veo-sdk 0.6.1 → 0.6.3

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.
Files changed (35) hide show
  1. package/dist/builder-PPLIAUCM.mjs +5 -0
  2. package/dist/{builder-BKPMANUB.mjs.map → builder-PPLIAUCM.mjs.map} +1 -1
  3. package/dist/builder.cjs +641 -105
  4. package/dist/builder.cjs.map +1 -1
  5. package/dist/builder.d.cts +78 -8
  6. package/dist/builder.d.ts +78 -8
  7. package/dist/builder.mjs +4 -4
  8. package/dist/{chunk-GVPAJFNW.mjs → chunk-3JEAPZ6A.mjs} +3 -3
  9. package/dist/{chunk-GVPAJFNW.mjs.map → chunk-3JEAPZ6A.mjs.map} +1 -1
  10. package/dist/{chunk-VWF4UHUU.mjs → chunk-DU6I4ZU2.mjs} +284 -15
  11. package/dist/chunk-DU6I4ZU2.mjs.map +1 -0
  12. package/dist/{chunk-NGP7IJVE.mjs → chunk-SZCIXA5X.mjs} +357 -82
  13. package/dist/chunk-SZCIXA5X.mjs.map +1 -0
  14. package/dist/detect-theme-X4K3TLUL.mjs +446 -0
  15. package/dist/detect-theme-X4K3TLUL.mjs.map +1 -0
  16. package/dist/{guide-preview-DylsEhrg.d.cts → guide-preview-DEFhfA4o.d.cts} +115 -0
  17. package/dist/{guide-preview-DylsEhrg.d.ts → guide-preview-DEFhfA4o.d.ts} +115 -0
  18. package/dist/index.cjs +1515 -56
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +18 -1
  21. package/dist/index.d.ts +18 -1
  22. package/dist/index.mjs +442 -17
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/veo-builder.js +132 -25
  25. package/dist/veo-builder.js.map +1 -1
  26. package/dist/veo-guides.js +84 -12
  27. package/dist/veo-guides.js.map +1 -1
  28. package/dist/veo-theme.js +2 -0
  29. package/dist/veo-theme.js.map +1 -0
  30. package/dist/veo.js +2 -2
  31. package/dist/veo.js.map +1 -1
  32. package/package.json +2 -2
  33. package/dist/builder-BKPMANUB.mjs +0 -5
  34. package/dist/chunk-NGP7IJVE.mjs.map +0 -1
  35. package/dist/chunk-VWF4UHUU.mjs.map +0 -1
@@ -0,0 +1,2 @@
1
+ var veoTheme=(function(exports){'use strict';var ie=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/;function ce(e){let t=ie.exec(e.trim());if(!t)return null;let r=t[4]===void 0?1:t[4].endsWith("%")?Number.parseFloat(t[4])/100:+t[4];return [+t[1],+t[2],+t[3],r]}function oe(e){let t=e.trim(),r=t.split(/[\s,/]+/).filter(Boolean);return r.length>=3&&r.every(a=>/^-?[\d.]+(%|deg)?$/.test(a))?t.includes("%")?`hsl(${t})`:`rgb(${t})`:t}function ne(e){let t=e.trim();return !t||t.length>64?false:/^(#|rgb|hsl|hwb|lab|lch|oklab|oklch|color\(|color-mix|light-dark)/i.test(t)||oe(t)!==t}function k(e,t){if(e[3]>=1)return e;let r=l=>Math.round(e[l]*e[3]+t[l]*(1-e[3]));return [r(0),r(1),r(2),1]}function y(e){let t=r=>Math.round(r).toString(16).padStart(2,"0");return `#${t(e[0])}${t(e[1])}${t(e[2])}`.toUpperCase()}function M(e){return (.2126*e[0]+.7152*e[1]+.0722*e[2])/255}function F(e){let t=Math.max(e[0],e[1],e[2])/255,r=Math.min(e[0],e[1],e[2])/255,l=(t+r)/2;return t===r?0:(t-r)/(1-Math.abs(2*l-1))}function re(e){let t=e.createElement("span");t.style.display="none",e.body.appendChild(t);let r=e.defaultView,l,a=new Map,f=m=>{if(l===void 0)try{let g=e.createElement("canvas");g.width=1,g.height=1,l=g.getContext("2d",{willReadFrequently:!0});}catch{l=null;}if(!l)return null;l.clearRect(0,0,1,1),l.fillStyle="#000",l.fillStyle=m,l.fillRect(0,0,1,1);let u=l.getImageData(0,0,1,1).data;return [u[0]??0,u[1]??0,u[2]??0,(u[3]??255)/255]};return {resolve(m){let u=m.trim();if(!u||!r)return null;let g=a.get(u);if(g!==void 0)return g;let d=null;if(t.style.color="",t.style.color=oe(u),t.style.color){let h=r.getComputedStyle(t).color;d=ce(h)??f(h);}return a.set(u,d),d},dispose(){t.remove();}}}var ue=/^(serif|sans-serif|monospace|cursive|fantasy|system-ui|ui-sans-serif|ui-serif|ui-monospace|ui-rounded|emoji|math|fangsong|inherit|initial|-apple-system|BlinkMacSystemFont|Segoe UI|Roboto|Helvetica|Helvetica Neue|Arial|Noto Sans|Apple Color Emoji|Segoe UI Emoji|Segoe UI Symbol|Noto Color Emoji)$/i;function L(e){return e.trim().replace(/^["']|["']$/g,"")}function fe(e){let t=e.split(",").map(L).filter(Boolean);return t.find(r=>!ue.test(r)&&!/fallback/i.test(r))??t[0]??""}function de(e){return e.replace(/^__/,"").replace(/_Fallback_[0-9a-f]+$/i," Fallback").replace(/_[0-9a-f]{6,}$/i,"").replace(/_/g," ").trim()}function H(e,t,r){let l=e.defaultView;if(!t||!l)return;let a=fe(l.getComputedStyle(t).fontFamily);if(!a)return;let f={name:de(a).slice(0,80),family:a.slice(0,120)},m=new Set;try{for(let c of Array.from(e.fonts??[]))L(c.family)===a&&c.status==="loaded"&&m.add(c.weight);}catch{}m.size>0&&(f.weights=[...m].sort().join(" ").slice(0,80));let u=r.filter(c=>c.family===a),g=u.find(c=>c.url)?.url??null,d=null;try{d=g?new URL(g,e.baseURI).origin:null;}catch{d=null;}let h=Array.from(e.querySelectorAll("link[href]")).map(c=>c.href);return d?f.hosting=d.includes("fonts.gstatic.com")?"google":d===l.location.origin?"self":"external":u.length>0?f.hosting="self":h.some(c=>c.includes("fonts.googleapis.com"))?f.hosting="google":h.some(c=>c.includes("use.typekit.net"))?f.hosting="adobe":f.hosting="system",f}var E=["accent","text","textMuted","background","border"],me={accent:["--primary","--color-primary","--brand","--color-brand","--brand-primary","--mui-palette-primary-main","--bs-primary","--ant-color-primary","--chakra-colors-brand-500","--accent-color","--accent"],text:["--foreground","--color-foreground","--text","--color-text","--text-primary","--bs-body-color","--mui-palette-text-primary"],textMuted:["--muted-foreground","--color-muted-foreground","--text-muted","--text-secondary","--bs-secondary-color","--mui-palette-text-secondary"],background:["--background","--color-background","--bg","--color-bg","--bs-body-bg","--mui-palette-background-default"],border:["--border","--color-border","--border-color","--bs-border-color","--mui-palette-divider"]},ge={accent:/brand|primary|accent|main/i,text:/text|foreground|\bfg\b|-fg|ink|content|body/i,textMuted:/muted|secondary|subtle|soft|hint|placeholder|text|-fg/i,background:/background|\bbg\b|-bg|surface|canvas|page|base/i,border:/border|line|divider|stroke|outline|separator/i},pe=/-(50|[1-9]00|950)$|white|black/i,he=/\.dark\b|\[data-(theme|mode|color-scheme)=["']?dark|\.theme-dark|\.dark-theme/i,be=/^(:root|html|:host|body)$|\.light\b|\[data-(theme|mode)=["']?light/i,ye=1500,xe=600;function Se(e){let t={names:new Set,byMode:{light:new Map,dark:new Map},faces:[]},r=(l,a)=>{for(let f of Array.from(l)){let m=f.style,u=f.selectorText;if(f.constructor.name==="CSSFontFaceRule"&&m){let d=m.getPropertyValue("src"),h=/url\(["']?([^"')]+)["']?\)/.exec(d)?.[1]??null;t.faces.push({family:L(m.getPropertyValue("font-family")),url:h});}else if(m&&typeof u=="string"){let d=u.split(",").map(c=>c.trim()),h=d.some(c=>he.test(c))?"dark":d.some(c=>be.test(c))?a?"dark":"light":null;for(let c of Array.from(m))c.startsWith("--")&&(t.names.add(c),h&&t.byMode[h].set(c,m.getPropertyValue(c).trim()));}let g=f.cssRules;if(g){let d=f.conditionText??"";r(g,a||/prefers-color-scheme:\s*dark/.test(d));}}};for(let l of Array.from(e.styleSheets))try{r(l.cssRules,!1);}catch{}return t}function V(e){let t=null,r=0;for(let[l,a]of e)a>r&&(r=a,t=l);return t}function Re(e=document){let t=e.defaultView,r=e.body;if(!t||!r)return null;let l=e.documentElement,a=re(e),f=e.createElement("div");try{let m=t.getComputedStyle(r),u=[255,255,255,1];for(let n of [r,l]){let o=a.resolve(t.getComputedStyle(n).backgroundColor);if(o&&o[3]>0){u=k(o,[255,255,255,1]);break}}let g=k(a.resolve(m.color)??[0,0,0,1],u),d=y(g),h=new Map,c=new Map,j=new Map,O=new Map,A=(n,o)=>{n.set(o,(n.get(o)??0)+1);},se=Math.abs(M(g)-M(u)),le=Array.from(r.querySelectorAll("*")).slice(0,ye);for(let n of le){if(n.getClientRects().length===0)continue;let o=t.getComputedStyle(n);if(Array.from(n.childNodes).some(i=>i.nodeType===3&&(i.textContent??"").trim()!=="")){let i=a.resolve(o.color);if(i&&i[3]>0){let p=k(i,u),b=y(p),I=Math.abs(M(p)-M(u))<se;b!==d&&F(p)<.3&&I&&A(h,b),n.closest("a")&&F(p)>=.3&&A(O,b);}}if(Number.parseFloat(o.borderTopWidth)>0&&o.borderTopStyle!=="none"){let i=a.resolve(o.borderTopColor);if(i&&i[3]>0){let p=k(i,u);F(p)<.3&&y(p)!==d&&A(c,y(p));}}if(n.matches('button,[role="button"],input[type="submit"],a[class*="btn"],a[class*="button"]')){let i=a.resolve(o.backgroundColor);i&&i[3]>.5&&F(i)>=.3&&A(j,y(i));}}let B=e.querySelector('meta[name="theme-color"]'),U=B?a.resolve(B.content):null,x={background:y(u),text:d},q=V(j)??V(O)??(U?y(U):null);q&&(x.accent=q);let G=V(h);G&&(x.textMuted=G);let W=V(c);W&&(x.border=W);let X=[l.className,l.dataset.theme,l.dataset.mode,r.className,r.dataset.theme].join(" ").toLowerCase(),$=/\bdark\b/.test(X)?"dark":/\blight\b/.test(X)?"light":t.getComputedStyle(l).colorScheme==="dark"||M(u)<.4?"dark":"light",S=$==="dark"?"light":"dark";f.className=S,f.dataset.theme=S,f.dataset.mode=S,f.style.cssText=`display:none;color-scheme:${S}`,r.appendChild(f);let K=t.getComputedStyle(f),T=(n,o)=>{if(!ne(n))return null;let s=a.resolve(n);return !s||s[3]===0?null:s[3]>.98?y(s):o?y(k(s,o)):null},v=Se(e),R={},C={};for(let n of E)for(let o of me[n]){let s=T(m.getPropertyValue(o),u);if(s){R[n]={name:o,confidence:3},C[n]={hex:s,confidence:3};break}}let z=E.filter(n=>!R[n]&&x[n]);if(z.length>0){let n=[];for(let o of Array.from(v.names).slice(0,xe)){let s=T(m.getPropertyValue(o));s&&n.push({name:o,cur:s,oth:T(K.getPropertyValue(o))});}for(let o of z){let s=null;for(let i of n){if(i.cur!==x[o])continue;let p=(ge[o].test(i.name)?2:0)+(i.oth&&i.oth!==i.cur?2:0)-(pe.test(i.name)?1:0);(!s||p>s.score)&&(s={name:i.name,score:p});}s&&s.score>=2&&(R[o]={name:s.name,confidence:2});}}for(let n of E){let o=x[n];!C[n]&&o&&(C[n]={hex:o,confidence:R[n]?2:1});}let N={},P=!1,J=["background","accent","text","textMuted","border"],D=null,Q=(n,o)=>{n==="background"&&(D=a.resolve(o));};for(let n of J){let o=R[n];if(!o)continue;let s=T(K.getPropertyValue(o.name),D);s&&(Q(n,s),N[n]={hex:s,confidence:o.confidence},s!==C[n]?.hex&&(P=!0));}if(!P){for(let s of E)delete N[s];D=null;let n=v.byMode[S],o=(s,i=0)=>i>6?s:s.replace(/var\(\s*(--[\w-]+)\s*(?:,\s*([^()]*))?\)/g,(p,b,I)=>o(n.get(b)??v.byMode.light.get(b)??(m.getPropertyValue(b).trim()||I||""),i+1));for(let s of J){let i=R[s],p=i?n.get(i.name):void 0,b=p?T(o(p),D):null;b&&(Q(s,b),N[s]={hex:b,confidence:2},b!==C[s]?.hex&&(P=!0));}}let Y={[$]:C};P&&(Y[S]=N);let ae=n=>Array.from(e.querySelectorAll(n)).find(o=>o.getClientRects().length>0&&(o.textContent??"").trim()!=="")??null,Z=H(e,r,v.faces),ee=H(e,ae("h1,h2,h3"),v.faces),w={};Z&&(w.body=Z),ee&&(w.heading=ee);let _={host:t.location.host,mode:$,palettes:Y},te=e.title.trim().slice(0,120);return te&&(_.appName=te),(w.body||w.heading)&&(_.fonts=w),_}finally{a.dispose(),f.remove();}}function Ce(e){let t=r=>E.map(l=>{let a=r?.[l];return a?`${a.hex}${a.confidence}`:"-"}).join("");return [e.host,t(e.palettes.light),t(e.palettes.dark),e.fonts?.body?.family??"",e.fonts?.heading?.family??""].join("|")}exports.detectTheme=Re;exports.snapshotHash=Ce;return exports;})({});//# sourceMappingURL=veo-theme.js.map
2
+ //# sourceMappingURL=veo-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins/theme-detect/color.ts","../src/plugins/theme-detect/fonts.ts","../src/plugins/theme-detect/detect-theme.ts"],"names":["RGB_RX","parseRgb","value","m","a","toCssColor","raw","v","parts","p","looksLikeColor","flatten","c","bg","mix","i","toHex","h","n","luminance","saturation","mx","mn","createColorResolver","doc","probe","view","ctx","cache","viaCanvas","computed","canvas","d","key","hit","out","GENERIC","cleanFamily","name","primaryFamily","stack","families","f","prettyFamily","family","describeFont","el","faces","font","weights","face","own","url","origin","links","l","ROLES","KNOWN_VARS","ROLE_NAME","PALETTE_NAME","DARK_SELECTOR","LIGHT_SELECTOR","MAX_ELEMENTS","MAX_VARS","scanSheets","scan","walk","rules","inDarkMedia","rule","style","selector","src","selectors","s","mode","prop","nested","media","sheet","top","counts","best","max","hex","detectTheme","body","html","colors","modeProbe","bodyCs","text","textHex","muted","border","accent","link","bump","k","contrast","elements","cs","flat","softer","meta","metaColor","sampled","sampledAccent","sampledMuted","sampledBorder","hints","other","probeCs","hexOf","over","roleVar","current","role","missing","r","candidates","cur","score","otherPalette","differs","otherOrder","otherBg","noteBg","ref","resolveVar","depth","_m","fb","palettes","firstVisible","bodyFont","headingFont","fonts","snapshot","appName","snapshotHash","colorsOf"],"mappings":"6CAGA,IAAMA,EAAAA,CAAS,gFAAA,CAGR,SAASC,EAAAA,CAASC,CAAAA,CAA4B,CACnD,IAAMC,CAAAA,CAAIH,EAAAA,CAAO,IAAA,CAAKE,CAAAA,CAAM,IAAA,EAAM,CAAA,CAClC,GAAI,CAACC,CAAAA,CAAG,OAAO,IAAA,CACf,IAAMC,CAAAA,CAAID,CAAAA,CAAE,C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EAAAA,CAAUnH,CAAAA,CAAI,KAAA,CAAM,IAAA,EAAK,CAAE,KAAA,CAAM,CAAA,CAAG,GAAG,CAAA,CAC7C,OAAImH,EAAAA,GAASD,CAAAA,CAAS,OAAA,CAAUC,EAAAA,CAAAA,CAAAA,CAC5BF,CAAAA,CAAM,IAAA,EAAQA,CAAAA,CAAM,OAAA,IAASC,CAAAA,CAAS,KAAA,CAAQD,CAAAA,CAAAA,CAC3CC,CACT,QAAE,CACAlD,CAAAA,CAAO,OAAA,EAAQ,CACfC,CAAAA,CAAU,MAAA,GACZ,CACF,CAGO,SAASmD,EAAAA,CAAaF,CAAAA,CAAiC,CAC5D,IAAMG,CAAAA,CAAYpI,CAAAA,EAChB+C,CAAAA,CAAM,GAAA,CAAK+D,CAAAA,EAAM,CACf,IAAM3G,CAAAA,CAA+BH,CAAAA,GAAI8G,CAAC,CAAA,CAC1C,OAAO3G,CAAAA,CAAI,CAAA,EAAGA,CAAAA,CAAE,GAAG,CAAA,EAAGA,CAAAA,CAAE,UAAU,CAAA,CAAA,CAAK,GACzC,CAAC,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA,CACZ,OAAO,CACL8H,CAAAA,CAAS,IAAA,CACTG,CAAAA,CAASH,CAAAA,CAAS,QAAA,CAAS,KAAK,CAAA,CAChCG,EAASH,CAAAA,CAAS,QAAA,CAAS,IAAI,CAAA,CAC/BA,CAAAA,CAAS,KAAA,EAAO,IAAA,EAAM,MAAA,EAAU,EAAA,CAChCA,CAAAA,CAAS,KAAA,EAAO,OAAA,EAAS,MAAA,EAAU,EACrC,CAAA,CAAE,IAAA,CAAK,GAAG,CACZ","file":"veo-theme.js","sourcesContent":["/** Color como `[r, g, b, a]` (a en 0..1). */\nexport type Rgba = [number, number, number, number];\n\nconst RGB_RX = /^rgba?\\(\\s*([\\d.]+)[,\\s]+([\\d.]+)[,\\s]+([\\d.]+)(?:\\s*[,/]\\s*([\\d.]+%?))?\\s*\\)$/;\n\n/** Parsea el `rgb()/rgba()` que devuelve `getComputedStyle`. */\nexport function parseRgb(value: string): Rgba | null {\n const m = RGB_RX.exec(value.trim());\n if (!m) return null;\n const a = m[4] === undefined ? 1 : m[4].endsWith('%') ? Number.parseFloat(m[4]) / 100 : +m[4];\n return [+(m[1] as string), +(m[2] as string), +(m[3] as string), a];\n}\n\n/**\n * Valor crudo de una variable CSS → color CSS válido. Varias librerías guardan\n * los canales SUELTOS para componerlos después: shadcn «262 83% 58%» (hsl),\n * Tailwind viejo «124 58 237» (rgb).\n */\nexport function toCssColor(raw: string): string {\n const v = raw.trim();\n const parts = v.split(/[\\s,/]+/).filter(Boolean);\n const bare = parts.length >= 3 && parts.every((p) => /^-?[\\d.]+(%|deg)?$/.test(p));\n if (!bare) return v;\n return v.includes('%') ? `hsl(${v})` : `rgb(${v})`;\n}\n\n/** Descarta rápido valores de variables que no pueden ser un color (tamaños, sombras, fuentes…). */\nexport function looksLikeColor(raw: string): boolean {\n const v = raw.trim();\n if (!v || v.length > 64) return false;\n return (\n /^(#|rgb|hsl|hwb|lab|lch|oklab|oklch|color\\(|color-mix|light-dark)/i.test(v) ||\n toCssColor(v) !== v\n );\n}\n\n/** Aplana un color con alfa sobre un fondo opaco. */\nexport function flatten(c: Rgba, bg: Rgba): Rgba {\n if (c[3] >= 1) return c;\n const mix = (i: 0 | 1 | 2): number => Math.round(c[i] * c[3] + bg[i] * (1 - c[3]));\n return [mix(0), mix(1), mix(2), 1];\n}\n\nexport function toHex(c: Rgba): string {\n const h = (n: number): string => Math.round(n).toString(16).padStart(2, '0');\n return `#${h(c[0])}${h(c[1])}${h(c[2])}`.toUpperCase();\n}\n\n/** Luminancia relativa aproximada (0 = negro, 1 = blanco). */\nexport function luminance(c: Rgba): number {\n return (0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2]) / 255;\n}\n\n/** Saturación HSL (0..1): separa colores de marca de grises. */\nexport function saturation(c: Rgba): number {\n const mx = Math.max(c[0], c[1], c[2]) / 255;\n const mn = Math.min(c[0], c[1], c[2]) / 255;\n const l = (mx + mn) / 2;\n return mx === mn ? 0 : (mx - mn) / (1 - Math.abs(2 * l - 1));\n}\n\n/**\n * Resuelve CUALQUIER color CSS (hex, hsl, oklch, color-mix, tripletas sueltas…)\n * a RGBA dejando que el navegador haga la conversión: se asigna a un elemento\n * oculto y se lee el computado; si no viene como `rgb()` (oklch, color(srgb…))\n * se pinta en un canvas de 1×1 y se lee el pixel.\n */\nexport function createColorResolver(doc: Document): {\n resolve: (raw: string) => Rgba | null;\n dispose: () => void;\n} {\n const probe = doc.createElement('span');\n probe.style.display = 'none';\n doc.body.appendChild(probe);\n const view = doc.defaultView;\n let ctx: CanvasRenderingContext2D | null | undefined;\n const cache = new Map<string, Rgba | null>();\n\n const viaCanvas = (computed: string): Rgba | null => {\n if (ctx === undefined) {\n try {\n const canvas = doc.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n ctx = canvas.getContext('2d', { willReadFrequently: true });\n } catch {\n ctx = null;\n }\n }\n if (!ctx) return null;\n ctx.clearRect(0, 0, 1, 1);\n ctx.fillStyle = '#000';\n ctx.fillStyle = computed;\n ctx.fillRect(0, 0, 1, 1);\n const d = ctx.getImageData(0, 0, 1, 1).data;\n return [d[0] ?? 0, d[1] ?? 0, d[2] ?? 0, (d[3] ?? 255) / 255];\n };\n\n return {\n resolve(raw) {\n const key = raw.trim();\n if (!key || !view) return null;\n const hit = cache.get(key);\n if (hit !== undefined) return hit;\n let out: Rgba | null = null;\n probe.style.color = '';\n probe.style.color = toCssColor(key);\n if (probe.style.color) {\n const computed = view.getComputedStyle(probe).color;\n out = parseRgb(computed) ?? viaCanvas(computed);\n }\n cache.set(key, out);\n return out;\n },\n dispose() {\n probe.remove();\n },\n };\n}\n","import type { DetectedFont } from './types';\n\nconst GENERIC =\n /^(serif|sans-serif|monospace|cursive|fantasy|system-ui|ui-sans-serif|ui-serif|ui-monospace|ui-rounded|emoji|math|fangsong|inherit|initial|-apple-system|BlinkMacSystemFont|Segoe UI|Roboto|Helvetica|Helvetica Neue|Arial|Noto Sans|Apple Color Emoji|Segoe UI Emoji|Segoe UI Symbol|Noto Color Emoji)$/i;\n\nexport function cleanFamily(name: string): string {\n return name.trim().replace(/^[\"']|[\"']$/g, '');\n}\n\n/** Primera familia REAL del stack (salta genéricas, del sistema y los «Fallback» de next/font). */\nexport function primaryFamily(stack: string): string {\n const families = stack.split(',').map(cleanFamily).filter(Boolean);\n return families.find((f) => !GENERIC.test(f) && !/fallback/i.test(f)) ?? families[0] ?? '';\n}\n\n/** Nombre legible: next/font mutila la familia («__Inter_5972bc» → «Inter»). */\nexport function prettyFamily(family: string): string {\n return family\n .replace(/^__/, '')\n .replace(/_Fallback_[0-9a-f]+$/i, ' Fallback')\n .replace(/_[0-9a-f]{6,}$/i, '')\n .replace(/_/g, ' ')\n .trim();\n}\n\nexport interface FontFaceInfo {\n family: string;\n url: string | null;\n}\n\n/** Describe la fuente de un elemento: nombre, pesos cargados y de dónde se sirve. */\nexport function describeFont(\n doc: Document,\n el: Element | null,\n faces: FontFaceInfo[],\n): DetectedFont | undefined {\n const view = doc.defaultView;\n if (!el || !view) return undefined;\n const family = primaryFamily(view.getComputedStyle(el).fontFamily);\n if (!family) return undefined;\n const font: DetectedFont = {\n name: prettyFamily(family).slice(0, 80),\n family: family.slice(0, 120),\n };\n\n const weights = new Set<string>();\n try {\n for (const face of Array.from(doc.fonts ?? [])) {\n if (cleanFamily(face.family) === family && face.status === 'loaded') weights.add(face.weight);\n }\n } catch {\n // FontFaceSet no disponible: se omiten los pesos.\n }\n if (weights.size > 0) font.weights = [...weights].sort().join(' ').slice(0, 80);\n\n const own = faces.filter((f) => f.family === family);\n const url = own.find((f) => f.url)?.url ?? null;\n let origin: string | null = null;\n try {\n origin = url ? new URL(url, doc.baseURI).origin : null;\n } catch {\n origin = null;\n }\n const links = Array.from(doc.querySelectorAll<HTMLLinkElement>('link[href]')).map((l) => l.href);\n if (origin) {\n font.hosting = origin.includes('fonts.gstatic.com')\n ? 'google'\n : origin === view.location.origin\n ? 'self'\n : 'external';\n } else if (own.length > 0) {\n font.hosting = 'self';\n } else if (links.some((h) => h.includes('fonts.googleapis.com'))) {\n // La hoja de Google Fonts es cross-origin: sus @font-face no se pueden leer.\n font.hosting = 'google';\n } else if (links.some((h) => h.includes('use.typekit.net'))) {\n font.hosting = 'adobe';\n } else {\n font.hosting = 'system';\n }\n return font;\n}\n","import {\n createColorResolver,\n flatten,\n looksLikeColor,\n luminance,\n type Rgba,\n saturation,\n toHex,\n} from './color';\nimport { cleanFamily, describeFont, type FontFaceInfo } from './fonts';\nimport type {\n DetectedColor,\n DetectedPalette,\n ThemeColorRole,\n ThemeMode,\n ThemeSnapshot,\n} from './types';\n\nconst ROLES: ThemeColorRole[] = ['accent', 'text', 'textMuted', 'background', 'border'];\n\n/**\n * Variables CSS conocidas por rol, de más a menos específica (shadcn, Tailwind\n * v4, Bootstrap, MUI, Ant, Chakra). Ojo: en shadcn `--accent` es el gris de\n * hover, por eso va al final.\n */\nconst KNOWN_VARS: Record<ThemeColorRole, string[]> = {\n accent: [\n '--primary',\n '--color-primary',\n '--brand',\n '--color-brand',\n '--brand-primary',\n '--mui-palette-primary-main',\n '--bs-primary',\n '--ant-color-primary',\n '--chakra-colors-brand-500',\n '--accent-color',\n '--accent',\n ],\n text: [\n '--foreground',\n '--color-foreground',\n '--text',\n '--color-text',\n '--text-primary',\n '--bs-body-color',\n '--mui-palette-text-primary',\n ],\n textMuted: [\n '--muted-foreground',\n '--color-muted-foreground',\n '--text-muted',\n '--text-secondary',\n '--bs-secondary-color',\n '--mui-palette-text-secondary',\n ],\n background: [\n '--background',\n '--color-background',\n '--bg',\n '--color-bg',\n '--bs-body-bg',\n '--mui-palette-background-default',\n ],\n border: [\n '--border',\n '--color-border',\n '--border-color',\n '--bs-border-color',\n '--mui-palette-divider',\n ],\n};\n\n/** Nombre «acorde al rol», para elegir entre variables con el mismo valor. */\nconst ROLE_NAME: Record<ThemeColorRole, RegExp> = {\n accent: /brand|primary|accent|main/i,\n text: /text|foreground|\\bfg\\b|-fg|ink|content|body/i,\n textMuted: /muted|secondary|subtle|soft|hint|placeholder|text|-fg/i,\n background: /background|\\bbg\\b|-bg|surface|canvas|page|base/i,\n border: /border|line|divider|stroke|outline|separator/i,\n};\n/** Variables de PALETA (`gray-500`, `white`): no cambian con el modo, no son semánticas. */\nconst PALETTE_NAME = /-(50|[1-9]00|950)$|white|black/i;\n\nconst DARK_SELECTOR =\n /\\.dark\\b|\\[data-(theme|mode|color-scheme)=[\"']?dark|\\.theme-dark|\\.dark-theme/i;\nconst LIGHT_SELECTOR = /^(:root|html|:host|body)$|\\.light\\b|\\[data-(theme|mode)=[\"']?light/i;\n\nconst MAX_ELEMENTS = 1500;\nconst MAX_VARS = 600;\n\ninterface SheetScan {\n names: Set<string>;\n byMode: Record<ThemeMode, Map<string, string>>;\n faces: FontFaceInfo[];\n}\n\n/** Una pasada por las hojas legibles: nombres de variables, valores por modo y @font-face. */\nfunction scanSheets(doc: Document): SheetScan {\n const scan: SheetScan = {\n names: new Set(),\n byMode: { light: new Map(), dark: new Map() },\n faces: [],\n };\n const walk = (rules: CSSRuleList, inDarkMedia: boolean): void => {\n for (const rule of Array.from(rules)) {\n const style = (rule as CSSStyleRule).style as CSSStyleDeclaration | undefined;\n const selector = (rule as CSSStyleRule).selectorText as string | undefined;\n if (rule.constructor.name === 'CSSFontFaceRule' && style) {\n const src = style.getPropertyValue('src');\n const url = /url\\([\"']?([^\"')]+)[\"']?\\)/.exec(src)?.[1] ?? null;\n scan.faces.push({ family: cleanFamily(style.getPropertyValue('font-family')), url });\n } else if (style && typeof selector === 'string') {\n const selectors = selector.split(',').map((s) => s.trim());\n const mode: ThemeMode | null = selectors.some((s) => DARK_SELECTOR.test(s))\n ? 'dark'\n : selectors.some((s) => LIGHT_SELECTOR.test(s))\n ? inDarkMedia\n ? 'dark'\n : 'light'\n : null;\n for (const prop of Array.from(style)) {\n if (!prop.startsWith('--')) continue;\n scan.names.add(prop);\n if (mode) scan.byMode[mode].set(prop, style.getPropertyValue(prop).trim());\n }\n }\n const nested = (rule as CSSGroupingRule).cssRules as CSSRuleList | undefined;\n if (nested) {\n const media = (rule as CSSMediaRule).conditionText ?? '';\n walk(nested, inDarkMedia || /prefers-color-scheme:\\s*dark/.test(media));\n }\n }\n };\n for (const sheet of Array.from(doc.styleSheets)) {\n try {\n walk(sheet.cssRules, false);\n } catch {\n // Hoja cross-origin sin CORS: ilegible.\n }\n }\n return scan;\n}\n\nfunction top(counts: Map<string, number>): string | null {\n let best: string | null = null;\n let max = 0;\n for (const [hex, n] of counts) {\n if (n > max) {\n max = n;\n best = hex;\n }\n }\n return best;\n}\n\n/**\n * Detecta el tema visual de la app donde corre el SDK: los 5 colores base\n * (acento, texto, texto tenue, fondo, borde) en el modo actual Y en el otro, y\n * las fuentes de cuerpo/encabezados. Solo lee estilos: nunca contenido.\n *\n * Colores, de más a menos fiable:\n * 1. variables CSS conocidas (`--primary`, `--foreground`…) → confianza 3;\n * 2. muestreo del DOM (fondo de botones, color del body, borde más frecuente)\n * y, con ese valor, la variable de la app que VALE eso → confianza 2 (así se\n * cubren apps con tokens propios, p. ej. `--color-brand`);\n * 3. el muestreo a secas → confianza 1.\n * El otro modo sale SIN activarlo: un elemento oculto con `class=\"dark\"`\n * hereda las variables de `.dark { … }`; si eso no cambia nada, se leen de la\n * hoja de estilos (`.dark`, `[data-theme=dark]`, `prefers-color-scheme`).\n */\nexport function detectTheme(doc: Document = document): ThemeSnapshot | null {\n const view = doc.defaultView;\n const body = doc.body;\n if (!view || !body) return null;\n const html = doc.documentElement;\n const colors = createColorResolver(doc);\n const modeProbe = doc.createElement('div');\n try {\n const bodyCs = view.getComputedStyle(body);\n\n // ── Fondo y texto base\n let bg: Rgba = [255, 255, 255, 1];\n for (const el of [body, html]) {\n const c = colors.resolve(view.getComputedStyle(el).backgroundColor);\n if (c && c[3] > 0) {\n bg = flatten(c, [255, 255, 255, 1]);\n break;\n }\n }\n const text = flatten(colors.resolve(bodyCs.color) ?? [0, 0, 0, 1], bg);\n const textHex = toHex(text);\n\n // ── Muestreo del DOM visible\n const muted = new Map<string, number>();\n const border = new Map<string, number>();\n const accent = new Map<string, number>();\n const link = new Map<string, number>();\n const bump = (m: Map<string, number>, k: string): void => {\n m.set(k, (m.get(k) ?? 0) + 1);\n };\n const contrast = Math.abs(luminance(text) - luminance(bg));\n const elements = Array.from(body.querySelectorAll('*')).slice(0, MAX_ELEMENTS);\n for (const el of elements) {\n if (el.getClientRects().length === 0) continue;\n const cs = view.getComputedStyle(el);\n const hasText = Array.from(el.childNodes).some(\n (n) => n.nodeType === 3 && (n.textContent ?? '').trim() !== '',\n );\n if (hasText) {\n const c = colors.resolve(cs.color);\n if (c && c[3] > 0) {\n const flat = flatten(c, bg);\n const hex = toHex(flat);\n const softer = Math.abs(luminance(flat) - luminance(bg)) < contrast;\n if (hex !== textHex && saturation(flat) < 0.3 && softer) bump(muted, hex);\n if (el.closest('a') && saturation(flat) >= 0.3) bump(link, hex);\n }\n }\n if (Number.parseFloat(cs.borderTopWidth) > 0 && cs.borderTopStyle !== 'none') {\n const c = colors.resolve(cs.borderTopColor);\n if (c && c[3] > 0) {\n const flat = flatten(c, bg);\n if (saturation(flat) < 0.3 && toHex(flat) !== textHex) bump(border, toHex(flat));\n }\n }\n if (\n el.matches('button,[role=\"button\"],input[type=\"submit\"],a[class*=\"btn\"],a[class*=\"button\"]')\n ) {\n const c = colors.resolve(cs.backgroundColor);\n if (c && c[3] > 0.5 && saturation(c) >= 0.3) bump(accent, toHex(c));\n }\n }\n const meta = doc.querySelector<HTMLMetaElement>('meta[name=\"theme-color\"]');\n const metaColor = meta ? colors.resolve(meta.content) : null;\n const sampled: Partial<Record<ThemeColorRole, string>> = {\n background: toHex(bg),\n text: textHex,\n };\n const sampledAccent = top(accent) ?? top(link) ?? (metaColor ? toHex(metaColor) : null);\n if (sampledAccent) sampled.accent = sampledAccent;\n const sampledMuted = top(muted);\n if (sampledMuted) sampled.textMuted = sampledMuted;\n const sampledBorder = top(border);\n if (sampledBorder) sampled.border = sampledBorder;\n\n // ── Modo actual: clase/atributo → color-scheme → luminancia del fondo\n const hints = [\n html.className,\n html.dataset.theme,\n html.dataset.mode,\n body.className,\n body.dataset.theme,\n ]\n .join(' ')\n .toLowerCase();\n const mode: ThemeMode = /\\bdark\\b/.test(hints)\n ? 'dark'\n : /\\blight\\b/.test(hints)\n ? 'light'\n : view.getComputedStyle(html).colorScheme === 'dark' || luminance(bg) < 0.4\n ? 'dark'\n : 'light';\n const other: ThemeMode = mode === 'dark' ? 'light' : 'dark';\n\n // ── Elemento oculto con la clase del OTRO modo: hereda sus variables\n modeProbe.className = other;\n modeProbe.dataset.theme = other;\n modeProbe.dataset.mode = other;\n modeProbe.style.cssText = `display:none;color-scheme:${other}`;\n body.appendChild(modeProbe);\n const probeCs = view.getComputedStyle(modeProbe);\n // Un color con alfa (p. ej. `--border: rgb(0 0 0 / .1)`) solo vale aplanado\n // sobre el fondo de SU modo; sin fondo conocido se descarta.\n const hexOf = (raw: string, over?: Rgba | null): string | null => {\n if (!looksLikeColor(raw)) return null;\n const c = colors.resolve(raw);\n if (!c || c[3] === 0) return null;\n if (c[3] > 0.98) return toHex(c);\n return over ? toHex(flatten(c, over)) : null;\n };\n\n // ── Rol → variable: por nombre conocido (3) o por valor muestreado (2)\n const scan = scanSheets(doc);\n const roleVar: Partial<Record<ThemeColorRole, { name: string; confidence: 2 | 3 }>> = {};\n const current: DetectedPalette = {};\n for (const role of ROLES) {\n for (const name of KNOWN_VARS[role]) {\n const hex = hexOf(bodyCs.getPropertyValue(name), bg);\n if (hex) {\n roleVar[role] = { name, confidence: 3 };\n current[role] = { hex, confidence: 3 };\n break;\n }\n }\n }\n const missing = ROLES.filter((r) => !roleVar[r] && sampled[r]);\n if (missing.length > 0) {\n const candidates: { name: string; cur: string; oth: string | null }[] = [];\n for (const name of Array.from(scan.names).slice(0, MAX_VARS)) {\n const cur = hexOf(bodyCs.getPropertyValue(name));\n if (cur) candidates.push({ name, cur, oth: hexOf(probeCs.getPropertyValue(name)) });\n }\n for (const role of missing) {\n let best: { name: string; score: number } | null = null;\n for (const c of candidates) {\n if (c.cur !== sampled[role]) continue;\n const score =\n (ROLE_NAME[role].test(c.name) ? 2 : 0) +\n (c.oth && c.oth !== c.cur ? 2 : 0) -\n (PALETTE_NAME.test(c.name) ? 1 : 0);\n if (!best || score > best.score) best = { name: c.name, score };\n }\n // Exige nombre acorde o que cambie con el modo: si no, es coincidencia.\n if (best && best.score >= 2) roleVar[role] = { name: best.name, confidence: 2 };\n }\n }\n for (const role of ROLES) {\n const hex = sampled[role];\n if (!current[role] && hex) current[role] = { hex, confidence: roleVar[role] ? 2 : 1 };\n }\n\n // ── El otro modo: probe; si no cambia nada, la hoja de estilos\n const otherPalette: DetectedPalette = {};\n let differs = false;\n // El fondo va primero: sobre él se aplanan los colores con alfa del otro modo.\n const otherOrder: ThemeColorRole[] = ['background', 'accent', 'text', 'textMuted', 'border'];\n let otherBg: Rgba | null = null;\n const noteBg = (role: ThemeColorRole, hex: string): void => {\n if (role === 'background') otherBg = colors.resolve(hex);\n };\n for (const role of otherOrder) {\n const ref = roleVar[role];\n if (!ref) continue;\n const hex = hexOf(probeCs.getPropertyValue(ref.name), otherBg);\n if (!hex) continue;\n noteBg(role, hex);\n otherPalette[role] = { hex, confidence: ref.confidence };\n if (hex !== current[role]?.hex) differs = true;\n }\n if (!differs) {\n for (const role of ROLES) delete otherPalette[role];\n otherBg = null;\n const sheet = scan.byMode[other];\n const resolveVar = (value: string, depth = 0): string =>\n depth > 6\n ? value\n : value.replace(\n /var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*([^()]*))?\\)/g,\n (_m, name: string, fb?: string) =>\n resolveVar(\n sheet.get(name) ??\n scan.byMode.light.get(name) ??\n (bodyCs.getPropertyValue(name).trim() || fb || ''),\n depth + 1,\n ),\n );\n for (const role of otherOrder) {\n const ref = roleVar[role];\n const raw = ref ? sheet.get(ref.name) : undefined;\n const hex = raw ? hexOf(resolveVar(raw), otherBg) : null;\n if (!hex) continue;\n noteBg(role, hex);\n otherPalette[role] = { hex, confidence: 2 };\n if (hex !== current[role]?.hex) differs = true;\n }\n }\n\n const palettes: ThemeSnapshot['palettes'] = { [mode]: current };\n // Sin ninguna diferencia, la app no tiene (o no expone) otro modo: no se inventa.\n if (differs) palettes[other] = otherPalette;\n\n // ── Fuentes\n const firstVisible = (selector: string): Element | null =>\n Array.from(doc.querySelectorAll(selector)).find(\n (el) => el.getClientRects().length > 0 && (el.textContent ?? '').trim() !== '',\n ) ?? null;\n const bodyFont = describeFont(doc, body, scan.faces);\n const headingFont = describeFont(doc, firstVisible('h1,h2,h3'), scan.faces);\n const fonts: NonNullable<ThemeSnapshot['fonts']> = {};\n if (bodyFont) fonts.body = bodyFont;\n if (headingFont) fonts.heading = headingFont;\n\n const snapshot: ThemeSnapshot = { host: view.location.host, mode, palettes };\n const appName = doc.title.trim().slice(0, 120);\n if (appName) snapshot.appName = appName;\n if (fonts.body || fonts.heading) snapshot.fonts = fonts;\n return snapshot;\n } finally {\n colors.dispose();\n modeProbe.remove();\n }\n}\n\n/** Huella estable del snapshot: si no cambió desde el último envío, no se reenvía. */\nexport function snapshotHash(snapshot: ThemeSnapshot): string {\n const colorsOf = (p?: DetectedPalette): string =>\n ROLES.map((r) => {\n const c: DetectedColor | undefined = p?.[r];\n return c ? `${c.hex}${c.confidence}` : '-';\n }).join('');\n return [\n snapshot.host,\n colorsOf(snapshot.palettes.light),\n colorsOf(snapshot.palettes.dark),\n snapshot.fonts?.body?.family ?? '',\n snapshot.fonts?.heading?.family ?? '',\n ].join('|');\n}\n"]}
package/dist/veo.js CHANGED
@@ -1,3 +1,3 @@
1
- var veo=(function(exports){'use strict';var P="0.0.1";var K="https://veo-backend-production-8c78.up.railway.app";function g(r){let e=r?.apiUrl;if(typeof e=="string"&&e.trim())return e;let t=globalThis.__VEO_API_URL__;return typeof t=="string"&&t.trim()?t:K}function u(){return typeof window<"u"}function l(){return typeof document<"u"}function C(){try{if(typeof localStorage>"u")return !1;let r="__veo_test__";return localStorage.setItem(r,"1"),localStorage.removeItem(r),!0}catch{return false}}function H(){return typeof navigator<"u"&&typeof navigator.sendBeacon=="function"}var v="veoBuilder",q="veoBuilderOrigin",F="veoBuilderPanel",j="veoBuilderPanelPath",Y="veoGuide";var Se="veoPreview",W="veo:preview_token";function Ie(){try{return window.sessionStorage}catch{return null}}function R(){if(!u())return null;let r=null;try{let t=new URLSearchParams(window.location.search).get(Se);r=t||null;}catch{r=null;}let e=Ie();if(r){try{e?.setItem(W,r);}catch{}return r}try{return e?.getItem(W)||null}catch{return null}}function X(){return R()!==null}var U="veo:builder_ctx",J="veo:builder_ctx:",be=1800*1e3;function k(){try{return window.sessionStorage}catch{return null}}function Z(){try{return window.localStorage}catch{return null}}function _e(r){return J+(r||"default")}function Te(r){try{k()?.setItem(U,JSON.stringify(r));}catch{}try{let e={...r,savedAt:Date.now()};Z()?.setItem(_e(r.guide),JSON.stringify(e));}catch{}}function xe(){let r=Z();if(!r)return null;let e=null;try{for(let i=0;i<r.length;i++){let o=r.key(i);if(!o?.startsWith(J))continue;let s=r.getItem(o);if(!s)continue;let a=null;try{a=JSON.parse(s);}catch{continue}if(typeof a?.savedAt!="number"||Date.now()-a.savedAt>be){try{r.removeItem(o);}catch{}continue}(!e||a.savedAt>e.savedAt)&&(e=a);}}catch{return null}if(!e)return null;let{savedAt:t,...n}=e;return n}function Pe(){try{let r=new URLSearchParams(window.location.search);if(r.get(v))return r;let e=window.location.hash.replace(/^#/,"");return e.includes(`${v}=`)?new URLSearchParams(e):r}catch{return null}}function Q(){if(!u())return null;let r=Pe(),e=r?.get(v);if(e){let n={token:e,origin:r?.get(q)??null,panel:r?.get(F)==="1",guide:r?.get(Y)??null,panelPath:r?.get(j)??null};return Te(n),n}if(X())return null;try{let n=k()?.getItem(U);if(n)return JSON.parse(n)}catch{}let t=xe();if(t)try{k()?.setItem(U,JSON.stringify(t));}catch{}return t}function ee(){return Q()?.token??null}function L(){return Q()!==null}function te(r){if(!u()||!l()||ee()===null||(r.apiKey&&r.apiUrl&&(window.__veoBuilder={apiKey:r.apiKey,apiUrl:r.apiUrl}),window.veoBuilder))return;let e=r.builderUrl??Ce();if(e){if(document.querySelector(`script[src="${e}"]`))return;let t=document.createElement("script");t.src=e,t.async=true,r.debug&&t.addEventListener("error",()=>console.error("[veo] no pude cargar",e)),document.head.appendChild(t);return}if(r.loadBuilder){r.loadBuilder().catch(t=>{r.debug&&console.error("[veo] no pude cargar el builder (import din\xE1mico)",t);});return}r.debug&&console.warn("[veo] builder mode pedido pero no pude resolver la URL de veo-builder.js");}function Ce(){let r=document.querySelectorAll("script[src]");for(let e of Array.from(r))if(/\bveo(\.min)?\.js(\?.*)?$/.test(e.src))return e.src.replace(/\bveo(\.min)?\.js/,"veo-builder$1.js");return null}var re=null;function ne(r){return re??(re=Re(r)),re}function Re(r){return new Promise(e=>{if(!u()||!l()){e(null);return}let t=window;if(t.veoGuides){e(t.veoGuides);return}let n=r.guidesUrl??Ue();if(!n){r.debug&&console.warn("[veo] no pude resolver la URL de veo-guides.js"),e(null);return}let i=()=>e(t.veoGuides??null),o=document.querySelector(`script[src="${n}"]`);if(o){o.addEventListener("load",i),o.addEventListener("error",()=>e(null));return}let s=document.createElement("script");s.src=n,s.async=true,s.addEventListener("load",i),s.addEventListener("error",()=>{r.debug&&console.error("[veo] no pude cargar",n),e(null);}),document.head.appendChild(s);})}function Ue(){let r=document.querySelectorAll("script[src]");for(let e of Array.from(r))if(/\bveo(\.min)?\.js(\?.*)?$/.test(e.src))return e.src.replace(/\bveo(\.min)?\.js/,"veo-guides$1.js");return null}function ke(r){return r}var ie={enabled:true,captureClicks:true,captureSubmits:true,captureChanges:true,maskAllInputs:true,maskAllText:false,throttleMs:100,maxTextLength:200,captureElementMetadata:true,captureAncestors:5},oe=10,se=["[data-veo-ignore]",".veo-ignore",'input[type="password"]','input[type="email"]','input[type="tel"]','input[type="hidden"]','[autocomplete="cc-number"]','[autocomplete="cc-csc"]','[autocomplete="cc-exp"]','[autocomplete="cc-name"]','[name*="password" i]','[name*="ssn" i]','[name*="credit" i]','[name*="card" i]','[id*="password" i]','[id*="ssn" i]'],ae=["value","data-credit-card","data-ssn","data-password"],ue=["id","name","type","role","href","data-action","data-veo-tag","data-testid","aria-label","aria-labelledby"],le=[/^css-[a-z0-9]{4,}$/i,/^_[a-z0-9]+_[a-z0-9]{4,}_\d+$/,/^[a-z]{2,4}-[a-z0-9]{6,}$/i,/^[a-f0-9]{6,}$/i,/^sc-[a-z0-9]+$/i];function y(r,e=[]){let t=[...se,...e],n=r;for(;n&&n!==document.documentElement;){for(let i of t)try{if(n.matches(i))return !0}catch{}n=n.parentElement;}return false}function ce(r){let e=r.toLowerCase();return ae.includes(e)||/password|secret|token|ssn|credit/i.test(r)}function de(r,e,t){if(t)return "";let n=r.tagName.toLowerCase();if(n==="input"||n==="textarea")return "";let o=((r instanceof HTMLElement?r.innerText:"")||r.textContent||"").trim().replace(/\s+/g," ");return o.length>e?`${o.slice(0,e)}\u2026`:o}function Le(r){return le.some(e=>e.test(r))}function f(r){return Array.from(r.classList).filter(e=>!Le(e)&&e.length<64)}var Ve=["data-testid","data-test","data-cy","name","aria-label","placeholder","alt","title","href","role","type"],Me=100;function V(r){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(r):r.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g,"\\$&")}function pe(r){return r.replace(/[\\"]/g,"\\$&")}function Ne(r,e){for(let t of Ve){let n=r.getAttribute(t);if(n&&n.length>0&&n.length<=Me)return `${e}[${t}="${pe(n)}"]`}return null}function Oe(r){let e=r.tagName.toLowerCase(),t=r.getAttribute("data-veo-tag");if(t)return `${e}[data-veo-tag="${pe(t)}"]`;if(r.id){let s=f(r),a=s.length>0?`.${s.map(V).join(".")}`:"";return `${e}#${V(r.id)}${a}`}let n=Ne(r,e);if(n)return n;let i=f(r),o=i.length>0?`.${i.map(V).join(".")}`:"";return `${e}${o}`}function ge(r,e=5){let t=[],n=r,i=0;for(;n&&n!==document.documentElement&&i<=e;)t.unshift(Oe(n)),n=n.parentElement,i++;return t.join(" > ")}function Be(r){let e={};for(let t of ue){let n=r.getAttribute(t);n!==null&&!ce(t)&&n.length<256&&(e[t]=n);}return e}function $e(r,e){let t=r.getBoundingClientRect();return {tag:r.tagName.toLowerCase(),id:r.id||null,classes:f(r),text:de(r,e.maxTextLength,e.maskAllText),attributes:e.captureElementMetadata?Be(r):{},position:{x:Math.round(t.left+window.scrollX),y:Math.round(t.top+window.scrollY),w:Math.round(t.width),h:Math.round(t.height)}}}function De(r,e){let t=[],n=r.parentElement,i=0;for(;n&&n!==document.documentElement&&i<e;)t.push({tag:n.tagName.toLowerCase(),id:n.id||null,classes:f(n),veoTag:n.getAttribute("data-veo-tag")||null}),n=n.parentElement,i++;return t}function fe(r,e,t){return {$event_type:r,$element:$e(e,t),$ancestors:De(e,t.captureAncestors),$selector_path:ge(e,t.captureAncestors),$page_url:window.location.href,$page_path:window.location.pathname}}var w=class{constructor(e){this.windowMs=e;this.lastFired=new WeakMap;}shouldFire(e){let t=Date.now(),n=this.lastFired.get(e)??0;return t-n<this.windowMs?false:(this.lastFired.set(e,t),true)}};var E=class{constructor(e,t){this.client=e;this.cleanups=[];let n=ie;this.config={enabled:t.enabled??n.enabled,captureClicks:t.captureClicks??n.captureClicks,captureSubmits:t.captureSubmits??n.captureSubmits,captureChanges:t.captureChanges??n.captureChanges,maskAllInputs:t.maskAllInputs??n.maskAllInputs,maskAllText:t.maskAllText??n.maskAllText,blockSelectors:t.blockSelectors??[],throttleMs:t.throttleMs??n.throttleMs,maxTextLength:t.maxTextLength??n.maxTextLength,captureElementMetadata:t.captureElementMetadata??n.captureElementMetadata,captureAncestors:Math.min(t.captureAncestors??n.captureAncestors,oe)},this.throttle=new w(this.config.throttleMs);}install(){!l()||!this.config.enabled||(this.config.captureClicks&&this.attach("click",e=>this.handleClick(e)),this.config.captureSubmits&&this.attach("submit",e=>this.handleSubmit(e),true),this.config.captureChanges&&this.attach("change",e=>this.handleChange(e),true));}destroy(){for(let e of this.cleanups)e();this.cleanups=[];}attach(e,t,n=false){let i=o=>{if(o.isTrusted)try{t(o);}catch{}};document.addEventListener(e,i,n),this.cleanups.push(()=>document.removeEventListener(e,i,n));}handleClick(e){let t=e.target;if(!(t instanceof Element))return;let n=this.findMeaningfulAncestor(t);n&&(y(n,this.config.blockSelectors)||this.throttle.shouldFire(n)&&this.emit("click",n));}handleSubmit(e){let t=e.target;!(t instanceof Element)||t.tagName.toLowerCase()!=="form"||y(t,this.config.blockSelectors)||this.throttle.shouldFire(t)&&this.emit("submit",t);}handleChange(e){let t=e.target;if(!(t instanceof Element))return;let n=t.tagName.toLowerCase();n!=="select"&&n!=="input"&&n!=="textarea"||t instanceof HTMLInputElement&&t.type!=="checkbox"&&t.type!=="radio"||y(t,this.config.blockSelectors)||this.throttle.shouldFire(t)&&this.emit("change",t);}findMeaningfulAncestor(e){let t=e,n=0;for(;t&&t!==document.documentElement&&n<5;){let i=t.tagName.toLowerCase();if(i==="button"||i==="a"||i==="input"||i==="select"||i==="textarea"||t.hasAttribute("data-veo-tag")||t.hasAttribute("role")||t.hasAttribute("onclick")||t instanceof HTMLElement&&t.style.cursor==="pointer")return t;t=t.parentElement,n++;}return null}emit(e,t){let n=fe(e,t,this.config);this.client.track("$autocapture",n);}};function M(r={}){let e=null;return {name:"autocapture",install(t){e=new E(t,r),e.install();},destroy(){e?.destroy(),e=null;}}}function N(){return {name:"spa-router",install(r){if(!u())return;r.pageview();let e=()=>{queueMicrotask(()=>r.pageview());},t=window.history.pushState,n=window.history.replaceState;window.history.pushState=function(...i){t.apply(this,i),e();},window.history.replaceState=function(...i){n.apply(this,i),e();},window.addEventListener("popstate",e),window.addEventListener("hashchange",e);}}}function d(){let e=Date.now().toString(16).padStart(12,"0"),t=new Uint8Array(10);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(t);else for(let i=0;i<t.length;i++)t[i]=Math.floor(Math.random()*256);t[0]=(t[0]??0)&15|112,t[2]=(t[2]??0)&63|128;let n=Array.from(t,i=>i.toString(16).padStart(2,"0")).join("");return [e.slice(0,8),e.slice(8,12),n.slice(0,4),n.slice(4,8),n.slice(8,20)].join("-")}var A=class{constructor(e){this.config=e;this.buffer=[];this.timer=null;this.flushing=false;this.retryCount=0;this.retryTimer=null;this.startTimer();}add(e){this.buffer.push(e),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);try{await this.config.transport.send("/v1/events",{events:e}),this.retryCount=0;}catch(t){this.buffer.unshift(...e),this.scheduleRetry(),this.config.onError?.(t);}finally{this.flushing=false;}}flushBeacon(){if(this.buffer.length===0)return;let e=this.buffer.splice(0,this.buffer.length);this.config.transport.sendBeacon("/v1/events",{events:e})||this.buffer.unshift(...e);}destroy(){this.timer&&clearInterval(this.timer),this.retryTimer&&clearTimeout(this.retryTimer),this.timer=null,this.retryTimer=null;}startTimer(){this.timer=setInterval(()=>{this.flush();},this.config.flushIntervalMs);}scheduleRetry(){let e=this.config.maxRetries??3;if(this.retryCount>=e){this.retryCount=0;return}this.retryCount++;let t=Math.min(1e3*2**(this.retryCount-1),3e4),n=t/2+Math.random()*(t/2);this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.flush();},n);}};var me="anonymous_user_id",O="end_user_id",S="session_id",m="session_last_active",he=1800*1e3,I=class{constructor(e){this.storage=e;this._endUserId=null;this._anonymousId=this.loadOrCreateAnonymousId(),this._sessionId=this.loadOrCreateSession(),this._endUserId=this.storage.get(O);}get anonymousId(){return this._anonymousId}get sessionId(){return this._sessionId}get endUserId(){return this._endUserId}get effectiveUserId(){return this._endUserId??this._anonymousId}setEndUserId(e){this._endUserId=e,this.storage.set(O,e);}touch(){let e=this.storage.get(m),t=Date.now();e&&t-Number.parseInt(e,10)>he&&(this._sessionId=d(),this.storage.set(S,this._sessionId)),this.storage.set(m,String(t));}reset(){this._endUserId=null,this.storage.remove(O),this._sessionId=d(),this.storage.set(S,this._sessionId),this.storage.set(m,String(Date.now()));}loadOrCreateAnonymousId(){let e=this.storage.get(me);return e||(e=d(),this.storage.set(me,e)),e}loadOrCreateSession(){let e=this.storage.get(S),t=this.storage.get(m);if(e&&t&&Date.now()-Number.parseInt(t,10)<he)return e;let n=d();return this.storage.set(S,n),this.storage.set(m,String(Date.now())),n}};var c="veo:",Ge=365*24*60*60*1e3,b=class{get(e){return localStorage.getItem(c+e)}set(e,t){try{localStorage.setItem(c+e,t);}catch{}}remove(e){localStorage.removeItem(c+e);}clear(){let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(c)&&e.push(n);}for(let t of e)localStorage.removeItem(t);}};function ve(){let r=document.cookie;return r===""?[]:r.split("; ")}var _=class{get(e){let t=`${c}${e}=`;for(let n of ve())if(n.startsWith(t))return decodeURIComponent(n.slice(t.length));return null}set(e,t,n){let i=Math.floor((n?.ttlMs??Ge)/1e3),o=typeof location<"u"&&location.protocol==="https:"?"; Secure":"";document.cookie=`${c}${e}=${encodeURIComponent(t)}; Path=/; Max-Age=${i}; SameSite=Lax${o}`;}remove(e){document.cookie=`${c}${e}=; Path=/; Max-Age=0; SameSite=Lax`;}clear(){for(let e of ve()){let t=e.indexOf("="),n=t===-1?e:e.slice(0,t);n.startsWith(c)&&this.remove(n.slice(c.length));}}},T=class{constructor(){this.store=new Map;}get(e){return this.store.get(e)??null}set(e,t){this.store.set(e,t);}remove(e){this.store.delete(e);}clear(){this.store.clear();}};function ye(r="localStorage"){return r==="localStorage"&&C()?new b:r==="cookie"&&l()?new _:r==="memory"?new T:C()?new b:l()?new _:new T}var B=class extends Error{constructor(t,n){super(t);this.statusCode=n;this.name="TransportError";}},x=class{constructor(e){this.config=e;}async send(e,t){let n=`${this.config.apiUrl}${e}`,i=new AbortController,o=this.config.timeoutMs??1e4,s=setTimeout(()=>i.abort(new DOMException(`Veo request timeout (${o}ms)`,"TimeoutError")),o);try{let a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":this.config.apiKey,"X-Sdk-Version":this.config.sdkVersion},body:JSON.stringify(t),signal:i.signal});if(!a.ok)throw new B(`HTTP ${a.status}`,a.status);return await a.json()}finally{clearTimeout(s);}}sendBeacon(e,t){if(!H())return false;let n=new URL(`${this.config.apiUrl}${e}`);n.searchParams.set("key",this.config.apiKey),n.searchParams.set("v",this.config.sdkVersion);let i=new Blob([JSON.stringify(t)],{type:"application/json"});return navigator.sendBeacon(n.toString(),i)}};var $="organization_id",we="end_user_id",D="identify_signature";function G(r){return r===null||typeof r!="object"?JSON.stringify(r)??"null":Array.isArray(r)?`[${r.map(G).join(",")}]`:`{${Object.keys(r).sort().map(t=>`${JSON.stringify(t)}:${G(r[t])}`).join(",")}}`}var h=class{constructor(e){this.config=e;this.plugins=[];this.currentOrganizationId=null;this.listeners={pageview:new Set,identify:new Set};if(!e.apiKey)throw new Error("apiKey is required");this.storage=ye(e.storage??"localStorage"),this.session=new I(this.storage),this.transport=new x({apiKey:e.apiKey,apiUrl:g(e).replace(/\/$/,""),sdkVersion:P}),this.queue=new A({transport:this.transport,flushIntervalMs:e.flushInterval??5e3,batchSize:e.flushBatchSize??20,onError:i=>{e.debug&&console.error("[veo] flush error:",i);}});let t=this.storage.get(we);t&&this.session.setEndUserId(t);let n=this.storage.get($);n&&(this.currentOrganizationId=n),this.setupUnloadHandlers(),e.debug&&console.log("[veo] initialized",{anonymousId:this.session.anonymousId,sessionId:this.session.sessionId,endUserId:this.session.endUserId});}identify(e){let{visitor:t,organization:n}=e,i=G({id:t.id,traits:t.traits??{},org:n?{id:n.id,attributes:n.attributes??{}}:null});if(this.session.endUserId===t.id&&this.storage.get(D)===i){this.config.debug&&console.debug("[veo] identify: sin cambios, omitido");return}let o=this.session.endUserId===null?this.session.anonymousId:void 0;this.session.setEndUserId(t.id),n&&(this.currentOrganizationId=n.id,this.storage.set($,n.id));let a={endUser:{id:t.id,traits:t.traits??{},...o!==void 0?{anonymousId:o}:{}},...n?{organization:{id:n.id,attributes:n.attributes??{}}}:{}};this.transport.send("/v1/identify",a).catch(p=>{this.config.debug&&console.error("[veo] identify failed:",p);}),this.enqueue({actionType:"identify",actionProperties:{traits:t.traits,organizationAttributes:n?.attributes}}),this.storage.set(D,i),this.emit("identify",{endUserId:t.id,sessionId:this.session.sessionId});}track(e,t){if(!e||typeof e!="string"){this.config.debug&&console.error("[veo] track: name is required");return}this.enqueue({actionType:"track",actionName:e,...t!==void 0?{actionProperties:t}:{}});}pageview(e){if(!l())return;let t=window.location.href,n=e??window.location.pathname;this.enqueue({actionType:"pageview",pageUrl:t,pagePath:n,pageTitle:document.title,pageReferrer:document.referrer}),this.emit("pageview",{url:t,path:n,sessionId:this.session.sessionId,endUserId:this.session.endUserId});}reset(){this.session.reset(),this.currentOrganizationId=null,this.storage.remove($),this.storage.remove(we),this.storage.remove(D);}flush(){return this.queue.flush()}use(e){return this.plugins.push(e),e.install(this),this}getEndUserId(){return this.session.endUserId}getAnonymousId(){return this.session.anonymousId}getSessionId(){return this.session.sessionId}on(e,t){return this.listeners[e].add(t),()=>{this.listeners[e].delete(t);}}emit(e,t){for(let n of this.listeners[e])try{n(t);}catch(i){this.config.debug&&console.error(`[veo] listener for '${e}' failed:`,i);}}enqueue(e){this.session.touch();let t=this.currentOrganizationId??void 0,n=e.pageUrl??(u()?window.location.href:void 0),i=e.pagePath??(u()?window.location.pathname:void 0),o=e.pageTitle??(l()?document.title:void 0),s=e.pageReferrer??(l()?document.referrer:void 0),a={actionId:d(),endUserId:this.session.effectiveUserId,sessionId:this.session.sessionId,actionType:e.actionType,occurredAt:new Date().toISOString(),...t!==void 0?{organizationId:t}:{},...e.actionName!==void 0?{actionName:e.actionName}:{},...n!==void 0?{pageUrl:n}:{},...i!==void 0?{pagePath:i}:{},...o!==void 0?{pageTitle:o}:{},...s!==void 0?{pageReferrer:s}:{},...e.actionProperties!==void 0?{actionProperties:e.actionProperties}:{}};this.queue.add(a);}setupUnloadHandlers(){u()&&(window.addEventListener("pagehide",()=>this.queue.flushBeacon()),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.queue.flushBeacon();}));}};function Ee(r,e,t){let n=new h(r);if(n.use(N()),r.autocapture!==false){let i=typeof r.autocapture=="object"?r.autocapture:{};n.use(M(i));}if(e(n),typeof window<"u"){let o=window.veo?._q??[];window.veo=n;for(let s of o){let[a,p]=s;if(a==="init")continue;let z=n[a];if(typeof z=="function")try{z.apply(n,Array.from(p));}catch(Ae){r.debug&&console.error("[veo] drain error:",Ae);}}te({...r.builderUrl!==void 0?{builderUrl:r.builderUrl}:{},...r.debug!==void 0?{debug:r.debug}:{},...r.apiKey!==void 0?{apiKey:r.apiKey}:{},apiUrl:g(r),...{}});}return n}function rr(r){let e=g(r);return Ee(r,t=>{let n=()=>ne({...r.guidesUrl!==void 0?{guidesUrl:r.guidesUrl}:{},...r.debug!==void 0?{debug:r.debug}:{}}),i=R();r.guides===true&&!L()&&i===null&&n().then(o=>{o&&t.use(o.guidesPlugin({apiUrl:e,apiKey:r.apiKey,...r.debug!==void 0?{debug:r.debug}:{}}));}),i!==null&&n().then(o=>o?.runPreviewMode({apiKey:r.apiKey,apiUrl:e,token:i,...r.debug!==void 0?{debug:r.debug}:{}})),t.preview=o=>{let s=null,a=n().then(p=>p?(s=p.previewGuide(o),s.ready):{rendered:false});return {close:()=>s?.close(),ready:a,host:()=>s?.host()??null}},t.closePreview=()=>{n().then(o=>o?.closeGuidePreview());};})}
2
- exports.Client=h;exports.SDK_VERSION=P;exports.autocapturePlugin=M;exports.definePlugin=ke;exports.init=rr;exports.spaRouterPlugin=N;return exports;})({});//# sourceMappingURL=veo.js.map
1
+ var veo=(function(exports){'use strict';var D="0.0.1";var J="https://veo-backend-production-8c78.up.railway.app";function f(r){let e=r?.apiUrl;if(typeof e=="string"&&e.trim())return e;let t=globalThis.__VEO_API_URL__;return typeof t=="string"&&t.trim()?t:J}function c(){return typeof window<"u"}function d(){return typeof document<"u"}function O(){try{if(typeof localStorage>"u")return !1;let r="__veo_test__";return localStorage.setItem(r,"1"),localStorage.removeItem(r),!0}catch{return false}}function Z(){return typeof navigator<"u"&&typeof navigator.sendBeacon=="function"}var S="veoBuilder",ee="veoBuilderOrigin",te="veoBuilderPanel",re="veoBuilderPanelPath",ne="veoGuide";var De="veoPreview",oe="veo:preview_token";function Oe(){try{return window.sessionStorage}catch{return null}}function V(){if(!c())return null;let r=null;try{let t=new URLSearchParams(window.location.search).get(De);r=t||null;}catch{r=null;}let e=Oe();if(r){try{e?.setItem(oe,r);}catch{}return r}try{return e?.getItem(oe)||null}catch{return null}}function ie(){return V()!==null}var $="veo:builder_ctx",se="veo:builder_ctx:",Ve=1800*1e3;function N(){try{return window.sessionStorage}catch{return null}}function ae(){try{return window.localStorage}catch{return null}}function $e(r){return se+(r||"default")}function Ne(r){try{N()?.setItem($,JSON.stringify(r));}catch{}try{let e={...r,savedAt:Date.now()};ae()?.setItem($e(r.guide),JSON.stringify(e));}catch{}}function Be(){let r=ae();if(!r)return null;let e=null;try{for(let o=0;o<r.length;o++){let i=r.key(o);if(!i?.startsWith(se))continue;let s=r.getItem(i);if(!s)continue;let a=null;try{a=JSON.parse(s);}catch{continue}if(typeof a?.savedAt!="number"||Date.now()-a.savedAt>Ve){try{r.removeItem(i);}catch{}continue}(!e||a.savedAt>e.savedAt)&&(e=a);}}catch{return null}if(!e)return null;let{savedAt:t,...n}=e;return n}function Ke(){try{let r=new URLSearchParams(window.location.search);if(r.get(S))return r;let e=window.location.hash.replace(/^#/,"");return e.includes(`${S}=`)?new URLSearchParams(e):r}catch{return null}}function ue(){if(!c())return null;let r=Ke(),e=r?.get(S);if(e){let n={token:e,origin:r?.get(ee)??null,panel:r?.get(te)==="1",guide:r?.get(ne)??null,panelPath:r?.get(re)??null};return Ne(n),n}if(ie())return null;try{let n=N()?.getItem($);if(n)return JSON.parse(n)}catch{}let t=Be();if(t)try{N()?.setItem($,JSON.stringify(t));}catch{}return t}function le(){return ue()?.token??null}function y(){return ue()!==null}function ce(r){if(!c()||!d()||le()===null||(r.apiKey&&r.apiUrl&&(window.__veoBuilder={apiKey:r.apiKey,apiUrl:r.apiUrl}),window.veoBuilder))return;let e=r.builderUrl??He();if(e){if(document.querySelector(`script[src="${e}"]`))return;let t=document.createElement("script");t.src=e,t.async=true,r.debug&&t.addEventListener("error",()=>console.error("[veo] no pude cargar",e)),document.head.appendChild(t);return}if(r.loadBuilder){r.loadBuilder().catch(t=>{r.debug&&console.error("[veo] no pude cargar el builder (import din\xE1mico)",t);});return}r.debug&&console.warn("[veo] builder mode pedido pero no pude resolver la URL de veo-builder.js");}function He(){let r=document.querySelectorAll("script[src]");for(let e of Array.from(r))if(/\bveo(\.min)?\.js(\?.*)?$/.test(e.src))return e.src.replace(/\bveo(\.min)?\.js/,"veo-builder$1.js");return null}var de=null;function pe(r){return de??(de=Ge(r)),de}function Ge(r){return new Promise(e=>{if(!c()||!d()){e(null);return}let t=window;if(t.veoGuides){e(t.veoGuides);return}let n=r.guidesUrl??qe();if(!n){r.debug&&console.warn("[veo] no pude resolver la URL de veo-guides.js"),e(null);return}let o=()=>e(t.veoGuides??null),i=document.querySelector(`script[src="${n}"]`);if(i){i.addEventListener("load",o),i.addEventListener("error",()=>e(null));return}let s=document.createElement("script");s.src=n,s.async=true,s.addEventListener("load",o),s.addEventListener("error",()=>{r.debug&&console.error("[veo] no pude cargar",n),e(null);}),document.head.appendChild(s);})}function qe(){let r=document.querySelectorAll("script[src]");for(let e of Array.from(r))if(/\bveo(\.min)?\.js(\?.*)?$/.test(e.src))return e.src.replace(/\bveo(\.min)?\.js/,"veo-guides$1.js");return null}function ze(r){return r}var he={enabled:true,captureClicks:true,captureSubmits:true,captureChanges:true,maskAllInputs:true,maskAllText:false,throttleMs:100,maxTextLength:200,captureElementMetadata:true,captureAncestors:5,captureClickQuality:true},me=10,fe=["[data-veo-ignore]",".veo-ignore",'input[type="password"]','input[type="email"]','input[type="tel"]','input[type="hidden"]','[autocomplete="cc-number"]','[autocomplete="cc-csc"]','[autocomplete="cc-exp"]','[autocomplete="cc-name"]','[name*="password" i]','[name*="ssn" i]','[name*="credit" i]','[name*="card" i]','[id*="password" i]','[id*="ssn" i]'],ge=["value","data-credit-card","data-ssn","data-password"],ve=["id","name","type","role","href","data-action","data-veo-tag","data-testid","aria-label","aria-labelledby"],ye=[/^css-[a-z0-9]{4,}$/i,/^_[a-z0-9]+_[a-z0-9]{4,}_\d+$/,/^[a-z]{2,4}-[a-z0-9]{6,}$/i,/^[a-f0-9]{6,}$/i,/^sc-[a-z0-9]+$/i];function We(r){return ye.some(e=>e.test(r))}function w(r){return Array.from(r.classList).filter(e=>!We(e)&&e.length<64)}var je=["data-testid","data-test","data-cy","name","aria-label","placeholder","alt","title","href","role","type"],Fe=100;function B(r){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(r):r.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g,"\\$&")}function we(r){return r.replace(/[\\"]/g,"\\$&")}function Xe(r,e){for(let t of je){let n=r.getAttribute(t);if(n&&n.length>0&&n.length<=Fe)return `${e}[${t}="${we(n)}"]`}return null}function Ye(r){let e=r.tagName.toLowerCase(),t=r.getAttribute("data-veo-tag");if(t)return `${e}[data-veo-tag="${we(t)}"]`;if(r.id){let s=w(r),a=s.length>0?`.${s.map(B).join(".")}`:"";return `${e}#${B(r.id)}${a}`}let n=Xe(r,e);if(n)return n;let o=w(r),i=o.length>0?`.${o.map(B).join(".")}`:"";return `${e}${i}`}function A(r,e=5){let t=[],n=r,o=0;for(;n&&n!==document.documentElement&&o<=e;)t.unshift(Ye(n)),n=n.parentElement,o++;return t.join(" > ")}var Qe=new Set(["input","textarea","select","option","label"]),Je=200,Ze=3e3,et={reactionWindowMs:1e3,errorWindowMs:2e3,rageClicks:3,rageWindowMs:1e3,rageClicksSlow:5,rageWindowSlowMs:3e3,maxPerElement:50};function Ee(r){let e;if(r instanceof Error)e=`${r.name}: ${r.message}`;else if(typeof r=="string")e=r;else try{e=JSON.stringify(r)??String(r);}catch{e=String(r);}return e.slice(0,Je)}var T=class{constructor(e,t={}){this.emit=e;this.installed=false;this.cleanups=[];this.netCount=0;this.navCount=0;this.focusCount=0;this.unloading=false;this.errors=[];this.history=new Map;this.bursts=new Map;this.emitted=new Map;this.opts={...et,...t};}install(){if(this.installed||!c())return;this.installed=true;let e=(t,n,o=true)=>{window.addEventListener(t,n,o),this.cleanups.push(()=>window.removeEventListener(t,n,o));};e("error",t=>{let n=t;this.pushError("error",n.error??n.message??"error");}),e("unhandledrejection",t=>{this.pushError("unhandledrejection",t.reason??"rejection");}),e("popstate",()=>this.navCount++),e("hashchange",()=>this.navCount++),e("focusin",()=>this.focusCount++),e("pagehide",()=>{this.unloading=true;}),e("beforeunload",()=>{this.unloading=true;}),this.patchHistory(),this.patchConsole(),this.patchFetch(),this.patchXhr();}destroy(){for(let e of this.cleanups)e();this.cleanups=[];for(let e of this.bursts.values())window.clearTimeout(e.timer);this.bursts.clear(),this.history.clear(),this.installed=false;}onClick(e,t){if(!this.installed)return;let n=Date.now(),o={at:n,reacted:false};this.remember(e,o),this.observeReaction(e,o,t),this.observeErrors(e,n),this.trackRage(e,n);}observeReaction(e,t,n){let o=this.netCount,i=this.navCount,s=this.focusCount,a=window.location.href,l=this.isDeadExempt(e,n),u=null;typeof MutationObserver<"u"&&(u=new MutationObserver(()=>{t.reacted=true,u?.disconnect(),u=null;}),u.observe(document.documentElement,{childList:true,attributes:true,characterData:true,subtree:true})),window.setTimeout(()=>{u?.disconnect();let p=t.reacted||this.unloading||this.netCount!==o||this.navCount!==i||this.focusCount!==s||window.location.href!==a;t.reacted=p,!p&&!l&&this.report("$dead_click",e,{});},this.opts.reactionWindowMs);}isDeadExempt(e,t){if(t&&(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)||t&&typeof t.button=="number"&&t.button!==0)return true;let n=e.tagName.toLowerCase();if(Qe.has(n)||e.closest('[contenteditable=""],[contenteditable="true"]'))return true;let o=e.closest("a");if(o){if(o.target==="_blank"||o.hasAttribute("download"))return true;let i=o.getAttribute("href")??"";if(/^(mailto|tel|sms):/i.test(i))return true}return false}observeErrors(e,t){let n=t+this.opts.errorWindowMs,o=()=>{let i=this.errors.find(s=>s.at>=t&&s.at<=n);if(i){this.report("$click_error",e,{$error_source:i.source,$error_message:i.message});return}Date.now()<n&&window.setTimeout(o,250);};window.setTimeout(o,250);}pushError(e,t){let n=Ee(t);if(n.startsWith("[veo]"))return;this.errors.push({at:Date.now(),source:e,message:n});let o=Date.now()-this.opts.errorWindowMs-1e3;for(;this.errors.length>0&&this.errors[0].at<o;)this.errors.shift();this.errors.length>50&&this.errors.splice(0,this.errors.length-50);}remember(e,t){let n=this.history.get(e)??[],o=t.at-Ze,i=n.filter(s=>s.at>=o);if(i.push(t),this.history.set(e,i),this.history.size>100)for(let[s,a]of this.history)a.every(l=>l.at<o)&&this.history.delete(s);}trackRage(e,t){let n=this.history.get(e)??[],o=n.filter(u=>u.at>=t-this.opts.rageWindowMs).length,i=n.filter(u=>u.at>=t-this.opts.rageWindowSlowMs).length,s=this.bursts.get(e),a=o>=this.opts.rageClicks||i>=this.opts.rageClicksSlow;if(!s&&!a)return;let l=s??{startedAt:(n.find(u=>u.at>=t-this.opts.rageWindowSlowMs)??{at:t}).at,count:0,timer:0};l.count=n.filter(u=>u.at>=l.startedAt).length,window.clearTimeout(l.timer),l.timer=window.setTimeout(()=>{this.bursts.delete(e);let u=(this.history.get(e)??[]).filter(p=>p.at>=l.startedAt);this.report("$rage_click",e,{$click_count:Math.max(u.length,l.count),$reacted_clicks:u.filter(p=>p.reacted).length});},this.opts.reactionWindowMs+50),this.bursts.set(e,l);}report(e,t,n){let o=A(t,5),i=this.emitted.get(o)??{$dead_click:0,$rage_click:0,$click_error:0};if(!(i[e]>=this.opts.maxPerElement)){i[e]++,this.emitted.set(o,i);try{this.emit(e,t,n);}catch{}}}patchHistory(){let e=window.history;if(!e)return;let t=e.pushState,n=e.replaceState,o=this;e.pushState=function(...i){return o.navCount++,t.apply(this,i)},e.replaceState=function(...i){return o.navCount++,n.apply(this,i)},this.cleanups.push(()=>{e.pushState=t,e.replaceState=n;});}patchConsole(){let e=console.error,t=this;console.error=function(...n){try{t.pushError("console",n.map(Ee).join(" "));}catch{}return e.apply(this,n)},this.cleanups.push(()=>{console.error=e;});}patchFetch(){if(typeof window.fetch!="function")return;let e=window.fetch,t=this;window.fetch=function(...n){t.netCount++;let o=e.apply(this,n);return o&&typeof o.then=="function"&&o.then(i=>{i&&i.status>=500&&t.pushError("fetch",`${i.status} ${i.url}`);},i=>t.pushError("fetch",i)),o},this.cleanups.push(()=>{window.fetch=e;});}patchXhr(){let e=typeof XMLHttpRequest<"u"?XMLHttpRequest.prototype:null;if(!e)return;let t=e.send,n=this;e.send=function(...o){n.netCount++;try{this.addEventListener("loadend",()=>{this.status>=500&&n.pushError("xhr",`${this.status} ${this.responseURL}`);});}catch{}return t.apply(this,o)},this.cleanups.push(()=>{e.send=t;});}};function _(r,e=[]){let t=[...fe,...e],n=r;for(;n&&n!==document.documentElement;){for(let o of t)try{if(n.matches(o))return !0}catch{}n=n.parentElement;}return false}function be(r){let e=r.toLowerCase();return ge.includes(e)||/password|secret|token|ssn|credit/i.test(r)}function Se(r,e,t){if(t)return "";let n=r.tagName.toLowerCase();if(n==="input"||n==="textarea")return "";let i=((r instanceof HTMLElement?r.innerText:"")||r.textContent||"").trim().replace(/\s+/g," ");return i.length>e?`${i.slice(0,e)}\u2026`:i}function tt(r){let e={};for(let t of ve){let n=r.getAttribute(t);n!==null&&!be(t)&&n.length<256&&(e[t]=n);}return e}function rt(r,e){let t=r.getBoundingClientRect();return {tag:r.tagName.toLowerCase(),id:r.id||null,classes:w(r),text:Se(r,e.maxTextLength,e.maskAllText),attributes:e.captureElementMetadata?tt(r):{},position:{x:Math.round(t.left+window.scrollX),y:Math.round(t.top+window.scrollY),w:Math.round(t.width),h:Math.round(t.height)}}}function nt(r,e){let t=[],n=r.parentElement,o=0;for(;n&&n!==document.documentElement&&o<e;)t.push({tag:n.tagName.toLowerCase(),id:n.id||null,classes:w(n),veoTag:n.getAttribute("data-veo-tag")||null}),n=n.parentElement,o++;return t}function K(r,e,t){return {$event_type:r,$element:rt(e,t),$ancestors:nt(e,t.captureAncestors),$selector_path:A(e,t.captureAncestors),$page_url:window.location.href,$page_path:window.location.pathname}}var I=class{constructor(e){this.windowMs=e;this.lastFired=new WeakMap;}shouldFire(e){let t=Date.now(),n=this.lastFired.get(e)??0;return t-n<this.windowMs?false:(this.lastFired.set(e,t),true)}};var C=class{constructor(e,t){this.client=e;this.cleanups=[];this.quality=null;let n=he;this.config={enabled:t.enabled??n.enabled,captureClicks:t.captureClicks??n.captureClicks,captureSubmits:t.captureSubmits??n.captureSubmits,captureChanges:t.captureChanges??n.captureChanges,maskAllInputs:t.maskAllInputs??n.maskAllInputs,maskAllText:t.maskAllText??n.maskAllText,blockSelectors:t.blockSelectors??[],throttleMs:t.throttleMs??n.throttleMs,maxTextLength:t.maxTextLength??n.maxTextLength,captureElementMetadata:t.captureElementMetadata??n.captureElementMetadata,captureAncestors:Math.min(t.captureAncestors??n.captureAncestors,me),captureClickQuality:t.captureClickQuality??n.captureClickQuality},this.throttle=new I(this.config.throttleMs);}install(){!d()||!this.config.enabled||(this.config.captureClicks&&this.config.captureClickQuality&&(this.quality=new T((e,t,n)=>{let o=K("click",t,this.config);this.client.track(e,{...o,...n});}),this.quality.install()),this.config.captureClicks&&this.attach("click",e=>this.handleClick(e)),this.config.captureSubmits&&this.attach("submit",e=>this.handleSubmit(e),true),this.config.captureChanges&&this.attach("change",e=>this.handleChange(e),true));}destroy(){for(let e of this.cleanups)e();this.cleanups=[],this.quality?.destroy(),this.quality=null;}attach(e,t,n=false){let o=i=>{if(i.isTrusted)try{t(i);}catch{}};document.addEventListener(e,o,n),this.cleanups.push(()=>document.removeEventListener(e,o,n));}handleClick(e){let t=e.target;if(!(t instanceof Element))return;let n=this.findMeaningfulAncestor(t);n&&(_(n,this.config.blockSelectors)||(this.quality?.onClick(n,e),this.throttle.shouldFire(n)&&this.emit("click",n)));}handleSubmit(e){let t=e.target;!(t instanceof Element)||t.tagName.toLowerCase()!=="form"||_(t,this.config.blockSelectors)||this.throttle.shouldFire(t)&&this.emit("submit",t);}handleChange(e){let t=e.target;if(!(t instanceof Element))return;let n=t.tagName.toLowerCase();n!=="select"&&n!=="input"&&n!=="textarea"||t instanceof HTMLInputElement&&t.type!=="checkbox"&&t.type!=="radio"||_(t,this.config.blockSelectors)||this.throttle.shouldFire(t)&&this.emit("change",t);}findMeaningfulAncestor(e){let t=e,n=0;for(;t&&t!==document.documentElement&&n<5;){let o=t.tagName.toLowerCase();if(o==="button"||o==="a"||o==="input"||o==="select"||o==="textarea"||t.hasAttribute("data-veo-tag")||t.hasAttribute("role")||t.hasAttribute("onclick")||t instanceof HTMLElement&&t.style.cursor==="pointer")return t;t=t.parentElement,n++;}return null}emit(e,t){let n=K(e,t,this.config);this.client.track("$autocapture",n);}};function H(r={}){let e=null;return {name:"autocapture",install(t){e=new C(t,r),e.install();},destroy(){e?.destroy(),e=null;}}}function G(){return {name:"spa-router",install(r){if(!c())return;r.pageview();let e=()=>{queueMicrotask(()=>r.pageview());},t=window.history.pushState,n=window.history.replaceState;window.history.pushState=function(...o){t.apply(this,o),e();},window.history.replaceState=function(...o){n.apply(this,o),e();},window.addEventListener("popstate",e),window.addEventListener("hashchange",e);}}}var ot="veo_theme_",_e=1440*60*1e3,Ae=4e3,it=4;function Te(r){try{let e=localStorage.getItem(r),t=e?JSON.parse(e):null;return t&&typeof t=="object"?t:{}}catch{return {}}}function st(r,e){try{localStorage.setItem(r,JSON.stringify(e));}catch{}}function at(r,e){let t=[r.documentElement.className,r.documentElement.dataset.theme,r.documentElement.dataset.mode,r.body?.className].join(" ").toLowerCase();return /\bdark\b/.test(t)?"dark":/\blight\b/.test(t)?"light":e?"dark":"light"}function ut(r,e,t){let n=r[e];return n!==void 0&&t-n.at<_e}function lt(r,e,t,n){let o=r[e];return !o||o.hash!==t||n-o.at>=_e}function Ie(r){let e=`${ot}${r.apiKey.slice(-16)||"default"}`,t=null,n=null,o=false,i=0,s=async()=>{if(o||i>=it)return;let l=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,u=at(document,l);if(!ut(Te(e),u,Date.now())){i++;try{let p=await r.loadDetector();if(!p||o)return;let h=p.detectTheme();if(!h)return;let X=p.snapshotHash(h),v=Te(e),Le=Date.now(),Y=()=>{let Q={hash:X,at:Date.now()};v[h.mode]=Q,v[u]=v[u]&&u!==h.mode?v[u]:Q,st(e,v);};if(!lt(v,h.mode,X,Le)){Y();return}r.debug&&console.log("[veo] theme snapshot",h),(await fetch(`${r.apiUrl}/v1/workspaces/theme-snapshot`,{method:"POST",headers:{"X-Api-Key":r.apiKey,"Content-Type":"application/json"},body:JSON.stringify(h),credentials:"omit"})).ok&&Y();}catch(p){r.debug&&console.warn("[veo] theme detect failed",p);}}},a=l=>{n&&clearTimeout(n),n=setTimeout(()=>{n=null;let u=window.requestIdleCallback;typeof u=="function"?u(()=>{s();}):s();},l);};return {name:"theme-detect",install(){!c()||!d()||(document.readyState==="complete"?a(Ae):window.addEventListener("load",()=>a(Ae),{once:true}),typeof MutationObserver=="function"&&(t=new MutationObserver(()=>a(1500)),t.observe(document.documentElement,{attributes:true,attributeFilter:["class","data-theme","data-mode"]})));},destroy(){o=true,t?.disconnect(),n&&clearTimeout(n);}}}function g(){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 o=0;o<t.length;o++)t[o]=Math.floor(Math.random()*256);t[0]=(t[0]??0)&15|112,t[2]=(t[2]??0)&63|128;let n=Array.from(t,o=>o.toString(16).padStart(2,"0")).join("");return [e.slice(0,8),e.slice(8,12),n.slice(0,4),n.slice(4,8),n.slice(8,20)].join("-")}var k=class{constructor(e){this.config=e;this.buffer=[];this.timer=null;this.flushing=false;this.retryCount=0;this.retryTimer=null;this.startTimer();}add(e){this.buffer.push(e),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);try{await this.config.transport.send("/v1/events",{events:e}),this.retryCount=0;}catch(t){this.buffer.unshift(...e),this.scheduleRetry(),this.config.onError?.(t);}finally{this.flushing=false;}}flushBeacon(){if(this.buffer.length===0)return;let e=this.buffer.splice(0,this.buffer.length);this.config.transport.sendBeacon("/v1/events",{events:e})||this.buffer.unshift(...e);}destroy(){this.timer&&clearInterval(this.timer),this.retryTimer&&clearTimeout(this.retryTimer),this.timer=null,this.retryTimer=null;}startTimer(){this.timer=setInterval(()=>{this.flush();},this.config.flushIntervalMs);}scheduleRetry(){let e=this.config.maxRetries??3;if(this.retryCount>=e){this.retryCount=0;return}this.retryCount++;let t=Math.min(1e3*2**(this.retryCount-1),3e4),n=t/2+Math.random()*(t/2);this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.flush();},n);}};var Ce="anonymous_user_id",q="end_user_id",P="session_id",E="session_last_active",ke=1800*1e3,x=class{constructor(e){this.storage=e;this._endUserId=null;this._anonymousId=this.loadOrCreateAnonymousId(),this._sessionId=this.loadOrCreateSession(),this._endUserId=this.storage.get(q);}get anonymousId(){return this._anonymousId}get sessionId(){return this._sessionId}get endUserId(){return this._endUserId}get effectiveUserId(){return this._endUserId??this._anonymousId}setEndUserId(e){this._endUserId=e,this.storage.set(q,e);}touch(){let e=this.storage.get(E),t=Date.now();e&&t-Number.parseInt(e,10)>ke&&(this._sessionId=g(),this.storage.set(P,this._sessionId)),this.storage.set(E,String(t));}reset(){this._endUserId=null,this.storage.remove(q),this._sessionId=g(),this.storage.set(P,this._sessionId),this.storage.set(E,String(Date.now()));}loadOrCreateAnonymousId(){let e=this.storage.get(Ce);return e||(e=g(),this.storage.set(Ce,e)),e}loadOrCreateSession(){let e=this.storage.get(P),t=this.storage.get(E);if(e&&t&&Date.now()-Number.parseInt(t,10)<ke)return e;let n=g();return this.storage.set(P,n),this.storage.set(E,String(Date.now())),n}};var m="veo:",ct=365*24*60*60*1e3,R=class{get(e){return localStorage.getItem(m+e)}set(e,t){try{localStorage.setItem(m+e,t);}catch{}}remove(e){localStorage.removeItem(m+e);}clear(){let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(m)&&e.push(n);}for(let t of e)localStorage.removeItem(t);}};function Pe(){let r=document.cookie;return r===""?[]:r.split("; ")}var M=class{get(e){let t=`${m}${e}=`;for(let n of Pe())if(n.startsWith(t))return decodeURIComponent(n.slice(t.length));return null}set(e,t,n){let o=Math.floor((n?.ttlMs??ct)/1e3),i=typeof location<"u"&&location.protocol==="https:"?"; Secure":"";document.cookie=`${m}${e}=${encodeURIComponent(t)}; Path=/; Max-Age=${o}; SameSite=Lax${i}`;}remove(e){document.cookie=`${m}${e}=; Path=/; Max-Age=0; SameSite=Lax`;}clear(){for(let e of Pe()){let t=e.indexOf("="),n=t===-1?e:e.slice(0,t);n.startsWith(m)&&this.remove(n.slice(m.length));}}},U=class{constructor(){this.store=new Map;}get(e){return this.store.get(e)??null}set(e,t){this.store.set(e,t);}remove(e){this.store.delete(e);}clear(){this.store.clear();}};function xe(r="localStorage"){return r==="localStorage"&&O()?new R:r==="cookie"&&d()?new M:r==="memory"?new U:O()?new R:d()?new M:new U}var z=class extends Error{constructor(t,n){super(t);this.statusCode=n;this.name="TransportError";}},L=class{constructor(e){this.config=e;}async send(e,t){let n=`${this.config.apiUrl}${e}`,o=new AbortController,i=this.config.timeoutMs??1e4,s=setTimeout(()=>o.abort(new DOMException(`Veo request timeout (${i}ms)`,"TimeoutError")),i);try{let a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":this.config.apiKey,"X-Sdk-Version":this.config.sdkVersion},body:JSON.stringify(t),signal:o.signal});if(!a.ok)throw new z(`HTTP ${a.status}`,a.status);return await a.json()}finally{clearTimeout(s);}}sendBeacon(e,t){if(!Z())return false;let n=new URL(`${this.config.apiUrl}${e}`);n.searchParams.set("key",this.config.apiKey),n.searchParams.set("v",this.config.sdkVersion);let o=new Blob([JSON.stringify(t)],{type:"application/json"});return navigator.sendBeacon(n.toString(),o)}};var W="organization_id",Re="end_user_id",j="identify_signature";function F(r){return r===null||typeof r!="object"?JSON.stringify(r)??"null":Array.isArray(r)?`[${r.map(F).join(",")}]`:`{${Object.keys(r).sort().map(t=>`${JSON.stringify(t)}:${F(r[t])}`).join(",")}}`}var b=class{constructor(e){this.config=e;this.plugins=[];this.currentOrganizationId=null;this.listeners={pageview:new Set,identify:new Set};if(!e.apiKey)throw new Error("apiKey is required");this.storage=xe(e.storage??"localStorage"),this.session=new x(this.storage),this.transport=new L({apiKey:e.apiKey,apiUrl:f(e).replace(/\/$/,""),sdkVersion:D}),this.queue=new k({transport:this.transport,flushIntervalMs:e.flushInterval??5e3,batchSize:e.flushBatchSize??20,onError:o=>{e.debug&&console.error("[veo] flush error:",o);}});let t=this.storage.get(Re);t&&this.session.setEndUserId(t);let n=this.storage.get(W);n&&(this.currentOrganizationId=n),this.setupUnloadHandlers(),e.debug&&console.log("[veo] initialized",{anonymousId:this.session.anonymousId,sessionId:this.session.sessionId,endUserId:this.session.endUserId});}identify(e){let{visitor:t,organization:n}=e,o=F({id:t.id,traits:t.traits??{},org:n?{id:n.id,attributes:n.attributes??{}}:null});if(this.session.endUserId===t.id&&this.storage.get(j)===o){this.config.debug&&console.debug("[veo] identify: sin cambios, omitido");return}let i=this.session.endUserId===null?this.session.anonymousId:void 0;this.session.setEndUserId(t.id),n&&(this.currentOrganizationId=n.id,this.storage.set(W,n.id));let a={endUser:{id:t.id,traits:t.traits??{},...i!==void 0?{anonymousId:i}:{}},...n?{organization:{id:n.id,attributes:n.attributes??{}}}:{}};this.transport.send("/v1/identify",a).catch(l=>{this.config.debug&&console.error("[veo] identify failed:",l);}),this.enqueue({actionType:"identify",actionProperties:{traits:t.traits,organizationAttributes:n?.attributes}}),this.storage.set(j,o),this.emit("identify",{endUserId:t.id,sessionId:this.session.sessionId});}track(e,t){if(!e||typeof e!="string"){this.config.debug&&console.error("[veo] track: name is required");return}this.enqueue({actionType:"track",actionName:e,...t!==void 0?{actionProperties:t}:{}});}pageview(e){if(!d())return;let t=window.location.href,n=e??window.location.pathname;this.enqueue({actionType:"pageview",pageUrl:t,pagePath:n,pageTitle:document.title,pageReferrer:document.referrer}),this.emit("pageview",{url:t,path:n,sessionId:this.session.sessionId,endUserId:this.session.endUserId});}reset(){this.session.reset(),this.currentOrganizationId=null,this.storage.remove(W),this.storage.remove(Re),this.storage.remove(j);}flush(){return this.queue.flush()}use(e){return this.plugins.push(e),e.install(this),this}getEndUserId(){return this.session.endUserId}getAnonymousId(){return this.session.anonymousId}getSessionId(){return this.session.sessionId}on(e,t){return this.listeners[e].add(t),()=>{this.listeners[e].delete(t);}}emit(e,t){for(let n of this.listeners[e])try{n(t);}catch(o){this.config.debug&&console.error(`[veo] listener for '${e}' failed:`,o);}}enqueue(e){this.session.touch();let t=this.currentOrganizationId??void 0,n=e.pageUrl??(c()?window.location.href:void 0),o=e.pagePath??(c()?window.location.pathname:void 0),i=e.pageTitle??(d()?document.title:void 0),s=e.pageReferrer??(d()?document.referrer:void 0),a={actionId:g(),endUserId:this.session.effectiveUserId,sessionId:this.session.sessionId,actionType:e.actionType,occurredAt:new Date().toISOString(),...t!==void 0?{organizationId:t}:{},...e.actionName!==void 0?{actionName:e.actionName}:{},...n!==void 0?{pageUrl:n}:{},...o!==void 0?{pagePath:o}:{},...i!==void 0?{pageTitle:i}:{},...s!==void 0?{pageReferrer:s}:{},...e.actionProperties!==void 0?{actionProperties:e.actionProperties}:{}};this.queue.add(a);}setupUnloadHandlers(){c()&&(window.addEventListener("pagehide",()=>this.queue.flushBeacon()),window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.queue.flushBeacon();}));}};function Me(r,e,t,n){let o=new b(r);if(o.use(G()),r.autocapture!==false){let i=typeof r.autocapture=="object"?r.autocapture:{};o.use(H(i));}if(r.detectTheme!==false&&n&&!y()&&o.use(Ie({apiUrl:f(r),apiKey:r.apiKey,loadDetector:n,...r.debug!==void 0?{debug:r.debug}:{}})),e(o),typeof window<"u"){let s=window.veo?._q??[];window.veo=o;for(let a of s){let[l,u]=a;if(l==="init")continue;let p=o[l];if(typeof p=="function")try{p.apply(o,Array.from(u));}catch(h){r.debug&&console.error("[veo] drain error:",h);}}ce({...r.builderUrl!==void 0?{builderUrl:r.builderUrl}:{},...r.debug!==void 0?{debug:r.debug}:{},...r.apiKey!==void 0?{apiKey:r.apiKey}:{},apiUrl:f(r),...{}});}return o}function Ue(r){if(!c()||!d())return Promise.resolve(null);let e=window;if(e.veoTheme)return Promise.resolve(e.veoTheme);let t=r.themeUrl??ht();return t?new Promise(n=>{let o=document.createElement("script");o.src=t,o.async=true,o.addEventListener("load",()=>n(e.veoTheme??null)),o.addEventListener("error",()=>{r.debug&&console.error("[veo] no pude cargar",t),n(null);}),document.head.appendChild(o);}):(r.debug&&console.warn("[veo] no pude resolver la URL de veo-theme.js"),Promise.resolve(null))}function ht(){let r=document.querySelectorAll("script[src]");for(let e of Array.from(r))if(/\bveo(\.min)?\.js(\?.*)?$/.test(e.src))return e.src.replace(/\bveo(\.min)?\.js/,"veo-theme$1.js");return null}function Vr(r){let e=f(r);return Me(r,t=>{let n=()=>pe({...r.guidesUrl!==void 0?{guidesUrl:r.guidesUrl}:{},...r.debug!==void 0?{debug:r.debug}:{}}),o=V();r.guides===true&&!y()&&o===null&&n().then(i=>{i&&t.use(i.guidesPlugin({apiUrl:e,apiKey:r.apiKey,...r.debug!==void 0?{debug:r.debug}:{}}));}),o!==null&&n().then(i=>i?.runPreviewMode({apiKey:r.apiKey,apiUrl:e,token:o,...r.debug!==void 0?{debug:r.debug}:{}})),t.preview=i=>{let s=null,a=n().then(l=>l?(s=l.previewGuide(i),s.ready):{rendered:false});return {close:()=>s?.close(),ready:a,host:()=>s?.host()??null}},t.closePreview=()=>{n().then(i=>i?.closeGuidePreview());};},void 0,()=>Ue({...r.themeUrl!==void 0?{themeUrl:r.themeUrl}:{},...r.debug!==void 0?{debug:r.debug}:{}}))}
2
+ exports.Client=b;exports.SDK_VERSION=D;exports.autocapturePlugin=H;exports.definePlugin=ze;exports.init=Vr;exports.spaRouterPlugin=G;return exports;})({});//# sourceMappingURL=veo.js.map
3
3
  //# sourceMappingURL=veo.js.map