viewgate-wrapper 1.3.3 → 1.3.5
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/cli.js +74 -0
- package/dist/plugin/next-loader.js +11 -0
- package/dist/plugin/transform-logic.js +20 -0
- package/dist/plugin/vite-plugin-viewgate.js +14 -0
- package/dist/viewgate-wrapper.js +568 -440
- package/dist/viewgate-wrapper.umd.cjs +5 -7
- package/package.json +1 -1
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&display=swap";:root{--vg-primary: #2513ec;--vg-primary-gradient: linear-gradient(135deg, #2513ec 0%, #7e3ff2 100%);--vg-glass: rgba(255, 255, 255, .7);--vg-glass-border: rgba(255, 255, 255, .3);--vg-shadow: 0 8px 32px 0 rgba(31, 38, 135, .37);--vg-radius: 16px}body{font-family:Inter,system-ui,-apple-system,sans-serif!important;margin:0}.vg-glassmorphism{background:var(--vg-glass);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid var(--vg-glass-border);box-shadow:var(--vg-shadow);border-radius:var(--vg-radius)}.vg-button-primary{background:var(--vg-primary-gradient);color:#fff;border:none;padding:10px 24px;border-radius:12px;font-weight:600;cursor:pointer;transition:transform .2s,box-shadow .2s;box-shadow:0 4px 12px #2513ec4d}.vg-button-primary:hover{transform:translateY(-2px);box-shadow:0 6px 16px #2513ec66}.vg-button-ghost{background:transparent;color:#444;border:1px solid #ddd;padding:10px 24px;border-radius:12px;cursor:pointer;transition:background .2s}.vg-button-ghost:hover{background:#0000000d}.vg-badge{background:#2513ec1a;color:var(--vg-primary);padding:4px 12px;border-radius:20px;font-size:12px;font-family:JetBrains Mono,monospace;font-weight:700;border:1px solid rgba(37,19,236,.2)}.vg-textarea{width:100%;border:1.5px solid #eee;border-radius:12px;padding:12px;font-family:inherit;color:#0f172a;resize:none;transition:border-color .2s,box-shadow .2s;outline:none}.vg-textarea:focus{border-color:var(--vg-primary);box-shadow:0 0 0 4px #2513ec1a}@keyframes vg-slide-in{0%{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes vg-fade-in{0%{opacity:0}to{opacity:1}}.vg-animate-slide{animation:vg-slide-in .3s cubic-bezier(.16,1,.3,1)}.vg-animate-fade{animation:vg-fade-in .2s ease-out}.vg-toasts{position:fixed;top:24px;right:24px;display:flex;flex-direction:column;gap:12px;z-index:100000}.vg-toast{padding:16px 24px;display:flex;align-items:center;gap:12px;min-width:300px}.vg-toast.success{background:#ecfdf5;border:1px solid #10b981;color:#065f46}.vg-toast.error{background:#fef2f2;border:1px solid #ef4444;color:#991b1b}.vg-cursor-pointer *{cursor:pointer!important}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
-
(function(R,
|
|
2
|
+
(function(R,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],x):(R=typeof globalThis<"u"?globalThis:R||self,x(R.ViewGateWrapper={},R.React))})(this,(function(R,x){"use strict";var $={exports:{}},L={};var re;function je(){if(re)return L;re=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,a,s){var i=null;if(s!==void 0&&(i=""+s),a.key!==void 0&&(i=""+a.key),"key"in a){s={};for(var c in a)c!=="key"&&(s[c]=a[c])}else s=a;return a=s.ref,{$$typeof:e,type:n,key:i,ref:a!==void 0?a:null,props:s}}return L.Fragment=t,L.jsx=r,L.jsxs=r,L}var V={};var ne;function Oe(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&(function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===Lt?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case _:return"Fragment";case G:return"Profiler";case I:return"StrictMode";case g:return"Suspense";case j:return"SuspenseList";case At:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case N:return"Portal";case Z:return o.displayName||"Context";case q:return(o._context.displayName||"Context")+".Consumer";case v:var f=o.render;return o=o.displayName,o||(o=f.displayName||f.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case M:return f=o.displayName||null,f!==null?f:e(o.type)||"Memo";case O:f=o._payload,o=o._init;try{return e(o(f))}catch{}}return null}function t(o){return""+o}function r(o){try{t(o);var f=!1}catch{f=!0}if(f){f=console;var p=f.error,w=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return p.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",w),t(o)}}function n(o){if(o===_)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===O)return"<...>";try{var f=e(o);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function a(){var o=K.A;return o===null?null:o.getOwner()}function s(){return Error("react-stack-top-frame")}function i(o){if(Re.call(o,"key")){var f=Object.getOwnPropertyDescriptor(o,"key").get;if(f&&f.isReactWarning)return!1}return o.key!==void 0}function c(o,f){function p(){Ce||(Ce=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",f))}p.isReactWarning=!0,Object.defineProperty(o,"key",{get:p,configurable:!0})}function l(){var o=e(this.type);return Te[o]||(Te[o]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),o=this.props.ref,o!==void 0?o:null}function u(o,f,p,w,U,ee){var y=p.ref;return o={$$typeof:F,type:o,key:f,props:p,_owner:w},(y!==void 0?y:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:l}):Object.defineProperty(o,"ref",{enumerable:!1,value:null}),o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(o,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(o,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ee}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function m(o,f,p,w,U,ee){var y=f.children;if(y!==void 0)if(w)if(Vt(y)){for(w=0;w<y.length;w++)h(y[w]);Object.freeze&&Object.freeze(y)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(y);if(Re.call(f,"key")){y=e(o);var A=Object.keys(f).filter(function(Ft){return Ft!=="key"});w=0<A.length?"{key: someKey, "+A.join(": ..., ")+": ...}":"{key: someKey}",_e[y+w]||(A=0<A.length?"{"+A.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
3
3
|
let props = %s;
|
|
4
4
|
<%s {...props} />
|
|
5
5
|
React keys must be passed directly to JSX without using spread:
|
|
6
6
|
let props = %s;
|
|
7
|
-
<%s key={someKey} {...props} />`,g,p,A,p),_e[p+g]=!0)}if(p=null,h!==void 0&&(r(h),p=""+h),o(u)&&(r(u.key),p=""+u.key),"key"in u){h={};for(var ee in u)ee!=="key"&&(h[ee]=u[ee])}else h=u;return p&&c(h,typeof i=="function"?i.displayName||i.name||"Unknown":i),m(i,p,h,s(),U,K)}function x(i){b(i)?i._store&&(i._store.validated=1):typeof i=="object"&&i!==null&&i.$$typeof===Z&&(i._payload.status==="fulfilled"?b(i._payload.value)&&i._payload.value._store&&(i._payload.value._store.validated=1):i._store&&(i._store.validated=1))}function b(i){return typeof i=="object"&&i!==null&&i.$$typeof===O}var k=w,O=Symbol.for("react.transitional.element"),W=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),X=Symbol.for("react.consumer"),S=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),jt=Symbol.for("react.activity"),At=Symbol.for("react.client.reference"),q=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re=Object.prototype.hasOwnProperty,Ft=Array.isArray,Q=console.createTask?console.createTask:function(){return null};k={react_stack_bottom_frame:function(i){return i()}};var Ce,Te={},ke=k.react_stack_bottom_frame.bind(k,a)(),Pe=Q(n(a)),_e={};L.Fragment=P,L.jsx=function(i,u,h){var g=1e4>q.recentlyCreatedOwnerStacks++;return d(i,u,h,!1,g?Error("react-stack-top-frame"):ke,g?Q(n(i)):Pe)},L.jsxs=function(i,u,h){var g=1e4>q.recentlyCreatedOwnerStacks++;return d(i,u,h,!0,g?Error("react-stack-top-frame"):ke,g?Q(n(i)):Pe)}})()),L}var ne;function Fe(){return ne||(ne=1,process.env.NODE_ENV==="production"?M.exports=je():M.exports=Ae()),M.exports}var f=Fe();const Le={en:{enterMode:"🚀 Enter Feedback Mode",exitMode:"✨ Exit Mode",feedbackHeader:"Feedback",selectedElement:"Selected element:",line:"Line",placeholder:"Tell us what you'd like to change...",cancel:"Cancel",send:"Send Feedback",submitting:"Submitting...",success:"Your feedback has been submitted successfully!",error:"Failed to submit feedback. Check backend connection.",successHeader:"Success",errorHeader:"Error",preview:"Preview"},es:{enterMode:"🚀 Activar Modo Comentarios",exitMode:"✨ Salir del Modo",feedbackHeader:"Comentarios",selectedElement:"Elemento seleccionado:",line:"Línea",placeholder:"Cuéntanos qué te gustaría cambiar...",cancel:"Cancelar",send:"Enviar Comentarios",submitting:"Enviando...",success:"¡Tus comentarios se han enviado con éxito!",error:"Error al enviar comentarios. Revisa la conexión con el servidor.",successHeader:"Éxito",errorHeader:"Error",preview:"Vista previa"}},se=w.createContext(void 0),ae=()=>{const e=w.useContext(se);if(!e)throw new Error("useViewGate must be used within a ViewGateProvider");return e},Oe=({children:e,language:t="es",apiKey:r})=>{const[n,s]=w.useState([]),a=(c,l)=>{const m=Date.now();s(d=>[...d,{id:m,message:c,type:l}]),setTimeout(()=>{s(d=>d.filter(x=>x.id!==m))},4e3)},o=Le[t];return f.jsxs(se.Provider,{value:{addToast:a,language:t,t:o,apiKey:r},children:[e,f.jsx(Ee,{}),f.jsx("div",{className:"vg-toasts",children:n.map(c=>f.jsxs("div",{className:`vg-toast vg-glassmorphism vg-animate-slide ${c.type}`,children:[f.jsx("span",{style:{fontSize:"20px"},children:c.type==="success"?"✅":"❌"}),f.jsxs("div",{children:[f.jsx("strong",{style:{display:"block"},children:c.type==="success"?o.successHeader:o.errorHeader}),f.jsx("span",{style:{fontSize:"14px"},children:c.message})]})]},c.id))})]})};function Ie(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),n=r.createElement("base"),s=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(s),t&&(n.href=t),s.href=e,s.href}const De=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function C(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}let _=null;function ie(e={}){return _||(e.includeStyleProperties?(_=e.includeStyleProperties,_):(_=C(window.getComputedStyle(document.documentElement)),_))}function $(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function Me(e){const t=$(e,"border-left-width"),r=$(e,"border-right-width");return e.clientWidth+t+r}function $e(e){const t=$(e,"border-top-width"),r=$(e,"border-bottom-width");return e.clientHeight+t+r}function oe(e,t={}){const r=t.width||Me(e),n=t.height||$e(e);return{width:r,height:n}}function Ve(){let e,t;try{t=process}catch{}const r=t&&t.env?t.env.devicePixelRatio:null;return r&&(e=parseInt(r,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const E=16384;function He(e){(e.width>E||e.height>E)&&(e.width>E&&e.height>E?e.width>e.height?(e.height*=E/e.width,e.width=E):(e.width*=E/e.height,e.height=E):e.width>E?(e.height*=E/e.width,e.width=E):(e.width*=E/e.height,e.height=E))}function V(e){return new Promise((t,r)=>{const n=new Image;n.onload=()=>{n.decode().then(()=>{requestAnimationFrame(()=>t(n))})},n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=e})}async function We(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function ze(e,t,r){const n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),a=document.createElementNS(n,"foreignObject");return s.setAttribute("width",`${t}`),s.setAttribute("height",`${r}`),s.setAttribute("viewBox",`0 0 ${t} ${r}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),s.appendChild(a),a.appendChild(e),We(s)}const v=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||v(r,t)};function Ue(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Ge(e,t){return ie(t).map(r=>{const n=e.getPropertyValue(r),s=e.getPropertyPriority(r);return`${r}: ${n}${s?" !important":""};`}).join(" ")}function Ne(e,t,r,n){const s=`.${e}:${t}`,a=r.cssText?Ue(r):Ge(r,n);return document.createTextNode(`${s}{${a}}`)}function ce(e,t,r,n){const s=window.getComputedStyle(e,r),a=s.getPropertyValue("content");if(a===""||a==="none")return;const o=De();try{t.className=`${t.className} ${o}`}catch{return}const c=document.createElement("style");c.appendChild(Ne(o,r,s,n)),t.appendChild(c)}function Ye(e,t,r){ce(e,t,":before",r),ce(e,t,":after",r)}const le="application/font-woff",ue="image/jpeg",Be={woff:le,woff2:le,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ue,jpeg:ue,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Je(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function G(e){const t=Je(e).toLowerCase();return Be[t]||""}function Xe(e){return e.split(/,/)[1]}function N(e){return e.search(/^(data:)/)!==-1}function Ze(e,t){return`data:${t};base64,${e}`}async function fe(e,t,r){const n=await fetch(e,t);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const s=await n.blob();return new Promise((a,o)=>{const c=new FileReader;c.onerror=o,c.onloadend=()=>{try{a(r({res:n,result:c.result}))}catch(l){o(l)}},c.readAsDataURL(s)})}const Y={};function qe(e,t,r){let n=e.replace(/\?.*/,"");return r&&(n=e),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),t?`[${t}]${n}`:n}async function B(e,t,r){const n=qe(e,t,r.includeQueryParams);if(Y[n]!=null)return Y[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let s;try{const a=await fe(e,r.fetchRequestInit,({res:o,result:c})=>(t||(t=o.headers.get("Content-Type")||""),Xe(c)));s=Ze(a,t)}catch(a){s=r.imagePlaceholder||"";let o=`Failed to fetch resource: ${e}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}return Y[n]=s,s}async function Qe(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):V(t)}async function Ke(e,t){if(e.currentSrc){const a=document.createElement("canvas"),o=a.getContext("2d");a.width=e.clientWidth,a.height=e.clientHeight,o?.drawImage(e,0,0,a.width,a.height);const c=a.toDataURL();return V(c)}const r=e.poster,n=G(r),s=await B(r,n,t);return V(s)}async function et(e,t){var r;try{if(!((r=e?.contentDocument)===null||r===void 0)&&r.body)return await H(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function tt(e,t){return v(e,HTMLCanvasElement)?Qe(e):v(e,HTMLVideoElement)?Ke(e,t):v(e,HTMLIFrameElement)?et(e,t):e.cloneNode(de(e))}const rt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",de=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function nt(e,t,r){var n,s;if(de(t))return t;let a=[];return rt(e)&&e.assignedNodes?a=C(e.assignedNodes()):v(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?a=C(e.contentDocument.body.childNodes):a=C(((s=e.shadowRoot)!==null&&s!==void 0?s:e).childNodes),a.length===0||v(e,HTMLVideoElement)||await a.reduce((o,c)=>o.then(()=>H(c,r)).then(l=>{l&&t.appendChild(l)}),Promise.resolve()),t}function st(e,t,r){const n=t.style;if(!n)return;const s=window.getComputedStyle(e);s.cssText?(n.cssText=s.cssText,n.transformOrigin=s.transformOrigin):ie(r).forEach(a=>{let o=s.getPropertyValue(a);a==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),v(e,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),n.setProperty(a,o,s.getPropertyPriority(a))})}function at(e,t){v(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),v(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function it(e,t){if(v(e,HTMLSelectElement)){const n=Array.from(t.children).find(s=>e.value===s.getAttribute("value"));n&&n.setAttribute("selected","")}}function ot(e,t,r){return v(t,Element)&&(st(e,t,r),Ye(e,t,r),at(e,t),it(e,t)),t}async function ct(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const n={};for(let a=0;a<r.length;a++){const c=r[a].getAttribute("xlink:href");if(c){const l=e.querySelector(c),m=document.querySelector(c);!l&&m&&!n[c]&&(n[c]=await H(m,t,!0))}}const s=Object.values(n);if(s.length){const a="http://www.w3.org/1999/xhtml",o=document.createElementNS(a,"svg");o.setAttribute("xmlns",a),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const c=document.createElementNS(a,"defs");o.appendChild(c);for(let l=0;l<s.length;l++)c.appendChild(s[l]);e.appendChild(o)}return e}async function H(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>tt(n,t)).then(n=>nt(e,n,t)).then(n=>ot(e,n,t)).then(n=>ct(n,t))}const me=/url\((['"]?)([^'"]+?)\1\)/g,lt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,ut=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ft(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function dt(e){const t=[];return e.replace(me,(r,n,s)=>(t.push(s),r)),t.filter(r=>!N(r))}async function mt(e,t,r,n,s){try{const a=r?Ie(t,r):t,o=G(t);let c;return s||(c=await B(a,o,n)),e.replace(ft(t),`$1${c}$3`)}catch{}return e}function ht(e,{preferredFontFormat:t}){return t?e.replace(ut,r=>{for(;;){const[n,,s]=lt.exec(r)||[];if(!s)return"";if(s===t)return`src: ${n};`}}):e}function he(e){return e.search(me)!==-1}async function ge(e,t,r){if(!he(e))return e;const n=ht(e,r);return dt(n).reduce((a,o)=>a.then(c=>mt(c,o,t,r)),Promise.resolve(n))}async function j(e,t,r){var n;const s=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(s){const a=await ge(s,null,r);return t.style.setProperty(e,a,t.style.getPropertyPriority(e)),!0}return!1}async function gt(e,t){await j("background",e,t)||await j("background-image",e,t),await j("mask",e,t)||await j("-webkit-mask",e,t)||await j("mask-image",e,t)||await j("-webkit-mask-image",e,t)}async function pt(e,t){const r=v(e,HTMLImageElement);if(!(r&&!N(e.src))&&!(v(e,SVGImageElement)&&!N(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,s=await B(n,G(n),t);await new Promise((a,o)=>{e.onload=a,e.onerror=t.onImageErrorHandler?(...l)=>{try{a(t.onImageErrorHandler(...l))}catch(m){o(m)}}:o;const c=e;c.decode&&(c.decode=a),c.loading==="lazy"&&(c.loading="eager"),r?(e.srcset="",e.src=s):e.href.baseVal=s})}async function yt(e,t){const n=C(e.childNodes).map(s=>pe(s,t));await Promise.all(n).then(()=>e)}async function pe(e,t){v(e,Element)&&(await gt(e,t),await pt(e,t),await yt(e,t))}function wt(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const n=t.style;return n!=null&&Object.keys(n).forEach(s=>{r[s]=n[s]}),e}const ye={};async function we(e){let t=ye[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},ye[e]=t,t}async function be(e,t){let r=e.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,a=(r.match(/url\([^)]+\)/g)||[]).map(async o=>{let c=o.replace(n,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),fe(c,t.fetchRequestInit,({result:l})=>(r=r.replace(o,`url(${l})`),[o,l]))});return Promise.all(a).then(()=>r)}function xe(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=e.replace(r,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=s.exec(n);if(l===null)break;t.push(l[0])}n=n.replace(s,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(o,"gi");for(;;){let l=a.exec(n);if(l===null){if(l=c.exec(n),l===null)break;a.lastIndex=c.lastIndex}else c.lastIndex=a.lastIndex;t.push(l[0])}return t}async function bt(e,t){const r=[],n=[];return e.forEach(s=>{if("cssRules"in s)try{C(s.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let c=o+1;const l=a.href,m=we(l).then(d=>be(d,t)).then(d=>xe(d).forEach(x=>{try{s.insertRule(x,x.startsWith("@import")?c+=1:s.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:x,error:b})}})).catch(d=>{console.error("Error loading remote css",d.toString())});n.push(m)}})}catch(a){const o=e.find(c=>c.href==null)||document.styleSheets[0];s.href!=null&&n.push(we(s.href).then(c=>be(c,t)).then(c=>xe(c).forEach(l=>{o.insertRule(l,o.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",a)}}),Promise.all(n).then(()=>(e.forEach(s=>{if("cssRules"in s)try{C(s.cssRules||[]).forEach(a=>{r.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${s.href}`,a)}}),r))}function xt(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>he(t.style.getPropertyValue("src")))}async function vt(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=C(e.ownerDocument.styleSheets),n=await bt(r,t);return xt(n)}function ve(e){return e.trim().replace(/["']/g,"")}function Et(e){const t=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(a=>{t.add(ve(a))}),Array.from(n.children).forEach(a=>{a instanceof HTMLElement&&r(a)})}return r(e),t}async function St(e,t){const r=await vt(e,t),n=Et(e);return(await Promise.all(r.filter(a=>n.has(ve(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return ge(a.cssText,o,t)}))).join(`
|
|
8
|
-
`)}async function Rt(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await St(e,t);if(r){const n=document.createElement("style"),
|
|
9
|
-
`).map((
|
|
10
|
-
`),map:null}}}}function
|
|
11
|
-
`).map((c,l)=>{const m=l+1;return c.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g,(d,x,b)=>d.includes("data-source-path")||b==="Fragment"||b==="React.Fragment"?d:`${x}<${b} data-source-path="${s}:${m}"`)}).join(`
|
|
12
|
-
`)}function _t(e){const t=this.resourcePath;return t?(process.env.NODE_ENV,Se(e,t,process.cwd())):e}R.ViewGate=Oe,R.ViewGateOverlay=Ee,R.transformSourcePaths=Se,R.useViewGate=ae,R.viewgateNextLoader=_t,R.viewgatePlugin=Pt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
|
7
|
+
<%s key={someKey} {...props} />`,w,y,A,y),_e[y+w]=!0)}if(y=null,p!==void 0&&(r(p),y=""+p),i(f)&&(r(f.key),y=""+f.key),"key"in f){p={};for(var te in f)te!=="key"&&(p[te]=f[te])}else p=f;return y&&c(p,typeof o=="function"?o.displayName||o.name||"Unknown":o),u(o,y,p,a(),U,ee)}function h(o){b(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===O&&(o._payload.status==="fulfilled"?b(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function b(o){return typeof o=="object"&&o!==null&&o.$$typeof===F}var T=x,F=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),Z=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),At=Symbol.for("react.activity"),Lt=Symbol.for("react.client.reference"),K=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re=Object.prototype.hasOwnProperty,Vt=Array.isArray,Q=console.createTask?console.createTask:function(){return null};T={react_stack_bottom_frame:function(o){return o()}};var Ce,Te={},Pe=T.react_stack_bottom_frame.bind(T,s)(),ke=Q(n(s)),_e={};V.Fragment=_,V.jsx=function(o,f,p){var w=1e4>K.recentlyCreatedOwnerStacks++;return m(o,f,p,!1,w?Error("react-stack-top-frame"):Pe,w?Q(n(o)):ke)},V.jsxs=function(o,f,p){var w=1e4>K.recentlyCreatedOwnerStacks++;return m(o,f,p,!0,w?Error("react-stack-top-frame"):Pe,w?Q(n(o)):ke)}})()),V}var se;function Ae(){return se||(se=1,process.env.NODE_ENV==="production"?$.exports=je():$.exports=Oe()),$.exports}var d=Ae();const Le={en:{enterMode:"🚀 Enter Feedback Mode",exitMode:"✨ Exit Mode",feedbackHeader:"Feedback",selectedElement:"Selected element:",line:"Line",placeholder:"Tell us what you'd like to change...",cancel:"Cancel",send:"Send Feedback",submitting:"Submitting...",success:"Your feedback has been submitted successfully!",error:"Failed to submit feedback. Check backend connection.",successHeader:"Success",errorHeader:"Error",preview:"Preview"},es:{enterMode:"🚀 Activar Modo Comentarios",exitMode:"✨ Salir del Modo",feedbackHeader:"Comentarios",selectedElement:"Elemento seleccionado:",line:"Línea",placeholder:"Cuéntanos qué te gustaría cambiar...",cancel:"Cancelar",send:"Enviar Comentarios",submitting:"Enviando...",success:"¡Tus comentarios se han enviado con éxito!",error:"Error al enviar comentarios. Revisa la conexión con el servidor.",successHeader:"Éxito",errorHeader:"Error",preview:"Vista previa"}},ae=x.createContext(void 0),oe=()=>{const e=x.useContext(ae);if(!e)throw new Error("useViewGate must be used within a ViewGateProvider");return e},Ve=({children:e,language:t="es",apiKey:r,baseUrl:n="https://view-gate.vercel.app"})=>{const[a,s]=x.useState([]),i=(l,u)=>{const m=Date.now();s(h=>[...h,{id:m,message:l,type:u}]),setTimeout(()=>{s(h=>h.filter(b=>b.id!==m))},4e3)},c=Le[t];return d.jsxs(ae.Provider,{"data-source-path":"/src/components/ViewGateProvider.tsx:99",value:{addToast:i,language:t,t:c,apiKey:r,baseUrl:n},children:[e,d.jsx(Se,{"data-source-path":"/src/components/ViewGateProvider.tsx:101"}),d.jsx("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:102",className:"vg-toasts",children:a.map(l=>d.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:104",className:`vg-toast vg-glassmorphism vg-animate-slide ${l.type}`,children:[d.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:105",style:{fontSize:"20px"},children:l.type==="success"?"✅":"❌"}),d.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:106",children:[d.jsx("strong",{"data-source-path":"/src/components/ViewGateProvider.tsx:107",style:{display:"block"},children:l.type==="success"?c.successHeader:c.errorHeader}),d.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:108",style:{fontSize:"14px"},children:l.message})]})]},l.id))})]})};function Fe(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),n=r.createElement("base"),a=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(a),t&&(n.href=t),a.href=e,a.href}const Ie=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function C(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}let P=null;function ie(e={}){return P||(e.includeStyleProperties?(P=e.includeStyleProperties,P):(P=C(window.getComputedStyle(document.documentElement)),P))}function D(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function Ge(e){const t=D(e,"border-left-width"),r=D(e,"border-right-width");return e.clientWidth+t+r}function Me(e){const t=D(e,"border-top-width"),r=D(e,"border-bottom-width");return e.clientHeight+t+r}function ce(e,t={}){const r=t.width||Ge(e),n=t.height||Me(e);return{width:r,height:n}}function $e(){let e,t;try{t=process}catch{}const r=t&&t.env?t.env.devicePixelRatio:null;return r&&(e=parseInt(r,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const S=16384;function De(e){(e.width>S||e.height>S)&&(e.width>S&&e.height>S?e.width>e.height?(e.height*=S/e.width,e.width=S):(e.width*=S/e.height,e.height=S):e.width>S?(e.height*=S/e.width,e.width=S):(e.width*=S/e.height,e.height=S))}function H(e){return new Promise((t,r)=>{const n=new Image;n.onload=()=>{n.decode().then(()=>{requestAnimationFrame(()=>t(n))})},n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=e})}async function He(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function We(e,t,r){const n="http://www.w3.org/2000/svg",a=document.createElementNS(n,"svg"),s=document.createElementNS(n,"foreignObject");return a.setAttribute("width",`${t}`),a.setAttribute("height",`${r}`),a.setAttribute("viewBox",`0 0 ${t} ${r}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),a.appendChild(s),s.appendChild(e),He(a)}const E=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||E(r,t)};function Ne(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Ue(e,t){return ie(t).map(r=>{const n=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${n}${a?" !important":""};`}).join(" ")}function ze(e,t,r,n){const a=`.${e}:${t}`,s=r.cssText?Ne(r):Ue(r,n);return document.createTextNode(`${a}{${s}}`)}function le(e,t,r,n){const a=window.getComputedStyle(e,r),s=a.getPropertyValue("content");if(s===""||s==="none")return;const i=Ie();try{t.className=`${t.className} ${i}`}catch{return}const c=document.createElement("style");c.appendChild(ze(i,r,a,n)),t.appendChild(c)}function Ye(e,t,r){le(e,t,":before",r),le(e,t,":after",r)}const ue="application/font-woff",fe="image/jpeg",Be={woff:ue,woff2:ue,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:fe,jpeg:fe,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Je(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function z(e){const t=Je(e).toLowerCase();return Be[t]||""}function Xe(e){return e.split(/,/)[1]}function Y(e){return e.search(/^(data:)/)!==-1}function qe(e,t){return`data:${t};base64,${e}`}async function de(e,t,r){const n=await fetch(e,t);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const a=await n.blob();return new Promise((s,i)=>{const c=new FileReader;c.onerror=i,c.onloadend=()=>{try{s(r({res:n,result:c.result}))}catch(l){i(l)}},c.readAsDataURL(a)})}const B={};function Ze(e,t,r){let n=e.replace(/\?.*/,"");return r&&(n=e),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),t?`[${t}]${n}`:n}async function J(e,t,r){const n=Ze(e,t,r.includeQueryParams);if(B[n]!=null)return B[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const s=await de(e,r.fetchRequestInit,({res:i,result:c})=>(t||(t=i.headers.get("Content-Type")||""),Xe(c)));a=qe(s,t)}catch(s){a=r.imagePlaceholder||"";let i=`Failed to fetch resource: ${e}`;s&&(i=typeof s=="string"?s:s.message),i&&console.warn(i)}return B[n]=a,a}async function Ke(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):H(t)}async function Qe(e,t){if(e.currentSrc){const s=document.createElement("canvas"),i=s.getContext("2d");s.width=e.clientWidth,s.height=e.clientHeight,i?.drawImage(e,0,0,s.width,s.height);const c=s.toDataURL();return H(c)}const r=e.poster,n=z(r),a=await J(r,n,t);return H(a)}async function et(e,t){var r;try{if(!((r=e?.contentDocument)===null||r===void 0)&&r.body)return await W(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function tt(e,t){return E(e,HTMLCanvasElement)?Ke(e):E(e,HTMLVideoElement)?Qe(e,t):E(e,HTMLIFrameElement)?et(e,t):e.cloneNode(me(e))}const rt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",me=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function nt(e,t,r){var n,a;if(me(t))return t;let s=[];return rt(e)&&e.assignedNodes?s=C(e.assignedNodes()):E(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?s=C(e.contentDocument.body.childNodes):s=C(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),s.length===0||E(e,HTMLVideoElement)||await s.reduce((i,c)=>i.then(()=>W(c,r)).then(l=>{l&&t.appendChild(l)}),Promise.resolve()),t}function st(e,t,r){const n=t.style;if(!n)return;const a=window.getComputedStyle(e);a.cssText?(n.cssText=a.cssText,n.transformOrigin=a.transformOrigin):ie(r).forEach(s=>{let i=a.getPropertyValue(s);s==="font-size"&&i.endsWith("px")&&(i=`${Math.floor(parseFloat(i.substring(0,i.length-2)))-.1}px`),E(e,HTMLIFrameElement)&&s==="display"&&i==="inline"&&(i="block"),s==="d"&&t.getAttribute("d")&&(i=`path(${t.getAttribute("d")})`),n.setProperty(s,i,a.getPropertyPriority(s))})}function at(e,t){E(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),E(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function ot(e,t){if(E(e,HTMLSelectElement)){const n=Array.from(t.children).find(a=>e.value===a.getAttribute("value"));n&&n.setAttribute("selected","")}}function it(e,t,r){return E(t,Element)&&(st(e,t,r),Ye(e,t,r),at(e,t),ot(e,t)),t}async function ct(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const n={};for(let s=0;s<r.length;s++){const c=r[s].getAttribute("xlink:href");if(c){const l=e.querySelector(c),u=document.querySelector(c);!l&&u&&!n[c]&&(n[c]=await W(u,t,!0))}}const a=Object.values(n);if(a.length){const s="http://www.w3.org/1999/xhtml",i=document.createElementNS(s,"svg");i.setAttribute("xmlns",s),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";const c=document.createElementNS(s,"defs");i.appendChild(c);for(let l=0;l<a.length;l++)c.appendChild(a[l]);e.appendChild(i)}return e}async function W(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>tt(n,t)).then(n=>nt(e,n,t)).then(n=>it(e,n,t)).then(n=>ct(n,t))}const he=/url\((['"]?)([^'"]+?)\1\)/g,lt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,ut=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ft(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function dt(e){const t=[];return e.replace(he,(r,n,a)=>(t.push(a),r)),t.filter(r=>!Y(r))}async function mt(e,t,r,n,a){try{const s=r?Fe(t,r):t,i=z(t);let c;return a||(c=await J(s,i,n)),e.replace(ft(t),`$1${c}$3`)}catch{}return e}function ht(e,{preferredFontFormat:t}){return t?e.replace(ut,r=>{for(;;){const[n,,a]=lt.exec(r)||[];if(!a)return"";if(a===t)return`src: ${n};`}}):e}function pe(e){return e.search(he)!==-1}async function ge(e,t,r){if(!pe(e))return e;const n=ht(e,r);return dt(n).reduce((s,i)=>s.then(c=>mt(c,i,t,r)),Promise.resolve(n))}async function k(e,t,r){var n;const a=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(a){const s=await ge(a,null,r);return t.style.setProperty(e,s,t.style.getPropertyPriority(e)),!0}return!1}async function pt(e,t){await k("background",e,t)||await k("background-image",e,t),await k("mask",e,t)||await k("-webkit-mask",e,t)||await k("mask-image",e,t)||await k("-webkit-mask-image",e,t)}async function gt(e,t){const r=E(e,HTMLImageElement);if(!(r&&!Y(e.src))&&!(E(e,SVGImageElement)&&!Y(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,a=await J(n,z(n),t);await new Promise((s,i)=>{e.onload=s,e.onerror=t.onImageErrorHandler?(...l)=>{try{s(t.onImageErrorHandler(...l))}catch(u){i(u)}}:i;const c=e;c.decode&&(c.decode=s),c.loading==="lazy"&&(c.loading="eager"),r?(e.srcset="",e.src=a):e.href.baseVal=a})}async function wt(e,t){const n=C(e.childNodes).map(a=>we(a,t));await Promise.all(n).then(()=>e)}async function we(e,t){E(e,Element)&&(await pt(e,t),await gt(e,t),await wt(e,t))}function yt(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const n=t.style;return n!=null&&Object.keys(n).forEach(a=>{r[a]=n[a]}),e}const ye={};async function xe(e){let t=ye[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},ye[e]=t,t}async function be(e,t){let r=e.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,s=(r.match(/url\([^)]+\)/g)||[]).map(async i=>{let c=i.replace(n,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),de(c,t.fetchRequestInit,({result:l})=>(r=r.replace(i,`url(${l})`),[i,l]))});return Promise.all(s).then(()=>r)}function ve(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=e.replace(r,"");const a=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=a.exec(n);if(l===null)break;t.push(l[0])}n=n.replace(a,"");const s=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(i,"gi");for(;;){let l=s.exec(n);if(l===null){if(l=c.exec(n),l===null)break;s.lastIndex=c.lastIndex}else c.lastIndex=s.lastIndex;t.push(l[0])}return t}async function xt(e,t){const r=[],n=[];return e.forEach(a=>{if("cssRules"in a)try{C(a.cssRules||[]).forEach((s,i)=>{if(s.type===CSSRule.IMPORT_RULE){let c=i+1;const l=s.href,u=xe(l).then(m=>be(m,t)).then(m=>ve(m).forEach(h=>{try{a.insertRule(h,h.startsWith("@import")?c+=1:a.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:h,error:b})}})).catch(m=>{console.error("Error loading remote css",m.toString())});n.push(u)}})}catch(s){const i=e.find(c=>c.href==null)||document.styleSheets[0];a.href!=null&&n.push(xe(a.href).then(c=>be(c,t)).then(c=>ve(c).forEach(l=>{i.insertRule(l,i.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",s)}}),Promise.all(n).then(()=>(e.forEach(a=>{if("cssRules"in a)try{C(a.cssRules||[]).forEach(s=>{r.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${a.href}`,s)}}),r))}function bt(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>pe(t.style.getPropertyValue("src")))}async function vt(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=C(e.ownerDocument.styleSheets),n=await xt(r,t);return bt(n)}function Ee(e){return e.trim().replace(/["']/g,"")}function Et(e){const t=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(s=>{t.add(Ee(s))}),Array.from(n.children).forEach(s=>{s instanceof HTMLElement&&r(s)})}return r(e),t}async function St(e,t){const r=await vt(e,t),n=Et(e);return(await Promise.all(r.filter(s=>n.has(Ee(s.style.fontFamily))).map(s=>{const i=s.parentStyleSheet?s.parentStyleSheet.href:null;return ge(s.cssText,i,t)}))).join(`
|
|
8
|
+
`)}async function Rt(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await St(e,t);if(r){const n=document.createElement("style"),a=document.createTextNode(r);n.appendChild(a),e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}}async function Ct(e,t={}){const{width:r,height:n}=ce(e,t),a=await W(e,t,!0);return await Rt(a,t),await we(a,t),yt(a,t),await We(a,r,n)}async function Tt(e,t={}){const{width:r,height:n}=ce(e,t),a=await Ct(e,t),s=await H(a),i=document.createElement("canvas"),c=i.getContext("2d"),l=t.pixelRatio||$e(),u=t.canvasWidth||r,m=t.canvasHeight||n;return i.width=u*l,i.height=m*l,t.skipAutoScale||De(i),i.style.width=`${u}`,i.style.height=`${m}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,i.width,i.height)),c.drawImage(s,0,0,i.width,i.height),i}async function Pt(e,t={}){return(await Tt(e,t)).toDataURL()}const kt=e=>{const r=Object.keys(e).find(s=>s.startsWith("__reactFiber$")||s.startsWith("__reactInternalInstance$"));if(!r)return"";const n=[];let a=e[r];for(;a;){const s=a.type;if(typeof s=="function"){const i=s.displayName||s.name;i&&!i.includes("ViewGate")&&!n.includes(i)&&n.unshift(i)}a=a.return}return n.join(" > ")||"Generic Component"},_t=e=>{const t=e.getAttribute("data-source-path")||"unknown:0",r=kt(e),a=(c=>{const l=[];let u=c;for(;u&&u.nodeType===Node.ELEMENT_NODE;){let m=u.nodeName.toLowerCase();if(u.id){m+="#"+u.id,l.unshift(m);break}else{let h=u,b=1;for(;h.previousElementSibling;)h=h.previousElementSibling,h.nodeName.toLowerCase()===m&&b++;b>1&&(m+=`:nth-of-type(${b})`)}l.unshift(m),u=u.parentElement}return l.join(" > ")})(e),s=(e.innerText||"").slice(0,50).trim(),i=`${e.tagName.toLowerCase()}-${s.replace(/\s+/g,"_")}-${a.split(" > ").slice(-2).join("_")}`;return{tag:e.tagName.toLowerCase(),id:e.id||"",classes:e.className||"",text:(e.innerText||"").slice(0,100).trim(),selector:a,outerHtml:(e.outerHTML||"").slice(0,500),parentContext:(e.parentElement?.innerText||"").slice(0,100).trim(),componentPath:r,signature:i,source:t}},Se=()=>{const{addToast:e,language:t,t:r,apiKey:n,baseUrl:a}=oe(),[s,i]=x.useState(!1),[c,l]=x.useState(null),[u,m]=x.useState(null),[h,b]=x.useState(""),[T,F]=x.useState(!1),[N,_]=x.useState(!1),I=x.useCallback(v=>{if(!s||u)return;const g=document.elementFromPoint(v.clientX,v.clientY);if(!g||g.id==="viewgate-overlay"||g.closest("#viewgate-ui")){l(null);return}g.getAttribute("data-source-path"),l({tag:g.tagName.toLowerCase(),source:g.getAttribute("data-source-path")||"unknown:0",rect:g.getBoundingClientRect(),element:g,previewText:(g.innerText||"").slice(0,100)||(g.getAttribute("placeholder")||"").slice(0,100)||g.tagName.toLowerCase(),semanticReference:_t(g)})},[s,u]),G=x.useCallback(async v=>{if(!(!s||u)&&c){v.preventDefault(),v.stopPropagation(),_(!0);try{const g=c.element.style.display,j=window.getComputedStyle(c.element).display==="inline";j&&(c.element.style.display="inline-block");const M=await Pt(c.element,{backgroundColor:"#ffffff",pixelRatio:2,skipFonts:!0,style:{margin:"0",padding:"4px"}});j&&(c.element.style.display=g),m({...c,visualPreview:M})}catch(g){console.error("Failed to capture preview:",g),m(c)}finally{_(!1),l(null)}}},[s,c,u]);x.useEffect(()=>(s&&!u?document.body.classList.add("vg-cursor-pointer"):document.body.classList.remove("vg-cursor-pointer"),window.addEventListener("mousemove",I),window.addEventListener("click",G,!0),()=>{document.body.classList.remove("vg-cursor-pointer"),window.removeEventListener("mousemove",I),window.removeEventListener("click",G,!0)}),[s,u,I,G]);const q=async()=>{if(!u||!h.trim())return;F(!0);const{semanticReference:v}=u,[g,j]=v.source.split(":"),M=j||"0";try{if(!(await fetch(`${a}/api/annotations`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({filePath:g,line:parseInt(M),url:window.location.href,message:h,componentName:v.componentPath||u.tag,reference:v})})).ok)throw new Error("Backend failed");e(r.success,"success"),m(null),b(""),i(!1)}catch(O){console.error(O),e(r.error,"error")}finally{F(!1)}},Z=v=>v.split("/").pop()?.split("\\").pop()||"unknown";return d.jsxs(d.Fragment,{children:[d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:230",style:{position:"fixed",bottom:"30px",right:"30px",zIndex:99999},id:"viewgate-ui",children:d.jsx("button",{onClick:()=>i(!s),className:"vg-button-primary",style:{padding:"12px 24px",fontSize:"15px"},children:s?r.exitMode:r.enterMode})}),N&&d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:242",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255,255,255,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e5,cursor:"wait"},children:d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:255",className:"vg-glassmorphism",style:{padding:"20px 40px",fontWeight:700},children:"Capturing..."})}),s&&c&&!u&&!N&&d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:263",style:{position:"fixed",top:c.rect.top,left:c.rect.left,width:c.rect.width,height:c.rect.height,border:"2px solid var(--vg-primary)",backgroundColor:"rgba(37, 19, 236, 0.05)",pointerEvents:"none",zIndex:99998,borderRadius:"4px",boxShadow:"0 0 15px rgba(37, 19, 236, 0.2)",transition:"all 0.1s ease-out"}}),u&&d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:281",className:"vg-animate-fade",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:99999},children:d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:294",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"460px",background:"white",color:"#0f172a"},children:[d.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:300",style:{margin:"0 0 10px 0",fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:302",style:{marginBottom:"20px"},children:[d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:303",style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[u.semanticReference.componentPath?d.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:305",className:"vg-badge",style:{backgroundColor:"#f5f3ff",color:"#7c3aed",borderColor:"#ddd6fe"},children:["📦 ",u.semanticReference.componentPath]}):d.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:309",className:"vg-badge",children:u.tag}),u.semanticReference.source&&!u.semanticReference.source.startsWith("unknown")?d.jsx(d.Fragment,{children:d.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:314",className:"vg-badge",style:{backgroundColor:"#fdf2f8",color:"#db2777",borderColor:"#fbcfe8"},children:["📄 ",Z(u.semanticReference.source.split(":")[0]||"unknown")]})}):d.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:319",className:"vg-badge",style:{backgroundColor:"#f0f9ff",color:"#0369a1",borderColor:"#bae6fd",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["🆔 ",u.semanticReference.signature]})]}),d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:324",style:{marginTop:"8px",fontSize:"11px",color:"#94a3b8"},children:["🎯 ",u.semanticReference.selector]})]}),d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:330",style:{backgroundColor:"#f8fafc",borderRadius:"8px",border:"1px solid #e2e8f0",marginBottom:"20px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:339",style:{padding:"8px 12px",fontSize:"10px",color:"#94a3b8",textTransform:"uppercase",fontWeight:700,borderBottom:"1px solid #f1f5f9"},children:r.preview}),d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:342",style:{padding:"12px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px",maxHeight:"150px",overflow:"hidden",backgroundColor:"white"},children:u.visualPreview?d.jsx("img",{src:u.visualPreview,alt:"Element Preview",style:{maxWidth:"100%",maxHeight:"120px",objectFit:"contain",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderRadius:"4px"}}):d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:365",style:{fontSize:"13px",color:"#64748b",fontStyle:"italic"},children:['"',u.previewText,'"']})})]}),d.jsx("textarea",{className:"vg-textarea",value:h,onChange:v=>b(v.target.value),rows:4,placeholder:r.placeholder,autoFocus:!0}),d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:381",style:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"24px"},children:[d.jsx("button",{onClick:()=>m(null),className:"vg-button-ghost",children:r.cancel}),d.jsx("button",{onClick:q,className:"vg-button-primary",disabled:T||!h.trim(),style:{opacity:T||!h.trim()?.6:1},children:T?r.submitting:r.send})]})]})})]})};function X(e,t,r){if(!t.endsWith(".tsx")&&!t.endsWith(".jsx")||t.includes("node_modules"))return e;const n=c=>c.replace(/\\/g,"/"),a=n(t).replace(n(r),"");return e.split(`
|
|
9
|
+
`).map((c,l)=>{const u=l+1;return c.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g,(m,h,b)=>m.includes("data-source-path")||b==="Fragment"||b==="React.Fragment"?m:`${h}<${b} data-source-path="${a}:${u}"`)}).join(`
|
|
10
|
+
`)}function jt(){return{name:"vite-plugin-viewgate",enforce:"pre",transform(e,t){return{code:X(e,t,process.cwd()),map:null}}}}function Ot(e){const t=this.resourcePath;return t?(process.env.NODE_ENV,X(e,t,process.cwd())):e}R.ViewGate=Ve,R.ViewGateOverlay=Se,R.transformSourcePaths=X,R.useViewGate=oe,R.viewgateNextLoader=Ot,R.viewgatePlugin=jt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|