"use strict";(()=>{var e={};e.id=1056,e.ids=[1056],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")},14972:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>g,patchFetch:()=>h,requestAsyncStorage:()=>x,routeModule:()=>c,serverHooks:()=>m,staticGenerationAsyncStorage:()=>f});var s={};t.r(s),t.d(s,{POST:()=>l});var o=t(49303),a=t(88716),i=t(60670),n=t(97816),p=t(71017),u=t.n(p),d=t(87070);async function l(e){try{let r=(await e.json()).country;if(!r)return d.NextResponse.json({error:"Country name is required"},{status:400});let t=u().join(process.cwd(),"d-access.json"),s=new n.lkr.auth.GoogleAuth({keyFile:t,scopes:["https://www.googleapis.com/auth/drive.readonly","https://www.googleapis.com/auth/spreadsheets.readonly"]}),o=n.lkr.drive({version:"v3",auth:s}),a=n.lkr.sheets({version:"v4",auth:s}),i=await o.files.list({q:`'1kG3l7ZF3bJ8nYjHu5cpyF1jI5p8PZiKv' in parents and name = '${r}' and mimeType = 'application/vnd.google-apps.folder' and trashed = false`,fields:"files(id, name)"});if(!i.data.files.length)return d.NextResponse.json({error:`Data not available for ${r} country`},{status:404});let p=i.data.files[0].id,l=(await o.files.list({q:`'${p}' in parents and mimeType='application/vnd.google-apps.spreadsheet' and trashed=false`,fields:"files(id, name)"})).data.files;if(!l.length)return d.NextResponse.json({message:`No data found for ${r} country`},{status:200});for(let e of l){if(e.name.toLowerCase().includes("completed"))continue;let r=(await a.spreadsheets.values.get({spreadsheetId:e.id,range:"A1:Z"})).data.values;if(!r||r.length<2)continue;let t=r[0],s=t.indexOf("domain_name"),o=t.indexOf("registrant_country"),i=t.indexOf("proceed_date");if(-1===s||-1===o||-1===i)continue;let n=r.slice(1).filter(e=>!e[i]||""===e[i].trim()).map(e=>({domain_name:e[s]||"",registrant_country:e[o]||""}));if(n.length>0)return d.NextResponse.json({data:n},{status:200})}return d.NextResponse.json({message:`No data found for ${r}`},{status:200})}catch(e){return console.error("Error fetching data:",e),d.NextResponse.json({error:"Internal Server Error",details:e.message},{status:500})}}let c=new o.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/get_domain/route",pathname:"/api/get_domain",filename:"route",bundlePath:"app/api/get_domain/route"},resolvedPagePath:"C:\\Users\\Design Collection\\OneDrive\\Desktop\\Jitendra Vishwakarma\\Next Dashboard\\web crawler for user dev\\Scrape Genius\\app\\api\\get_domain\\route.js",nextConfigOutput:"",userland:s}),{requestAsyncStorage:x,staticGenerationAsyncStorage:f,serverHooks:m}=c,g="/api/get_domain/route";function h(){return(0,i.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:f})}}};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(14972));module.exports=s})();