@treasuredata/tdx 2026.4.21 → 2026.4.23

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 +17 -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_0x54a495=a57_0xb325;(function(_0x2f7377,_0xd01ad9){const _0x4a57fd=a57_0xb325,_0x13fe37=_0x2f7377();while(!![]){try{const _0x4022ff=-parseInt(_0x4a57fd(0x23c))/0x1*(-parseInt(_0x4a57fd(0x237))/0x2)+-parseInt(_0x4a57fd(0x223))/0x3*(-parseInt(_0x4a57fd(0x236))/0x4)+parseInt(_0x4a57fd(0x210))/0x5*(parseInt(_0x4a57fd(0x202))/0x6)+-parseInt(_0x4a57fd(0x20e))/0x7+-parseInt(_0x4a57fd(0x1f6))/0x8*(-parseInt(_0x4a57fd(0x211))/0x9)+parseInt(_0x4a57fd(0x1f8))/0xa+-parseInt(_0x4a57fd(0x218))/0xb;if(_0x4022ff===_0xd01ad9)break;else _0x13fe37['push'](_0x13fe37['shift']());}catch(_0x2aabf4){_0x13fe37['push'](_0x13fe37['shift']());}}}(a57_0x3612,0xa59c0));function a57_0x3612(){const _0x42f507=['stg-ap01','proxy','llm_default_project','startsWith','endsWith','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','\x20env\x20var','name','entries','ap01','split','eu01','toUpperCase','next','895460qGzVPB','2150kOBjnZ','yellow','warn','profile','tdx.json','1055UnjCNt','clear','stg-ap03','path','source','some','keychain\x20(profile:\x20','readFileSync','TD_API_KEY_','dev-eu01','stringify','627136LrEWkW','read','10885670QDwzSw','accessToken','apiKeys','TDX_ACCESS_TOKEN_','number','apiKey','Warning:\x20Unknown\x20site\x20\x27','match','release_channel','config/llm-project','426knRNPM','config/account-info','us01','toISOString','site','keychain','includes','projectId','ap03','join','tdx','TDX_API_KEY_','3968188gLcxnZ','TDX_API_KEY\x20env\x20var','90865rHeeFe','144WdXCHV','llm_default_agent','Warning:\x20Failed\x20to\x20read\x20','stg-us01','trim','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','ap02','46129842EdcLes','filter','string','.config','map','.json','parse','existsSync','replace','utf-8','\x27,\x20defaulting\x20to\x20us01','9IeFCrK','write','stable','config/llm-agent','accountId'];a57_0x3612=function(){return _0x42f507;};return a57_0x3612();}import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0xcb6c6d from'node:fs';import*as a57_0x24dedc from'node:path';function a57_0xb325(_0x470492,_0x297d98){_0x470492=_0x470492-0x1f2;const _0x36128e=a57_0x3612();let _0xb3253e=_0x36128e[_0x470492];return _0xb3253e;}import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a57_0x529f41 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x29ee7b=a57_0xb325;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x29ee7b(0x21b),_0x29ee7b(0x20c));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x3be5f2){const _0x3092dd=a57_0xb325,_0x55a67f=getConfigDir();return _0x3be5f2?a57_0x24dedc[_0x3092dd(0x20b)](_0x55a67f,'.env.'+_0x3be5f2):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x54a495(0x22a),a57_0x54a495(0x201));export function getLLMProjectCacheFile(_0x540f52){const _0xbc0080=a57_0x54a495;return llmProjectCache[_0xbc0080(0x23f)](_0x540f52);}export function readCachedLLMProject(_0x23d89f){const _0x52ffac=a57_0x54a495,_0x33bc0c=llmProjectCache[_0x52ffac(0x1f7)](_0x23d89f);if(_0x33bc0c&&typeof _0x33bc0c['id']===_0x52ffac(0x21a)&&typeof _0x33bc0c[_0x52ffac(0x22f)]===_0x52ffac(0x21a))return _0x33bc0c;return null;}export function writeCachedLLMProject(_0x5cc9b4,_0x4ef96a,_0x1c64bd){try{llmProjectCache['write']({'name':_0x5cc9b4,'id':_0x4ef96a},_0x1c64bd);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x54a495(0x212),a57_0x54a495(0x226));export function getLLMAgentCacheFile(_0x2f9c80){return llmAgentCache['path'](_0x2f9c80);}export function readCachedLLMAgent(_0x1e2cd0){const _0x15432e=a57_0x54a495,_0x4f947c=llmAgentCache[_0x15432e(0x1f7)](_0x1e2cd0);if(_0x4f947c&&typeof _0x4f947c['id']===_0x15432e(0x21a)&&typeof _0x4f947c[_0x15432e(0x22f)]===_0x15432e(0x21a)&&typeof _0x4f947c[_0x15432e(0x209)]===_0x15432e(0x21a))return _0x4f947c;return null;}export function writeCachedLLMAgent(_0x300f87,_0x2d8da,_0x27858f,_0x29cffb){const _0x14764c=a57_0x54a495;try{llmAgentCache[_0x14764c(0x224)]({'name':_0x300f87,'id':_0x2d8da,'projectId':_0x27858f},_0x29cffb);}catch{}}export function clearCachedLLMAgent(_0x1cb03f){const _0x300e34=a57_0x54a495;try{llmAgentCache[_0x300e34(0x23d)](_0x1cb03f);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a57_0x54a495(0x203),{'suffix':a57_0x54a495(0x21d)});export function getAccountInfoCacheFile(_0x46c621){return accountInfoCache['path'](_0x46c621);}export function readCachedAccountInfo(_0x48934){const _0x15783b=a57_0x54a495,_0x3045f9=accountInfoCache[_0x15783b(0x1f7)](_0x48934);if(_0x3045f9&&typeof _0x3045f9[_0x15783b(0x206)]===_0x15783b(0x21a)&&typeof _0x3045f9[_0x15783b(0x227)]===_0x15783b(0x1fc))return _0x3045f9;return null;}export function writeCachedAccountInfo(_0x299836,_0x5c8ee8,_0x4302fa){const _0x5ead19=a57_0x54a495;try{accountInfoCache[_0x5ead19(0x224)]({'site':_0x299836,'accountId':_0x5c8ee8,'cachedAt':new Date()[_0x5ead19(0x205)]()},_0x4302fa);}catch{}}export function parseEnvFile(_0xeec03b){const _0x227908=a57_0x54a495,_0x248ce6={};for(const _0x18e9bd of _0xeec03b[_0x227908(0x232)]('\x0a')){const _0x20615f=_0x18e9bd[_0x227908(0x215)]();if(!_0x20615f||_0x20615f[_0x227908(0x22b)]('#'))continue;const _0x577dd8=_0x20615f[_0x227908(0x1ff)](/^([^=]+)=(.*)$/);if(_0x577dd8){const _0x404ad3=_0x577dd8[0x1][_0x227908(0x215)]();let _0x5bf297=_0x577dd8[0x2][_0x227908(0x215)]();(_0x5bf297[_0x227908(0x22b)]('\x22')&&_0x5bf297['endsWith']('\x22')||_0x5bf297[_0x227908(0x22b)]('\x27')&&_0x5bf297[_0x227908(0x22c)]('\x27'))&&(_0x5bf297=_0x5bf297['slice'](0x1,-0x1)),_0x248ce6[_0x404ad3]=_0x5bf297;}}return _0x248ce6;}export function readUserConfig(){const _0x220e82=a57_0x54a495,_0x4553b2=getConfigFile();if(!existsSync(_0x4553b2))return{};try{const _0x51d7f5=readFileSync(_0x4553b2,'utf-8');return parseEnvFile(_0x51d7f5);}catch(_0x4574b5){return console[_0x220e82(0x239)](_0x220e82(0x22d)+_0x4553b2+':',_0x4574b5),{};}}export function resolveSite(_0x50eaa8){const _0xb64e33=a57_0x54a495,_0x41f050=[_0xb64e33(0x204),_0xb64e33(0x231),_0xb64e33(0x233),_0xb64e33(0x217),_0xb64e33(0x20a),'dev-us01',_0xb64e33(0x1f4),_0xb64e33(0x214),_0xb64e33(0x228),_0xb64e33(0x23e)];if(_0x41f050[_0xb64e33(0x208)](_0x50eaa8))return _0x50eaa8;if(_0x50eaa8 in SITE_ALIASES)return SITE_ALIASES[_0x50eaa8];return console[_0xb64e33(0x239)](_0xb64e33(0x1fe)+_0x50eaa8+_0xb64e33(0x222)),_0xb64e33(0x204);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x4f6825){const _0x3df6dd=a57_0x54a495,_0x1c36f3=_0x4f6825||getActiveProfileName()||undefined;if(_0x1c36f3){const _0x187dab=_0x3df6dd(0x1fb)+normalizeProfileForEnvVar(_0x1c36f3);if(process.env[_0x187dab])return{'accessToken':process.env[_0x187dab],'source':_0x187dab+_0x3df6dd(0x22e)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':'TDX_ACCESS_TOKEN\x20env\x20var'};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x486a9b=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x486a9b)return{'accessToken':_0x486a9b,'source':'TDX_ACCESS_TOKEN_FILE'};}return null;}function readAccessTokenFile(_0x234025){const _0x53372d=a57_0x54a495;try{const _0x358678=readFileSync(_0x234025,_0x53372d(0x221))[_0x53372d(0x215)]();return _0x358678||null;}catch{return null;}}export function getAccessToken(_0x37efbb){const _0x4207e0=a57_0x54a495;return resolveAccessToken(_0x37efbb)?.[_0x4207e0(0x1f9)];}export function getAPIKey(_0x21b7f5){const _0x11a635=a57_0x54a495,_0x2b83e0=_0x21b7f5||getActiveProfileName();if(_0x2b83e0){const _0x2c472c=_0x11a635(0x20d)+normalizeProfileForEnvVar(_0x2b83e0);if(process.env[_0x2c472c])return process.env[_0x2c472c];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x169575){const _0x46062e=a57_0x54a495;return _0x169575[_0x46062e(0x234)]()[_0x46062e(0x220)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x1563cb,_0x109ad1){const _0x533e4b=a57_0x54a495,_0x3fc871=resolveAccessToken(_0x109ad1);if(_0x3fc871)return{'apiKey':_0x3fc871[_0x533e4b(0x1f9)],'source':_0x3fc871[_0x533e4b(0x240)],'isDeprecated':![]};const _0x3d343b=_0x109ad1||getActiveProfileName()||undefined;if(_0x3d343b){const _0x25246b='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x3d343b);if(process.env[_0x25246b])return{'apiKey':process.env[_0x25246b],'source':_0x25246b+_0x533e4b(0x22e),'isDeprecated':![]};const _0x1c30f6=getCachedCredential(_0x1563cb,_0x3d343b);if(_0x1c30f6)return{'apiKey':_0x1c30f6,'source':_0x533e4b(0x242)+_0x3d343b+')','isDeprecated':![]};const _0x1a7fdd=await getKeychainAPIKey(_0x3d343b);if(_0x1a7fdd)return setCachedCredential(_0x1a7fdd,_0x1563cb,_0x3d343b),{'apiKey':_0x1a7fdd,'source':_0x533e4b(0x242)+_0x3d343b+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x533e4b(0x20f),'isDeprecated':![]};if(!_0x3d343b){const _0x58f141=getCachedCredential(_0x1563cb,undefined);if(_0x58f141)return{'apiKey':_0x58f141,'source':_0x533e4b(0x207),'isDeprecated':![]};const _0x414e0a=await getKeychainAPIKey(undefined);if(_0x414e0a)return setCachedCredential(_0x414e0a,_0x1563cb,undefined),{'apiKey':_0x414e0a,'source':_0x533e4b(0x207),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x220a99,_0x48a6d2){const _0x3a8168=a57_0x54a495,_0x15466c=await resolveAPIKeyAsync(_0x220a99,_0x48a6d2);return _0x15466c?.[_0x3a8168(0x1fd)];}function cleanupLegacyEnvFile(_0x392213){const _0x4147e8=a57_0x54a495;if(!existsSync(_0x392213))return![];try{const _0x5bdcec=readFileSync(_0x392213,_0x4147e8(0x221)),_0xe82300=_0x5bdcec[_0x4147e8(0x232)]('\x0a'),_0x2c2b67=_0xe82300[_0x4147e8(0x219)](_0x76ce5b=>{const _0x3a4290=_0x4147e8,_0x23b6dc=_0x76ce5b[_0x3a4290(0x215)]();if(!_0x23b6dc||_0x23b6dc['startsWith']('#'))return!![];const [_0x25c4b6]=_0x23b6dc[_0x3a4290(0x232)]('=');return!_0x25c4b6['startsWith']('TD_API_KEY');}),_0x473c72=_0x2c2b67[_0x4147e8(0x241)](_0x2cc0d4=>{const _0x55b23a=_0x4147e8,_0xdb628d=_0x2cc0d4[_0x55b23a(0x215)]();return _0xdb628d&&!_0xdb628d[_0x55b23a(0x22b)]('#');});if(!_0x473c72)return unlinkSync(_0x392213),!![];return writeFileSync(_0x392213,_0x2c2b67[_0x4147e8(0x20b)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x1e2f93=a57_0x54a495;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x48cb63=a57_0x24dedc['join'](getConfigDir(),_0x1e2f93(0x23b));if(!a57_0xcb6c6d[_0x1e2f93(0x21f)](_0x48cb63))return null;try{const _0x19502f=a57_0xcb6c6d[_0x1e2f93(0x1f2)](_0x48cb63,_0x1e2f93(0x221)),_0xf70184=JSON[_0x1e2f93(0x21e)](_0x19502f);return _0xf70184[_0x1e2f93(0x23a)]||null;}catch{return null;}}export function saveAPIKey(_0x1de458,_0x65bac8,_0x59a7d8){const _0x57af58=a57_0x54a495,_0x2ade88=getConfigDir(),_0x155fb4=getConfigFilePath(_0x59a7d8);!existsSync(_0x2ade88)&&mkdirSync(_0x2ade88,{'recursive':!![],'mode':0x1c0});let _0x322653={};if(existsSync(_0x155fb4))try{const _0xd05e76=readFileSync(_0x155fb4,_0x57af58(0x221));_0x322653=parseEnvFile(_0xd05e76);}catch(_0x9d672e){console['warn'](_0x57af58(0x213)+_0x155fb4+':',_0x9d672e);}const _0x2871d9=_0x1de458['toUpperCase']()[_0x57af58(0x220)](/-/g,'_');_0x322653[_0x57af58(0x1f3)+_0x2871d9]=_0x65bac8;const _0xb26767=Object[_0x57af58(0x230)](_0x322653)[_0x57af58(0x21c)](([_0x261882,_0x16dbc2])=>_0x261882+'='+_0x16dbc2);writeFileSync(_0x155fb4,_0xb26767[_0x57af58(0x20b)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0xd43232,_0x73f897,_0x52541e){const _0x10b6c7=a57_0x54a495;await saveKeychainAPIKey(_0xd43232,_0x52541e),setCachedCredential(_0xd43232,_0x73f897,_0x52541e);const _0x2f64a3=getConfigFilePath(_0x52541e);cleanupLegacyEnvFile(_0x2f64a3)&&console[_0x10b6c7(0x239)](a57_0x529f41[_0x10b6c7(0x238)](_0x10b6c7(0x216)));}export function loadConfig(){const _0x326752=a57_0x54a495,_0x20bdec={'apiKeys':{},'defaultSite':'us01'},_0x30d3cd=[_0x326752(0x204),'ap01',_0x326752(0x233),_0x326752(0x217),_0x326752(0x20a),'dev-us01',_0x326752(0x1f4),_0x326752(0x214),'stg-ap01',_0x326752(0x23e)],_0xbdb2f5=getAPIKey();if(_0xbdb2f5)for(const _0x37b7f8 of _0x30d3cd){_0x20bdec[_0x326752(0x1fa)][_0x37b7f8]=_0xbdb2f5;}return _0x20bdec;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x282d6e=a57_0x54a495,_0x359622=a57_0x24dedc[_0x282d6e(0x20b)](getConfigDir(),_0x282d6e(0x23b));if(!a57_0xcb6c6d[_0x282d6e(0x21f)](_0x359622))return undefined;try{const _0x58e81d=a57_0xcb6c6d[_0x282d6e(0x1f2)](_0x359622,'utf-8'),_0x1ceb6d=JSON['parse'](_0x58e81d);return typeof _0x1ceb6d['proxy']===_0x282d6e(0x21a)?_0x1ceb6d[_0x282d6e(0x229)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x1c2433=a57_0x54a495,_0x4942b7=process.env.TDX_RELEASE_CHANNEL;if(_0x4942b7===_0x1c2433(0x235)||_0x4942b7===_0x1c2433(0x225))return _0x4942b7;const _0x3eb8bf=a57_0x24dedc[_0x1c2433(0x20b)](getConfigDir(),_0x1c2433(0x23b));if(!a57_0xcb6c6d['existsSync'](_0x3eb8bf))return _0x1c2433(0x225);try{const _0x5f5bf9=a57_0xcb6c6d[_0x1c2433(0x1f2)](_0x3eb8bf,'utf-8'),_0x4c3ced=JSON[_0x1c2433(0x21e)](_0x5f5bf9);if(_0x4c3ced[_0x1c2433(0x200)]===_0x1c2433(0x235))return'next';}catch{}return _0x1c2433(0x225);}export function saveReleaseChannel(_0x7c0a7b){const _0x507884=a57_0x54a495,_0x400895=getConfigDir(),_0x1f77a4=a57_0x24dedc[_0x507884(0x20b)](_0x400895,_0x507884(0x23b));!existsSync(_0x400895)&&mkdirSync(_0x400895,{'recursive':!![],'mode':0x1c0});let _0x55492c={};if(existsSync(_0x1f77a4))try{const _0xece1ae=readFileSync(_0x1f77a4,_0x507884(0x221));_0x55492c=JSON[_0x507884(0x21e)](_0xece1ae);}catch{}_0x55492c[_0x507884(0x200)]=_0x7c0a7b,writeFileSync(_0x1f77a4,JSON[_0x507884(0x1f5)](_0x55492c,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_0x5b1f03=a58_0x1b5f;function a58_0x1b5f(_0xeba5c2,_0x235f24){_0xeba5c2=_0xeba5c2-0x1c6;const _0x4bf9c4=a58_0x4bf9();let _0x1b5f65=_0x4bf9c4[_0xeba5c2];return _0x1b5f65;}(function(_0x127e16,_0x46f7f5){const _0x5605aa=a58_0x1b5f,_0x1f7ff1=_0x127e16();while(!![]){try{const _0x4f5527=-parseInt(_0x5605aa(0x1c7))/0x1*(-parseInt(_0x5605aa(0x1c8))/0x2)+parseInt(_0x5605aa(0x1d9))/0x3*(-parseInt(_0x5605aa(0x1ca))/0x4)+-parseInt(_0x5605aa(0x1c6))/0x5*(parseInt(_0x5605aa(0x1d8))/0x6)+parseInt(_0x5605aa(0x1cd))/0x7*(-parseInt(_0x5605aa(0x1d5))/0x8)+-parseInt(_0x5605aa(0x1cc))/0x9+-parseInt(_0x5605aa(0x1d3))/0xa*(parseInt(_0x5605aa(0x1cb))/0xb)+-parseInt(_0x5605aa(0x1c9))/0xc*(-parseInt(_0x5605aa(0x1ce))/0xd);if(_0x4f5527===_0x46f7f5)break;else _0x1f7ff1['push'](_0x1f7ff1['shift']());}catch(_0x4f99ab){_0x1f7ff1['push'](_0x1f7ff1['shift']());}}}(a58_0x4bf9,0xb78a3));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x5b1f03(0x1d2),a58_0x5b1f03(0x1d1));function a58_0x4bf9(){const _0x5417c1=['107393UXPZGu','clear','now','core/connection-cache','connections-{profile}.json','10430lqEwNU','write','8XbOkQP','connections','read','72iUxGCl','859146MaJFrd','504345DCLKeo','590388RvZxCq','2vuUBIK','7704ZwcIQM','16szFksw','15389YmnOFS','24291uLWkpy','9270513vtufkk'];a58_0x4bf9=function(){return _0x5417c1;};return a58_0x4bf9();}export function loadCachedConnections(_0x5aaf86){const _0xa74611=a58_0x5b1f03,_0x5b645d=connectionCache[_0xa74611(0x1d7)](_0x5aaf86);return _0x5b645d?.[_0xa74611(0x1d6)]??null;}export function saveCachedConnections(_0x2ff51e,_0x52b8d5){const _0x49c748=a58_0x5b1f03;connectionCache[_0x49c748(0x1d4)](_0x2ff51e,{'connections':_0x52b8d5,'cachedAt':Date[_0x49c748(0x1d0)]()});}export function clearConnectionCache(_0x3a59bd){const _0x5b52ed=a58_0x5b1f03;connectionCache[_0x5b52ed(0x1cf)](_0x3a59bd);}
@@ -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_0x30b49e=a59_0x4e0a;(function(_0x26b2d4,_0x3cd8d8){const _0x8880d9=a59_0x4e0a,_0x8ff67f=_0x26b2d4();while(!![]){try{const _0x2c49f7=parseInt(_0x8880d9(0xa2))/0x1+parseInt(_0x8880d9(0xba))/0x2+parseInt(_0x8880d9(0xbd))/0x3*(parseInt(_0x8880d9(0xb8))/0x4)+parseInt(_0x8880d9(0xa8))/0x5*(parseInt(_0x8880d9(0xaf))/0x6)+parseInt(_0x8880d9(0xb2))/0x7+parseInt(_0x8880d9(0xb4))/0x8*(parseInt(_0x8880d9(0xbb))/0x9)+-parseInt(_0x8880d9(0xb7))/0xa;if(_0x2c49f7===_0x3cd8d8)break;else _0x8ff67f['push'](_0x8ff67f['shift']());}catch(_0x21a205){_0x8ff67f['push'](_0x8ff67f['shift']());}}}(a59_0x2b52,0x3703a));import a59_0x48abc9 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;function a59_0x2b52(){const _0x1a6f4b=['ap01','Select\x20your\x20Treasure\x20Data\x20site:','Cancelled','132uapMtq','log','test','3035347VBxxRH','length','1365368lomoaT','jp\x20\x20\x20-\x20Japan','eu\x20\x20\x20-\x20Europe','11481290mRwVtn','238904rWBbds','findIndex','549740Gsuvny','9mnwMGv','us\x20\x20\x20-\x20United\x20States','18iHEqRX','trim','value','push','Site\x20name\x20cannot\x20be\x20empty','24827dcNAew','customSite','select','us01','other','eu01','25255afrqbQ','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','site'];a59_0x2b52=function(){return _0x1a6f4b;};return a59_0x2b52();}export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0xe0f454,_0x3a6ec2){if(_0xe0f454===undefined)return _0x3a6ec2;if(typeof _0xe0f454==='number')return _0xe0f454;return parseInt(_0xe0f454,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x30b49e(0xbc),'value':'us01'},{'title':a59_0x30b49e(0xb5),'value':a59_0x30b49e(0xac)},{'title':a59_0x30b49e(0xb6),'value':a59_0x30b49e(0xa7)},{'title':'ap02\x20-\x20Korea','value':'ap02'}];function a59_0x4e0a(_0x3eaedc,_0x257e65){_0x3eaedc=_0x3eaedc-0x9e;const _0x2b52ae=a59_0x2b52();let _0x4e0aab=_0x2b52ae[_0x3eaedc];return _0x4e0aab;}export function buildSiteChoices(_0x2fd431){const _0x440dac=a59_0x30b49e,_0x1ca05f=[...STANDARD_SITE_CHOICES];let _0x18034d=_0x1ca05f[_0x440dac(0xb9)](_0x385b63=>_0x385b63[_0x440dac(0x9f)]===_0x2fd431);return _0x18034d===-0x1&&_0x2fd431!==_0x440dac(0xa5)&&(_0x1ca05f['push']({'title':_0x2fd431,'value':_0x2fd431}),_0x18034d=_0x1ca05f[_0x440dac(0xb3)]-0x1),_0x1ca05f[_0x440dac(0xa0)]({'title':'Enter\x20custom\x20site','value':'other'}),{'choices':_0x1ca05f,'initialIndex':_0x18034d>=0x0?_0x18034d:0x0};}export async function promptSiteSelection(_0x2b5916,_0x2461a2,_0x4a4751=a59_0x30b49e(0xae)){const _0x1a9372=a59_0x30b49e,{choices:_0xcc250a,initialIndex:_0x1825a3}=buildSiteChoices(_0x2b5916),_0x36198e=_0x2461a2?_0x1a9372(0xa9)+_0x2461a2+'):':_0x1a9372(0xad),_0x60b4b8=await a59_0x48abc9({'type':_0x1a9372(0xa4),'name':_0x1a9372(0xab),'message':_0x36198e,'choices':_0xcc250a,'initial':_0x1825a3});if(!_0x60b4b8['site'])return console['log']('\x0a'+_0x4a4751),null;if(_0x60b4b8[_0x1a9372(0xab)]!==_0x1a9372(0xa6))return _0x60b4b8[_0x1a9372(0xab)];const _0xfaa9e7=await a59_0x48abc9({'type':'text','name':_0x1a9372(0xa3),'message':'Enter\x20site\x20name:','initial':_0x1a9372(0xa5),'validate':_0x273a98=>{const _0x228c23=_0x1a9372;if(!_0x273a98||!_0x273a98[_0x228c23(0x9e)]())return _0x228c23(0xa1);if(!/^[a-z0-9-]+$/[_0x228c23(0xb1)](_0x273a98['trim']()))return _0x228c23(0xaa);return!![];}});if(!_0xfaa9e7[_0x1a9372(0xa3)])return console[_0x1a9372(0xb0)]('\x0a'+_0x4a4751),null;return _0xfaa9e7[_0x1a9372(0xa3)];}
@@ -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(_0x21d66c,_0x1b153f){const _0x2e0566=a60_0x3892,_0x8151cd=_0x21d66c();while(!![]){try{const _0x384fe8=-parseInt(_0x2e0566(0x107))/0x1+parseInt(_0x2e0566(0x101))/0x2*(parseInt(_0x2e0566(0x103))/0x3)+-parseInt(_0x2e0566(0xf7))/0x4*(parseInt(_0x2e0566(0xfa))/0x5)+parseInt(_0x2e0566(0xf9))/0x6+parseInt(_0x2e0566(0xfb))/0x7*(-parseInt(_0x2e0566(0x106))/0x8)+-parseInt(_0x2e0566(0x102))/0x9*(-parseInt(_0x2e0566(0xf6))/0xa)+parseInt(_0x2e0566(0xfd))/0xb*(parseInt(_0x2e0566(0xfc))/0xc);if(_0x384fe8===_0x1b153f)break;else _0x8151cd['push'](_0x8151cd['shift']());}catch(_0x3d9f71){_0x8151cd['push'](_0x8151cd['shift']());}}}(a60_0x6678,0x9d295));function a60_0x3892(_0x39eff7,_0x404f81){_0x39eff7=_0x39eff7-0xf5;const _0x6678c3=a60_0x6678();let _0x389233=_0x6678c3[_0x39eff7];return _0x389233;}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x3a22f5,_0x10b855){const _0x551fa8=a60_0x3892,_0x20b343=_0x3a22f5||_0x551fa8(0x104),_0x271d39=_0x10b855||_0x551fa8(0xff);return _0x20b343+':'+_0x271d39;}export function getCachedCredential(_0x4d5e67,_0x5a3ca1){const _0x33265d=a60_0x3892,_0x3d202c=getCacheKey(_0x4d5e67,_0x5a3ca1),_0x3b48e3=cache[_0x33265d(0x100)](_0x3d202c);if(!_0x3b48e3)return null;if(Date[_0x33265d(0xfe)]()-_0x3b48e3['loadedAt']>CACHE_TTL_MS)return cache[_0x33265d(0xf5)](_0x3d202c),null;return _0x3b48e3['apiKey'];}export function setCachedCredential(_0x2622be,_0x44f78b,_0x2bad39){const _0x1254d1=a60_0x3892,_0x3c250f=getCacheKey(_0x44f78b,_0x2bad39);cache[_0x1254d1(0xf8)](_0x3c250f,{'apiKey':_0x2622be,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x386608=a60_0x3892;cache[_0x386608(0x105)]();}export function clearCachedCredential(_0x13ade4,_0x45c4b8){const _0x219802=a60_0x3892,_0x5b554e=getCacheKey(_0x13ade4,_0x45c4b8);cache[_0x219802(0xf5)](_0x5b554e);}function a60_0x6678(){const _0x530a53=['1055574BsGdgC','147bdZzaO','__default_site__','clear','8KIeLIV','1201756SzgNge','delete','20brNzRI','4pOTSWb','set','6813636WqaCdn','2627960TTsBxt','1898414hhfbZu','5484WTZRzZ','5401MxZIwh','now','__default_profile__','get','42764roTudp'];a60_0x6678=function(){return _0x530a53;};return a60_0x6678();}
@@ -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_0x5c45c9=a61_0x16e6;(function(_0x24c653,_0x1c8e6e){const _0x320289=a61_0x16e6,_0x115aa0=_0x24c653();while(!![]){try{const _0x424238=-parseInt(_0x320289(0xe7))/0x1*(parseInt(_0x320289(0xd9))/0x2)+parseInt(_0x320289(0xc5))/0x3+-parseInt(_0x320289(0xf1))/0x4*(parseInt(_0x320289(0xd6))/0x5)+-parseInt(_0x320289(0xbe))/0x6+parseInt(_0x320289(0x103))/0x7*(parseInt(_0x320289(0xea))/0x8)+parseInt(_0x320289(0xf4))/0x9*(-parseInt(_0x320289(0x102))/0xa)+parseInt(_0x320289(0xd8))/0xb;if(_0x424238===_0x1c8e6e)break;else _0x115aa0['push'](_0x115aa0['shift']());}catch(_0x570421){_0x115aa0['push'](_0x115aa0['shift']());}}}(a61_0x4cd8,0xbcd42));function a61_0x4cd8(){const _0x247b58=['260lYmeDh','llm_project','30534339QJXCUV','5422sJEZRj','activeProfile','not\x20set','none','log','config','env','getParameters','llmProject','logLevel','Global','llm_agent','(active)','expires_at','389uBNtIx','(using\x20session:\x20','cliFlags','51504CxZPDa','.env','sessions','workflowProject','string','access_token','now','25940TzfYnR','displayWithSources','[configuration\x20files]','662391EuwyKX','Profile','profileCredentials','loadGlobalConfig','segmentPath','replace','project','site','assign','.json','resolveAPIKeyAsync','(session:\x20','profile:\x20','readFileSync','10jWNhtb','49ZzzfCT','Global\x20Credentials','configFiles','refresh_token','segment_path','apiKey','us01','session','Session','database','parent_segment','layers','profileSource','global','getSource','entries','globalCredentials','parse','7519584nMZsyX','default','tdx.json','[context]','accessToken','green','injectIntoOptions','2013567mtaGMF','composableAudience','cli','cyan','sessionId','join','workflow_project','proxy','bold','profiles','llmAgent','display','CLI\x20flag:\x20--','profile','existsSync','dim','composable_audience'];a61_0x4cd8=function(){return _0x247b58;};return a61_0x4cd8();}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';function a61_0x16e6(_0x33c3f6,_0x4e8d8d){_0x33c3f6=_0x33c3f6-0xbb;const _0x4cd84d=a61_0x4cd8();let _0x16e628=_0x4cd84d[_0x33c3f6];return _0x16e628;}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a61_0x103bc3 from'node:fs';import*as a61_0x551c95 from'node:path';import a61_0x32ae15 from'chalk';export class GlobalContext{[a61_0x5c45c9(0xfb)];['database'];[a61_0x5c45c9(0x10d)];[a61_0x5c45c9(0x107)];[a61_0x5c45c9(0xd7)];[a61_0x5c45c9(0xe4)];['workflow_project'];['composable_audience'];['apiKey'];[a61_0x5c45c9(0xc2)];['proxy'];['verbose'];['logLevel'];[a61_0x5c45c9(0xd2)];['profileSource']=null;[a61_0x5c45c9(0x10e)];[a61_0x5c45c9(0xda)];[a61_0x5c45c9(0xc9)];['configFiles'];constructor(_0x271573){const _0x469528=a61_0x5c45c9;this[_0x469528(0xc9)]=getSessionID(_0x271573[_0x469528(0x10a)]);const _0x425e05=loadSessionContext(_0x271573[_0x469528(0x10a)]),_0x4cd476=loadProjectConfig(),_0x20dc3d=this[_0x469528(0xf7)]();if(_0x271573[_0x469528(0xd2)])this[_0x469528(0xda)]=_0x271573[_0x469528(0xd2)],this[_0x469528(0x10f)]=_0x469528(0xc7);else{if(_0x425e05?.[_0x469528(0xd2)])this[_0x469528(0xda)]=_0x425e05[_0x469528(0xd2)],this[_0x469528(0x10f)]=_0x469528(0x10a);else{if(_0x20dc3d[_0x469528(0xd2)])this[_0x469528(0xda)]=_0x20dc3d[_0x469528(0xd2)],this['profileSource']=_0x469528(0xde);else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this['profileSource']=_0x469528(0xdf)):(this['activeProfile']=null,this[_0x469528(0x10f)]=null);}}const _0xa607b8=this['activeProfile']?loadProfile(this[_0x469528(0xda)]):null,_0x553601=_0x44a6b1=>{const _0x5628de=_0x469528;if(!_0x44a6b1)return{};const _0xbbabc0=_0x44a6b1,_0x528498={};for(const [_0x2044dc,_0x4d302d]of Object[_0x5628de(0xbb)](_0xbbabc0)){typeof _0x4d302d===_0x5628de(0xee)&&(_0x528498[_0x2044dc]=_0x4d302d);}return _0x528498;},_0x468711={},_0x50a4e6=(_0x17e6f9,_0x4e0709,_0x452758)=>{const _0x1218a9=_0x469528;if(!_0x17e6f9)return![];if(_0x452758&&_0x17e6f9===_0x452758)return![];const _0x27918f=_0x425e05,_0x1ad2d3=_0x4cd476,_0x4242c1=_0xa607b8?.[_0x1218a9(0xde)],_0x1a1c3a=_0x20dc3d,_0x4db8fd=_0x27918f?.[_0x4e0709],_0x107361=_0x1ad2d3?.[_0x4e0709],_0x144061=_0x4242c1?.[_0x4e0709],_0x40270a=_0x1a1c3a[_0x4e0709];return _0x17e6f9!==_0x4db8fd&&_0x17e6f9!==_0x107361&&_0x17e6f9!==_0x144061&&_0x17e6f9!==_0x40270a;},_0x3c54ed=[{'optionKey':'site','contextKey':'site','defaultValue':_0x469528(0x109)},{'optionKey':_0x469528(0x10c),'contextKey':_0x469528(0x10c)},{'optionKey':'parentSegment','contextKey':_0x469528(0x10d)},{'optionKey':'llmProject','contextKey':_0x469528(0xd7)},{'optionKey':_0x469528(0xcf),'contextKey':_0x469528(0xe4)},{'optionKey':'composableAudience','contextKey':'composable_audience'},{'optionKey':_0x469528(0xd2),'contextKey':_0x469528(0xd2)}];for(const {optionKey:_0x262130,contextKey:_0x40e27c,defaultValue:_0x1fe4bd}of _0x3c54ed){const _0x47fe04=_0x271573[_0x262130];_0x50a4e6(_0x47fe04,_0x40e27c,_0x1fe4bd)&&(_0x468711[_0x40e27c]=_0x47fe04);}this[_0x469528(0x10e)]={'cliFlags':_0x468711,'session':_0x553601(_0x425e05),'project':_0x553601(_0x4cd476),'profile':_0x553601(_0xa607b8?.['config']),'global':_0x553601(_0x20dc3d)};const _0x3b8295={...this[_0x469528(0x10e)][_0x469528(0x110)],...this[_0x469528(0x10e)][_0x469528(0xd2)],...this[_0x469528(0x10e)][_0x469528(0xfa)]};process.env.TDX_SITE&&!this['layers'][_0x469528(0x10a)][_0x469528(0xfb)]&&!this[_0x469528(0x10e)]['cliFlags'][_0x469528(0xfb)]&&(_0x3b8295[_0x469528(0xfb)]=process.env.TDX_SITE);Object['assign'](_0x3b8295,this['layers'][_0x469528(0x10a)]),Object[_0x469528(0xfc)](_0x3b8295,this[_0x469528(0x10e)][_0x469528(0xe9)]);const _0x4bf2f0=_0x3b8295[_0x469528(0xfb)]||_0x469528(0x109);this['site']=resolveSite(_0x4bf2f0),this[_0x469528(0x10c)]=_0x3b8295[_0x469528(0x10c)],this[_0x469528(0x10d)]=_0x3b8295[_0x469528(0x10d)],this[_0x469528(0x107)]=_0x3b8295[_0x469528(0x107)],this[_0x469528(0xd7)]=_0x3b8295[_0x469528(0xd7)],this[_0x469528(0xe4)]=_0x3b8295[_0x469528(0xe4)],this[_0x469528(0xcb)]=_0x3b8295[_0x469528(0xcb)],this[_0x469528(0xd5)]=_0x3b8295['composable_audience'],this['verbose']=_0x271573['verbose']||![],this[_0x469528(0xe2)]=_0x271573[_0x469528(0xe2)]??LogLevel['INFO'],this[_0x469528(0xd2)]=this['activeProfile']||undefined,this[_0x469528(0xc2)]=getAccessToken(this[_0x469528(0xda)]||undefined),this[_0x469528(0x108)]=getAPIKey(this[_0x469528(0xda)]||undefined);const _0x15501a=typeof _0x20dc3d[_0x469528(0xcc)]===_0x469528(0xee)?_0x20dc3d[_0x469528(0xcc)]:undefined;this[_0x469528(0xcc)]=_0x15501a||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x7e1397=getConfigDir(),_0x4d93f9=a61_0x551c95[_0x469528(0xca)](_0x7e1397,_0x469528(0xec),this[_0x469528(0xc9)]+_0x469528(0xfd)),_0x4522d5=findProjectConfigPath(),_0xefa307=a61_0x551c95[_0x469528(0xca)](_0x7e1397,_0x469528(0xc0)),_0x46909d=a61_0x551c95[_0x469528(0xca)](_0x7e1397,_0x469528(0xeb));let _0x3bda34=null,_0x325fc8=null;this[_0x469528(0xda)]&&(_0x3bda34=a61_0x551c95[_0x469528(0xca)](_0x7e1397,_0x469528(0xce),this[_0x469528(0xda)],'tdx.json'),_0x325fc8=a61_0x551c95[_0x469528(0xca)](_0x7e1397,_0x469528(0xce),this[_0x469528(0xda)],'.env')),this[_0x469528(0x105)]={'session':a61_0x103bc3[_0x469528(0xd3)](_0x4d93f9)?_0x4d93f9:null,'project':_0x4522d5,'profile':_0x3bda34&&a61_0x103bc3[_0x469528(0xd3)](_0x3bda34)?_0x3bda34:null,'profileCredentials':_0x325fc8&&a61_0x103bc3[_0x469528(0xd3)](_0x325fc8)?_0x325fc8:null,'global':a61_0x103bc3[_0x469528(0xd3)](_0xefa307)?_0xefa307:null,'globalCredentials':a61_0x103bc3[_0x469528(0xd3)](_0x46909d)?_0x46909d:null};}[a61_0x5c45c9(0x111)](_0x353f92,_0x4e16d9){const _0xfd43f3=a61_0x5c45c9;if(!_0x4e16d9)return _0xfd43f3(0xdb);const _0x231794=_0x4e16d9;if(this[_0xfd43f3(0x10e)][_0xfd43f3(0xe9)][_0x353f92]===_0x231794){if(_0x353f92==='site'&&_0x231794===_0xfd43f3(0x109)&&!this[_0xfd43f3(0x10e)]['session'][_0xfd43f3(0xfb)]&&!this[_0xfd43f3(0x10e)][_0xfd43f3(0xfa)]['site']&&!this[_0xfd43f3(0x10e)][_0xfd43f3(0xd2)][_0xfd43f3(0xfb)]&&!this['layers'][_0xfd43f3(0x110)][_0xfd43f3(0xfb)])return _0xfd43f3(0xbf);return _0xfd43f3(0xd1)+_0x353f92[_0xfd43f3(0xf9)](/_/g,'-');}if(this[_0xfd43f3(0x10e)]['session'][_0x353f92]===_0x231794)return _0xfd43f3(0x10a);if(this[_0xfd43f3(0x10e)][_0xfd43f3(0xfa)][_0x353f92]===_0x231794)return _0xfd43f3(0xfa);if(this['layers'][_0xfd43f3(0xd2)][_0x353f92]===_0x231794)return _0xfd43f3(0x100)+this['activeProfile'];if(this[_0xfd43f3(0x10e)]['global'][_0x353f92]===_0x231794)return _0xfd43f3(0x110);return _0xfd43f3(0xbf);}[a61_0x5c45c9(0xf7)](){const _0x133afa=a61_0x5c45c9,_0x4bae95=a61_0x551c95[_0x133afa(0xca)](getConfigDir(),_0x133afa(0xc0));if(!a61_0x103bc3['existsSync'](_0x4bae95))return{};try{const _0x2f0135=a61_0x103bc3[_0x133afa(0x101)](_0x4bae95,'utf-8');return JSON[_0x133afa(0xbd)](_0x2f0135);}catch{return{};}}[a61_0x5c45c9(0xc4)](_0x25535c){const _0x3083c5=a61_0x5c45c9;_0x25535c[_0x3083c5(0xfb)]=this[_0x3083c5(0xfb)],!_0x25535c['database']&&this[_0x3083c5(0x10c)]&&(_0x25535c[_0x3083c5(0x10c)]=this[_0x3083c5(0x10c)]),!_0x25535c['parentSegment']&&this[_0x3083c5(0x10d)]&&(_0x25535c['parentSegment']=this['parent_segment']),!_0x25535c[_0x3083c5(0xf8)]&&this[_0x3083c5(0x107)]&&(_0x25535c[_0x3083c5(0xf8)]=this[_0x3083c5(0x107)]),!_0x25535c[_0x3083c5(0xe1)]&&this[_0x3083c5(0xd7)]&&(_0x25535c[_0x3083c5(0xe1)]=this[_0x3083c5(0xd7)]),!_0x25535c[_0x3083c5(0xcf)]&&this['llm_agent']&&(_0x25535c[_0x3083c5(0xcf)]=this[_0x3083c5(0xe4)]),!_0x25535c['workflowProject']&&this[_0x3083c5(0xcb)]&&(_0x25535c[_0x3083c5(0xed)]=this[_0x3083c5(0xcb)]),!_0x25535c[_0x3083c5(0xc6)]&&this[_0x3083c5(0xd5)]&&(_0x25535c[_0x3083c5(0xc6)]=this[_0x3083c5(0xd5)]);}[a61_0x5c45c9(0xe0)](){const _0x561921=a61_0x5c45c9;return[{'key':_0x561921(0xfb),'value':this['site']},{'key':_0x561921(0x10c),'value':this[_0x561921(0x10c)]},{'key':_0x561921(0x10d),'value':this[_0x561921(0x10d)]},{'key':_0x561921(0x107),'value':this[_0x561921(0x107)]},{'key':'llm_project','value':this[_0x561921(0xd7)]},{'key':'llm_agent','value':this['llm_agent']},{'key':_0x561921(0xcb),'value':this['workflow_project']},{'key':'composable_audience','value':this['composable_audience']},{'key':_0x561921(0xd2),'value':this[_0x561921(0xda)]||undefined}];}[a61_0x5c45c9(0xd0)](){const _0x19fa6e=a61_0x5c45c9;console['log'](a61_0x32ae15['bold'](_0x19fa6e(0xc1)));for(const {key:_0x58f028,value:_0x17e890}of this[_0x19fa6e(0xe0)]()){_0x17e890&&console[_0x19fa6e(0xdd)](a61_0x32ae15['cyan'](_0x58f028)+':\x20'+_0x17e890);}}[a61_0x5c45c9(0xf2)](){const _0x28d027=a61_0x5c45c9;console[_0x28d027(0xdd)](a61_0x32ae15[_0x28d027(0xcd)](_0x28d027(0xc1)));for(const {key:_0x12bf97,value:_0x4856a5}of this[_0x28d027(0xe0)]()){if(_0x4856a5){const _0x5821d2=_0x12bf97===_0x28d027(0xd2)?_0x28d027(0xe5):'('+this[_0x28d027(0x111)](_0x12bf97,_0x4856a5)+')';console[_0x28d027(0xdd)](a61_0x32ae15[_0x28d027(0xc8)](_0x12bf97)+':\x20'+_0x4856a5+'\x20'+a61_0x32ae15[_0x28d027(0xd4)](_0x5821d2));}}console[_0x28d027(0xdd)]('\x0a'+a61_0x32ae15[_0x28d027(0xcd)](_0x28d027(0xf3)));const _0x37a248=[{'label':_0x28d027(0x10b),'path':this['configFiles']['session'],'extra':_0x28d027(0xff)+this['sessionId']+')'},{'label':'Project','path':this['configFiles'][_0x28d027(0xfa)]},{'label':_0x28d027(0xf5),'path':this['configFiles'][_0x28d027(0xd2)]},{'label':'Profile\x20Credentials','path':this[_0x28d027(0x105)][_0x28d027(0xf6)]},{'label':_0x28d027(0xe3),'path':this['configFiles']['global']},{'label':_0x28d027(0x104),'path':this[_0x28d027(0x105)][_0x28d027(0xbc)]}];for(const {label:_0x37dca3,path:_0x33ccc7,extra:_0x3fa84e}of _0x37a248){if(_0x33ccc7)console['log'](a61_0x32ae15[_0x28d027(0xc8)](_0x37dca3)+':\x20'+_0x33ccc7+'\x20'+a61_0x32ae15[_0x28d027(0xc3)]('✓')+(_0x3fa84e?'\x20'+a61_0x32ae15[_0x28d027(0xd4)](_0x3fa84e):''));else{if(_0x37dca3===_0x28d027(0x10b))console['log'](a61_0x32ae15['cyan'](_0x37dca3)+':\x20'+a61_0x32ae15['dim'](_0x28d027(0xdc))+'\x20'+a61_0x32ae15[_0x28d027(0xd4)](_0x28d027(0xe8)+this['sessionId']+')'));else(_0x37dca3==='Project'||_0x37dca3===_0x28d027(0xe3))&&console[_0x28d027(0xdd)](a61_0x32ae15[_0x28d027(0xc8)](_0x37dca3)+':\x20'+a61_0x32ae15[_0x28d027(0xd4)]('none'));}}}async['resolveAPIKeyAsync'](){const _0x54a858=a61_0x5c45c9;if(!this['accessToken']){const _0x12da3c=await getOAuthTokens(this[_0x54a858(0xda)]||undefined);if(_0x12da3c){const _0x86d88b=0x5*0x3c*0x3e8,_0x4771e1=!_0x12da3c[_0x54a858(0xe6)]||_0x12da3c[_0x54a858(0xe6)]<Date[_0x54a858(0xf0)]()+_0x86d88b;if(_0x4771e1&&_0x12da3c[_0x54a858(0x106)])try{const _0x30975b=getConsoleUrl(this['site']),_0x4caf47=await refreshAccessToken(_0x30975b,_0x12da3c[_0x54a858(0x106)]);await saveOAuthTokens(_0x4caf47,this[_0x54a858(0xda)]||undefined),this[_0x54a858(0xc2)]=_0x4caf47[_0x54a858(0xef)];}catch{this[_0x54a858(0xc2)]=_0x12da3c[_0x54a858(0xef)];}else this[_0x54a858(0xc2)]=_0x12da3c[_0x54a858(0xef)];return undefined;}}return this['apiKey']=await getAPIKeyAsync(this[_0x54a858(0xfb)],this['activeProfile']||undefined),this[_0x54a858(0x108)];}static async['createAsync'](_0x3618c6){const _0x470533=a61_0x5c45c9,_0x55152a=new GlobalContext(_0x3618c6);return await _0x55152a[_0x470533(0xfe)](),_0x55152a;}}
@@ -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_0x1fbc23=a62_0x2aaa;(function(_0x2dd8fb,_0x55f3bd){const _0x119215=a62_0x2aaa,_0x1503e4=_0x2dd8fb();while(!![]){try{const _0x44af4a=-parseInt(_0x119215(0xa7))/0x1+parseInt(_0x119215(0xae))/0x2*(-parseInt(_0x119215(0x99))/0x3)+-parseInt(_0x119215(0xab))/0x4*(-parseInt(_0x119215(0xad))/0x5)+parseInt(_0x119215(0x97))/0x6*(-parseInt(_0x119215(0xb5))/0x7)+-parseInt(_0x119215(0xa2))/0x8*(-parseInt(_0x119215(0x94))/0x9)+parseInt(_0x119215(0x91))/0xa*(-parseInt(_0x119215(0x96))/0xb)+parseInt(_0x119215(0xb4))/0xc;if(_0x44af4a===_0x55f3bd)break;else _0x1503e4['push'](_0x1503e4['shift']());}catch(_0x34f869){_0x1503e4['push'](_0x1503e4['shift']());}}}(a62_0x2beb,0xc7377));const SERVICE_NAME=a62_0x1fbc23(0x95);let EntryClass=null,keyringLoadError=null;function a62_0x2aaa(_0x401428,_0x31b81e){_0x401428=_0x401428-0x91;const _0x2beb09=a62_0x2beb();let _0x2aaabb=_0x2beb09[_0x401428];return _0x2aaabb;}function a62_0x2beb(){const _0x21c05e=['8cfOaMl','could\x20not\x20be\x20found','reason','cannot\x20find','restricted','186742TWGpJI','unavailable','not\x20found','deleteCredential','2816308MTTLhE','message','10pIiiVr','153214yyaHeU',':api_key','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.','__keychain_test__','Entry','not\x20available','11733048ywmJvn','329ojIEZx','6641820lDmObH','toLowerCase','access_denied','12268089vjFmDJ','tdx','11wXdCHW','158226yNHzfu','getPassword','33cugrlp','no\x20matching\x20entry','success','includes','setPassword','value','not_found','access','-25293'];a62_0x2beb=function(){return _0x21c05e;};return a62_0x2beb();}async function getEntryClass(){const _0x11bd8c=a62_0x1fbc23;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x107cf3=await import('@napi-rs/keyring');return EntryClass=_0x107cf3[_0x11bd8c(0xb2)],EntryClass;}catch(_0x3774fc){return keyringLoadError=_0x3774fc instanceof Error?_0x3774fc:new Error(String(_0x3774fc)),null;}}function getAccountName(_0x442773){const _0x19324a=a62_0x1fbc23,_0xc9e7c4=_0x442773||'';return'profile:'+_0xc9e7c4+_0x19324a(0xaf);}export async function getKeychainAPIKey(_0x3745f9){const _0x83ae5a=a62_0x1fbc23,_0xe4bcdf=await getKeychainAPIKeyWithStatus(_0x3745f9);if(_0xe4bcdf[_0x83ae5a(0x9b)])return _0xe4bcdf[_0x83ae5a(0x9e)];return _0xe4bcdf[_0x83ae5a(0xa4)]===_0x83ae5a(0x93)&&console['error']('Warning:\x20'+_0xe4bcdf[_0x83ae5a(0xac)]),null;}export async function getKeychainAPIKeyWithStatus(_0x196838){const _0x25f51e=a62_0x1fbc23;try{const _0x5930d1=await getEntryClass();if(!_0x5930d1)return{'success':![],'reason':_0x25f51e(0xa8)};const _0x4d4004=getAccountName(_0x196838),_0x2fcd37=new _0x5930d1(SERVICE_NAME,_0x4d4004),_0x5ced3f=_0x2fcd37[_0x25f51e(0x98)]();if(_0x5ced3f)return{'success':!![],'value':_0x5ced3f};return{'success':![],'reason':_0x25f51e(0x9f)};}catch(_0x2aafed){const _0x438706=_0x2aafed instanceof Error?_0x2aafed[_0x25f51e(0xac)]:String(_0x2aafed);if(_0x438706['includes']('-25300')||_0x438706[_0x25f51e(0x92)]()['includes'](_0x25f51e(0xa3))||_0x438706['toLowerCase']()[_0x25f51e(0x9c)](_0x25f51e(0xa9))||_0x438706[_0x25f51e(0x92)]()[_0x25f51e(0x9c)](_0x25f51e(0x9a)))return{'success':![],'reason':'not_found'};if(_0x438706['includes'](_0x25f51e(0xa1))||_0x438706[_0x25f51e(0x92)]()['includes'](_0x25f51e(0xa6))||_0x438706[_0x25f51e(0x92)]()[_0x25f51e(0x9c)](_0x25f51e(0xa0)))return{'success':![],'reason':'access_denied','message':_0x25f51e(0xb0)};return{'success':![],'reason':'unavailable','message':_0x438706};}}export async function saveKeychainAPIKey(_0xaeb61b,_0xdb8670){const _0x26615e=a62_0x1fbc23,_0x13fda5=await getEntryClass();if(!_0x13fda5)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x29dc59=getAccountName(_0xdb8670),_0xf2b024=new _0x13fda5(SERVICE_NAME,_0x29dc59);_0xf2b024[_0x26615e(0x9d)](_0xaeb61b);}export async function deleteKeychainAPIKey(_0xb2b7d8){const _0x390c0b=a62_0x1fbc23;try{const _0x2d5f12=await getEntryClass();if(!_0x2d5f12)return![];const _0x4b7e1e=getAccountName(_0xb2b7d8),_0x567ac3=new _0x2d5f12(SERVICE_NAME,_0x4b7e1e);return _0x567ac3[_0x390c0b(0xaa)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x3c5b92=a62_0x1fbc23;try{const _0x32efd4=await getEntryClass();if(!_0x32efd4)return![];const _0x579057=new _0x32efd4(SERVICE_NAME,_0x3c5b92(0xb1));return _0x579057['getPassword'](),!![];}catch(_0x27cf1f){const _0x2b7c72=_0x27cf1f instanceof Error?_0x27cf1f[_0x3c5b92(0xac)][_0x3c5b92(0x92)]():'';if(_0x2b7c72[_0x3c5b92(0x9c)](_0x3c5b92(0xb3))||_0x2b7c72[_0x3c5b92(0x9c)]('not\x20supported')||_0x2b7c72[_0x3c5b92(0x9c)](_0x3c5b92(0xa5)))return![];return!![];}}
@@ -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_0x2d0a61=a63_0xfb4c;(function(_0xb9556b,_0x5bdaab){const _0x1f85ea=a63_0xfb4c,_0x390933=_0xb9556b();while(!![]){try{const _0x5141ee=parseInt(_0x1f85ea(0xb0))/0x1*(-parseInt(_0x1f85ea(0xb2))/0x2)+parseInt(_0x1f85ea(0xbd))/0x3+parseInt(_0x1f85ea(0xb3))/0x4*(-parseInt(_0x1f85ea(0xb9))/0x5)+-parseInt(_0x1f85ea(0xb5))/0x6*(parseInt(_0x1f85ea(0xbb))/0x7)+-parseInt(_0x1f85ea(0xb7))/0x8*(parseInt(_0x1f85ea(0xb1))/0x9)+-parseInt(_0x1f85ea(0xb6))/0xa*(parseInt(_0x1f85ea(0xbc))/0xb)+-parseInt(_0x1f85ea(0xb4))/0xc*(-parseInt(_0x1f85ea(0xbe))/0xd);if(_0x5141ee===_0x5bdaab)break;else _0x390933['push'](_0x390933['shift']());}catch(_0x3a32e5){_0x390933['push'](_0x390933['shift']());}}}(a63_0x1d4e,0x2e1da));const SERVICE_NAME=a63_0x2d0a61(0xac);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x40f5e1=a63_0x2d0a61;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x1faf21=await import(_0x40f5e1(0xba));return EntryClass=_0x1faf21['Entry'],EntryClass;}catch(_0x2d16c3){return keyringLoadError=_0x2d16c3 instanceof Error?_0x2d16c3:new Error(String(_0x2d16c3)),null;}}function getOAuthAccountName(_0xe3165a){const _0x40189c=a63_0x2d0a61,_0x5ef159=_0xe3165a||'';return'profile:'+_0x5ef159+_0x40189c(0xb8);}export async function saveOAuthTokens(_0x15015a,_0x5e2feb){const _0x481444=a63_0x2d0a61,_0x43b70c=await getEntryClass();if(!_0x43b70c)throw new Error(_0x481444(0xaf));const _0x2139d0=getOAuthAccountName(_0x5e2feb),_0x2fd03c=new _0x43b70c(SERVICE_NAME,_0x2139d0);_0x2fd03c[_0x481444(0xae)](JSON['stringify'](_0x15015a));}function a63_0xfb4c(_0xedd3b,_0x53f88b){_0xedd3b=_0xedd3b-0xac;const _0x1d4e60=a63_0x1d4e();let _0xfb4c67=_0x1d4e60[_0xedd3b];return _0xfb4c67;}function a63_0x1d4e(){const _0x35a6aa=['System\x20keychain\x20is\x20not\x20available','1CEMgkN','322362fygevf','11932YZxpyL','4dyeLwa','3298992RVaouG','96hkAwwb','3303470SxcUwF','72YOjbsq',':oauth_tokens','425605EBPpGB','@napi-rs/keyring','12796OWVuPR','11fnmind','411558STbUCA','39QljVNE','tdx','deleteCredential','setPassword'];a63_0x1d4e=function(){return _0x35a6aa;};return a63_0x1d4e();}export async function getOAuthTokens(_0x2731a8){try{const _0x576475=await getEntryClass();if(!_0x576475)return null;const _0x820ebe=getOAuthAccountName(_0x2731a8),_0x4ac8ff=new _0x576475(SERVICE_NAME,_0x820ebe),_0x34c688=_0x4ac8ff['getPassword']();if(_0x34c688)return JSON['parse'](_0x34c688);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x5ad7e7){const _0x30ce45=a63_0x2d0a61;try{const _0x1a4d9a=await getEntryClass();if(!_0x1a4d9a)return![];const _0x533813=getOAuthAccountName(_0x5ad7e7),_0x80c798=new _0x1a4d9a(SERVICE_NAME,_0x533813);return _0x80c798[_0x30ce45(0xad)](),!![];}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_0x502812=a64_0x2a4c;(function(_0x522d1e,_0x5a5185){const _0x507376=a64_0x2a4c,_0x161288=_0x522d1e();while(!![]){try{const _0x23c4c2=-parseInt(_0x507376(0xa0))/0x1*(parseInt(_0x507376(0x8d))/0x2)+-parseInt(_0x507376(0x75))/0x3+parseInt(_0x507376(0x89))/0x4*(parseInt(_0x507376(0xa7))/0x5)+parseInt(_0x507376(0x72))/0x6+-parseInt(_0x507376(0x91))/0x7*(-parseInt(_0x507376(0x76))/0x8)+parseInt(_0x507376(0x6c))/0x9*(-parseInt(_0x507376(0x9e))/0xa)+parseInt(_0x507376(0x7d))/0xb*(parseInt(_0x507376(0x96))/0xc);if(_0x23c4c2===_0x5a5185)break;else _0x161288['push'](_0x161288['shift']());}catch(_0x5c9b58){_0x161288['push'](_0x161288['shift']());}}}(a64_0x5084,0x9f5ae));import*as a64_0x21f618 from'node:crypto';import*as a64_0x3cdc1e 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_0x502812(0x7b)+OAUTH_CALLBACK_PORT+a64_0x502812(0x65);export function getOAuthClientId(){const _0x9a129d=a64_0x502812;return process.env.TD_OAUTH_CLIENT_ID||_0x9a129d(0x7c);}export function generatePKCEPair(){const _0x280669=a64_0x502812,_0x4c45cf=a64_0x21f618[_0x280669(0x93)](0x20)['toString'](_0x280669(0x94)),_0xbec6d5=a64_0x21f618[_0x280669(0xa8)](_0x280669(0x95))[_0x280669(0x9c)](_0x4c45cf)[_0x280669(0x87)](_0x280669(0x94));return{'verifier':_0x4c45cf,'challenge':_0xbec6d5};}export function buildAuthorizeURL(_0x2315d0,_0x20acbb){const _0x322d28=a64_0x502812,_0x4696d3=new URL(_0x322d28(0x6f),_0x2315d0);return _0x4696d3[_0x322d28(0x6d)][_0x322d28(0x80)]('response_type',_0x322d28(0x8b)),_0x4696d3[_0x322d28(0x6d)]['set'](_0x322d28(0x81),_0x20acbb[_0x322d28(0x68)]),_0x4696d3[_0x322d28(0x6d)][_0x322d28(0x80)](_0x322d28(0xa3),_0x20acbb[_0x322d28(0x85)]),_0x4696d3['searchParams'][_0x322d28(0x80)]('state',_0x20acbb[_0x322d28(0x66)]),_0x4696d3[_0x322d28(0x6d)][_0x322d28(0x80)]('code_challenge',_0x20acbb['codeChallenge']),_0x4696d3[_0x322d28(0x6d)][_0x322d28(0x80)](_0x322d28(0x6e),_0x322d28(0x86)),_0x20acbb['scope']&&_0x4696d3[_0x322d28(0x6d)]['set']('scope',_0x20acbb[_0x322d28(0x8c)]),_0x4696d3[_0x322d28(0x7e)]();}function a64_0x5084(){const _0x270c5f=['http://127.0.0.1','2014970vlWZgA','127.0.0.1','4qytfBx','application/x-www-form-urlencoded','listen','redirect_uri','get','expires_in','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','5138300oRbVTk','createHash','/users/initiate_sso','/oauth/callback','state','pathname','clientId','message','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','waitForCallback','54AgfYlZ','searchParams','code_challenge_method','/oauth/authorize','text/html','end','1291242tMncnp','text','url','3578856zxkNdl','8EIdadz','openid\x20email\x20profile','createServer','text/plain','redirect_to_path','http://localhost:','tdx','11629970cainnI','toString','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','set','client_id','json','hex','Not\x20Found','redirectUri','S256','digest','writeHead','4VEpdTf','close','code','scope','629638ydjUjm','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','now','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','6695647MEuKOF','Port\x20','randomBytes','base64url','sha256','24KVmjzp','error','):\x20','EADDRINUSE','account_name','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','update'];a64_0x5084=function(){return _0x270c5f;};return a64_0x5084();}export function buildSSOInitiateURL(_0x28fb89,_0x22290d,_0xb1f3a2){const _0x1dea77=a64_0x502812,_0x5567c4=new URL(_0x1dea77(0xa9),_0x28fb89);_0x5567c4[_0x1dea77(0x6d)][_0x1dea77(0x80)](_0x1dea77(0x9a),_0x22290d);const _0x508c0d=_0xb1f3a2['replace'](_0x28fb89,'');return _0x5567c4[_0x1dea77(0x6d)][_0x1dea77(0x80)](_0x1dea77(0x7a),_0x508c0d),_0x5567c4[_0x1dea77(0x7e)]();}export async function postTokenRequest(_0x185790,_0x313c13){const _0x3a0a6d=a64_0x502812,_0x1011cb=new URLSearchParams(_0x313c13)[_0x3a0a6d(0x7e)](),_0x51bc58=await fetch(_0x185790,{'method':'POST','headers':{'Content-Type':_0x3a0a6d(0xa1)},'body':_0x1011cb});if(!_0x51bc58['ok']){const _0x47cb83=await _0x51bc58[_0x3a0a6d(0x73)]();throw new Error('OAuth\x20token\x20request\x20failed\x20('+_0x51bc58['status']+_0x3a0a6d(0x98)+_0x47cb83);}const _0xfe0e7d=await _0x51bc58[_0x3a0a6d(0x82)]();return{'access_token':_0xfe0e7d['access_token'],'refresh_token':_0xfe0e7d['refresh_token'],'scope':_0xfe0e7d[_0x3a0a6d(0x8c)],'expires_at':_0xfe0e7d[_0x3a0a6d(0xa5)]?Date[_0x3a0a6d(0x8f)]()+_0xfe0e7d[_0x3a0a6d(0xa5)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x3bca13,_0x37bc26,_0x5d2d4e,_0x643f97){const _0x29b89a=_0x3bca13+'/oauth/token';return postTokenRequest(_0x29b89a,{'grant_type':'authorization_code','client_id':getOAuthClientId(),'code':_0x37bc26,'code_verifier':_0x5d2d4e,'redirect_uri':_0x643f97});}export function startLocalCallbackServer(){const _0x245138=a64_0x502812;let _0x4e43c5,_0x3f4824;const _0xe60c44=new Promise((_0x440e18,_0x570df7)=>{_0x4e43c5=_0x440e18,_0x3f4824=_0x570df7;}),_0x392442=a64_0x3cdc1e[_0x245138(0x78)]((_0x4be11f,_0xa74d65)=>{const _0x2c5500=_0x245138,_0x3860c1=new URL(_0x4be11f[_0x2c5500(0x74)]||'/',_0x2c5500(0x9d));if(_0x3860c1[_0x2c5500(0x67)]!==_0x2c5500(0x65)){_0xa74d65[_0x2c5500(0x88)](0x194,{'Content-Type':_0x2c5500(0x79)}),_0xa74d65[_0x2c5500(0x71)](_0x2c5500(0x84));return;}const _0x54d172=_0x3860c1['searchParams'][_0x2c5500(0xa4)]('code'),_0x50d07b=_0x3860c1[_0x2c5500(0x6d)]['get'](_0x2c5500(0x66)),_0x3f901a=_0x3860c1[_0x2c5500(0x6d)]['get'](_0x2c5500(0x97));if(_0x3f901a||!_0x54d172||!_0x50d07b){_0xa74d65[_0x2c5500(0x88)](0x190,{'Content-Type':_0x2c5500(0x70)}),_0xa74d65[_0x2c5500(0x71)](_0x2c5500(0x6a)),_0x3f4824(new Error(_0x2c5500(0x90)));return;}_0xa74d65[_0x2c5500(0x88)](0xc8,{'Content-Type':'text/html'}),_0xa74d65['end'](_0x2c5500(0xa6)),_0x4e43c5({'code':_0x54d172,'state':_0x50d07b});});_0x392442['on'](_0x245138(0x97),_0x2d7721=>{const _0x5c9788=_0x245138;_0x2d7721['code']===_0x5c9788(0x99)?_0x3f4824(new Error(_0x5c9788(0x92)+OAUTH_CALLBACK_PORT+_0x5c9788(0x8e))):_0x3f4824(new Error(_0x5c9788(0x9b)+_0x2d7721[_0x5c9788(0x69)]));}),_0x392442[_0x245138(0xa2)](OAUTH_CALLBACK_PORT,_0x245138(0x9f));const _0x50d0b6=setTimeout(()=>{const _0x314193=_0x245138;_0x3f4824(new Error(_0x314193(0x7f))),_0x392442[_0x314193(0x8a)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0xe60c44,'close':()=>{const _0x1d1ba4=_0x245138;clearTimeout(_0x50d0b6),_0x392442[_0x1d1ba4(0x8a)]();}};}function a64_0x2a4c(_0x19d308,_0x562447){_0x19d308=_0x19d308-0x65;const _0x50842d=a64_0x5084();let _0x2a4cad=_0x50842d[_0x19d308];return _0x2a4cad;}export async function startOAuthFlow(_0x6fbde1,_0x25e30b){const _0x529dbb=a64_0x502812,_0x55ccd0=getConsoleUrl(_0x6fbde1),_0x16e681=getOAuthClientId(),{verifier:_0x384935,challenge:_0x3ba28c}=generatePKCEPair(),_0x14901b=a64_0x21f618[_0x529dbb(0x93)](0x10)['toString'](_0x529dbb(0x83)),_0x4a16cf=startLocalCallbackServer();try{const _0x1ba781=OAUTH_REDIRECT_URI,_0x402a7f=buildAuthorizeURL(_0x55ccd0,{'clientId':_0x16e681,'redirectUri':_0x1ba781,'state':_0x14901b,'codeChallenge':_0x3ba28c,'scope':_0x529dbb(0x77)}),_0x25a75a=_0x25e30b?.['accountName']?buildSSOInitiateURL(_0x55ccd0,_0x25e30b['accountName'],_0x402a7f):_0x402a7f;openBrowser(_0x25a75a);const _0x418559=await _0x4a16cf[_0x529dbb(0x6b)]();if(_0x418559['state']!==_0x14901b)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x55ccd0,_0x418559['code'],_0x384935,_0x1ba781);}finally{_0x4a16cf[_0x529dbb(0x8a)]();}}
@@ -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 a65_0x27f5(){const _0x2f45f2=['\x27:\x20config\x20must\x20be\x20an\x20object','Profile\x20\x27','7MkhWjv','parent_segment','rmSync','\x20\x20mv\x20\x22','672824fLxWox','push','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','account_name','site','parse','Profile\x20','join','directory','values','Error:\x20','profile','message','\x27:\x20\x27','readFileSync','name','657599SEdtXF','user_info','toISOString','from','\x20does\x20not\x20exist','sort','description','\x20\x201.\x20Edit:\x20','find','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','warn','test','stringify','73419RUEqKt','has','entries','5271816XqMrwq','llm_agent','\x27\x20not\x20found\x20in\x20user\x20configuration','INVALID_PROFILE_CONFIG','user','localeCompare','7375aZpUZY','Warning:\x20Profile\x20\x27','620090dBGJNU','readdirSync','.env.','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','length','map','@tdx-studio','Invalid\x20profile\x20name:\x20','utf-8','existsSync','includes','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x27:\x20unknown\x20config\x20key\x20\x27','profiles','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','\x20already\x20exists','\x27\x20must\x20be\x20a\x20string',',\x20creating\x20new\x20file','\x0aWarning:\x20Failed\x20to\x20parse\x20','Warning:\x20Failed\x20to\x20parse\x20','tdx.json','set','isDirectory','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','Failed\x20to\x20parse\x20','object','some','171KSPGYp','filter','.env','785608HHdGck',':\x20Invalid\x20JSON\x20syntax','llm_project','128ZMtWDi','database','local','keys'];a65_0x27f5=function(){return _0x2f45f2;};return a65_0x27f5();}const a65_0x417818=a65_0x3237;(function(_0x52dbc6,_0x1fe802){const _0x501020=a65_0x3237,_0x85421b=_0x52dbc6();while(!![]){try{const _0x30ae52=parseInt(_0x501020(0x135))/0x1+-parseInt(_0x501020(0x118))/0x2+parseInt(_0x501020(0xef))/0x3+-parseInt(_0x501020(0x11b))/0x4*(parseInt(_0x501020(0xf8))/0x5)+-parseInt(_0x501020(0xf2))/0x6+-parseInt(_0x501020(0x121))/0x7*(parseInt(_0x501020(0x125))/0x8)+parseInt(_0x501020(0x115))/0x9*(parseInt(_0x501020(0xfa))/0xa);if(_0x30ae52===_0x1fe802)break;else _0x85421b['push'](_0x85421b['shift']());}catch(_0x243e6f){_0x85421b['push'](_0x85421b['shift']());}}}(a65_0x27f5,0x6fb1c));import*as a65_0x2644da from'node:fs';import*as a65_0xc8443c 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_0x417818(0x100);export function getProfileParams(_0x2f774a){const _0x3753a3=a65_0x417818,_0x2e1dae={};if(!_0x2f774a)return _0x2e1dae;for(const [_0x207c0a,_0x4388f1]of Object[_0x3753a3(0xf1)](_0x2f774a)){_0x207c0a!==_0x3753a3(0xe8)&&_0x4388f1!==undefined&&(_0x2e1dae[_0x207c0a]=_0x4388f1);}return _0x2e1dae;}export function getProfilesDir(){const _0x586570=a65_0x417818;return a65_0xc8443c[_0x586570(0x12c)](getConfigDir(),_0x586570(0x107));}function getProfileDir(_0x1c215e){const _0x4d7a8d=a65_0x417818;return a65_0xc8443c[_0x4d7a8d(0x12c)](getProfilesDir(),_0x1c215e);}function getProfileConfigPath(_0x3b385a){const _0x340ab3=a65_0x417818;return a65_0xc8443c[_0x340ab3(0x12c)](getProfileDir(_0x3b385a),_0x340ab3(0x10e));}function getProfileEnvPath(_0x15b530){const _0x326bf9=a65_0x417818;return a65_0xc8443c['join'](getProfileDir(_0x15b530),_0x326bf9(0x117));}function getGlobalConfigPath(){const _0x514223=a65_0x417818;return a65_0xc8443c[_0x514223(0x12c)](getConfigDir(),'tdx.json');}function validateProfileName(_0x4ab0fe){const _0x2cbf49=a65_0x417818;if(/^@?[a-zA-Z0-9_-]+$/[_0x2cbf49(0xed)](_0x4ab0fe))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x2cbf49(0xed)](_0x4ab0fe))return;throw new Error(_0x2cbf49(0x101)+_0x4ab0fe+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x5e6983,_0x58e063){const _0x34e394=a65_0x417818;if(typeof _0x5e6983!==_0x34e394(0x113)||_0x5e6983===null)throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x34e394(0x120)+_0x58e063+_0x34e394(0x11f));const _0x431cc0=[_0x34e394(0xe8),_0x34e394(0x129),_0x34e394(0x11c),_0x34e394(0x122),_0x34e394(0x11a),_0x34e394(0xf3),_0x34e394(0x128),_0x34e394(0x136)],_0x407ebb=_0x5e6983;for(const _0x459b0e of Object[_0x34e394(0x11e)](_0x407ebb)){!_0x431cc0[_0x34e394(0x104)](_0x459b0e)&&console['warn'](_0x34e394(0xf9)+_0x58e063+_0x34e394(0x106)+_0x459b0e+'\x27\x20will\x20be\x20ignored');}const _0x2629cd=_0x431cc0['filter'](_0x5b2f22=>_0x5b2f22!==_0x34e394(0x136));for(const _0xcb02ce of _0x2629cd){if(_0x407ebb[_0xcb02ce]!==undefined&&typeof _0x407ebb[_0xcb02ce]!=='string')throw new SDKError(ErrorCode[_0x34e394(0xf5)],_0x34e394(0x120)+_0x58e063+_0x34e394(0x132)+_0xcb02ce+_0x34e394(0x10a));}return!![];}function loadProfilesFromTdxJson(_0x235f9e,_0x3fccf8){const _0x1d82f5=a65_0x417818;if(!a65_0x2644da[_0x1d82f5(0x103)](_0x235f9e))return[];try{const _0x3b34a9=a65_0x2644da[_0x1d82f5(0x133)](_0x235f9e,_0x1d82f5(0x102)),_0x157932=JSON[_0x1d82f5(0x12a)](_0x3b34a9);if(!_0x157932['profiles']||typeof _0x157932['profiles']!==_0x1d82f5(0x113))return[];const _0x4077eb=[];for(const [_0x2d7e2e,_0x1a1352]of Object[_0x1d82f5(0xf1)](_0x157932[_0x1d82f5(0x107)])){try{validateProfileConfig(_0x1a1352,_0x2d7e2e);const _0x343aa0=getNewCredentialPath(_0x2d7e2e),_0x80f91a=getOldCredentialPath(_0x2d7e2e),_0x4208c5=a65_0x2644da[_0x1d82f5(0x103)](_0x343aa0)||a65_0x2644da['existsSync'](_0x80f91a);_0x4077eb[_0x1d82f5(0x126)]({'name':_0x2d7e2e,'config':_0x1a1352,'metadata':{'name':_0x2d7e2e,'createdAt':new Date()[_0x1d82f5(0x137)]()},'hasCredentials':_0x4208c5,'scope':_0x3fccf8});}catch(_0x55ce5d){_0x55ce5d instanceof Error&&(console[_0x1d82f5(0xec)](_0x1d82f5(0xfd)+_0x235f9e+':'),console[_0x1d82f5(0xec)]('\x20\x20'+_0x55ce5d[_0x1d82f5(0x131)]+'\x0a'));}}return _0x4077eb;}catch(_0x139e5e){return _0x139e5e instanceof SyntaxError?(console[_0x1d82f5(0xec)](_0x1d82f5(0x10c)+_0x235f9e+_0x1d82f5(0x119)),console[_0x1d82f5(0xec)](_0x1d82f5(0x12f)+_0x139e5e[_0x1d82f5(0x131)]+'\x0a')):console[_0x1d82f5(0xec)](_0x1d82f5(0x127)+_0x235f9e+':\x20'+_0x139e5e+'\x0a'),[];}}function a65_0x3237(_0x3090f6,_0x415774){_0x3090f6=_0x3090f6-0xe8;const _0x27f506=a65_0x27f5();let _0x32370d=_0x27f506[_0x3090f6];return _0x32370d;}export function getNewCredentialPath(_0x4fb576){const _0x5ab812=a65_0x417818;return a65_0xc8443c[_0x5ab812(0x12c)](getConfigDir(),_0x5ab812(0xfc)+_0x4fb576);}function getOldCredentialPath(_0x1c9a33){const _0x18c609=a65_0x417818;return a65_0xc8443c[_0x18c609(0x12c)](getProfilesDir(),_0x1c9a33,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x1ee472=a65_0x417818,_0x35f2f3=[],_0x31ed3c=findProjectConfigPath();_0x31ed3c&&_0x35f2f3[_0x1ee472(0x126)](...loadProfilesFromTdxJson(_0x31ed3c,_0x1ee472(0x11d)));const _0x4d744f=a65_0xc8443c[_0x1ee472(0x12c)](getConfigDir(),_0x1ee472(0x10e));return _0x35f2f3[_0x1ee472(0x126)](...loadProfilesFromTdxJson(_0x4d744f,_0x1ee472(0xf6))),_0x35f2f3;}function loadProfilesFromDirectories(){const _0x2de899=a65_0x417818,_0x3a7c15=getProfilesDir();if(!a65_0x2644da[_0x2de899(0x103)](_0x3a7c15))return[];try{return a65_0x2644da[_0x2de899(0xfb)](_0x3a7c15,{'withFileTypes':!![]})[_0x2de899(0x116)](_0x57d21c=>_0x57d21c[_0x2de899(0x110)]())['map'](_0x1e5cde=>_0x1e5cde[_0x2de899(0x134)])[_0x2de899(0x116)](_0x124542=>{const _0xa3d2c9=_0x2de899,_0x1139bd=getProfileConfigPath(_0x124542),_0x425777=getProfileEnvPath(_0x124542);return a65_0x2644da['existsSync'](_0x1139bd)||a65_0x2644da[_0xa3d2c9(0x103)](_0x425777);})[_0x2de899(0xff)](_0x59e9b5=>{const _0x27116b=_0x2de899,_0x2ed940=loadProfileFromDirectory(_0x59e9b5);if(_0x2ed940)return{..._0x2ed940,'scope':_0x27116b(0x12d)};return null;})[_0x2de899(0x116)](_0x3de715=>_0x3de715!==null);}catch{return[];}}function loadProfileFromDirectory(_0x4aaced){const _0x4a1f9c=a65_0x417818,_0x16f119=getProfileConfigPath(_0x4aaced),_0x3aca6a=getOldCredentialPath(_0x4aaced);if(!a65_0x2644da['existsSync'](_0x16f119)&&!a65_0x2644da[_0x4a1f9c(0x103)](_0x3aca6a))return null;let _0x45fc32={},_0x41e088={'name':_0x4aaced,'createdAt':new Date()[_0x4a1f9c(0x137)]()};if(a65_0x2644da[_0x4a1f9c(0x103)](_0x16f119))try{const _0x51db45=a65_0x2644da['readFileSync'](_0x16f119,_0x4a1f9c(0x102)),_0x7505ba=JSON[_0x4a1f9c(0x12a)](_0x51db45),{metadata:_0x25dd61,..._0x1af01c}=_0x7505ba;_0x45fc32=_0x1af01c,_0x25dd61&&(_0x41e088=_0x25dd61);}catch{}return{'name':_0x4aaced,'config':_0x45fc32,'metadata':_0x41e088,'hasCredentials':a65_0x2644da['existsSync'](_0x3aca6a),'scope':_0x4a1f9c(0x12d)};}export function listProfiles(){const _0x2a2676=a65_0x417818,_0x1de186=loadProfilesFromTdxJsonFiles(),_0x746541=loadProfilesFromDirectories();if(_0x746541[_0x2a2676(0xfe)]>0x0){const _0x50b461=_0x746541[_0x2a2676(0xff)](_0x25333e=>_0x25333e[_0x2a2676(0x134)])[_0x2a2676(0x12c)](',\x20'),_0x444a5a=getConfigDir();console[_0x2a2676(0xec)](_0x2a2676(0x105)+_0x50b461),console[_0x2a2676(0xec)](_0x2a2676(0xeb)),console[_0x2a2676(0xec)](_0x2a2676(0xe9)+a65_0xc8443c['join'](_0x444a5a,'tdx.json')),console[_0x2a2676(0xec)](_0x2a2676(0x108)),console[_0x2a2676(0xec)](_0x2a2676(0x111));}const _0x5d013b=[..._0x1de186,..._0x746541],_0x5669e0=new Map();for(const _0x1cc006 of _0x5d013b){!_0x5669e0[_0x2a2676(0xf0)](_0x1cc006[_0x2a2676(0x134)])&&_0x5669e0[_0x2a2676(0x10f)](_0x1cc006[_0x2a2676(0x134)],_0x1cc006);}return Array[_0x2a2676(0x138)](_0x5669e0[_0x2a2676(0x12e)]())[_0x2a2676(0x13a)]((_0x3fa9e9,_0x4cfc87)=>_0x3fa9e9[_0x2a2676(0x134)][_0x2a2676(0xf7)](_0x4cfc87[_0x2a2676(0x134)]));}export function profileExists(_0x414272){const _0x2b854a=a65_0x417818,_0x46c6c5=listProfiles();return _0x46c6c5[_0x2b854a(0x114)](_0x2bc12a=>_0x2bc12a['name']===_0x414272);}export function loadProfile(_0xe2a78d){const _0x5906b3=a65_0x417818;validateProfileName(_0xe2a78d);const _0xc67d42=listProfiles(),_0x443c96=_0xc67d42[_0x5906b3(0xea)](_0x4300a9=>_0x4300a9['name']===_0xe2a78d);return _0x443c96||null;}export function saveProfile(_0x2d78f0,_0x236a00,_0x34206a=![]){saveProfileToUserConfig(_0x2d78f0,_0x236a00);}export function deleteProfile(_0x48fe94){const _0x4a73a0=a65_0x417818;validateProfileName(_0x48fe94);const _0x50874b=getProfileDir(_0x48fe94);if(!a65_0x2644da['existsSync'](_0x50874b))throw new Error(_0x4a73a0(0x12b)+_0x48fe94+_0x4a73a0(0x139));a65_0x2644da[_0x4a73a0(0x123)](_0x50874b,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x15d0da,_0x8c417f){const _0x1c941d=a65_0x417818;validateProfileName(_0x15d0da);const _0x555717=getGlobalConfigPath(),_0x290779=getConfigDir();!a65_0x2644da[_0x1c941d(0x103)](_0x290779)&&createSecureDirectory(_0x290779);let _0x40a138={};if(a65_0x2644da[_0x1c941d(0x103)](_0x555717))try{const _0x49201a=a65_0x2644da[_0x1c941d(0x133)](_0x555717,'utf-8');_0x40a138=JSON[_0x1c941d(0x12a)](_0x49201a);}catch{console[_0x1c941d(0xec)](_0x1c941d(0x10d)+_0x555717+',\x20creating\x20new\x20file');}!_0x40a138[_0x1c941d(0x107)]&&(_0x40a138[_0x1c941d(0x107)]={}),_0x40a138[_0x1c941d(0x107)][_0x15d0da]=_0x8c417f,writeSecureFile(_0x555717,JSON[_0x1c941d(0xee)](_0x40a138,null,0x2));}export function removeProfileFromUserConfig(_0x3846a8){const _0x3a4cef=a65_0x417818;validateProfileName(_0x3846a8);const _0x47118e=getGlobalConfigPath();if(!a65_0x2644da['existsSync'](_0x47118e))throw new Error(_0x3a4cef(0x120)+_0x3846a8+_0x3a4cef(0xf4));let _0x1d2559={};try{const _0xfa9d45=a65_0x2644da[_0x3a4cef(0x133)](_0x47118e,'utf-8');_0x1d2559=JSON['parse'](_0xfa9d45);}catch{throw new Error(_0x3a4cef(0x112)+_0x47118e);}if(!_0x1d2559['profiles']||!_0x1d2559[_0x3a4cef(0x107)][_0x3846a8])throw new Error(_0x3a4cef(0x120)+_0x3846a8+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x1d2559[_0x3a4cef(0x107)][_0x3846a8],_0x1d2559['profile']===_0x3846a8&&delete _0x1d2559['profile'],writeSecureFile(_0x47118e,JSON[_0x3a4cef(0xee)](_0x1d2559,null,0x2));}export function getActiveProfile(){const _0x2303fb=a65_0x417818,_0x63ebd0=loadSessionContext();if(_0x63ebd0?.[_0x2303fb(0x130)])return _0x63ebd0[_0x2303fb(0x130)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x116da8=getGlobalConfigPath();if(!a65_0x2644da[_0x2303fb(0x103)](_0x116da8))return null;try{const _0x9ea3af=a65_0x2644da[_0x2303fb(0x133)](_0x116da8,_0x2303fb(0x102)),_0x2d24ca=JSON[_0x2303fb(0x12a)](_0x9ea3af);return _0x2d24ca[_0x2303fb(0x130)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0xbad1fc){const _0xc1df3c=a65_0x417818,_0x18d8e7=getGlobalConfigPath(),_0x4e5a9b=getConfigDir();!a65_0x2644da[_0xc1df3c(0x103)](_0x4e5a9b)&&createSecureDirectory(_0x4e5a9b);let _0x57a0ad={};if(a65_0x2644da[_0xc1df3c(0x103)](_0x18d8e7))try{const _0x2f214f=a65_0x2644da['readFileSync'](_0x18d8e7,_0xc1df3c(0x102));_0x57a0ad=JSON[_0xc1df3c(0x12a)](_0x2f214f);}catch{console[_0xc1df3c(0xec)](_0xc1df3c(0x10d)+_0x18d8e7+_0xc1df3c(0x10b));}_0x57a0ad[_0xc1df3c(0x129)]=_0xbad1fc,writeSecureFile(_0x18d8e7,JSON[_0xc1df3c(0xee)](_0x57a0ad,null,0x2));}export function saveActiveProfileToUserConfig(_0x57c989){const _0x55b227=a65_0x417818;validateProfileName(_0x57c989);const _0x4e97cf=getGlobalConfigPath(),_0x1d66bd=getConfigDir();!a65_0x2644da[_0x55b227(0x103)](_0x1d66bd)&&createSecureDirectory(_0x1d66bd);let _0x17e7a7={};if(a65_0x2644da[_0x55b227(0x103)](_0x4e97cf))try{const _0xb9d6ef=a65_0x2644da[_0x55b227(0x133)](_0x4e97cf,_0x55b227(0x102));_0x17e7a7=JSON[_0x55b227(0x12a)](_0xb9d6ef);}catch{console[_0x55b227(0xec)](_0x55b227(0x10d)+_0x4e97cf+_0x55b227(0x10b));}_0x17e7a7[_0x55b227(0x130)]=_0x57c989,writeSecureFile(_0x4e97cf,JSON['stringify'](_0x17e7a7,null,0x2));}function clearFieldFromUserConfig(_0x291c0d){const _0x86b1ed=a65_0x417818,_0x31259e=getGlobalConfigPath();if(!a65_0x2644da[_0x86b1ed(0x103)](_0x31259e))return;let _0x2ab729={};try{const _0x5d50f9=a65_0x2644da[_0x86b1ed(0x133)](_0x31259e,_0x86b1ed(0x102));_0x2ab729=JSON[_0x86b1ed(0x12a)](_0x5d50f9);}catch{return;}delete _0x2ab729[_0x291c0d],writeSecureFile(_0x31259e,JSON[_0x86b1ed(0xee)](_0x2ab729,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x56ef0a,_0x3a6e9f){const _0x39a4f3=a65_0x417818;validateProfileName(_0x56ef0a);if(profileExists(_0x56ef0a))throw new Error(_0x39a4f3(0x12b)+_0x56ef0a+_0x39a4f3(0x109));saveProfile(_0x56ef0a,_0x3a6e9f);}export function saveProfileCredentials(_0x2d040d,_0x13b7fd){const _0x4f7f69=a65_0x417818;validateProfileName(_0x2d040d);if(!profileExists(_0x2d040d))throw new Error(_0x4f7f69(0x12b)+_0x2d040d+_0x4f7f69(0x139));const _0x1f8b1f=getNewCredentialPath(_0x2d040d);writeSecureFile(_0x1f8b1f,_0x13b7fd);}export function loadProfileCredentials(_0x4c7386){const _0x5d0ca6=a65_0x417818;validateProfileName(_0x4c7386);const _0x425c32=getNewCredentialPath(_0x4c7386);if(a65_0x2644da[_0x5d0ca6(0x103)](_0x425c32))try{return a65_0x2644da[_0x5d0ca6(0x133)](_0x425c32,_0x5d0ca6(0x102));}catch{}const _0x5ad4a7=getOldCredentialPath(_0x4c7386);if(a65_0x2644da[_0x5d0ca6(0x103)](_0x5ad4a7)){console[_0x5d0ca6(0xec)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x4c7386+'\x27'),console[_0x5d0ca6(0xec)]('To\x20migrate:'),console[_0x5d0ca6(0xec)](_0x5d0ca6(0x124)+_0x5ad4a7+'\x22\x20\x22'+_0x425c32+'\x22'),console[_0x5d0ca6(0xec)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a65_0x2644da[_0x5d0ca6(0x133)](_0x5ad4a7,_0x5d0ca6(0x102));}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(_0x189343,_0x12a1a8){const _0x22bd0e=a66_0xc674,_0x4db6b9=_0x189343();while(!![]){try{const _0x4522ab=-parseInt(_0x22bd0e(0x1dd))/0x1+parseInt(_0x22bd0e(0x1cb))/0x2*(parseInt(_0x22bd0e(0x1df))/0x3)+-parseInt(_0x22bd0e(0x1d8))/0x4+-parseInt(_0x22bd0e(0x1cf))/0x5+-parseInt(_0x22bd0e(0x1d9))/0x6*(parseInt(_0x22bd0e(0x1e0))/0x7)+parseInt(_0x22bd0e(0x1ce))/0x8+parseInt(_0x22bd0e(0x1e5))/0x9;if(_0x4522ab===_0x12a1a8)break;else _0x4db6b9['push'](_0x4db6b9['shift']());}catch(_0x21d4d6){_0x4db6b9['push'](_0x4db6b9['shift']());}}}(a66_0x59d6,0x3332d));import*as a66_0x19840c from'node:fs';import*as a66_0x5232a2 from'node:path';function a66_0xc674(_0x432413,_0x4ecd4b){_0x432413=_0x432413-0x1cb;const _0x59d6ef=a66_0x59d6();let _0xc67440=_0x59d6ef[_0x432413];return _0xc67440;}const PROJECT_CONFIG_FILENAME='tdx.json';function a66_0x59d6(){const _0x4d9415=['979768INhqVt','57678MrhnpH','stringify','warn','dirname','363194uHpsyN','cwd','4506UbfFib','301MKWgjy','parse','apiKey','readFileSync',').\x20','8107074dXxBFx','258FBquji','api_key','code','1669072KJlRqS','359870vAzKEC','ENOENT','TD_API_KEY','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','join','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','includes','profile','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.'];a66_0x59d6=function(){return _0x4d9415;};return a66_0x59d6();}export function findProjectConfigPath(_0x4aaea4){const _0x36915c=a66_0xc674;let _0x4d7f09=_0x4aaea4||process[_0x36915c(0x1de)]();while(!![]){const _0x322cfe=a66_0x5232a2[_0x36915c(0x1d3)](_0x4d7f09,PROJECT_CONFIG_FILENAME);if(a66_0x19840c['existsSync'](_0x322cfe))return _0x322cfe;const _0x1e5c88=a66_0x5232a2[_0x36915c(0x1dc)](_0x4d7f09);if(_0x1e5c88===_0x4d7f09)return null;_0x4d7f09=_0x1e5c88;}}export function loadProjectConfig(_0x57aaf0){const _0x1df769=a66_0xc674,_0x10413c=findProjectConfigPath(_0x57aaf0);if(!_0x10413c)return null;try{const _0x241b6e=a66_0x19840c[_0x1df769(0x1e3)](_0x10413c,'utf-8'),_0x2bd80a=JSON[_0x1df769(0x1e1)](_0x241b6e),_0x59b786=JSON[_0x1df769(0x1da)](_0x2bd80a);if(_0x59b786[_0x1df769(0x1d5)](_0x1df769(0x1d1))||_0x59b786[_0x1df769(0x1d5)]('apiKey')||_0x59b786[_0x1df769(0x1d5)](_0x1df769(0x1cc)))throw new Error(_0x1df769(0x1d4)+_0x10413c+_0x1df769(0x1e4)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0xf2322f,profile:_0x2b97fe,..._0x27f8fd}=_0x2bd80a;return _0x2b97fe&&console[_0x1df769(0x1db)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x10413c+'\x20is\x20ignored.\x20'+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x27f8fd;}catch(_0x542e5f){if(_0x542e5f instanceof Error&&_0x1df769(0x1cd)in _0x542e5f&&_0x542e5f[_0x1df769(0x1cd)]===_0x1df769(0x1d0))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x10413c+':\x20'+_0x542e5f);}}export function saveProjectConfig(_0x2bf8db,_0x5b019b){const _0x59fb66=a66_0xc674,_0x461336=_0x5b019b||process['cwd'](),_0x431229=a66_0x5232a2[_0x59fb66(0x1d3)](_0x461336,PROJECT_CONFIG_FILENAME),_0x24bcf1=JSON[_0x59fb66(0x1da)](_0x2bf8db);if(_0x24bcf1['includes'](_0x59fb66(0x1d1))||_0x24bcf1[_0x59fb66(0x1d5)](_0x59fb66(0x1e2))||_0x24bcf1[_0x59fb66(0x1d5)](_0x59fb66(0x1cc)))throw new Error(_0x59fb66(0x1d2));if(_0x59fb66(0x1d6)in _0x2bf8db)throw new Error(_0x59fb66(0x1d7));a66_0x19840c['writeFileSync'](_0x431229,JSON[_0x59fb66(0x1da)](_0x2bf8db,null,0x2));}export function hasProjectConfig(_0x27079e){return findProjectConfigPath(_0x27079e)!==null;}export function getProjectRoot(_0x1356fb){const _0x3fb1e3=findProjectConfigPath(_0x1356fb);return _0x3fb1e3?a66_0x5232a2['dirname'](_0x3fb1e3):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(_0x375c49,_0x7cff2b){const _0x2bb532=a67_0x5e50,_0x190ef5=_0x375c49();while(!![]){try{const _0xeb19ef=parseInt(_0x2bb532(0x188))/0x1+parseInt(_0x2bb532(0x194))/0x2*(-parseInt(_0x2bb532(0x177))/0x3)+-parseInt(_0x2bb532(0x18e))/0x4*(parseInt(_0x2bb532(0x193))/0x5)+parseInt(_0x2bb532(0x184))/0x6+-parseInt(_0x2bb532(0x180))/0x7*(parseInt(_0x2bb532(0x18a))/0x8)+parseInt(_0x2bb532(0x17f))/0x9+parseInt(_0x2bb532(0x18b))/0xa;if(_0xeb19ef===_0x7cff2b)break;else _0x190ef5['push'](_0x190ef5['shift']());}catch(_0x2dcb57){_0x190ef5['push'](_0x190ef5['shift']());}}}(a67_0x5f38,0x9958a));import*as a67_0x4f81ef from'node:fs';import*as a67_0x1e39f7 from'node:path';import*as a67_0x30767e 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 _0x472f2a=a67_0x5e50,_0x34128a=process.env.TDX_CONFIG_DIR||a67_0x1e39f7[_0x472f2a(0x183)](a67_0x30767e[_0x472f2a(0x199)](),_0x472f2a(0x197),_0x472f2a(0x190));return a67_0x1e39f7[_0x472f2a(0x183)](_0x34128a,_0x472f2a(0x175));}function getSessionPath(_0xc35908){const _0x415f5d=a67_0x5e50;return a67_0x1e39f7['join'](getSessionsDir(),_0xc35908+_0x415f5d(0x187));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x1173a8){const _0x33eee7=a67_0x5e50;if(_0x1173a8)return _0x1173a8;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x33eee7(0x17c)]();}function a67_0x5f38(){const _0x31257e=['existsSync','parse','join','4210482VFiTNU','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','now','.json','221169UtUpdI','api_key','40yvbEdH','3840520moufFr','getTime','replace','44wKliIz','apiKey','tdx','writeFileSync','utf-8','358885JFrLok','756706FqXOle','readdirSync','toISOString','.config','stringify','homedir','test','warn','unlinkSync','sessions','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','3sizHRD','createdAt','.\x20This\x20is\x20insecure.\x20Removing\x20session.','includes','sort','toString','readFileSync','endsWith','9666837LNTJTp','819077rGIMwo'];a67_0x5f38=function(){return _0x31257e;};return a67_0x5f38();}export function loadSessionContext(_0x12f2ff){const _0x34636f=a67_0x5e50,_0x2a4941=getSessionID(_0x12f2ff),_0x3dc6fa=/^\d+$/[_0x34636f(0x19a)](_0x2a4941)?parseInt(_0x2a4941,0xa):null;return _0x3dc6fa!==null?loadSessionContextByPID(_0x3dc6fa):loadSessionContextByString(_0x2a4941);}export function loadSessionContextByPID(_0x38d6d7){const _0x2ebdc5=a67_0x5e50,_0x497508=getSessionPath(_0x38d6d7);if(!a67_0x4f81ef[_0x2ebdc5(0x181)](_0x497508))return null;try{const _0x40fdae=a67_0x4f81ef[_0x2ebdc5(0x17d)](_0x497508,_0x2ebdc5(0x192)),_0x12ae17=JSON[_0x2ebdc5(0x182)](_0x40fdae),_0x59cd79=new Date(_0x12ae17['createdAt'])[_0x2ebdc5(0x18c)](),_0x7f2415=Date[_0x2ebdc5(0x186)]();if(_0x7f2415-_0x59cd79>SESSION_EXPIRATION_MS)return a67_0x4f81ef['unlinkSync'](_0x497508),null;const _0x396458=JSON[_0x2ebdc5(0x198)](_0x12ae17);if(_0x396458[_0x2ebdc5(0x17a)]('TD_API_KEY')||_0x396458[_0x2ebdc5(0x17a)](_0x2ebdc5(0x18f))||_0x396458[_0x2ebdc5(0x17a)](_0x2ebdc5(0x189)))return console[_0x2ebdc5(0x19b)](_0x2ebdc5(0x176)+_0x497508+_0x2ebdc5(0x179)),a67_0x4f81ef[_0x2ebdc5(0x174)](_0x497508),null;return _0x12ae17;}catch{try{a67_0x4f81ef[_0x2ebdc5(0x174)](_0x497508);}catch{}return null;}}function loadSessionContextByString(_0x20d5af){const _0x1375f5=a67_0x5e50,_0x336e35=a67_0x1e39f7['join'](getSessionsDir(),_0x20d5af+_0x1375f5(0x187));if(!a67_0x4f81ef['existsSync'](_0x336e35))return null;try{const _0x401281=a67_0x4f81ef[_0x1375f5(0x17d)](_0x336e35,_0x1375f5(0x192)),_0x1023e3=JSON[_0x1375f5(0x182)](_0x401281),_0x118b33=new Date(_0x1023e3[_0x1375f5(0x178)])[_0x1375f5(0x18c)](),_0x38b1cb=Date[_0x1375f5(0x186)]();if(_0x38b1cb-_0x118b33>SESSION_EXPIRATION_MS)return a67_0x4f81ef[_0x1375f5(0x174)](_0x336e35),null;const _0x1733f4=JSON[_0x1375f5(0x198)](_0x1023e3);if(_0x1733f4[_0x1375f5(0x17a)]('TD_API_KEY')||_0x1733f4[_0x1375f5(0x17a)]('apiKey')||_0x1733f4[_0x1375f5(0x17a)]('api_key'))return console[_0x1375f5(0x19b)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x336e35+_0x1375f5(0x179)),a67_0x4f81ef[_0x1375f5(0x174)](_0x336e35),null;return _0x1023e3;}catch{try{a67_0x4f81ef[_0x1375f5(0x174)](_0x336e35);}catch{}return null;}}export function saveSessionContext(_0x2e48ed,_0x10ac8f){const _0x298f4d=a67_0x5e50,_0x2b40a9=getSessionID(_0x10ac8f),_0x1e3194=/^\d+$/['test'](_0x2b40a9)?parseInt(_0x2b40a9,0xa):getCurrentSessionPID(),_0x4b090e=a67_0x1e39f7[_0x298f4d(0x183)](getSessionsDir(),_0x2b40a9+_0x298f4d(0x187)),_0x2bab7b=getSessionsDir();createSecureDirectory(_0x2bab7b);const _0x2f23f1=JSON[_0x298f4d(0x198)](_0x2e48ed);if(_0x2f23f1['includes']('TD_API_KEY')||_0x2f23f1[_0x298f4d(0x17a)](_0x298f4d(0x18f))||_0x2f23f1[_0x298f4d(0x17a)](_0x298f4d(0x189)))throw new Error(_0x298f4d(0x185));let _0x3f208f;const _0x47c15c=/^\d+$/['test'](_0x2b40a9)?loadSessionContextByPID(parseInt(_0x2b40a9,0xa)):loadSessionContextByString(_0x2b40a9);_0x47c15c?_0x3f208f={..._0x47c15c,..._0x2e48ed,'pid':_0x1e3194,'sessionId':_0x2b40a9!==_0x1e3194[_0x298f4d(0x17c)]()?_0x2b40a9:undefined,'updatedAt':new Date()[_0x298f4d(0x196)]()}:_0x3f208f={'pid':_0x1e3194,'sessionId':_0x2b40a9!==_0x1e3194[_0x298f4d(0x17c)]()?_0x2b40a9:undefined,..._0x2e48ed,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x298f4d(0x196)]()},a67_0x4f81ef[_0x298f4d(0x191)](_0x4b090e,JSON[_0x298f4d(0x198)](_0x3f208f,null,0x2));}function a67_0x5e50(_0xb1b29c,_0x15e09a){_0xb1b29c=_0xb1b29c-0x174;const _0x5f380d=a67_0x5f38();let _0x5e5056=_0x5f380d[_0xb1b29c];return _0x5e5056;}export function clearSessionContext(_0x64cc27){const _0x3742fb=a67_0x5e50,_0x3c0094=getSessionID(_0x64cc27),_0x58f7b6=a67_0x1e39f7[_0x3742fb(0x183)](getSessionsDir(),_0x3c0094+_0x3742fb(0x187));a67_0x4f81ef['existsSync'](_0x58f7b6)&&a67_0x4f81ef[_0x3742fb(0x174)](_0x58f7b6);}export function clearSessionContextField(_0x4cc416,_0x4741d5){const _0x54927e=a67_0x5e50,_0x4521de=getSessionID(_0x4741d5),_0x22f117=a67_0x1e39f7[_0x54927e(0x183)](getSessionsDir(),_0x4521de+_0x54927e(0x187));if(!a67_0x4f81ef[_0x54927e(0x181)](_0x22f117))return;try{const _0x27b1cd=a67_0x4f81ef[_0x54927e(0x17d)](_0x22f117,'utf-8'),_0x4bfd9a=JSON[_0x54927e(0x182)](_0x27b1cd);delete _0x4bfd9a[_0x4cc416],a67_0x4f81ef[_0x54927e(0x191)](_0x22f117,JSON[_0x54927e(0x198)](_0x4bfd9a,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x5b09b5=a67_0x5e50,_0x746bc5=getSessionsDir();if(!a67_0x4f81ef[_0x5b09b5(0x181)](_0x746bc5))return 0x0;let _0x433ad5=0x0;const _0x14f238=Date['now']();try{const _0x22919c=a67_0x4f81ef[_0x5b09b5(0x195)](_0x746bc5);for(const _0x31254e of _0x22919c){if(!_0x31254e[_0x5b09b5(0x17e)](_0x5b09b5(0x187)))continue;const _0x7e1ac9=a67_0x1e39f7['join'](_0x746bc5,_0x31254e),_0x1af52b=_0x31254e[_0x5b09b5(0x18d)](_0x5b09b5(0x187),''),_0x28aef5=parseInt(_0x1af52b,0xa),_0x3c96b2=!isNaN(_0x28aef5);if(_0x3c96b2){if(!isProcessRunning(_0x28aef5)){a67_0x4f81ef[_0x5b09b5(0x174)](_0x7e1ac9),_0x433ad5++;continue;}}try{const _0x5aa757=a67_0x4f81ef['readFileSync'](_0x7e1ac9,'utf-8'),_0x54fb80=JSON[_0x5b09b5(0x182)](_0x5aa757),_0x4d125e=new Date(_0x54fb80[_0x5b09b5(0x178)])[_0x5b09b5(0x18c)]();_0x14f238-_0x4d125e>SESSION_EXPIRATION_MS&&(a67_0x4f81ef[_0x5b09b5(0x174)](_0x7e1ac9),_0x433ad5++);}catch{a67_0x4f81ef[_0x5b09b5(0x174)](_0x7e1ac9),_0x433ad5++;}}}catch{}return _0x433ad5;}export function listActiveSessions(){const _0x3893e7=a67_0x5e50,_0x59f44e=getSessionsDir();if(!a67_0x4f81ef[_0x3893e7(0x181)](_0x59f44e))return[];try{const _0x2b63a1=a67_0x4f81ef[_0x3893e7(0x195)](_0x59f44e),_0x9ce52b=[];for(const _0xc77209 of _0x2b63a1){if(!_0xc77209[_0x3893e7(0x17e)](_0x3893e7(0x187)))continue;const _0x29e9c4=_0xc77209[_0x3893e7(0x18d)]('.json',''),_0x4615d5=parseInt(_0x29e9c4,0xa);!isNaN(_0x4615d5)&&isProcessRunning(_0x4615d5)&&_0x9ce52b['push'](_0x4615d5);}return _0x9ce52b[_0x3893e7(0x17b)]((_0x35a1a5,_0x55f409)=>_0x35a1a5-_0x55f409);}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_0x3d032c=a68_0x5886;function a68_0x3087(){const _0x2e6d39=['4173420rNplXE','36iEtnmd','9vlvzsp','178598HFjQPX','312594HhXVhy','145404QCwyNc','write','users','2129696pUHaCZ','core/user-cache','now','read','1196FTNgCq','4371DqjfXy','2129895lQoBOf'];a68_0x3087=function(){return _0x2e6d39;};return a68_0x3087();}function a68_0x5886(_0x321982,_0x11a664){_0x321982=_0x321982-0x16b;const _0x308781=a68_0x3087();let _0x588686=_0x308781[_0x321982];return _0x588686;}(function(_0xff374a,_0x1982c3){const _0x40b366=a68_0x5886,_0x343d5c=_0xff374a();while(!![]){try{const _0x58f46a=parseInt(_0x40b366(0x175))/0x1+-parseInt(_0x40b366(0x176))/0x2+parseInt(_0x40b366(0x16f))/0x3*(parseInt(_0x40b366(0x16e))/0x4)+-parseInt(_0x40b366(0x170))/0x5+parseInt(_0x40b366(0x172))/0x6*(parseInt(_0x40b366(0x174))/0x7)+-parseInt(_0x40b366(0x179))/0x8*(-parseInt(_0x40b366(0x173))/0x9)+-parseInt(_0x40b366(0x171))/0xa;if(_0x58f46a===_0x1982c3)break;else _0x343d5c['push'](_0x343d5c['shift']());}catch(_0x56d26c){_0x343d5c['push'](_0x343d5c['shift']());}}}(a68_0x3087,0x3d676));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json',a68_0x3d032c(0x16b));export function loadCachedUsers(_0x370171){const _0x593290=a68_0x3d032c,_0x2fc486=userCache[_0x593290(0x16d)](_0x370171);return _0x2fc486?.[_0x593290(0x178)]??null;}export function saveCachedUsers(_0x54819d,_0x267ff6){const _0x4dd3b3=a68_0x3d032c;userCache[_0x4dd3b3(0x177)](_0x54819d,{'users':_0x267ff6,'cachedAt':Date[_0x4dd3b3(0x16c)]()});}export function clearUserCache(_0x1dd0d5){userCache['clear'](_0x1dd0d5);}
@@ -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(_0x4bb042,_0x18d261){const _0xce0e14=a69_0x1957,_0x6126bc=_0x4bb042();while(!![]){try{const _0x507de6=parseInt(_0xce0e14(0x83))/0x1*(parseInt(_0xce0e14(0x8a))/0x2)+-parseInt(_0xce0e14(0x82))/0x3*(-parseInt(_0xce0e14(0x7f))/0x4)+-parseInt(_0xce0e14(0x7e))/0x5+-parseInt(_0xce0e14(0x7d))/0x6*(-parseInt(_0xce0e14(0x89))/0x7)+parseInt(_0xce0e14(0x7c))/0x8*(parseInt(_0xce0e14(0x87))/0x9)+-parseInt(_0xce0e14(0x88))/0xa+-parseInt(_0xce0e14(0x84))/0xb;if(_0x507de6===_0x18d261)break;else _0x6126bc['push'](_0x6126bc['shift']());}catch(_0x29a124){_0x6126bc['push'](_0x6126bc['shift']());}}}(a69_0x30f1,0x1d445));function a69_0x1957(_0x37c856,_0x5e5d8e){_0x37c856=_0x37c856-0x79;const _0x30f184=a69_0x30f1();let _0x19571d=_0x30f184[_0x37c856];return _0x19571d;}import{readFileSync}from'fs';import{fileURLToPath}from'url';function a69_0x30f1(){const _0x47537f=['.dev','utf-8','12lmyHOf','120613sJNJHM','4527985toMHWa','includes','version','18bsyKpT','741700EnwNgO','119kjTZnM','2hOcWyN','../../package.json','parse','0.0.0','914864xhMGWm','49578QickiS','306850nABUoF','177252PkiaWi'];a69_0x30f1=function(){return _0x47537f;};return a69_0x30f1();}import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x38dfd0=a69_0x1957;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x433c3f=fileURLToPath(import.meta.url),_0x332de9=dirname(_0x433c3f);try{const _0x23db4e=join(_0x332de9,'../build-info.json');cachedBuildInfo=JSON[_0x38dfd0(0x7a)](readFileSync(_0x23db4e,_0x38dfd0(0x81)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x49a331=a69_0x1957;if(cachedVersion!==null)return cachedVersion;const _0x473764=fileURLToPath(import.meta.url),_0x2cc564=dirname(_0x473764),_0x48f99a=getBuildInfo();if(_0x48f99a[_0x49a331(0x86)])return cachedVersion=_0x48f99a[_0x49a331(0x86)],cachedVersion;try{const _0x101eb7=join(_0x2cc564,_0x49a331(0x79)),_0x4dd4cf=JSON[_0x49a331(0x7a)](readFileSync(_0x101eb7,'utf-8'));cachedVersion=_0x4dd4cf['version'];}catch{cachedVersion=_0x49a331(0x7b);}return cachedVersion;}export function isDevVersion(){const _0x321f26=a69_0x1957,_0x2679f7=getVersion();return _0x2679f7[_0x321f26(0x85)](_0x321f26(0x80))||_0x2679f7[_0x321f26(0x85)]('-');}