module.exports=[70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},38827,e=>{"use strict";var t=e.i(26747),r=e.i(90406),a=e.i(44898),s=e.i(62950),i=e.i(24977);function n(e){return null==e?null:String(e)}async function o(e,t){if("GET"!==e.method)return t.status(405).json({success:!1,message:"Method not allowed"});let r=process.env.SECRET_TOKEN||"TTWQW222rs#@#@!@";{let a,s=((a=e.headers.authorization||"").startsWith("Bearer ")?a.slice(7):a).trim();if(!s||s!==r)return t.status(401).json({success:!1,message:"Unauthorized"})}try{let{dateFrom:r,dateTo:a,company:s}=e.query,o={};s&&(o.agency=String(s)),(r||a)&&(o.startdate={},r&&(o.startdate.gte=new Date(String(r))),a&&(o.startdate.lte=new Date(String(a))));let u=await i.default.policy.count({where:o}),d=await i.default.policy.aggregate({where:o,_sum:{premium:!0}}),l=await i.default.policy.groupBy({by:["product"],where:o,_count:{id:!0},_sum:{premium:!0},orderBy:{_count:{id:"desc"}}}),p=await i.default.policy.findMany({where:o,take:10,orderBy:[{startdate:"desc"},{createdAt:"desc"}],select:{id:!0,agency:!0,startdate:!0,insured:!0,policyEndorsementNo:!0,plate:!0,product:!0,premium:!0,paymentStatus:!0}});return t.status(200).json({success:!0,summary:{totalPolicies:u,premiumSum:n(d._sum.premium??0)},products:l.map(e=>({product:e.product||"Tanımsız",count:e._count.id,premiumSum:n(e._sum.premium??0)})),recent:p.map(e=>{var t;return{...e,startdate:(t=e.startdate)?new Date(t).toISOString():null,premium:n(e.premium)}})})}catch(e){return console.error(e),t.status(500).json({success:!1,message:"Server error"})}}e.s(["default",()=>o],38229);var u=e.i(38229),d=e.i(7031),l=e.i(81927),p=e.i(46432);let c=(0,s.hoist)(u,"default"),m=(0,s.hoist)(u,"config"),g=new a.PagesAPIRouteModule({definition:{kind:r.RouteKind.PAGES_API,page:"/api/Dashboard/Home",pathname:"/api/Dashboard/Home",bundlePath:"",filename:""},userland:u,distDir:".next",relativeProjectDir:""});async function h(e,r,a){g.isDev&&(0,p.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let s="/api/Dashboard/Home";s=s.replace(/\/index$/,"")||"/";let i=await g.prepare(e,r,{srcPage:s});if(!i){r.statusCode=400,r.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve());return}let{query:n,params:o,prerenderManifest:u,routerServerContext:c}=i;try{let t=e.method||"GET",a=(0,d.getTracer)(),i=a.getActiveScopeSpan(),p=g.instrumentationOnRequestError.bind(g),m=async i=>g.render(e,r,{query:{...n,...o},params:o,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:u.preview,propagateError:!1,dev:g.isDev,page:"/api/Dashboard/Home",internalRevalidate:null==c?void 0:c.revalidate,onError:(...t)=>p(e,...t)}).finally(()=>{if(!i)return;i.setAttributes({"http.status_code":r.statusCode,"next.rsc":!1});let e=a.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==l.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=e.get("next.route");if(n){let e=`${t} ${n}`;i.setAttributes({"next.route":n,"http.route":n,"next.span_name":e}),i.updateName(e)}else i.updateName(`${t} ${s}`)});i?await m(i):await a.withPropagatedContext(e.headers,()=>a.trace(l.BaseServerSpan.handleRequest,{spanName:`${t} ${s}`,kind:d.SpanKind.SERVER,attributes:{"http.method":t,"http.target":e.url}},m))}catch(e){if(g.isDev)throw e;(0,t.sendError)(r,500,"Internal Server Error")}finally{null==a.waitUntil||a.waitUntil.call(a,Promise.resolve())}}e.s(["config",0,m,"default",0,c,"handler",()=>h],38827)}];

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