/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@darkvisitors/sdk@1.6.1/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DarkVisitors=exports.AgentType=void 0;const NODE_PACKAGE_VERSION="1.3.0";var AgentType;!function(e){e.AIAgent="AI Agent",e.AIAssistant="AI Assistant",e.AIDataScraper="AI Data Scraper",e.AISearchCrawler="AI Search Crawler",e.Archiver="Archiver",e.DeveloperHelper="Developer Helper",e.Fetcher="Fetcher",e.HeadlessAgent="Headless Agent",e.IntelligenceGatherer="Intelligence Gatherer",e.Scraper="Scraper",e.SEOCrawler="SEO Crawler",e.SearchEngineCrawler="Search Engine Crawler",e.SecurityScanner="Security Scanner",e.UndocumentedAIAgent="Undocumented AI Agent"}(AgentType||(exports.AgentType=AgentType={}));class DarkVisitors{constructor(e){this.accessToken=e}trackVisit(e){const t="path"in e?e:{path:e.url?new URL(e.url,"https://example.org/").pathname:"/",method:e.method??"GET",headers:e.headers};fetch("https://api.darkvisitors.com/visits",{method:"POST",headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify({request_path:t.path,request_method:t.method,request_headers:this.filterHeaders(t.headers),node_package_version:"1.3.0"})}).catch((e=>{console.error(`Dark Visitors failed to track visit: ${e.message}`)}))}async generateRobotsTxt(e,t="/"){const r=await fetch("https://api.darkvisitors.com/robots-txts",{method:"POST",headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify({agent_types:e,disallow:t,node_package_version:"1.3.0"})});if(r.ok)return await r.text();throw new Error(`Dark Visitors failed to generate robots.txt: ${r.status} ${r.statusText}`)}filterHeaders(e){const t=new Set(["authorization","proxy-authorization","cookie","set-cookie"]);return Object.fromEntries(Object.entries(e).filter((([e])=>!t.has(e.toLowerCase()))))}}exports.DarkVisitors=DarkVisitors;
//# sourceMappingURL=/sm/d568342baceb90f769e6f229168a70fb3b5de3910cd779fdce812ae3a9ce295e.map