"use strict";(()=>{var e={};e.id=7850,e.ids=[7850],e.modules={20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},39491:e=>{e.exports=require("assert")},14300:e=>{e.exports=require("buffer")},32081:e=>{e.exports=require("child_process")},6113:e=>{e.exports=require("crypto")},82361:e=>{e.exports=require("events")},57147:e=>{e.exports=require("fs")},13685:e=>{e.exports=require("http")},85158:e=>{e.exports=require("http2")},95687:e=>{e.exports=require("https")},41808:e=>{e.exports=require("net")},15673:e=>{e.exports=require("node:events")},97742:e=>{e.exports=require("node:process")},47261:e=>{e.exports=require("node:util")},22037:e=>{e.exports=require("os")},71017:e=>{e.exports=require("path")},77282:e=>{e.exports=require("process")},85477:e=>{e.exports=require("punycode")},63477:e=>{e.exports=require("querystring")},12781:e=>{e.exports=require("stream")},24404:e=>{e.exports=require("tls")},76224:e=>{e.exports=require("tty")},57310:e=>{e.exports=require("url")},73837:e=>{e.exports=require("util")},59796:e=>{e.exports=require("zlib")},12168:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>g,patchFetch:()=>v,requestAsyncStorage:()=>h,routeModule:()=>x,serverHooks:()=>q,staticGenerationAsyncStorage:()=>c});var s={};t.r(s),t.d(s,{POST:()=>l});var o=t(49303),a=t(88716),i=t(60670),p=t(97816),u=t(71017),n=t.n(u),d=t(87070);async function l(e){try{let r=(await e.json()).url;if(!r)return d.NextResponse.json({error:"Google Sheet URL is required"},{status:400});let t=r.match(/\/d\/([a-zA-Z0-9-_]+)/),s=t?.[1];if(!s)return d.NextResponse.json({error:"Invalid Google Sheet URL"},{status:400});let o=n().join(process.cwd(),"d-access.json"),a=new p.lkr.auth.GoogleAuth({keyFile:o,scopes:["https://www.googleapis.com/auth/spreadsheets.readonly"]}),i=p.lkr.sheets({version:"v4",auth:a}),u=await i.spreadsheets.get({spreadsheetId:s}),l=u.data.sheets?.[0];if(!l||!l.properties?.title)return d.NextResponse.json({error:"No sheets found in this spreadsheet"},{status:404});let x=l.properties.title,h=(await i.spreadsheets.values.get({spreadsheetId:s,range:`${x}!A1:Z`})).data.values;if(!h||h.length<2)return d.NextResponse.json({message:"No data rows available in the sheet"},{status:200});let c=h[0],q=h.slice(1).map(e=>{let r={};return c.forEach((t,s)=>{r[t]=e[s]||""}),r});return d.NextResponse.json({records:q},{status:200})}catch(e){return d.NextResponse.json({error:e,details:e.message},{status:500})}}let x=new o.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/ad_leads/route",pathname:"/api/ad_leads",filename:"route",bundlePath:"app/api/ad_leads/route"},resolvedPagePath:"C:\\Users\\Design Collection\\OneDrive\\Desktop\\Jitendra Vishwakarma\\Next Dashboard\\web crawler for user dev\\Scrape Genius\\app\\api\\ad_leads\\route.js",nextConfigOutput:"",userland:s}),{requestAsyncStorage:h,staticGenerationAsyncStorage:c,serverHooks:q}=x,g="/api/ad_leads/route";function v(){return(0,i.patchFetch)({serverHooks:q,staticGenerationAsyncStorage:c})}}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,5972,6577,820,7816],()=>t(12168));module.exports=s})();