@treasuredata/tdx 2026.4.3 → 2026.4.5

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.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.d.ts +2 -0
  168. package/dist/sdk/types/workspace.d.ts.map +1 -1
  169. package/dist/sdk/types/workspace.js +1 -1
  170. package/dist/sdk/user.js +1 -1
  171. package/dist/sdk/util/format-detector.js +1 -1
  172. package/dist/sdk/util/formatters.js +1 -1
  173. package/dist/sdk/util/index.js +1 -1
  174. package/dist/sdk/util/paginate.js +1 -1
  175. package/dist/sdk/util/tree-formatter.js +1 -1
  176. package/dist/sdk/workflow/archive-validation.js +1 -1
  177. package/dist/sdk/workflow/clone-workflow.js +1 -1
  178. package/dist/sdk/workflow/index.js +1 -1
  179. package/dist/sdk/workflow/pull-workflow.js +1 -1
  180. package/dist/sdk/workflow/push-workflow.js +1 -1
  181. package/dist/sdk/workflow/tdx-config.js +1 -1
  182. package/dist/sdk/workflow/workflow-utils.js +1 -1
  183. package/dist/sdk/workspace/access-tracker.d.ts +5 -0
  184. package/dist/sdk/workspace/access-tracker.d.ts.map +1 -0
  185. package/dist/sdk/workspace/access-tracker.js +1 -0
  186. package/dist/sdk/workspace/access-tracker.js.map +1 -0
  187. package/dist/sdk/workspace/frontmatter.js +1 -1
  188. package/dist/sdk/workspace/git.d.ts +1 -1
  189. package/dist/sdk/workspace/git.d.ts.map +1 -1
  190. package/dist/sdk/workspace/git.js +1 -1
  191. package/dist/sdk/workspace/git.js.map +1 -1
  192. package/dist/sdk/workspace/index.d.ts +8 -0
  193. package/dist/sdk/workspace/index.d.ts.map +1 -1
  194. package/dist/sdk/workspace/index.js +1 -1
  195. package/dist/sdk/workspace/index.js.map +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_0x185a92=a57_0xdcbe;(function(_0x53a72e,_0x50222b){const _0x4b2346=a57_0xdcbe,_0x2727a8=_0x53a72e();while(!![]){try{const _0x572ea2=-parseInt(_0x4b2346(0x173))/0x1*(-parseInt(_0x4b2346(0x153))/0x2)+parseInt(_0x4b2346(0x166))/0x3+-parseInt(_0x4b2346(0x13d))/0x4*(-parseInt(_0x4b2346(0x176))/0x5)+-parseInt(_0x4b2346(0x174))/0x6+parseInt(_0x4b2346(0x177))/0x7+parseInt(_0x4b2346(0x189))/0x8*(-parseInt(_0x4b2346(0x164))/0x9)+parseInt(_0x4b2346(0x18b))/0xa*(-parseInt(_0x4b2346(0x156))/0xb);if(_0x572ea2===_0x50222b)break;else _0x2727a8['push'](_0x2727a8['shift']());}catch(_0xbb6e29){_0x2727a8['push'](_0x2727a8['shift']());}}}(a57_0xa61e,0x47422));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x24dd85 from'node:fs';import*as a57_0x481a87 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_0x26504f from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x1afac1=a57_0xdcbe;return process.env.TDX_CONFIG_DIR||join(homedir(),'.config',_0x1afac1(0x17a));}export function getConfigFile(){const _0x4b9409=a57_0xdcbe;return join(getConfigDir(),_0x4b9409(0x15f));}export function getConfigFilePath(_0x464fb4){const _0x5a57eb=a57_0xdcbe,_0x2bddcb=getConfigDir();return _0x464fb4?a57_0x481a87[_0x5a57eb(0x179)](_0x2bddcb,_0x5a57eb(0x147)+_0x464fb4):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project','config/llm-project');export function getLLMProjectCacheFile(_0x546295){const _0x46bd4d=a57_0xdcbe;return llmProjectCache[_0x46bd4d(0x15a)](_0x546295);}export function readCachedLLMProject(_0x502bbf){const _0x1482bf=a57_0xdcbe,_0x44b6c2=llmProjectCache[_0x1482bf(0x160)](_0x502bbf);if(_0x44b6c2&&typeof _0x44b6c2['id']===_0x1482bf(0x17b)&&typeof _0x44b6c2[_0x1482bf(0x17f)]===_0x1482bf(0x17b))return _0x44b6c2;return null;}export function writeCachedLLMProject(_0x1a6fef,_0x143084,_0x37e4f4){const _0x1025de=a57_0xdcbe;try{llmProjectCache[_0x1025de(0x165)]({'name':_0x1a6fef,'id':_0x143084},_0x37e4f4);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x185a92(0x180),a57_0x185a92(0x149));export function getLLMAgentCacheFile(_0x92a78a){const _0x3f9d0f=a57_0x185a92;return llmAgentCache[_0x3f9d0f(0x15a)](_0x92a78a);}export function readCachedLLMAgent(_0x1754c1){const _0xaccc4f=a57_0x185a92,_0x52e3b0=llmAgentCache[_0xaccc4f(0x160)](_0x1754c1);if(_0x52e3b0&&typeof _0x52e3b0['id']===_0xaccc4f(0x17b)&&typeof _0x52e3b0[_0xaccc4f(0x17f)]===_0xaccc4f(0x17b)&&typeof _0x52e3b0['projectId']==='string')return _0x52e3b0;return null;}export function writeCachedLLMAgent(_0x478cae,_0x450d99,_0x1befd6,_0x3e7aaf){const _0x24854f=a57_0x185a92;try{llmAgentCache[_0x24854f(0x165)]({'name':_0x478cae,'id':_0x450d99,'projectId':_0x1befd6},_0x3e7aaf);}catch{}}export function clearCachedLLMAgent(_0x32a514){const _0x289e2f=a57_0x185a92;try{llmAgentCache[_0x289e2f(0x13e)](_0x32a514);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x185a92(0x18d),a57_0x185a92(0x18c),{'suffix':a57_0x185a92(0x151)});export function getAccountInfoCacheFile(_0x42a846){const _0x40e399=a57_0x185a92;return accountInfoCache[_0x40e399(0x15a)](_0x42a846);}export function readCachedAccountInfo(_0x4f23c0){const _0x475b35=a57_0x185a92,_0x3b554b=accountInfoCache[_0x475b35(0x160)](_0x4f23c0);if(_0x3b554b&&typeof _0x3b554b[_0x475b35(0x17d)]==='string'&&typeof _0x3b554b[_0x475b35(0x183)]===_0x475b35(0x167))return _0x3b554b;return null;}export function writeCachedAccountInfo(_0x2f7a39,_0x227c27,_0x57d06d){const _0xe8401a=a57_0x185a92;try{accountInfoCache[_0xe8401a(0x165)]({'site':_0x2f7a39,'accountId':_0x227c27,'cachedAt':new Date()[_0xe8401a(0x13f)]()},_0x57d06d);}catch{}}export function parseEnvFile(_0x5f115e){const _0x3b6d3c=a57_0x185a92,_0x8272ae={};for(const _0x152d64 of _0x5f115e[_0x3b6d3c(0x154)]('\x0a')){const _0x5681b5=_0x152d64[_0x3b6d3c(0x185)]();if(!_0x5681b5||_0x5681b5[_0x3b6d3c(0x175)]('#'))continue;const _0x117e1f=_0x5681b5['match'](/^([^=]+)=(.*)$/);if(_0x117e1f){const _0x4bf3b8=_0x117e1f[0x1][_0x3b6d3c(0x185)]();let _0x41a7cb=_0x117e1f[0x2][_0x3b6d3c(0x185)]();(_0x41a7cb[_0x3b6d3c(0x175)]('\x22')&&_0x41a7cb['endsWith']('\x22')||_0x41a7cb[_0x3b6d3c(0x175)]('\x27')&&_0x41a7cb[_0x3b6d3c(0x146)]('\x27'))&&(_0x41a7cb=_0x41a7cb[_0x3b6d3c(0x181)](0x1,-0x1)),_0x8272ae[_0x4bf3b8]=_0x41a7cb;}}return _0x8272ae;}export function readUserConfig(){const _0x1daec1=a57_0x185a92,_0x50bb7a=getConfigFile();if(!existsSync(_0x50bb7a))return{};try{const _0x6593ec=readFileSync(_0x50bb7a,_0x1daec1(0x158));return parseEnvFile(_0x6593ec);}catch(_0x3f94ff){return console[_0x1daec1(0x184)](_0x1daec1(0x170)+_0x50bb7a+':',_0x3f94ff),{};}}export function resolveSite(_0x161353){const _0x65fa5d=a57_0x185a92,_0x4dfbea=['us01',_0x65fa5d(0x168),_0x65fa5d(0x14c),_0x65fa5d(0x157),_0x65fa5d(0x150),_0x65fa5d(0x148),_0x65fa5d(0x16d),_0x65fa5d(0x14a),_0x65fa5d(0x15c),'stg-ap03'];if(_0x4dfbea[_0x65fa5d(0x161)](_0x161353))return _0x161353;if(_0x161353 in SITE_ALIASES)return SITE_ALIASES[_0x161353];return console[_0x65fa5d(0x184)](_0x65fa5d(0x15b)+_0x161353+_0x65fa5d(0x15e)),_0x65fa5d(0x187);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x52b7b8){const _0x17f35e=a57_0x185a92,_0x2a6126=_0x52b7b8||getActiveProfileName()||undefined;if(_0x2a6126){const _0x32e97f=_0x17f35e(0x186)+normalizeProfileForEnvVar(_0x2a6126);if(process.env[_0x32e97f])return{'accessToken':process.env[_0x32e97f],'source':_0x32e97f+_0x17f35e(0x172)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x17f35e(0x178)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x1d71ab=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x1d71ab)return{'accessToken':_0x1d71ab,'source':_0x17f35e(0x182)};}return null;}function readAccessTokenFile(_0x77a54b){const _0x30d4d0=a57_0x185a92;try{const _0x5b58cd=readFileSync(_0x77a54b,_0x30d4d0(0x158))[_0x30d4d0(0x185)]();return _0x5b58cd||null;}catch{return null;}}export function getAccessToken(_0x995c98){const _0xeb9e09=a57_0x185a92;return resolveAccessToken(_0x995c98)?.[_0xeb9e09(0x15d)];}function a57_0xdcbe(_0x2960b4,_0x2dd7f3){_0x2960b4=_0x2960b4-0x13d;const _0xa61ec2=a57_0xa61e();let _0xdcbec7=_0xa61ec2[_0x2960b4];return _0xdcbec7;}export function getAPIKey(_0x37776c){const _0x2620a7=a57_0x185a92,_0x192af2=_0x37776c||getActiveProfileName();if(_0x192af2){const _0x20256c=_0x2620a7(0x16e)+normalizeProfileForEnvVar(_0x192af2);if(process.env[_0x20256c])return process.env[_0x20256c];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x345144){const _0x10598f=a57_0x185a92;return _0x345144[_0x10598f(0x17c)]()[_0x10598f(0x140)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x3aa2a8,_0x1782a6){const _0x469cbe=a57_0x185a92,_0x576b2f=resolveAccessToken(_0x1782a6);if(_0x576b2f)return{'apiKey':_0x576b2f[_0x469cbe(0x15d)],'source':_0x576b2f[_0x469cbe(0x16f)],'isDeprecated':![]};const _0x502019=_0x1782a6||getActiveProfileName()||undefined;if(_0x502019){const _0x532fc2=_0x469cbe(0x16e)+normalizeProfileForEnvVar(_0x502019);if(process.env[_0x532fc2])return{'apiKey':process.env[_0x532fc2],'source':_0x532fc2+'\x20env\x20var','isDeprecated':![]};const _0x32de37=getCachedCredential(_0x3aa2a8,_0x502019);if(_0x32de37)return{'apiKey':_0x32de37,'source':_0x469cbe(0x16a)+_0x502019+')','isDeprecated':![]};const _0x15856c=await getKeychainAPIKey(_0x502019);if(_0x15856c)return setCachedCredential(_0x15856c,_0x3aa2a8,_0x502019),{'apiKey':_0x15856c,'source':_0x469cbe(0x16a)+_0x502019+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x469cbe(0x169),'isDeprecated':![]};if(!_0x502019){const _0x4c7fb4=getCachedCredential(_0x3aa2a8,undefined);if(_0x4c7fb4)return{'apiKey':_0x4c7fb4,'source':_0x469cbe(0x155),'isDeprecated':![]};const _0x4d2c3a=await getKeychainAPIKey(undefined);if(_0x4d2c3a)return setCachedCredential(_0x4d2c3a,_0x3aa2a8,undefined),{'apiKey':_0x4d2c3a,'source':_0x469cbe(0x155),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x9b5c58,_0x583251){const _0x3aa329=a57_0x185a92,_0x2171c1=await resolveAPIKeyAsync(_0x9b5c58,_0x583251);return _0x2171c1?.[_0x3aa329(0x188)];}function cleanupLegacyEnvFile(_0x4607bc){const _0x4cfe21=a57_0x185a92;if(!existsSync(_0x4607bc))return![];try{const _0xfd5f3e=readFileSync(_0x4607bc,'utf-8'),_0x4749e=_0xfd5f3e[_0x4cfe21(0x154)]('\x0a'),_0x3ebdd4=_0x4749e[_0x4cfe21(0x163)](_0xf88c05=>{const _0x355e6a=_0x4cfe21,_0x42847e=_0xf88c05[_0x355e6a(0x185)]();if(!_0x42847e||_0x42847e[_0x355e6a(0x175)]('#'))return!![];const [_0x1558ef]=_0x42847e[_0x355e6a(0x154)]('=');return!_0x1558ef['startsWith'](_0x355e6a(0x144));}),_0x2d306c=_0x3ebdd4['some'](_0x4da1eb=>{const _0x162450=_0x4cfe21,_0x260391=_0x4da1eb['trim']();return _0x260391&&!_0x260391[_0x162450(0x175)]('#');});if(!_0x2d306c)return unlinkSync(_0x4607bc),!![];return writeFileSync(_0x4607bc,_0x3ebdd4[_0x4cfe21(0x179)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x595cef=a57_0x185a92;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1aff6b=a57_0x481a87[_0x595cef(0x179)](getConfigDir(),_0x595cef(0x145));if(!a57_0x24dd85['existsSync'](_0x1aff6b))return null;try{const _0x2feb04=a57_0x24dd85[_0x595cef(0x152)](_0x1aff6b,_0x595cef(0x158)),_0x24734f=JSON['parse'](_0x2feb04);return _0x24734f[_0x595cef(0x16b)]||null;}catch{return null;}}export function saveAPIKey(_0x2c1f76,_0x3dfbd3,_0x25df5e){const _0x4d002a=a57_0x185a92,_0x26e1ae=getConfigDir(),_0x48674c=getConfigFilePath(_0x25df5e);!existsSync(_0x26e1ae)&&mkdirSync(_0x26e1ae,{'recursive':!![],'mode':0x1c0});let _0xfb187c={};if(existsSync(_0x48674c))try{const _0x1c4eeb=readFileSync(_0x48674c,_0x4d002a(0x158));_0xfb187c=parseEnvFile(_0x1c4eeb);}catch(_0x4dd534){console[_0x4d002a(0x184)](_0x4d002a(0x14b)+_0x48674c+':',_0x4dd534);}const _0x44e0ca=_0x2c1f76[_0x4d002a(0x17c)]()['replace'](/-/g,'_');_0xfb187c[_0x4d002a(0x143)+_0x44e0ca]=_0x3dfbd3;const _0x3b0f3d=Object['entries'](_0xfb187c)[_0x4d002a(0x171)](([_0x97ad42,_0xc785ec])=>_0x97ad42+'='+_0xc785ec);writeFileSync(_0x48674c,_0x3b0f3d[_0x4d002a(0x179)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x2bb9f0,_0x2d8060,_0x6f15f8){const _0x457d10=a57_0x185a92;await saveKeychainAPIKey(_0x2bb9f0,_0x6f15f8),setCachedCredential(_0x2bb9f0,_0x2d8060,_0x6f15f8);const _0x47ea21=getConfigFilePath(_0x6f15f8);cleanupLegacyEnvFile(_0x47ea21)&&console[_0x457d10(0x184)](a57_0x26504f[_0x457d10(0x17e)](_0x457d10(0x14d)));}export function loadConfig(){const _0x55d2c1=a57_0x185a92,_0x206950={'apiKeys':{},'defaultSite':_0x55d2c1(0x187)},_0x172331=[_0x55d2c1(0x187),_0x55d2c1(0x168),_0x55d2c1(0x14c),_0x55d2c1(0x157),'ap03',_0x55d2c1(0x148),_0x55d2c1(0x16d),_0x55d2c1(0x14a),_0x55d2c1(0x15c),_0x55d2c1(0x14f)],_0x26b4fd=getAPIKey();if(_0x26b4fd)for(const _0x8b7cee of _0x172331){_0x206950[_0x55d2c1(0x18a)][_0x8b7cee]=_0x26b4fd;}return _0x206950;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x26a0ce=a57_0x185a92,_0x1dbe10=a57_0x481a87['join'](getConfigDir(),_0x26a0ce(0x145));if(!a57_0x24dd85[_0x26a0ce(0x162)](_0x1dbe10))return undefined;try{const _0x34b036=a57_0x24dd85[_0x26a0ce(0x152)](_0x1dbe10,'utf-8'),_0x11867f=JSON['parse'](_0x34b036);return typeof _0x11867f['proxy']===_0x26a0ce(0x17b)?_0x11867f[_0x26a0ce(0x16c)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x2feb94=a57_0x185a92,_0x3b5a40=process.env.TDX_RELEASE_CHANNEL;if(_0x3b5a40==='next'||_0x3b5a40===_0x2feb94(0x141))return _0x3b5a40;const _0x593c93=a57_0x481a87[_0x2feb94(0x179)](getConfigDir(),_0x2feb94(0x145));if(!a57_0x24dd85[_0x2feb94(0x162)](_0x593c93))return'stable';try{const _0x3000bc=a57_0x24dd85[_0x2feb94(0x152)](_0x593c93,_0x2feb94(0x158)),_0x4c36a4=JSON[_0x2feb94(0x159)](_0x3000bc);if(_0x4c36a4[_0x2feb94(0x142)]==='next')return'next';}catch{}return _0x2feb94(0x141);}function a57_0xa61e(){const _0x3f3868=['\x27,\x20defaulting\x20to\x20us01','.env','read','includes','existsSync','filter','178803gEPuRs','write','1662678wesszV','number','ap01','TDX_API_KEY\x20env\x20var','keychain\x20(profile:\x20','profile','proxy','dev-eu01','TDX_API_KEY_','source','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','map','\x20env\x20var','4753WTBEcR','448554vcAzqI','startsWith','5cGsZpS','3277687OcExdi','TDX_ACCESS_TOKEN\x20env\x20var','join','tdx','string','toUpperCase','site','yellow','name','llm_default_agent','slice','TDX_ACCESS_TOKEN_FILE','accountId','warn','trim','TDX_ACCESS_TOKEN_','us01','apiKey','88ZEMRLn','apiKeys','20NiysjB','config/account-info','account_info','270392brbhfQ','clear','toISOString','replace','stable','release_channel','TD_API_KEY_','TD_API_KEY','tdx.json','endsWith','.env.','dev-us01','config/llm-agent','stg-us01','Warning:\x20Failed\x20to\x20read\x20','eu01','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','stringify','stg-ap03','ap03','.json','readFileSync','2EjNNMM','split','keychain','2803064blBUWu','ap02','utf-8','parse','path','Warning:\x20Unknown\x20site\x20\x27','stg-ap01','accessToken'];a57_0xa61e=function(){return _0x3f3868;};return a57_0xa61e();}export function saveReleaseChannel(_0x28b193){const _0x4836e1=a57_0x185a92,_0x4f1cc0=getConfigDir(),_0x54417c=a57_0x481a87[_0x4836e1(0x179)](_0x4f1cc0,_0x4836e1(0x145));!existsSync(_0x4f1cc0)&&mkdirSync(_0x4f1cc0,{'recursive':!![],'mode':0x1c0});let _0x31d4a1={};if(existsSync(_0x54417c))try{const _0x5359eb=readFileSync(_0x54417c,_0x4836e1(0x158));_0x31d4a1=JSON['parse'](_0x5359eb);}catch{}_0x31d4a1['release_channel']=_0x28b193,writeFileSync(_0x54417c,JSON[_0x4836e1(0x14e)](_0x31d4a1,null,0x2),{'mode':0x180});}
1
+ function a57_0x232c(){const _0x3c4338=['config/llm-agent','warn','clear','next','stable','eu01','toUpperCase','match','963060VTCQKy','name','.config','18gFfEpp','number','parse','readFileSync','keychain','string','profile','us01','endsWith','.json','\x20env\x20var','replace','utf-8','trim','TDX_API_KEY\x20env\x20var','ap01','join','TDX_API_KEY_','stg-us01','entries','map','TD_API_KEY_','Warning:\x20Unknown\x20site\x20\x27','stg-ap01','.env.','existsSync','slice','tdx.json','5170563npNmUn','config/llm-project','apiKeys','stg-ap03','ap02','11871839jJRFNF','.env','16bzdKIp','1199828RhxOLZ','source','dev-us01','stringify','dev-eu01','startsWith','proxy','ap03','\x27,\x20defaulting\x20to\x20us01','projectId','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','6929870cYSvDV','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','accountId','read','write','account_info','9387024OhxJIe','keychain\x20(profile:\x20','tdx','split','path','accessToken','some','807656uYNYcr','toISOString','TDX_ACCESS_TOKEN_','apiKey'];a57_0x232c=function(){return _0x3c4338;};return a57_0x232c();}const a57_0x18495b=a57_0x4e96;(function(_0x14d8d2,_0x4156de){const _0x3058cf=a57_0x4e96,_0x45c123=_0x14d8d2();while(!![]){try{const _0xb1929b=-parseInt(_0x3058cf(0x18b))/0x1+parseInt(_0x3058cf(0x167))/0x2+-parseInt(_0x3058cf(0x18e))/0x3*(-parseInt(_0x3058cf(0x17f))/0x4)+parseInt(_0x3058cf(0x172))/0x5+parseInt(_0x3058cf(0x178))/0x6+-parseInt(_0x3058cf(0x164))/0x7+parseInt(_0x3058cf(0x166))/0x8*(-parseInt(_0x3058cf(0x15f))/0x9);if(_0xb1929b===_0x4156de)break;else _0x45c123['push'](_0x45c123['shift']());}catch(_0x510371){_0x45c123['push'](_0x45c123['shift']());}}}(a57_0x232c,0xe8de1));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x4f6340 from'node:fs';import*as a57_0x3fbdef from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';function a57_0x4e96(_0x1c5547,_0x297e07){_0x1c5547=_0x1c5547-0x154;const _0x232c35=a57_0x232c();let _0x4e969e=_0x232c35[_0x1c5547];return _0x4e969e;}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a57_0x207a58 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x19429f=a57_0x4e96;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x19429f(0x18d),_0x19429f(0x17a));}export function getConfigFile(){const _0x13ca49=a57_0x4e96;return join(getConfigDir(),_0x13ca49(0x165));}export function getConfigFilePath(_0x12fda4){const _0xb6dd02=a57_0x4e96,_0x3f3441=getConfigDir();return _0x12fda4?a57_0x3fbdef['join'](_0x3f3441,_0xb6dd02(0x15b)+_0x12fda4):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project',a57_0x18495b(0x160));export function getLLMProjectCacheFile(_0x66123d){const _0x35e73d=a57_0x18495b;return llmProjectCache[_0x35e73d(0x17c)](_0x66123d);}export function readCachedLLMProject(_0x34d9cf){const _0x1fd09a=a57_0x18495b,_0x2709c2=llmProjectCache[_0x1fd09a(0x175)](_0x34d9cf);if(_0x2709c2&&typeof _0x2709c2['id']===_0x1fd09a(0x193)&&typeof _0x2709c2[_0x1fd09a(0x18c)]===_0x1fd09a(0x193))return _0x2709c2;return null;}export function writeCachedLLMProject(_0x5bd9c9,_0x120988,_0x2f17ab){try{llmProjectCache['write']({'name':_0x5bd9c9,'id':_0x120988},_0x2f17ab);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a57_0x18495b(0x183));export function getLLMAgentCacheFile(_0xd183b3){const _0x5692f1=a57_0x18495b;return llmAgentCache[_0x5692f1(0x17c)](_0xd183b3);}export function readCachedLLMAgent(_0x1a1a48){const _0x1acd7e=a57_0x18495b,_0x47ae41=llmAgentCache[_0x1acd7e(0x175)](_0x1a1a48);if(_0x47ae41&&typeof _0x47ae41['id']==='string'&&typeof _0x47ae41['name']===_0x1acd7e(0x193)&&typeof _0x47ae41[_0x1acd7e(0x170)]===_0x1acd7e(0x193))return _0x47ae41;return null;}export function writeCachedLLMAgent(_0x1d2f23,_0xade6b,_0x59580b,_0x5a78e6){try{llmAgentCache['write']({'name':_0x1d2f23,'id':_0xade6b,'projectId':_0x59580b},_0x5a78e6);}catch{}}export function clearCachedLLMAgent(_0x4d81f3){const _0x565006=a57_0x18495b;try{llmAgentCache[_0x565006(0x185)](_0x4d81f3);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x18495b(0x177),'config/account-info',{'suffix':a57_0x18495b(0x197)});export function getAccountInfoCacheFile(_0x47351b){return accountInfoCache['path'](_0x47351b);}export function readCachedAccountInfo(_0xbccf4e){const _0x56fa42=a57_0x18495b,_0x32a0b6=accountInfoCache[_0x56fa42(0x175)](_0xbccf4e);if(_0x32a0b6&&typeof _0x32a0b6['site']===_0x56fa42(0x193)&&typeof _0x32a0b6[_0x56fa42(0x174)]===_0x56fa42(0x18f))return _0x32a0b6;return null;}export function writeCachedAccountInfo(_0x30a0ff,_0x1fab5f,_0x5672ee){const _0x511201=a57_0x18495b;try{accountInfoCache[_0x511201(0x176)]({'site':_0x30a0ff,'accountId':_0x1fab5f,'cachedAt':new Date()[_0x511201(0x180)]()},_0x5672ee);}catch{}}export function parseEnvFile(_0x282d19){const _0x50adb3=a57_0x18495b,_0x423ef8={};for(const _0x12c9be of _0x282d19[_0x50adb3(0x17b)]('\x0a')){const _0x143fc6=_0x12c9be[_0x50adb3(0x19b)]();if(!_0x143fc6||_0x143fc6[_0x50adb3(0x16c)]('#'))continue;const _0x2e065c=_0x143fc6[_0x50adb3(0x18a)](/^([^=]+)=(.*)$/);if(_0x2e065c){const _0x2e2901=_0x2e065c[0x1][_0x50adb3(0x19b)]();let _0x240224=_0x2e065c[0x2]['trim']();(_0x240224[_0x50adb3(0x16c)]('\x22')&&_0x240224[_0x50adb3(0x196)]('\x22')||_0x240224[_0x50adb3(0x16c)]('\x27')&&_0x240224[_0x50adb3(0x196)]('\x27'))&&(_0x240224=_0x240224[_0x50adb3(0x15d)](0x1,-0x1)),_0x423ef8[_0x2e2901]=_0x240224;}}return _0x423ef8;}export function readUserConfig(){const _0x2f5f0f=a57_0x18495b,_0xca3103=getConfigFile();if(!existsSync(_0xca3103))return{};try{const _0x275bc1=readFileSync(_0xca3103,'utf-8');return parseEnvFile(_0x275bc1);}catch(_0x4c8bd5){return console[_0x2f5f0f(0x184)](_0x2f5f0f(0x171)+_0xca3103+':',_0x4c8bd5),{};}}export function resolveSite(_0x455d32){const _0x3a00ee=a57_0x18495b,_0x2788d7=[_0x3a00ee(0x195),_0x3a00ee(0x19d),_0x3a00ee(0x188),_0x3a00ee(0x163),_0x3a00ee(0x16e),'dev-us01',_0x3a00ee(0x16b),_0x3a00ee(0x155),_0x3a00ee(0x15a),_0x3a00ee(0x162)];if(_0x2788d7['includes'](_0x455d32))return _0x455d32;if(_0x455d32 in SITE_ALIASES)return SITE_ALIASES[_0x455d32];return console[_0x3a00ee(0x184)](_0x3a00ee(0x159)+_0x455d32+_0x3a00ee(0x16f)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x4f10c6){const _0x2b8688=a57_0x18495b,_0x55d5a8=_0x4f10c6||getActiveProfileName()||undefined;if(_0x55d5a8){const _0x1c63ec=_0x2b8688(0x181)+normalizeProfileForEnvVar(_0x55d5a8);if(process.env[_0x1c63ec])return{'accessToken':process.env[_0x1c63ec],'source':_0x1c63ec+_0x2b8688(0x198)};}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 _0x8e5076=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x8e5076)return{'accessToken':_0x8e5076,'source':'TDX_ACCESS_TOKEN_FILE'};}return null;}function readAccessTokenFile(_0x43ad05){const _0x4730d3=a57_0x18495b;try{const _0x23a67e=readFileSync(_0x43ad05,_0x4730d3(0x19a))[_0x4730d3(0x19b)]();return _0x23a67e||null;}catch{return null;}}export function getAccessToken(_0x13985a){const _0x5c7b02=a57_0x18495b;return resolveAccessToken(_0x13985a)?.[_0x5c7b02(0x17d)];}export function getAPIKey(_0x4928c4){const _0x1d4fdf=a57_0x18495b,_0x596331=_0x4928c4||getActiveProfileName();if(_0x596331){const _0x143df0=_0x1d4fdf(0x154)+normalizeProfileForEnvVar(_0x596331);if(process.env[_0x143df0])return process.env[_0x143df0];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x453b13){const _0xb29bc5=a57_0x18495b;return _0x453b13['toUpperCase']()[_0xb29bc5(0x199)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0xd602a2,_0x1c66ea){const _0x249ce3=a57_0x18495b,_0x16da8a=resolveAccessToken(_0x1c66ea);if(_0x16da8a)return{'apiKey':_0x16da8a['accessToken'],'source':_0x16da8a[_0x249ce3(0x168)],'isDeprecated':![]};const _0x3b2cfb=_0x1c66ea||getActiveProfileName()||undefined;if(_0x3b2cfb){const _0x3199c9='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x3b2cfb);if(process.env[_0x3199c9])return{'apiKey':process.env[_0x3199c9],'source':_0x3199c9+_0x249ce3(0x198),'isDeprecated':![]};const _0x28038c=getCachedCredential(_0xd602a2,_0x3b2cfb);if(_0x28038c)return{'apiKey':_0x28038c,'source':_0x249ce3(0x179)+_0x3b2cfb+')','isDeprecated':![]};const _0x22a169=await getKeychainAPIKey(_0x3b2cfb);if(_0x22a169)return setCachedCredential(_0x22a169,_0xd602a2,_0x3b2cfb),{'apiKey':_0x22a169,'source':'keychain\x20(profile:\x20'+_0x3b2cfb+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x249ce3(0x19c),'isDeprecated':![]};if(!_0x3b2cfb){const _0x1a474b=getCachedCredential(_0xd602a2,undefined);if(_0x1a474b)return{'apiKey':_0x1a474b,'source':'keychain','isDeprecated':![]};const _0x36b86a=await getKeychainAPIKey(undefined);if(_0x36b86a)return setCachedCredential(_0x36b86a,_0xd602a2,undefined),{'apiKey':_0x36b86a,'source':_0x249ce3(0x192),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x312e96,_0x41abc9){const _0x15f728=a57_0x18495b,_0x5babc1=await resolveAPIKeyAsync(_0x312e96,_0x41abc9);return _0x5babc1?.[_0x15f728(0x182)];}function cleanupLegacyEnvFile(_0x528a44){const _0x5b02f7=a57_0x18495b;if(!existsSync(_0x528a44))return![];try{const _0x5309d3=readFileSync(_0x528a44,'utf-8'),_0x25523d=_0x5309d3['split']('\x0a'),_0x24c5ac=_0x25523d['filter'](_0x1f890f=>{const _0x3b3bc1=a57_0x4e96,_0x59faec=_0x1f890f[_0x3b3bc1(0x19b)]();if(!_0x59faec||_0x59faec[_0x3b3bc1(0x16c)]('#'))return!![];const [_0x50873e]=_0x59faec[_0x3b3bc1(0x17b)]('=');return!_0x50873e[_0x3b3bc1(0x16c)]('TD_API_KEY');}),_0xf3a955=_0x24c5ac[_0x5b02f7(0x17e)](_0x18841e=>{const _0x4f7f89=_0x5b02f7,_0xb25326=_0x18841e['trim']();return _0xb25326&&!_0xb25326[_0x4f7f89(0x16c)]('#');});if(!_0xf3a955)return unlinkSync(_0x528a44),!![];return writeFileSync(_0x528a44,_0x24c5ac[_0x5b02f7(0x19e)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x475262=a57_0x18495b;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1c36b8=a57_0x3fbdef[_0x475262(0x19e)](getConfigDir(),'tdx.json');if(!a57_0x4f6340[_0x475262(0x15c)](_0x1c36b8))return null;try{const _0x5d9842=a57_0x4f6340[_0x475262(0x191)](_0x1c36b8,_0x475262(0x19a)),_0x29fb99=JSON['parse'](_0x5d9842);return _0x29fb99[_0x475262(0x194)]||null;}catch{return null;}}export function saveAPIKey(_0x454666,_0x5afe57,_0x47e043){const _0x3f5f4c=a57_0x18495b,_0xb84eac=getConfigDir(),_0x5c4723=getConfigFilePath(_0x47e043);!existsSync(_0xb84eac)&&mkdirSync(_0xb84eac,{'recursive':!![],'mode':0x1c0});let _0x1f10ee={};if(existsSync(_0x5c4723))try{const _0x58fadb=readFileSync(_0x5c4723,_0x3f5f4c(0x19a));_0x1f10ee=parseEnvFile(_0x58fadb);}catch(_0x2f3053){console[_0x3f5f4c(0x184)]('Warning:\x20Failed\x20to\x20read\x20'+_0x5c4723+':',_0x2f3053);}const _0x485322=_0x454666[_0x3f5f4c(0x189)]()[_0x3f5f4c(0x199)](/-/g,'_');_0x1f10ee[_0x3f5f4c(0x158)+_0x485322]=_0x5afe57;const _0x81337a=Object[_0x3f5f4c(0x156)](_0x1f10ee)[_0x3f5f4c(0x157)](([_0x2f02cf,_0xfbd6e1])=>_0x2f02cf+'='+_0xfbd6e1);writeFileSync(_0x5c4723,_0x81337a[_0x3f5f4c(0x19e)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x16b565,_0x3ec607,_0x56df7c){const _0x3a6c83=a57_0x18495b;await saveKeychainAPIKey(_0x16b565,_0x56df7c),setCachedCredential(_0x16b565,_0x3ec607,_0x56df7c);const _0x239a35=getConfigFilePath(_0x56df7c);cleanupLegacyEnvFile(_0x239a35)&&console['warn'](a57_0x207a58['yellow'](_0x3a6c83(0x173)));}export function loadConfig(){const _0x1a107e=a57_0x18495b,_0x17ed87={'apiKeys':{},'defaultSite':_0x1a107e(0x195)},_0x5e74b4=[_0x1a107e(0x195),_0x1a107e(0x19d),_0x1a107e(0x188),_0x1a107e(0x163),_0x1a107e(0x16e),_0x1a107e(0x169),'dev-eu01','stg-us01',_0x1a107e(0x15a),_0x1a107e(0x162)],_0x4aa6ee=getAPIKey();if(_0x4aa6ee)for(const _0x1d5da3 of _0x5e74b4){_0x17ed87[_0x1a107e(0x161)][_0x1d5da3]=_0x4aa6ee;}return _0x17ed87;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x173fd4=a57_0x18495b,_0x1e2952=a57_0x3fbdef[_0x173fd4(0x19e)](getConfigDir(),_0x173fd4(0x15e));if(!a57_0x4f6340[_0x173fd4(0x15c)](_0x1e2952))return undefined;try{const _0x271278=a57_0x4f6340['readFileSync'](_0x1e2952,_0x173fd4(0x19a)),_0x43cec=JSON[_0x173fd4(0x190)](_0x271278);return typeof _0x43cec['proxy']==='string'?_0x43cec[_0x173fd4(0x16d)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x544b4f=a57_0x18495b,_0x5271ee=process.env.TDX_RELEASE_CHANNEL;if(_0x5271ee===_0x544b4f(0x186)||_0x5271ee===_0x544b4f(0x187))return _0x5271ee;const _0x3e902a=a57_0x3fbdef['join'](getConfigDir(),_0x544b4f(0x15e));if(!a57_0x4f6340[_0x544b4f(0x15c)](_0x3e902a))return _0x544b4f(0x187);try{const _0x364c2f=a57_0x4f6340[_0x544b4f(0x191)](_0x3e902a,_0x544b4f(0x19a)),_0x37ff2d=JSON[_0x544b4f(0x190)](_0x364c2f);if(_0x37ff2d['release_channel']===_0x544b4f(0x186))return'next';}catch{}return'stable';}export function saveReleaseChannel(_0x2c5203){const _0x1f053d=a57_0x18495b,_0x14cf39=getConfigDir(),_0x1b74ba=a57_0x3fbdef[_0x1f053d(0x19e)](_0x14cf39,_0x1f053d(0x15e));!existsSync(_0x14cf39)&&mkdirSync(_0x14cf39,{'recursive':!![],'mode':0x1c0});let _0x124ffc={};if(existsSync(_0x1b74ba))try{const _0x22767c=readFileSync(_0x1b74ba,'utf-8');_0x124ffc=JSON['parse'](_0x22767c);}catch{}_0x124ffc['release_channel']=_0x2c5203,writeFileSync(_0x1b74ba,JSON[_0x1f053d(0x16a)](_0x124ffc,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a58_0x22dd2a=a58_0x2658;(function(_0x2fb44c,_0x56f8f8){const _0x137972=a58_0x2658,_0x416361=_0x2fb44c();while(!![]){try{const _0x53132e=parseInt(_0x137972(0x88))/0x1+parseInt(_0x137972(0x81))/0x2*(parseInt(_0x137972(0x85))/0x3)+parseInt(_0x137972(0x80))/0x4+parseInt(_0x137972(0x83))/0x5*(-parseInt(_0x137972(0x82))/0x6)+parseInt(_0x137972(0x8a))/0x7*(parseInt(_0x137972(0x7f))/0x8)+parseInt(_0x137972(0x86))/0x9*(-parseInt(_0x137972(0x7d))/0xa)+parseInt(_0x137972(0x7c))/0xb;if(_0x53132e===_0x56f8f8)break;else _0x416361['push'](_0x416361['shift']());}catch(_0x284d6b){_0x416361['push'](_0x416361['shift']());}}}(a58_0x4abe,0xb37ee));function a58_0x2658(_0x2dc47a,_0x3e6c0d){_0x2dc47a=_0x2dc47a-0x7c;const _0x4abe49=a58_0x4abe();let _0x265882=_0x4abe49[_0x2dc47a];return _0x265882;}function a58_0x4abe(){const _0x12925f=['80ueFYyB','connections','56WrjPCM','1343456mlCmeg','2hBoopD','162lsjsZF','23270oRoNYp','read','1668855dDjqqZ','1473642SIwlYQ','connections-{profile}.json','579180LODrOd','clear','135611SSvpkc','6202196MbkSgn'];a58_0x4abe=function(){return _0x12925f;};return a58_0x4abe();}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x22dd2a(0x87),'core/connection-cache');export function loadCachedConnections(_0x1cf831){const _0x1d73dc=a58_0x22dd2a,_0x284720=connectionCache[_0x1d73dc(0x84)](_0x1cf831);return _0x284720?.[_0x1d73dc(0x7e)]??null;}export function saveCachedConnections(_0x3d4184,_0x41ee5f){connectionCache['write'](_0x3d4184,{'connections':_0x41ee5f,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x268643){const _0x2f7692=a58_0x22dd2a;connectionCache[_0x2f7692(0x89)](_0x268643);}
1
+ function a58_0x2b09(_0x8dca4c,_0x289b1f){_0x8dca4c=_0x8dca4c-0x121;const _0x3b54a5=a58_0x3b54();let _0x2b0981=_0x3b54a5[_0x8dca4c];return _0x2b0981;}const a58_0x599e91=a58_0x2b09;(function(_0x215892,_0x29e83f){const _0x2aecb4=a58_0x2b09,_0x10d2ce=_0x215892();while(!![]){try{const _0xac2df5=parseInt(_0x2aecb4(0x124))/0x1*(-parseInt(_0x2aecb4(0x12f))/0x2)+parseInt(_0x2aecb4(0x123))/0x3*(-parseInt(_0x2aecb4(0x127))/0x4)+-parseInt(_0x2aecb4(0x121))/0x5*(parseInt(_0x2aecb4(0x131))/0x6)+parseInt(_0x2aecb4(0x126))/0x7*(-parseInt(_0x2aecb4(0x125))/0x8)+parseInt(_0x2aecb4(0x12a))/0x9*(-parseInt(_0x2aecb4(0x12d))/0xa)+parseInt(_0x2aecb4(0x122))/0xb+parseInt(_0x2aecb4(0x129))/0xc;if(_0xac2df5===_0x29e83f)break;else _0x10d2ce['push'](_0x10d2ce['shift']());}catch(_0x52f935){_0x10d2ce['push'](_0x10d2ce['shift']());}}}(a58_0x3b54,0x6536b));import{createProfileCache}from'../utils/global-cache.js';function a58_0x3b54(){const _0x1a8847=['core/connection-cache','connections-{profile}.json','306170abPHsy','connections','203114luWicn','read','3468834DIPmzS','5tfhrEa','5742000XPlUrg','185733JbZOiB','1bfrBkK','77048iMxNOz','49DpMDTP','4BjycVi','now','14665008YUTScT','153aPfYwM'];a58_0x3b54=function(){return _0x1a8847;};return a58_0x3b54();}const connectionCache=createProfileCache(a58_0x599e91(0x12c),a58_0x599e91(0x12b));export function loadCachedConnections(_0x5321f9){const _0x3df129=a58_0x599e91,_0x76c281=connectionCache[_0x3df129(0x130)](_0x5321f9);return _0x76c281?.[_0x3df129(0x12e)]??null;}export function saveCachedConnections(_0x11911d,_0x2367b6){const _0x271438=a58_0x599e91;connectionCache['write'](_0x11911d,{'connections':_0x2367b6,'cachedAt':Date[_0x271438(0x128)]()});}export function clearConnectionCache(_0x280681){connectionCache['clear'](_0x280681);}
@@ -1 +1 @@
1
- const a59_0x57d683=a59_0x3920;function a59_0x2ed1(){const _0x5ee843=['ap01','1suhjWH','1693406celuPl','7545Pjlmio','customSite','Site\x20name\x20cannot\x20be\x20empty','site','findIndex','ap02','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','1082745NvblqC','value','push','653406fzzbGm','Cancelled','1610NcXmGU','1299237pVSzQc','50RiYiXY','us\x20\x20\x20-\x20United\x20States','us01','number','120ARfQUo','2705744GZwnSS','eu\x20\x20\x20-\x20Europe','1252YysjQY','Enter\x20site\x20name:','11202yxXLoU','trim','Enter\x20custom\x20site','log','ap02\x20-\x20Korea'];a59_0x2ed1=function(){return _0x5ee843;};return a59_0x2ed1();}(function(_0x875f83,_0xcdbc45){const _0x26336a=a59_0x3920,_0x3f975a=_0x875f83();while(!![]){try{const _0x3139b1=-parseInt(_0x26336a(0xd6))/0x1*(-parseInt(_0x26336a(0xc3))/0x2)+parseInt(_0x26336a(0xc6))/0x3+-parseInt(_0x26336a(0xce))/0x4*(-parseInt(_0x26336a(0xd8))/0x5)+-parseInt(_0x26336a(0xd0))/0x6*(-parseInt(_0x26336a(0xc5))/0x7)+-parseInt(_0x26336a(0xcc))/0x8+-parseInt(_0x26336a(0xdf))/0x9*(-parseInt(_0x26336a(0xc7))/0xa)+parseInt(_0x26336a(0xd7))/0xb*(-parseInt(_0x26336a(0xcb))/0xc);if(_0x3139b1===_0xcdbc45)break;else _0x3f975a['push'](_0x3f975a['shift']());}catch(_0x41f5f6){_0x3f975a['push'](_0x3f975a['shift']());}}}(a59_0x2ed1,0x5e14c));import a59_0x98cb4f from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x34fe14,_0x2038d9){const _0x305014=a59_0x3920;if(_0x34fe14===undefined)return _0x2038d9;if(typeof _0x34fe14===_0x305014(0xca))return _0x34fe14;return parseInt(_0x34fe14,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x57d683(0xc8),'value':a59_0x57d683(0xc9)},{'title':'jp\x20\x20\x20-\x20Japan','value':a59_0x57d683(0xd5)},{'title':a59_0x57d683(0xcd),'value':'eu01'},{'title':a59_0x57d683(0xd4),'value':a59_0x57d683(0xdd)}];function a59_0x3920(_0x27f834,_0x15d475){_0x27f834=_0x27f834-0xc2;const _0x2ed16a=a59_0x2ed1();let _0x392055=_0x2ed16a[_0x27f834];return _0x392055;}export function buildSiteChoices(_0x1d601e){const _0x31b811=a59_0x57d683,_0x1b40d1=[...STANDARD_SITE_CHOICES];let _0x4a51eb=_0x1b40d1[_0x31b811(0xdc)](_0x511e89=>_0x511e89[_0x31b811(0xe0)]===_0x1d601e);return _0x4a51eb===-0x1&&_0x1d601e!==_0x31b811(0xc9)&&(_0x1b40d1[_0x31b811(0xc2)]({'title':_0x1d601e,'value':_0x1d601e}),_0x4a51eb=_0x1b40d1['length']-0x1),_0x1b40d1['push']({'title':_0x31b811(0xd2),'value':'other'}),{'choices':_0x1b40d1,'initialIndex':_0x4a51eb>=0x0?_0x4a51eb:0x0};}export async function promptSiteSelection(_0x427133,_0x160456,_0x1ef558=a59_0x57d683(0xc4)){const _0x2e9b43=a59_0x57d683,{choices:_0x5be616,initialIndex:_0x481dbe}=buildSiteChoices(_0x427133),_0x4c8fae=_0x160456?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x160456+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x163149=await a59_0x98cb4f({'type':'select','name':_0x2e9b43(0xdb),'message':_0x4c8fae,'choices':_0x5be616,'initial':_0x481dbe});if(!_0x163149[_0x2e9b43(0xdb)])return console[_0x2e9b43(0xd3)]('\x0a'+_0x1ef558),null;if(_0x163149['site']!=='other')return _0x163149[_0x2e9b43(0xdb)];const _0x493300=await a59_0x98cb4f({'type':'text','name':_0x2e9b43(0xd9),'message':_0x2e9b43(0xcf),'initial':_0x2e9b43(0xc9),'validate':_0x2a020b=>{const _0x27344b=_0x2e9b43;if(!_0x2a020b||!_0x2a020b[_0x27344b(0xd1)]())return _0x27344b(0xda);if(!/^[a-z0-9-]+$/['test'](_0x2a020b[_0x27344b(0xd1)]()))return _0x27344b(0xde);return!![];}});if(!_0x493300[_0x2e9b43(0xd9)])return console[_0x2e9b43(0xd3)]('\x0a'+_0x1ef558),null;return _0x493300[_0x2e9b43(0xd9)];}
1
+ const a59_0x466a57=a59_0x1818;(function(_0x5e0810,_0x5126d4){const _0x3bbbb4=a59_0x1818,_0x403719=_0x5e0810();while(!![]){try{const _0x349ba2=parseInt(_0x3bbbb4(0xdc))/0x1+parseInt(_0x3bbbb4(0xe0))/0x2*(parseInt(_0x3bbbb4(0xe5))/0x3)+parseInt(_0x3bbbb4(0xe1))/0x4*(parseInt(_0x3bbbb4(0xd9))/0x5)+parseInt(_0x3bbbb4(0xe9))/0x6*(-parseInt(_0x3bbbb4(0xdf))/0x7)+parseInt(_0x3bbbb4(0xeb))/0x8+parseInt(_0x3bbbb4(0xea))/0x9*(-parseInt(_0x3bbbb4(0xdb))/0xa)+-parseInt(_0x3bbbb4(0xd8))/0xb*(parseInt(_0x3bbbb4(0xd2))/0xc);if(_0x349ba2===_0x5126d4)break;else _0x403719['push'](_0x403719['shift']());}catch(_0x5eed50){_0x403719['push'](_0x403719['shift']());}}}(a59_0xda00,0xa0484));function a59_0xda00(){const _0x484205=['value','push','Site\x20name\x20cannot\x20be\x20empty','site','24IjBANC','Cancelled','customSite','Enter\x20site\x20name:','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','us01','6704709qFWFyr','5490VHblgP','Select\x20your\x20Treasure\x20Data\x20site:','70pGLUrM','748881wXUEgf','other','eu\x20\x20\x20-\x20Europe','14IUQOjn','5042WXyvoH','2052vgboZZ','ap02\x20-\x20Korea','number','ap02','1011llVzvK','findIndex','test','log','108492UkPzuF','1515087qQVuKj','7427096IukbcH','trim'];a59_0xda00=function(){return _0x484205;};return a59_0xda00();}import a59_0x2f2a45 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x2d929a,_0x221127){const _0xfe2d0c=a59_0x1818;if(_0x2d929a===undefined)return _0x221127;if(typeof _0x2d929a===_0xfe2d0c(0xe3))return _0x2d929a;return parseInt(_0x2d929a,0xa);}function a59_0x1818(_0x98cb13,_0x599b7a){_0x98cb13=_0x98cb13-0xcd;const _0xda00a7=a59_0xda00();let _0x1818f3=_0xda00a7[_0x98cb13];return _0x1818f3;}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':a59_0x466a57(0xd7)},{'title':'jp\x20\x20\x20-\x20Japan','value':'ap01'},{'title':a59_0x466a57(0xde),'value':'eu01'},{'title':a59_0x466a57(0xe2),'value':a59_0x466a57(0xe4)}];export function buildSiteChoices(_0x51c51e){const _0xabf4c4=a59_0x466a57,_0x484bd3=[...STANDARD_SITE_CHOICES];let _0x54ca81=_0x484bd3[_0xabf4c4(0xe6)](_0x14ad8f=>_0x14ad8f[_0xabf4c4(0xce)]===_0x51c51e);return _0x54ca81===-0x1&&_0x51c51e!=='us01'&&(_0x484bd3['push']({'title':_0x51c51e,'value':_0x51c51e}),_0x54ca81=_0x484bd3['length']-0x1),_0x484bd3[_0xabf4c4(0xcf)]({'title':'Enter\x20custom\x20site','value':_0xabf4c4(0xdd)}),{'choices':_0x484bd3,'initialIndex':_0x54ca81>=0x0?_0x54ca81:0x0};}export async function promptSiteSelection(_0x3cdc3c,_0x129573,_0x1e65bc=a59_0x466a57(0xd3)){const _0x5385cb=a59_0x466a57,{choices:_0x2a4612,initialIndex:_0x4e48d0}=buildSiteChoices(_0x3cdc3c),_0x5221ca=_0x129573?_0x5385cb(0xd6)+_0x129573+'):':_0x5385cb(0xda),_0x9745c9=await a59_0x2f2a45({'type':'select','name':'site','message':_0x5221ca,'choices':_0x2a4612,'initial':_0x4e48d0});if(!_0x9745c9[_0x5385cb(0xd1)])return console['log']('\x0a'+_0x1e65bc),null;if(_0x9745c9['site']!==_0x5385cb(0xdd))return _0x9745c9[_0x5385cb(0xd1)];const _0x39901e=await a59_0x2f2a45({'type':'text','name':_0x5385cb(0xd4),'message':_0x5385cb(0xd5),'initial':_0x5385cb(0xd7),'validate':_0x4d9044=>{const _0x1a906b=_0x5385cb;if(!_0x4d9044||!_0x4d9044[_0x1a906b(0xcd)]())return _0x1a906b(0xd0);if(!/^[a-z0-9-]+$/[_0x1a906b(0xe7)](_0x4d9044[_0x1a906b(0xcd)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x39901e[_0x5385cb(0xd4)])return console[_0x5385cb(0xe8)]('\x0a'+_0x1e65bc),null;return _0x39901e['customSite'];}
@@ -1 +1 @@
1
- function a60_0x27a5(_0x43d56a,_0x4c7be0){_0x43d56a=_0x43d56a-0x9d;const _0x3c969e=a60_0x3c96();let _0x27a545=_0x3c969e[_0x43d56a];return _0x27a545;}(function(_0x36a11f,_0x507ebf){const _0x4a326d=a60_0x27a5,_0x6b5c10=_0x36a11f();while(!![]){try{const _0xd00aba=parseInt(_0x4a326d(0x9d))/0x1+parseInt(_0x4a326d(0xa0))/0x2+parseInt(_0x4a326d(0xa7))/0x3+-parseInt(_0x4a326d(0x9f))/0x4+parseInt(_0x4a326d(0x9e))/0x5+parseInt(_0x4a326d(0xa8))/0x6+-parseInt(_0x4a326d(0xa3))/0x7*(parseInt(_0x4a326d(0xa4))/0x8);if(_0xd00aba===_0x507ebf)break;else _0x6b5c10['push'](_0x6b5c10['shift']());}catch(_0x171a93){_0x6b5c10['push'](_0x6b5c10['shift']());}}}(a60_0x3c96,0xca4dd));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a60_0x3c96(){const _0x31343c=['loadedAt','now','2650707FJLbcS','2988894tZzCLD','clear','__default_site__','1025179TFJBCP','6295890rqjrTq','6600960YeAvfW','2338764KdOimV','delete','get','75670OqpgIm','1744ahXVky'];a60_0x3c96=function(){return _0x31343c;};return a60_0x3c96();}function getCacheKey(_0xeb0073,_0x510079){const _0x3e257e=a60_0x27a5,_0x5bd0b2=_0xeb0073||_0x3e257e(0xaa),_0x3f6d8f=_0x510079||'__default_profile__';return _0x5bd0b2+':'+_0x3f6d8f;}export function getCachedCredential(_0x3f7789,_0x457c3d){const _0x2be394=a60_0x27a5,_0x22e7b8=getCacheKey(_0x3f7789,_0x457c3d),_0x37afca=cache[_0x2be394(0xa2)](_0x22e7b8);if(!_0x37afca)return null;if(Date[_0x2be394(0xa6)]()-_0x37afca[_0x2be394(0xa5)]>CACHE_TTL_MS)return cache['delete'](_0x22e7b8),null;return _0x37afca['apiKey'];}export function setCachedCredential(_0x13daea,_0x1b7c22,_0x394bc9){const _0xeb727f=a60_0x27a5,_0x358507=getCacheKey(_0x1b7c22,_0x394bc9);cache['set'](_0x358507,{'apiKey':_0x13daea,'loadedAt':Date[_0xeb727f(0xa6)]()});}export function clearCredentialCache(){const _0x46e6fe=a60_0x27a5;cache[_0x46e6fe(0xa9)]();}export function clearCachedCredential(_0x64ccdc,_0x1518e9){const _0x5b0cfe=a60_0x27a5,_0x404f97=getCacheKey(_0x64ccdc,_0x1518e9);cache[_0x5b0cfe(0xa1)](_0x404f97);}
1
+ (function(_0x2467ee,_0x3c80a5){const _0x361aa0=a60_0x54ba,_0x288a4d=_0x2467ee();while(!![]){try{const _0x1eef9a=parseInt(_0x361aa0(0x1b8))/0x1*(parseInt(_0x361aa0(0x1b9))/0x2)+parseInt(_0x361aa0(0x1b5))/0x3*(parseInt(_0x361aa0(0x1aa))/0x4)+-parseInt(_0x361aa0(0x1b0))/0x5+parseInt(_0x361aa0(0x1b7))/0x6*(parseInt(_0x361aa0(0x1af))/0x7)+parseInt(_0x361aa0(0x1ad))/0x8+parseInt(_0x361aa0(0x1b2))/0x9*(parseInt(_0x361aa0(0x1ba))/0xa)+-parseInt(_0x361aa0(0x1bc))/0xb*(parseInt(_0x361aa0(0x1ab))/0xc);if(_0x1eef9a===_0x3c80a5)break;else _0x288a4d['push'](_0x288a4d['shift']());}catch(_0x1d089c){_0x288a4d['push'](_0x288a4d['shift']());}}}(a60_0x19e5,0x23c49));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a60_0x19e5(){const _0x5a3828=['9JlDvPw','delete','loadedAt','21BCPkYE','apiKey','6CaCtgu','161cMlhmC','2118JxBQOd','675590MTXmop','now','2519VxlNbo','121356pLDOJv','19164DGedex','clear','852728kPyJEf','set','1391677mtLpAU','1218075RsbDfF','__default_site__'];a60_0x19e5=function(){return _0x5a3828;};return a60_0x19e5();}function getCacheKey(_0x2cafae,_0x8208dc){const _0x4aec36=a60_0x54ba,_0x33248a=_0x2cafae||_0x4aec36(0x1b1),_0x211820=_0x8208dc||'__default_profile__';return _0x33248a+':'+_0x211820;}function a60_0x54ba(_0x118895,_0x4d72e0){_0x118895=_0x118895-0x1aa;const _0x19e5c6=a60_0x19e5();let _0x54baa3=_0x19e5c6[_0x118895];return _0x54baa3;}export function getCachedCredential(_0x4dc467,_0xeed84f){const _0x47b0a1=a60_0x54ba,_0x21bcf5=getCacheKey(_0x4dc467,_0xeed84f),_0xb2d699=cache['get'](_0x21bcf5);if(!_0xb2d699)return null;if(Date[_0x47b0a1(0x1bb)]()-_0xb2d699[_0x47b0a1(0x1b4)]>CACHE_TTL_MS)return cache[_0x47b0a1(0x1b3)](_0x21bcf5),null;return _0xb2d699[_0x47b0a1(0x1b6)];}export function setCachedCredential(_0x5149f5,_0x328b3f,_0x1b33e4){const _0x10888d=a60_0x54ba,_0x3888da=getCacheKey(_0x328b3f,_0x1b33e4);cache[_0x10888d(0x1ae)](_0x3888da,{'apiKey':_0x5149f5,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x1af5f0=a60_0x54ba;cache[_0x1af5f0(0x1ac)]();}export function clearCachedCredential(_0x214058,_0x39812c){const _0x284a9c=a60_0x54ba,_0x399fb1=getCacheKey(_0x214058,_0x39812c);cache[_0x284a9c(0x1b3)](_0x399fb1);}
@@ -1 +1 @@
1
- const a61_0x11ad9c=a61_0x4826;(function(_0x2be387,_0x545072){const _0x253583=a61_0x4826,_0xe489c9=_0x2be387();while(!![]){try{const _0x1bebad=parseInt(_0x253583(0xdb))/0x1*(parseInt(_0x253583(0xca))/0x2)+parseInt(_0x253583(0xc9))/0x3+-parseInt(_0x253583(0xae))/0x4*(-parseInt(_0x253583(0xb8))/0x5)+-parseInt(_0x253583(0xe0))/0x6+parseInt(_0x253583(0xad))/0x7+parseInt(_0x253583(0xe4))/0x8+-parseInt(_0x253583(0x9d))/0x9*(parseInt(_0x253583(0xbf))/0xa);if(_0x1bebad===_0x545072)break;else _0xe489c9['push'](_0xe489c9['shift']());}catch(_0x4a4fa3){_0xe489c9['push'](_0xe489c9['shift']());}}}(a61_0x4e2b,0x8b66f));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a61_0x4826(_0x2d6831,_0x33a124){_0x2d6831=_0x2d6831-0x90;const _0x4e2bbc=a61_0x4e2b();let _0x4826b1=_0x4e2bbc[_0x2d6831];return _0x4826b1;}import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';function a61_0x4e2b(){const _0x279929=['now','dim','site','resolveAPIKeyAsync','1602063dQQNrg','255518snUyzU','not\x20set','CLI\x20flag:\x20--','getSource','refresh_token','loadGlobalConfig','composable_audience','profiles','join','(active)','profileCredentials','activeProfile','cyan','session','configFiles','bold','INFO','5YdQYjx','profile','createAsync','database','tdx.json','544962MKbWMG','Profile\x20Credentials','.env','.json','4510456miluQW','workflowProject','layers','readFileSync','injectIntoOptions','proxy','access_token','env','segment_path','llmAgent','entries','string','llm_project','profileSource','332802aasmvk','[configuration\x20files]','sessionId','utf-8','us01','assign','apiKey','existsSync','sessions','accessToken','global','display','llm_agent','verbose','Session','profile:\x20','7018200wvJubT','4ERHFtB','Global','config','composableAudience','segmentPath','llmProject','getParameters','Project','log','(session:\x20','891265RkMkbZ','Profile','cliFlags','logLevel','workflow_project','parentSegment','default','610DbOlKy','project','expires_at','cli','parent_segment','[context]'];a61_0x4e2b=function(){return _0x279929;};return a61_0x4e2b();}import{LogLevel}from'../utils/logger/index.js';import*as a61_0x2512e1 from'node:fs';import*as a61_0x5de166 from'node:path';import a61_0x2c9e97 from'chalk';export class GlobalContext{[a61_0x11ad9c(0xc7)];[a61_0x11ad9c(0xde)];[a61_0x11ad9c(0xc3)];[a61_0x11ad9c(0x97)];['llm_project'];[a61_0x11ad9c(0xa9)];[a61_0x11ad9c(0xbc)];['composable_audience'];['apiKey'];[a61_0x11ad9c(0xa6)];[a61_0x11ad9c(0x94)];[a61_0x11ad9c(0xaa)];[a61_0x11ad9c(0xbb)];[a61_0x11ad9c(0xdc)];['profileSource']=null;[a61_0x11ad9c(0x91)];[a61_0x11ad9c(0xd5)];['sessionId'];[a61_0x11ad9c(0xd8)];constructor(_0x991025){const _0x4c0986=a61_0x11ad9c;this[_0x4c0986(0x9f)]=getSessionID(_0x991025[_0x4c0986(0xd7)]);const _0x1c033e=loadSessionContext(_0x991025[_0x4c0986(0xd7)]),_0x20b2e2=loadProjectConfig(),_0x3b19b1=this['loadGlobalConfig']();if(_0x991025[_0x4c0986(0xdc)])this[_0x4c0986(0xd5)]=_0x991025['profile'],this[_0x4c0986(0x9c)]=_0x4c0986(0xc2);else{if(_0x1c033e?.[_0x4c0986(0xdc)])this['activeProfile']=_0x1c033e[_0x4c0986(0xdc)],this[_0x4c0986(0x9c)]='session';else{if(_0x3b19b1[_0x4c0986(0xdc)])this[_0x4c0986(0xd5)]=_0x3b19b1[_0x4c0986(0xdc)],this[_0x4c0986(0x9c)]=_0x4c0986(0xb0);else process.env.TDX_PROFILE?(this[_0x4c0986(0xd5)]=process.env.TDX_PROFILE,this['profileSource']=_0x4c0986(0x96)):(this['activeProfile']=null,this[_0x4c0986(0x9c)]=null);}}const _0x1605d0=this[_0x4c0986(0xd5)]?loadProfile(this[_0x4c0986(0xd5)]):null,_0x281bd1=_0x4dcf04=>{const _0x1e2667=_0x4c0986;if(!_0x4dcf04)return{};const _0x1a603a=_0x4dcf04,_0x32927e={};for(const [_0xed8c08,_0x5df239]of Object[_0x1e2667(0x99)](_0x1a603a)){typeof _0x5df239===_0x1e2667(0x9a)&&(_0x32927e[_0xed8c08]=_0x5df239);}return _0x32927e;},_0x17d8c5={},_0xcc91dc=(_0x2d1809,_0x2a7076,_0x32e6ea)=>{const _0x4aa244=_0x4c0986;if(!_0x2d1809)return![];if(_0x32e6ea&&_0x2d1809===_0x32e6ea)return![];const _0x4fff19=_0x1c033e,_0x3d7ba6=_0x20b2e2,_0x25be76=_0x1605d0?.[_0x4aa244(0xb0)],_0x120636=_0x3b19b1,_0x15538d=_0x4fff19?.[_0x2a7076],_0x5abaa6=_0x3d7ba6?.[_0x2a7076],_0x25ea5e=_0x25be76?.[_0x2a7076],_0x29010f=_0x120636[_0x2a7076];return _0x2d1809!==_0x15538d&&_0x2d1809!==_0x5abaa6&&_0x2d1809!==_0x25ea5e&&_0x2d1809!==_0x29010f;},_0x405239=[{'optionKey':'site','contextKey':_0x4c0986(0xc7),'defaultValue':_0x4c0986(0xa1)},{'optionKey':_0x4c0986(0xde),'contextKey':_0x4c0986(0xde)},{'optionKey':_0x4c0986(0xbd),'contextKey':_0x4c0986(0xc3)},{'optionKey':_0x4c0986(0xb3),'contextKey':_0x4c0986(0x9b)},{'optionKey':_0x4c0986(0x98),'contextKey':_0x4c0986(0xa9)},{'optionKey':_0x4c0986(0xb1),'contextKey':_0x4c0986(0xd0)},{'optionKey':_0x4c0986(0xdc),'contextKey':_0x4c0986(0xdc)}];for(const {optionKey:_0xfe34d2,contextKey:_0x33eeaf,defaultValue:_0x23a454}of _0x405239){const _0xe2f20=_0x991025[_0xfe34d2];_0xcc91dc(_0xe2f20,_0x33eeaf,_0x23a454)&&(_0x17d8c5[_0x33eeaf]=_0xe2f20);}this[_0x4c0986(0x91)]={'cliFlags':_0x17d8c5,'session':_0x281bd1(_0x1c033e),'project':_0x281bd1(_0x20b2e2),'profile':_0x281bd1(_0x1605d0?.[_0x4c0986(0xb0)]),'global':_0x281bd1(_0x3b19b1)};const _0x8a50ac={...this['layers'][_0x4c0986(0xa7)],...this[_0x4c0986(0x91)]['profile'],...this[_0x4c0986(0x91)][_0x4c0986(0xc0)]};process.env.TDX_SITE&&!this[_0x4c0986(0x91)][_0x4c0986(0xd7)][_0x4c0986(0xc7)]&&!this[_0x4c0986(0x91)][_0x4c0986(0xba)][_0x4c0986(0xc7)]&&(_0x8a50ac['site']=process.env.TDX_SITE);Object[_0x4c0986(0xa2)](_0x8a50ac,this[_0x4c0986(0x91)][_0x4c0986(0xd7)]),Object['assign'](_0x8a50ac,this['layers'][_0x4c0986(0xba)]);const _0x41eb7f=_0x8a50ac[_0x4c0986(0xc7)]||_0x4c0986(0xa1);this[_0x4c0986(0xc7)]=resolveSite(_0x41eb7f),this[_0x4c0986(0xde)]=_0x8a50ac[_0x4c0986(0xde)],this[_0x4c0986(0xc3)]=_0x8a50ac[_0x4c0986(0xc3)],this[_0x4c0986(0x97)]=_0x8a50ac['segment_path'],this[_0x4c0986(0x9b)]=_0x8a50ac[_0x4c0986(0x9b)],this['llm_agent']=_0x8a50ac['llm_agent'],this[_0x4c0986(0xbc)]=_0x8a50ac[_0x4c0986(0xbc)],this[_0x4c0986(0xd0)]=_0x8a50ac[_0x4c0986(0xd0)],this[_0x4c0986(0xaa)]=_0x991025['verbose']||![],this[_0x4c0986(0xbb)]=_0x991025[_0x4c0986(0xbb)]??LogLevel[_0x4c0986(0xda)],this[_0x4c0986(0xdc)]=this[_0x4c0986(0xd5)]||undefined,this[_0x4c0986(0xa6)]=getAccessToken(this['activeProfile']||undefined),this[_0x4c0986(0xa3)]=getAPIKey(this[_0x4c0986(0xd5)]||undefined);const _0x1baa17=typeof _0x3b19b1[_0x4c0986(0x94)]===_0x4c0986(0x9a)?_0x3b19b1[_0x4c0986(0x94)]:undefined;this[_0x4c0986(0x94)]=_0x1baa17||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x2c7d31=getConfigDir(),_0x3eec4a=a61_0x5de166[_0x4c0986(0xd2)](_0x2c7d31,_0x4c0986(0xa5),this[_0x4c0986(0x9f)]+_0x4c0986(0xe3)),_0x5dce64=findProjectConfigPath(),_0x2a25b0=a61_0x5de166['join'](_0x2c7d31,_0x4c0986(0xdf)),_0x360805=a61_0x5de166[_0x4c0986(0xd2)](_0x2c7d31,_0x4c0986(0xe2));let _0xe778ce=null,_0xbcb0df=null;this[_0x4c0986(0xd5)]&&(_0xe778ce=a61_0x5de166['join'](_0x2c7d31,_0x4c0986(0xd1),this[_0x4c0986(0xd5)],_0x4c0986(0xdf)),_0xbcb0df=a61_0x5de166[_0x4c0986(0xd2)](_0x2c7d31,_0x4c0986(0xd1),this[_0x4c0986(0xd5)],_0x4c0986(0xe2))),this['configFiles']={'session':a61_0x2512e1['existsSync'](_0x3eec4a)?_0x3eec4a:null,'project':_0x5dce64,'profile':_0xe778ce&&a61_0x2512e1[_0x4c0986(0xa4)](_0xe778ce)?_0xe778ce:null,'profileCredentials':_0xbcb0df&&a61_0x2512e1[_0x4c0986(0xa4)](_0xbcb0df)?_0xbcb0df:null,'global':a61_0x2512e1[_0x4c0986(0xa4)](_0x2a25b0)?_0x2a25b0:null,'globalCredentials':a61_0x2512e1[_0x4c0986(0xa4)](_0x360805)?_0x360805:null};}[a61_0x11ad9c(0xcd)](_0x528419,_0x359539){const _0xeb14f5=a61_0x11ad9c;if(!_0x359539)return _0xeb14f5(0xcb);const _0x564982=_0x359539;if(this[_0xeb14f5(0x91)]['cliFlags'][_0x528419]===_0x564982){if(_0x528419===_0xeb14f5(0xc7)&&_0x564982===_0xeb14f5(0xa1)&&!this[_0xeb14f5(0x91)][_0xeb14f5(0xd7)][_0xeb14f5(0xc7)]&&!this['layers'][_0xeb14f5(0xc0)][_0xeb14f5(0xc7)]&&!this['layers'][_0xeb14f5(0xdc)][_0xeb14f5(0xc7)]&&!this[_0xeb14f5(0x91)][_0xeb14f5(0xa7)]['site'])return _0xeb14f5(0xbe);return _0xeb14f5(0xcc)+_0x528419['replace'](/_/g,'-');}if(this[_0xeb14f5(0x91)][_0xeb14f5(0xd7)][_0x528419]===_0x564982)return _0xeb14f5(0xd7);if(this[_0xeb14f5(0x91)][_0xeb14f5(0xc0)][_0x528419]===_0x564982)return _0xeb14f5(0xc0);if(this[_0xeb14f5(0x91)][_0xeb14f5(0xdc)][_0x528419]===_0x564982)return _0xeb14f5(0xac)+this[_0xeb14f5(0xd5)];if(this[_0xeb14f5(0x91)][_0xeb14f5(0xa7)][_0x528419]===_0x564982)return _0xeb14f5(0xa7);return'default';}[a61_0x11ad9c(0xcf)](){const _0x411135=a61_0x11ad9c,_0x2f4d20=a61_0x5de166['join'](getConfigDir(),_0x411135(0xdf));if(!a61_0x2512e1['existsSync'](_0x2f4d20))return{};try{const _0x2144fe=a61_0x2512e1[_0x411135(0x92)](_0x2f4d20,_0x411135(0xa0));return JSON['parse'](_0x2144fe);}catch{return{};}}[a61_0x11ad9c(0x93)](_0x13955f){const _0x36dd86=a61_0x11ad9c;_0x13955f[_0x36dd86(0xc7)]=this['site'],!_0x13955f['database']&&this[_0x36dd86(0xde)]&&(_0x13955f[_0x36dd86(0xde)]=this[_0x36dd86(0xde)]),!_0x13955f[_0x36dd86(0xbd)]&&this['parent_segment']&&(_0x13955f[_0x36dd86(0xbd)]=this['parent_segment']),!_0x13955f['segmentPath']&&this[_0x36dd86(0x97)]&&(_0x13955f[_0x36dd86(0xb2)]=this[_0x36dd86(0x97)]),!_0x13955f[_0x36dd86(0xb3)]&&this['llm_project']&&(_0x13955f[_0x36dd86(0xb3)]=this[_0x36dd86(0x9b)]),!_0x13955f['llmAgent']&&this['llm_agent']&&(_0x13955f[_0x36dd86(0x98)]=this[_0x36dd86(0xa9)]),!_0x13955f[_0x36dd86(0x90)]&&this['workflow_project']&&(_0x13955f[_0x36dd86(0x90)]=this['workflow_project']),!_0x13955f[_0x36dd86(0xb1)]&&this[_0x36dd86(0xd0)]&&(_0x13955f['composableAudience']=this[_0x36dd86(0xd0)]);}['getParameters'](){const _0x439eea=a61_0x11ad9c;return[{'key':_0x439eea(0xc7),'value':this[_0x439eea(0xc7)]},{'key':_0x439eea(0xde),'value':this['database']},{'key':_0x439eea(0xc3),'value':this[_0x439eea(0xc3)]},{'key':_0x439eea(0x97),'value':this[_0x439eea(0x97)]},{'key':_0x439eea(0x9b),'value':this['llm_project']},{'key':_0x439eea(0xa9),'value':this[_0x439eea(0xa9)]},{'key':'workflow_project','value':this[_0x439eea(0xbc)]},{'key':_0x439eea(0xd0),'value':this['composable_audience']},{'key':'profile','value':this[_0x439eea(0xd5)]||undefined}];}[a61_0x11ad9c(0xa8)](){const _0x25b072=a61_0x11ad9c;console[_0x25b072(0xb6)](a61_0x2c9e97[_0x25b072(0xd9)](_0x25b072(0xc4)));for(const {key:_0x240266,value:_0x5131e0}of this[_0x25b072(0xb4)]()){_0x5131e0&&console[_0x25b072(0xb6)](a61_0x2c9e97[_0x25b072(0xd6)](_0x240266)+':\x20'+_0x5131e0);}}['displayWithSources'](){const _0x5bca47=a61_0x11ad9c;console['log'](a61_0x2c9e97['bold'](_0x5bca47(0xc4)));for(const {key:_0x1b4e7b,value:_0x3a81ba}of this[_0x5bca47(0xb4)]()){if(_0x3a81ba){const _0x4394e1=_0x1b4e7b===_0x5bca47(0xdc)?_0x5bca47(0xd3):'('+this[_0x5bca47(0xcd)](_0x1b4e7b,_0x3a81ba)+')';console[_0x5bca47(0xb6)](a61_0x2c9e97[_0x5bca47(0xd6)](_0x1b4e7b)+':\x20'+_0x3a81ba+'\x20'+a61_0x2c9e97['dim'](_0x4394e1));}}console['log']('\x0a'+a61_0x2c9e97[_0x5bca47(0xd9)](_0x5bca47(0x9e)));const _0x3480a7=[{'label':'Session','path':this[_0x5bca47(0xd8)]['session'],'extra':_0x5bca47(0xb7)+this['sessionId']+')'},{'label':_0x5bca47(0xb5),'path':this[_0x5bca47(0xd8)][_0x5bca47(0xc0)]},{'label':_0x5bca47(0xb9),'path':this[_0x5bca47(0xd8)][_0x5bca47(0xdc)]},{'label':_0x5bca47(0xe1),'path':this[_0x5bca47(0xd8)][_0x5bca47(0xd4)]},{'label':_0x5bca47(0xaf),'path':this[_0x5bca47(0xd8)][_0x5bca47(0xa7)]},{'label':'Global\x20Credentials','path':this['configFiles']['globalCredentials']}];for(const {label:_0x49c4bd,path:_0x769447,extra:_0x2833b5}of _0x3480a7){if(_0x769447)console[_0x5bca47(0xb6)](a61_0x2c9e97[_0x5bca47(0xd6)](_0x49c4bd)+':\x20'+_0x769447+'\x20'+a61_0x2c9e97['green']('✓')+(_0x2833b5?'\x20'+a61_0x2c9e97[_0x5bca47(0xc6)](_0x2833b5):''));else{if(_0x49c4bd===_0x5bca47(0xab))console[_0x5bca47(0xb6)](a61_0x2c9e97[_0x5bca47(0xd6)](_0x49c4bd)+':\x20'+a61_0x2c9e97[_0x5bca47(0xc6)]('none')+'\x20'+a61_0x2c9e97['dim']('(using\x20session:\x20'+this['sessionId']+')'));else(_0x49c4bd===_0x5bca47(0xb5)||_0x49c4bd==='Global')&&console['log'](a61_0x2c9e97[_0x5bca47(0xd6)](_0x49c4bd)+':\x20'+a61_0x2c9e97[_0x5bca47(0xc6)]('none'));}}}async['resolveAPIKeyAsync'](){const _0x4ee466=a61_0x11ad9c;if(!this[_0x4ee466(0xa6)]){const _0x4faff1=await getOAuthTokens(this[_0x4ee466(0xd5)]||undefined);if(_0x4faff1){const _0x54ddd4=0x5*0x3c*0x3e8,_0x1d8df1=!_0x4faff1['expires_at']||_0x4faff1[_0x4ee466(0xc1)]<Date[_0x4ee466(0xc5)]()+_0x54ddd4;if(_0x1d8df1&&_0x4faff1['refresh_token'])try{const _0x5de429=getConsoleUrl(this['site']),_0x421ec9=await refreshAccessToken(_0x5de429,_0x4faff1[_0x4ee466(0xce)]);await saveOAuthTokens(_0x421ec9,this[_0x4ee466(0xd5)]||undefined),this[_0x4ee466(0xa6)]=_0x421ec9[_0x4ee466(0x95)];}catch{this['accessToken']=_0x4faff1[_0x4ee466(0x95)];}else this[_0x4ee466(0xa6)]=_0x4faff1[_0x4ee466(0x95)];return undefined;}}return this[_0x4ee466(0xa3)]=await getAPIKeyAsync(this[_0x4ee466(0xc7)],this['activeProfile']||undefined),this[_0x4ee466(0xa3)];}static async[a61_0x11ad9c(0xdd)](_0x3944ac){const _0x1b173e=a61_0x11ad9c,_0x2cf8e7=new GlobalContext(_0x3944ac);return await _0x2cf8e7[_0x1b173e(0xc8)](),_0x2cf8e7;}}
1
+ const a61_0x25a435=a61_0x37a4;(function(_0x5a0ea7,_0x46a837){const _0x4321d5=a61_0x37a4,_0x4aec42=_0x5a0ea7();while(!![]){try{const _0x47c562=parseInt(_0x4321d5(0x205))/0x1+parseInt(_0x4321d5(0x202))/0x2*(-parseInt(_0x4321d5(0x1da))/0x3)+-parseInt(_0x4321d5(0x1bf))/0x4+-parseInt(_0x4321d5(0x1e5))/0x5+-parseInt(_0x4321d5(0x1b9))/0x6*(-parseInt(_0x4321d5(0x1c1))/0x7)+parseInt(_0x4321d5(0x1f4))/0x8*(-parseInt(_0x4321d5(0x200))/0x9)+parseInt(_0x4321d5(0x1b6))/0xa*(parseInt(_0x4321d5(0x1de))/0xb);if(_0x47c562===_0x46a837)break;else _0x4aec42['push'](_0x4aec42['shift']());}catch(_0xd2e48c){_0x4aec42['push'](_0x4aec42['shift']());}}}(a61_0x5e6c,0xe4933));function a61_0x5e6c(){const _0x37f696=['parentSegment','cli','green','Profile\x20Credentials','1028824vYrwxN','config','cyan','.env','accessToken','activeProfile','Profile','site','us01','proxy','access_token','dim','81VtUssp','existsSync','2PvfIgc','.json','llm_agent','621812ykkltM','log','Global\x20Credentials','cliFlags','profile:\x20','expires_at','not\x20set','database','segment_path','46405510gdmnoh','bold','loadGlobalConfig','50610ynqQjM','(session:\x20','composableAudience','verbose','workflow_project','parse','5884152BlVJGF','displayWithSources','469fivOhx','now','assign','(active)','global','configFiles','replace','getParameters','Project','profile','createAsync','profiles','INFO','default','profileSource','utf-8','llmAgent','entries','refresh_token','layers','composable_audience','none','workflowProject','logLevel','readFileSync','3019851ogyoAy','sessionId','apiKey','resolveAPIKeyAsync','11KJlLyj','globalCredentials','llm_project','tdx.json','injectIntoOptions','parent_segment','join','6280915RkXbZL','llmProject','Global','session','env','project','[context]','string','segmentPath','[configuration\x20files]','getSource'];a61_0x5e6c=function(){return _0x37f696;};return a61_0x5e6c();}function a61_0x37a4(_0x1a6573,_0x100347){_0x1a6573=_0x1a6573-0x1b2;const _0x5e6c8f=a61_0x5e6c();let _0x37a462=_0x5e6c8f[_0x1a6573];return _0x37a462;}import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a61_0x35a7a1 from'node:fs';import*as a61_0x14381d from'node:path';import a61_0x2349fe from'chalk';export class GlobalContext{[a61_0x25a435(0x1fb)];[a61_0x25a435(0x1b4)];[a61_0x25a435(0x1e3)];[a61_0x25a435(0x1b5)];[a61_0x25a435(0x1e0)];['llm_agent'];['workflow_project'];[a61_0x25a435(0x1d5)];[a61_0x25a435(0x1dc)];[a61_0x25a435(0x1f8)];[a61_0x25a435(0x1fd)];['verbose'];[a61_0x25a435(0x1d8)];[a61_0x25a435(0x1ca)];[a61_0x25a435(0x1cf)]=null;[a61_0x25a435(0x1d4)];[a61_0x25a435(0x1f9)];[a61_0x25a435(0x1db)];[a61_0x25a435(0x1c6)];constructor(_0x4aac6e){const _0x15aa1d=a61_0x25a435;this[_0x15aa1d(0x1db)]=getSessionID(_0x4aac6e['session']);const _0xda77a8=loadSessionContext(_0x4aac6e[_0x15aa1d(0x1e8)]),_0x2b93e2=loadProjectConfig(),_0xf74de9=this[_0x15aa1d(0x1b8)]();if(_0x4aac6e['profile'])this[_0x15aa1d(0x1f9)]=_0x4aac6e['profile'],this[_0x15aa1d(0x1cf)]=_0x15aa1d(0x1f1);else{if(_0xda77a8?.['profile'])this[_0x15aa1d(0x1f9)]=_0xda77a8[_0x15aa1d(0x1ca)],this[_0x15aa1d(0x1cf)]=_0x15aa1d(0x1e8);else{if(_0xf74de9[_0x15aa1d(0x1ca)])this[_0x15aa1d(0x1f9)]=_0xf74de9[_0x15aa1d(0x1ca)],this[_0x15aa1d(0x1cf)]='config';else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this['profileSource']=_0x15aa1d(0x1e9)):(this['activeProfile']=null,this[_0x15aa1d(0x1cf)]=null);}}const _0x5f2499=this[_0x15aa1d(0x1f9)]?loadProfile(this['activeProfile']):null,_0x49626e=_0x180b1b=>{const _0x47aa80=_0x15aa1d;if(!_0x180b1b)return{};const _0xaaad3a=_0x180b1b,_0x3953cb={};for(const [_0x34100b,_0x3b0d4b]of Object[_0x47aa80(0x1d2)](_0xaaad3a)){typeof _0x3b0d4b===_0x47aa80(0x1ec)&&(_0x3953cb[_0x34100b]=_0x3b0d4b);}return _0x3953cb;},_0x5ba114={},_0x40de01=(_0x2fcbe0,_0x2377b4,_0x327ccb)=>{const _0x24e13a=_0x15aa1d;if(!_0x2fcbe0)return![];if(_0x327ccb&&_0x2fcbe0===_0x327ccb)return![];const _0x515f84=_0xda77a8,_0x3b6b0a=_0x2b93e2,_0x3d2d83=_0x5f2499?.[_0x24e13a(0x1f5)],_0x150f6e=_0xf74de9,_0x293eb3=_0x515f84?.[_0x2377b4],_0x2752c6=_0x3b6b0a?.[_0x2377b4],_0x43f644=_0x3d2d83?.[_0x2377b4],_0x46d7f9=_0x150f6e[_0x2377b4];return _0x2fcbe0!==_0x293eb3&&_0x2fcbe0!==_0x2752c6&&_0x2fcbe0!==_0x43f644&&_0x2fcbe0!==_0x46d7f9;},_0x45a978=[{'optionKey':_0x15aa1d(0x1fb),'contextKey':'site','defaultValue':'us01'},{'optionKey':_0x15aa1d(0x1b4),'contextKey':_0x15aa1d(0x1b4)},{'optionKey':'parentSegment','contextKey':'parent_segment'},{'optionKey':_0x15aa1d(0x1e6),'contextKey':_0x15aa1d(0x1e0)},{'optionKey':_0x15aa1d(0x1d1),'contextKey':_0x15aa1d(0x204)},{'optionKey':_0x15aa1d(0x1bb),'contextKey':'composable_audience'},{'optionKey':_0x15aa1d(0x1ca),'contextKey':_0x15aa1d(0x1ca)}];for(const {optionKey:_0x295c08,contextKey:_0x56610b,defaultValue:_0x263932}of _0x45a978){const _0x30f81e=_0x4aac6e[_0x295c08];_0x40de01(_0x30f81e,_0x56610b,_0x263932)&&(_0x5ba114[_0x56610b]=_0x30f81e);}this[_0x15aa1d(0x1d4)]={'cliFlags':_0x5ba114,'session':_0x49626e(_0xda77a8),'project':_0x49626e(_0x2b93e2),'profile':_0x49626e(_0x5f2499?.[_0x15aa1d(0x1f5)]),'global':_0x49626e(_0xf74de9)};const _0x53ac3f={...this[_0x15aa1d(0x1d4)][_0x15aa1d(0x1c5)],...this['layers']['profile'],...this[_0x15aa1d(0x1d4)]['project']};process.env.TDX_SITE&&!this['layers']['session']['site']&&!this[_0x15aa1d(0x1d4)][_0x15aa1d(0x208)][_0x15aa1d(0x1fb)]&&(_0x53ac3f[_0x15aa1d(0x1fb)]=process.env.TDX_SITE);Object[_0x15aa1d(0x1c3)](_0x53ac3f,this[_0x15aa1d(0x1d4)][_0x15aa1d(0x1e8)]),Object['assign'](_0x53ac3f,this[_0x15aa1d(0x1d4)][_0x15aa1d(0x208)]);const _0x2a27f9=_0x53ac3f[_0x15aa1d(0x1fb)]||_0x15aa1d(0x1fc);this[_0x15aa1d(0x1fb)]=resolveSite(_0x2a27f9),this[_0x15aa1d(0x1b4)]=_0x53ac3f['database'],this[_0x15aa1d(0x1e3)]=_0x53ac3f[_0x15aa1d(0x1e3)],this[_0x15aa1d(0x1b5)]=_0x53ac3f[_0x15aa1d(0x1b5)],this[_0x15aa1d(0x1e0)]=_0x53ac3f[_0x15aa1d(0x1e0)],this[_0x15aa1d(0x204)]=_0x53ac3f[_0x15aa1d(0x204)],this['workflow_project']=_0x53ac3f[_0x15aa1d(0x1bd)],this[_0x15aa1d(0x1d5)]=_0x53ac3f[_0x15aa1d(0x1d5)],this[_0x15aa1d(0x1bc)]=_0x4aac6e[_0x15aa1d(0x1bc)]||![],this[_0x15aa1d(0x1d8)]=_0x4aac6e['logLevel']??LogLevel[_0x15aa1d(0x1cd)],this[_0x15aa1d(0x1ca)]=this[_0x15aa1d(0x1f9)]||undefined,this[_0x15aa1d(0x1f8)]=getAccessToken(this[_0x15aa1d(0x1f9)]||undefined),this[_0x15aa1d(0x1dc)]=getAPIKey(this[_0x15aa1d(0x1f9)]||undefined);const _0x3efeba=typeof _0xf74de9[_0x15aa1d(0x1fd)]===_0x15aa1d(0x1ec)?_0xf74de9[_0x15aa1d(0x1fd)]:undefined;this[_0x15aa1d(0x1fd)]=_0x3efeba||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x26ab1=getConfigDir(),_0x3ea435=a61_0x14381d['join'](_0x26ab1,'sessions',this['sessionId']+_0x15aa1d(0x203)),_0x15dc6e=findProjectConfigPath(),_0x3a8371=a61_0x14381d[_0x15aa1d(0x1e4)](_0x26ab1,_0x15aa1d(0x1e1)),_0x3a63e2=a61_0x14381d['join'](_0x26ab1,_0x15aa1d(0x1f7));let _0x51c669=null,_0x190b8b=null;this[_0x15aa1d(0x1f9)]&&(_0x51c669=a61_0x14381d[_0x15aa1d(0x1e4)](_0x26ab1,_0x15aa1d(0x1cc),this[_0x15aa1d(0x1f9)],_0x15aa1d(0x1e1)),_0x190b8b=a61_0x14381d[_0x15aa1d(0x1e4)](_0x26ab1,_0x15aa1d(0x1cc),this[_0x15aa1d(0x1f9)],'.env')),this[_0x15aa1d(0x1c6)]={'session':a61_0x35a7a1[_0x15aa1d(0x201)](_0x3ea435)?_0x3ea435:null,'project':_0x15dc6e,'profile':_0x51c669&&a61_0x35a7a1[_0x15aa1d(0x201)](_0x51c669)?_0x51c669:null,'profileCredentials':_0x190b8b&&a61_0x35a7a1['existsSync'](_0x190b8b)?_0x190b8b:null,'global':a61_0x35a7a1[_0x15aa1d(0x201)](_0x3a8371)?_0x3a8371:null,'globalCredentials':a61_0x35a7a1[_0x15aa1d(0x201)](_0x3a63e2)?_0x3a63e2:null};}[a61_0x25a435(0x1ef)](_0x9a01d9,_0x45f17a){const _0xe3821a=a61_0x25a435;if(!_0x45f17a)return _0xe3821a(0x1b3);const _0xd041b=_0x45f17a;if(this[_0xe3821a(0x1d4)][_0xe3821a(0x208)][_0x9a01d9]===_0xd041b){if(_0x9a01d9==='site'&&_0xd041b==='us01'&&!this['layers']['session']['site']&&!this[_0xe3821a(0x1d4)]['project'][_0xe3821a(0x1fb)]&&!this[_0xe3821a(0x1d4)][_0xe3821a(0x1ca)][_0xe3821a(0x1fb)]&&!this['layers']['global'][_0xe3821a(0x1fb)])return _0xe3821a(0x1ce);return'CLI\x20flag:\x20--'+_0x9a01d9[_0xe3821a(0x1c7)](/_/g,'-');}if(this[_0xe3821a(0x1d4)][_0xe3821a(0x1e8)][_0x9a01d9]===_0xd041b)return _0xe3821a(0x1e8);if(this[_0xe3821a(0x1d4)][_0xe3821a(0x1ea)][_0x9a01d9]===_0xd041b)return _0xe3821a(0x1ea);if(this[_0xe3821a(0x1d4)]['profile'][_0x9a01d9]===_0xd041b)return _0xe3821a(0x209)+this['activeProfile'];if(this[_0xe3821a(0x1d4)][_0xe3821a(0x1c5)][_0x9a01d9]===_0xd041b)return _0xe3821a(0x1c5);return'default';}['loadGlobalConfig'](){const _0x1e54c6=a61_0x25a435,_0x2559bb=a61_0x14381d['join'](getConfigDir(),_0x1e54c6(0x1e1));if(!a61_0x35a7a1[_0x1e54c6(0x201)](_0x2559bb))return{};try{const _0x5af1f0=a61_0x35a7a1[_0x1e54c6(0x1d9)](_0x2559bb,_0x1e54c6(0x1d0));return JSON[_0x1e54c6(0x1be)](_0x5af1f0);}catch{return{};}}[a61_0x25a435(0x1e2)](_0x582101){const _0x1204b9=a61_0x25a435;_0x582101[_0x1204b9(0x1fb)]=this[_0x1204b9(0x1fb)],!_0x582101[_0x1204b9(0x1b4)]&&this['database']&&(_0x582101[_0x1204b9(0x1b4)]=this[_0x1204b9(0x1b4)]),!_0x582101[_0x1204b9(0x1f0)]&&this[_0x1204b9(0x1e3)]&&(_0x582101[_0x1204b9(0x1f0)]=this[_0x1204b9(0x1e3)]),!_0x582101[_0x1204b9(0x1ed)]&&this[_0x1204b9(0x1b5)]&&(_0x582101[_0x1204b9(0x1ed)]=this[_0x1204b9(0x1b5)]),!_0x582101['llmProject']&&this[_0x1204b9(0x1e0)]&&(_0x582101[_0x1204b9(0x1e6)]=this[_0x1204b9(0x1e0)]),!_0x582101['llmAgent']&&this['llm_agent']&&(_0x582101[_0x1204b9(0x1d1)]=this[_0x1204b9(0x204)]),!_0x582101[_0x1204b9(0x1d7)]&&this[_0x1204b9(0x1bd)]&&(_0x582101[_0x1204b9(0x1d7)]=this['workflow_project']),!_0x582101[_0x1204b9(0x1bb)]&&this['composable_audience']&&(_0x582101[_0x1204b9(0x1bb)]=this[_0x1204b9(0x1d5)]);}[a61_0x25a435(0x1c8)](){const _0x158cfd=a61_0x25a435;return[{'key':'site','value':this[_0x158cfd(0x1fb)]},{'key':_0x158cfd(0x1b4),'value':this['database']},{'key':_0x158cfd(0x1e3),'value':this[_0x158cfd(0x1e3)]},{'key':_0x158cfd(0x1b5),'value':this[_0x158cfd(0x1b5)]},{'key':_0x158cfd(0x1e0),'value':this[_0x158cfd(0x1e0)]},{'key':_0x158cfd(0x204),'value':this[_0x158cfd(0x204)]},{'key':'workflow_project','value':this['workflow_project']},{'key':'composable_audience','value':this[_0x158cfd(0x1d5)]},{'key':_0x158cfd(0x1ca),'value':this[_0x158cfd(0x1f9)]||undefined}];}['display'](){const _0x48effb=a61_0x25a435;console[_0x48effb(0x206)](a61_0x2349fe[_0x48effb(0x1b7)](_0x48effb(0x1eb)));for(const {key:_0x34be72,value:_0xdab14d}of this[_0x48effb(0x1c8)]()){_0xdab14d&&console[_0x48effb(0x206)](a61_0x2349fe[_0x48effb(0x1f6)](_0x34be72)+':\x20'+_0xdab14d);}}[a61_0x25a435(0x1c0)](){const _0x412a1f=a61_0x25a435;console[_0x412a1f(0x206)](a61_0x2349fe[_0x412a1f(0x1b7)](_0x412a1f(0x1eb)));for(const {key:_0x4141d8,value:_0x29d8f5}of this[_0x412a1f(0x1c8)]()){if(_0x29d8f5){const _0x4fa914=_0x4141d8==='profile'?_0x412a1f(0x1c4):'('+this[_0x412a1f(0x1ef)](_0x4141d8,_0x29d8f5)+')';console['log'](a61_0x2349fe[_0x412a1f(0x1f6)](_0x4141d8)+':\x20'+_0x29d8f5+'\x20'+a61_0x2349fe['dim'](_0x4fa914));}}console['log']('\x0a'+a61_0x2349fe['bold'](_0x412a1f(0x1ee)));const _0x5751cf=[{'label':'Session','path':this[_0x412a1f(0x1c6)][_0x412a1f(0x1e8)],'extra':_0x412a1f(0x1ba)+this[_0x412a1f(0x1db)]+')'},{'label':_0x412a1f(0x1c9),'path':this[_0x412a1f(0x1c6)]['project']},{'label':_0x412a1f(0x1fa),'path':this['configFiles'][_0x412a1f(0x1ca)]},{'label':_0x412a1f(0x1f3),'path':this[_0x412a1f(0x1c6)]['profileCredentials']},{'label':_0x412a1f(0x1e7),'path':this['configFiles'][_0x412a1f(0x1c5)]},{'label':_0x412a1f(0x207),'path':this['configFiles'][_0x412a1f(0x1df)]}];for(const {label:_0x1d48d8,path:_0x38edf4,extra:_0x1f1981}of _0x5751cf){if(_0x38edf4)console[_0x412a1f(0x206)](a61_0x2349fe['cyan'](_0x1d48d8)+':\x20'+_0x38edf4+'\x20'+a61_0x2349fe[_0x412a1f(0x1f2)]('✓')+(_0x1f1981?'\x20'+a61_0x2349fe[_0x412a1f(0x1ff)](_0x1f1981):''));else{if(_0x1d48d8==='Session')console[_0x412a1f(0x206)](a61_0x2349fe[_0x412a1f(0x1f6)](_0x1d48d8)+':\x20'+a61_0x2349fe[_0x412a1f(0x1ff)](_0x412a1f(0x1d6))+'\x20'+a61_0x2349fe[_0x412a1f(0x1ff)]('(using\x20session:\x20'+this['sessionId']+')'));else(_0x1d48d8==='Project'||_0x1d48d8==='Global')&&console[_0x412a1f(0x206)](a61_0x2349fe['cyan'](_0x1d48d8)+':\x20'+a61_0x2349fe[_0x412a1f(0x1ff)]('none'));}}}async[a61_0x25a435(0x1dd)](){const _0x31cc97=a61_0x25a435;if(!this[_0x31cc97(0x1f8)]){const _0x2282f9=await getOAuthTokens(this[_0x31cc97(0x1f9)]||undefined);if(_0x2282f9){const _0x5413f9=0x5*0x3c*0x3e8,_0x5a27bb=!_0x2282f9[_0x31cc97(0x1b2)]||_0x2282f9['expires_at']<Date[_0x31cc97(0x1c2)]()+_0x5413f9;if(_0x5a27bb&&_0x2282f9[_0x31cc97(0x1d3)])try{const _0x3407f7=getConsoleUrl(this[_0x31cc97(0x1fb)]),_0x1b215d=await refreshAccessToken(_0x3407f7,_0x2282f9['refresh_token']);await saveOAuthTokens(_0x1b215d,this[_0x31cc97(0x1f9)]||undefined),this[_0x31cc97(0x1f8)]=_0x1b215d[_0x31cc97(0x1fe)];}catch{this['accessToken']=_0x2282f9[_0x31cc97(0x1fe)];}else this['accessToken']=_0x2282f9['access_token'];return undefined;}}return this['apiKey']=await getAPIKeyAsync(this[_0x31cc97(0x1fb)],this[_0x31cc97(0x1f9)]||undefined),this['apiKey'];}static async[a61_0x25a435(0x1cb)](_0x1fefbd){const _0x5dd12e=new GlobalContext(_0x1fefbd);return await _0x5dd12e['resolveAPIKeyAsync'](),_0x5dd12e;}}
@@ -1 +1 @@
1
- (function(_0x47b536,_0x2917b2){const _0x40a7f0=a62_0x5e4b,_0x10e622=_0x47b536();while(!![]){try{const _0x5f415f=parseInt(_0x40a7f0(0xa1))/0x1+-parseInt(_0x40a7f0(0xab))/0x2+-parseInt(_0x40a7f0(0x9f))/0x3+-parseInt(_0x40a7f0(0xb3))/0x4*(parseInt(_0x40a7f0(0x99))/0x5)+-parseInt(_0x40a7f0(0x98))/0x6*(parseInt(_0x40a7f0(0xa4))/0x7)+-parseInt(_0x40a7f0(0xae))/0x8*(-parseInt(_0x40a7f0(0xaa))/0x9)+parseInt(_0x40a7f0(0xb2))/0xa;if(_0x5f415f===_0x2917b2)break;else _0x10e622['push'](_0x10e622['shift']());}catch(_0x366935){_0x10e622['push'](_0x10e622['shift']());}}}(a62_0x37e9,0x1f36a));const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2729a9=a62_0x5e4b;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x4fa8cb=await import(_0x2729a9(0xa3));return EntryClass=_0x4fa8cb[_0x2729a9(0x9c)],EntryClass;}catch(_0x222477){return keyringLoadError=_0x222477 instanceof Error?_0x222477:new Error(String(_0x222477)),null;}}function getAccountName(_0x2fd18f){const _0x1cb79c=a62_0x5e4b,_0x1b8ba6=_0x2fd18f||'';return _0x1cb79c(0xb4)+_0x1b8ba6+':api_key';}export async function getKeychainAPIKey(_0x186196){const _0xf21ca0=a62_0x5e4b,_0x768614=await getKeychainAPIKeyWithStatus(_0x186196);if(_0x768614['success'])return _0x768614['value'];return _0x768614[_0xf21ca0(0x9e)]===_0xf21ca0(0x97)&&console['error'](_0xf21ca0(0xa6)+_0x768614[_0xf21ca0(0xad)]),null;}export async function getKeychainAPIKeyWithStatus(_0x1b2a55){const _0x507e9f=a62_0x5e4b;try{const _0x344080=await getEntryClass();if(!_0x344080)return{'success':![],'reason':_0x507e9f(0xa0)};const _0x1011e1=getAccountName(_0x1b2a55),_0xb271ef=new _0x344080(SERVICE_NAME,_0x1011e1),_0x59cf33=_0xb271ef[_0x507e9f(0xa7)]();if(_0x59cf33)return{'success':!![],'value':_0x59cf33};return{'success':![],'reason':'not_found'};}catch(_0x5c6e45){const _0x4ebb2e=_0x5c6e45 instanceof Error?_0x5c6e45['message']:String(_0x5c6e45);if(_0x4ebb2e[_0x507e9f(0x9d)]('-25300')||_0x4ebb2e[_0x507e9f(0xac)]()[_0x507e9f(0x9d)](_0x507e9f(0xa9))||_0x4ebb2e[_0x507e9f(0xac)]()[_0x507e9f(0x9d)]('not\x20found')||_0x4ebb2e[_0x507e9f(0xac)]()[_0x507e9f(0x9d)](_0x507e9f(0xa8)))return{'success':![],'reason':_0x507e9f(0xb0)};if(_0x4ebb2e['includes'](_0x507e9f(0x9b))||_0x4ebb2e['toLowerCase']()[_0x507e9f(0x9d)](_0x507e9f(0xaf))||_0x4ebb2e[_0x507e9f(0xac)]()[_0x507e9f(0x9d)]('access'))return{'success':![],'reason':'access_denied','message':_0x507e9f(0x9a)};return{'success':![],'reason':_0x507e9f(0xa0),'message':_0x4ebb2e};}}function a62_0x37e9(){const _0x46e274=['not_found','setPassword','3557760TtyNeI','14332GKqAEf','profile:','access_denied','1088544cHPsWH','5VgEqcc','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.','-25293','Entry','includes','reason','246618LMZktM','unavailable','67277USRnOm','not\x20supported','@napi-rs/keyring','7OJwyFK','not\x20available','Warning:\x20','getPassword','no\x20matching\x20entry','could\x20not\x20be\x20found','9ZckFNW','233242qFaUrM','toLowerCase','message','709048nYiePv','restricted'];a62_0x37e9=function(){return _0x46e274;};return a62_0x37e9();}function a62_0x5e4b(_0x24ee0e,_0x374f25){_0x24ee0e=_0x24ee0e-0x97;const _0x37e943=a62_0x37e9();let _0x5e4b93=_0x37e943[_0x24ee0e];return _0x5e4b93;}export async function saveKeychainAPIKey(_0x205517,_0x261015){const _0x3df98b=a62_0x5e4b,_0xdebb0e=await getEntryClass();if(!_0xdebb0e)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x31f9fa=getAccountName(_0x261015),_0x3c0164=new _0xdebb0e(SERVICE_NAME,_0x31f9fa);_0x3c0164[_0x3df98b(0xb1)](_0x205517);}export async function deleteKeychainAPIKey(_0x2516c8){try{const _0x5abf48=await getEntryClass();if(!_0x5abf48)return![];const _0x51338d=getAccountName(_0x2516c8),_0x1e765f=new _0x5abf48(SERVICE_NAME,_0x51338d);return _0x1e765f['deleteCredential'](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x123440=a62_0x5e4b;try{const _0x2bad4e=await getEntryClass();if(!_0x2bad4e)return![];const _0x306740=new _0x2bad4e(SERVICE_NAME,'__keychain_test__');return _0x306740[_0x123440(0xa7)](),!![];}catch(_0x1c629f){const _0x3b0ee4=_0x1c629f instanceof Error?_0x1c629f[_0x123440(0xad)][_0x123440(0xac)]():'';if(_0x3b0ee4[_0x123440(0x9d)](_0x123440(0xa5))||_0x3b0ee4[_0x123440(0x9d)](_0x123440(0xa2))||_0x3b0ee4[_0x123440(0x9d)]('cannot\x20find'))return![];return!![];}}
1
+ const a62_0x218c38=a62_0x39f6;(function(_0x5bd471,_0x18779d){const _0x12fb87=a62_0x39f6,_0x157ecf=_0x5bd471();while(!![]){try{const _0x573038=parseInt(_0x12fb87(0x18a))/0x1+-parseInt(_0x12fb87(0x185))/0x2*(parseInt(_0x12fb87(0x182))/0x3)+parseInt(_0x12fb87(0x195))/0x4+parseInt(_0x12fb87(0x192))/0x5+-parseInt(_0x12fb87(0x181))/0x6+parseInt(_0x12fb87(0x18f))/0x7*(-parseInt(_0x12fb87(0x187))/0x8)+parseInt(_0x12fb87(0x180))/0x9;if(_0x573038===_0x18779d)break;else _0x157ecf['push'](_0x157ecf['shift']());}catch(_0x4fa609){_0x157ecf['push'](_0x157ecf['shift']());}}}(a62_0x3535,0x629ec));function a62_0x3535(){const _0x55d129=['tdx','not\x20available','152484veksnL','toLowerCase','access_denied','message','getPassword','4813186hWFKoV','Warning:\x20','reason','1940860MISFli','includes','__keychain_test__','1912848XoHwdO','not\x20supported','-25293','no\x20matching\x20entry',':api_key','System\x20keychain\x20is\x20not\x20available','setPassword','Entry','value','deleteCredential','unavailable','profile:','4453713tpcCWx','456084fUNQLO','15qGUQRl','error','not_found','138466aHQhUh','restricted','8vCsKoV'];a62_0x3535=function(){return _0x55d129;};return a62_0x3535();}const SERVICE_NAME=a62_0x218c38(0x188);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x1e0335=a62_0x218c38;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x3ab264=await import('@napi-rs/keyring');return EntryClass=_0x3ab264[_0x1e0335(0x19c)],EntryClass;}catch(_0x1fe25b){return keyringLoadError=_0x1fe25b instanceof Error?_0x1fe25b:new Error(String(_0x1fe25b)),null;}}function a62_0x39f6(_0x272580,_0x1df2f0){_0x272580=_0x272580-0x180;const _0x3535a9=a62_0x3535();let _0x39f61e=_0x3535a9[_0x272580];return _0x39f61e;}function getAccountName(_0x2718bd){const _0x3eacfb=a62_0x218c38,_0x1bfa73=_0x2718bd||'';return _0x3eacfb(0x1a0)+_0x1bfa73+_0x3eacfb(0x199);}export async function getKeychainAPIKey(_0x71b031){const _0xe086e8=a62_0x218c38,_0xfac299=await getKeychainAPIKeyWithStatus(_0x71b031);if(_0xfac299['success'])return _0xfac299[_0xe086e8(0x19d)];return _0xfac299[_0xe086e8(0x191)]==='access_denied'&&console[_0xe086e8(0x183)](_0xe086e8(0x190)+_0xfac299['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x1e80bd){const _0x40a1ce=a62_0x218c38;try{const _0xf3d839=await getEntryClass();if(!_0xf3d839)return{'success':![],'reason':'unavailable'};const _0x41414d=getAccountName(_0x1e80bd),_0x325eff=new _0xf3d839(SERVICE_NAME,_0x41414d),_0x52b215=_0x325eff['getPassword']();if(_0x52b215)return{'success':!![],'value':_0x52b215};return{'success':![],'reason':_0x40a1ce(0x184)};}catch(_0x6c8020){const _0x38271f=_0x6c8020 instanceof Error?_0x6c8020['message']:String(_0x6c8020);if(_0x38271f[_0x40a1ce(0x193)]('-25300')||_0x38271f['toLowerCase']()[_0x40a1ce(0x193)]('could\x20not\x20be\x20found')||_0x38271f[_0x40a1ce(0x18b)]()[_0x40a1ce(0x193)]('not\x20found')||_0x38271f[_0x40a1ce(0x18b)]()[_0x40a1ce(0x193)](_0x40a1ce(0x198)))return{'success':![],'reason':_0x40a1ce(0x184)};if(_0x38271f[_0x40a1ce(0x193)](_0x40a1ce(0x197))||_0x38271f[_0x40a1ce(0x18b)]()[_0x40a1ce(0x193)](_0x40a1ce(0x186))||_0x38271f[_0x40a1ce(0x18b)]()[_0x40a1ce(0x193)]('access'))return{'success':![],'reason':_0x40a1ce(0x18c),'message':'Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'};return{'success':![],'reason':_0x40a1ce(0x19f),'message':_0x38271f};}}export async function saveKeychainAPIKey(_0x162b66,_0x707f05){const _0x13c074=a62_0x218c38,_0x5af657=await getEntryClass();if(!_0x5af657)throw new Error(_0x13c074(0x19a));const _0x31c962=getAccountName(_0x707f05),_0x4cb178=new _0x5af657(SERVICE_NAME,_0x31c962);_0x4cb178[_0x13c074(0x19b)](_0x162b66);}export async function deleteKeychainAPIKey(_0x2fb0a1){const _0x556bda=a62_0x218c38;try{const _0x588e58=await getEntryClass();if(!_0x588e58)return![];const _0x5305b6=getAccountName(_0x2fb0a1),_0x10de16=new _0x588e58(SERVICE_NAME,_0x5305b6);return _0x10de16[_0x556bda(0x19e)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x2bc33a=a62_0x218c38;try{const _0x5b9f8e=await getEntryClass();if(!_0x5b9f8e)return![];const _0x3296d5=new _0x5b9f8e(SERVICE_NAME,_0x2bc33a(0x194));return _0x3296d5[_0x2bc33a(0x18e)](),!![];}catch(_0x287bdb){const _0x17c084=_0x287bdb instanceof Error?_0x287bdb[_0x2bc33a(0x18d)]['toLowerCase']():'';if(_0x17c084[_0x2bc33a(0x193)](_0x2bc33a(0x189))||_0x17c084[_0x2bc33a(0x193)](_0x2bc33a(0x196))||_0x17c084[_0x2bc33a(0x193)]('cannot\x20find'))return![];return!![];}}
@@ -1 +1 @@
1
- const a63_0x1b5989=a63_0x383f;(function(_0x15156a,_0x208f1c){const _0x3677a3=a63_0x383f,_0x1fd68c=_0x15156a();while(!![]){try{const _0x11174f=-parseInt(_0x3677a3(0x154))/0x1+parseInt(_0x3677a3(0x159))/0x2+-parseInt(_0x3677a3(0x156))/0x3*(-parseInt(_0x3677a3(0x14c))/0x4)+parseInt(_0x3677a3(0x152))/0x5+parseInt(_0x3677a3(0x151))/0x6*(-parseInt(_0x3677a3(0x150))/0x7)+parseInt(_0x3677a3(0x155))/0x8+-parseInt(_0x3677a3(0x157))/0x9*(parseInt(_0x3677a3(0x149))/0xa);if(_0x11174f===_0x208f1c)break;else _0x1fd68c['push'](_0x1fd68c['shift']());}catch(_0x5ac2ed){_0x1fd68c['push'](_0x1fd68c['shift']());}}}(a63_0x269c,0x4ff04));const SERVICE_NAME=a63_0x1b5989(0x14b);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x53ac3e=a63_0x1b5989;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x142dd1=await import('@napi-rs/keyring');return EntryClass=_0x142dd1[_0x53ac3e(0x147)],EntryClass;}catch(_0x5b4df1){return keyringLoadError=_0x5b4df1 instanceof Error?_0x5b4df1:new Error(String(_0x5b4df1)),null;}}function a63_0x383f(_0x16c96e,_0x14f9c0){_0x16c96e=_0x16c96e-0x147;const _0x269c72=a63_0x269c();let _0x383f40=_0x269c72[_0x16c96e];return _0x383f40;}function a63_0x269c(){const _0x1877fd=['962700XdYWMu','System\x20keychain\x20is\x20not\x20available','164291QIdBYy','3209648PvQedw','15KtPlSj','18ZsXCfE','setPassword','1224808DKQgCI','Entry','parse','2177830stidYz','getPassword','tdx','271036PDUDVB',':oauth_tokens','stringify','profile:','9716HkHljw','2670GlzVXW'];a63_0x269c=function(){return _0x1877fd;};return a63_0x269c();}function getOAuthAccountName(_0x37fd61){const _0x5adbf7=a63_0x1b5989,_0x4a6417=_0x37fd61||'';return _0x5adbf7(0x14f)+_0x4a6417+_0x5adbf7(0x14d);}export async function saveOAuthTokens(_0x538189,_0x34fae0){const _0x6359f9=a63_0x1b5989,_0x6c172e=await getEntryClass();if(!_0x6c172e)throw new Error(_0x6359f9(0x153));const _0x3d2de9=getOAuthAccountName(_0x34fae0),_0x301dcb=new _0x6c172e(SERVICE_NAME,_0x3d2de9);_0x301dcb[_0x6359f9(0x158)](JSON[_0x6359f9(0x14e)](_0x538189));}export async function getOAuthTokens(_0x5aa071){const _0x159368=a63_0x1b5989;try{const _0x2e959a=await getEntryClass();if(!_0x2e959a)return null;const _0x5e7a2d=getOAuthAccountName(_0x5aa071),_0x281e95=new _0x2e959a(SERVICE_NAME,_0x5e7a2d),_0x3b64db=_0x281e95[_0x159368(0x14a)]();if(_0x3b64db)return JSON[_0x159368(0x148)](_0x3b64db);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x178b10){try{const _0x1ddace=await getEntryClass();if(!_0x1ddace)return![];const _0x2e9064=getOAuthAccountName(_0x178b10),_0x5e4e4b=new _0x1ddace(SERVICE_NAME,_0x2e9064);return _0x5e4e4b['deleteCredential'](),!![];}catch{return![];}}
1
+ const a63_0x531683=a63_0x3f0e;function a63_0x19df(){const _0x235e16=['50949nbhOqn','10cVIRFu','4930227eTUlEz','35OINWSj','tdx','36IRtTEn','profile:','1886709XbZjhr','2otqRPW','3215226zVVacS','deleteCredential','110056SjLJbL','setPassword',':oauth_tokens','17003umZclh','Entry','parse','137407NQyLaT','System\x20keychain\x20is\x20not\x20available','1160hfWEDn'];a63_0x19df=function(){return _0x235e16;};return a63_0x19df();}(function(_0x10cf4a,_0x560d44){const _0x5160a8=a63_0x3f0e,_0x784888=_0x10cf4a();while(!![]){try{const _0x487235=-parseInt(_0x5160a8(0x159))/0x1+parseInt(_0x5160a8(0x150))/0x2*(parseInt(_0x5160a8(0x15c))/0x3)+parseInt(_0x5160a8(0x153))/0x4*(parseInt(_0x5160a8(0x15f))/0x5)+parseInt(_0x5160a8(0x151))/0x6+-parseInt(_0x5160a8(0x156))/0x7*(parseInt(_0x5160a8(0x15b))/0x8)+parseInt(_0x5160a8(0x15e))/0x9*(parseInt(_0x5160a8(0x15d))/0xa)+-parseInt(_0x5160a8(0x163))/0xb*(parseInt(_0x5160a8(0x161))/0xc);if(_0x487235===_0x560d44)break;else _0x784888['push'](_0x784888['shift']());}catch(_0x59c173){_0x784888['push'](_0x784888['shift']());}}}(a63_0x19df,0x4693e));const SERVICE_NAME=a63_0x531683(0x160);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x47cfc0=a63_0x531683;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x45762a=await import('@napi-rs/keyring');return EntryClass=_0x45762a[_0x47cfc0(0x157)],EntryClass;}catch(_0x4afc54){return keyringLoadError=_0x4afc54 instanceof Error?_0x4afc54:new Error(String(_0x4afc54)),null;}}function getOAuthAccountName(_0x1bdc9d){const _0x57beb4=a63_0x531683,_0x261f61=_0x1bdc9d||'';return _0x57beb4(0x162)+_0x261f61+_0x57beb4(0x155);}export async function saveOAuthTokens(_0x1d08dc,_0x4a3595){const _0x1e0578=a63_0x531683,_0x402ca0=await getEntryClass();if(!_0x402ca0)throw new Error(_0x1e0578(0x15a));const _0x5d4d0a=getOAuthAccountName(_0x4a3595),_0xd73699=new _0x402ca0(SERVICE_NAME,_0x5d4d0a);_0xd73699[_0x1e0578(0x154)](JSON['stringify'](_0x1d08dc));}export async function getOAuthTokens(_0xdbee0d){const _0x1c146c=a63_0x531683;try{const _0x34c190=await getEntryClass();if(!_0x34c190)return null;const _0x3dbd81=getOAuthAccountName(_0xdbee0d),_0x8dec82=new _0x34c190(SERVICE_NAME,_0x3dbd81),_0x4450d7=_0x8dec82['getPassword']();if(_0x4450d7)return JSON[_0x1c146c(0x158)](_0x4450d7);return null;}catch{return null;}}function a63_0x3f0e(_0x57f7d5,_0x5ed5e8){_0x57f7d5=_0x57f7d5-0x150;const _0x19df1e=a63_0x19df();let _0x3f0ec7=_0x19df1e[_0x57f7d5];return _0x3f0ec7;}export async function deleteOAuthTokens(_0x57a07d){const _0xaca8e8=a63_0x531683;try{const _0x524d08=await getEntryClass();if(!_0x524d08)return![];const _0x47da9c=getOAuthAccountName(_0x57a07d),_0x48733c=new _0x524d08(SERVICE_NAME,_0x47da9c);return _0x48733c[_0xaca8e8(0x152)](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- const a64_0x4870ac=a64_0x554c;(function(_0x4dc96c,_0x293350){const _0x18f39b=a64_0x554c,_0xae69cc=_0x4dc96c();while(!![]){try{const _0x47d9f3=parseInt(_0x18f39b(0x1c7))/0x1*(parseInt(_0x18f39b(0x1da))/0x2)+parseInt(_0x18f39b(0x1e9))/0x3+-parseInt(_0x18f39b(0x1d9))/0x4*(-parseInt(_0x18f39b(0x1bd))/0x5)+-parseInt(_0x18f39b(0x1dd))/0x6*(parseInt(_0x18f39b(0x1ad))/0x7)+-parseInt(_0x18f39b(0x1e8))/0x8*(-parseInt(_0x18f39b(0x1d1))/0x9)+parseInt(_0x18f39b(0x1e2))/0xa*(-parseInt(_0x18f39b(0x1be))/0xb)+parseInt(_0x18f39b(0x1b8))/0xc*(parseInt(_0x18f39b(0x1d0))/0xd);if(_0x47d9f3===_0x293350)break;else _0xae69cc['push'](_0xae69cc['shift']());}catch(_0x517476){_0xae69cc['push'](_0xae69cc['shift']());}}}(a64_0x2b67,0x7e0c1));import*as a64_0x294319 from'node:crypto';import*as a64_0x3e3303 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;function a64_0x554c(_0xbac4e6,_0x6de532){_0xbac4e6=_0xbac4e6-0x1a6;const _0x2b678b=a64_0x2b67();let _0x554c80=_0x2b678b[_0xbac4e6];return _0x554c80;}export const OAUTH_REDIRECT_URI=a64_0x4870ac(0x1aa)+OAUTH_CALLBACK_PORT+'/oauth/callback';export function getOAuthClientId(){const _0x56eb73=a64_0x4870ac;return process.env.TD_OAUTH_CLIENT_ID||_0x56eb73(0x1db);}export function generatePKCEPair(){const _0x4f96c8=a64_0x4870ac,_0x1644c3=a64_0x294319[_0x4f96c8(0x1dc)](0x20)[_0x4f96c8(0x1b4)]('base64url'),_0xa41780=a64_0x294319[_0x4f96c8(0x1d3)](_0x4f96c8(0x1d4))[_0x4f96c8(0x1e4)](_0x1644c3)[_0x4f96c8(0x1b1)](_0x4f96c8(0x1a6));return{'verifier':_0x1644c3,'challenge':_0xa41780};}export function buildAuthorizeURL(_0x358fa8,_0x1a732c){const _0x455ec1=a64_0x4870ac,_0x27e0cf=new URL(_0x455ec1(0x1bf),_0x358fa8);return _0x27e0cf['searchParams']['set'](_0x455ec1(0x1c0),_0x455ec1(0x1cf)),_0x27e0cf[_0x455ec1(0x1c3)][_0x455ec1(0x1d6)](_0x455ec1(0x1bc),_0x1a732c['clientId']),_0x27e0cf[_0x455ec1(0x1c3)][_0x455ec1(0x1d6)](_0x455ec1(0x1cb),_0x1a732c['redirectUri']),_0x27e0cf[_0x455ec1(0x1c3)][_0x455ec1(0x1d6)]('state',_0x1a732c[_0x455ec1(0x1ce)]),_0x27e0cf['searchParams'][_0x455ec1(0x1d6)](_0x455ec1(0x1ec),_0x1a732c[_0x455ec1(0x1ba)]),_0x27e0cf[_0x455ec1(0x1c3)][_0x455ec1(0x1d6)](_0x455ec1(0x1cc),_0x455ec1(0x1c8)),_0x1a732c['scope']&&_0x27e0cf[_0x455ec1(0x1c3)][_0x455ec1(0x1d6)]('scope',_0x1a732c['scope']),_0x27e0cf[_0x455ec1(0x1b4)]();}export function buildSSOInitiateURL(_0x130381,_0x173414,_0x11fdad){const _0x5a5347=a64_0x4870ac,_0x4d9b87=new URL(_0x5a5347(0x1c2),_0x130381);_0x4d9b87['searchParams'][_0x5a5347(0x1d6)]('account_name',_0x173414);const _0x32d2b7=_0x11fdad[_0x5a5347(0x1ed)](_0x130381,'');return _0x4d9b87[_0x5a5347(0x1c3)][_0x5a5347(0x1d6)](_0x5a5347(0x1a7),_0x32d2b7),_0x4d9b87[_0x5a5347(0x1b4)]();}export async function postTokenRequest(_0x5354e1,_0x536414){const _0x3f2486=a64_0x4870ac,_0x44c559=new URLSearchParams(_0x536414)[_0x3f2486(0x1b4)](),_0x2031d1=await fetch(_0x5354e1,{'method':_0x3f2486(0x1bb),'headers':{'Content-Type':_0x3f2486(0x1ae)},'body':_0x44c559});if(!_0x2031d1['ok']){const _0x3981fc=await _0x2031d1[_0x3f2486(0x1ca)]();throw new Error(_0x3f2486(0x1e7)+_0x2031d1[_0x3f2486(0x1e3)]+_0x3f2486(0x1d2)+_0x3981fc);}const _0x3d53ac=await _0x2031d1[_0x3f2486(0x1c5)]();return{'access_token':_0x3d53ac[_0x3f2486(0x1c4)],'refresh_token':_0x3d53ac[_0x3f2486(0x1a9)],'scope':_0x3d53ac[_0x3f2486(0x1e6)],'expires_at':_0x3d53ac['expires_in']?Date[_0x3f2486(0x1b6)]()+_0x3d53ac['expires_in']*0x3e8:undefined};}function a64_0x2b67(){const _0x25e394=['scope','OAuth\x20token\x20request\x20failed\x20(','8TkvDZR','656985antZXO','http://127.0.0.1','end','code_challenge','replace','base64url','redirect_to_path','EADDRINUSE','refresh_token','http://localhost:','/oauth/callback','writeHead','205520clPCyz','application/x-www-form-urlencoded','message','text/html','digest','hex','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','toString','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','now','Not\x20Found','12SVpclh','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','codeChallenge','POST','client_id','226145fOHnbb','5951zudHHD','/oauth/authorize','response_type','get','/users/initiate_sso','searchParams','access_token','json','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','45157SmprTQ','S256','close','text','redirect_uri','code_challenge_method','authorization_code','state','code','1090102zLNEQM','5897862YvjhXl','):\x20','createHash','sha256','Port\x20','set','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','listen','16GFaXuO','14IKNlPH','tdx','randomBytes','144qLkcBg','accountName','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','/oauth/token','createServer','4330YAGImu','status','update','text/plain'];a64_0x2b67=function(){return _0x25e394;};return a64_0x2b67();}export async function exchangeCodeForTokens(_0x1d2c81,_0x3492cc,_0x3af655,_0xe4f096){const _0x4b2b06=a64_0x4870ac,_0x33e14e=_0x1d2c81+_0x4b2b06(0x1e0);return postTokenRequest(_0x33e14e,{'grant_type':_0x4b2b06(0x1cd),'client_id':getOAuthClientId(),'code':_0x3492cc,'code_verifier':_0x3af655,'redirect_uri':_0xe4f096});}export function startLocalCallbackServer(){const _0x5039b1=a64_0x4870ac;let _0x237b57,_0x3fd7b6;const _0x3902c1=new Promise((_0x466f9d,_0x531cf9)=>{_0x237b57=_0x466f9d,_0x3fd7b6=_0x531cf9;}),_0x56e68d=a64_0x3e3303[_0x5039b1(0x1e1)]((_0x26e6fc,_0x43b8f7)=>{const _0x47d26b=_0x5039b1,_0x4d94be=new URL(_0x26e6fc['url']||'/',_0x47d26b(0x1ea));if(_0x4d94be['pathname']!==_0x47d26b(0x1ab)){_0x43b8f7['writeHead'](0x194,{'Content-Type':_0x47d26b(0x1e5)}),_0x43b8f7['end'](_0x47d26b(0x1b7));return;}const _0x531e67=_0x4d94be[_0x47d26b(0x1c3)][_0x47d26b(0x1c1)]('code'),_0x4bd30f=_0x4d94be[_0x47d26b(0x1c3)][_0x47d26b(0x1c1)](_0x47d26b(0x1ce)),_0x478730=_0x4d94be[_0x47d26b(0x1c3)][_0x47d26b(0x1c1)]('error');if(_0x478730||!_0x531e67||!_0x4bd30f){_0x43b8f7[_0x47d26b(0x1ac)](0x190,{'Content-Type':_0x47d26b(0x1b0)}),_0x43b8f7['end'](_0x47d26b(0x1d7)),_0x3fd7b6(new Error(_0x47d26b(0x1b3)));return;}_0x43b8f7[_0x47d26b(0x1ac)](0xc8,{'Content-Type':_0x47d26b(0x1b0)}),_0x43b8f7[_0x47d26b(0x1eb)](_0x47d26b(0x1c6)),_0x237b57({'code':_0x531e67,'state':_0x4bd30f});});_0x56e68d['on']('error',_0x4b08aa=>{const _0x3ab872=_0x5039b1;_0x4b08aa[_0x3ab872(0x1cf)]===_0x3ab872(0x1a8)?_0x3fd7b6(new Error(_0x3ab872(0x1d5)+OAUTH_CALLBACK_PORT+_0x3ab872(0x1b9))):_0x3fd7b6(new Error('Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20'+_0x4b08aa[_0x3ab872(0x1af)]));}),_0x56e68d[_0x5039b1(0x1d8)](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x65988d=setTimeout(()=>{const _0x307d9f=_0x5039b1;_0x3fd7b6(new Error(_0x307d9f(0x1b5))),_0x56e68d[_0x307d9f(0x1c9)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x3902c1,'close':()=>{const _0x1b2117=_0x5039b1;clearTimeout(_0x65988d),_0x56e68d[_0x1b2117(0x1c9)]();}};}export async function startOAuthFlow(_0x1bc0a1,_0x2a21a8){const _0x47711b=a64_0x4870ac,_0x22d577=getConsoleUrl(_0x1bc0a1),_0xdbce18=getOAuthClientId(),{verifier:_0x1596d1,challenge:_0x12609c}=generatePKCEPair(),_0x2fb3f1=a64_0x294319[_0x47711b(0x1dc)](0x10)[_0x47711b(0x1b4)](_0x47711b(0x1b2)),_0x1d41a3=startLocalCallbackServer();try{const _0xb26c24=OAUTH_REDIRECT_URI,_0x961645=buildAuthorizeURL(_0x22d577,{'clientId':_0xdbce18,'redirectUri':_0xb26c24,'state':_0x2fb3f1,'codeChallenge':_0x12609c,'scope':'openid\x20email\x20profile'}),_0x489930=_0x2a21a8?.['accountName']?buildSSOInitiateURL(_0x22d577,_0x2a21a8[_0x47711b(0x1de)],_0x961645):_0x961645;openBrowser(_0x489930);const _0x6e6188=await _0x1d41a3['waitForCallback']();if(_0x6e6188[_0x47711b(0x1ce)]!==_0x2fb3f1)throw new Error(_0x47711b(0x1df));return await exchangeCodeForTokens(_0x22d577,_0x6e6188[_0x47711b(0x1cf)],_0x1596d1,_0xb26c24);}finally{_0x1d41a3[_0x47711b(0x1c9)]();}}
1
+ (function(_0x50c718,_0x4c71bf){const _0x24c5f5=a64_0x1376,_0x132553=_0x50c718();while(!![]){try{const _0x2c38c3=-parseInt(_0x24c5f5(0x1b6))/0x1*(parseInt(_0x24c5f5(0x188))/0x2)+parseInt(_0x24c5f5(0x18b))/0x3*(-parseInt(_0x24c5f5(0x1b5))/0x4)+parseInt(_0x24c5f5(0x196))/0x5*(parseInt(_0x24c5f5(0x1b4))/0x6)+-parseInt(_0x24c5f5(0x1af))/0x7+parseInt(_0x24c5f5(0x1c3))/0x8*(parseInt(_0x24c5f5(0x18e))/0x9)+parseInt(_0x24c5f5(0x18a))/0xa*(parseInt(_0x24c5f5(0x1a7))/0xb)+-parseInt(_0x24c5f5(0x1ab))/0xc;if(_0x2c38c3===_0x4c71bf)break;else _0x132553['push'](_0x132553['shift']());}catch(_0x50f20d){_0x132553['push'](_0x132553['shift']());}}}(a64_0x8ead,0xc35c4));import*as a64_0x5e04c4 from'node:crypto';function a64_0x1376(_0x37b966,_0x19dba7){_0x37b966=_0x37b966-0x185;const _0x8ead7e=a64_0x8ead();let _0x137647=_0x8ead7e[_0x37b966];return _0x137647;}import*as a64_0x4d90f1 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='http://localhost:'+OAUTH_CALLBACK_PORT+'/oauth/callback';export function getOAuthClientId(){const _0xcbb297=a64_0x1376;return process.env.TD_OAUTH_CLIENT_ID||_0xcbb297(0x1a0);}export function generatePKCEPair(){const _0x4df5e0=a64_0x1376,_0x590bf4=a64_0x5e04c4[_0x4df5e0(0x1aa)](0x20)[_0x4df5e0(0x19a)](_0x4df5e0(0x19b)),_0x18d257=a64_0x5e04c4[_0x4df5e0(0x186)](_0x4df5e0(0x1bd))['update'](_0x590bf4)[_0x4df5e0(0x1a2)](_0x4df5e0(0x19b));return{'verifier':_0x590bf4,'challenge':_0x18d257};}export function buildAuthorizeURL(_0x4f8901,_0x101251){const _0x1421b4=a64_0x1376,_0x53e22e=new URL(_0x1421b4(0x191),_0x4f8901);return _0x53e22e[_0x1421b4(0x19d)][_0x1421b4(0x1a5)]('response_type',_0x1421b4(0x190)),_0x53e22e[_0x1421b4(0x19d)][_0x1421b4(0x1a5)]('client_id',_0x101251['clientId']),_0x53e22e['searchParams'][_0x1421b4(0x1a5)](_0x1421b4(0x18d),_0x101251['redirectUri']),_0x53e22e[_0x1421b4(0x19d)][_0x1421b4(0x1a5)](_0x1421b4(0x1bf),_0x101251[_0x1421b4(0x1bf)]),_0x53e22e[_0x1421b4(0x19d)][_0x1421b4(0x1a5)]('code_challenge',_0x101251['codeChallenge']),_0x53e22e[_0x1421b4(0x19d)]['set'](_0x1421b4(0x198),_0x1421b4(0x1a6)),_0x101251[_0x1421b4(0x1be)]&&_0x53e22e[_0x1421b4(0x19d)]['set'](_0x1421b4(0x1be),_0x101251[_0x1421b4(0x1be)]),_0x53e22e[_0x1421b4(0x19a)]();}export function buildSSOInitiateURL(_0x5d048c,_0x56d07a,_0x1bef96){const _0x2bdc65=a64_0x1376,_0x560dae=new URL(_0x2bdc65(0x1c1),_0x5d048c);_0x560dae[_0x2bdc65(0x19d)][_0x2bdc65(0x1a5)](_0x2bdc65(0x1ad),_0x56d07a);const _0xdd545f=_0x1bef96['replace'](_0x5d048c,'');return _0x560dae[_0x2bdc65(0x19d)][_0x2bdc65(0x1a5)]('redirect_to_path',_0xdd545f),_0x560dae[_0x2bdc65(0x19a)]();}function a64_0x8ead(){const _0x1acb19=['S256','22LPQyQG','waitForCallback','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','randomBytes','15062592AfVyIB','Not\x20Found','account_name','expires_in','38843zLGtNF','text/html','hex','text','createServer','34158dopwtd','196XEvHxS','3341ugTUDU','error','/oauth/callback','accountName','message','status','application/x-www-form-urlencoded','sha256','scope','state','access_token','/users/initiate_sso','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','5004920DSfCSW','refresh_token','end','createHash','listen','658XibrKY','json','7927770WZuAdR','71871bwNsut','close','redirect_uri','18GMGPXG','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','code','/oauth/authorize','127.0.0.1','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','EADDRINUSE','OAuth\x20token\x20request\x20failed\x20(','1315bdScDw','authorization_code','code_challenge_method','):\x20','toString','base64url','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','searchParams','get','Port\x20','tdx','openid\x20email\x20profile','digest','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','writeHead','set'];a64_0x8ead=function(){return _0x1acb19;};return a64_0x8ead();}export async function postTokenRequest(_0x10324e,_0x418850){const _0x44f6de=a64_0x1376,_0x29faf2=new URLSearchParams(_0x418850)['toString'](),_0x3eb0bf=await fetch(_0x10324e,{'method':'POST','headers':{'Content-Type':_0x44f6de(0x1bc)},'body':_0x29faf2});if(!_0x3eb0bf['ok']){const _0x36e2fe=await _0x3eb0bf[_0x44f6de(0x1b2)]();throw new Error(_0x44f6de(0x195)+_0x3eb0bf[_0x44f6de(0x1bb)]+_0x44f6de(0x199)+_0x36e2fe);}const _0x4fc875=await _0x3eb0bf[_0x44f6de(0x189)]();return{'access_token':_0x4fc875[_0x44f6de(0x1c0)],'refresh_token':_0x4fc875[_0x44f6de(0x1c4)],'scope':_0x4fc875['scope'],'expires_at':_0x4fc875[_0x44f6de(0x1ae)]?Date['now']()+_0x4fc875[_0x44f6de(0x1ae)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x51cebe,_0x5c8060,_0x56563d,_0x9a5f88){const _0x39b2a4=a64_0x1376,_0x4b5bc9=_0x51cebe+'/oauth/token';return postTokenRequest(_0x4b5bc9,{'grant_type':_0x39b2a4(0x197),'client_id':getOAuthClientId(),'code':_0x5c8060,'code_verifier':_0x56563d,'redirect_uri':_0x9a5f88});}export function startLocalCallbackServer(){const _0x9baf02=a64_0x1376;let _0x35acdc,_0x5001b4;const _0x5b4d94=new Promise((_0x3d3468,_0x25a397)=>{_0x35acdc=_0x3d3468,_0x5001b4=_0x25a397;}),_0x54aa48=a64_0x4d90f1[_0x9baf02(0x1b3)]((_0x263adf,_0x2cc1a2)=>{const _0x21bedd=_0x9baf02,_0xe96c81=new URL(_0x263adf['url']||'/','http://127.0.0.1');if(_0xe96c81['pathname']!==_0x21bedd(0x1b8)){_0x2cc1a2[_0x21bedd(0x1a4)](0x194,{'Content-Type':'text/plain'}),_0x2cc1a2[_0x21bedd(0x185)](_0x21bedd(0x1ac));return;}const _0x4e5a16=_0xe96c81[_0x21bedd(0x19d)][_0x21bedd(0x19e)](_0x21bedd(0x190)),_0x45703d=_0xe96c81[_0x21bedd(0x19d)][_0x21bedd(0x19e)](_0x21bedd(0x1bf)),_0x5afbac=_0xe96c81[_0x21bedd(0x19d)][_0x21bedd(0x19e)](_0x21bedd(0x1b7));if(_0x5afbac||!_0x4e5a16||!_0x45703d){_0x2cc1a2[_0x21bedd(0x1a4)](0x190,{'Content-Type':_0x21bedd(0x1b0)}),_0x2cc1a2[_0x21bedd(0x185)](_0x21bedd(0x1c2)),_0x5001b4(new Error('OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters'));return;}_0x2cc1a2['writeHead'](0xc8,{'Content-Type':_0x21bedd(0x1b0)}),_0x2cc1a2['end'](_0x21bedd(0x19c)),_0x35acdc({'code':_0x4e5a16,'state':_0x45703d});});_0x54aa48['on'](_0x9baf02(0x1b7),_0x494841=>{const _0x57ead2=_0x9baf02;_0x494841[_0x57ead2(0x190)]===_0x57ead2(0x194)?_0x5001b4(new Error(_0x57ead2(0x19f)+OAUTH_CALLBACK_PORT+_0x57ead2(0x1a9))):_0x5001b4(new Error(_0x57ead2(0x1a3)+_0x494841[_0x57ead2(0x1ba)]));}),_0x54aa48[_0x9baf02(0x187)](OAUTH_CALLBACK_PORT,_0x9baf02(0x192));const _0x265f57=setTimeout(()=>{const _0x4f4bda=_0x9baf02;_0x5001b4(new Error(_0x4f4bda(0x193))),_0x54aa48[_0x4f4bda(0x18c)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x5b4d94,'close':()=>{clearTimeout(_0x265f57),_0x54aa48['close']();}};}export async function startOAuthFlow(_0x40d29c,_0x3fdaaa){const _0x46416f=a64_0x1376,_0x2c33b6=getConsoleUrl(_0x40d29c),_0x10d868=getOAuthClientId(),{verifier:_0x2ba22e,challenge:_0x32d900}=generatePKCEPair(),_0x519df0=a64_0x5e04c4['randomBytes'](0x10)[_0x46416f(0x19a)](_0x46416f(0x1b1)),_0x3cbf0e=startLocalCallbackServer();try{const _0x511cd9=OAUTH_REDIRECT_URI,_0x498f18=buildAuthorizeURL(_0x2c33b6,{'clientId':_0x10d868,'redirectUri':_0x511cd9,'state':_0x519df0,'codeChallenge':_0x32d900,'scope':_0x46416f(0x1a1)}),_0x3c1566=_0x3fdaaa?.[_0x46416f(0x1b9)]?buildSSOInitiateURL(_0x2c33b6,_0x3fdaaa[_0x46416f(0x1b9)],_0x498f18):_0x498f18;openBrowser(_0x3c1566);const _0x21b096=await _0x3cbf0e[_0x46416f(0x1a8)]();if(_0x21b096[_0x46416f(0x1bf)]!==_0x519df0)throw new Error(_0x46416f(0x18f));return await exchangeCodeForTokens(_0x2c33b6,_0x21b096[_0x46416f(0x190)],_0x2ba22e,_0x511cd9);}finally{_0x3cbf0e['close']();}}
@@ -1 +1 @@
1
- (function(_0x3914c7,_0x114683){const _0x21f7bb=a65_0x5516,_0x40f573=_0x3914c7();while(!![]){try{const _0x423fac=-parseInt(_0x21f7bb(0x150))/0x1*(-parseInt(_0x21f7bb(0x16f))/0x2)+-parseInt(_0x21f7bb(0x15d))/0x3+parseInt(_0x21f7bb(0x179))/0x4+parseInt(_0x21f7bb(0x133))/0x5+parseInt(_0x21f7bb(0x155))/0x6*(parseInt(_0x21f7bb(0x13b))/0x7)+parseInt(_0x21f7bb(0x13c))/0x8*(parseInt(_0x21f7bb(0x15b))/0x9)+-parseInt(_0x21f7bb(0x132))/0xa;if(_0x423fac===_0x114683)break;else _0x40f573['push'](_0x40f573['shift']());}catch(_0x28185d){_0x40f573['push'](_0x40f573['shift']());}}}(a65_0x4b33,0xd9665));import*as a65_0x48a047 from'node:fs';import*as a65_0x14168b from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME='@tdx-studio';export function getProfileParams(_0x1728a4){const _0x45410c=a65_0x5516,_0x59d291={};if(!_0x1728a4)return _0x59d291;for(const [_0x189515,_0x23c233]of Object[_0x45410c(0x154)](_0x1728a4)){_0x189515!==_0x45410c(0x172)&&_0x23c233!==undefined&&(_0x59d291[_0x189515]=_0x23c233);}return _0x59d291;}export function getProfilesDir(){const _0x27ac5b=a65_0x5516;return a65_0x14168b[_0x27ac5b(0x137)](getConfigDir(),_0x27ac5b(0x17b));}function getProfileDir(_0x1c64c6){const _0x5cb03b=a65_0x5516;return a65_0x14168b[_0x5cb03b(0x137)](getProfilesDir(),_0x1c64c6);}function getProfileConfigPath(_0x86d287){const _0x3e144d=a65_0x5516;return a65_0x14168b[_0x3e144d(0x137)](getProfileDir(_0x86d287),_0x3e144d(0x148));}function getProfileEnvPath(_0x2032c4){const _0x228eca=a65_0x5516;return a65_0x14168b[_0x228eca(0x137)](getProfileDir(_0x2032c4),_0x228eca(0x161));}function getGlobalConfigPath(){const _0x2588c9=a65_0x5516;return a65_0x14168b[_0x2588c9(0x137)](getConfigDir(),_0x2588c9(0x148));}function validateProfileName(_0x5d2ed4){const _0x2d17cc=a65_0x5516;if(/^@?[a-zA-Z0-9_-]+$/[_0x2d17cc(0x14f)](_0x5d2ed4))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x2d17cc(0x14f)](_0x5d2ed4))return;throw new Error('Invalid\x20profile\x20name:\x20'+_0x5d2ed4+_0x2d17cc(0x164));}function validateProfileConfig(_0x19c01d,_0x499dec){const _0x387a02=a65_0x5516;if(typeof _0x19c01d!=='object'||_0x19c01d===null)throw new SDKError(ErrorCode[_0x387a02(0x135)],_0x387a02(0x136)+_0x499dec+_0x387a02(0x175));const _0x584ab6=[_0x387a02(0x172),_0x387a02(0x134),'database',_0x387a02(0x162),_0x387a02(0x139),_0x387a02(0x140),_0x387a02(0x16d)],_0x39b792=_0x19c01d;for(const _0x883ff0 of Object[_0x387a02(0x151)](_0x39b792)){!_0x584ab6['includes'](_0x883ff0)&&console['warn'](_0x387a02(0x143)+_0x499dec+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x883ff0+'\x27\x20will\x20be\x20ignored');}if(_0x39b792['description']!==undefined&&typeof _0x39b792[_0x387a02(0x172)]!==_0x387a02(0x176))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x387a02(0x136)+_0x499dec+_0x387a02(0x166));if(_0x39b792[_0x387a02(0x134)]!==undefined&&typeof _0x39b792['site']!=='string')throw new SDKError(ErrorCode[_0x387a02(0x135)],_0x387a02(0x136)+_0x499dec+_0x387a02(0x14d));if(_0x39b792[_0x387a02(0x130)]!==undefined&&typeof _0x39b792[_0x387a02(0x130)]!==_0x387a02(0x176))throw new SDKError(ErrorCode[_0x387a02(0x135)],_0x387a02(0x136)+_0x499dec+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x39b792[_0x387a02(0x162)]!==undefined&&typeof _0x39b792[_0x387a02(0x162)]!==_0x387a02(0x176))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x387a02(0x136)+_0x499dec+_0x387a02(0x15f));if(_0x39b792[_0x387a02(0x139)]!==undefined&&typeof _0x39b792[_0x387a02(0x139)]!==_0x387a02(0x176))throw new SDKError(ErrorCode[_0x387a02(0x135)],_0x387a02(0x136)+_0x499dec+_0x387a02(0x16e));if(_0x39b792[_0x387a02(0x140)]!==undefined&&typeof _0x39b792['llm_agent']!=='string')throw new SDKError(ErrorCode[_0x387a02(0x135)],_0x387a02(0x136)+_0x499dec+_0x387a02(0x14e));return!![];}function loadProfilesFromTdxJson(_0x36f33d,_0xd7a947){const _0x83d73b=a65_0x5516;if(!a65_0x48a047[_0x83d73b(0x177)](_0x36f33d))return[];try{const _0x2fb019=a65_0x48a047[_0x83d73b(0x17f)](_0x36f33d,_0x83d73b(0x13d)),_0x5da180=JSON[_0x83d73b(0x141)](_0x2fb019);if(!_0x5da180[_0x83d73b(0x17b)]||typeof _0x5da180[_0x83d73b(0x17b)]!==_0x83d73b(0x174))return[];const _0x1b6455=[];for(const [_0x5e342a,_0x51ec44]of Object['entries'](_0x5da180['profiles'])){try{validateProfileConfig(_0x51ec44,_0x5e342a);const _0x22040f=getNewCredentialPath(_0x5e342a),_0x5d0ce4=getOldCredentialPath(_0x5e342a),_0x1d23af=a65_0x48a047[_0x83d73b(0x177)](_0x22040f)||a65_0x48a047[_0x83d73b(0x177)](_0x5d0ce4);_0x1b6455['push']({'name':_0x5e342a,'config':_0x51ec44,'metadata':{'name':_0x5e342a,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x1d23af,'scope':_0xd7a947});}catch(_0x5223fc){_0x5223fc instanceof Error&&(console[_0x83d73b(0x173)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x36f33d+':'),console['warn']('\x20\x20'+_0x5223fc[_0x83d73b(0x149)]+'\x0a'));}}return _0x1b6455;}catch(_0x4a1600){return _0x4a1600 instanceof SyntaxError?(console[_0x83d73b(0x173)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x36f33d+_0x83d73b(0x146)),console['warn'](_0x83d73b(0x167)+_0x4a1600[_0x83d73b(0x149)]+'\x0a')):console[_0x83d73b(0x173)](_0x83d73b(0x171)+_0x36f33d+':\x20'+_0x4a1600+'\x0a'),[];}}export function getNewCredentialPath(_0x4696ed){const _0x460ab3=a65_0x5516;return a65_0x14168b[_0x460ab3(0x137)](getConfigDir(),_0x460ab3(0x170)+_0x4696ed);}function getOldCredentialPath(_0x17b333){const _0x2320a1=a65_0x5516;return a65_0x14168b[_0x2320a1(0x137)](getProfilesDir(),_0x17b333,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x24bfff=a65_0x5516,_0x3a6f97=[],_0x7b7c4b=findProjectConfigPath();_0x7b7c4b&&_0x3a6f97[_0x24bfff(0x17d)](...loadProfilesFromTdxJson(_0x7b7c4b,_0x24bfff(0x13a)));const _0x48a89c=a65_0x14168b[_0x24bfff(0x137)](getConfigDir(),_0x24bfff(0x148));return _0x3a6f97[_0x24bfff(0x17d)](...loadProfilesFromTdxJson(_0x48a89c,_0x24bfff(0x13f))),_0x3a6f97;}function loadProfilesFromDirectories(){const _0x3c2187=a65_0x5516,_0x397f94=getProfilesDir();if(!a65_0x48a047[_0x3c2187(0x177)](_0x397f94))return[];try{return a65_0x48a047['readdirSync'](_0x397f94,{'withFileTypes':!![]})[_0x3c2187(0x169)](_0x41cc37=>_0x41cc37[_0x3c2187(0x15e)]())[_0x3c2187(0x14b)](_0x3f914c=>_0x3f914c[_0x3c2187(0x152)])[_0x3c2187(0x169)](_0x538978=>{const _0x331d29=_0x3c2187,_0x4689f1=getProfileConfigPath(_0x538978),_0x40e252=getProfileEnvPath(_0x538978);return a65_0x48a047[_0x331d29(0x177)](_0x4689f1)||a65_0x48a047[_0x331d29(0x177)](_0x40e252);})[_0x3c2187(0x14b)](_0x251095=>{const _0xccc598=_0x3c2187,_0x3f6202=loadProfileFromDirectory(_0x251095);if(_0x3f6202)return{..._0x3f6202,'scope':_0xccc598(0x157)};return null;})['filter'](_0x2f4807=>_0x2f4807!==null);}catch{return[];}}function loadProfileFromDirectory(_0x610cc7){const _0x141215=a65_0x5516,_0x5334b6=getProfileConfigPath(_0x610cc7),_0x4298b8=getOldCredentialPath(_0x610cc7);if(!a65_0x48a047[_0x141215(0x177)](_0x5334b6)&&!a65_0x48a047[_0x141215(0x177)](_0x4298b8))return null;let _0x108bc3={},_0x285602={'name':_0x610cc7,'createdAt':new Date()[_0x141215(0x16c)]()};if(a65_0x48a047['existsSync'](_0x5334b6))try{const _0x658500=a65_0x48a047[_0x141215(0x17f)](_0x5334b6,_0x141215(0x13d)),_0x1300ad=JSON[_0x141215(0x141)](_0x658500),{metadata:_0x253fbb,..._0x39191b}=_0x1300ad;_0x108bc3=_0x39191b,_0x253fbb&&(_0x285602=_0x253fbb);}catch{}return{'name':_0x610cc7,'config':_0x108bc3,'metadata':_0x285602,'hasCredentials':a65_0x48a047[_0x141215(0x177)](_0x4298b8),'scope':_0x141215(0x157)};}export function listProfiles(){const _0x5ed3d4=a65_0x5516,_0x1437a5=loadProfilesFromTdxJsonFiles(),_0x3fdcbb=loadProfilesFromDirectories();if(_0x3fdcbb[_0x5ed3d4(0x16a)]>0x0){const _0x26401f=_0x3fdcbb[_0x5ed3d4(0x14b)](_0x5bcd73=>_0x5bcd73['name'])[_0x5ed3d4(0x137)](',\x20'),_0x4a9e96=getConfigDir();console['warn'](_0x5ed3d4(0x17a)+_0x26401f),console[_0x5ed3d4(0x173)](_0x5ed3d4(0x17c)),console[_0x5ed3d4(0x173)](_0x5ed3d4(0x159)+a65_0x14168b[_0x5ed3d4(0x137)](_0x4a9e96,_0x5ed3d4(0x148))),console[_0x5ed3d4(0x173)](_0x5ed3d4(0x147)),console['warn']('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x75d2fb=[..._0x1437a5,..._0x3fdcbb],_0x5a0918=new Map();for(const _0x2fd54b of _0x75d2fb){!_0x5a0918[_0x5ed3d4(0x15a)](_0x2fd54b[_0x5ed3d4(0x152)])&&_0x5a0918[_0x5ed3d4(0x145)](_0x2fd54b[_0x5ed3d4(0x152)],_0x2fd54b);}return Array[_0x5ed3d4(0x16b)](_0x5a0918[_0x5ed3d4(0x142)]())[_0x5ed3d4(0x17e)]((_0x26080d,_0x2f74fc)=>_0x26080d['name']['localeCompare'](_0x2f74fc[_0x5ed3d4(0x152)]));}export function profileExists(_0x3bca30){const _0x5b608f=a65_0x5516,_0x18f2ff=listProfiles();return _0x18f2ff[_0x5b608f(0x168)](_0x58b957=>_0x58b957[_0x5b608f(0x152)]===_0x3bca30);}export function loadProfile(_0x5033be){const _0x49e4f9=a65_0x5516;validateProfileName(_0x5033be);const _0x534896=listProfiles(),_0x1391f1=_0x534896[_0x49e4f9(0x163)](_0x352947=>_0x352947['name']===_0x5033be);return _0x1391f1||null;}export function saveProfile(_0x27d36b,_0x5bae42,_0xd4d75f=![]){saveProfileToUserConfig(_0x27d36b,_0x5bae42);}export function deleteProfile(_0x112efa){const _0x3335db=a65_0x5516;validateProfileName(_0x112efa);const _0x2a714f=getProfileDir(_0x112efa);if(!a65_0x48a047[_0x3335db(0x177)](_0x2a714f))throw new Error('Profile\x20'+_0x112efa+'\x20does\x20not\x20exist');a65_0x48a047[_0x3335db(0x156)](_0x2a714f,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x4c017a,_0x3f93c4){const _0xfc0efc=a65_0x5516;validateProfileName(_0x4c017a);const _0xe3c07=getGlobalConfigPath(),_0x5b169f=getConfigDir();!a65_0x48a047[_0xfc0efc(0x177)](_0x5b169f)&&createSecureDirectory(_0x5b169f);let _0x5511c2={};if(a65_0x48a047['existsSync'](_0xe3c07))try{const _0x321d2b=a65_0x48a047[_0xfc0efc(0x17f)](_0xe3c07,_0xfc0efc(0x13d));_0x5511c2=JSON['parse'](_0x321d2b);}catch{console[_0xfc0efc(0x173)]('Warning:\x20Failed\x20to\x20parse\x20'+_0xe3c07+_0xfc0efc(0x153));}!_0x5511c2['profiles']&&(_0x5511c2['profiles']={}),_0x5511c2['profiles'][_0x4c017a]=_0x3f93c4,writeSecureFile(_0xe3c07,JSON[_0xfc0efc(0x165)](_0x5511c2,null,0x2));}export function removeProfileFromUserConfig(_0x28607d){const _0x9f4298=a65_0x5516;validateProfileName(_0x28607d);const _0x24d7c3=getGlobalConfigPath();if(!a65_0x48a047[_0x9f4298(0x177)](_0x24d7c3))throw new Error(_0x9f4298(0x136)+_0x28607d+_0x9f4298(0x138));let _0x123d22={};try{const _0x30232b=a65_0x48a047[_0x9f4298(0x17f)](_0x24d7c3,_0x9f4298(0x13d));_0x123d22=JSON[_0x9f4298(0x141)](_0x30232b);}catch{throw new Error(_0x9f4298(0x15c)+_0x24d7c3);}if(!_0x123d22['profiles']||!_0x123d22[_0x9f4298(0x17b)][_0x28607d])throw new Error(_0x9f4298(0x136)+_0x28607d+_0x9f4298(0x138));delete _0x123d22['profiles'][_0x28607d],_0x123d22[_0x9f4298(0x14c)]===_0x28607d&&delete _0x123d22[_0x9f4298(0x14c)],writeSecureFile(_0x24d7c3,JSON[_0x9f4298(0x165)](_0x123d22,null,0x2));}function a65_0x5516(_0x21cc25,_0x231468){_0x21cc25=_0x21cc25-0x130;const _0x4b3351=a65_0x4b33();let _0x55162a=_0x4b3351[_0x21cc25];return _0x55162a;}function a65_0x4b33(){const _0x2e9aa5=['Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','push','sort','readFileSync','database','To\x20migrate:','32614860MsWDfz','4284530iJjnUj','site','INVALID_PROFILE_CONFIG','Profile\x20\x27','join','\x27\x20not\x20found\x20in\x20user\x20configuration','llm_project','local','1589Qoxlnd','558088CJhEOM','utf-8','Warning:\x20Failed\x20to\x20parse\x20','user','llm_agent','parse','values','Warning:\x20Profile\x20\x27','\x20\x20mv\x20\x22','set',':\x20Invalid\x20JSON\x20syntax','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','tdx.json','message','Profile\x20','map','profile','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','test','1AdAbDF','keys','name',',\x20creating\x20new\x20file','entries','33138QDCqVt','rmSync','directory','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x20\x201.\x20Edit:\x20','has','45zdukIg','Failed\x20to\x20parse\x20','379437EweGGK','isDirectory','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x22\x20\x22','.env','parent_segment','find','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','stringify','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','Error:\x20','some','filter','length','from','toISOString','user_info','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','1725582GlcdQn','.env.','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','description','warn','object','\x27:\x20config\x20must\x20be\x20an\x20object','string','existsSync','\x20already\x20exists','3824844KltNpd','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','profiles'];a65_0x4b33=function(){return _0x2e9aa5;};return a65_0x4b33();}export function getActiveProfile(){const _0x1163e6=a65_0x5516,_0x425052=loadSessionContext();if(_0x425052?.[_0x1163e6(0x14c)])return _0x425052[_0x1163e6(0x14c)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x3860e3=getGlobalConfigPath();if(!a65_0x48a047['existsSync'](_0x3860e3))return null;try{const _0x367efc=a65_0x48a047['readFileSync'](_0x3860e3,'utf-8'),_0x45f5ed=JSON[_0x1163e6(0x141)](_0x367efc);return _0x45f5ed[_0x1163e6(0x14c)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x382ded){const _0x51e877=a65_0x5516,_0x64d755=getGlobalConfigPath(),_0x4b365c=getConfigDir();!a65_0x48a047[_0x51e877(0x177)](_0x4b365c)&&createSecureDirectory(_0x4b365c);let _0x48975d={};if(a65_0x48a047['existsSync'](_0x64d755))try{const _0x486e0d=a65_0x48a047[_0x51e877(0x17f)](_0x64d755,_0x51e877(0x13d));_0x48975d=JSON['parse'](_0x486e0d);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x64d755+_0x51e877(0x153));}_0x48975d[_0x51e877(0x134)]=_0x382ded,writeSecureFile(_0x64d755,JSON[_0x51e877(0x165)](_0x48975d,null,0x2));}export function saveActiveProfileToUserConfig(_0x59190e){const _0x147f11=a65_0x5516;validateProfileName(_0x59190e);const _0x2331d8=getGlobalConfigPath(),_0x1c6251=getConfigDir();!a65_0x48a047[_0x147f11(0x177)](_0x1c6251)&&createSecureDirectory(_0x1c6251);let _0x2079a0={};if(a65_0x48a047['existsSync'](_0x2331d8))try{const _0x36c0b2=a65_0x48a047[_0x147f11(0x17f)](_0x2331d8,_0x147f11(0x13d));_0x2079a0=JSON[_0x147f11(0x141)](_0x36c0b2);}catch{console[_0x147f11(0x173)](_0x147f11(0x13e)+_0x2331d8+_0x147f11(0x153));}_0x2079a0[_0x147f11(0x14c)]=_0x59190e,writeSecureFile(_0x2331d8,JSON[_0x147f11(0x165)](_0x2079a0,null,0x2));}function clearFieldFromUserConfig(_0x5b8630){const _0x3d131d=a65_0x5516,_0x2b15bb=getGlobalConfigPath();if(!a65_0x48a047[_0x3d131d(0x177)](_0x2b15bb))return;let _0x361552={};try{const _0x480af5=a65_0x48a047['readFileSync'](_0x2b15bb,_0x3d131d(0x13d));_0x361552=JSON['parse'](_0x480af5);}catch{return;}delete _0x361552[_0x5b8630],writeSecureFile(_0x2b15bb,JSON[_0x3d131d(0x165)](_0x361552,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x44b952=a65_0x5516;clearFieldFromUserConfig(_0x44b952(0x134));}export function clearActiveProfileFromUserConfig(){const _0x5dffea=a65_0x5516;clearFieldFromUserConfig(_0x5dffea(0x14c));}export function createProfile(_0x14916b,_0x21f554){const _0x1aeab9=a65_0x5516;validateProfileName(_0x14916b);if(profileExists(_0x14916b))throw new Error(_0x1aeab9(0x14a)+_0x14916b+_0x1aeab9(0x178));saveProfile(_0x14916b,_0x21f554);}export function saveProfileCredentials(_0x5c6a48,_0x36287e){const _0x3486fc=a65_0x5516;validateProfileName(_0x5c6a48);if(!profileExists(_0x5c6a48))throw new Error(_0x3486fc(0x14a)+_0x5c6a48+'\x20does\x20not\x20exist');const _0x18951f=getNewCredentialPath(_0x5c6a48);writeSecureFile(_0x18951f,_0x36287e);}export function loadProfileCredentials(_0x3d7276){const _0x339bf5=a65_0x5516;validateProfileName(_0x3d7276);const _0x2aea62=getNewCredentialPath(_0x3d7276);if(a65_0x48a047['existsSync'](_0x2aea62))try{return a65_0x48a047[_0x339bf5(0x17f)](_0x2aea62,_0x339bf5(0x13d));}catch{}const _0x2ba4d8=getOldCredentialPath(_0x3d7276);if(a65_0x48a047['existsSync'](_0x2ba4d8)){console[_0x339bf5(0x173)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x3d7276+'\x27'),console[_0x339bf5(0x173)](_0x339bf5(0x131)),console[_0x339bf5(0x173)](_0x339bf5(0x144)+_0x2ba4d8+_0x339bf5(0x160)+_0x2aea62+'\x22'),console[_0x339bf5(0x173)](_0x339bf5(0x158));try{return a65_0x48a047['readFileSync'](_0x2ba4d8,_0x339bf5(0x13d));}catch{return null;}}return null;}
1
+ const a65_0x7dd984=a65_0x3c69;(function(_0x16d37b,_0x3548e5){const _0x1e4565=a65_0x3c69,_0x221ba2=_0x16d37b();while(!![]){try{const _0x26979b=parseInt(_0x1e4565(0x1c4))/0x1+-parseInt(_0x1e4565(0x1df))/0x2+-parseInt(_0x1e4565(0x1da))/0x3+-parseInt(_0x1e4565(0x1e2))/0x4+parseInt(_0x1e4565(0x1fd))/0x5*(-parseInt(_0x1e4565(0x1ea))/0x6)+-parseInt(_0x1e4565(0x1f4))/0x7*(parseInt(_0x1e4565(0x1f0))/0x8)+parseInt(_0x1e4565(0x1ca))/0x9*(parseInt(_0x1e4565(0x1f5))/0xa);if(_0x26979b===_0x3548e5)break;else _0x221ba2['push'](_0x221ba2['shift']());}catch(_0x430b74){_0x221ba2['push'](_0x221ba2['shift']());}}}(a65_0x437d,0xb747f));import*as a65_0x4d73d1 from'node:fs';import*as a65_0x50d744 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';function a65_0x3c69(_0x414f5d,_0x214f4e){_0x414f5d=_0x414f5d-0x1b3;const _0x437d22=a65_0x437d();let _0x3c69b6=_0x437d22[_0x414f5d];return _0x3c69b6;}import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a65_0x7dd984(0x1d4);export function getProfileParams(_0x2721c4){const _0x30171d=a65_0x7dd984,_0x1dabb1={};if(!_0x2721c4)return _0x1dabb1;for(const [_0x3843ae,_0x24f0fa]of Object[_0x30171d(0x1e5)](_0x2721c4)){_0x3843ae!==_0x30171d(0x1d0)&&_0x24f0fa!==undefined&&(_0x1dabb1[_0x3843ae]=_0x24f0fa);}return _0x1dabb1;}export function getProfilesDir(){const _0x266674=a65_0x7dd984;return a65_0x50d744[_0x266674(0x1c0)](getConfigDir(),_0x266674(0x1cb));}function getProfileDir(_0x3c2a9c){return a65_0x50d744['join'](getProfilesDir(),_0x3c2a9c);}function getProfileConfigPath(_0x231d85){const _0x1847a7=a65_0x7dd984;return a65_0x50d744[_0x1847a7(0x1c0)](getProfileDir(_0x231d85),_0x1847a7(0x1e1));}function a65_0x437d(){const _0x5ab93b=[':\x20Invalid\x20JSON\x20syntax','.env','2763912vaGHSV','includes','tdx.json','598036dpiCwT','test','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','entries','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','object','\x22\x20\x22','Profile\x20\x27','28932UfAXAO','isDirectory','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x20\x201.\x20Edit:\x20','\x27\x20will\x20be\x20ignored','keys','600fRpSGR','filter','Error:\x20','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','16163TFWoib','10KTnJfE','set','message','llm_project','push','warn','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','.env.','250egTVMo','Warning:\x20Failed\x20to\x20parse\x20','sort','Profile\x20','site','parent_segment','values','\x27:\x20unknown\x20config\x20key\x20\x27','directory','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','parse','database','readdirSync','stringify','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','has','user_info','join','user','Invalid\x20profile\x20name:\x20','toISOString','179219hbZtyA','utf-8','profile',',\x20creating\x20new\x20file','llm_agent','existsSync','29646369HakPHf','profiles','length','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','localeCompare','\x27:\x20config\x20must\x20be\x20an\x20object','description','string','local','some','@tdx-studio','name','map','readFileSync','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x27\x20not\x20found\x20in\x20user\x20configuration','2330403LuDGdD','rmSync','INVALID_PROFILE_CONFIG'];a65_0x437d=function(){return _0x5ab93b;};return a65_0x437d();}function getProfileEnvPath(_0x8451){const _0x5508c4=a65_0x7dd984;return a65_0x50d744[_0x5508c4(0x1c0)](getProfileDir(_0x8451),'.env');}function getGlobalConfigPath(){const _0x25a07c=a65_0x7dd984;return a65_0x50d744[_0x25a07c(0x1c0)](getConfigDir(),_0x25a07c(0x1e1));}function validateProfileName(_0x1fac66){const _0x3b8a99=a65_0x7dd984;if(/^@?[a-zA-Z0-9_-]+$/[_0x3b8a99(0x1e3)](_0x1fac66))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x3b8a99(0x1e3)](_0x1fac66))return;throw new Error(_0x3b8a99(0x1c2)+_0x1fac66+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x7fa48f,_0x482786){const _0x3f175c=a65_0x7dd984;if(typeof _0x7fa48f!==_0x3f175c(0x1e7)||_0x7fa48f===null)throw new SDKError(ErrorCode[_0x3f175c(0x1dc)],_0x3f175c(0x1e9)+_0x482786+_0x3f175c(0x1cf));const _0x2d6697=[_0x3f175c(0x1d0),_0x3f175c(0x1b3),_0x3f175c(0x1ba),_0x3f175c(0x1b4),_0x3f175c(0x1f8),_0x3f175c(0x1c8),_0x3f175c(0x1bf)],_0xefdf0a=_0x7fa48f;for(const _0x20fe5a of Object[_0x3f175c(0x1ef)](_0xefdf0a)){!_0x2d6697[_0x3f175c(0x1e0)](_0x20fe5a)&&console[_0x3f175c(0x1fa)]('Warning:\x20Profile\x20\x27'+_0x482786+_0x3f175c(0x1b6)+_0x20fe5a+_0x3f175c(0x1ee));}if(_0xefdf0a[_0x3f175c(0x1d0)]!==undefined&&typeof _0xefdf0a[_0x3f175c(0x1d0)]!==_0x3f175c(0x1d1))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x3f175c(0x1e9)+_0x482786+_0x3f175c(0x1fb));if(_0xefdf0a['site']!==undefined&&typeof _0xefdf0a[_0x3f175c(0x1b3)]!==_0x3f175c(0x1d1))throw new SDKError(ErrorCode[_0x3f175c(0x1dc)],_0x3f175c(0x1e9)+_0x482786+_0x3f175c(0x1e4));if(_0xefdf0a['database']!==undefined&&typeof _0xefdf0a[_0x3f175c(0x1ba)]!=='string')throw new SDKError(ErrorCode[_0x3f175c(0x1dc)],_0x3f175c(0x1e9)+_0x482786+_0x3f175c(0x1ec));if(_0xefdf0a[_0x3f175c(0x1b4)]!==undefined&&typeof _0xefdf0a[_0x3f175c(0x1b4)]!==_0x3f175c(0x1d1))throw new SDKError(ErrorCode[_0x3f175c(0x1dc)],'Profile\x20\x27'+_0x482786+_0x3f175c(0x1bd));if(_0xefdf0a[_0x3f175c(0x1f8)]!==undefined&&typeof _0xefdf0a[_0x3f175c(0x1f8)]!==_0x3f175c(0x1d1))throw new SDKError(ErrorCode[_0x3f175c(0x1dc)],_0x3f175c(0x1e9)+_0x482786+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0xefdf0a[_0x3f175c(0x1c8)]!==undefined&&typeof _0xefdf0a[_0x3f175c(0x1c8)]!==_0x3f175c(0x1d1))throw new SDKError(ErrorCode[_0x3f175c(0x1dc)],_0x3f175c(0x1e9)+_0x482786+_0x3f175c(0x1e6));return!![];}function loadProfilesFromTdxJson(_0x2c139f,_0x546eda){const _0x546254=a65_0x7dd984;if(!a65_0x4d73d1[_0x546254(0x1c9)](_0x2c139f))return[];try{const _0x156f1a=a65_0x4d73d1[_0x546254(0x1d7)](_0x2c139f,_0x546254(0x1c5)),_0x9f534=JSON[_0x546254(0x1b9)](_0x156f1a);if(!_0x9f534[_0x546254(0x1cb)]||typeof _0x9f534[_0x546254(0x1cb)]!==_0x546254(0x1e7))return[];const _0x5e7247=[];for(const [_0x5a7873,_0x1f149e]of Object['entries'](_0x9f534[_0x546254(0x1cb)])){try{validateProfileConfig(_0x1f149e,_0x5a7873);const _0x506375=getNewCredentialPath(_0x5a7873),_0x57d1d5=getOldCredentialPath(_0x5a7873),_0x4f7a36=a65_0x4d73d1[_0x546254(0x1c9)](_0x506375)||a65_0x4d73d1[_0x546254(0x1c9)](_0x57d1d5);_0x5e7247['push']({'name':_0x5a7873,'config':_0x1f149e,'metadata':{'name':_0x5a7873,'createdAt':new Date()[_0x546254(0x1c3)]()},'hasCredentials':_0x4f7a36,'scope':_0x546eda});}catch(_0x3cf7e9){_0x3cf7e9 instanceof Error&&(console['warn']('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x2c139f+':'),console[_0x546254(0x1fa)]('\x20\x20'+_0x3cf7e9[_0x546254(0x1f7)]+'\x0a'));}}return _0x5e7247;}catch(_0x23dc83){return _0x23dc83 instanceof SyntaxError?(console[_0x546254(0x1fa)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x2c139f+_0x546254(0x1dd)),console[_0x546254(0x1fa)](_0x546254(0x1f2)+_0x23dc83[_0x546254(0x1f7)]+'\x0a')):console[_0x546254(0x1fa)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x2c139f+':\x20'+_0x23dc83+'\x0a'),[];}}export function getNewCredentialPath(_0x1beba4){const _0x3434c9=a65_0x7dd984;return a65_0x50d744[_0x3434c9(0x1c0)](getConfigDir(),_0x3434c9(0x1fc)+_0x1beba4);}function getOldCredentialPath(_0x283dc6){const _0x4c1570=a65_0x7dd984;return a65_0x50d744[_0x4c1570(0x1c0)](getProfilesDir(),_0x283dc6,_0x4c1570(0x1de));}function loadProfilesFromTdxJsonFiles(){const _0x116228=a65_0x7dd984,_0x2c4aae=[],_0x4da9df=findProjectConfigPath();_0x4da9df&&_0x2c4aae[_0x116228(0x1f9)](...loadProfilesFromTdxJson(_0x4da9df,_0x116228(0x1d2)));const _0x275f02=a65_0x50d744[_0x116228(0x1c0)](getConfigDir(),_0x116228(0x1e1));return _0x2c4aae[_0x116228(0x1f9)](...loadProfilesFromTdxJson(_0x275f02,_0x116228(0x1c1))),_0x2c4aae;}function loadProfilesFromDirectories(){const _0x337598=a65_0x7dd984,_0x1c09e4=getProfilesDir();if(!a65_0x4d73d1[_0x337598(0x1c9)](_0x1c09e4))return[];try{return a65_0x4d73d1[_0x337598(0x1bb)](_0x1c09e4,{'withFileTypes':!![]})['filter'](_0x41987f=>_0x41987f[_0x337598(0x1eb)]())[_0x337598(0x1d6)](_0x56553b=>_0x56553b[_0x337598(0x1d5)])[_0x337598(0x1f1)](_0x30591e=>{const _0x3d4764=_0x337598,_0x21ec65=getProfileConfigPath(_0x30591e),_0x3a306c=getProfileEnvPath(_0x30591e);return a65_0x4d73d1[_0x3d4764(0x1c9)](_0x21ec65)||a65_0x4d73d1[_0x3d4764(0x1c9)](_0x3a306c);})['map'](_0x31edd9=>{const _0x38d8f7=_0x337598,_0x2e28c=loadProfileFromDirectory(_0x31edd9);if(_0x2e28c)return{..._0x2e28c,'scope':_0x38d8f7(0x1b7)};return null;})[_0x337598(0x1f1)](_0x18ce63=>_0x18ce63!==null);}catch{return[];}}function loadProfileFromDirectory(_0x454897){const _0x52a1c6=a65_0x7dd984,_0x5a16eb=getProfileConfigPath(_0x454897),_0x22d8ae=getOldCredentialPath(_0x454897);if(!a65_0x4d73d1[_0x52a1c6(0x1c9)](_0x5a16eb)&&!a65_0x4d73d1[_0x52a1c6(0x1c9)](_0x22d8ae))return null;let _0xcc436e={},_0x152548={'name':_0x454897,'createdAt':new Date()[_0x52a1c6(0x1c3)]()};if(a65_0x4d73d1[_0x52a1c6(0x1c9)](_0x5a16eb))try{const _0x13b3c8=a65_0x4d73d1[_0x52a1c6(0x1d7)](_0x5a16eb,_0x52a1c6(0x1c5)),_0x4dc7ed=JSON['parse'](_0x13b3c8),{metadata:_0x37f565,..._0x19643b}=_0x4dc7ed;_0xcc436e=_0x19643b,_0x37f565&&(_0x152548=_0x37f565);}catch{}return{'name':_0x454897,'config':_0xcc436e,'metadata':_0x152548,'hasCredentials':a65_0x4d73d1[_0x52a1c6(0x1c9)](_0x22d8ae),'scope':_0x52a1c6(0x1b7)};}export function listProfiles(){const _0x4b5d9e=a65_0x7dd984,_0xae2ae9=loadProfilesFromTdxJsonFiles(),_0x501474=loadProfilesFromDirectories();if(_0x501474[_0x4b5d9e(0x1cc)]>0x0){const _0x2c6ce7=_0x501474[_0x4b5d9e(0x1d6)](_0x2615aa=>_0x2615aa[_0x4b5d9e(0x1d5)])[_0x4b5d9e(0x1c0)](',\x20'),_0x1e81f5=getConfigDir();console[_0x4b5d9e(0x1fa)](_0x4b5d9e(0x1b8)+_0x2c6ce7),console[_0x4b5d9e(0x1fa)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x4b5d9e(0x1fa)](_0x4b5d9e(0x1ed)+a65_0x50d744[_0x4b5d9e(0x1c0)](_0x1e81f5,_0x4b5d9e(0x1e1))),console[_0x4b5d9e(0x1fa)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x4b5d9e(0x1fa)](_0x4b5d9e(0x1cd));}const _0x5bb069=[..._0xae2ae9,..._0x501474],_0x20f1ec=new Map();for(const _0x4fbef9 of _0x5bb069){!_0x20f1ec[_0x4b5d9e(0x1be)](_0x4fbef9[_0x4b5d9e(0x1d5)])&&_0x20f1ec[_0x4b5d9e(0x1f6)](_0x4fbef9[_0x4b5d9e(0x1d5)],_0x4fbef9);}return Array['from'](_0x20f1ec[_0x4b5d9e(0x1b5)]())[_0x4b5d9e(0x1ff)]((_0x47320c,_0xd391bc)=>_0x47320c[_0x4b5d9e(0x1d5)][_0x4b5d9e(0x1ce)](_0xd391bc[_0x4b5d9e(0x1d5)]));}export function profileExists(_0x6b6581){const _0x58d9e2=a65_0x7dd984,_0x2fa0a0=listProfiles();return _0x2fa0a0[_0x58d9e2(0x1d3)](_0xe13f06=>_0xe13f06[_0x58d9e2(0x1d5)]===_0x6b6581);}export function loadProfile(_0x370f65){validateProfileName(_0x370f65);const _0x5a0954=listProfiles(),_0x4883ee=_0x5a0954['find'](_0x2a61aa=>_0x2a61aa['name']===_0x370f65);return _0x4883ee||null;}export function saveProfile(_0x730595,_0x5af703,_0x3145b9=![]){saveProfileToUserConfig(_0x730595,_0x5af703);}export function deleteProfile(_0x1ad0aa){const _0x4f68e9=a65_0x7dd984;validateProfileName(_0x1ad0aa);const _0xda056f=getProfileDir(_0x1ad0aa);if(!a65_0x4d73d1[_0x4f68e9(0x1c9)](_0xda056f))throw new Error(_0x4f68e9(0x200)+_0x1ad0aa+'\x20does\x20not\x20exist');a65_0x4d73d1[_0x4f68e9(0x1db)](_0xda056f,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x2e19ad,_0x14aa78){const _0x47eaf5=a65_0x7dd984;validateProfileName(_0x2e19ad);const _0x5ee7b5=getGlobalConfigPath(),_0x21bf47=getConfigDir();!a65_0x4d73d1[_0x47eaf5(0x1c9)](_0x21bf47)&&createSecureDirectory(_0x21bf47);let _0x14df5d={};if(a65_0x4d73d1['existsSync'](_0x5ee7b5))try{const _0x138b1a=a65_0x4d73d1[_0x47eaf5(0x1d7)](_0x5ee7b5,_0x47eaf5(0x1c5));_0x14df5d=JSON['parse'](_0x138b1a);}catch{console['warn'](_0x47eaf5(0x1fe)+_0x5ee7b5+_0x47eaf5(0x1c7));}!_0x14df5d[_0x47eaf5(0x1cb)]&&(_0x14df5d[_0x47eaf5(0x1cb)]={}),_0x14df5d[_0x47eaf5(0x1cb)][_0x2e19ad]=_0x14aa78,writeSecureFile(_0x5ee7b5,JSON[_0x47eaf5(0x1bc)](_0x14df5d,null,0x2));}export function removeProfileFromUserConfig(_0x318154){const _0x447435=a65_0x7dd984;validateProfileName(_0x318154);const _0x351660=getGlobalConfigPath();if(!a65_0x4d73d1[_0x447435(0x1c9)](_0x351660))throw new Error(_0x447435(0x1e9)+_0x318154+_0x447435(0x1d9));let _0x1a8fac={};try{const _0x21bff7=a65_0x4d73d1[_0x447435(0x1d7)](_0x351660,'utf-8');_0x1a8fac=JSON[_0x447435(0x1b9)](_0x21bff7);}catch{throw new Error('Failed\x20to\x20parse\x20'+_0x351660);}if(!_0x1a8fac[_0x447435(0x1cb)]||!_0x1a8fac['profiles'][_0x318154])throw new Error(_0x447435(0x1e9)+_0x318154+_0x447435(0x1d9));delete _0x1a8fac['profiles'][_0x318154],_0x1a8fac[_0x447435(0x1c6)]===_0x318154&&delete _0x1a8fac['profile'],writeSecureFile(_0x351660,JSON['stringify'](_0x1a8fac,null,0x2));}export function getActiveProfile(){const _0x2d09be=a65_0x7dd984,_0x3497b7=loadSessionContext();if(_0x3497b7?.[_0x2d09be(0x1c6)])return _0x3497b7[_0x2d09be(0x1c6)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1dd7b1=getGlobalConfigPath();if(!a65_0x4d73d1[_0x2d09be(0x1c9)](_0x1dd7b1))return null;try{const _0x5bcba6=a65_0x4d73d1[_0x2d09be(0x1d7)](_0x1dd7b1,_0x2d09be(0x1c5)),_0x35619c=JSON[_0x2d09be(0x1b9)](_0x5bcba6);return _0x35619c[_0x2d09be(0x1c6)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x2b2a50){const _0xde330a=a65_0x7dd984,_0x213751=getGlobalConfigPath(),_0x53a4fd=getConfigDir();!a65_0x4d73d1[_0xde330a(0x1c9)](_0x53a4fd)&&createSecureDirectory(_0x53a4fd);let _0x37116f={};if(a65_0x4d73d1[_0xde330a(0x1c9)](_0x213751))try{const _0x1eb298=a65_0x4d73d1['readFileSync'](_0x213751,_0xde330a(0x1c5));_0x37116f=JSON[_0xde330a(0x1b9)](_0x1eb298);}catch{console[_0xde330a(0x1fa)](_0xde330a(0x1fe)+_0x213751+_0xde330a(0x1c7));}_0x37116f['site']=_0x2b2a50,writeSecureFile(_0x213751,JSON[_0xde330a(0x1bc)](_0x37116f,null,0x2));}export function saveActiveProfileToUserConfig(_0xbfe23e){const _0x580779=a65_0x7dd984;validateProfileName(_0xbfe23e);const _0x550252=getGlobalConfigPath(),_0x4f4e4c=getConfigDir();!a65_0x4d73d1[_0x580779(0x1c9)](_0x4f4e4c)&&createSecureDirectory(_0x4f4e4c);let _0x119823={};if(a65_0x4d73d1[_0x580779(0x1c9)](_0x550252))try{const _0x7fb78a=a65_0x4d73d1[_0x580779(0x1d7)](_0x550252,'utf-8');_0x119823=JSON[_0x580779(0x1b9)](_0x7fb78a);}catch{console[_0x580779(0x1fa)](_0x580779(0x1fe)+_0x550252+_0x580779(0x1c7));}_0x119823[_0x580779(0x1c6)]=_0xbfe23e,writeSecureFile(_0x550252,JSON['stringify'](_0x119823,null,0x2));}function clearFieldFromUserConfig(_0xecdb2d){const _0x2d4951=a65_0x7dd984,_0x40735e=getGlobalConfigPath();if(!a65_0x4d73d1[_0x2d4951(0x1c9)](_0x40735e))return;let _0x4c69a6={};try{const _0x31c603=a65_0x4d73d1['readFileSync'](_0x40735e,_0x2d4951(0x1c5));_0x4c69a6=JSON[_0x2d4951(0x1b9)](_0x31c603);}catch{return;}delete _0x4c69a6[_0xecdb2d],writeSecureFile(_0x40735e,JSON[_0x2d4951(0x1bc)](_0x4c69a6,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x2ee386=a65_0x7dd984;clearFieldFromUserConfig(_0x2ee386(0x1b3));}export function clearActiveProfileFromUserConfig(){const _0x1b330e=a65_0x7dd984;clearFieldFromUserConfig(_0x1b330e(0x1c6));}export function createProfile(_0x24e257,_0x384c7f){const _0x3c2161=a65_0x7dd984;validateProfileName(_0x24e257);if(profileExists(_0x24e257))throw new Error(_0x3c2161(0x200)+_0x24e257+'\x20already\x20exists');saveProfile(_0x24e257,_0x384c7f);}export function saveProfileCredentials(_0x24d1d6,_0x366539){const _0x44306e=a65_0x7dd984;validateProfileName(_0x24d1d6);if(!profileExists(_0x24d1d6))throw new Error(_0x44306e(0x200)+_0x24d1d6+'\x20does\x20not\x20exist');const _0x176274=getNewCredentialPath(_0x24d1d6);writeSecureFile(_0x176274,_0x366539);}export function loadProfileCredentials(_0xd97b94){const _0x6f6cb0=a65_0x7dd984;validateProfileName(_0xd97b94);const _0x280ff8=getNewCredentialPath(_0xd97b94);if(a65_0x4d73d1[_0x6f6cb0(0x1c9)](_0x280ff8))try{return a65_0x4d73d1[_0x6f6cb0(0x1d7)](_0x280ff8,_0x6f6cb0(0x1c5));}catch{}const _0x67532=getOldCredentialPath(_0xd97b94);if(a65_0x4d73d1['existsSync'](_0x67532)){console[_0x6f6cb0(0x1fa)](_0x6f6cb0(0x1f3)+_0xd97b94+'\x27'),console['warn']('To\x20migrate:'),console[_0x6f6cb0(0x1fa)]('\x20\x20mv\x20\x22'+_0x67532+_0x6f6cb0(0x1e8)+_0x280ff8+'\x22'),console[_0x6f6cb0(0x1fa)](_0x6f6cb0(0x1d8));try{return a65_0x4d73d1[_0x6f6cb0(0x1d7)](_0x67532,_0x6f6cb0(0x1c5));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- (function(_0x19dbfc,_0x2a15e4){const _0x3077c5=a66_0x5bb4,_0x3411db=_0x19dbfc();while(!![]){try{const _0x4fbc5c=parseInt(_0x3077c5(0xc6))/0x1+-parseInt(_0x3077c5(0xc5))/0x2*(-parseInt(_0x3077c5(0xdb))/0x3)+parseInt(_0x3077c5(0xda))/0x4+parseInt(_0x3077c5(0xce))/0x5+-parseInt(_0x3077c5(0xd6))/0x6+parseInt(_0x3077c5(0xe2))/0x7*(parseInt(_0x3077c5(0xc8))/0x8)+-parseInt(_0x3077c5(0xdd))/0x9*(parseInt(_0x3077c5(0xd1))/0xa);if(_0x4fbc5c===_0x2a15e4)break;else _0x3411db['push'](_0x3411db['shift']());}catch(_0x35c492){_0x3411db['push'](_0x3411db['shift']());}}}(a66_0x2321,0xa63c1));import*as a66_0x332986 from'node:fs';function a66_0x2321(){const _0x222d4e=['14TDvgik','923888Gjkcdp','apiKey','24vJNvEk','stringify','utf-8','Failed\x20to\x20load\x20project\x20config\x20from\x20','cwd','code','6486290RNaWdi','readFileSync','api_key','24671060RZWnOi',').\x20','existsSync','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','198906HlQajK','profile','parse','includes','4698636vclIsd','407802sDFSfn','dirname','18oZoddi','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','join','writeFileSync','ENOENT','3035473pbNEAC','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.'];a66_0x2321=function(){return _0x222d4e;};return a66_0x2321();}import*as a66_0x5e1873 from'node:path';function a66_0x5bb4(_0x4bc1f6,_0x2bc2c8){_0x4bc1f6=_0x4bc1f6-0xc5;const _0x232120=a66_0x2321();let _0x5bb462=_0x232120[_0x4bc1f6];return _0x5bb462;}const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x54c777){const _0x20d3d5=a66_0x5bb4;let _0x17ed42=_0x54c777||process['cwd']();while(!![]){const _0x5bfa2a=a66_0x5e1873[_0x20d3d5(0xdf)](_0x17ed42,PROJECT_CONFIG_FILENAME);if(a66_0x332986[_0x20d3d5(0xd3)](_0x5bfa2a))return _0x5bfa2a;const _0x2bb6ec=a66_0x5e1873['dirname'](_0x17ed42);if(_0x2bb6ec===_0x17ed42)return null;_0x17ed42=_0x2bb6ec;}}export function loadProjectConfig(_0x339322){const _0x2668f0=a66_0x5bb4,_0x47a2b0=findProjectConfigPath(_0x339322);if(!_0x47a2b0)return null;try{const _0x508f04=a66_0x332986[_0x2668f0(0xcf)](_0x47a2b0,_0x2668f0(0xca)),_0x4db449=JSON[_0x2668f0(0xd8)](_0x508f04),_0x544122=JSON['stringify'](_0x4db449);if(_0x544122[_0x2668f0(0xd9)]('TD_API_KEY')||_0x544122[_0x2668f0(0xd9)](_0x2668f0(0xc7))||_0x544122['includes'](_0x2668f0(0xd0)))throw new Error(_0x2668f0(0xd4)+_0x47a2b0+_0x2668f0(0xd2)+_0x2668f0(0xe3));const {metadata:_0x319f7c,profile:_0x28f21e,..._0x4217fa}=_0x4db449;return _0x28f21e&&console['warn']('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x47a2b0+'\x20is\x20ignored.\x20'+_0x2668f0(0xde)),_0x4217fa;}catch(_0x35de29){if(_0x35de29 instanceof Error&&_0x2668f0(0xcd)in _0x35de29&&_0x35de29[_0x2668f0(0xcd)]===_0x2668f0(0xe1))return null;throw new Error(_0x2668f0(0xcb)+_0x47a2b0+':\x20'+_0x35de29);}}export function saveProjectConfig(_0x3e1af7,_0x51418c){const _0x1d1179=a66_0x5bb4,_0x45933b=_0x51418c||process[_0x1d1179(0xcc)](),_0x4bb164=a66_0x5e1873['join'](_0x45933b,PROJECT_CONFIG_FILENAME),_0x20a287=JSON[_0x1d1179(0xc9)](_0x3e1af7);if(_0x20a287['includes']('TD_API_KEY')||_0x20a287[_0x1d1179(0xd9)]('apiKey')||_0x20a287['includes'](_0x1d1179(0xd0)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x1d1179(0xd7)in _0x3e1af7)throw new Error(_0x1d1179(0xd5));a66_0x332986[_0x1d1179(0xe0)](_0x4bb164,JSON['stringify'](_0x3e1af7,null,0x2));}export function hasProjectConfig(_0xbfc566){return findProjectConfigPath(_0xbfc566)!==null;}export function getProjectRoot(_0x3b6e34){const _0x9351ed=a66_0x5bb4,_0x17e238=findProjectConfigPath(_0x3b6e34);return _0x17e238?a66_0x5e1873[_0x9351ed(0xdc)](_0x17e238):null;}
1
+ const a66_0x38a7af=a66_0x5530;(function(_0x5fd575,_0x52ac76){const _0x54ebcf=a66_0x5530,_0x42b391=_0x5fd575();while(!![]){try{const _0x241e1a=-parseInt(_0x54ebcf(0x84))/0x1*(-parseInt(_0x54ebcf(0x80))/0x2)+-parseInt(_0x54ebcf(0x83))/0x3*(parseInt(_0x54ebcf(0x68))/0x4)+parseInt(_0x54ebcf(0x82))/0x5*(-parseInt(_0x54ebcf(0x77))/0x6)+-parseInt(_0x54ebcf(0x67))/0x7*(parseInt(_0x54ebcf(0x6b))/0x8)+-parseInt(_0x54ebcf(0x81))/0x9*(-parseInt(_0x54ebcf(0x65))/0xa)+parseInt(_0x54ebcf(0x71))/0xb*(-parseInt(_0x54ebcf(0x70))/0xc)+-parseInt(_0x54ebcf(0x6d))/0xd*(-parseInt(_0x54ebcf(0x6c))/0xe);if(_0x241e1a===_0x52ac76)break;else _0x42b391['push'](_0x42b391['shift']());}catch(_0x2ecbb4){_0x42b391['push'](_0x42b391['shift']());}}}(a66_0x5080,0xda56e));function a66_0x5080(){const _0x1357cf=['tdx.json','profile','utf-8','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','42XhLYgs','join','cwd','parse','dirname','apiKey','readFileSync','writeFileSync','warn','606496NhdmzO','9CebICh','924920swhzMo','373731ekFIPz','2Hauadz','code','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','7657720JZkHuW','api_key','34832aTreyb','24KypGng','includes','\x20is\x20ignored.\x20','2224AMUPGB','235830WqrDUa','3497gqNZNc','TD_API_KEY','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','71172LzeMcF','2937zarCxl','stringify'];a66_0x5080=function(){return _0x1357cf;};return a66_0x5080();}import*as a66_0x533e3e from'node:fs';import*as a66_0xcc75fe from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x38a7af(0x73);export function findProjectConfigPath(_0x5a81bb){const _0x54782a=a66_0x38a7af;let _0x59a8c2=_0x5a81bb||process[_0x54782a(0x79)]();while(!![]){const _0x2ed9a7=a66_0xcc75fe[_0x54782a(0x78)](_0x59a8c2,PROJECT_CONFIG_FILENAME);if(a66_0x533e3e['existsSync'](_0x2ed9a7))return _0x2ed9a7;const _0x8a9455=a66_0xcc75fe[_0x54782a(0x7b)](_0x59a8c2);if(_0x8a9455===_0x59a8c2)return null;_0x59a8c2=_0x8a9455;}}function a66_0x5530(_0x3f6d8b,_0x2cfb0f){_0x3f6d8b=_0x3f6d8b-0x64;const _0x508027=a66_0x5080();let _0x553028=_0x508027[_0x3f6d8b];return _0x553028;}export function loadProjectConfig(_0x2eb20c){const _0x46d29b=a66_0x38a7af,_0x32b77a=findProjectConfigPath(_0x2eb20c);if(!_0x32b77a)return null;try{const _0x149f9a=a66_0x533e3e[_0x46d29b(0x7d)](_0x32b77a,_0x46d29b(0x75)),_0x24e33f=JSON[_0x46d29b(0x7a)](_0x149f9a),_0x232317=JSON[_0x46d29b(0x72)](_0x24e33f);if(_0x232317[_0x46d29b(0x69)]('TD_API_KEY')||_0x232317[_0x46d29b(0x69)](_0x46d29b(0x7c))||_0x232317[_0x46d29b(0x69)](_0x46d29b(0x66)))throw new Error(_0x46d29b(0x76)+_0x32b77a+').\x20'+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x79d1ea,profile:_0x5a00a9,..._0x35f936}=_0x24e33f;return _0x5a00a9&&console[_0x46d29b(0x7f)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x32b77a+_0x46d29b(0x6a)+_0x46d29b(0x6f)),_0x35f936;}catch(_0x50149f){if(_0x50149f instanceof Error&&_0x46d29b(0x85)in _0x50149f&&_0x50149f[_0x46d29b(0x85)]==='ENOENT')return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x32b77a+':\x20'+_0x50149f);}}export function saveProjectConfig(_0x51e8ab,_0x138811){const _0xbf685e=a66_0x38a7af,_0x8638a2=_0x138811||process[_0xbf685e(0x79)](),_0x3443d8=a66_0xcc75fe[_0xbf685e(0x78)](_0x8638a2,PROJECT_CONFIG_FILENAME),_0x179a4b=JSON[_0xbf685e(0x72)](_0x51e8ab);if(_0x179a4b[_0xbf685e(0x69)](_0xbf685e(0x6e))||_0x179a4b['includes'](_0xbf685e(0x7c))||_0x179a4b[_0xbf685e(0x69)](_0xbf685e(0x66)))throw new Error(_0xbf685e(0x64));if(_0xbf685e(0x74)in _0x51e8ab)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a66_0x533e3e[_0xbf685e(0x7e)](_0x3443d8,JSON[_0xbf685e(0x72)](_0x51e8ab,null,0x2));}export function hasProjectConfig(_0x306ad2){return findProjectConfigPath(_0x306ad2)!==null;}export function getProjectRoot(_0x29c3fc){const _0x4ac5a2=findProjectConfigPath(_0x29c3fc);return _0x4ac5a2?a66_0xcc75fe['dirname'](_0x4ac5a2):null;}
@@ -1 +1 @@
1
- (function(_0x347b1d,_0x25379c){const _0x1c0ab9=a67_0x23ac,_0x2c9081=_0x347b1d();while(!![]){try{const _0x40b64b=-parseInt(_0x1c0ab9(0x1d0))/0x1+parseInt(_0x1c0ab9(0x1c4))/0x2*(parseInt(_0x1c0ab9(0x1d3))/0x3)+parseInt(_0x1c0ab9(0x1d5))/0x4*(parseInt(_0x1c0ab9(0x1cf))/0x5)+parseInt(_0x1c0ab9(0x1e5))/0x6*(-parseInt(_0x1c0ab9(0x1e2))/0x7)+parseInt(_0x1c0ab9(0x1e7))/0x8*(-parseInt(_0x1c0ab9(0x1d4))/0x9)+-parseInt(_0x1c0ab9(0x1c9))/0xa+parseInt(_0x1c0ab9(0x1e1))/0xb;if(_0x40b64b===_0x25379c)break;else _0x2c9081['push'](_0x2c9081['shift']());}catch(_0x11b8ab){_0x2c9081['push'](_0x2c9081['shift']());}}}(a67_0x1c74,0xb5d99));import*as a67_0x38f4ce from'node:fs';import*as a67_0x9cc442 from'node:path';import*as a67_0x38ac7f 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 _0xea3d07=a67_0x23ac,_0x351387=process.env.TDX_CONFIG_DIR||a67_0x9cc442[_0xea3d07(0x1e9)](a67_0x38ac7f[_0xea3d07(0x1c2)](),_0xea3d07(0x1da),_0xea3d07(0x1d6));return a67_0x9cc442['join'](_0x351387,_0xea3d07(0x1e3));}function getSessionPath(_0x18a490){const _0x1acc45=a67_0x23ac;return a67_0x9cc442[_0x1acc45(0x1e9)](getSessionsDir(),_0x18a490+_0x1acc45(0x1ce));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x4b9987){const _0x9bc58f=a67_0x23ac;if(_0x4b9987)return _0x4b9987;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x9bc58f(0x1e6)]();}export function loadSessionContext(_0x3c2f8b){const _0x51b1db=a67_0x23ac,_0x59fd70=getSessionID(_0x3c2f8b),_0x580db1=/^\d+$/[_0x51b1db(0x1de)](_0x59fd70)?parseInt(_0x59fd70,0xa):null;return _0x580db1!==null?loadSessionContextByPID(_0x580db1):loadSessionContextByString(_0x59fd70);}export function loadSessionContextByPID(_0x15ac82){const _0x3f24fb=a67_0x23ac,_0x3c9b65=getSessionPath(_0x15ac82);if(!a67_0x38f4ce['existsSync'](_0x3c9b65))return null;try{const _0x16a625=a67_0x38f4ce['readFileSync'](_0x3c9b65,_0x3f24fb(0x1dc)),_0x2f3dec=JSON[_0x3f24fb(0x1d7)](_0x16a625),_0x22c108=new Date(_0x2f3dec[_0x3f24fb(0x1eb)])['getTime'](),_0x11f096=Date[_0x3f24fb(0x1db)]();if(_0x11f096-_0x22c108>SESSION_EXPIRATION_MS)return a67_0x38f4ce[_0x3f24fb(0x1c8)](_0x3c9b65),null;const _0x21d95a=JSON['stringify'](_0x2f3dec);if(_0x21d95a[_0x3f24fb(0x1e0)](_0x3f24fb(0x1cd))||_0x21d95a[_0x3f24fb(0x1e0)]('apiKey')||_0x21d95a[_0x3f24fb(0x1e0)](_0x3f24fb(0x1c7)))return console['warn']('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x3c9b65+_0x3f24fb(0x1c3)),a67_0x38f4ce['unlinkSync'](_0x3c9b65),null;return _0x2f3dec;}catch{try{a67_0x38f4ce['unlinkSync'](_0x3c9b65);}catch{}return null;}}function a67_0x23ac(_0x4feaa,_0x1c2f40){_0x4feaa=_0x4feaa-0x1c2;const _0x1c7435=a67_0x1c74();let _0x23acc8=_0x1c7435[_0x4feaa];return _0x23acc8;}function loadSessionContextByString(_0x41cec6){const _0x4c0c19=a67_0x23ac,_0x2f660f=a67_0x9cc442['join'](getSessionsDir(),_0x41cec6+'.json');if(!a67_0x38f4ce[_0x4c0c19(0x1d1)](_0x2f660f))return null;try{const _0x2f7b15=a67_0x38f4ce[_0x4c0c19(0x1ca)](_0x2f660f,_0x4c0c19(0x1dc)),_0x5979ed=JSON[_0x4c0c19(0x1d7)](_0x2f7b15),_0x280ff8=new Date(_0x5979ed[_0x4c0c19(0x1eb)])[_0x4c0c19(0x1e4)](),_0x57ed58=Date[_0x4c0c19(0x1db)]();if(_0x57ed58-_0x280ff8>SESSION_EXPIRATION_MS)return a67_0x38f4ce[_0x4c0c19(0x1c8)](_0x2f660f),null;const _0x42bbaa=JSON[_0x4c0c19(0x1dd)](_0x5979ed);if(_0x42bbaa[_0x4c0c19(0x1e0)](_0x4c0c19(0x1cd))||_0x42bbaa[_0x4c0c19(0x1e0)]('apiKey')||_0x42bbaa['includes'](_0x4c0c19(0x1c7)))return console[_0x4c0c19(0x1e8)](_0x4c0c19(0x1cb)+_0x2f660f+_0x4c0c19(0x1c3)),a67_0x38f4ce[_0x4c0c19(0x1c8)](_0x2f660f),null;return _0x5979ed;}catch{try{a67_0x38f4ce[_0x4c0c19(0x1c8)](_0x2f660f);}catch{}return null;}}function a67_0x1c74(){const _0x589e61=['push','writeFileSync','api_key','unlinkSync','3191680VwwHCj','readFileSync','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','apiKey','TD_API_KEY','.json','3715sQsIuB','878135eliLCc','existsSync','readdirSync','650490UXDQNh','972432mhWRWR','2036kAPJKl','tdx','parse','toISOString','sort','.config','now','utf-8','stringify','test','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','includes','23741784TtAnHO','7tndaNU','sessions','getTime','6820878aURaVD','toString','8TlkFhn','warn','join','endsWith','createdAt','homedir','.\x20This\x20is\x20insecure.\x20Removing\x20session.','6MCxhME'];a67_0x1c74=function(){return _0x589e61;};return a67_0x1c74();}export function saveSessionContext(_0x18ab4a,_0x598f90){const _0x564243=a67_0x23ac,_0x208742=getSessionID(_0x598f90),_0x2f38d2=/^\d+$/[_0x564243(0x1de)](_0x208742)?parseInt(_0x208742,0xa):getCurrentSessionPID(),_0x3e1841=a67_0x9cc442[_0x564243(0x1e9)](getSessionsDir(),_0x208742+_0x564243(0x1ce)),_0x242cac=getSessionsDir();createSecureDirectory(_0x242cac);const _0x3bbe8e=JSON[_0x564243(0x1dd)](_0x18ab4a);if(_0x3bbe8e['includes'](_0x564243(0x1cd))||_0x3bbe8e[_0x564243(0x1e0)](_0x564243(0x1cc))||_0x3bbe8e['includes'](_0x564243(0x1c7)))throw new Error(_0x564243(0x1df));let _0x527a31;const _0x2010cd=/^\d+$/['test'](_0x208742)?loadSessionContextByPID(parseInt(_0x208742,0xa)):loadSessionContextByString(_0x208742);_0x2010cd?_0x527a31={..._0x2010cd,..._0x18ab4a,'pid':_0x2f38d2,'sessionId':_0x208742!==_0x2f38d2[_0x564243(0x1e6)]()?_0x208742:undefined,'updatedAt':new Date()['toISOString']()}:_0x527a31={'pid':_0x2f38d2,'sessionId':_0x208742!==_0x2f38d2[_0x564243(0x1e6)]()?_0x208742:undefined,..._0x18ab4a,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x564243(0x1d8)]()},a67_0x38f4ce[_0x564243(0x1c6)](_0x3e1841,JSON[_0x564243(0x1dd)](_0x527a31,null,0x2));}export function clearSessionContext(_0x3b7da1){const _0x55b1a0=a67_0x23ac,_0x12470e=getSessionID(_0x3b7da1),_0x6908b6=a67_0x9cc442['join'](getSessionsDir(),_0x12470e+_0x55b1a0(0x1ce));a67_0x38f4ce[_0x55b1a0(0x1d1)](_0x6908b6)&&a67_0x38f4ce[_0x55b1a0(0x1c8)](_0x6908b6);}export function clearSessionContextField(_0x395c78,_0x30c8b9){const _0x2ab700=a67_0x23ac,_0x5a4a65=getSessionID(_0x30c8b9),_0x518c71=a67_0x9cc442[_0x2ab700(0x1e9)](getSessionsDir(),_0x5a4a65+'.json');if(!a67_0x38f4ce[_0x2ab700(0x1d1)](_0x518c71))return;try{const _0x31c0ae=a67_0x38f4ce[_0x2ab700(0x1ca)](_0x518c71,_0x2ab700(0x1dc)),_0x4483ee=JSON[_0x2ab700(0x1d7)](_0x31c0ae);delete _0x4483ee[_0x395c78],a67_0x38f4ce['writeFileSync'](_0x518c71,JSON[_0x2ab700(0x1dd)](_0x4483ee,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x15223c=a67_0x23ac,_0x304165=getSessionsDir();if(!a67_0x38f4ce['existsSync'](_0x304165))return 0x0;let _0x3de3ec=0x0;const _0x42618c=Date[_0x15223c(0x1db)]();try{const _0x442bde=a67_0x38f4ce[_0x15223c(0x1d2)](_0x304165);for(const _0x9e9677 of _0x442bde){if(!_0x9e9677[_0x15223c(0x1ea)](_0x15223c(0x1ce)))continue;const _0x1b44c2=a67_0x9cc442[_0x15223c(0x1e9)](_0x304165,_0x9e9677),_0x2f2989=_0x9e9677['replace']('.json',''),_0x46498a=parseInt(_0x2f2989,0xa),_0x3fcfa6=!isNaN(_0x46498a);if(_0x3fcfa6){if(!isProcessRunning(_0x46498a)){a67_0x38f4ce[_0x15223c(0x1c8)](_0x1b44c2),_0x3de3ec++;continue;}}try{const _0x5cbd6d=a67_0x38f4ce['readFileSync'](_0x1b44c2,'utf-8'),_0x5bbeca=JSON[_0x15223c(0x1d7)](_0x5cbd6d),_0x23bb53=new Date(_0x5bbeca['createdAt'])[_0x15223c(0x1e4)]();_0x42618c-_0x23bb53>SESSION_EXPIRATION_MS&&(a67_0x38f4ce[_0x15223c(0x1c8)](_0x1b44c2),_0x3de3ec++);}catch{a67_0x38f4ce[_0x15223c(0x1c8)](_0x1b44c2),_0x3de3ec++;}}}catch{}return _0x3de3ec;}export function listActiveSessions(){const _0x1ab287=a67_0x23ac,_0x5b4cc2=getSessionsDir();if(!a67_0x38f4ce[_0x1ab287(0x1d1)](_0x5b4cc2))return[];try{const _0x4c7048=a67_0x38f4ce[_0x1ab287(0x1d2)](_0x5b4cc2),_0x491c7d=[];for(const _0x35a80e of _0x4c7048){if(!_0x35a80e[_0x1ab287(0x1ea)](_0x1ab287(0x1ce)))continue;const _0x1ae905=_0x35a80e['replace']('.json',''),_0x33e36a=parseInt(_0x1ae905,0xa);!isNaN(_0x33e36a)&&isProcessRunning(_0x33e36a)&&_0x491c7d[_0x1ab287(0x1c5)](_0x33e36a);}return _0x491c7d[_0x1ab287(0x1d9)]((_0x36a8bd,_0x56ed36)=>_0x36a8bd-_0x56ed36);}catch{return[];}}
1
+ (function(_0x210a27,_0x5f45fb){const _0x93bda6=a67_0x2598,_0x46e949=_0x210a27();while(!![]){try{const _0x1a14cb=-parseInt(_0x93bda6(0xdf))/0x1*(-parseInt(_0x93bda6(0xeb))/0x2)+parseInt(_0x93bda6(0xd7))/0x3+parseInt(_0x93bda6(0xd5))/0x4*(-parseInt(_0x93bda6(0xe5))/0x5)+-parseInt(_0x93bda6(0xc7))/0x6*(parseInt(_0x93bda6(0xed))/0x7)+-parseInt(_0x93bda6(0xcb))/0x8*(parseInt(_0x93bda6(0xca))/0x9)+-parseInt(_0x93bda6(0xc6))/0xa*(-parseInt(_0x93bda6(0xd8))/0xb)+-parseInt(_0x93bda6(0xe8))/0xc*(-parseInt(_0x93bda6(0xd6))/0xd);if(_0x1a14cb===_0x5f45fb)break;else _0x46e949['push'](_0x46e949['shift']());}catch(_0xf4e51b){_0x46e949['push'](_0x46e949['shift']());}}}(a67_0x1b40,0x299f4));import*as a67_0x406a2b from'node:fs';import*as a67_0x1fa905 from'node:path';function a67_0x2598(_0x1e3929,_0x278bc9){_0x1e3929=_0x1e3929-0xc6;const _0x1b40c7=a67_0x1b40();let _0x259875=_0x1b40c7[_0x1e3929];return _0x259875;}import*as a67_0x2de195 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 _0x32dcdb=a67_0x2598,_0x3fb2dc=process.env.TDX_CONFIG_DIR||a67_0x1fa905[_0x32dcdb(0xc9)](a67_0x2de195[_0x32dcdb(0xd4)](),'.config',_0x32dcdb(0xd2));return a67_0x1fa905[_0x32dcdb(0xc9)](_0x3fb2dc,_0x32dcdb(0xe1));}function getSessionPath(_0x4c26ec){const _0xcd0609=a67_0x2598;return a67_0x1fa905[_0xcd0609(0xc9)](getSessionsDir(),_0x4c26ec+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x2e76d2){const _0x3f218d=a67_0x2598;if(_0x2e76d2)return _0x2e76d2;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x3f218d(0xea)]();}function a67_0x1b40(){const _0x379e7a=['warn','homedir','4ezUHZt','1459198DdWcre','747240aYbcDN','13233ZZDZSi','api_key','writeFileSync','readdirSync','.\x20This\x20is\x20insecure.\x20Removing\x20session.','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','endsWith','2akaDQW','unlinkSync','sessions','createdAt','toISOString','utf-8','519020bFFZWt','.json','TD_API_KEY','24ZuTwIF','parse','toString','95726FWyndv','includes','490WRVuRB','stringify','1030sfqtNC','10410zPTpNX','test','join','9ANLOAu','2379752LxHjNC','apiKey','existsSync','getTime','push','now','readFileSync','tdx'];a67_0x1b40=function(){return _0x379e7a;};return a67_0x1b40();}export function loadSessionContext(_0x5be30c){const _0x26f7da=a67_0x2598,_0xbaa0e7=getSessionID(_0x5be30c),_0x2f91ca=/^\d+$/[_0x26f7da(0xc8)](_0xbaa0e7)?parseInt(_0xbaa0e7,0xa):null;return _0x2f91ca!==null?loadSessionContextByPID(_0x2f91ca):loadSessionContextByString(_0xbaa0e7);}export function loadSessionContextByPID(_0x5e1a28){const _0x3b414c=a67_0x2598,_0x967e0d=getSessionPath(_0x5e1a28);if(!a67_0x406a2b['existsSync'](_0x967e0d))return null;try{const _0x3f788c=a67_0x406a2b[_0x3b414c(0xd1)](_0x967e0d,_0x3b414c(0xe4)),_0x283516=JSON[_0x3b414c(0xe9)](_0x3f788c),_0x2cf9d9=new Date(_0x283516[_0x3b414c(0xe2)])[_0x3b414c(0xce)](),_0x473609=Date['now']();if(_0x473609-_0x2cf9d9>SESSION_EXPIRATION_MS)return a67_0x406a2b[_0x3b414c(0xe0)](_0x967e0d),null;const _0x3072f=JSON[_0x3b414c(0xee)](_0x283516);if(_0x3072f['includes'](_0x3b414c(0xe7))||_0x3072f[_0x3b414c(0xec)](_0x3b414c(0xcc))||_0x3072f[_0x3b414c(0xec)](_0x3b414c(0xd9)))return console[_0x3b414c(0xd3)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x967e0d+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a67_0x406a2b[_0x3b414c(0xe0)](_0x967e0d),null;return _0x283516;}catch{try{a67_0x406a2b[_0x3b414c(0xe0)](_0x967e0d);}catch{}return null;}}function loadSessionContextByString(_0x243e68){const _0xe78793=a67_0x2598,_0x5c31e1=a67_0x1fa905[_0xe78793(0xc9)](getSessionsDir(),_0x243e68+_0xe78793(0xe6));if(!a67_0x406a2b['existsSync'](_0x5c31e1))return null;try{const _0x1ce5e5=a67_0x406a2b[_0xe78793(0xd1)](_0x5c31e1,'utf-8'),_0x3f9ce1=JSON[_0xe78793(0xe9)](_0x1ce5e5),_0x19951f=new Date(_0x3f9ce1[_0xe78793(0xe2)])[_0xe78793(0xce)](),_0x1e9d68=Date[_0xe78793(0xd0)]();if(_0x1e9d68-_0x19951f>SESSION_EXPIRATION_MS)return a67_0x406a2b[_0xe78793(0xe0)](_0x5c31e1),null;const _0x144e30=JSON[_0xe78793(0xee)](_0x3f9ce1);if(_0x144e30[_0xe78793(0xec)](_0xe78793(0xe7))||_0x144e30[_0xe78793(0xec)]('apiKey')||_0x144e30[_0xe78793(0xec)](_0xe78793(0xd9)))return console['warn'](_0xe78793(0xdd)+_0x5c31e1+_0xe78793(0xdc)),a67_0x406a2b[_0xe78793(0xe0)](_0x5c31e1),null;return _0x3f9ce1;}catch{try{a67_0x406a2b[_0xe78793(0xe0)](_0x5c31e1);}catch{}return null;}}export function saveSessionContext(_0x2a8564,_0x1cb549){const _0x54686a=a67_0x2598,_0x1bfaaa=getSessionID(_0x1cb549),_0x4967d2=/^\d+$/[_0x54686a(0xc8)](_0x1bfaaa)?parseInt(_0x1bfaaa,0xa):getCurrentSessionPID(),_0x3862c4=a67_0x1fa905[_0x54686a(0xc9)](getSessionsDir(),_0x1bfaaa+'.json'),_0x13324a=getSessionsDir();createSecureDirectory(_0x13324a);const _0x51596d=JSON[_0x54686a(0xee)](_0x2a8564);if(_0x51596d[_0x54686a(0xec)](_0x54686a(0xe7))||_0x51596d[_0x54686a(0xec)](_0x54686a(0xcc))||_0x51596d['includes'](_0x54686a(0xd9)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x543908;const _0x5abec0=/^\d+$/[_0x54686a(0xc8)](_0x1bfaaa)?loadSessionContextByPID(parseInt(_0x1bfaaa,0xa)):loadSessionContextByString(_0x1bfaaa);_0x5abec0?_0x543908={..._0x5abec0,..._0x2a8564,'pid':_0x4967d2,'sessionId':_0x1bfaaa!==_0x4967d2[_0x54686a(0xea)]()?_0x1bfaaa:undefined,'updatedAt':new Date()['toISOString']()}:_0x543908={'pid':_0x4967d2,'sessionId':_0x1bfaaa!==_0x4967d2['toString']()?_0x1bfaaa:undefined,..._0x2a8564,'createdAt':new Date()[_0x54686a(0xe3)](),'updatedAt':new Date()['toISOString']()},a67_0x406a2b[_0x54686a(0xda)](_0x3862c4,JSON['stringify'](_0x543908,null,0x2));}export function clearSessionContext(_0x4953d7){const _0x3c890c=a67_0x2598,_0x5a516a=getSessionID(_0x4953d7),_0x215af8=a67_0x1fa905['join'](getSessionsDir(),_0x5a516a+_0x3c890c(0xe6));a67_0x406a2b[_0x3c890c(0xcd)](_0x215af8)&&a67_0x406a2b[_0x3c890c(0xe0)](_0x215af8);}export function clearSessionContextField(_0x149e44,_0x24dd4a){const _0x56a7b2=a67_0x2598,_0x41cc8c=getSessionID(_0x24dd4a),_0x11ddd5=a67_0x1fa905[_0x56a7b2(0xc9)](getSessionsDir(),_0x41cc8c+_0x56a7b2(0xe6));if(!a67_0x406a2b[_0x56a7b2(0xcd)](_0x11ddd5))return;try{const _0x5eacb0=a67_0x406a2b[_0x56a7b2(0xd1)](_0x11ddd5,_0x56a7b2(0xe4)),_0x3af06f=JSON['parse'](_0x5eacb0);delete _0x3af06f[_0x149e44],a67_0x406a2b[_0x56a7b2(0xda)](_0x11ddd5,JSON[_0x56a7b2(0xee)](_0x3af06f,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x52d21c=a67_0x2598,_0x29ee34=getSessionsDir();if(!a67_0x406a2b[_0x52d21c(0xcd)](_0x29ee34))return 0x0;let _0x2ab67c=0x0;const _0x3927a2=Date['now']();try{const _0x4b7989=a67_0x406a2b[_0x52d21c(0xdb)](_0x29ee34);for(const _0x1a079d of _0x4b7989){if(!_0x1a079d[_0x52d21c(0xde)]('.json'))continue;const _0x28e5b0=a67_0x1fa905[_0x52d21c(0xc9)](_0x29ee34,_0x1a079d),_0x4cb45c=_0x1a079d['replace'](_0x52d21c(0xe6),''),_0x2c5c3c=parseInt(_0x4cb45c,0xa),_0x5281e7=!isNaN(_0x2c5c3c);if(_0x5281e7){if(!isProcessRunning(_0x2c5c3c)){a67_0x406a2b[_0x52d21c(0xe0)](_0x28e5b0),_0x2ab67c++;continue;}}try{const _0x47af4a=a67_0x406a2b[_0x52d21c(0xd1)](_0x28e5b0,'utf-8'),_0x39d01c=JSON[_0x52d21c(0xe9)](_0x47af4a),_0x1f2a5b=new Date(_0x39d01c[_0x52d21c(0xe2)])[_0x52d21c(0xce)]();_0x3927a2-_0x1f2a5b>SESSION_EXPIRATION_MS&&(a67_0x406a2b[_0x52d21c(0xe0)](_0x28e5b0),_0x2ab67c++);}catch{a67_0x406a2b[_0x52d21c(0xe0)](_0x28e5b0),_0x2ab67c++;}}}catch{}return _0x2ab67c;}export function listActiveSessions(){const _0x1fc984=a67_0x2598,_0x11fd4c=getSessionsDir();if(!a67_0x406a2b[_0x1fc984(0xcd)](_0x11fd4c))return[];try{const _0x1f5643=a67_0x406a2b[_0x1fc984(0xdb)](_0x11fd4c),_0x39e034=[];for(const _0x41ebdd of _0x1f5643){if(!_0x41ebdd[_0x1fc984(0xde)](_0x1fc984(0xe6)))continue;const _0x505c70=_0x41ebdd['replace']('.json',''),_0x4fdd2e=parseInt(_0x505c70,0xa);!isNaN(_0x4fdd2e)&&isProcessRunning(_0x4fdd2e)&&_0x39e034[_0x1fc984(0xcf)](_0x4fdd2e);}return _0x39e034['sort']((_0x55943d,_0xb0f118)=>_0x55943d-_0xb0f118);}catch{return[];}}
@@ -1 +1 @@
1
- const a68_0x54e2f7=a68_0x56ee;(function(_0x4340fb,_0x52a515){const _0x5343a9=a68_0x56ee,_0x22e0d2=_0x4340fb();while(!![]){try{const _0x54c7db=parseInt(_0x5343a9(0x122))/0x1*(parseInt(_0x5343a9(0x116))/0x2)+parseInt(_0x5343a9(0x11b))/0x3*(parseInt(_0x5343a9(0x119))/0x4)+-parseInt(_0x5343a9(0x121))/0x5*(parseInt(_0x5343a9(0x117))/0x6)+parseInt(_0x5343a9(0x11e))/0x7*(parseInt(_0x5343a9(0x11c))/0x8)+-parseInt(_0x5343a9(0x11a))/0x9+-parseInt(_0x5343a9(0x115))/0xa*(-parseInt(_0x5343a9(0x124))/0xb)+-parseInt(_0x5343a9(0x11d))/0xc*(parseInt(_0x5343a9(0x118))/0xd);if(_0x54c7db===_0x52a515)break;else _0x22e0d2['push'](_0x22e0d2['shift']());}catch(_0x58a4b9){_0x22e0d2['push'](_0x22e0d2['shift']());}}}(a68_0x2410,0xec881));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json',a68_0x54e2f7(0x123));export function loadCachedUsers(_0x191eb6){const _0x555fa7=a68_0x54e2f7,_0x962f80=userCache[_0x555fa7(0x120)](_0x191eb6);return _0x962f80?.[_0x555fa7(0x11f)]??null;}export function saveCachedUsers(_0x5f5917,_0x739333){const _0x447a89=a68_0x54e2f7;userCache['write'](_0x5f5917,{'users':_0x739333,'cachedAt':Date[_0x447a89(0x125)]()});}function a68_0x56ee(_0x5e60b7,_0x10f828){_0x5e60b7=_0x5e60b7-0x115;const _0x241016=a68_0x2410();let _0x56ee01=_0x241016[_0x5e60b7];return _0x56ee01;}function a68_0x2410(){const _0x21cfee=['106180UTLEzr','853623HDYJNM','core/user-cache','10210981VGFELx','now','10qfplzQ','4oRsisY','222GNgVSh','52gvttPK','438732PxPhOo','8409591mnfcbw','45ikhQog','48rusTzW','8462460obHQaY','1433859NGnjES','users','read'];a68_0x2410=function(){return _0x21cfee;};return a68_0x2410();}export function clearUserCache(_0x194e39){userCache['clear'](_0x194e39);}
1
+ const a68_0x561eef=a68_0x4eb4;(function(_0x19b644,_0x38bbc7){const _0x2736b7=a68_0x4eb4,_0x2af5e8=_0x19b644();while(!![]){try{const _0x405cf4=-parseInt(_0x2736b7(0x1bf))/0x1*(-parseInt(_0x2736b7(0x1c8))/0x2)+parseInt(_0x2736b7(0x1c6))/0x3*(parseInt(_0x2736b7(0x1cd))/0x4)+parseInt(_0x2736b7(0x1ce))/0x5*(parseInt(_0x2736b7(0x1cb))/0x6)+-parseInt(_0x2736b7(0x1c9))/0x7*(-parseInt(_0x2736b7(0x1c1))/0x8)+-parseInt(_0x2736b7(0x1c3))/0x9*(parseInt(_0x2736b7(0x1c0))/0xa)+-parseInt(_0x2736b7(0x1cc))/0xb+parseInt(_0x2736b7(0x1cf))/0xc;if(_0x405cf4===_0x38bbc7)break;else _0x2af5e8['push'](_0x2af5e8['shift']());}catch(_0x40d628){_0x2af5e8['push'](_0x2af5e8['shift']());}}}(a68_0x4617,0x6f17a));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json',a68_0x561eef(0x1c4));export function loadCachedUsers(_0x5b7f9c){const _0x366b25=a68_0x561eef,_0x298ff3=userCache[_0x366b25(0x1c7)](_0x5b7f9c);return _0x298ff3?.[_0x366b25(0x1c2)]??null;}function a68_0x4617(){const _0x2ed27c=['read','1566IgHPZj','460957wSJJDk','write','48vOUFaO','9991872mGuyzE','30696CNGUDR','288105bGItie','5683944DyFHfA','clear','277SJbiEW','20Hzcpdc','8karXAi','users','2899836DHZsgP','core/user-cache','now','309phsQPm'];a68_0x4617=function(){return _0x2ed27c;};return a68_0x4617();}export function saveCachedUsers(_0x33e968,_0xf0d8fb){const _0x3b9a47=a68_0x561eef;userCache[_0x3b9a47(0x1ca)](_0x33e968,{'users':_0xf0d8fb,'cachedAt':Date[_0x3b9a47(0x1c5)]()});}function a68_0x4eb4(_0x3db2c9,_0x5a55a9){_0x3db2c9=_0x3db2c9-0x1be;const _0x461780=a68_0x4617();let _0x4eb4e=_0x461780[_0x3db2c9];return _0x4eb4e;}export function clearUserCache(_0x373aa5){const _0x159773=a68_0x561eef;userCache[_0x159773(0x1be)](_0x373aa5);}