@treasuredata/tdx 2026.4.21 → 2026.4.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.d.ts.map +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-command.js.map +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/tables.js +1 -1
  53. package/dist/commands/unset-command.js +1 -1
  54. package/dist/commands/upgrade-command.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/work-command.js +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/oauth-keychain.js +1 -1
  68. package/dist/core/oauth.js +1 -1
  69. package/dist/core/profile.js +1 -1
  70. package/dist/core/project-config.js +1 -1
  71. package/dist/core/session.js +1 -1
  72. package/dist/core/user-cache.js +1 -1
  73. package/dist/core/version.js +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/mcp/server.js +1 -1
  76. package/dist/mcp/tools/index.js +1 -1
  77. package/dist/mcp/tools/tdx-run.js +1 -1
  78. package/dist/mcp/tools/tdx-search.js +1 -1
  79. package/dist/mcp/tools/work-create-item.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
  82. package/dist/proxy/claude-usage-tracker.js +1 -1
  83. package/dist/proxy/claude-usage-tracker.js.map +1 -1
  84. package/dist/proxy/passthrough-server.d.ts +10 -0
  85. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  86. package/dist/proxy/passthrough-server.js +1 -1
  87. package/dist/proxy/passthrough-server.js.map +1 -1
  88. package/dist/proxy/sse-usage-parser.js +1 -1
  89. package/dist/sdk/agent/agent-config.js +1 -1
  90. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  91. package/dist/sdk/agent/agent-yaml.js +1 -1
  92. package/dist/sdk/agent/test/evaluator.js +1 -1
  93. package/dist/sdk/agent/test/executor.js +1 -1
  94. package/dist/sdk/agent/test/index.js +1 -1
  95. package/dist/sdk/agent/test/output.js +1 -1
  96. package/dist/sdk/agent/test/parser.js +1 -1
  97. package/dist/sdk/agent/tool-target-registry.js +1 -1
  98. package/dist/sdk/api.js +1 -1
  99. package/dist/sdk/cas/cas-api-client.js +1 -1
  100. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  101. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  102. package/dist/sdk/cas/index.js +1 -1
  103. package/dist/sdk/cas/pull-workflow.js +1 -1
  104. package/dist/sdk/cas/push-workflow.js +1 -1
  105. package/dist/sdk/client/cdp-api-client.js +1 -1
  106. package/dist/sdk/client/delivery-api-client.js +1 -1
  107. package/dist/sdk/client/endpoints.js +1 -1
  108. package/dist/sdk/client/engage-api-client.js +1 -1
  109. package/dist/sdk/client/http-client.js +1 -1
  110. package/dist/sdk/client/llm-api-client.js +1 -1
  111. package/dist/sdk/client/oauth-refresh.js +1 -1
  112. package/dist/sdk/client/rate-limiter.js +1 -1
  113. package/dist/sdk/client/td-api-client.js +1 -1
  114. package/dist/sdk/client/trino-api-client.js +1 -1
  115. package/dist/sdk/client/workflow-client.js +1 -1
  116. package/dist/sdk/connection-validator.js +1 -1
  117. package/dist/sdk/connection.js +1 -1
  118. package/dist/sdk/delivery.js +1 -1
  119. package/dist/sdk/engage/campaign-pull.js +1 -1
  120. package/dist/sdk/engage/campaign-push.js +1 -1
  121. package/dist/sdk/engage/campaign-validator.js +1 -1
  122. package/dist/sdk/engage/campaign-yaml.js +1 -1
  123. package/dist/sdk/engage/template-pull.js +1 -1
  124. package/dist/sdk/engage/template-push.js +1 -1
  125. package/dist/sdk/engage/template-validator.js +1 -1
  126. package/dist/sdk/engage/template-yaml.js +1 -1
  127. package/dist/sdk/engage/types/campaign-def.js +1 -1
  128. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  129. package/dist/sdk/engage/types/template-schema.js +1 -1
  130. package/dist/sdk/engage.js +1 -1
  131. package/dist/sdk/errors.js +1 -1
  132. package/dist/sdk/index.js +1 -1
  133. package/dist/sdk/io/index.js +1 -1
  134. package/dist/sdk/io/node-filesystem.js +1 -1
  135. package/dist/sdk/job.js +1 -1
  136. package/dist/sdk/journey.js +1 -1
  137. package/dist/sdk/llm/chat-cache.js +1 -1
  138. package/dist/sdk/llm/index.js +1 -1
  139. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  140. package/dist/sdk/llm/model-factors.d.ts +33 -9
  141. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  142. package/dist/sdk/llm/model-factors.js +1 -1
  143. package/dist/sdk/llm/model-factors.js.map +1 -1
  144. package/dist/sdk/personalization.js +1 -1
  145. package/dist/sdk/policy.js +1 -1
  146. package/dist/sdk/query/index.js +1 -1
  147. package/dist/sdk/query/sql-parser.js +1 -1
  148. package/dist/sdk/realtime.js +1 -1
  149. package/dist/sdk/schedule.js +1 -1
  150. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  151. package/dist/sdk/segment/fields-display.js +1 -1
  152. package/dist/sdk/segment/file-discovery.js +1 -1
  153. package/dist/sdk/segment/journey-utils.js +1 -1
  154. package/dist/sdk/segment/journey-validator.js +1 -1
  155. package/dist/sdk/segment/journey-yaml.js +1 -1
  156. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  157. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  158. package/dist/sdk/segment/pull-workflow.js +1 -1
  159. package/dist/sdk/segment/push-recovery.js +1 -1
  160. package/dist/sdk/segment/push-workflow.js +1 -1
  161. package/dist/sdk/segment/resolution-context.js +1 -1
  162. package/dist/sdk/segment/segment-path-parser.js +1 -1
  163. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  164. package/dist/sdk/segment/segment-validator.js +1 -1
  165. package/dist/sdk/segment/target-resolution.js +1 -1
  166. package/dist/sdk/segment/tdx-config.js +1 -1
  167. package/dist/sdk/segment/types/activation-schema.js +1 -1
  168. package/dist/sdk/segment/types/journey-def.js +1 -1
  169. package/dist/sdk/segment/types/journey-schema.js +1 -1
  170. package/dist/sdk/segment/types/segment-def.js +1 -1
  171. package/dist/sdk/segment/types/segment-schema.js +1 -1
  172. package/dist/sdk/segment/validate-files.js +1 -1
  173. package/dist/sdk/segment/yaml-validator.js +1 -1
  174. package/dist/sdk/segment.js +1 -1
  175. package/dist/sdk/types/index.js +1 -1
  176. package/dist/sdk/types/progress.js +1 -1
  177. package/dist/sdk/types/workspace.js +1 -1
  178. package/dist/sdk/user.js +1 -1
  179. package/dist/sdk/util/format-detector.js +1 -1
  180. package/dist/sdk/util/formatters.js +1 -1
  181. package/dist/sdk/util/index.js +1 -1
  182. package/dist/sdk/util/paginate.js +1 -1
  183. package/dist/sdk/util/tree-formatter.js +1 -1
  184. package/dist/sdk/workflow/archive-validation.js +1 -1
  185. package/dist/sdk/workflow/clone-workflow.js +1 -1
  186. package/dist/sdk/workflow/index.js +1 -1
  187. package/dist/sdk/workflow/pull-workflow.js +1 -1
  188. package/dist/sdk/workflow/push-workflow.js +1 -1
  189. package/dist/sdk/workflow/task-graph.js +1 -1
  190. package/dist/sdk/workflow/tdx-config.js +1 -1
  191. package/dist/sdk/workflow/workflow-utils.js +1 -1
  192. package/dist/sdk/workspace/access-tracker.js +1 -1
  193. package/dist/sdk/workspace/frontmatter.js +1 -1
  194. package/dist/sdk/workspace/git.js +1 -1
  195. package/dist/sdk/workspace/index.js +1 -1
  196. package/dist/sdk/workspace/templates.js +1 -1
  197. package/dist/sdk/workspace/weekly.js +1 -1
  198. package/dist/sdk/workspace/wikilinks.js +1 -1
  199. package/dist/test-utils/command-runner.js +1 -1
  200. package/dist/test-utils/factories.js +1 -1
  201. package/dist/test-utils/fixtures.js +1 -1
  202. package/dist/test-utils/http-mock.js +1 -1
  203. package/dist/test-utils/index.js +1 -1
  204. package/dist/utils/async.js +1 -1
  205. package/dist/utils/colors.js +1 -1
  206. package/dist/utils/diff.js +1 -1
  207. package/dist/utils/file-permissions.js +1 -1
  208. package/dist/utils/file-reader.js +1 -1
  209. package/dist/utils/github-releases.js +1 -1
  210. package/dist/utils/global-cache.js +1 -1
  211. package/dist/utils/json-loader.js +1 -1
  212. package/dist/utils/local-cache.js +1 -1
  213. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  214. package/dist/utils/logger/formatters/index.js +1 -1
  215. package/dist/utils/logger/handlers/console-handler.js +1 -1
  216. package/dist/utils/logger/handlers/file-handler.js +1 -1
  217. package/dist/utils/logger/handlers/index.js +1 -1
  218. package/dist/utils/logger/handlers/null-handler.js +1 -1
  219. package/dist/utils/logger/index.js +1 -1
  220. package/dist/utils/logger/logger.js +1 -1
  221. package/dist/utils/logger/types.js +1 -1
  222. package/dist/utils/option-validation.js +1 -1
  223. package/dist/utils/process.js +1 -1
  224. package/dist/utils/prompt.js +1 -1
  225. package/dist/utils/spinner.js +1 -1
  226. package/dist/utils/sse-parser.js +1 -1
  227. package/dist/utils/string-utils.js +1 -1
  228. package/dist/utils/table-ref-parser.js +1 -1
  229. package/dist/utils/tdx-logger.js +1 -1
  230. package/dist/utils/version-check.js +1 -1
  231. package/package.json +1 -1
@@ -1 +1 @@
1
- const a57_0x1e888e=a57_0x3832;(function(_0x85358a,_0x323de5){const _0x23d017=a57_0x3832,_0x480bd7=_0x85358a();while(!![]){try{const _0x529565=parseInt(_0x23d017(0x1e7))/0x1*(parseInt(_0x23d017(0x211))/0x2)+-parseInt(_0x23d017(0x20d))/0x3+-parseInt(_0x23d017(0x1f7))/0x4+parseInt(_0x23d017(0x1f4))/0x5*(parseInt(_0x23d017(0x200))/0x6)+parseInt(_0x23d017(0x208))/0x7+-parseInt(_0x23d017(0x1e6))/0x8*(-parseInt(_0x23d017(0x214))/0x9)+-parseInt(_0x23d017(0x1df))/0xa;if(_0x529565===_0x323de5)break;else _0x480bd7['push'](_0x480bd7['shift']());}catch(_0x1999f8){_0x480bd7['push'](_0x480bd7['shift']());}}}(a57_0x17be,0x53215));function a57_0x3832(_0x332fa7,_0x5bb641){_0x332fa7=_0x332fa7-0x1db;const _0x17bed4=a57_0x17be();let _0x383248=_0x17bed4[_0x332fa7];return _0x383248;}import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x180dc1 from'node:fs';import*as a57_0x66f808 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a57_0x5c5e3d from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x1a409f=a57_0x3832;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x1a409f(0x226),'tdx');}export function getConfigFile(){const _0x3c785f=a57_0x3832;return join(getConfigDir(),_0x3c785f(0x220));}export function getConfigFilePath(_0x10133b){const _0x3e6a66=a57_0x3832,_0x1c30fb=getConfigDir();return _0x10133b?a57_0x66f808[_0x3e6a66(0x21c)](_0x1c30fb,_0x3e6a66(0x210)+_0x10133b):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project',a57_0x1e888e(0x1e3));export function getLLMProjectCacheFile(_0xd996cc){return llmProjectCache['path'](_0xd996cc);}export function readCachedLLMProject(_0x113729){const _0x3bfaf3=a57_0x1e888e,_0x3d630d=llmProjectCache[_0x3bfaf3(0x1e5)](_0x113729);if(_0x3d630d&&typeof _0x3d630d['id']===_0x3bfaf3(0x225)&&typeof _0x3d630d[_0x3bfaf3(0x22b)]===_0x3bfaf3(0x225))return _0x3d630d;return null;}export function writeCachedLLMProject(_0x42884c,_0x555129,_0x46e561){const _0x5e9df4=a57_0x1e888e;try{llmProjectCache[_0x5e9df4(0x1e0)]({'name':_0x42884c,'id':_0x555129},_0x46e561);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x1e888e(0x1de),a57_0x1e888e(0x21b));export function getLLMAgentCacheFile(_0x4d8643){const _0x488b99=a57_0x1e888e;return llmAgentCache[_0x488b99(0x1f1)](_0x4d8643);}export function readCachedLLMAgent(_0x56d367){const _0x15c293=a57_0x1e888e,_0x1872aa=llmAgentCache['read'](_0x56d367);if(_0x1872aa&&typeof _0x1872aa['id']===_0x15c293(0x225)&&typeof _0x1872aa[_0x15c293(0x22b)]===_0x15c293(0x225)&&typeof _0x1872aa[_0x15c293(0x1ee)]==='string')return _0x1872aa;return null;}export function writeCachedLLMAgent(_0x10e4f6,_0x2f9c8b,_0x433f85,_0x4b9925){const _0x585659=a57_0x1e888e;try{llmAgentCache[_0x585659(0x1e0)]({'name':_0x10e4f6,'id':_0x2f9c8b,'projectId':_0x433f85},_0x4b9925);}catch{}}export function clearCachedLLMAgent(_0x14d8a7){try{llmAgentCache['clear'](_0x14d8a7);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x1e888e(0x20c),a57_0x1e888e(0x1f3),{'suffix':a57_0x1e888e(0x20e)});export function getAccountInfoCacheFile(_0x13eff3){const _0x4780b5=a57_0x1e888e;return accountInfoCache[_0x4780b5(0x1f1)](_0x13eff3);}export function readCachedAccountInfo(_0x337b8d){const _0x20c529=a57_0x1e888e,_0x427ddf=accountInfoCache[_0x20c529(0x1e5)](_0x337b8d);if(_0x427ddf&&typeof _0x427ddf[_0x20c529(0x22a)]==='string'&&typeof _0x427ddf[_0x20c529(0x206)]===_0x20c529(0x1fe))return _0x427ddf;return null;}export function writeCachedAccountInfo(_0x221801,_0x161ee7,_0x15b137){const _0x5f321e=a57_0x1e888e;try{accountInfoCache['write']({'site':_0x221801,'accountId':_0x161ee7,'cachedAt':new Date()[_0x5f321e(0x218)]()},_0x15b137);}catch{}}export function parseEnvFile(_0x3b435b){const _0x58b33d=a57_0x1e888e,_0x45146b={};for(const _0x503f1e of _0x3b435b[_0x58b33d(0x204)]('\x0a')){const _0x5e7a74=_0x503f1e[_0x58b33d(0x1f9)]();if(!_0x5e7a74||_0x5e7a74[_0x58b33d(0x1db)]('#'))continue;const _0x3a5951=_0x5e7a74[_0x58b33d(0x1dc)](/^([^=]+)=(.*)$/);if(_0x3a5951){const _0x6bd1bb=_0x3a5951[0x1][_0x58b33d(0x1f9)]();let _0x4e27f1=_0x3a5951[0x2]['trim']();(_0x4e27f1[_0x58b33d(0x1db)]('\x22')&&_0x4e27f1['endsWith']('\x22')||_0x4e27f1['startsWith']('\x27')&&_0x4e27f1[_0x58b33d(0x205)]('\x27'))&&(_0x4e27f1=_0x4e27f1[_0x58b33d(0x20f)](0x1,-0x1)),_0x45146b[_0x6bd1bb]=_0x4e27f1;}}return _0x45146b;}function a57_0x17be(){const _0x2d59e1=['split','endsWith','accountId','existsSync','3970862biTPKx','apiKey','dev-us01','warn','account_info','34002rnbpgS','.json','slice','.env.','4FTgXkP','some','proxy','7641yfWXIw','source','TDX_API_KEY\x20env\x20var','Warning:\x20Failed\x20to\x20read\x20','toISOString','stringify','us01','config/llm-agent','join','stg-ap03','replace','dev-eu01','.env','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','TD_API_KEY_','TDX_ACCESS_TOKEN_','eu01','string','.config','TDX_API_KEY_','utf-8','entries','site','name','apiKeys','startsWith','match','keychain\x20(profile:\x20','llm_default_agent','12396330tLnhfH','write','includes','parse','config/llm-project','Warning:\x20Unknown\x20site\x20\x27','read','48SQRAaa','285977TOmpRX','ap02','stg-ap01','TDX_ACCESS_TOKEN\x20env\x20var','ap01','readFileSync','profile','projectId','next','stg-us01','path','accessToken','config/account-info','3255885lqyrLb','ap03','stable','816092RLomgQ','release_channel','trim','TD_API_KEY','tdx.json','toUpperCase','\x27,\x20defaulting\x20to\x20us01','number','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','6xVTIMf','yellow','keychain','\x20env\x20var'];a57_0x17be=function(){return _0x2d59e1;};return a57_0x17be();}export function readUserConfig(){const _0x159d8a=a57_0x1e888e,_0x2f4863=getConfigFile();if(!existsSync(_0x2f4863))return{};try{const _0x4de56d=readFileSync(_0x2f4863,_0x159d8a(0x228));return parseEnvFile(_0x4de56d);}catch(_0x12ce74){return console[_0x159d8a(0x20b)](_0x159d8a(0x221)+_0x2f4863+':',_0x12ce74),{};}}export function resolveSite(_0x2a503c){const _0x342cd5=a57_0x1e888e,_0x34cb25=[_0x342cd5(0x21a),'ap01',_0x342cd5(0x224),_0x342cd5(0x1e8),_0x342cd5(0x1f5),_0x342cd5(0x20a),_0x342cd5(0x21f),_0x342cd5(0x1f0),_0x342cd5(0x1e9),_0x342cd5(0x21d)];if(_0x34cb25[_0x342cd5(0x1e1)](_0x2a503c))return _0x2a503c;if(_0x2a503c in SITE_ALIASES)return SITE_ALIASES[_0x2a503c];return console[_0x342cd5(0x20b)](_0x342cd5(0x1e4)+_0x2a503c+_0x342cd5(0x1fd)),_0x342cd5(0x21a);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0xfa30f3){const _0xf3a105=a57_0x1e888e,_0x4dc2fc=_0xfa30f3||getActiveProfileName()||undefined;if(_0x4dc2fc){const _0x3d0304=_0xf3a105(0x223)+normalizeProfileForEnvVar(_0x4dc2fc);if(process.env[_0x3d0304])return{'accessToken':process.env[_0x3d0304],'source':_0x3d0304+_0xf3a105(0x203)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0xf3a105(0x1ea)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x55a78b=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x55a78b)return{'accessToken':_0x55a78b,'source':'TDX_ACCESS_TOKEN_FILE'};}return null;}function readAccessTokenFile(_0x2fca0c){const _0x138746=a57_0x1e888e;try{const _0x1b5345=readFileSync(_0x2fca0c,_0x138746(0x228))['trim']();return _0x1b5345||null;}catch{return null;}}export function getAccessToken(_0x3f206d){const _0xc78e0e=a57_0x1e888e;return resolveAccessToken(_0x3f206d)?.[_0xc78e0e(0x1f2)];}export function getAPIKey(_0x214b7b){const _0x58c682=_0x214b7b||getActiveProfileName();if(_0x58c682){const _0x44eb72='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x58c682);if(process.env[_0x44eb72])return process.env[_0x44eb72];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x572bae){const _0x98d336=a57_0x1e888e;return _0x572bae[_0x98d336(0x1fc)]()[_0x98d336(0x21e)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x4df2e5,_0x47e20f){const _0x52f19a=a57_0x1e888e,_0x413abd=resolveAccessToken(_0x47e20f);if(_0x413abd)return{'apiKey':_0x413abd[_0x52f19a(0x1f2)],'source':_0x413abd[_0x52f19a(0x215)],'isDeprecated':![]};const _0x4de36f=_0x47e20f||getActiveProfileName()||undefined;if(_0x4de36f){const _0x30dcc4=_0x52f19a(0x227)+normalizeProfileForEnvVar(_0x4de36f);if(process.env[_0x30dcc4])return{'apiKey':process.env[_0x30dcc4],'source':_0x30dcc4+_0x52f19a(0x203),'isDeprecated':![]};const _0x12cbc4=getCachedCredential(_0x4df2e5,_0x4de36f);if(_0x12cbc4)return{'apiKey':_0x12cbc4,'source':_0x52f19a(0x1dd)+_0x4de36f+')','isDeprecated':![]};const _0xf9a5a1=await getKeychainAPIKey(_0x4de36f);if(_0xf9a5a1)return setCachedCredential(_0xf9a5a1,_0x4df2e5,_0x4de36f),{'apiKey':_0xf9a5a1,'source':_0x52f19a(0x1dd)+_0x4de36f+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x52f19a(0x216),'isDeprecated':![]};if(!_0x4de36f){const _0x209ab9=getCachedCredential(_0x4df2e5,undefined);if(_0x209ab9)return{'apiKey':_0x209ab9,'source':_0x52f19a(0x202),'isDeprecated':![]};const _0xcbe581=await getKeychainAPIKey(undefined);if(_0xcbe581)return setCachedCredential(_0xcbe581,_0x4df2e5,undefined),{'apiKey':_0xcbe581,'source':_0x52f19a(0x202),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x39e7fe,_0x2a4204){const _0x319c2d=a57_0x1e888e,_0x38f809=await resolveAPIKeyAsync(_0x39e7fe,_0x2a4204);return _0x38f809?.[_0x319c2d(0x209)];}function cleanupLegacyEnvFile(_0x54e03c){const _0x484673=a57_0x1e888e;if(!existsSync(_0x54e03c))return![];try{const _0x1d7f03=readFileSync(_0x54e03c,_0x484673(0x228)),_0x1ecac7=_0x1d7f03[_0x484673(0x204)]('\x0a'),_0x3f95d0=_0x1ecac7['filter'](_0x29882d=>{const _0xf71774=_0x484673,_0x46755c=_0x29882d[_0xf71774(0x1f9)]();if(!_0x46755c||_0x46755c[_0xf71774(0x1db)]('#'))return!![];const [_0x4bf2f5]=_0x46755c[_0xf71774(0x204)]('=');return!_0x4bf2f5[_0xf71774(0x1db)](_0xf71774(0x1fa));}),_0x4782e2=_0x3f95d0[_0x484673(0x212)](_0x5599a8=>{const _0xda816b=_0x484673,_0x4c04d4=_0x5599a8[_0xda816b(0x1f9)]();return _0x4c04d4&&!_0x4c04d4[_0xda816b(0x1db)]('#');});if(!_0x4782e2)return unlinkSync(_0x54e03c),!![];return writeFileSync(_0x54e03c,_0x3f95d0[_0x484673(0x21c)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x569b69=a57_0x1e888e;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0xd7380f=a57_0x66f808['join'](getConfigDir(),_0x569b69(0x1fb));if(!a57_0x180dc1[_0x569b69(0x207)](_0xd7380f))return null;try{const _0x356dda=a57_0x180dc1['readFileSync'](_0xd7380f,'utf-8'),_0x8baebd=JSON[_0x569b69(0x1e2)](_0x356dda);return _0x8baebd[_0x569b69(0x1ed)]||null;}catch{return null;}}export function saveAPIKey(_0x4cf83d,_0x33eb74,_0x37f8b0){const _0x1f6b37=a57_0x1e888e,_0x70ee1=getConfigDir(),_0x2a5f13=getConfigFilePath(_0x37f8b0);!existsSync(_0x70ee1)&&mkdirSync(_0x70ee1,{'recursive':!![],'mode':0x1c0});let _0x3d7511={};if(existsSync(_0x2a5f13))try{const _0x4b69d7=readFileSync(_0x2a5f13,_0x1f6b37(0x228));_0x3d7511=parseEnvFile(_0x4b69d7);}catch(_0x489abe){console[_0x1f6b37(0x20b)](_0x1f6b37(0x217)+_0x2a5f13+':',_0x489abe);}const _0xb1f9a2=_0x4cf83d[_0x1f6b37(0x1fc)]()[_0x1f6b37(0x21e)](/-/g,'_');_0x3d7511[_0x1f6b37(0x222)+_0xb1f9a2]=_0x33eb74;const _0x38644a=Object[_0x1f6b37(0x229)](_0x3d7511)['map'](([_0x57f1b4,_0x570ef2])=>_0x57f1b4+'='+_0x570ef2);writeFileSync(_0x2a5f13,_0x38644a[_0x1f6b37(0x21c)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x16e723,_0x13caa5,_0xa126d0){const _0x442d58=a57_0x1e888e;await saveKeychainAPIKey(_0x16e723,_0xa126d0),setCachedCredential(_0x16e723,_0x13caa5,_0xa126d0);const _0x236da4=getConfigFilePath(_0xa126d0);cleanupLegacyEnvFile(_0x236da4)&&console[_0x442d58(0x20b)](a57_0x5c5e3d[_0x442d58(0x201)](_0x442d58(0x1ff)));}export function loadConfig(){const _0x4aaafb=a57_0x1e888e,_0x13eb52={'apiKeys':{},'defaultSite':'us01'},_0x5571b7=[_0x4aaafb(0x21a),_0x4aaafb(0x1eb),_0x4aaafb(0x224),_0x4aaafb(0x1e8),'ap03',_0x4aaafb(0x20a),'dev-eu01',_0x4aaafb(0x1f0),_0x4aaafb(0x1e9),_0x4aaafb(0x21d)],_0x41b2a4=getAPIKey();if(_0x41b2a4)for(const _0x1a89d6 of _0x5571b7){_0x13eb52[_0x4aaafb(0x22c)][_0x1a89d6]=_0x41b2a4;}return _0x13eb52;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x1042aa=a57_0x1e888e,_0x1813c5=a57_0x66f808[_0x1042aa(0x21c)](getConfigDir(),_0x1042aa(0x1fb));if(!a57_0x180dc1['existsSync'](_0x1813c5))return undefined;try{const _0x21be81=a57_0x180dc1[_0x1042aa(0x1ec)](_0x1813c5,_0x1042aa(0x228)),_0x1f9dd9=JSON[_0x1042aa(0x1e2)](_0x21be81);return typeof _0x1f9dd9[_0x1042aa(0x213)]==='string'?_0x1f9dd9[_0x1042aa(0x213)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x366d6c=a57_0x1e888e,_0x5d8bc5=process.env.TDX_RELEASE_CHANNEL;if(_0x5d8bc5===_0x366d6c(0x1ef)||_0x5d8bc5===_0x366d6c(0x1f6))return _0x5d8bc5;const _0x1466bf=a57_0x66f808[_0x366d6c(0x21c)](getConfigDir(),_0x366d6c(0x1fb));if(!a57_0x180dc1[_0x366d6c(0x207)](_0x1466bf))return _0x366d6c(0x1f6);try{const _0x1b86b7=a57_0x180dc1['readFileSync'](_0x1466bf,_0x366d6c(0x228)),_0x4498e9=JSON['parse'](_0x1b86b7);if(_0x4498e9['release_channel']==='next')return _0x366d6c(0x1ef);}catch{}return _0x366d6c(0x1f6);}export function saveReleaseChannel(_0x2fceec){const _0x2f4eb1=a57_0x1e888e,_0x4e9ff7=getConfigDir(),_0x3d67bd=a57_0x66f808[_0x2f4eb1(0x21c)](_0x4e9ff7,'tdx.json');!existsSync(_0x4e9ff7)&&mkdirSync(_0x4e9ff7,{'recursive':!![],'mode':0x1c0});let _0x5a2fe9={};if(existsSync(_0x3d67bd))try{const _0x23855a=readFileSync(_0x3d67bd,_0x2f4eb1(0x228));_0x5a2fe9=JSON[_0x2f4eb1(0x1e2)](_0x23855a);}catch{}_0x5a2fe9[_0x2f4eb1(0x1f8)]=_0x2fceec,writeFileSync(_0x3d67bd,JSON[_0x2f4eb1(0x219)](_0x5a2fe9,null,0x2),{'mode':0x180});}
1
+ const a57_0xf72b3b=a57_0x2b50;(function(_0x1ddbc8,_0x10dd19){const _0x51ac38=a57_0x2b50,_0x3a3f9a=_0x1ddbc8();while(!![]){try{const _0x440a5f=-parseInt(_0x51ac38(0x1fa))/0x1+parseInt(_0x51ac38(0x20e))/0x2*(-parseInt(_0x51ac38(0x22e))/0x3)+parseInt(_0x51ac38(0x204))/0x4+-parseInt(_0x51ac38(0x22d))/0x5+parseInt(_0x51ac38(0x21d))/0x6+parseInt(_0x51ac38(0x1fb))/0x7*(parseInt(_0x51ac38(0x222))/0x8)+-parseInt(_0x51ac38(0x216))/0x9;if(_0x440a5f===_0x10dd19)break;else _0x3a3f9a['push'](_0x3a3f9a['shift']());}catch(_0x524fd6){_0x3a3f9a['push'](_0x3a3f9a['shift']());}}}(a57_0x2b02,0x979ba));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x596949 from'node:fs';import*as a57_0x56e807 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a57_0x12daae from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x15d1ed=a57_0x2b50;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x15d1ed(0x1f8),'tdx');}export function getConfigFile(){const _0x4bb4ac=a57_0x2b50;return join(getConfigDir(),_0x4bb4ac(0x1f7));}export function getConfigFilePath(_0x13c581){const _0x2ce7f1=a57_0x2b50,_0x764598=getConfigDir();return _0x13c581?a57_0x56e807[_0x2ce7f1(0x223)](_0x764598,'.env.'+_0x13c581):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0xf72b3b(0x214),a57_0xf72b3b(0x1ff));export function getLLMProjectCacheFile(_0x2f078b){const _0x28b84e=a57_0xf72b3b;return llmProjectCache[_0x28b84e(0x20d)](_0x2f078b);}export function readCachedLLMProject(_0x4b913a){const _0x21db5b=a57_0xf72b3b,_0x2988de=llmProjectCache[_0x21db5b(0x218)](_0x4b913a);if(_0x2988de&&typeof _0x2988de['id']==='string'&&typeof _0x2988de[_0x21db5b(0x237)]===_0x21db5b(0x232))return _0x2988de;return null;}export function writeCachedLLMProject(_0x33a590,_0x484348,_0x4c5bc8){const _0x5b909c=a57_0xf72b3b;try{llmProjectCache[_0x5b909c(0x221)]({'name':_0x33a590,'id':_0x484348},_0x4c5bc8);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0xf72b3b(0x20b),a57_0xf72b3b(0x23c));export function getLLMAgentCacheFile(_0x11930f){const _0x3d5009=a57_0xf72b3b;return llmAgentCache[_0x3d5009(0x20d)](_0x11930f);}export function readCachedLLMAgent(_0x3368dc){const _0x5baddc=a57_0xf72b3b,_0x3b04ee=llmAgentCache[_0x5baddc(0x218)](_0x3368dc);if(_0x3b04ee&&typeof _0x3b04ee['id']===_0x5baddc(0x232)&&typeof _0x3b04ee[_0x5baddc(0x237)]===_0x5baddc(0x232)&&typeof _0x3b04ee[_0x5baddc(0x1f6)]==='string')return _0x3b04ee;return null;}export function writeCachedLLMAgent(_0x27b147,_0x16f88e,_0x339d45,_0x1a266a){try{llmAgentCache['write']({'name':_0x27b147,'id':_0x16f88e,'projectId':_0x339d45},_0x1a266a);}catch{}}export function clearCachedLLMAgent(_0x189f8e){try{llmAgentCache['clear'](_0x189f8e);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a57_0xf72b3b(0x233),{'suffix':a57_0xf72b3b(0x234)});function a57_0x2b50(_0x31bffc,_0x591d8e){_0x31bffc=_0x31bffc-0x1f4;const _0x2b02bb=a57_0x2b02();let _0x2b5071=_0x2b02bb[_0x31bffc];return _0x2b5071;}export function getAccountInfoCacheFile(_0x32ce9d){const _0x3da507=a57_0xf72b3b;return accountInfoCache[_0x3da507(0x20d)](_0x32ce9d);}export function readCachedAccountInfo(_0x553103){const _0x4dde25=a57_0xf72b3b,_0x5d6606=accountInfoCache[_0x4dde25(0x218)](_0x553103);if(_0x5d6606&&typeof _0x5d6606[_0x4dde25(0x210)]===_0x4dde25(0x232)&&typeof _0x5d6606[_0x4dde25(0x20a)]===_0x4dde25(0x206))return _0x5d6606;return null;}export function writeCachedAccountInfo(_0x4e128e,_0x4baf74,_0x56ada0){try{accountInfoCache['write']({'site':_0x4e128e,'accountId':_0x4baf74,'cachedAt':new Date()['toISOString']()},_0x56ada0);}catch{}}export function parseEnvFile(_0x13aba8){const _0x2e7f95=a57_0xf72b3b,_0x2156f1={};for(const _0x1ada17 of _0x13aba8[_0x2e7f95(0x236)]('\x0a')){const _0x4db3c5=_0x1ada17[_0x2e7f95(0x22c)]();if(!_0x4db3c5||_0x4db3c5[_0x2e7f95(0x21b)]('#'))continue;const _0x182e7c=_0x4db3c5[_0x2e7f95(0x20c)](/^([^=]+)=(.*)$/);if(_0x182e7c){const _0x44dd1f=_0x182e7c[0x1]['trim']();let _0x35652a=_0x182e7c[0x2]['trim']();(_0x35652a[_0x2e7f95(0x21b)]('\x22')&&_0x35652a[_0x2e7f95(0x239)]('\x22')||_0x35652a['startsWith']('\x27')&&_0x35652a['endsWith']('\x27'))&&(_0x35652a=_0x35652a[_0x2e7f95(0x229)](0x1,-0x1)),_0x2156f1[_0x44dd1f]=_0x35652a;}}return _0x2156f1;}export function readUserConfig(){const _0x49ccb0=a57_0xf72b3b,_0x34c634=getConfigFile();if(!existsSync(_0x34c634))return{};try{const _0x19cfc8=readFileSync(_0x34c634,_0x49ccb0(0x21a));return parseEnvFile(_0x19cfc8);}catch(_0xce0f42){return console['warn'](_0x49ccb0(0x1f9)+_0x34c634+':',_0xce0f42),{};}}export function resolveSite(_0x290ba8){const _0xc9e91=a57_0xf72b3b,_0x1ba309=[_0xc9e91(0x205),_0xc9e91(0x1f4),_0xc9e91(0x1fe),'ap02',_0xc9e91(0x203),_0xc9e91(0x212),_0xc9e91(0x21f),'stg-us01','stg-ap01',_0xc9e91(0x22f)];if(_0x1ba309[_0xc9e91(0x225)](_0x290ba8))return _0x290ba8;if(_0x290ba8 in SITE_ALIASES)return SITE_ALIASES[_0x290ba8];return console[_0xc9e91(0x224)]('Warning:\x20Unknown\x20site\x20\x27'+_0x290ba8+_0xc9e91(0x208)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}function a57_0x2b02(){const _0x14ea26=['warn','includes','TDX_API_KEY\x20env\x20var','next','TDX_ACCESS_TOKEN\x20env\x20var','slice','release_channel','toUpperCase','trim','1385765vTCgyc','157959vrfbNc','stg-ap03','entries','\x20env\x20var','string','config/account-info','.json','tdx.json','split','name','ap02','endsWith','replace','TD_API_KEY_','config/llm-agent','apiKeys','proxy','stg-us01','yellow','ap01','parse','projectId','.env','.config','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','258209nNfXqk','1057NGAQyl','source','TDX_API_KEY_','eu01','config/llm-project','existsSync','stringify','apiKey','ap03','1267048XqEXfs','us01','number','readFileSync','\x27,\x20defaulting\x20to\x20us01','profile','accountId','llm_default_agent','match','path','14UaVZTM','map','site','some','dev-us01','accessToken','llm_default_project','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','9957510MwCZGs','stable','read','keychain\x20(profile:\x20','utf-8','startsWith','TDX_ACCESS_TOKEN_','6515160CxlbqH','stg-ap01','dev-eu01','TDX_ACCESS_TOKEN_FILE','write','65096EMnmHZ','join'];a57_0x2b02=function(){return _0x14ea26;};return a57_0x2b02();}export function resolveAccessToken(_0x371937){const _0x23caf9=a57_0xf72b3b,_0x20ced5=_0x371937||getActiveProfileName()||undefined;if(_0x20ced5){const _0x42deb7=_0x23caf9(0x21c)+normalizeProfileForEnvVar(_0x20ced5);if(process.env[_0x42deb7])return{'accessToken':process.env[_0x42deb7],'source':_0x42deb7+'\x20env\x20var'};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x23caf9(0x228)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x1bf34b=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x1bf34b)return{'accessToken':_0x1bf34b,'source':_0x23caf9(0x220)};}return null;}function readAccessTokenFile(_0x42ae5d){const _0x200313=a57_0xf72b3b;try{const _0x29ca9a=readFileSync(_0x42ae5d,_0x200313(0x21a))[_0x200313(0x22c)]();return _0x29ca9a||null;}catch{return null;}}export function getAccessToken(_0x47a047){const _0x41fb35=a57_0xf72b3b;return resolveAccessToken(_0x47a047)?.[_0x41fb35(0x213)];}export function getAPIKey(_0x1f1570){const _0x2ef9b7=a57_0xf72b3b,_0x5cb56f=_0x1f1570||getActiveProfileName();if(_0x5cb56f){const _0x59e3f2=_0x2ef9b7(0x1fd)+normalizeProfileForEnvVar(_0x5cb56f);if(process.env[_0x59e3f2])return process.env[_0x59e3f2];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x12ff2a){const _0x4650cc=a57_0xf72b3b;return _0x12ff2a[_0x4650cc(0x22b)]()[_0x4650cc(0x23a)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x573910,_0x50d9ca){const _0x31de06=a57_0xf72b3b,_0xef376c=resolveAccessToken(_0x50d9ca);if(_0xef376c)return{'apiKey':_0xef376c[_0x31de06(0x213)],'source':_0xef376c[_0x31de06(0x1fc)],'isDeprecated':![]};const _0x3af411=_0x50d9ca||getActiveProfileName()||undefined;if(_0x3af411){const _0x1cf511=_0x31de06(0x1fd)+normalizeProfileForEnvVar(_0x3af411);if(process.env[_0x1cf511])return{'apiKey':process.env[_0x1cf511],'source':_0x1cf511+_0x31de06(0x231),'isDeprecated':![]};const _0x23f9c4=getCachedCredential(_0x573910,_0x3af411);if(_0x23f9c4)return{'apiKey':_0x23f9c4,'source':_0x31de06(0x219)+_0x3af411+')','isDeprecated':![]};const _0x50f3d7=await getKeychainAPIKey(_0x3af411);if(_0x50f3d7)return setCachedCredential(_0x50f3d7,_0x573910,_0x3af411),{'apiKey':_0x50f3d7,'source':_0x31de06(0x219)+_0x3af411+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x31de06(0x226),'isDeprecated':![]};if(!_0x3af411){const _0x520136=getCachedCredential(_0x573910,undefined);if(_0x520136)return{'apiKey':_0x520136,'source':'keychain','isDeprecated':![]};const _0x28e8a0=await getKeychainAPIKey(undefined);if(_0x28e8a0)return setCachedCredential(_0x28e8a0,_0x573910,undefined),{'apiKey':_0x28e8a0,'source':'keychain','isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x3873e8,_0x413463){const _0x208df1=a57_0xf72b3b,_0xcf23e0=await resolveAPIKeyAsync(_0x3873e8,_0x413463);return _0xcf23e0?.[_0x208df1(0x202)];}function cleanupLegacyEnvFile(_0x42f332){const _0x497cc1=a57_0xf72b3b;if(!existsSync(_0x42f332))return![];try{const _0x2b7314=readFileSync(_0x42f332,'utf-8'),_0x4eb792=_0x2b7314[_0x497cc1(0x236)]('\x0a'),_0x550594=_0x4eb792['filter'](_0x5f25dd=>{const _0x138fb8=_0x497cc1,_0x11c08d=_0x5f25dd['trim']();if(!_0x11c08d||_0x11c08d[_0x138fb8(0x21b)]('#'))return!![];const [_0x236cbe]=_0x11c08d['split']('=');return!_0x236cbe[_0x138fb8(0x21b)]('TD_API_KEY');}),_0x5e7e31=_0x550594[_0x497cc1(0x211)](_0x46e6b5=>{const _0x35209a=_0x497cc1,_0x1153de=_0x46e6b5[_0x35209a(0x22c)]();return _0x1153de&&!_0x1153de[_0x35209a(0x21b)]('#');});if(!_0x5e7e31)return unlinkSync(_0x42f332),!![];return writeFileSync(_0x42f332,_0x550594[_0x497cc1(0x223)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x5d91cd=a57_0xf72b3b;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x24d405=a57_0x56e807[_0x5d91cd(0x223)](getConfigDir(),'tdx.json');if(!a57_0x596949[_0x5d91cd(0x200)](_0x24d405))return null;try{const _0x4d127c=a57_0x596949[_0x5d91cd(0x207)](_0x24d405,_0x5d91cd(0x21a)),_0x17bcfc=JSON[_0x5d91cd(0x1f5)](_0x4d127c);return _0x17bcfc[_0x5d91cd(0x209)]||null;}catch{return null;}}export function saveAPIKey(_0x508108,_0x4321d9,_0x2c4206){const _0x21852f=a57_0xf72b3b,_0x5994e1=getConfigDir(),_0x5ddac5=getConfigFilePath(_0x2c4206);!existsSync(_0x5994e1)&&mkdirSync(_0x5994e1,{'recursive':!![],'mode':0x1c0});let _0x19d22e={};if(existsSync(_0x5ddac5))try{const _0x31b566=readFileSync(_0x5ddac5,_0x21852f(0x21a));_0x19d22e=parseEnvFile(_0x31b566);}catch(_0x596457){console[_0x21852f(0x224)]('Warning:\x20Failed\x20to\x20read\x20'+_0x5ddac5+':',_0x596457);}const _0x45a9fa=_0x508108[_0x21852f(0x22b)]()['replace'](/-/g,'_');_0x19d22e[_0x21852f(0x23b)+_0x45a9fa]=_0x4321d9;const _0x5476ed=Object[_0x21852f(0x230)](_0x19d22e)[_0x21852f(0x20f)](([_0x12596a,_0x124738])=>_0x12596a+'='+_0x124738);writeFileSync(_0x5ddac5,_0x5476ed[_0x21852f(0x223)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x56a156,_0x25c1a1,_0x5ecaeb){const _0x381764=a57_0xf72b3b;await saveKeychainAPIKey(_0x56a156,_0x5ecaeb),setCachedCredential(_0x56a156,_0x25c1a1,_0x5ecaeb);const _0x291323=getConfigFilePath(_0x5ecaeb);cleanupLegacyEnvFile(_0x291323)&&console['warn'](a57_0x12daae[_0x381764(0x240)](_0x381764(0x215)));}export function loadConfig(){const _0xae4bec=a57_0xf72b3b,_0x221fad={'apiKeys':{},'defaultSite':_0xae4bec(0x205)},_0xc683e=[_0xae4bec(0x205),'ap01',_0xae4bec(0x1fe),_0xae4bec(0x238),_0xae4bec(0x203),_0xae4bec(0x212),_0xae4bec(0x21f),_0xae4bec(0x23f),_0xae4bec(0x21e),_0xae4bec(0x22f)],_0x26573a=getAPIKey();if(_0x26573a)for(const _0x4bb8db of _0xc683e){_0x221fad[_0xae4bec(0x23d)][_0x4bb8db]=_0x26573a;}return _0x221fad;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x52ae69=a57_0xf72b3b,_0x5a2b22=a57_0x56e807['join'](getConfigDir(),_0x52ae69(0x235));if(!a57_0x596949[_0x52ae69(0x200)](_0x5a2b22))return undefined;try{const _0x770b03=a57_0x596949['readFileSync'](_0x5a2b22,_0x52ae69(0x21a)),_0x12fb85=JSON['parse'](_0x770b03);return typeof _0x12fb85[_0x52ae69(0x23e)]===_0x52ae69(0x232)?_0x12fb85['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x2d1c86=a57_0xf72b3b,_0x3a253e=process.env.TDX_RELEASE_CHANNEL;if(_0x3a253e===_0x2d1c86(0x227)||_0x3a253e===_0x2d1c86(0x217))return _0x3a253e;const _0x282510=a57_0x56e807[_0x2d1c86(0x223)](getConfigDir(),_0x2d1c86(0x235));if(!a57_0x596949[_0x2d1c86(0x200)](_0x282510))return'stable';try{const _0x4da2e7=a57_0x596949[_0x2d1c86(0x207)](_0x282510,_0x2d1c86(0x21a)),_0x4cb2ba=JSON[_0x2d1c86(0x1f5)](_0x4da2e7);if(_0x4cb2ba[_0x2d1c86(0x22a)]===_0x2d1c86(0x227))return _0x2d1c86(0x227);}catch{}return _0x2d1c86(0x217);}export function saveReleaseChannel(_0x57fecf){const _0x567b38=a57_0xf72b3b,_0xe3ac57=getConfigDir(),_0x11fc41=a57_0x56e807[_0x567b38(0x223)](_0xe3ac57,_0x567b38(0x235));!existsSync(_0xe3ac57)&&mkdirSync(_0xe3ac57,{'recursive':!![],'mode':0x1c0});let _0x5cf7ed={};if(existsSync(_0x11fc41))try{const _0x4e6937=readFileSync(_0x11fc41,'utf-8');_0x5cf7ed=JSON['parse'](_0x4e6937);}catch{}_0x5cf7ed[_0x567b38(0x22a)]=_0x57fecf,writeFileSync(_0x11fc41,JSON[_0x567b38(0x201)](_0x5cf7ed,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- function a58_0x4662(_0x5e68ee,_0x300dc7){_0x5e68ee=_0x5e68ee-0x11f;const _0x2c5198=a58_0x2c51();let _0x466260=_0x2c5198[_0x5e68ee];return _0x466260;}const a58_0x4e3b7b=a58_0x4662;(function(_0x38d56a,_0x14c31f){const _0x3f9460=a58_0x4662,_0x114fb7=_0x38d56a();while(!![]){try{const _0x29db83=parseInt(_0x3f9460(0x122))/0x1*(-parseInt(_0x3f9460(0x11f))/0x2)+parseInt(_0x3f9460(0x128))/0x3+-parseInt(_0x3f9460(0x120))/0x4*(-parseInt(_0x3f9460(0x127))/0x5)+parseInt(_0x3f9460(0x12b))/0x6+parseInt(_0x3f9460(0x123))/0x7+-parseInt(_0x3f9460(0x129))/0x8+-parseInt(_0x3f9460(0x125))/0x9;if(_0x29db83===_0x14c31f)break;else _0x114fb7['push'](_0x114fb7['shift']());}catch(_0x345965){_0x114fb7['push'](_0x114fb7['shift']());}}}(a58_0x2c51,0x2146d));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x4e3b7b(0x121),a58_0x4e3b7b(0x124));export function loadCachedConnections(_0x2b17d4){const _0x4e6c25=connectionCache['read'](_0x2b17d4);return _0x4e6c25?.['connections']??null;}export function saveCachedConnections(_0x2857ef,_0x43271a){const _0x278130=a58_0x4e3b7b;connectionCache['write'](_0x2857ef,{'connections':_0x43271a,'cachedAt':Date[_0x278130(0x126)]()});}export function clearConnectionCache(_0x4b3c0a){const _0x1208e7=a58_0x4e3b7b;connectionCache[_0x1208e7(0x12a)](_0x4b3c0a);}function a58_0x2c51(){const _0x3e1d85=['17946aTJHKX','now','5YbsgSX','441624gwkCSu','1670648igsTZR','clear','1337358samGmZ','10gRNlxE','178588yujpWd','connections-{profile}.json','30967iRdJim','610491Qhloct','core/connection-cache'];a58_0x2c51=function(){return _0x3e1d85;};return a58_0x2c51();}
1
+ const a58_0x19499f=a58_0x4ff6;function a58_0x4ff6(_0x242229,_0x4008bc){_0x242229=_0x242229-0xdc;const _0x5c267b=a58_0x5c26();let _0x4ff673=_0x5c267b[_0x242229];return _0x4ff673;}(function(_0x237740,_0x223599){const _0x217ac0=a58_0x4ff6,_0x17636e=_0x237740();while(!![]){try{const _0x2c57d0=parseInt(_0x217ac0(0xdd))/0x1+parseInt(_0x217ac0(0xe5))/0x2*(-parseInt(_0x217ac0(0xe8))/0x3)+parseInt(_0x217ac0(0xdc))/0x4+-parseInt(_0x217ac0(0xdf))/0x5+parseInt(_0x217ac0(0xe4))/0x6*(parseInt(_0x217ac0(0xe6))/0x7)+-parseInt(_0x217ac0(0xe9))/0x8+parseInt(_0x217ac0(0xde))/0x9;if(_0x2c57d0===_0x223599)break;else _0x17636e['push'](_0x17636e['shift']());}catch(_0x312268){_0x17636e['push'](_0x17636e['shift']());}}}(a58_0x5c26,0xee0c4));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache('connections-{profile}.json',a58_0x19499f(0xe3));export function loadCachedConnections(_0x24bf47){const _0x462f34=a58_0x19499f,_0x217aa1=connectionCache[_0x462f34(0xe7)](_0x24bf47);return _0x217aa1?.['connections']??null;}export function saveCachedConnections(_0x2fdf5d,_0x30f1b0){const _0x1a4ce3=a58_0x19499f;connectionCache[_0x1a4ce3(0xe0)](_0x2fdf5d,{'connections':_0x30f1b0,'cachedAt':Date[_0x1a4ce3(0xe2)]()});}function a58_0x5c26(){const _0x134c4f=['11613035uMUZTx','read','1133727srheVX','275856fwtcge','1215856qJFFqp','940858nGwSHQ','14163318LHkvrF','7892290Whjyme','write','clear','now','core/connection-cache','6oMOWUn','10mlFbtC'];a58_0x5c26=function(){return _0x134c4f;};return a58_0x5c26();}export function clearConnectionCache(_0x21fb1e){const _0x5591ed=a58_0x19499f;connectionCache[_0x5591ed(0xe1)](_0x21fb1e);}
@@ -1 +1 @@
1
- function a59_0x190a(_0x579e37,_0x3cddc4){_0x579e37=_0x579e37-0x1d8;const _0x33d0f9=a59_0x33d0();let _0x190af3=_0x33d0f9[_0x579e37];return _0x190af3;}function a59_0x33d0(){const _0x411e20=['Cancelled','length','push','469513UBLuYk','ap02\x20-\x20Korea','site','us01','trim','value','12jdpGvZ','test','15921jErMEZ','ap01','740tmcpHK','customSite','10HfasZe','2LzxPuE','log','eu01','7JTlGsl','Select\x20your\x20Treasure\x20Data\x20site:','18586061CaLBRB','other','ap02','395727iYDHxk','2064jkJapn','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','3331332KAIiDY','findIndex','1996abrfgp','us\x20\x20\x20-\x20United\x20States','Enter\x20custom\x20site','1252725sWLiof','Site\x20name\x20cannot\x20be\x20empty','number','select'];a59_0x33d0=function(){return _0x411e20;};return a59_0x33d0();}const a59_0x395966=a59_0x190a;(function(_0x29cff3,_0x1ca05d){const _0x54aec9=a59_0x190a,_0xe3e76b=_0x29cff3();while(!![]){try{const _0x3ea4aa=-parseInt(_0x54aec9(0x1f8))/0x1*(-parseInt(_0x54aec9(0x1f0))/0x2)+parseInt(_0x54aec9(0x1dc))/0x3+parseInt(_0x54aec9(0x1d9))/0x4*(-parseInt(_0x54aec9(0x1ed))/0x5)+parseInt(_0x54aec9(0x1fb))/0x6*(parseInt(_0x54aec9(0x1f3))/0x7)+parseInt(_0x54aec9(0x1f9))/0x8*(parseInt(_0x54aec9(0x1eb))/0x9)+-parseInt(_0x54aec9(0x1ef))/0xa*(parseInt(_0x54aec9(0x1e3))/0xb)+parseInt(_0x54aec9(0x1e9))/0xc*(-parseInt(_0x54aec9(0x1f5))/0xd);if(_0x3ea4aa===_0x1ca05d)break;else _0xe3e76b['push'](_0xe3e76b['shift']());}catch(_0x49f857){_0xe3e76b['push'](_0xe3e76b['shift']());}}}(a59_0x33d0,0x440a6));import a59_0x20ccd2 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x5deef8,_0x5a13eb){const _0x1b5f34=a59_0x190a;if(_0x5deef8===undefined)return _0x5a13eb;if(typeof _0x5deef8===_0x1b5f34(0x1de))return _0x5deef8;return parseInt(_0x5deef8,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x395966(0x1da),'value':a59_0x395966(0x1e6)},{'title':'jp\x20\x20\x20-\x20Japan','value':a59_0x395966(0x1ec)},{'title':'eu\x20\x20\x20-\x20Europe','value':a59_0x395966(0x1f2)},{'title':a59_0x395966(0x1e4),'value':a59_0x395966(0x1f7)}];export function buildSiteChoices(_0xaaeb45){const _0x55b2db=a59_0x395966,_0x3a3d6b=[...STANDARD_SITE_CHOICES];let _0x39056a=_0x3a3d6b[_0x55b2db(0x1d8)](_0xa5434=>_0xa5434[_0x55b2db(0x1e8)]===_0xaaeb45);return _0x39056a===-0x1&&_0xaaeb45!==_0x55b2db(0x1e6)&&(_0x3a3d6b[_0x55b2db(0x1e2)]({'title':_0xaaeb45,'value':_0xaaeb45}),_0x39056a=_0x3a3d6b[_0x55b2db(0x1e1)]-0x1),_0x3a3d6b[_0x55b2db(0x1e2)]({'title':_0x55b2db(0x1db),'value':'other'}),{'choices':_0x3a3d6b,'initialIndex':_0x39056a>=0x0?_0x39056a:0x0};}export async function promptSiteSelection(_0x3f720f,_0x3c8257,_0x3d2350=a59_0x395966(0x1e0)){const _0xdc939d=a59_0x395966,{choices:_0x6959bb,initialIndex:_0x3b590a}=buildSiteChoices(_0x3f720f),_0x2f7e00=_0x3c8257?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x3c8257+'):':_0xdc939d(0x1f4),_0x2db29e=await a59_0x20ccd2({'type':_0xdc939d(0x1df),'name':_0xdc939d(0x1e5),'message':_0x2f7e00,'choices':_0x6959bb,'initial':_0x3b590a});if(!_0x2db29e[_0xdc939d(0x1e5)])return console[_0xdc939d(0x1f1)]('\x0a'+_0x3d2350),null;if(_0x2db29e[_0xdc939d(0x1e5)]!==_0xdc939d(0x1f6))return _0x2db29e[_0xdc939d(0x1e5)];const _0x1eb7f9=await a59_0x20ccd2({'type':'text','name':_0xdc939d(0x1ee),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x338f25=>{const _0x35ae1e=_0xdc939d;if(!_0x338f25||!_0x338f25[_0x35ae1e(0x1e7)]())return _0x35ae1e(0x1dd);if(!/^[a-z0-9-]+$/[_0x35ae1e(0x1ea)](_0x338f25[_0x35ae1e(0x1e7)]()))return _0x35ae1e(0x1fa);return!![];}});if(!_0x1eb7f9['customSite'])return console['log']('\x0a'+_0x3d2350),null;return _0x1eb7f9['customSite'];}
1
+ const a59_0x3ecb26=a59_0x8d60;(function(_0x23141a,_0x765546){const _0x3350b5=a59_0x8d60,_0x3cc7bf=_0x23141a();while(!![]){try{const _0x4a2381=-parseInt(_0x3350b5(0x133))/0x1*(-parseInt(_0x3350b5(0x147))/0x2)+parseInt(_0x3350b5(0x13d))/0x3+parseInt(_0x3350b5(0x132))/0x4*(parseInt(_0x3350b5(0x13a))/0x5)+parseInt(_0x3350b5(0x134))/0x6*(-parseInt(_0x3350b5(0x137))/0x7)+parseInt(_0x3350b5(0x129))/0x8+parseInt(_0x3350b5(0x130))/0x9*(-parseInt(_0x3350b5(0x13b))/0xa)+-parseInt(_0x3350b5(0x13e))/0xb*(parseInt(_0x3350b5(0x138))/0xc);if(_0x4a2381===_0x765546)break;else _0x3cc7bf['push'](_0x3cc7bf['shift']());}catch(_0x52080f){_0x3cc7bf['push'](_0x3cc7bf['shift']());}}}(a59_0x12d0,0xe6db1));function a59_0x12d0(){const _0x380990=['select','9VpreLY','Select\x20your\x20Treasure\x20Data\x20site:','4Uvmfpz','1605629lYzNvV','3006WwDwdb','customSite','us01','1918doiCdA','2988MVqVvt','eu01','4048555YmdNQd','16082330ABomYN','Cancelled','3858072OSyRsk','59719kiWIKA','push','number','ap02','Site\x20name\x20cannot\x20be\x20empty','test','log','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','trim','2ELGBSz','other','us\x20\x20\x20-\x20United\x20States','ap01','2732392etebzW','Enter\x20site\x20name:','jp\x20\x20\x20-\x20Japan','value','text','site'];a59_0x12d0=function(){return _0x380990;};return a59_0x12d0();}function a59_0x8d60(_0x5f5471,_0x57f67a){_0x5f5471=_0x5f5471-0x129;const _0x12d048=a59_0x12d0();let _0x8d6054=_0x12d048[_0x5f5471];return _0x8d6054;}import a59_0x74da27 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x1878c4,_0x33b820){const _0x469385=a59_0x8d60;if(_0x1878c4===undefined)return _0x33b820;if(typeof _0x1878c4===_0x469385(0x140))return _0x1878c4;return parseInt(_0x1878c4,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x3ecb26(0x149),'value':a59_0x3ecb26(0x136)},{'title':a59_0x3ecb26(0x12b),'value':a59_0x3ecb26(0x14a)},{'title':'eu\x20\x20\x20-\x20Europe','value':a59_0x3ecb26(0x139)},{'title':'ap02\x20-\x20Korea','value':a59_0x3ecb26(0x141)}];export function buildSiteChoices(_0x5f1251){const _0x25f835=a59_0x3ecb26,_0x137001=[...STANDARD_SITE_CHOICES];let _0x2fd32e=_0x137001['findIndex'](_0x3bb28a=>_0x3bb28a[_0x25f835(0x12c)]===_0x5f1251);return _0x2fd32e===-0x1&&_0x5f1251!=='us01'&&(_0x137001[_0x25f835(0x13f)]({'title':_0x5f1251,'value':_0x5f1251}),_0x2fd32e=_0x137001['length']-0x1),_0x137001['push']({'title':'Enter\x20custom\x20site','value':_0x25f835(0x148)}),{'choices':_0x137001,'initialIndex':_0x2fd32e>=0x0?_0x2fd32e:0x0};}export async function promptSiteSelection(_0x3756b7,_0xd2009d,_0x3f6c50=a59_0x3ecb26(0x13c)){const _0x594dea=a59_0x3ecb26,{choices:_0x3f91b9,initialIndex:_0x5c24c2}=buildSiteChoices(_0x3756b7),_0x194f31=_0xd2009d?_0x594dea(0x145)+_0xd2009d+'):':_0x594dea(0x131),_0x274f5d=await a59_0x74da27({'type':_0x594dea(0x12f),'name':_0x594dea(0x12e),'message':_0x194f31,'choices':_0x3f91b9,'initial':_0x5c24c2});if(!_0x274f5d[_0x594dea(0x12e)])return console[_0x594dea(0x144)]('\x0a'+_0x3f6c50),null;if(_0x274f5d[_0x594dea(0x12e)]!=='other')return _0x274f5d[_0x594dea(0x12e)];const _0x546748=await a59_0x74da27({'type':_0x594dea(0x12d),'name':_0x594dea(0x135),'message':_0x594dea(0x12a),'initial':_0x594dea(0x136),'validate':_0x44677d=>{const _0x209dfa=_0x594dea;if(!_0x44677d||!_0x44677d[_0x209dfa(0x146)]())return _0x209dfa(0x142);if(!/^[a-z0-9-]+$/[_0x209dfa(0x143)](_0x44677d['trim']()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x546748[_0x594dea(0x135)])return console[_0x594dea(0x144)]('\x0a'+_0x3f6c50),null;return _0x546748[_0x594dea(0x135)];}
@@ -1 +1 @@
1
- (function(_0x14753a,_0x28b558){const _0x5db413=a60_0x540d,_0x23b0aa=_0x14753a();while(!![]){try{const _0x2b235f=parseInt(_0x5db413(0x127))/0x1*(-parseInt(_0x5db413(0x11b))/0x2)+parseInt(_0x5db413(0x11a))/0x3+-parseInt(_0x5db413(0x125))/0x4*(-parseInt(_0x5db413(0x117))/0x5)+-parseInt(_0x5db413(0x11d))/0x6+-parseInt(_0x5db413(0x126))/0x7+parseInt(_0x5db413(0x116))/0x8*(parseInt(_0x5db413(0x11f))/0x9)+parseInt(_0x5db413(0x124))/0xa*(parseInt(_0x5db413(0x122))/0xb);if(_0x2b235f===_0x28b558)break;else _0x23b0aa['push'](_0x23b0aa['shift']());}catch(_0x551b4f){_0x23b0aa['push'](_0x23b0aa['shift']());}}}(a60_0x34bf,0x7c893));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a60_0x34bf(){const _0x2c20e6=['4290075hhUybm','__default_site__','get','197483NJQUFg','loadedAt','440iHkySu','57008vcbpJH','1736539mMNcHL','1HHKvsb','clear','delete','8QmRiro','25vMGUmU','__default_profile__','set','2162556nJkRka','1463036wlGGaL','now','3414150BFtlvc','apiKey'];a60_0x34bf=function(){return _0x2c20e6;};return a60_0x34bf();}function getCacheKey(_0x266d87,_0x2ccbcb){const _0x2a7265=a60_0x540d,_0x4feecf=_0x266d87||_0x2a7265(0x120),_0x4bd5ed=_0x2ccbcb||_0x2a7265(0x118);return _0x4feecf+':'+_0x4bd5ed;}export function getCachedCredential(_0x4278c8,_0x3321fc){const _0x28b97f=a60_0x540d,_0x575ab0=getCacheKey(_0x4278c8,_0x3321fc),_0x543a22=cache[_0x28b97f(0x121)](_0x575ab0);if(!_0x543a22)return null;if(Date[_0x28b97f(0x11c)]()-_0x543a22[_0x28b97f(0x123)]>CACHE_TTL_MS)return cache['delete'](_0x575ab0),null;return _0x543a22[_0x28b97f(0x11e)];}export function setCachedCredential(_0x412e23,_0x4ac5fe,_0x550a6f){const _0xe4d857=a60_0x540d,_0x54f1b6=getCacheKey(_0x4ac5fe,_0x550a6f);cache[_0xe4d857(0x119)](_0x54f1b6,{'apiKey':_0x412e23,'loadedAt':Date[_0xe4d857(0x11c)]()});}export function clearCredentialCache(){const _0x30622d=a60_0x540d;cache[_0x30622d(0x114)]();}function a60_0x540d(_0x1ed5f5,_0xa3130c){_0x1ed5f5=_0x1ed5f5-0x114;const _0x34bf9d=a60_0x34bf();let _0x540d59=_0x34bf9d[_0x1ed5f5];return _0x540d59;}export function clearCachedCredential(_0x176b26,_0x26c44b){const _0x17ef44=a60_0x540d,_0x16d19b=getCacheKey(_0x176b26,_0x26c44b);cache[_0x17ef44(0x115)](_0x16d19b);}
1
+ (function(_0x38f579,_0x4b337e){const _0x2e6401=a60_0x3dcb,_0x57acd1=_0x38f579();while(!![]){try{const _0x29a41b=-parseInt(_0x2e6401(0x76))/0x1*(parseInt(_0x2e6401(0x75))/0x2)+-parseInt(_0x2e6401(0x6d))/0x3*(parseInt(_0x2e6401(0x79))/0x4)+parseInt(_0x2e6401(0x7a))/0x5+parseInt(_0x2e6401(0x7c))/0x6+-parseInt(_0x2e6401(0x71))/0x7*(-parseInt(_0x2e6401(0x70))/0x8)+-parseInt(_0x2e6401(0x6f))/0x9+parseInt(_0x2e6401(0x74))/0xa;if(_0x29a41b===_0x4b337e)break;else _0x57acd1['push'](_0x57acd1['shift']());}catch(_0x5d29d8){_0x57acd1['push'](_0x57acd1['shift']());}}}(a60_0x113d,0x9436b));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a60_0x3dcb(_0x2c5649,_0x1b0c03){_0x2c5649=_0x2c5649-0x6a;const _0x113dde=a60_0x113d();let _0x3dcbe2=_0x113dde[_0x2c5649];return _0x3dcbe2;}function a60_0x113d(){const _0x52168c=['__default_site__','2269362RtEvaK','set','delete','get','93DVdBYy','apiKey','1316151vaIwkf','16qqqrbm','1390151JWFfVL','clear','__default_profile__','2292090nRrpis','5934hlOXre','223KEoUHN','now','loadedAt','75884BDmhIf','4992210CtuWLQ'];a60_0x113d=function(){return _0x52168c;};return a60_0x113d();}function getCacheKey(_0x1fe6ab,_0xc62e6c){const _0x347493=a60_0x3dcb,_0x438a9d=_0x1fe6ab||_0x347493(0x7b),_0x4ff95d=_0xc62e6c||_0x347493(0x73);return _0x438a9d+':'+_0x4ff95d;}export function getCachedCredential(_0x4633cd,_0x34fba5){const _0x2dfbba=a60_0x3dcb,_0x51755d=getCacheKey(_0x4633cd,_0x34fba5),_0x32a656=cache[_0x2dfbba(0x6c)](_0x51755d);if(!_0x32a656)return null;if(Date[_0x2dfbba(0x77)]()-_0x32a656[_0x2dfbba(0x78)]>CACHE_TTL_MS)return cache[_0x2dfbba(0x6b)](_0x51755d),null;return _0x32a656[_0x2dfbba(0x6e)];}export function setCachedCredential(_0x346c30,_0x6343de,_0x210c53){const _0x155c1b=a60_0x3dcb,_0xf393d4=getCacheKey(_0x6343de,_0x210c53);cache[_0x155c1b(0x6a)](_0xf393d4,{'apiKey':_0x346c30,'loadedAt':Date[_0x155c1b(0x77)]()});}export function clearCredentialCache(){const _0x1e81a7=a60_0x3dcb;cache[_0x1e81a7(0x72)]();}export function clearCachedCredential(_0x2bd379,_0x5581f3){const _0x3c1778=a60_0x3dcb,_0x259c00=getCacheKey(_0x2bd379,_0x5581f3);cache[_0x3c1778(0x6b)](_0x259c00);}
@@ -1 +1 @@
1
- const a61_0x209454=a61_0x2312;(function(_0x5e3f0d,_0x1e3231){const _0x24a4cd=a61_0x2312,_0x4c0529=_0x5e3f0d();while(!![]){try{const _0x391b0e=parseInt(_0x24a4cd(0xb9))/0x1*(-parseInt(_0x24a4cd(0xbd))/0x2)+-parseInt(_0x24a4cd(0xaf))/0x3*(-parseInt(_0x24a4cd(0xb2))/0x4)+-parseInt(_0x24a4cd(0xa3))/0x5*(-parseInt(_0x24a4cd(0x8b))/0x6)+parseInt(_0x24a4cd(0x82))/0x7*(-parseInt(_0x24a4cd(0xc3))/0x8)+parseInt(_0x24a4cd(0x84))/0x9*(-parseInt(_0x24a4cd(0x8e))/0xa)+parseInt(_0x24a4cd(0xc7))/0xb*(-parseInt(_0x24a4cd(0xac))/0xc)+parseInt(_0x24a4cd(0xa5))/0xd;if(_0x391b0e===_0x1e3231)break;else _0x4c0529['push'](_0x4c0529['shift']());}catch(_0x1e5c39){_0x4c0529['push'](_0x4c0529['shift']());}}}(a61_0x5e48,0xe4bd4));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a61_0x5e48(){const _0x36bc9f=['(active)','Global\x20Credentials','expires_at','refresh_token','sessions','Profile\x20Credentials','2389385HeINjb','segment_path','61166001kzeHEP','now','env','composableAudience','config','profileSource','llmProject','5363532DqfiPw','accessToken','profile','38769XcCcmI','proxy','sessionId','152kYNPaS','activeProfile','green','tdx.json','log','default','(session:\x20','8GQcZoM','injectIntoOptions','llm_agent','displayWithSources','380438vesCHy','parentSegment','createAsync','apiKey','logLevel','llmAgent','1488sGbrrI','database','loadGlobalConfig','site','11cMXrYV','[context]','workflowProject','.env','Global','project','parent_segment','configFiles','entries','Profile','layers','profile:\x20','existsSync','us01','getParameters','segmentPath','replace','composable_audience','cli','41419mPXiAE','Session','9XgYkWI','string','not\x20set','access_token','assign','join','session','6aUNuSW','resolveAPIKeyAsync','workflow_project','16678370pdiWDT','llm_project','cliFlags','display','profiles','bold','verbose','global','profileCredentials','dim','[configuration\x20files]','parse','cyan','readFileSync','getSource'];a61_0x5e48=function(){return _0x36bc9f;};return a61_0x5e48();}import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a61_0x2312(_0x3a844e,_0x186ed6){_0x3a844e=_0x3a844e-0x78;const _0x5e48c4=a61_0x5e48();let _0x2312f6=_0x5e48c4[_0x3a844e];return _0x2312f6;}import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a61_0x557e7e from'node:fs';import*as a61_0x1eb71e from'node:path';import a61_0x357328 from'chalk';export class GlobalContext{[a61_0x209454(0xc6)];[a61_0x209454(0xc4)];[a61_0x209454(0xcd)];[a61_0x209454(0xa4)];[a61_0x209454(0x8f)];[a61_0x209454(0xbb)];[a61_0x209454(0x8d)];[a61_0x209454(0x80)];[a61_0x209454(0xc0)];[a61_0x209454(0xad)];[a61_0x209454(0xb0)];['verbose'];[a61_0x209454(0xc1)];[a61_0x209454(0xae)];[a61_0x209454(0xaa)]=null;[a61_0x209454(0x79)];['activeProfile'];[a61_0x209454(0xb1)];[a61_0x209454(0xce)];constructor(_0x16038a){const _0x4031e0=a61_0x209454;this[_0x4031e0(0xb1)]=getSessionID(_0x16038a[_0x4031e0(0x8a)]);const _0x4a7026=loadSessionContext(_0x16038a[_0x4031e0(0x8a)]),_0x141412=loadProjectConfig(),_0xf279f7=this[_0x4031e0(0xc5)]();if(_0x16038a[_0x4031e0(0xae)])this[_0x4031e0(0xb3)]=_0x16038a[_0x4031e0(0xae)],this['profileSource']=_0x4031e0(0x81);else{if(_0x4a7026?.[_0x4031e0(0xae)])this['activeProfile']=_0x4a7026[_0x4031e0(0xae)],this[_0x4031e0(0xaa)]=_0x4031e0(0x8a);else{if(_0xf279f7[_0x4031e0(0xae)])this[_0x4031e0(0xb3)]=_0xf279f7[_0x4031e0(0xae)],this['profileSource']='config';else process.env.TDX_PROFILE?(this[_0x4031e0(0xb3)]=process.env.TDX_PROFILE,this[_0x4031e0(0xaa)]=_0x4031e0(0xa7)):(this[_0x4031e0(0xb3)]=null,this[_0x4031e0(0xaa)]=null);}}const _0x2c5ccb=this[_0x4031e0(0xb3)]?loadProfile(this[_0x4031e0(0xb3)]):null,_0x3d79a9=_0x32ad7e=>{const _0x35db89=_0x4031e0;if(!_0x32ad7e)return{};const _0xbed5bf=_0x32ad7e,_0x2e37a6={};for(const [_0x838dca,_0x44e6d0]of Object[_0x35db89(0xcf)](_0xbed5bf)){typeof _0x44e6d0===_0x35db89(0x85)&&(_0x2e37a6[_0x838dca]=_0x44e6d0);}return _0x2e37a6;},_0x127029={},_0xa9475c=(_0x2bd924,_0x12652b,_0x431958)=>{const _0x250975=_0x4031e0;if(!_0x2bd924)return![];if(_0x431958&&_0x2bd924===_0x431958)return![];const _0x43c192=_0x4a7026,_0x22071f=_0x141412,_0x1950da=_0x2c5ccb?.[_0x250975(0xa9)],_0x20da18=_0xf279f7,_0x1284db=_0x43c192?.[_0x12652b],_0x587d48=_0x22071f?.[_0x12652b],_0x42fbe8=_0x1950da?.[_0x12652b],_0x38c26f=_0x20da18[_0x12652b];return _0x2bd924!==_0x1284db&&_0x2bd924!==_0x587d48&&_0x2bd924!==_0x42fbe8&&_0x2bd924!==_0x38c26f;},_0x286435=[{'optionKey':_0x4031e0(0xc6),'contextKey':_0x4031e0(0xc6),'defaultValue':_0x4031e0(0x7c)},{'optionKey':_0x4031e0(0xc4),'contextKey':_0x4031e0(0xc4)},{'optionKey':'parentSegment','contextKey':_0x4031e0(0xcd)},{'optionKey':'llmProject','contextKey':_0x4031e0(0x8f)},{'optionKey':_0x4031e0(0xc2),'contextKey':'llm_agent'},{'optionKey':'composableAudience','contextKey':_0x4031e0(0x80)},{'optionKey':_0x4031e0(0xae),'contextKey':_0x4031e0(0xae)}];for(const {optionKey:_0x3c81b6,contextKey:_0x342719,defaultValue:_0x2c3d87}of _0x286435){const _0x2a8fe7=_0x16038a[_0x3c81b6];_0xa9475c(_0x2a8fe7,_0x342719,_0x2c3d87)&&(_0x127029[_0x342719]=_0x2a8fe7);}this[_0x4031e0(0x79)]={'cliFlags':_0x127029,'session':_0x3d79a9(_0x4a7026),'project':_0x3d79a9(_0x141412),'profile':_0x3d79a9(_0x2c5ccb?.[_0x4031e0(0xa9)]),'global':_0x3d79a9(_0xf279f7)};const _0x2883e2={...this[_0x4031e0(0x79)]['global'],...this[_0x4031e0(0x79)][_0x4031e0(0xae)],...this[_0x4031e0(0x79)][_0x4031e0(0xcc)]};process.env.TDX_SITE&&!this[_0x4031e0(0x79)][_0x4031e0(0x8a)]['site']&&!this[_0x4031e0(0x79)][_0x4031e0(0x90)]['site']&&(_0x2883e2[_0x4031e0(0xc6)]=process.env.TDX_SITE);Object[_0x4031e0(0x88)](_0x2883e2,this[_0x4031e0(0x79)]['session']),Object[_0x4031e0(0x88)](_0x2883e2,this[_0x4031e0(0x79)][_0x4031e0(0x90)]);const _0x6f85f6=_0x2883e2['site']||'us01';this['site']=resolveSite(_0x6f85f6),this[_0x4031e0(0xc4)]=_0x2883e2[_0x4031e0(0xc4)],this[_0x4031e0(0xcd)]=_0x2883e2[_0x4031e0(0xcd)],this[_0x4031e0(0xa4)]=_0x2883e2['segment_path'],this[_0x4031e0(0x8f)]=_0x2883e2['llm_project'],this[_0x4031e0(0xbb)]=_0x2883e2[_0x4031e0(0xbb)],this[_0x4031e0(0x8d)]=_0x2883e2['workflow_project'],this[_0x4031e0(0x80)]=_0x2883e2[_0x4031e0(0x80)],this[_0x4031e0(0x94)]=_0x16038a[_0x4031e0(0x94)]||![],this[_0x4031e0(0xc1)]=_0x16038a['logLevel']??LogLevel['INFO'],this[_0x4031e0(0xae)]=this[_0x4031e0(0xb3)]||undefined,this[_0x4031e0(0xad)]=getAccessToken(this[_0x4031e0(0xb3)]||undefined),this[_0x4031e0(0xc0)]=getAPIKey(this[_0x4031e0(0xb3)]||undefined);const _0x19c917=typeof _0xf279f7[_0x4031e0(0xb0)]===_0x4031e0(0x85)?_0xf279f7['proxy']:undefined;this[_0x4031e0(0xb0)]=_0x19c917||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x47f196=getConfigDir(),_0x167724=a61_0x1eb71e[_0x4031e0(0x89)](_0x47f196,_0x4031e0(0xa1),this[_0x4031e0(0xb1)]+'.json'),_0x2ed5d6=findProjectConfigPath(),_0x4fb77a=a61_0x1eb71e[_0x4031e0(0x89)](_0x47f196,'tdx.json'),_0x59155b=a61_0x1eb71e[_0x4031e0(0x89)](_0x47f196,_0x4031e0(0xca));let _0x342581=null,_0x3c988a=null;this[_0x4031e0(0xb3)]&&(_0x342581=a61_0x1eb71e[_0x4031e0(0x89)](_0x47f196,'profiles',this[_0x4031e0(0xb3)],_0x4031e0(0xb5)),_0x3c988a=a61_0x1eb71e[_0x4031e0(0x89)](_0x47f196,_0x4031e0(0x92),this[_0x4031e0(0xb3)],_0x4031e0(0xca))),this[_0x4031e0(0xce)]={'session':a61_0x557e7e[_0x4031e0(0x7b)](_0x167724)?_0x167724:null,'project':_0x2ed5d6,'profile':_0x342581&&a61_0x557e7e[_0x4031e0(0x7b)](_0x342581)?_0x342581:null,'profileCredentials':_0x3c988a&&a61_0x557e7e[_0x4031e0(0x7b)](_0x3c988a)?_0x3c988a:null,'global':a61_0x557e7e['existsSync'](_0x4fb77a)?_0x4fb77a:null,'globalCredentials':a61_0x557e7e[_0x4031e0(0x7b)](_0x59155b)?_0x59155b:null};}[a61_0x209454(0x9c)](_0x26a00e,_0x66a04a){const _0x515ad1=a61_0x209454;if(!_0x66a04a)return _0x515ad1(0x86);const _0x54ad4f=_0x66a04a;if(this[_0x515ad1(0x79)][_0x515ad1(0x90)][_0x26a00e]===_0x54ad4f){if(_0x26a00e==='site'&&_0x54ad4f===_0x515ad1(0x7c)&&!this['layers'][_0x515ad1(0x8a)][_0x515ad1(0xc6)]&&!this['layers'][_0x515ad1(0xcc)]['site']&&!this['layers']['profile'][_0x515ad1(0xc6)]&&!this[_0x515ad1(0x79)][_0x515ad1(0x95)][_0x515ad1(0xc6)])return'default';return'CLI\x20flag:\x20--'+_0x26a00e[_0x515ad1(0x7f)](/_/g,'-');}if(this[_0x515ad1(0x79)]['session'][_0x26a00e]===_0x54ad4f)return'session';if(this['layers']['project'][_0x26a00e]===_0x54ad4f)return _0x515ad1(0xcc);if(this[_0x515ad1(0x79)][_0x515ad1(0xae)][_0x26a00e]===_0x54ad4f)return _0x515ad1(0x7a)+this[_0x515ad1(0xb3)];if(this[_0x515ad1(0x79)]['global'][_0x26a00e]===_0x54ad4f)return _0x515ad1(0x95);return _0x515ad1(0xb7);}['loadGlobalConfig'](){const _0x2b354f=a61_0x209454,_0x54b0db=a61_0x1eb71e[_0x2b354f(0x89)](getConfigDir(),'tdx.json');if(!a61_0x557e7e['existsSync'](_0x54b0db))return{};try{const _0x4a2f4d=a61_0x557e7e[_0x2b354f(0x9b)](_0x54b0db,'utf-8');return JSON[_0x2b354f(0x99)](_0x4a2f4d);}catch{return{};}}[a61_0x209454(0xba)](_0x3d31cc){const _0x213b2=a61_0x209454;_0x3d31cc['site']=this[_0x213b2(0xc6)],!_0x3d31cc[_0x213b2(0xc4)]&&this[_0x213b2(0xc4)]&&(_0x3d31cc['database']=this[_0x213b2(0xc4)]),!_0x3d31cc[_0x213b2(0xbe)]&&this[_0x213b2(0xcd)]&&(_0x3d31cc[_0x213b2(0xbe)]=this[_0x213b2(0xcd)]),!_0x3d31cc[_0x213b2(0x7e)]&&this[_0x213b2(0xa4)]&&(_0x3d31cc['segmentPath']=this['segment_path']),!_0x3d31cc[_0x213b2(0xab)]&&this[_0x213b2(0x8f)]&&(_0x3d31cc['llmProject']=this['llm_project']),!_0x3d31cc[_0x213b2(0xc2)]&&this[_0x213b2(0xbb)]&&(_0x3d31cc['llmAgent']=this[_0x213b2(0xbb)]),!_0x3d31cc['workflowProject']&&this[_0x213b2(0x8d)]&&(_0x3d31cc[_0x213b2(0xc9)]=this['workflow_project']),!_0x3d31cc[_0x213b2(0xa8)]&&this[_0x213b2(0x80)]&&(_0x3d31cc['composableAudience']=this[_0x213b2(0x80)]);}['getParameters'](){const _0x2160d5=a61_0x209454;return[{'key':_0x2160d5(0xc6),'value':this['site']},{'key':_0x2160d5(0xc4),'value':this[_0x2160d5(0xc4)]},{'key':'parent_segment','value':this[_0x2160d5(0xcd)]},{'key':_0x2160d5(0xa4),'value':this['segment_path']},{'key':_0x2160d5(0x8f),'value':this[_0x2160d5(0x8f)]},{'key':_0x2160d5(0xbb),'value':this[_0x2160d5(0xbb)]},{'key':'workflow_project','value':this[_0x2160d5(0x8d)]},{'key':_0x2160d5(0x80),'value':this[_0x2160d5(0x80)]},{'key':_0x2160d5(0xae),'value':this[_0x2160d5(0xb3)]||undefined}];}[a61_0x209454(0x91)](){const _0x2a81f6=a61_0x209454;console[_0x2a81f6(0xb6)](a61_0x357328[_0x2a81f6(0x93)]('[context]'));for(const {key:_0x297b76,value:_0x380e32}of this[_0x2a81f6(0x7d)]()){_0x380e32&&console['log'](a61_0x357328[_0x2a81f6(0x9a)](_0x297b76)+':\x20'+_0x380e32);}}[a61_0x209454(0xbc)](){const _0x5a13e6=a61_0x209454;console['log'](a61_0x357328[_0x5a13e6(0x93)](_0x5a13e6(0xc8)));for(const {key:_0x3df8be,value:_0x2e1913}of this['getParameters']()){if(_0x2e1913){const _0x179aca=_0x3df8be===_0x5a13e6(0xae)?_0x5a13e6(0x9d):'('+this[_0x5a13e6(0x9c)](_0x3df8be,_0x2e1913)+')';console[_0x5a13e6(0xb6)](a61_0x357328[_0x5a13e6(0x9a)](_0x3df8be)+':\x20'+_0x2e1913+'\x20'+a61_0x357328[_0x5a13e6(0x97)](_0x179aca));}}console[_0x5a13e6(0xb6)]('\x0a'+a61_0x357328[_0x5a13e6(0x93)](_0x5a13e6(0x98)));const _0x8e5e5e=[{'label':_0x5a13e6(0x83),'path':this[_0x5a13e6(0xce)][_0x5a13e6(0x8a)],'extra':_0x5a13e6(0xb8)+this['sessionId']+')'},{'label':'Project','path':this[_0x5a13e6(0xce)][_0x5a13e6(0xcc)]},{'label':_0x5a13e6(0x78),'path':this[_0x5a13e6(0xce)]['profile']},{'label':_0x5a13e6(0xa2),'path':this[_0x5a13e6(0xce)][_0x5a13e6(0x96)]},{'label':_0x5a13e6(0xcb),'path':this[_0x5a13e6(0xce)][_0x5a13e6(0x95)]},{'label':_0x5a13e6(0x9e),'path':this[_0x5a13e6(0xce)]['globalCredentials']}];for(const {label:_0x572b4e,path:_0x4e7712,extra:_0x36475e}of _0x8e5e5e){if(_0x4e7712)console[_0x5a13e6(0xb6)](a61_0x357328[_0x5a13e6(0x9a)](_0x572b4e)+':\x20'+_0x4e7712+'\x20'+a61_0x357328[_0x5a13e6(0xb4)]('✓')+(_0x36475e?'\x20'+a61_0x357328[_0x5a13e6(0x97)](_0x36475e):''));else{if(_0x572b4e===_0x5a13e6(0x83))console[_0x5a13e6(0xb6)](a61_0x357328[_0x5a13e6(0x9a)](_0x572b4e)+':\x20'+a61_0x357328[_0x5a13e6(0x97)]('none')+'\x20'+a61_0x357328[_0x5a13e6(0x97)]('(using\x20session:\x20'+this[_0x5a13e6(0xb1)]+')'));else(_0x572b4e==='Project'||_0x572b4e===_0x5a13e6(0xcb))&&console['log'](a61_0x357328[_0x5a13e6(0x9a)](_0x572b4e)+':\x20'+a61_0x357328[_0x5a13e6(0x97)]('none'));}}}async[a61_0x209454(0x8c)](){const _0x1141f2=a61_0x209454;if(!this[_0x1141f2(0xad)]){const _0xa2b566=await getOAuthTokens(this[_0x1141f2(0xb3)]||undefined);if(_0xa2b566){const _0x18b44a=0x5*0x3c*0x3e8,_0x5b2c57=!_0xa2b566[_0x1141f2(0x9f)]||_0xa2b566['expires_at']<Date[_0x1141f2(0xa6)]()+_0x18b44a;if(_0x5b2c57&&_0xa2b566[_0x1141f2(0xa0)])try{const _0x2b120d=getConsoleUrl(this[_0x1141f2(0xc6)]),_0x2d494c=await refreshAccessToken(_0x2b120d,_0xa2b566[_0x1141f2(0xa0)]);await saveOAuthTokens(_0x2d494c,this['activeProfile']||undefined),this[_0x1141f2(0xad)]=_0x2d494c[_0x1141f2(0x87)];}catch{this[_0x1141f2(0xad)]=_0xa2b566[_0x1141f2(0x87)];}else this['accessToken']=_0xa2b566[_0x1141f2(0x87)];return undefined;}}return this[_0x1141f2(0xc0)]=await getAPIKeyAsync(this[_0x1141f2(0xc6)],this[_0x1141f2(0xb3)]||undefined),this[_0x1141f2(0xc0)];}static async[a61_0x209454(0xbf)](_0x365017){const _0x5d455d=a61_0x209454,_0x1e593a=new GlobalContext(_0x365017);return await _0x1e593a[_0x5d455d(0x8c)](),_0x1e593a;}}
1
+ const a61_0x21f20a=a61_0x572c;(function(_0x128ac9,_0x16fdb9){const _0x3234cc=a61_0x572c,_0x3f7a9a=_0x128ac9();while(!![]){try{const _0x33fd7b=parseInt(_0x3234cc(0x204))/0x1*(parseInt(_0x3234cc(0x1f6))/0x2)+parseInt(_0x3234cc(0x1bd))/0x3*(parseInt(_0x3234cc(0x1bc))/0x4)+-parseInt(_0x3234cc(0x1d9))/0x5*(parseInt(_0x3234cc(0x1d0))/0x6)+parseInt(_0x3234cc(0x1bf))/0x7+parseInt(_0x3234cc(0x1c4))/0x8*(parseInt(_0x3234cc(0x1cc))/0x9)+-parseInt(_0x3234cc(0x205))/0xa+-parseInt(_0x3234cc(0x1bb))/0xb*(parseInt(_0x3234cc(0x1cb))/0xc);if(_0x33fd7b===_0x16fdb9)break;else _0x3f7a9a['push'](_0x3f7a9a['shift']());}catch(_0x2b8c5f){_0x3f7a9a['push'](_0x3f7a9a['shift']());}}}(a61_0x1e5b,0x25255));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';function a61_0x572c(_0x1bd0dc,_0x304636){_0x1bd0dc=_0x1bd0dc-0x1b3;const _0x1e5bf8=a61_0x1e5b();let _0x572cb0=_0x1e5bf8[_0x1bd0dc];return _0x572cb0;}import{LogLevel}from'../utils/logger/index.js';import*as a61_0xa71f04 from'node:fs';import*as a61_0x4dc184 from'node:path';function a61_0x1e5b(){const _0x42c771=['loadGlobalConfig','us01','profiles','site','bold','Profile','refresh_token','cyan','1502945GBZOrE','not\x20set','project','parentSegment','accessToken','llmProject','database','CLI\x20flag:\x20--','global','default','(active)','composableAudience','config','sessionId','logLevel','string','existsSync','utf-8','llm_agent','displayWithSources','parent_segment','cli','segment_path','profile','expires_at','Profile\x20Credentials','session','.json','access_token','2RRaVfO','green','profile:\x20','activeProfile','Project','.env','getParameters','layers','now','workflow_project','Global','join','profileSource','replace','299821AUCONU','745730QMsoCM','[configuration\x20files]','proxy','cliFlags','readFileSync','display','INFO','configFiles','workflowProject','llm_project','parse','531817eQBexc','1096CWKcSY','510FPbRJq','log','1402604cGLAsh','segmentPath','tdx.json','assign','injectIntoOptions','46216HkPqKB','verbose','apiKey','Global\x20Credentials','none','composable_audience','resolveAPIKeyAsync','12yTPCCa','45MqrceW','getSource','dim','llmAgent','6lmeHwU'];a61_0x1e5b=function(){return _0x42c771;};return a61_0x1e5b();}import a61_0x256a44 from'chalk';export class GlobalContext{[a61_0x21f20a(0x1d4)];[a61_0x21f20a(0x1df)];[a61_0x21f20a(0x1ed)];[a61_0x21f20a(0x1ef)];[a61_0x21f20a(0x1b9)];[a61_0x21f20a(0x1eb)];[a61_0x21f20a(0x1ff)];[a61_0x21f20a(0x1c9)];[a61_0x21f20a(0x1c6)];[a61_0x21f20a(0x1dd)];[a61_0x21f20a(0x207)];[a61_0x21f20a(0x1c5)];[a61_0x21f20a(0x1e7)];[a61_0x21f20a(0x1f0)];['profileSource']=null;[a61_0x21f20a(0x1fd)];[a61_0x21f20a(0x1f9)];[a61_0x21f20a(0x1e6)];[a61_0x21f20a(0x1b7)];constructor(_0x292fb2){const _0x4a3409=a61_0x21f20a;this[_0x4a3409(0x1e6)]=getSessionID(_0x292fb2[_0x4a3409(0x1f3)]);const _0x8cd039=loadSessionContext(_0x292fb2[_0x4a3409(0x1f3)]),_0x717cd6=loadProjectConfig(),_0x911718=this[_0x4a3409(0x1d1)]();if(_0x292fb2['profile'])this[_0x4a3409(0x1f9)]=_0x292fb2[_0x4a3409(0x1f0)],this['profileSource']=_0x4a3409(0x1ee);else{if(_0x8cd039?.[_0x4a3409(0x1f0)])this[_0x4a3409(0x1f9)]=_0x8cd039[_0x4a3409(0x1f0)],this[_0x4a3409(0x202)]=_0x4a3409(0x1f3);else{if(_0x911718['profile'])this[_0x4a3409(0x1f9)]=_0x911718['profile'],this['profileSource']=_0x4a3409(0x1e5);else process.env.TDX_PROFILE?(this[_0x4a3409(0x1f9)]=process.env.TDX_PROFILE,this[_0x4a3409(0x202)]='env'):(this[_0x4a3409(0x1f9)]=null,this[_0x4a3409(0x202)]=null);}}const _0x329948=this['activeProfile']?loadProfile(this[_0x4a3409(0x1f9)]):null,_0x4a0fa0=_0x2db7d5=>{const _0x5943f5=_0x4a3409;if(!_0x2db7d5)return{};const _0x585003=_0x2db7d5,_0x31bdcc={};for(const [_0x20bdf9,_0x4e7df2]of Object['entries'](_0x585003)){typeof _0x4e7df2===_0x5943f5(0x1e8)&&(_0x31bdcc[_0x20bdf9]=_0x4e7df2);}return _0x31bdcc;},_0x5d0f02={},_0x2632d2=(_0x3ab830,_0xaf46b7,_0x539e86)=>{if(!_0x3ab830)return![];if(_0x539e86&&_0x3ab830===_0x539e86)return![];const _0x518526=_0x8cd039,_0x100821=_0x717cd6,_0x325ac0=_0x329948?.['config'],_0x22e707=_0x911718,_0xd7b0a3=_0x518526?.[_0xaf46b7],_0x5b170a=_0x100821?.[_0xaf46b7],_0x228c00=_0x325ac0?.[_0xaf46b7],_0x2bd635=_0x22e707[_0xaf46b7];return _0x3ab830!==_0xd7b0a3&&_0x3ab830!==_0x5b170a&&_0x3ab830!==_0x228c00&&_0x3ab830!==_0x2bd635;},_0x54b2d4=[{'optionKey':_0x4a3409(0x1d4),'contextKey':'site','defaultValue':_0x4a3409(0x1d2)},{'optionKey':'database','contextKey':'database'},{'optionKey':_0x4a3409(0x1dc),'contextKey':_0x4a3409(0x1ed)},{'optionKey':'llmProject','contextKey':_0x4a3409(0x1b9)},{'optionKey':_0x4a3409(0x1cf),'contextKey':_0x4a3409(0x1eb)},{'optionKey':_0x4a3409(0x1e4),'contextKey':_0x4a3409(0x1c9)},{'optionKey':_0x4a3409(0x1f0),'contextKey':_0x4a3409(0x1f0)}];for(const {optionKey:_0x590a53,contextKey:_0x42eee3,defaultValue:_0x2da7de}of _0x54b2d4){const _0xca56c2=_0x292fb2[_0x590a53];_0x2632d2(_0xca56c2,_0x42eee3,_0x2da7de)&&(_0x5d0f02[_0x42eee3]=_0xca56c2);}this['layers']={'cliFlags':_0x5d0f02,'session':_0x4a0fa0(_0x8cd039),'project':_0x4a0fa0(_0x717cd6),'profile':_0x4a0fa0(_0x329948?.[_0x4a3409(0x1e5)]),'global':_0x4a0fa0(_0x911718)};const _0xf3e762={...this[_0x4a3409(0x1fd)]['global'],...this['layers']['profile'],...this[_0x4a3409(0x1fd)][_0x4a3409(0x1db)]};process.env.TDX_SITE&&!this[_0x4a3409(0x1fd)]['session'][_0x4a3409(0x1d4)]&&!this[_0x4a3409(0x1fd)][_0x4a3409(0x1b3)][_0x4a3409(0x1d4)]&&(_0xf3e762[_0x4a3409(0x1d4)]=process.env.TDX_SITE);Object['assign'](_0xf3e762,this[_0x4a3409(0x1fd)][_0x4a3409(0x1f3)]),Object[_0x4a3409(0x1c2)](_0xf3e762,this[_0x4a3409(0x1fd)]['cliFlags']);const _0x3852d6=_0xf3e762[_0x4a3409(0x1d4)]||_0x4a3409(0x1d2);this[_0x4a3409(0x1d4)]=resolveSite(_0x3852d6),this[_0x4a3409(0x1df)]=_0xf3e762[_0x4a3409(0x1df)],this[_0x4a3409(0x1ed)]=_0xf3e762['parent_segment'],this['segment_path']=_0xf3e762[_0x4a3409(0x1ef)],this[_0x4a3409(0x1b9)]=_0xf3e762['llm_project'],this[_0x4a3409(0x1eb)]=_0xf3e762[_0x4a3409(0x1eb)],this[_0x4a3409(0x1ff)]=_0xf3e762[_0x4a3409(0x1ff)],this['composable_audience']=_0xf3e762[_0x4a3409(0x1c9)],this['verbose']=_0x292fb2[_0x4a3409(0x1c5)]||![],this['logLevel']=_0x292fb2[_0x4a3409(0x1e7)]??LogLevel[_0x4a3409(0x1b6)],this[_0x4a3409(0x1f0)]=this['activeProfile']||undefined,this[_0x4a3409(0x1dd)]=getAccessToken(this[_0x4a3409(0x1f9)]||undefined),this[_0x4a3409(0x1c6)]=getAPIKey(this[_0x4a3409(0x1f9)]||undefined);const _0x5f2fc6=typeof _0x911718[_0x4a3409(0x207)]===_0x4a3409(0x1e8)?_0x911718[_0x4a3409(0x207)]:undefined;this[_0x4a3409(0x207)]=_0x5f2fc6||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x48cf4c=getConfigDir(),_0x1e6429=a61_0x4dc184[_0x4a3409(0x201)](_0x48cf4c,'sessions',this[_0x4a3409(0x1e6)]+_0x4a3409(0x1f4)),_0x2e6b3b=findProjectConfigPath(),_0x42100f=a61_0x4dc184[_0x4a3409(0x201)](_0x48cf4c,_0x4a3409(0x1c1)),_0x3add52=a61_0x4dc184[_0x4a3409(0x201)](_0x48cf4c,_0x4a3409(0x1fb));let _0x33ca66=null,_0x21f1f5=null;this[_0x4a3409(0x1f9)]&&(_0x33ca66=a61_0x4dc184[_0x4a3409(0x201)](_0x48cf4c,_0x4a3409(0x1d3),this[_0x4a3409(0x1f9)],'tdx.json'),_0x21f1f5=a61_0x4dc184[_0x4a3409(0x201)](_0x48cf4c,_0x4a3409(0x1d3),this['activeProfile'],'.env')),this['configFiles']={'session':a61_0xa71f04[_0x4a3409(0x1e9)](_0x1e6429)?_0x1e6429:null,'project':_0x2e6b3b,'profile':_0x33ca66&&a61_0xa71f04[_0x4a3409(0x1e9)](_0x33ca66)?_0x33ca66:null,'profileCredentials':_0x21f1f5&&a61_0xa71f04[_0x4a3409(0x1e9)](_0x21f1f5)?_0x21f1f5:null,'global':a61_0xa71f04[_0x4a3409(0x1e9)](_0x42100f)?_0x42100f:null,'globalCredentials':a61_0xa71f04[_0x4a3409(0x1e9)](_0x3add52)?_0x3add52:null};}[a61_0x21f20a(0x1cd)](_0x1185c0,_0x407d15){const _0x54eec7=a61_0x21f20a;if(!_0x407d15)return _0x54eec7(0x1da);const _0x204194=_0x407d15;if(this['layers'][_0x54eec7(0x1b3)][_0x1185c0]===_0x204194){if(_0x1185c0===_0x54eec7(0x1d4)&&_0x204194===_0x54eec7(0x1d2)&&!this['layers'][_0x54eec7(0x1f3)]['site']&&!this['layers'][_0x54eec7(0x1db)][_0x54eec7(0x1d4)]&&!this[_0x54eec7(0x1fd)][_0x54eec7(0x1f0)][_0x54eec7(0x1d4)]&&!this[_0x54eec7(0x1fd)]['global'][_0x54eec7(0x1d4)])return _0x54eec7(0x1e2);return _0x54eec7(0x1e0)+_0x1185c0[_0x54eec7(0x203)](/_/g,'-');}if(this['layers'][_0x54eec7(0x1f3)][_0x1185c0]===_0x204194)return _0x54eec7(0x1f3);if(this[_0x54eec7(0x1fd)][_0x54eec7(0x1db)][_0x1185c0]===_0x204194)return _0x54eec7(0x1db);if(this[_0x54eec7(0x1fd)][_0x54eec7(0x1f0)][_0x1185c0]===_0x204194)return _0x54eec7(0x1f8)+this['activeProfile'];if(this[_0x54eec7(0x1fd)][_0x54eec7(0x1e1)][_0x1185c0]===_0x204194)return'global';return _0x54eec7(0x1e2);}[a61_0x21f20a(0x1d1)](){const _0x5397ff=a61_0x21f20a,_0x84c54e=a61_0x4dc184[_0x5397ff(0x201)](getConfigDir(),_0x5397ff(0x1c1));if(!a61_0xa71f04[_0x5397ff(0x1e9)](_0x84c54e))return{};try{const _0x4b8655=a61_0xa71f04[_0x5397ff(0x1b4)](_0x84c54e,_0x5397ff(0x1ea));return JSON[_0x5397ff(0x1ba)](_0x4b8655);}catch{return{};}}[a61_0x21f20a(0x1c3)](_0x2de62b){const _0x54ac40=a61_0x21f20a;_0x2de62b['site']=this[_0x54ac40(0x1d4)],!_0x2de62b['database']&&this['database']&&(_0x2de62b[_0x54ac40(0x1df)]=this[_0x54ac40(0x1df)]),!_0x2de62b[_0x54ac40(0x1dc)]&&this[_0x54ac40(0x1ed)]&&(_0x2de62b[_0x54ac40(0x1dc)]=this[_0x54ac40(0x1ed)]),!_0x2de62b[_0x54ac40(0x1c0)]&&this[_0x54ac40(0x1ef)]&&(_0x2de62b[_0x54ac40(0x1c0)]=this[_0x54ac40(0x1ef)]),!_0x2de62b[_0x54ac40(0x1de)]&&this['llm_project']&&(_0x2de62b['llmProject']=this['llm_project']),!_0x2de62b[_0x54ac40(0x1cf)]&&this[_0x54ac40(0x1eb)]&&(_0x2de62b[_0x54ac40(0x1cf)]=this['llm_agent']),!_0x2de62b['workflowProject']&&this['workflow_project']&&(_0x2de62b[_0x54ac40(0x1b8)]=this[_0x54ac40(0x1ff)]),!_0x2de62b[_0x54ac40(0x1e4)]&&this[_0x54ac40(0x1c9)]&&(_0x2de62b[_0x54ac40(0x1e4)]=this['composable_audience']);}[a61_0x21f20a(0x1fc)](){const _0x5b799f=a61_0x21f20a;return[{'key':'site','value':this[_0x5b799f(0x1d4)]},{'key':_0x5b799f(0x1df),'value':this[_0x5b799f(0x1df)]},{'key':_0x5b799f(0x1ed),'value':this[_0x5b799f(0x1ed)]},{'key':_0x5b799f(0x1ef),'value':this[_0x5b799f(0x1ef)]},{'key':_0x5b799f(0x1b9),'value':this['llm_project']},{'key':'llm_agent','value':this[_0x5b799f(0x1eb)]},{'key':'workflow_project','value':this[_0x5b799f(0x1ff)]},{'key':_0x5b799f(0x1c9),'value':this[_0x5b799f(0x1c9)]},{'key':'profile','value':this[_0x5b799f(0x1f9)]||undefined}];}[a61_0x21f20a(0x1b5)](){const _0x1441a3=a61_0x21f20a;console['log'](a61_0x256a44[_0x1441a3(0x1d5)]('[context]'));for(const {key:_0x1a4e9c,value:_0x23d163}of this[_0x1441a3(0x1fc)]()){_0x23d163&&console[_0x1441a3(0x1be)](a61_0x256a44[_0x1441a3(0x1d8)](_0x1a4e9c)+':\x20'+_0x23d163);}}[a61_0x21f20a(0x1ec)](){const _0x386760=a61_0x21f20a;console[_0x386760(0x1be)](a61_0x256a44[_0x386760(0x1d5)]('[context]'));for(const {key:_0x2dc81b,value:_0x5dff7c}of this['getParameters']()){if(_0x5dff7c){const _0x1c55b5=_0x2dc81b==='profile'?_0x386760(0x1e3):'('+this['getSource'](_0x2dc81b,_0x5dff7c)+')';console[_0x386760(0x1be)](a61_0x256a44[_0x386760(0x1d8)](_0x2dc81b)+':\x20'+_0x5dff7c+'\x20'+a61_0x256a44[_0x386760(0x1ce)](_0x1c55b5));}}console['log']('\x0a'+a61_0x256a44[_0x386760(0x1d5)](_0x386760(0x206)));const _0x473845=[{'label':'Session','path':this[_0x386760(0x1b7)][_0x386760(0x1f3)],'extra':'(session:\x20'+this[_0x386760(0x1e6)]+')'},{'label':_0x386760(0x1fa),'path':this[_0x386760(0x1b7)][_0x386760(0x1db)]},{'label':_0x386760(0x1d6),'path':this[_0x386760(0x1b7)]['profile']},{'label':_0x386760(0x1f2),'path':this[_0x386760(0x1b7)]['profileCredentials']},{'label':_0x386760(0x200),'path':this[_0x386760(0x1b7)][_0x386760(0x1e1)]},{'label':_0x386760(0x1c7),'path':this[_0x386760(0x1b7)]['globalCredentials']}];for(const {label:_0x160134,path:_0x2aea03,extra:_0x4f312}of _0x473845){if(_0x2aea03)console[_0x386760(0x1be)](a61_0x256a44['cyan'](_0x160134)+':\x20'+_0x2aea03+'\x20'+a61_0x256a44[_0x386760(0x1f7)]('✓')+(_0x4f312?'\x20'+a61_0x256a44[_0x386760(0x1ce)](_0x4f312):''));else{if(_0x160134==='Session')console[_0x386760(0x1be)](a61_0x256a44[_0x386760(0x1d8)](_0x160134)+':\x20'+a61_0x256a44[_0x386760(0x1ce)](_0x386760(0x1c8))+'\x20'+a61_0x256a44['dim']('(using\x20session:\x20'+this[_0x386760(0x1e6)]+')'));else(_0x160134===_0x386760(0x1fa)||_0x160134===_0x386760(0x200))&&console[_0x386760(0x1be)](a61_0x256a44[_0x386760(0x1d8)](_0x160134)+':\x20'+a61_0x256a44[_0x386760(0x1ce)]('none'));}}}async['resolveAPIKeyAsync'](){const _0xd98b05=a61_0x21f20a;if(!this[_0xd98b05(0x1dd)]){const _0x47f639=await getOAuthTokens(this['activeProfile']||undefined);if(_0x47f639){const _0x3bbfce=0x5*0x3c*0x3e8,_0xc63684=!_0x47f639[_0xd98b05(0x1f1)]||_0x47f639['expires_at']<Date[_0xd98b05(0x1fe)]()+_0x3bbfce;if(_0xc63684&&_0x47f639[_0xd98b05(0x1d7)])try{const _0xc67d4f=getConsoleUrl(this[_0xd98b05(0x1d4)]),_0x5d1694=await refreshAccessToken(_0xc67d4f,_0x47f639[_0xd98b05(0x1d7)]);await saveOAuthTokens(_0x5d1694,this[_0xd98b05(0x1f9)]||undefined),this[_0xd98b05(0x1dd)]=_0x5d1694[_0xd98b05(0x1f5)];}catch{this[_0xd98b05(0x1dd)]=_0x47f639[_0xd98b05(0x1f5)];}else this[_0xd98b05(0x1dd)]=_0x47f639[_0xd98b05(0x1f5)];return undefined;}}return this[_0xd98b05(0x1c6)]=await getAPIKeyAsync(this['site'],this['activeProfile']||undefined),this[_0xd98b05(0x1c6)];}static async['createAsync'](_0x2c944f){const _0x34105e=a61_0x21f20a,_0x1d330f=new GlobalContext(_0x2c944f);return await _0x1d330f[_0x34105e(0x1ca)](),_0x1d330f;}}
@@ -1 +1 @@
1
- const a62_0x3cfc7c=a62_0x5c3b;(function(_0x366f93,_0x830528){const _0x30fef1=a62_0x5c3b,_0x25deba=_0x366f93();while(!![]){try{const _0x569265=-parseInt(_0x30fef1(0xce))/0x1+parseInt(_0x30fef1(0xaf))/0x2+-parseInt(_0x30fef1(0xca))/0x3+-parseInt(_0x30fef1(0xbb))/0x4+parseInt(_0x30fef1(0xc0))/0x5*(-parseInt(_0x30fef1(0xc6))/0x6)+-parseInt(_0x30fef1(0xc1))/0x7+parseInt(_0x30fef1(0xcb))/0x8*(parseInt(_0x30fef1(0xb9))/0x9);if(_0x569265===_0x830528)break;else _0x25deba['push'](_0x25deba['shift']());}catch(_0x121d98){_0x25deba['push'](_0x25deba['shift']());}}}(a62_0x3a7b,0x7214f));const SERVICE_NAME=a62_0x3cfc7c(0xb1);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x260737=a62_0x3cfc7c;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x513f0b=await import('@napi-rs/keyring');return EntryClass=_0x513f0b[_0x260737(0xb6)],EntryClass;}catch(_0x134bda){return keyringLoadError=_0x134bda instanceof Error?_0x134bda:new Error(String(_0x134bda)),null;}}function a62_0x3a7b(){const _0x47ae35=['27moDmnN','__keychain_test__','3221592BQDqDj','message','getPassword',':api_key','could\x20not\x20be\x20found','5GSGFOe','5904318CJHTMU','-25300','restricted','deleteCredential','includes','1620222ABCmyk','not_found','setPassword','profile:','2560182kVsCYn','8706032RITYKM','unavailable','reason','321112wnyReR','-25293','access_denied','System\x20keychain\x20is\x20not\x20available','591864welMpC','error','tdx','success','not\x20found','not\x20available','access','Entry','toLowerCase','Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'];a62_0x3a7b=function(){return _0x47ae35;};return a62_0x3a7b();}function a62_0x5c3b(_0x160d00,_0x5267aa){_0x160d00=_0x160d00-0xac;const _0x3a7bfe=a62_0x3a7b();let _0x5c3b7e=_0x3a7bfe[_0x160d00];return _0x5c3b7e;}function getAccountName(_0x2b07a2){const _0x3d743c=a62_0x3cfc7c,_0x3f97bb=_0x2b07a2||'';return _0x3d743c(0xc9)+_0x3f97bb+_0x3d743c(0xbe);}export async function getKeychainAPIKey(_0x31b04a){const _0x369851=a62_0x3cfc7c,_0x2f6beb=await getKeychainAPIKeyWithStatus(_0x31b04a);if(_0x2f6beb[_0x369851(0xb2)])return _0x2f6beb['value'];return _0x2f6beb[_0x369851(0xcd)]===_0x369851(0xad)&&console[_0x369851(0xb0)]('Warning:\x20'+_0x2f6beb['message']),null;}export async function getKeychainAPIKeyWithStatus(_0xb9a72c){const _0x397761=a62_0x3cfc7c;try{const _0x542ef6=await getEntryClass();if(!_0x542ef6)return{'success':![],'reason':_0x397761(0xcc)};const _0x117cd4=getAccountName(_0xb9a72c),_0x42a3c0=new _0x542ef6(SERVICE_NAME,_0x117cd4),_0x1066a8=_0x42a3c0[_0x397761(0xbd)]();if(_0x1066a8)return{'success':!![],'value':_0x1066a8};return{'success':![],'reason':_0x397761(0xc7)};}catch(_0x5475f3){const _0x1534ac=_0x5475f3 instanceof Error?_0x5475f3['message']:String(_0x5475f3);if(_0x1534ac[_0x397761(0xc5)](_0x397761(0xc2))||_0x1534ac[_0x397761(0xb7)]()[_0x397761(0xc5)](_0x397761(0xbf))||_0x1534ac[_0x397761(0xb7)]()[_0x397761(0xc5)](_0x397761(0xb3))||_0x1534ac[_0x397761(0xb7)]()['includes']('no\x20matching\x20entry'))return{'success':![],'reason':_0x397761(0xc7)};if(_0x1534ac[_0x397761(0xc5)](_0x397761(0xac))||_0x1534ac['toLowerCase']()[_0x397761(0xc5)](_0x397761(0xc3))||_0x1534ac['toLowerCase']()['includes'](_0x397761(0xb5)))return{'success':![],'reason':_0x397761(0xad),'message':_0x397761(0xb8)};return{'success':![],'reason':'unavailable','message':_0x1534ac};}}export async function saveKeychainAPIKey(_0x429d07,_0xe4b370){const _0x1c647f=a62_0x3cfc7c,_0x4abc82=await getEntryClass();if(!_0x4abc82)throw new Error(_0x1c647f(0xae));const _0x17fc81=getAccountName(_0xe4b370),_0x2c8d10=new _0x4abc82(SERVICE_NAME,_0x17fc81);_0x2c8d10[_0x1c647f(0xc8)](_0x429d07);}export async function deleteKeychainAPIKey(_0x5e8324){const _0x20d101=a62_0x3cfc7c;try{const _0x16e88c=await getEntryClass();if(!_0x16e88c)return![];const _0x43b8c1=getAccountName(_0x5e8324),_0x117c6b=new _0x16e88c(SERVICE_NAME,_0x43b8c1);return _0x117c6b[_0x20d101(0xc4)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x444df4=a62_0x3cfc7c;try{const _0xbb5e8a=await getEntryClass();if(!_0xbb5e8a)return![];const _0x5d6e71=new _0xbb5e8a(SERVICE_NAME,_0x444df4(0xba));return _0x5d6e71[_0x444df4(0xbd)](),!![];}catch(_0x7241e7){const _0x19eb75=_0x7241e7 instanceof Error?_0x7241e7[_0x444df4(0xbc)][_0x444df4(0xb7)]():'';if(_0x19eb75[_0x444df4(0xc5)](_0x444df4(0xb4))||_0x19eb75[_0x444df4(0xc5)]('not\x20supported')||_0x19eb75[_0x444df4(0xc5)]('cannot\x20find'))return![];return!![];}}
1
+ const a62_0x332135=a62_0x1982;(function(_0x46ba8e,_0x4f8e5f){const _0x5c07cc=a62_0x1982,_0x54272d=_0x46ba8e();while(!![]){try{const _0x1178f4=-parseInt(_0x5c07cc(0x184))/0x1*(parseInt(_0x5c07cc(0x182))/0x2)+-parseInt(_0x5c07cc(0x187))/0x3+-parseInt(_0x5c07cc(0x189))/0x4*(parseInt(_0x5c07cc(0x18c))/0x5)+parseInt(_0x5c07cc(0x19e))/0x6+parseInt(_0x5c07cc(0x19c))/0x7*(-parseInt(_0x5c07cc(0x191))/0x8)+-parseInt(_0x5c07cc(0x18e))/0x9+parseInt(_0x5c07cc(0x199))/0xa;if(_0x1178f4===_0x4f8e5f)break;else _0x54272d['push'](_0x54272d['shift']());}catch(_0x3a88ec){_0x54272d['push'](_0x54272d['shift']());}}}(a62_0xf925,0xd402f));function a62_0x1982(_0x118fc9,_0x235505){_0x118fc9=_0x118fc9-0x180;const _0xf925cd=a62_0xf925();let _0x198291=_0xf925cd[_0x118fc9];return _0x198291;}const SERVICE_NAME=a62_0x332135(0x183);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x553da3=a62_0x332135;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x3621e9=await import(_0x553da3(0x188));return EntryClass=_0x3621e9[_0x553da3(0x196)],EntryClass;}catch(_0x9ed453){return keyringLoadError=_0x9ed453 instanceof Error?_0x9ed453:new Error(String(_0x9ed453)),null;}}function getAccountName(_0x1f3f81){const _0x4899bc=a62_0x332135,_0x457751=_0x1f3f81||'';return _0x4899bc(0x185)+_0x457751+':api_key';}export async function getKeychainAPIKey(_0x811cc){const _0x25c1eb=a62_0x332135,_0x393c5e=await getKeychainAPIKeyWithStatus(_0x811cc);if(_0x393c5e[_0x25c1eb(0x18d)])return _0x393c5e[_0x25c1eb(0x1a0)];return _0x393c5e['reason']===_0x25c1eb(0x194)&&console[_0x25c1eb(0x190)]('Warning:\x20'+_0x393c5e['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x17f429){const _0x271600=a62_0x332135;try{const _0x5d511d=await getEntryClass();if(!_0x5d511d)return{'success':![],'reason':_0x271600(0x180)};const _0x56ca50=getAccountName(_0x17f429),_0x2a533e=new _0x5d511d(SERVICE_NAME,_0x56ca50),_0x2db5d3=_0x2a533e[_0x271600(0x181)]();if(_0x2db5d3)return{'success':!![],'value':_0x2db5d3};return{'success':![],'reason':_0x271600(0x197)};}catch(_0x24deb1){const _0xd3dcb=_0x24deb1 instanceof Error?_0x24deb1[_0x271600(0x19b)]:String(_0x24deb1);if(_0xd3dcb[_0x271600(0x193)](_0x271600(0x18a))||_0xd3dcb[_0x271600(0x192)]()[_0x271600(0x193)](_0x271600(0x195))||_0xd3dcb['toLowerCase']()['includes']('not\x20found')||_0xd3dcb[_0x271600(0x192)]()['includes'](_0x271600(0x19d)))return{'success':![],'reason':_0x271600(0x197)};if(_0xd3dcb['includes'](_0x271600(0x19a))||_0xd3dcb[_0x271600(0x192)]()[_0x271600(0x193)]('restricted')||_0xd3dcb[_0x271600(0x192)]()[_0x271600(0x193)](_0x271600(0x198)))return{'success':![],'reason':_0x271600(0x194),'message':'Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'};return{'success':![],'reason':_0x271600(0x180),'message':_0xd3dcb};}}export async function saveKeychainAPIKey(_0x21a333,_0x18eb31){const _0x2dfe9c=await getEntryClass();if(!_0x2dfe9c)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x5698d6=getAccountName(_0x18eb31),_0x23aff0=new _0x2dfe9c(SERVICE_NAME,_0x5698d6);_0x23aff0['setPassword'](_0x21a333);}export async function deleteKeychainAPIKey(_0x1eafec){const _0x5c8303=a62_0x332135;try{const _0x4e621c=await getEntryClass();if(!_0x4e621c)return![];const _0x23b362=getAccountName(_0x1eafec),_0x1668d2=new _0x4e621c(SERVICE_NAME,_0x23b362);return _0x1668d2[_0x5c8303(0x18b)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x488085=a62_0x332135;try{const _0x30ceca=await getEntryClass();if(!_0x30ceca)return![];const _0x143283=new _0x30ceca(SERVICE_NAME,'__keychain_test__');return _0x143283['getPassword'](),!![];}catch(_0x28f773){const _0xd50d25=_0x28f773 instanceof Error?_0x28f773['message']['toLowerCase']():'';if(_0xd50d25[_0x488085(0x193)](_0x488085(0x18f))||_0xd50d25[_0x488085(0x193)](_0x488085(0x19f))||_0xd50d25[_0x488085(0x193)](_0x488085(0x186)))return![];return!![];}}function a62_0xf925(){const _0x3fca07=['getPassword','2myBfMk','tdx','492097qNhHbu','profile:','cannot\x20find','4547979DNYxdQ','@napi-rs/keyring','60HCbMFw','-25300','deleteCredential','179635cJDkUn','success','366597UrNTKr','not\x20available','error','8WtbmWt','toLowerCase','includes','access_denied','could\x20not\x20be\x20found','Entry','not_found','access','39861190wdoawX','-25293','message','7625989kMlPFp','no\x20matching\x20entry','3356610kEfzrw','not\x20supported','value','unavailable'];a62_0xf925=function(){return _0x3fca07;};return a62_0xf925();}
@@ -1 +1 @@
1
- function a63_0x12d7(){const _0x380ac8=[':oauth_tokens','4UpHOGZ','setPassword','4479846Tnwhyu','1855068UhQiPz','15hfLeLg','tdx','3788781ScKXRW','parse','11tjxVPF','291190kExaHm','266557iiyOrZ','Entry','System\x20keychain\x20is\x20not\x20available','profile:','deleteCredential','24865630AygdsO','36xGbKMg','getPassword','2368504VEbUVM'];a63_0x12d7=function(){return _0x380ac8;};return a63_0x12d7();}const a63_0x4c518e=a63_0x2b9b;(function(_0x48d9fa,_0x2d136e){const _0x3a725a=a63_0x2b9b,_0x3037be=_0x48d9fa();while(!![]){try{const _0xa29472=parseInt(_0x3a725a(0x11d))/0x1+parseInt(_0x3a725a(0x11c))/0x2+parseInt(_0x3a725a(0x119))/0x3*(parseInt(_0x3a725a(0x127))/0x4)+parseInt(_0x3a725a(0x12b))/0x5*(parseInt(_0x3a725a(0x12a))/0x6)+-parseInt(_0x3a725a(0x129))/0x7+parseInt(_0x3a725a(0x125))/0x8*(parseInt(_0x3a725a(0x123))/0x9)+parseInt(_0x3a725a(0x122))/0xa*(-parseInt(_0x3a725a(0x11b))/0xb);if(_0xa29472===_0x2d136e)break;else _0x3037be['push'](_0x3037be['shift']());}catch(_0x4ba979){_0x3037be['push'](_0x3037be['shift']());}}}(a63_0x12d7,0xa1364));const SERVICE_NAME=a63_0x4c518e(0x12c);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x4841e4=a63_0x4c518e;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x261bce=await import('@napi-rs/keyring');return EntryClass=_0x261bce[_0x4841e4(0x11e)],EntryClass;}catch(_0x1b0ab6){return keyringLoadError=_0x1b0ab6 instanceof Error?_0x1b0ab6:new Error(String(_0x1b0ab6)),null;}}function getOAuthAccountName(_0x1b81e5){const _0x2592b1=a63_0x4c518e,_0x22c88c=_0x1b81e5||'';return _0x2592b1(0x120)+_0x22c88c+_0x2592b1(0x126);}function a63_0x2b9b(_0x14306d,_0x1a897e){_0x14306d=_0x14306d-0x119;const _0x12d734=a63_0x12d7();let _0x2b9b5f=_0x12d734[_0x14306d];return _0x2b9b5f;}export async function saveOAuthTokens(_0x22db2b,_0x3cfb7a){const _0x56d29e=a63_0x4c518e,_0x1c49a7=await getEntryClass();if(!_0x1c49a7)throw new Error(_0x56d29e(0x11f));const _0x28af1e=getOAuthAccountName(_0x3cfb7a),_0x7ca693=new _0x1c49a7(SERVICE_NAME,_0x28af1e);_0x7ca693[_0x56d29e(0x128)](JSON['stringify'](_0x22db2b));}export async function getOAuthTokens(_0x1b5172){const _0x97b515=a63_0x4c518e;try{const _0x441205=await getEntryClass();if(!_0x441205)return null;const _0x426dc2=getOAuthAccountName(_0x1b5172),_0x5de757=new _0x441205(SERVICE_NAME,_0x426dc2),_0x365dd1=_0x5de757[_0x97b515(0x124)]();if(_0x365dd1)return JSON[_0x97b515(0x11a)](_0x365dd1);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x2f172d){const _0x11017c=a63_0x4c518e;try{const _0xeb9b4f=await getEntryClass();if(!_0xeb9b4f)return![];const _0x49f743=getOAuthAccountName(_0x2f172d),_0x59de7f=new _0xeb9b4f(SERVICE_NAME,_0x49f743);return _0x59de7f[_0x11017c(0x121)](),!![];}catch{return![];}}
1
+ const a63_0x4c2e7a=a63_0x10af;(function(_0x329d05,_0x44cfe5){const _0x1890fd=a63_0x10af,_0x5aebc0=_0x329d05();while(!![]){try{const _0x34ef43=parseInt(_0x1890fd(0x152))/0x1*(parseInt(_0x1890fd(0x14b))/0x2)+-parseInt(_0x1890fd(0x15b))/0x3*(parseInt(_0x1890fd(0x14f))/0x4)+parseInt(_0x1890fd(0x157))/0x5*(parseInt(_0x1890fd(0x14c))/0x6)+parseInt(_0x1890fd(0x158))/0x7+parseInt(_0x1890fd(0x14a))/0x8+-parseInt(_0x1890fd(0x149))/0x9*(parseInt(_0x1890fd(0x15a))/0xa)+parseInt(_0x1890fd(0x156))/0xb;if(_0x34ef43===_0x44cfe5)break;else _0x5aebc0['push'](_0x5aebc0['shift']());}catch(_0x479fb9){_0x5aebc0['push'](_0x5aebc0['shift']());}}}(a63_0xb3fe,0x6337c));function a63_0xb3fe(){const _0x18e904=[':oauth_tokens','35830zCyzWR','69099mRiFSP','927suRVAV','1099464wACkNx','2trlYYY','996522GyLEZl','setPassword','tdx','60twwiUM','getPassword','stringify','104237ZIhGCg','parse','@napi-rs/keyring','deleteCredential','432014yCUsmp','5frZvoE','4717363sOKtyL'];a63_0xb3fe=function(){return _0x18e904;};return a63_0xb3fe();}const SERVICE_NAME=a63_0x4c2e7a(0x14e);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x199c34=a63_0x4c2e7a;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x47c9cb=await import(_0x199c34(0x154));return EntryClass=_0x47c9cb['Entry'],EntryClass;}catch(_0x4fc8ae){return keyringLoadError=_0x4fc8ae instanceof Error?_0x4fc8ae:new Error(String(_0x4fc8ae)),null;}}function a63_0x10af(_0x5e1cc6,_0x1fd672){_0x5e1cc6=_0x5e1cc6-0x149;const _0xb3fed1=a63_0xb3fe();let _0x10af2a=_0xb3fed1[_0x5e1cc6];return _0x10af2a;}function getOAuthAccountName(_0x2ba763){const _0x72864d=a63_0x4c2e7a,_0x221716=_0x2ba763||'';return'profile:'+_0x221716+_0x72864d(0x159);}export async function saveOAuthTokens(_0x583829,_0x416eff){const _0x4cea01=a63_0x4c2e7a,_0x4d303c=await getEntryClass();if(!_0x4d303c)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x30425e=getOAuthAccountName(_0x416eff),_0x4cf306=new _0x4d303c(SERVICE_NAME,_0x30425e);_0x4cf306[_0x4cea01(0x14d)](JSON[_0x4cea01(0x151)](_0x583829));}export async function getOAuthTokens(_0x27d192){const _0x22d72c=a63_0x4c2e7a;try{const _0x4fc806=await getEntryClass();if(!_0x4fc806)return null;const _0xd9cd03=getOAuthAccountName(_0x27d192),_0x7e428=new _0x4fc806(SERVICE_NAME,_0xd9cd03),_0x90fb05=_0x7e428[_0x22d72c(0x150)]();if(_0x90fb05)return JSON[_0x22d72c(0x153)](_0x90fb05);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x2b67b0){const _0x255bab=a63_0x4c2e7a;try{const _0x21551d=await getEntryClass();if(!_0x21551d)return![];const _0xe1419=getOAuthAccountName(_0x2b67b0),_0x3fa062=new _0x21551d(SERVICE_NAME,_0xe1419);return _0x3fa062[_0x255bab(0x155)](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- const a64_0x1caaa6=a64_0x57f7;(function(_0x57257a,_0x1d5a93){const _0x42a1a0=a64_0x57f7,_0x304ede=_0x57257a();while(!![]){try{const _0x2e465c=parseInt(_0x42a1a0(0xfb))/0x1*(parseInt(_0x42a1a0(0xea))/0x2)+-parseInt(_0x42a1a0(0xfc))/0x3+-parseInt(_0x42a1a0(0xca))/0x4+parseInt(_0x42a1a0(0xe6))/0x5*(parseInt(_0x42a1a0(0xcd))/0x6)+-parseInt(_0x42a1a0(0xed))/0x7*(-parseInt(_0x42a1a0(0x107))/0x8)+-parseInt(_0x42a1a0(0xf9))/0x9+parseInt(_0x42a1a0(0x102))/0xa;if(_0x2e465c===_0x1d5a93)break;else _0x304ede['push'](_0x304ede['shift']());}catch(_0x24d747){_0x304ede['push'](_0x304ede['shift']());}}}(a64_0x3bae,0xc4fca));import*as a64_0x52d5d6 from'node:crypto';import*as a64_0x3d29e0 from'node:http';function a64_0x3bae(){const _0x328f39=['redirect_to_path','account_name','text','replace','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','now','S256','text/plain','code','set','createHash','code_challenge','authorization_code','toString','randomBytes','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','codeChallenge','error','response_type','end','close','scope','digest','http://localhost:','5JcWQFv','Not\x20Found','sha256','update','1934764kcnjSg','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','writeHead','14HSlnlt','text/html','/oauth/authorize','accountName','redirectUri','127.0.0.1','access_token','/oauth/callback','searchParams','client_id','hex','pathname','2575701HwaZab','expires_in','1JxGsZi','1252656dKmlUy','url','):\x20','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','code_challenge_method','get','5093510kgOakM','Port\x20','state','message','OAuth\x20token\x20request\x20failed\x20(','5222696Wnvlfm','listen','base64url','POST','5415480wnQWrq','/oauth/token','clientId','492372eGxNmJ'];a64_0x3bae=function(){return _0x328f39;};return a64_0x3bae();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a64_0x1caaa6(0xe5)+OAUTH_CALLBACK_PORT+a64_0x1caaa6(0xf4);export function getOAuthClientId(){return process.env.TD_OAUTH_CLIENT_ID||'tdx';}export function generatePKCEPair(){const _0x23b833=a64_0x1caaa6,_0x33d53d=a64_0x52d5d6[_0x23b833(0xdc)](0x20)[_0x23b833(0xdb)](_0x23b833(0xc8)),_0x3958aa=a64_0x52d5d6[_0x23b833(0xd8)](_0x23b833(0xe8))[_0x23b833(0xe9)](_0x33d53d)[_0x23b833(0xe4)](_0x23b833(0xc8));return{'verifier':_0x33d53d,'challenge':_0x3958aa};}export function buildAuthorizeURL(_0xf36be,_0x3b9c3f){const _0x13a7a7=a64_0x1caaa6,_0x15b59d=new URL(_0x13a7a7(0xef),_0xf36be);return _0x15b59d[_0x13a7a7(0xf5)][_0x13a7a7(0xd7)](_0x13a7a7(0xe0),'code'),_0x15b59d['searchParams'][_0x13a7a7(0xd7)](_0x13a7a7(0xf6),_0x3b9c3f[_0x13a7a7(0xcc)]),_0x15b59d[_0x13a7a7(0xf5)][_0x13a7a7(0xd7)]('redirect_uri',_0x3b9c3f[_0x13a7a7(0xf1)]),_0x15b59d['searchParams'][_0x13a7a7(0xd7)](_0x13a7a7(0x104),_0x3b9c3f['state']),_0x15b59d[_0x13a7a7(0xf5)][_0x13a7a7(0xd7)](_0x13a7a7(0xd9),_0x3b9c3f[_0x13a7a7(0xde)]),_0x15b59d[_0x13a7a7(0xf5)]['set'](_0x13a7a7(0x100),_0x13a7a7(0xd4)),_0x3b9c3f['scope']&&_0x15b59d[_0x13a7a7(0xf5)]['set']('scope',_0x3b9c3f['scope']),_0x15b59d[_0x13a7a7(0xdb)]();}export function buildSSOInitiateURL(_0x5cce16,_0x527c51,_0x19cfd9){const _0x223c28=a64_0x1caaa6,_0x5e34c3=new URL('/users/initiate_sso',_0x5cce16);_0x5e34c3[_0x223c28(0xf5)][_0x223c28(0xd7)](_0x223c28(0xcf),_0x527c51);const _0x36c171=_0x19cfd9[_0x223c28(0xd1)](_0x5cce16,'');return _0x5e34c3['searchParams'][_0x223c28(0xd7)](_0x223c28(0xce),_0x36c171),_0x5e34c3[_0x223c28(0xdb)]();}export async function postTokenRequest(_0x128d7d,_0x4d0fff){const _0x1afb19=a64_0x1caaa6,_0x1c7162=new URLSearchParams(_0x4d0fff)[_0x1afb19(0xdb)](),_0x549df9=await fetch(_0x128d7d,{'method':_0x1afb19(0xc9),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x1c7162});if(!_0x549df9['ok']){const _0x53fd84=await _0x549df9[_0x1afb19(0xd0)]();throw new Error(_0x1afb19(0x106)+_0x549df9['status']+_0x1afb19(0xfe)+_0x53fd84);}const _0x4a6e24=await _0x549df9['json']();return{'access_token':_0x4a6e24[_0x1afb19(0xf3)],'refresh_token':_0x4a6e24['refresh_token'],'scope':_0x4a6e24[_0x1afb19(0xe3)],'expires_at':_0x4a6e24[_0x1afb19(0xfa)]?Date[_0x1afb19(0xd3)]()+_0x4a6e24[_0x1afb19(0xfa)]*0x3e8:undefined};}function a64_0x57f7(_0x5bc8a9,_0x37e10c){_0x5bc8a9=_0x5bc8a9-0xc8;const _0x3bae8e=a64_0x3bae();let _0x57f780=_0x3bae8e[_0x5bc8a9];return _0x57f780;}export async function exchangeCodeForTokens(_0x4ac360,_0x5b13fd,_0x112ae3,_0x1f3ea3){const _0x4a2aab=a64_0x1caaa6,_0x346771=_0x4ac360+_0x4a2aab(0xcb);return postTokenRequest(_0x346771,{'grant_type':_0x4a2aab(0xda),'client_id':getOAuthClientId(),'code':_0x5b13fd,'code_verifier':_0x112ae3,'redirect_uri':_0x1f3ea3});}export function startLocalCallbackServer(){const _0x36810a=a64_0x1caaa6;let _0x30688b,_0x561545;const _0x4d3737=new Promise((_0x682f3e,_0x27126b)=>{_0x30688b=_0x682f3e,_0x561545=_0x27126b;}),_0x1e6489=a64_0x3d29e0['createServer']((_0x44304a,_0x31cbba)=>{const _0x32a44b=a64_0x57f7,_0x59e75a=new URL(_0x44304a[_0x32a44b(0xfd)]||'/','http://127.0.0.1');if(_0x59e75a[_0x32a44b(0xf8)]!=='/oauth/callback'){_0x31cbba[_0x32a44b(0xec)](0x194,{'Content-Type':_0x32a44b(0xd5)}),_0x31cbba[_0x32a44b(0xe1)](_0x32a44b(0xe7));return;}const _0x28a0e6=_0x59e75a['searchParams']['get'](_0x32a44b(0xd6)),_0x3b1228=_0x59e75a[_0x32a44b(0xf5)]['get'](_0x32a44b(0x104)),_0x2c981a=_0x59e75a[_0x32a44b(0xf5)][_0x32a44b(0x101)](_0x32a44b(0xdf));if(_0x2c981a||!_0x28a0e6||!_0x3b1228){_0x31cbba[_0x32a44b(0xec)](0x190,{'Content-Type':'text/html'}),_0x31cbba[_0x32a44b(0xe1)](_0x32a44b(0xdd)),_0x561545(new Error('OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters'));return;}_0x31cbba[_0x32a44b(0xec)](0xc8,{'Content-Type':_0x32a44b(0xee)}),_0x31cbba['end'](_0x32a44b(0xeb)),_0x30688b({'code':_0x28a0e6,'state':_0x3b1228});});_0x1e6489['on']('error',_0x343cdc=>{const _0x332631=a64_0x57f7;_0x343cdc[_0x332631(0xd6)]==='EADDRINUSE'?_0x561545(new Error(_0x332631(0x103)+OAUTH_CALLBACK_PORT+_0x332631(0xd2))):_0x561545(new Error('Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20'+_0x343cdc[_0x332631(0x105)]));}),_0x1e6489[_0x36810a(0x108)](OAUTH_CALLBACK_PORT,_0x36810a(0xf2));const _0x29f9f7=setTimeout(()=>{const _0xf1be1e=_0x36810a;_0x561545(new Error('OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes')),_0x1e6489[_0xf1be1e(0xe2)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x4d3737,'close':()=>{const _0x169af7=_0x36810a;clearTimeout(_0x29f9f7),_0x1e6489[_0x169af7(0xe2)]();}};}export async function startOAuthFlow(_0x56c49f,_0x1db6cd){const _0x11802c=a64_0x1caaa6,_0x51c7d6=getConsoleUrl(_0x56c49f),_0x1394da=getOAuthClientId(),{verifier:_0x20039a,challenge:_0x1c2348}=generatePKCEPair(),_0x3f884d=a64_0x52d5d6[_0x11802c(0xdc)](0x10)[_0x11802c(0xdb)](_0x11802c(0xf7)),_0x277a93=startLocalCallbackServer();try{const _0x28458b=OAUTH_REDIRECT_URI,_0x4fb063=buildAuthorizeURL(_0x51c7d6,{'clientId':_0x1394da,'redirectUri':_0x28458b,'state':_0x3f884d,'codeChallenge':_0x1c2348,'scope':'openid\x20email\x20profile'}),_0x388f24=_0x1db6cd?.[_0x11802c(0xf0)]?buildSSOInitiateURL(_0x51c7d6,_0x1db6cd['accountName'],_0x4fb063):_0x4fb063;openBrowser(_0x388f24);const _0x53df8a=await _0x277a93['waitForCallback']();if(_0x53df8a['state']!==_0x3f884d)throw new Error(_0x11802c(0xff));return await exchangeCodeForTokens(_0x51c7d6,_0x53df8a[_0x11802c(0xd6)],_0x20039a,_0x28458b);}finally{_0x277a93['close']();}}
1
+ const a64_0x373735=a64_0x5028;(function(_0x382514,_0x5652dd){const _0x156a71=a64_0x5028,_0x527ff7=_0x382514();while(!![]){try{const _0x20511e=parseInt(_0x156a71(0xbe))/0x1+-parseInt(_0x156a71(0xa7))/0x2*(-parseInt(_0x156a71(0x95))/0x3)+parseInt(_0x156a71(0xc9))/0x4*(parseInt(_0x156a71(0xb7))/0x5)+-parseInt(_0x156a71(0x9d))/0x6*(-parseInt(_0x156a71(0xbb))/0x7)+-parseInt(_0x156a71(0xbc))/0x8*(-parseInt(_0x156a71(0xb6))/0x9)+-parseInt(_0x156a71(0xca))/0xa*(-parseInt(_0x156a71(0xb9))/0xb)+-parseInt(_0x156a71(0xa6))/0xc*(parseInt(_0x156a71(0xab))/0xd);if(_0x20511e===_0x5652dd)break;else _0x527ff7['push'](_0x527ff7['shift']());}catch(_0xda6fee){_0x527ff7['push'](_0x527ff7['shift']());}}}(a64_0x5193,0xa6152));import*as a64_0x274d3c from'node:crypto';import*as a64_0x427dbc from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a64_0x373735(0xaa)+OAUTH_CALLBACK_PORT+'/oauth/callback';export function getOAuthClientId(){const _0x5018cb=a64_0x373735;return process.env.TD_OAUTH_CLIENT_ID||_0x5018cb(0xd0);}function a64_0x5028(_0x4dd310,_0x1e53da){_0x4dd310=_0x4dd310-0x8a;const _0x5193d3=a64_0x5193();let _0x50282e=_0x5193d3[_0x4dd310];return _0x50282e;}export function generatePKCEPair(){const _0x232e91=a64_0x373735,_0x58cc8c=a64_0x274d3c[_0x232e91(0xb0)](0x20)[_0x232e91(0x8e)](_0x232e91(0x98)),_0x44b405=a64_0x274d3c['createHash'](_0x232e91(0x92))[_0x232e91(0xa8)](_0x58cc8c)[_0x232e91(0xc2)]('base64url');return{'verifier':_0x58cc8c,'challenge':_0x44b405};}export function buildAuthorizeURL(_0x45caac,_0x9867d4){const _0x2617b6=a64_0x373735,_0x31be5f=new URL('/oauth/authorize',_0x45caac);return _0x31be5f[_0x2617b6(0xb1)][_0x2617b6(0xc5)](_0x2617b6(0xcc),_0x2617b6(0x8d)),_0x31be5f[_0x2617b6(0xb1)][_0x2617b6(0xc5)](_0x2617b6(0x93),_0x9867d4['clientId']),_0x31be5f['searchParams'][_0x2617b6(0xc5)](_0x2617b6(0xb5),_0x9867d4['redirectUri']),_0x31be5f[_0x2617b6(0xb1)][_0x2617b6(0xc5)](_0x2617b6(0xce),_0x9867d4[_0x2617b6(0xce)]),_0x31be5f[_0x2617b6(0xb1)][_0x2617b6(0xc5)](_0x2617b6(0x8a),_0x9867d4[_0x2617b6(0xa4)]),_0x31be5f[_0x2617b6(0xb1)][_0x2617b6(0xc5)](_0x2617b6(0x8b),_0x2617b6(0xba)),_0x9867d4[_0x2617b6(0x96)]&&_0x31be5f[_0x2617b6(0xb1)][_0x2617b6(0xc5)](_0x2617b6(0x96),_0x9867d4['scope']),_0x31be5f[_0x2617b6(0x8e)]();}export function buildSSOInitiateURL(_0xef9d8a,_0x4fe0c9,_0x2e7c81){const _0x5903c9=a64_0x373735,_0x577868=new URL('/users/initiate_sso',_0xef9d8a);_0x577868['searchParams'][_0x5903c9(0xc5)](_0x5903c9(0xb2),_0x4fe0c9);const _0x3e94cd=_0x2e7c81[_0x5903c9(0x94)](_0xef9d8a,'');return _0x577868[_0x5903c9(0xb1)]['set'](_0x5903c9(0xbd),_0x3e94cd),_0x577868[_0x5903c9(0x8e)]();}export async function postTokenRequest(_0x2466bd,_0x485ea1){const _0x5381ef=a64_0x373735,_0x2428bc=new URLSearchParams(_0x485ea1)[_0x5381ef(0x8e)](),_0x26f307=await fetch(_0x2466bd,{'method':_0x5381ef(0x9a),'headers':{'Content-Type':_0x5381ef(0xa0)},'body':_0x2428bc});if(!_0x26f307['ok']){const _0x17f4f4=await _0x26f307[_0x5381ef(0xaf)]();throw new Error('OAuth\x20token\x20request\x20failed\x20('+_0x26f307[_0x5381ef(0xc0)]+_0x5381ef(0x9b)+_0x17f4f4);}const _0x30b6c4=await _0x26f307[_0x5381ef(0xa9)]();return{'access_token':_0x30b6c4[_0x5381ef(0x99)],'refresh_token':_0x30b6c4[_0x5381ef(0xc7)],'scope':_0x30b6c4[_0x5381ef(0x96)],'expires_at':_0x30b6c4[_0x5381ef(0xcb)]?Date[_0x5381ef(0x9e)]()+_0x30b6c4[_0x5381ef(0xcb)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x27947d,_0x46366a,_0x5f6276,_0x28503c){const _0x442ad5=a64_0x373735,_0x498f0b=_0x27947d+_0x442ad5(0xc3);return postTokenRequest(_0x498f0b,{'grant_type':_0x442ad5(0xc8),'client_id':getOAuthClientId(),'code':_0x46366a,'code_verifier':_0x5f6276,'redirect_uri':_0x28503c});}export function startLocalCallbackServer(){const _0x4c8784=a64_0x373735;let _0x560940,_0x57a2c9;const _0x3a3ae4=new Promise((_0x288838,_0xf15328)=>{_0x560940=_0x288838,_0x57a2c9=_0xf15328;}),_0x3e4756=a64_0x427dbc[_0x4c8784(0x90)]((_0x99ed33,_0x4e57f2)=>{const _0x58462b=_0x4c8784,_0x3c1ccd=new URL(_0x99ed33[_0x58462b(0x97)]||'/',_0x58462b(0xcf));if(_0x3c1ccd['pathname']!==_0x58462b(0x91)){_0x4e57f2[_0x58462b(0xb3)](0x194,{'Content-Type':_0x58462b(0xbf)}),_0x4e57f2[_0x58462b(0xb8)](_0x58462b(0xa2));return;}const _0x5115df=_0x3c1ccd['searchParams'][_0x58462b(0xc1)]('code'),_0x2d8a7c=_0x3c1ccd[_0x58462b(0xb1)]['get'](_0x58462b(0xce)),_0x23f75d=_0x3c1ccd[_0x58462b(0xb1)][_0x58462b(0xc1)](_0x58462b(0x9c));if(_0x23f75d||!_0x5115df||!_0x2d8a7c){_0x4e57f2[_0x58462b(0xb3)](0x190,{'Content-Type':'text/html'}),_0x4e57f2['end']('<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>'),_0x57a2c9(new Error(_0x58462b(0x8f)));return;}_0x4e57f2['writeHead'](0xc8,{'Content-Type':_0x58462b(0xa1)}),_0x4e57f2[_0x58462b(0xb8)](_0x58462b(0xa3)),_0x560940({'code':_0x5115df,'state':_0x2d8a7c});});_0x3e4756['on'](_0x4c8784(0x9c),_0x4aad01=>{const _0x32c4cf=_0x4c8784;_0x4aad01[_0x32c4cf(0x8d)]===_0x32c4cf(0xc6)?_0x57a2c9(new Error(_0x32c4cf(0xb4)+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0x57a2c9(new Error(_0x32c4cf(0xac)+_0x4aad01[_0x32c4cf(0xc4)]));}),_0x3e4756[_0x4c8784(0x8c)](OAUTH_CALLBACK_PORT,_0x4c8784(0xad));const _0x3b8e08=setTimeout(()=>{const _0x1049de=_0x4c8784;_0x57a2c9(new Error('OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes')),_0x3e4756[_0x1049de(0xae)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x3a3ae4,'close':()=>{const _0x24367b=_0x4c8784;clearTimeout(_0x3b8e08),_0x3e4756[_0x24367b(0xae)]();}};}export async function startOAuthFlow(_0x49f71c,_0x386e9e){const _0x21b2ea=a64_0x373735,_0x25b098=getConsoleUrl(_0x49f71c),_0x362094=getOAuthClientId(),{verifier:_0xfd9072,challenge:_0x5eb539}=generatePKCEPair(),_0x268703=a64_0x274d3c[_0x21b2ea(0xb0)](0x10)[_0x21b2ea(0x8e)](_0x21b2ea(0x9f)),_0x1e6abb=startLocalCallbackServer();try{const _0x26e9a6=OAUTH_REDIRECT_URI,_0x1df365=buildAuthorizeURL(_0x25b098,{'clientId':_0x362094,'redirectUri':_0x26e9a6,'state':_0x268703,'codeChallenge':_0x5eb539,'scope':'openid\x20email\x20profile'}),_0x206270=_0x386e9e?.[_0x21b2ea(0xcd)]?buildSSOInitiateURL(_0x25b098,_0x386e9e[_0x21b2ea(0xcd)],_0x1df365):_0x1df365;openBrowser(_0x206270);const _0x3a0d7d=await _0x1e6abb[_0x21b2ea(0xa5)]();if(_0x3a0d7d[_0x21b2ea(0xce)]!==_0x268703)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x25b098,_0x3a0d7d[_0x21b2ea(0x8d)],_0xfd9072,_0x26e9a6);}finally{_0x1e6abb[_0x21b2ea(0xae)]();}}function a64_0x5193(){const _0x2abd5c=['codeChallenge','waitForCallback','57461016yQGCwC','2UMSgMU','update','json','http://localhost:','13IqAWMl','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','127.0.0.1','close','text','randomBytes','searchParams','account_name','writeHead','Port\x20','redirect_uri','2320911jrprhc','115nNBBdr','end','33HyZzrq','S256','1288798jVYPTu','24EiwfTX','redirect_to_path','601293ptUfMF','text/plain','status','get','digest','/oauth/token','message','set','EADDRINUSE','refresh_token','authorization_code','88076cssKRn','3418040IFgVpH','expires_in','response_type','accountName','state','http://127.0.0.1','tdx','code_challenge','code_challenge_method','listen','code','toString','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','createServer','/oauth/callback','sha256','client_id','replace','3819345AZYbsp','scope','url','base64url','access_token','POST','):\x20','error','42fDFFPH','now','hex','application/x-www-form-urlencoded','text/html','Not\x20Found','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>'];a64_0x5193=function(){return _0x2abd5c;};return a64_0x5193();}
@@ -1 +1 @@
1
- const a65_0x5c6e7a=a65_0x7302;(function(_0x4cfc81,_0x5c9c4a){const _0x140499=a65_0x7302,_0x460619=_0x4cfc81();while(!![]){try{const _0x128964=-parseInt(_0x140499(0xcb))/0x1*(parseInt(_0x140499(0xc7))/0x2)+parseInt(_0x140499(0xb6))/0x3+-parseInt(_0x140499(0xb8))/0x4*(-parseInt(_0x140499(0xce))/0x5)+parseInt(_0x140499(0xd1))/0x6+-parseInt(_0x140499(0x9f))/0x7*(parseInt(_0x140499(0xbe))/0x8)+-parseInt(_0x140499(0x95))/0x9*(-parseInt(_0x140499(0xb3))/0xa)+-parseInt(_0x140499(0x9c))/0xb;if(_0x128964===_0x5c9c4a)break;else _0x460619['push'](_0x460619['shift']());}catch(_0x1f973a){_0x460619['push'](_0x460619['shift']());}}}(a65_0x379d,0x5c3d6));import*as a65_0x466710 from'node:fs';import*as a65_0x5caf8d from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a65_0x5c6e7a(0xa3);export function getProfileParams(_0x115f37){const _0x3ada24=a65_0x5c6e7a,_0xb312fc={};if(!_0x115f37)return _0xb312fc;for(const [_0x228664,_0x3cd8e9]of Object[_0x3ada24(0xd4)](_0x115f37)){_0x228664!==_0x3ada24(0xbc)&&_0x3cd8e9!==undefined&&(_0xb312fc[_0x228664]=_0x3cd8e9);}return _0xb312fc;}export function getProfilesDir(){const _0x147018=a65_0x5c6e7a;return a65_0x5caf8d[_0x147018(0xcc)](getConfigDir(),_0x147018(0xb5));}function getProfileDir(_0x1d4af3){const _0x173880=a65_0x5c6e7a;return a65_0x5caf8d[_0x173880(0xcc)](getProfilesDir(),_0x1d4af3);}function getProfileConfigPath(_0x21dbce){const _0x2a56c1=a65_0x5c6e7a;return a65_0x5caf8d['join'](getProfileDir(_0x21dbce),_0x2a56c1(0xdd));}function getProfileEnvPath(_0xa75509){const _0x414bbc=a65_0x5c6e7a;return a65_0x5caf8d[_0x414bbc(0xcc)](getProfileDir(_0xa75509),_0x414bbc(0x96));}function getGlobalConfigPath(){return a65_0x5caf8d['join'](getConfigDir(),'tdx.json');}function validateProfileName(_0x3c20c3){const _0x45f6e9=a65_0x5c6e7a;if(/^@?[a-zA-Z0-9_-]+$/[_0x45f6e9(0xbd)](_0x3c20c3))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x45f6e9(0xbd)](_0x3c20c3))return;throw new Error(_0x45f6e9(0xc3)+_0x3c20c3+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0xefd4c5,_0x5abfe4){const _0x7c35fa=a65_0x5c6e7a;if(typeof _0xefd4c5!==_0x7c35fa(0xa4)||_0xefd4c5===null)throw new SDKError(ErrorCode[_0x7c35fa(0xa0)],'Profile\x20\x27'+_0x5abfe4+_0x7c35fa(0xc2));const _0x42dfd2=[_0x7c35fa(0xbc),_0x7c35fa(0x98),_0x7c35fa(0xad),_0x7c35fa(0xa6),_0x7c35fa(0xb0),_0x7c35fa(0xca),_0x7c35fa(0xa2),_0x7c35fa(0xa7)],_0x2bc433=_0xefd4c5;for(const _0x1f2994 of Object[_0x7c35fa(0xc4)](_0x2bc433)){!_0x42dfd2[_0x7c35fa(0xd7)](_0x1f2994)&&console[_0x7c35fa(0x97)](_0x7c35fa(0xcf)+_0x5abfe4+_0x7c35fa(0xc6)+_0x1f2994+_0x7c35fa(0xd6));}const _0x26dd86=_0x42dfd2[_0x7c35fa(0xa8)](_0x21355d=>_0x21355d!==_0x7c35fa(0xa7));for(const _0x2de4eb of _0x26dd86){if(_0x2bc433[_0x2de4eb]!==undefined&&typeof _0x2bc433[_0x2de4eb]!=='string')throw new SDKError(ErrorCode[_0x7c35fa(0xa0)],_0x7c35fa(0xdc)+_0x5abfe4+_0x7c35fa(0xe2)+_0x2de4eb+_0x7c35fa(0x9d));}return!![];}function loadProfilesFromTdxJson(_0x4643f6,_0x4ecb71){const _0x59d1f5=a65_0x5c6e7a;if(!a65_0x466710[_0x59d1f5(0xb2)](_0x4643f6))return[];try{const _0x57676c=a65_0x466710[_0x59d1f5(0xc1)](_0x4643f6,_0x59d1f5(0xa5)),_0x95248f=JSON[_0x59d1f5(0xae)](_0x57676c);if(!_0x95248f['profiles']||typeof _0x95248f[_0x59d1f5(0xb5)]!==_0x59d1f5(0xa4))return[];const _0x475ea9=[];for(const [_0x3e409d,_0x54b966]of Object[_0x59d1f5(0xd4)](_0x95248f[_0x59d1f5(0xb5)])){try{validateProfileConfig(_0x54b966,_0x3e409d);const _0x4e0de0=getNewCredentialPath(_0x3e409d),_0x55943d=getOldCredentialPath(_0x3e409d),_0x49ea85=a65_0x466710['existsSync'](_0x4e0de0)||a65_0x466710[_0x59d1f5(0xb2)](_0x55943d);_0x475ea9[_0x59d1f5(0x9a)]({'name':_0x3e409d,'config':_0x54b966,'metadata':{'name':_0x3e409d,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x49ea85,'scope':_0x4ecb71});}catch(_0x54dc20){_0x54dc20 instanceof Error&&(console[_0x59d1f5(0x97)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x4643f6+':'),console[_0x59d1f5(0x97)]('\x20\x20'+_0x54dc20[_0x59d1f5(0xab)]+'\x0a'));}}return _0x475ea9;}catch(_0x283a80){return _0x283a80 instanceof SyntaxError?(console[_0x59d1f5(0x97)](_0x59d1f5(0xb9)+_0x4643f6+_0x59d1f5(0xb4)),console[_0x59d1f5(0x97)](_0x59d1f5(0xa1)+_0x283a80['message']+'\x0a')):console['warn']('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x4643f6+':\x20'+_0x283a80+'\x0a'),[];}}export function getNewCredentialPath(_0x2d1cfe){const _0xc28358=a65_0x5c6e7a;return a65_0x5caf8d[_0xc28358(0xcc)](getConfigDir(),_0xc28358(0xaf)+_0x2d1cfe);}function getOldCredentialPath(_0x4b688c){const _0xba0bb8=a65_0x5c6e7a;return a65_0x5caf8d[_0xba0bb8(0xcc)](getProfilesDir(),_0x4b688c,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x3de320=a65_0x5c6e7a,_0x15b9b4=[],_0x4a6aca=findProjectConfigPath();_0x4a6aca&&_0x15b9b4['push'](...loadProfilesFromTdxJson(_0x4a6aca,'local'));const _0x251004=a65_0x5caf8d[_0x3de320(0xcc)](getConfigDir(),_0x3de320(0xdd));return _0x15b9b4[_0x3de320(0x9a)](...loadProfilesFromTdxJson(_0x251004,'user')),_0x15b9b4;}function loadProfilesFromDirectories(){const _0x31ec47=a65_0x5c6e7a,_0xf92d1=getProfilesDir();if(!a65_0x466710[_0x31ec47(0xb2)](_0xf92d1))return[];try{return a65_0x466710['readdirSync'](_0xf92d1,{'withFileTypes':!![]})[_0x31ec47(0xa8)](_0x110c5d=>_0x110c5d[_0x31ec47(0xb1)]())['map'](_0x1a0b38=>_0x1a0b38[_0x31ec47(0xba)])[_0x31ec47(0xa8)](_0x3d1a43=>{const _0x3e2db0=_0x31ec47,_0x4e910a=getProfileConfigPath(_0x3d1a43),_0x3d1938=getProfileEnvPath(_0x3d1a43);return a65_0x466710[_0x3e2db0(0xb2)](_0x4e910a)||a65_0x466710[_0x3e2db0(0xb2)](_0x3d1938);})[_0x31ec47(0xcd)](_0x3b711e=>{const _0x47a46a=loadProfileFromDirectory(_0x3b711e);if(_0x47a46a)return{..._0x47a46a,'scope':'directory'};return null;})[_0x31ec47(0xa8)](_0x4cbe5b=>_0x4cbe5b!==null);}catch{return[];}}function loadProfileFromDirectory(_0xf301fe){const _0x3025f8=a65_0x5c6e7a,_0x5182c9=getProfileConfigPath(_0xf301fe),_0x15382f=getOldCredentialPath(_0xf301fe);if(!a65_0x466710[_0x3025f8(0xb2)](_0x5182c9)&&!a65_0x466710[_0x3025f8(0xb2)](_0x15382f))return null;let _0xf23937={},_0x3e653b={'name':_0xf301fe,'createdAt':new Date()[_0x3025f8(0xdf)]()};if(a65_0x466710['existsSync'](_0x5182c9))try{const _0x5c9909=a65_0x466710['readFileSync'](_0x5182c9,'utf-8'),_0x476fdc=JSON['parse'](_0x5c9909),{metadata:_0x437b32,..._0x46db97}=_0x476fdc;_0xf23937=_0x46db97,_0x437b32&&(_0x3e653b=_0x437b32);}catch{}return{'name':_0xf301fe,'config':_0xf23937,'metadata':_0x3e653b,'hasCredentials':a65_0x466710[_0x3025f8(0xb2)](_0x15382f),'scope':_0x3025f8(0xdb)};}export function listProfiles(){const _0x438f15=a65_0x5c6e7a,_0x341fed=loadProfilesFromTdxJsonFiles(),_0x3cc410=loadProfilesFromDirectories();if(_0x3cc410[_0x438f15(0x99)]>0x0){const _0x20e505=_0x3cc410[_0x438f15(0xcd)](_0x5b66e6=>_0x5b66e6[_0x438f15(0xba)])[_0x438f15(0xcc)](',\x20'),_0x3133b7=getConfigDir();console[_0x438f15(0x97)](_0x438f15(0xb7)+_0x20e505),console[_0x438f15(0x97)](_0x438f15(0xe3)),console[_0x438f15(0x97)]('\x20\x201.\x20Edit:\x20'+a65_0x5caf8d[_0x438f15(0xcc)](_0x3133b7,_0x438f15(0xdd))),console[_0x438f15(0x97)](_0x438f15(0xaa)),console[_0x438f15(0x97)](_0x438f15(0xc8));}const _0x517de2=[..._0x341fed,..._0x3cc410],_0x3c79c6=new Map();for(const _0x18fd6a of _0x517de2){!_0x3c79c6[_0x438f15(0xd5)](_0x18fd6a[_0x438f15(0xba)])&&_0x3c79c6[_0x438f15(0x9e)](_0x18fd6a[_0x438f15(0xba)],_0x18fd6a);}return Array[_0x438f15(0xc9)](_0x3c79c6[_0x438f15(0xac)]())[_0x438f15(0xbf)]((_0x2c8b7b,_0x117393)=>_0x2c8b7b[_0x438f15(0xba)][_0x438f15(0xd9)](_0x117393[_0x438f15(0xba)]));}export function profileExists(_0x33167e){const _0x53a140=listProfiles();return _0x53a140['some'](_0x265817=>_0x265817['name']===_0x33167e);}export function loadProfile(_0x314548){const _0x25d0ee=a65_0x5c6e7a;validateProfileName(_0x314548);const _0x3d61da=listProfiles(),_0x15b148=_0x3d61da['find'](_0x2bd5f0=>_0x2bd5f0[_0x25d0ee(0xba)]===_0x314548);return _0x15b148||null;}export function saveProfile(_0x48ebc3,_0xba9729,_0x47d5d0=![]){saveProfileToUserConfig(_0x48ebc3,_0xba9729);}export function deleteProfile(_0x52a755){const _0x13d4aa=a65_0x5c6e7a;validateProfileName(_0x52a755);const _0x135e95=getProfileDir(_0x52a755);if(!a65_0x466710[_0x13d4aa(0xb2)](_0x135e95))throw new Error(_0x13d4aa(0xd3)+_0x52a755+_0x13d4aa(0xd8));a65_0x466710[_0x13d4aa(0xd2)](_0x135e95,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x5c13a5,_0x3fed8f){const _0x2acbc7=a65_0x5c6e7a;validateProfileName(_0x5c13a5);const _0x55e165=getGlobalConfigPath(),_0x5f4707=getConfigDir();!a65_0x466710[_0x2acbc7(0xb2)](_0x5f4707)&&createSecureDirectory(_0x5f4707);let _0x37dbf2={};if(a65_0x466710[_0x2acbc7(0xb2)](_0x55e165))try{const _0x3b2c60=a65_0x466710[_0x2acbc7(0xc1)](_0x55e165,_0x2acbc7(0xa5));_0x37dbf2=JSON['parse'](_0x3b2c60);}catch{console[_0x2acbc7(0x97)](_0x2acbc7(0xe1)+_0x55e165+_0x2acbc7(0xbb));}!_0x37dbf2['profiles']&&(_0x37dbf2[_0x2acbc7(0xb5)]={}),_0x37dbf2['profiles'][_0x5c13a5]=_0x3fed8f,writeSecureFile(_0x55e165,JSON[_0x2acbc7(0xde)](_0x37dbf2,null,0x2));}export function removeProfileFromUserConfig(_0x439e8b){const _0x18516f=a65_0x5c6e7a;validateProfileName(_0x439e8b);const _0x2e5d96=getGlobalConfigPath();if(!a65_0x466710[_0x18516f(0xb2)](_0x2e5d96))throw new Error(_0x18516f(0xdc)+_0x439e8b+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x22c835={};try{const _0x8521cd=a65_0x466710[_0x18516f(0xc1)](_0x2e5d96,_0x18516f(0xa5));_0x22c835=JSON[_0x18516f(0xae)](_0x8521cd);}catch{throw new Error(_0x18516f(0xc0)+_0x2e5d96);}if(!_0x22c835[_0x18516f(0xb5)]||!_0x22c835['profiles'][_0x439e8b])throw new Error(_0x18516f(0xdc)+_0x439e8b+_0x18516f(0xe0));delete _0x22c835['profiles'][_0x439e8b],_0x22c835[_0x18516f(0xc5)]===_0x439e8b&&delete _0x22c835[_0x18516f(0xc5)],writeSecureFile(_0x2e5d96,JSON[_0x18516f(0xde)](_0x22c835,null,0x2));}function a65_0x7302(_0x432a0a,_0x500e55){_0x432a0a=_0x432a0a-0x95;const _0x379dc8=a65_0x379d();let _0x73029e=_0x379dc8[_0x432a0a];return _0x73029e;}export function getActiveProfile(){const _0x1374b7=a65_0x5c6e7a,_0x2c290f=loadSessionContext();if(_0x2c290f?.['profile'])return _0x2c290f[_0x1374b7(0xc5)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x19243b=getGlobalConfigPath();if(!a65_0x466710['existsSync'](_0x19243b))return null;try{const _0x432806=a65_0x466710[_0x1374b7(0xc1)](_0x19243b,_0x1374b7(0xa5)),_0x3e5edb=JSON[_0x1374b7(0xae)](_0x432806);return _0x3e5edb[_0x1374b7(0xc5)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x1c900c){const _0x4cb907=a65_0x5c6e7a,_0x3f6538=getGlobalConfigPath(),_0x23639a=getConfigDir();!a65_0x466710[_0x4cb907(0xb2)](_0x23639a)&&createSecureDirectory(_0x23639a);let _0x3de708={};if(a65_0x466710[_0x4cb907(0xb2)](_0x3f6538))try{const _0x5c0977=a65_0x466710[_0x4cb907(0xc1)](_0x3f6538,_0x4cb907(0xa5));_0x3de708=JSON['parse'](_0x5c0977);}catch{console[_0x4cb907(0x97)](_0x4cb907(0xe1)+_0x3f6538+_0x4cb907(0xbb));}_0x3de708[_0x4cb907(0x98)]=_0x1c900c,writeSecureFile(_0x3f6538,JSON[_0x4cb907(0xde)](_0x3de708,null,0x2));}export function saveActiveProfileToUserConfig(_0x57d9cc){const _0x102cce=a65_0x5c6e7a;validateProfileName(_0x57d9cc);const _0x5e5618=getGlobalConfigPath(),_0x7b78a3=getConfigDir();!a65_0x466710['existsSync'](_0x7b78a3)&&createSecureDirectory(_0x7b78a3);let _0x1f1fd6={};if(a65_0x466710[_0x102cce(0xb2)](_0x5e5618))try{const _0x24bf6a=a65_0x466710[_0x102cce(0xc1)](_0x5e5618,_0x102cce(0xa5));_0x1f1fd6=JSON[_0x102cce(0xae)](_0x24bf6a);}catch{console[_0x102cce(0x97)](_0x102cce(0xe1)+_0x5e5618+_0x102cce(0xbb));}_0x1f1fd6[_0x102cce(0xc5)]=_0x57d9cc,writeSecureFile(_0x5e5618,JSON[_0x102cce(0xde)](_0x1f1fd6,null,0x2));}function clearFieldFromUserConfig(_0x20d9c8){const _0x4bf0f4=a65_0x5c6e7a,_0x39bf54=getGlobalConfigPath();if(!a65_0x466710[_0x4bf0f4(0xb2)](_0x39bf54))return;let _0x564b44={};try{const _0x8b3c20=a65_0x466710[_0x4bf0f4(0xc1)](_0x39bf54,_0x4bf0f4(0xa5));_0x564b44=JSON[_0x4bf0f4(0xae)](_0x8b3c20);}catch{return;}delete _0x564b44[_0x20d9c8],writeSecureFile(_0x39bf54,JSON[_0x4bf0f4(0xde)](_0x564b44,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0xc4ad96=a65_0x5c6e7a;clearFieldFromUserConfig(_0xc4ad96(0x98));}export function clearActiveProfileFromUserConfig(){const _0x3b0624=a65_0x5c6e7a;clearFieldFromUserConfig(_0x3b0624(0xc5));}export function createProfile(_0x706d0e,_0x1ca22d){const _0x22a0e4=a65_0x5c6e7a;validateProfileName(_0x706d0e);if(profileExists(_0x706d0e))throw new Error('Profile\x20'+_0x706d0e+_0x22a0e4(0xd0));saveProfile(_0x706d0e,_0x1ca22d);}export function saveProfileCredentials(_0x1094f4,_0x1f0c1d){const _0x1da49b=a65_0x5c6e7a;validateProfileName(_0x1094f4);if(!profileExists(_0x1094f4))throw new Error('Profile\x20'+_0x1094f4+_0x1da49b(0xd8));const _0x15f557=getNewCredentialPath(_0x1094f4);writeSecureFile(_0x15f557,_0x1f0c1d);}export function loadProfileCredentials(_0x5a3a5a){const _0x568978=a65_0x5c6e7a;validateProfileName(_0x5a3a5a);const _0x4fb426=getNewCredentialPath(_0x5a3a5a);if(a65_0x466710[_0x568978(0xb2)](_0x4fb426))try{return a65_0x466710[_0x568978(0xc1)](_0x4fb426,_0x568978(0xa5));}catch{}const _0x411417=getOldCredentialPath(_0x5a3a5a);if(a65_0x466710[_0x568978(0xb2)](_0x411417)){console[_0x568978(0x97)](_0x568978(0xa9)+_0x5a3a5a+'\x27'),console[_0x568978(0x97)](_0x568978(0xda)),console[_0x568978(0x97)]('\x20\x20mv\x20\x22'+_0x411417+_0x568978(0xe4)+_0x4fb426+'\x22'),console[_0x568978(0x97)](_0x568978(0x9b));try{return a65_0x466710[_0x568978(0xc1)](_0x411417,_0x568978(0xa5));}catch{return null;}}return null;}function a65_0x379d(){const _0x5d5a1e=['has','\x27\x20will\x20be\x20ignored','includes','\x20does\x20not\x20exist','localeCompare','To\x20migrate:','directory','Profile\x20\x27','tdx.json','stringify','toISOString','\x27\x20not\x20found\x20in\x20user\x20configuration','Warning:\x20Failed\x20to\x20parse\x20','\x27:\x20\x27','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x22\x20\x22','198441gFLZIU','.env','warn','site','length','push','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','14044668yjwoJo','\x27\x20must\x20be\x20a\x20string','set','8631cLdeWu','INVALID_PROFILE_CONFIG','Error:\x20','account_name','@tdx-studio','object','utf-8','parent_segment','user_info','filter','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','message','values','database','parse','.env.','llm_project','isDirectory','existsSync','180yBLMPr',':\x20Invalid\x20JSON\x20syntax','profiles','2250309RVlyrF','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','356pNvTZX','\x0aWarning:\x20Failed\x20to\x20parse\x20','name',',\x20creating\x20new\x20file','description','test','224lrHiDl','sort','Failed\x20to\x20parse\x20','readFileSync','\x27:\x20config\x20must\x20be\x20an\x20object','Invalid\x20profile\x20name:\x20','keys','profile','\x27:\x20unknown\x20config\x20key\x20\x27','95784mihTfn','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','from','llm_agent','5qeupTA','join','map','9855PZIcky','Warning:\x20Profile\x20\x27','\x20already\x20exists','3637092XJRKly','rmSync','Profile\x20','entries'];a65_0x379d=function(){return _0x5d5a1e;};return a65_0x379d();}
1
+ (function(_0x5455bd,_0x13e2da){const _0x497921=a65_0x4665,_0x1c2156=_0x5455bd();while(!![]){try{const _0x2c7d2b=-parseInt(_0x497921(0x131))/0x1*(parseInt(_0x497921(0x11f))/0x2)+parseInt(_0x497921(0x11d))/0x3+-parseInt(_0x497921(0x15e))/0x4*(-parseInt(_0x497921(0x114))/0x5)+parseInt(_0x497921(0x159))/0x6*(parseInt(_0x497921(0x124))/0x7)+-parseInt(_0x497921(0x113))/0x8*(-parseInt(_0x497921(0x133))/0x9)+-parseInt(_0x497921(0x150))/0xa*(-parseInt(_0x497921(0x14b))/0xb)+-parseInt(_0x497921(0x12d))/0xc;if(_0x2c7d2b===_0x13e2da)break;else _0x1c2156['push'](_0x1c2156['shift']());}catch(_0x16a138){_0x1c2156['push'](_0x1c2156['shift']());}}}(a65_0x545f,0x6f036));import*as a65_0x114c8a from'node:fs';import*as a65_0x22f861 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME='@tdx-studio';export function getProfileParams(_0x3d319e){const _0x3e0d7f=a65_0x4665,_0x381afc={};if(!_0x3d319e)return _0x381afc;for(const [_0x3a0043,_0x334bb0]of Object[_0x3e0d7f(0x135)](_0x3d319e)){_0x3a0043!==_0x3e0d7f(0x146)&&_0x334bb0!==undefined&&(_0x381afc[_0x3a0043]=_0x334bb0);}return _0x381afc;}export function getProfilesDir(){const _0x1e6a66=a65_0x4665;return a65_0x22f861[_0x1e6a66(0x132)](getConfigDir(),_0x1e6a66(0x11b));}function getProfileDir(_0x13e203){return a65_0x22f861['join'](getProfilesDir(),_0x13e203);}function getProfileConfigPath(_0x404ad7){const _0xc09721=a65_0x4665;return a65_0x22f861['join'](getProfileDir(_0x404ad7),_0xc09721(0x12c));}function getProfileEnvPath(_0x36be11){const _0x2d5625=a65_0x4665;return a65_0x22f861[_0x2d5625(0x132)](getProfileDir(_0x36be11),_0x2d5625(0x155));}function getGlobalConfigPath(){const _0x441a83=a65_0x4665;return a65_0x22f861[_0x441a83(0x132)](getConfigDir(),'tdx.json');}function validateProfileName(_0x5236ad){const _0x28ce8e=a65_0x4665;if(/^@?[a-zA-Z0-9_-]+$/[_0x28ce8e(0x13a)](_0x5236ad))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/['test'](_0x5236ad))return;throw new Error(_0x28ce8e(0x145)+_0x5236ad+_0x28ce8e(0x11a));}function validateProfileConfig(_0x4ca62c,_0x1e6ff2){const _0x100d26=a65_0x4665;if(typeof _0x4ca62c!==_0x100d26(0x15b)||_0x4ca62c===null)throw new SDKError(ErrorCode[_0x100d26(0x15a)],'Profile\x20\x27'+_0x1e6ff2+_0x100d26(0x115));const _0x4d4eb9=[_0x100d26(0x146),_0x100d26(0x137),'database',_0x100d26(0x141),_0x100d26(0x126),'llm_agent',_0x100d26(0x12e),_0x100d26(0x12b)],_0x2a6266=_0x4ca62c;for(const _0x30cc69 of Object[_0x100d26(0x15f)](_0x2a6266)){!_0x4d4eb9[_0x100d26(0x136)](_0x30cc69)&&console['warn'](_0x100d26(0x15c)+_0x1e6ff2+_0x100d26(0x14d)+_0x30cc69+_0x100d26(0x122));}const _0x32e831=_0x4d4eb9[_0x100d26(0x14f)](_0x584886=>_0x584886!==_0x100d26(0x12b));for(const _0x5b3f17 of _0x32e831){if(_0x2a6266[_0x5b3f17]!==undefined&&typeof _0x2a6266[_0x5b3f17]!==_0x100d26(0x154))throw new SDKError(ErrorCode[_0x100d26(0x15a)],_0x100d26(0x149)+_0x1e6ff2+'\x27:\x20\x27'+_0x5b3f17+_0x100d26(0x12f));}return!![];}function loadProfilesFromTdxJson(_0x2840dd,_0xb9b042){const _0x127542=a65_0x4665;if(!a65_0x114c8a['existsSync'](_0x2840dd))return[];try{const _0xd944de=a65_0x114c8a[_0x127542(0x152)](_0x2840dd,_0x127542(0x129)),_0x427c00=JSON[_0x127542(0x15d)](_0xd944de);if(!_0x427c00[_0x127542(0x11b)]||typeof _0x427c00[_0x127542(0x11b)]!==_0x127542(0x15b))return[];const _0x58fd93=[];for(const [_0x46baf8,_0x247d10]of Object[_0x127542(0x135)](_0x427c00['profiles'])){try{validateProfileConfig(_0x247d10,_0x46baf8);const _0x33bbed=getNewCredentialPath(_0x46baf8),_0x598487=getOldCredentialPath(_0x46baf8),_0x2bcfe6=a65_0x114c8a[_0x127542(0x123)](_0x33bbed)||a65_0x114c8a[_0x127542(0x123)](_0x598487);_0x58fd93[_0x127542(0x134)]({'name':_0x46baf8,'config':_0x247d10,'metadata':{'name':_0x46baf8,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x2bcfe6,'scope':_0xb9b042});}catch(_0x3fb791){_0x3fb791 instanceof Error&&(console[_0x127542(0x151)](_0x127542(0x143)+_0x2840dd+':'),console['warn']('\x20\x20'+_0x3fb791[_0x127542(0x142)]+'\x0a'));}}return _0x58fd93;}catch(_0x52254b){return _0x52254b instanceof SyntaxError?(console[_0x127542(0x151)](_0x127542(0x138)+_0x2840dd+':\x20Invalid\x20JSON\x20syntax'),console['warn'](_0x127542(0x13b)+_0x52254b[_0x127542(0x142)]+'\x0a')):console[_0x127542(0x151)](_0x127542(0x14a)+_0x2840dd+':\x20'+_0x52254b+'\x0a'),[];}}export function getNewCredentialPath(_0x4a2c56){const _0x5d3faf=a65_0x4665;return a65_0x22f861[_0x5d3faf(0x132)](getConfigDir(),_0x5d3faf(0x127)+_0x4a2c56);}function getOldCredentialPath(_0x46ef4a){const _0x5406f0=a65_0x4665;return a65_0x22f861[_0x5406f0(0x132)](getProfilesDir(),_0x46ef4a,_0x5406f0(0x155));}function loadProfilesFromTdxJsonFiles(){const _0x4fd883=a65_0x4665,_0x157cd5=[],_0x172720=findProjectConfigPath();_0x172720&&_0x157cd5['push'](...loadProfilesFromTdxJson(_0x172720,_0x4fd883(0x13c)));const _0x51eac8=a65_0x22f861[_0x4fd883(0x132)](getConfigDir(),_0x4fd883(0x12c));return _0x157cd5[_0x4fd883(0x134)](...loadProfilesFromTdxJson(_0x51eac8,'user')),_0x157cd5;}function loadProfilesFromDirectories(){const _0x591f8d=a65_0x4665,_0x2ced74=getProfilesDir();if(!a65_0x114c8a[_0x591f8d(0x123)](_0x2ced74))return[];try{return a65_0x114c8a['readdirSync'](_0x2ced74,{'withFileTypes':!![]})[_0x591f8d(0x14f)](_0x1a075d=>_0x1a075d[_0x591f8d(0x116)]())[_0x591f8d(0x13e)](_0x175a39=>_0x175a39[_0x591f8d(0x117)])[_0x591f8d(0x14f)](_0x2d1119=>{const _0x3678fc=_0x591f8d,_0x2873f7=getProfileConfigPath(_0x2d1119),_0x1d5040=getProfileEnvPath(_0x2d1119);return a65_0x114c8a[_0x3678fc(0x123)](_0x2873f7)||a65_0x114c8a['existsSync'](_0x1d5040);})[_0x591f8d(0x13e)](_0x24558d=>{const _0x4675cf=_0x591f8d,_0x59b253=loadProfileFromDirectory(_0x24558d);if(_0x59b253)return{..._0x59b253,'scope':_0x4675cf(0x128)};return null;})['filter'](_0x492e41=>_0x492e41!==null);}catch{return[];}}function loadProfileFromDirectory(_0xb70d29){const _0x2512a9=a65_0x4665,_0x514a74=getProfileConfigPath(_0xb70d29),_0x1314a3=getOldCredentialPath(_0xb70d29);if(!a65_0x114c8a[_0x2512a9(0x123)](_0x514a74)&&!a65_0x114c8a['existsSync'](_0x1314a3))return null;let _0x1fcf86={},_0x2394e5={'name':_0xb70d29,'createdAt':new Date()['toISOString']()};if(a65_0x114c8a[_0x2512a9(0x123)](_0x514a74))try{const _0x407616=a65_0x114c8a[_0x2512a9(0x152)](_0x514a74,'utf-8'),_0x427eec=JSON[_0x2512a9(0x15d)](_0x407616),{metadata:_0x2c8a02,..._0x139641}=_0x427eec;_0x1fcf86=_0x139641,_0x2c8a02&&(_0x2394e5=_0x2c8a02);}catch{}return{'name':_0xb70d29,'config':_0x1fcf86,'metadata':_0x2394e5,'hasCredentials':a65_0x114c8a['existsSync'](_0x1314a3),'scope':_0x2512a9(0x128)};}export function listProfiles(){const _0x101b1e=a65_0x4665,_0x1cb1f5=loadProfilesFromTdxJsonFiles(),_0x289bd7=loadProfilesFromDirectories();if(_0x289bd7['length']>0x0){const _0x5543ce=_0x289bd7[_0x101b1e(0x13e)](_0x174e0c=>_0x174e0c['name'])[_0x101b1e(0x132)](',\x20'),_0x24c0ad=getConfigDir();console[_0x101b1e(0x151)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x5543ce),console[_0x101b1e(0x151)](_0x101b1e(0x153)),console[_0x101b1e(0x151)](_0x101b1e(0x140)+a65_0x22f861[_0x101b1e(0x132)](_0x24c0ad,'tdx.json')),console['warn']('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console['warn'](_0x101b1e(0x139));}const _0x2f7954=[..._0x1cb1f5,..._0x289bd7],_0x3f6e16=new Map();for(const _0x20e2f2 of _0x2f7954){!_0x3f6e16[_0x101b1e(0x157)](_0x20e2f2[_0x101b1e(0x117)])&&_0x3f6e16[_0x101b1e(0x14e)](_0x20e2f2[_0x101b1e(0x117)],_0x20e2f2);}return Array[_0x101b1e(0x14c)](_0x3f6e16['values']())[_0x101b1e(0x12a)]((_0x38c30b,_0x307ce0)=>_0x38c30b['name'][_0x101b1e(0x148)](_0x307ce0['name']));}export function profileExists(_0x5cf354){const _0x1c94e2=a65_0x4665,_0x12e725=listProfiles();return _0x12e725[_0x1c94e2(0x13d)](_0x4c9f9e=>_0x4c9f9e[_0x1c94e2(0x117)]===_0x5cf354);}function a65_0x4665(_0x40ca27,_0x559c15){_0x40ca27=_0x40ca27-0x113;const _0x545f52=a65_0x545f();let _0x4665ab=_0x545f52[_0x40ca27];return _0x4665ab;}export function loadProfile(_0x25fe60){const _0x8439=a65_0x4665;validateProfileName(_0x25fe60);const _0x39c8c4=listProfiles(),_0x5bfa77=_0x39c8c4[_0x8439(0x13f)](_0x176da0=>_0x176da0[_0x8439(0x117)]===_0x25fe60);return _0x5bfa77||null;}export function saveProfile(_0xa3606e,_0x3f603e,_0x1d1f40=![]){saveProfileToUserConfig(_0xa3606e,_0x3f603e);}export function deleteProfile(_0x59938e){const _0x1ad78e=a65_0x4665;validateProfileName(_0x59938e);const _0x18b025=getProfileDir(_0x59938e);if(!a65_0x114c8a[_0x1ad78e(0x123)](_0x18b025))throw new Error('Profile\x20'+_0x59938e+_0x1ad78e(0x11e));a65_0x114c8a[_0x1ad78e(0x158)](_0x18b025,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x11c03e,_0x2960f6){const _0x429248=a65_0x4665;validateProfileName(_0x11c03e);const _0x2651fb=getGlobalConfigPath(),_0x5358ff=getConfigDir();!a65_0x114c8a[_0x429248(0x123)](_0x5358ff)&&createSecureDirectory(_0x5358ff);let _0x236176={};if(a65_0x114c8a[_0x429248(0x123)](_0x2651fb))try{const _0x5dfca4=a65_0x114c8a[_0x429248(0x152)](_0x2651fb,_0x429248(0x129));_0x236176=JSON[_0x429248(0x15d)](_0x5dfca4);}catch{console['warn'](_0x429248(0x144)+_0x2651fb+_0x429248(0x118));}!_0x236176[_0x429248(0x11b)]&&(_0x236176['profiles']={}),_0x236176[_0x429248(0x11b)][_0x11c03e]=_0x2960f6,writeSecureFile(_0x2651fb,JSON[_0x429248(0x11c)](_0x236176,null,0x2));}export function removeProfileFromUserConfig(_0x27b06c){const _0x452343=a65_0x4665;validateProfileName(_0x27b06c);const _0x394a95=getGlobalConfigPath();if(!a65_0x114c8a['existsSync'](_0x394a95))throw new Error(_0x452343(0x149)+_0x27b06c+_0x452343(0x156));let _0x1f4a79={};try{const _0x496d5c=a65_0x114c8a[_0x452343(0x152)](_0x394a95,'utf-8');_0x1f4a79=JSON[_0x452343(0x15d)](_0x496d5c);}catch{throw new Error(_0x452343(0x125)+_0x394a95);}if(!_0x1f4a79[_0x452343(0x11b)]||!_0x1f4a79[_0x452343(0x11b)][_0x27b06c])throw new Error(_0x452343(0x149)+_0x27b06c+_0x452343(0x156));delete _0x1f4a79[_0x452343(0x11b)][_0x27b06c],_0x1f4a79[_0x452343(0x130)]===_0x27b06c&&delete _0x1f4a79[_0x452343(0x130)],writeSecureFile(_0x394a95,JSON[_0x452343(0x11c)](_0x1f4a79,null,0x2));}export function getActiveProfile(){const _0x4c0815=a65_0x4665,_0x14f4d6=loadSessionContext();if(_0x14f4d6?.[_0x4c0815(0x130)])return _0x14f4d6[_0x4c0815(0x130)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1467a8=getGlobalConfigPath();if(!a65_0x114c8a[_0x4c0815(0x123)](_0x1467a8))return null;try{const _0x29e548=a65_0x114c8a[_0x4c0815(0x152)](_0x1467a8,_0x4c0815(0x129)),_0x238314=JSON[_0x4c0815(0x15d)](_0x29e548);return _0x238314['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x385382){const _0x18942e=a65_0x4665,_0xa0ab6b=getGlobalConfigPath(),_0x19512c=getConfigDir();!a65_0x114c8a[_0x18942e(0x123)](_0x19512c)&&createSecureDirectory(_0x19512c);let _0xf46ae9={};if(a65_0x114c8a['existsSync'](_0xa0ab6b))try{const _0x7c29e5=a65_0x114c8a[_0x18942e(0x152)](_0xa0ab6b,_0x18942e(0x129));_0xf46ae9=JSON[_0x18942e(0x15d)](_0x7c29e5);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0xa0ab6b+_0x18942e(0x118));}_0xf46ae9[_0x18942e(0x137)]=_0x385382,writeSecureFile(_0xa0ab6b,JSON[_0x18942e(0x11c)](_0xf46ae9,null,0x2));}function a65_0x545f(){const _0x1b881f=['readFileSync','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','string','.env','\x27\x20not\x20found\x20in\x20user\x20configuration','has','rmSync','36468CxZdFn','INVALID_PROFILE_CONFIG','object','Warning:\x20Profile\x20\x27','parse','4lGkZgn','keys','3800RFMUxd','1244615WqwOMh','\x27:\x20config\x20must\x20be\x20an\x20object','isDirectory','name',',\x20creating\x20new\x20file','\x20already\x20exists','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','profiles','stringify','1080777sddMfQ','\x20does\x20not\x20exist','26326MTOEue','\x22\x20\x22','Profile\x20','\x27\x20will\x20be\x20ignored','existsSync','301mObJeC','Failed\x20to\x20parse\x20','llm_project','.env.','directory','utf-8','sort','user_info','tdx.json','13123932tDOLLn','account_name','\x27\x20must\x20be\x20a\x20string','profile','23VcJqYZ','join','4869JhoChd','push','entries','includes','site','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','test','Error:\x20','local','some','map','find','\x20\x201.\x20Edit:\x20','parent_segment','message','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','Warning:\x20Failed\x20to\x20parse\x20','Invalid\x20profile\x20name:\x20','description','To\x20migrate:','localeCompare','Profile\x20\x27','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','583EUoSzU','from','\x27:\x20unknown\x20config\x20key\x20\x27','set','filter','136530xtucgt','warn'];a65_0x545f=function(){return _0x1b881f;};return a65_0x545f();}export function saveActiveProfileToUserConfig(_0x2284fe){const _0x2d8363=a65_0x4665;validateProfileName(_0x2284fe);const _0x2f26c2=getGlobalConfigPath(),_0x17f754=getConfigDir();!a65_0x114c8a[_0x2d8363(0x123)](_0x17f754)&&createSecureDirectory(_0x17f754);let _0xb9996d={};if(a65_0x114c8a[_0x2d8363(0x123)](_0x2f26c2))try{const _0x424dba=a65_0x114c8a[_0x2d8363(0x152)](_0x2f26c2,'utf-8');_0xb9996d=JSON[_0x2d8363(0x15d)](_0x424dba);}catch{console['warn'](_0x2d8363(0x144)+_0x2f26c2+_0x2d8363(0x118));}_0xb9996d[_0x2d8363(0x130)]=_0x2284fe,writeSecureFile(_0x2f26c2,JSON[_0x2d8363(0x11c)](_0xb9996d,null,0x2));}function clearFieldFromUserConfig(_0x48e5cc){const _0x424906=a65_0x4665,_0x9a9417=getGlobalConfigPath();if(!a65_0x114c8a[_0x424906(0x123)](_0x9a9417))return;let _0x491b12={};try{const _0xa46d74=a65_0x114c8a['readFileSync'](_0x9a9417,_0x424906(0x129));_0x491b12=JSON[_0x424906(0x15d)](_0xa46d74);}catch{return;}delete _0x491b12[_0x48e5cc],writeSecureFile(_0x9a9417,JSON[_0x424906(0x11c)](_0x491b12,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x5445b7=a65_0x4665;clearFieldFromUserConfig(_0x5445b7(0x137));}export function clearActiveProfileFromUserConfig(){const _0x172953=a65_0x4665;clearFieldFromUserConfig(_0x172953(0x130));}export function createProfile(_0x510017,_0x3abba6){const _0x4a8ea4=a65_0x4665;validateProfileName(_0x510017);if(profileExists(_0x510017))throw new Error('Profile\x20'+_0x510017+_0x4a8ea4(0x119));saveProfile(_0x510017,_0x3abba6);}export function saveProfileCredentials(_0x1167ed,_0x5373f1){const _0x1bc452=a65_0x4665;validateProfileName(_0x1167ed);if(!profileExists(_0x1167ed))throw new Error(_0x1bc452(0x121)+_0x1167ed+_0x1bc452(0x11e));const _0x1772eb=getNewCredentialPath(_0x1167ed);writeSecureFile(_0x1772eb,_0x5373f1);}export function loadProfileCredentials(_0x3d6b5a){const _0x553d1a=a65_0x4665;validateProfileName(_0x3d6b5a);const _0x33544c=getNewCredentialPath(_0x3d6b5a);if(a65_0x114c8a[_0x553d1a(0x123)](_0x33544c))try{return a65_0x114c8a[_0x553d1a(0x152)](_0x33544c,_0x553d1a(0x129));}catch{}const _0x352331=getOldCredentialPath(_0x3d6b5a);if(a65_0x114c8a[_0x553d1a(0x123)](_0x352331)){console[_0x553d1a(0x151)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x3d6b5a+'\x27'),console[_0x553d1a(0x151)](_0x553d1a(0x147)),console[_0x553d1a(0x151)]('\x20\x20mv\x20\x22'+_0x352331+_0x553d1a(0x120)+_0x33544c+'\x22'),console[_0x553d1a(0x151)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a65_0x114c8a['readFileSync'](_0x352331,'utf-8');}catch{return null;}}return null;}
@@ -1 +1 @@
1
- (function(_0x103fdc,_0xb7b206){const _0x707768=a66_0x5c69,_0x446f8d=_0x103fdc();while(!![]){try{const _0x174c15=-parseInt(_0x707768(0x1ce))/0x1+parseInt(_0x707768(0x1ba))/0x2*(-parseInt(_0x707768(0x1d3))/0x3)+-parseInt(_0x707768(0x1c4))/0x4*(parseInt(_0x707768(0x1bc))/0x5)+-parseInt(_0x707768(0x1c9))/0x6+-parseInt(_0x707768(0x1c2))/0x7+parseInt(_0x707768(0x1c3))/0x8+parseInt(_0x707768(0x1bb))/0x9;if(_0x174c15===_0xb7b206)break;else _0x446f8d['push'](_0x446f8d['shift']());}catch(_0x4a8966){_0x446f8d['push'](_0x446f8d['shift']());}}}(a66_0x16fe,0x4992d));function a66_0x5c69(_0x39cbad,_0x1d5857){_0x39cbad=_0x39cbad-0x1ba;const _0x16fe77=a66_0x16fe();let _0x5c696a=_0x16fe77[_0x39cbad];return _0x5c696a;}import*as a66_0x30c08e from'node:fs';function a66_0x16fe(){const _0x22a571=['2879608kDtYQy','8zMiTFR','Failed\x20to\x20load\x20project\x20config\x20from\x20','dirname','existsSync','includes','1191996EASwYn','ENOENT','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','parse','cwd','282792wsfiZe','join','api_key',').\x20','stringify','3IrLdjW','profile','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','apiKey','350386NFkvcd','11519352WakLTp','982730RvbhCV','warn','Warning:\x20\x27profile\x27\x20field\x20in\x20','utf-8','writeFileSync','TD_API_KEY','2021453gtZrpo'];a66_0x16fe=function(){return _0x22a571;};return a66_0x16fe();}import*as a66_0x32ee5e from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x1b877a){const _0x1d8eee=a66_0x5c69;let _0x1d27d7=_0x1b877a||process[_0x1d8eee(0x1cd)]();while(!![]){const _0x43f1fd=a66_0x32ee5e[_0x1d8eee(0x1cf)](_0x1d27d7,PROJECT_CONFIG_FILENAME);if(a66_0x30c08e[_0x1d8eee(0x1c7)](_0x43f1fd))return _0x43f1fd;const _0x188bc7=a66_0x32ee5e[_0x1d8eee(0x1c6)](_0x1d27d7);if(_0x188bc7===_0x1d27d7)return null;_0x1d27d7=_0x188bc7;}}export function loadProjectConfig(_0x133196){const _0x55600f=a66_0x5c69,_0x2ead01=findProjectConfigPath(_0x133196);if(!_0x2ead01)return null;try{const _0x1e0036=a66_0x30c08e['readFileSync'](_0x2ead01,_0x55600f(0x1bf)),_0x220d66=JSON[_0x55600f(0x1cc)](_0x1e0036),_0x248125=JSON[_0x55600f(0x1d2)](_0x220d66);if(_0x248125[_0x55600f(0x1c8)](_0x55600f(0x1c1))||_0x248125[_0x55600f(0x1c8)]('apiKey')||_0x248125['includes'](_0x55600f(0x1d0)))throw new Error(_0x55600f(0x1d5)+_0x2ead01+_0x55600f(0x1d1)+_0x55600f(0x1cb));const {metadata:_0x1d9dae,profile:_0x19d359,..._0x35b221}=_0x220d66;return _0x19d359&&console[_0x55600f(0x1bd)](_0x55600f(0x1be)+_0x2ead01+'\x20is\x20ignored.\x20'+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x35b221;}catch(_0x10a61a){if(_0x10a61a instanceof Error&&'code'in _0x10a61a&&_0x10a61a['code']===_0x55600f(0x1ca))return null;throw new Error(_0x55600f(0x1c5)+_0x2ead01+':\x20'+_0x10a61a);}}export function saveProjectConfig(_0x40ed31,_0x228fe2){const _0x3b9d26=a66_0x5c69,_0x43c21e=_0x228fe2||process[_0x3b9d26(0x1cd)](),_0x443d09=a66_0x32ee5e[_0x3b9d26(0x1cf)](_0x43c21e,PROJECT_CONFIG_FILENAME),_0x3175b6=JSON[_0x3b9d26(0x1d2)](_0x40ed31);if(_0x3175b6[_0x3b9d26(0x1c8)]('TD_API_KEY')||_0x3175b6['includes'](_0x3b9d26(0x1d6))||_0x3175b6[_0x3b9d26(0x1c8)](_0x3b9d26(0x1d0)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x3b9d26(0x1d4)in _0x40ed31)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a66_0x30c08e[_0x3b9d26(0x1c0)](_0x443d09,JSON[_0x3b9d26(0x1d2)](_0x40ed31,null,0x2));}export function hasProjectConfig(_0x56b6a9){return findProjectConfigPath(_0x56b6a9)!==null;}export function getProjectRoot(_0x2a7c2c){const _0x3e7df6=a66_0x5c69,_0x3eec2d=findProjectConfigPath(_0x2a7c2c);return _0x3eec2d?a66_0x32ee5e[_0x3e7df6(0x1c6)](_0x3eec2d):null;}
1
+ function a66_0x25e8(_0x369b33,_0x2d4092){_0x369b33=_0x369b33-0x1de;const _0x262551=a66_0x2625();let _0x25e899=_0x262551[_0x369b33];return _0x25e899;}const a66_0x314a52=a66_0x25e8;(function(_0x28299d,_0x1bbf24){const _0x4a4c14=a66_0x25e8,_0x537f94=_0x28299d();while(!![]){try{const _0x3158e4=parseInt(_0x4a4c14(0x1ff))/0x1*(-parseInt(_0x4a4c14(0x1e4))/0x2)+-parseInt(_0x4a4c14(0x1e2))/0x3+parseInt(_0x4a4c14(0x1f0))/0x4+-parseInt(_0x4a4c14(0x1ea))/0x5+parseInt(_0x4a4c14(0x1e1))/0x6*(-parseInt(_0x4a4c14(0x1ee))/0x7)+-parseInt(_0x4a4c14(0x1ed))/0x8+parseInt(_0x4a4c14(0x1ec))/0x9;if(_0x3158e4===_0x1bbf24)break;else _0x537f94['push'](_0x537f94['shift']());}catch(_0x107937){_0x537f94['push'](_0x537f94['shift']());}}}(a66_0x2625,0xe7267));import*as a66_0x554185 from'node:fs';function a66_0x2625(){const _0x39279a=['Warning:\x20\x27profile\x27\x20field\x20in\x20','4824cqFELk','1923126LXjVpn','stringify','1148688qjIfnC','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','tdx.json','TD_API_KEY','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','readFileSync','9421085wMSzNU','includes','58308957NYHFPl','5708656jqzDKf','8764RmYKEu','Failed\x20to\x20load\x20project\x20config\x20from\x20','1745996krfBKn','profile','ENOENT','code','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','apiKey','cwd','\x20is\x20ignored.\x20','existsSync',').\x20','api_key','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','warn','utf-8','3OxJSuh','dirname','join'];a66_0x2625=function(){return _0x39279a;};return a66_0x2625();}import*as a66_0x42479b from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x314a52(0x1e6);export function findProjectConfigPath(_0x5eac34){const _0x1aeda5=a66_0x314a52;let _0x331bcf=_0x5eac34||process[_0x1aeda5(0x1f6)]();while(!![]){const _0x2f6e1c=a66_0x42479b[_0x1aeda5(0x1df)](_0x331bcf,PROJECT_CONFIG_FILENAME);if(a66_0x554185[_0x1aeda5(0x1f8)](_0x2f6e1c))return _0x2f6e1c;const _0x540898=a66_0x42479b[_0x1aeda5(0x1de)](_0x331bcf);if(_0x540898===_0x331bcf)return null;_0x331bcf=_0x540898;}}export function loadProjectConfig(_0x357be5){const _0x5b58c5=a66_0x314a52,_0x5d29ae=findProjectConfigPath(_0x357be5);if(!_0x5d29ae)return null;try{const _0x47ca6=a66_0x554185[_0x5b58c5(0x1e9)](_0x5d29ae,_0x5b58c5(0x1fe)),_0x1cd581=JSON['parse'](_0x47ca6),_0x417ac9=JSON[_0x5b58c5(0x1e3)](_0x1cd581);if(_0x417ac9[_0x5b58c5(0x1eb)](_0x5b58c5(0x1e7))||_0x417ac9[_0x5b58c5(0x1eb)](_0x5b58c5(0x1f5))||_0x417ac9[_0x5b58c5(0x1eb)](_0x5b58c5(0x1fa)))throw new Error(_0x5b58c5(0x1f4)+_0x5d29ae+_0x5b58c5(0x1f9)+_0x5b58c5(0x1fb));const {metadata:_0x3977bd,profile:_0x2895cf,..._0x3d54ff}=_0x1cd581;return _0x2895cf&&console[_0x5b58c5(0x1fd)](_0x5b58c5(0x1e0)+_0x5d29ae+_0x5b58c5(0x1f7)+_0x5b58c5(0x1e5)),_0x3d54ff;}catch(_0x564484){if(_0x564484 instanceof Error&&_0x5b58c5(0x1f3)in _0x564484&&_0x564484[_0x5b58c5(0x1f3)]===_0x5b58c5(0x1f2))return null;throw new Error(_0x5b58c5(0x1ef)+_0x5d29ae+':\x20'+_0x564484);}}export function saveProjectConfig(_0x5cf567,_0xe6b1a1){const _0x1ce36b=a66_0x314a52,_0x5c8720=_0xe6b1a1||process['cwd'](),_0x55be90=a66_0x42479b['join'](_0x5c8720,PROJECT_CONFIG_FILENAME),_0x4f450a=JSON[_0x1ce36b(0x1e3)](_0x5cf567);if(_0x4f450a[_0x1ce36b(0x1eb)]('TD_API_KEY')||_0x4f450a['includes'](_0x1ce36b(0x1f5))||_0x4f450a['includes'](_0x1ce36b(0x1fa)))throw new Error(_0x1ce36b(0x1e8));if(_0x1ce36b(0x1f1)in _0x5cf567)throw new Error(_0x1ce36b(0x1fc));a66_0x554185['writeFileSync'](_0x55be90,JSON[_0x1ce36b(0x1e3)](_0x5cf567,null,0x2));}export function hasProjectConfig(_0x3a57f2){return findProjectConfigPath(_0x3a57f2)!==null;}export function getProjectRoot(_0x3b8d40){const _0x321503=a66_0x314a52,_0x550305=findProjectConfigPath(_0x3b8d40);return _0x550305?a66_0x42479b[_0x321503(0x1de)](_0x550305):null;}
@@ -1 +1 @@
1
- (function(_0x29b4bf,_0x1dae83){const _0x262ffa=a67_0x3ca9,_0x4a3726=_0x29b4bf();while(!![]){try{const _0x414dfa=parseInt(_0x262ffa(0x1e6))/0x1*(-parseInt(_0x262ffa(0x1d7))/0x2)+parseInt(_0x262ffa(0x1f0))/0x3+-parseInt(_0x262ffa(0x1e4))/0x4+parseInt(_0x262ffa(0x1d5))/0x5+parseInt(_0x262ffa(0x1d3))/0x6+parseInt(_0x262ffa(0x1ee))/0x7+-parseInt(_0x262ffa(0x1da))/0x8;if(_0x414dfa===_0x1dae83)break;else _0x4a3726['push'](_0x4a3726['shift']());}catch(_0xc3edcc){_0x4a3726['push'](_0x4a3726['shift']());}}}(a67_0x5f5d,0xe0559));import*as a67_0x1c31f2 from'node:fs';import*as a67_0x2fa872 from'node:path';import*as a67_0x5760bd from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';function a67_0x5f5d(){const _0x3c04d2=['5087296HbmHqT','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','11xcSmYe','toISOString','getTime','join','readdirSync','stringify','.json','.\x20This\x20is\x20insecure.\x20Removing\x20session.','10029971QeyExp','endsWith','106473aindct','unlinkSync','now','includes','.config','parse','sessions','writeFileSync','warn','9608910uScjzF','toString','6429100giFsQP','test','104508DkJmum','api_key','TD_API_KEY','12721264uylugF','utf-8','tdx','sort','readFileSync','apiKey','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','existsSync','createdAt','replace'];a67_0x5f5d=function(){return _0x3c04d2;};return a67_0x5f5d();}import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function a67_0x3ca9(_0x29158c,_0x36f87b){_0x29158c=_0x29158c-0x1d0;const _0x5f5d73=a67_0x5f5d();let _0x3ca969=_0x5f5d73[_0x29158c];return _0x3ca969;}function getSessionsDir(){const _0x2e7bc1=a67_0x3ca9,_0x860510=process.env.TDX_CONFIG_DIR||a67_0x2fa872[_0x2e7bc1(0x1e9)](a67_0x5760bd['homedir'](),_0x2e7bc1(0x1f4),_0x2e7bc1(0x1dc));return a67_0x2fa872[_0x2e7bc1(0x1e9)](_0x860510,_0x2e7bc1(0x1d0));}function getSessionPath(_0x4488a4){const _0x15c238=a67_0x3ca9;return a67_0x2fa872[_0x15c238(0x1e9)](getSessionsDir(),_0x4488a4+_0x15c238(0x1ec));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x39631c){const _0x1aeb2b=a67_0x3ca9;if(_0x39631c)return _0x39631c;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x1aeb2b(0x1d4)]();}export function loadSessionContext(_0xf7ef0c){const _0x2e2a33=a67_0x3ca9,_0x569ab7=getSessionID(_0xf7ef0c),_0x368132=/^\d+$/[_0x2e2a33(0x1d6)](_0x569ab7)?parseInt(_0x569ab7,0xa):null;return _0x368132!==null?loadSessionContextByPID(_0x368132):loadSessionContextByString(_0x569ab7);}export function loadSessionContextByPID(_0x4ff121){const _0x4a584b=a67_0x3ca9,_0x23ed0d=getSessionPath(_0x4ff121);if(!a67_0x1c31f2[_0x4a584b(0x1e1)](_0x23ed0d))return null;try{const _0x5471e0=a67_0x1c31f2[_0x4a584b(0x1de)](_0x23ed0d,_0x4a584b(0x1db)),_0x285c0e=JSON[_0x4a584b(0x1f5)](_0x5471e0),_0x5c146a=new Date(_0x285c0e[_0x4a584b(0x1e2)])[_0x4a584b(0x1e8)](),_0x431b34=Date[_0x4a584b(0x1f2)]();if(_0x431b34-_0x5c146a>SESSION_EXPIRATION_MS)return a67_0x1c31f2[_0x4a584b(0x1f1)](_0x23ed0d),null;const _0x1370cc=JSON[_0x4a584b(0x1eb)](_0x285c0e);if(_0x1370cc[_0x4a584b(0x1f3)](_0x4a584b(0x1d9))||_0x1370cc[_0x4a584b(0x1f3)](_0x4a584b(0x1df))||_0x1370cc[_0x4a584b(0x1f3)](_0x4a584b(0x1d8)))return console[_0x4a584b(0x1d2)](_0x4a584b(0x1e5)+_0x23ed0d+_0x4a584b(0x1ed)),a67_0x1c31f2[_0x4a584b(0x1f1)](_0x23ed0d),null;return _0x285c0e;}catch{try{a67_0x1c31f2['unlinkSync'](_0x23ed0d);}catch{}return null;}}function loadSessionContextByString(_0x2170c7){const _0x50782f=a67_0x3ca9,_0x1ef712=a67_0x2fa872[_0x50782f(0x1e9)](getSessionsDir(),_0x2170c7+_0x50782f(0x1ec));if(!a67_0x1c31f2[_0x50782f(0x1e1)](_0x1ef712))return null;try{const _0x559163=a67_0x1c31f2[_0x50782f(0x1de)](_0x1ef712,'utf-8'),_0x56c152=JSON[_0x50782f(0x1f5)](_0x559163),_0x381287=new Date(_0x56c152[_0x50782f(0x1e2)])[_0x50782f(0x1e8)](),_0x2e3528=Date[_0x50782f(0x1f2)]();if(_0x2e3528-_0x381287>SESSION_EXPIRATION_MS)return a67_0x1c31f2[_0x50782f(0x1f1)](_0x1ef712),null;const _0xb3eb79=JSON[_0x50782f(0x1eb)](_0x56c152);if(_0xb3eb79[_0x50782f(0x1f3)](_0x50782f(0x1d9))||_0xb3eb79[_0x50782f(0x1f3)](_0x50782f(0x1df))||_0xb3eb79[_0x50782f(0x1f3)](_0x50782f(0x1d8)))return console[_0x50782f(0x1d2)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x1ef712+_0x50782f(0x1ed)),a67_0x1c31f2['unlinkSync'](_0x1ef712),null;return _0x56c152;}catch{try{a67_0x1c31f2['unlinkSync'](_0x1ef712);}catch{}return null;}}export function saveSessionContext(_0x455558,_0x130205){const _0x1ad794=a67_0x3ca9,_0x5b5fdd=getSessionID(_0x130205),_0x1360ae=/^\d+$/[_0x1ad794(0x1d6)](_0x5b5fdd)?parseInt(_0x5b5fdd,0xa):getCurrentSessionPID(),_0x1f8c74=a67_0x2fa872[_0x1ad794(0x1e9)](getSessionsDir(),_0x5b5fdd+_0x1ad794(0x1ec)),_0x469377=getSessionsDir();createSecureDirectory(_0x469377);const _0x563b1f=JSON[_0x1ad794(0x1eb)](_0x455558);if(_0x563b1f[_0x1ad794(0x1f3)](_0x1ad794(0x1d9))||_0x563b1f[_0x1ad794(0x1f3)]('apiKey')||_0x563b1f[_0x1ad794(0x1f3)](_0x1ad794(0x1d8)))throw new Error(_0x1ad794(0x1e0));let _0x3a7cac;const _0x515aa3=/^\d+$/[_0x1ad794(0x1d6)](_0x5b5fdd)?loadSessionContextByPID(parseInt(_0x5b5fdd,0xa)):loadSessionContextByString(_0x5b5fdd);_0x515aa3?_0x3a7cac={..._0x515aa3,..._0x455558,'pid':_0x1360ae,'sessionId':_0x5b5fdd!==_0x1360ae['toString']()?_0x5b5fdd:undefined,'updatedAt':new Date()[_0x1ad794(0x1e7)]()}:_0x3a7cac={'pid':_0x1360ae,'sessionId':_0x5b5fdd!==_0x1360ae[_0x1ad794(0x1d4)]()?_0x5b5fdd:undefined,..._0x455558,'createdAt':new Date()[_0x1ad794(0x1e7)](),'updatedAt':new Date()[_0x1ad794(0x1e7)]()},a67_0x1c31f2[_0x1ad794(0x1d1)](_0x1f8c74,JSON['stringify'](_0x3a7cac,null,0x2));}export function clearSessionContext(_0x5dcf1a){const _0x311c83=a67_0x3ca9,_0x30eb5f=getSessionID(_0x5dcf1a),_0x2d9ca5=a67_0x2fa872[_0x311c83(0x1e9)](getSessionsDir(),_0x30eb5f+'.json');a67_0x1c31f2[_0x311c83(0x1e1)](_0x2d9ca5)&&a67_0x1c31f2[_0x311c83(0x1f1)](_0x2d9ca5);}export function clearSessionContextField(_0x3e584f,_0x28ebb5){const _0xe39257=a67_0x3ca9,_0x301b73=getSessionID(_0x28ebb5),_0x3c4e8=a67_0x2fa872[_0xe39257(0x1e9)](getSessionsDir(),_0x301b73+_0xe39257(0x1ec));if(!a67_0x1c31f2[_0xe39257(0x1e1)](_0x3c4e8))return;try{const _0x5b488d=a67_0x1c31f2['readFileSync'](_0x3c4e8,'utf-8'),_0x799aab=JSON[_0xe39257(0x1f5)](_0x5b488d);delete _0x799aab[_0x3e584f],a67_0x1c31f2[_0xe39257(0x1d1)](_0x3c4e8,JSON['stringify'](_0x799aab,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x3b1027=a67_0x3ca9,_0x236a5c=getSessionsDir();if(!a67_0x1c31f2['existsSync'](_0x236a5c))return 0x0;let _0x3e8443=0x0;const _0x323484=Date[_0x3b1027(0x1f2)]();try{const _0x25904d=a67_0x1c31f2[_0x3b1027(0x1ea)](_0x236a5c);for(const _0x5f3076 of _0x25904d){if(!_0x5f3076[_0x3b1027(0x1ef)](_0x3b1027(0x1ec)))continue;const _0x5d6a8e=a67_0x2fa872[_0x3b1027(0x1e9)](_0x236a5c,_0x5f3076),_0x84ac7c=_0x5f3076[_0x3b1027(0x1e3)]('.json',''),_0x13dcaf=parseInt(_0x84ac7c,0xa),_0x39eb7b=!isNaN(_0x13dcaf);if(_0x39eb7b){if(!isProcessRunning(_0x13dcaf)){a67_0x1c31f2[_0x3b1027(0x1f1)](_0x5d6a8e),_0x3e8443++;continue;}}try{const _0x4a24f1=a67_0x1c31f2[_0x3b1027(0x1de)](_0x5d6a8e,_0x3b1027(0x1db)),_0x438d2f=JSON[_0x3b1027(0x1f5)](_0x4a24f1),_0x590168=new Date(_0x438d2f['createdAt'])[_0x3b1027(0x1e8)]();_0x323484-_0x590168>SESSION_EXPIRATION_MS&&(a67_0x1c31f2[_0x3b1027(0x1f1)](_0x5d6a8e),_0x3e8443++);}catch{a67_0x1c31f2[_0x3b1027(0x1f1)](_0x5d6a8e),_0x3e8443++;}}}catch{}return _0x3e8443;}export function listActiveSessions(){const _0x1f5897=a67_0x3ca9,_0x2cf865=getSessionsDir();if(!a67_0x1c31f2['existsSync'](_0x2cf865))return[];try{const _0x9a76c5=a67_0x1c31f2[_0x1f5897(0x1ea)](_0x2cf865),_0x371d4a=[];for(const _0xea82bf of _0x9a76c5){if(!_0xea82bf[_0x1f5897(0x1ef)](_0x1f5897(0x1ec)))continue;const _0x13f873=_0xea82bf[_0x1f5897(0x1e3)](_0x1f5897(0x1ec),''),_0x517d3e=parseInt(_0x13f873,0xa);!isNaN(_0x517d3e)&&isProcessRunning(_0x517d3e)&&_0x371d4a['push'](_0x517d3e);}return _0x371d4a[_0x1f5897(0x1dd)]((_0x363f2e,_0x4b193f)=>_0x363f2e-_0x4b193f);}catch{return[];}}
1
+ (function(_0x33abb6,_0x243e29){const _0x36d1dc=a67_0x4695,_0x1db4d9=_0x33abb6();while(!![]){try{const _0x29ee54=parseInt(_0x36d1dc(0x159))/0x1*(parseInt(_0x36d1dc(0x14a))/0x2)+-parseInt(_0x36d1dc(0x15a))/0x3+-parseInt(_0x36d1dc(0x168))/0x4+-parseInt(_0x36d1dc(0x15d))/0x5*(parseInt(_0x36d1dc(0x149))/0x6)+-parseInt(_0x36d1dc(0x16d))/0x7*(-parseInt(_0x36d1dc(0x151))/0x8)+parseInt(_0x36d1dc(0x163))/0x9+-parseInt(_0x36d1dc(0x161))/0xa*(-parseInt(_0x36d1dc(0x16c))/0xb);if(_0x29ee54===_0x243e29)break;else _0x1db4d9['push'](_0x1db4d9['shift']());}catch(_0x4a1423){_0x1db4d9['push'](_0x1db4d9['shift']());}}}(a67_0x32de,0xa40e1));import*as a67_0x50583d from'node:fs';import*as a67_0x2d1db2 from'node:path';import*as a67_0x280404 from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x359821=a67_0x4695,_0x99748a=process.env.TDX_CONFIG_DIR||a67_0x2d1db2[_0x359821(0x162)](a67_0x280404[_0x359821(0x157)](),_0x359821(0x14b),_0x359821(0x167));return a67_0x2d1db2[_0x359821(0x162)](_0x99748a,'sessions');}function getSessionPath(_0x4a623b){const _0x35599c=a67_0x4695;return a67_0x2d1db2[_0x35599c(0x162)](getSessionsDir(),_0x4a623b+'.json');}export function getCurrentSessionPID(){return getPPID();}function a67_0x32de(){const _0x49a352=['.json','createdAt','tdx','5251812skrQOW','unlinkSync','TD_API_KEY','api_key','24431LjRYPa','2611OPSbCo','parse','apiKey','utf-8','.\x20This\x20is\x20insecure.\x20Removing\x20session.','warn','6GxdaxR','2126mYVkAb','.config','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','writeFileSync','test','stringify','endsWith','15656RYmNGE','readdirSync','readFileSync','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','sort','toISOString','homedir','push','802TXAyIL','2325360gGQaeE','replace','now','94465UDOxGc','toString','includes','getTime','4150OXFXVp','join','2472597WyKSCC','existsSync'];a67_0x32de=function(){return _0x49a352;};return a67_0x32de();}export function getSessionID(_0x48995b){const _0x5866d0=a67_0x4695;if(_0x48995b)return _0x48995b;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x5866d0(0x15e)]();}export function loadSessionContext(_0x4c93a0){const _0x1127b0=a67_0x4695,_0x4ca5fe=getSessionID(_0x4c93a0),_0x2d143d=/^\d+$/[_0x1127b0(0x14e)](_0x4ca5fe)?parseInt(_0x4ca5fe,0xa):null;return _0x2d143d!==null?loadSessionContextByPID(_0x2d143d):loadSessionContextByString(_0x4ca5fe);}export function loadSessionContextByPID(_0x1f0ea6){const _0x5bd79a=a67_0x4695,_0x18d2a3=getSessionPath(_0x1f0ea6);if(!a67_0x50583d[_0x5bd79a(0x164)](_0x18d2a3))return null;try{const _0x1bc126=a67_0x50583d[_0x5bd79a(0x153)](_0x18d2a3,_0x5bd79a(0x170)),_0x5e157b=JSON[_0x5bd79a(0x16e)](_0x1bc126),_0x32aa4a=new Date(_0x5e157b[_0x5bd79a(0x166)])[_0x5bd79a(0x160)](),_0x133ddc=Date[_0x5bd79a(0x15c)]();if(_0x133ddc-_0x32aa4a>SESSION_EXPIRATION_MS)return a67_0x50583d[_0x5bd79a(0x169)](_0x18d2a3),null;const _0x5d4773=JSON[_0x5bd79a(0x14f)](_0x5e157b);if(_0x5d4773[_0x5bd79a(0x15f)](_0x5bd79a(0x16a))||_0x5d4773['includes'](_0x5bd79a(0x16f))||_0x5d4773[_0x5bd79a(0x15f)](_0x5bd79a(0x16b)))return console[_0x5bd79a(0x148)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x18d2a3+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a67_0x50583d[_0x5bd79a(0x169)](_0x18d2a3),null;return _0x5e157b;}catch{try{a67_0x50583d[_0x5bd79a(0x169)](_0x18d2a3);}catch{}return null;}}function loadSessionContextByString(_0x2c757e){const _0x577692=a67_0x4695,_0x33c22e=a67_0x2d1db2['join'](getSessionsDir(),_0x2c757e+'.json');if(!a67_0x50583d[_0x577692(0x164)](_0x33c22e))return null;try{const _0x1e01e6=a67_0x50583d[_0x577692(0x153)](_0x33c22e,_0x577692(0x170)),_0x34d012=JSON[_0x577692(0x16e)](_0x1e01e6),_0x326eeb=new Date(_0x34d012['createdAt'])[_0x577692(0x160)](),_0x2e31e8=Date['now']();if(_0x2e31e8-_0x326eeb>SESSION_EXPIRATION_MS)return a67_0x50583d['unlinkSync'](_0x33c22e),null;const _0x42256e=JSON[_0x577692(0x14f)](_0x34d012);if(_0x42256e['includes'](_0x577692(0x16a))||_0x42256e[_0x577692(0x15f)](_0x577692(0x16f))||_0x42256e[_0x577692(0x15f)](_0x577692(0x16b)))return console['warn'](_0x577692(0x154)+_0x33c22e+_0x577692(0x171)),a67_0x50583d[_0x577692(0x169)](_0x33c22e),null;return _0x34d012;}catch{try{a67_0x50583d['unlinkSync'](_0x33c22e);}catch{}return null;}}export function saveSessionContext(_0x536396,_0x4d905f){const _0x99f912=a67_0x4695,_0x29fffa=getSessionID(_0x4d905f),_0xdbd0c0=/^\d+$/[_0x99f912(0x14e)](_0x29fffa)?parseInt(_0x29fffa,0xa):getCurrentSessionPID(),_0x537cfd=a67_0x2d1db2[_0x99f912(0x162)](getSessionsDir(),_0x29fffa+_0x99f912(0x165)),_0x4e3e42=getSessionsDir();createSecureDirectory(_0x4e3e42);const _0x423dfe=JSON[_0x99f912(0x14f)](_0x536396);if(_0x423dfe[_0x99f912(0x15f)](_0x99f912(0x16a))||_0x423dfe[_0x99f912(0x15f)]('apiKey')||_0x423dfe[_0x99f912(0x15f)]('api_key'))throw new Error(_0x99f912(0x14c));let _0x2f596e;const _0x21f4d0=/^\d+$/[_0x99f912(0x14e)](_0x29fffa)?loadSessionContextByPID(parseInt(_0x29fffa,0xa)):loadSessionContextByString(_0x29fffa);_0x21f4d0?_0x2f596e={..._0x21f4d0,..._0x536396,'pid':_0xdbd0c0,'sessionId':_0x29fffa!==_0xdbd0c0[_0x99f912(0x15e)]()?_0x29fffa:undefined,'updatedAt':new Date()['toISOString']()}:_0x2f596e={'pid':_0xdbd0c0,'sessionId':_0x29fffa!==_0xdbd0c0[_0x99f912(0x15e)]()?_0x29fffa:undefined,..._0x536396,'createdAt':new Date()[_0x99f912(0x156)](),'updatedAt':new Date()[_0x99f912(0x156)]()},a67_0x50583d[_0x99f912(0x14d)](_0x537cfd,JSON[_0x99f912(0x14f)](_0x2f596e,null,0x2));}function a67_0x4695(_0xc210ee,_0x156ae7){_0xc210ee=_0xc210ee-0x148;const _0x32def3=a67_0x32de();let _0x4695f8=_0x32def3[_0xc210ee];return _0x4695f8;}export function clearSessionContext(_0x1176d0){const _0x493cdf=a67_0x4695,_0x179fdd=getSessionID(_0x1176d0),_0x24fa50=a67_0x2d1db2[_0x493cdf(0x162)](getSessionsDir(),_0x179fdd+_0x493cdf(0x165));a67_0x50583d['existsSync'](_0x24fa50)&&a67_0x50583d['unlinkSync'](_0x24fa50);}export function clearSessionContextField(_0x43e27a,_0x2ecc73){const _0x8424d9=a67_0x4695,_0x240d58=getSessionID(_0x2ecc73),_0x2b1a90=a67_0x2d1db2['join'](getSessionsDir(),_0x240d58+_0x8424d9(0x165));if(!a67_0x50583d['existsSync'](_0x2b1a90))return;try{const _0x34cb37=a67_0x50583d['readFileSync'](_0x2b1a90,_0x8424d9(0x170)),_0x4cbaa6=JSON['parse'](_0x34cb37);delete _0x4cbaa6[_0x43e27a],a67_0x50583d[_0x8424d9(0x14d)](_0x2b1a90,JSON[_0x8424d9(0x14f)](_0x4cbaa6,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x1c03af=a67_0x4695,_0x1b7b38=getSessionsDir();if(!a67_0x50583d[_0x1c03af(0x164)](_0x1b7b38))return 0x0;let _0xe1cb5c=0x0;const _0x490706=Date[_0x1c03af(0x15c)]();try{const _0x12bb4e=a67_0x50583d['readdirSync'](_0x1b7b38);for(const _0x5da7b8 of _0x12bb4e){if(!_0x5da7b8[_0x1c03af(0x150)](_0x1c03af(0x165)))continue;const _0x5948f0=a67_0x2d1db2[_0x1c03af(0x162)](_0x1b7b38,_0x5da7b8),_0x20a37a=_0x5da7b8[_0x1c03af(0x15b)](_0x1c03af(0x165),''),_0xba8083=parseInt(_0x20a37a,0xa),_0x4e892a=!isNaN(_0xba8083);if(_0x4e892a){if(!isProcessRunning(_0xba8083)){a67_0x50583d[_0x1c03af(0x169)](_0x5948f0),_0xe1cb5c++;continue;}}try{const _0xf922f7=a67_0x50583d[_0x1c03af(0x153)](_0x5948f0,_0x1c03af(0x170)),_0x556442=JSON['parse'](_0xf922f7),_0x28951e=new Date(_0x556442[_0x1c03af(0x166)])[_0x1c03af(0x160)]();_0x490706-_0x28951e>SESSION_EXPIRATION_MS&&(a67_0x50583d[_0x1c03af(0x169)](_0x5948f0),_0xe1cb5c++);}catch{a67_0x50583d['unlinkSync'](_0x5948f0),_0xe1cb5c++;}}}catch{}return _0xe1cb5c;}export function listActiveSessions(){const _0x58d345=a67_0x4695,_0x2d42da=getSessionsDir();if(!a67_0x50583d[_0x58d345(0x164)](_0x2d42da))return[];try{const _0x3408d0=a67_0x50583d[_0x58d345(0x152)](_0x2d42da),_0x54d63d=[];for(const _0x4cb7fa of _0x3408d0){if(!_0x4cb7fa['endsWith'](_0x58d345(0x165)))continue;const _0x530e99=_0x4cb7fa[_0x58d345(0x15b)](_0x58d345(0x165),''),_0x2d2a28=parseInt(_0x530e99,0xa);!isNaN(_0x2d2a28)&&isProcessRunning(_0x2d2a28)&&_0x54d63d[_0x58d345(0x158)](_0x2d2a28);}return _0x54d63d[_0x58d345(0x155)]((_0x1158a9,_0x4948f7)=>_0x1158a9-_0x4948f7);}catch{return[];}}
@@ -1 +1 @@
1
- function a68_0x1201(){const _0x444e84=['2638afwMqc','28432ciXSHo','723084kGHael','core/user-cache','2022knXCxg','clear','read','users','917CPvcZe','1418165beENxi','9DyZvCe','374943iwpQkV','14687390XzJCrN','560496aWKSIn'];a68_0x1201=function(){return _0x444e84;};return a68_0x1201();}const a68_0x2d7171=a68_0x3b0c;(function(_0x35809c,_0x6f18a3){const _0x52d128=a68_0x3b0c,_0x487f79=_0x35809c();while(!![]){try{const _0x55b87f=parseInt(_0x52d128(0x15b))/0x1+parseInt(_0x52d128(0x15e))/0x2*(-parseInt(_0x52d128(0x162))/0x3)+parseInt(_0x52d128(0x160))/0x4+-parseInt(_0x52d128(0x167))/0x5+parseInt(_0x52d128(0x15d))/0x6+-parseInt(_0x52d128(0x166))/0x7*(parseInt(_0x52d128(0x15f))/0x8)+parseInt(_0x52d128(0x15a))/0x9*(parseInt(_0x52d128(0x15c))/0xa);if(_0x55b87f===_0x6f18a3)break;else _0x487f79['push'](_0x487f79['shift']());}catch(_0x1f3d25){_0x487f79['push'](_0x487f79['shift']());}}}(a68_0x1201,0x751a8));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json',a68_0x2d7171(0x161));export function loadCachedUsers(_0x3e8920){const _0x3aad2c=a68_0x2d7171,_0xd2fed2=userCache[_0x3aad2c(0x164)](_0x3e8920);return _0xd2fed2?.[_0x3aad2c(0x165)]??null;}export function saveCachedUsers(_0x1bab68,_0x53497c){userCache['write'](_0x1bab68,{'users':_0x53497c,'cachedAt':Date['now']()});}function a68_0x3b0c(_0x1db270,_0x2c1bb8){_0x1db270=_0x1db270-0x15a;const _0x1201ea=a68_0x1201();let _0x3b0c31=_0x1201ea[_0x1db270];return _0x3b0c31;}export function clearUserCache(_0x5258f5){const _0x4dc944=a68_0x2d7171;userCache[_0x4dc944(0x163)](_0x5258f5);}
1
+ const a68_0x51cfe6=a68_0x3807;function a68_0x3423(){const _0xae8f9f=['1438166xAEPXx','36tuBEhH','230196WHTskv','577032LmKiod','704163gUrnmj','core/user-cache','users-{profile}.json','5945859mINkZD','23480rdGUwv','now','868ZPMhaq','9184PySnRy','read','clear'];a68_0x3423=function(){return _0xae8f9f;};return a68_0x3423();}(function(_0x218b9f,_0x41df62){const _0x2d67a6=a68_0x3807,_0x42c825=_0x218b9f();while(!![]){try{const _0x39cdcf=parseInt(_0x2d67a6(0xf4))/0x1+parseInt(_0x2d67a6(0xfe))/0x2+-parseInt(_0x2d67a6(0x101))/0x3+parseInt(_0x2d67a6(0xff))/0x4*(parseInt(_0x2d67a6(0xf8))/0x5)+-parseInt(_0x2d67a6(0x100))/0x6+parseInt(_0x2d67a6(0xfa))/0x7*(-parseInt(_0x2d67a6(0xfb))/0x8)+-parseInt(_0x2d67a6(0xf7))/0x9;if(_0x39cdcf===_0x41df62)break;else _0x42c825['push'](_0x42c825['shift']());}catch(_0x1bf27b){_0x42c825['push'](_0x42c825['shift']());}}}(a68_0x3423,0x696b5));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x51cfe6(0xf6),a68_0x51cfe6(0xf5));function a68_0x3807(_0x5ca3a3,_0x2950e5){_0x5ca3a3=_0x5ca3a3-0xf4;const _0x34230c=a68_0x3423();let _0x380720=_0x34230c[_0x5ca3a3];return _0x380720;}export function loadCachedUsers(_0x542957){const _0x5b2a0c=a68_0x51cfe6,_0x23fcb2=userCache[_0x5b2a0c(0xfc)](_0x542957);return _0x23fcb2?.['users']??null;}export function saveCachedUsers(_0x2b765b,_0x47cf08){const _0x3f34e7=a68_0x51cfe6;userCache['write'](_0x2b765b,{'users':_0x47cf08,'cachedAt':Date[_0x3f34e7(0xf9)]()});}export function clearUserCache(_0x326958){const _0x420ab6=a68_0x51cfe6;userCache[_0x420ab6(0xfd)](_0x326958);}
@@ -1 +1 @@
1
- (function(_0x450a9b,_0x5cbaa1){const _0x8d2a1b=a69_0x5eba,_0x3d55cf=_0x450a9b();while(!![]){try{const _0x5b58bc=-parseInt(_0x8d2a1b(0x1b6))/0x1+parseInt(_0x8d2a1b(0x1bb))/0x2+parseInt(_0x8d2a1b(0x1b7))/0x3+parseInt(_0x8d2a1b(0x1c2))/0x4*(-parseInt(_0x8d2a1b(0x1c6))/0x5)+-parseInt(_0x8d2a1b(0x1b9))/0x6*(parseInt(_0x8d2a1b(0x1be))/0x7)+-parseInt(_0x8d2a1b(0x1c0))/0x8+-parseInt(_0x8d2a1b(0x1bf))/0x9*(-parseInt(_0x8d2a1b(0x1bc))/0xa);if(_0x5b58bc===_0x5cbaa1)break;else _0x3d55cf['push'](_0x3d55cf['shift']());}catch(_0x2f791e){_0x3d55cf['push'](_0x3d55cf['shift']());}}}(a69_0x171b,0x47e61));import{readFileSync}from'fs';function a69_0x171b(){const _0x20f605=['32srBGxd','includes','.dev','../build-info.json','315820HWGhQn','200981sZaLsd','665277bdbxqA','parse','1437960KhzEAe','utf-8','470514ANMgbD','30mUdEZy','version','14zAyXUY','4443678zjXrhK','3665056oSzOpV','0.0.0'];a69_0x171b=function(){return _0x20f605;};return a69_0x171b();}function a69_0x5eba(_0x12650c,_0x118553){_0x12650c=_0x12650c-0x1b6;const _0x171ba2=a69_0x171b();let _0x5ebaf5=_0x171ba2[_0x12650c];return _0x5ebaf5;}import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x48d6b9=a69_0x5eba;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x3ca68e=fileURLToPath(import.meta.url),_0x3f70df=dirname(_0x3ca68e);try{const _0xf16c28=join(_0x3f70df,_0x48d6b9(0x1c5));cachedBuildInfo=JSON[_0x48d6b9(0x1b8)](readFileSync(_0xf16c28,_0x48d6b9(0x1ba)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0xf8c583=a69_0x5eba;if(cachedVersion!==null)return cachedVersion;const _0x41bd5c=fileURLToPath(import.meta.url),_0x35042d=dirname(_0x41bd5c),_0x145029=getBuildInfo();if(_0x145029['version'])return cachedVersion=_0x145029[_0xf8c583(0x1bd)],cachedVersion;try{const _0x53b878=join(_0x35042d,'../../package.json'),_0x15191f=JSON[_0xf8c583(0x1b8)](readFileSync(_0x53b878,'utf-8'));cachedVersion=_0x15191f[_0xf8c583(0x1bd)];}catch{cachedVersion=_0xf8c583(0x1c1);}return cachedVersion;}export function isDevVersion(){const _0x1aea2d=a69_0x5eba,_0xf1367c=getVersion();return _0xf1367c[_0x1aea2d(0x1c3)](_0x1aea2d(0x1c4))||_0xf1367c[_0x1aea2d(0x1c3)]('-');}
1
+ (function(_0x15963d,_0x3ece9a){const _0x593c4f=a69_0x3159,_0x233e8d=_0x15963d();while(!![]){try{const _0x55ac0a=-parseInt(_0x593c4f(0x164))/0x1*(parseInt(_0x593c4f(0x16f))/0x2)+-parseInt(_0x593c4f(0x171))/0x3*(-parseInt(_0x593c4f(0x16b))/0x4)+-parseInt(_0x593c4f(0x168))/0x5+parseInt(_0x593c4f(0x16a))/0x6+parseInt(_0x593c4f(0x165))/0x7*(parseInt(_0x593c4f(0x16e))/0x8)+-parseInt(_0x593c4f(0x16d))/0x9*(-parseInt(_0x593c4f(0x174))/0xa)+-parseInt(_0x593c4f(0x169))/0xb;if(_0x55ac0a===_0x3ece9a)break;else _0x233e8d['push'](_0x233e8d['shift']());}catch(_0x3a02d8){_0x233e8d['push'](_0x233e8d['shift']());}}}(a69_0x1e65,0xc8019));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a69_0x1e65(){const _0x1d646a=['../../package.json','parse','329275IBKPQy','19217132uagIjm','4802154KtWZTn','60196JNcetC','utf-8','189wbxezB','24OjfWRs','5496DxeyGp','.dev','321vsYojA','0.0.0','version','369130WyOkMp','includes','343nCIizx','907389NoPQmq'];a69_0x1e65=function(){return _0x1d646a;};return a69_0x1e65();}function a69_0x3159(_0x15a360,_0x24d5d0){_0x15a360=_0x15a360-0x164;const _0x1e654b=a69_0x1e65();let _0x315916=_0x1e654b[_0x15a360];return _0x315916;}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x4cc558=a69_0x3159;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4b4fd5=fileURLToPath(import.meta.url),_0x41ce5f=dirname(_0x4b4fd5);try{const _0x564f88=join(_0x41ce5f,'../build-info.json');cachedBuildInfo=JSON[_0x4cc558(0x167)](readFileSync(_0x564f88,_0x4cc558(0x16c)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x48de72=a69_0x3159;if(cachedVersion!==null)return cachedVersion;const _0x15f340=fileURLToPath(import.meta.url),_0x2bcc5a=dirname(_0x15f340),_0x5cb14b=getBuildInfo();if(_0x5cb14b[_0x48de72(0x173)])return cachedVersion=_0x5cb14b[_0x48de72(0x173)],cachedVersion;try{const _0x5616d5=join(_0x2bcc5a,_0x48de72(0x166)),_0x336dc1=JSON[_0x48de72(0x167)](readFileSync(_0x5616d5,_0x48de72(0x16c)));cachedVersion=_0x336dc1['version'];}catch{cachedVersion=_0x48de72(0x172);}return cachedVersion;}export function isDevVersion(){const _0x2e6223=a69_0x3159,_0x424b01=getVersion();return _0x424b01[_0x2e6223(0x175)](_0x2e6223(0x170))||_0x424b01['includes']('-');}