"use strict";(()=>{var e={};e.id=9581,e.ids=[9581],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")},56681:e=>{e.exports=require("playwright")},57574:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>g,patchFetch:()=>y,requestAsyncStorage:()=>p,routeModule:()=>d,serverHooks:()=>h,staticGenerationAsyncStorage:()=>m});var a={};r.r(a),r.d(a,{POST:()=>c});var l=r(49303),n=r(88716),i=r(60670),s=r(87070),o=r(56681),u=r.n(o);async function c(e){let t;try{let{url:r,headless:a=!0}=await e.json();if(!r)return s.NextResponse.json({error:"URL is required"},{status:400});t=await u().chromium.launch({headless:a});let l=await t.newPage();await l.route("**/*",e=>{["image","stylesheet","font"].includes(e.request().resourceType())?e.abort():e.continue()}),await l.goto(r,{waitUntil:"domcontentloaded",timeout:3e4});let n=await l.evaluate(()=>{let e=document.querySelector('div[id="business-unit-title"]'),t=e.querySelector("h1 span"),r=document.querySelector('svg path[d="M0 0h16v16H0z"]')||null,a=document.querySelector('svg path[d="M0 2.5h16v11H0v-11Zm1.789 1L8 9.173 14.211 3.5H1.79ZM15 4.134l-7 6.393-7-6.393V12.5h14V4.134Z"]')||null,l=document.querySelector('svg path[d="M8 4a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5ZM4.5 6.5a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0Z"]')||null,n=document.querySelector('svg path[d="M10.694 1.537c.217.281.415.592.593.923.321.6.59 1.287.793 2.04h1.983a7.027 7.027 0 0 0-3.37-2.963ZM14.54 5.5h-2.235c.143.789.22 1.63.22 2.5 0 .87-.077 1.711-.22 2.5h2.235c.297-.776.46-1.62.46-2.5 0-.88-.163-1.724-.46-2.5Zm-.476 6H12.08a9.655 9.655 0 0 1-.793 2.04 6.698 6.698 0 0 1-.593.923 7.027 7.027 0 0 0 3.37-2.963Zm-8.758 2.963a6.708 6.708 0 0 1-.593-.923 9.654 9.654 0 0 1-.792-2.04H1.936a7.027 7.027 0 0 0 3.37 2.963ZM1.46 10.5h2.236c-.144-.789-.22-1.63-.22-2.5 0-.87.076-1.711.22-2.5H1.46A6.984 6.984 0 0 0 1 8c0 .88.163 1.724.46 2.5Zm.476-6h1.985c.203-.753.47-1.44.792-2.04.178-.331.376-.642.593-.923A7.027 7.027 0 0 0 1.936 4.5ZM8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0M5.595 2.933c-.247.46-.461.987-.635 1.567H7.5V1.075c-.677.204-1.35.822-1.905 1.858Zm4.81 0c.247.46.462.987.635 1.567H8.5V1.075c.677.204 1.35.822 1.906 1.858ZM8.5 5.5h2.787c.153.774.238 1.616.238 2.5 0 .884-.085 1.726-.238 2.5H8.5v-5Zm0 6h2.54a8.428 8.428 0 0 1-.634 1.567c-.557 1.036-1.229 1.654-1.906 1.858V11.5Zm-1 0v3.425c-.677-.204-1.35-.822-1.905-1.858A8.426 8.426 0 0 1 4.96 11.5H7.5Zm0-1H4.713A12.91 12.91 0 0 1 4.475 8c0-.884.085-1.726.238-2.5H7.5v5Z"]')||null,i=e.querySelector(".styles_breadcrumb__klHaT a"),s=e.querySelector(".styles_ratingContainer__desHL p"),o=document.querySelector("img.business-profile-image_image__V14jr"),u=document.querySelector('[data-testid="company-details-card"] p'),c=u?.innerText?.trim()||null,d=o?.src?.trim()||null;s?.innerText?.trim();let p=i?.innerText?.trim()||null,m=t?.innerText?.trim()||null,h=l?.closest("li")?.querySelector("p")?.innerText?.trim()||null,g=n?.closest("li")?.querySelector("a")?.href?.trim()||null,y=a?.closest("li")?.querySelector("a")?.innerText?.trim()||null,v=r?.closest("li")?.querySelector("a")?.innerText?.trim()||null,q=[];if(v){let e=Array.from(v.matchAll(/\+?\d{1,4}?[-.\s]?\(?\d{2,5}\)?[-.\s]?\d{3,4}[-.\s]?\d{4,9}/g),e=>e[0]);q=[...new Set(e.filter(e=>{let t=e.replace(/[^\d+]/g,"");return!(t.length<7||t.length>15||/^\d+$/.test(t)&&(t.length<10||t.length>14))&&!!/^\+?\d{1,4}[-.\s]?\(?\d{2,5}\)?[-.\s]?\d{3,4}[-.\s]?\d{4,9}$/.test(e)}))].map(e=>e.replace(/[\s()\-\+]/g,""))||[]}return{sector:p,profileImg:d,title:m,company:m,phone:q,address:h,email:y||"N/A",website:g,description:c}});return s.NextResponse.json(n)}catch(e){return console.log(e),[]}finally{t&&await t.close()}}let d=new l.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/trustpilot_detail_scraper/route",pathname:"/api/trustpilot_detail_scraper",filename:"route",bundlePath:"app/api/trustpilot_detail_scraper/route"},resolvedPagePath:"C:\\Users\\Design Collection\\OneDrive\\Desktop\\Jitendra Vishwakarma\\Next Dashboard\\web crawler for user dev\\Scrape Genius\\app\\api\\trustpilot_detail_scraper\\route.js",nextConfigOutput:"",userland:a}),{requestAsyncStorage:p,staticGenerationAsyncStorage:m,serverHooks:h}=d,g="/api/trustpilot_detail_scraper/route";function y(){return(0,i.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:m})}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[8948,5972],()=>r(57574));module.exports=a})();