viewgate-wrapper 1.8.1 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ViewGateOverlay.d.ts.map +1 -1
- package/dist/viewgate-wrapper.js +335 -284
- package/dist/viewgate-wrapper.umd.cjs +6 -6
- package/package.json +1 -1
- package/dist/cli.js +0 -74
- package/dist/plugin/next-loader.js +0 -11
- package/dist/plugin/transform-logic.js +0 -20
- package/dist/plugin/vite-plugin-viewgate.js +0 -14
|
@@ -1,10 +1,10 @@
|
|
|
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}@keyframes vg-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.vg-spinner{border:4px solid rgba(255,255,255,.3);border-top:4px solid white;border-radius:50%;width:40px;height:40px;animation:vg-spin 1s linear infinite;margin-bottom:16px}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
-
(function(R,
|
|
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}@keyframes vg-pulse-green{0%{box-shadow:0 0 #10b981b3;border-color:#10b981}70%{box-shadow:0 0 0 15px #10b98100;border-color:#10b981}to{box-shadow:0 0 #10b98100;border-color:#10b981}}.vg-highlight-active{animation:vg-pulse-green 2s infinite!important;outline:4px solid #10b981!important;outline-offset:2px!important;transition:all .3s ease!important;position:relative!important;z-index:9999!important}.vg-highlight-active:after{content:"✓ Revised";position:absolute;top:-25px;left:0;background:#10b981;color:#fff;padding:2px 8px;border-radius:4px;font-size:10px;font-weight:800;text-transform:uppercase;white-space:nowrap;pointer-events:none}@keyframes vg-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.vg-spinner{border:4px solid rgba(255,255,255,.3);border-top:4px solid white;border-radius:50%;width:40px;height:40px;animation:vg-spin 1s linear infinite;margin-bottom:16px}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
+
(function(R,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],g):(R=typeof globalThis<"u"?globalThis:R||self,g(R.ViewGateWrapper={},R.React))})(this,(function(R,g){"use strict";var J={exports:{}},M={};var de;function Ae(){if(de)return M;de=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 M.Fragment=t,M.jsx=r,M.jsxs=r,M}var H={};var fe;function Ge(){return fe||(fe=1,process.env.NODE_ENV!=="production"&&(function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===_?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case L:return"Fragment";case q:return"Profiler";case z:return"StrictMode";case U:return"Suspense";case ce:return"SuspenseList";case ee: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 Q:return"Portal";case ie:return o.displayName||"Context";case W:return(o._context.displayName||"Context")+".Consumer";case I:var p=o.render;return o=o.displayName,o||(o=p.displayName||p.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case le:return p=o.displayName||null,p!==null?p:e(o.type)||"Memo";case $:p=o._payload,o=o._init;try{return e(o(p))}catch{}}return null}function t(o){return""+o}function r(o){try{t(o);var p=!1}catch{p=!0}if(p){p=console;var y=p.error,w=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return y.call(p,"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===L)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===$)return"<...>";try{var p=e(o);return p?"<"+p+">":"<...>"}catch{return"<...>"}}function a(){var o=F.A;return o===null?null:o.getOwner()}function s(){return Error("react-stack-top-frame")}function i(o){if(O.call(o,"key")){var p=Object.getOwnPropertyDescriptor(o,"key").get;if(p&&p.isReactWarning)return!1}return o.key!==void 0}function c(o,p){function y(){te||(te=!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)",p))}y.isReactWarning=!0,Object.defineProperty(o,"key",{get:y,configurable:!0})}function u(){var o=e(this.type);return B[o]||(B[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 d(o,p,y,w,k,N){var v=y.ref;return o={$$typeof:T,type:o,key:p,props:y,_owner:w},(v!==void 0?v:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:u}):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:k}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:N}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function h(o,p,y,w,k,N){var v=p.children;if(v!==void 0)if(w)if(Y(v)){for(w=0;w<v.length;w++)x(v[w]);Object.freeze&&Object.freeze(v)}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 x(v);if(O.call(p,"key")){v=e(o);var D=Object.keys(p).filter(function(Lt){return Lt!=="key"});w=0<D.length?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}",j[v+w]||(D=0<D.length?"{"+D.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} />`,v,b,N,b),U[b+v]=!0)}if(b=null,y!==void 0&&(r(y),b=""+y),i(f)&&(r(f.key),b=""+f.key),"key"in f){y={};for(var ue in f)ue!=="key"&&(y[ue]=f[ue])}else y=f;return b&&c(y,typeof o=="function"?o.displayName||o.name||"Unknown":o),d(o,b,y,a(),q,le)}function g(o){w(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===$&&(o._payload.status==="fulfilled"?w(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function w(o){return typeof o=="object"&&o!==null&&o.$$typeof===k}var C=x,k=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),G=Symbol.for("react.fragment"),H=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),ae=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),T=Symbol.for("react.client.reference"),O=C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,ce=Array.isArray,I=console.createTask?console.createTask:function(){return null};C={react_stack_bottom_frame:function(o){return o()}};var p,h={},P=C.react_stack_bottom_frame.bind(C,s)(),F=I(n(s)),U={};M.Fragment=G,M.jsx=function(o,f,y){var v=1e4>O.recentlyCreatedOwnerStacks++;return m(o,f,y,!1,v?Error("react-stack-top-frame"):P,v?I(n(o)):F)},M.jsxs=function(o,f,y){var v=1e4>O.recentlyCreatedOwnerStacks++;return m(o,f,y,!0,v?Error("react-stack-top-frame"):P,v?I(n(o)):F)}})()),M}var pe;function Le(){return pe||(pe=1,process.env.NODE_ENV==="production"?Y.exports=Ge():Y.exports=Ae()),Y.exports}var l=Le();const Ie={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",viewComments:"👀 View Comments",close:"Close",observe:"Observe",pending:"Pending",readyForReview:"Ready for Review",noComments:"No comments found.",deleteConfirm:"Are you sure you want to close/delete this comment?",markReady:"Mark as Ready",reopen:"Reopen",review:"Review",confirmDelete:"Are you sure you want to delete this annotation?",yes:"Yes, delete",no:"No, cancel",deleteSuccess:"The annotation has been deleted.",updateSuccess:"Status updated successfully.",navigating:"Navigating to source..."},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",viewComments:"👀 Ver Comentarios",close:"Cerrar",observe:"Observar",pending:"Pendiente",readyForReview:"Lista para revisión",noComments:"No hay comentarios.",deleteConfirm:"¿Estás seguro de que deseas cerrar y eliminar este comentario?",markReady:"Marcar como Listo",reopen:"Reabrir",review:"Revisar",confirmDelete:"¿Estás seguro de que deseas eliminar este comentario?",yes:"Sí, eliminar",no:"No, cancelar",deleteSuccess:"El comentario ha sido eliminado.",updateSuccess:"Estado actualizado correctamente.",navigating:"Redirigiendo al origen..."}},me=x.createContext(void 0),he=()=>{const e=x.useContext(me);if(!e)throw new Error("useViewGate must be used within a ViewGateProvider");return e},Fe=({children:e,language:t="es",apiKey:r,baseUrl:n="https://view-gate.vercel.app"})=>{const[a,s]=x.useState([]),i=(u,d)=>{const m=Date.now();s(g=>[...g,{id:m,message:u,type:d}]),setTimeout(()=>{s(g=>g.filter(w=>w.id!==m))},4e3)},c=Ie[t];return l.jsxs(me.Provider,{"data-source-path":"/src/components/ViewGateProvider.tsx:136",value:{addToast:i,language:t,t:c,apiKey:r,baseUrl:n},children:[e,l.jsx(Ve,{"data-source-path":"/src/components/ViewGateProvider.tsx:138"}),l.jsx("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:139",className:"vg-toasts",children:a.map(u=>l.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:141",className:`vg-toast vg-glassmorphism vg-animate-slide ${u.type}`,children:[l.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:142",style:{fontSize:"20px"},children:u.type==="success"?"✅":"❌"}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:143",children:[l.jsx("strong",{"data-source-path":"/src/components/ViewGateProvider.tsx:144",style:{display:"block"},children:u.type==="success"?c.successHeader:c.errorHeader}),l.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:145",style:{fontSize:"14px"},children:u.message})]})]},u.id))})]})};function Ne(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 De=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function j(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}let _=null;function ge(e={}){return _||(e.includeStyleProperties?(_=e.includeStyleProperties,_):(_=j(window.getComputedStyle(document.documentElement)),_))}function B(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function Me(e){const t=B(e,"border-left-width"),r=B(e,"border-right-width");return e.clientWidth+t+r}function He(e){const t=B(e,"border-top-width"),r=B(e,"border-bottom-width");return e.clientHeight+t+r}function xe(e,t={}){const r=t.width||Me(e),n=t.height||He(e);return{width:r,height:n}}function ze(){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 We(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 J(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 $e(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Ue(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),$e(a)}const S=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||S(r,t)};function Ye(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Be(e,t){return ge(t).map(r=>{const n=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${n}${a?" !important":""};`}).join(" ")}function Je(e,t,r,n){const a=`.${e}:${t}`,s=r.cssText?Ye(r):Be(r,n);return document.createTextNode(`${a}{${s}}`)}function ye(e,t,r,n){const a=window.getComputedStyle(e,r),s=a.getPropertyValue("content");if(s===""||s==="none")return;const i=De();try{t.className=`${t.className} ${i}`}catch{return}const c=document.createElement("style");c.appendChild(Je(i,r,a,n)),t.appendChild(c)}function Xe(e,t,r){ye(e,t,":before",r),ye(e,t,":after",r)}const we="application/font-woff",ve="image/jpeg",Ze={woff:we,woff2:we,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ve,jpeg:ve,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Ke(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function ee(e){const t=Ke(e).toLowerCase();return Ze[t]||""}function Qe(e){return e.split(/,/)[1]}function te(e){return e.search(/^(data:)/)!==-1}function qe(e,t){return`data:${t};base64,${e}`}async function be(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(u){i(u)}},c.readAsDataURL(a)})}const re={};function et(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 ne(e,t,r){const n=et(e,t,r.includeQueryParams);if(re[n]!=null)return re[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const s=await be(e,r.fetchRequestInit,({res:i,result:c})=>(t||(t=i.headers.get("Content-Type")||""),Qe(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 re[n]=a,a}async function tt(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):J(t)}async function rt(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 J(c)}const r=e.poster,n=ee(r),a=await ne(r,n,t);return J(a)}async function nt(e,t){var r;try{if(!((r=e?.contentDocument)===null||r===void 0)&&r.body)return await X(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function st(e,t){return S(e,HTMLCanvasElement)?tt(e):S(e,HTMLVideoElement)?rt(e,t):S(e,HTMLIFrameElement)?nt(e,t):e.cloneNode(Se(e))}const at=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",Se=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function ot(e,t,r){var n,a;if(Se(t))return t;let s=[];return at(e)&&e.assignedNodes?s=j(e.assignedNodes()):S(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?s=j(e.contentDocument.body.childNodes):s=j(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),s.length===0||S(e,HTMLVideoElement)||await s.reduce((i,c)=>i.then(()=>X(c,r)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function it(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):ge(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`),S(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 ct(e,t){S(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),S(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function lt(e,t){if(S(e,HTMLSelectElement)){const n=Array.from(t.children).find(a=>e.value===a.getAttribute("value"));n&&n.setAttribute("selected","")}}function ut(e,t,r){return S(t,Element)&&(it(e,t,r),Xe(e,t,r),ct(e,t),lt(e,t)),t}async function dt(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 u=e.querySelector(c),d=document.querySelector(c);!u&&d&&!n[c]&&(n[c]=await X(d,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 u=0;u<a.length;u++)c.appendChild(a[u]);e.appendChild(i)}return e}async function X(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>st(n,t)).then(n=>ot(e,n,t)).then(n=>ut(e,n,t)).then(n=>dt(n,t))}const Ee=/url\((['"]?)([^'"]+?)\1\)/g,ft=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,pt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function mt(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function ht(e){const t=[];return e.replace(Ee,(r,n,a)=>(t.push(a),r)),t.filter(r=>!te(r))}async function gt(e,t,r,n,a){try{const s=r?Ne(t,r):t,i=ee(t);let c;return a||(c=await ne(s,i,n)),e.replace(mt(t),`$1${c}$3`)}catch{}return e}function xt(e,{preferredFontFormat:t}){return t?e.replace(pt,r=>{for(;;){const[n,,a]=ft.exec(r)||[];if(!a)return"";if(a===t)return`src: ${n};`}}):e}function Ce(e){return e.search(Ee)!==-1}async function Re(e,t,r){if(!Ce(e))return e;const n=xt(e,r);return ht(n).reduce((s,i)=>s.then(c=>gt(c,i,t,r)),Promise.resolve(n))}async function V(e,t,r){var n;const a=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(a){const s=await Re(a,null,r);return t.style.setProperty(e,s,t.style.getPropertyPriority(e)),!0}return!1}async function yt(e,t){await V("background",e,t)||await V("background-image",e,t),await V("mask",e,t)||await V("-webkit-mask",e,t)||await V("mask-image",e,t)||await V("-webkit-mask-image",e,t)}async function wt(e,t){const r=S(e,HTMLImageElement);if(!(r&&!te(e.src))&&!(S(e,SVGImageElement)&&!te(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,a=await ne(n,ee(n),t);await new Promise((s,i)=>{e.onload=s,e.onerror=t.onImageErrorHandler?(...u)=>{try{s(t.onImageErrorHandler(...u))}catch(d){i(d)}}: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 vt(e,t){const n=j(e.childNodes).map(a=>ke(a,t));await Promise.all(n).then(()=>e)}async function ke(e,t){S(e,Element)&&(await yt(e,t),await wt(e,t),await vt(e,t))}function bt(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 je={};async function Te(e){let t=je[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},je[e]=t,t}async function Oe(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),be(c,t.fetchRequestInit,({result:u})=>(r=r.replace(i,`url(${u})`),[i,u]))});return Promise.all(s).then(()=>r)}function Pe(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 u=a.exec(n);if(u===null)break;t.push(u[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 u=s.exec(n);if(u===null){if(u=c.exec(n),u===null)break;s.lastIndex=c.lastIndex}else c.lastIndex=s.lastIndex;t.push(u[0])}return t}async function St(e,t){const r=[],n=[];return e.forEach(a=>{if("cssRules"in a)try{j(a.cssRules||[]).forEach((s,i)=>{if(s.type===CSSRule.IMPORT_RULE){let c=i+1;const u=s.href,d=Te(u).then(m=>Oe(m,t)).then(m=>Pe(m).forEach(g=>{try{a.insertRule(g,g.startsWith("@import")?c+=1:a.cssRules.length)}catch(w){console.error("Error inserting rule from remote css",{rule:g,error:w})}})).catch(m=>{console.error("Error loading remote css",m.toString())});n.push(d)}})}catch(s){const i=e.find(c=>c.href==null)||document.styleSheets[0];a.href!=null&&n.push(Te(a.href).then(c=>Oe(c,t)).then(c=>Pe(c).forEach(u=>{i.insertRule(u,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{j(a.cssRules||[]).forEach(s=>{r.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${a.href}`,s)}}),r))}function Et(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Ce(t.style.getPropertyValue("src")))}async function Ct(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=j(e.ownerDocument.styleSheets),n=await St(r,t);return Et(n)}function _e(e){return e.trim().replace(/["']/g,"")}function Rt(e){const t=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(s=>{t.add(_e(s))}),Array.from(n.children).forEach(s=>{s instanceof HTMLElement&&r(s)})}return r(e),t}async function kt(e,t){const r=await Ct(e,t),n=Rt(e);return(await Promise.all(r.filter(s=>n.has(_e(s.style.fontFamily))).map(s=>{const i=s.parentStyleSheet?s.parentStyleSheet.href:null;return Re(s.cssText,i,t)}))).join(`
|
|
8
|
-
`)}async function jt(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await kt(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 Tt(e,t={}){const{width:r,height:n}=xe(e,t),a=await X(e,t,!0);return await jt(a,t),await ke(a,t),bt(a,t),await Ue(a,r,n)}async function Ot(e,t={}){const{width:r,height:n}=xe(e,t),a=await Tt(e,t),s=await J(a),i=document.createElement("canvas"),c=i.getContext("2d"),u=t.pixelRatio||ze(),d=t.canvasWidth||r,m=t.canvasHeight||n;return i.width=d*u,i.height=m*u,t.skipAutoScale||We(i),i.style.width=`${d}`,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 Ot(e,t)).toDataURL()}const _t=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"},Vt=e=>{let t="unknown:0",r=e;for(;r;){const d=r.getAttribute("data-source-path");if(d){t=d;break}r=r.parentElement}const n=_t(e),s=(d=>{const m=[];let g=d;for(;g&&g.nodeType===Node.ELEMENT_NODE;){let w=g.nodeName.toLowerCase();if(g.id){w+="#"+g.id,m.unshift(w);break}else{let C=g,k=1;for(;C.previousElementSibling;)C=C.previousElementSibling,C.nodeName.toLowerCase()===w&&k++;k>1&&(w+=`:nth-of-type(${k})`)}m.unshift(w),g=g.parentElement}return m.join(" > ")})(e),i=(e.innerText||"").slice(0,50).trim(),c={};["placeholder","aria-label","name","type","alt","title","value","role"].forEach(d=>{const m=e.getAttribute(d);m&&(c[d]=m)});const u=`${e.tagName.toLowerCase()}-${i.replace(/\s+/g,"_")}-${s.split(" > ").slice(-2).join("_")}`;return{tag:e.tagName.toLowerCase(),id:e.id||"",classes:e.className||"",text:(e.innerText||"").slice(0,100).trim(),selector:s,outerHtml:(e.outerHTML||"").slice(0,1e3),parentContext:(e.parentElement?.innerText||"").slice(0,150).trim(),componentPath:n,signature:u,source:t,attributes:c,metadata:{hint:`Edit ${t.split(":")[0]} at line ${t.split(":")[1]||"?"}`}}},Ve=()=>{const{addToast:e,language:t,t:r,apiKey:n,baseUrl:a}=he(),[s,i]=x.useState(!1),[c,u]=x.useState(null),[d,m]=x.useState(null),[g,w]=x.useState(""),[C,k]=x.useState(!1),[Z,G]=x.useState(!1),[H,K]=x.useState(!1),[z,ae]=x.useState([]),[A,W]=x.useState(null),[oe,ie]=x.useState(!1),[$,Q]=x.useState(!1),T=x.useCallback(async()=>{if(n){Q(!0);try{const p=await fetch(`${a}/api/annotations`,{headers:{"x-api-key":n}});if(p.ok){const h=await p.json();ae(h)}}catch(p){console.error("Failed to fetch annotations",p)}finally{Q(!1)}}},[n,a]);x.useEffect(()=>{T()},[T]);const O=x.useCallback(p=>{if(!s||d)return;const h=document.elementFromPoint(p.clientX,p.clientY);if(!h||h.id==="viewgate-overlay"||h.closest("#viewgate-ui")){u(null);return}h.getAttribute("data-source-path"),u({tag:h.tagName.toLowerCase(),source:h.getAttribute("data-source-path")||"unknown:0",rect:h.getBoundingClientRect(),element:h,previewText:(h.innerText||"").slice(0,100)||(h.getAttribute("placeholder")||"").slice(0,100)||h.tagName.toLowerCase(),semanticReference:Vt(h)})},[s,d]),L=x.useCallback(async p=>{if(!(!s||d)&&c){p.preventDefault(),p.stopPropagation(),G(!0);try{const h=c.element.style.display,P=window.getComputedStyle(c.element).display==="inline";P&&(c.element.style.display="inline-block");const F=await Pt(c.element,{backgroundColor:"#ffffff",pixelRatio:2,skipFonts:!0,style:{margin:"0",padding:"4px"}});P&&(c.element.style.display=h),m({...c,visualPreview:F})}catch(h){console.error("Failed to capture preview:",h),m(c)}finally{G(!1),u(null)}}},[s,c,d,H]);x.useEffect(()=>(s&&!d?document.body.classList.add("vg-cursor-pointer"):document.body.classList.remove("vg-cursor-pointer"),window.addEventListener("mousemove",O),window.addEventListener("click",L,!0),()=>{document.body.classList.remove("vg-cursor-pointer"),window.removeEventListener("mousemove",O),window.removeEventListener("click",L,!0)}),[s,d,O,L]);const ce=async()=>{if(!d||!g.trim())return;k(!0);const{semanticReference:p}=d,[h,P]=p.source.split(":"),F=P||"0";try{if(!(await fetch(`${a}/api/annotations`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({filePath:h,line:parseInt(F),url:window.location.href,message:g,componentName:p.componentPath||d.tag,reference:p})})).ok)throw new Error("Backend failed");e(r.success,"success"),m(null),w(""),i(!1),T()}catch(U){console.error(U),e(r.error,"error")}finally{k(!1)}},I=p=>p.split("/").pop()?.split("\\").pop()||"unknown";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:282",style:{position:"fixed",bottom:"30px",right:"30px",zIndex:99999},id:"viewgate-ui",children:[l.jsx("button",{onClick:()=>i(!s),className:"vg-button-primary",style:{padding:"12px 24px",fontSize:"15px"},children:s?r.exitMode:r.enterMode}),z.length>0&&l.jsx("button",{onClick:()=>{K(!H),i(!1),m(null)},className:"vg-button-ghost",style:{padding:"12px 24px",fontSize:"15px",marginLeft:"12px",background:"white"},children:r.viewComments})]}),Z&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:307",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:320",className:"vg-glassmorphism",style:{padding:"30px 50px",fontWeight:700,display:"flex",flexDirection:"column",alignItems:"center",backgroundColor:"rgba(0,0,0,0.7)",color:"white",border:"1px solid rgba(255,255,255,0.1)"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:321",className:"vg-spinner"}),"Capturing..."]})}),s&&c&&!d&&!Z&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:329",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"}}),d&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:347",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:360",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"460px",background:"white",color:"#0f172a"},children:[l.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:366",style:{margin:"0 0 10px 0",fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:368",style:{marginBottom:"20px"},children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:369",style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[d.semanticReference.componentPath?l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:371",className:"vg-badge",style:{backgroundColor:"#f5f3ff",color:"#7c3aed",borderColor:"#ddd6fe"},children:["📦 ",d.tag]}):l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:375",className:"vg-badge",children:d.tag}),d.semanticReference.source&&!d.semanticReference.source.startsWith("unknown")?l.jsx(l.Fragment,{children:l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:380",className:"vg-badge",style:{backgroundColor:"#fdf2f8",color:"#db2777",borderColor:"#fbcfe8"},children:["📄 ",I(d.semanticReference.source.split(":")[0]||"unknown")]})}):l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:385",className:"vg-badge",style:{backgroundColor:"#f0f9ff",color:"#0369a1",borderColor:"#bae6fd",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["🆔 ",d.semanticReference.signature]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:390",style:{marginTop:"8px",fontSize:"11px",color:"#94a3b8"},children:["🎯 ",d.semanticReference.selector]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:396",style:{backgroundColor:"#f8fafc",borderRadius:"8px",border:"1px solid #e2e8f0",marginBottom:"20px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:405",style:{padding:"8px 12px",fontSize:"10px",color:"#94a3b8",textTransform:"uppercase",fontWeight:700,borderBottom:"1px solid #f1f5f9"},children:r.preview}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:408",style:{padding:"12px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",maxHeight:"200px",overflow:"hidden",backgroundColor:"#fdfdfd"},children:d.visualPreview?l.jsx("img",{src:d.visualPreview,alt:"Element Preview",style:{maxWidth:"100%",maxHeight:"120px",objectFit:"contain",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderRadius:"4px"}}):l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:431",style:{fontSize:"13px",color:"#64748b",fontStyle:"italic"},children:['"',d.previewText,'"']})})]}),l.jsx("textarea",{className:"vg-textarea",value:g,onChange:p=>w(p.target.value),rows:4,placeholder:r.placeholder,autoFocus:!0}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:447",style:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"24px"},children:[l.jsx("button",{onClick:()=>m(null),className:"vg-button-ghost",children:r.cancel}),l.jsx("button",{onClick:ce,className:"vg-button-primary",disabled:C||!g.trim(),style:{opacity:C||!g.trim()?.6:1},children:C?r.submitting:r.send})]})]})}),H&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:469",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:482",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"600px",maxHeight:"80vh",background:"white",color:"#0f172a",display:"flex",flexDirection:"column"},children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:491",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[l.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:492",style:{margin:0,fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:493",onClick:()=>K(!1),className:"vg-button-ghost",style:{padding:"6px 12px"},children:"✕"})]}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:496",style:{overflowY:"auto",flex:1,paddingRight:"8px",display:"flex",flexDirection:"column",gap:"16px"},children:$?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:498",style:{textAlign:"center",padding:"40px",color:"#64748b"},children:"Cargando..."}):z.length===0?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:500",style:{textAlign:"center",padding:"40px",color:"#64748b"},children:r.noComments}):z.map(p=>l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:503",style:{border:"1px solid #e2e8f0",borderRadius:"12px",padding:"16px",backgroundColor:p.status==="ready_for_review"?"#f0fdf4":"#fff"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:509",style:{display:"flex",justifyContent:"space-between",marginBottom:"12px"},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:510",style:{display:"flex",gap:"8px",alignItems:"center"},children:[p.status==="ready_for_review"?l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:512",className:"vg-badge",style:{backgroundColor:"#dcfce7",color:"#166534",borderColor:"#bbf7d0"},children:["✓ ",r.readyForReview]}):l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:514",className:"vg-badge",style:{backgroundColor:"#fef3c7",color:"#92400e",borderColor:"#fde68a"},children:["⏳ ",r.pending]}),l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:516",style:{fontSize:"12px",color:"#64748b"},children:new Date(p.timestamp).toLocaleString()})]})}),l.jsxs("p",{"data-source-path":"/src/components/ViewGateOverlay.tsx:522",style:{margin:"0 0 12px 0",fontSize:"15px",fontWeight:600},children:['"',p.message,'"']}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:524",style:{display:"flex",gap:"6px",flexWrap:"wrap",marginBottom:"16px"},children:[l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:525",className:"vg-badge",style:{backgroundColor:"#f1f5f9",color:"#475569",border:"none"},children:p.componentName||"UI Element"}),p.filePath&&p.filePath!=="unknown"&&l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:529",className:"vg-badge",style:{backgroundColor:"#f1f5f9",color:"#475569",border:"none"},children:I(p.filePath)})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:535",style:{display:"flex",gap:"8px",justifyContent:"flex-end",borderTop:"1px solid #e2e8f0",paddingTop:"16px",marginTop:"8px"},children:[p.status==="pending"?l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:537",className:"vg-button-primary",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:async()=>{try{(await fetch(`${a}/api/annotations/${p._id}`,{method:"PATCH",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({status:"ready_for_review"})})).ok&&(T(),e(r.updateSuccess,"success"))}catch{e(r.error,"error")}},children:["✅ ",r.markReady]}):l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:559",className:"vg-button-ghost",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:async()=>{try{(await fetch(`${a}/api/annotations/${p._id}`,{method:"PATCH",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({status:"pending"})})).ok&&(T(),e(r.updateSuccess,"success"))}catch{e(r.error,"error")}},children:["🔄 ",r.reopen]}),l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:582",className:"vg-button-ghost",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:()=>{p.url&&(ie(!0),setTimeout(()=>{window.location.href=p.url},1e3))},children:["👁️ ",r.review]}),l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:597",className:"vg-button-primary",style:{backgroundColor:"#ef4444",display:"flex",alignItems:"center",gap:"6px"},onClick:()=>{W({title:r.deleteConfirm,message:r.confirmDelete,onConfirm:async()=>{try{(await fetch(`${a}/api/annotations/${p._id}`,{method:"DELETE",headers:{"x-api-key":n}})).ok&&(T(),e(r.deleteSuccess,"success"))}catch{e(r.error,"error")}finally{W(null)}}})},children:["🗑️ ",r.close]})]})]},p._id))})]})}),oe&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:636",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.85)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:3e5,backdropFilter:"blur(10px)",color:"white"},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:650",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"20px"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:651",className:"vg-spinner",style:{width:"50px",height:"50px",borderTopColor:"white"}}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:652",style:{fontSize:"18px",fontWeight:600,letterSpacing:"0.5px"},children:r.navigating})]})}),A&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:659",className:"vg-animate-fade",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2e5},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:672",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"400px",background:"white",textAlign:"center"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:678",style:{fontSize:"48px",marginBottom:"16px"},children:"⚠️"}),l.jsx("h3",{"data-source-path":"/src/components/ViewGateOverlay.tsx:679",style:{margin:"0 0 12px 0",fontSize:"20px",fontWeight:700,color:"#0f172a"},children:A.title}),l.jsx("p",{"data-source-path":"/src/components/ViewGateOverlay.tsx:680",style:{margin:"0 0 24px 0",fontSize:"15px",color:"#64748b",lineHeight:1.5},children:A.message}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:682",style:{display:"flex",gap:"12px",justifyContent:"center"},children:[l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:683",className:"vg-button-ghost",onClick:()=>W(null),style:{flex:1},children:r.no}),l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:690",className:"vg-button-primary",style:{backgroundColor:"#ef4444",flex:1},onClick:A.onConfirm,children:r.yes})]})]})})]})};function se(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,u)=>{const d=u+1;return c.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g,(
|
|
10
|
-
`)}function
|
|
7
|
+
<%s key={someKey} {...props} />`,w,v,D,v),j[v+w]=!0)}if(v=null,y!==void 0&&(r(y),v=""+y),i(p)&&(r(p.key),v=""+p.key),"key"in p){y={};for(var ue in p)ue!=="key"&&(y[ue]=p[ue])}else y=p;return v&&c(y,typeof o=="function"?o.displayName||o.name||"Unknown":o),d(o,v,y,a(),k,N)}function x(o){b(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===$&&(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===T}var C=g,T=Symbol.for("react.transitional.element"),Q=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),ie=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),ce=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),_=Symbol.for("react.client.reference"),F=C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=Object.prototype.hasOwnProperty,Y=Array.isArray,V=console.createTask?console.createTask:function(){return null};C={react_stack_bottom_frame:function(o){return o()}};var te,B={},f=C.react_stack_bottom_frame.bind(C,s)(),m=V(n(s)),j={};H.Fragment=L,H.jsx=function(o,p,y){var w=1e4>F.recentlyCreatedOwnerStacks++;return h(o,p,y,!1,w?Error("react-stack-top-frame"):f,w?V(n(o)):m)},H.jsxs=function(o,p,y){var w=1e4>F.recentlyCreatedOwnerStacks++;return h(o,p,y,!0,w?Error("react-stack-top-frame"):f,w?V(n(o)):m)}})()),H}var pe;function Le(){return pe||(pe=1,process.env.NODE_ENV==="production"?J.exports=Ae():J.exports=Ge()),J.exports}var l=Le();const Ie={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",viewComments:"👀 View Comments",close:"Close",observe:"Observe",pending:"Pending",readyForReview:"Ready for Review",noComments:"No comments found.",deleteConfirm:"Are you sure you want to close/delete this comment?",markReady:"Mark as Ready",reopen:"Reopen",review:"Review",confirmDelete:"Are you sure you want to delete this annotation?",yes:"Yes, delete",no:"No, cancel",deleteSuccess:"The annotation has been deleted.",updateSuccess:"Status updated successfully.",navigating:"Redirecting to review..."},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",viewComments:"👀 Ver Comentarios",close:"Cerrar",observe:"Observar",pending:"Pendiente",readyForReview:"Lista para revisión",noComments:"No hay comentarios.",deleteConfirm:"¿Estás seguro de que deseas cerrar y eliminar este comentario?",markReady:"Marcar como Listo",reopen:"Reabrir",review:"Revisar",confirmDelete:"¿Estás seguro de que deseas eliminar este comentario?",yes:"Sí, eliminar",no:"No, cancelar",deleteSuccess:"El comentario ha sido eliminado.",updateSuccess:"Estado actualizado correctamente.",navigating:"Redirigiendo a revisión..."}},me=g.createContext(void 0),he=()=>{const e=g.useContext(me);if(!e)throw new Error("useViewGate must be used within a ViewGateProvider");return e},Fe=({children:e,language:t="es",apiKey:r,baseUrl:n="https://view-gate.vercel.app"})=>{const[a,s]=g.useState([]),i=(u,d)=>{const h=Date.now();s(x=>[...x,{id:h,message:u,type:d}]),setTimeout(()=>{s(x=>x.filter(b=>b.id!==h))},4e3)},c=Ie[t];return l.jsxs(me.Provider,{"data-source-path":"/src/components/ViewGateProvider.tsx:136",value:{addToast:i,language:t,t:c,apiKey:r,baseUrl:n},children:[e,l.jsx(Ve,{"data-source-path":"/src/components/ViewGateProvider.tsx:138"}),l.jsx("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:139",className:"vg-toasts",children:a.map(u=>l.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:141",className:`vg-toast vg-glassmorphism vg-animate-slide ${u.type}`,children:[l.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:142",style:{fontSize:"20px"},children:u.type==="success"?"✅":"❌"}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:143",children:[l.jsx("strong",{"data-source-path":"/src/components/ViewGateProvider.tsx:144",style:{display:"block"},children:u.type==="success"?c.successHeader:c.errorHeader}),l.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:145",style:{fontSize:"14px"},children:u.message})]})]},u.id))})]})};function Ne(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 De=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function P(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}let A=null;function ge(e={}){return A||(e.includeStyleProperties?(A=e.includeStyleProperties,A):(A=P(window.getComputedStyle(document.documentElement)),A))}function X(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function Me(e){const t=X(e,"border-left-width"),r=X(e,"border-right-width");return e.clientWidth+t+r}function He(e){const t=X(e,"border-top-width"),r=X(e,"border-bottom-width");return e.clientHeight+t+r}function xe(e,t={}){const r=t.width||Me(e),n=t.height||He(e);return{width:r,height:n}}function ze(){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 We(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 Z(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 Ue(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function $e(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),Ue(a)}const S=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||S(r,t)};function Ye(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Be(e,t){return ge(t).map(r=>{const n=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${n}${a?" !important":""};`}).join(" ")}function Je(e,t,r,n){const a=`.${e}:${t}`,s=r.cssText?Ye(r):Be(r,n);return document.createTextNode(`${a}{${s}}`)}function ye(e,t,r,n){const a=window.getComputedStyle(e,r),s=a.getPropertyValue("content");if(s===""||s==="none")return;const i=De();try{t.className=`${t.className} ${i}`}catch{return}const c=document.createElement("style");c.appendChild(Je(i,r,a,n)),t.appendChild(c)}function Xe(e,t,r){ye(e,t,":before",r),ye(e,t,":after",r)}const we="application/font-woff",ve="image/jpeg",Ze={woff:we,woff2:we,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ve,jpeg:ve,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Ke(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function re(e){const t=Ke(e).toLowerCase();return Ze[t]||""}function Qe(e){return e.split(/,/)[1]}function ne(e){return e.search(/^(data:)/)!==-1}function qe(e,t){return`data:${t};base64,${e}`}async function be(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(u){i(u)}},c.readAsDataURL(a)})}const se={};function et(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 ae(e,t,r){const n=et(e,t,r.includeQueryParams);if(se[n]!=null)return se[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const s=await be(e,r.fetchRequestInit,({res:i,result:c})=>(t||(t=i.headers.get("Content-Type")||""),Qe(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 se[n]=a,a}async function tt(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):Z(t)}async function rt(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 Z(c)}const r=e.poster,n=re(r),a=await ae(r,n,t);return Z(a)}async function nt(e,t){var r;try{if(!((r=e?.contentDocument)===null||r===void 0)&&r.body)return await K(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function st(e,t){return S(e,HTMLCanvasElement)?tt(e):S(e,HTMLVideoElement)?rt(e,t):S(e,HTMLIFrameElement)?nt(e,t):e.cloneNode(Se(e))}const at=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",Se=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function ot(e,t,r){var n,a;if(Se(t))return t;let s=[];return at(e)&&e.assignedNodes?s=P(e.assignedNodes()):S(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?s=P(e.contentDocument.body.childNodes):s=P(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),s.length===0||S(e,HTMLVideoElement)||await s.reduce((i,c)=>i.then(()=>K(c,r)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function it(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):ge(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`),S(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 ct(e,t){S(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),S(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function lt(e,t){if(S(e,HTMLSelectElement)){const n=Array.from(t.children).find(a=>e.value===a.getAttribute("value"));n&&n.setAttribute("selected","")}}function ut(e,t,r){return S(t,Element)&&(it(e,t,r),Xe(e,t,r),ct(e,t),lt(e,t)),t}async function dt(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 u=e.querySelector(c),d=document.querySelector(c);!u&&d&&!n[c]&&(n[c]=await K(d,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 u=0;u<a.length;u++)c.appendChild(a[u]);e.appendChild(i)}return e}async function K(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>st(n,t)).then(n=>ot(e,n,t)).then(n=>ut(e,n,t)).then(n=>dt(n,t))}const Ee=/url\((['"]?)([^'"]+?)\1\)/g,ft=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,pt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function mt(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function ht(e){const t=[];return e.replace(Ee,(r,n,a)=>(t.push(a),r)),t.filter(r=>!ne(r))}async function gt(e,t,r,n,a){try{const s=r?Ne(t,r):t,i=re(t);let c;return a||(c=await ae(s,i,n)),e.replace(mt(t),`$1${c}$3`)}catch{}return e}function xt(e,{preferredFontFormat:t}){return t?e.replace(pt,r=>{for(;;){const[n,,a]=ft.exec(r)||[];if(!a)return"";if(a===t)return`src: ${n};`}}):e}function Ce(e){return e.search(Ee)!==-1}async function Re(e,t,r){if(!Ce(e))return e;const n=xt(e,r);return ht(n).reduce((s,i)=>s.then(c=>gt(c,i,t,r)),Promise.resolve(n))}async function G(e,t,r){var n;const a=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(a){const s=await Re(a,null,r);return t.style.setProperty(e,s,t.style.getPropertyPriority(e)),!0}return!1}async function yt(e,t){await G("background",e,t)||await G("background-image",e,t),await G("mask",e,t)||await G("-webkit-mask",e,t)||await G("mask-image",e,t)||await G("-webkit-mask-image",e,t)}async function wt(e,t){const r=S(e,HTMLImageElement);if(!(r&&!ne(e.src))&&!(S(e,SVGImageElement)&&!ne(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,a=await ae(n,re(n),t);await new Promise((s,i)=>{e.onload=s,e.onerror=t.onImageErrorHandler?(...u)=>{try{s(t.onImageErrorHandler(...u))}catch(d){i(d)}}: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 vt(e,t){const n=P(e.childNodes).map(a=>ke(a,t));await Promise.all(n).then(()=>e)}async function ke(e,t){S(e,Element)&&(await yt(e,t),await wt(e,t),await vt(e,t))}function bt(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 je={};async function Te(e){let t=je[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},je[e]=t,t}async function Oe(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),be(c,t.fetchRequestInit,({result:u})=>(r=r.replace(i,`url(${u})`),[i,u]))});return Promise.all(s).then(()=>r)}function Pe(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 u=a.exec(n);if(u===null)break;t.push(u[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 u=s.exec(n);if(u===null){if(u=c.exec(n),u===null)break;s.lastIndex=c.lastIndex}else c.lastIndex=s.lastIndex;t.push(u[0])}return t}async function St(e,t){const r=[],n=[];return e.forEach(a=>{if("cssRules"in a)try{P(a.cssRules||[]).forEach((s,i)=>{if(s.type===CSSRule.IMPORT_RULE){let c=i+1;const u=s.href,d=Te(u).then(h=>Oe(h,t)).then(h=>Pe(h).forEach(x=>{try{a.insertRule(x,x.startsWith("@import")?c+=1:a.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:x,error:b})}})).catch(h=>{console.error("Error loading remote css",h.toString())});n.push(d)}})}catch(s){const i=e.find(c=>c.href==null)||document.styleSheets[0];a.href!=null&&n.push(Te(a.href).then(c=>Oe(c,t)).then(c=>Pe(c).forEach(u=>{i.insertRule(u,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{P(a.cssRules||[]).forEach(s=>{r.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${a.href}`,s)}}),r))}function Et(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Ce(t.style.getPropertyValue("src")))}async function Ct(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=P(e.ownerDocument.styleSheets),n=await St(r,t);return Et(n)}function _e(e){return e.trim().replace(/["']/g,"")}function Rt(e){const t=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(s=>{t.add(_e(s))}),Array.from(n.children).forEach(s=>{s instanceof HTMLElement&&r(s)})}return r(e),t}async function kt(e,t){const r=await Ct(e,t),n=Rt(e);return(await Promise.all(r.filter(s=>n.has(_e(s.style.fontFamily))).map(s=>{const i=s.parentStyleSheet?s.parentStyleSheet.href:null;return Re(s.cssText,i,t)}))).join(`
|
|
8
|
+
`)}async function jt(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await kt(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 Tt(e,t={}){const{width:r,height:n}=xe(e,t),a=await K(e,t,!0);return await jt(a,t),await ke(a,t),bt(a,t),await $e(a,r,n)}async function Ot(e,t={}){const{width:r,height:n}=xe(e,t),a=await Tt(e,t),s=await Z(a),i=document.createElement("canvas"),c=i.getContext("2d"),u=t.pixelRatio||ze(),d=t.canvasWidth||r,h=t.canvasHeight||n;return i.width=d*u,i.height=h*u,t.skipAutoScale||We(i),i.style.width=`${d}`,i.style.height=`${h}`,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 Ot(e,t)).toDataURL()}const _t=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"},Vt=e=>{let t="unknown:0",r=e;for(;r;){const d=r.getAttribute("data-source-path");if(d){t=d;break}r=r.parentElement}const n=_t(e),s=(d=>{const h=[];let x=d;for(;x&&x.nodeType===Node.ELEMENT_NODE;){let b=x.nodeName.toLowerCase();if(x.id){b+="#"+x.id,h.unshift(b);break}else{let C=x,T=1;for(;C.previousElementSibling;)C=C.previousElementSibling,C.nodeName.toLowerCase()===b&&T++;T>1&&(b+=`:nth-of-type(${T})`)}h.unshift(b),x=x.parentElement}return h.join(" > ")})(e),i=(e.innerText||"").slice(0,50).trim(),c={};["placeholder","aria-label","name","type","alt","title","value","role"].forEach(d=>{const h=e.getAttribute(d);h&&(c[d]=h)});const u=`${e.tagName.toLowerCase()}-${i.replace(/\s+/g,"_")}-${s.split(" > ").slice(-2).join("_")}`;return{tag:e.tagName.toLowerCase(),id:e.id||"",classes:e.className||"",text:(e.innerText||"").slice(0,100).trim(),selector:s,outerHtml:(e.outerHTML||"").slice(0,1e3),parentContext:(e.parentElement?.innerText||"").slice(0,150).trim(),componentPath:n,signature:u,source:t,attributes:c,metadata:{hint:`Edit ${t.split(":")[0]} at line ${t.split(":")[1]||"?"}`}}},Ve=()=>{const{addToast:e,language:t,t:r,apiKey:n,baseUrl:a}=he(),[s,i]=g.useState(!1),[c,u]=g.useState(null),[d,h]=g.useState(null),[x,b]=g.useState(""),[C,T]=g.useState(!1),[Q,L]=g.useState(!1),[z,q]=g.useState(!1),[W,ie]=g.useState([]),[I,U]=g.useState(null),[ce,le]=g.useState(!1),[$,ee]=g.useState(!1),[_,F]=g.useState(null),O=g.useCallback(async()=>{if(n){ee(!0);try{const f=await fetch(`${a}/api/annotations`,{headers:{"x-api-key":n}});if(f.ok){const m=await f.json();ie(m)}}catch(f){console.error("Failed to fetch annotations",f)}finally{ee(!1)}}},[n,a]);g.useEffect(()=>{const f=()=>{const m=window.location.hash;if(m.includes("vg_hl=")){const j=m.split("vg_hl=");if(j.length<2)return;const o=decodeURIComponent(j[1]);[100,500,1e3,2e3].forEach(y=>{setTimeout(()=>{const w=document.querySelectorAll("*");for(const k of w)if(k.tagName.toLowerCase()===o.split("-")[0]){const N=k.getBoundingClientRect();if(N.width>0&&N.height>0){const v=(k.innerText||"").slice(0,50).trim().replace(/\s+/g,"_");if(o.includes(v)){k.classList.add("vg-highlight-active"),F(k),k.scrollIntoView({behavior:"smooth",block:"center"});break}}}},y)})}};return f(),window.addEventListener("hashchange",f),()=>window.removeEventListener("hashchange",f)},[]),g.useEffect(()=>{if(!_)return;const f=()=>{_.classList.remove("vg-highlight-active"),F(null),window.history.replaceState&&window.history.replaceState(null,"",window.location.pathname+window.location.search)};return _.addEventListener("mouseover",f),()=>_.removeEventListener("mouseover",f)},[_]),g.useEffect(()=>{O()},[O]);const Y=g.useCallback(f=>{if(!s||d)return;const m=document.elementFromPoint(f.clientX,f.clientY);if(!m||m.id==="viewgate-overlay"||m.closest("#viewgate-ui")){u(null);return}m.getAttribute("data-source-path"),u({tag:m.tagName.toLowerCase(),source:m.getAttribute("data-source-path")||"unknown:0",rect:m.getBoundingClientRect(),element:m,previewText:(m.innerText||"").slice(0,100)||(m.getAttribute("placeholder")||"").slice(0,100)||m.tagName.toLowerCase(),semanticReference:Vt(m)})},[s,d]),V=g.useCallback(async f=>{if(!(!s||d)&&c){f.preventDefault(),f.stopPropagation(),L(!0);try{const m=c.element.style.display,j=window.getComputedStyle(c.element).display==="inline";j&&(c.element.style.display="inline-block");const o=await Pt(c.element,{backgroundColor:"#ffffff",pixelRatio:2,skipFonts:!0,style:{margin:"0",padding:"4px"}});j&&(c.element.style.display=m),h({...c,visualPreview:o})}catch(m){console.error("Failed to capture preview:",m),h(c)}finally{L(!1),u(null)}}},[s,c,d,z]);g.useEffect(()=>(s&&!d?document.body.classList.add("vg-cursor-pointer"):document.body.classList.remove("vg-cursor-pointer"),window.addEventListener("mousemove",Y),window.addEventListener("click",V,!0),()=>{document.body.classList.remove("vg-cursor-pointer"),window.removeEventListener("mousemove",Y),window.removeEventListener("click",V,!0)}),[s,d,Y,V]);const te=async()=>{if(!d||!x.trim())return;T(!0);const{semanticReference:f}=d,[m,j]=f.source.split(":"),o=j||"0";try{if(!(await fetch(`${a}/api/annotations`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({filePath:m,line:parseInt(o),url:window.location.href,message:x,componentName:f.componentPath||d.tag,reference:f})})).ok)throw new Error("Backend failed");e(r.success,"success"),h(null),b(""),i(!1),O()}catch(p){console.error(p),e(r.error,"error")}finally{T(!1)}},B=f=>f.split("/").pop()?.split("\\").pop()||"unknown";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:344",style:{position:"fixed",bottom:"30px",right:"30px",zIndex:99999},id:"viewgate-ui",children:[l.jsx("button",{onClick:()=>i(!s),className:"vg-button-primary",style:{padding:"12px 24px",fontSize:"15px"},children:s?r.exitMode:r.enterMode}),W.length>0&&l.jsx("button",{onClick:()=>{q(!z),i(!1),h(null)},className:"vg-button-ghost",style:{padding:"12px 24px",fontSize:"15px",marginLeft:"12px",background:"white"},children:r.viewComments})]}),Q&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:369",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:382",className:"vg-glassmorphism",style:{padding:"30px 50px",fontWeight:700,display:"flex",flexDirection:"column",alignItems:"center",backgroundColor:"rgba(0,0,0,0.7)",color:"white",border:"1px solid rgba(255,255,255,0.1)"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:383",className:"vg-spinner"}),"Capturing..."]})}),s&&c&&!d&&!Q&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:391",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"}}),d&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:409",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:422",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"460px",background:"white",color:"#0f172a"},children:[l.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:428",style:{margin:"0 0 10px 0",fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:430",style:{marginBottom:"20px"},children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:431",style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[d.semanticReference.componentPath?l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:433",className:"vg-badge",style:{backgroundColor:"#f5f3ff",color:"#7c3aed",borderColor:"#ddd6fe"},children:["📦 ",d.tag]}):l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:437",className:"vg-badge",children:d.tag}),d.semanticReference.source&&!d.semanticReference.source.startsWith("unknown")?l.jsx(l.Fragment,{children:l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:442",className:"vg-badge",style:{backgroundColor:"#fdf2f8",color:"#db2777",borderColor:"#fbcfe8"},children:["📄 ",B(d.semanticReference.source.split(":")[0]||"unknown")]})}):l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:447",className:"vg-badge",style:{backgroundColor:"#f0f9ff",color:"#0369a1",borderColor:"#bae6fd",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["🆔 ",d.semanticReference.signature]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:452",style:{marginTop:"8px",fontSize:"11px",color:"#94a3b8"},children:["🎯 ",d.semanticReference.selector]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:458",style:{backgroundColor:"#f8fafc",borderRadius:"8px",border:"1px solid #e2e8f0",marginBottom:"20px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:467",style:{padding:"8px 12px",fontSize:"10px",color:"#94a3b8",textTransform:"uppercase",fontWeight:700,borderBottom:"1px solid #f1f5f9"},children:r.preview}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:470",style:{padding:"12px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",maxHeight:"200px",overflow:"hidden",backgroundColor:"#fdfdfd"},children:d.visualPreview?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:481",style:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:l.jsx("img",{src:d.visualPreview,alt:"Element Preview",style:{maxWidth:"90%",maxHeight:"160px",objectFit:"contain",boxShadow:"0 4px 12px rgba(0,0,0,0.12)",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"white"}})}):l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:504",style:{fontSize:"13px",color:"#64748b",fontStyle:"italic",textAlign:"center",padding:"0 20px"},children:['"',d.previewText,'"']})})]}),l.jsx("textarea",{className:"vg-textarea",value:x,onChange:f=>b(f.target.value),rows:4,placeholder:r.placeholder,autoFocus:!0}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:520",style:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"24px"},children:[l.jsx("button",{onClick:()=>h(null),className:"vg-button-ghost",children:r.cancel}),l.jsx("button",{onClick:te,className:"vg-button-primary",disabled:C||!x.trim(),style:{opacity:C||!x.trim()?.6:1},children:C?r.submitting:r.send})]})]})}),z&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:542",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:555",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"600px",maxHeight:"80vh",background:"white",color:"#0f172a",display:"flex",flexDirection:"column"},children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:564",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[l.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:565",style:{margin:0,fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:566",onClick:()=>q(!1),className:"vg-button-ghost",style:{padding:"6px 12px"},children:"✕"})]}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:569",style:{overflowY:"auto",flex:1,paddingRight:"8px",display:"flex",flexDirection:"column",gap:"16px"},children:$?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:571",style:{textAlign:"center",padding:"40px",color:"#64748b"},children:"Cargando..."}):W.length===0?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:573",style:{textAlign:"center",padding:"40px",color:"#64748b"},children:r.noComments}):W.map(f=>l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:576",style:{border:"1px solid #e2e8f0",borderRadius:"12px",padding:"16px",backgroundColor:f.status==="ready_for_review"?"#f0fdf4":"#fff"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:582",style:{display:"flex",justifyContent:"space-between",marginBottom:"12px"},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:583",style:{display:"flex",gap:"8px",alignItems:"center"},children:[f.status==="ready_for_review"?l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:585",className:"vg-badge",style:{backgroundColor:"#dcfce7",color:"#166534",borderColor:"#bbf7d0"},children:["✓ ",r.readyForReview]}):l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:587",className:"vg-badge",style:{backgroundColor:"#fef3c7",color:"#92400e",borderColor:"#fde68a"},children:["⏳ ",r.pending]}),l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:589",style:{fontSize:"12px",color:"#64748b"},children:new Date(f.timestamp).toLocaleString()})]})}),l.jsxs("p",{"data-source-path":"/src/components/ViewGateOverlay.tsx:595",style:{margin:"0 0 12px 0",fontSize:"15px",fontWeight:600},children:['"',f.message,'"']}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:597",style:{display:"flex",gap:"6px",flexWrap:"wrap",marginBottom:"16px"},children:[l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:598",className:"vg-badge",style:{backgroundColor:"#f1f5f9",color:"#475569",border:"none"},children:["📦 ",f.componentName?.split(" > ").pop()||"UI Element"]}),f.filePath&&f.filePath!=="unknown"&&l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:602",className:"vg-badge",style:{backgroundColor:"#f1f5f9",color:"#475569",border:"none"},children:["📄 ",B(f.filePath)]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:608",style:{display:"flex",gap:"8px",justifyContent:"flex-end",borderTop:"1px solid #e2e8f0",paddingTop:"16px",marginTop:"8px"},children:[f.status==="pending"?l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:610",className:"vg-button-primary",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:async()=>{try{(await fetch(`${a}/api/annotations/${f._id}`,{method:"PATCH",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({status:"ready_for_review"})})).ok&&(O(),e(r.updateSuccess,"success"))}catch{e(r.error,"error")}},children:["✅ ",r.markReady]}):l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:632",className:"vg-button-ghost",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:async()=>{try{(await fetch(`${a}/api/annotations/${f._id}`,{method:"PATCH",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({status:"pending"})})).ok&&(O(),e(r.updateSuccess,"success"))}catch{e(r.error,"error")}},children:["🔄 ",r.reopen]}),l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:655",className:"vg-button-ghost",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:()=>{if(f.url){le(!0);const m=new URL(f.url);m.hash=`vg_hl=${encodeURIComponent(f.reference.signature)}`,setTimeout(()=>{window.location.href=m.toString()},1e3)}},children:["👁️ ",r.review]}),l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:672",className:"vg-button-primary",style:{backgroundColor:"#ef4444",display:"flex",alignItems:"center",gap:"6px"},onClick:()=>{U({title:r.deleteConfirm,message:r.confirmDelete,onConfirm:async()=>{try{(await fetch(`${a}/api/annotations/${f._id}`,{method:"DELETE",headers:{"x-api-key":n}})).ok&&(O(),e(r.deleteSuccess,"success"))}catch{e(r.error,"error")}finally{U(null)}}})},children:["🗑️ ",r.close]})]})]},f._id))})]})}),ce&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:711",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.85)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:3e5,backdropFilter:"blur(10px)",color:"white"},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:725",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"20px"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:726",className:"vg-spinner",style:{width:"50px",height:"50px",borderTopColor:"white"}}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:727",style:{fontSize:"18px",fontWeight:600,letterSpacing:"0.5px"},children:r.navigating})]})}),I&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:734",className:"vg-animate-fade",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2e5},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:747",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"400px",background:"white",textAlign:"center"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:753",style:{fontSize:"48px",marginBottom:"16px"},children:"⚠️"}),l.jsx("h3",{"data-source-path":"/src/components/ViewGateOverlay.tsx:754",style:{margin:"0 0 12px 0",fontSize:"20px",fontWeight:700,color:"#0f172a"},children:I.title}),l.jsx("p",{"data-source-path":"/src/components/ViewGateOverlay.tsx:755",style:{margin:"0 0 24px 0",fontSize:"15px",color:"#64748b",lineHeight:1.5},children:I.message}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:757",style:{display:"flex",gap:"12px",justifyContent:"center"},children:[l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:758",className:"vg-button-ghost",onClick:()=>U(null),style:{flex:1},children:r.no}),l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:765",className:"vg-button-primary",style:{backgroundColor:"#ef4444",flex:1},onClick:I.onConfirm,children:r.yes})]})]})})]})};function oe(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,u)=>{const d=u+1;return c.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g,(h,x,b)=>h.includes("data-source-path")||b==="Fragment"||b==="React.Fragment"?h:`${x}<${b} data-source-path="${a}:${d}"`)}).join(`
|
|
10
|
+
`)}function At(){return{name:"vite-plugin-viewgate",enforce:"pre",transform(e,t){return{code:oe(e,t,process.cwd()),map:null}}}}function Gt(e){const t=this.resourcePath;return t?(process.env.NODE_ENV,oe(e,t,process.cwd())):e}R.ViewGate=Fe,R.ViewGateOverlay=Ve,R.transformSourcePaths=oe,R.useViewGate=he,R.viewgateNextLoader=Gt,R.viewgatePlugin=At,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
package/dist/cli.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import os from 'os';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
async function setup() {
|
|
9
|
-
console.log('🚀 Setting up ViewGate MCP Server...');
|
|
10
|
-
// 1. Locate mcp_config.json
|
|
11
|
-
const configDir = path.join(os.homedir(), '.gemini', 'antigravity');
|
|
12
|
-
const configPath = path.join(configDir, 'mcp_config.json');
|
|
13
|
-
if (!fs.existsSync(configPath)) {
|
|
14
|
-
console.error(`❌ Could not find mcp_config.json at ${configPath}`);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
// 2. Determine the path to the MCP server
|
|
18
|
-
// In production (node_modules), we'll be in dist/cli.js, so mcp-server is at ../mcp-server
|
|
19
|
-
// During local dev, it might be different.
|
|
20
|
-
let mcpServerPath = '';
|
|
21
|
-
// Check if we are running from node_modules or local dev
|
|
22
|
-
const isLocalDev = __dirname.includes('view-gate-wrapper' + path.sep + 'src') || __dirname.includes('view-gate-wrapper' + path.sep + 'dist');
|
|
23
|
-
if (isLocalDev) {
|
|
24
|
-
// Find the root of the project
|
|
25
|
-
let root = __dirname;
|
|
26
|
-
while (root !== path.parse(root).root && !fs.existsSync(path.join(root, 'package.json'))) {
|
|
27
|
-
root = path.dirname(root);
|
|
28
|
-
}
|
|
29
|
-
mcpServerPath = path.join(root, 'mcp-server', 'dist', 'index.js');
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// In node_modules, we expect to be in something like node_modules/viewgate-wrapper/dist
|
|
33
|
-
mcpServerPath = path.join(__dirname, '..', 'mcp-server', 'dist', 'index.js');
|
|
34
|
-
}
|
|
35
|
-
// Normalize to forward slashes for the JSON config (cleaner on Windows)
|
|
36
|
-
const normalizedMcpPath = mcpServerPath.replace(/\\/g, '/');
|
|
37
|
-
if (!fs.existsSync(mcpServerPath)) {
|
|
38
|
-
console.error(`❌ MCP Server not found at: ${mcpServerPath}`);
|
|
39
|
-
console.log('Please ensure you have built the project: npm run build');
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
// 3. Read and update mcp_config.json
|
|
43
|
-
try {
|
|
44
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
45
|
-
if (!config.mcpServers) {
|
|
46
|
-
config.mcpServers = {};
|
|
47
|
-
}
|
|
48
|
-
const currentServer = config.mcpServers.viewgate || {};
|
|
49
|
-
const env = currentServer.env || {};
|
|
50
|
-
// Default values if not present
|
|
51
|
-
const backendUrl = env.BACKEND_URL || 'https://view-gate.vercel.app';
|
|
52
|
-
const apiKey = env.API_KEY || 'YOUR_API_KEY_HERE';
|
|
53
|
-
config.mcpServers.viewgate = {
|
|
54
|
-
command: 'node',
|
|
55
|
-
args: [normalizedMcpPath],
|
|
56
|
-
env: {
|
|
57
|
-
BACKEND_URL: backendUrl,
|
|
58
|
-
API_KEY: apiKey
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
62
|
-
console.log(`✅ Updated mcp_config.json successfully!`);
|
|
63
|
-
console.log(`📍 MCP Path: ${normalizedMcpPath}`);
|
|
64
|
-
if (apiKey === 'YOUR_API_KEY_HERE') {
|
|
65
|
-
console.log('\n⚠️ Remember to set your API_KEY in:');
|
|
66
|
-
console.log(` ${configPath}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
console.error(`❌ Error updating configuration: ${error.message}`);
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
setup();
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { transformSourcePaths } from './transform-logic.js';
|
|
2
|
-
export default function viewgateNextLoader(source) {
|
|
3
|
-
const id = this.resourcePath;
|
|
4
|
-
if (!id)
|
|
5
|
-
return source;
|
|
6
|
-
// Debug log to ensure loader is running
|
|
7
|
-
if (process.env.NODE_ENV === 'development') {
|
|
8
|
-
// console.log(`[ViewGate] Transforming: ${id}`);
|
|
9
|
-
}
|
|
10
|
-
return transformSourcePaths(source, id, process.cwd());
|
|
11
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export function transformSourcePaths(code, id, cwd) {
|
|
2
|
-
if (!id.endsWith('.tsx') && !id.endsWith('.jsx'))
|
|
3
|
-
return code;
|
|
4
|
-
if (id.includes('node_modules'))
|
|
5
|
-
return code;
|
|
6
|
-
const normalizePath = (p) => p.replace(/\\/g, '/');
|
|
7
|
-
const relativePath = normalizePath(id).replace(normalizePath(cwd), '');
|
|
8
|
-
const lines = code.split('\n');
|
|
9
|
-
const transformedLines = lines.map((line, index) => {
|
|
10
|
-
const lineNumber = index + 1;
|
|
11
|
-
// Regex to find JSX tags and inject data-source-path (handles self-closing tags)
|
|
12
|
-
return line.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g, (match, prefix, tagName) => {
|
|
13
|
-
if (match.includes('data-source-path') || tagName === 'Fragment' || tagName === 'React.Fragment') {
|
|
14
|
-
return match;
|
|
15
|
-
}
|
|
16
|
-
return `${prefix}<${tagName} data-source-path="${relativePath}:${lineNumber}"`;
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
return transformedLines.join('\n');
|
|
20
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { transformSourcePaths } from './transform-logic.js';
|
|
2
|
-
export default function viewgatePlugin() {
|
|
3
|
-
return {
|
|
4
|
-
name: 'vite-plugin-viewgate',
|
|
5
|
-
enforce: 'pre',
|
|
6
|
-
transform(code, id) {
|
|
7
|
-
const transformedCode = transformSourcePaths(code, id, process.cwd());
|
|
8
|
-
return {
|
|
9
|
-
code: transformedCode,
|
|
10
|
-
map: null
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|