veo-sdk 0.1.0 → 0.2.0
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/README.md +15 -11
- package/dist/builder.cjs +2072 -0
- package/dist/builder.cjs.map +1 -0
- package/dist/builder.d.cts +162 -0
- package/dist/builder.d.ts +162 -0
- package/dist/builder.mjs +449 -0
- package/dist/builder.mjs.map +1 -0
- package/dist/chunk-BBAA5BRS.mjs +2728 -0
- package/dist/chunk-BBAA5BRS.mjs.map +1 -0
- package/dist/guide-preview-CO5ShtNf.d.cts +137 -0
- package/dist/guide-preview-CO5ShtNf.d.ts +137 -0
- package/dist/index.cjs +1952 -904
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -22
- package/dist/index.d.ts +41 -22
- package/dist/index.mjs +351 -2027
- package/dist/index.mjs.map +1 -1
- package/dist/veo-builder.js +289 -0
- package/dist/veo-builder.js.map +1 -0
- package/dist/veo-guides.js +259 -0
- package/dist/veo-guides.js.map +1 -0
- package/dist/veo.js +1 -169
- package/dist/veo.js.map +1 -1
- package/package.json +7 -2
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
var veoGuides=(function(exports){'use strict';function ot(){return typeof window<"u"}function Ae(){return typeof document<"u"}var rt=["http:","https:"],it="data-veo-guide",st="veo:freq:";var at="veo:walkthrough_state:";var ct={shown:1,dismissed:2,completed:2};function dt(n){return n.slice(-16)||"default"}var Te=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 o=this.cache.get(e);return o?t==="once"?true:t==="until_dismissed"?o.status==="dismissed"||o.status==="completed":t==="until_answered"?o.status==="completed":false:false}record(e,t){let o=this.cache.get(e);o&&ct[t]<ct[o.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[o,r]of this.cache)e-r.lastInteractionAt>7776e6&&(this.cache.delete(o),t=true);if(this.cache.size>500){let o=Array.from(this.cache.entries()).sort((i,s)=>i[1].lastInteractionAt-s[1].lastInteractionAt),r=this.cache.size-500;for(let i=0;i<r;i++){let s=o[i];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 o=[];for(let r of t)if(r&&typeof r=="object"&&typeof r.guideId=="string"&&typeof r.lastInteractionAt=="number"&&["shown","dismissed","completed"].includes(r.status)){let i=r;o.push([i.guideId,i]);}return new Map(o)}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 Le=class{constructor(e,t,o=false){this.apiUrl=e;this.apiKey=t;this.debug=o;}async resolve(e,t){let o=new URLSearchParams({endUserId:e,pageUrl:t}),r;try{r=await fetch(`${this.apiUrl}/v1/guides/resolve?${o.toString()}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(i){return this.debug&&console.error("[veo] guides resolve fetch failed:",i),[]}if(!r.ok)return this.debug&&console.warn("[veo] guides resolve HTTP",r.status),[];try{let i=await r.json();return Array.isArray(i.guides)?i.guides:[]}catch(i){return this.debug&&console.error("[veo] guides resolve parse failed:",i),[]}}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(o){return this.debug&&console.error("[veo] guides fetchById network failed:",o),null}if(!t.ok)return this.debug&&console.warn("[veo] guides fetchById HTTP",t.status),null;try{let o=await t.json();return typeof o.guideId!="string"||typeof o.guideName!="string"||typeof o.guideType!="string"||!Array.isArray(o.guideSteps)||!o.activationRules||typeof o.displayFrequency!="string"||typeof o.displayPriority!="number"?(this.debug&&console.warn("[veo] guides fetchById: unexpected shape"),null):{guideId:o.guideId,guideName:o.guideName,guideType:o.guideType,guideSteps:o.guideSteps,activationRules:o.activationRules,displayFrequency:o.displayFrequency,displayPriority:o.displayPriority}}catch(o){return this.debug&&console.error("[veo] guides fetchById parse failed:",o),null}}};function ut(n){let e={endUserId:n.endUserId,interactionType:n.action};return n.sessionId&&(e.sessionId=n.sessionId),typeof n.stepIndex=="number"&&(e.stepPosition=n.stepIndex),n.pageUrl&&(e.pageUrl=n.pageUrl),n.pagePath&&(e.pagePath=n.pagePath),e}var Ge=class{constructor(e,t){this.apiUrl=e;this.apiKey=t;}async send(e){let t=this.buildUrl(e.guideId),o=await fetch(t,{method:"POST",headers:{"X-Api-Key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(ut(e.payload)),credentials:"omit"});if(!o.ok)throw new Error(`guide interaction send failed: HTTP ${o.status}`)}sendBeacon(e){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function")return false;let t=`${this.buildUrl(e.guideId)}?key=${encodeURIComponent(this.apiKey)}`,o=new Blob([JSON.stringify(ut(e.payload))],{type:"application/json"});try{return navigator.sendBeacon(t,o)}catch{return false}}buildUrl(e){return `${this.apiUrl}/v1/guides/${encodeURIComponent(e)}/interactions`}};var Oe=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;this.flushing=true;let e=this.buffer.splice(0,this.buffer.length),t=await Promise.allSettled(e.map(o=>this.config.client.send({guideId:o.guideId,payload:o.payload})));for(let o=0;o<t.length;o++){let r=t[o],i=e[o];!r||!i||r.status!=="fulfilled"&&(i.attempts+=1,i.attempts<this.config.maxRetries?this.buffer.push(i):this.safeOnError(r.reason,i));}this.flushing=false;}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 o=e instanceof Error?e:new Error(String(e));try{this.config.onError(o,t);}catch{}}};function F(n,e,t){let o=e.createElement("div");if(o.className="veo-guide-content",typeof n.imageUrl=="string"&&n.imageUrl&&q(n.imageUrl)){let s=e.createElement("img");s.className="veo-guide-image",s.src=n.imageUrl,s.alt=typeof n.title=="string"?n.title:"",o.appendChild(s);}if(typeof n.title=="string"&&n.title){let s=e.createElement("h2");s.className="veo-guide-title",s.textContent=n.title,o.appendChild(s);}if(typeof n.content=="string"&&n.content){let s=e.createElement("p");s.className="veo-guide-text",s.textContent=n.content,o.appendChild(s);}let r=e.createElement("div");if(r.className="veo-guide-actions",typeof n.ctaText=="string"&&n.ctaText){let s=e.createElement("button");s.type="button",s.className="veo-guide-cta",s.textContent=n.ctaText,s.addEventListener("click",()=>{let a=n.ctaAction??"dismiss",c=en(n);t.onCtaClick(a,c);}),r.appendChild(s);}o.appendChild(r);let i=e.createElement("button");return i.type="button",i.className="veo-guide-close",i.setAttribute("aria-label","Cerrar"),i.textContent="\xD7",i.addEventListener("click",()=>t.onDismiss()),o.appendChild(i),o}function q(n){if(typeof n!="string"||n.length===0)return false;try{let e=typeof window<"u"?window.location.href:"http://localhost/",t=new URL(n,e);return rt.includes(t.protocol)}catch{return false}}function en(n){let e=n.style?.ctaUrl;if(typeof e=="string")return q(e)?e:void 0}var tn={"--veo-bg":"#1f2937","--veo-text":"#f9fafb","--veo-text-secondary":"#d1d5db","--veo-shadow":"0 20px 60px rgba(0, 0, 0, 0.55)"},nn={left:"flex-start",center:"center",right:"flex-end"},pt={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)"},ft={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]},ht=/^#[0-9a-f]{3,8}$|^(rgb|rgba|hsl|hsla)\([\d.,%/\sdeg]+\)$|^[a-z]{3,20}$/i;function V(n,e,t){return Math.min(t,Math.max(e,n))}function mt(n,e){if(!e||typeof e!="object")return;let t=e;if(typeof t.accentColor=="string"&&ht.test(t.accentColor.trim())&&n.style.setProperty("--veo-primary",t.accentColor.trim()),t.theme==="dark")for(let[i,s]of Object.entries(tn))n.style.setProperty(i,s);typeof t.radius=="number"&&Number.isFinite(t.radius)&&n.style.setProperty("--veo-radius",`${V(t.radius,0,48)}px`),typeof t.width=="number"&&Number.isFinite(t.width)&&n.style.setProperty("--veo-width",`${V(t.width,220,720)}px`),(t.align==="left"||t.align==="center"||t.align==="right")&&n.style.setProperty("--veo-actions-justify",nn[t.align]),typeof t.padding=="number"&&Number.isFinite(t.padding)&&n.style.setProperty("--veo-pad",`${V(t.padding,0,64)}px`),typeof t.margin=="number"&&Number.isFinite(t.margin)&&n.style.setProperty("--veo-margin",`${V(t.margin,0,64)}px`),typeof t.borderWidth=="number"&&Number.isFinite(t.borderWidth)&&n.style.setProperty("--veo-border-width",`${V(t.borderWidth,0,16)}px`),typeof t.borderColor=="string"&&ht.test(t.borderColor.trim())&&n.style.setProperty("--veo-border-color",t.borderColor.trim()),typeof t.shadow=="string"&&pt[t.shadow]&&n.style.setProperty("--veo-shadow",pt[t.shadow]);let o,r;typeof t.posX=="number"&&typeof t.posY=="number"?(o=V(t.posX,0,1),r=V(t.posY,0,1)):typeof t.overlayPosition=="string"&&ft[t.overlayPosition]&&([o,r]=ft[t.overlayPosition]),o!==void 0&&r!==void 0&&(n.style.setProperty("--veo-pos-x",`${o*100}%`),n.style.setProperty("--veo-pos-y",`${r*100}%`));}var gt=`
|
|
2
|
+
:host {
|
|
3
|
+
--veo-primary: #4f46e5;
|
|
4
|
+
--veo-text: #1f2937;
|
|
5
|
+
--veo-text-secondary: #4b5563;
|
|
6
|
+
--veo-bg: #ffffff;
|
|
7
|
+
--veo-radius: 12px;
|
|
8
|
+
--veo-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
|
|
9
|
+
--veo-width: 420px;
|
|
10
|
+
--veo-actions-justify: flex-end;
|
|
11
|
+
all: initial;
|
|
12
|
+
}
|
|
13
|
+
* { box-sizing: border-box; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
|
|
14
|
+
|
|
15
|
+
.veo-modal-overlay {
|
|
16
|
+
position: fixed; inset: 0;
|
|
17
|
+
background: rgba(15, 15, 30, 0.45);
|
|
18
|
+
z-index: ${2147483640};
|
|
19
|
+
animation: veo-fade-in 180ms ease-out;
|
|
20
|
+
}
|
|
21
|
+
/*
|
|
22
|
+
* Posici\xF3n libre/preset: --veo-pos-x/y son porcentajes (default 50% = centro).
|
|
23
|
+
* El truco translate(-pos) alinea la MISMA fracci\xF3n de la tarjeta con esa
|
|
24
|
+
* fracci\xF3n del overlay, as\xED la tarjeta nunca se sale (0% = pegada izquierda,
|
|
25
|
+
* 100% = pegada derecha, 50% = centrada) sea cual sea su ancho.
|
|
26
|
+
*/
|
|
27
|
+
.veo-modal-card {
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: var(--veo-pos-x, 50%);
|
|
30
|
+
top: var(--veo-pos-y, 50%);
|
|
31
|
+
transform: translate(calc(var(--veo-pos-x, 50%) * -1), calc(var(--veo-pos-y, 50%) * -1));
|
|
32
|
+
background: var(--veo-bg);
|
|
33
|
+
border-radius: var(--veo-radius);
|
|
34
|
+
border: var(--veo-border-width, 0) solid var(--veo-border-color, transparent);
|
|
35
|
+
padding: var(--veo-pad, 24px);
|
|
36
|
+
max-width: var(--veo-width); width: 90%;
|
|
37
|
+
box-shadow: var(--veo-shadow);
|
|
38
|
+
animation: veo-fade-in 180ms ease-out;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.veo-banner {
|
|
42
|
+
position: fixed; left: 0; right: 0;
|
|
43
|
+
background: var(--veo-bg);
|
|
44
|
+
border: var(--veo-border-width, 0) solid var(--veo-border-color, transparent);
|
|
45
|
+
padding: var(--veo-pad, 16px);
|
|
46
|
+
z-index: ${2147483640};
|
|
47
|
+
box-shadow: var(--veo-shadow, 0 2px 12px rgba(0, 0, 0, 0.12));
|
|
48
|
+
animation: veo-slide-down 200ms ease-out;
|
|
49
|
+
}
|
|
50
|
+
.veo-banner-top { top: 0; }
|
|
51
|
+
.veo-banner-bottom { bottom: 0; }
|
|
52
|
+
|
|
53
|
+
.veo-tooltip {
|
|
54
|
+
position: absolute;
|
|
55
|
+
background: var(--veo-bg);
|
|
56
|
+
border-radius: var(--veo-radius);
|
|
57
|
+
border: var(--veo-border-width, 0) solid var(--veo-border-color, transparent);
|
|
58
|
+
padding: var(--veo-pad, 15px);
|
|
59
|
+
max-width: 300px;
|
|
60
|
+
z-index: ${2147483640};
|
|
61
|
+
box-shadow: var(--veo-shadow, 0 8px 30px rgba(0, 0, 0, 0.18));
|
|
62
|
+
animation: veo-fade-in 150ms ease-out;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.veo-inline {
|
|
66
|
+
background: var(--veo-bg);
|
|
67
|
+
border-radius: var(--veo-radius);
|
|
68
|
+
border: var(--veo-border-width, 0) solid var(--veo-border-color, transparent);
|
|
69
|
+
padding: var(--veo-pad, 20px);
|
|
70
|
+
max-width: var(--veo-width);
|
|
71
|
+
margin: var(--veo-margin, 12px) 0;
|
|
72
|
+
position: relative;
|
|
73
|
+
box-shadow: var(--veo-shadow);
|
|
74
|
+
animation: veo-fade-in 160ms ease-out;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.veo-guide-content {
|
|
78
|
+
position: relative;
|
|
79
|
+
display: flex; flex-direction: column;
|
|
80
|
+
}
|
|
81
|
+
.veo-guide-image {
|
|
82
|
+
display: block; width: 100%; max-height: 180px;
|
|
83
|
+
object-fit: cover; border-radius: 8px;
|
|
84
|
+
margin-bottom: 12px;
|
|
85
|
+
}
|
|
86
|
+
.veo-guide-title {
|
|
87
|
+
font-size: 18px; font-weight: 600; line-height: 1.3;
|
|
88
|
+
margin: 0 0 6px; color: var(--veo-text);
|
|
89
|
+
}
|
|
90
|
+
.veo-guide-text {
|
|
91
|
+
font-size: 14px; line-height: 1.5;
|
|
92
|
+
margin: 0 0 16px; color: var(--veo-text-secondary);
|
|
93
|
+
}
|
|
94
|
+
.veo-guide-actions {
|
|
95
|
+
display: flex; gap: 8px; justify-content: var(--veo-actions-justify);
|
|
96
|
+
}
|
|
97
|
+
.veo-guide-cta {
|
|
98
|
+
background: var(--veo-primary); color: #fff; border: none;
|
|
99
|
+
padding: 9px 18px; border-radius: 8px;
|
|
100
|
+
font-size: 14px; font-weight: 500; cursor: pointer;
|
|
101
|
+
transition: opacity 120ms ease;
|
|
102
|
+
}
|
|
103
|
+
.veo-guide-cta:hover { opacity: 0.9; }
|
|
104
|
+
.veo-guide-cta:active { transform: translateY(1px); }
|
|
105
|
+
.veo-guide-close {
|
|
106
|
+
position: absolute; top: -6px; right: -6px;
|
|
107
|
+
width: 24px; height: 24px;
|
|
108
|
+
background: none; border: none;
|
|
109
|
+
font-size: 22px; line-height: 1;
|
|
110
|
+
cursor: pointer; color: #9ca3af; padding: 0;
|
|
111
|
+
}
|
|
112
|
+
.veo-guide-close:hover { color: var(--veo-text); }
|
|
113
|
+
|
|
114
|
+
.veo-form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
|
|
115
|
+
.veo-form-field { display: flex; flex-direction: column; gap: 6px; }
|
|
116
|
+
.veo-form-label { font-size: 13px; font-weight: 500; color: var(--veo-text); }
|
|
117
|
+
.veo-form-input {
|
|
118
|
+
font-size: 14px; color: var(--veo-text);
|
|
119
|
+
background: var(--veo-bg);
|
|
120
|
+
border: 1px solid #d1d5db; border-radius: 8px;
|
|
121
|
+
padding: 8px 10px; width: 100%;
|
|
122
|
+
}
|
|
123
|
+
.veo-form-input:focus { outline: 2px solid var(--veo-primary); outline-offset: -1px; border-color: transparent; }
|
|
124
|
+
.veo-form-options { display: flex; flex-direction: column; gap: 6px; }
|
|
125
|
+
.veo-form-option {
|
|
126
|
+
display: flex; align-items: center; gap: 8px;
|
|
127
|
+
font-size: 14px; color: var(--veo-text); cursor: pointer;
|
|
128
|
+
}
|
|
129
|
+
.veo-form-option input { accent-color: var(--veo-primary); margin: 0; cursor: pointer; }
|
|
130
|
+
.veo-form-scale { display: flex; gap: 4px; flex-wrap: wrap; }
|
|
131
|
+
.veo-nps-btn {
|
|
132
|
+
min-width: 30px; height: 30px; padding: 0 4px;
|
|
133
|
+
font-size: 13px; font-weight: 500; color: var(--veo-text);
|
|
134
|
+
background: var(--veo-bg); border: 1px solid #d1d5db; border-radius: 6px;
|
|
135
|
+
cursor: pointer; transition: all 100ms ease;
|
|
136
|
+
}
|
|
137
|
+
.veo-nps-btn:hover { border-color: var(--veo-primary); }
|
|
138
|
+
.veo-rating-btn {
|
|
139
|
+
background: none; border: none; padding: 0 2px;
|
|
140
|
+
font-size: 26px; line-height: 1; color: #d1d5db;
|
|
141
|
+
cursor: pointer; transition: color 100ms ease;
|
|
142
|
+
}
|
|
143
|
+
.veo-scale-active.veo-nps-btn { background: var(--veo-primary); color: #fff; border-color: var(--veo-primary); }
|
|
144
|
+
.veo-scale-active.veo-rating-btn { color: #f59e0b; }
|
|
145
|
+
.veo-form-error { font-size: 13px; color: #dc2626; margin: 0; }
|
|
146
|
+
.veo-form-thanks {
|
|
147
|
+
text-align: center; padding: 24px 8px;
|
|
148
|
+
font-size: 16px; font-weight: 600; color: var(--veo-text);
|
|
149
|
+
}
|
|
150
|
+
.veo-form-preview-note {
|
|
151
|
+
text-align: center; margin: 0 0 12px;
|
|
152
|
+
font-size: 12px; color: #b45309;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.veo-walkthrough {
|
|
156
|
+
position: absolute;
|
|
157
|
+
background: var(--veo-bg);
|
|
158
|
+
border-radius: var(--veo-radius);
|
|
159
|
+
border: var(--veo-border-width, 0) solid var(--veo-border-color, transparent);
|
|
160
|
+
padding: var(--veo-pad, 16px);
|
|
161
|
+
max-width: 340px;
|
|
162
|
+
z-index: ${2147483640};
|
|
163
|
+
box-shadow: var(--veo-shadow, 0 8px 30px rgba(0, 0, 0, 0.2));
|
|
164
|
+
animation: veo-fade-in 150ms ease-out;
|
|
165
|
+
}
|
|
166
|
+
.veo-walkthrough-arrow {
|
|
167
|
+
position: absolute;
|
|
168
|
+
width: 12px;
|
|
169
|
+
height: 12px;
|
|
170
|
+
background: var(--veo-bg);
|
|
171
|
+
transform: rotate(45deg);
|
|
172
|
+
pointer-events: none;
|
|
173
|
+
}
|
|
174
|
+
.veo-walkthrough-counter {
|
|
175
|
+
font-size: 11px; color: #9ca3af;
|
|
176
|
+
margin-bottom: 8px; letter-spacing: 0.02em;
|
|
177
|
+
}
|
|
178
|
+
.veo-walkthrough-progress {
|
|
179
|
+
display: flex; gap: 4px;
|
|
180
|
+
margin-bottom: 12px;
|
|
181
|
+
}
|
|
182
|
+
.veo-walkthrough-progress-dot {
|
|
183
|
+
width: 8px; height: 8px;
|
|
184
|
+
border-radius: 50%;
|
|
185
|
+
background: #e5e7eb;
|
|
186
|
+
transition: background 200ms ease;
|
|
187
|
+
}
|
|
188
|
+
.veo-walkthrough-progress-dot.active { background: var(--veo-primary); }
|
|
189
|
+
.veo-walkthrough-progress-dot.completed { background: var(--veo-primary); opacity: 0.5; }
|
|
190
|
+
.veo-walkthrough-actions {
|
|
191
|
+
display: flex; align-items: center;
|
|
192
|
+
margin-top: 16px; gap: 8px;
|
|
193
|
+
}
|
|
194
|
+
.veo-walkthrough-actions-right {
|
|
195
|
+
display: flex; gap: 8px;
|
|
196
|
+
margin-left: auto;
|
|
197
|
+
}
|
|
198
|
+
.veo-walkthrough-btn-secondary {
|
|
199
|
+
background: transparent; color: #6b7280;
|
|
200
|
+
border: 1px solid #e5e7eb;
|
|
201
|
+
padding: 8px 16px; border-radius: 8px;
|
|
202
|
+
font-size: 13px; cursor: pointer;
|
|
203
|
+
transition: background 120ms ease;
|
|
204
|
+
}
|
|
205
|
+
.veo-walkthrough-btn-secondary:hover { background: #f9fafb; }
|
|
206
|
+
.veo-walkthrough-skip {
|
|
207
|
+
background: transparent; color: #9ca3af;
|
|
208
|
+
border: none; padding: 4px 8px;
|
|
209
|
+
font-size: 12px; cursor: pointer;
|
|
210
|
+
}
|
|
211
|
+
.veo-walkthrough-skip:hover { color: var(--veo-text); }
|
|
212
|
+
|
|
213
|
+
.veo-custom-floating {
|
|
214
|
+
position: fixed;
|
|
215
|
+
z-index: ${2147483640};
|
|
216
|
+
max-width: calc(100vw - 16px);
|
|
217
|
+
max-height: calc(100vh - 16px);
|
|
218
|
+
animation: veo-fade-in 160ms ease;
|
|
219
|
+
}
|
|
220
|
+
.veo-custom-anchored {
|
|
221
|
+
position: fixed;
|
|
222
|
+
top: 0; left: 0;
|
|
223
|
+
z-index: ${2147483640};
|
|
224
|
+
max-width: calc(100vw - 16px);
|
|
225
|
+
animation: veo-fade-in 160ms ease;
|
|
226
|
+
}
|
|
227
|
+
.veo-custom-inline {
|
|
228
|
+
display: block;
|
|
229
|
+
margin: 12px 0;
|
|
230
|
+
}
|
|
231
|
+
.veo-custom-frame {
|
|
232
|
+
display: block;
|
|
233
|
+
border: 0;
|
|
234
|
+
width: 360px;
|
|
235
|
+
background: transparent;
|
|
236
|
+
color-scheme: normal;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@keyframes veo-fade-in { from { opacity: 0; } to { opacity: 1; } }
|
|
240
|
+
@keyframes veo-slide-up {
|
|
241
|
+
from { transform: translateY(10px); opacity: 0; }
|
|
242
|
+
to { transform: translateY(0); opacity: 1; }
|
|
243
|
+
}
|
|
244
|
+
@keyframes veo-slide-down {
|
|
245
|
+
from { transform: translateY(-10px); opacity: 0; }
|
|
246
|
+
to { transform: translateY(0); opacity: 1; }
|
|
247
|
+
}
|
|
248
|
+
`;var b=class{constructor(){this.host=null;this.shadow=null;this.cleanups=[];}createHost(){let e=document.createElement("div");e.setAttribute(it,"");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=gt,t.appendChild(o);let r=document.createElement("div");return t.appendChild(r),document.body.appendChild(e),this.host=e,this.shadow=t,{host:e,shadow:t,root:r}}applyDesign(e){this.host&&mt(this.host,e);}registerCleanup(e){this.cleanups.push(e);}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 ee=class extends b{render(e){let t=e.guide.guideSteps[0];if(!t)return;let{root:o}=this.createHost();this.applyDesign(t.style);let r=o.ownerDocument??document,i=t.style?.position==="bottom"?"bottom":"top",s=r.createElement("div");s.className=`veo-banner veo-banner-${i}`;let a=(l,d)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:l}),d&&window.open(d,"_blank","noopener,noreferrer"),e.onClose();},c=F(t,r,{onCtaClick:(l,d)=>{a("cta_clicked",l==="url"?d:void 0);},onDismiss:()=>a("dismissed")});s.appendChild(c),o.appendChild(s),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var j=Math.min,H=Math.max,Ee=Math.round;var L=n=>({x:n,y:n}),on={left:"right",right:"left",bottom:"top",top:"bottom"};function Ne(n,e,t){return H(n,j(e,t))}function te(n,e){return typeof n=="function"?n(e):n}function $(n){return n.split("-")[0]}function ne(n){return n.split("-")[1]}function Qe(n){return n==="x"?"y":"x"}function De(n){return n==="y"?"height":"width"}function D(n){let e=n[0];return e==="t"||e==="b"?"y":"x"}function We(n){return Qe(D(n))}function wt(n,e,t){t===void 0&&(t=false);let o=ne(n),r=We(n),i=De(r),s=r==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=ke(s)),[s,ke(s)]}function bt(n){let e=ke(n);return [_e(n),e,_e(e)]}function _e(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}var vt=["left","right"],yt=["right","left"],rn=["top","bottom"],sn=["bottom","top"];function an(n,e,t){switch(n){case "top":case "bottom":return t?e?yt:vt:e?vt:yt;case "left":case "right":return e?rn:sn;default:return []}}function xt(n,e,t,o){let r=ne(n),i=an($(n),t==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(_e)))),i}function ke(n){let e=$(n);return on[e]+n.slice(e.length)}function ln(n){return {top:0,right:0,bottom:0,left:0,...n}}function Je(n){return typeof n!="number"?ln(n):{top:n,right:n,bottom:n,left:n}}function Y(n){let{x:e,y:t,width:o,height:r}=n;return {width:o,height:r,top:t,left:e,right:e+o,bottom:t+r,x:e,y:t}}function Ct(n,e,t){let{reference:o,floating:r}=n,i=D(e),s=We(e),a=De(s),c=$(e),l=i==="y",d=o.x+o.width/2-r.width/2,p=o.y+o.height/2-r.height/2,f=o[a]/2-r[a]/2,u;switch(c){case "top":u={x:d,y:o.y-r.height};break;case "bottom":u={x:d,y:o.y+o.height};break;case "right":u={x:o.x+o.width,y:p};break;case "left":u={x:o.x-r.width,y:p};break;default:u={x:o.x,y:o.y};}switch(ne(e)){case "start":u[s]-=f*(t&&l?-1:1);break;case "end":u[s]+=f*(t&&l?-1:1);break}return u}async function kt(n,e){var t;e===void 0&&(e={});let{x:o,y:r,platform:i,rects:s,elements:a,strategy:c}=n,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:f=false,padding:u=0}=te(e,n),h=Je(u),g=a[f?p==="floating"?"reference":"floating":p],v=Y(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(g)))==null||t?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:c})),y=p==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},P=Y(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:c}):y);return {top:(v.top-P.top+h.top)/x.y,bottom:(P.bottom-v.bottom+h.bottom)/x.y,left:(v.left-P.left+h.left)/x.x,right:(P.right-v.right+h.right)/x.x}}var cn=50,Et=async(n,e,t)=>{let{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=t,a=s.detectOverflow?s:{...s,detectOverflow:kt},c=await(s.isRTL==null?void 0:s.isRTL(e)),l=await s.getElementRects({reference:n,floating:e,strategy:r}),{x:d,y:p}=Ct(l,o,c),f=o,u=0,h={};for(let m=0;m<i.length;m++){let g=i[m];if(!g)continue;let{name:v,fn:y}=g,{x:w,y:x,data:P,reset:k}=await y({x:d,y:p,initialPlacement:o,placement:f,strategy:r,middlewareData:h,rects:l,platform:a,elements:{reference:n,floating:e}});d=w??d,p=x??p,h[v]={...h[v],...P},k&&u<cn&&(u++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(l=k.rects===true?await s.getElementRects({reference:n,floating:e,strategy:r}):k.rects),{x:d,y:p}=Ct(l,f,c)),m=-1);}return {x:d,y:p,placement:f,strategy:r,middlewareData:h}},St=n=>({name:"arrow",options:n,async fn(e){let{x:t,y:o,placement:r,rects:i,platform:s,elements:a,middlewareData:c}=e,{element:l,padding:d=0}=te(n,e)||{};if(l==null)return {};let p=Je(d),f={x:t,y:o},u=We(r),h=De(u),m=await s.getDimensions(l),g=u==="y",v=g?"top":"left",y=g?"bottom":"right",w=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[u]-f[u]-i.floating[h],P=f[u]-i.reference[u],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l)),B=k?k[w]:0;(!B||!await(s.isElement==null?void 0:s.isElement(k)))&&(B=a.floating[w]||i.floating[h]);let we=x/2-P/2,U=B/2-m[h]/2-1,_=j(p[v],U),be=j(p[y],U),z=_,xe=B-m[h]-be,C=B/2-m[h]/2+we,K=Ne(z,C,xe),N=!c.arrow&&ne(r)!=null&&C!==K&&i.reference[h]/2-(C<z?_:be)-m[h]/2<0,A=N?C<z?C-z:C-xe:0;return {[u]:f[u]+A,data:{[u]:K,centerOffset:C-K-A,...N&&{alignmentOffset:A}},reset:N}}});var Rt=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,o;let{placement:r,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:l}=e,{mainAxis:d=true,crossAxis:p=true,fallbackPlacements:f,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=true,...g}=te(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return {};let v=$(r),y=D(a),w=$(a)===a,x=await(c.isRTL==null?void 0:c.isRTL(l.floating)),P=f||(w||!m?[ke(a)]:bt(a)),k=h!=="none";!f&&k&&P.push(...xt(a,m,h,x));let B=[a,...P],we=await c.detectOverflow(e,g),U=[],_=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&U.push(we[v]),p){let C=wt(r,s,x);U.push(we[C[0]],we[C[1]]);}if(_=[..._,{placement:r,overflows:U}],!U.every(C=>C<=0)){var be,z;let C=(((be=i.flip)==null?void 0:be.index)||0)+1,K=B[C];if(K&&(!(p==="alignment"?y!==D(K):false)||_.every(T=>D(T.placement)===y?T.overflows[0]>0:true)))return {data:{index:C,overflows:_},reset:{placement:K}};let N=(z=_.filter(A=>A.overflows[0]<=0).sort((A,T)=>A.overflows[1]-T.overflows[1])[0])==null?void 0:z.placement;if(!N)switch(u){case "bestFit":{var xe;let A=(xe=_.filter(T=>{if(k){let M=D(T.placement);return M===y||M==="y"}return true}).map(T=>[T.placement,T.overflows.filter(M=>M>0).reduce((M,Jt)=>M+Jt,0)]).sort((T,M)=>T[1]-M[1])[0])==null?void 0:xe[0];A&&(N=A);break}case "initialPlacement":N=a;break}if(r!==N)return {reset:{placement:N}}}return {}}}};var dn=new Set(["left","top"]);async function un(n,e){let{placement:t,platform:o,elements:r}=n,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=$(t),a=ne(t),c=D(t)==="y",l=dn.has(s)?-1:1,d=i&&c?-1:1,p=te(e,n),{mainAxis:f,crossAxis:u,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof h=="number"&&(u=a==="end"?h*-1:h),c?{x:u*d,y:f*l}:{x:f*l,y:u*d}}var It=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,o;let{x:r,y:i,placement:s,middlewareData:a}=e,c=await un(e,n);return s===((t=a.offset)==null?void 0:t.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:s}}}}},Pt=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){let{x:t,y:o,placement:r,platform:i}=e,{mainAxis:s=true,crossAxis:a=false,limiter:c={fn:v=>{let{x:y,y:w}=v;return {x:y,y:w}}},...l}=te(n,e),d={x:t,y:o},p=await i.detectOverflow(e,l),f=D($(r)),u=Qe(f),h=d[u],m=d[f];if(s){let v=u==="y"?"top":"left",y=u==="y"?"bottom":"right",w=h+p[v],x=h-p[y];h=Ne(w,h,x);}if(a){let v=f==="y"?"top":"left",y=f==="y"?"bottom":"right",w=m+p[v],x=m-p[y];m=Ne(w,m,x);}let g=c.fn({...e,[u]:h,[f]:m});return {...g,data:{x:g.x-t,y:g.y-o,enabled:{[u]:s,[f]:a}}}}}};function Fe(){return typeof window<"u"}function Q(n){return Tt(n)?(n.nodeName||"").toLowerCase():"#document"}function E(n){var e;return (n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function G(n){var e;return (e=(Tt(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Tt(n){return Fe()?n instanceof Node||n instanceof E(n).Node:false}function S(n){return Fe()?n instanceof Element||n instanceof E(n).Element:false}function O(n){return Fe()?n instanceof HTMLElement||n instanceof E(n).HTMLElement:false}function At(n){return !Fe()||typeof ShadowRoot>"u"?false:n instanceof ShadowRoot||n instanceof E(n).ShadowRoot}function oe(n){let{overflow:e,overflowX:t,overflowY:o,display:r}=R(n);return /auto|scroll|overlay|hidden|clip/.test(e+o+t)&&r!=="inline"&&r!=="contents"}function Lt(n){return /^(table|td|th)$/.test(Q(n))}function Se(n){try{if(n.matches(":popover-open"))return !0}catch{}try{return n.matches(":modal")}catch{return false}}var pn=/transform|translate|scale|rotate|perspective|filter/,fn=/paint|layout|strict|content/,X=n=>!!n&&n!=="none",Ze;function He(n){let e=S(n)?R(n):n;return X(e.transform)||X(e.translate)||X(e.scale)||X(e.rotate)||X(e.perspective)||!$e()&&(X(e.backdropFilter)||X(e.filter))||pn.test(e.willChange||"")||fn.test(e.contain||"")}function Gt(n){let e=W(n);for(;O(e)&&!J(e);){if(He(e))return e;if(Se(e))return null;e=W(e);}return null}function $e(){return Ze==null&&(Ze=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ze}function J(n){return /^(html|body|#document)$/.test(Q(n))}function R(n){return E(n).getComputedStyle(n)}function Re(n){return S(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function W(n){if(Q(n)==="html")return n;let e=n.assignedSlot||n.parentNode||At(n)&&n.host||G(n);return At(e)?e.host:e}function Ot(n){let e=W(n);return J(e)?n.ownerDocument?n.ownerDocument.body:n.body:O(e)&&oe(e)?e:Ot(e)}function Me(n,e,t){var o;e===void 0&&(e=[]);let r=Ot(n),i=r===((o=n.ownerDocument)==null?void 0:o.body),s=E(r);if(i){Be(s);return e.concat(s,s.visualViewport||[],oe(r)?r:[],[])}else return e.concat(r,Me(r,[]))}function Be(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Wt(n){let e=R(n),t=parseFloat(e.width)||0,o=parseFloat(e.height)||0,r=O(n),i=r?n.offsetWidth:t,s=r?n.offsetHeight:o,a=Ee(t)!==i||Ee(o)!==s;return a&&(t=i,o=s),{width:t,height:o,$:a}}function Mt(n){return S(n)?n:n.contextElement}function re(n){let e=Mt(n);if(!O(e))return L(1);let t=e.getBoundingClientRect(),{width:o,height:r,$:i}=Wt(e),s=(i?Ee(t.width):t.width)/o,a=(i?Ee(t.height):t.height)/r;return (!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var hn=L(0);function Ft(n){let e=E(n);return !$e()||!e.visualViewport?hn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function mn(n,e,t){return e===void 0&&(e=false),!t||e&&t!==E(n)?false:e}function Ie(n,e,t,o){e===void 0&&(e=false),t===void 0&&(t=false);let r=n.getBoundingClientRect(),i=Mt(n),s=L(1);e&&(o?S(o)&&(s=re(o)):s=re(n));let a=mn(i,t,o)?Ft(i):L(0),c=(r.left+a.x)/s.x,l=(r.top+a.y)/s.y,d=r.width/s.x,p=r.height/s.y;if(i){let f=E(i),u=o&&S(o)?E(o):o,h=f,m=Be(h);for(;m&&o&&u!==h;){let g=re(m),v=m.getBoundingClientRect(),y=R(m),w=v.left+(m.clientLeft+parseFloat(y.paddingLeft))*g.x,x=v.top+(m.clientTop+parseFloat(y.paddingTop))*g.y;c*=g.x,l*=g.y,d*=g.x,p*=g.y,c+=w,l+=x,h=E(m),m=Be(h);}}return Y({width:d,height:p,x:c,y:l})}function Ue(n,e){let t=Re(n).scrollLeft;return e?e.left+t:Ie(G(n)).left+t}function Ht(n,e){let t=n.getBoundingClientRect(),o=t.left+e.scrollLeft-Ue(n,t),r=t.top+e.scrollTop;return {x:o,y:r}}function gn(n){let{elements:e,rect:t,offsetParent:o,strategy:r}=n,i=r==="fixed",s=G(o),a=e?Se(e.floating):false;if(o===s||a&&i)return t;let c={scrollLeft:0,scrollTop:0},l=L(1),d=L(0),p=O(o);if((p||!p&&!i)&&((Q(o)!=="body"||oe(s))&&(c=Re(o)),p)){let u=Ie(o);l=re(o),d.x=u.x+o.clientLeft,d.y=u.y+o.clientTop;}let f=s&&!p&&!i?Ht(s,c):L(0);return {width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:t.y*l.y-c.scrollTop*l.y+d.y+f.y}}function vn(n){return Array.from(n.getClientRects())}function yn(n){let e=G(n),t=Re(n),o=n.ownerDocument.body,r=H(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=H(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight),s=-t.scrollLeft+Ue(n),a=-t.scrollTop;return R(o).direction==="rtl"&&(s+=H(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:a}}var _t=25;function wn(n,e){let t=E(n),o=G(n),r=t.visualViewport,i=o.clientWidth,s=o.clientHeight,a=0,c=0;if(r){i=r.width,s=r.height;let d=$e();(!d||d&&e==="fixed")&&(a=r.offsetLeft,c=r.offsetTop);}let l=Ue(o);if(l<=0){let d=o.ownerDocument,p=d.body,f=getComputedStyle(p),u=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,h=Math.abs(o.clientWidth-p.clientWidth-u);h<=_t&&(i-=h);}else l<=_t&&(i+=l);return {width:i,height:s,x:a,y:c}}function bn(n,e){let t=Ie(n,true,e==="fixed"),o=t.top+n.clientTop,r=t.left+n.clientLeft,i=O(n)?re(n):L(1),s=n.clientWidth*i.x,a=n.clientHeight*i.y,c=r*i.x,l=o*i.y;return {width:s,height:a,x:c,y:l}}function Nt(n,e,t){let o;if(e==="viewport")o=wn(n,t);else if(e==="document")o=yn(G(n));else if(S(e))o=bn(e,t);else {let r=Ft(n);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height};}return Y(o)}function $t(n,e){let t=W(n);return t===e||!S(t)||J(t)?false:R(t).position==="fixed"||$t(t,e)}function xn(n,e){let t=e.get(n);if(t)return t;let o=Me(n,[]).filter(a=>S(a)&&Q(a)!=="body"),r=null,i=R(n).position==="fixed",s=i?W(n):n;for(;S(s)&&!J(s);){let a=R(s),c=He(s);!c&&a.position==="fixed"&&(r=null),(i?!c&&!r:!c&&a.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||oe(s)&&!c&&$t(n,s))?o=o.filter(d=>d!==s):r=a,s=W(s);}return e.set(n,o),o}function Cn(n){let{element:e,boundary:t,rootBoundary:o,strategy:r}=n,s=[...t==="clippingAncestors"?Se(e)?[]:xn(e,this._c):[].concat(t),o],a=Nt(e,s[0],r),c=a.top,l=a.right,d=a.bottom,p=a.left;for(let f=1;f<s.length;f++){let u=Nt(e,s[f],r);c=H(u.top,c),l=j(u.right,l),d=j(u.bottom,d),p=H(u.left,p);}return {width:l-p,height:d-c,x:p,y:c}}function kn(n){let{width:e,height:t}=Wt(n);return {width:e,height:t}}function En(n,e,t){let o=O(e),r=G(e),i=t==="fixed",s=Ie(n,true,i,e),a={scrollLeft:0,scrollTop:0},c=L(0);function l(){c.x=Ue(r);}if(o||!o&&!i)if((Q(e)!=="body"||oe(r))&&(a=Re(e)),o){let u=Ie(e,true,i,e);c.x=u.x+e.clientLeft,c.y=u.y+e.clientTop;}else r&&l();i&&!o&&r&&l();let d=r&&!o&&!i?Ht(r,a):L(0),p=s.left+a.scrollLeft-c.x-d.x,f=s.top+a.scrollTop-c.y-d.y;return {x:p,y:f,width:s.width,height:s.height}}function et(n){return R(n).position==="static"}function Dt(n,e){if(!O(n)||R(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return G(n)===t&&(t=t.ownerDocument.body),t}function Bt(n,e){let t=E(n);if(Se(n))return t;if(!O(n)){let r=W(n);for(;r&&!J(r);){if(S(r)&&!et(r))return r;r=W(r);}return t}let o=Dt(n,e);for(;o&&Lt(o)&&et(o);)o=Dt(o,e);return o&&J(o)&&et(o)&&!He(o)?t:o||Gt(n)||t}var Sn=async function(n){let e=this.getOffsetParent||Bt,t=this.getDimensions,o=await t(n.floating);return {reference:En(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Rn(n){return R(n).direction==="rtl"}var In={convertOffsetParentRelativeRectToViewportRelativeRect:gn,getDocumentElement:G,getClippingRect:Cn,getOffsetParent:Bt,getElementRects:Sn,getClientRects:vn,getDimensions:kn,getScale:re,isElement:S,isRTL:Rn};var ie=It;var se=Pt,ae=Rt;var Ut=St;var le=(n,e,t)=>{let o=new Map,r={platform:In,...t},i={...r.platform,_c:o};return Et(n,e,{...r,platform:i})};function I(n,e=5e3){return new Promise(t=>{let o=()=>{try{return document.querySelector(n)}catch{return null}},r=o();if(r){t(r);return}let i=false,s=l=>{i||(i=true,a.disconnect(),clearTimeout(c),t(l));},a=new MutationObserver(()=>{let l=o();l&&s(l);});a.observe(document.body,{childList:true,subtree:true});let c=setTimeout(()=>s(null),e);})}function zt(){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 r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[0]=(t[0]??0)&15|112,t[2]=(t[2]??0)&63|128;let o=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return [e.slice(0,8),e.slice(8,12),o.slice(0,4),o.slice(4,8),o.slice(8,20)].join("-")}function ze(n,e,t,o){let r=n.createElement("iframe");r.className="veo-custom-frame",r.setAttribute("sandbox","allow-scripts"),r.setAttribute("title",t.guide.guideName||"Veo"),r.style.width=o.width;let i=o.fixedHeight!==void 0&&o.fixedHeight!==null;i&&(r.style.height=tt(o.fixedHeight));let s=zt();r.srcdoc=An(e.html??"",e.css??"",e.js??"",s);let a=()=>t.onClose(),c=l=>{if(l.source!==r.contentWindow)return;let d=l.data;if(!(!d||typeof d!="object"||d.__veo!==s))switch(d.type){case "dismiss":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"dismissed"}),a();break;case "cta":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"cta_clicked"}),typeof d.url=="string"&&q(d.url)&&window.open(d.url,"_blank","noopener,noreferrer"),d.close!==false&&a();break;case "navigate":typeof d.url=="string"&&q(d.url)&&window.location.assign(d.url);break;case "track":typeof d.name=="string"&&t.onTrack&&t.onTrack(d.name,Pn(d.props)?d.props:void 0);break;case "resize":!i&&typeof d.height=="number"&&d.height>0&&(r.style.height=`${Math.ceil(d.height)}px`);break}};return window.addEventListener("message",c),{iframe:r,cleanup:()=>window.removeEventListener("message",c)}}function tt(n){return typeof n=="number"?`${n}px`:n}function Pn(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function An(n,e,t,o){let r=`(function(){var T=${JSON.stringify(o)};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(){P({type:'resize',height:Math.ceil(document.documentElement.scrollHeight)});}window.addEventListener('load',H);try{if(typeof ResizeObserver!=='undefined'){new ResizeObserver(H).observe(document.documentElement);}}catch(e){}})();`;return `<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:transparent;}</style><style>${Kt(e,"style")}</style></head><body>${n}<script>${r}</script>`+(t?`<script>${Kt(t,"script")}</script>`:"")+"</body></html>"}function Kt(n,e){let t=e==="script"?/<\/script/gi:/<\/style/gi;return n.replace(t,`<\\/${e}`)}var Tn={mode:"floating",position:"bottom-right"},qt=16,Ln=360,ce=class extends b{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let o=t.placement??Tn,r=null;if(o.mode==="anchored"){let d=o.selector??t.selector??e.guide.activationRules.selector;if(typeof d!="string"||d.length===0||(r=await I(d),!r))return}let{root:i}=this.createHost(),s=i.ownerDocument??document,a=s.createElement("div");a.className=o.mode==="anchored"?"veo-custom-anchored":"veo-custom-floating";let{iframe:c,cleanup:l}=ze(s,t,e,{width:tt(o.width??Ln),fixedHeight:o.height??null});this.registerCleanup(l),a.appendChild(c),i.appendChild(a),o.mode==="floating"?Gn(a,o):r&&this.registerCleanup(await this.setupAnchoredPosition(r,a,o)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}async setupAnchoredPosition(e,t,o){let r=o.side??"bottom",i=async()=>{let{x:a,y:c}=await le(e,t,{placement:r,strategy:"fixed",middleware:[ie(o.offsetY??8),ae(),se({padding:8})]});t.style.left=`${a}px`,t.style.top=`${c}px`;};await i();let s=()=>{i();};return window.addEventListener("scroll",s,true),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s,true),window.removeEventListener("resize",s);}}};function Gn(n,e){let t=e.position??"bottom-right",o=`${e.offsetX??qt}px`,r=`${e.offsetY??qt}px`,i=n.style;if(t==="center"){i.top="50%",i.left="50%",i.transform="translate(-50%, -50%)";return}let[s,a]=t.split("-");s==="top"?i.top=r:i.bottom=r,a==="left"?i.left=o:a==="right"?i.right=o:(i.left="50%",i.transform="translateX(-50%)");}function Ke(n,e,t){let o=e.guide.guideSteps[0];if(!o)return;let r=o.fields??[],i=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();},s=t.createElement("div");if(s.className="veo-guide-content",o.title){let u=t.createElement("h2");u.className="veo-guide-title",u.textContent=o.title,s.appendChild(u);}if(o.content){let u=t.createElement("p");u.className="veo-guide-text",u.textContent=o.content,s.appendChild(u);}let a=[],c=t.createElement("form");c.className="veo-form",c.noValidate=true;for(let u of r){let{wrapper:h,read:m}=_n(u,t);a.push({field:u,read:m}),c.appendChild(h);}let l=t.createElement("p");l.className="veo-form-error",l.style.display="none",c.appendChild(l);let d=t.createElement("div");d.className="veo-guide-actions";let p=t.createElement("button");p.type="submit",p.className="veo-guide-cta",p.textContent=o.ctaText||"Enviar",d.appendChild(p),c.appendChild(d),c.addEventListener("submit",u=>{u.preventDefault(),l.style.display="none";let h={};for(let{field:g,read:v}of a){let y=v();if(y==null||y===""){if(g.required){l.textContent=`Complet\xE1 "${g.label}"`,l.style.display="block";return}continue}h[g.key]=y;}if(Object.keys(h).length===0){l.textContent="Respond\xE9 al menos un campo",l.style.display="block";return}p.disabled=true,(e.onFormSubmit??(()=>Promise.resolve(true)))(h).then(g=>{if(!g){p.disabled=false,l.textContent="No se pudo enviar. Prob\xE1 de nuevo.",l.style.display="block";return}e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"completed"});let v=e.isPreview?e.previewNote??"Vista previa: la respuesta NO se guard\xF3.":null;On(n,t,v),window.setTimeout(()=>e.onClose(),v?2200:1400);});}),s.appendChild(c);let f=t.createElement("button");f.type="button",f.className="veo-guide-close",f.setAttribute("aria-label","Cerrar"),f.textContent="\xD7",f.addEventListener("click",i),s.appendChild(f),n.appendChild(s);}function On(n,e,t){for(;n.firstChild;)n.removeChild(n.firstChild);let o=e.createElement("div");if(o.className="veo-form-thanks",o.textContent="\u2713 \xA1Gracias por tu respuesta!",n.appendChild(o),t){let r=e.createElement("p");r.className="veo-form-preview-note",r.textContent=t,n.appendChild(r);}}function _n(n,e){let t=e.createElement("div");t.className="veo-form-field";let o=e.createElement("label");switch(o.className="veo-form-label",o.textContent=n.required?`${n.label} *`:n.label,t.appendChild(o),n.type){case "textarea":{let r=e.createElement("textarea");return r.className="veo-form-input",r.rows=3,n.placeholder&&(r.placeholder=n.placeholder),t.appendChild(r),{wrapper:t,read:()=>r.value.trim()}}case "number":{let r=e.createElement("input");return r.type="number",r.className="veo-form-input",n.placeholder&&(r.placeholder=n.placeholder),t.appendChild(r),{wrapper:t,read:()=>r.value.trim()===""?void 0:Number(r.value)}}case "select":{let r=e.createElement("select");r.className="veo-form-input";let i=e.createElement("option");i.value="",i.textContent=n.placeholder||"Eleg\xED una opci\xF3n\u2026",r.appendChild(i);for(let s of n.options??[]){let a=e.createElement("option");a.value=s,a.textContent=s,r.appendChild(a);}return t.appendChild(r),{wrapper:t,read:()=>r.value||void 0}}case "radio":{let r=e.createElement("div");r.className="veo-form-options";let i=`veo-${n.key}`,s=[];for(let a of n.options??[]){let c=e.createElement("label");c.className="veo-form-option";let l=e.createElement("input");l.type="radio",l.name=i,l.value=a,s.push(l);let d=e.createElement("span");d.textContent=a,c.appendChild(l),c.appendChild(d),r.appendChild(c);}return t.appendChild(r),{wrapper:t,read:()=>s.find(a=>a.checked)?.value}}case "multiselect":{let r=e.createElement("div");r.className="veo-form-options";let i=[];for(let s of n.options??[]){let a=e.createElement("label");a.className="veo-form-option";let c=e.createElement("input");c.type="checkbox",c.value=s,i.push(c);let l=e.createElement("span");l.textContent=s,a.appendChild(c),a.appendChild(l),r.appendChild(a);}return t.appendChild(r),{wrapper:t,read:()=>{let s=i.filter(a=>a.checked).map(a=>a.value);return s.length>0?s:void 0}}}case "checkbox":{let r=e.createElement("label");r.className="veo-form-option";let i=e.createElement("input");i.type="checkbox";let s=e.createElement("span");return s.textContent=n.placeholder||"S\xED",r.appendChild(i),r.appendChild(s),t.appendChild(r),{wrapper:t,read:()=>i.checked?true:n.required?"":false}}case "yesno":{let r=e.createElement("div");r.className="veo-form-options";let i=`veo-${n.key}`,[s,a]=n.options?.length===2?n.options:["S\xED","No"],c=[];for(let{label:l,value:d}of [{label:s,value:true},{label:a,value:false}]){let p=e.createElement("label");p.className="veo-form-option";let f=e.createElement("input");f.type="radio",f.name=i,c.push({input:f,value:d});let u=e.createElement("span");u.textContent=l,p.appendChild(f),p.appendChild(u),r.appendChild(p);}return t.appendChild(r),{wrapper:t,read:()=>c.find(l=>l.input.checked)?.value}}case "nps":return Vt(t,e,0,10,"veo-nps-btn");case "rating":return Vt(t,e,1,5,"veo-rating-btn","\u2605");default:{let r=e.createElement("input");return r.type="text",r.className="veo-form-input",n.placeholder&&(r.placeholder=n.placeholder),t.appendChild(r),{wrapper:t,read:()=>r.value.trim()}}}}function Vt(n,e,t,o,r,i){let s=e.createElement("div");s.className="veo-form-scale";let a,c=[];for(let l=t;l<=o;l++){let d=e.createElement("button");d.type="button",d.className=r,d.textContent=i??String(l),d.setAttribute("aria-label",String(l)),d.addEventListener("click",()=>{a=l,c.forEach((p,f)=>{let u=i?f+t<=l:f+t===l;p.classList.toggle("veo-scale-active",u);});}),c.push(d),s.appendChild(d);}return n.appendChild(s),{wrapper:n,read:()=>a}}var de=class extends b{render(e){let t=e.guide.guideSteps[0];if(!t||(t.fields??[]).length===0)return;let{root:o}=this.createHost();this.applyDesign(t.style);let r=o.ownerDocument??document,i=r.createElement("div");i.className="veo-modal-overlay";let s=r.createElement("div");s.className="veo-modal-card",Ke(s,e,r),i.appendChild(s),o.appendChild(i);let a=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();};i.addEventListener("click",l=>{l.target===i&&a();});let c=l=>{l.key==="Escape"&&a();};document.addEventListener("keydown",c),this.registerCleanup(()=>document.removeEventListener("keydown",c)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};function ue(n){let e=n?.inlinePosition;return e==="before"||e==="prepend"||e==="append"?e:"after"}function Z(n,e,t){switch(t){case "before":n.before(e);break;case "after":n.after(e);break;case "prepend":n.prepend(e);break;case "append":n.append(e);break}}function pe(n,e,t){let o=window.setInterval(()=>{if(n.isConnected)return;let r=document.querySelector(e);r&&Z(r,n,t);},1e3);return ()=>window.clearInterval(o)}var fe=class extends b{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await I(o);if(!r)return;let{host:i,root:s}=this.createHost();i.style.display="block";let a=ue(t.style);Z(r,i,a),this.registerCleanup(pe(i,o,a));let c=s.ownerDocument??document,l=c.createElement("div");l.className="veo-custom-inline";let{iframe:d,cleanup:p}=ze(c,t,e,{width:"100%"});this.registerCleanup(p),l.appendChild(d),s.appendChild(l),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var he=class extends b{async render(e){let t=e.guide.guideSteps[0];if(!t||(t.fields??[]).length===0)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await I(o);if(!r)return;let{host:i,root:s}=this.createHost();i.style.display="block";let a=ue(t.style);Z(r,i,a),this.registerCleanup(pe(i,o,a)),this.applyDesign(t.style);let c=s.ownerDocument??document,l=c.createElement("div");l.className="veo-inline",Ke(l,e,c),s.appendChild(l),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var me=class extends b{async render(e){let t=e.guide.guideSteps[0];if(!t)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await I(o);if(!r)return;let{host:i,root:s}=this.createHost();i.style.display="block";let a=ue(t.style);Z(r,i,a),this.registerCleanup(pe(i,o,a)),this.applyDesign(t.style);let c=s.ownerDocument??document,l=c.createElement("div");l.className="veo-inline";let d=(f,u)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:f}),u&&window.open(u,"_blank","noopener,noreferrer"),e.onClose();},p=F(t,c,{onCtaClick:(f,u)=>d("cta_clicked",f==="url"?u:void 0),onDismiss:()=>d("dismissed")});l.appendChild(p),s.appendChild(l),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var ge=class extends b{render(e){let t=e.guide.guideSteps[0];if(!t)return;let{root:o}=this.createHost();this.applyDesign(t.style);let r=o.ownerDocument??document,i=r.createElement("div");i.className="veo-modal-overlay";let s=r.createElement("div");s.className="veo-modal-card";let a=(d,p)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:d}),p&&window.open(p,"_blank","noopener,noreferrer"),e.onClose();},c=F(t,r,{onCtaClick:(d,p)=>{a("cta_clicked",d==="url"?p:void 0);},onDismiss:()=>a("dismissed")});s.appendChild(c),i.appendChild(s),o.appendChild(i),i.addEventListener("click",d=>{d.target===i&&a("dismissed");});let l=d=>{d.key==="Escape"&&a("dismissed");};document.addEventListener("keydown",l),this.registerCleanup(()=>document.removeEventListener("keydown",l)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var ve=class extends b{async render(e){let t=e.guide.guideSteps[0];if(!t)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await I(o);if(!r)return;let{root:i}=this.createHost();this.applyDesign(t.style);let s=i.ownerDocument??document,a=s.createElement("div");a.className="veo-tooltip";let c=(f,u)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:f}),u&&window.open(u,"_blank","noopener,noreferrer"),e.onClose();},l=F(t,s,{onCtaClick:(f,u)=>{c("cta_clicked",f==="url"?u:void 0);},onDismiss:()=>c("dismissed")});a.appendChild(l),i.appendChild(a);let d=async()=>{let{x:f,y:u}=await le(r,a,{placement:"bottom",middleware:[ie(8),ae(),se({padding:8})]});a.style.left=`${f}px`,a.style.top=`${u}px`;};await d();let p=()=>{d();};window.addEventListener("scroll",p,true),window.addEventListener("resize",p),this.registerCleanup(()=>{window.removeEventListener("scroll",p,true),window.removeEventListener("resize",p);}),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};function jt(n,e,t,o,r){let i=o.createElement("div");i.className="veo-guide-content";let s=o.createElement("div");s.className="veo-walkthrough-counter",s.textContent=`Paso ${e+1} de ${t}`,i.appendChild(s);let a=o.createElement("div");a.className="veo-walkthrough-progress";for(let h=0;h<t;h++){let m=o.createElement("span");m.className="veo-walkthrough-progress-dot",h<e&&m.classList.add("completed"),h===e&&m.classList.add("active"),a.appendChild(m);}if(i.appendChild(a),typeof n.imageUrl=="string"&&n.imageUrl&&q(n.imageUrl)){let h=o.createElement("img");h.className="veo-guide-image",h.src=n.imageUrl,h.alt=typeof n.title=="string"?n.title:"",i.appendChild(h);}if(typeof n.title=="string"&&n.title){let h=o.createElement("h2");h.className="veo-guide-title",h.textContent=n.title,i.appendChild(h);}if(typeof n.content=="string"&&n.content){let h=o.createElement("p");h.className="veo-guide-text",h.textContent=n.content,i.appendChild(h);}let c=o.createElement("div");c.className="veo-walkthrough-actions";let l=o.createElement("button");l.type="button",l.className="veo-walkthrough-skip",l.textContent="Omitir",l.addEventListener("click",()=>r.onSkip()),c.appendChild(l);let d=o.createElement("div");if(d.className="veo-walkthrough-actions-right",e>0){let h=o.createElement("button");h.type="button",h.className="veo-walkthrough-btn-secondary",h.textContent="Atr\xE1s",h.addEventListener("click",()=>r.onBack()),d.appendChild(h);}let p=e===t-1,f=o.createElement("button");f.type="button",f.className="veo-guide-cta";let u=p?"Finalizar":"Siguiente";return f.textContent=typeof n.ctaText=="string"&&n.ctaText?n.ctaText:u,f.addEventListener("click",()=>{p?r.onComplete():r.onNext();}),d.appendChild(f),c.appendChild(d),i.appendChild(c),i}var ye=class extends b{async render(e){let t=e.guide.guideSteps[e.currentStepIndex];if(!t)return false;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return false;let r=await I(o,5e3);if(!r)return false;let{root:i}=this.createHost();this.applyDesign(t.style);let s=i.ownerDocument??document,a=s.createElement("div");a.className="veo-walkthrough";let c=jt(t,e.currentStepIndex,e.guide.guideSteps.length,s,e.callbacks);a.appendChild(c);let l=s.createElement("div");l.className="veo-walkthrough-arrow",a.appendChild(l),i.appendChild(a);let d=async()=>{let{x:f,y:u,placement:h,middlewareData:m}=await le(r,a,{placement:"bottom",middleware:[ie(10),ae(),se({padding:8}),Ut({element:l})]});a.style.left=`${f}px`,a.style.top=`${u}px`,Dn(l,h,m.arrow);};await d();let p=()=>{d();};return window.addEventListener("scroll",p,true),window.addEventListener("resize",p),this.registerCleanup(()=>{window.removeEventListener("scroll",p,true),window.removeEventListener("resize",p);}),true}},Nn={top:"bottom",bottom:"top",left:"right",right:"left"};function Dn(n,e,t){let o=Nn[e.split("-")[0]??"bottom"]??"top";for(let r of ["top","bottom","left","right"])n.style.setProperty(r,"");t?.x!=null&&n.style.setProperty("left",`${t.x}px`),t?.y!=null&&n.style.setProperty("top",`${t.y}px`),n.style.setProperty(o,"-6px");}var qe=class{constructor(e){this.state=null;this.storageKey=`${at}${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 o=Date.now();return this.state={guideId:e,totalSteps:t,currentStepIndex:0,startedAt:o,lastProgressAt:o},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 o=t;return typeof o.guideId!="string"||typeof o.totalSteps!="number"||typeof o.currentStepIndex!="number"||typeof o.startedAt!="number"||typeof o.lastProgressAt!="number"?null:o}catch{return null}}persist(){if(!(typeof localStorage>"u"||!this.state))try{localStorage.setItem(this.storageKey,JSON.stringify(this.state));}catch{}}};var Mn={shown:"shown",dismissed:"dismissed",cta_clicked:null,step_advanced:null,step_back:null,completed:"completed"},Ve=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;if(this.debug=t.debug===true,this.apiUrl=t.apiUrl,this.apiKey=t.apiKey,this.resolver=t.resolver??new Le(t.apiUrl,t.apiKey,this.debug),t.trackerQueue)this.trackerQueue=t.trackerQueue;else {let r=new Ge(t.apiUrl,t.apiKey);this.trackerQueue=new Oe({client:r,flushIntervalMs:3e3,batchSize:5,maxRetries:3,onError:(i,s)=>{this.debug&&console.warn(`[veo] dropped guide interaction after retries: guideId=${s.guideId} action=${s.payload.action}`,i);}});}let o=dt(t.apiKey);this.frequencyCache=t.frequencyCache??new Te(o),this.walkthroughState=t.walkthroughState??new qe(o);}get pendingInteractions(){return this.trackerQueue.size}clearFrequencyCache(){this.frequencyCache.clear();}clearWalkthroughState(){this.tearDownWalkthrough();}async checkGuides(e,t){let o=this.client.getEndUserId();if(!o){this.debug&&console.log("[veo] guides: skipped, no endUserId yet");return}if(await this.tryResumeWalkthrough(o,t,e))return;let r;try{r=await this.resolver.resolve(o,e);}catch(i){this.debug&&console.error("[veo] guides resolver threw:",i);return}this.debug&&console.log(`[veo] guides: ${r.length} eligible at ${e}`);for(let i of r){if(this.frequencyCache.shouldFilter(i.guideId,i.displayFrequency)){this.debug&&console.log(`[veo] guides: filtered locally guideId=${i.guideId}`);continue}if(this.activeByGuideId.has(i.guideId)){this.debug&&console.log(`[veo] guides: already shown guideId=${i.guideId}`);continue}if(i.guideType==="walkthrough"&&i.guideSteps.length>1){if(this.walkthroughState.hasActive()){this.debug&&console.log(`[veo] guides: walkthrough ${i.guideId} skipped (another active)`);continue}await this.startWalkthrough(i,o,t,e);continue}this.runSingleStepRender(i,t,e);}}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.dispatched.clear(),this.trackerQueue.destroy();}runSingleStepRender(e,t,o){let r=this.createSingleStepRenderer(e.guideType);if(!r)return;this.activeByGuideId.set(e.guideId,r);let i=e.activationRules.delayMs??0;window.setTimeout(()=>this.mountSingleStepRenderer(e,r,t,o),i);}mountSingleStepRenderer(e,t,o,r){this.activeRenderers.add(t),this.activeByGuideId.set(e.guideId,t);let i=()=>{t.destroy(),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);},s=l=>{this.handleInteraction(e,o,r,l);},a=(l,d)=>{this.client.track(l,d);},c=l=>this.submitFormResponse(e.guideId,l);try{t.render({guide:e,onInteraction:s,onClose:i,onTrack:a,onFormSubmit:c});}catch(l){this.debug&&console.error("[veo] renderer.render threw:",l),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);}}async tryResumeWalkthrough(e,t,o){let r=this.walkthroughState.current();if(!r)return false;let i=await this.resolver.fetchById(r.guideId);if(!i||i.guideType!=="walkthrough")return this.debug&&console.log(`[veo] guides: walkthrough ${r.guideId} no longer available, cleaning up`),this.tearDownWalkthrough(),true;let s=Math.min(r.currentStepIndex,i.guideSteps.length-1);return await this.renderWalkthroughStep(i,s,e,t,o),true}async startWalkthrough(e,t,o,r){this.walkthroughState.start(e.guideId,e.guideSteps.length),await this.renderWalkthroughStep(e,0,t,o,r)&&(this.enqueueInteractionOnce(e.guideId,t,o,r,"shown",0),this.frequencyCache.record(e.guideId,"shown"));}async renderWalkthroughStep(e,t,o,r,i){this.activeWalkthroughRenderer&&(this.activeWalkthroughRenderer.destroy(),this.activeWalkthroughRenderer=null);let s=new ye;this.activeWalkthroughGuide=e;let a={onNext:()=>this.handleWalkthroughNext(o,r,i),onBack:()=>this.handleWalkthroughBack(o,r,i),onSkip:()=>this.handleWalkthroughSkip(o,r,i),onComplete:()=>this.handleWalkthroughComplete(o,r,i)},c=false;try{c=await s.render({guide:e,currentStepIndex:t,callbacks:a});}catch(l){this.debug&&console.error("[veo] walkthrough renderer threw:",l);}return c?(this.activeWalkthroughRenderer=s,true):(this.debug&&console.warn(`[veo] walkthrough ${e.guideId} step ${t} could not render, cancelling`),this.tearDownWalkthrough(),false)}handleWalkthroughNext(e,t,o){let r=this.activeWalkthroughGuide;if(!r)return;let i=this.walkthroughState.advance();if(!i){this.handleWalkthroughComplete(e,t,o);return}this.enqueueInteraction(r.guideId,e,t,o,"step_advanced",i.currentStepIndex),this.renderWalkthroughStep(r,i.currentStepIndex,e,t,o);}handleWalkthroughBack(e,t,o){let r=this.activeWalkthroughGuide;if(!r)return;let i=this.walkthroughState.current();if(!i||i.currentStepIndex===0)return;let s=this.walkthroughState.back();s&&(this.enqueueInteraction(r.guideId,e,t,o,"step_back",s.currentStepIndex),this.renderWalkthroughStep(r,s.currentStepIndex,e,t,o));}handleWalkthroughSkip(e,t,o){let r=this.activeWalkthroughGuide,i=this.walkthroughState.current();!r||!i||(this.enqueueInteraction(r.guideId,e,t,o,"dismissed",i.currentStepIndex),this.frequencyCache.record(r.guideId,"dismissed"),this.tearDownWalkthrough());}handleWalkthroughComplete(e,t,o){let r=this.activeWalkthroughGuide,i=this.walkthroughState.current();!r||!i||(this.enqueueInteraction(r.guideId,e,t,o,"completed",i.currentStepIndex),this.frequencyCache.record(r.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,o,r){let i=`${e.guideId}:${r.action}`;if(this.dispatched.has(i)){this.debug&&console.log(`[veo] guides: dedup hit ${i}`);return}this.dispatched.add(i);let s=Mn[r.action];s&&this.frequencyCache.record(e.guideId,s);let a=this.client.getEndUserId();if(!a){this.debug&&console.warn("[veo] guides: interaction without endUserId \u2014 skipping enqueue");return}this.trackerQueue.enqueue({guideId:e.guideId,payload:{endUserId:a,sessionId:t,action:r.action,stepIndex:r.stepIndex,pageUrl:o,pagePath:Yt(o)}});}enqueueInteraction(e,t,o,r,i,s){this.trackerQueue.enqueue({guideId:e,payload:{endUserId:t,sessionId:o,action:i,stepIndex:s,pageUrl:r,pagePath:Yt(r)}});}enqueueInteractionOnce(e,t,o,r,i,s){let a=`${e}:${i}:${s}`;this.dispatched.has(a)||(this.dispatched.add(a),this.enqueueInteraction(e,t,o,r,i,s));}createSingleStepRenderer(e){switch(e){case "modal":return new ge;case "banner":return new ee;case "tooltip":return new ve;case "custom":return new ce;case "inline":return new me;case "inline-custom":return new fe;case "form":return new de;case "inline-form":return new he;case "walkthrough":return null}}async submitFormResponse(e,t){let o=this.client.getEndUserId()??this.client.getAnonymousId();try{let r=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:o,answers:t})});return !r.ok&&this.debug&&console.warn("[veo] form-response respondi\xF3",r.status),r.ok}catch(r){return this.debug&&console.warn("[veo] form-response fall\xF3:",r),false}}};function Yt(n){try{return new URL(n).pathname}catch{return "/"}}var Fn="__veo_preview__",nt=class{constructor(){this.singleStep=null;this.walkthrough=null;this.walkthroughGuide=null;this.walkthroughIndex=0;this.input=null;}preview(e){this.close(),this.input=e;let t=Hn(e),o=typeof e.startStepIndex=="number"?e.startStepIndex:0,r=t.guideType==="walkthrough"?this.startWalkthrough(t,o):this.renderSingleStep(t);return {close:()=>this.close(),ready:r}}close(){this.singleStep&&(Pe(this.singleStep),this.singleStep=null),this.walkthrough&&(Pe(this.walkthrough),this.walkthrough=null),this.walkthroughGuide=null,this.walkthroughIndex=0,this.input=null;}async renderSingleStep(e){let t=$n(e.guideType);if(!t)return {rendered:false};this.singleStep=t;let o=false;try{await t.render({guide:e,onInteraction:r=>{r.action==="shown"&&(o=!0);},onClose:()=>this.close(),onTrack:()=>{},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?(Pe(t),{rendered:false}):{rendered:o}}async startWalkthrough(e,t=0){if(e.guideSteps.length===0)return {rendered:false};this.walkthroughGuide=e;let o=Math.min(Math.max(0,Math.floor(t)),e.guideSteps.length-1);return this.walkthroughIndex=o,{rendered:await this.renderWalkthroughStep(o)}}async renderWalkthroughStep(e){let t=this.walkthroughGuide;if(!t)return false;this.walkthrough&&(Pe(this.walkthrough),this.walkthrough=null);let o=new ye,r={onNext:()=>{let s=this.walkthroughIndex+1;if(s>=t.guideSteps.length){this.close();return}this.walkthroughIndex=s,this.renderWalkthroughStep(s);},onBack:()=>{let s=this.walkthroughIndex-1;s<0||(this.walkthroughIndex=s,this.renderWalkthroughStep(s));},onSkip:()=>this.close(),onComplete:()=>this.close()},i=false;try{i=await o.render({guide:t,currentStepIndex:e,callbacks:r});}catch{i=false;}return !i||this.walkthroughGuide!==t?(Pe(o),false):(this.walkthrough=o,true)}},je=null;function Ye(n){return Ae()?(je||(je=new nt),je.preview(n)):{close:()=>{},ready:Promise.resolve({rendered:false})}}function Xt(){je?.close();}function Hn(n){let e=n.activationRules?.selector,t={url:n.activationRules?.url??{type:"prefix",pattern:"/"},trigger:"immediate",...e!==void 0?{selector:e}:{}};return {guideId:Fn,guideName:n.guideName??"Preview",guideType:n.guideType,guideSteps:n.guideSteps,activationRules:t,displayFrequency:"always",displayPriority:0}}function $n(n){switch(n){case "modal":return new ge;case "banner":return new ee;case "tooltip":return new ve;case "custom":return new ce;case "inline":return new me;case "inline-custom":return new fe;case "form":return new de;case "inline-form":return new he;case "walkthrough":return null}}function Pe(n){try{n.destroy();}catch{}}var Xe=null;async function Qt(n){if(!Ae())return null;Xe?.teardown();let e=null;try{let a=await fetch(`${n.apiUrl}/v1/guides/preview-resolve`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":n.apiKey},body:JSON.stringify({token:n.token})});a.ok?e=(await a.json()).guide??null:n.debug&&console.warn("[veo] preview-resolve respondi\xF3",a.status);}catch(a){n.debug&&console.warn("[veo] preview-resolve fall\xF3:",a);}let t=async a=>{if(!e)return false;let c=window.veo,l=c?.getEndUserId?.()??c?.getAnonymousId?.()??null;if(!l)return false;try{return (await fetch(`${n.apiUrl}/v1/guides/${e.guideId}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":n.apiKey},body:JSON.stringify({endUserId:l,answers:a})})).ok}catch{return false}},o=null,r=()=>{e&&(o?.close(),o=Ye({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."}));},i=Bn({label:e?`Vista previa: ${e.guideName}`:"Link de preview inv\xE1lido o vencido",error:!e,onReshow:e?r:null,onClose:()=>s.teardown()}),s={teardown(){o?.close(),o=null,i.remove(),Xe===s&&(Xe=null);}};return Xe=s,r(),s}function Bn(n){let e=document.createElement("div");e.setAttribute("data-veo-preview-chip","");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=`
|
|
249
|
+
.chip { position: fixed; bottom: 16px; right: 16px; z-index: 2147483647;
|
|
250
|
+
display: flex; align-items: center; gap: 8px; padding: 8px 12px;
|
|
251
|
+
background: #111827; color: #f9fafb; border-radius: 9999px;
|
|
252
|
+
font: 500 12px/1.2 system-ui, sans-serif; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
|
|
253
|
+
.chip.error { background: #7f1d1d; }
|
|
254
|
+
.label { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
255
|
+
button { all: unset; cursor: pointer; padding: 2px 6px; border-radius: 9999px;
|
|
256
|
+
font-size: 12px; line-height: 1; }
|
|
257
|
+
button:hover { background: rgba(255,255,255,.15); }
|
|
258
|
+
`,t.appendChild(o);let r=document.createElement("div");r.className=n.error?"chip error":"chip";let i=document.createElement("span");if(i.className="label",i.textContent=n.label,r.appendChild(i),n.onReshow){let a=document.createElement("button");a.textContent="\u21BB",a.title="Volver a mostrar la gu\xEDa",a.addEventListener("click",n.onReshow),r.appendChild(a);}let s=document.createElement("button");return s.textContent="\u2715",s.title="Salir de la vista previa",s.addEventListener("click",n.onClose),r.appendChild(s),t.appendChild(r),document.body.appendChild(e),{remove:()=>e.remove()}}function Un(n){return {name:"guides",install(e){if(!ot())return;let t=new Ve(e,n);window.__veoGuides={controller:t},e.on("identify",({sessionId:o})=>{t.checkGuides(window.location.href,o);}),e.on("pageview",({url:o,sessionId:r})=>{t.checkGuides(o,r);}),t.checkGuides(window.location.href,e.getSessionId());}}}exports.closeGuidePreview=Xt;exports.guidesPlugin=Un;exports.previewGuide=Ye;exports.runPreviewMode=Qt;return exports;})({});//# sourceMappingURL=veo-guides.js.map
|
|
259
|
+
//# sourceMappingURL=veo-guides.js.map
|