veo-sdk 0.3.16 → 0.4.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/dist/builder-ZDNVF6KG.mjs +5 -0
- package/dist/{builder-EQYOMQFY.mjs.map → builder-ZDNVF6KG.mjs.map} +1 -1
- package/dist/builder.cjs +1008 -215
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.d.cts +38 -2
- package/dist/builder.d.ts +38 -2
- package/dist/builder.mjs +4 -4
- package/dist/{chunk-QCIT7CGE.mjs → chunk-I55Z7UGJ.mjs} +269 -5
- package/dist/chunk-I55Z7UGJ.mjs.map +1 -0
- package/dist/{chunk-YHUPUTWH.mjs → chunk-ICKEQ7VC.mjs} +713 -184
- package/dist/chunk-ICKEQ7VC.mjs.map +1 -0
- package/dist/{chunk-IEHGG5NL.mjs → chunk-MA2BXLZ7.mjs} +67 -11
- package/dist/chunk-MA2BXLZ7.mjs.map +1 -0
- package/dist/{guide-preview-DewCTa-B.d.cts → guide-preview-D_xhRVLe.d.cts} +20 -2
- package/dist/{guide-preview-DewCTa-B.d.ts → guide-preview-D_xhRVLe.d.ts} +20 -2
- package/dist/index.cjs +1097 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +7 -6
- package/dist/index.mjs.map +1 -1
- package/dist/veo-builder.js +125 -9
- package/dist/veo-builder.js.map +1 -1
- package/dist/veo-guides.js +86 -4
- package/dist/veo-guides.js.map +1 -1
- package/dist/veo.js +1 -1
- package/dist/veo.js.map +1 -1
- package/package.json +1 -1
- package/dist/builder-EQYOMQFY.mjs +0 -5
- package/dist/chunk-IEHGG5NL.mjs.map +0 -1
- package/dist/chunk-QCIT7CGE.mjs.map +0 -1
- package/dist/chunk-YHUPUTWH.mjs.map +0 -1
package/dist/veo-guides.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var veoGuides=(function(exports){'use strict';function ft(){return typeof window<"u"}function _e(){return typeof document<"u"}var ht=["http:","https:"],mt="data-veo-guide",gt="veo:freq:";var vt="veo:walkthrough_state:";var wt={shown:1,dismissed:2,completed:2};function bt(n){return n.slice(-16)||"default"}var Ne=class{constructor(e){this.storageKey=`${gt}${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&&wt[t]<wt[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,i]of this.cache)e-i.lastInteractionAt>7776e6&&(this.cache.delete(o),t=true);if(this.cache.size>500){let o=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=o[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 o=[];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;o.push([r.guideId,r]);}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 Oe=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}),i;try{i=await fetch(`${this.apiUrl}/v1/guides/resolve?${o.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(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 xt(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 De=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(xt(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(xt(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 Fe=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 i=t[o],r=e[o];!i||!r||i.status!=="fulfilled"&&(r.attempts+=1,r.attempts<this.config.maxRetries?this.buffer.push(r):this.safeOnError(i.reason,r));}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 R(n,e,t){let o=e.createElement("div");o.className="veo-guide-content";let i=cn(n);return i?dn(o,i,e,t):ln(o,n,e,t),o.appendChild(Re(e,()=>t.onDismiss())),o}function ln(n,e,t,o){if(typeof e.imageUrl=="string"&&e.imageUrl&&N(e.imageUrl)){let r=t.createElement("img");r.className="veo-guide-image",r.src=e.imageUrl,r.alt=typeof e.title=="string"?e.title:"",n.appendChild(r);}if(typeof e.title=="string"&&e.title){let r=t.createElement("h2");r.className="veo-guide-title",r.textContent=e.title,n.appendChild(r);}if(typeof e.content=="string"&&e.content){let r=t.createElement("p");r.className="veo-guide-text",r.textContent=e.content,n.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=fn(e);o.onCtaClick(s,a);}),i.appendChild(r);}n.appendChild(i);}function cn(n){if(!Array.isArray(n.blocks)||n.blocks.length===0)return null;let e=n.blocks.filter(t=>!t||typeof t!="object"?false:t.type==="image"?typeof t.url=="string"&&N(t.url):t.type==="title"||t.type==="text"||t.type==="button");return e.length>0?e:null}function dn(n,e,t,o){let i=0;for(;i<e.length;){let r=e[i];if(r?.type==="button"){let a=t.createElement("div");a.className="veo-guide-actions";let l;for(;i<e.length&&e[i]?.type==="button";){let c=e[i];if(!l){let u=c.style?.align;(u==="left"||u==="center"||u==="right")&&(l=u);}a.appendChild(pn(c,t,o)),i++;}l&&(a.style.justifyContent=Ct[l]),n.appendChild(a);continue}let s=un(r,t);s&&n.appendChild(s),i++;}}function un(n,e){switch(n.type){case "title":{let t=e.createElement("h2");return t.className="veo-guide-title",t.textContent=typeof n.text=="string"?n.text:"",Me(t,n.style,"text"),t}case "text":{let t=e.createElement("p");return t.className="veo-guide-text",t.textContent=typeof n.text=="string"?n.text:"",Me(t,n.style,"text"),t}case "image":{if(typeof n.url!="string"||!N(n.url))return null;let t=e.createElement("img");return t.className="veo-guide-image",t.src=n.url,t.alt="",Me(t,n.style,"image"),t}default:return null}}function pn(n,e,t){let o=e.createElement("button");return o.type="button",o.className="veo-guide-cta",o.textContent=typeof n.text=="string"&&n.text?n.text:"OK",Me(o,n.style,"button"),o.addEventListener("click",()=>{let i=n.action??"dismiss",r=i==="url"&&typeof n.url=="string"&&N(n.url)?n.url:void 0;t.onCtaClick(i,r);}),o}var Ct={left:"flex-start",center:"center",right:"flex-end"};function Ee(n,e,t){return Math.min(t,Math.max(e,n))}function Me(n,e,t){if(!e||typeof e!="object")return;let o=e,i=typeof o.align=="string"?o.align:null;i&&(i==="left"||i==="center"||i==="right")&&(t==="text"?n.style.textAlign=i:t==="image"&&(n.style.alignSelf=Ct[i])),t!=="image"&&typeof o.color=="string"&&(n.style.color=o.color),t==="text"&&typeof o.fontSize=="number"&&Number.isFinite(o.fontSize)&&(n.style.fontSize=`${Ee(o.fontSize,8,72)}px`),t==="image"&&typeof o.width=="number"&&Number.isFinite(o.width)&&(n.style.width=`${Ee(o.width,10,100)}%`),t==="image"&&typeof o.radius=="number"&&Number.isFinite(o.radius)&&(n.style.borderRadius=`${Ee(o.radius,0,48)}px`),typeof o.marginTop=="number"&&Number.isFinite(o.marginTop)&&(n.style.marginTop=`${Ee(o.marginTop,0,64)}px`),typeof o.marginBottom=="number"&&Number.isFinite(o.marginBottom)&&(n.style.marginBottom=`${Ee(o.marginBottom,0,64)}px`);}function Re(n,e,t="veo-guide-close"){let o=n.createElement("button");return o.type="button",o.className=t,o.setAttribute("aria-label","Cerrar"),o.textContent="\xD7",o.addEventListener("click",e),o}function N(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 ht.includes(t.protocol)}catch{return false}}function fn(n){let e=n.style?.ctaUrl;if(typeof e=="string")return N(e)?e:void 0}function re(n,e,t,o,i){let r=o.createElement("div");r.className="veo-guide-content";let s=o.createElement("div");s.className="veo-walkthrough-counter",s.textContent=`Paso ${e+1} de ${t}`,r.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(r.appendChild(a),typeof n.imageUrl=="string"&&n.imageUrl&&N(n.imageUrl)){let h=o.createElement("img");h.className="veo-guide-image",h.src=n.imageUrl,h.alt=typeof n.title=="string"?n.title:"",r.appendChild(h);}if(typeof n.title=="string"&&n.title){let h=o.createElement("h2");h.className="veo-guide-title",h.textContent=n.title,r.appendChild(h);}if(typeof n.content=="string"&&n.content){let h=o.createElement("p");h.className="veo-guide-text",h.textContent=n.content,r.appendChild(h);}let l=o.createElement("div");l.className="veo-walkthrough-actions";let c=o.createElement("button");c.type="button",c.className="veo-walkthrough-skip",c.textContent="Omitir",c.addEventListener("click",()=>i.onSkip()),l.appendChild(c);let u=o.createElement("div");if(u.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",()=>i.onBack()),u.appendChild(h);}let d=e===t-1,p=o.createElement("button");p.type="button",p.className="veo-guide-cta";let f=d?"Finalizar":"Siguiente";return p.textContent=typeof n.ctaText=="string"&&n.ctaText?n.ctaText:f,p.addEventListener("click",()=>{d?i.onComplete():i.onNext();}),u.appendChild(p),l.appendChild(u),r.appendChild(l),r.appendChild(Re(o,()=>i.onSkip())),r}var hn={"--veo-bg":"#1f2937","--veo-text":"#f9fafb","--veo-text-secondary":"#d1d5db","--veo-shadow":"0 20px 60px rgba(0, 0, 0, 0.55)"},rt={left:"flex-start",center:"center",right:"flex-end"},mn={left:"flex-start",center:"center",right:"flex-end"},gn={title:"text",text:"text",image:"self"},kt={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)"},St={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]},$=/^#[0-9a-f]{3,8}$|^(rgb|rgba|hsl|hsla)\([\d.,%/\sdeg]+\)$|^[a-z]{3,20}$/i;function S(n,e,t){return Math.min(t,Math.max(e,n))}function Et(n,e){if(!e||typeof e!="object")return;let t=e;if(typeof t.accentColor=="string"&&$.test(t.accentColor.trim())&&n.style.setProperty("--veo-primary",t.accentColor.trim()),typeof t.fontFamily=="string"&&t.fontFamily.length<=200&&!/[<>{}]/.test(t.fontFamily)&&n.style.setProperty("--veo-font",t.fontFamily.trim()),t.theme==="dark")for(let[r,s]of Object.entries(hn))n.style.setProperty(r,s);typeof t.background=="string"&&$.test(t.background.trim())&&n.style.setProperty("--veo-bg",t.background.trim()),typeof t.textColor=="string"&&$.test(t.textColor.trim())&&n.style.setProperty("--veo-text",t.textColor.trim()),typeof t.textSecondaryColor=="string"&&$.test(t.textSecondaryColor.trim())&&n.style.setProperty("--veo-text-secondary",t.textSecondaryColor.trim()),typeof t.radius=="number"&&Number.isFinite(t.radius)&&n.style.setProperty("--veo-radius",`${S(t.radius,0,48)}px`),typeof t.width=="number"&&Number.isFinite(t.width)&&n.style.setProperty("--veo-width",`${S(t.width,220,720)}px`),(t.align==="left"||t.align==="center"||t.align==="right")&&n.style.setProperty("--veo-actions-justify",rt[t.align]),typeof t.padding=="number"&&Number.isFinite(t.padding)&&n.style.setProperty("--veo-pad",`${S(t.padding,0,64)}px`),typeof t.margin=="number"&&Number.isFinite(t.margin)&&n.style.setProperty("--veo-margin",`${S(t.margin,0,64)}px`),typeof t.borderWidth=="number"&&Number.isFinite(t.borderWidth)&&n.style.setProperty("--veo-border-width",`${S(t.borderWidth,0,16)}px`),typeof t.borderColor=="string"&&$.test(t.borderColor.trim())&&n.style.setProperty("--veo-border-color",t.borderColor.trim()),typeof t.shadow=="string"&&kt[t.shadow]&&n.style.setProperty("--veo-shadow",kt[t.shadow]);let o,i;if(typeof t.posX=="number"&&typeof t.posY=="number"?(o=S(t.posX,0,1),i=S(t.posY,0,1)):typeof t.overlayPosition=="string"&&St[t.overlayPosition]&&([o,i]=St[t.overlayPosition]),o!==void 0&&i!==void 0&&(n.style.setProperty("--veo-pos-x",`${o*100}%`),n.style.setProperty("--veo-pos-y",`${i*100}%`)),t.elements&&typeof t.elements=="object"){let r=t.elements;it(n,"title",r.title),it(n,"text",r.text),it(n,"image",r.image),vn(n,r.cta);}}function vn(n,e){if(!e||typeof e!="object")return;let t=e;typeof t.align=="string"&&rt[t.align]&&n.style.setProperty("--veo-actions-justify",rt[t.align]),typeof t.background=="string"&&$.test(t.background.trim())&&n.style.setProperty("--veo-cta-bg",t.background.trim()),typeof t.color=="string"&&$.test(t.color.trim())&&n.style.setProperty("--veo-cta-color",t.color.trim()),typeof t.fontSize=="number"&&Number.isFinite(t.fontSize)&&n.style.setProperty("--veo-cta-size",`${S(t.fontSize,10,24)}px`),typeof t.radius=="number"&&Number.isFinite(t.radius)&&n.style.setProperty("--veo-cta-radius",`${S(t.radius,0,48)}px`);}function it(n,e,t){if(!t||typeof t!="object")return;let o=t;if(typeof o.align=="string"&&(o.align==="left"||o.align==="center"||o.align==="right")){let r=(gn[e]??"text")==="self"?mn[o.align]:o.align;n.style.setProperty(`--veo-${e}-align`,r);}typeof o.color=="string"&&$.test(o.color.trim())&&n.style.setProperty(`--veo-${e}-color`,o.color.trim()),typeof o.fontSize=="number"&&Number.isFinite(o.fontSize)&&n.style.setProperty(`--veo-${e}-size`,`${S(o.fontSize,8,72)}px`),typeof o.width=="number"&&Number.isFinite(o.width)&&n.style.setProperty(`--veo-${e}-width`,`${S(o.width,10,100)}%`),typeof o.radius=="number"&&Number.isFinite(o.radius)&&n.style.setProperty(`--veo-${e}-radius`,`${S(o.radius,0,48)}px`),typeof o.marginTop=="number"&&Number.isFinite(o.marginTop)&&n.style.setProperty(`--veo-${e}-mt`,`${S(o.marginTop,0,64)}px`),typeof o.marginBottom=="number"&&Number.isFinite(o.marginBottom)&&n.style.setProperty(`--veo-${e}-mb`,`${S(o.marginBottom,0,64)}px`);}var Rt=`
|
|
1
|
+
var veoGuides=(function(exports){'use strict';function gt(){return typeof window<"u"}function De(){return typeof document<"u"}var vt=["http:","https:"],yt="data-veo-guide",wt="veo:freq:";var bt="veo:walkthrough_state:";var Ct={shown:1,dismissed:2,completed:2};function kt(n){return n.slice(-16)||"default"}var Be=class{constructor(t){this.storageKey=`${wt}${t}`,this.cache=this.load(),this.prune();}shouldFilter(t,e){if(e==="every_visit"||e==="always")return false;let o=this.cache.get(t);return o?e==="once"?true:e==="until_dismissed"?o.status==="dismissed"||o.status==="completed":e==="until_answered"?o.status==="completed":false:false}record(t,e){let o=this.cache.get(t);o&&Ct[e]<Ct[o.status]||(this.cache.set(t,{guideId:t,status:e,lastInteractionAt:Date.now()}),this.persist());}clear(){this.cache.clear(),this.persist();}snapshot(){return Array.from(this.cache.values())}prune(){let t=Date.now(),e=false;for(let[o,i]of this.cache)t-i.lastInteractionAt>7776e6&&(this.cache.delete(o),e=true);if(this.cache.size>500){let o=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=o[r];s&&this.cache.delete(s[0]);}e=true;}e&&this.persist();}load(){if(typeof localStorage>"u")return new Map;try{let t=localStorage.getItem(this.storageKey);if(!t)return new Map;let e=JSON.parse(t);if(!Array.isArray(e))return new Map;let o=[];for(let i of e)if(i&&typeof i=="object"&&typeof i.guideId=="string"&&typeof i.lastInteractionAt=="number"&&["shown","dismissed","completed"].includes(i.status)){let r=i;o.push([r.guideId,r]);}return new Map(o)}catch{return new Map}}persist(){if(!(typeof localStorage>"u"))try{let t=JSON.stringify(Array.from(this.cache.values()));localStorage.setItem(this.storageKey,t);}catch{}}};var Fe=class{constructor(t,e,o=false){this.apiUrl=t;this.apiKey=e;this.debug=o;}async resolve(t,e){let o=new URLSearchParams({endUserId:t,pageUrl:e}),i;try{i=await fetch(`${this.apiUrl}/v1/guides/resolve?${o.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(t){let e;try{e=await fetch(`${this.apiUrl}/v1/guides/${encodeURIComponent(t)}`,{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(!e.ok)return this.debug&&console.warn("[veo] guides fetchById HTTP",e.status),null;try{let o=await e.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 Et(n){let t={endUserId:n.endUserId,interactionType:n.action};return n.sessionId&&(t.sessionId=n.sessionId),typeof n.stepIndex=="number"&&(t.stepPosition=n.stepIndex),n.pageUrl&&(t.pageUrl=n.pageUrl),n.pagePath&&(t.pagePath=n.pagePath),n.metadata&&(t.metadata=n.metadata),t}var He=class{constructor(t,e){this.apiUrl=t;this.apiKey=e;}async send(t){let e=this.buildUrl(t.guideId),o=await fetch(e,{method:"POST",headers:{"X-Api-Key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(Et(t.payload)),credentials:"omit"});if(!o.ok)throw new Error(`guide interaction send failed: HTTP ${o.status}`)}sendBeacon(t){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function")return false;let e=`${this.buildUrl(t.guideId)}?key=${encodeURIComponent(this.apiKey)}`,o=new Blob([JSON.stringify(Et(t.payload))],{type:"application/json"});try{return navigator.sendBeacon(e,o)}catch{return false}}buildUrl(t){return `${this.apiUrl}/v1/guides/${encodeURIComponent(t)}/interactions`}};var $e=class{constructor(t){this.config=t;this.buffer=[];this.timer=null;this.flushing=false;this.unloadCleanup=null;this.startTimer(),this.installUnloadHandler();}get size(){return this.buffer.length}enqueue(t){this.buffer.push({guideId:t.guideId,payload:t.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 t=Date.now(),e=this.buffer.filter(r=>(r.nextRetryAt??0)<=t);if(e.length===0)return;this.flushing=true;let o=new Set(e);this.buffer=this.buffer.filter(r=>!o.has(r));let i=await Promise.allSettled(e.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=e[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(t){let e=Math.min(3e3*2**(t-1),3e4);return e/2+Math.random()*(e/2)}flushBeacon(){if(this.buffer.length===0)return;let t=this.buffer.splice(0,this.buffer.length);for(let e of t)this.config.client.sendBeacon({guideId:e.guideId,payload:e.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 t=()=>this.flushBeacon(),e=()=>{document.visibilityState==="hidden"&&this.flushBeacon();};window.addEventListener("pagehide",t),window.addEventListener("visibilitychange",e),this.unloadCleanup=()=>{window.removeEventListener("pagehide",t),window.removeEventListener("visibilitychange",e);};}safeOnError(t,e){if(!this.config.onError)return;let o=t instanceof Error?t:new Error(String(t));try{this.config.onError(o,e);}catch{}}};var ie=Math.min,q=Math.max,Ae=Math.round;var _=n=>({x:n,y:n}),vn={left:"right",right:"left",bottom:"top",top:"bottom"};function Ue(n,t,e){return q(n,ie(t,e))}function de(n,t){return typeof n=="function"?n(t):n}function j(n){return n.split("-")[0]}function ue(n){return n.split("-")[1]}function at(n){return n==="x"?"y":"x"}function ze(n){return n==="y"?"height":"width"}function U(n){let t=n[0];return t==="t"||t==="b"?"y":"x"}function Ke(n){return at(U(n))}function It(n,t,e){e===void 0&&(e=false);let o=ue(n),i=Ke(n),r=ze(i),s=i==="x"?o===(e?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(s=Te(s)),[s,Te(s)]}function Tt(n){let t=Te(n);return [We(n),t,We(t)]}function We(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}var St=["left","right"],Rt=["right","left"],yn=["top","bottom"],wn=["bottom","top"];function bn(n,t,e){switch(n){case "top":case "bottom":return e?t?Rt:St:t?St:Rt;case "left":case "right":return t?yn:wn;default:return []}}function At(n,t,e,o){let i=ue(n),r=bn(j(n),e==="start",o);return i&&(r=r.map(s=>s+"-"+i),t&&(r=r.concat(r.map(We)))),r}function Te(n){let t=j(n);return vn[t]+n.slice(t.length)}function xn(n){return {top:0,right:0,bottom:0,left:0,...n}}function lt(n){return typeof n!="number"?xn(n):{top:n,right:n,bottom:n,left:n}}function re(n){let{x:t,y:e,width:o,height:i}=n;return {width:o,height:i,top:e,left:t,right:t+o,bottom:e+i,x:t,y:e}}function Pt(n,t,e){let{reference:o,floating:i}=n,r=U(t),s=Ke(t),a=ze(s),l=j(t),c=r==="y",u=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,f=o[a]/2-i[a]/2,p;switch(l){case "top":p={x:u,y:o.y-i.height};break;case "bottom":p={x:u,y:o.y+o.height};break;case "right":p={x:o.x+o.width,y:d};break;case "left":p={x:o.x-i.width,y:d};break;default:p={x:o.x,y:o.y};}switch(ue(t)){case "start":p[s]-=f*(e&&c?-1:1);break;case "end":p[s]+=f*(e&&c?-1:1);break}return p}async function Lt(n,t){var e;t===void 0&&(t={});let{x:o,y:i,platform:r,rects:s,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=false,padding:p=0}=de(t,n),m=lt(p),g=a[f?d==="floating"?"reference":"floating":d],v=re(await r.getClippingRect({element:(e=await(r.isElement==null?void 0:r.isElement(g)))==null||e?g:g.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),w=d==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),b=await(r.isElement==null?void 0:r.isElement(y))?await(r.getScale==null?void 0:r.getScale(y))||{x:1,y:1}:{x:1,y:1},R=re(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:y,strategy:l}):w);return {top:(v.top-R.top+m.top)/b.y,bottom:(R.bottom-v.bottom+m.bottom)/b.y,left:(v.left-R.left+m.left)/b.x,right:(R.right-v.right+m.right)/b.x}}var Cn=50,Gt=async(n,t,e)=>{let{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=e,a=s.detectOverflow?s:{...s,detectOverflow:Lt},l=await(s.isRTL==null?void 0:s.isRTL(t)),c=await s.getElementRects({reference:n,floating:t,strategy:i}),{x:u,y:d}=Pt(c,o,l),f=o,p=0,m={};for(let h=0;h<r.length;h++){let g=r[h];if(!g)continue;let{name:v,fn:w}=g,{x:y,y:b,data:R,reset:C}=await w({x:u,y:d,initialPlacement:o,placement:f,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:n,floating:t}});u=y??u,d=b??d,m[v]={...m[v],...R},C&&p<Cn&&(p++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(c=C.rects===true?await s.getElementRects({reference:n,floating:t,strategy:i}):C.rects),{x:u,y:d}=Pt(c,f,l)),h=-1);}return {x:u,y:d,placement:f,strategy:i,middlewareData:m}},Nt=n=>({name:"arrow",options:n,async fn(t){let{x:e,y:o,placement:i,rects:r,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=de(n,t)||{};if(c==null)return {};let d=lt(u),f={x:e,y:o},p=Ke(i),m=ze(p),h=await s.getDimensions(c),g=p==="y",v=g?"top":"left",w=g?"bottom":"right",y=g?"clientHeight":"clientWidth",b=r.reference[m]+r.reference[p]-f[p]-r.floating[m],R=f[p]-r.reference[p],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c)),ee=C?C[y]:0;(!ee||!await(s.isElement==null?void 0:s.isElement(C)))&&(ee=a.floating[y]||r.floating[m]);let Se=b/2-R/2,te=ee/2-h[m]/2-1,$=ie(d[v],te),Re=ie(d[w],te),ne=$,Ie=ee-h[m]-Re,E=ee/2-h[m]/2+Se,oe=Ue(ne,E,Ie),W=!l.arrow&&ue(i)!=null&&E!==oe&&r.reference[m]/2-(E<ne?$:Re)-h[m]/2<0,G=W?E<ne?E-ne:E-Ie:0;return {[p]:f[p]+G,data:{[p]:oe,centerOffset:E-oe-G,...W&&{alignmentOffset:G}},reset:W}}});var _t=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var e,o;let{placement:i,middlewareData:r,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=true,crossAxis:d=true,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=true,...g}=de(n,t);if((e=r.arrow)!=null&&e.alignmentOffset)return {};let v=j(i),w=U(a),y=j(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),R=f||(y||!h?[Te(a)]:Tt(a)),C=m!=="none";!f&&C&&R.push(...At(a,h,m,b));let ee=[a,...R],Se=await l.detectOverflow(t,g),te=[],$=((o=r.flip)==null?void 0:o.overflows)||[];if(u&&te.push(Se[v]),d){let E=It(i,s,b);te.push(Se[E[0]],Se[E[1]]);}if($=[...$,{placement:i,overflows:te}],!te.every(E=>E<=0)){var Re,ne;let E=(((Re=r.flip)==null?void 0:Re.index)||0)+1,oe=ee[E];if(oe&&(!(d==="alignment"?w!==U(oe):false)||$.every(N=>U(N.placement)===w?N.overflows[0]>0:true)))return {data:{index:E,overflows:$},reset:{placement:oe}};let W=(ne=$.filter(G=>G.overflows[0]<=0).sort((G,N)=>G.overflows[1]-N.overflows[1])[0])==null?void 0:ne.placement;if(!W)switch(p){case "bestFit":{var Ie;let G=(Ie=$.filter(N=>{if(C){let K=U(N.placement);return K===w||K==="y"}return true}).map(N=>[N.placement,N.overflows.filter(K=>K>0).reduce((K,hn)=>K+hn,0)]).sort((N,K)=>N[1]-K[1])[0])==null?void 0:Ie[0];G&&(W=G);break}case "initialPlacement":W=a;break}if(i!==W)return {reset:{placement:W}}}return {}}}};var kn=new Set(["left","top"]);async function En(n,t){let{placement:e,platform:o,elements:i}=n,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=j(e),a=ue(e),l=U(e)==="y",c=kn.has(s)?-1:1,u=r&&l?-1:1,d=de(t,n),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}var Mt=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var e,o;let{x:i,y:r,placement:s,middlewareData:a}=t,l=await En(t,n);return s===((e=a.offset)==null?void 0:e.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:s}}}}},Ot=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){let{x:e,y:o,placement:i,platform:r}=t,{mainAxis:s=true,crossAxis:a=false,limiter:l={fn:v=>{let{x:w,y}=v;return {x:w,y}}},...c}=de(n,t),u={x:e,y:o},d=await r.detectOverflow(t,c),f=U(j(i)),p=at(f),m=u[p],h=u[f];if(s){let v=p==="y"?"top":"left",w=p==="y"?"bottom":"right",y=m+d[v],b=m-d[w];m=Ue(y,m,b);}if(a){let v=f==="y"?"top":"left",w=f==="y"?"bottom":"right",y=h+d[v],b=h-d[w];h=Ue(y,h,b);}let g=l.fn({...t,[p]:m,[f]:h});return {...g,data:{x:g.x-e,y:g.y-o,enabled:{[p]:s,[f]:a}}}}}};function je(){return typeof window<"u"}function ae(n){return Bt(n)?(n.nodeName||"").toLowerCase():"#document"}function I(n){var t;return (n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function O(n){var t;return (t=(Bt(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function Bt(n){return je()?n instanceof Node||n instanceof I(n).Node:false}function P(n){return je()?n instanceof Element||n instanceof I(n).Element:false}function D(n){return je()?n instanceof HTMLElement||n instanceof I(n).HTMLElement:false}function Dt(n){return !je()||typeof ShadowRoot>"u"?false:n instanceof ShadowRoot||n instanceof I(n).ShadowRoot}function pe(n){let{overflow:t,overflowX:e,overflowY:o,display:i}=L(n);return /auto|scroll|overlay|hidden|clip/.test(t+o+e)&&i!=="inline"&&i!=="contents"}function Ft(n){return /^(table|td|th)$/.test(ae(n))}function Pe(n){try{if(n.matches(":popover-open"))return !0}catch{}try{return n.matches(":modal")}catch{return false}}var Sn=/transform|translate|scale|rotate|perspective|filter/,Rn=/paint|layout|strict|content/,se=n=>!!n&&n!=="none",ct;function Ve(n){let t=P(n)?L(n):n;return se(t.transform)||se(t.translate)||se(t.scale)||se(t.rotate)||se(t.perspective)||!Ye()&&(se(t.backdropFilter)||se(t.filter))||Sn.test(t.willChange||"")||Rn.test(t.contain||"")}function Ht(n){let t=z(n);for(;D(t)&&!le(t);){if(Ve(t))return t;if(Pe(t))return null;t=z(t);}return null}function Ye(){return ct==null&&(ct=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ct}function le(n){return /^(html|body|#document)$/.test(ae(n))}function L(n){return I(n).getComputedStyle(n)}function Le(n){return P(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function z(n){if(ae(n)==="html")return n;let t=n.assignedSlot||n.parentNode||Dt(n)&&n.host||O(n);return Dt(t)?t.host:t}function $t(n){let t=z(n);return le(t)?n.ownerDocument?n.ownerDocument.body:n.body:D(t)&&pe(t)?t:$t(t)}function qe(n,t,e){var o;t===void 0&&(t=[]);let i=$t(n),r=i===((o=n.ownerDocument)==null?void 0:o.body),s=I(i);if(r){Xe(s);return t.concat(s,s.visualViewport||[],pe(i)?i:[],[])}else return t.concat(i,qe(i,[]))}function Xe(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Kt(n){let t=L(n),e=parseFloat(t.width)||0,o=parseFloat(t.height)||0,i=D(n),r=i?n.offsetWidth:e,s=i?n.offsetHeight:o,a=Ae(e)!==r||Ae(o)!==s;return a&&(e=r,o=s),{width:e,height:o,$:a}}function qt(n){return P(n)?n:n.contextElement}function fe(n){let t=qt(n);if(!D(t))return _(1);let e=t.getBoundingClientRect(),{width:o,height:i,$:r}=Kt(t),s=(r?Ae(e.width):e.width)/o,a=(r?Ae(e.height):e.height)/i;return (!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var In=_(0);function jt(n){let t=I(n);return !Ye()||!t.visualViewport?In:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Tn(n,t,e){return t===void 0&&(t=false),!e||t&&e!==I(n)?false:t}function Ge(n,t,e,o){t===void 0&&(t=false),e===void 0&&(e=false);let i=n.getBoundingClientRect(),r=qt(n),s=_(1);t&&(o?P(o)&&(s=fe(o)):s=fe(n));let a=Tn(r,e,o)?jt(r):_(0),l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,d=i.height/s.y;if(r){let f=I(r),p=o&&P(o)?I(o):o,m=f,h=Xe(m);for(;h&&o&&p!==m;){let g=fe(h),v=h.getBoundingClientRect(),w=L(h),y=v.left+(h.clientLeft+parseFloat(w.paddingLeft))*g.x,b=v.top+(h.clientTop+parseFloat(w.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,d*=g.y,l+=y,c+=b,m=I(h),h=Xe(m);}}return re({width:u,height:d,x:l,y:c})}function Qe(n,t){let e=Le(n).scrollLeft;return t?t.left+e:Ge(O(n)).left+e}function Vt(n,t){let e=n.getBoundingClientRect(),o=e.left+t.scrollLeft-Qe(n,e),i=e.top+t.scrollTop;return {x:o,y:i}}function An(n){let{elements:t,rect:e,offsetParent:o,strategy:i}=n,r=i==="fixed",s=O(o),a=t?Pe(t.floating):false;if(o===s||a&&r)return e;let l={scrollLeft:0,scrollTop:0},c=_(1),u=_(0),d=D(o);if((d||!d&&!r)&&((ae(o)!=="body"||pe(s))&&(l=Le(o)),d)){let p=Ge(o);c=fe(o),u.x=p.x+o.clientLeft,u.y=p.y+o.clientTop;}let f=s&&!d&&!r?Vt(s,l):_(0);return {width:e.width*c.x,height:e.height*c.y,x:e.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:e.y*c.y-l.scrollTop*c.y+u.y+f.y}}function Pn(n){return Array.from(n.getClientRects())}function Ln(n){let t=O(n),e=Le(n),o=n.ownerDocument.body,i=q(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=q(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight),s=-e.scrollLeft+Qe(n),a=-e.scrollTop;return L(o).direction==="rtl"&&(s+=q(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:a}}var Wt=25;function Gn(n,t){let e=I(n),o=O(n),i=e.visualViewport,r=o.clientWidth,s=o.clientHeight,a=0,l=0;if(i){r=i.width,s=i.height;let u=Ye();(!u||u&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop);}let c=Qe(o);if(c<=0){let u=o.ownerDocument,d=u.body,f=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(o.clientWidth-d.clientWidth-p);m<=Wt&&(r-=m);}else c<=Wt&&(r+=c);return {width:r,height:s,x:a,y:l}}function Nn(n,t){let e=Ge(n,true,t==="fixed"),o=e.top+n.clientTop,i=e.left+n.clientLeft,r=D(n)?fe(n):_(1),s=n.clientWidth*r.x,a=n.clientHeight*r.y,l=i*r.x,c=o*r.y;return {width:s,height:a,x:l,y:c}}function Ut(n,t,e){let o;if(t==="viewport")o=Gn(n,e);else if(t==="document")o=Ln(O(n));else if(P(t))o=Nn(t,e);else {let i=jt(n);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height};}return re(o)}function Yt(n,t){let e=z(n);return e===t||!P(e)||le(e)?false:L(e).position==="fixed"||Yt(e,t)}function _n(n,t){let e=t.get(n);if(e)return e;let o=qe(n,[]).filter(a=>P(a)&&ae(a)!=="body"),i=null,r=L(n).position==="fixed",s=r?z(n):n;for(;P(s)&&!le(s);){let a=L(s),l=Ve(s);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||pe(s)&&!l&&Yt(n,s))?o=o.filter(u=>u!==s):i=a,s=z(s);}return t.set(n,o),o}function Mn(n){let{element:t,boundary:e,rootBoundary:o,strategy:i}=n,s=[...e==="clippingAncestors"?Pe(t)?[]:_n(t,this._c):[].concat(e),o],a=Ut(t,s[0],i),l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<s.length;f++){let p=Ut(t,s[f],i);l=q(p.top,l),c=ie(p.right,c),u=ie(p.bottom,u),d=q(p.left,d);}return {width:c-d,height:u-l,x:d,y:l}}function On(n){let{width:t,height:e}=Kt(n);return {width:t,height:e}}function Dn(n,t,e){let o=D(t),i=O(t),r=e==="fixed",s=Ge(n,true,r,t),a={scrollLeft:0,scrollTop:0},l=_(0);function c(){l.x=Qe(i);}if(o||!o&&!r)if((ae(t)!=="body"||pe(i))&&(a=Le(t)),o){let p=Ge(t,true,r,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop;}else i&&c();r&&!o&&i&&c();let u=i&&!o&&!r?Vt(i,a):_(0),d=s.left+a.scrollLeft-l.x-u.x,f=s.top+a.scrollTop-l.y-u.y;return {x:d,y:f,width:s.width,height:s.height}}function dt(n){return L(n).position==="static"}function zt(n,t){if(!D(n)||L(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return O(n)===e&&(e=e.ownerDocument.body),e}function Xt(n,t){let e=I(n);if(Pe(n))return e;if(!D(n)){let i=z(n);for(;i&&!le(i);){if(P(i)&&!dt(i))return i;i=z(i);}return e}let o=zt(n,t);for(;o&&Ft(o)&&dt(o);)o=zt(o,t);return o&&le(o)&&dt(o)&&!Ve(o)?e:o||Ht(n)||e}var Bn=async function(n){let t=this.getOffsetParent||Xt,e=this.getDimensions,o=await e(n.floating);return {reference:Dn(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Fn(n){return L(n).direction==="rtl"}var Hn={convertOffsetParentRelativeRectToViewportRelativeRect:An,getDocumentElement:O,getClippingRect:Mn,getOffsetParent:Xt,getElementRects:Bn,getClientRects:Pn,getDimensions:On,getScale:fe,isElement:P,isRTL:Fn};var V=Mt;var Y=Ot,X=_t;var me=Nt;var Q=(n,t,e)=>{let o=new Map,i={platform:Hn,...e},r={...i.platform,_c:o};return Gt(n,t,{...i,platform:r})};var $n={P:"p",BR:"br",STRONG:"strong",B:"strong",EM:"em",I:"em",U:"u",S:"s",UL:"ul",OL:"ol",LI:"li",A:"a"},Wn=new Set(["SCRIPT","STYLE","TEMPLATE","IFRAME","OBJECT","EMBED","NOSCRIPT","TITLE","TEXTAREA","SELECT","SVG","MATH"]),Qt=16*1024,Un=20,zn=1e3;function Jt(n,t){let e=t.createDocumentFragment();if(typeof n!="string"||n.length===0)return e;let o;try{o=new DOMParser().parseFromString(n.length>Qt?n.slice(0,Qt):n,"text/html");}catch{return e.appendChild(t.createTextNode(n)),e}let i={nodes:0,exceeded:false};for(let r of Array.from(o.body.childNodes)){let s=Ne(r,t,0,i);s&&e.appendChild(s);}if(i.exceeded){let r=t.createDocumentFragment();return r.appendChild(t.createTextNode(o.body.textContent??"")),r}return e}function Ne(n,t,e,o){if(o.exceeded)return null;if(++o.nodes>zn||e>Un)return o.exceeded=true,null;if(n.nodeType===Node.TEXT_NODE)return t.createTextNode(n.textContent??"");if(n.nodeType!==Node.ELEMENT_NODE)return null;let i=n;if(Wn.has(i.tagName))return null;let r=$n[i.tagName];if(!r){let a=t.createDocumentFragment();for(let l of Array.from(i.childNodes)){let c=Ne(l,t,e+1,o);c&&a.appendChild(c);}return a}if(r==="a"){let a=i.getAttribute("href")??"";if(!T(a)){let c=t.createDocumentFragment();for(let u of Array.from(i.childNodes)){let d=Ne(u,t,e+1,o);d&&c.appendChild(d);}return c}let l=t.createElement("a");l.setAttribute("href",a),l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer nofollow");for(let c of Array.from(i.childNodes)){let u=Ne(c,t,e+1,o);u&&l.appendChild(u);}return l}let s=t.createElement(r);for(let a of Array.from(i.childNodes)){let l=Ne(a,t,e+1,o);l&&s.appendChild(l);}return s}function A(n,t,e){let o=t.createElement("div");o.className="veo-guide-content";let i=qn(n);return i?jn(o,i,t,e):Kn(o,n,t,e),o.appendChild(Me(t,()=>e.onDismiss())),o}function Kn(n,t,e,o){if(typeof t.imageUrl=="string"&&t.imageUrl&&T(t.imageUrl)){let r=e.createElement("img");r.className="veo-guide-image",r.src=t.imageUrl,r.alt=typeof t.title=="string"?t.title:"",n.appendChild(r);}if(typeof t.title=="string"&&t.title){let r=e.createElement("h2");r.className="veo-guide-title",r.textContent=t.title,n.appendChild(r);}if(typeof t.content=="string"&&t.content){let r=e.createElement("p");r.className="veo-guide-text",r.textContent=t.content,n.appendChild(r);}let i=e.createElement("div");if(i.className="veo-guide-actions",typeof t.ctaText=="string"&&t.ctaText){let r=e.createElement("button");r.type="button",r.className="veo-guide-cta",r.textContent=t.ctaText,r.addEventListener("click",()=>{let s=t.ctaAction??"dismiss",a=Xn(t);o.onCtaClick(s,a);}),i.appendChild(r);}n.appendChild(i);}function qn(n){if(!Array.isArray(n.blocks)||n.blocks.length===0)return null;let t=n.blocks.filter(e=>!e||typeof e!="object"?false:e.type==="image"?typeof e.url=="string"&&T(e.url):e.type==="title"||e.type==="text"||e.type==="button");return t.length>0?t:null}function jn(n,t,e,o){let i=0;for(;i<t.length;){let r=t[i];if(r?.type==="button"){let a=e.createElement("div");a.className="veo-guide-actions";let l;for(;i<t.length&&t[i]?.type==="button";){let c=t[i];if(!l){let u=c.style?.align;(u==="left"||u==="center"||u==="right")&&(l=u);}a.appendChild(Yn(c,e,o)),i++;}l&&(a.style.justifyContent=Zt[l]),n.appendChild(a);continue}let s=Vn(r,e);s&&n.appendChild(s),i++;}}function Vn(n,t){switch(n.type){case "title":{let e=t.createElement("h2");return e.className="veo-guide-title",e.textContent=typeof n.text=="string"?n.text:"",Je(e,n.style,"text"),e}case "text":{let e=t.createElement("div");return e.className="veo-guide-text",typeof n.html=="string"&&n.html?e.appendChild(Jt(n.html,t)):e.textContent=typeof n.text=="string"?n.text:"",Je(e,n.style,"text"),e}case "image":{if(typeof n.url!="string"||!T(n.url))return null;let e=t.createElement("img");return e.className="veo-guide-image",e.src=n.url,e.alt="",Je(e,n.style,"image"),e}default:return null}}function Yn(n,t,e){let o=t.createElement("button");return o.type="button",o.className="veo-guide-cta",o.textContent=typeof n.text=="string"&&n.text?n.text:"OK",Je(o,n.style,"button"),o.addEventListener("click",()=>{let i=n.action??"dismiss",r=i==="url"&&typeof n.url=="string"&&T(n.url)?n.url:void 0,s={...typeof n.id=="string"&&n.id?{buttonId:n.id}:{},...typeof n.text=="string"&&n.text?{buttonText:n.text}:{}};e.onCtaClick(i,r,Object.keys(s).length?s:void 0);}),o}var Zt={left:"flex-start",center:"center",right:"flex-end"};function _e(n,t,e){return Math.min(e,Math.max(t,n))}function Je(n,t,e){if(!t||typeof t!="object")return;let o=t;if(e==="image"&&o.bleed===true){n.classList.add("veo-guide-image--bleed");return}let i=typeof o.align=="string"?o.align:null;i&&(i==="left"||i==="center"||i==="right")&&(e==="text"?n.style.textAlign=i:e==="image"&&(n.style.alignSelf=Zt[i])),e!=="image"&&typeof o.color=="string"&&(n.style.color=o.color),e==="text"&&typeof o.fontSize=="number"&&Number.isFinite(o.fontSize)&&(n.style.fontSize=`${_e(o.fontSize,8,72)}px`),e==="image"&&typeof o.width=="number"&&Number.isFinite(o.width)&&(n.style.width=`${_e(o.width,10,100)}%`),e==="image"&&typeof o.radius=="number"&&Number.isFinite(o.radius)&&(n.style.borderRadius=`${_e(o.radius,0,48)}px`),typeof o.marginTop=="number"&&Number.isFinite(o.marginTop)&&(n.style.marginTop=`${_e(o.marginTop,0,64)}px`),typeof o.marginBottom=="number"&&Number.isFinite(o.marginBottom)&&(n.style.marginBottom=`${_e(o.marginBottom,0,64)}px`);}function Me(n,t,e="veo-guide-close"){let o=n.createElement("button");return o.type="button",o.className=e,o.setAttribute("aria-label","Cerrar"),o.textContent="\xD7",o.addEventListener("click",t),o}function T(n){if(typeof n!="string"||n.length===0)return false;try{let t=typeof window<"u"?window.location.href:"http://localhost/",e=new URL(n,t);return vt.includes(e.protocol)}catch{return false}}function Xn(n){let t=n.style?.ctaUrl;if(typeof t=="string")return T(t)?t:void 0}var Qn={"--veo-bg":"#1f2937","--veo-text":"#f9fafb","--veo-text-secondary":"#d1d5db","--veo-shadow":"0 20px 60px rgba(0, 0, 0, 0.55)"},pt={left:"flex-start",center:"center",right:"flex-end"},Jn={left:"flex-start",center:"center",right:"flex-end"},Zn={title:"text",text:"text",image:"self"},en={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)"},tn={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]},B=/^#[0-9a-f]{3,8}$|^(rgb|rgba|hsl|hsla)\([\d.,%/\sdeg]+\)$|^[a-z]{3,20}$/i;function S(n,t,e){return Math.min(e,Math.max(t,n))}function nn(n,t){if(!t||typeof t!="object")return;let e=t;if(typeof e.accentColor=="string"&&B.test(e.accentColor.trim())&&n.style.setProperty("--veo-primary",e.accentColor.trim()),typeof e.fontFamily=="string"&&e.fontFamily.length<=200&&!/[<>{}]/.test(e.fontFamily)&&n.style.setProperty("--veo-font",e.fontFamily.trim()),e.theme==="dark")for(let[r,s]of Object.entries(Qn))n.style.setProperty(r,s);typeof e.background=="string"&&B.test(e.background.trim())&&n.style.setProperty("--veo-bg",e.background.trim()),typeof e.textColor=="string"&&B.test(e.textColor.trim())&&n.style.setProperty("--veo-text",e.textColor.trim()),typeof e.textSecondaryColor=="string"&&B.test(e.textSecondaryColor.trim())&&n.style.setProperty("--veo-text-secondary",e.textSecondaryColor.trim()),typeof e.radius=="number"&&Number.isFinite(e.radius)&&n.style.setProperty("--veo-radius",`${S(e.radius,0,48)}px`),typeof e.width=="number"&&Number.isFinite(e.width)&&n.style.setProperty("--veo-width",`${S(e.width,220,720)}px`),typeof e.height=="number"&&Number.isFinite(e.height)&&n.style.setProperty("--veo-min-h",`${S(e.height,120,900)}px`),(e.align==="left"||e.align==="center"||e.align==="right")&&n.style.setProperty("--veo-actions-justify",pt[e.align]),typeof e.padding=="number"&&Number.isFinite(e.padding)&&n.style.setProperty("--veo-pad",`${S(e.padding,0,64)}px`),typeof e.margin=="number"&&Number.isFinite(e.margin)&&n.style.setProperty("--veo-margin",`${S(e.margin,0,64)}px`),typeof e.borderWidth=="number"&&Number.isFinite(e.borderWidth)&&n.style.setProperty("--veo-border-width",`${S(e.borderWidth,0,16)}px`),typeof e.borderColor=="string"&&B.test(e.borderColor.trim())&&n.style.setProperty("--veo-border-color",e.borderColor.trim()),typeof e.shadow=="string"&&en[e.shadow]&&n.style.setProperty("--veo-shadow",en[e.shadow]);let o,i;if(typeof e.posX=="number"&&typeof e.posY=="number"?(o=S(e.posX,0,1),i=S(e.posY,0,1)):typeof e.overlayPosition=="string"&&tn[e.overlayPosition]&&([o,i]=tn[e.overlayPosition]),o!==void 0&&i!==void 0&&(n.style.setProperty("--veo-pos-x",`${o*100}%`),n.style.setProperty("--veo-pos-y",`${i*100}%`)),e.elements&&typeof e.elements=="object"){let r=e.elements;ut(n,"title",r.title),ut(n,"text",r.text),ut(n,"image",r.image),eo(n,r.cta);}}function eo(n,t){if(!t||typeof t!="object")return;let e=t;typeof e.align=="string"&&pt[e.align]&&n.style.setProperty("--veo-actions-justify",pt[e.align]),typeof e.background=="string"&&B.test(e.background.trim())&&n.style.setProperty("--veo-cta-bg",e.background.trim()),typeof e.color=="string"&&B.test(e.color.trim())&&n.style.setProperty("--veo-cta-color",e.color.trim()),typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)&&n.style.setProperty("--veo-cta-size",`${S(e.fontSize,10,24)}px`),typeof e.radius=="number"&&Number.isFinite(e.radius)&&n.style.setProperty("--veo-cta-radius",`${S(e.radius,0,48)}px`);}function ut(n,t,e){if(!e||typeof e!="object")return;let o=e;if(typeof o.align=="string"&&(o.align==="left"||o.align==="center"||o.align==="right")){let r=(Zn[t]??"text")==="self"?Jn[o.align]:o.align;n.style.setProperty(`--veo-${t}-align`,r);}typeof o.color=="string"&&B.test(o.color.trim())&&n.style.setProperty(`--veo-${t}-color`,o.color.trim()),typeof o.fontSize=="number"&&Number.isFinite(o.fontSize)&&n.style.setProperty(`--veo-${t}-size`,`${S(o.fontSize,8,72)}px`),typeof o.width=="number"&&Number.isFinite(o.width)&&n.style.setProperty(`--veo-${t}-width`,`${S(o.width,10,100)}%`),typeof o.radius=="number"&&Number.isFinite(o.radius)&&n.style.setProperty(`--veo-${t}-radius`,`${S(o.radius,0,48)}px`),typeof o.marginTop=="number"&&Number.isFinite(o.marginTop)&&n.style.setProperty(`--veo-${t}-mt`,`${S(o.marginTop,0,64)}px`),typeof o.marginBottom=="number"&&Number.isFinite(o.marginBottom)&&n.style.setProperty(`--veo-${t}-mb`,`${S(o.marginBottom,0,64)}px`);}function F(n){let t=n?.inlinePosition;return t==="before"||t==="prepend"||t==="append"?t:"after"}function M(n,t,e){switch(e){case "before":n.before(t);break;case "after":n.after(t);break;case "prepend":n.prepend(t);break;case "append":n.append(t);break}}function H(n,t,e){let o=window.setInterval(()=>{if(n.isConnected)return;let i=document.querySelector(t);i&&M(i,n,e);},1e3);return ()=>window.clearInterval(o)}function k(n,t=5e3){return new Promise(e=>{let o=()=>{try{return document.querySelector(n)}catch{return null}},i=o();if(i){e(i);return}let r=false,s=c=>{r||(r=true,a.disconnect(),clearTimeout(l),e(c));},a=new MutationObserver(()=>{let c=o();c&&s(c);});a.observe(document.body,{childList:true,subtree:true});let l=setTimeout(()=>s(null),t);})}var on=`
|
|
2
2
|
:host {
|
|
3
3
|
--veo-primary: #FF5B35;
|
|
4
4
|
--veo-text: #1f2937;
|
|
@@ -18,6 +18,13 @@ var veoGuides=(function(exports){'use strict';function ft(){return typeof window
|
|
|
18
18
|
z-index: ${2147483640};
|
|
19
19
|
animation: veo-fade-in 180ms ease-out;
|
|
20
20
|
}
|
|
21
|
+
/* Sin backdrop (style.backdrop === false): la app queda usable detr\xE1s; solo la
|
|
22
|
+
tarjeta captura el mouse. El click-en-backdrop deja de cerrar (no hay backdrop). */
|
|
23
|
+
.veo-modal-overlay--none {
|
|
24
|
+
background: transparent;
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
}
|
|
27
|
+
.veo-modal-overlay--none .veo-modal-card { pointer-events: auto; }
|
|
21
28
|
/*
|
|
22
29
|
* Posici\xF3n libre/preset: --veo-pos-x/y son porcentajes (default 50% = centro).
|
|
23
30
|
* El truco translate(-pos) alinea la MISMA fracci\xF3n de la tarjeta con esa
|
|
@@ -34,6 +41,7 @@ var veoGuides=(function(exports){'use strict';function ft(){return typeof window
|
|
|
34
41
|
border: var(--veo-border-width, 0) solid var(--veo-border-color, transparent);
|
|
35
42
|
padding: var(--veo-pad, 24px);
|
|
36
43
|
max-width: var(--veo-width); width: 90%;
|
|
44
|
+
min-height: var(--veo-min-h, auto);
|
|
37
45
|
box-shadow: var(--veo-shadow);
|
|
38
46
|
animation: veo-fade-in 180ms ease-out;
|
|
39
47
|
}
|
|
@@ -49,6 +57,14 @@ var veoGuides=(function(exports){'use strict';function ft(){return typeof window
|
|
|
49
57
|
}
|
|
50
58
|
.veo-banner-top { top: 0; }
|
|
51
59
|
.veo-banner-bottom { bottom: 0; }
|
|
60
|
+
/* Banner EMBEBIDO en un contenedor (step.selector): fluye dentro del contenedor
|
|
61
|
+
y empuja su contenido, en vez de flotar fijo sobre la pantalla. */
|
|
62
|
+
.veo-banner-embedded {
|
|
63
|
+
position: static;
|
|
64
|
+
left: auto; right: auto;
|
|
65
|
+
width: 100%;
|
|
66
|
+
border-radius: var(--veo-radius, 0);
|
|
67
|
+
}
|
|
52
68
|
|
|
53
69
|
.veo-tooltip {
|
|
54
70
|
position: absolute;
|
|
@@ -102,6 +118,21 @@ var veoGuides=(function(exports){'use strict';function ft(){return typeof window
|
|
|
102
118
|
border-radius: var(--veo-image-radius, 8px);
|
|
103
119
|
margin: var(--veo-image-mt, 0) 0 var(--veo-image-mb, 12px);
|
|
104
120
|
}
|
|
121
|
+
/* Imagen A SANGRE: rompe el padding de la tarjeta y ocupa el ancho completo
|
|
122
|
+
(hero estilo anuncio). Como primer bloque, hereda el redondeo superior. */
|
|
123
|
+
.veo-guide-image--bleed {
|
|
124
|
+
width: calc(100% + var(--veo-pad, 24px) * 2);
|
|
125
|
+
max-width: none;
|
|
126
|
+
max-height: 280px;
|
|
127
|
+
align-self: auto;
|
|
128
|
+
border-radius: 0;
|
|
129
|
+
margin: 0 calc(var(--veo-pad, 24px) * -1) 12px;
|
|
130
|
+
}
|
|
131
|
+
.veo-guide-content > .veo-guide-image--bleed:first-child {
|
|
132
|
+
margin-top: calc(var(--veo-pad, 24px) * -1);
|
|
133
|
+
border-radius: calc(var(--veo-radius, 12px) - var(--veo-border-width, 0px))
|
|
134
|
+
calc(var(--veo-radius, 12px) - var(--veo-border-width, 0px)) 0 0;
|
|
135
|
+
}
|
|
105
136
|
.veo-guide-title {
|
|
106
137
|
font-size: var(--veo-title-size, 18px); font-weight: 600; line-height: 1.3;
|
|
107
138
|
text-align: var(--veo-title-align, left);
|
|
@@ -114,6 +145,18 @@ var veoGuides=(function(exports){'use strict';function ft(){return typeof window
|
|
|
114
145
|
margin: var(--veo-text-mt, 0) 0 var(--veo-text-mb, 16px);
|
|
115
146
|
color: var(--veo-text-color, var(--veo-text-secondary));
|
|
116
147
|
}
|
|
148
|
+
/* Rich text dentro de un bloque de texto (p/listas/links/\xE9nfasis). */
|
|
149
|
+
.veo-guide-text p { margin: 0 0 8px; }
|
|
150
|
+
.veo-guide-text p:last-child { margin-bottom: 0; }
|
|
151
|
+
.veo-guide-text ul, .veo-guide-text ol { margin: 0 0 8px; padding-left: 20px; }
|
|
152
|
+
.veo-guide-text ul { list-style: disc; }
|
|
153
|
+
.veo-guide-text ol { list-style: decimal; }
|
|
154
|
+
.veo-guide-text li { margin: 2px 0; display: list-item; }
|
|
155
|
+
.veo-guide-text a { color: var(--veo-primary); text-decoration: underline; cursor: pointer; }
|
|
156
|
+
.veo-guide-text strong { font-weight: 600; }
|
|
157
|
+
.veo-guide-text em { font-style: italic; }
|
|
158
|
+
.veo-guide-text u { text-decoration: underline; }
|
|
159
|
+
.veo-guide-text s { text-decoration: line-through; }
|
|
117
160
|
.veo-guide-actions {
|
|
118
161
|
display: flex; gap: 8px; justify-content: var(--veo-actions-justify);
|
|
119
162
|
}
|
|
@@ -252,6 +295,44 @@ var veoGuides=(function(exports){'use strict';function ft(){return typeof window
|
|
|
252
295
|
}
|
|
253
296
|
.veo-walkthrough-skip:hover { color: var(--veo-text); }
|
|
254
297
|
|
|
298
|
+
/* \u2500\u2500 Badge (elemento inyectado junto al ancla que abre un tooltip) \u2500\u2500 */
|
|
299
|
+
.veo-badge {
|
|
300
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
301
|
+
border: none; padding: 0; margin: 0 4px;
|
|
302
|
+
background: none; cursor: pointer;
|
|
303
|
+
line-height: 1; vertical-align: middle;
|
|
304
|
+
font-family: inherit;
|
|
305
|
+
}
|
|
306
|
+
.veo-badge:focus-visible { outline: 2px solid var(--veo-primary); outline-offset: 2px; }
|
|
307
|
+
.veo-badge--icon {
|
|
308
|
+
border-radius: 50%;
|
|
309
|
+
background: color-mix(in srgb, var(--veo-primary) 14%, transparent);
|
|
310
|
+
color: var(--veo-primary);
|
|
311
|
+
font-weight: 600;
|
|
312
|
+
}
|
|
313
|
+
.veo-badge--dot {
|
|
314
|
+
border-radius: 50%;
|
|
315
|
+
background: var(--veo-primary);
|
|
316
|
+
animation: veo-badge-pulse 2s ease-out infinite;
|
|
317
|
+
}
|
|
318
|
+
.veo-badge--pill {
|
|
319
|
+
border-radius: 999px;
|
|
320
|
+
background: var(--veo-primary);
|
|
321
|
+
color: #fff;
|
|
322
|
+
font-weight: 600;
|
|
323
|
+
padding: 3px 9px;
|
|
324
|
+
white-space: nowrap;
|
|
325
|
+
}
|
|
326
|
+
.veo-badge--image img { display: block; border-radius: 4px; object-fit: cover; }
|
|
327
|
+
/* El tooltip del badge usa strategy fixed (el host vive dentro del flujo del
|
|
328
|
+
cliente; un absoluto se recortar\xEDa con overflow de ancestros). */
|
|
329
|
+
.veo-badge-tooltip { position: fixed; }
|
|
330
|
+
@keyframes veo-badge-pulse {
|
|
331
|
+
0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--veo-primary) 45%, transparent); }
|
|
332
|
+
70% { box-shadow: 0 0 0 7px transparent; }
|
|
333
|
+
100% { box-shadow: 0 0 0 0 transparent; }
|
|
334
|
+
}
|
|
335
|
+
|
|
255
336
|
.veo-custom-floating {
|
|
256
337
|
position: fixed;
|
|
257
338
|
z-index: ${2147483640};
|
|
@@ -288,8 +369,9 @@ var veoGuides=(function(exports){'use strict';function ft(){return typeof window
|
|
|
288
369
|
from { transform: translateY(-10px); opacity: 0; }
|
|
289
370
|
to { transform: translateY(0); opacity: 1; }
|
|
290
371
|
}
|
|
291
|
-
`;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(mt,"");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=Rt,t.appendChild(o);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&&Et(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 U=class extends w{render(e){let t=e.nav?.stepIndex??0,o=e.guide.guideSteps[t];if(!o)return;let{root:i}=this.createHost();this.applyDesign(o.style);let r=i.ownerDocument??document,s=o.style?.position==="bottom"?"bottom":"top",a=r.createElement("div");a.className=`veo-banner veo-banner-${s}`;let l=(u,d)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:t,action:u}),d&&window.open(d,"_blank","noopener,noreferrer"),e.onClose();},c=e.nav?re(o,e.nav.stepIndex,e.nav.totalSteps,r,e.nav.callbacks):R(o,r,{onCtaClick:(u,d)=>l("cta_clicked",u==="url"?d:void 0),onDismiss:()=>l("dismissed")});a.appendChild(c),i.appendChild(a),e.nav||(this.liveContainer=a,this.liveContent=c,this.liveBuild=u=>R(u,r,{onCtaClick:(d,p)=>l("cta_clicked",d==="url"?p:void 0),onDismiss:()=>l("dismissed")}),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"}));}onLiveUpdate(e){if(this.liveContainer){let t=e.style?.position==="bottom"?"bottom":"top";this.liveContainer.className=`veo-banner veo-banner-${t}`;}}};var Q=Math.min,z=Math.max,Te=Math.round;var _=n=>({x:n,y:n}),yn={left:"right",right:"left",bottom:"top",top:"bottom"};function Be(n,e,t){return z(n,Q(e,t))}function se(n,e){return typeof n=="function"?n(e):n}function K(n){return n.split("-")[0]}function ae(n){return n.split("-")[1]}function st(n){return n==="x"?"y":"x"}function We(n){return n==="y"?"height":"width"}function H(n){let e=n[0];return e==="t"||e==="b"?"y":"x"}function $e(n){return st(H(n))}function Tt(n,e,t){t===void 0&&(t=false);let o=ae(n),i=$e(n),r=We(i),s=i==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=Pe(s)),[s,Pe(s)]}function At(n){let e=Pe(n);return [He(n),e,He(e)]}function He(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}var It=["left","right"],Pt=["right","left"],wn=["top","bottom"],bn=["bottom","top"];function xn(n,e,t){switch(n){case "top":case "bottom":return t?e?Pt:It:e?It:Pt;case "left":case "right":return e?wn:bn;default:return []}}function Lt(n,e,t,o){let i=ae(n),r=xn(K(n),t==="start",o);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(He)))),r}function Pe(n){let e=K(n);return yn[e]+n.slice(e.length)}function Cn(n){return {top:0,right:0,bottom:0,left:0,...n}}function at(n){return typeof n!="number"?Cn(n):{top:n,right:n,bottom:n,left:n}}function J(n){let{x:e,y:t,width:o,height:i}=n;return {width:o,height:i,top:t,left:e,right:e+o,bottom:t+i,x:e,y:t}}function Gt(n,e,t){let{reference:o,floating:i}=n,r=H(e),s=$e(e),a=We(s),l=K(e),c=r==="y",u=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,p=o[a]/2-i[a]/2,f;switch(l){case "top":f={x:u,y:o.y-i.height};break;case "bottom":f={x:u,y:o.y+o.height};break;case "right":f={x:o.x+o.width,y:d};break;case "left":f={x:o.x-i.width,y:d};break;default:f={x:o.x,y:o.y};}switch(ae(e)){case "start":f[s]-=p*(t&&c?-1:1);break;case "end":f[s]+=p*(t&&c?-1:1);break}return f}async function _t(n,e){var t;e===void 0&&(e={});let{x:o,y:i,platform:r,rects:s,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=false,padding:f=0}=se(e,n),h=at(f),g=a[p?d==="floating"?"reference":"floating":d],v=J(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:c,rootBoundary:u,strategy:l})),y=d==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),x=await(r.isElement==null?void 0:r.isElement(b))?await(r.getScale==null?void 0:r.getScale(b))||{x:1,y:1}:{x:1,y:1},A=J(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:b,strategy:l}):y);return {top:(v.top-A.top+h.top)/x.y,bottom:(A.bottom-v.bottom+h.bottom)/x.y,left:(v.left-A.left+h.left)/x.x,right:(A.right-v.right+h.right)/x.x}}var kn=50,Nt=async(n,e,t)=>{let{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=t,a=s.detectOverflow?s:{...s,detectOverflow:_t},l=await(s.isRTL==null?void 0:s.isRTL(e)),c=await s.getElementRects({reference:n,floating:e,strategy:i}),{x:u,y:d}=Gt(c,o,l),p=o,f=0,h={};for(let m=0;m<r.length;m++){let g=r[m];if(!g)continue;let{name:v,fn:y}=g,{x:b,y:x,data:A,reset:k}=await y({x:u,y:d,initialPlacement:o,placement:p,strategy:i,middlewareData:h,rects:c,platform:a,elements:{reference:n,floating:e}});u=b??u,d=x??d,h[v]={...h[v],...A},k&&f<kn&&(f++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(c=k.rects===true?await s.getElementRects({reference:n,floating:e,strategy:i}):k.rects),{x:u,y:d}=Gt(c,p,l)),m=-1);}return {x:u,y:d,placement:p,strategy:i,middlewareData:h}},Ot=n=>({name:"arrow",options:n,async fn(e){let{x:t,y:o,placement:i,rects:r,platform:s,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=se(n,e)||{};if(c==null)return {};let d=at(u),p={x:t,y:o},f=$e(i),h=We(f),m=await s.getDimensions(c),g=f==="y",v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=r.reference[h]+r.reference[f]-p[f]-r.floating[h],A=p[f]-r.reference[f],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c)),j=k?k[b]:0;(!j||!await(s.isElement==null?void 0:s.isElement(k)))&&(j=a.floating[b]||r.floating[h]);let Ce=x/2-A/2,V=j/2-m[h]/2-1,F=Q(d[v],V),ke=Q(d[y],V),Y=F,Se=j-m[h]-ke,C=j/2-m[h]/2+Ce,X=Be(Y,C,Se),M=!l.arrow&&ae(i)!=null&&C!==X&&r.reference[h]/2-(C<Y?F:ke)-m[h]/2<0,L=M?C<Y?C-Y:C-Se:0;return {[f]:p[f]+L,data:{[f]:X,centerOffset:C-X-L,...M&&{alignmentOffset:L}},reset:M}}});var Dt=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,o;let{placement:i,middlewareData:r,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=true,crossAxis:d=true,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=true,...g}=se(n,e);if((t=r.arrow)!=null&&t.alignmentOffset)return {};let v=K(i),y=H(a),b=K(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),A=p||(b||!m?[Pe(a)]:At(a)),k=h!=="none";!p&&k&&A.push(...Lt(a,m,h,x));let j=[a,...A],Ce=await l.detectOverflow(e,g),V=[],F=((o=r.flip)==null?void 0:o.overflows)||[];if(u&&V.push(Ce[v]),d){let C=Tt(i,s,x);V.push(Ce[C[0]],Ce[C[1]]);}if(F=[...F,{placement:i,overflows:V}],!V.every(C=>C<=0)){var ke,Y;let C=(((ke=r.flip)==null?void 0:ke.index)||0)+1,X=j[C];if(X&&(!(d==="alignment"?y!==H(X):false)||F.every(G=>H(G.placement)===y?G.overflows[0]>0:true)))return {data:{index:C,overflows:F},reset:{placement:X}};let M=(Y=F.filter(L=>L.overflows[0]<=0).sort((L,G)=>L.overflows[1]-G.overflows[1])[0])==null?void 0:Y.placement;if(!M)switch(f){case "bestFit":{var Se;let L=(Se=F.filter(G=>{if(k){let W=H(G.placement);return W===y||W==="y"}return true}).map(G=>[G.placement,G.overflows.filter(W=>W>0).reduce((W,sn)=>W+sn,0)]).sort((G,W)=>G[1]-W[1])[0])==null?void 0:Se[0];L&&(M=L);break}case "initialPlacement":M=a;break}if(i!==M)return {reset:{placement:M}}}return {}}}};var Sn=new Set(["left","top"]);async function En(n,e){let{placement:t,platform:o,elements:i}=n,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=K(t),a=ae(t),l=H(t)==="y",c=Sn.has(s)?-1:1,u=r&&l?-1:1,d=se(e,n),{mainAxis:p,crossAxis:f,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof h=="number"&&(f=a==="end"?h*-1:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}var Ft=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,o;let{x:i,y:r,placement:s,middlewareData:a}=e,l=await En(e,n);return s===((t=a.offset)==null?void 0:t.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:s}}}}},Mt=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){let{x:t,y:o,placement:i,platform:r}=e,{mainAxis:s=true,crossAxis:a=false,limiter:l={fn:v=>{let{x:y,y:b}=v;return {x:y,y:b}}},...c}=se(n,e),u={x:t,y:o},d=await r.detectOverflow(e,c),p=H(K(i)),f=st(p),h=u[f],m=u[p];if(s){let v=f==="y"?"top":"left",y=f==="y"?"bottom":"right",b=h+d[v],x=h-d[y];h=Be(b,h,x);}if(a){let v=p==="y"?"top":"left",y=p==="y"?"bottom":"right",b=m+d[v],x=m-d[y];m=Be(b,m,x);}let g=l.fn({...e,[f]:h,[p]:m});return {...g,data:{x:g.x-t,y:g.y-o,enabled:{[f]:s,[p]:a}}}}}};function ze(){return typeof window<"u"}function ee(n){return Bt(n)?(n.nodeName||"").toLowerCase():"#document"}function E(n){var e;return (n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function O(n){var e;return (e=(Bt(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Bt(n){return ze()?n instanceof Node||n instanceof E(n).Node:false}function I(n){return ze()?n instanceof Element||n instanceof E(n).Element:false}function D(n){return ze()?n instanceof HTMLElement||n instanceof E(n).HTMLElement:false}function Ht(n){return !ze()||typeof ShadowRoot>"u"?false:n instanceof ShadowRoot||n instanceof E(n).ShadowRoot}function le(n){let{overflow:e,overflowX:t,overflowY:o,display:i}=P(n);return /auto|scroll|overlay|hidden|clip/.test(e+o+t)&&i!=="inline"&&i!=="contents"}function Wt(n){return /^(table|td|th)$/.test(ee(n))}function Ae(n){try{if(n.matches(":popover-open"))return !0}catch{}try{return n.matches(":modal")}catch{return false}}var Rn=/transform|translate|scale|rotate|perspective|filter/,In=/paint|layout|strict|content/,Z=n=>!!n&&n!=="none",lt;function Ke(n){let e=I(n)?P(n):n;return Z(e.transform)||Z(e.translate)||Z(e.scale)||Z(e.rotate)||Z(e.perspective)||!qe()&&(Z(e.backdropFilter)||Z(e.filter))||Rn.test(e.willChange||"")||In.test(e.contain||"")}function $t(n){let e=B(n);for(;D(e)&&!te(e);){if(Ke(e))return e;if(Ae(e))return null;e=B(e);}return null}function qe(){return lt==null&&(lt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),lt}function te(n){return /^(html|body|#document)$/.test(ee(n))}function P(n){return E(n).getComputedStyle(n)}function Le(n){return I(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function B(n){if(ee(n)==="html")return n;let e=n.assignedSlot||n.parentNode||Ht(n)&&n.host||O(n);return Ht(e)?e.host:e}function Ut(n){let e=B(n);return te(e)?n.ownerDocument?n.ownerDocument.body:n.body:D(e)&&le(e)?e:Ut(e)}function Ue(n,e,t){var o;e===void 0&&(e=[]);let i=Ut(n),r=i===((o=n.ownerDocument)==null?void 0:o.body),s=E(i);if(r){je(s);return e.concat(s,s.visualViewport||[],le(i)?i:[],[])}else return e.concat(i,Ue(i,[]))}function je(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function jt(n){let e=P(n),t=parseFloat(e.width)||0,o=parseFloat(e.height)||0,i=D(n),r=i?n.offsetWidth:t,s=i?n.offsetHeight:o,a=Te(t)!==r||Te(o)!==s;return a&&(t=r,o=s),{width:t,height:o,$:a}}function Vt(n){return I(n)?n:n.contextElement}function ce(n){let e=Vt(n);if(!D(e))return _(1);let t=e.getBoundingClientRect(),{width:o,height:i,$:r}=jt(e),s=(r?Te(t.width):t.width)/o,a=(r?Te(t.height):t.height)/i;return (!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var Pn=_(0);function Yt(n){let e=E(n);return !qe()||!e.visualViewport?Pn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Tn(n,e,t){return e===void 0&&(e=false),!t||e&&t!==E(n)?false:e}function Ge(n,e,t,o){e===void 0&&(e=false),t===void 0&&(t=false);let i=n.getBoundingClientRect(),r=Vt(n),s=_(1);e&&(o?I(o)&&(s=ce(o)):s=ce(n));let a=Tn(r,t,o)?Yt(r):_(0),l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,d=i.height/s.y;if(r){let p=E(r),f=o&&I(o)?E(o):o,h=p,m=je(h);for(;m&&o&&f!==h;){let g=ce(m),v=m.getBoundingClientRect(),y=P(m),b=v.left+(m.clientLeft+parseFloat(y.paddingLeft))*g.x,x=v.top+(m.clientTop+parseFloat(y.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,d*=g.y,l+=b,c+=x,h=E(m),m=je(h);}}return J({width:u,height:d,x:l,y:c})}function Ve(n,e){let t=Le(n).scrollLeft;return e?e.left+t:Ge(O(n)).left+t}function Xt(n,e){let t=n.getBoundingClientRect(),o=t.left+e.scrollLeft-Ve(n,t),i=t.top+e.scrollTop;return {x:o,y:i}}function An(n){let{elements:e,rect:t,offsetParent:o,strategy:i}=n,r=i==="fixed",s=O(o),a=e?Ae(e.floating):false;if(o===s||a&&r)return t;let l={scrollLeft:0,scrollTop:0},c=_(1),u=_(0),d=D(o);if((d||!d&&!r)&&((ee(o)!=="body"||le(s))&&(l=Le(o)),d)){let f=Ge(o);c=ce(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop;}let p=s&&!d&&!r?Xt(s,l):_(0);return {width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:t.y*c.y-l.scrollTop*c.y+u.y+p.y}}function Ln(n){return Array.from(n.getClientRects())}function Gn(n){let e=O(n),t=Le(n),o=n.ownerDocument.body,i=z(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=z(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight),s=-t.scrollLeft+Ve(n),a=-t.scrollTop;return P(o).direction==="rtl"&&(s+=z(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:a}}var zt=25;function _n(n,e){let t=E(n),o=O(n),i=t.visualViewport,r=o.clientWidth,s=o.clientHeight,a=0,l=0;if(i){r=i.width,s=i.height;let u=qe();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop);}let c=Ve(o);if(c<=0){let u=o.ownerDocument,d=u.body,p=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(o.clientWidth-d.clientWidth-f);h<=zt&&(r-=h);}else c<=zt&&(r+=c);return {width:r,height:s,x:a,y:l}}function Nn(n,e){let t=Ge(n,true,e==="fixed"),o=t.top+n.clientTop,i=t.left+n.clientLeft,r=D(n)?ce(n):_(1),s=n.clientWidth*r.x,a=n.clientHeight*r.y,l=i*r.x,c=o*r.y;return {width:s,height:a,x:l,y:c}}function Kt(n,e,t){let o;if(e==="viewport")o=_n(n,t);else if(e==="document")o=Gn(O(n));else if(I(e))o=Nn(e,t);else {let i=Yt(n);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height};}return J(o)}function Qt(n,e){let t=B(n);return t===e||!I(t)||te(t)?false:P(t).position==="fixed"||Qt(t,e)}function On(n,e){let t=e.get(n);if(t)return t;let o=Ue(n,[]).filter(a=>I(a)&&ee(a)!=="body"),i=null,r=P(n).position==="fixed",s=r?B(n):n;for(;I(s)&&!te(s);){let a=P(s),l=Ke(s);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||le(s)&&!l&&Qt(n,s))?o=o.filter(u=>u!==s):i=a,s=B(s);}return e.set(n,o),o}function Dn(n){let{element:e,boundary:t,rootBoundary:o,strategy:i}=n,s=[...t==="clippingAncestors"?Ae(e)?[]:On(e,this._c):[].concat(t),o],a=Kt(e,s[0],i),l=a.top,c=a.right,u=a.bottom,d=a.left;for(let p=1;p<s.length;p++){let f=Kt(e,s[p],i);l=z(f.top,l),c=Q(f.right,c),u=Q(f.bottom,u),d=z(f.left,d);}return {width:c-d,height:u-l,x:d,y:l}}function Fn(n){let{width:e,height:t}=jt(n);return {width:e,height:t}}function Mn(n,e,t){let o=D(e),i=O(e),r=t==="fixed",s=Ge(n,true,r,e),a={scrollLeft:0,scrollTop:0},l=_(0);function c(){l.x=Ve(i);}if(o||!o&&!r)if((ee(e)!=="body"||le(i))&&(a=Le(e)),o){let f=Ge(e,true,r,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop;}else i&&c();r&&!o&&i&&c();let u=i&&!o&&!r?Xt(i,a):_(0),d=s.left+a.scrollLeft-l.x-u.x,p=s.top+a.scrollTop-l.y-u.y;return {x:d,y:p,width:s.width,height:s.height}}function ct(n){return P(n).position==="static"}function qt(n,e){if(!D(n)||P(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return O(n)===t&&(t=t.ownerDocument.body),t}function Jt(n,e){let t=E(n);if(Ae(n))return t;if(!D(n)){let i=B(n);for(;i&&!te(i);){if(I(i)&&!ct(i))return i;i=B(i);}return t}let o=qt(n,e);for(;o&&Wt(o)&&ct(o);)o=qt(o,e);return o&&te(o)&&ct(o)&&!Ke(o)?t:o||$t(n)||t}var Hn=async function(n){let e=this.getOffsetParent||Jt,t=this.getDimensions,o=await t(n.floating);return {reference:Mn(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Bn(n){return P(n).direction==="rtl"}var Wn={convertOffsetParentRelativeRectToViewportRelativeRect:An,getDocumentElement:O,getClippingRect:Dn,getOffsetParent:Jt,getElementRects:Hn,getClientRects:Ln,getDimensions:Fn,getScale:ce,isElement:I,isRTL:Bn};var de=Ft;var ue=Mt,pe=Dt;var Ye=Ot;var fe=(n,e,t)=>{let o=new Map,i={platform:Wn,...t},r={...i.platform,_c:o};return Nt(n,e,{...i,platform:r})};function T(n,e=5e3){return new Promise(t=>{let o=()=>{try{return document.querySelector(n)}catch{return null}},i=o();if(i){t(i);return}let r=false,s=c=>{r||(r=true,a.disconnect(),clearTimeout(l),t(c));},a=new MutationObserver(()=>{let c=o();c&&s(c);});a.observe(document.body,{childList:true,subtree:true});let l=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 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 o=Array.from(t,i=>i.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 Xe(n,e,t,o){let i=n.createElement("iframe");i.className="veo-custom-frame",i.setAttribute("sandbox","allow-scripts"),i.setAttribute("title",t.guide.guideName||"OnUser"),i.style.width=o.width;let r=o.fixedHeight!==void 0&&o.fixedHeight!==null;r&&(i.style.height=ut(o.fixedHeight));let s=Zt(),a=e.style?.tailwind===true;i.srcdoc=qn(e.html??"",e.css??"",e.js??"",s,{hostCss:Un(),htmlAttrs:zn(),tailwind:a});let l=()=>t.onClose(),c=u=>{if(u.source!==i.contentWindow)return;let d=u.data;if(!(!d||typeof d!="object"||d.__veo!==s))switch(d.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 d.url=="string"&&N(d.url)&&window.open(d.url,"_blank","noopener,noreferrer"),d.close!==false&&l();break;case "navigate":typeof d.url=="string"&&N(d.url)&&window.location.assign(d.url);break;case "track":typeof d.name=="string"&&t.onTrack&&t.onTrack(d.name,Kn(d.props)?d.props:void 0);break;case "resize":!r&&typeof d.height=="number"&&d.height>0&&(i.style.height=`${Math.ceil(d.height)}px`);break}};return window.addEventListener("message",c),{iframe:i,cleanup:()=>window.removeEventListener("message",c)}}function ut(n){return typeof n=="number"?`${n}px`:n}var $n=800*1024;function Un(){if(typeof document>"u")return "";let n="";try{for(let e of Array.from(document.styleSheets)){let t=null;try{t=e.cssRules;}catch{continue}if(t){for(let o of Array.from(t))if(n+=`${o.cssText}
|
|
292
|
-
`,n.length>$n)return n}}}catch{return n}return n}function zn(){if(typeof document>"u")return "";try{let n=document.documentElement,e=[];for(let t of ["class","style","data-theme","data-mode","data-color-mode"]){let o=n.getAttribute(t);o&&o.length<=1e3&&!/["<>]/.test(o)&&e.push(`${t}="${o}"`);}return e.join(" ")}catch{return ""}}function Kn(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function qn(n,e,t,o,i){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(){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>${dt(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>${dt(e,"style")}</style></head><body style="margin:0!important;background:transparent!important;min-height:0!important;height:auto!important;"><div id="__veo_root">${n}</div><script>${r}</script>`+(t?`<script>${dt(t,"script")}</script>`:"")+"</body></html>"}function dt(n,e){let t=e==="script"?/<\/script/gi:/<\/style/gi;return n.replace(t,`<\\/${e}`)}var jn={mode:"floating",position:"bottom-right"},en=16,Vn=360,he=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let o=t.placement??jn,i=null;if(o.mode==="anchored"){let u=o.selector??t.selector??e.guide.activationRules.selector;if(typeof u!="string"||u.length===0||(i=await T(u),!i))return}let{root:r}=this.createHost(),s=r.ownerDocument??document,a=s.createElement("div");a.className=o.mode==="anchored"?"veo-custom-anchored":"veo-custom-floating";let{iframe:l,cleanup:c}=Xe(s,t,e,{width:ut(o.width??Vn),fixedHeight:o.height??null});this.registerCleanup(c),a.appendChild(l),r.appendChild(a),o.mode==="floating"?Yn(a,o):i&&this.registerCleanup(await this.setupAnchoredPosition(i,a,o)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}async setupAnchoredPosition(e,t,o){let i=o.side??"bottom",r=async()=>{let{x:a,y:l}=await fe(e,t,{placement:i,strategy:"fixed",middleware:[de(o.offsetY??8),pe(),ue({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 Yn(n,e){let t=e.position??"bottom-right",o=`${e.offsetX??en}px`,i=`${e.offsetY??en}px`,r=n.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=o:a==="right"?r.right=o:(r.left="50%",r.transform="translateX(-50%)");}function Qe(n,e,t){let o=e.guide.guideSteps[0];if(!o)return;let i=o.fields??[],r=()=>{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 p=t.createElement("h2");p.className="veo-guide-title",p.textContent=o.title,s.appendChild(p);}if(o.content){let p=t.createElement("p");p.className="veo-guide-text",p.textContent=o.content,s.appendChild(p);}let a=[],l=t.createElement("form");l.className="veo-form",l.noValidate=true;for(let p of i){let{wrapper:f,read:h}=Qn(p,t);a.push({field:p,read:h}),l.appendChild(f);}let c=t.createElement("p");c.className="veo-form-error",c.style.display="none",l.appendChild(c);let u=t.createElement("div");u.className="veo-guide-actions";let d=t.createElement("button");d.type="submit",d.className="veo-guide-cta",d.textContent=o.ctaText||"Enviar",u.appendChild(d),l.appendChild(u),l.addEventListener("submit",p=>{p.preventDefault(),c.style.display="none";let f={};for(let{field:m,read:g}of a){let v=g();if(v==null||v===""){if(m.required){c.textContent=`Completa "${m.label}"`,c.style.display="block";return}continue}f[m.key]=v;}if(Object.keys(f).length===0){c.textContent="Responde al menos un campo",c.style.display="block";return}d.disabled=true,(e.onFormSubmit??(()=>Promise.resolve(true)))(f).then(m=>{if(!m){d.disabled=false,c.textContent="No se pudo enviar. Prueba de nuevo.",c.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;Xn(n,t,g),window.setTimeout(()=>e.onClose(),g?2200:1400);});}),s.appendChild(l),s.appendChild(Re(t,r)),n.appendChild(s);}function Xn(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 i=e.createElement("p");i.className="veo-form-preview-note",i.textContent=t,n.appendChild(i);}}function Qn(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 i=e.createElement("textarea");return i.className="veo-form-input",i.rows=3,n.placeholder&&(i.placeholder=n.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",n.placeholder&&(i.placeholder=n.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=n.placeholder||"Elige una opci\xF3n\u2026",i.appendChild(r);for(let s of n.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-${n.key}`,s=[];for(let a of n.options??[]){let l=e.createElement("label");l.className="veo-form-option";let c=e.createElement("input");c.type="radio",c.name=r,c.value=a,s.push(c);let u=e.createElement("span");u.textContent=a,l.appendChild(c),l.appendChild(u),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 n.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 c=e.createElement("span");c.textContent=s,a.appendChild(l),a.appendChild(c),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=n.placeholder||"S\xED",i.appendChild(r),i.appendChild(s),t.appendChild(i),{wrapper:t,read:()=>r.checked?true:n.required?"":false}}case "yesno":{let i=e.createElement("div");i.className="veo-form-options";let r=`veo-${n.key}`,[s,a]=n.options?.length===2?n.options:["S\xED","No"],l=[];for(let{label:c,value:u}of [{label:s,value:true},{label:a,value:false}]){let d=e.createElement("label");d.className="veo-form-option";let p=e.createElement("input");p.type="radio",p.name=r,l.push({input:p,value:u});let f=e.createElement("span");f.textContent=c,d.appendChild(p),d.appendChild(f),i.appendChild(d);}return t.appendChild(i),{wrapper:t,read:()=>l.find(c=>c.input.checked)?.value}}case "nps":return tn(t,e,0,10,"veo-nps-btn");case "rating":return tn(t,e,1,5,"veo-rating-btn","\u2605");default:{let i=e.createElement("input");return i.type="text",i.className="veo-form-input",n.placeholder&&(i.placeholder=n.placeholder),t.appendChild(i),{wrapper:t,read:()=>i.value.trim()}}}}function tn(n,e,t,o,i,r){let s=e.createElement("div");s.className="veo-form-scale";let a,l=[];for(let c=t;c<=o;c++){let u=e.createElement("button");u.type="button",u.className=i,u.textContent=r??String(c),u.setAttribute("aria-label",String(c)),u.addEventListener("click",()=>{a=c,l.forEach((d,p)=>{let f=r?p+t<=c:p+t===c;d.classList.toggle("veo-scale-active",f);});}),l.push(u),s.appendChild(u);}return n.appendChild(s),{wrapper:n,read:()=>a}}var me=class extends w{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 i=o.ownerDocument??document,r=i.createElement("div");r.className="veo-modal-overlay";let s=i.createElement("div");s.className="veo-modal-card",Qe(s,e,i),r.appendChild(s),o.appendChild(r);let a=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();};r.addEventListener("click",c=>{c.target===r&&a();});let l=c=>{c.key==="Escape"&&a();};document.addEventListener("keydown",l),this.registerCleanup(()=>document.removeEventListener("keydown",l)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};function ne(n){let e=n?.inlinePosition;return e==="before"||e==="prepend"||e==="append"?e:"after"}function oe(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 ge(n,e,t){let o=window.setInterval(()=>{if(n.isConnected)return;let i=document.querySelector(e);i&&oe(i,n,t);},1e3);return ()=>window.clearInterval(o)}var ve=class extends w{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 i=await T(o);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=ne(t.style);oe(i,r,a),this.registerCleanup(ge(r,o,a));let l=s.ownerDocument??document,c=l.createElement("div");c.className="veo-custom-inline";let{iframe:u,cleanup:d}=Xe(l,t,e,{width:"100%"});this.registerCleanup(d),c.appendChild(u),s.appendChild(c),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var ye=class extends w{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 i=await T(o);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=ne(t.style);oe(i,r,a),this.registerCleanup(ge(r,o,a)),this.applyDesign(t.style);let l=s.ownerDocument??document,c=l.createElement("div");c.className="veo-inline",Qe(c,e,l),s.appendChild(c),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var we=class extends w{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 i=await T(o);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=ne(t.style);oe(i,r,a),this.registerCleanup(ge(r,o,a)),this.applyDesign(t.style);let l=s.ownerDocument??document,c=l.createElement("div");c.className="veo-inline";let u=(p,f)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:p}),f&&window.open(f,"_blank","noopener,noreferrer"),e.onClose();},d=R(t,l,{onCtaClick:(p,f)=>u("cta_clicked",p==="url"?f:void 0),onDismiss:()=>u("dismissed")});c.appendChild(d),s.appendChild(c),this.liveContainer=c,this.liveContent=d,this.liveKey=`${o}|${a}`,this.liveBuild=p=>R(p,l,{onCtaClick:(f,h)=>u("cta_clicked",f==="url"?h:void 0),onDismiss:()=>u("dismissed")}),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}liveKeyOf(e){return `${e.selector??""}|${ne(e.style)}`}};var q=class extends w{render(e){let t=e.nav?.stepIndex??0,o=e.guide.guideSteps[t];if(!o)return;let{root:i}=this.createHost();this.applyDesign(o.style);let r=i.ownerDocument??document,s=r.createElement("div");s.className="veo-modal-overlay";let a=r.createElement("div");a.className="veo-modal-card";let l=(p,f)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:t,action:p}),f&&window.open(f,"_blank","noopener,noreferrer"),e.onClose();},c=()=>{e.nav?e.nav.callbacks.onSkip():l("dismissed");},u=e.nav?re(o,e.nav.stepIndex,e.nav.totalSteps,r,e.nav.callbacks):R(o,r,{onCtaClick:(p,f)=>l("cta_clicked",p==="url"?f:void 0),onDismiss:()=>l("dismissed")});a.appendChild(u),s.appendChild(a),i.appendChild(s),e.nav||(this.liveContainer=a,this.liveContent=u,this.liveBuild=p=>R(p,r,{onCtaClick:(f,h)=>l("cta_clicked",f==="url"?h:void 0),onDismiss:()=>l("dismissed")})),s.addEventListener("click",p=>{p.target===s&&c();});let d=p=>{p.key==="Escape"&&c();};document.addEventListener("keydown",d),this.registerCleanup(()=>document.removeEventListener("keydown",d)),e.nav||e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var Jn={top:"bottom",bottom:"top",left:"right",right:"left"};function Je(n,e,t){let o=Jn[e.split("-")[0]??"bottom"]??"top";for(let i of ["top","bottom","left","right"])n.style.setProperty(i,"");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 be=class extends w{constructor(){super(...arguments);this.side="bottom";this.reposition=null;}async render(t){let o=t.guide.guideSteps[0];if(!o)return;let i=o.selector??t.guide.activationRules.selector;if(typeof i!="string"||i.length===0)return;let r=await T(i);if(!r)return;let s=o.style?.tooltipPlacement;this.side=s==="top"||s==="left"||s==="right"?s:"bottom";let{root:a}=this.createHost();this.applyDesign(o.style);let l=a.ownerDocument??document,c=l.createElement("div");c.className="veo-tooltip";let u=(m,g)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:m}),g&&window.open(g,"_blank","noopener,noreferrer"),t.onClose();},d=R(o,l,{onCtaClick:(m,g)=>{u("cta_clicked",m==="url"?g:void 0);},onDismiss:()=>u("dismissed")});c.appendChild(d);let p=l.createElement("div");p.className="veo-tooltip-arrow",c.appendChild(p),a.appendChild(c);let f=async()=>{let{x:m,y:g,placement:v,middlewareData:y}=await fe(r,c,{placement:this.side,middleware:[de(10),pe(),ue({padding:8}),Ye({element:p})]});c.style.left=`${m}px`,c.style.top=`${g}px`,Je(p,v,y.arrow);};await f();let h=()=>{f();};this.reposition=h,window.addEventListener("scroll",h,true),window.addEventListener("resize",h),this.registerCleanup(()=>{window.removeEventListener("scroll",h,true),window.removeEventListener("resize",h);}),this.liveContainer=c,this.liveContent=d,this.liveKey=i,this.liveBuild=m=>R(m,l,{onCtaClick:(g,v)=>u("cta_clicked",g==="url"?v:void 0),onDismiss:()=>u("dismissed")}),t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}liveKeyOf(t){return t.selector??""}onLiveUpdate(t){let o=t.style?.tooltipPlacement;this.side=o==="top"||o==="left"||o==="right"?o:"bottom",this.reposition?.();}};var xe=class extends w{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 i=await T(o,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,c=l.createElement("div");c.className="veo-walkthrough";let u=re(t,e.currentStepIndex,e.guide.guideSteps.length,l,e.callbacks);c.appendChild(u);let d=l.createElement("div");d.className="veo-walkthrough-arrow",c.appendChild(d),a.appendChild(c);let p=async()=>{let{x:h,y:m,placement:g,middlewareData:v}=await fe(i,c,{placement:s,middleware:[de(10),pe(),ue({padding:8}),Ye({element:d})]});c.style.left=`${h}px`,c.style.top=`${m}px`,Je(d,g,v.arrow);};await p();let f=()=>{p();};return window.addEventListener("scroll",f,true),window.addEventListener("resize",f),this.registerCleanup(()=>{window.removeEventListener("scroll",f,true),window.removeEventListener("resize",f);}),true}};var Ze=class{constructor(e){this.state=null;this.storageKey=`${vt}${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 eo={shown:"shown",dismissed:"dismissed",cta_clicked:null,step_advanced:null,step_back:null,completed:"completed"},et=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 Oe(t.apiUrl,t.apiKey,this.debug),t.trackerQueue)this.trackerQueue=t.trackerQueue;else {let i=new De(t.apiUrl,t.apiKey);this.trackerQueue=new Fe({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 o=bt(t.apiKey);this.frequencyCache=t.frequencyCache??new Ne(o),this.walkthroughState=t.walkthroughState??new Ze(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 i;try{i=await this.resolver.resolve(o,e);}catch(r){this.debug&&console.error("[veo] guides resolver threw:",r);return}this.debug&&console.log(`[veo] guides: ${i.length} eligible at ${e}`);for(let r of i){if(this.frequencyCache.shouldFilter(r.guideId,r.displayFrequency)){this.debug&&console.log(`[veo] guides: filtered locally guideId=${r.guideId}`);continue}if(this.activeByGuideId.has(r.guideId)){this.debug&&console.log(`[veo] guides: already shown guideId=${r.guideId}`);continue}if(r.guideType==="walkthrough"&&r.guideSteps.length>1){if(this.walkthroughState.hasActive()){this.debug&&console.log(`[veo] guides: walkthrough ${r.guideId} skipped (another active)`);continue}await this.startWalkthrough(r,o,t,e);continue}this.runSingleStepRender(r,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 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,o),r);}mountSingleStepRenderer(e,t,o,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,o,i,c);},a=(c,u)=>{this.client.track(c,u);},l=c=>this.submitFormResponse(e.guideId,c);try{t.render({guide:e,onInteraction:s,onClose:r,onTrack:a,onFormSubmit:l});}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 tryResumeWalkthrough(e,t,o){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,o),true}async startWalkthrough(e,t,o,i){this.walkthroughState.start(e.guideId,e.guideSteps.length),await this.renderWalkthroughStep(e,0,t,o,i)&&(this.enqueueInteractionOnce(e.guideId,t,o,i,"shown",0),this.frequencyCache.record(e.guideId,"shown"));}async renderWalkthroughStep(e,t,o,i,r){this.activeWalkthroughRenderer&&(this.activeWalkthroughRenderer.destroy(),this.activeWalkthroughRenderer=null),this.activeWalkthroughGuide=e;let s={onNext:()=>this.handleWalkthroughNext(o,i,r),onBack:()=>this.handleWalkthroughBack(o,i,r),onSkip:()=>this.handleWalkthroughSkip(o,i,r),onComplete:()=>this.handleWalkthroughComplete(o,i,r)},a=e.guideSteps[t],l=to(a);if(l==="modal"||l==="banner"){let d=l==="modal"?new q:new U;try{d.render({guide:e,onInteraction:()=>{},onClose:()=>{},nav:{stepIndex:t,totalSteps:e.guideSteps.length,callbacks:s}});}catch(p){return this.debug&&console.error("[veo] sequence renderer threw:",p),this.tearDownWalkthrough(),false}return this.activeWalkthroughRenderer=d,true}let c=new xe,u=false;try{u=await c.render({guide:e,currentStepIndex:t,callbacks:s});}catch(d){this.debug&&console.error("[veo] walkthrough renderer threw:",d);}return u?(this.activeWalkthroughRenderer=c,true):(this.debug&&console.warn(`[veo] walkthrough ${e.guideId} step ${t} could not render, cancelling`),this.tearDownWalkthrough(),false)}handleWalkthroughNext(e,t,o){let i=this.activeWalkthroughGuide;if(!i)return;let r=this.walkthroughState.advance();if(!r){this.handleWalkthroughComplete(e,t,o);return}this.enqueueInteraction(i.guideId,e,t,o,"step_advanced",r.currentStepIndex),this.renderWalkthroughStep(i,r.currentStepIndex,e,t,o);}handleWalkthroughBack(e,t,o){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,o,"step_back",s.currentStepIndex),this.renderWalkthroughStep(i,s.currentStepIndex,e,t,o));}handleWalkthroughSkip(e,t,o){let i=this.activeWalkthroughGuide,r=this.walkthroughState.current();!i||!r||(this.enqueueInteraction(i.guideId,e,t,o,"dismissed",r.currentStepIndex),this.frequencyCache.record(i.guideId,"dismissed"),this.tearDownWalkthrough());}handleWalkthroughComplete(e,t,o){let i=this.activeWalkthroughGuide,r=this.walkthroughState.current();!i||!r||(this.enqueueInteraction(i.guideId,e,t,o,"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,o,i){let r=`${e.guideId}:${i.action}`;if(this.dispatched.has(r)){this.debug&&console.log(`[veo] guides: dedup hit ${r}`);return}this.dispatched.add(r);let s=eo[i.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:i.action,stepIndex:i.stepIndex,pageUrl:o,pagePath:nn(o)}});}enqueueInteraction(e,t,o,i,r,s){this.trackerQueue.enqueue({guideId:e,payload:{endUserId:t,sessionId:o,action:r,stepIndex:s,pageUrl:i,pagePath:nn(i)}});}enqueueInteractionOnce(e,t,o,i,r,s){let a=`${e}:${r}:${s}`;this.dispatched.has(a)||(this.dispatched.add(a),this.enqueueInteraction(e,t,o,i,r,s));}createSingleStepRenderer(e){switch(e){case "modal":return new q;case "banner":return new U;case "tooltip":return new be;case "custom":return new he;case "inline":return new we;case "inline-custom":return new ve;case "form":return new me;case "inline-form":return new ye;case "walkthrough":return null}}async submitFormResponse(e,t){let o=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:o,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 nn(n){try{return new URL(n).pathname}catch{return "/"}}function to(n){let e=n?.style?.render;return typeof e=="string"?e:"walkthrough"}var no="__veo_preview__",pt=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})};this.close(),this.input=e;let o=oo(e),i=typeof e.startStepIndex=="number"?e.startStepIndex:0,r=o.guideType==="walkthrough"?this.startWalkthrough(o,i):this.renderSingleStep(o);return {close:()=>this.close(),ready:r}}close(){this.singleStep&&(ie(this.singleStep),this.singleStep=null),this.walkthrough&&(ie(this.walkthrough),this.walkthrough=null),this.walkthroughGuide=null,this.walkthroughIndex=0,this.input=null;}async renderSingleStep(e){let t=io(e.guideType);if(!t)return {rendered:false};this.singleStep=t;let o=false;try{await t.render({guide:e,onInteraction:i=>{i.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?(ie(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&&(ie(this.walkthrough),this.walkthrough=null);let o={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 q:new U;try{l.render({guide:t,onInteraction:()=>{},onClose:()=>this.close(),nav:{stepIndex:e,totalSteps:t.guideSteps.length,callbacks:o}});}catch{return ie(l),false}return this.walkthroughGuide!==t?(ie(l),false):(this.walkthrough=l,true)}let s=new xe,a=false;try{a=await s.render({guide:t,currentStepIndex:e,callbacks:o});}catch{a=false;}return !a||this.walkthroughGuide!==t?(ie(s),false):(this.walkthrough=s,true)}},tt=null;function nt(n){return _e()?(tt||(tt=new pt),tt.preview(n)):{close:()=>{},ready:Promise.resolve({rendered:false})}}function on(){tt?.close();}function oo(n){let e=n.activationRules?.selector,t={url:n.activationRules?.url??{type:"prefix",pattern:"/"},trigger:"immediate",...e!==void 0?{selector:e}:{}};return {guideId:no,guideName:n.guideName??"Preview",guideType:n.guideType,guideSteps:n.guideSteps,activationRules:t,displayFrequency:"always",displayPriority:0}}function io(n){switch(n){case "modal":return new q;case "banner":return new U;case "tooltip":return new be;case "custom":return new he;case "inline":return new we;case "inline-custom":return new ve;case "form":return new me;case "inline-form":return new ye;case "walkthrough":return null}}function ie(n){try{n.destroy();}catch{}}var ot=null;async function rn(n){if(!_e())return null;ot?.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 l=window.veo,c=l?.getEndUserId?.()??l?.getAnonymousId?.()??null;if(!c)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:c,answers:a})})).ok}catch{return false}},o=null,i=()=>{e&&(o?.close(),o=nt({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=ro({label:e?`Vista previa: ${e.guideName}`:"Link de preview inv\xE1lido o vencido",error:!e,onReshow:e?i:null,onClose:()=>s.teardown()}),s={teardown(){o?.close(),o=null,r.remove(),ot===s&&(ot=null);}};return ot=s,i(),s}function ro(n){let e=document.createElement("div");e.setAttribute("data-veo-preview-chip","");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=`
|
|
372
|
+
`;var x=class{constructor(){this.host=null;this.shadow=null;this.cleanups=[];this.liveContainer=null;this.liveContent=null;this.liveBuild=null;this.liveKey="";}liveKeyOf(t){return ""}onLiveUpdate(t){}updateStep(t){if(!this.host||!this.liveContainer||!this.liveContent||!this.liveBuild||this.liveKeyOf(t)!==this.liveKey)return false;let e=this.liveBuild(t);return this.liveContainer.replaceChild(e,this.liveContent),this.liveContent=e,this.applyDesign(t.style),this.onLiveUpdate(t),true}createHost(){let t=document.createElement("div");t.setAttribute(yt,"");let e=t.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=on,e.appendChild(o);let i=document.createElement("div");return e.appendChild(i),document.body.appendChild(t),this.host=t,this.shadow=e,{host:t,shadow:e,root:i}}applyDesign(t){this.host&&nn(this.host,t);}registerCleanup(t){this.cleanups.push(t);}hostElement(){return this.host}destroy(){for(let t of this.cleanups)try{t();}catch{}this.cleanups=[],this.host?.parentNode&&this.host.parentNode.removeChild(this.host),this.host=null,this.shadow=null;}};var to={top:"bottom",bottom:"top",left:"right",right:"left"};function he(n,t,e){let o=to[t.split("-")[0]??"bottom"]??"top";for(let i of ["top","bottom","left","right"])n.style.setProperty(i,"");e?.x!=null&&n.style.setProperty("left",`${e.x}px`),e?.y!=null&&n.style.setProperty("top",`${e.y}px`),n.style.setProperty(o,"-6px");}var no=150,ge=class extends x{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(e){let o=e.guide.guideSteps[0];if(!o)return;let i=o.selector??e.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(o.style),this.trigger=o.style?.badgeTrigger==="click"?"click":"hover";let c=o.style?.tooltipPlacement;this.side=c==="bottom"||c==="left"||c==="right"?c:"top";let u=F(o.style);s.style.display="inline-flex",s.style.verticalAlign="middle";let d=sn(rn(o),l);a.appendChild(d),this.badgeBtn=d,M(r,s,u),this.registerCleanup(H(s,i,u));let f=l.createElement("div");f.className="veo-tooltip veo-badge-tooltip",f.style.display="none";let p=(y,b)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:y,...b?{metadata:b}:{}});},m=y=>A(y,l,{onCtaClick:(b,R,C)=>{if(p("cta_clicked",C),b==="url"&&R&&window.open(R,"_blank","noopener,noreferrer"),b==="dismiss"){p("dismissed"),e.onClose();return}this.closeTooltip();},onDismiss:()=>{p("dismissed"),e.onClose();}}),h=m(o);f.appendChild(h);let g=l.createElement("div");g.className="veo-tooltip-arrow",f.appendChild(g),a.appendChild(f),this.tooltip=f,this.arrowEl=g,this.liveContainer=f,this.liveContent=h,this.liveKey=this.liveKeyOf(o),this.liveBuild=m;let v=()=>{this.cancelClose(),this.open||(this.openTooltip(d),this.shownEmitted||(this.shownEmitted=true,p("shown")));};if(this.trigger==="hover"){let y=()=>{this.cancelClose(),this.closeTimer=window.setTimeout(()=>this.closeTooltip(),no);};d.addEventListener("mouseenter",v),d.addEventListener("focus",v),d.addEventListener("mouseleave",y),d.addEventListener("blur",y),f.addEventListener("mouseenter",()=>this.cancelClose()),f.addEventListener("mouseleave",y);}else {d.addEventListener("click",()=>{this.open?this.closeTooltip():v();});let y=b=>{this.open&&(b.composedPath().includes(s)||this.closeTooltip());};document.addEventListener("click",y,true),this.registerCleanup(()=>document.removeEventListener("click",y,true));}let w=y=>{y.key==="Escape"&&this.open&&this.closeTooltip();};document.addEventListener("keydown",w),this.registerCleanup(()=>document.removeEventListener("keydown",w)),e.isPreview&&v();}liveKeyOf(e){let o=e.selector??"",i=F(e.style),r=e.style?.badgeTrigger==="click"?"click":"hover";return `${o}|${i}|${r}`}onLiveUpdate(e){if(this.badgeBtn){let i=this.badgeBtn.ownerDocument,r=sn(rn(e),i);this.badgeBtn.className=r.className,this.badgeBtn.setAttribute("style",r.getAttribute("style")??""),this.badgeBtn.replaceChildren(...Array.from(r.childNodes));}let o=e.style?.tooltipPlacement;this.side=o==="bottom"||o==="left"||o==="right"?o:"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(e){if(!this.tooltip)return;this.tooltip.style.display="block",this.open=true,this.position(e);let o=()=>{this.position(e);};window.addEventListener("scroll",o,true),window.addEventListener("resize",o),this.stopFloat=()=>{window.removeEventListener("scroll",o,true),window.removeEventListener("resize",o);};}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(e){let o=this.tooltip,i=this.arrowEl;if(!o||!i)return;let{x:r,y:s,placement:a,middlewareData:l}=await Q(e,o,{strategy:"fixed",placement:this.side,middleware:[V(8),X(),Y({padding:8}),me({element:i})]});o.style.left=`${r}px`,o.style.top=`${s}px`,he(i,a,l.arrow);}};function rn(n){let t=n.style?.badge;if(!t||typeof t!="object")return {kind:"icon"};let e=t;return {kind:e.kind==="dot"||e.kind==="pill"||e.kind==="image"||e.kind==="icon"?e.kind:"icon",icon:typeof e.icon=="string"?e.icon:null,text:typeof e.text=="string"?e.text:null,imageUrl:typeof e.imageUrl=="string"?e.imageUrl:null,color:typeof e.color=="string"&&B.test(e.color.trim())?e.color.trim():null,size:typeof e.size=="number"&&Number.isFinite(e.size)?e.size:null}}function Ze(n,t,e){return Math.min(e,Math.max(t,n))}function sn(n,t){let e=t.createElement("button");e.type="button",e.className=`veo-badge veo-badge--${n.kind}`,e.setAttribute("aria-label","M\xE1s informaci\xF3n");let o=Ze(n.size??18,8,48);switch(n.kind){case "dot":e.style.width=`${o}px`,e.style.height=`${o}px`,n.color&&(e.style.background=n.color);break;case "pill":{e.textContent=n.text?.slice(0,24)||"Nuevo",e.style.fontSize=`${Ze(Math.round(o*.62),8,24)}px`,n.color&&(e.style.background=n.color);break}case "image":{if(n.imageUrl&&T(n.imageUrl)){let i=t.createElement("img");i.src=n.imageUrl,i.alt="",i.style.width=`${o}px`,i.style.height=`${o}px`,e.appendChild(i);}else e.className="veo-badge veo-badge--icon",e.textContent="?",e.style.width=`${o}px`,e.style.height=`${o}px`,e.style.fontSize=`${Ze(Math.round(o*.62),8,32)}px`;break}default:{e.textContent=(n.icon||"\u2139\uFE0F").slice(0,4),e.style.width=`${o}px`,e.style.height=`${o}px`,e.style.fontSize=`${Ze(Math.round(o*.62),8,32)}px`,n.color&&(e.style.color=n.color);break}}return e}function ve(n,t,e,o,i){let r=o.createElement("div");r.className="veo-guide-content";let s=o.createElement("div");s.className="veo-walkthrough-counter",s.textContent=`Paso ${t+1} de ${e}`,r.appendChild(s);let a=o.createElement("div");a.className="veo-walkthrough-progress";for(let m=0;m<e;m++){let h=o.createElement("span");h.className="veo-walkthrough-progress-dot",m<t&&h.classList.add("completed"),m===t&&h.classList.add("active"),a.appendChild(h);}if(r.appendChild(a),typeof n.imageUrl=="string"&&n.imageUrl&&T(n.imageUrl)){let m=o.createElement("img");m.className="veo-guide-image",m.src=n.imageUrl,m.alt=typeof n.title=="string"?n.title:"",r.appendChild(m);}if(typeof n.title=="string"&&n.title){let m=o.createElement("h2");m.className="veo-guide-title",m.textContent=n.title,r.appendChild(m);}if(typeof n.content=="string"&&n.content){let m=o.createElement("p");m.className="veo-guide-text",m.textContent=n.content,r.appendChild(m);}let l=o.createElement("div");l.className="veo-walkthrough-actions";let c=o.createElement("button");c.type="button",c.className="veo-walkthrough-skip",c.textContent="Omitir",c.addEventListener("click",()=>i.onSkip()),l.appendChild(c);let u=o.createElement("div");if(u.className="veo-walkthrough-actions-right",t>0){let m=o.createElement("button");m.type="button",m.className="veo-walkthrough-btn-secondary",m.textContent="Atr\xE1s",m.addEventListener("click",()=>i.onBack()),u.appendChild(m);}let d=t===e-1,f=o.createElement("button");f.type="button",f.className="veo-guide-cta";let p=d?"Finalizar":"Siguiente";return f.textContent=typeof n.ctaText=="string"&&n.ctaText?n.ctaText:p,f.addEventListener("click",()=>{d?i.onComplete():i.onNext();}),u.appendChild(f),l.appendChild(u),r.appendChild(l),r.appendChild(Me(o,()=>i.onSkip())),r}var J=class extends x{async render(t){let e=t.nav?.stepIndex??0,o=t.guide.guideSteps[e];if(!o)return;let i=o.style?.position==="bottom"?"bottom":"top",r=t.nav?null:o.selector?.trim()??null,s=null;if(r&&(s=await k(r),!s))return;let{host:a,root:l}=this.createHost();this.applyDesign(o.style);let c=l.ownerDocument??document,u=c.createElement("div");u.className=an(i,!!s);let d=(p,m,h)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:e,action:p,...h?{metadata:h}:{}}),m&&window.open(m,"_blank","noopener,noreferrer"),t.onClose();},f=t.nav?ve(o,t.nav.stepIndex,t.nav.totalSteps,c,t.nav.callbacks):A(o,c,{onCtaClick:(p,m,h)=>d("cta_clicked",p==="url"?m:void 0,h),onDismiss:()=>d("dismissed")});if(u.appendChild(f),l.appendChild(u),r&&s){a.style.display="block";let p=i==="top"?"prepend":"append";M(s,a,p),this.registerCleanup(H(a,r,p));}t.nav||(this.liveContainer=u,this.liveContent=f,this.liveBuild=p=>A(p,c,{onCtaClick:(m,h,g)=>d("cta_clicked",m==="url"?h:void 0,g),onDismiss:()=>d("dismissed")}),this.liveKey=this.liveKeyOf(o),t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"}));}liveKeyOf(t){let e=t.selector?.trim()??"";if(!e)return "";let o=t.style?.position==="bottom"?"bottom":"top";return `${e}|${o}`}onLiveUpdate(t){if(this.liveContainer){let e=t.style?.position==="bottom"?"bottom":"top",o=!!t.selector?.trim();this.liveContainer.className=an(e,o);}}};function an(n,t){return t?"veo-banner veo-banner-embedded":`veo-banner veo-banner-${n}`}function ln(){let t=Date.now().toString(16).padStart(12,"0"),e=new Uint8Array(10);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(let i=0;i<e.length;i++)e[i]=Math.floor(Math.random()*256);e[0]=(e[0]??0)&15|112,e[2]=(e[2]??0)&63|128;let o=Array.from(e,i=>i.toString(16).padStart(2,"0")).join("");return [t.slice(0,8),t.slice(8,12),o.slice(0,4),o.slice(4,8),o.slice(8,20)].join("-")}function et(n,t,e,o){let i=n.createElement("iframe");i.className="veo-custom-frame",i.setAttribute("sandbox","allow-scripts"),i.setAttribute("title",e.guide.guideName||"OnUser"),i.style.width=o.width;let r=o.fixedHeight!==void 0&&o.fixedHeight!==null;r&&(i.style.height=mt(o.fixedHeight));let s=ln(),a=t.style?.tailwind===true;i.srcdoc=ao(t.html??"",t.css??"",t.js??"",s,{hostCss:io(),htmlAttrs:ro(),tailwind:a});let l=()=>e.onClose(),c=u=>{if(u.source!==i.contentWindow)return;let d=u.data;if(!(!d||typeof d!="object"||d.__veo!==s))switch(d.type){case "dismiss":e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),l();break;case "cta":e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"cta_clicked"}),typeof d.url=="string"&&T(d.url)&&window.open(d.url,"_blank","noopener,noreferrer"),d.close!==false&&l();break;case "navigate":typeof d.url=="string"&&T(d.url)&&window.location.assign(d.url);break;case "track":typeof d.name=="string"&&e.onTrack&&e.onTrack(d.name,so(d.props)?d.props:void 0);break;case "resize":!r&&typeof d.height=="number"&&d.height>0&&(i.style.height=`${Math.ceil(d.height)}px`);break}};return window.addEventListener("message",c),{iframe:i,cleanup:()=>window.removeEventListener("message",c)}}function mt(n){return typeof n=="number"?`${n}px`:n}var oo=800*1024;function io(){if(typeof document>"u")return "";let n="";try{for(let t of Array.from(document.styleSheets)){let e=null;try{e=t.cssRules;}catch{continue}if(e){for(let o of Array.from(e))if(n+=`${o.cssText}
|
|
373
|
+
`,n.length>oo)return n}}}catch{return n}return n}function ro(){if(typeof document>"u")return "";try{let n=document.documentElement,t=[];for(let e of ["class","style","data-theme","data-mode","data-color-mode"]){let o=n.getAttribute(e);o&&o.length<=1e3&&!/["<>]/.test(o)&&t.push(`${e}="${o}"`);}return t.join(" ")}catch{return ""}}function so(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function ao(n,t,e,o,i){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(){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>${ft(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>${ft(t,"style")}</style></head><body style="margin:0!important;background:transparent!important;min-height:0!important;height:auto!important;"><div id="__veo_root">${n}</div><script>${r}</script>`+(e?`<script>${ft(e,"script")}</script>`:"")+"</body></html>"}function ft(n,t){let e=t==="script"?/<\/script/gi:/<\/style/gi;return n.replace(e,`<\\/${t}`)}var lo={mode:"floating",position:"bottom-right"},cn=16,co=360,ye=class extends x{async render(t){let e=t.guide.guideSteps[0];if(!e||typeof e.html!="string"||e.html.length===0)return;let o=e.placement??lo,i=null;if(o.mode==="anchored"){let u=o.selector??e.selector??t.guide.activationRules.selector;if(typeof u!="string"||u.length===0||(i=await k(u),!i))return}let{root:r}=this.createHost(),s=r.ownerDocument??document,a=s.createElement("div");a.className=o.mode==="anchored"?"veo-custom-anchored":"veo-custom-floating";let{iframe:l,cleanup:c}=et(s,e,t,{width:mt(o.width??co),fixedHeight:o.height??null});this.registerCleanup(c),a.appendChild(l),r.appendChild(a),o.mode==="floating"?uo(a,o):i&&this.registerCleanup(await this.setupAnchoredPosition(i,a,o)),t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}async setupAnchoredPosition(t,e,o){let i=o.side??"bottom",r=async()=>{let{x:a,y:l}=await Q(t,e,{placement:i,strategy:"fixed",middleware:[V(o.offsetY??8),X(),Y({padding:8})]});e.style.left=`${a}px`,e.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 uo(n,t){let e=t.position??"bottom-right",o=`${t.offsetX??cn}px`,i=`${t.offsetY??cn}px`,r=n.style;if(e==="center"){r.top="50%",r.left="50%",r.transform="translate(-50%, -50%)";return}let[s,a]=e.split("-");s==="top"?r.top=i:r.bottom=i,a==="left"?r.left=o:a==="right"?r.right=o:(r.left="50%",r.transform="translateX(-50%)");}function tt(n,t,e){let o=t.guide.guideSteps[0];if(!o)return;let i=o.fields??[],r=()=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"dismissed"}),t.onClose();},s=e.createElement("div");if(s.className="veo-guide-content",o.title){let f=e.createElement("h2");f.className="veo-guide-title",f.textContent=o.title,s.appendChild(f);}if(o.content){let f=e.createElement("p");f.className="veo-guide-text",f.textContent=o.content,s.appendChild(f);}let a=[],l=e.createElement("form");l.className="veo-form",l.noValidate=true;for(let f of i){let{wrapper:p,read:m}=fo(f,e);a.push({field:f,read:m}),l.appendChild(p);}let c=e.createElement("p");c.className="veo-form-error",c.style.display="none",l.appendChild(c);let u=e.createElement("div");u.className="veo-guide-actions";let d=e.createElement("button");d.type="submit",d.className="veo-guide-cta",d.textContent=o.ctaText||"Enviar",u.appendChild(d),l.appendChild(u),l.addEventListener("submit",f=>{f.preventDefault(),c.style.display="none";let p={};for(let{field:h,read:g}of a){let v=g();if(v==null||v===""){if(h.required){c.textContent=`Completa "${h.label}"`,c.style.display="block";return}continue}p[h.key]=v;}if(Object.keys(p).length===0){c.textContent="Responde al menos un campo",c.style.display="block";return}d.disabled=true,(t.onFormSubmit??(()=>Promise.resolve(true)))(p).then(h=>{if(!h){d.disabled=false,c.textContent="No se pudo enviar. Prueba de nuevo.",c.style.display="block";return}t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"completed"});let g=t.isPreview?t.previewNote??"Vista previa: la respuesta NO se guard\xF3.":null;po(n,e,g),window.setTimeout(()=>t.onClose(),g?2200:1400);});}),s.appendChild(l),s.appendChild(Me(e,r)),n.appendChild(s);}function po(n,t,e){for(;n.firstChild;)n.removeChild(n.firstChild);let o=t.createElement("div");if(o.className="veo-form-thanks",o.textContent="\u2713 \xA1Gracias por tu respuesta!",n.appendChild(o),e){let i=t.createElement("p");i.className="veo-form-preview-note",i.textContent=e,n.appendChild(i);}}function fo(n,t){let e=t.createElement("div");e.className="veo-form-field";let o=t.createElement("label");switch(o.className="veo-form-label",o.textContent=n.required?`${n.label} *`:n.label,e.appendChild(o),n.type){case "textarea":{let i=t.createElement("textarea");return i.className="veo-form-input",i.rows=3,n.placeholder&&(i.placeholder=n.placeholder),e.appendChild(i),{wrapper:e,read:()=>i.value.trim()}}case "number":{let i=t.createElement("input");return i.type="number",i.className="veo-form-input",n.placeholder&&(i.placeholder=n.placeholder),e.appendChild(i),{wrapper:e,read:()=>i.value.trim()===""?void 0:Number(i.value)}}case "select":{let i=t.createElement("select");i.className="veo-form-input";let r=t.createElement("option");r.value="",r.textContent=n.placeholder||"Elige una opci\xF3n\u2026",i.appendChild(r);for(let s of n.options??[]){let a=t.createElement("option");a.value=s,a.textContent=s,i.appendChild(a);}return e.appendChild(i),{wrapper:e,read:()=>i.value||void 0}}case "radio":{let i=t.createElement("div");i.className="veo-form-options";let r=`veo-${n.key}`,s=[];for(let a of n.options??[]){let l=t.createElement("label");l.className="veo-form-option";let c=t.createElement("input");c.type="radio",c.name=r,c.value=a,s.push(c);let u=t.createElement("span");u.textContent=a,l.appendChild(c),l.appendChild(u),i.appendChild(l);}return e.appendChild(i),{wrapper:e,read:()=>s.find(a=>a.checked)?.value}}case "multiselect":{let i=t.createElement("div");i.className="veo-form-options";let r=[];for(let s of n.options??[]){let a=t.createElement("label");a.className="veo-form-option";let l=t.createElement("input");l.type="checkbox",l.value=s,r.push(l);let c=t.createElement("span");c.textContent=s,a.appendChild(l),a.appendChild(c),i.appendChild(a);}return e.appendChild(i),{wrapper:e,read:()=>{let s=r.filter(a=>a.checked).map(a=>a.value);return s.length>0?s:void 0}}}case "checkbox":{let i=t.createElement("label");i.className="veo-form-option";let r=t.createElement("input");r.type="checkbox";let s=t.createElement("span");return s.textContent=n.placeholder||"S\xED",i.appendChild(r),i.appendChild(s),e.appendChild(i),{wrapper:e,read:()=>r.checked?true:n.required?"":false}}case "yesno":{let i=t.createElement("div");i.className="veo-form-options";let r=`veo-${n.key}`,[s,a]=n.options?.length===2?n.options:["S\xED","No"],l=[];for(let{label:c,value:u}of [{label:s,value:true},{label:a,value:false}]){let d=t.createElement("label");d.className="veo-form-option";let f=t.createElement("input");f.type="radio",f.name=r,l.push({input:f,value:u});let p=t.createElement("span");p.textContent=c,d.appendChild(f),d.appendChild(p),i.appendChild(d);}return e.appendChild(i),{wrapper:e,read:()=>l.find(c=>c.input.checked)?.value}}case "nps":return dn(e,t,0,10,"veo-nps-btn");case "rating":return dn(e,t,1,5,"veo-rating-btn","\u2605");default:{let i=t.createElement("input");return i.type="text",i.className="veo-form-input",n.placeholder&&(i.placeholder=n.placeholder),e.appendChild(i),{wrapper:e,read:()=>i.value.trim()}}}}function dn(n,t,e,o,i,r){let s=t.createElement("div");s.className="veo-form-scale";let a,l=[];for(let c=e;c<=o;c++){let u=t.createElement("button");u.type="button",u.className=i,u.textContent=r??String(c),u.setAttribute("aria-label",String(c)),u.addEventListener("click",()=>{a=c,l.forEach((d,f)=>{let p=r?f+e<=c:f+e===c;d.classList.toggle("veo-scale-active",p);});}),l.push(u),s.appendChild(u);}return n.appendChild(s),{wrapper:n,read:()=>a}}var we=class extends x{render(t){let e=t.guide.guideSteps[0];if(!e||(e.fields??[]).length===0)return;let{root:o}=this.createHost();this.applyDesign(e.style);let i=o.ownerDocument??document,r=i.createElement("div");r.className="veo-modal-overlay";let s=i.createElement("div");s.className="veo-modal-card",tt(s,t,i),r.appendChild(s),o.appendChild(r);let a=()=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"dismissed"}),t.onClose();};r.addEventListener("click",c=>{c.target===r&&a();});let l=c=>{c.key==="Escape"&&a();};document.addEventListener("keydown",l),this.registerCleanup(()=>document.removeEventListener("keydown",l)),t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}};var be=class extends x{async render(t){let e=t.guide.guideSteps[0];if(!e||typeof e.html!="string"||e.html.length===0)return;let o=e.selector??t.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let i=await k(o);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=F(e.style);M(i,r,a),this.registerCleanup(H(r,o,a));let l=s.ownerDocument??document,c=l.createElement("div");c.className="veo-custom-inline";let{iframe:u,cleanup:d}=et(l,e,t,{width:"100%"});this.registerCleanup(d),c.appendChild(u),s.appendChild(c),t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}};var xe=class extends x{async render(t){let e=t.guide.guideSteps[0];if(!e||(e.fields??[]).length===0)return;let o=e.selector??t.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let i=await k(o);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=F(e.style);M(i,r,a),this.registerCleanup(H(r,o,a)),this.applyDesign(e.style);let l=s.ownerDocument??document,c=l.createElement("div");c.className="veo-inline",tt(c,t,l),s.appendChild(c),t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}};var Ce=class extends x{async render(t){let e=t.guide.guideSteps[0];if(!e)return;let o=e.selector??t.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let i=await k(o);if(!i)return;let{host:r,root:s}=this.createHost();r.style.display="block";let a=F(e.style);M(i,r,a),this.registerCleanup(H(r,o,a)),this.applyDesign(e.style);let l=s.ownerDocument??document,c=l.createElement("div");c.className="veo-inline";let u=(f,p,m)=>{t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:f,...m?{metadata:m}:{}}),p&&window.open(p,"_blank","noopener,noreferrer"),t.onClose();},d=A(e,l,{onCtaClick:(f,p,m)=>u("cta_clicked",f==="url"?p:void 0,m),onDismiss:()=>u("dismissed")});c.appendChild(d),s.appendChild(c),this.liveContainer=c,this.liveContent=d,this.liveKey=`${o}|${a}`,this.liveBuild=f=>A(f,l,{onCtaClick:(p,m,h)=>u("cta_clicked",p==="url"?m:void 0,h),onDismiss:()=>u("dismissed")}),t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"shown"});}liveKeyOf(t){return `${t.selector??""}|${F(t.style)}`}};function un(n){return n.style?.backdrop===false?"veo-modal-overlay veo-modal-overlay--none":"veo-modal-overlay"}var Z=class extends x{constructor(){super(...arguments);this.overlay=null;}render(e){let o=e.nav?.stepIndex??0,i=e.guide.guideSteps[o];if(!i)return;let{root:r}=this.createHost();this.applyDesign(i.style);let s=r.ownerDocument??document,a=s.createElement("div");a.className=un(i),this.overlay=a;let l=s.createElement("div");l.className="veo-modal-card";let c=(p,m,h)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:o,action:p,...h?{metadata:h}:{}}),m&&window.open(m,"_blank","noopener,noreferrer"),e.onClose();},u=()=>{e.nav?e.nav.callbacks.onSkip():c("dismissed");},d=e.nav?ve(i,e.nav.stepIndex,e.nav.totalSteps,s,e.nav.callbacks):A(i,s,{onCtaClick:(p,m,h)=>c("cta_clicked",p==="url"?m:void 0,h),onDismiss:()=>c("dismissed")});l.appendChild(d),a.appendChild(l),r.appendChild(a),e.nav||(this.liveContainer=l,this.liveContent=d,this.liveBuild=p=>A(p,s,{onCtaClick:(m,h,g)=>c("cta_clicked",m==="url"?h:void 0,g),onDismiss:()=>c("dismissed")})),a.addEventListener("click",p=>{p.target===a&&u();});let f=p=>{p.key==="Escape"&&u();};document.addEventListener("keydown",f),this.registerCleanup(()=>document.removeEventListener("keydown",f)),e.nav||e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}onLiveUpdate(e){this.overlay&&(this.overlay.className=un(e));}destroy(){this.overlay=null,super.destroy();}};var ke=class extends x{constructor(){super(...arguments);this.side="bottom";this.reposition=null;}async render(e){let o=e.guide.guideSteps[0];if(!o)return;let i=o.selector??e.guide.activationRules.selector;if(typeof i!="string"||i.length===0)return;let r=await k(i);if(!r)return;let s=o.style?.tooltipPlacement;this.side=s==="top"||s==="left"||s==="right"?s:"bottom";let{root:a}=this.createHost();this.applyDesign(o.style);let l=a.ownerDocument??document,c=l.createElement("div");c.className="veo-tooltip";let u=(h,g,v)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:h,...v?{metadata:v}:{}}),g&&window.open(g,"_blank","noopener,noreferrer"),e.onClose();},d=A(o,l,{onCtaClick:(h,g,v)=>{u("cta_clicked",h==="url"?g:void 0,v);},onDismiss:()=>u("dismissed")});c.appendChild(d);let f=l.createElement("div");f.className="veo-tooltip-arrow",c.appendChild(f),a.appendChild(c);let p=async()=>{let{x:h,y:g,placement:v,middlewareData:w}=await Q(r,c,{placement:this.side,middleware:[V(10),X(),Y({padding:8}),me({element:f})]});c.style.left=`${h}px`,c.style.top=`${g}px`,he(f,v,w.arrow);};await p();let m=()=>{p();};this.reposition=m,window.addEventListener("scroll",m,true),window.addEventListener("resize",m),this.registerCleanup(()=>{window.removeEventListener("scroll",m,true),window.removeEventListener("resize",m);}),this.liveContainer=c,this.liveContent=d,this.liveKey=i,this.liveBuild=h=>A(h,l,{onCtaClick:(g,v,w)=>u("cta_clicked",g==="url"?v:void 0,w),onDismiss:()=>u("dismissed")}),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}liveKeyOf(e){return e.selector??""}onLiveUpdate(e){let o=e.style?.tooltipPlacement;this.side=o==="top"||o==="left"||o==="right"?o:"bottom",this.reposition?.();}};var Ee=class extends x{async render(t){let e=t.guide.guideSteps[t.currentStepIndex];if(!e)return false;let o=e.selector??t.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return false;let i=await k(o,5e3);if(!i)return false;let r=e.style?.tooltipPlacement,s=r==="top"||r==="left"||r==="right"?r:"bottom",{root:a}=this.createHost();this.applyDesign(e.style);let l=a.ownerDocument??document,c=l.createElement("div");c.className="veo-walkthrough";let u=ve(e,t.currentStepIndex,t.guide.guideSteps.length,l,t.callbacks);c.appendChild(u);let d=l.createElement("div");d.className="veo-walkthrough-arrow",c.appendChild(d),a.appendChild(c);let f=async()=>{let{x:m,y:h,placement:g,middlewareData:v}=await Q(i,c,{placement:s,middleware:[V(10),X(),Y({padding:8}),me({element:d})]});c.style.left=`${m}px`,c.style.top=`${h}px`,he(d,g,v.arrow);};await f();let p=()=>{f();};return window.addEventListener("scroll",p,true),window.addEventListener("resize",p),this.registerCleanup(()=>{window.removeEventListener("scroll",p,true),window.removeEventListener("resize",p);}),true}};var nt=class{constructor(t){this.state=null;this.storageKey=`${bt}${t}`,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(t,e){let o=Date.now();return this.state={guideId:t,totalSteps:e,currentStepIndex:0,startedAt:o,lastProgressAt:o},this.persist(),this.state}advance(){if(!this.state)return null;let t=this.state.currentStepIndex+1;return t>=this.state.totalSteps?null:(this.state={...this.state,currentStepIndex:t,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(t){return Date.now()-t.lastProgressAt>18e5}load(){if(typeof localStorage>"u")return null;try{let t=localStorage.getItem(this.storageKey);if(!t)return null;let e=JSON.parse(t);if(!e||typeof e!="object")return null;let o=e;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 ho=3e4,go={shown:"shown",dismissed:"dismissed",cta_clicked:null,step_advanced:null,step_back:null,completed:"completed"},ot=class{constructor(t,e){this.client=t;this.activeRenderers=new Set;this.activeByGuideId=new Map;this.dispatched=new Set;this.activeWalkthroughRenderer=null;this.activeWalkthroughGuide=null;this.resolveCache=null;this.inflightResolve=null;if(this.debug=e.debug===true,this.apiUrl=e.apiUrl,this.apiKey=e.apiKey,this.resolver=e.resolver??new Fe(e.apiUrl,e.apiKey,this.debug),e.trackerQueue)this.trackerQueue=e.trackerQueue;else {let i=new He(e.apiUrl,e.apiKey);this.trackerQueue=new $e({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 o=kt(e.apiKey);this.frequencyCache=e.frequencyCache??new Be(o),this.walkthroughState=e.walkthroughState??new nt(o);}get pendingInteractions(){return this.trackerQueue.size}clearFrequencyCache(){this.frequencyCache.clear();}clearWalkthroughState(){this.tearDownWalkthrough();}async checkGuides(t,e){let o=this.client.getEndUserId();if(!o){this.debug&&console.log("[veo] guides: skipped, no endUserId yet");return}if(await this.tryResumeWalkthrough(o,e,t))return;let i;try{i=await this.resolveGuides(o,t);}catch(r){this.debug&&console.error("[veo] guides resolver threw:",r);return}this.debug&&console.log(`[veo] guides: ${i.length} eligible at ${t}`);for(let r of i){if(this.frequencyCache.shouldFilter(r.guideId,r.displayFrequency)){this.debug&&console.log(`[veo] guides: filtered locally guideId=${r.guideId}`);continue}if(this.activeByGuideId.has(r.guideId)){this.debug&&console.log(`[veo] guides: already shown guideId=${r.guideId}`);continue}if(r.guideType==="walkthrough"&&r.guideSteps.length>1){if(this.walkthroughState.hasActive()){this.debug&&console.log(`[veo] guides: walkthrough ${r.guideId} skipped (another active)`);continue}await this.startWalkthrough(r,o,e,t);continue}this.runSingleStepRender(r,e,t);}}async resolveGuides(t,e){let o=`${t}
|
|
374
|
+
${e}`,i=Date.now();if(this.resolveCache?.key===o&&i-this.resolveCache.at<ho)return this.debug&&console.log("[veo] guides: resolve cache hit"),this.resolveCache.guides;if(this.inflightResolve?.key===o)return this.inflightResolve.promise;let r=this.resolver.resolve(t,e);this.inflightResolve={key:o,promise:r};try{let s=await r;return this.resolveCache={key:o,at:Date.now(),guides:s},s}finally{this.inflightResolve?.key===o&&(this.inflightResolve=null);}}destroy(){for(let t of this.activeRenderers)try{t.destroy();}catch(e){this.debug&&console.error("[veo] renderer destroy failed:",e);}if(this.activeRenderers.clear(),this.activeByGuideId.clear(),this.activeWalkthroughRenderer){try{this.activeWalkthroughRenderer.destroy();}catch{}this.activeWalkthroughRenderer=null,this.activeWalkthroughGuide=null;}this.dispatched.clear(),this.resolveCache=null,this.inflightResolve=null,this.trackerQueue.destroy();}runSingleStepRender(t,e,o){let i=this.createSingleStepRenderer(t.guideType);if(!i)return;this.activeByGuideId.set(t.guideId,i);let r=t.activationRules.delayMs??0;window.setTimeout(()=>this.mountSingleStepRenderer(t,i,e,o),r);}mountSingleStepRenderer(t,e,o,i){this.activeRenderers.add(e),this.activeByGuideId.set(t.guideId,e);let r=()=>{e.destroy(),this.activeRenderers.delete(e),this.activeByGuideId.get(t.guideId)===e&&this.activeByGuideId.delete(t.guideId);},s=c=>{this.handleInteraction(t,o,i,c);},a=(c,u)=>{this.client.track(c,u);},l=c=>this.submitFormResponse(t.guideId,c);try{e.render({guide:t,onInteraction:s,onClose:r,onTrack:a,onFormSubmit:l});}catch(c){this.debug&&console.error("[veo] renderer.render threw:",c),this.activeRenderers.delete(e),this.activeByGuideId.get(t.guideId)===e&&this.activeByGuideId.delete(t.guideId);}}async tryResumeWalkthrough(t,e,o){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,t,e,o),true}async startWalkthrough(t,e,o,i){this.walkthroughState.start(t.guideId,t.guideSteps.length),await this.renderWalkthroughStep(t,0,e,o,i)&&(this.enqueueInteractionOnce(t.guideId,e,o,i,"shown",0),this.frequencyCache.record(t.guideId,"shown"));}async renderWalkthroughStep(t,e,o,i,r){this.activeWalkthroughRenderer&&(this.activeWalkthroughRenderer.destroy(),this.activeWalkthroughRenderer=null),this.activeWalkthroughGuide=t;let s={onNext:()=>this.handleWalkthroughNext(o,i,r),onBack:()=>this.handleWalkthroughBack(o,i,r),onSkip:()=>this.handleWalkthroughSkip(o,i,r),onComplete:()=>this.handleWalkthroughComplete(o,i,r)},a=t.guideSteps[e],l=vo(a);if(l==="modal"||l==="banner"){let d=l==="modal"?new Z:new J;try{d.render({guide:t,onInteraction:()=>{},onClose:()=>{},nav:{stepIndex:e,totalSteps:t.guideSteps.length,callbacks:s}});}catch(f){return this.debug&&console.error("[veo] sequence renderer threw:",f),this.tearDownWalkthrough(),false}return this.activeWalkthroughRenderer=d,true}let c=new Ee,u=false;try{u=await c.render({guide:t,currentStepIndex:e,callbacks:s});}catch(d){this.debug&&console.error("[veo] walkthrough renderer threw:",d);}return u?(this.activeWalkthroughRenderer=c,true):(this.debug&&console.warn(`[veo] walkthrough ${t.guideId} step ${e} could not render, cancelling`),this.tearDownWalkthrough(),false)}handleWalkthroughNext(t,e,o){let i=this.activeWalkthroughGuide;if(!i)return;let r=this.walkthroughState.advance();if(!r){this.handleWalkthroughComplete(t,e,o);return}this.enqueueInteraction(i.guideId,t,e,o,"step_advanced",r.currentStepIndex),this.renderWalkthroughStep(i,r.currentStepIndex,t,e,o);}handleWalkthroughBack(t,e,o){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,t,e,o,"step_back",s.currentStepIndex),this.renderWalkthroughStep(i,s.currentStepIndex,t,e,o));}handleWalkthroughSkip(t,e,o){let i=this.activeWalkthroughGuide,r=this.walkthroughState.current();!i||!r||(this.enqueueInteraction(i.guideId,t,e,o,"dismissed",r.currentStepIndex),this.frequencyCache.record(i.guideId,"dismissed"),this.tearDownWalkthrough());}handleWalkthroughComplete(t,e,o){let i=this.activeWalkthroughGuide,r=this.walkthroughState.current();!i||!r||(this.enqueueInteraction(i.guideId,t,e,o,"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(t,e,o,i){let r=i.metadata?.buttonId?`:${i.metadata.buttonId}`:"",s=`${t.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=go[i.action];a&&this.frequencyCache.record(t.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:t.guideId,payload:{endUserId:l,sessionId:e,action:i.action,stepIndex:i.stepIndex,pageUrl:o,pagePath:pn(o),...i.metadata?{metadata:i.metadata}:{}}});}enqueueInteraction(t,e,o,i,r,s){this.trackerQueue.enqueue({guideId:t,payload:{endUserId:e,sessionId:o,action:r,stepIndex:s,pageUrl:i,pagePath:pn(i)}});}enqueueInteractionOnce(t,e,o,i,r,s){let a=`${t}:${r}:${s}`;this.dispatched.has(a)||(this.dispatched.add(a),this.enqueueInteraction(t,e,o,i,r,s));}createSingleStepRenderer(t){switch(t){case "modal":return new Z;case "banner":return new J;case "tooltip":return new ke;case "custom":return new ye;case "inline":return new Ce;case "inline-custom":return new be;case "form":return new we;case "inline-form":return new xe;case "badge":return new ge;case "walkthrough":return null}}async submitFormResponse(t,e){let o=this.client.getEndUserId()??this.client.getAnonymousId();try{let i=await fetch(`${this.apiUrl}/v1/guides/${t}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":this.apiKey},body:JSON.stringify({endUserId:o,answers:e})});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 pn(n){try{return new URL(n).pathname}catch{return "/"}}function vo(n){let t=n?.style?.render;return typeof t=="string"?t:"walkthrough"}var yo="__veo_preview__",ht=class{constructor(){this.singleStep=null;this.walkthrough=null;this.walkthroughGuide=null;this.walkthroughIndex=0;this.input=null;}preview(t){let e=t.guideSteps[0];if(this.singleStep&&this.input&&t.guideType===this.input.guideType&&t.guideType!=="walkthrough"&&e&&this.singleStep.updateStep(e))return this.input=t,{close:()=>this.close(),ready:Promise.resolve({rendered:true}),host:()=>this.activeHost()};this.close(),this.input=t;let o=wo(t),i=typeof t.startStepIndex=="number"?t.startStepIndex:0,r=o.guideType==="walkthrough"?this.startWalkthrough(o,i):this.renderSingleStep(o);return {close:()=>this.close(),ready:r,host:()=>this.activeHost()}}activeHost(){return this.singleStep?this.singleStep.hostElement():this.walkthrough instanceof x?this.walkthrough.hostElement():null}close(){this.singleStep&&(ce(this.singleStep),this.singleStep=null),this.walkthrough&&(ce(this.walkthrough),this.walkthrough=null),this.walkthroughGuide=null,this.walkthroughIndex=0,this.input=null;}async renderSingleStep(t){let e=bo(t.guideType);if(!e)return {rendered:false};this.singleStep=e;let o=false;try{await e.render({guide:t,onInteraction:i=>{i.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!==e?(ce(e),{rendered:false}):{rendered:o}}async startWalkthrough(t,e=0){if(t.guideSteps.length===0)return {rendered:false};this.walkthroughGuide=t;let o=Math.min(Math.max(0,Math.floor(e)),t.guideSteps.length-1);return this.walkthroughIndex=o,{rendered:await this.renderWalkthroughStep(o)}}async renderWalkthroughStep(t){let e=this.walkthroughGuide;if(!e)return false;this.walkthrough&&(ce(this.walkthrough),this.walkthrough=null);let o={onNext:()=>{let l=this.walkthroughIndex+1;if(l>=e.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=e.guideSteps[t]?.style?.render;if(r==="modal"||r==="banner"){let l=r==="modal"?new Z:new J;try{l.render({guide:e,onInteraction:()=>{},onClose:()=>this.close(),nav:{stepIndex:t,totalSteps:e.guideSteps.length,callbacks:o}});}catch{return ce(l),false}return this.walkthroughGuide!==e?(ce(l),false):(this.walkthrough=l,true)}let s=new Ee,a=false;try{a=await s.render({guide:e,currentStepIndex:t,callbacks:o});}catch{a=false;}return !a||this.walkthroughGuide!==e?(ce(s),false):(this.walkthrough=s,true)}},it=null;function rt(n){return De()?(it||(it=new ht),it.preview(n)):{close:()=>{},ready:Promise.resolve({rendered:false}),host:()=>null}}function fn(){it?.close();}function wo(n){let t=n.activationRules?.selector,e={url:n.activationRules?.url??{type:"prefix",pattern:"/"},trigger:"immediate",...t!==void 0?{selector:t}:{}};return {guideId:yo,guideName:n.guideName??"Preview",guideType:n.guideType,guideSteps:n.guideSteps,activationRules:e,displayFrequency:"always",displayPriority:0}}function bo(n){switch(n){case "modal":return new Z;case "banner":return new J;case "tooltip":return new ke;case "custom":return new ye;case "inline":return new Ce;case "inline-custom":return new be;case "form":return new we;case "inline-form":return new xe;case "badge":return new ge;case "walkthrough":return null}}function ce(n){try{n.destroy();}catch{}}var st=null;async function mn(n){if(!De())return null;st?.teardown();let t=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?t=(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 e=async a=>{if(!t)return false;let l=window.veo,c=l?.getEndUserId?.()??l?.getAnonymousId?.()??null;if(!c)return false;try{return (await fetch(`${n.apiUrl}/v1/guides/${t.guideId}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":n.apiKey},body:JSON.stringify({endUserId:c,answers:a})})).ok}catch{return false}},o=null,i=()=>{t&&(o?.close(),o=rt({guideType:t.guideType,guideSteps:t.guideSteps,activationRules:t.activationRules,guideName:t.guideName,formSubmit:e,formSubmitNote:"Vista previa: guardado en TU usuario para probar el flujo."}));},r=xo({label:t?`Vista previa: ${t.guideName}`:"Link de preview inv\xE1lido o vencido",error:!t,onReshow:t?i:null,onClose:()=>s.teardown()}),s={teardown(){o?.close(),o=null,r.remove(),st===s&&(st=null);}};return st=s,i(),s}function xo(n){let t=document.createElement("div");t.setAttribute("data-veo-preview-chip","");let e=t.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=`
|
|
293
375
|
.chip { position: fixed; bottom: 16px; right: 16px; z-index: 2147483647;
|
|
294
376
|
display: flex; align-items: center; gap: 8px; padding: 8px 12px;
|
|
295
377
|
background: #111827; color: #f9fafb; border-radius: 9999px;
|
|
@@ -299,5 +381,5 @@ var veoGuides=(function(exports){'use strict';function ft(){return typeof window
|
|
|
299
381
|
button { all: unset; cursor: pointer; padding: 2px 6px; border-radius: 9999px;
|
|
300
382
|
font-size: 12px; line-height: 1; }
|
|
301
383
|
button:hover { background: rgba(255,255,255,.15); }
|
|
302
|
-
`,
|
|
384
|
+
`,e.appendChild(o);let i=document.createElement("div");i.className=n.error?"chip error":"chip";let r=document.createElement("span");if(r.className="label",r.textContent=n.label,i.appendChild(r),n.onReshow){let a=document.createElement("button");a.textContent="\u21BB",a.title="Volver a mostrar la gu\xEDa",a.addEventListener("click",n.onReshow),i.appendChild(a);}let s=document.createElement("button");return s.textContent="\u2715",s.title="Salir de la vista previa",s.addEventListener("click",n.onClose),i.appendChild(s),e.appendChild(i),document.body.appendChild(t),{remove:()=>t.remove()}}function Co(n){return {name:"guides",install(t){if(!gt())return;let e=new ot(t,n);window.__veoGuides={controller:e},t.on("identify",({sessionId:o})=>{e.checkGuides(window.location.href,o);}),t.on("pageview",({url:o,sessionId:i})=>{e.checkGuides(o,i);}),e.checkGuides(window.location.href,t.getSessionId());}}}exports.closeGuidePreview=fn;exports.guidesPlugin=Co;exports.previewGuide=rt;exports.runPreviewMode=mn;return exports;})({});//# sourceMappingURL=veo-guides.js.map
|
|
303
385
|
//# sourceMappingURL=veo-guides.js.map
|