module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},23862,e=>e.a(async(t,r)=>{try{let t=await e.y("pg-587764f78a6c7a9c");e.n(t),r()}catch(e){r(e)}},!0),64769,e=>e.a(async(t,r)=>{try{var a=e.i(23862),n=t([a]);[a]=n.then?(await n)():n;let s=new a.Pool({host:"209.74.80.58",port:5432,user:"rrgnihyq_admin_domiblocks",password:"D0miblocks#2026",database:"rrgnihyq_DOMIBLOCKS_OPS",max:5,idleTimeoutMillis:3e4,connectionTimeoutMillis:1e4});s.on("error",e=>{console.error("❌ [DB OPS ERROR]:",e.message)}),e.s(["default",0,s,"queryOps",0,(e,t)=>s.query(e,t)]),r()}catch(e){r(e)}},!1),49603,e=>e.a(async(t,r)=>{try{var a=e.i(89171),n=e.i(64769),s=t([n]);async function i(e){try{let t=(await e.json()).visitas||[];if(!Array.isArray(t)||0===t.length)return a.NextResponse.json({success:!0,message:"No hay visitas para procesar"});for(let e of(console.log(`Recibiendo ${t.length} visitas para sincronizar...`),t)){let{id:t,clienteId:r,clienteNombre:a,vendedorId:s,fechaInicio:i,fechaFin:o,latitud:l,longitud:d}=e,c=`
        INSERT INTO "Visita" (
          "id", 
          "clienteId", 
          "clienteNombre", 
          "vendedorId", 
          "fechaInicio", 
          "fechaFin", 
          "latitud", 
          "longitud", 
          "sincronizado", 
          "createdAt"
        )
        VALUES ($1, $2, $3, $4, $5, $6, $7, $8, true, NOW())
        ON CONFLICT ("id") DO UPDATE SET
          "fechaFin" = EXCLUDED."fechaFin",
          "sincronizado" = true;
      `;await (0,n.queryOps)(c,[t,r,a,s,new Date(i),o?new Date(o):null,l,d])}return a.NextResponse.json({success:!0,message:"Visitas sincronizadas correctamente"})}catch(e){return console.error("Error sincronizando visitas:",e),a.NextResponse.json({error:"Internal Server Error"},{status:500})}}[n]=s.then?(await s)():s,e.s(["POST",()=>i]),r()}catch(e){r(e)}},!1),67616,e=>e.a(async(t,r)=>{try{var a=e.i(47909),n=e.i(74017),s=e.i(96250),i=e.i(59756),o=e.i(61916),l=e.i(74677),d=e.i(69741),c=e.i(16795),u=e.i(87718),p=e.i(95169),h=e.i(47587),x=e.i(66012),R=e.i(70101),v=e.i(26937),y=e.i(10372),g=e.i(93695);e.i(52474);var f=e.i(220),m=e.i(49603),w=t([m]);[m]=w.then?(await w)():w;let A=new a.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/visitas/sync/route",pathname:"/api/visitas/sync",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/visitas/sync/route.ts",nextConfigOutput:"standalone",userland:m}),{workAsyncStorage:O,workUnitAsyncStorage:N,serverHooks:b}=A;function E(){return(0,s.patchFetch)({workAsyncStorage:O,workUnitAsyncStorage:N})}async function C(e,t,r){A.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let a="/api/visitas/sync/route";a=a.replace(/\/index$/,"")||"/";let s=await A.prepare(e,t,{srcPage:a,multiZoneDraftMode:!1});if(!s)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:m,params:w,nextConfig:E,parsedUrl:C,isDraftMode:O,prerenderManifest:N,routerServerContext:b,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,resolvedPathname:S,clientReferenceManifest:q,serverActionsManifest:_}=s,k=(0,d.normalizeAppPath)(a),I=!!(N.dynamicRoutes[k]||N.routes[S]),D=async()=>((null==b?void 0:b.render404)?await b.render404(e,t,C,!1):t.end("This page could not be found"),null);if(I&&!O){let e=!!N.routes[S],t=N.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await D();throw new g.NoFallbackError}}let j=null;!I||A.isDev||O||(j=S,j="/index"===j?"/":j);let U=!0===A.isDev||!I,$=I&&!U;_&&q&&(0,l.setManifestsSingleton)({page:a,clientReferenceManifest:q,serverActionsManifest:_});let H=e.method||"GET",M=(0,o.getTracer)(),F=M.getActiveScopeSpan(),K={params:w,prerenderManifest:N,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,i.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>A.onRequestError(e,t,a,n,b)},sharedContext:{buildId:m}},L=new c.NodeNextRequest(e),B=new c.NodeNextResponse(t),z=u.NextRequestAdapter.fromNodeNextRequest(L,(0,u.signalFromNodeResponse)(t));try{let s=async e=>A.handle(z,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==p.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${H} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${H} ${a}`)}),l=!!(0,i.getRequestMeta)(e,"minimalMode"),d=async i=>{var o,d;let c=async({previousCacheEntry:n})=>{try{if(!l&&T&&P&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await s(i);e.fetchMetrics=K.renderOpts.fetchMetrics;let o=K.renderOpts.pendingWaitUntil;o&&r.waitUntil&&(r.waitUntil(o),o=void 0);let d=K.renderOpts.collectedTags;if(!I)return await (0,x.sendResponse)(L,B,a,K.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,R.toNodeOutgoingHttpHeaders)(a.headers);d&&(t[y.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=y.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,n=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=y.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==n?void 0:n.isStale)&&await A.onRequestError(e,t,{routerKind:"App Router",routePath:a,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:T})},!1,b),t}},u=await A.handleResponse({req:e,nextConfig:E,cacheKey:j,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,responseGenerator:c,waitUntil:r.waitUntil,isMinimalMode:l});if(!I)return null;if((null==u||null==(o=u.value)?void 0:o.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(d=u.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});l||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),O&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let p=(0,R.fromNodeOutgoingHttpHeaders)(u.value.headers);return l&&I||p.delete(y.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||p.get("Cache-Control")||p.set("Cache-Control",(0,v.getCacheControlHeader)(u.cacheControl)),await (0,x.sendResponse)(L,B,new Response(u.value.body,{headers:p,status:u.value.status||200})),null};F?await d(F):await M.withPropagatedContext(e.headers,()=>M.trace(p.BaseServerSpan.handleRequest,{spanName:`${H} ${a}`,kind:o.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},d))}catch(t){if(t instanceof g.NoFallbackError||await A.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:T})},!1,b),I)throw t;return await (0,x.sendResponse)(L,B,new Response(null,{status:500})),null}}e.s(["handler",()=>C,"patchFetch",()=>E,"routeModule",()=>A,"serverHooks",()=>b,"workAsyncStorage",()=>O,"workUnitAsyncStorage",()=>N]),r()}catch(e){r(e)}},!1)];

//# sourceMappingURL=%5Broot-of-the-server%5D__b45a5d1b._.js.map