{"version":3,"file":"http.cjs","sources":["../../../src/http.ts"],"sourcesContent":["import { version } from \"./version\";\n\nconst getEnvironment = (): \"web\" | \"server\" =>\n  typeof window !== \"undefined\" ? \"web\" : \"server\";\n\nexport const SDK_USER_AGENT = `helius-node-sdk/${version} (${getEnvironment()})`;\n\n/**\n * Sanitize a client identifier string, stripping non-printable ASCII.\n * Returns the cleaned string or `undefined` if nothing usable remains.\n */\nexport const sanitizeClient = (raw: string): string | undefined => {\n  const sanitized = raw.replace(/[^\\x20-\\x7E]/g, \"\").trim();\n  return sanitized || undefined;\n};\n\n/**\n * Build the standard SDK headers.\n *\n * - `User-Agent` is always the SDK identifier (e.g. `helius-node-sdk/2.1.0 (server)`).\n * - When a consumer `clientId` is provided (e.g. `helius-mcp/0.3.0`), it is sent\n *   as the `X-Helius-Client` header instead of being stacked in `User-Agent`.\n */\nexport const getSDKHeaders = (clientId?: string): Record<string, string> => {\n  const headers: Record<string, string> = {\n    \"User-Agent\": SDK_USER_AGENT,\n  };\n\n  if (clientId) {\n    const sanitized = sanitizeClient(clientId);\n    if (sanitized) {\n      headers[\"X-Helius-Client\"] = sanitized;\n    }\n  }\n\n  return headers;\n};\n"],"names":["version"],"mappings":";;;;AAEA,MAAM,cAAc,GAAG,MACrB,OAAO,MAAM,KAAK,WAAW,GAAG,KAAK,GAAG,QAAQ;AAE3C,MAAM,cAAc,GAAG,CAAA,gBAAA,EAAmBA,eAAO,CAAA,EAAA,EAAK,cAAc,EAAE,CAAA,CAAA;AAE7E;;;AAGG;AACI,MAAM,cAAc,GAAG,CAAC,GAAW,KAAwB;AAChE,IAAA,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE;IACzD,OAAO,SAAS,IAAI,SAAS;AAC/B;AAEA;;;;;;AAMG;AACI,MAAM,aAAa,GAAG,CAAC,QAAiB,KAA4B;AACzE,IAAA,MAAM,OAAO,GAA2B;AACtC,QAAA,YAAY,EAAE,cAAc;KAC7B;IAED,IAAI,QAAQ,EAAE;AACZ,QAAA,MAAM,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC;QAC1C,IAAI,SAAS,EAAE;AACb,YAAA,OAAO,CAAC,iBAAiB,CAAC,GAAG,SAAS;QACxC;IACF;AAEA,IAAA,OAAO,OAAO;AAChB;;;;;;"}