"use strict";(()=>{var e={};e.id=3949,e.ids=[3949],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")},76360:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>h,patchFetch:()=>v,requestAsyncStorage:()=>x,routeModule:()=>f,serverHooks:()=>m,staticGenerationAsyncStorage:()=>q});var s={};t.r(s),t.d(s,{POST:()=>l});var o=t(49303),i=t(88716),a=t(60670),n=t(87070),p=t(97816),u=t(71017),d=t.n(u),c=t(24263);async function l(e){try{let{officename:r,from_db:t=!1}=await e.json();if(t){if(!r)return n.NextResponse.json({error:"Office name is required"},{status:400});let e=d().join(process.cwd(),"d-access.json"),t=new p.lkr.auth.GoogleAuth({keyFile:e,scopes:["https://www.googleapis.com/auth/drive.readonly"]}),s=p.lkr.drive({version:"v3",auth:t}),o=await s.files.list({q:"'1XkT3jVUfFcZX4rJO6C0zpwG3Fe8-3n5r' in parents and name='pincodes.json' and mimeType='application/json' and trashed=false",fields:"files(id, name)"});if(!o.data.files.length)return n.NextResponse.json({message:"JSON file not found in Drive folder"},{status:404});let i=o.data.files[0].id,a=await s.files.get({fileId:i,alt:"media"},{responseType:"stream"}),u="";await new Promise((e,r)=>{a.data.on("data",e=>{u+=e}),a.data.on("end",e),a.data.on("error",r)});let c=JSON.parse(u).filter(e=>e.officename.toLowerCase().includes(r.toLowerCase())),l=[...new Map(c.map(e=>[e.pincode,{label:`${e.officename} | ${e.pincode}`,value:e.pincode}])).values()];return n.NextResponse.json({success:!0,data:l})}{let e=(await (0,c.Z)(`https://api.data.gov.in/resource/5c2f62fe-5afa-4119-a499-fec9d604d5bd?api-key=579b464db66ec23bdd0000011f4cccaaddbb4f355b4604cfd45414a6&format=json&filters%5Bofficename%5D=${r}&limit=10000`)).data.records,t=[...new Map(e.map(e=>[e.pincode,{label:`${e.officename} | ${e.pincode}`,value:e.pincode}])).values()];return n.NextResponse.json(t)}}catch(e){return console.log(e),[]}}let f=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/pincodes/route",pathname:"/api/pincodes",filename:"route",bundlePath:"app/api/pincodes/route"},resolvedPagePath:"C:\\Users\\Design Collection\\OneDrive\\Desktop\\Jitendra Vishwakarma\\Next Dashboard\\web crawler for user dev\\Scrape Genius\\app\\api\\pincodes\\route.js",nextConfigOutput:"",userland:s}),{requestAsyncStorage:x,staticGenerationAsyncStorage:q,serverHooks:m}=f,h="/api/pincodes/route";function v(){return(0,a.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:q})}}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,5972,6577,1053,8552,820,7816],()=>t(76360));module.exports=s})();