veo-sdk 0.5.20 → 0.5.21
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/builder.mjs +1 -1
- package/dist/{chunk-ZPX6HCXZ.mjs → chunk-NLXUBRGF.mjs} +27 -2
- package/dist/chunk-NLXUBRGF.mjs.map +1 -0
- package/dist/index.cjs +25 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/veo-guides.js +3 -3
- package/dist/veo-guides.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZPX6HCXZ.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { definePlugin, getPreviewToken, guidesPlugin, runPreviewMode } from './chunk-
|
|
2
|
-
export { definePlugin, guidesPlugin } from './chunk-
|
|
1
|
+
import { definePlugin, getPreviewToken, guidesPlugin, runPreviewMode } from './chunk-NLXUBRGF.mjs';
|
|
2
|
+
export { definePlugin, guidesPlugin } from './chunk-NLXUBRGF.mjs';
|
|
3
3
|
import { hasWindow, hasDocument, uuidv7, DEFAULT_AUTOCAPTURE_CONFIG, MAX_ANCESTORS, hasLocalStorage, hasNavigatorSendBeacon, ALWAYS_BLOCK_SELECTORS, buildSelectorPath, resolveBuilderToken, filterHumanClasses, PRIORITY_ATTRIBUTES, SENSITIVE_ATTRIBUTES, isBuilderMode, previewGuide, closeGuidePreview } from './chunk-UJWTFUJV.mjs';
|
|
4
4
|
export { closeGuidePreview, previewGuide } from './chunk-UJWTFUJV.mjs';
|
|
5
5
|
import './chunk-PTG3BTJE.mjs';
|
package/dist/veo-guides.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var veoGuides=(function(exports){'use strict';function wt(){return typeof window<"u"}function De(){return typeof document<"u"}var xt=["http:","https:"],Ct="data-veo-guide",St="veo:freq:";var kt="veo:walkthrough_state:";var Rt={shown:1,dismissed:2,completed:2};function It(o){return o.slice(-16)||"default"}var We=class{constructor(e){this.storageKey=`${St}${e}`,this.cache=this.load(),this.prune();}shouldFilter(e,t){if(t==="every_visit"||t==="always")return false;let n=this.cache.get(e);return n?t==="once"?true:t==="until_dismissed"?n.status==="dismissed"||n.status==="completed":t==="until_answered"?n.status==="completed":false:false}record(e,t){let n=this.cache.get(e);n&&Rt[t]<Rt[n.status]||(this.cache.set(e,{guideId:e,status:t,lastInteractionAt:Date.now()}),this.persist());}clear(){this.cache.clear(),this.persist();}snapshot(){return Array.from(this.cache.values())}prune(){let e=Date.now(),t=false;for(let[n,i]of this.cache)e-i.lastInteractionAt>7776e6&&(this.cache.delete(n),t=true);if(this.cache.size>500){let n=Array.from(this.cache.entries()).sort((r,s)=>r[1].lastInteractionAt-s[1].lastInteractionAt),i=this.cache.size-500;for(let r=0;r<i;r++){let s=n[r];s&&this.cache.delete(s[0]);}t=true;}t&&this.persist();}load(){if(typeof localStorage>"u")return new Map;try{let e=localStorage.getItem(this.storageKey);if(!e)return new Map;let t=JSON.parse(e);if(!Array.isArray(t))return new Map;let n=[];for(let i of t)if(i&&typeof i=="object"&&typeof i.guideId=="string"&&typeof i.lastInteractionAt=="number"&&["shown","dismissed","completed"].includes(i.status)){let r=i;n.push([r.guideId,r]);}return new Map(n)}catch{return new Map}}persist(){if(!(typeof localStorage>"u"))try{let e=JSON.stringify(Array.from(this.cache.values()));localStorage.setItem(this.storageKey,e);}catch{}}};var ze=class{constructor(e,t,n=false){this.apiUrl=e;this.apiKey=t;this.debug=n;}async resolve(e,t){let n=new URLSearchParams({endUserId:e,pageUrl:t}),i;try{i=await fetch(`${this.apiUrl}/v1/guides/resolve?${n.toString()}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(r){return this.debug&&console.error("[veo] guides resolve fetch failed:",r),[]}if(!i.ok)return this.debug&&console.warn("[veo] guides resolve HTTP",i.status),[];try{let r=await i.json();return Array.isArray(r.guides)?r.guides:[]}catch(r){return this.debug&&console.error("[veo] guides resolve parse failed:",r),[]}}async fetchById(e){let t;try{t=await fetch(`${this.apiUrl}/v1/guides/${encodeURIComponent(e)}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(n){return this.debug&&console.error("[veo] guides fetchById network failed:",n),null}if(!t.ok)return this.debug&&console.warn("[veo] guides fetchById HTTP",t.status),null;try{let n=await t.json();return typeof n.guideId!="string"||typeof n.guideName!="string"||typeof n.guideType!="string"||!Array.isArray(n.guideSteps)||!n.activationRules||typeof n.displayFrequency!="string"||typeof n.displayPriority!="number"?(this.debug&&console.warn("[veo] guides fetchById: unexpected shape"),null):{guideId:n.guideId,guideName:n.guideName,guideType:n.guideType,guideSteps:n.guideSteps,activationRules:n.activationRules,displayFrequency:n.displayFrequency,displayPriority:n.displayPriority}}catch(n){return this.debug&&console.error("[veo] guides fetchById parse failed:",n),null}}};function Tt(o){let e={endUserId:o.endUserId,interactionType:o.action};return o.sessionId&&(e.sessionId=o.sessionId),typeof o.stepIndex=="number"&&(e.stepPosition=o.stepIndex),o.pageUrl&&(e.pageUrl=o.pageUrl),o.pagePath&&(e.pagePath=o.pagePath),o.metadata&&(e.metadata=o.metadata),e}var Ue=class{constructor(e,t){this.apiUrl=e;this.apiKey=t;}async send(e){let t=this.buildUrl(e.guideId),n=await fetch(t,{method:"POST",headers:{"X-Api-Key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(Tt(e.payload)),credentials:"omit"});if(!n.ok)throw new Error(`guide interaction send failed: HTTP ${n.status}`)}sendBeacon(e){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function")return false;let t=`${this.buildUrl(e.guideId)}?key=${encodeURIComponent(this.apiKey)}`,n=new Blob([JSON.stringify(Tt(e.payload))],{type:"application/json"});try{return navigator.sendBeacon(t,n)}catch{return false}}buildUrl(e){return `${this.apiUrl}/v1/guides/${encodeURIComponent(e)}/interactions`}};var Ke=class{constructor(e){this.config=e;this.buffer=[];this.timer=null;this.flushing=false;this.unloadCleanup=null;this.startTimer(),this.installUnloadHandler();}get size(){return this.buffer.length}enqueue(e){this.buffer.push({guideId:e.guideId,payload:e.payload,attempts:0,enqueuedAt:Date.now()}),this.buffer.length>=this.config.batchSize&&this.flush();}async flush(){if(this.flushing||this.buffer.length===0)return;let e=Date.now(),t=this.buffer.filter(r=>(r.nextRetryAt??0)<=e);if(t.length===0)return;this.flushing=true;let n=new Set(t);this.buffer=this.buffer.filter(r=>!n.has(r));let i=await Promise.allSettled(t.map(r=>this.config.client.send({guideId:r.guideId,payload:r.payload})));for(let r=0;r<i.length;r++){let s=i[r],a=t[r];!s||!a||s.status!=="fulfilled"&&(a.attempts+=1,a.attempts<this.config.maxRetries?(a.nextRetryAt=Date.now()+this.retryDelayMs(a.attempts),this.buffer.push(a)):this.safeOnError(s.reason,a));}this.flushing=false;}retryDelayMs(e){let t=Math.min(3e3*2**(e-1),3e4);return t/2+Math.random()*(t/2)}flushBeacon(){if(this.buffer.length===0)return;let e=this.buffer.splice(0,this.buffer.length);for(let t of e)this.config.client.sendBeacon({guideId:t.guideId,payload:t.payload});}destroy(){this.timer&&clearInterval(this.timer),this.timer=null,this.unloadCleanup?.(),this.unloadCleanup=null;}startTimer(){typeof window>"u"||(this.timer=setInterval(()=>{this.flush();},this.config.flushIntervalMs));}installUnloadHandler(){if(typeof window>"u")return;let e=()=>this.flushBeacon(),t=()=>{document.visibilityState==="hidden"&&this.flushBeacon();};window.addEventListener("pagehide",e),window.addEventListener("visibilitychange",t),this.unloadCleanup=()=>{window.removeEventListener("pagehide",e),window.removeEventListener("visibilitychange",t);};}safeOnError(e,t){if(!this.config.onError)return;let n=e instanceof Error?e:new Error(String(e));try{this.config.onError(n,t);}catch{}}};var ae=Math.min,J=Math.max,Oe=Math.round;var B=o=>({x:o,y:o}),Rn={left:"right",right:"left",bottom:"top",top:"bottom"};function je(o,e,t){return J(o,ae(e,t))}function ge(o,e){return typeof o=="function"?o(e):o}function Z(o){return o.split("-")[0]}function ve(o){return o.split("-")[1]}function ct(o){return o==="x"?"y":"x"}function Ve(o){return o==="y"?"height":"width"}function Y(o){let e=o[0];return e==="t"||e==="b"?"y":"x"}function Ye(o){return ct(Y(o))}function Lt(o,e,t){t===void 0&&(t=false);let n=ve(o),i=Ye(o),r=Ve(i),s=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=Me(s)),[s,Me(s)]}function Gt(o){let e=Me(o);return [qe(o),e,qe(e)]}function qe(o){return o.includes("start")?o.replace("start","end"):o.replace("end","start")}var Pt=["left","right"],At=["right","left"],In=["top","bottom"],Tn=["bottom","top"];function Pn(o,e,t){switch(o){case "top":case "bottom":return t?e?At:Pt:e?Pt:At;case "left":case "right":return e?In:Tn;default:return []}}function Nt(o,e,t,n){let i=ve(o),r=Pn(Z(o),t==="start",n);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(qe)))),r}function Me(o){let e=Z(o);return Rn[e]+o.slice(e.length)}function An(o){return {top:0,right:0,bottom:0,left:0,...o}}function ut(o){return typeof o!="number"?An(o):{top:o,right:o,bottom:o,left:o}}function le(o){let{x:e,y:t,width:n,height:i}=o;return {width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function Mt(o,e,t){let{reference:n,floating:i}=o,r=Y(e),s=Ye(e),a=Ve(s),l=Z(e),d=r==="y",c=n.x+n.width/2-i.width/2,p=n.y+n.height/2-i.height/2,m=n[a]/2-i[a]/2,u;switch(l){case "top":u={x:c,y:n.y-i.height};break;case "bottom":u={x:c,y:n.y+n.height};break;case "right":u={x:n.x+n.width,y:p};break;case "left":u={x:n.x-i.width,y:p};break;default:u={x:n.x,y:n.y};}switch(ve(e)){case "start":u[s]-=m*(t&&d?-1:1);break;case "end":u[s]+=m*(t&&d?-1:1);break}return u}async function Ot(o,e){var t;e===void 0&&(e={});let{x:n,y:i,platform:r,rects:s,elements:a,strategy:l}=o,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:p="floating",altBoundary:m=false,padding:u=0}=ge(e,o),f=ut(u),g=a[m?p==="floating"?"reference":"floating":p],v=le(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(g)))==null||t?g:g.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:d,rootBoundary:c,strategy:l})),b=p==="floating"?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,x=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),y=await(r.isElement==null?void 0:r.isElement(x))?await(r.getScale==null?void 0:r.getScale(x))||{x:1,y:1}:{x:1,y:1},C=le(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:x,strategy:l}):b);return {top:(v.top-C.top+f.top)/y.y,bottom:(C.bottom-v.bottom+f.bottom)/y.y,left:(v.left-C.left+f.left)/y.x,right:(C.right-v.right+f.right)/y.x}}var Ln=50,_t=async(o,e,t)=>{let{placement:n="bottom",strategy:i="absolute",middleware:r=[],platform:s}=t,a=s.detectOverflow?s:{...s,detectOverflow:Ot},l=await(s.isRTL==null?void 0:s.isRTL(e)),d=await s.getElementRects({reference:o,floating:e,strategy:i}),{x:c,y:p}=Mt(d,n,l),m=n,u=0,f={};for(let h=0;h<r.length;h++){let g=r[h];if(!g)continue;let{name:v,fn:b}=g,{x,y,data:C,reset:S}=await b({x:c,y:p,initialPlacement:n,placement:m,strategy:i,middlewareData:f,rects:d,platform:a,elements:{reference:o,floating:e}});c=x??c,p=y??p,f[v]={...f[v],...C},S&&u<Ln&&(u++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(d=S.rects===true?await s.getElementRects({reference:o,floating:e,strategy:i}):S.rects),{x:c,y:p}=Mt(d,m,l)),h=-1);}return {x:c,y:p,placement:m,strategy:i,middlewareData:f}},Bt=o=>({name:"arrow",options:o,async fn(e){let{x:t,y:n,placement:i,rects:r,platform:s,elements:a,middlewareData:l}=e,{element:d,padding:c=0}=ge(o,e)||{};if(d==null)return {};let p=ut(c),m={x:t,y:n},u=Ye(i),f=Ve(u),h=await s.getDimensions(d),g=u==="y",v=g?"top":"left",b=g?"bottom":"right",x=g?"clientHeight":"clientWidth",y=r.reference[f]+r.reference[u]-m[u]-r.floating[f],C=m[u]-r.reference[u],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d)),q=S?S[x]:0;(!q||!await(s.isElement==null?void 0:s.isElement(S)))&&(q=a.floating[x]||r.floating[f]);let Le=y/2-C/2,ie=q/2-h[f]/2-1,j=ae(p[v],ie),Ge=ae(p[b],ie),re=j,Ne=q-h[f]-Ge,E=q/2-h[f]/2+Le,se=je(re,E,Ne),V=!l.arrow&&ve(i)!=null&&E!==se&&r.reference[f]/2-(E<re?j:Ge)-h[f]/2<0,O=V?E<re?E-re:E-Ne:0;return {[u]:m[u]+O,data:{[u]:se,centerOffset:E-se-O,...V&&{alignmentOffset:O}},reset:V}}});var Ft=function(o){return o===void 0&&(o={}),{name:"flip",options:o,async fn(e){var t,n;let{placement:i,middlewareData:r,rects:s,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:c=true,crossAxis:p=true,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:h=true,...g}=ge(o,e);if((t=r.arrow)!=null&&t.alignmentOffset)return {};let v=Z(i),b=Y(a),x=Z(a)===a,y=await(l.isRTL==null?void 0:l.isRTL(d.floating)),C=m||(x||!h?[Me(a)]:Gt(a)),S=f!=="none";!m&&S&&C.push(...Nt(a,h,f,y));let q=[a,...C],Le=await l.detectOverflow(e,g),ie=[],j=((n=r.flip)==null?void 0:n.overflows)||[];if(c&&ie.push(Le[v]),p){let E=Lt(i,s,y);ie.push(Le[E[0]],Le[E[1]]);}if(j=[...j,{placement:i,overflows:ie}],!ie.every(E=>E<=0)){var Ge,re;let E=(((Ge=r.flip)==null?void 0:Ge.index)||0)+1,se=q[E];if(se&&(!(p==="alignment"?b!==Y(se):false)||j.every(_=>Y(_.placement)===b?_.overflows[0]>0:true)))return {data:{index:E,overflows:j},reset:{placement:se}};let V=(re=j.filter(O=>O.overflows[0]<=0).sort((O,_)=>O.overflows[1]-_.overflows[1])[0])==null?void 0:re.placement;if(!V)switch(u){case "bestFit":{var Ne;let O=(Ne=j.filter(_=>{if(S){let Q=Y(_.placement);return Q===b||Q==="y"}return true}).map(_=>[_.placement,_.overflows.filter(Q=>Q>0).reduce((Q,kn)=>Q+kn,0)]).sort((_,Q)=>_[1]-Q[1])[0])==null?void 0:Ne[0];O&&(V=O);break}case "initialPlacement":V=a;break}if(i!==V)return {reset:{placement:V}}}return {}}}};var Gn=new Set(["left","top"]);async function Nn(o,e){let{placement:t,platform:n,elements:i}=o,r=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=Z(t),a=ve(t),l=Y(t)==="y",d=Gn.has(s)?-1:1,c=r&&l?-1:1,p=ge(e,o),{mainAxis:m,crossAxis:u,alignmentAxis:f}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof f=="number"&&(u=a==="end"?f*-1:f),l?{x:u*c,y:m*d}:{x:m*d,y:u*c}}var $t=function(o){return o===void 0&&(o=0),{name:"offset",options:o,async fn(e){var t,n;let{x:i,y:r,placement:s,middlewareData:a}=e,l=await Nn(e,o);return s===((t=a.offset)==null?void 0:t.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:s}}}}},Ht=function(o){return o===void 0&&(o={}),{name:"shift",options:o,async fn(e){let{x:t,y:n,placement:i,platform:r}=e,{mainAxis:s=true,crossAxis:a=false,limiter:l={fn:v=>{let{x:b,y:x}=v;return {x:b,y:x}}},...d}=ge(o,e),c={x:t,y:n},p=await r.detectOverflow(e,d),m=Y(Z(i)),u=ct(m),f=c[u],h=c[m];if(s){let v=u==="y"?"top":"left",b=u==="y"?"bottom":"right",x=f+p[v],y=f-p[b];f=je(x,f,y);}if(a){let v=m==="y"?"top":"left",b=m==="y"?"bottom":"right",x=h+p[v],y=h-p[b];h=je(x,h,y);}let g=l.fn({...e,[u]:f,[m]:h});return {...g,data:{x:g.x-t,y:g.y-n,enabled:{[u]:s,[m]:a}}}}}};function Qe(){return typeof window<"u"}function ce(o){return Wt(o)?(o.nodeName||"").toLowerCase():"#document"}function T(o){var e;return (o==null||(e=o.ownerDocument)==null?void 0:e.defaultView)||window}function F(o){var e;return (e=(Wt(o)?o.ownerDocument:o.document)||window.document)==null?void 0:e.documentElement}function Wt(o){return Qe()?o instanceof Node||o instanceof T(o).Node:false}function L(o){return Qe()?o instanceof Element||o instanceof T(o).Element:false}function $(o){return Qe()?o instanceof HTMLElement||o instanceof T(o).HTMLElement:false}function Dt(o){return !Qe()||typeof ShadowRoot>"u"?false:o instanceof ShadowRoot||o instanceof T(o).ShadowRoot}function ye(o){let{overflow:e,overflowX:t,overflowY:n,display:i}=G(o);return /auto|scroll|overlay|hidden|clip/.test(e+n+t)&&i!=="inline"&&i!=="contents"}function zt(o){return /^(table|td|th)$/.test(ce(o))}function _e(o){try{if(o.matches(":popover-open"))return !0}catch{}try{return o.matches(":modal")}catch{return false}}var Mn=/transform|translate|scale|rotate|perspective|filter/,On=/paint|layout|strict|content/,de=o=>!!o&&o!=="none",pt;function Je(o){let e=L(o)?G(o):o;return de(e.transform)||de(e.translate)||de(e.scale)||de(e.rotate)||de(e.perspective)||!Ze()&&(de(e.backdropFilter)||de(e.filter))||Mn.test(e.willChange||"")||On.test(e.contain||"")}function Ut(o){let e=X(o);for(;$(e)&&!ue(e);){if(Je(e))return e;if(_e(e))return null;e=X(e);}return null}function Ze(){return pt==null&&(pt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),pt}function ue(o){return /^(html|body|#document)$/.test(ce(o))}function G(o){return T(o).getComputedStyle(o)}function Be(o){return L(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:{scrollLeft:o.scrollX,scrollTop:o.scrollY}}function X(o){if(ce(o)==="html")return o;let e=o.assignedSlot||o.parentNode||Dt(o)&&o.host||F(o);return Dt(e)?e.host:e}function Kt(o){let e=X(o);return ue(e)?o.ownerDocument?o.ownerDocument.body:o.body:$(e)&&ye(e)?e:Kt(e)}function Xe(o,e,t){var n;e===void 0&&(e=[]);let i=Kt(o),r=i===((n=o.ownerDocument)==null?void 0:n.body),s=T(i);if(r){et(s);return e.concat(s,s.visualViewport||[],ye(i)?i:[],[])}else return e.concat(i,Xe(i,[]))}function et(o){return o.parent&&Object.getPrototypeOf(o.parent)?o.frameElement:null}function Yt(o){let e=G(o),t=parseFloat(e.width)||0,n=parseFloat(e.height)||0,i=$(o),r=i?o.offsetWidth:t,s=i?o.offsetHeight:n,a=Oe(t)!==r||Oe(n)!==s;return a&&(t=r,n=s),{width:t,height:n,$:a}}function Xt(o){return L(o)?o:o.contextElement}function be(o){let e=Xt(o);if(!$(e))return B(1);let t=e.getBoundingClientRect(),{width:n,height:i,$:r}=Yt(e),s=(r?Oe(t.width):t.width)/n,a=(r?Oe(t.height):t.height)/i;return (!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var _n=B(0);function Qt(o){let e=T(o);return !Ze()||!e.visualViewport?_n:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Bn(o,e,t){return e===void 0&&(e=false),!t||e&&t!==T(o)?false:e}function Fe(o,e,t,n){e===void 0&&(e=false),t===void 0&&(t=false);let i=o.getBoundingClientRect(),r=Xt(o),s=B(1);e&&(n?L(n)&&(s=be(n)):s=be(o));let a=Bn(r,t,n)?Qt(r):B(0),l=(i.left+a.x)/s.x,d=(i.top+a.y)/s.y,c=i.width/s.x,p=i.height/s.y;if(r){let m=T(r),u=n&&L(n)?T(n):n,f=m,h=et(f);for(;h&&n&&u!==f;){let g=be(h),v=h.getBoundingClientRect(),b=G(h),x=v.left+(h.clientLeft+parseFloat(b.paddingLeft))*g.x,y=v.top+(h.clientTop+parseFloat(b.paddingTop))*g.y;l*=g.x,d*=g.y,c*=g.x,p*=g.y,l+=x,d+=y,f=T(h),h=et(f);}}return le({width:c,height:p,x:l,y:d})}function tt(o,e){let t=Be(o).scrollLeft;return e?e.left+t:Fe(F(o)).left+t}function Jt(o,e){let t=o.getBoundingClientRect(),n=t.left+e.scrollLeft-tt(o,t),i=t.top+e.scrollTop;return {x:n,y:i}}function Fn(o){let{elements:e,rect:t,offsetParent:n,strategy:i}=o,r=i==="fixed",s=F(n),a=e?_e(e.floating):false;if(n===s||a&&r)return t;let l={scrollLeft:0,scrollTop:0},d=B(1),c=B(0),p=$(n);if((p||!p&&!r)&&((ce(n)!=="body"||ye(s))&&(l=Be(n)),p)){let u=Fe(n);d=be(n),c.x=u.x+n.clientLeft,c.y=u.y+n.clientTop;}let m=s&&!p&&!r?Jt(s,l):B(0);return {width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+c.x+m.x,y:t.y*d.y-l.scrollTop*d.y+c.y+m.y}}function $n(o){return Array.from(o.getClientRects())}function Hn(o){let e=F(o),t=Be(o),n=o.ownerDocument.body,i=J(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=J(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),s=-t.scrollLeft+tt(o),a=-t.scrollTop;return G(n).direction==="rtl"&&(s+=J(e.clientWidth,n.clientWidth)-i),{width:i,height:r,x:s,y:a}}var qt=25;function Dn(o,e){let t=T(o),n=F(o),i=t.visualViewport,r=n.clientWidth,s=n.clientHeight,a=0,l=0;if(i){r=i.width,s=i.height;let c=Ze();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop);}let d=tt(n);if(d<=0){let c=n.ownerDocument,p=c.body,m=getComputedStyle(p),u=c.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,f=Math.abs(n.clientWidth-p.clientWidth-u);f<=qt&&(r-=f);}else d<=qt&&(r+=d);return {width:r,height:s,x:a,y:l}}function Wn(o,e){let t=Fe(o,true,e==="fixed"),n=t.top+o.clientTop,i=t.left+o.clientLeft,r=$(o)?be(o):B(1),s=o.clientWidth*r.x,a=o.clientHeight*r.y,l=i*r.x,d=n*r.y;return {width:s,height:a,x:l,y:d}}function jt(o,e,t){let n;if(e==="viewport")n=Dn(o,t);else if(e==="document")n=Hn(F(o));else if(L(e))n=Wn(e,t);else {let i=Qt(o);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height};}return le(n)}function Zt(o,e){let t=X(o);return t===e||!L(t)||ue(t)?false:G(t).position==="fixed"||Zt(t,e)}function zn(o,e){let t=e.get(o);if(t)return t;let n=Xe(o,[]).filter(a=>L(a)&&ce(a)!=="body"),i=null,r=G(o).position==="fixed",s=r?X(o):o;for(;L(s)&&!ue(s);){let a=G(s),l=Je(s);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ye(s)&&!l&&Zt(o,s))?n=n.filter(c=>c!==s):i=a,s=X(s);}return e.set(o,n),n}function Un(o){let{element:e,boundary:t,rootBoundary:n,strategy:i}=o,s=[...t==="clippingAncestors"?_e(e)?[]:zn(e,this._c):[].concat(t),n],a=jt(e,s[0],i),l=a.top,d=a.right,c=a.bottom,p=a.left;for(let m=1;m<s.length;m++){let u=jt(e,s[m],i);l=J(u.top,l),d=ae(u.right,d),c=ae(u.bottom,c),p=J(u.left,p);}return {width:d-p,height:c-l,x:p,y:l}}function Kn(o){let{width:e,height:t}=Yt(o);return {width:e,height:t}}function qn(o,e,t){let n=$(e),i=F(e),r=t==="fixed",s=Fe(o,true,r,e),a={scrollLeft:0,scrollTop:0},l=B(0);function d(){l.x=tt(i);}if(n||!n&&!r)if((ce(e)!=="body"||ye(i))&&(a=Be(e)),n){let u=Fe(e,true,r,e);l.x=u.x+e.clientLeft,l.y=u.y+e.clientTop;}else i&&d();r&&!n&&i&&d();let c=i&&!n&&!r?Jt(i,a):B(0),p=s.left+a.scrollLeft-l.x-c.x,m=s.top+a.scrollTop-l.y-c.y;return {x:p,y:m,width:s.width,height:s.height}}function ft(o){return G(o).position==="static"}function Vt(o,e){if(!$(o)||G(o).position==="fixed")return null;if(e)return e(o);let t=o.offsetParent;return F(o)===t&&(t=t.ownerDocument.body),t}function en(o,e){let t=T(o);if(_e(o))return t;if(!$(o)){let i=X(o);for(;i&&!ue(i);){if(L(i)&&!ft(i))return i;i=X(i);}return t}let n=Vt(o,e);for(;n&&zt(n)&&ft(n);)n=Vt(n,e);return n&&ue(n)&&ft(n)&&!Je(n)?t:n||Ut(o)||t}var jn=async function(o){let e=this.getOffsetParent||en,t=this.getDimensions,n=await t(o.floating);return {reference:qn(o.reference,await e(o.floating),o.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Vn(o){return G(o).direction==="rtl"}var Yn={convertOffsetParentRelativeRectToViewportRelativeRect:Fn,getDocumentElement:F,getClippingRect:Un,getOffsetParent:en,getElementRects:jn,getClientRects:$n,getDimensions:Kn,getScale:be,isElement:L,isRTL:Vn};var H=$t;var D=Ht,W=Ft;var ee=Bt;var z=(o,e,t)=>{let n=new Map,i={platform:Yn,...t},r={...i.platform,_c:n};return _t(o,e,{...i,platform:r})};var Xn={P:"p",BR:"br",STRONG:"strong",B:"strong",EM:"em",I:"em",U:"u",S:"s",UL:"ul",OL:"ol",LI:"li",A:"a"},Qn=new Set(["SCRIPT","STYLE","TEMPLATE","IFRAME","OBJECT","EMBED","NOSCRIPT","TITLE","TEXTAREA","SELECT","SVG","MATH"]),tn=16*1024,Jn=20,Zn=1e3;function nn(o,e){let t=e.createDocumentFragment();if(typeof o!="string"||o.length===0)return t;let n;try{n=new DOMParser().parseFromString(o.length>tn?o.slice(0,tn):o,"text/html");}catch{return t.appendChild(e.createTextNode(o)),t}let i={nodes:0,exceeded:false};for(let r of Array.from(n.body.childNodes)){let s=$e(r,e,0,i);s&&t.appendChild(s);}if(i.exceeded){let r=e.createDocumentFragment();return r.appendChild(e.createTextNode(n.body.textContent??"")),r}return t}function $e(o,e,t,n){if(n.exceeded)return null;if(++n.nodes>Zn||t>Jn)return n.exceeded=true,null;if(o.nodeType===Node.TEXT_NODE)return e.createTextNode(o.textContent??"");if(o.nodeType!==Node.ELEMENT_NODE)return null;let i=o;if(Qn.has(i.tagName))return null;let r=Xn[i.tagName];if(!r){let a=e.createDocumentFragment();for(let l of Array.from(i.childNodes)){let d=$e(l,e,t+1,n);d&&a.appendChild(d);}return a}if(r==="a"){let a=i.getAttribute("href")??"";if(!R(a)){let d=e.createDocumentFragment();for(let c of Array.from(i.childNodes)){let p=$e(c,e,t+1,n);p&&d.appendChild(p);}return d}let l=e.createElement("a");l.setAttribute("href",a),l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer nofollow");for(let d of Array.from(i.childNodes)){let c=$e(d,e,t+1,n);c&&l.appendChild(c);}return l}let s=e.createElement(r);for(let a of Array.from(i.childNodes)){let l=$e(a,e,t+1,n);l&&s.appendChild(l);}return s}function P(o,e,t){let n=e.createElement("div");n.className="veo-guide-content";let i=rn(o);return i?to(n,i,e,t):eo(n,o,e,t),n.appendChild(pe(e,()=>t.onDismiss())),n}function on(o,e){let t=rn(o);if(t){let i=[];for(let{block:r,idx:s}of t){if(r.type==="button")continue;let a=nt(r,e);a&&(a.dataset.veoIdx=String(s),i.push(a));}return i}let n=[];if(typeof o.imageUrl=="string"&&o.imageUrl&&R(o.imageUrl)){let i=e.createElement("img");i.className="veo-guide-image",i.src=o.imageUrl,i.alt=typeof o.title=="string"?o.title:"",n.push(i);}if(typeof o.title=="string"&&o.title){let i=e.createElement("h2");i.className="veo-guide-title",i.textContent=o.title,n.push(i);}if(typeof o.content=="string"&&o.content){let i=e.createElement("p");i.className="veo-guide-text",i.textContent=o.content,n.push(i);}return n}function eo(o,e,t,n){if(typeof e.imageUrl=="string"&&e.imageUrl&&R(e.imageUrl)){let r=t.createElement("img");r.className="veo-guide-image",r.src=e.imageUrl,r.alt=typeof e.title=="string"?e.title:"",o.appendChild(r);}if(typeof e.title=="string"&&e.title){let r=t.createElement("h2");r.className="veo-guide-title",r.textContent=e.title,o.appendChild(r);}if(typeof e.content=="string"&&e.content){let r=t.createElement("p");r.className="veo-guide-text",r.textContent=e.content,o.appendChild(r);}let i=t.createElement("div");if(i.className="veo-guide-actions",typeof e.ctaText=="string"&&e.ctaText){let r=t.createElement("button");r.type="button",r.className="veo-guide-cta",r.textContent=e.ctaText,r.addEventListener("click",()=>{let s=e.ctaAction??"dismiss",a=oo(e);n.onCtaClick(s,a);}),i.appendChild(r);}o.appendChild(i);}function rn(o){if(!Array.isArray(o.blocks)||o.blocks.length===0)return null;let e=o.blocks.map((t,n)=>({block:t,idx:n})).filter(t=>{let n=t.block;return !n||typeof n!="object"?false:n.type==="image"?typeof n.url=="string"&&R(n.url):n.type==="title"||n.type==="text"||n.type==="button"});return e.length>0?e:null}function to(o,e,t,n){let i=0;for(;i<e.length;){let r=e[i];if(r?.block.type==="button"){let a=t.createElement("div");a.className="veo-guide-actions",a.dataset.veoIdx=String(r.idx);let l;for(;i<e.length&&e[i]?.block.type==="button";){let d=e[i].block;if(!l){let c=d.style?.align;(c==="left"||c==="center"||c==="right")&&(l=c);}a.appendChild(no(d,t,n)),i++;}l&&(a.style.justifyContent=sn[l]),o.appendChild(a);continue}let s=r?nt(r.block,t):null;s&&r&&(s.dataset.veoIdx=String(r.idx),o.appendChild(s)),i++;}}function nt(o,e){switch(o.type){case "title":{let t=e.createElement("h2");return t.className="veo-guide-title",t.textContent=typeof o.text=="string"?o.text:"",we(t,o.style,"text"),t}case "text":{let t=e.createElement("div");return t.className="veo-guide-text",typeof o.html=="string"&&o.html?t.appendChild(nn(o.html,e)):t.textContent=typeof o.text=="string"?o.text:"",we(t,o.style,"text"),t}case "image":{if(typeof o.url!="string"||!R(o.url))return null;let t=e.createElement("img");return t.className="veo-guide-image",t.src=o.url,t.alt="",we(t,o.style,"image"),t}default:return null}}function no(o,e,t){let n=e.createElement("button");return n.type="button",n.className="veo-guide-cta",n.textContent=typeof o.text=="string"&&o.text?o.text:"OK",we(n,o.style,"button"),n.addEventListener("click",()=>{let i=o.action??"dismiss",r=i==="next"||i==="url"||i==="guide"?i:"dismiss",s=r==="url"&&typeof o.url=="string"&&R(o.url)?o.url:r==="guide"&&typeof o.targetGuideId=="string"&&o.targetGuideId?o.targetGuideId:void 0,a={...typeof o.id=="string"&&o.id?{buttonId:o.id}:{},...typeof o.text=="string"&&o.text?{buttonText:o.text}:{}};t.onCtaClick(r,s,Object.keys(a).length?a:void 0);}),n}var sn={left:"flex-start",center:"center",right:"flex-end"};function N(o,e,t){return Math.min(t,Math.max(e,o))}function we(o,e,t){if(!e||typeof e!="object")return;let n=e;if(t==="image"&&n.bleed===true){o.classList.add("veo-guide-image--bleed");return}let i=typeof n.align=="string"?n.align:null;if(i&&(i==="left"||i==="center"||i==="right")&&(t==="text"?o.style.textAlign=i:t==="image"&&(o.style.alignSelf=sn[i])),t!=="image"&&typeof n.color=="string"&&(o.style.color=n.color),t==="text"&&typeof n.fontSize=="number"&&Number.isFinite(n.fontSize)&&(o.style.fontSize=`${N(n.fontSize,8,72)}px`),t==="image"&&typeof n.width=="number"&&Number.isFinite(n.width)&&(o.style.width=`${N(n.width,10,100)}%`),t==="image"&&typeof n.radius=="number"&&Number.isFinite(n.radius)&&(o.style.borderRadius=`${N(n.radius,0,48)}px`),typeof n.marginTop=="number"&&Number.isFinite(n.marginTop)&&(o.style.marginTop=`${N(n.marginTop,0,64)}px`),typeof n.marginBottom=="number"&&Number.isFinite(n.marginBottom)&&(o.style.marginBottom=`${N(n.marginBottom,0,64)}px`),t!=="image"&&(typeof n.fontSize=="number"&&Number.isFinite(n.fontSize)&&(o.style.fontSize=`${N(n.fontSize,8,96)}px`),typeof n.fontFamily=="string"&&n.fontFamily&&n.fontFamily!=="inherit"&&(o.style.fontFamily=n.fontFamily),typeof n.fontWeight=="string"&&n.fontWeight&&(o.style.fontWeight=n.fontWeight),typeof n.textTransform=="string"&&n.textTransform&&n.textTransform!=="none"&&(o.style.textTransform=n.textTransform),typeof n.lineHeight=="number"&&Number.isFinite(n.lineHeight)&&(o.style.lineHeight=`${N(n.lineHeight,50,300)}%`),typeof n.letterSpacing=="number"&&Number.isFinite(n.letterSpacing)&&(o.style.letterSpacing=`${N(n.letterSpacing,-5,20)}px`)),typeof n.background=="string"&&n.background&&(o.style.background=n.background),typeof n.borderWidth=="number"&&n.borderWidth>0){let r=typeof n.borderColor=="string"&&n.borderColor?n.borderColor:"#bbbbbb";o.style.border=`${N(n.borderWidth,0,20)}px solid ${r}`;}t!=="image"&&typeof n.radius=="number"&&Number.isFinite(n.radius)&&(o.style.borderRadius=`${N(n.radius,0,64)}px`);for(let r of ["Top","Right","Bottom","Left"]){let s=n[`padding${r}`];typeof s=="number"&&Number.isFinite(s)&&o.style.setProperty(`padding-${r.toLowerCase()}`,`${N(s,0,128)}px`);let a=n[`margin${r}`];typeof a=="number"&&Number.isFinite(a)&&o.style.setProperty(`margin-${r.toLowerCase()}`,`${N(a,0,128)}px`);}}function pe(o,e,t="veo-guide-close"){let n=o.createElement("button");return n.type="button",n.className=t,n.setAttribute("aria-label","Cerrar"),n.textContent="\xD7",n.addEventListener("click",e),n}function R(o){if(typeof o!="string"||o.length===0)return false;try{let e=typeof window<"u"?window.location.href:"http://localhost/",t=new URL(o,e);return xt.includes(t.protocol)}catch{return false}}function oo(o){let e=o.style?.ctaUrl;if(typeof e=="string")return R(e)?e:void 0}var io={"--veo-bg":"#1f2937","--veo-text":"#f9fafb","--veo-text-secondary":"#d1d5db","--veo-shadow":"0 20px 60px rgba(0, 0, 0, 0.55)"},ht={left:"flex-start",center:"center",right:"flex-end"},ro={left:"flex-start",center:"center",right:"flex-end"},so={title:"text",text:"text",image:"self"},an={none:"none",soft:"0 4px 14px rgba(0, 0, 0, 0.10)",medium:"0 8px 30px rgba(0, 0, 0, 0.18)",strong:"0 24px 60px rgba(0, 0, 0, 0.32)"},ln={center:[.5,.5],top:[.5,0],bottom:[.5,1],left:[0,.5],right:[1,.5],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},U=/^#[0-9a-f]{3,8}$|^(rgb|rgba|hsl|hsla)\([\d.,%/\sdeg]+\)$|^[a-z]{3,20}$/i;function I(o,e,t){return Math.min(t,Math.max(e,o))}function dn(o,e){if(!e||typeof e!="object")return;let t=e;if(typeof t.accentColor=="string"&&U.test(t.accentColor.trim())&&o.style.setProperty("--veo-primary",t.accentColor.trim()),typeof t.fontFamily=="string"&&t.fontFamily.length<=200&&!/[<>{}]/.test(t.fontFamily)&&o.style.setProperty("--veo-font",t.fontFamily.trim()),t.theme==="dark")for(let[r,s]of Object.entries(io))o.style.setProperty(r,s);typeof t.background=="string"&&U.test(t.background.trim())&&o.style.setProperty("--veo-bg",t.background.trim()),typeof t.textColor=="string"&&U.test(t.textColor.trim())&&o.style.setProperty("--veo-text",t.textColor.trim()),typeof t.textSecondaryColor=="string"&&U.test(t.textSecondaryColor.trim())&&o.style.setProperty("--veo-text-secondary",t.textSecondaryColor.trim()),typeof t.radius=="number"&&Number.isFinite(t.radius)&&o.style.setProperty("--veo-radius",`${I(t.radius,0,48)}px`),typeof t.width=="number"&&Number.isFinite(t.width)&&o.style.setProperty("--veo-width",`${I(t.width,220,720)}px`),typeof t.height=="number"&&Number.isFinite(t.height)&&o.style.setProperty("--veo-min-h",`${I(t.height,120,900)}px`),(t.align==="left"||t.align==="center"||t.align==="right")&&o.style.setProperty("--veo-actions-justify",ht[t.align]),typeof t.padding=="number"&&Number.isFinite(t.padding)&&o.style.setProperty("--veo-pad",`${I(t.padding,0,64)}px`),typeof t.margin=="number"&&Number.isFinite(t.margin)&&o.style.setProperty("--veo-margin",`${I(t.margin,0,64)}px`),typeof t.borderWidth=="number"&&Number.isFinite(t.borderWidth)&&o.style.setProperty("--veo-border-width",`${I(t.borderWidth,0,16)}px`),typeof t.borderColor=="string"&&U.test(t.borderColor.trim())&&o.style.setProperty("--veo-border-color",t.borderColor.trim()),typeof t.shadow=="string"&&an[t.shadow]&&o.style.setProperty("--veo-shadow",an[t.shadow]);let n,i;if(typeof t.posX=="number"&&typeof t.posY=="number"?(n=I(t.posX,0,1),i=I(t.posY,0,1)):typeof t.overlayPosition=="string"&&ln[t.overlayPosition]&&([n,i]=ln[t.overlayPosition]),n!==void 0&&i!==void 0&&(o.style.setProperty("--veo-pos-x",`${n*100}%`),o.style.setProperty("--veo-pos-y",`${i*100}%`)),t.elements&&typeof t.elements=="object"){let r=t.elements;mt(o,"title",r.title),mt(o,"text",r.text),mt(o,"image",r.image),ao(o,r.cta);}}function ao(o,e){if(!e||typeof e!="object")return;let t=e;typeof t.align=="string"&&ht[t.align]&&o.style.setProperty("--veo-actions-justify",ht[t.align]),typeof t.background=="string"&&U.test(t.background.trim())&&o.style.setProperty("--veo-cta-bg",t.background.trim()),typeof t.color=="string"&&U.test(t.color.trim())&&o.style.setProperty("--veo-cta-color",t.color.trim()),typeof t.fontSize=="number"&&Number.isFinite(t.fontSize)&&o.style.setProperty("--veo-cta-size",`${I(t.fontSize,10,24)}px`),typeof t.radius=="number"&&Number.isFinite(t.radius)&&o.style.setProperty("--veo-cta-radius",`${I(t.radius,0,48)}px`);}function mt(o,e,t){if(!t||typeof t!="object")return;let n=t;if(typeof n.align=="string"&&(n.align==="left"||n.align==="center"||n.align==="right")){let r=(so[e]??"text")==="self"?ro[n.align]:n.align;o.style.setProperty(`--veo-${e}-align`,r);}typeof n.color=="string"&&U.test(n.color.trim())&&o.style.setProperty(`--veo-${e}-color`,n.color.trim()),typeof n.fontSize=="number"&&Number.isFinite(n.fontSize)&&o.style.setProperty(`--veo-${e}-size`,`${I(n.fontSize,8,72)}px`),typeof n.width=="number"&&Number.isFinite(n.width)&&o.style.setProperty(`--veo-${e}-width`,`${I(n.width,10,100)}%`),typeof n.radius=="number"&&Number.isFinite(n.radius)&&o.style.setProperty(`--veo-${e}-radius`,`${I(n.radius,0,48)}px`),typeof n.marginTop=="number"&&Number.isFinite(n.marginTop)&&o.style.setProperty(`--veo-${e}-mt`,`${I(n.marginTop,0,64)}px`),typeof n.marginBottom=="number"&&Number.isFinite(n.marginBottom)&&o.style.setProperty(`--veo-${e}-mb`,`${I(n.marginBottom,0,64)}px`);}function K(o){let e=o?.inlinePosition;return e==="before"||e==="prepend"||e==="append"?e:"after"}function A(o,e,t){switch(t){case "before":o.before(e);break;case "after":o.after(e);break;case "prepend":o.prepend(e);break;case "append":o.append(e);break}}function M(o,e,t){let n=window.setInterval(()=>{if(o.isConnected)return;let i=document.querySelector(e);i&&A(i,o,t);},1e3);return ()=>window.clearInterval(n)}function k(o,e=5e3){return new Promise(t=>{let n=()=>{try{return document.querySelector(o)}catch{return null}},i=n();if(i){t(i);return}let r=false,s=d=>{r||(r=true,a.disconnect(),clearTimeout(l),t(d));},a=new MutationObserver(()=>{let d=n();d&&s(d);});a.observe(document.body,{childList:true,subtree:true});let l=setTimeout(()=>s(null),e);})}var cn=`
|
|
1
|
+
var veoGuides=(function(exports){'use strict';function wt(){return typeof window<"u"}function We(){return typeof document<"u"}var xt=["http:","https:"],Ct="data-veo-guide",St="veo:freq:";var kt="veo:walkthrough_state:";var Rt={shown:1,dismissed:2,completed:2};function It(o){return o.slice(-16)||"default"}var ze=class{constructor(e){this.storageKey=`${St}${e}`,this.cache=this.load(),this.prune();}shouldFilter(e,t){if(t==="every_visit"||t==="always")return false;let n=this.cache.get(e);return n?t==="once"?true:t==="until_dismissed"?n.status==="dismissed"||n.status==="completed":t==="until_answered"?n.status==="completed":false:false}record(e,t){let n=this.cache.get(e);n&&Rt[t]<Rt[n.status]||(this.cache.set(e,{guideId:e,status:t,lastInteractionAt:Date.now()}),this.persist());}clear(){this.cache.clear(),this.persist();}snapshot(){return Array.from(this.cache.values())}prune(){let e=Date.now(),t=false;for(let[n,i]of this.cache)e-i.lastInteractionAt>7776e6&&(this.cache.delete(n),t=true);if(this.cache.size>500){let n=Array.from(this.cache.entries()).sort((r,s)=>r[1].lastInteractionAt-s[1].lastInteractionAt),i=this.cache.size-500;for(let r=0;r<i;r++){let s=n[r];s&&this.cache.delete(s[0]);}t=true;}t&&this.persist();}load(){if(typeof localStorage>"u")return new Map;try{let e=localStorage.getItem(this.storageKey);if(!e)return new Map;let t=JSON.parse(e);if(!Array.isArray(t))return new Map;let n=[];for(let i of t)if(i&&typeof i=="object"&&typeof i.guideId=="string"&&typeof i.lastInteractionAt=="number"&&["shown","dismissed","completed"].includes(i.status)){let r=i;n.push([r.guideId,r]);}return new Map(n)}catch{return new Map}}persist(){if(!(typeof localStorage>"u"))try{let e=JSON.stringify(Array.from(this.cache.values()));localStorage.setItem(this.storageKey,e);}catch{}}};var Ue=class{constructor(e,t,n=false){this.apiUrl=e;this.apiKey=t;this.debug=n;}async resolve(e,t){let n=new URLSearchParams({endUserId:e,pageUrl:t}),i;try{i=await fetch(`${this.apiUrl}/v1/guides/resolve?${n.toString()}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(r){return this.debug&&console.error("[veo] guides resolve fetch failed:",r),[]}if(!i.ok)return this.debug&&console.warn("[veo] guides resolve HTTP",i.status),[];try{let r=await i.json();return Array.isArray(r.guides)?r.guides:[]}catch(r){return this.debug&&console.error("[veo] guides resolve parse failed:",r),[]}}async fetchById(e){let t;try{t=await fetch(`${this.apiUrl}/v1/guides/${encodeURIComponent(e)}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(n){return this.debug&&console.error("[veo] guides fetchById network failed:",n),null}if(!t.ok)return this.debug&&console.warn("[veo] guides fetchById HTTP",t.status),null;try{let n=await t.json();return typeof n.guideId!="string"||typeof n.guideName!="string"||typeof n.guideType!="string"||!Array.isArray(n.guideSteps)||!n.activationRules||typeof n.displayFrequency!="string"||typeof n.displayPriority!="number"?(this.debug&&console.warn("[veo] guides fetchById: unexpected shape"),null):{guideId:n.guideId,guideName:n.guideName,guideType:n.guideType,guideSteps:n.guideSteps,activationRules:n.activationRules,displayFrequency:n.displayFrequency,displayPriority:n.displayPriority}}catch(n){return this.debug&&console.error("[veo] guides fetchById parse failed:",n),null}}};function Tt(o){let e={endUserId:o.endUserId,interactionType:o.action};return o.sessionId&&(e.sessionId=o.sessionId),typeof o.stepIndex=="number"&&(e.stepPosition=o.stepIndex),o.pageUrl&&(e.pageUrl=o.pageUrl),o.pagePath&&(e.pagePath=o.pagePath),o.metadata&&(e.metadata=o.metadata),e}var Ke=class{constructor(e,t){this.apiUrl=e;this.apiKey=t;}async send(e){let t=this.buildUrl(e.guideId),n=await fetch(t,{method:"POST",headers:{"X-Api-Key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(Tt(e.payload)),credentials:"omit"});if(!n.ok)throw new Error(`guide interaction send failed: HTTP ${n.status}`)}sendBeacon(e){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function")return false;let t=`${this.buildUrl(e.guideId)}?key=${encodeURIComponent(this.apiKey)}`,n=new Blob([JSON.stringify(Tt(e.payload))],{type:"application/json"});try{return navigator.sendBeacon(t,n)}catch{return false}}buildUrl(e){return `${this.apiUrl}/v1/guides/${encodeURIComponent(e)}/interactions`}};var qe=class{constructor(e){this.config=e;this.buffer=[];this.timer=null;this.flushing=false;this.unloadCleanup=null;this.startTimer(),this.installUnloadHandler();}get size(){return this.buffer.length}enqueue(e){this.buffer.push({guideId:e.guideId,payload:e.payload,attempts:0,enqueuedAt:Date.now()}),this.buffer.length>=this.config.batchSize&&this.flush();}async flush(){if(this.flushing||this.buffer.length===0)return;let e=Date.now(),t=this.buffer.filter(r=>(r.nextRetryAt??0)<=e);if(t.length===0)return;this.flushing=true;let n=new Set(t);this.buffer=this.buffer.filter(r=>!n.has(r));let i=await Promise.allSettled(t.map(r=>this.config.client.send({guideId:r.guideId,payload:r.payload})));for(let r=0;r<i.length;r++){let s=i[r],a=t[r];!s||!a||s.status!=="fulfilled"&&(a.attempts+=1,a.attempts<this.config.maxRetries?(a.nextRetryAt=Date.now()+this.retryDelayMs(a.attempts),this.buffer.push(a)):this.safeOnError(s.reason,a));}this.flushing=false;}retryDelayMs(e){let t=Math.min(3e3*2**(e-1),3e4);return t/2+Math.random()*(t/2)}flushBeacon(){if(this.buffer.length===0)return;let e=this.buffer.splice(0,this.buffer.length);for(let t of e)this.config.client.sendBeacon({guideId:t.guideId,payload:t.payload});}destroy(){this.timer&&clearInterval(this.timer),this.timer=null,this.unloadCleanup?.(),this.unloadCleanup=null;}startTimer(){typeof window>"u"||(this.timer=setInterval(()=>{this.flush();},this.config.flushIntervalMs));}installUnloadHandler(){if(typeof window>"u")return;let e=()=>this.flushBeacon(),t=()=>{document.visibilityState==="hidden"&&this.flushBeacon();};window.addEventListener("pagehide",e),window.addEventListener("visibilitychange",t),this.unloadCleanup=()=>{window.removeEventListener("pagehide",e),window.removeEventListener("visibilitychange",t);};}safeOnError(e,t){if(!this.config.onError)return;let n=e instanceof Error?e:new Error(String(e));try{this.config.onError(n,t);}catch{}}};var ae=Math.min,J=Math.max,Oe=Math.round;var B=o=>({x:o,y:o}),Rn={left:"right",right:"left",bottom:"top",top:"bottom"};function Ve(o,e,t){return J(o,ae(e,t))}function ge(o,e){return typeof o=="function"?o(e):o}function Z(o){return o.split("-")[0]}function ve(o){return o.split("-")[1]}function ct(o){return o==="x"?"y":"x"}function Ye(o){return o==="y"?"height":"width"}function Y(o){let e=o[0];return e==="t"||e==="b"?"y":"x"}function Xe(o){return ct(Y(o))}function Lt(o,e,t){t===void 0&&(t=false);let n=ve(o),i=Xe(o),r=Ye(i),s=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=Me(s)),[s,Me(s)]}function Gt(o){let e=Me(o);return [je(o),e,je(e)]}function je(o){return o.includes("start")?o.replace("start","end"):o.replace("end","start")}var Pt=["left","right"],At=["right","left"],In=["top","bottom"],Tn=["bottom","top"];function Pn(o,e,t){switch(o){case "top":case "bottom":return t?e?At:Pt:e?Pt:At;case "left":case "right":return e?In:Tn;default:return []}}function Nt(o,e,t,n){let i=ve(o),r=Pn(Z(o),t==="start",n);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(je)))),r}function Me(o){let e=Z(o);return Rn[e]+o.slice(e.length)}function An(o){return {top:0,right:0,bottom:0,left:0,...o}}function ut(o){return typeof o!="number"?An(o):{top:o,right:o,bottom:o,left:o}}function le(o){let{x:e,y:t,width:n,height:i}=o;return {width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function Mt(o,e,t){let{reference:n,floating:i}=o,r=Y(e),s=Xe(e),a=Ye(s),l=Z(e),d=r==="y",c=n.x+n.width/2-i.width/2,p=n.y+n.height/2-i.height/2,m=n[a]/2-i[a]/2,u;switch(l){case "top":u={x:c,y:n.y-i.height};break;case "bottom":u={x:c,y:n.y+n.height};break;case "right":u={x:n.x+n.width,y:p};break;case "left":u={x:n.x-i.width,y:p};break;default:u={x:n.x,y:n.y};}switch(ve(e)){case "start":u[s]-=m*(t&&d?-1:1);break;case "end":u[s]+=m*(t&&d?-1:1);break}return u}async function Ot(o,e){var t;e===void 0&&(e={});let{x:n,y:i,platform:r,rects:s,elements:a,strategy:l}=o,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:p="floating",altBoundary:m=false,padding:u=0}=ge(e,o),f=ut(u),g=a[m?p==="floating"?"reference":"floating":p],v=le(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(g)))==null||t?g:g.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:d,rootBoundary:c,strategy:l})),b=p==="floating"?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,x=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),y=await(r.isElement==null?void 0:r.isElement(x))?await(r.getScale==null?void 0:r.getScale(x))||{x:1,y:1}:{x:1,y:1},C=le(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:x,strategy:l}):b);return {top:(v.top-C.top+f.top)/y.y,bottom:(C.bottom-v.bottom+f.bottom)/y.y,left:(v.left-C.left+f.left)/y.x,right:(C.right-v.right+f.right)/y.x}}var Ln=50,_t=async(o,e,t)=>{let{placement:n="bottom",strategy:i="absolute",middleware:r=[],platform:s}=t,a=s.detectOverflow?s:{...s,detectOverflow:Ot},l=await(s.isRTL==null?void 0:s.isRTL(e)),d=await s.getElementRects({reference:o,floating:e,strategy:i}),{x:c,y:p}=Mt(d,n,l),m=n,u=0,f={};for(let h=0;h<r.length;h++){let g=r[h];if(!g)continue;let{name:v,fn:b}=g,{x,y,data:C,reset:S}=await b({x:c,y:p,initialPlacement:n,placement:m,strategy:i,middlewareData:f,rects:d,platform:a,elements:{reference:o,floating:e}});c=x??c,p=y??p,f[v]={...f[v],...C},S&&u<Ln&&(u++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(d=S.rects===true?await s.getElementRects({reference:o,floating:e,strategy:i}):S.rects),{x:c,y:p}=Mt(d,m,l)),h=-1);}return {x:c,y:p,placement:m,strategy:i,middlewareData:f}},Bt=o=>({name:"arrow",options:o,async fn(e){let{x:t,y:n,placement:i,rects:r,platform:s,elements:a,middlewareData:l}=e,{element:d,padding:c=0}=ge(o,e)||{};if(d==null)return {};let p=ut(c),m={x:t,y:n},u=Xe(i),f=Ye(u),h=await s.getDimensions(d),g=u==="y",v=g?"top":"left",b=g?"bottom":"right",x=g?"clientHeight":"clientWidth",y=r.reference[f]+r.reference[u]-m[u]-r.floating[f],C=m[u]-r.reference[u],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d)),q=S?S[x]:0;(!q||!await(s.isElement==null?void 0:s.isElement(S)))&&(q=a.floating[x]||r.floating[f]);let Le=y/2-C/2,ie=q/2-h[f]/2-1,j=ae(p[v],ie),Ge=ae(p[b],ie),re=j,Ne=q-h[f]-Ge,E=q/2-h[f]/2+Le,se=Ve(re,E,Ne),V=!l.arrow&&ve(i)!=null&&E!==se&&r.reference[f]/2-(E<re?j:Ge)-h[f]/2<0,O=V?E<re?E-re:E-Ne:0;return {[u]:m[u]+O,data:{[u]:se,centerOffset:E-se-O,...V&&{alignmentOffset:O}},reset:V}}});var Ft=function(o){return o===void 0&&(o={}),{name:"flip",options:o,async fn(e){var t,n;let{placement:i,middlewareData:r,rects:s,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:c=true,crossAxis:p=true,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:h=true,...g}=ge(o,e);if((t=r.arrow)!=null&&t.alignmentOffset)return {};let v=Z(i),b=Y(a),x=Z(a)===a,y=await(l.isRTL==null?void 0:l.isRTL(d.floating)),C=m||(x||!h?[Me(a)]:Gt(a)),S=f!=="none";!m&&S&&C.push(...Nt(a,h,f,y));let q=[a,...C],Le=await l.detectOverflow(e,g),ie=[],j=((n=r.flip)==null?void 0:n.overflows)||[];if(c&&ie.push(Le[v]),p){let E=Lt(i,s,y);ie.push(Le[E[0]],Le[E[1]]);}if(j=[...j,{placement:i,overflows:ie}],!ie.every(E=>E<=0)){var Ge,re;let E=(((Ge=r.flip)==null?void 0:Ge.index)||0)+1,se=q[E];if(se&&(!(p==="alignment"?b!==Y(se):false)||j.every(_=>Y(_.placement)===b?_.overflows[0]>0:true)))return {data:{index:E,overflows:j},reset:{placement:se}};let V=(re=j.filter(O=>O.overflows[0]<=0).sort((O,_)=>O.overflows[1]-_.overflows[1])[0])==null?void 0:re.placement;if(!V)switch(u){case "bestFit":{var Ne;let O=(Ne=j.filter(_=>{if(S){let Q=Y(_.placement);return Q===b||Q==="y"}return true}).map(_=>[_.placement,_.overflows.filter(Q=>Q>0).reduce((Q,kn)=>Q+kn,0)]).sort((_,Q)=>_[1]-Q[1])[0])==null?void 0:Ne[0];O&&(V=O);break}case "initialPlacement":V=a;break}if(i!==V)return {reset:{placement:V}}}return {}}}};var Gn=new Set(["left","top"]);async function Nn(o,e){let{placement:t,platform:n,elements:i}=o,r=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=Z(t),a=ve(t),l=Y(t)==="y",d=Gn.has(s)?-1:1,c=r&&l?-1:1,p=ge(e,o),{mainAxis:m,crossAxis:u,alignmentAxis:f}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof f=="number"&&(u=a==="end"?f*-1:f),l?{x:u*c,y:m*d}:{x:m*d,y:u*c}}var $t=function(o){return o===void 0&&(o=0),{name:"offset",options:o,async fn(e){var t,n;let{x:i,y:r,placement:s,middlewareData:a}=e,l=await Nn(e,o);return s===((t=a.offset)==null?void 0:t.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:s}}}}},Ht=function(o){return o===void 0&&(o={}),{name:"shift",options:o,async fn(e){let{x:t,y:n,placement:i,platform:r}=e,{mainAxis:s=true,crossAxis:a=false,limiter:l={fn:v=>{let{x:b,y:x}=v;return {x:b,y:x}}},...d}=ge(o,e),c={x:t,y:n},p=await r.detectOverflow(e,d),m=Y(Z(i)),u=ct(m),f=c[u],h=c[m];if(s){let v=u==="y"?"top":"left",b=u==="y"?"bottom":"right",x=f+p[v],y=f-p[b];f=Ve(x,f,y);}if(a){let v=m==="y"?"top":"left",b=m==="y"?"bottom":"right",x=h+p[v],y=h-p[b];h=Ve(x,h,y);}let g=l.fn({...e,[u]:f,[m]:h});return {...g,data:{x:g.x-t,y:g.y-n,enabled:{[u]:s,[m]:a}}}}}};function Je(){return typeof window<"u"}function ce(o){return Wt(o)?(o.nodeName||"").toLowerCase():"#document"}function T(o){var e;return (o==null||(e=o.ownerDocument)==null?void 0:e.defaultView)||window}function F(o){var e;return (e=(Wt(o)?o.ownerDocument:o.document)||window.document)==null?void 0:e.documentElement}function Wt(o){return Je()?o instanceof Node||o instanceof T(o).Node:false}function L(o){return Je()?o instanceof Element||o instanceof T(o).Element:false}function $(o){return Je()?o instanceof HTMLElement||o instanceof T(o).HTMLElement:false}function Dt(o){return !Je()||typeof ShadowRoot>"u"?false:o instanceof ShadowRoot||o instanceof T(o).ShadowRoot}function ye(o){let{overflow:e,overflowX:t,overflowY:n,display:i}=G(o);return /auto|scroll|overlay|hidden|clip/.test(e+n+t)&&i!=="inline"&&i!=="contents"}function zt(o){return /^(table|td|th)$/.test(ce(o))}function _e(o){try{if(o.matches(":popover-open"))return !0}catch{}try{return o.matches(":modal")}catch{return false}}var Mn=/transform|translate|scale|rotate|perspective|filter/,On=/paint|layout|strict|content/,de=o=>!!o&&o!=="none",pt;function Ze(o){let e=L(o)?G(o):o;return de(e.transform)||de(e.translate)||de(e.scale)||de(e.rotate)||de(e.perspective)||!et()&&(de(e.backdropFilter)||de(e.filter))||Mn.test(e.willChange||"")||On.test(e.contain||"")}function Ut(o){let e=X(o);for(;$(e)&&!ue(e);){if(Ze(e))return e;if(_e(e))return null;e=X(e);}return null}function et(){return pt==null&&(pt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),pt}function ue(o){return /^(html|body|#document)$/.test(ce(o))}function G(o){return T(o).getComputedStyle(o)}function Be(o){return L(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:{scrollLeft:o.scrollX,scrollTop:o.scrollY}}function X(o){if(ce(o)==="html")return o;let e=o.assignedSlot||o.parentNode||Dt(o)&&o.host||F(o);return Dt(e)?e.host:e}function Kt(o){let e=X(o);return ue(e)?o.ownerDocument?o.ownerDocument.body:o.body:$(e)&&ye(e)?e:Kt(e)}function Qe(o,e,t){var n;e===void 0&&(e=[]);let i=Kt(o),r=i===((n=o.ownerDocument)==null?void 0:n.body),s=T(i);if(r){tt(s);return e.concat(s,s.visualViewport||[],ye(i)?i:[],[])}else return e.concat(i,Qe(i,[]))}function tt(o){return o.parent&&Object.getPrototypeOf(o.parent)?o.frameElement:null}function Yt(o){let e=G(o),t=parseFloat(e.width)||0,n=parseFloat(e.height)||0,i=$(o),r=i?o.offsetWidth:t,s=i?o.offsetHeight:n,a=Oe(t)!==r||Oe(n)!==s;return a&&(t=r,n=s),{width:t,height:n,$:a}}function Xt(o){return L(o)?o:o.contextElement}function be(o){let e=Xt(o);if(!$(e))return B(1);let t=e.getBoundingClientRect(),{width:n,height:i,$:r}=Yt(e),s=(r?Oe(t.width):t.width)/n,a=(r?Oe(t.height):t.height)/i;return (!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var _n=B(0);function Qt(o){let e=T(o);return !et()||!e.visualViewport?_n:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Bn(o,e,t){return e===void 0&&(e=false),!t||e&&t!==T(o)?false:e}function Fe(o,e,t,n){e===void 0&&(e=false),t===void 0&&(t=false);let i=o.getBoundingClientRect(),r=Xt(o),s=B(1);e&&(n?L(n)&&(s=be(n)):s=be(o));let a=Bn(r,t,n)?Qt(r):B(0),l=(i.left+a.x)/s.x,d=(i.top+a.y)/s.y,c=i.width/s.x,p=i.height/s.y;if(r){let m=T(r),u=n&&L(n)?T(n):n,f=m,h=tt(f);for(;h&&n&&u!==f;){let g=be(h),v=h.getBoundingClientRect(),b=G(h),x=v.left+(h.clientLeft+parseFloat(b.paddingLeft))*g.x,y=v.top+(h.clientTop+parseFloat(b.paddingTop))*g.y;l*=g.x,d*=g.y,c*=g.x,p*=g.y,l+=x,d+=y,f=T(h),h=tt(f);}}return le({width:c,height:p,x:l,y:d})}function nt(o,e){let t=Be(o).scrollLeft;return e?e.left+t:Fe(F(o)).left+t}function Jt(o,e){let t=o.getBoundingClientRect(),n=t.left+e.scrollLeft-nt(o,t),i=t.top+e.scrollTop;return {x:n,y:i}}function Fn(o){let{elements:e,rect:t,offsetParent:n,strategy:i}=o,r=i==="fixed",s=F(n),a=e?_e(e.floating):false;if(n===s||a&&r)return t;let l={scrollLeft:0,scrollTop:0},d=B(1),c=B(0),p=$(n);if((p||!p&&!r)&&((ce(n)!=="body"||ye(s))&&(l=Be(n)),p)){let u=Fe(n);d=be(n),c.x=u.x+n.clientLeft,c.y=u.y+n.clientTop;}let m=s&&!p&&!r?Jt(s,l):B(0);return {width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+c.x+m.x,y:t.y*d.y-l.scrollTop*d.y+c.y+m.y}}function $n(o){return Array.from(o.getClientRects())}function Hn(o){let e=F(o),t=Be(o),n=o.ownerDocument.body,i=J(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=J(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),s=-t.scrollLeft+nt(o),a=-t.scrollTop;return G(n).direction==="rtl"&&(s+=J(e.clientWidth,n.clientWidth)-i),{width:i,height:r,x:s,y:a}}var qt=25;function Dn(o,e){let t=T(o),n=F(o),i=t.visualViewport,r=n.clientWidth,s=n.clientHeight,a=0,l=0;if(i){r=i.width,s=i.height;let c=et();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop);}let d=nt(n);if(d<=0){let c=n.ownerDocument,p=c.body,m=getComputedStyle(p),u=c.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,f=Math.abs(n.clientWidth-p.clientWidth-u);f<=qt&&(r-=f);}else d<=qt&&(r+=d);return {width:r,height:s,x:a,y:l}}function Wn(o,e){let t=Fe(o,true,e==="fixed"),n=t.top+o.clientTop,i=t.left+o.clientLeft,r=$(o)?be(o):B(1),s=o.clientWidth*r.x,a=o.clientHeight*r.y,l=i*r.x,d=n*r.y;return {width:s,height:a,x:l,y:d}}function jt(o,e,t){let n;if(e==="viewport")n=Dn(o,t);else if(e==="document")n=Hn(F(o));else if(L(e))n=Wn(e,t);else {let i=Qt(o);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height};}return le(n)}function Zt(o,e){let t=X(o);return t===e||!L(t)||ue(t)?false:G(t).position==="fixed"||Zt(t,e)}function zn(o,e){let t=e.get(o);if(t)return t;let n=Qe(o,[]).filter(a=>L(a)&&ce(a)!=="body"),i=null,r=G(o).position==="fixed",s=r?X(o):o;for(;L(s)&&!ue(s);){let a=G(s),l=Ze(s);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ye(s)&&!l&&Zt(o,s))?n=n.filter(c=>c!==s):i=a,s=X(s);}return e.set(o,n),n}function Un(o){let{element:e,boundary:t,rootBoundary:n,strategy:i}=o,s=[...t==="clippingAncestors"?_e(e)?[]:zn(e,this._c):[].concat(t),n],a=jt(e,s[0],i),l=a.top,d=a.right,c=a.bottom,p=a.left;for(let m=1;m<s.length;m++){let u=jt(e,s[m],i);l=J(u.top,l),d=ae(u.right,d),c=ae(u.bottom,c),p=J(u.left,p);}return {width:d-p,height:c-l,x:p,y:l}}function Kn(o){let{width:e,height:t}=Yt(o);return {width:e,height:t}}function qn(o,e,t){let n=$(e),i=F(e),r=t==="fixed",s=Fe(o,true,r,e),a={scrollLeft:0,scrollTop:0},l=B(0);function d(){l.x=nt(i);}if(n||!n&&!r)if((ce(e)!=="body"||ye(i))&&(a=Be(e)),n){let u=Fe(e,true,r,e);l.x=u.x+e.clientLeft,l.y=u.y+e.clientTop;}else i&&d();r&&!n&&i&&d();let c=i&&!n&&!r?Jt(i,a):B(0),p=s.left+a.scrollLeft-l.x-c.x,m=s.top+a.scrollTop-l.y-c.y;return {x:p,y:m,width:s.width,height:s.height}}function ft(o){return G(o).position==="static"}function Vt(o,e){if(!$(o)||G(o).position==="fixed")return null;if(e)return e(o);let t=o.offsetParent;return F(o)===t&&(t=t.ownerDocument.body),t}function en(o,e){let t=T(o);if(_e(o))return t;if(!$(o)){let i=X(o);for(;i&&!ue(i);){if(L(i)&&!ft(i))return i;i=X(i);}return t}let n=Vt(o,e);for(;n&&zt(n)&&ft(n);)n=Vt(n,e);return n&&ue(n)&&ft(n)&&!Ze(n)?t:n||Ut(o)||t}var jn=async function(o){let e=this.getOffsetParent||en,t=this.getDimensions,n=await t(o.floating);return {reference:qn(o.reference,await e(o.floating),o.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Vn(o){return G(o).direction==="rtl"}var Yn={convertOffsetParentRelativeRectToViewportRelativeRect:Fn,getDocumentElement:F,getClippingRect:Un,getOffsetParent:en,getElementRects:jn,getClientRects:$n,getDimensions:Kn,getScale:be,isElement:L,isRTL:Vn};var H=$t;var D=Ht,W=Ft;var ee=Bt;var z=(o,e,t)=>{let n=new Map,i={platform:Yn,...t},r={...i.platform,_c:n};return _t(o,e,{...i,platform:r})};var Xn={P:"p",BR:"br",STRONG:"strong",B:"strong",EM:"em",I:"em",U:"u",S:"s",UL:"ul",OL:"ol",LI:"li",A:"a"},Qn=new Set(["SCRIPT","STYLE","TEMPLATE","IFRAME","OBJECT","EMBED","NOSCRIPT","TITLE","TEXTAREA","SELECT","SVG","MATH"]),tn=16*1024,Jn=20,Zn=1e3;function nn(o,e){let t=e.createDocumentFragment();if(typeof o!="string"||o.length===0)return t;let n;try{n=new DOMParser().parseFromString(o.length>tn?o.slice(0,tn):o,"text/html");}catch{return t.appendChild(e.createTextNode(o)),t}let i={nodes:0,exceeded:false};for(let r of Array.from(n.body.childNodes)){let s=$e(r,e,0,i);s&&t.appendChild(s);}if(i.exceeded){let r=e.createDocumentFragment();return r.appendChild(e.createTextNode(n.body.textContent??"")),r}return t}function $e(o,e,t,n){if(n.exceeded)return null;if(++n.nodes>Zn||t>Jn)return n.exceeded=true,null;if(o.nodeType===Node.TEXT_NODE)return e.createTextNode(o.textContent??"");if(o.nodeType!==Node.ELEMENT_NODE)return null;let i=o;if(Qn.has(i.tagName))return null;let r=Xn[i.tagName];if(!r){let a=e.createDocumentFragment();for(let l of Array.from(i.childNodes)){let d=$e(l,e,t+1,n);d&&a.appendChild(d);}return a}if(r==="a"){let a=i.getAttribute("href")??"";if(!R(a)){let d=e.createDocumentFragment();for(let c of Array.from(i.childNodes)){let p=$e(c,e,t+1,n);p&&d.appendChild(p);}return d}let l=e.createElement("a");l.setAttribute("href",a),l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer nofollow");for(let d of Array.from(i.childNodes)){let c=$e(d,e,t+1,n);c&&l.appendChild(c);}return l}let s=e.createElement(r);for(let a of Array.from(i.childNodes)){let l=$e(a,e,t+1,n);l&&s.appendChild(l);}return s}function P(o,e,t){let n=e.createElement("div");n.className="veo-guide-content";let i=rn(o);return i?to(n,i,e,t):eo(n,o,e,t),n.appendChild(pe(e,()=>t.onDismiss())),n}function on(o,e){let t=rn(o);if(t){let i=[];for(let{block:r,idx:s}of t){if(r.type==="button")continue;let a=ot(r,e);a&&(a.dataset.veoIdx=String(s),i.push(a));}return i}let n=[];if(typeof o.imageUrl=="string"&&o.imageUrl&&R(o.imageUrl)){let i=e.createElement("img");i.className="veo-guide-image",i.src=o.imageUrl,i.alt=typeof o.title=="string"?o.title:"",n.push(i);}if(typeof o.title=="string"&&o.title){let i=e.createElement("h2");i.className="veo-guide-title",i.textContent=o.title,n.push(i);}if(typeof o.content=="string"&&o.content){let i=e.createElement("p");i.className="veo-guide-text",i.textContent=o.content,n.push(i);}return n}function eo(o,e,t,n){if(typeof e.imageUrl=="string"&&e.imageUrl&&R(e.imageUrl)){let r=t.createElement("img");r.className="veo-guide-image",r.src=e.imageUrl,r.alt=typeof e.title=="string"?e.title:"",o.appendChild(r);}if(typeof e.title=="string"&&e.title){let r=t.createElement("h2");r.className="veo-guide-title",r.textContent=e.title,o.appendChild(r);}if(typeof e.content=="string"&&e.content){let r=t.createElement("p");r.className="veo-guide-text",r.textContent=e.content,o.appendChild(r);}let i=t.createElement("div");if(i.className="veo-guide-actions",typeof e.ctaText=="string"&&e.ctaText){let r=t.createElement("button");r.type="button",r.className="veo-guide-cta",r.textContent=e.ctaText,r.addEventListener("click",()=>{let s=e.ctaAction??"dismiss",a=oo(e);n.onCtaClick(s,a);}),i.appendChild(r);}o.appendChild(i);}function rn(o){if(!Array.isArray(o.blocks)||o.blocks.length===0)return null;let e=o.blocks.map((t,n)=>({block:t,idx:n})).filter(t=>{let n=t.block;return !n||typeof n!="object"?false:n.type==="image"?typeof n.url=="string"&&R(n.url):n.type==="title"||n.type==="text"||n.type==="button"});return e.length>0?e:null}function to(o,e,t,n){let i=0;for(;i<e.length;){let r=e[i];if(r?.block.type==="button"){let a=t.createElement("div");a.className="veo-guide-actions",a.dataset.veoIdx=String(r.idx);let l;for(;i<e.length&&e[i]?.block.type==="button";){let d=e[i].block;if(!l){let c=d.style?.align;(c==="left"||c==="center"||c==="right")&&(l=c);}a.appendChild(no(d,t,n)),i++;}l&&(a.style.justifyContent=sn[l]),o.appendChild(a);continue}let s=r?ot(r.block,t):null;s&&r&&(s.dataset.veoIdx=String(r.idx),o.appendChild(s)),i++;}}function ot(o,e){switch(o.type){case "title":{let t=e.createElement("h2");return t.className="veo-guide-title",t.textContent=typeof o.text=="string"?o.text:"",we(t,o.style,"text"),t}case "text":{let t=e.createElement("div");return t.className="veo-guide-text",typeof o.html=="string"&&o.html?t.appendChild(nn(o.html,e)):t.textContent=typeof o.text=="string"?o.text:"",we(t,o.style,"text"),t}case "image":{if(typeof o.url!="string"||!R(o.url))return null;let t=e.createElement("img");return t.className="veo-guide-image",t.src=o.url,t.alt="",we(t,o.style,"image"),t}default:return null}}function no(o,e,t){let n=e.createElement("button");return n.type="button",n.className="veo-guide-cta",n.textContent=typeof o.text=="string"&&o.text?o.text:"OK",we(n,o.style,"button"),n.addEventListener("click",()=>{let i=o.action??"dismiss",r=i==="next"||i==="url"||i==="guide"?i:"dismiss",s=r==="url"&&typeof o.url=="string"&&R(o.url)?o.url:r==="guide"&&typeof o.targetGuideId=="string"&&o.targetGuideId?o.targetGuideId:void 0,a={...typeof o.id=="string"&&o.id?{buttonId:o.id}:{},...typeof o.text=="string"&&o.text?{buttonText:o.text}:{}};t.onCtaClick(r,s,Object.keys(a).length?a:void 0);}),n}var sn={left:"flex-start",center:"center",right:"flex-end"};function N(o,e,t){return Math.min(t,Math.max(e,o))}function we(o,e,t){if(!e||typeof e!="object")return;let n=e;if(t==="image"&&n.bleed===true){o.classList.add("veo-guide-image--bleed");return}let i=typeof n.align=="string"?n.align:null;if(i&&(i==="left"||i==="center"||i==="right")&&(t==="text"?o.style.textAlign=i:t==="image"&&(o.style.alignSelf=sn[i])),t!=="image"&&typeof n.color=="string"&&(o.style.color=n.color),t==="text"&&typeof n.fontSize=="number"&&Number.isFinite(n.fontSize)&&(o.style.fontSize=`${N(n.fontSize,8,72)}px`),t==="image"&&typeof n.width=="number"&&Number.isFinite(n.width)&&(o.style.width=`${N(n.width,10,100)}%`),t==="image"&&typeof n.radius=="number"&&Number.isFinite(n.radius)&&(o.style.borderRadius=`${N(n.radius,0,48)}px`),typeof n.marginTop=="number"&&Number.isFinite(n.marginTop)&&(o.style.marginTop=`${N(n.marginTop,0,64)}px`),typeof n.marginBottom=="number"&&Number.isFinite(n.marginBottom)&&(o.style.marginBottom=`${N(n.marginBottom,0,64)}px`),t!=="image"&&(typeof n.fontSize=="number"&&Number.isFinite(n.fontSize)&&(o.style.fontSize=`${N(n.fontSize,8,96)}px`),typeof n.fontFamily=="string"&&n.fontFamily&&n.fontFamily!=="inherit"&&(o.style.fontFamily=n.fontFamily),typeof n.fontWeight=="string"&&n.fontWeight&&(o.style.fontWeight=n.fontWeight),typeof n.textTransform=="string"&&n.textTransform&&n.textTransform!=="none"&&(o.style.textTransform=n.textTransform),typeof n.lineHeight=="number"&&Number.isFinite(n.lineHeight)&&(o.style.lineHeight=`${N(n.lineHeight,50,300)}%`),typeof n.letterSpacing=="number"&&Number.isFinite(n.letterSpacing)&&(o.style.letterSpacing=`${N(n.letterSpacing,-5,20)}px`)),typeof n.background=="string"&&n.background&&(o.style.background=n.background),typeof n.borderWidth=="number"&&n.borderWidth>0){let r=typeof n.borderColor=="string"&&n.borderColor?n.borderColor:"#bbbbbb";o.style.border=`${N(n.borderWidth,0,20)}px solid ${r}`;}t!=="image"&&typeof n.radius=="number"&&Number.isFinite(n.radius)&&(o.style.borderRadius=`${N(n.radius,0,64)}px`);for(let r of ["Top","Right","Bottom","Left"]){let s=n[`padding${r}`];typeof s=="number"&&Number.isFinite(s)&&o.style.setProperty(`padding-${r.toLowerCase()}`,`${N(s,0,128)}px`);let a=n[`margin${r}`];typeof a=="number"&&Number.isFinite(a)&&o.style.setProperty(`margin-${r.toLowerCase()}`,`${N(a,0,128)}px`);}}function pe(o,e,t="veo-guide-close"){let n=o.createElement("button");return n.type="button",n.className=t,n.setAttribute("aria-label","Cerrar"),n.textContent="\xD7",n.addEventListener("click",e),n}function R(o){if(typeof o!="string"||o.length===0)return false;try{let e=typeof window<"u"?window.location.href:"http://localhost/",t=new URL(o,e);return xt.includes(t.protocol)}catch{return false}}function oo(o){let e=o.style?.ctaUrl;if(typeof e=="string")return R(e)?e:void 0}var io={"--veo-bg":"#1f2937","--veo-text":"#f9fafb","--veo-text-secondary":"#d1d5db","--veo-shadow":"0 20px 60px rgba(0, 0, 0, 0.55)"},ht={left:"flex-start",center:"center",right:"flex-end"},ro={left:"flex-start",center:"center",right:"flex-end"},so={title:"text",text:"text",image:"self"},an={none:"none",soft:"0 4px 14px rgba(0, 0, 0, 0.10)",medium:"0 8px 30px rgba(0, 0, 0, 0.18)",strong:"0 24px 60px rgba(0, 0, 0, 0.32)"},ln={center:[.5,.5],top:[.5,0],bottom:[.5,1],left:[0,.5],right:[1,.5],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},U=/^#[0-9a-f]{3,8}$|^(rgb|rgba|hsl|hsla)\([\d.,%/\sdeg]+\)$|^[a-z]{3,20}$/i;function I(o,e,t){return Math.min(t,Math.max(e,o))}function dn(o,e){if(!e||typeof e!="object")return;let t=e;if(typeof t.accentColor=="string"&&U.test(t.accentColor.trim())&&o.style.setProperty("--veo-primary",t.accentColor.trim()),typeof t.fontFamily=="string"&&t.fontFamily.length<=200&&!/[<>{}]/.test(t.fontFamily)&&o.style.setProperty("--veo-font",t.fontFamily.trim()),t.theme==="dark")for(let[r,s]of Object.entries(io))o.style.setProperty(r,s);typeof t.background=="string"&&U.test(t.background.trim())&&o.style.setProperty("--veo-bg",t.background.trim()),typeof t.textColor=="string"&&U.test(t.textColor.trim())&&o.style.setProperty("--veo-text",t.textColor.trim()),typeof t.textSecondaryColor=="string"&&U.test(t.textSecondaryColor.trim())&&o.style.setProperty("--veo-text-secondary",t.textSecondaryColor.trim()),typeof t.radius=="number"&&Number.isFinite(t.radius)&&o.style.setProperty("--veo-radius",`${I(t.radius,0,48)}px`),typeof t.width=="number"&&Number.isFinite(t.width)&&o.style.setProperty("--veo-width",`${I(t.width,220,720)}px`),typeof t.height=="number"&&Number.isFinite(t.height)&&o.style.setProperty("--veo-min-h",`${I(t.height,120,900)}px`),(t.align==="left"||t.align==="center"||t.align==="right")&&o.style.setProperty("--veo-actions-justify",ht[t.align]),typeof t.padding=="number"&&Number.isFinite(t.padding)&&o.style.setProperty("--veo-pad",`${I(t.padding,0,64)}px`),typeof t.margin=="number"&&Number.isFinite(t.margin)&&o.style.setProperty("--veo-margin",`${I(t.margin,0,64)}px`),typeof t.borderWidth=="number"&&Number.isFinite(t.borderWidth)&&o.style.setProperty("--veo-border-width",`${I(t.borderWidth,0,16)}px`),typeof t.borderColor=="string"&&U.test(t.borderColor.trim())&&o.style.setProperty("--veo-border-color",t.borderColor.trim()),typeof t.shadow=="string"&&an[t.shadow]&&o.style.setProperty("--veo-shadow",an[t.shadow]);let n,i;if(typeof t.posX=="number"&&typeof t.posY=="number"?(n=I(t.posX,0,1),i=I(t.posY,0,1)):typeof t.overlayPosition=="string"&&ln[t.overlayPosition]&&([n,i]=ln[t.overlayPosition]),n!==void 0&&i!==void 0&&(o.style.setProperty("--veo-pos-x",`${n*100}%`),o.style.setProperty("--veo-pos-y",`${i*100}%`)),t.elements&&typeof t.elements=="object"){let r=t.elements;mt(o,"title",r.title),mt(o,"text",r.text),mt(o,"image",r.image),ao(o,r.cta);}}function ao(o,e){if(!e||typeof e!="object")return;let t=e;typeof t.align=="string"&&ht[t.align]&&o.style.setProperty("--veo-actions-justify",ht[t.align]),typeof t.background=="string"&&U.test(t.background.trim())&&o.style.setProperty("--veo-cta-bg",t.background.trim()),typeof t.color=="string"&&U.test(t.color.trim())&&o.style.setProperty("--veo-cta-color",t.color.trim()),typeof t.fontSize=="number"&&Number.isFinite(t.fontSize)&&o.style.setProperty("--veo-cta-size",`${I(t.fontSize,10,24)}px`),typeof t.radius=="number"&&Number.isFinite(t.radius)&&o.style.setProperty("--veo-cta-radius",`${I(t.radius,0,48)}px`);}function mt(o,e,t){if(!t||typeof t!="object")return;let n=t;if(typeof n.align=="string"&&(n.align==="left"||n.align==="center"||n.align==="right")){let r=(so[e]??"text")==="self"?ro[n.align]:n.align;o.style.setProperty(`--veo-${e}-align`,r);}typeof n.color=="string"&&U.test(n.color.trim())&&o.style.setProperty(`--veo-${e}-color`,n.color.trim()),typeof n.fontSize=="number"&&Number.isFinite(n.fontSize)&&o.style.setProperty(`--veo-${e}-size`,`${I(n.fontSize,8,72)}px`),typeof n.width=="number"&&Number.isFinite(n.width)&&o.style.setProperty(`--veo-${e}-width`,`${I(n.width,10,100)}%`),typeof n.radius=="number"&&Number.isFinite(n.radius)&&o.style.setProperty(`--veo-${e}-radius`,`${I(n.radius,0,48)}px`),typeof n.marginTop=="number"&&Number.isFinite(n.marginTop)&&o.style.setProperty(`--veo-${e}-mt`,`${I(n.marginTop,0,64)}px`),typeof n.marginBottom=="number"&&Number.isFinite(n.marginBottom)&&o.style.setProperty(`--veo-${e}-mb`,`${I(n.marginBottom,0,64)}px`);}function K(o){let e=o?.inlinePosition;return e==="before"||e==="prepend"||e==="append"?e:"after"}function A(o,e,t){switch(t){case "before":o.before(e);break;case "after":o.after(e);break;case "prepend":o.prepend(e);break;case "append":o.append(e);break}}function M(o,e,t){let n=window.setInterval(()=>{if(o.isConnected)return;let i=document.querySelector(e);i&&A(i,o,t);},1e3);return ()=>window.clearInterval(n)}function k(o,e=5e3){return new Promise(t=>{let n=()=>{try{return document.querySelector(o)}catch{return null}},i=n();if(i){t(i);return}let r=false,s=d=>{r||(r=true,a.disconnect(),clearTimeout(l),t(d));},a=new MutationObserver(()=>{let d=n();d&&s(d);});a.observe(document.body,{childList:true,subtree:true});let l=setTimeout(()=>s(null),e);})}var cn=`
|
|
2
2
|
:host {
|
|
3
3
|
--veo-primary: #FF5B35;
|
|
4
4
|
--veo-text: #1f2937;
|
|
@@ -423,8 +423,8 @@ var veoGuides=(function(exports){'use strict';function wt(){return typeof window
|
|
|
423
423
|
to { transform: translateY(0); opacity: 1; }
|
|
424
424
|
}
|
|
425
425
|
`;var w=class{constructor(){this.host=null;this.shadow=null;this.cleanups=[];this.liveContainer=null;this.liveContent=null;this.liveBuild=null;this.liveKey="";}liveKeyOf(e){return ""}onLiveUpdate(e){}updateStep(e){if(!this.host||!this.liveContainer||!this.liveContent||!this.liveBuild||this.liveKeyOf(e)!==this.liveKey)return false;let t=this.liveBuild(e);return this.liveContainer.replaceChild(t,this.liveContent),this.liveContent=t,this.applyDesign(e.style),this.onLiveUpdate(e),true}createHost(){let e=document.createElement("div");e.setAttribute(Ct,"");let t=e.attachShadow({mode:"open"}),n=document.createElement("style");n.textContent=cn,t.appendChild(n);let i=document.createElement("div");return t.appendChild(i),document.body.appendChild(e),this.host=e,this.shadow=t,{host:e,shadow:t,root:i}}applyDesign(e){this.host&&dn(this.host,e);}registerCleanup(e){this.cleanups.push(e);}hostElement(){return this.host}destroy(){for(let e of this.cleanups)try{e();}catch{}this.cleanups=[],this.host?.parentNode&&this.host.parentNode.removeChild(this.host),this.host=null,this.shadow=null;}};var lo={top:"bottom",bottom:"top",left:"right",right:"left"};function te(o,e,t){let n=lo[e.split("-")[0]??"bottom"]??"top";for(let i of ["top","bottom","left","right"])o.style.setProperty(i,"");t?.x!=null&&o.style.setProperty("left",`${t.x}px`),t?.y!=null&&o.style.setProperty("top",`${t.y}px`),o.style.setProperty(n,"-6px");}var co=150,xe=class extends w{constructor(){super(...arguments);this.tooltip=null;this.arrowEl=null;this.badgeBtn=null;this.open=false;this.shownEmitted=false;this.trigger="hover";this.side="top";this.closeTimer=null;this.stopFloat=null;}async render(t){let n=t.guide.guideSteps[0];if(!n)return;let i=n.selector??t.guide.activationRules.selector;if(typeof i!="string"||i.length===0)return;let r=await k(i);if(!r)return;let{host:s,root:a}=this.createHost(),l=a.ownerDocument??document;this.applyDesign(n.style);let d=n.style?.width;typeof d=="number"&&Number.isFinite(d)&&s.style.setProperty("--veo-badge-tip-width",`${Math.min(720,Math.max(220,d))}px`),this.trigger=n.style?.badgeTrigger==="click"?"click":"hover";let c=n.style?.tooltipPlacement;this.side=c==="bottom"||c==="left"||c==="right"?c:"top";let p=K(n.style);s.style.display="inline-flex",s.style.verticalAlign="middle";let m=pn(un(n),l);a.appendChild(m),this.badgeBtn=m,A(r,s,p),this.registerCleanup(M(s,i,p));let u=l.createElement("div");u.className="veo-tooltip veo-badge-tooltip",u.style.display="none";let f=(y,C)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:y,...C?{metadata:C}:{}});},h=y=>P(y,l,{onCtaClick:(C,S,q)=>{f("cta_clicked",q),C==="url"&&S&&window.open(S,"_blank","noopener,noreferrer"),this.closeTooltip(),C==="guide"&&S&&t.onOpenGuide?.(S);},onDismiss:()=>this.closeTooltip()}),g=h(n);u.appendChild(g);let v=l.createElement("div");v.className="veo-tooltip-arrow",u.appendChild(v),a.appendChild(u),this.tooltip=u,this.arrowEl=v,this.liveContainer=u,this.liveContent=g,this.liveKey=this.liveKeyOf(n),this.liveBuild=h;let b=()=>{this.cancelClose(),this.open||(this.openTooltip(m),this.shownEmitted||(this.shownEmitted=true,f("shown")));};if(this.trigger==="hover"){let y=()=>{this.cancelClose(),this.closeTimer=window.setTimeout(()=>this.closeTooltip(),co);};m.addEventListener("mouseenter",b),m.addEventListener("focus",b),m.addEventListener("mouseleave",y),m.addEventListener("blur",y),u.addEventListener("mouseenter",()=>this.cancelClose()),u.addEventListener("mouseleave",y);}else {m.addEventListener("click",()=>{this.open?this.closeTooltip():b();});let y=C=>{this.open&&(C.composedPath().includes(s)||this.closeTooltip());};document.addEventListener("click",y,true),this.registerCleanup(()=>document.removeEventListener("click",y,true));}let x=y=>{y.key==="Escape"&&this.open&&this.closeTooltip();};document.addEventListener("keydown",x),this.registerCleanup(()=>document.removeEventListener("keydown",x)),t.isPreview&&b();}liveKeyOf(t){let n=t.selector??"",i=K(t.style),r=t.style?.badgeTrigger==="click"?"click":"hover";return `${n}|${i}|${r}`}onLiveUpdate(t){if(this.badgeBtn){let i=this.badgeBtn.ownerDocument,r=pn(un(t),i);this.badgeBtn.className=r.className,this.badgeBtn.setAttribute("style",r.getAttribute("style")??""),this.badgeBtn.replaceChildren(...Array.from(r.childNodes));}let n=t.style?.tooltipPlacement;this.side=n==="bottom"||n==="left"||n==="right"?n:"top",this.open&&this.badgeBtn&&this.position(this.badgeBtn);}destroy(){this.cancelClose(),this.stopFloat?.(),this.stopFloat=null,this.tooltip=null,this.arrowEl=null,this.badgeBtn=null,this.open=false,super.destroy();}openTooltip(t){if(!this.tooltip)return;this.tooltip.style.display="block",this.open=true,this.position(t);let n=()=>{this.position(t);};window.addEventListener("scroll",n,true),window.addEventListener("resize",n),this.stopFloat=()=>{window.removeEventListener("scroll",n,true),window.removeEventListener("resize",n);};}closeTooltip(){this.cancelClose(),!(!this.tooltip||!this.open)&&(this.tooltip.style.display="none",this.open=false,this.stopFloat?.(),this.stopFloat=null);}cancelClose(){this.closeTimer!==null&&(window.clearTimeout(this.closeTimer),this.closeTimer=null);}async position(t){let n=this.tooltip,i=this.arrowEl;if(!n||!i)return;let{x:r,y:s,placement:a,middlewareData:l}=await z(t,n,{strategy:"fixed",placement:this.side,middleware:[H(8),W(),D({padding:8}),ee({element:i})]});n.style.left=`${r}px`,n.style.top=`${s}px`,te(i,a,l.arrow);}};function un(o){let e=o.style?.badge;if(!e||typeof e!="object")return {kind:"icon"};let t=e;return {kind:t.kind==="dot"||t.kind==="pill"||t.kind==="text"||t.kind==="image"||t.kind==="icon"?t.kind:"icon",icon:typeof t.icon=="string"?t.icon:null,text:typeof t.text=="string"?t.text:null,imageUrl:typeof t.imageUrl=="string"?t.imageUrl:null,color:typeof t.color=="string"&&U.test(t.color.trim())?t.color.trim():null,size:typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}}function He(o,e,t){return Math.min(t,Math.max(e,o))}function pn(o,e){let t=e.createElement("button");t.type="button",t.className=`veo-badge veo-badge--${o.kind}`,t.setAttribute("aria-label","M\xE1s informaci\xF3n");let n=He(o.size??18,8,48);switch(o.kind){case "dot":t.style.width=`${n}px`,t.style.height=`${n}px`,o.color&&(t.style.background=o.color);break;case "pill":{t.textContent=o.text?.slice(0,24)||"Nuevo",t.style.fontSize=`${He(Math.round(n*.62),8,24)}px`,o.color&&(t.style.background=o.color);break}case "text":{t.textContent=o.text?.slice(0,32)||"Nuevo",t.style.fontSize=`${He(Math.round(n*.7),9,28)}px`,o.color&&(t.style.color=o.color);break}case "image":{if(o.imageUrl&&R(o.imageUrl)){let i=e.createElement("img");i.src=o.imageUrl,i.alt="",i.style.width=`${n}px`,i.style.height=`${n}px`,t.appendChild(i);}else t.className="veo-badge veo-badge--icon",t.textContent="?",t.style.width=`${n}px`,t.style.height=`${n}px`,t.style.fontSize=`${He(Math.round(n*.62),8,32)}px`;break}default:{t.textContent=(o.icon||"\u2139\uFE0F").slice(0,4),t.style.width=`${n}px`,t.style.height=`${n}px`,t.style.fontSize=`${He(Math.round(n*.62),8,32)}px`,o.color&&(t.style.color=o.color);break}}return t}function Ce(o,e,t,n,i){let r=n.createElement("div");r.className="veo-guide-content";let s=n.createElement("div");s.className="veo-walkthrough-counter",s.textContent=`Paso ${e+1} de ${t}`,r.appendChild(s);let a=n.createElement("div");a.className="veo-walkthrough-progress";for(let f=0;f<t;f++){let h=n.createElement("span");h.className="veo-walkthrough-progress-dot",f<e&&h.classList.add("completed"),f===e&&h.classList.add("active"),a.appendChild(h);}r.appendChild(a);for(let f of on(o,n))r.appendChild(f);let l=n.createElement("div");l.className="veo-walkthrough-actions";let d=n.createElement("button");d.type="button",d.className="veo-walkthrough-skip",d.textContent="Omitir",d.addEventListener("click",()=>i.onSkip()),l.appendChild(d);let c=n.createElement("div");if(c.className="veo-walkthrough-actions-right",e>0){let f=n.createElement("button");f.type="button",f.className="veo-walkthrough-btn-secondary",f.textContent="Atr\xE1s",f.addEventListener("click",()=>i.onBack()),c.appendChild(f);}let p=e===t-1,m=n.createElement("button");m.type="button",m.className="veo-guide-cta";let u=p?"Finalizar":"Siguiente";return m.textContent=typeof o.ctaText=="string"&&o.ctaText?o.ctaText:u,m.addEventListener("click",()=>{p?i.onComplete():i.onNext();}),c.appendChild(m),l.appendChild(c),r.appendChild(l),r.appendChild(pe(n,()=>i.onSkip())),r}var ne=class extends w{async render(e){let t=e.nav?.stepIndex??0,n=e.guide.guideSteps[t];if(!n)return;let i=n.style?.position==="bottom"?"bottom":"top",r=n.selector?.trim()||null,s=null;if(r&&(s=await k(r),!s))return;let{host:a,root:l}=this.createHost();this.applyDesign(n.style);let d=l.ownerDocument??document,c=d.createElement("div");c.className=fn(i,!!s);let p=(u,f,h)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:t,action:u,...h?{metadata:h}:{}}),f&&window.open(f,"_blank","noopener,noreferrer"),e.onClose();},m=e.nav?Ce(n,e.nav.stepIndex,e.nav.totalSteps,d,e.nav.callbacks):P(n,d,{onCtaClick:(u,f,h)=>{p("cta_clicked",u==="url"?f:void 0,h),u==="guide"&&f&&e.onOpenGuide?.(f);},onDismiss:()=>p("dismissed")});if(c.appendChild(m),l.appendChild(c),r&&s){a.style.display="block";let u=i==="top"?"prepend":"append";A(s,a,u),this.registerCleanup(M(a,r,u));}e.nav||(this.liveContainer=c,this.liveContent=m,this.liveBuild=u=>P(u,d,{onCtaClick:(f,h,g)=>{p("cta_clicked",f==="url"?h:void 0,g),f==="guide"&&h&&e.onOpenGuide?.(h);},onDismiss:()=>p("dismissed")}),this.liveKey=this.liveKeyOf(n),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"}));}liveKeyOf(e){let t=e.selector?.trim()??"";if(!t)return "";let n=e.style?.position==="bottom"?"bottom":"top";return `${t}|${n}`}onLiveUpdate(e){if(this.liveContainer){let t=e.style?.position==="bottom"?"bottom":"top",n=!!e.selector?.trim();this.liveContainer.className=fn(t,n);}}};function fn(o,e){return e?"veo-banner veo-banner-embedded":`veo-banner veo-banner-${o}`}function mn(){let e=Date.now().toString(16).padStart(12,"0"),t=new Uint8Array(10);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(t);else for(let i=0;i<t.length;i++)t[i]=Math.floor(Math.random()*256);t[0]=(t[0]??0)&15|112,t[2]=(t[2]??0)&63|128;let n=Array.from(t,i=>i.toString(16).padStart(2,"0")).join("");return [e.slice(0,8),e.slice(8,12),n.slice(0,4),n.slice(4,8),n.slice(8,20)].join("-")}function Se(o,e,t,n){let i=o.createElement("iframe");i.className="veo-custom-frame",i.setAttribute("sandbox","allow-scripts"),i.setAttribute("title",t.guide.guideName||"OnUser"),i.style.width=n.width;let r=n.fixedHeight!==void 0&&n.fixedHeight!==null;r&&(i.style.height=vt(n.fixedHeight));let s=mn(),a=e.style?.tailwind===true;i.srcdoc=ho(e.html??"",e.css??"",e.js??"",s,{hostCss:po(),htmlAttrs:fo(),tailwind:a});let l=()=>t.onClose(),d=c=>{if(c.source!==i.contentWindow)return;let p=c.data;if(!(!p||typeof p!="object"||p.__veo!==s))switch(p.type){case "dismiss":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"dismissed"}),l();break;case "cta":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"cta_clicked"}),typeof p.url=="string"&&R(p.url)&&window.open(p.url,"_blank","noopener,noreferrer"),p.close!==false&&l();break;case "navigate":typeof p.url=="string"&&R(p.url)&&window.location.assign(p.url);break;case "track":typeof p.name=="string"&&t.onTrack&&t.onTrack(p.name,mo(p.props)?p.props:void 0);break;case "resize":!r&&typeof p.height=="number"&&p.height>0&&(i.style.height=`${Math.ceil(p.height)}px`);break}};return window.addEventListener("message",d),{iframe:i,cleanup:()=>window.removeEventListener("message",d)}}function vt(o){return typeof o=="number"?`${o}px`:o}var uo=800*1024;function po(){if(typeof document>"u")return "";let o="";try{for(let e of Array.from(document.styleSheets)){let t=null;try{t=e.cssRules;}catch{continue}if(t){for(let n of Array.from(t))if(o+=`${n.cssText}
|
|
426
|
-
`,o.length>uo)return o}}}catch{return o}return o}function fo(){if(typeof document>"u")return "";try{let o=document.documentElement,e=[];for(let t of ["class","style","data-theme","data-mode","data-color-mode"]){let n=o.getAttribute(t);n&&n.length<=1e3&&!/["<>]/.test(n)&&e.push(`${t}="${n}"`);}return e.join(" ")}catch{return ""}}function mo(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function ho(o,e,t,n,i){let r=`(function(){var T=${JSON.stringify(n)};function P(m){m.__veo=T;parent.postMessage(m,'*');}window.veo={dismiss:function(){P({type:'dismiss'});},cta:function(u){P({type:'cta',url:u});},track:function(n,p){P({type:'track',name:n,props:p||{}});},navigate:function(u){P({type:'navigate',url:u});}};document.addEventListener('click',function(e){var a=e.target&&e.target.closest?e.target.closest('a[href]'):null;if(!a)return;var h=a.getAttribute('href');if(!h||h.charAt(0)==='#'||/^(javascript|mailto|tel):/i.test(h))return;e.preventDefault();if(a.target==='_blank'){P({type:'cta',url:a.href,close:false});}else{P({type:'navigate',url:h});}},true);function H(){var r=document.getElementById('__veo_root');var h=r?r.getBoundingClientRect().height:document.documentElement.scrollHeight;P({type:'resize',height:Math.ceil(h)});}window.addEventListener('load',H);try{if(typeof ResizeObserver!=='undefined'){var _r=document.getElementById('__veo_root');new ResizeObserver(H).observe(_r||document.documentElement);}}catch(e){}})();`,s=i.hostCss?`<style>${gt(i.hostCss,"style")}</style>`:"",a=i.tailwind?'<script src="https://cdn.tailwindcss.com"></script>':"";return `<!DOCTYPE html><html ${i.htmlAttrs}><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;}body{font-family:system-ui,-apple-system,sans-serif;}</style>`+s+"<style>html,body{margin:0!important;padding:0!important;background:transparent!important;height:auto!important;min-height:0!important;max-height:none!important;width:auto!important;min-width:0!important;overflow:visible!important;color-scheme:normal!important;}</style>"+a+`<style>${gt(e,"style")}</style></head><body style="margin:0!important;background:transparent!important;min-height:0!important;height:auto!important;"><div id="__veo_root">${o}</div><script>${r}</script>`+(t?`<script>${gt(t,"script")}</script>`:"")+"</body></html>"}function gt(o,e){let t=e==="script"?/<\/script/gi:/<\/style/gi;return o.replace(t,`<\\/${e}`)}function hn(o,e,t){if(o.sandboxed){let s={html:o.html??"",css:o.css,js:o.js},{iframe:a,cleanup:l}=Se(e,s,t,{width:"100%"}),d=e.createElement("div");return d.className="veo-code-sandbox",d.appendChild(a),{node:d,cleanup:l}}let n=e,i=[];if(typeof o.css=="string"&&o.css.trim()){let s=n.createElement("style");s.textContent=o.css,n.head.appendChild(s),i.push(s);}let r=null;if(typeof o.html=="string"&&o.html.trim()){r=e.createElement("div"),r.className="veo-code-html",r.innerHTML=o.html;for(let s of Array.from(r.querySelectorAll("script")))i.push(go(s,n)),s.remove();}if(typeof o.js=="string"&&o.js.trim()){let s=n.createElement("script");s.textContent=o.js,n.body.appendChild(s),i.push(s);}return {node:r,cleanup:()=>{for(let s of i)s.parentNode?.removeChild(s);}}}function go(o,e){let t=e.createElement("script");for(let n of Array.from(o.attributes))t.setAttribute(n.name,n.value);return o.src||(t.textContent=o.textContent),e.body.appendChild(t),t}function ot(o,e,t){let n=e.guide.guideSteps[0];if(!n)return;let i=n.fields??[],r=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();},s=t.createElement("div");if(s.className="veo-guide-content",n.title){let m=t.createElement("h2");m.className="veo-guide-title",m.textContent=n.title,s.appendChild(m);}if(n.content){let m=t.createElement("p");m.className="veo-guide-text",m.textContent=n.content,s.appendChild(m);}let a=[],l=t.createElement("form");l.className="veo-form",l.noValidate=true;for(let m of i){let{wrapper:u,read:f}=yt(m,t);a.push({field:m,read:f}),l.appendChild(u);}let d=t.createElement("p");d.className="veo-form-error",d.style.display="none",l.appendChild(d);let c=t.createElement("div");c.className="veo-guide-actions";let p=t.createElement("button");p.type="submit",p.className="veo-guide-cta",p.textContent=n.ctaText||"Enviar",c.appendChild(p),l.appendChild(c),l.addEventListener("submit",m=>{m.preventDefault(),d.style.display="none";let u={};for(let{field:h,read:g}of a){let v=g();if(v==null||v===""){if(h.required){d.textContent=`Completa "${h.label}"`,d.style.display="block";return}continue}u[h.key]=v;}if(Object.keys(u).length===0){d.textContent="Responde al menos un campo",d.style.display="block";return}p.disabled=true,(e.onFormSubmit??(()=>Promise.resolve(true)))(u).then(h=>{if(!h){p.disabled=false,d.textContent="No se pudo enviar. Prueba de nuevo.",d.style.display="block";return}e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"completed"});let g=e.isPreview?e.previewNote??"Vista previa: la respuesta NO se guard\xF3.":null;vo(o,t,g),window.setTimeout(()=>e.onClose(),g?2200:1400);});}),s.appendChild(l),s.appendChild(pe(t,r)),o.appendChild(s);}function vo(o,e,t){for(;o.firstChild;)o.removeChild(o.firstChild);let n=e.createElement("div");if(n.className="veo-form-thanks",n.textContent="\u2713 \xA1Gracias por tu respuesta!",o.appendChild(n),t){let i=e.createElement("p");i.className="veo-form-preview-note",i.textContent=t,o.appendChild(i);}}function yt(o,e){let t=e.createElement("div");t.className="veo-form-field";let n=e.createElement("label");switch(n.className="veo-form-label",n.textContent=o.required?`${o.label} *`:o.label,t.appendChild(n),o.type){case "textarea":{let i=e.createElement("textarea");return i.className="veo-form-input",i.rows=3,o.placeholder&&(i.placeholder=o.placeholder),t.appendChild(i),{wrapper:t,read:()=>i.value.trim()}}case "number":{let i=e.createElement("input");return i.type="number",i.className="veo-form-input",o.placeholder&&(i.placeholder=o.placeholder),t.appendChild(i),{wrapper:t,read:()=>i.value.trim()===""?void 0:Number(i.value)}}case "select":{let i=e.createElement("select");i.className="veo-form-input";let r=e.createElement("option");r.value="",r.textContent=o.placeholder||"Elige una opci\xF3n\u2026",i.appendChild(r);for(let s of o.options??[]){let a=e.createElement("option");a.value=s,a.textContent=s,i.appendChild(a);}return t.appendChild(i),{wrapper:t,read:()=>i.value||void 0}}case "radio":{let i=e.createElement("div");i.className="veo-form-options";let r=`veo-${o.key}`,s=[];for(let a of o.options??[]){let l=e.createElement("label");l.className="veo-form-option";let d=e.createElement("input");d.type="radio",d.name=r,d.value=a,s.push(d);let c=e.createElement("span");c.textContent=a,l.appendChild(d),l.appendChild(c),i.appendChild(l);}return t.appendChild(i),{wrapper:t,read:()=>s.find(a=>a.checked)?.value}}case "multiselect":{let i=e.createElement("div");i.className="veo-form-options";let r=[];for(let s of o.options??[]){let a=e.createElement("label");a.className="veo-form-option";let l=e.createElement("input");l.type="checkbox",l.value=s,r.push(l);let d=e.createElement("span");d.textContent=s,a.appendChild(l),a.appendChild(d),i.appendChild(a);}return t.appendChild(i),{wrapper:t,read:()=>{let s=r.filter(a=>a.checked).map(a=>a.value);return s.length>0?s:void 0}}}case "checkbox":{let i=e.createElement("label");i.className="veo-form-option";let r=e.createElement("input");r.type="checkbox";let s=e.createElement("span");return s.textContent=o.placeholder||"S\xED",i.appendChild(r),i.appendChild(s),t.appendChild(i),{wrapper:t,read:()=>r.checked?true:o.required?"":false}}case "yesno":{let i=e.createElement("div");i.className="veo-form-options";let r=`veo-${o.key}`,[s,a]=o.options?.length===2?o.options:["S\xED","No"],l=[];for(let{label:d,value:c}of [{label:s,value:true},{label:a,value:false}]){let p=e.createElement("label");p.className="veo-form-option";let m=e.createElement("input");m.type="radio",m.name=r,l.push({input:m,value:c});let u=e.createElement("span");u.textContent=d,p.appendChild(m),p.appendChild(u),i.appendChild(p);}return t.appendChild(i),{wrapper:t,read:()=>l.find(d=>d.input.checked)?.value}}case "nps":return gn(t,e,0,10,"veo-nps-btn");case "rating":return gn(t,e,1,5,"veo-rating-btn","\u2605");default:{let i=e.createElement("input");return i.type="text",i.className="veo-form-input",o.placeholder&&(i.placeholder=o.placeholder),t.appendChild(i),{wrapper:t,read:()=>i.value.trim()}}}}function gn(o,e,t,n,i,r){let s=e.createElement("div");s.className="veo-form-scale";let a,l=[];for(let d=t;d<=n;d++){let c=e.createElement("button");c.type="button",c.className=i,c.textContent=r??String(d),c.setAttribute("aria-label",String(d)),c.addEventListener("click",()=>{a=d,l.forEach((p,m)=>{let u=r?m+t<=d:m+t===d;p.classList.toggle("veo-scale-active",u);});}),l.push(c),s.appendChild(c);}return o.appendChild(s),{wrapper:o,read:()=>a}}var yo={left:"flex-start",center:"center",right:"flex-end"},me=class extends w{async render(e){let t=e.nav?.stepIndex??0,n=e.guide.guideSteps[t];if(!n)return;let i=(n.position==="relative-to-element"||n.presentation==="inline")&&n.anchorSelector?.trim()||void 0,r=null;if(i&&(r=await k(i),!r))return;let{host:s,root:a}=this.createHost(),l=a.ownerDocument??document,d=n.design??{};typeof d.zIndex=="number"&&(s.style.zIndex=String(d.zIndex));let c=l.createElement("div");c.className="veo-card",Io(c,d);let p=(u,f)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:t,action:u,...{}});},m=[];if(this.buildContent(c,n.blocks??[],l,e,t,m),d.closeButton!==false){let u=pe(l,()=>{p("dismissed"),this.closeOrSkip(e);}),f=typeof d.closeColor=="string"?d.closeColor:null,h=typeof d.closeHoverColor=="string"?d.closeHoverColor:null;f&&(u.style.color=f);let g=typeof d.closePosition=="string"?d.closePosition:"top-right";xo(u,g),So(c,g),h&&(u.addEventListener("mouseenter",()=>{u.style.color=h;}),u.addEventListener("mouseleave",()=>{u.style.color=f??"";})),c.appendChild(u);}if(n.presentation==="inline"&&r){s.style.display="block";let u=bo(n.inlinePosition);a.appendChild(c),A(r,s,u),this.registerCleanup(M(s,i,u));}else if(n.position==="relative-to-element"&&r){if(d.backdrop===true){let h=l.createElement("div");h.className="veo-composite-overlay veo-composite-overlay--dim",typeof d.backdropColor=="string"&&(h.style.background=d.backdropColor);let g=typeof d.backdropZIndex=="number"?d.backdropZIndex:2e5;h.style.zIndex=String(g),a.appendChild(h),d.targetAbove===true&&this.registerCleanup(Eo(r,g+1));}let u=l.createElement("div");u.className="veo-composite-anchored";let f=d.caret===false?null:ko(l,d);f&&u.appendChild(f),u.appendChild(c),a.appendChild(u),this.registerCleanup(await Ro(r,u,f));}else {let u=l.createElement("div");u.className="veo-composite-overlay",d.backdrop!==false&&(u.classList.add("veo-composite-overlay--dim"),typeof d.backdropColor=="string"&&(u.style.background=d.backdropColor),typeof d.backdropZIndex=="number"&&(u.style.zIndex=String(d.backdropZIndex)),u.addEventListener("click",f=>{f.target===u&&(p("dismissed"),this.closeOrSkip(e));})),wo(c,n.position,d),u.appendChild(c),a.appendChild(u);}e.onInteraction({guideId:e.guide.guideId,stepIndex:t,action:"shown"});}buildContent(e,t,n,i,r,s){let a=d=>{i.onInteraction({guideId:i.guide.guideId,stepIndex:r,action:"cta_clicked",...d.id?{metadata:{buttonId:d.id}}:{}});},l=0;for(;l<t.length;){let d=t[l];if(!d){l++;continue}if(d.type==="button"){let p=n.createElement("div");p.className="veo-guide-actions";let m;for(;l<t.length&&t[l]?.type==="button";){let u=t[l];if(!m){let f=u.style?.align;(f==="left"||f==="center"||f==="right")&&(m=f);}p.appendChild(this.buildButton(u,n,i,r,s,a)),l++;}m&&(p.style.justifyContent=yo[m]??"flex-end"),e.appendChild(p);continue}if(d.type==="code"){let{node:p,cleanup:m}=hn(d,n,i);p&&e.appendChild(p),this.registerCleanup(m),l++;continue}if(d.type==="form"){let p=n.createElement("div");p.className="veo-form";for(let m of d.fields??[]){let{wrapper:u,read:f}=yt(m,n);s.push({field:m,read:f}),p.appendChild(u);}e.appendChild(p),l++;continue}let c=nt(d,n);c&&e.appendChild(c),l++;}}buildButton(e,t,n,i,r,s){let a=t.createElement("button");a.type="button",a.className="veo-guide-cta",a.textContent=e.text?.trim()||"OK",we(a,e.style,"button");let l=n.nav?.callbacks;return a.addEventListener("click",()=>{switch(e.action){case "next":s(e),l?l.onNext():n.onClose();break;case "prev":s(e),l?.onBack();break;case "url":s(e),typeof e.url=="string"&&R(e.url)&&window.open(e.url,"_blank","noopener,noreferrer");break;case "guide":s(e),e.targetGuideId&&n.onOpenGuide?.(e.targetGuideId),this.closeOrSkip(n);break;case "submit-forms":case "submit-forms-advance":case "submit-forms-goto":this.submitForms(r,n,i,a,()=>{s(e),e.action==="submit-forms"||!l?n.onClose():e.action==="submit-forms-goto"&&typeof e.targetStep=="number"&&l.onGoto?l.onGoto(e.targetStep):l.onNext();});break;default:s(e),this.closeOrSkip(n);}}),a}submitForms(e,t,n,i,r){let s={};for(let{field:l,read:d}of e){let c=d();if(c==null||c===""){if(l.required){i.textContent=`Completa "${l.label}"`;return}continue}s[l.key]=c;}if(e.length>0&&Object.keys(s).length===0)return;i.disabled=true,(t.onFormSubmit??(()=>Promise.resolve(true)))(s).then(l=>{i.disabled=false,l&&(t.onInteraction({guideId:t.guide.guideId,stepIndex:n,action:"completed"}),r());});}closeOrSkip(e){e.nav?.callbacks?e.nav.callbacks.onSkip():e.onClose();}};function bo(o){return o==="before"||o==="prepend"||o==="append"?o:"after"}function wo(o,e,t){let n=o.style;n.position="fixed";let i="16px",r=t.hAlign==="left"?"left":t.hAlign==="right"?"right":null,s=e.includes("top")?"top":e.includes("bottom")?"bottom":"middle",a=r??(e.includes("left")?"left":e.includes("right")?"right":"middle");s==="top"?n.top=i:s==="bottom"?n.bottom=i:n.top="50%",a==="left"?n.left=i:a==="right"?n.right=i:n.left="50%";let l=a==="middle"?"-50%":"0",d=s==="middle"?"-50%":"0";n.transform=l==="0"&&d==="0"?"":`translate(${l}, ${d})`;}var vn="10px";function xo(o,e){let t=o.style;t.top="auto",t.right="auto",t.bottom="auto",t.left="auto";let n=e.includes("bottom")?"bottom":"top",i=e.includes("left")?"left":"right";t.setProperty(n,vn),t.setProperty(i,vn);}var Co="34px";function So(o,e){let t=Array.from(o.children).filter(i=>i instanceof HTMLElement&&!i.classList.contains("veo-guide-close"));if(t.length===0)return;let n=e.includes("bottom")?t[t.length-1]:t[0];n&&(n.style[e.includes("left")?"paddingLeft":"paddingRight"]=Co);}function ko(o,e){let t=o.createElement("div");t.className="veo-composite-caret";let n=typeof e.caretWidth=="number"?e.caretWidth:12,i=typeof e.caretHeight=="number"?e.caretHeight:12,r=t.style;if(r.position="absolute",r.width=`${n}px`,r.height=`${i}px`,r.transform="rotate(45deg)",r.background=typeof e.background=="string"?e.background:"#ffffff",typeof e.borderWidth=="number"&&e.borderWidth>0){let s=typeof e.borderColor=="string"?e.borderColor:"#bbbbbb";r.border=`${e.borderWidth}px solid ${s}`;}return t}function Eo(o,e){let t=o,n=t.style.position,i=t.style.zIndex;return getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.style.zIndex=String(e),()=>{t.style.position=n,t.style.zIndex=i;}}async function Ro(o,e,t){let n=async()=>{let{x:r,y:s,placement:a,middlewareData:l}=await z(o,e,{placement:"bottom",strategy:"fixed",middleware:[H(t?10:8),W(),D({padding:8}),...t?[ee({element:t})]:[]]});e.style.left=`${r}px`,e.style.top=`${s}px`,t&&te(t,a,l.arrow);};await n();let i=()=>{n();};return window.addEventListener("scroll",i,true),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i,true),window.removeEventListener("resize",i);}}function Io(o,e){let t=o.style,n=a=>typeof a=="number"&&Number.isFinite(a)?`${a}px`:null,i=a=>typeof a=="string"&&a?a:null;i(e.background)&&(t.background=e.background);let r=i(e.color)??i(e.textColor);r&&(t.color=r),n(e.fontSize)&&(t.fontSize=n(e.fontSize)),i(e.fontWeight)&&(t.fontWeight=e.fontWeight),i(e.fontFamily)&&e.fontFamily!=="inherit"&&(t.fontFamily=e.fontFamily),i(e.textTransform)&&e.textTransform!=="none"&&(t.textTransform=e.textTransform),typeof e.letterSpacing=="number"&&(t.letterSpacing=`${e.letterSpacing}px`),i(e.align)&&(t.textAlign=e.align),typeof e.lineHeight=="number"&&(t.lineHeight=`${e.lineHeight}%`),n(e.radius)&&(t.borderRadius=n(e.radius));let s=n(e.borderWidth);if(s&&(t.border=`${s} solid ${i(e.borderColor)??"#e5e5e5"}`),i(e.shadowColor)||typeof e.shadowBlur=="number"){let a=l=>typeof e[l]=="number"?e[l]:0;t.boxShadow=`${a("shadowX")}px ${a("shadowY")}px ${a("shadowBlur")}px ${a("shadowSpread")}px ${i(e.shadowColor)??"rgba(0,0,0,0.2)"}`;}e.fullWidth===true?t.width="100%":e.widthType==="fluid"?(t.width="auto",n(e.width)&&(t.maxWidth=n(e.width))):n(e.width)&&(t.width=n(e.width));for(let a of ["Top","Right","Bottom","Left"]){let l=n(e[`padding${a}`]);l&&t.setProperty(`padding-${a.toLowerCase()}`,l);let d=n(e[`margin${a}`]);d&&t.setProperty(`margin-${a.toLowerCase()}`,d);}}var To={mode:"floating",position:"bottom-right"},yn=16,Po=360,ke=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let n=t.placement??To,i=null;if(n.mode==="anchored"){let c=n.selector??t.selector??e.guide.activationRules.selector;if(typeof c!="string"||c.length===0||(i=await k(c),!i))return}let{root:r}=this.createHost(),s=r.ownerDocument??document,a=s.createElement("div");a.className=n.mode==="anchored"?"veo-custom-anchored":"veo-custom-floating";let{iframe:l,cleanup:d}=Se(s,t,e,{width:vt(n.width??Po),fixedHeight:n.height??null});this.registerCleanup(d),a.appendChild(l),r.appendChild(a),n.mode==="floating"?Ao(a,n):i&&this.registerCleanup(await this.setupAnchoredPosition(i,a,n)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}async setupAnchoredPosition(e,t,n){let i=n.side??"bottom",r=async()=>{let{x:a,y:l}=await z(e,t,{placement:i,strategy:"fixed",middleware:[H(n.offsetY??8),W(),D({padding:8})]});t.style.left=`${a}px`,t.style.top=`${l}px`;};await r();let s=()=>{r();};return window.addEventListener("scroll",s,true),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s,true),window.removeEventListener("resize",s);}}};function Ao(o,e){let t=e.position??"bottom-right",n=`${e.offsetX??yn}px`,i=`${e.offsetY??yn}px`,r=o.style;if(t==="center"){r.top="50%",r.left="50%",r.transform="translate(-50%, -50%)";return}let[s,a]=t.split("-");s==="top"?r.top=i:r.bottom=i,a==="left"?r.left=n:a==="right"?r.right=n:(r.left="50%",r.transform="translateX(-50%)");}var Ee=class extends w{render(e){let t=e.guide.guideSteps[0];if(!t||(t.fields??[]).length===0)return;let{root:n}=this.createHost();this.applyDesign(t.style);let i=n.ownerDocument??document,r=i.createElement("div");r.className="veo-modal-overlay";let s=i.createElement("div");s.className="veo-modal-card",ot(s,e,i),r.appendChild(s),n.appendChild(r);let a=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();};r.addEventListener("click",d=>{d.target===r&&a();});let l=d=>{d.key==="Escape"&&a();};document.addEventListener("keydown",l),this.registerCleanup(()=>document.removeEventListener("keydown",l)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var Re=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let n=t.selector??e.guide.activationRules.selector;if(typeof n!="string"||n.length===0)return;let i=await k(n);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=K(t.style);A(i,r,a),this.registerCleanup(M(r,n,a));let l=s.ownerDocument??document,d=l.createElement("div");d.className="veo-custom-inline";let{iframe:c,cleanup:p}=Se(l,t,e,{width:"100%"});this.registerCleanup(p),d.appendChild(c),s.appendChild(d),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var Ie=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t||(t.fields??[]).length===0)return;let n=t.selector??e.guide.activationRules.selector;if(typeof n!="string"||n.length===0)return;let i=await k(n);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=K(t.style);A(i,r,a),this.registerCleanup(M(r,n,a)),this.applyDesign(t.style);let l=s.ownerDocument??document,d=l.createElement("div");d.className="veo-inline",ot(d,e,l),s.appendChild(d),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var Te=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t)return;let n=t.selector??e.guide.activationRules.selector;if(typeof n!="string"||n.length===0)return;let i=await k(n);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=K(t.style);A(i,r,a),this.registerCleanup(M(r,n,a)),this.applyDesign(t.style);let l=s.ownerDocument??document,d=l.createElement("div");d.className="veo-inline";let c=(m,u,f)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:m,...f?{metadata:f}:{}}),u&&window.open(u,"_blank","noopener,noreferrer"),e.onClose();},p=P(t,l,{onCtaClick:(m,u,f)=>{c("cta_clicked",m==="url"?u:void 0,f),m==="guide"&&u&&e.onOpenGuide?.(u);},onDismiss:()=>c("dismissed")});d.appendChild(p),s.appendChild(d),this.liveContainer=d,this.liveContent=p,this.liveKey=`${n}|${a}`,this.liveBuild=m=>P(m,l,{onCtaClick:(u,f,h)=>{c("cta_clicked",u==="url"?f:void 0,h),u==="guide"&&f&&e.onOpenGuide?.(f);},onDismiss:()=>c("dismissed")}),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}liveKeyOf(e){return `${e.selector??""}|${K(e.style)}`}};function bn(o){return o.style?.backdrop===false?"veo-modal-overlay veo-modal-overlay--none":"veo-modal-overlay"}var oe=class extends w{constructor(){super(...arguments);this.overlay=null;}render(t){let n=t.nav?.stepIndex??0,i=t.guide.guideSteps[n];if(!i)return;let{root:r}=this.createHost();this.applyDesign(i.style);let s=r.ownerDocument??document,a=s.createElement("div");a.className=bn(i),this.overlay=a;let l=s.createElement("div");l.className="veo-modal-card";let d=(u,f,h)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:n,action:u,...h?{metadata:h}:{}}),f&&window.open(f,"_blank","noopener,noreferrer"),t.onClose();},c=()=>{t.nav?t.nav.callbacks.onSkip():d("dismissed");},p=t.nav?Ce(i,t.nav.stepIndex,t.nav.totalSteps,s,t.nav.callbacks):P(i,s,{onCtaClick:(u,f,h)=>{d("cta_clicked",u==="url"?f:void 0,h),u==="guide"&&f&&t.onOpenGuide?.(f);},onDismiss:()=>d("dismissed")});l.appendChild(p),a.appendChild(l),r.appendChild(a),t.nav||(this.liveContainer=l,this.liveContent=p,this.liveBuild=u=>P(u,s,{onCtaClick:(f,h,g)=>{d("cta_clicked",f==="url"?h:void 0,g),f==="guide"&&h&&t.onOpenGuide?.(h);},onDismiss:()=>d("dismissed")})),a.addEventListener("click",u=>{u.target===a&&c();});let m=u=>{u.key==="Escape"&&c();};document.addEventListener("keydown",m),this.registerCleanup(()=>document.removeEventListener("keydown",m)),t.nav||t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}onLiveUpdate(t){this.overlay&&(this.overlay.className=bn(t));}destroy(){this.overlay=null,super.destroy();}};var Pe=class extends w{constructor(){super(...arguments);this.side="bottom";this.reposition=null;}async render(t){let n=t.guide.guideSteps[0];if(!n)return;let i=n.selector??t.guide.activationRules.selector;if(typeof i!="string"||i.length===0)return;let r=await k(i);if(!r)return;let s=n.style?.tooltipPlacement;this.side=s==="top"||s==="left"||s==="right"?s:"bottom";let{root:a}=this.createHost();this.applyDesign(n.style);let l=a.ownerDocument??document,d=l.createElement("div");d.className="veo-tooltip";let c=(h,g,v)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:h,...v?{metadata:v}:{}}),g&&window.open(g,"_blank","noopener,noreferrer"),t.onClose();},p=P(n,l,{onCtaClick:(h,g,v)=>{c("cta_clicked",h==="url"?g:void 0,v),h==="guide"&&g&&t.onOpenGuide?.(g);},onDismiss:()=>c("dismissed")});d.appendChild(p);let m=l.createElement("div");m.className="veo-tooltip-arrow",d.appendChild(m),a.appendChild(d);let u=async()=>{let{x:h,y:g,placement:v,middlewareData:b}=await z(r,d,{placement:this.side,middleware:[H(10),W(),D({padding:8}),ee({element:m})]});d.style.left=`${h}px`,d.style.top=`${g}px`,te(m,v,b.arrow);};await u();let f=()=>{u();};this.reposition=f,window.addEventListener("scroll",f,true),window.addEventListener("resize",f),this.registerCleanup(()=>{window.removeEventListener("scroll",f,true),window.removeEventListener("resize",f);}),this.liveContainer=d,this.liveContent=p,this.liveKey=i,this.liveBuild=h=>P(h,l,{onCtaClick:(g,v,b)=>{c("cta_clicked",g==="url"?v:void 0,b),g==="guide"&&v&&t.onOpenGuide?.(v);},onDismiss:()=>c("dismissed")}),t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}liveKeyOf(t){return t.selector??""}onLiveUpdate(t){let n=t.style?.tooltipPlacement;this.side=n==="top"||n==="left"||n==="right"?n:"bottom",this.reposition?.();}};var Ae=class extends w{async render(e){let t=e.guide.guideSteps[e.currentStepIndex];if(!t)return false;let n=t.selector??e.guide.activationRules.selector;if(typeof n!="string"||n.length===0)return false;let i=await k(n,5e3);if(!i)return false;let r=t.style?.tooltipPlacement,s=r==="top"||r==="left"||r==="right"?r:"bottom",{root:a}=this.createHost();this.applyDesign(t.style);let l=a.ownerDocument??document,d=l.createElement("div");d.className="veo-walkthrough";let c=Ce(t,e.currentStepIndex,e.guide.guideSteps.length,l,e.callbacks);d.appendChild(c);let p=l.createElement("div");p.className="veo-walkthrough-arrow",d.appendChild(p),a.appendChild(d);let m=async()=>{let{x:f,y:h,placement:g,middlewareData:v}=await z(i,d,{placement:s,middleware:[H(10),W(),D({padding:8}),ee({element:p})]});d.style.left=`${f}px`,d.style.top=`${h}px`,te(p,g,v.arrow);};await m();let u=()=>{m();};return window.addEventListener("scroll",u,true),window.addEventListener("resize",u),this.registerCleanup(()=>{window.removeEventListener("scroll",u,true),window.removeEventListener("resize",u);}),true}};function Lo(o,e){switch(o.type){case "exact":return o.pattern===e;case "prefix":return e.startsWith(o.pattern);case "regex":try{return new RegExp(o.pattern).test(e)}catch{return false}}}function it(o,e){return !o||o.scope==="sitewide"||!o.pattern?true:Lo({type:o.matchType??"prefix",pattern:o.pattern},e)}var rt=class{constructor(e){this.state=null;this.storageKey=`${kt}${e}`,this.state=this.load(),this.state&&this.isAbandoned(this.state)&&this.clear();}current(){return this.state?this.isAbandoned(this.state)?(this.clear(),null):this.state:null}hasActive(){return this.current()!==null}start(e,t){let n=Date.now();return this.state={guideId:e,totalSteps:t,currentStepIndex:0,startedAt:n,lastProgressAt:n},this.persist(),this.state}advance(){if(!this.state)return null;let e=this.state.currentStepIndex+1;return e>=this.state.totalSteps?null:(this.state={...this.state,currentStepIndex:e,lastProgressAt:Date.now()},this.persist(),this.state)}back(){return this.state?this.state.currentStepIndex===0?this.state:(this.state={...this.state,currentStepIndex:this.state.currentStepIndex-1,lastProgressAt:Date.now()},this.persist(),this.state):null}clear(){if(this.state=null,!(typeof localStorage>"u"))try{localStorage.removeItem(this.storageKey);}catch{}}isAbandoned(e){return Date.now()-e.lastProgressAt>18e5}load(){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(this.storageKey);if(!e)return null;let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;return typeof n.guideId!="string"||typeof n.totalSteps!="number"||typeof n.currentStepIndex!="number"||typeof n.startedAt!="number"||typeof n.lastProgressAt!="number"?null:n}catch{return null}}persist(){if(!(typeof localStorage>"u"||!this.state))try{localStorage.setItem(this.storageKey,JSON.stringify(this.state));}catch{}}};var No=3e4,Mo={shown:"shown",dismissed:"dismissed",cta_clicked:null,step_advanced:null,step_back:null,completed:"completed"},st=class{constructor(e,t){this.client=e;this.activeRenderers=new Set;this.activeByGuideId=new Map;this.dispatched=new Set;this.activeWalkthroughRenderer=null;this.activeWalkthroughGuide=null;this.resolveCache=null;this.inflightResolve=null;this.armedTriggers=new Map;this.pendingComposite=null;if(this.debug=t.debug===true,this.apiUrl=t.apiUrl,this.apiKey=t.apiKey,this.resolver=t.resolver??new ze(t.apiUrl,t.apiKey,this.debug),t.trackerQueue)this.trackerQueue=t.trackerQueue;else {let i=new Ue(t.apiUrl,t.apiKey);this.trackerQueue=new Ke({client:i,flushIntervalMs:3e3,batchSize:5,maxRetries:3,onError:(r,s)=>{this.debug&&console.warn(`[veo] dropped guide interaction after retries: guideId=${s.guideId} action=${s.payload.action}`,r);}});}let n=It(t.apiKey);this.frequencyCache=t.frequencyCache??new We(n),this.walkthroughState=t.walkthroughState??new rt(n);}get pendingInteractions(){return this.trackerQueue.size}clearFrequencyCache(){this.frequencyCache.clear();}clearWalkthroughState(){this.tearDownWalkthrough();}async checkGuides(e,t){let n=this.client.getEndUserId();if(!n){this.debug&&console.log("[veo] guides: skipped, no endUserId yet");return}if(await this.tryResumeWalkthrough(n,t,e))return;this.tryResumeComposite(t,e);let i;try{i=await this.resolveGuides(n,e);}catch(r){this.debug&&console.error("[veo] guides resolver threw:",r);return}this.debug&&console.log(`[veo] guides: ${i.length} eligible at ${e}`),this.disarmTriggers();for(let r of i){let s=r.activationRules.trigger;if((s==="on_click"||s==="on_hover")&&r.activationRules.selector){this.armInteractionTrigger(r,n,t,e);continue}await this.showGuide(r,n,t,e);}}async showGuide(e,t,n,i){if(this.frequencyCache.shouldFilter(e.guideId,e.displayFrequency)){this.debug&&console.log(`[veo] guides: filtered locally guideId=${e.guideId}`);return}if(this.activeByGuideId.has(e.guideId)){this.debug&&console.log(`[veo] guides: already shown guideId=${e.guideId}`);return}if(e.guideType==="walkthrough"&&e.guideSteps.length>1){if(this.walkthroughState.hasActive()){this.debug&&console.log(`[veo] guides: walkthrough ${e.guideId} skipped (another active)`);return}await this.startWalkthrough(e,t,n,i);return}if(e.guideType==="composite"){this.startComposite(e,n,i);return}this.runSingleStepRender(e,n,i);}armInteractionTrigger(e,t,n,i){if(this.frequencyCache.shouldFilter(e.guideId,e.displayFrequency)||this.activeByGuideId.has(e.guideId)||this.armedTriggers.has(e.guideId))return;let r=e.activationRules.selector,s=e.activationRules.trigger==="on_hover"?"mouseover":"click",a=d=>{let c=d.target;if(c instanceof Element){try{if(!c.closest(r))return}catch{return}l(),this.showGuide(e,t,n,i);}},l=()=>{document.removeEventListener(s,a,true),this.armedTriggers.delete(e.guideId);};document.addEventListener(s,a,true),this.armedTriggers.set(e.guideId,l),this.debug&&console.log(`[veo] guides: armed ${s} trigger for ${e.guideId} on ${r}`);}disarmTriggers(){for(let e of this.armedTriggers.values())e();this.armedTriggers.clear();}async resolveGuides(e,t){let n=`${e}
|
|
427
|
-
${t}`,i=Date.now();if(this.resolveCache?.key===n&&i-this.resolveCache.at<No)return this.debug&&console.log("[veo] guides: resolve cache hit"),this.resolveCache.guides;if(this.inflightResolve?.key===n)return this.inflightResolve.promise;let r=this.resolver.resolve(e,t);this.inflightResolve={key:n,promise:r};try{let s=await r;return this.resolveCache={key:n,at:Date.now(),guides:s},s}finally{this.inflightResolve?.key===n&&(this.inflightResolve=null);}}destroy(){for(let e of this.activeRenderers)try{e.destroy();}catch(t){this.debug&&console.error("[veo] renderer destroy failed:",t);}if(this.activeRenderers.clear(),this.activeByGuideId.clear(),this.activeWalkthroughRenderer){try{this.activeWalkthroughRenderer.destroy();}catch{}this.activeWalkthroughRenderer=null,this.activeWalkthroughGuide=null;}this.disarmTriggers(),this.dispatched.clear(),this.resolveCache=null,this.inflightResolve=null,this.trackerQueue.destroy();}runSingleStepRender(e,t,n){let i=this.createSingleStepRenderer(e.guideType);if(!i)return;this.activeByGuideId.set(e.guideId,i);let r=e.activationRules.delayMs??0;window.setTimeout(()=>this.mountSingleStepRenderer(e,i,t,n),r);}startComposite(e,t,n){if(this.pendingComposite?.guide.guideId===e.guideId)return;let r=e.guideSteps.findIndex(s=>it(s.pageLocation,n));r!==-1&&this.renderCompositeStep(e,r,t,n);}tryResumeComposite(e,t){let n=this.pendingComposite;if(!n)return false;let r=n.guide.guideSteps[n.stepIndex];return r?it(r.pageLocation,t)?(this.pendingComposite=null,this.renderCompositeStep(n.guide,n.stepIndex,e,t),true):false:(this.pendingComposite=null,false)}renderCompositeStep(e,t,n,i){let r=e.guideSteps,s=new me;this.activeRenderers.add(s),this.activeByGuideId.set(e.guideId,s);let a=()=>{s.destroy(),this.activeRenderers.delete(s),this.activeByGuideId.get(e.guideId)===s&&this.activeByGuideId.delete(e.guideId);},l=c=>{if(a(),c<0||c>=r.length)return;let p=r[c];p&&it(p.pageLocation,i)?this.renderCompositeStep(e,c,n,i):this.pendingComposite={guide:e,stepIndex:c};},d=r.length>1?{stepIndex:t,totalSteps:r.length,callbacks:{onNext:()=>l(t+1),onBack:()=>l(t-1),onGoto:c=>l(c),onSkip:a,onComplete:a}}:void 0;try{s.render({guide:e,onInteraction:c=>this.handleInteraction(e,n,i,c),onClose:a,onTrack:(c,p)=>this.client.track(c,p),onFormSubmit:c=>this.submitFormResponse(e.guideId,c),onOpenGuide:c=>{this.openGuideById(c,n,i);},...d?{nav:d}:{}});}catch(c){this.debug&&console.error("[veo] composite renderer threw:",c),a();}}mountSingleStepRenderer(e,t,n,i){this.activeRenderers.add(t),this.activeByGuideId.set(e.guideId,t);let r=()=>{t.destroy(),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);},s=c=>{this.handleInteraction(e,n,i,c);},a=(c,p)=>{this.client.track(c,p);},l=c=>this.submitFormResponse(e.guideId,c),d=c=>{this.openGuideById(c,n,i);};try{t.render({guide:e,onInteraction:s,onClose:r,onTrack:a,onFormSubmit:l,onOpenGuide:d});}catch(c){this.debug&&console.error("[veo] renderer.render threw:",c),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);}}async openGuideById(e,t,n){if(this.activeByGuideId.has(e))return;let i=await this.resolver.fetchById(e);if(!i){this.debug&&console.warn(`[veo] guides: chained guide ${e} not found`);return}let r=this.client.getEndUserId()??this.client.getAnonymousId();if(i.guideType==="walkthrough"&&i.guideSteps.length>1){this.walkthroughState.hasActive()||await this.startWalkthrough(i,r,t,n);return}this.runSingleStepRender(i,t,n);}async tryResumeWalkthrough(e,t,n){let i=this.walkthroughState.current();if(!i)return false;let r=await this.resolver.fetchById(i.guideId);if(!r||r.guideType!=="walkthrough")return this.debug&&console.log(`[veo] guides: walkthrough ${i.guideId} no longer available, cleaning up`),this.tearDownWalkthrough(),true;let s=Math.min(i.currentStepIndex,r.guideSteps.length-1);return await this.renderWalkthroughStep(r,s,e,t,n),true}async startWalkthrough(e,t,n,i){this.walkthroughState.start(e.guideId,e.guideSteps.length),await this.renderWalkthroughStep(e,0,t,n,i)&&(this.enqueueInteractionOnce(e.guideId,t,n,i,"shown",0),this.frequencyCache.record(e.guideId,"shown"));}async renderWalkthroughStep(e,t,n,i,r){this.activeWalkthroughRenderer&&(this.activeWalkthroughRenderer.destroy(),this.activeWalkthroughRenderer=null),this.activeWalkthroughGuide=e;let s={onNext:()=>this.handleWalkthroughNext(n,i,r),onBack:()=>this.handleWalkthroughBack(n,i,r),onSkip:()=>this.handleWalkthroughSkip(n,i,r),onComplete:()=>this.handleWalkthroughComplete(n,i,r)},a=e.guideSteps[t],l=Oo(a);if(l==="modal"||l==="banner"){let p=l==="modal"?new oe:new ne;try{p.render({guide:e,onInteraction:()=>{},onClose:()=>{},nav:{stepIndex:t,totalSteps:e.guideSteps.length,callbacks:s}});}catch(m){return this.debug&&console.error("[veo] sequence renderer threw:",m),this.tearDownWalkthrough(),false}return this.activeWalkthroughRenderer=p,true}let d=new Ae,c=false;try{c=await d.render({guide:e,currentStepIndex:t,callbacks:s});}catch(p){this.debug&&console.error("[veo] walkthrough renderer threw:",p);}return c?(this.activeWalkthroughRenderer=d,true):(this.debug&&console.warn(`[veo] walkthrough ${e.guideId} step ${t} could not render, cancelling`),this.tearDownWalkthrough(),false)}handleWalkthroughNext(e,t,n){let i=this.activeWalkthroughGuide;if(!i)return;let r=this.walkthroughState.advance();if(!r){this.handleWalkthroughComplete(e,t,n);return}this.enqueueInteraction(i.guideId,e,t,n,"step_advanced",r.currentStepIndex),this.renderWalkthroughStep(i,r.currentStepIndex,e,t,n);}handleWalkthroughBack(e,t,n){let i=this.activeWalkthroughGuide;if(!i)return;let r=this.walkthroughState.current();if(!r||r.currentStepIndex===0)return;let s=this.walkthroughState.back();s&&(this.enqueueInteraction(i.guideId,e,t,n,"step_back",s.currentStepIndex),this.renderWalkthroughStep(i,s.currentStepIndex,e,t,n));}handleWalkthroughSkip(e,t,n){let i=this.activeWalkthroughGuide,r=this.walkthroughState.current();!i||!r||(this.enqueueInteraction(i.guideId,e,t,n,"dismissed",r.currentStepIndex),this.frequencyCache.record(i.guideId,"dismissed"),this.tearDownWalkthrough());}handleWalkthroughComplete(e,t,n){let i=this.activeWalkthroughGuide,r=this.walkthroughState.current();!i||!r||(this.enqueueInteraction(i.guideId,e,t,n,"completed",r.currentStepIndex),this.frequencyCache.record(i.guideId,"completed"),this.tearDownWalkthrough());}tearDownWalkthrough(){if(this.activeWalkthroughRenderer)try{this.activeWalkthroughRenderer.destroy();}catch{}this.activeWalkthroughRenderer=null,this.activeWalkthroughGuide=null,this.walkthroughState.clear();}handleInteraction(e,t,n,i){let r=i.metadata?.buttonId?`:${i.metadata.buttonId}`:"",s=`${e.guideId}:${i.action}${r}`;if(this.dispatched.has(s)){this.debug&&console.log(`[veo] guides: dedup hit ${s}`);return}this.dispatched.add(s);let a=Mo[i.action];a&&this.frequencyCache.record(e.guideId,a);let l=this.client.getEndUserId();if(!l){this.debug&&console.warn("[veo] guides: interaction without endUserId \u2014 skipping enqueue");return}this.trackerQueue.enqueue({guideId:e.guideId,payload:{endUserId:l,sessionId:t,action:i.action,stepIndex:i.stepIndex,pageUrl:n,pagePath:wn(n),...i.metadata?{metadata:i.metadata}:{}}});}enqueueInteraction(e,t,n,i,r,s){this.trackerQueue.enqueue({guideId:e,payload:{endUserId:t,sessionId:n,action:r,stepIndex:s,pageUrl:i,pagePath:wn(i)}});}enqueueInteractionOnce(e,t,n,i,r,s){let a=`${e}:${r}:${s}`;this.dispatched.has(a)||(this.dispatched.add(a),this.enqueueInteraction(e,t,n,i,r,s));}createSingleStepRenderer(e){switch(e){case "modal":return new oe;case "banner":return new ne;case "tooltip":return new Pe;case "custom":return new ke;case "inline":return new Te;case "inline-custom":return new Re;case "form":return new Ee;case "inline-form":return new Ie;case "badge":return new xe;case "composite":return new me;case "walkthrough":return null;default:return null}}async submitFormResponse(e,t){let n=this.client.getEndUserId()??this.client.getAnonymousId();try{let i=await fetch(`${this.apiUrl}/v1/guides/${e}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":this.apiKey},body:JSON.stringify({endUserId:n,answers:t})});return !i.ok&&this.debug&&console.warn("[veo] form-response respondi\xF3",i.status),i.ok}catch(i){return this.debug&&console.warn("[veo] form-response fall\xF3:",i),false}}};function wn(o){try{return new URL(o).pathname}catch{return "/"}}function Oo(o){let e=o?.style?.render;return typeof e=="string"?e:"walkthrough"}var _o="__veo_preview__",bt=class{constructor(){this.singleStep=null;this.walkthrough=null;this.walkthroughGuide=null;this.walkthroughIndex=0;this.input=null;}preview(e){let t=e.guideSteps[0];if(this.singleStep&&this.input&&e.guideType===this.input.guideType&&e.guideType!=="walkthrough"&&t&&this.singleStep.updateStep(t))return this.input=e,{close:()=>this.close(),ready:Promise.resolve({rendered:true}),host:()=>this.activeHost()};this.close(),this.input=e;let n=Bo(e),i=typeof e.startStepIndex=="number"?e.startStepIndex:0;if(n.guideType==="composite"){let s=Math.min(Math.max(0,i),n.guideSteps.length-1),a=n.guideSteps[s];a&&(n.guideSteps=[a]);let l=this.renderSingleStep(n);return {close:()=>this.close(),ready:l,host:()=>this.activeHost()}}let r=n.guideType==="walkthrough"?this.startWalkthrough(n,i):this.renderSingleStep(n);return {close:()=>this.close(),ready:r,host:()=>this.activeHost()}}activeHost(){return this.singleStep?this.singleStep.hostElement():this.walkthrough instanceof w?this.walkthrough.hostElement():null}close(){this.singleStep&&(he(this.singleStep),this.singleStep=null),this.walkthrough&&(he(this.walkthrough),this.walkthrough=null),this.walkthroughGuide=null,this.walkthroughIndex=0,this.input=null;}async renderSingleStep(e){let t=Fo(e.guideType);if(!t)return {rendered:false};this.singleStep=t;let n=false;try{await t.render({guide:e,onInteraction:i=>{i.action==="shown"&&(n=!0);},onClose:()=>this.close(),onTrack:()=>{},onOpenGuide:()=>{},onFormSubmit:this.input?.formSubmit??(()=>Promise.resolve(!0)),isPreview:!0,...this.input?.formSubmit&&this.input.formSubmitNote!==void 0?{previewNote:this.input.formSubmitNote}:{}});}catch{return this.close(),{rendered:false}}return this.singleStep!==t?(he(t),{rendered:false}):{rendered:n}}async startWalkthrough(e,t=0){if(e.guideSteps.length===0)return {rendered:false};this.walkthroughGuide=e;let n=Math.min(Math.max(0,Math.floor(t)),e.guideSteps.length-1);return this.walkthroughIndex=n,{rendered:await this.renderWalkthroughStep(n)}}async renderWalkthroughStep(e){let t=this.walkthroughGuide;if(!t)return false;this.walkthrough&&(he(this.walkthrough),this.walkthrough=null);let n={onNext:()=>{let l=this.walkthroughIndex+1;if(l>=t.guideSteps.length){this.close();return}this.walkthroughIndex=l,this.renderWalkthroughStep(l);},onBack:()=>{let l=this.walkthroughIndex-1;l<0||(this.walkthroughIndex=l,this.renderWalkthroughStep(l));},onSkip:()=>this.close(),onComplete:()=>this.close()},r=t.guideSteps[e]?.style?.render;if(r==="modal"||r==="banner"){let l=r==="modal"?new oe:new ne;try{l.render({guide:t,onInteraction:()=>{},onClose:()=>this.close(),nav:{stepIndex:e,totalSteps:t.guideSteps.length,callbacks:n}});}catch{return he(l),false}return this.walkthroughGuide!==t?(he(l),false):(this.walkthrough=l,true)}let s=new Ae,a=false;try{a=await s.render({guide:t,currentStepIndex:e,callbacks:n});}catch{a=false;}return !a||this.walkthroughGuide!==t?(he(s),false):(this.walkthrough=s,true)}},at=null;function lt(o){return De()?(at||(at=new bt),at.preview(o)):{close:()=>{},ready:Promise.resolve({rendered:false}),host:()=>null}}function xn(){at?.close();}function Bo(o){let e=o.activationRules?.selector,t={url:o.activationRules?.url??{type:"prefix",pattern:"/"},trigger:"immediate",...e!==void 0?{selector:e}:{}};return {guideId:_o,guideName:o.guideName??"Preview",guideType:o.guideType,guideSteps:o.guideSteps,activationRules:t,displayFrequency:"always",displayPriority:0}}function Fo(o){switch(o){case "modal":return new oe;case "banner":return new ne;case "tooltip":return new Pe;case "custom":return new ke;case "inline":return new Te;case "inline-custom":return new Re;case "form":return new Ee;case "inline-form":return new Ie;case "badge":return new xe;case "composite":return new me;case "walkthrough":return null;default:return null}}function he(o){try{o.destroy();}catch{}}var $o="veo:preview_token";function Ho(){try{return window.sessionStorage}catch{return null}}function Cn(){try{Ho()?.removeItem($o);}catch{}}var dt=null;async function Sn(o){if(!De())return null;dt?.teardown();let e=null;try{let a=await fetch(`${o.apiUrl}/v1/guides/preview-resolve`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":o.apiKey},body:JSON.stringify({token:o.token})});a.ok?e=(await a.json()).guide??null:o.debug&&console.warn("[veo] preview-resolve respondi\xF3",a.status);}catch(a){o.debug&&console.warn("[veo] preview-resolve fall\xF3:",a);}let t=async a=>{if(!e)return false;let l=window.veo,d=l?.getEndUserId?.()??l?.getAnonymousId?.()??null;if(!d)return false;try{return (await fetch(`${o.apiUrl}/v1/guides/${e.guideId}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":o.apiKey},body:JSON.stringify({endUserId:d,answers:a})})).ok}catch{return false}},n=null,i=()=>{e&&(n?.close(),n=lt({guideType:e.guideType,guideSteps:e.guideSteps,activationRules:e.activationRules,guideName:e.guideName,formSubmit:t,formSubmitNote:"Vista previa: guardado en TU usuario para probar el flujo."}));},r=Do({label:e?`Vista previa: ${e.guideName}`:"Link de preview inv\xE1lido o vencido",error:!e,onReshow:e?i:null,onClose:()=>s.teardown()}),s={teardown(){n?.close(),n=null,r.remove(),Cn(),dt===s&&(dt=null);}};return dt=s,i(),s}function Do(o){let e=document.createElement("div");e.setAttribute("data-veo-preview-chip","");let t=e.attachShadow({mode:"open"}),n=document.createElement("style");n.textContent=`
|
|
426
|
+
`,o.length>uo)return o}}}catch{return o}return o}function fo(){if(typeof document>"u")return "";try{let o=document.documentElement,e=[];for(let t of ["class","style","data-theme","data-mode","data-color-mode"]){let n=o.getAttribute(t);n&&n.length<=1e3&&!/["<>]/.test(n)&&e.push(`${t}="${n}"`);}return e.join(" ")}catch{return ""}}function mo(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function ho(o,e,t,n,i){let r=`(function(){var T=${JSON.stringify(n)};function P(m){m.__veo=T;parent.postMessage(m,'*');}window.veo={dismiss:function(){P({type:'dismiss'});},cta:function(u){P({type:'cta',url:u});},track:function(n,p){P({type:'track',name:n,props:p||{}});},navigate:function(u){P({type:'navigate',url:u});}};document.addEventListener('click',function(e){var a=e.target&&e.target.closest?e.target.closest('a[href]'):null;if(!a)return;var h=a.getAttribute('href');if(!h||h.charAt(0)==='#'||/^(javascript|mailto|tel):/i.test(h))return;e.preventDefault();if(a.target==='_blank'){P({type:'cta',url:a.href,close:false});}else{P({type:'navigate',url:h});}},true);function H(){var r=document.getElementById('__veo_root');var h=r?r.getBoundingClientRect().height:document.documentElement.scrollHeight;P({type:'resize',height:Math.ceil(h)});}window.addEventListener('load',H);try{if(typeof ResizeObserver!=='undefined'){var _r=document.getElementById('__veo_root');new ResizeObserver(H).observe(_r||document.documentElement);}}catch(e){}})();`,s=i.hostCss?`<style>${gt(i.hostCss,"style")}</style>`:"",a=i.tailwind?'<script src="https://cdn.tailwindcss.com"></script>':"";return `<!DOCTYPE html><html ${i.htmlAttrs}><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;}body{font-family:system-ui,-apple-system,sans-serif;}</style>`+s+"<style>html,body{margin:0!important;padding:0!important;background:transparent!important;height:auto!important;min-height:0!important;max-height:none!important;width:auto!important;min-width:0!important;overflow:visible!important;color-scheme:normal!important;}</style>"+a+`<style>${gt(e,"style")}</style></head><body style="margin:0!important;background:transparent!important;min-height:0!important;height:auto!important;"><div id="__veo_root">${o}</div><script>${r}</script>`+(t?`<script>${gt(t,"script")}</script>`:"")+"</body></html>"}function gt(o,e){let t=e==="script"?/<\/script/gi:/<\/style/gi;return o.replace(t,`<\\/${e}`)}function hn(o,e,t){if(o.sandboxed){let s={html:o.html??"",css:o.css,js:o.js},{iframe:a,cleanup:l}=Se(e,s,t,{width:"100%"}),d=e.createElement("div");return d.className="veo-code-sandbox",d.appendChild(a),{node:d,cleanup:l}}let n=e,i=[];if(typeof o.css=="string"&&o.css.trim()){let s=n.createElement("style");s.textContent=o.css,n.head.appendChild(s),i.push(s);}let r=null;if(typeof o.html=="string"&&o.html.trim()){r=e.createElement("div"),r.className="veo-code-html",r.innerHTML=o.html;for(let s of Array.from(r.querySelectorAll("script")))i.push(go(s,n)),s.remove();}if(typeof o.js=="string"&&o.js.trim()){let s=n.createElement("script");s.textContent=o.js,n.body.appendChild(s),i.push(s);}return {node:r,cleanup:()=>{for(let s of i)s.parentNode?.removeChild(s);}}}function go(o,e){let t=e.createElement("script");for(let n of Array.from(o.attributes))t.setAttribute(n.name,n.value);return o.src||(t.textContent=o.textContent),e.body.appendChild(t),t}function it(o,e,t){let n=e.guide.guideSteps[0];if(!n)return;let i=n.fields??[],r=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();},s=t.createElement("div");if(s.className="veo-guide-content",n.title){let m=t.createElement("h2");m.className="veo-guide-title",m.textContent=n.title,s.appendChild(m);}if(n.content){let m=t.createElement("p");m.className="veo-guide-text",m.textContent=n.content,s.appendChild(m);}let a=[],l=t.createElement("form");l.className="veo-form",l.noValidate=true;for(let m of i){let{wrapper:u,read:f}=yt(m,t);a.push({field:m,read:f}),l.appendChild(u);}let d=t.createElement("p");d.className="veo-form-error",d.style.display="none",l.appendChild(d);let c=t.createElement("div");c.className="veo-guide-actions";let p=t.createElement("button");p.type="submit",p.className="veo-guide-cta",p.textContent=n.ctaText||"Enviar",c.appendChild(p),l.appendChild(c),l.addEventListener("submit",m=>{m.preventDefault(),d.style.display="none";let u={};for(let{field:h,read:g}of a){let v=g();if(v==null||v===""){if(h.required){d.textContent=`Completa "${h.label}"`,d.style.display="block";return}continue}u[h.key]=v;}if(Object.keys(u).length===0){d.textContent="Responde al menos un campo",d.style.display="block";return}p.disabled=true,(e.onFormSubmit??(()=>Promise.resolve(true)))(u).then(h=>{if(!h){p.disabled=false,d.textContent="No se pudo enviar. Prueba de nuevo.",d.style.display="block";return}e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"completed"});let g=e.isPreview?e.previewNote??"Vista previa: la respuesta NO se guard\xF3.":null;vo(o,t,g),window.setTimeout(()=>e.onClose(),g?2200:1400);});}),s.appendChild(l),s.appendChild(pe(t,r)),o.appendChild(s);}function vo(o,e,t){for(;o.firstChild;)o.removeChild(o.firstChild);let n=e.createElement("div");if(n.className="veo-form-thanks",n.textContent="\u2713 \xA1Gracias por tu respuesta!",o.appendChild(n),t){let i=e.createElement("p");i.className="veo-form-preview-note",i.textContent=t,o.appendChild(i);}}function yt(o,e){let t=e.createElement("div");t.className="veo-form-field";let n=e.createElement("label");switch(n.className="veo-form-label",n.textContent=o.required?`${o.label} *`:o.label,t.appendChild(n),o.type){case "textarea":{let i=e.createElement("textarea");return i.className="veo-form-input",i.rows=3,o.placeholder&&(i.placeholder=o.placeholder),t.appendChild(i),{wrapper:t,read:()=>i.value.trim()}}case "number":{let i=e.createElement("input");return i.type="number",i.className="veo-form-input",o.placeholder&&(i.placeholder=o.placeholder),t.appendChild(i),{wrapper:t,read:()=>i.value.trim()===""?void 0:Number(i.value)}}case "select":{let i=e.createElement("select");i.className="veo-form-input";let r=e.createElement("option");r.value="",r.textContent=o.placeholder||"Elige una opci\xF3n\u2026",i.appendChild(r);for(let s of o.options??[]){let a=e.createElement("option");a.value=s,a.textContent=s,i.appendChild(a);}return t.appendChild(i),{wrapper:t,read:()=>i.value||void 0}}case "radio":{let i=e.createElement("div");i.className="veo-form-options";let r=`veo-${o.key}`,s=[];for(let a of o.options??[]){let l=e.createElement("label");l.className="veo-form-option";let d=e.createElement("input");d.type="radio",d.name=r,d.value=a,s.push(d);let c=e.createElement("span");c.textContent=a,l.appendChild(d),l.appendChild(c),i.appendChild(l);}return t.appendChild(i),{wrapper:t,read:()=>s.find(a=>a.checked)?.value}}case "multiselect":{let i=e.createElement("div");i.className="veo-form-options";let r=[];for(let s of o.options??[]){let a=e.createElement("label");a.className="veo-form-option";let l=e.createElement("input");l.type="checkbox",l.value=s,r.push(l);let d=e.createElement("span");d.textContent=s,a.appendChild(l),a.appendChild(d),i.appendChild(a);}return t.appendChild(i),{wrapper:t,read:()=>{let s=r.filter(a=>a.checked).map(a=>a.value);return s.length>0?s:void 0}}}case "checkbox":{let i=e.createElement("label");i.className="veo-form-option";let r=e.createElement("input");r.type="checkbox";let s=e.createElement("span");return s.textContent=o.placeholder||"S\xED",i.appendChild(r),i.appendChild(s),t.appendChild(i),{wrapper:t,read:()=>r.checked?true:o.required?"":false}}case "yesno":{let i=e.createElement("div");i.className="veo-form-options";let r=`veo-${o.key}`,[s,a]=o.options?.length===2?o.options:["S\xED","No"],l=[];for(let{label:d,value:c}of [{label:s,value:true},{label:a,value:false}]){let p=e.createElement("label");p.className="veo-form-option";let m=e.createElement("input");m.type="radio",m.name=r,l.push({input:m,value:c});let u=e.createElement("span");u.textContent=d,p.appendChild(m),p.appendChild(u),i.appendChild(p);}return t.appendChild(i),{wrapper:t,read:()=>l.find(d=>d.input.checked)?.value}}case "nps":return gn(t,e,0,10,"veo-nps-btn");case "rating":return gn(t,e,1,5,"veo-rating-btn","\u2605");default:{let i=e.createElement("input");return i.type="text",i.className="veo-form-input",o.placeholder&&(i.placeholder=o.placeholder),t.appendChild(i),{wrapper:t,read:()=>i.value.trim()}}}}function gn(o,e,t,n,i,r){let s=e.createElement("div");s.className="veo-form-scale";let a,l=[];for(let d=t;d<=n;d++){let c=e.createElement("button");c.type="button",c.className=i,c.textContent=r??String(d),c.setAttribute("aria-label",String(d)),c.addEventListener("click",()=>{a=d,l.forEach((p,m)=>{let u=r?m+t<=d:m+t===d;p.classList.toggle("veo-scale-active",u);});}),l.push(c),s.appendChild(c);}return o.appendChild(s),{wrapper:o,read:()=>a}}var yo={left:"flex-start",center:"center",right:"flex-end"},me=class extends w{async render(e){let t=e.nav?.stepIndex??0,n=e.guide.guideSteps[t];if(!n)return;let i=(n.position==="relative-to-element"||n.presentation==="inline")&&n.anchorSelector?.trim()||void 0,r=null;if(i&&(r=await k(i),!r))return;let{host:s,root:a}=this.createHost(),l=a.ownerDocument??document,d=n.design??{};typeof d.zIndex=="number"&&(s.style.zIndex=String(d.zIndex));let c=l.createElement("div");c.className="veo-card",Io(c,d);let p=(u,f)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:t,action:u,...{}});},m=[];if(this.buildContent(c,n.blocks??[],l,e,t,m),d.closeButton!==false){let u=pe(l,()=>{p("dismissed"),this.closeOrSkip(e);}),f=typeof d.closeColor=="string"?d.closeColor:null,h=typeof d.closeHoverColor=="string"?d.closeHoverColor:null;f&&(u.style.color=f);let g=typeof d.closePosition=="string"?d.closePosition:"top-right";xo(u,g),So(c,g),h&&(u.addEventListener("mouseenter",()=>{u.style.color=h;}),u.addEventListener("mouseleave",()=>{u.style.color=f??"";})),c.appendChild(u);}if(n.presentation==="inline"&&r){s.style.display="block";let u=bo(n.inlinePosition);a.appendChild(c),A(r,s,u),this.registerCleanup(M(s,i,u));}else if(n.position==="relative-to-element"&&r){if(d.backdrop===true){let h=l.createElement("div");h.className="veo-composite-overlay veo-composite-overlay--dim",typeof d.backdropColor=="string"&&(h.style.background=d.backdropColor);let g=typeof d.backdropZIndex=="number"?d.backdropZIndex:2e5;h.style.zIndex=String(g),a.appendChild(h),d.targetAbove===true&&this.registerCleanup(Eo(r,g+1));}let u=l.createElement("div");u.className="veo-composite-anchored";let f=d.caret===false?null:ko(l,d);f&&u.appendChild(f),u.appendChild(c),a.appendChild(u),this.registerCleanup(await Ro(r,u,f));}else {let u=l.createElement("div");u.className="veo-composite-overlay",d.backdrop!==false&&(u.classList.add("veo-composite-overlay--dim"),typeof d.backdropColor=="string"&&(u.style.background=d.backdropColor),typeof d.backdropZIndex=="number"&&(u.style.zIndex=String(d.backdropZIndex)),u.addEventListener("click",f=>{f.target===u&&(p("dismissed"),this.closeOrSkip(e));})),wo(c,n.position,d),u.appendChild(c),a.appendChild(u);}e.onInteraction({guideId:e.guide.guideId,stepIndex:t,action:"shown"});}buildContent(e,t,n,i,r,s){let a=d=>{i.onInteraction({guideId:i.guide.guideId,stepIndex:r,action:"cta_clicked",...d.id?{metadata:{buttonId:d.id}}:{}});},l=0;for(;l<t.length;){let d=t[l];if(!d){l++;continue}if(d.type==="button"){let p=n.createElement("div");p.className="veo-guide-actions";let m;for(;l<t.length&&t[l]?.type==="button";){let u=t[l];if(!m){let f=u.style?.align;(f==="left"||f==="center"||f==="right")&&(m=f);}p.appendChild(this.buildButton(u,n,i,r,s,a)),l++;}m&&(p.style.justifyContent=yo[m]??"flex-end"),e.appendChild(p);continue}if(d.type==="code"){let{node:p,cleanup:m}=hn(d,n,i);p&&e.appendChild(p),this.registerCleanup(m),l++;continue}if(d.type==="form"){let p=n.createElement("div");p.className="veo-form";for(let m of d.fields??[]){let{wrapper:u,read:f}=yt(m,n);s.push({field:m,read:f}),p.appendChild(u);}e.appendChild(p),l++;continue}let c=ot(d,n);c&&e.appendChild(c),l++;}}buildButton(e,t,n,i,r,s){let a=t.createElement("button");a.type="button",a.className="veo-guide-cta",a.textContent=e.text?.trim()||"OK",we(a,e.style,"button");let l=n.nav?.callbacks;return a.addEventListener("click",()=>{switch(e.action){case "next":s(e),l?l.onNext():n.onClose();break;case "prev":s(e),l?.onBack();break;case "url":s(e),typeof e.url=="string"&&R(e.url)&&window.open(e.url,"_blank","noopener,noreferrer");break;case "guide":s(e),e.targetGuideId&&n.onOpenGuide?.(e.targetGuideId),this.closeOrSkip(n);break;case "submit-forms":case "submit-forms-advance":case "submit-forms-goto":this.submitForms(r,n,i,a,()=>{s(e),e.action==="submit-forms"||!l?n.onClose():e.action==="submit-forms-goto"&&typeof e.targetStep=="number"&&l.onGoto?l.onGoto(e.targetStep):l.onNext();});break;default:s(e),this.closeOrSkip(n);}}),a}submitForms(e,t,n,i,r){let s={};for(let{field:l,read:d}of e){let c=d();if(c==null||c===""){if(l.required){i.textContent=`Completa "${l.label}"`;return}continue}s[l.key]=c;}if(e.length>0&&Object.keys(s).length===0)return;i.disabled=true,(t.onFormSubmit??(()=>Promise.resolve(true)))(s).then(l=>{i.disabled=false,l&&(t.onInteraction({guideId:t.guide.guideId,stepIndex:n,action:"completed"}),r());});}closeOrSkip(e){e.nav?.callbacks?e.nav.callbacks.onSkip():e.onClose();}};function bo(o){return o==="before"||o==="prepend"||o==="append"?o:"after"}function wo(o,e,t){let n=o.style;n.position="fixed";let i="16px",r=t.hAlign==="left"?"left":t.hAlign==="right"?"right":null,s=e.includes("top")?"top":e.includes("bottom")?"bottom":"middle",a=r??(e.includes("left")?"left":e.includes("right")?"right":"middle");s==="top"?n.top=i:s==="bottom"?n.bottom=i:n.top="50%",a==="left"?n.left=i:a==="right"?n.right=i:n.left="50%";let l=a==="middle"?"-50%":"0",d=s==="middle"?"-50%":"0";n.transform=l==="0"&&d==="0"?"":`translate(${l}, ${d})`;}var vn="10px";function xo(o,e){let t=o.style;t.top="auto",t.right="auto",t.bottom="auto",t.left="auto";let n=e.includes("bottom")?"bottom":"top",i=e.includes("left")?"left":"right";t.setProperty(n,vn),t.setProperty(i,vn);}var Co="34px";function So(o,e){let t=Array.from(o.children).filter(i=>i instanceof HTMLElement&&!i.classList.contains("veo-guide-close"));if(t.length===0)return;let n=e.includes("bottom")?t[t.length-1]:t[0];n&&(n.style[e.includes("left")?"paddingLeft":"paddingRight"]=Co);}function ko(o,e){let t=o.createElement("div");t.className="veo-composite-caret";let n=typeof e.caretWidth=="number"?e.caretWidth:12,i=typeof e.caretHeight=="number"?e.caretHeight:12,r=t.style;if(r.position="absolute",r.width=`${n}px`,r.height=`${i}px`,r.transform="rotate(45deg)",r.background=typeof e.background=="string"?e.background:"#ffffff",typeof e.borderWidth=="number"&&e.borderWidth>0){let s=typeof e.borderColor=="string"?e.borderColor:"#bbbbbb";r.border=`${e.borderWidth}px solid ${s}`;}return t}function Eo(o,e){let t=o,n=t.style.position,i=t.style.zIndex;return getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.style.zIndex=String(e),()=>{t.style.position=n,t.style.zIndex=i;}}async function Ro(o,e,t){let n=async()=>{let{x:r,y:s,placement:a,middlewareData:l}=await z(o,e,{placement:"bottom",strategy:"fixed",middleware:[H(t?10:8),W(),D({padding:8}),...t?[ee({element:t})]:[]]});e.style.left=`${r}px`,e.style.top=`${s}px`,t&&te(t,a,l.arrow);};await n();let i=()=>{n();};return window.addEventListener("scroll",i,true),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i,true),window.removeEventListener("resize",i);}}function Io(o,e){let t=o.style,n=a=>typeof a=="number"&&Number.isFinite(a)?`${a}px`:null,i=a=>typeof a=="string"&&a?a:null;i(e.background)&&(t.background=e.background);let r=i(e.color)??i(e.textColor);r&&(t.color=r),n(e.fontSize)&&(t.fontSize=n(e.fontSize)),i(e.fontWeight)&&(t.fontWeight=e.fontWeight),i(e.fontFamily)&&e.fontFamily!=="inherit"&&(t.fontFamily=e.fontFamily),i(e.textTransform)&&e.textTransform!=="none"&&(t.textTransform=e.textTransform),typeof e.letterSpacing=="number"&&(t.letterSpacing=`${e.letterSpacing}px`),i(e.align)&&(t.textAlign=e.align),typeof e.lineHeight=="number"&&(t.lineHeight=`${e.lineHeight}%`),n(e.radius)&&(t.borderRadius=n(e.radius));let s=n(e.borderWidth);if(s&&(t.border=`${s} solid ${i(e.borderColor)??"#e5e5e5"}`),i(e.shadowColor)||typeof e.shadowBlur=="number"){let a=l=>typeof e[l]=="number"?e[l]:0;t.boxShadow=`${a("shadowX")}px ${a("shadowY")}px ${a("shadowBlur")}px ${a("shadowSpread")}px ${i(e.shadowColor)??"rgba(0,0,0,0.2)"}`;}e.fullWidth===true?t.width="100%":e.widthType==="fluid"?(t.width="auto",n(e.width)&&(t.maxWidth=n(e.width))):n(e.width)&&(t.width=n(e.width));for(let a of ["Top","Right","Bottom","Left"]){let l=n(e[`padding${a}`]);l&&t.setProperty(`padding-${a.toLowerCase()}`,l);let d=n(e[`margin${a}`]);d&&t.setProperty(`margin-${a.toLowerCase()}`,d);}}var To={mode:"floating",position:"bottom-right"},yn=16,Po=360,ke=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let n=t.placement??To,i=null;if(n.mode==="anchored"){let c=n.selector??t.selector??e.guide.activationRules.selector;if(typeof c!="string"||c.length===0||(i=await k(c),!i))return}let{root:r}=this.createHost(),s=r.ownerDocument??document,a=s.createElement("div");a.className=n.mode==="anchored"?"veo-custom-anchored":"veo-custom-floating";let{iframe:l,cleanup:d}=Se(s,t,e,{width:vt(n.width??Po),fixedHeight:n.height??null});this.registerCleanup(d),a.appendChild(l),r.appendChild(a),n.mode==="floating"?Ao(a,n):i&&this.registerCleanup(await this.setupAnchoredPosition(i,a,n)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}async setupAnchoredPosition(e,t,n){let i=n.side??"bottom",r=async()=>{let{x:a,y:l}=await z(e,t,{placement:i,strategy:"fixed",middleware:[H(n.offsetY??8),W(),D({padding:8})]});t.style.left=`${a}px`,t.style.top=`${l}px`;};await r();let s=()=>{r();};return window.addEventListener("scroll",s,true),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s,true),window.removeEventListener("resize",s);}}};function Ao(o,e){let t=e.position??"bottom-right",n=`${e.offsetX??yn}px`,i=`${e.offsetY??yn}px`,r=o.style;if(t==="center"){r.top="50%",r.left="50%",r.transform="translate(-50%, -50%)";return}let[s,a]=t.split("-");s==="top"?r.top=i:r.bottom=i,a==="left"?r.left=n:a==="right"?r.right=n:(r.left="50%",r.transform="translateX(-50%)");}var Ee=class extends w{render(e){let t=e.guide.guideSteps[0];if(!t||(t.fields??[]).length===0)return;let{root:n}=this.createHost();this.applyDesign(t.style);let i=n.ownerDocument??document,r=i.createElement("div");r.className="veo-modal-overlay";let s=i.createElement("div");s.className="veo-modal-card",it(s,e,i),r.appendChild(s),n.appendChild(r);let a=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();};r.addEventListener("click",d=>{d.target===r&&a();});let l=d=>{d.key==="Escape"&&a();};document.addEventListener("keydown",l),this.registerCleanup(()=>document.removeEventListener("keydown",l)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var Re=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let n=t.selector??e.guide.activationRules.selector;if(typeof n!="string"||n.length===0)return;let i=await k(n);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=K(t.style);A(i,r,a),this.registerCleanup(M(r,n,a));let l=s.ownerDocument??document,d=l.createElement("div");d.className="veo-custom-inline";let{iframe:c,cleanup:p}=Se(l,t,e,{width:"100%"});this.registerCleanup(p),d.appendChild(c),s.appendChild(d),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var Ie=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t||(t.fields??[]).length===0)return;let n=t.selector??e.guide.activationRules.selector;if(typeof n!="string"||n.length===0)return;let i=await k(n);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=K(t.style);A(i,r,a),this.registerCleanup(M(r,n,a)),this.applyDesign(t.style);let l=s.ownerDocument??document,d=l.createElement("div");d.className="veo-inline",it(d,e,l),s.appendChild(d),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var Te=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t)return;let n=t.selector??e.guide.activationRules.selector;if(typeof n!="string"||n.length===0)return;let i=await k(n);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=K(t.style);A(i,r,a),this.registerCleanup(M(r,n,a)),this.applyDesign(t.style);let l=s.ownerDocument??document,d=l.createElement("div");d.className="veo-inline";let c=(m,u,f)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:m,...f?{metadata:f}:{}}),u&&window.open(u,"_blank","noopener,noreferrer"),e.onClose();},p=P(t,l,{onCtaClick:(m,u,f)=>{c("cta_clicked",m==="url"?u:void 0,f),m==="guide"&&u&&e.onOpenGuide?.(u);},onDismiss:()=>c("dismissed")});d.appendChild(p),s.appendChild(d),this.liveContainer=d,this.liveContent=p,this.liveKey=`${n}|${a}`,this.liveBuild=m=>P(m,l,{onCtaClick:(u,f,h)=>{c("cta_clicked",u==="url"?f:void 0,h),u==="guide"&&f&&e.onOpenGuide?.(f);},onDismiss:()=>c("dismissed")}),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}liveKeyOf(e){return `${e.selector??""}|${K(e.style)}`}};function bn(o){return o.style?.backdrop===false?"veo-modal-overlay veo-modal-overlay--none":"veo-modal-overlay"}var oe=class extends w{constructor(){super(...arguments);this.overlay=null;}render(t){let n=t.nav?.stepIndex??0,i=t.guide.guideSteps[n];if(!i)return;let{root:r}=this.createHost();this.applyDesign(i.style);let s=r.ownerDocument??document,a=s.createElement("div");a.className=bn(i),this.overlay=a;let l=s.createElement("div");l.className="veo-modal-card";let d=(u,f,h)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:n,action:u,...h?{metadata:h}:{}}),f&&window.open(f,"_blank","noopener,noreferrer"),t.onClose();},c=()=>{t.nav?t.nav.callbacks.onSkip():d("dismissed");},p=t.nav?Ce(i,t.nav.stepIndex,t.nav.totalSteps,s,t.nav.callbacks):P(i,s,{onCtaClick:(u,f,h)=>{d("cta_clicked",u==="url"?f:void 0,h),u==="guide"&&f&&t.onOpenGuide?.(f);},onDismiss:()=>d("dismissed")});l.appendChild(p),a.appendChild(l),r.appendChild(a),t.nav||(this.liveContainer=l,this.liveContent=p,this.liveBuild=u=>P(u,s,{onCtaClick:(f,h,g)=>{d("cta_clicked",f==="url"?h:void 0,g),f==="guide"&&h&&t.onOpenGuide?.(h);},onDismiss:()=>d("dismissed")})),a.addEventListener("click",u=>{u.target===a&&c();});let m=u=>{u.key==="Escape"&&c();};document.addEventListener("keydown",m),this.registerCleanup(()=>document.removeEventListener("keydown",m)),t.nav||t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}onLiveUpdate(t){this.overlay&&(this.overlay.className=bn(t));}destroy(){this.overlay=null,super.destroy();}};var Pe=class extends w{constructor(){super(...arguments);this.side="bottom";this.reposition=null;}async render(t){let n=t.guide.guideSteps[0];if(!n)return;let i=n.selector??t.guide.activationRules.selector;if(typeof i!="string"||i.length===0)return;let r=await k(i);if(!r)return;let s=n.style?.tooltipPlacement;this.side=s==="top"||s==="left"||s==="right"?s:"bottom";let{root:a}=this.createHost();this.applyDesign(n.style);let l=a.ownerDocument??document,d=l.createElement("div");d.className="veo-tooltip";let c=(h,g,v)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:h,...v?{metadata:v}:{}}),g&&window.open(g,"_blank","noopener,noreferrer"),t.onClose();},p=P(n,l,{onCtaClick:(h,g,v)=>{c("cta_clicked",h==="url"?g:void 0,v),h==="guide"&&g&&t.onOpenGuide?.(g);},onDismiss:()=>c("dismissed")});d.appendChild(p);let m=l.createElement("div");m.className="veo-tooltip-arrow",d.appendChild(m),a.appendChild(d);let u=async()=>{let{x:h,y:g,placement:v,middlewareData:b}=await z(r,d,{placement:this.side,middleware:[H(10),W(),D({padding:8}),ee({element:m})]});d.style.left=`${h}px`,d.style.top=`${g}px`,te(m,v,b.arrow);};await u();let f=()=>{u();};this.reposition=f,window.addEventListener("scroll",f,true),window.addEventListener("resize",f),this.registerCleanup(()=>{window.removeEventListener("scroll",f,true),window.removeEventListener("resize",f);}),this.liveContainer=d,this.liveContent=p,this.liveKey=i,this.liveBuild=h=>P(h,l,{onCtaClick:(g,v,b)=>{c("cta_clicked",g==="url"?v:void 0,b),g==="guide"&&v&&t.onOpenGuide?.(v);},onDismiss:()=>c("dismissed")}),t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}liveKeyOf(t){return t.selector??""}onLiveUpdate(t){let n=t.style?.tooltipPlacement;this.side=n==="top"||n==="left"||n==="right"?n:"bottom",this.reposition?.();}};var Ae=class extends w{async render(e){let t=e.guide.guideSteps[e.currentStepIndex];if(!t)return false;let n=t.selector??e.guide.activationRules.selector;if(typeof n!="string"||n.length===0)return false;let i=await k(n,5e3);if(!i)return false;let r=t.style?.tooltipPlacement,s=r==="top"||r==="left"||r==="right"?r:"bottom",{root:a}=this.createHost();this.applyDesign(t.style);let l=a.ownerDocument??document,d=l.createElement("div");d.className="veo-walkthrough";let c=Ce(t,e.currentStepIndex,e.guide.guideSteps.length,l,e.callbacks);d.appendChild(c);let p=l.createElement("div");p.className="veo-walkthrough-arrow",d.appendChild(p),a.appendChild(d);let m=async()=>{let{x:f,y:h,placement:g,middlewareData:v}=await z(i,d,{placement:s,middleware:[H(10),W(),D({padding:8}),ee({element:p})]});d.style.left=`${f}px`,d.style.top=`${h}px`,te(p,g,v.arrow);};await m();let u=()=>{m();};return window.addEventListener("scroll",u,true),window.addEventListener("resize",u),this.registerCleanup(()=>{window.removeEventListener("scroll",u,true),window.removeEventListener("resize",u);}),true}};function Lo(o,e){switch(o.type){case "exact":return o.pattern===e;case "prefix":return e.startsWith(o.pattern);case "regex":try{return new RegExp(o.pattern).test(e)}catch{return false}}}function De(o,e){return !o||o.scope==="sitewide"||!o.pattern?true:Lo({type:o.matchType??"prefix",pattern:o.pattern},e)}var rt=class{constructor(e){this.state=null;this.storageKey=`${kt}${e}`,this.state=this.load(),this.state&&this.isAbandoned(this.state)&&this.clear();}current(){return this.state?this.isAbandoned(this.state)?(this.clear(),null):this.state:null}hasActive(){return this.current()!==null}start(e,t){let n=Date.now();return this.state={guideId:e,totalSteps:t,currentStepIndex:0,startedAt:n,lastProgressAt:n},this.persist(),this.state}advance(){if(!this.state)return null;let e=this.state.currentStepIndex+1;return e>=this.state.totalSteps?null:(this.state={...this.state,currentStepIndex:e,lastProgressAt:Date.now()},this.persist(),this.state)}back(){return this.state?this.state.currentStepIndex===0?this.state:(this.state={...this.state,currentStepIndex:this.state.currentStepIndex-1,lastProgressAt:Date.now()},this.persist(),this.state):null}clear(){if(this.state=null,!(typeof localStorage>"u"))try{localStorage.removeItem(this.storageKey);}catch{}}isAbandoned(e){return Date.now()-e.lastProgressAt>18e5}load(){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(this.storageKey);if(!e)return null;let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;return typeof n.guideId!="string"||typeof n.totalSteps!="number"||typeof n.currentStepIndex!="number"||typeof n.startedAt!="number"||typeof n.lastProgressAt!="number"?null:n}catch{return null}}persist(){if(!(typeof localStorage>"u"||!this.state))try{localStorage.setItem(this.storageKey,JSON.stringify(this.state));}catch{}}};var No=3e4,Mo={shown:"shown",dismissed:"dismissed",cta_clicked:null,step_advanced:null,step_back:null,completed:"completed"},st=class{constructor(e,t){this.client=e;this.activeRenderers=new Set;this.activeByGuideId=new Map;this.dispatched=new Set;this.activeWalkthroughRenderer=null;this.activeWalkthroughGuide=null;this.resolveCache=null;this.inflightResolve=null;this.armedTriggers=new Map;this.pendingComposite=null;this.activeComposite=new Map;if(this.debug=t.debug===true,this.apiUrl=t.apiUrl,this.apiKey=t.apiKey,this.resolver=t.resolver??new Ue(t.apiUrl,t.apiKey,this.debug),t.trackerQueue)this.trackerQueue=t.trackerQueue;else {let i=new Ke(t.apiUrl,t.apiKey);this.trackerQueue=new qe({client:i,flushIntervalMs:3e3,batchSize:5,maxRetries:3,onError:(r,s)=>{this.debug&&console.warn(`[veo] dropped guide interaction after retries: guideId=${s.guideId} action=${s.payload.action}`,r);}});}let n=It(t.apiKey);this.frequencyCache=t.frequencyCache??new ze(n),this.walkthroughState=t.walkthroughState??new rt(n);}get pendingInteractions(){return this.trackerQueue.size}clearFrequencyCache(){this.frequencyCache.clear();}clearWalkthroughState(){this.tearDownWalkthrough();}async checkGuides(e,t){let n=this.client.getEndUserId();if(!n){this.debug&&console.log("[veo] guides: skipped, no endUserId yet");return}if(this.pruneComposite(e),await this.tryResumeWalkthrough(n,t,e))return;this.tryResumeComposite(t,e);let i;try{i=await this.resolveGuides(n,e);}catch(r){this.debug&&console.error("[veo] guides resolver threw:",r);return}this.debug&&console.log(`[veo] guides: ${i.length} eligible at ${e}`),this.disarmTriggers();for(let r of i){let s=r.activationRules.trigger;if((s==="on_click"||s==="on_hover")&&r.activationRules.selector){this.armInteractionTrigger(r,n,t,e);continue}await this.showGuide(r,n,t,e);}}async showGuide(e,t,n,i){if(this.frequencyCache.shouldFilter(e.guideId,e.displayFrequency)){this.debug&&console.log(`[veo] guides: filtered locally guideId=${e.guideId}`);return}if(this.activeByGuideId.has(e.guideId)){this.debug&&console.log(`[veo] guides: already shown guideId=${e.guideId}`);return}if(e.guideType==="walkthrough"&&e.guideSteps.length>1){if(this.walkthroughState.hasActive()){this.debug&&console.log(`[veo] guides: walkthrough ${e.guideId} skipped (another active)`);return}await this.startWalkthrough(e,t,n,i);return}if(e.guideType==="composite"){this.startComposite(e,n,i);return}this.runSingleStepRender(e,n,i);}armInteractionTrigger(e,t,n,i){if(this.frequencyCache.shouldFilter(e.guideId,e.displayFrequency)||this.activeByGuideId.has(e.guideId)||this.armedTriggers.has(e.guideId))return;let r=e.activationRules.selector,s=e.activationRules.trigger==="on_hover"?"mouseover":"click",a=d=>{let c=d.target;if(c instanceof Element){try{if(!c.closest(r))return}catch{return}l(),this.showGuide(e,t,n,i);}},l=()=>{document.removeEventListener(s,a,true),this.armedTriggers.delete(e.guideId);};document.addEventListener(s,a,true),this.armedTriggers.set(e.guideId,l),this.debug&&console.log(`[veo] guides: armed ${s} trigger for ${e.guideId} on ${r}`);}disarmTriggers(){for(let e of this.armedTriggers.values())e();this.armedTriggers.clear();}async resolveGuides(e,t){let n=`${e}
|
|
427
|
+
${t}`,i=Date.now();if(this.resolveCache?.key===n&&i-this.resolveCache.at<No)return this.debug&&console.log("[veo] guides: resolve cache hit"),this.resolveCache.guides;if(this.inflightResolve?.key===n)return this.inflightResolve.promise;let r=this.resolver.resolve(e,t);this.inflightResolve={key:n,promise:r};try{let s=await r;return this.resolveCache={key:n,at:Date.now(),guides:s},s}finally{this.inflightResolve?.key===n&&(this.inflightResolve=null);}}destroy(){for(let e of this.activeRenderers)try{e.destroy();}catch(t){this.debug&&console.error("[veo] renderer destroy failed:",t);}if(this.activeRenderers.clear(),this.activeByGuideId.clear(),this.activeComposite.clear(),this.activeWalkthroughRenderer){try{this.activeWalkthroughRenderer.destroy();}catch{}this.activeWalkthroughRenderer=null,this.activeWalkthroughGuide=null;}this.disarmTriggers(),this.dispatched.clear(),this.resolveCache=null,this.inflightResolve=null,this.trackerQueue.destroy();}runSingleStepRender(e,t,n){let i=this.createSingleStepRenderer(e.guideType);if(!i)return;this.activeByGuideId.set(e.guideId,i);let r=e.activationRules.delayMs??0;window.setTimeout(()=>this.mountSingleStepRenderer(e,i,t,n),r);}startComposite(e,t,n){if(this.pendingComposite?.guide.guideId===e.guideId)return;let r=e.guideSteps.findIndex(s=>De(s.pageLocation,n));r!==-1&&this.renderCompositeStep(e,r,t,n);}pruneComposite(e){for(let t of this.activeComposite.values()){let i=t.guide.guideSteps[t.stepIndex];(!i||!De(i.pageLocation,e))&&t.cleanup();}}tryResumeComposite(e,t){let n=this.pendingComposite;if(!n)return false;let r=n.guide.guideSteps[n.stepIndex];return r?De(r.pageLocation,t)?(this.pendingComposite=null,this.renderCompositeStep(n.guide,n.stepIndex,e,t),true):false:(this.pendingComposite=null,false)}renderCompositeStep(e,t,n,i){let r=e.guideSteps,s=new me;this.activeRenderers.add(s),this.activeByGuideId.set(e.guideId,s);let a=()=>{s.destroy(),this.activeRenderers.delete(s),this.activeByGuideId.get(e.guideId)===s&&this.activeByGuideId.delete(e.guideId),this.activeComposite.delete(e.guideId);};this.activeComposite.set(e.guideId,{guide:e,stepIndex:t,cleanup:a});let l=c=>{if(a(),c<0||c>=r.length)return;let p=r[c];p&&De(p.pageLocation,i)?this.renderCompositeStep(e,c,n,i):this.pendingComposite={guide:e,stepIndex:c};},d=r.length>1?{stepIndex:t,totalSteps:r.length,callbacks:{onNext:()=>l(t+1),onBack:()=>l(t-1),onGoto:c=>l(c),onSkip:a,onComplete:a}}:void 0;try{s.render({guide:e,onInteraction:c=>this.handleInteraction(e,n,i,c),onClose:a,onTrack:(c,p)=>this.client.track(c,p),onFormSubmit:c=>this.submitFormResponse(e.guideId,c),onOpenGuide:c=>{this.openGuideById(c,n,i);},...d?{nav:d}:{}});}catch(c){this.debug&&console.error("[veo] composite renderer threw:",c),a();}}mountSingleStepRenderer(e,t,n,i){this.activeRenderers.add(t),this.activeByGuideId.set(e.guideId,t);let r=()=>{t.destroy(),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);},s=c=>{this.handleInteraction(e,n,i,c);},a=(c,p)=>{this.client.track(c,p);},l=c=>this.submitFormResponse(e.guideId,c),d=c=>{this.openGuideById(c,n,i);};try{t.render({guide:e,onInteraction:s,onClose:r,onTrack:a,onFormSubmit:l,onOpenGuide:d});}catch(c){this.debug&&console.error("[veo] renderer.render threw:",c),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);}}async openGuideById(e,t,n){if(this.activeByGuideId.has(e))return;let i=await this.resolver.fetchById(e);if(!i){this.debug&&console.warn(`[veo] guides: chained guide ${e} not found`);return}let r=this.client.getEndUserId()??this.client.getAnonymousId();if(i.guideType==="walkthrough"&&i.guideSteps.length>1){this.walkthroughState.hasActive()||await this.startWalkthrough(i,r,t,n);return}this.runSingleStepRender(i,t,n);}async tryResumeWalkthrough(e,t,n){let i=this.walkthroughState.current();if(!i)return false;let r=await this.resolver.fetchById(i.guideId);if(!r||r.guideType!=="walkthrough")return this.debug&&console.log(`[veo] guides: walkthrough ${i.guideId} no longer available, cleaning up`),this.tearDownWalkthrough(),true;let s=Math.min(i.currentStepIndex,r.guideSteps.length-1);return await this.renderWalkthroughStep(r,s,e,t,n),true}async startWalkthrough(e,t,n,i){this.walkthroughState.start(e.guideId,e.guideSteps.length),await this.renderWalkthroughStep(e,0,t,n,i)&&(this.enqueueInteractionOnce(e.guideId,t,n,i,"shown",0),this.frequencyCache.record(e.guideId,"shown"));}async renderWalkthroughStep(e,t,n,i,r){this.activeWalkthroughRenderer&&(this.activeWalkthroughRenderer.destroy(),this.activeWalkthroughRenderer=null),this.activeWalkthroughGuide=e;let s={onNext:()=>this.handleWalkthroughNext(n,i,r),onBack:()=>this.handleWalkthroughBack(n,i,r),onSkip:()=>this.handleWalkthroughSkip(n,i,r),onComplete:()=>this.handleWalkthroughComplete(n,i,r)},a=e.guideSteps[t],l=Oo(a);if(l==="modal"||l==="banner"){let p=l==="modal"?new oe:new ne;try{p.render({guide:e,onInteraction:()=>{},onClose:()=>{},nav:{stepIndex:t,totalSteps:e.guideSteps.length,callbacks:s}});}catch(m){return this.debug&&console.error("[veo] sequence renderer threw:",m),this.tearDownWalkthrough(),false}return this.activeWalkthroughRenderer=p,true}let d=new Ae,c=false;try{c=await d.render({guide:e,currentStepIndex:t,callbacks:s});}catch(p){this.debug&&console.error("[veo] walkthrough renderer threw:",p);}return c?(this.activeWalkthroughRenderer=d,true):(this.debug&&console.warn(`[veo] walkthrough ${e.guideId} step ${t} could not render, cancelling`),this.tearDownWalkthrough(),false)}handleWalkthroughNext(e,t,n){let i=this.activeWalkthroughGuide;if(!i)return;let r=this.walkthroughState.advance();if(!r){this.handleWalkthroughComplete(e,t,n);return}this.enqueueInteraction(i.guideId,e,t,n,"step_advanced",r.currentStepIndex),this.renderWalkthroughStep(i,r.currentStepIndex,e,t,n);}handleWalkthroughBack(e,t,n){let i=this.activeWalkthroughGuide;if(!i)return;let r=this.walkthroughState.current();if(!r||r.currentStepIndex===0)return;let s=this.walkthroughState.back();s&&(this.enqueueInteraction(i.guideId,e,t,n,"step_back",s.currentStepIndex),this.renderWalkthroughStep(i,s.currentStepIndex,e,t,n));}handleWalkthroughSkip(e,t,n){let i=this.activeWalkthroughGuide,r=this.walkthroughState.current();!i||!r||(this.enqueueInteraction(i.guideId,e,t,n,"dismissed",r.currentStepIndex),this.frequencyCache.record(i.guideId,"dismissed"),this.tearDownWalkthrough());}handleWalkthroughComplete(e,t,n){let i=this.activeWalkthroughGuide,r=this.walkthroughState.current();!i||!r||(this.enqueueInteraction(i.guideId,e,t,n,"completed",r.currentStepIndex),this.frequencyCache.record(i.guideId,"completed"),this.tearDownWalkthrough());}tearDownWalkthrough(){if(this.activeWalkthroughRenderer)try{this.activeWalkthroughRenderer.destroy();}catch{}this.activeWalkthroughRenderer=null,this.activeWalkthroughGuide=null,this.walkthroughState.clear();}handleInteraction(e,t,n,i){let r=i.metadata?.buttonId?`:${i.metadata.buttonId}`:"",s=`${e.guideId}:${i.action}${r}`;if(this.dispatched.has(s)){this.debug&&console.log(`[veo] guides: dedup hit ${s}`);return}this.dispatched.add(s);let a=Mo[i.action];a&&this.frequencyCache.record(e.guideId,a);let l=this.client.getEndUserId();if(!l){this.debug&&console.warn("[veo] guides: interaction without endUserId \u2014 skipping enqueue");return}this.trackerQueue.enqueue({guideId:e.guideId,payload:{endUserId:l,sessionId:t,action:i.action,stepIndex:i.stepIndex,pageUrl:n,pagePath:wn(n),...i.metadata?{metadata:i.metadata}:{}}});}enqueueInteraction(e,t,n,i,r,s){this.trackerQueue.enqueue({guideId:e,payload:{endUserId:t,sessionId:n,action:r,stepIndex:s,pageUrl:i,pagePath:wn(i)}});}enqueueInteractionOnce(e,t,n,i,r,s){let a=`${e}:${r}:${s}`;this.dispatched.has(a)||(this.dispatched.add(a),this.enqueueInteraction(e,t,n,i,r,s));}createSingleStepRenderer(e){switch(e){case "modal":return new oe;case "banner":return new ne;case "tooltip":return new Pe;case "custom":return new ke;case "inline":return new Te;case "inline-custom":return new Re;case "form":return new Ee;case "inline-form":return new Ie;case "badge":return new xe;case "composite":return new me;case "walkthrough":return null;default:return null}}async submitFormResponse(e,t){let n=this.client.getEndUserId()??this.client.getAnonymousId();try{let i=await fetch(`${this.apiUrl}/v1/guides/${e}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":this.apiKey},body:JSON.stringify({endUserId:n,answers:t})});return !i.ok&&this.debug&&console.warn("[veo] form-response respondi\xF3",i.status),i.ok}catch(i){return this.debug&&console.warn("[veo] form-response fall\xF3:",i),false}}};function wn(o){try{return new URL(o).pathname}catch{return "/"}}function Oo(o){let e=o?.style?.render;return typeof e=="string"?e:"walkthrough"}var _o="__veo_preview__",bt=class{constructor(){this.singleStep=null;this.walkthrough=null;this.walkthroughGuide=null;this.walkthroughIndex=0;this.input=null;}preview(e){let t=e.guideSteps[0];if(this.singleStep&&this.input&&e.guideType===this.input.guideType&&e.guideType!=="walkthrough"&&t&&this.singleStep.updateStep(t))return this.input=e,{close:()=>this.close(),ready:Promise.resolve({rendered:true}),host:()=>this.activeHost()};this.close(),this.input=e;let n=Bo(e),i=typeof e.startStepIndex=="number"?e.startStepIndex:0;if(n.guideType==="composite"){let s=Math.min(Math.max(0,i),n.guideSteps.length-1),a=n.guideSteps[s];a&&(n.guideSteps=[a]);let l=this.renderSingleStep(n);return {close:()=>this.close(),ready:l,host:()=>this.activeHost()}}let r=n.guideType==="walkthrough"?this.startWalkthrough(n,i):this.renderSingleStep(n);return {close:()=>this.close(),ready:r,host:()=>this.activeHost()}}activeHost(){return this.singleStep?this.singleStep.hostElement():this.walkthrough instanceof w?this.walkthrough.hostElement():null}close(){this.singleStep&&(he(this.singleStep),this.singleStep=null),this.walkthrough&&(he(this.walkthrough),this.walkthrough=null),this.walkthroughGuide=null,this.walkthroughIndex=0,this.input=null;}async renderSingleStep(e){let t=Fo(e.guideType);if(!t)return {rendered:false};this.singleStep=t;let n=false;try{await t.render({guide:e,onInteraction:i=>{i.action==="shown"&&(n=!0);},onClose:()=>this.close(),onTrack:()=>{},onOpenGuide:()=>{},onFormSubmit:this.input?.formSubmit??(()=>Promise.resolve(!0)),isPreview:!0,...this.input?.formSubmit&&this.input.formSubmitNote!==void 0?{previewNote:this.input.formSubmitNote}:{}});}catch{return this.close(),{rendered:false}}return this.singleStep!==t?(he(t),{rendered:false}):{rendered:n}}async startWalkthrough(e,t=0){if(e.guideSteps.length===0)return {rendered:false};this.walkthroughGuide=e;let n=Math.min(Math.max(0,Math.floor(t)),e.guideSteps.length-1);return this.walkthroughIndex=n,{rendered:await this.renderWalkthroughStep(n)}}async renderWalkthroughStep(e){let t=this.walkthroughGuide;if(!t)return false;this.walkthrough&&(he(this.walkthrough),this.walkthrough=null);let n={onNext:()=>{let l=this.walkthroughIndex+1;if(l>=t.guideSteps.length){this.close();return}this.walkthroughIndex=l,this.renderWalkthroughStep(l);},onBack:()=>{let l=this.walkthroughIndex-1;l<0||(this.walkthroughIndex=l,this.renderWalkthroughStep(l));},onSkip:()=>this.close(),onComplete:()=>this.close()},r=t.guideSteps[e]?.style?.render;if(r==="modal"||r==="banner"){let l=r==="modal"?new oe:new ne;try{l.render({guide:t,onInteraction:()=>{},onClose:()=>this.close(),nav:{stepIndex:e,totalSteps:t.guideSteps.length,callbacks:n}});}catch{return he(l),false}return this.walkthroughGuide!==t?(he(l),false):(this.walkthrough=l,true)}let s=new Ae,a=false;try{a=await s.render({guide:t,currentStepIndex:e,callbacks:n});}catch{a=false;}return !a||this.walkthroughGuide!==t?(he(s),false):(this.walkthrough=s,true)}},at=null;function lt(o){return We()?(at||(at=new bt),at.preview(o)):{close:()=>{},ready:Promise.resolve({rendered:false}),host:()=>null}}function xn(){at?.close();}function Bo(o){let e=o.activationRules?.selector,t={url:o.activationRules?.url??{type:"prefix",pattern:"/"},trigger:"immediate",...e!==void 0?{selector:e}:{}};return {guideId:_o,guideName:o.guideName??"Preview",guideType:o.guideType,guideSteps:o.guideSteps,activationRules:t,displayFrequency:"always",displayPriority:0}}function Fo(o){switch(o){case "modal":return new oe;case "banner":return new ne;case "tooltip":return new Pe;case "custom":return new ke;case "inline":return new Te;case "inline-custom":return new Re;case "form":return new Ee;case "inline-form":return new Ie;case "badge":return new xe;case "composite":return new me;case "walkthrough":return null;default:return null}}function he(o){try{o.destroy();}catch{}}var $o="veo:preview_token";function Ho(){try{return window.sessionStorage}catch{return null}}function Cn(){try{Ho()?.removeItem($o);}catch{}}var dt=null;async function Sn(o){if(!We())return null;dt?.teardown();let e=null;try{let a=await fetch(`${o.apiUrl}/v1/guides/preview-resolve`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":o.apiKey},body:JSON.stringify({token:o.token})});a.ok?e=(await a.json()).guide??null:o.debug&&console.warn("[veo] preview-resolve respondi\xF3",a.status);}catch(a){o.debug&&console.warn("[veo] preview-resolve fall\xF3:",a);}let t=async a=>{if(!e)return false;let l=window.veo,d=l?.getEndUserId?.()??l?.getAnonymousId?.()??null;if(!d)return false;try{return (await fetch(`${o.apiUrl}/v1/guides/${e.guideId}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":o.apiKey},body:JSON.stringify({endUserId:d,answers:a})})).ok}catch{return false}},n=null,i=()=>{e&&(n?.close(),n=lt({guideType:e.guideType,guideSteps:e.guideSteps,activationRules:e.activationRules,guideName:e.guideName,formSubmit:t,formSubmitNote:"Vista previa: guardado en TU usuario para probar el flujo."}));},r=Do({label:e?`Vista previa: ${e.guideName}`:"Link de preview inv\xE1lido o vencido",error:!e,onReshow:e?i:null,onClose:()=>s.teardown()}),s={teardown(){n?.close(),n=null,r.remove(),Cn(),dt===s&&(dt=null);}};return dt=s,i(),s}function Do(o){let e=document.createElement("div");e.setAttribute("data-veo-preview-chip","");let t=e.attachShadow({mode:"open"}),n=document.createElement("style");n.textContent=`
|
|
428
428
|
.chip { position: fixed; bottom: 16px; right: 16px; z-index: 2147483647;
|
|
429
429
|
display: flex; align-items: center; gap: 8px; padding: 8px 12px;
|
|
430
430
|
background: #111827; color: #f9fafb; border-radius: 9999px;
|