@treasuredata/tdx 2026.4.10 → 2026.4.11

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 (220) 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.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/access-tracker.js +1 -1
  182. package/dist/sdk/workspace/frontmatter.js +1 -1
  183. package/dist/sdk/workspace/git.js +1 -1
  184. package/dist/sdk/workspace/index.js +1 -1
  185. package/dist/sdk/workspace/templates.js +1 -1
  186. package/dist/sdk/workspace/weekly.js +1 -1
  187. package/dist/sdk/workspace/wikilinks.js +1 -1
  188. package/dist/test-utils/command-runner.js +1 -1
  189. package/dist/test-utils/factories.js +1 -1
  190. package/dist/test-utils/fixtures.js +1 -1
  191. package/dist/test-utils/http-mock.js +1 -1
  192. package/dist/test-utils/index.js +1 -1
  193. package/dist/utils/async.js +1 -1
  194. package/dist/utils/colors.js +1 -1
  195. package/dist/utils/diff.js +1 -1
  196. package/dist/utils/file-permissions.js +1 -1
  197. package/dist/utils/file-reader.js +1 -1
  198. package/dist/utils/github-releases.js +1 -1
  199. package/dist/utils/global-cache.js +1 -1
  200. package/dist/utils/json-loader.js +1 -1
  201. package/dist/utils/local-cache.js +1 -1
  202. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  203. package/dist/utils/logger/formatters/index.js +1 -1
  204. package/dist/utils/logger/handlers/console-handler.js +1 -1
  205. package/dist/utils/logger/handlers/file-handler.js +1 -1
  206. package/dist/utils/logger/handlers/index.js +1 -1
  207. package/dist/utils/logger/handlers/null-handler.js +1 -1
  208. package/dist/utils/logger/index.js +1 -1
  209. package/dist/utils/logger/logger.js +1 -1
  210. package/dist/utils/logger/types.js +1 -1
  211. package/dist/utils/option-validation.js +1 -1
  212. package/dist/utils/process.js +1 -1
  213. package/dist/utils/prompt.js +1 -1
  214. package/dist/utils/spinner.js +1 -1
  215. package/dist/utils/sse-parser.js +1 -1
  216. package/dist/utils/string-utils.js +1 -1
  217. package/dist/utils/table-ref-parser.js +1 -1
  218. package/dist/utils/tdx-logger.js +1 -1
  219. package/dist/utils/version-check.js +1 -1
  220. package/package.json +1 -1
@@ -1 +1 @@
1
- const a57_0x4d14ec=a57_0x2c4f;(function(_0x21204f,_0x1f327a){const _0x5667af=a57_0x2c4f,_0x3377ab=_0x21204f();while(!![]){try{const _0x170d3b=-parseInt(_0x5667af(0x1a9))/0x1*(parseInt(_0x5667af(0x1ad))/0x2)+-parseInt(_0x5667af(0x1d0))/0x3*(-parseInt(_0x5667af(0x1b7))/0x4)+parseInt(_0x5667af(0x1c8))/0x5+parseInt(_0x5667af(0x1d2))/0x6*(-parseInt(_0x5667af(0x1af))/0x7)+-parseInt(_0x5667af(0x1bf))/0x8*(-parseInt(_0x5667af(0x1ea))/0x9)+-parseInt(_0x5667af(0x1bc))/0xa+parseInt(_0x5667af(0x1eb))/0xb;if(_0x170d3b===_0x1f327a)break;else _0x3377ab['push'](_0x3377ab['shift']());}catch(_0x433976){_0x3377ab['push'](_0x3377ab['shift']());}}}(a57_0x20bb,0xe41f8));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';function a57_0x20bb(){const _0x4de33a=['accessToken','profile','parse','yellow','stg-ap03','name','clear','split','proxy','trim','9aFUjol','1128424mZzXXW','utf-8','llm_default_agent','TDX_API_KEY_','\x27,\x20defaulting\x20to\x20us01','keychain','replace','TDX_API_KEY\x20env\x20var','stable','apiKeys','us01','config/llm-project','59dUBJGz','join','slice','dev-us01','6716vTgNIl','\x20env\x20var','6377IrEafj','read','stringify','.env','map','ap03','llm_default_project','endsWith','1048lNsQsZ','path','dev-eu01','next','string','3741450bHtNIU','number','account_info','631112LbSvUA','.config','includes','TD_API_KEY','TDX_ACCESS_TOKEN_FILE','accountId','write','projectId','existsSync','7938745OzFFat','config/account-info','release_channel','TDX_ACCESS_TOKEN_','keychain\x20(profile:\x20','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','ap02','entries','3075UtPptP','tdx.json','3498vAUoYx','TD_API_KEY_','TDX_ACCESS_TOKEN\x20env\x20var','source','tdx','warn','startsWith','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','readFileSync','eu01','config/llm-agent','stg-us01','apiKey','stg-ap01'];a57_0x20bb=function(){return _0x4de33a;};return a57_0x20bb();}import*as a57_0x29ae3a from'node:fs';import*as a57_0x587230 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_0xe781ba from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x572bed=a57_0x2c4f;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x572bed(0x1c0),_0x572bed(0x1d6));}export function getConfigFile(){const _0x3e3a7d=a57_0x2c4f;return join(getConfigDir(),_0x3e3a7d(0x1b2));}export function getConfigFilePath(_0x4fbe10){const _0x4eea5f=getConfigDir();return _0x4fbe10?a57_0x587230['join'](_0x4eea5f,'.env.'+_0x4fbe10):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x4d14ec(0x1b5),a57_0x4d14ec(0x1a8));export function getLLMProjectCacheFile(_0x521a8d){return llmProjectCache['path'](_0x521a8d);}export function readCachedLLMProject(_0x102c23){const _0x9505e3=a57_0x4d14ec,_0x2edbe0=llmProjectCache['read'](_0x102c23);if(_0x2edbe0&&typeof _0x2edbe0['id']===_0x9505e3(0x1bb)&&typeof _0x2edbe0[_0x9505e3(0x1e5)]===_0x9505e3(0x1bb))return _0x2edbe0;return null;}export function writeCachedLLMProject(_0x22e3e7,_0x1e8de8,_0x55be5a){const _0x434769=a57_0x4d14ec;try{llmProjectCache[_0x434769(0x1c5)]({'name':_0x22e3e7,'id':_0x1e8de8},_0x55be5a);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x4d14ec(0x1ed),a57_0x4d14ec(0x1dc));export function getLLMAgentCacheFile(_0x479f18){const _0x1ccd33=a57_0x4d14ec;return llmAgentCache[_0x1ccd33(0x1b8)](_0x479f18);}export function readCachedLLMAgent(_0x5eb949){const _0xc33ba8=a57_0x4d14ec,_0x99d72b=llmAgentCache[_0xc33ba8(0x1b0)](_0x5eb949);if(_0x99d72b&&typeof _0x99d72b['id']===_0xc33ba8(0x1bb)&&typeof _0x99d72b[_0xc33ba8(0x1e5)]===_0xc33ba8(0x1bb)&&typeof _0x99d72b[_0xc33ba8(0x1c6)]===_0xc33ba8(0x1bb))return _0x99d72b;return null;}export function writeCachedLLMAgent(_0x505e7c,_0x1f486f,_0x5bc488,_0x562a89){const _0x167c96=a57_0x4d14ec;try{llmAgentCache[_0x167c96(0x1c5)]({'name':_0x505e7c,'id':_0x1f486f,'projectId':_0x5bc488},_0x562a89);}catch{}}export function clearCachedLLMAgent(_0x77b38e){const _0x134ccc=a57_0x4d14ec;try{llmAgentCache[_0x134ccc(0x1e6)](_0x77b38e);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x4d14ec(0x1be),a57_0x4d14ec(0x1c9),{'suffix':'.json'});export function getAccountInfoCacheFile(_0x37a021){const _0x127fc6=a57_0x4d14ec;return accountInfoCache[_0x127fc6(0x1b8)](_0x37a021);}export function readCachedAccountInfo(_0x341574){const _0x47887b=a57_0x4d14ec,_0x4dbe6e=accountInfoCache['read'](_0x341574);if(_0x4dbe6e&&typeof _0x4dbe6e['site']==='string'&&typeof _0x4dbe6e[_0x47887b(0x1c4)]===_0x47887b(0x1bd))return _0x4dbe6e;return null;}export function writeCachedAccountInfo(_0x128196,_0x5e0a0c,_0x5d7cec){try{accountInfoCache['write']({'site':_0x128196,'accountId':_0x5e0a0c,'cachedAt':new Date()['toISOString']()},_0x5d7cec);}catch{}}export function parseEnvFile(_0x56cd02){const _0x1397c4=a57_0x4d14ec,_0x25e558={};for(const _0x217118 of _0x56cd02[_0x1397c4(0x1e7)]('\x0a')){const _0x3405de=_0x217118[_0x1397c4(0x1e9)]();if(!_0x3405de||_0x3405de[_0x1397c4(0x1d8)]('#'))continue;const _0x140b6c=_0x3405de['match'](/^([^=]+)=(.*)$/);if(_0x140b6c){const _0x4bf6ae=_0x140b6c[0x1]['trim']();let _0x46ef36=_0x140b6c[0x2][_0x1397c4(0x1e9)]();(_0x46ef36[_0x1397c4(0x1d8)]('\x22')&&_0x46ef36[_0x1397c4(0x1b6)]('\x22')||_0x46ef36[_0x1397c4(0x1d8)]('\x27')&&_0x46ef36[_0x1397c4(0x1b6)]('\x27'))&&(_0x46ef36=_0x46ef36[_0x1397c4(0x1ab)](0x1,-0x1)),_0x25e558[_0x4bf6ae]=_0x46ef36;}}return _0x25e558;}export function readUserConfig(){const _0x29452d=a57_0x4d14ec,_0x9a4506=getConfigFile();if(!existsSync(_0x9a4506))return{};try{const _0xe79a1a=readFileSync(_0x9a4506,'utf-8');return parseEnvFile(_0xe79a1a);}catch(_0xc4c7c2){return console[_0x29452d(0x1d7)](_0x29452d(0x1d9)+_0x9a4506+':',_0xc4c7c2),{};}}export function resolveSite(_0x9c2961){const _0x12cf94=a57_0x4d14ec,_0x2294a7=['us01','ap01','eu01',_0x12cf94(0x1ce),_0x12cf94(0x1b4),'dev-us01',_0x12cf94(0x1b9),_0x12cf94(0x1dd),_0x12cf94(0x1df),_0x12cf94(0x1e4)];if(_0x2294a7[_0x12cf94(0x1c1)](_0x9c2961))return _0x9c2961;if(_0x9c2961 in SITE_ALIASES)return SITE_ALIASES[_0x9c2961];return console[_0x12cf94(0x1d7)]('Warning:\x20Unknown\x20site\x20\x27'+_0x9c2961+_0x12cf94(0x1ef)),_0x12cf94(0x1a7);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x5e9da7){const _0x440988=a57_0x4d14ec,_0x45adfa=_0x5e9da7||getActiveProfileName()||undefined;if(_0x45adfa){const _0x3c3c72=_0x440988(0x1cb)+normalizeProfileForEnvVar(_0x45adfa);if(process.env[_0x3c3c72])return{'accessToken':process.env[_0x3c3c72],'source':_0x3c3c72+_0x440988(0x1ae)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x440988(0x1d4)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x260d63=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x260d63)return{'accessToken':_0x260d63,'source':_0x440988(0x1c3)};}return null;}function readAccessTokenFile(_0x429339){const _0x8813df=a57_0x4d14ec;try{const _0xc29e0b=readFileSync(_0x429339,_0x8813df(0x1ec))['trim']();return _0xc29e0b||null;}catch{return null;}}export function getAccessToken(_0x24edbe){return resolveAccessToken(_0x24edbe)?.['accessToken'];}export function getAPIKey(_0x3ce714){const _0x2fcd3b=a57_0x4d14ec,_0x1307fc=_0x3ce714||getActiveProfileName();if(_0x1307fc){const _0x2329aa=_0x2fcd3b(0x1ee)+normalizeProfileForEnvVar(_0x1307fc);if(process.env[_0x2329aa])return process.env[_0x2329aa];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x5f419b){return _0x5f419b['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x47a8cf,_0x4c667a){const _0x5482a1=a57_0x4d14ec,_0x542106=resolveAccessToken(_0x4c667a);if(_0x542106)return{'apiKey':_0x542106[_0x5482a1(0x1e0)],'source':_0x542106[_0x5482a1(0x1d5)],'isDeprecated':![]};const _0x2a2be5=_0x4c667a||getActiveProfileName()||undefined;if(_0x2a2be5){const _0x44cc08='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x2a2be5);if(process.env[_0x44cc08])return{'apiKey':process.env[_0x44cc08],'source':_0x44cc08+_0x5482a1(0x1ae),'isDeprecated':![]};const _0x339a15=getCachedCredential(_0x47a8cf,_0x2a2be5);if(_0x339a15)return{'apiKey':_0x339a15,'source':_0x5482a1(0x1cc)+_0x2a2be5+')','isDeprecated':![]};const _0x538fb4=await getKeychainAPIKey(_0x2a2be5);if(_0x538fb4)return setCachedCredential(_0x538fb4,_0x47a8cf,_0x2a2be5),{'apiKey':_0x538fb4,'source':_0x5482a1(0x1cc)+_0x2a2be5+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x5482a1(0x1a4),'isDeprecated':![]};if(!_0x2a2be5){const _0x2f0b8c=getCachedCredential(_0x47a8cf,undefined);if(_0x2f0b8c)return{'apiKey':_0x2f0b8c,'source':_0x5482a1(0x1f0),'isDeprecated':![]};const _0x5545cf=await getKeychainAPIKey(undefined);if(_0x5545cf)return setCachedCredential(_0x5545cf,_0x47a8cf,undefined),{'apiKey':_0x5545cf,'source':'keychain','isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x3da1b3,_0x50512f){const _0x2f3dd8=a57_0x4d14ec,_0x1c00fb=await resolveAPIKeyAsync(_0x3da1b3,_0x50512f);return _0x1c00fb?.[_0x2f3dd8(0x1de)];}function cleanupLegacyEnvFile(_0x2d6e05){const _0x3435fe=a57_0x4d14ec;if(!existsSync(_0x2d6e05))return![];try{const _0x3c46f4=readFileSync(_0x2d6e05,_0x3435fe(0x1ec)),_0x50a916=_0x3c46f4[_0x3435fe(0x1e7)]('\x0a'),_0x1e606e=_0x50a916['filter'](_0x1b76ad=>{const _0x5bfa66=_0x3435fe,_0x3c3918=_0x1b76ad[_0x5bfa66(0x1e9)]();if(!_0x3c3918||_0x3c3918[_0x5bfa66(0x1d8)]('#'))return!![];const [_0x22654d]=_0x3c3918[_0x5bfa66(0x1e7)]('=');return!_0x22654d[_0x5bfa66(0x1d8)](_0x5bfa66(0x1c2));}),_0x262edf=_0x1e606e['some'](_0x52cf0c=>{const _0x36f188=_0x3435fe,_0x5d824b=_0x52cf0c[_0x36f188(0x1e9)]();return _0x5d824b&&!_0x5d824b['startsWith']('#');});if(!_0x262edf)return unlinkSync(_0x2d6e05),!![];return writeFileSync(_0x2d6e05,_0x1e606e['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x598280=a57_0x4d14ec;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x14caee=a57_0x587230['join'](getConfigDir(),_0x598280(0x1d1));if(!a57_0x29ae3a[_0x598280(0x1c7)](_0x14caee))return null;try{const _0x4d5f0c=a57_0x29ae3a[_0x598280(0x1da)](_0x14caee,_0x598280(0x1ec)),_0x1ce2f4=JSON[_0x598280(0x1e2)](_0x4d5f0c);return _0x1ce2f4[_0x598280(0x1e1)]||null;}catch{return null;}}export function saveAPIKey(_0x122cfb,_0x443490,_0x22007d){const _0x30f58f=a57_0x4d14ec,_0x533604=getConfigDir(),_0x23ca48=getConfigFilePath(_0x22007d);!existsSync(_0x533604)&&mkdirSync(_0x533604,{'recursive':!![],'mode':0x1c0});let _0xca78fd={};if(existsSync(_0x23ca48))try{const _0x42fc4a=readFileSync(_0x23ca48,_0x30f58f(0x1ec));_0xca78fd=parseEnvFile(_0x42fc4a);}catch(_0x2b54c4){console[_0x30f58f(0x1d7)]('Warning:\x20Failed\x20to\x20read\x20'+_0x23ca48+':',_0x2b54c4);}const _0x4888f6=_0x122cfb['toUpperCase']()[_0x30f58f(0x1a3)](/-/g,'_');_0xca78fd[_0x30f58f(0x1d3)+_0x4888f6]=_0x443490;const _0x4d5dff=Object[_0x30f58f(0x1cf)](_0xca78fd)[_0x30f58f(0x1b3)](([_0x179b73,_0x4de52f])=>_0x179b73+'='+_0x4de52f);writeFileSync(_0x23ca48,_0x4d5dff['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x474921,_0x5bf220,_0x25dfc2){const _0x45d675=a57_0x4d14ec;await saveKeychainAPIKey(_0x474921,_0x25dfc2),setCachedCredential(_0x474921,_0x5bf220,_0x25dfc2);const _0x1d6006=getConfigFilePath(_0x25dfc2);cleanupLegacyEnvFile(_0x1d6006)&&console[_0x45d675(0x1d7)](a57_0xe781ba[_0x45d675(0x1e3)](_0x45d675(0x1cd)));}function a57_0x2c4f(_0x311838,_0x283e65){_0x311838=_0x311838-0x1a3;const _0x20bb6c=a57_0x20bb();let _0x2c4fb9=_0x20bb6c[_0x311838];return _0x2c4fb9;}export function loadConfig(){const _0x5ee63e=a57_0x4d14ec,_0x3d7953={'apiKeys':{},'defaultSite':_0x5ee63e(0x1a7)},_0x5e8904=[_0x5ee63e(0x1a7),'ap01',_0x5ee63e(0x1db),_0x5ee63e(0x1ce),_0x5ee63e(0x1b4),_0x5ee63e(0x1ac),_0x5ee63e(0x1b9),_0x5ee63e(0x1dd),_0x5ee63e(0x1df),'stg-ap03'],_0x61637f=getAPIKey();if(_0x61637f)for(const _0x5a66f9 of _0x5e8904){_0x3d7953[_0x5ee63e(0x1a6)][_0x5a66f9]=_0x61637f;}return _0x3d7953;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x415194=a57_0x4d14ec,_0x437552=a57_0x587230[_0x415194(0x1aa)](getConfigDir(),_0x415194(0x1d1));if(!a57_0x29ae3a[_0x415194(0x1c7)](_0x437552))return undefined;try{const _0x380c4a=a57_0x29ae3a['readFileSync'](_0x437552,'utf-8'),_0x460847=JSON[_0x415194(0x1e2)](_0x380c4a);return typeof _0x460847[_0x415194(0x1e8)]===_0x415194(0x1bb)?_0x460847[_0x415194(0x1e8)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x271c7c=a57_0x4d14ec,_0xcfc8f=process.env.TDX_RELEASE_CHANNEL;if(_0xcfc8f===_0x271c7c(0x1ba)||_0xcfc8f==='stable')return _0xcfc8f;const _0x20de2b=a57_0x587230[_0x271c7c(0x1aa)](getConfigDir(),_0x271c7c(0x1d1));if(!a57_0x29ae3a[_0x271c7c(0x1c7)](_0x20de2b))return'stable';try{const _0x263d09=a57_0x29ae3a[_0x271c7c(0x1da)](_0x20de2b,'utf-8'),_0x3aef94=JSON[_0x271c7c(0x1e2)](_0x263d09);if(_0x3aef94['release_channel']===_0x271c7c(0x1ba))return _0x271c7c(0x1ba);}catch{}return _0x271c7c(0x1a5);}export function saveReleaseChannel(_0x3b13c4){const _0x408206=a57_0x4d14ec,_0x140f04=getConfigDir(),_0x37adab=a57_0x587230[_0x408206(0x1aa)](_0x140f04,_0x408206(0x1d1));!existsSync(_0x140f04)&&mkdirSync(_0x140f04,{'recursive':!![],'mode':0x1c0});let _0x43a01f={};if(existsSync(_0x37adab))try{const _0xd95e17=readFileSync(_0x37adab,_0x408206(0x1ec));_0x43a01f=JSON['parse'](_0xd95e17);}catch{}_0x43a01f[_0x408206(0x1ca)]=_0x3b13c4,writeFileSync(_0x37adab,JSON[_0x408206(0x1b1)](_0x43a01f,null,0x2),{'mode':0x180});}
1
+ const a57_0x39f640=a57_0x5599;(function(_0x3612c7,_0x249afe){const _0x45dce1=a57_0x5599,_0xe26295=_0x3612c7();while(!![]){try{const _0x288387=-parseInt(_0x45dce1(0x1c5))/0x1+parseInt(_0x45dce1(0x1a2))/0x2*(-parseInt(_0x45dce1(0x1b9))/0x3)+parseInt(_0x45dce1(0x1a0))/0x4*(parseInt(_0x45dce1(0x1bc))/0x5)+-parseInt(_0x45dce1(0x1c3))/0x6*(parseInt(_0x45dce1(0x1c7))/0x7)+parseInt(_0x45dce1(0x1cb))/0x8+-parseInt(_0x45dce1(0x1d9))/0x9+parseInt(_0x45dce1(0x1c4))/0xa;if(_0x288387===_0x249afe)break;else _0xe26295['push'](_0xe26295['shift']());}catch(_0x1b45c3){_0xe26295['push'](_0xe26295['shift']());}}}(a57_0x3ada,0xb699b));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x453863 from'node:fs';import*as a57_0x3478ef from'node:path';function a57_0x3ada(){const _0x455ae7=['toUpperCase','projectId','\x20env\x20var','accessToken','release_channel','TDX_ACCESS_TOKEN\x20env\x20var','578427tsmmoF','TDX_API_KEY_','Warning:\x20Unknown\x20site\x20\x27','1318105WkfVEz','join','.json','dev-eu01','next','profile','match','1382760UunpOn','42953400hgGrqb','1366914ZjoQfT','parse','14jXwuHF','dev-us01','some','map','1931376iOyXvO','keychain','utf-8','read','includes','write','proxy','.config','site','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','accountId','path','apiKey','\x27,\x20defaulting\x20to\x20us01','11345157qjWtvO','config/llm-project','warn','startsWith','clear','TDX_ACCESS_TOKEN_FILE','TDX_API_KEY\x20env\x20var','tdx.json','ap01','TD_API_KEY','slice','.env','account_info','replace','string','4AxoOYm','source','10OQxagM','number','name','us01','readFileSync','stg-ap01','.env.','llm_default_agent','ap02','trim','eu01','config/account-info','split','existsSync','stringify','stg-us01','stable'];a57_0x3ada=function(){return _0x455ae7;};return a57_0x3ada();}import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a57_0x1e9aa8 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x55662e=a57_0x5599;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x55662e(0x1d2),'tdx');}export function getConfigFile(){const _0x230f07=a57_0x5599;return join(getConfigDir(),_0x230f07(0x1e4));}export function getConfigFilePath(_0x1ab50e){const _0x1b72ea=a57_0x5599,_0x542aab=getConfigDir();return _0x1ab50e?a57_0x3478ef[_0x1b72ea(0x1bd)](_0x542aab,_0x1b72ea(0x1a8)+_0x1ab50e):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project',a57_0x39f640(0x1da));export function getLLMProjectCacheFile(_0xc10cf0){return llmProjectCache['path'](_0xc10cf0);}export function readCachedLLMProject(_0x3609a3){const _0x319c63=a57_0x39f640,_0x124476=llmProjectCache[_0x319c63(0x1ce)](_0x3609a3);if(_0x124476&&typeof _0x124476['id']===_0x319c63(0x19f)&&typeof _0x124476[_0x319c63(0x1a4)]==='string')return _0x124476;return null;}export function writeCachedLLMProject(_0xdf6cfe,_0x3ad786,_0x3ff462){const _0x3fc157=a57_0x39f640;try{llmProjectCache[_0x3fc157(0x1d0)]({'name':_0xdf6cfe,'id':_0x3ad786},_0x3ff462);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x39f640(0x1a9),'config/llm-agent');export function getLLMAgentCacheFile(_0x23e9f5){const _0x21c780=a57_0x39f640;return llmAgentCache[_0x21c780(0x1d6)](_0x23e9f5);}export function readCachedLLMAgent(_0x21031f){const _0x58c181=a57_0x39f640,_0x27f2b9=llmAgentCache[_0x58c181(0x1ce)](_0x21031f);if(_0x27f2b9&&typeof _0x27f2b9['id']===_0x58c181(0x19f)&&typeof _0x27f2b9[_0x58c181(0x1a4)]===_0x58c181(0x19f)&&typeof _0x27f2b9[_0x58c181(0x1b4)]===_0x58c181(0x19f))return _0x27f2b9;return null;}export function writeCachedLLMAgent(_0x3bce5d,_0x437bdc,_0x1d772e,_0x5cd95c){const _0x2185f5=a57_0x39f640;try{llmAgentCache[_0x2185f5(0x1d0)]({'name':_0x3bce5d,'id':_0x437bdc,'projectId':_0x1d772e},_0x5cd95c);}catch{}}export function clearCachedLLMAgent(_0x4f059d){const _0x2c2b91=a57_0x39f640;try{llmAgentCache[_0x2c2b91(0x1dd)](_0x4f059d);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x39f640(0x1e5),a57_0x39f640(0x1ad),{'suffix':a57_0x39f640(0x1be)});export function getAccountInfoCacheFile(_0x14a6f7){const _0x5cb7a1=a57_0x39f640;return accountInfoCache[_0x5cb7a1(0x1d6)](_0x14a6f7);}export function readCachedAccountInfo(_0x309b74){const _0x493e06=a57_0x39f640,_0x16e5bc=accountInfoCache[_0x493e06(0x1ce)](_0x309b74);if(_0x16e5bc&&typeof _0x16e5bc[_0x493e06(0x1d3)]==='string'&&typeof _0x16e5bc[_0x493e06(0x1d5)]===_0x493e06(0x1a3))return _0x16e5bc;return null;}export function writeCachedAccountInfo(_0x768904,_0x23de13,_0x4b039d){const _0x1eb4e3=a57_0x39f640;try{accountInfoCache[_0x1eb4e3(0x1d0)]({'site':_0x768904,'accountId':_0x23de13,'cachedAt':new Date()['toISOString']()},_0x4b039d);}catch{}}export function parseEnvFile(_0x4f4cd4){const _0x4f8d84=a57_0x39f640,_0x5789c4={};for(const _0x4de6d8 of _0x4f4cd4['split']('\x0a')){const _0x5207c9=_0x4de6d8['trim']();if(!_0x5207c9||_0x5207c9[_0x4f8d84(0x1dc)]('#'))continue;const _0x4e519c=_0x5207c9[_0x4f8d84(0x1c2)](/^([^=]+)=(.*)$/);if(_0x4e519c){const _0x1f61c0=_0x4e519c[0x1][_0x4f8d84(0x1ab)]();let _0x2d291e=_0x4e519c[0x2][_0x4f8d84(0x1ab)]();(_0x2d291e[_0x4f8d84(0x1dc)]('\x22')&&_0x2d291e['endsWith']('\x22')||_0x2d291e[_0x4f8d84(0x1dc)]('\x27')&&_0x2d291e['endsWith']('\x27'))&&(_0x2d291e=_0x2d291e[_0x4f8d84(0x1e3)](0x1,-0x1)),_0x5789c4[_0x1f61c0]=_0x2d291e;}}return _0x5789c4;}export function readUserConfig(){const _0x388946=a57_0x39f640,_0x37b387=getConfigFile();if(!existsSync(_0x37b387))return{};try{const _0x2e0705=readFileSync(_0x37b387,_0x388946(0x1cd));return parseEnvFile(_0x2e0705);}catch(_0x57dc1e){return console[_0x388946(0x1db)](_0x388946(0x1d4)+_0x37b387+':',_0x57dc1e),{};}}export function resolveSite(_0x26c0de){const _0x134923=a57_0x39f640,_0x234892=['us01',_0x134923(0x1e1),_0x134923(0x1ac),_0x134923(0x1aa),'ap03',_0x134923(0x1c8),_0x134923(0x1bf),_0x134923(0x1b1),_0x134923(0x1a7),'stg-ap03'];if(_0x234892[_0x134923(0x1cf)](_0x26c0de))return _0x26c0de;if(_0x26c0de in SITE_ALIASES)return SITE_ALIASES[_0x26c0de];return console[_0x134923(0x1db)](_0x134923(0x1bb)+_0x26c0de+_0x134923(0x1d8)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}function a57_0x5599(_0x24c5cb,_0x8237fe){_0x24c5cb=_0x24c5cb-0x19e;const _0x3ada59=a57_0x3ada();let _0x559985=_0x3ada59[_0x24c5cb];return _0x559985;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x4cb7dd){const _0x59f987=a57_0x39f640,_0x466357=_0x4cb7dd||getActiveProfileName()||undefined;if(_0x466357){const _0x192aa9='TDX_ACCESS_TOKEN_'+normalizeProfileForEnvVar(_0x466357);if(process.env[_0x192aa9])return{'accessToken':process.env[_0x192aa9],'source':_0x192aa9+_0x59f987(0x1b5)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x59f987(0x1b8)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x53bd72=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x53bd72)return{'accessToken':_0x53bd72,'source':_0x59f987(0x1de)};}return null;}function readAccessTokenFile(_0x139664){const _0x414b4e=a57_0x39f640;try{const _0x27431a=readFileSync(_0x139664,_0x414b4e(0x1cd))[_0x414b4e(0x1ab)]();return _0x27431a||null;}catch{return null;}}export function getAccessToken(_0x46588c){const _0x3e69da=a57_0x39f640;return resolveAccessToken(_0x46588c)?.[_0x3e69da(0x1b6)];}export function getAPIKey(_0x4feed5){const _0xcfe206=a57_0x39f640,_0x1017c5=_0x4feed5||getActiveProfileName();if(_0x1017c5){const _0x2e6feb=_0xcfe206(0x1ba)+normalizeProfileForEnvVar(_0x1017c5);if(process.env[_0x2e6feb])return process.env[_0x2e6feb];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x25afc2){const _0x10c3eb=a57_0x39f640;return _0x25afc2[_0x10c3eb(0x1b3)]()[_0x10c3eb(0x19e)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x2714f5,_0x2a1c0e){const _0x508f50=a57_0x39f640,_0x38a861=resolveAccessToken(_0x2a1c0e);if(_0x38a861)return{'apiKey':_0x38a861[_0x508f50(0x1b6)],'source':_0x38a861[_0x508f50(0x1a1)],'isDeprecated':![]};const _0x3660f3=_0x2a1c0e||getActiveProfileName()||undefined;if(_0x3660f3){const _0x21c245=_0x508f50(0x1ba)+normalizeProfileForEnvVar(_0x3660f3);if(process.env[_0x21c245])return{'apiKey':process.env[_0x21c245],'source':_0x21c245+'\x20env\x20var','isDeprecated':![]};const _0x344b70=getCachedCredential(_0x2714f5,_0x3660f3);if(_0x344b70)return{'apiKey':_0x344b70,'source':'keychain\x20(profile:\x20'+_0x3660f3+')','isDeprecated':![]};const _0x15a3f6=await getKeychainAPIKey(_0x3660f3);if(_0x15a3f6)return setCachedCredential(_0x15a3f6,_0x2714f5,_0x3660f3),{'apiKey':_0x15a3f6,'source':'keychain\x20(profile:\x20'+_0x3660f3+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x508f50(0x1df),'isDeprecated':![]};if(!_0x3660f3){const _0x2f4a0e=getCachedCredential(_0x2714f5,undefined);if(_0x2f4a0e)return{'apiKey':_0x2f4a0e,'source':_0x508f50(0x1cc),'isDeprecated':![]};const _0x262a18=await getKeychainAPIKey(undefined);if(_0x262a18)return setCachedCredential(_0x262a18,_0x2714f5,undefined),{'apiKey':_0x262a18,'source':_0x508f50(0x1cc),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x31f40a,_0x378213){const _0x302343=a57_0x39f640,_0x506ee8=await resolveAPIKeyAsync(_0x31f40a,_0x378213);return _0x506ee8?.[_0x302343(0x1d7)];}function cleanupLegacyEnvFile(_0x590540){const _0x45de0d=a57_0x39f640;if(!existsSync(_0x590540))return![];try{const _0x13edb1=readFileSync(_0x590540,'utf-8'),_0x27b0e5=_0x13edb1[_0x45de0d(0x1ae)]('\x0a'),_0x5c895d=_0x27b0e5['filter'](_0x305bb3=>{const _0x1c8520=_0x45de0d,_0x33ad07=_0x305bb3['trim']();if(!_0x33ad07||_0x33ad07['startsWith']('#'))return!![];const [_0x4d5112]=_0x33ad07[_0x1c8520(0x1ae)]('=');return!_0x4d5112[_0x1c8520(0x1dc)](_0x1c8520(0x1e2));}),_0x301945=_0x5c895d[_0x45de0d(0x1c9)](_0x411ca7=>{const _0x21d3af=_0x45de0d,_0x51f98b=_0x411ca7[_0x21d3af(0x1ab)]();return _0x51f98b&&!_0x51f98b[_0x21d3af(0x1dc)]('#');});if(!_0x301945)return unlinkSync(_0x590540),!![];return writeFileSync(_0x590540,_0x5c895d['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x3ad698=a57_0x39f640;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x922219=a57_0x3478ef[_0x3ad698(0x1bd)](getConfigDir(),_0x3ad698(0x1e0));if(!a57_0x453863[_0x3ad698(0x1af)](_0x922219))return null;try{const _0x3664e3=a57_0x453863[_0x3ad698(0x1a6)](_0x922219,_0x3ad698(0x1cd)),_0x409b14=JSON[_0x3ad698(0x1c6)](_0x3664e3);return _0x409b14[_0x3ad698(0x1c1)]||null;}catch{return null;}}export function saveAPIKey(_0x3948ee,_0x11f736,_0x445ef2){const _0x3b4b5f=a57_0x39f640,_0x199259=getConfigDir(),_0x449d3e=getConfigFilePath(_0x445ef2);!existsSync(_0x199259)&&mkdirSync(_0x199259,{'recursive':!![],'mode':0x1c0});let _0x289e46={};if(existsSync(_0x449d3e))try{const _0x307465=readFileSync(_0x449d3e,'utf-8');_0x289e46=parseEnvFile(_0x307465);}catch(_0x45bd37){console['warn']('Warning:\x20Failed\x20to\x20read\x20'+_0x449d3e+':',_0x45bd37);}const _0x523419=_0x3948ee[_0x3b4b5f(0x1b3)]()[_0x3b4b5f(0x19e)](/-/g,'_');_0x289e46['TD_API_KEY_'+_0x523419]=_0x11f736;const _0x4dab4e=Object['entries'](_0x289e46)[_0x3b4b5f(0x1ca)](([_0x371831,_0x88ae8b])=>_0x371831+'='+_0x88ae8b);writeFileSync(_0x449d3e,_0x4dab4e[_0x3b4b5f(0x1bd)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0xa40c4e,_0x14ebd3,_0x291717){const _0x363e82=a57_0x39f640;await saveKeychainAPIKey(_0xa40c4e,_0x291717),setCachedCredential(_0xa40c4e,_0x14ebd3,_0x291717);const _0x2f4bce=getConfigFilePath(_0x291717);cleanupLegacyEnvFile(_0x2f4bce)&&console[_0x363e82(0x1db)](a57_0x1e9aa8['yellow']('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x276dd2=a57_0x39f640,_0x4f6b82={'apiKeys':{},'defaultSite':_0x276dd2(0x1a5)},_0x1ae593=[_0x276dd2(0x1a5),'ap01','eu01','ap02','ap03','dev-us01','dev-eu01',_0x276dd2(0x1b1),'stg-ap01','stg-ap03'],_0x344048=getAPIKey();if(_0x344048)for(const _0x171050 of _0x1ae593){_0x4f6b82['apiKeys'][_0x171050]=_0x344048;}return _0x4f6b82;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0xbc8203=a57_0x39f640,_0x22737e=a57_0x3478ef[_0xbc8203(0x1bd)](getConfigDir(),'tdx.json');if(!a57_0x453863[_0xbc8203(0x1af)](_0x22737e))return undefined;try{const _0x498432=a57_0x453863[_0xbc8203(0x1a6)](_0x22737e,'utf-8'),_0x4d9c4a=JSON[_0xbc8203(0x1c6)](_0x498432);return typeof _0x4d9c4a[_0xbc8203(0x1d1)]===_0xbc8203(0x19f)?_0x4d9c4a[_0xbc8203(0x1d1)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0xd2a1d8=a57_0x39f640,_0xaf6ae9=process.env.TDX_RELEASE_CHANNEL;if(_0xaf6ae9===_0xd2a1d8(0x1c0)||_0xaf6ae9===_0xd2a1d8(0x1b2))return _0xaf6ae9;const _0x5508f8=a57_0x3478ef[_0xd2a1d8(0x1bd)](getConfigDir(),'tdx.json');if(!a57_0x453863[_0xd2a1d8(0x1af)](_0x5508f8))return _0xd2a1d8(0x1b2);try{const _0x48740c=a57_0x453863[_0xd2a1d8(0x1a6)](_0x5508f8,_0xd2a1d8(0x1cd)),_0x443e42=JSON[_0xd2a1d8(0x1c6)](_0x48740c);if(_0x443e42[_0xd2a1d8(0x1b7)]==='next')return'next';}catch{}return _0xd2a1d8(0x1b2);}export function saveReleaseChannel(_0x35d4fc){const _0xf38a00=a57_0x39f640,_0x41a47b=getConfigDir(),_0x45572e=a57_0x3478ef['join'](_0x41a47b,_0xf38a00(0x1e0));!existsSync(_0x41a47b)&&mkdirSync(_0x41a47b,{'recursive':!![],'mode':0x1c0});let _0x176e06={};if(existsSync(_0x45572e))try{const _0x7bccd=readFileSync(_0x45572e,'utf-8');_0x176e06=JSON['parse'](_0x7bccd);}catch{}_0x176e06[_0xf38a00(0x1b7)]=_0x35d4fc,writeFileSync(_0x45572e,JSON[_0xf38a00(0x1b0)](_0x176e06,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a58_0x2cc181=a58_0x4530;(function(_0x5aa5f0,_0x318365){const _0x2b5fea=a58_0x4530,_0x336f38=_0x5aa5f0();while(!![]){try{const _0x326943=parseInt(_0x2b5fea(0x1e2))/0x1*(parseInt(_0x2b5fea(0x1de))/0x2)+parseInt(_0x2b5fea(0x1e6))/0x3*(-parseInt(_0x2b5fea(0x1db))/0x4)+parseInt(_0x2b5fea(0x1dd))/0x5*(-parseInt(_0x2b5fea(0x1e0))/0x6)+parseInt(_0x2b5fea(0x1e5))/0x7*(-parseInt(_0x2b5fea(0x1e4))/0x8)+parseInt(_0x2b5fea(0x1ea))/0x9+parseInt(_0x2b5fea(0x1e1))/0xa+parseInt(_0x2b5fea(0x1e9))/0xb*(-parseInt(_0x2b5fea(0x1e8))/0xc);if(_0x326943===_0x318365)break;else _0x336f38['push'](_0x336f38['shift']());}catch(_0x44bb36){_0x336f38['push'](_0x336f38['shift']());}}}(a58_0x341b,0x3408c));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x2cc181(0x1e3),a58_0x2cc181(0x1eb));export function loadCachedConnections(_0x58ef69){const _0x3a7637=a58_0x2cc181,_0x207db1=connectionCache['read'](_0x58ef69);return _0x207db1?.[_0x3a7637(0x1df)]??null;}function a58_0x341b(){const _0x5f09de=['734jbVUrB','connections-{profile}.json','2808824VHlgSQ','7gzbVgj','27999OeVyyY','clear','12mbTQLZ','3124319ZeqNXl','2364471HWdPen','core/connection-cache','4HXFHEv','now','99275PgiyVn','1084LpaqGW','connections','12aexfrm','2367600aZlgFF'];a58_0x341b=function(){return _0x5f09de;};return a58_0x341b();}export function saveCachedConnections(_0x1d520f,_0x3d5033){const _0x306351=a58_0x2cc181;connectionCache['write'](_0x1d520f,{'connections':_0x3d5033,'cachedAt':Date[_0x306351(0x1dc)]()});}function a58_0x4530(_0x4427c8,_0x542a4e){_0x4427c8=_0x4427c8-0x1db;const _0x341b02=a58_0x341b();let _0x4530ac=_0x341b02[_0x4427c8];return _0x4530ac;}export function clearConnectionCache(_0x1dd5d7){const _0x5ec2e9=a58_0x2cc181;connectionCache[_0x5ec2e9(0x1e7)](_0x1dd5d7);}
1
+ const a58_0x4dcd19=a58_0x52b1;(function(_0x2f4fe5,_0x3832c7){const _0x479896=a58_0x52b1,_0x3c69ab=_0x2f4fe5();while(!![]){try{const _0x451ac4=-parseInt(_0x479896(0x14b))/0x1*(parseInt(_0x479896(0x154))/0x2)+parseInt(_0x479896(0x14a))/0x3+parseInt(_0x479896(0x14e))/0x4+-parseInt(_0x479896(0x151))/0x5+parseInt(_0x479896(0x14c))/0x6*(-parseInt(_0x479896(0x150))/0x7)+parseInt(_0x479896(0x148))/0x8*(parseInt(_0x479896(0x152))/0x9)+parseInt(_0x479896(0x155))/0xa;if(_0x451ac4===_0x3832c7)break;else _0x3c69ab['push'](_0x3c69ab['shift']());}catch(_0x4ba39c){_0x3c69ab['push'](_0x3c69ab['shift']());}}}(a58_0x178f,0x19106));function a58_0x178f(){const _0x1d9a2f=['204399heziXJ','now','293404puhzYS','2099690BUnaUD','read','72UgwLLX','write','102987ZYUKNu','1UKRuvy','1266LzBqlF','connections-{profile}.json','105828mOdIhv','core/connection-cache','6559drUKuG','140415iRYMCL'];a58_0x178f=function(){return _0x1d9a2f;};return a58_0x178f();}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x4dcd19(0x14d),a58_0x4dcd19(0x14f));export function loadCachedConnections(_0x539f5c){const _0x56291d=a58_0x4dcd19,_0x31106c=connectionCache[_0x56291d(0x156)](_0x539f5c);return _0x31106c?.['connections']??null;}export function saveCachedConnections(_0xd66099,_0x200edd){const _0x2a0044=a58_0x4dcd19;connectionCache[_0x2a0044(0x149)](_0xd66099,{'connections':_0x200edd,'cachedAt':Date[_0x2a0044(0x153)]()});}function a58_0x52b1(_0x26e89e,_0x3cd4f1){_0x26e89e=_0x26e89e-0x148;const _0x178f7b=a58_0x178f();let _0x52b1f3=_0x178f7b[_0x26e89e];return _0x52b1f3;}export function clearConnectionCache(_0x35c8e0){connectionCache['clear'](_0x35c8e0);}
@@ -1 +1 @@
1
- const a59_0x15edfc=a59_0x346f;(function(_0x4e48cc,_0x2fe87a){const _0x2b6012=a59_0x346f,_0x295aea=_0x4e48cc();while(!![]){try{const _0x5275b2=parseInt(_0x2b6012(0x7a))/0x1+parseInt(_0x2b6012(0x85))/0x2*(-parseInt(_0x2b6012(0x76))/0x3)+parseInt(_0x2b6012(0x6c))/0x4+-parseInt(_0x2b6012(0x7b))/0x5*(parseInt(_0x2b6012(0x7e))/0x6)+-parseInt(_0x2b6012(0x81))/0x7+-parseInt(_0x2b6012(0x70))/0x8*(parseInt(_0x2b6012(0x79))/0x9)+parseInt(_0x2b6012(0x7c))/0xa;if(_0x5275b2===_0x2fe87a)break;else _0x295aea['push'](_0x295aea['shift']());}catch(_0x12c865){_0x295aea['push'](_0x295aea['shift']());}}}(a59_0x58c2,0x44079));import a59_0xc9c6f7 from'prompts';function a59_0x58c2(){const _0x298aae=['push','8gyVnXP','length','Select\x20your\x20Treasure\x20Data\x20site:','trim','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','eu01','308082WcHaZS','ap02','number','578763JisYrL','486180TEqLuE','887365pLJsdM','175410NWXIPI','findIndex','6uPHRWR','other','customSite','2189313ZNrmVZ','log','Enter\x20site\x20name:','value','4wbHFTM','Enter\x20custom\x20site','eu\x20\x20\x20-\x20Europe','us01','site','Site\x20name\x20cannot\x20be\x20empty','ap02\x20-\x20Korea','us\x20\x20\x20-\x20United\x20States','2139420ZzEBMs','text','Cancelled'];a59_0x58c2=function(){return _0x298aae;};return a59_0x58c2();}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x2089a9,_0x6398a1){const _0x37e6d1=a59_0x346f;if(_0x2089a9===undefined)return _0x6398a1;if(typeof _0x2089a9===_0x37e6d1(0x78))return _0x2089a9;return parseInt(_0x2089a9,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x15edfc(0x6b),'value':a59_0x15edfc(0x67)},{'title':'jp\x20\x20\x20-\x20Japan','value':'ap01'},{'title':a59_0x15edfc(0x87),'value':a59_0x15edfc(0x75)},{'title':a59_0x15edfc(0x6a),'value':a59_0x15edfc(0x77)}];function a59_0x346f(_0x25afaf,_0x1f4e17){_0x25afaf=_0x25afaf-0x67;const _0x58c2be=a59_0x58c2();let _0x346f94=_0x58c2be[_0x25afaf];return _0x346f94;}export function buildSiteChoices(_0x47a4d1){const _0x19496b=a59_0x15edfc,_0x476466=[...STANDARD_SITE_CHOICES];let _0x1a8f56=_0x476466[_0x19496b(0x7d)](_0x42d14e=>_0x42d14e[_0x19496b(0x84)]===_0x47a4d1);return _0x1a8f56===-0x1&&_0x47a4d1!=='us01'&&(_0x476466[_0x19496b(0x6f)]({'title':_0x47a4d1,'value':_0x47a4d1}),_0x1a8f56=_0x476466[_0x19496b(0x71)]-0x1),_0x476466['push']({'title':_0x19496b(0x86),'value':_0x19496b(0x7f)}),{'choices':_0x476466,'initialIndex':_0x1a8f56>=0x0?_0x1a8f56:0x0};}export async function promptSiteSelection(_0x47a012,_0x18757f,_0x4bfa14=a59_0x15edfc(0x6e)){const _0x4d114f=a59_0x15edfc,{choices:_0x5bb3d7,initialIndex:_0x4b36c}=buildSiteChoices(_0x47a012),_0x7ba6f0=_0x18757f?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x18757f+'):':_0x4d114f(0x72),_0x235144=await a59_0xc9c6f7({'type':'select','name':_0x4d114f(0x68),'message':_0x7ba6f0,'choices':_0x5bb3d7,'initial':_0x4b36c});if(!_0x235144[_0x4d114f(0x68)])return console[_0x4d114f(0x82)]('\x0a'+_0x4bfa14),null;if(_0x235144[_0x4d114f(0x68)]!==_0x4d114f(0x7f))return _0x235144['site'];const _0xd2bf28=await a59_0xc9c6f7({'type':_0x4d114f(0x6d),'name':_0x4d114f(0x80),'message':_0x4d114f(0x83),'initial':_0x4d114f(0x67),'validate':_0x50dbea=>{const _0x462199=_0x4d114f;if(!_0x50dbea||!_0x50dbea['trim']())return _0x462199(0x69);if(!/^[a-z0-9-]+$/['test'](_0x50dbea[_0x462199(0x73)]()))return _0x462199(0x74);return!![];}});if(!_0xd2bf28[_0x4d114f(0x80)])return console['log']('\x0a'+_0x4bfa14),null;return _0xd2bf28[_0x4d114f(0x80)];}
1
+ const a59_0x2c8797=a59_0x3833;function a59_0x3833(_0x263795,_0x358637){_0x263795=_0x263795-0x8b;const _0x53edc1=a59_0x53ed();let _0x383319=_0x53edc1[_0x263795];return _0x383319;}(function(_0x8fab9f,_0x5e95af){const _0x50fe89=a59_0x3833,_0x2ca308=_0x8fab9f();while(!![]){try{const _0x203448=-parseInt(_0x50fe89(0xaa))/0x1*(-parseInt(_0x50fe89(0xa4))/0x2)+-parseInt(_0x50fe89(0xa3))/0x3+parseInt(_0x50fe89(0xa6))/0x4+parseInt(_0x50fe89(0x8b))/0x5+-parseInt(_0x50fe89(0x8e))/0x6*(-parseInt(_0x50fe89(0x8d))/0x7)+parseInt(_0x50fe89(0xa2))/0x8*(parseInt(_0x50fe89(0x9c))/0x9)+parseInt(_0x50fe89(0x99))/0xa*(-parseInt(_0x50fe89(0xa9))/0xb);if(_0x203448===_0x5e95af)break;else _0x2ca308['push'](_0x2ca308['shift']());}catch(_0x40756d){_0x2ca308['push'](_0x2ca308['shift']());}}}(a59_0x53ed,0x40ef1));import a59_0xc3f5e9 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x49ea54,_0x15fc01){const _0x3591c0=a59_0x3833;if(_0x49ea54===undefined)return _0x15fc01;if(typeof _0x49ea54===_0x3591c0(0x98))return _0x49ea54;return parseInt(_0x49ea54,0xa);}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':'us01'},{'title':a59_0x2c8797(0x9b),'value':a59_0x2c8797(0x8f)},{'title':a59_0x2c8797(0x9f),'value':'eu01'},{'title':a59_0x2c8797(0x97),'value':a59_0x2c8797(0x8c)}];export function buildSiteChoices(_0x57e9f9){const _0x937625=a59_0x2c8797,_0x3cf326=[...STANDARD_SITE_CHOICES];let _0x4792f0=_0x3cf326[_0x937625(0x92)](_0x19111a=>_0x19111a[_0x937625(0x94)]===_0x57e9f9);return _0x4792f0===-0x1&&_0x57e9f9!==_0x937625(0xa8)&&(_0x3cf326[_0x937625(0x91)]({'title':_0x57e9f9,'value':_0x57e9f9}),_0x4792f0=_0x3cf326[_0x937625(0x9e)]-0x1),_0x3cf326[_0x937625(0x91)]({'title':'Enter\x20custom\x20site','value':_0x937625(0x93)}),{'choices':_0x3cf326,'initialIndex':_0x4792f0>=0x0?_0x4792f0:0x0};}export async function promptSiteSelection(_0x639cc,_0x361ec0,_0x5c0491='Cancelled'){const _0x1e27c1=a59_0x2c8797,{choices:_0x199953,initialIndex:_0x2d6193}=buildSiteChoices(_0x639cc),_0x46af07=_0x361ec0?_0x1e27c1(0xa1)+_0x361ec0+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x2fe0fd=await a59_0xc3f5e9({'type':_0x1e27c1(0x96),'name':'site','message':_0x46af07,'choices':_0x199953,'initial':_0x2d6193});if(!_0x2fe0fd['site'])return console[_0x1e27c1(0x9d)]('\x0a'+_0x5c0491),null;if(_0x2fe0fd[_0x1e27c1(0xa5)]!==_0x1e27c1(0x93))return _0x2fe0fd['site'];const _0x4be863=await a59_0xc3f5e9({'type':'text','name':_0x1e27c1(0xa0),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x279c33=>{const _0xa6050f=_0x1e27c1;if(!_0x279c33||!_0x279c33[_0xa6050f(0x95)]())return _0xa6050f(0xa7);if(!/^[a-z0-9-]+$/[_0xa6050f(0x9a)](_0x279c33[_0xa6050f(0x95)]()))return _0xa6050f(0x90);return!![];}});if(!_0x4be863['customSite'])return console[_0x1e27c1(0x9d)]('\x0a'+_0x5c0491),null;return _0x4be863[_0x1e27c1(0xa0)];}function a59_0x53ed(){const _0x5937c0=['findIndex','other','value','trim','select','ap02\x20-\x20Korea','number','10MzVmAv','test','jp\x20\x20\x20-\x20Japan','147231vgFNqO','log','length','eu\x20\x20\x20-\x20Europe','customSite','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','8BFTMVd','476118ktSuHM','26VfUKJu','site','1211152HdQRbO','Site\x20name\x20cannot\x20be\x20empty','us01','2366419nakvtg','3671SokoRu','1310080tcYYlv','ap02','742eHRNQx','618aPAaob','ap01','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','push'];a59_0x53ed=function(){return _0x5937c0;};return a59_0x53ed();}
@@ -1 +1 @@
1
- (function(_0x577a83,_0x2cef21){const _0x1802d0=a60_0x2a51,_0x4d101c=_0x577a83();while(!![]){try{const _0x3df232=-parseInt(_0x1802d0(0x120))/0x1+-parseInt(_0x1802d0(0x11a))/0x2*(parseInt(_0x1802d0(0x119))/0x3)+parseInt(_0x1802d0(0x116))/0x4*(parseInt(_0x1802d0(0x118))/0x5)+parseInt(_0x1802d0(0x11e))/0x6+-parseInt(_0x1802d0(0x115))/0x7+parseInt(_0x1802d0(0x123))/0x8+parseInt(_0x1802d0(0x124))/0x9;if(_0x3df232===_0x2cef21)break;else _0x4d101c['push'](_0x4d101c['shift']());}catch(_0x704f5){_0x4d101c['push'](_0x4d101c['shift']());}}}(a60_0x4237,0x9c0b6));function a60_0x2a51(_0x3322ab,_0x2859ac){_0x3322ab=_0x3322ab-0x115;const _0x423785=a60_0x4237();let _0x2a51af=_0x423785[_0x3322ab];return _0x2a51af;}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x138bc6,_0x178207){const _0x25b8f8=a60_0x2a51,_0x54672f=_0x138bc6||_0x25b8f8(0x122),_0x5d26cb=_0x178207||'__default_profile__';return _0x54672f+':'+_0x5d26cb;}function a60_0x4237(){const _0x19520d=['loadedAt','818630VSTHzk','get','__default_site__','7048960Hbypkj','8430867WivJES','3103996fuIqug','136QZVZvW','delete','21245yxSDeP','3HBXVMP','1688348bwYwFj','apiKey','clear','now','4698246LsqvpU'];a60_0x4237=function(){return _0x19520d;};return a60_0x4237();}export function getCachedCredential(_0x558222,_0x55fe1d){const _0x57d5fe=a60_0x2a51,_0x593124=getCacheKey(_0x558222,_0x55fe1d),_0x32c983=cache[_0x57d5fe(0x121)](_0x593124);if(!_0x32c983)return null;if(Date[_0x57d5fe(0x11d)]()-_0x32c983[_0x57d5fe(0x11f)]>CACHE_TTL_MS)return cache[_0x57d5fe(0x117)](_0x593124),null;return _0x32c983[_0x57d5fe(0x11b)];}export function setCachedCredential(_0x29c05b,_0x39639d,_0x26e128){const _0x29f5df=getCacheKey(_0x39639d,_0x26e128);cache['set'](_0x29f5df,{'apiKey':_0x29c05b,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x5744cd=a60_0x2a51;cache[_0x5744cd(0x11c)]();}export function clearCachedCredential(_0x20783e,_0x11d701){const _0x47ab49=getCacheKey(_0x20783e,_0x11d701);cache['delete'](_0x47ab49);}
1
+ function a60_0x1ca6(_0x185270,_0x12e54a){_0x185270=_0x185270-0xc6;const _0x367de6=a60_0x367d();let _0x1ca603=_0x367de6[_0x185270];return _0x1ca603;}(function(_0x57cc45,_0x3fd341){const _0x2cec68=a60_0x1ca6,_0x19e088=_0x57cc45();while(!![]){try{const _0x45b781=parseInt(_0x2cec68(0xcf))/0x1+parseInt(_0x2cec68(0xc7))/0x2*(-parseInt(_0x2cec68(0xce))/0x3)+-parseInt(_0x2cec68(0xd1))/0x4+-parseInt(_0x2cec68(0xd3))/0x5+parseInt(_0x2cec68(0xd0))/0x6+-parseInt(_0x2cec68(0xcc))/0x7+parseInt(_0x2cec68(0xcd))/0x8*(parseInt(_0x2cec68(0xd2))/0x9);if(_0x45b781===_0x3fd341)break;else _0x19e088['push'](_0x19e088['shift']());}catch(_0x4bdae0){_0x19e088['push'](_0x19e088['shift']());}}}(a60_0x367d,0x9171a));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x5d1526,_0x30927a){const _0x561b46=_0x5d1526||'__default_site__',_0x5e1e41=_0x30927a||'__default_profile__';return _0x561b46+':'+_0x5e1e41;}export function getCachedCredential(_0x4ae9ab,_0x52f1b7){const _0x176cbb=a60_0x1ca6,_0x22b004=getCacheKey(_0x4ae9ab,_0x52f1b7),_0x2ed77a=cache[_0x176cbb(0xc9)](_0x22b004);if(!_0x2ed77a)return null;if(Date[_0x176cbb(0xc8)]()-_0x2ed77a[_0x176cbb(0xcb)]>CACHE_TTL_MS)return cache[_0x176cbb(0xc6)](_0x22b004),null;return _0x2ed77a['apiKey'];}export function setCachedCredential(_0x51b3e8,_0x592382,_0x369778){const _0xb3e39=a60_0x1ca6,_0x211380=getCacheKey(_0x592382,_0x369778);cache[_0xb3e39(0xca)](_0x211380,{'apiKey':_0x51b3e8,'loadedAt':Date[_0xb3e39(0xc8)]()});}export function clearCredentialCache(){const _0x3f61fe=a60_0x1ca6;cache[_0x3f61fe(0xd4)]();}function a60_0x367d(){const _0x2563ab=['clear','delete','882530AHTSoG','now','get','set','loadedAt','1039619ijoKGC','8sHRgue','3XmeRZT','31226kknqTr','6773418aLiRsb','4506408AJgYFd','17459352lzCqJw','3939675RoJrul'];a60_0x367d=function(){return _0x2563ab;};return a60_0x367d();}export function clearCachedCredential(_0x4c8b0e,_0xa263cf){const _0x4a00b0=getCacheKey(_0x4c8b0e,_0xa263cf);cache['delete'](_0x4a00b0);}
@@ -1 +1 @@
1
- const a61_0x5e9ba5=a61_0x2f84;(function(_0x4eecb7,_0x21c580){const _0x149ea2=a61_0x2f84,_0x135d62=_0x4eecb7();while(!![]){try{const _0xbc0747=parseInt(_0x149ea2(0x244))/0x1+-parseInt(_0x149ea2(0x201))/0x2+-parseInt(_0x149ea2(0x207))/0x3+-parseInt(_0x149ea2(0x21b))/0x4*(-parseInt(_0x149ea2(0x20b))/0x5)+-parseInt(_0x149ea2(0x23d))/0x6+-parseInt(_0x149ea2(0x1fc))/0x7+parseInt(_0x149ea2(0x221))/0x8;if(_0xbc0747===_0x21c580)break;else _0x135d62['push'](_0x135d62['shift']());}catch(_0x445746){_0x135d62['push'](_0x135d62['shift']());}}}(a61_0x34a6,0xbb657));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a61_0x34a6(){const _0x1ea98b=['project','segment_path','(session:\x20','logLevel','now','green','llmProject','global','getSource','layers','workflowProject','us01','database','dim','displayWithSources','cliFlags','parent_segment','join','none','profileSource','existsSync','replace','4698030PepkKQ','llm_agent','.json','entries','(using\x20session:\x20','log','resolveAPIKeyAsync','1405228sYiQzb','assign','llmAgent','[context]','proxy','profileCredentials','default','string','apiKey','display','(active)','injectIntoOptions','workflow_project','profile','composableAudience','87178HULZqW','loadGlobalConfig','llm_project','sessions','createAsync','2631882RNfelF','utf-8','site','session','Project','[configuration\x20files]','3518274tQhOxB','accessToken','sessionId','bold','32090gDljHQ','globalCredentials','parse','profiles','INFO','expires_at','.env','refresh_token','readFileSync','verbose','configFiles','CLI\x20flag:\x20--','segmentPath','tdx.json','profile:\x20','config','184nXQYXe','activeProfile','composable_audience','parentSegment','Global','Global\x20Credentials','18810216KwMbuZ','cyan','Profile','Session','getParameters','access_token'];a61_0x34a6=function(){return _0x1ea98b;};return a61_0x34a6();}import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a61_0x2f84(_0x1ab4c1,_0x1d9749){_0x1ab4c1=_0x1ab4c1-0x1ee;const _0x34a673=a61_0x34a6();let _0x2f84c4=_0x34a673[_0x1ab4c1];return _0x2f84c4;}import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a61_0x1b9791 from'node:fs';import*as a61_0x452e09 from'node:path';import a61_0x2247fd from'chalk';export class GlobalContext{['site'];[a61_0x5e9ba5(0x233)];[a61_0x5e9ba5(0x237)];[a61_0x5e9ba5(0x228)];[a61_0x5e9ba5(0x1fe)];[a61_0x5e9ba5(0x23e)];[a61_0x5e9ba5(0x1f9)];['composable_audience'];[a61_0x5e9ba5(0x1f5)];['accessToken'];[a61_0x5e9ba5(0x1f1)];[a61_0x5e9ba5(0x214)];[a61_0x5e9ba5(0x22a)];[a61_0x5e9ba5(0x1fa)];['profileSource']=null;['layers'];[a61_0x5e9ba5(0x21c)];['sessionId'];['configFiles'];constructor(_0x2d9234){const _0x5608de=a61_0x5e9ba5;this[_0x5608de(0x209)]=getSessionID(_0x2d9234[_0x5608de(0x204)]);const _0x59fd36=loadSessionContext(_0x2d9234[_0x5608de(0x204)]),_0x53fb92=loadProjectConfig(),_0x1199bb=this[_0x5608de(0x1fd)]();if(_0x2d9234['profile'])this[_0x5608de(0x21c)]=_0x2d9234[_0x5608de(0x1fa)],this[_0x5608de(0x23a)]='cli';else{if(_0x59fd36?.[_0x5608de(0x1fa)])this[_0x5608de(0x21c)]=_0x59fd36['profile'],this[_0x5608de(0x23a)]=_0x5608de(0x204);else{if(_0x1199bb[_0x5608de(0x1fa)])this['activeProfile']=_0x1199bb['profile'],this[_0x5608de(0x23a)]=_0x5608de(0x21a);else process.env.TDX_PROFILE?(this[_0x5608de(0x21c)]=process.env.TDX_PROFILE,this[_0x5608de(0x23a)]='env'):(this[_0x5608de(0x21c)]=null,this[_0x5608de(0x23a)]=null);}}const _0x1183b1=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x994e6e=_0x73af78=>{const _0x267317=_0x5608de;if(!_0x73af78)return{};const _0x1e15d0=_0x73af78,_0x1866dc={};for(const [_0x5d4118,_0x2ad11c]of Object[_0x267317(0x240)](_0x1e15d0)){typeof _0x2ad11c===_0x267317(0x1f4)&&(_0x1866dc[_0x5d4118]=_0x2ad11c);}return _0x1866dc;},_0x4e8d1c={},_0x4f9793=(_0x57e694,_0x3d63d8,_0x167a48)=>{const _0x3d81c4=_0x5608de;if(!_0x57e694)return![];if(_0x167a48&&_0x57e694===_0x167a48)return![];const _0x453ff2=_0x59fd36,_0x1423f4=_0x53fb92,_0x72f3e=_0x1183b1?.[_0x3d81c4(0x21a)],_0x385647=_0x1199bb,_0x50b66=_0x453ff2?.[_0x3d63d8],_0x7a2e40=_0x1423f4?.[_0x3d63d8],_0x275478=_0x72f3e?.[_0x3d63d8],_0x4913d0=_0x385647[_0x3d63d8];return _0x57e694!==_0x50b66&&_0x57e694!==_0x7a2e40&&_0x57e694!==_0x275478&&_0x57e694!==_0x4913d0;},_0x244e1d=[{'optionKey':_0x5608de(0x203),'contextKey':'site','defaultValue':_0x5608de(0x232)},{'optionKey':'database','contextKey':_0x5608de(0x233)},{'optionKey':_0x5608de(0x21e),'contextKey':'parent_segment'},{'optionKey':'llmProject','contextKey':'llm_project'},{'optionKey':_0x5608de(0x1ef),'contextKey':_0x5608de(0x23e)},{'optionKey':_0x5608de(0x1fb),'contextKey':'composable_audience'},{'optionKey':'profile','contextKey':'profile'}];for(const {optionKey:_0x302be5,contextKey:_0x345cf2,defaultValue:_0x416efd}of _0x244e1d){const _0x484150=_0x2d9234[_0x302be5];_0x4f9793(_0x484150,_0x345cf2,_0x416efd)&&(_0x4e8d1c[_0x345cf2]=_0x484150);}this['layers']={'cliFlags':_0x4e8d1c,'session':_0x994e6e(_0x59fd36),'project':_0x994e6e(_0x53fb92),'profile':_0x994e6e(_0x1183b1?.[_0x5608de(0x21a)]),'global':_0x994e6e(_0x1199bb)};const _0x3ef7ec={...this[_0x5608de(0x230)][_0x5608de(0x22e)],...this[_0x5608de(0x230)][_0x5608de(0x1fa)],...this['layers'][_0x5608de(0x227)]};process.env.TDX_SITE&&!this['layers'][_0x5608de(0x204)]['site']&&!this[_0x5608de(0x230)][_0x5608de(0x236)][_0x5608de(0x203)]&&(_0x3ef7ec['site']=process.env.TDX_SITE);Object[_0x5608de(0x1ee)](_0x3ef7ec,this[_0x5608de(0x230)][_0x5608de(0x204)]),Object[_0x5608de(0x1ee)](_0x3ef7ec,this['layers'][_0x5608de(0x236)]);const _0x379bb5=_0x3ef7ec[_0x5608de(0x203)]||_0x5608de(0x232);this[_0x5608de(0x203)]=resolveSite(_0x379bb5),this[_0x5608de(0x233)]=_0x3ef7ec['database'],this[_0x5608de(0x237)]=_0x3ef7ec[_0x5608de(0x237)],this[_0x5608de(0x228)]=_0x3ef7ec[_0x5608de(0x228)],this[_0x5608de(0x1fe)]=_0x3ef7ec[_0x5608de(0x1fe)],this['llm_agent']=_0x3ef7ec[_0x5608de(0x23e)],this[_0x5608de(0x1f9)]=_0x3ef7ec[_0x5608de(0x1f9)],this[_0x5608de(0x21d)]=_0x3ef7ec[_0x5608de(0x21d)],this[_0x5608de(0x214)]=_0x2d9234['verbose']||![],this['logLevel']=_0x2d9234[_0x5608de(0x22a)]??LogLevel[_0x5608de(0x20f)],this[_0x5608de(0x1fa)]=this[_0x5608de(0x21c)]||undefined,this[_0x5608de(0x208)]=getAccessToken(this[_0x5608de(0x21c)]||undefined),this['apiKey']=getAPIKey(this['activeProfile']||undefined);const _0x4c161a=typeof _0x1199bb[_0x5608de(0x1f1)]===_0x5608de(0x1f4)?_0x1199bb[_0x5608de(0x1f1)]:undefined;this[_0x5608de(0x1f1)]=_0x4c161a||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x25f8bd=getConfigDir(),_0x464809=a61_0x452e09[_0x5608de(0x238)](_0x25f8bd,_0x5608de(0x1ff),this[_0x5608de(0x209)]+_0x5608de(0x23f)),_0x1688df=findProjectConfigPath(),_0x23d447=a61_0x452e09[_0x5608de(0x238)](_0x25f8bd,_0x5608de(0x218)),_0xe95764=a61_0x452e09[_0x5608de(0x238)](_0x25f8bd,_0x5608de(0x211));let _0x5cb670=null,_0xbf9ef3=null;this[_0x5608de(0x21c)]&&(_0x5cb670=a61_0x452e09[_0x5608de(0x238)](_0x25f8bd,_0x5608de(0x20e),this[_0x5608de(0x21c)],_0x5608de(0x218)),_0xbf9ef3=a61_0x452e09['join'](_0x25f8bd,'profiles',this[_0x5608de(0x21c)],_0x5608de(0x211))),this[_0x5608de(0x215)]={'session':a61_0x1b9791[_0x5608de(0x23b)](_0x464809)?_0x464809:null,'project':_0x1688df,'profile':_0x5cb670&&a61_0x1b9791[_0x5608de(0x23b)](_0x5cb670)?_0x5cb670:null,'profileCredentials':_0xbf9ef3&&a61_0x1b9791[_0x5608de(0x23b)](_0xbf9ef3)?_0xbf9ef3:null,'global':a61_0x1b9791[_0x5608de(0x23b)](_0x23d447)?_0x23d447:null,'globalCredentials':a61_0x1b9791[_0x5608de(0x23b)](_0xe95764)?_0xe95764:null};}[a61_0x5e9ba5(0x22f)](_0x1891bf,_0x5d194b){const _0x39ef66=a61_0x5e9ba5;if(!_0x5d194b)return'not\x20set';const _0x3210c3=_0x5d194b;if(this['layers'][_0x39ef66(0x236)][_0x1891bf]===_0x3210c3){if(_0x1891bf===_0x39ef66(0x203)&&_0x3210c3===_0x39ef66(0x232)&&!this[_0x39ef66(0x230)][_0x39ef66(0x204)][_0x39ef66(0x203)]&&!this[_0x39ef66(0x230)][_0x39ef66(0x227)]['site']&&!this[_0x39ef66(0x230)][_0x39ef66(0x1fa)][_0x39ef66(0x203)]&&!this[_0x39ef66(0x230)][_0x39ef66(0x22e)]['site'])return _0x39ef66(0x1f3);return _0x39ef66(0x216)+_0x1891bf[_0x39ef66(0x23c)](/_/g,'-');}if(this[_0x39ef66(0x230)][_0x39ef66(0x204)][_0x1891bf]===_0x3210c3)return _0x39ef66(0x204);if(this[_0x39ef66(0x230)]['project'][_0x1891bf]===_0x3210c3)return _0x39ef66(0x227);if(this[_0x39ef66(0x230)][_0x39ef66(0x1fa)][_0x1891bf]===_0x3210c3)return _0x39ef66(0x219)+this[_0x39ef66(0x21c)];if(this[_0x39ef66(0x230)]['global'][_0x1891bf]===_0x3210c3)return _0x39ef66(0x22e);return'default';}[a61_0x5e9ba5(0x1fd)](){const _0xd8f2a6=a61_0x5e9ba5,_0x6f43d6=a61_0x452e09['join'](getConfigDir(),_0xd8f2a6(0x218));if(!a61_0x1b9791[_0xd8f2a6(0x23b)](_0x6f43d6))return{};try{const _0x269602=a61_0x1b9791[_0xd8f2a6(0x213)](_0x6f43d6,_0xd8f2a6(0x202));return JSON[_0xd8f2a6(0x20d)](_0x269602);}catch{return{};}}[a61_0x5e9ba5(0x1f8)](_0x30b359){const _0x407381=a61_0x5e9ba5;_0x30b359[_0x407381(0x203)]=this[_0x407381(0x203)],!_0x30b359[_0x407381(0x233)]&&this[_0x407381(0x233)]&&(_0x30b359[_0x407381(0x233)]=this['database']),!_0x30b359[_0x407381(0x21e)]&&this[_0x407381(0x237)]&&(_0x30b359['parentSegment']=this[_0x407381(0x237)]),!_0x30b359[_0x407381(0x217)]&&this['segment_path']&&(_0x30b359[_0x407381(0x217)]=this[_0x407381(0x228)]),!_0x30b359[_0x407381(0x22d)]&&this[_0x407381(0x1fe)]&&(_0x30b359[_0x407381(0x22d)]=this['llm_project']),!_0x30b359[_0x407381(0x1ef)]&&this[_0x407381(0x23e)]&&(_0x30b359[_0x407381(0x1ef)]=this[_0x407381(0x23e)]),!_0x30b359[_0x407381(0x231)]&&this['workflow_project']&&(_0x30b359[_0x407381(0x231)]=this[_0x407381(0x1f9)]),!_0x30b359[_0x407381(0x1fb)]&&this[_0x407381(0x21d)]&&(_0x30b359[_0x407381(0x1fb)]=this[_0x407381(0x21d)]);}[a61_0x5e9ba5(0x225)](){const _0xaccc0c=a61_0x5e9ba5;return[{'key':_0xaccc0c(0x203),'value':this[_0xaccc0c(0x203)]},{'key':_0xaccc0c(0x233),'value':this['database']},{'key':_0xaccc0c(0x237),'value':this[_0xaccc0c(0x237)]},{'key':'segment_path','value':this['segment_path']},{'key':_0xaccc0c(0x1fe),'value':this[_0xaccc0c(0x1fe)]},{'key':_0xaccc0c(0x23e),'value':this[_0xaccc0c(0x23e)]},{'key':'workflow_project','value':this[_0xaccc0c(0x1f9)]},{'key':'composable_audience','value':this['composable_audience']},{'key':'profile','value':this[_0xaccc0c(0x21c)]||undefined}];}[a61_0x5e9ba5(0x1f6)](){const _0x33b708=a61_0x5e9ba5;console[_0x33b708(0x242)](a61_0x2247fd[_0x33b708(0x20a)](_0x33b708(0x1f0)));for(const {key:_0x353a46,value:_0x5bcb72}of this[_0x33b708(0x225)]()){_0x5bcb72&&console[_0x33b708(0x242)](a61_0x2247fd[_0x33b708(0x222)](_0x353a46)+':\x20'+_0x5bcb72);}}[a61_0x5e9ba5(0x235)](){const _0x283253=a61_0x5e9ba5;console[_0x283253(0x242)](a61_0x2247fd[_0x283253(0x20a)](_0x283253(0x1f0)));for(const {key:_0x265401,value:_0x494794}of this[_0x283253(0x225)]()){if(_0x494794){const _0x5138b7=_0x265401==='profile'?_0x283253(0x1f7):'('+this[_0x283253(0x22f)](_0x265401,_0x494794)+')';console[_0x283253(0x242)](a61_0x2247fd['cyan'](_0x265401)+':\x20'+_0x494794+'\x20'+a61_0x2247fd['dim'](_0x5138b7));}}console[_0x283253(0x242)]('\x0a'+a61_0x2247fd[_0x283253(0x20a)](_0x283253(0x206)));const _0x47637a=[{'label':_0x283253(0x224),'path':this['configFiles'][_0x283253(0x204)],'extra':_0x283253(0x229)+this[_0x283253(0x209)]+')'},{'label':_0x283253(0x205),'path':this[_0x283253(0x215)][_0x283253(0x227)]},{'label':_0x283253(0x223),'path':this[_0x283253(0x215)]['profile']},{'label':'Profile\x20Credentials','path':this[_0x283253(0x215)][_0x283253(0x1f2)]},{'label':_0x283253(0x21f),'path':this[_0x283253(0x215)][_0x283253(0x22e)]},{'label':_0x283253(0x220),'path':this[_0x283253(0x215)][_0x283253(0x20c)]}];for(const {label:_0x2f408c,path:_0x1c90c8,extra:_0x5d40e3}of _0x47637a){if(_0x1c90c8)console[_0x283253(0x242)](a61_0x2247fd[_0x283253(0x222)](_0x2f408c)+':\x20'+_0x1c90c8+'\x20'+a61_0x2247fd[_0x283253(0x22c)]('✓')+(_0x5d40e3?'\x20'+a61_0x2247fd['dim'](_0x5d40e3):''));else{if(_0x2f408c===_0x283253(0x224))console[_0x283253(0x242)](a61_0x2247fd[_0x283253(0x222)](_0x2f408c)+':\x20'+a61_0x2247fd[_0x283253(0x234)](_0x283253(0x239))+'\x20'+a61_0x2247fd[_0x283253(0x234)](_0x283253(0x241)+this[_0x283253(0x209)]+')'));else(_0x2f408c==='Project'||_0x2f408c===_0x283253(0x21f))&&console[_0x283253(0x242)](a61_0x2247fd[_0x283253(0x222)](_0x2f408c)+':\x20'+a61_0x2247fd[_0x283253(0x234)](_0x283253(0x239)));}}}async[a61_0x5e9ba5(0x243)](){const _0x55f9f5=a61_0x5e9ba5;if(!this[_0x55f9f5(0x208)]){const _0x44a0b9=await getOAuthTokens(this[_0x55f9f5(0x21c)]||undefined);if(_0x44a0b9){const _0x4d49a9=0x5*0x3c*0x3e8,_0x153a11=!_0x44a0b9[_0x55f9f5(0x210)]||_0x44a0b9['expires_at']<Date[_0x55f9f5(0x22b)]()+_0x4d49a9;if(_0x153a11&&_0x44a0b9[_0x55f9f5(0x212)])try{const _0x314e00=getConsoleUrl(this['site']),_0xcccbdf=await refreshAccessToken(_0x314e00,_0x44a0b9[_0x55f9f5(0x212)]);await saveOAuthTokens(_0xcccbdf,this[_0x55f9f5(0x21c)]||undefined),this[_0x55f9f5(0x208)]=_0xcccbdf['access_token'];}catch{this[_0x55f9f5(0x208)]=_0x44a0b9[_0x55f9f5(0x226)];}else this[_0x55f9f5(0x208)]=_0x44a0b9[_0x55f9f5(0x226)];return undefined;}}return this[_0x55f9f5(0x1f5)]=await getAPIKeyAsync(this[_0x55f9f5(0x203)],this[_0x55f9f5(0x21c)]||undefined),this[_0x55f9f5(0x1f5)];}static async[a61_0x5e9ba5(0x200)](_0x1c0642){const _0x490460=a61_0x5e9ba5,_0x52ae4b=new GlobalContext(_0x1c0642);return await _0x52ae4b[_0x490460(0x243)](),_0x52ae4b;}}
1
+ const a61_0x2555a3=a61_0x5c6f;(function(_0x370041,_0x278621){const _0x537bf3=a61_0x5c6f,_0x244ec1=_0x370041();while(!![]){try{const _0x265df7=-parseInt(_0x537bf3(0x119))/0x1+parseInt(_0x537bf3(0x10c))/0x2+parseInt(_0x537bf3(0x125))/0x3+-parseInt(_0x537bf3(0x140))/0x4+parseInt(_0x537bf3(0x11a))/0x5+-parseInt(_0x537bf3(0x152))/0x6+parseInt(_0x537bf3(0x139))/0x7;if(_0x265df7===_0x278621)break;else _0x244ec1['push'](_0x244ec1['shift']());}catch(_0x578222){_0x244ec1['push'](_0x244ec1['shift']());}}}(a61_0x4f93,0x842a4));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a61_0x5c6f(_0x5d01b7,_0x56d3c8){_0x5d01b7=_0x5d01b7-0x105;const _0x4f93c3=a61_0x4f93();let _0x5c6f9d=_0x4f93c3[_0x5d01b7];return _0x5c6f9d;}function a61_0x4f93(){const _0x26928e=['composable_audience','cliFlags','refresh_token','sessionId','site','existsSync','session','displayWithSources','accessToken','1760700cHuvow','utf-8','Global\x20Credentials','injectIntoOptions','.env','replace','env','(using\x20session:\x20','Profile\x20Credentials','apiKey','verbose','none','resolveAPIKeyAsync','254542BCjMFj','profiles','llmAgent','composableAudience','workflow_project','tdx.json','global','parent_segment','database','[configuration\x20files]','profileSource','profile','workflowProject','693244PRLVPf','2617195idMmfE','logLevel','project','Project','proxy','log','access_token','(session:\x20','segmentPath','Profile','llm_project','1095105PXiwvR','activeProfile','.json','string','layers','dim','readFileSync','now','expires_at','llmProject','getParameters','loadGlobalConfig','sessions','configFiles','entries','assign','cyan','parse','join','Global','9491307gdqeEm','llm_agent','INFO','getSource','segment_path','profile:\x20','createAsync','3374416TkuvdO','parentSegment','bold','green','config','[context]','default','Session','profileCredentials'];a61_0x4f93=function(){return _0x26928e;};return a61_0x4f93();}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_0x34d69d from'node:fs';import*as a61_0x3fd718 from'node:path';import a61_0x577586 from'chalk';export class GlobalContext{[a61_0x2555a3(0x14d)];['database'];[a61_0x2555a3(0x113)];[a61_0x2555a3(0x13d)];['llm_project'];[a61_0x2555a3(0x13a)];['workflow_project'];['composable_audience'];[a61_0x2555a3(0x108)];[a61_0x2555a3(0x151)];[a61_0x2555a3(0x11e)];[a61_0x2555a3(0x109)];['logLevel'];['profile'];['profileSource']=null;[a61_0x2555a3(0x129)];[a61_0x2555a3(0x126)];['sessionId'];[a61_0x2555a3(0x132)];constructor(_0x106bc8){const _0xf3000b=a61_0x2555a3;this['sessionId']=getSessionID(_0x106bc8[_0xf3000b(0x14f)]);const _0x4ba24b=loadSessionContext(_0x106bc8[_0xf3000b(0x14f)]),_0x23fe0f=loadProjectConfig(),_0x2046d8=this[_0xf3000b(0x130)]();if(_0x106bc8[_0xf3000b(0x117)])this[_0xf3000b(0x126)]=_0x106bc8[_0xf3000b(0x117)],this['profileSource']='cli';else{if(_0x4ba24b?.[_0xf3000b(0x117)])this[_0xf3000b(0x126)]=_0x4ba24b['profile'],this[_0xf3000b(0x116)]=_0xf3000b(0x14f);else{if(_0x2046d8[_0xf3000b(0x117)])this[_0xf3000b(0x126)]=_0x2046d8['profile'],this[_0xf3000b(0x116)]=_0xf3000b(0x144);else process.env.TDX_PROFILE?(this[_0xf3000b(0x126)]=process.env.TDX_PROFILE,this['profileSource']=_0xf3000b(0x105)):(this[_0xf3000b(0x126)]=null,this[_0xf3000b(0x116)]=null);}}const _0x8b393f=this[_0xf3000b(0x126)]?loadProfile(this[_0xf3000b(0x126)]):null,_0x2520f8=_0x3eb1f2=>{const _0x120fa0=_0xf3000b;if(!_0x3eb1f2)return{};const _0x33643e=_0x3eb1f2,_0x206d8e={};for(const [_0x12c5b1,_0x3cb9d9]of Object[_0x120fa0(0x133)](_0x33643e)){typeof _0x3cb9d9==='string'&&(_0x206d8e[_0x12c5b1]=_0x3cb9d9);}return _0x206d8e;},_0x175d90={},_0x19c617=(_0x31ba9d,_0x465866,_0x295b79)=>{const _0x4f1884=_0xf3000b;if(!_0x31ba9d)return![];if(_0x295b79&&_0x31ba9d===_0x295b79)return![];const _0x1c2791=_0x4ba24b,_0x2e4407=_0x23fe0f,_0x10085e=_0x8b393f?.[_0x4f1884(0x144)],_0x10f985=_0x2046d8,_0x10e4d5=_0x1c2791?.[_0x465866],_0x92e0bc=_0x2e4407?.[_0x465866],_0x11c8e0=_0x10085e?.[_0x465866],_0x3d0d81=_0x10f985[_0x465866];return _0x31ba9d!==_0x10e4d5&&_0x31ba9d!==_0x92e0bc&&_0x31ba9d!==_0x11c8e0&&_0x31ba9d!==_0x3d0d81;},_0x2c941e=[{'optionKey':_0xf3000b(0x14d),'contextKey':_0xf3000b(0x14d),'defaultValue':'us01'},{'optionKey':_0xf3000b(0x114),'contextKey':_0xf3000b(0x114)},{'optionKey':_0xf3000b(0x141),'contextKey':_0xf3000b(0x113)},{'optionKey':_0xf3000b(0x12e),'contextKey':_0xf3000b(0x124)},{'optionKey':_0xf3000b(0x10e),'contextKey':_0xf3000b(0x13a)},{'optionKey':'composableAudience','contextKey':'composable_audience'},{'optionKey':_0xf3000b(0x117),'contextKey':_0xf3000b(0x117)}];for(const {optionKey:_0x295e46,contextKey:_0x10a906,defaultValue:_0x18e35e}of _0x2c941e){const _0x5a416f=_0x106bc8[_0x295e46];_0x19c617(_0x5a416f,_0x10a906,_0x18e35e)&&(_0x175d90[_0x10a906]=_0x5a416f);}this[_0xf3000b(0x129)]={'cliFlags':_0x175d90,'session':_0x2520f8(_0x4ba24b),'project':_0x2520f8(_0x23fe0f),'profile':_0x2520f8(_0x8b393f?.['config']),'global':_0x2520f8(_0x2046d8)};const _0x1e7441={...this[_0xf3000b(0x129)]['global'],...this[_0xf3000b(0x129)][_0xf3000b(0x117)],...this[_0xf3000b(0x129)][_0xf3000b(0x11c)]};process.env.TDX_SITE&&!this[_0xf3000b(0x129)]['session']['site']&&!this['layers']['cliFlags'][_0xf3000b(0x14d)]&&(_0x1e7441[_0xf3000b(0x14d)]=process.env.TDX_SITE);Object[_0xf3000b(0x134)](_0x1e7441,this[_0xf3000b(0x129)][_0xf3000b(0x14f)]),Object[_0xf3000b(0x134)](_0x1e7441,this['layers'][_0xf3000b(0x14a)]);const _0x539d55=_0x1e7441[_0xf3000b(0x14d)]||'us01';this[_0xf3000b(0x14d)]=resolveSite(_0x539d55),this['database']=_0x1e7441[_0xf3000b(0x114)],this[_0xf3000b(0x113)]=_0x1e7441[_0xf3000b(0x113)],this[_0xf3000b(0x13d)]=_0x1e7441[_0xf3000b(0x13d)],this[_0xf3000b(0x124)]=_0x1e7441[_0xf3000b(0x124)],this[_0xf3000b(0x13a)]=_0x1e7441['llm_agent'],this[_0xf3000b(0x110)]=_0x1e7441['workflow_project'],this[_0xf3000b(0x149)]=_0x1e7441[_0xf3000b(0x149)],this[_0xf3000b(0x109)]=_0x106bc8[_0xf3000b(0x109)]||![],this[_0xf3000b(0x11b)]=_0x106bc8[_0xf3000b(0x11b)]??LogLevel[_0xf3000b(0x13b)],this[_0xf3000b(0x117)]=this['activeProfile']||undefined,this[_0xf3000b(0x151)]=getAccessToken(this[_0xf3000b(0x126)]||undefined),this[_0xf3000b(0x108)]=getAPIKey(this[_0xf3000b(0x126)]||undefined);const _0x1bc559=typeof _0x2046d8['proxy']===_0xf3000b(0x128)?_0x2046d8[_0xf3000b(0x11e)]:undefined;this[_0xf3000b(0x11e)]=_0x1bc559||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x13731a=getConfigDir(),_0x178430=a61_0x3fd718[_0xf3000b(0x137)](_0x13731a,_0xf3000b(0x131),this[_0xf3000b(0x14c)]+_0xf3000b(0x127)),_0x5eb0c5=findProjectConfigPath(),_0x10d53a=a61_0x3fd718[_0xf3000b(0x137)](_0x13731a,_0xf3000b(0x111)),_0x2ff3ca=a61_0x3fd718[_0xf3000b(0x137)](_0x13731a,_0xf3000b(0x156));let _0x2682d7=null,_0x3868b9=null;this[_0xf3000b(0x126)]&&(_0x2682d7=a61_0x3fd718[_0xf3000b(0x137)](_0x13731a,_0xf3000b(0x10d),this[_0xf3000b(0x126)],_0xf3000b(0x111)),_0x3868b9=a61_0x3fd718[_0xf3000b(0x137)](_0x13731a,_0xf3000b(0x10d),this[_0xf3000b(0x126)],'.env')),this[_0xf3000b(0x132)]={'session':a61_0x34d69d[_0xf3000b(0x14e)](_0x178430)?_0x178430:null,'project':_0x5eb0c5,'profile':_0x2682d7&&a61_0x34d69d[_0xf3000b(0x14e)](_0x2682d7)?_0x2682d7:null,'profileCredentials':_0x3868b9&&a61_0x34d69d[_0xf3000b(0x14e)](_0x3868b9)?_0x3868b9:null,'global':a61_0x34d69d[_0xf3000b(0x14e)](_0x10d53a)?_0x10d53a:null,'globalCredentials':a61_0x34d69d[_0xf3000b(0x14e)](_0x2ff3ca)?_0x2ff3ca:null};}[a61_0x2555a3(0x13c)](_0x2b938f,_0x2a945c){const _0x1414f2=a61_0x2555a3;if(!_0x2a945c)return'not\x20set';const _0x1cd30a=_0x2a945c;if(this[_0x1414f2(0x129)]['cliFlags'][_0x2b938f]===_0x1cd30a){if(_0x2b938f==='site'&&_0x1cd30a==='us01'&&!this['layers']['session'][_0x1414f2(0x14d)]&&!this['layers'][_0x1414f2(0x11c)][_0x1414f2(0x14d)]&&!this['layers'][_0x1414f2(0x117)]['site']&&!this[_0x1414f2(0x129)][_0x1414f2(0x112)][_0x1414f2(0x14d)])return _0x1414f2(0x146);return'CLI\x20flag:\x20--'+_0x2b938f[_0x1414f2(0x157)](/_/g,'-');}if(this['layers'][_0x1414f2(0x14f)][_0x2b938f]===_0x1cd30a)return'session';if(this[_0x1414f2(0x129)]['project'][_0x2b938f]===_0x1cd30a)return'project';if(this[_0x1414f2(0x129)][_0x1414f2(0x117)][_0x2b938f]===_0x1cd30a)return _0x1414f2(0x13e)+this[_0x1414f2(0x126)];if(this[_0x1414f2(0x129)][_0x1414f2(0x112)][_0x2b938f]===_0x1cd30a)return _0x1414f2(0x112);return _0x1414f2(0x146);}['loadGlobalConfig'](){const _0x1904bb=a61_0x2555a3,_0x47d426=a61_0x3fd718[_0x1904bb(0x137)](getConfigDir(),_0x1904bb(0x111));if(!a61_0x34d69d[_0x1904bb(0x14e)](_0x47d426))return{};try{const _0x4a456a=a61_0x34d69d[_0x1904bb(0x12b)](_0x47d426,_0x1904bb(0x153));return JSON[_0x1904bb(0x136)](_0x4a456a);}catch{return{};}}[a61_0x2555a3(0x155)](_0x2403b2){const _0x120dd1=a61_0x2555a3;_0x2403b2[_0x120dd1(0x14d)]=this['site'],!_0x2403b2[_0x120dd1(0x114)]&&this['database']&&(_0x2403b2[_0x120dd1(0x114)]=this[_0x120dd1(0x114)]),!_0x2403b2[_0x120dd1(0x141)]&&this[_0x120dd1(0x113)]&&(_0x2403b2[_0x120dd1(0x141)]=this['parent_segment']),!_0x2403b2[_0x120dd1(0x122)]&&this[_0x120dd1(0x13d)]&&(_0x2403b2['segmentPath']=this[_0x120dd1(0x13d)]),!_0x2403b2['llmProject']&&this[_0x120dd1(0x124)]&&(_0x2403b2[_0x120dd1(0x12e)]=this[_0x120dd1(0x124)]),!_0x2403b2[_0x120dd1(0x10e)]&&this[_0x120dd1(0x13a)]&&(_0x2403b2[_0x120dd1(0x10e)]=this[_0x120dd1(0x13a)]),!_0x2403b2[_0x120dd1(0x118)]&&this[_0x120dd1(0x110)]&&(_0x2403b2[_0x120dd1(0x118)]=this[_0x120dd1(0x110)]),!_0x2403b2[_0x120dd1(0x10f)]&&this[_0x120dd1(0x149)]&&(_0x2403b2['composableAudience']=this[_0x120dd1(0x149)]);}[a61_0x2555a3(0x12f)](){const _0x37dd69=a61_0x2555a3;return[{'key':_0x37dd69(0x14d),'value':this[_0x37dd69(0x14d)]},{'key':_0x37dd69(0x114),'value':this['database']},{'key':_0x37dd69(0x113),'value':this[_0x37dd69(0x113)]},{'key':_0x37dd69(0x13d),'value':this['segment_path']},{'key':_0x37dd69(0x124),'value':this[_0x37dd69(0x124)]},{'key':_0x37dd69(0x13a),'value':this[_0x37dd69(0x13a)]},{'key':'workflow_project','value':this['workflow_project']},{'key':_0x37dd69(0x149),'value':this['composable_audience']},{'key':_0x37dd69(0x117),'value':this[_0x37dd69(0x126)]||undefined}];}['display'](){const _0xb3178=a61_0x2555a3;console[_0xb3178(0x11f)](a61_0x577586[_0xb3178(0x142)](_0xb3178(0x145)));for(const {key:_0x57d73f,value:_0x5e2afe}of this['getParameters']()){_0x5e2afe&&console['log'](a61_0x577586[_0xb3178(0x135)](_0x57d73f)+':\x20'+_0x5e2afe);}}[a61_0x2555a3(0x150)](){const _0x3d2ffd=a61_0x2555a3;console[_0x3d2ffd(0x11f)](a61_0x577586['bold'](_0x3d2ffd(0x145)));for(const {key:_0x184013,value:_0x3befba}of this[_0x3d2ffd(0x12f)]()){if(_0x3befba){const _0x390a5d=_0x184013===_0x3d2ffd(0x117)?'(active)':'('+this[_0x3d2ffd(0x13c)](_0x184013,_0x3befba)+')';console[_0x3d2ffd(0x11f)](a61_0x577586[_0x3d2ffd(0x135)](_0x184013)+':\x20'+_0x3befba+'\x20'+a61_0x577586[_0x3d2ffd(0x12a)](_0x390a5d));}}console[_0x3d2ffd(0x11f)]('\x0a'+a61_0x577586['bold'](_0x3d2ffd(0x115)));const _0xf1fc68=[{'label':'Session','path':this[_0x3d2ffd(0x132)][_0x3d2ffd(0x14f)],'extra':_0x3d2ffd(0x121)+this[_0x3d2ffd(0x14c)]+')'},{'label':_0x3d2ffd(0x11d),'path':this[_0x3d2ffd(0x132)][_0x3d2ffd(0x11c)]},{'label':_0x3d2ffd(0x123),'path':this[_0x3d2ffd(0x132)][_0x3d2ffd(0x117)]},{'label':_0x3d2ffd(0x107),'path':this[_0x3d2ffd(0x132)][_0x3d2ffd(0x148)]},{'label':'Global','path':this[_0x3d2ffd(0x132)][_0x3d2ffd(0x112)]},{'label':_0x3d2ffd(0x154),'path':this[_0x3d2ffd(0x132)]['globalCredentials']}];for(const {label:_0x5748c7,path:_0x207734,extra:_0x21df88}of _0xf1fc68){if(_0x207734)console[_0x3d2ffd(0x11f)](a61_0x577586['cyan'](_0x5748c7)+':\x20'+_0x207734+'\x20'+a61_0x577586[_0x3d2ffd(0x143)]('✓')+(_0x21df88?'\x20'+a61_0x577586[_0x3d2ffd(0x12a)](_0x21df88):''));else{if(_0x5748c7===_0x3d2ffd(0x147))console[_0x3d2ffd(0x11f)](a61_0x577586['cyan'](_0x5748c7)+':\x20'+a61_0x577586['dim']('none')+'\x20'+a61_0x577586[_0x3d2ffd(0x12a)](_0x3d2ffd(0x106)+this['sessionId']+')'));else(_0x5748c7===_0x3d2ffd(0x11d)||_0x5748c7===_0x3d2ffd(0x138))&&console[_0x3d2ffd(0x11f)](a61_0x577586['cyan'](_0x5748c7)+':\x20'+a61_0x577586[_0x3d2ffd(0x12a)](_0x3d2ffd(0x10a)));}}}async['resolveAPIKeyAsync'](){const _0x5a9b3d=a61_0x2555a3;if(!this[_0x5a9b3d(0x151)]){const _0x34a7ad=await getOAuthTokens(this[_0x5a9b3d(0x126)]||undefined);if(_0x34a7ad){const _0x3f9e34=0x5*0x3c*0x3e8,_0x313bcd=!_0x34a7ad[_0x5a9b3d(0x12d)]||_0x34a7ad[_0x5a9b3d(0x12d)]<Date[_0x5a9b3d(0x12c)]()+_0x3f9e34;if(_0x313bcd&&_0x34a7ad['refresh_token'])try{const _0x406ef0=getConsoleUrl(this[_0x5a9b3d(0x14d)]),_0x574635=await refreshAccessToken(_0x406ef0,_0x34a7ad[_0x5a9b3d(0x14b)]);await saveOAuthTokens(_0x574635,this[_0x5a9b3d(0x126)]||undefined),this[_0x5a9b3d(0x151)]=_0x574635[_0x5a9b3d(0x120)];}catch{this[_0x5a9b3d(0x151)]=_0x34a7ad['access_token'];}else this[_0x5a9b3d(0x151)]=_0x34a7ad[_0x5a9b3d(0x120)];return undefined;}}return this[_0x5a9b3d(0x108)]=await getAPIKeyAsync(this['site'],this[_0x5a9b3d(0x126)]||undefined),this[_0x5a9b3d(0x108)];}static async[a61_0x2555a3(0x13f)](_0x14b10a){const _0x1d71a7=a61_0x2555a3,_0x5320a4=new GlobalContext(_0x14b10a);return await _0x5320a4[_0x1d71a7(0x10b)](),_0x5320a4;}}
@@ -1 +1 @@
1
- const a62_0x5f2947=a62_0x4ce4;(function(_0x401098,_0x373d4a){const _0x1b5988=a62_0x4ce4,_0x5f01a8=_0x401098();while(!![]){try{const _0x2abf9f=-parseInt(_0x1b5988(0xd3))/0x1*(parseInt(_0x1b5988(0xe7))/0x2)+parseInt(_0x1b5988(0xd0))/0x3*(parseInt(_0x1b5988(0xde))/0x4)+-parseInt(_0x1b5988(0xe5))/0x5*(parseInt(_0x1b5988(0xe1))/0x6)+parseInt(_0x1b5988(0xce))/0x7*(parseInt(_0x1b5988(0xd7))/0x8)+-parseInt(_0x1b5988(0xe3))/0x9*(-parseInt(_0x1b5988(0xec))/0xa)+-parseInt(_0x1b5988(0xc8))/0xb+parseInt(_0x1b5988(0xea))/0xc;if(_0x2abf9f===_0x373d4a)break;else _0x5f01a8['push'](_0x5f01a8['shift']());}catch(_0x3b82d7){_0x5f01a8['push'](_0x5f01a8['shift']());}}}(a62_0x1054,0x3ab2d));const SERVICE_NAME=a62_0x5f2947(0xe8);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x7264f=a62_0x5f2947;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x1fd1c5=await import(_0x7264f(0xd4));return EntryClass=_0x1fd1c5[_0x7264f(0xcf)],EntryClass;}catch(_0x256870){return keyringLoadError=_0x256870 instanceof Error?_0x256870:new Error(String(_0x256870)),null;}}function a62_0x1054(){const _0x3aa6d2=['not\x20supported','7353228HbMwqI','__keychain_test__','43110prBKCK','restricted','success','4437565EUMatr','error','includes','not\x20available','no\x20matching\x20entry','unavailable','15792ijcoHO','Entry','48yIXlth','toLowerCase','profile:','766IbUdTT','@napi-rs/keyring','reason','-25300','96GfhTWP','not_found','cannot\x20find','setPassword','access_denied','message','getPassword','71744TZtPzz','access',':api_key','6yNeYdi','System\x20keychain\x20is\x20not\x20available','198gFnLml','-25293','1686085fKrEeg','not\x20found','106WuqkdV','tdx'];a62_0x1054=function(){return _0x3aa6d2;};return a62_0x1054();}function getAccountName(_0x163f27){const _0x1e628f=a62_0x5f2947,_0x2a04d6=_0x163f27||'';return _0x1e628f(0xd2)+_0x2a04d6+_0x1e628f(0xe0);}export async function getKeychainAPIKey(_0x363afd){const _0x394566=a62_0x5f2947,_0x159a20=await getKeychainAPIKeyWithStatus(_0x363afd);if(_0x159a20[_0x394566(0xc7)])return _0x159a20['value'];return _0x159a20[_0x394566(0xd5)]==='access_denied'&&console[_0x394566(0xc9)]('Warning:\x20'+_0x159a20[_0x394566(0xdc)]),null;}export async function getKeychainAPIKeyWithStatus(_0x429753){const _0x16e139=a62_0x5f2947;try{const _0x19211e=await getEntryClass();if(!_0x19211e)return{'success':![],'reason':_0x16e139(0xcd)};const _0x1866e7=getAccountName(_0x429753),_0x153f11=new _0x19211e(SERVICE_NAME,_0x1866e7),_0x318f99=_0x153f11[_0x16e139(0xdd)]();if(_0x318f99)return{'success':!![],'value':_0x318f99};return{'success':![],'reason':_0x16e139(0xd8)};}catch(_0x41d936){const _0x3f44e0=_0x41d936 instanceof Error?_0x41d936[_0x16e139(0xdc)]:String(_0x41d936);if(_0x3f44e0[_0x16e139(0xca)](_0x16e139(0xd6))||_0x3f44e0['toLowerCase']()[_0x16e139(0xca)]('could\x20not\x20be\x20found')||_0x3f44e0[_0x16e139(0xd1)]()['includes'](_0x16e139(0xe6))||_0x3f44e0[_0x16e139(0xd1)]()[_0x16e139(0xca)](_0x16e139(0xcc)))return{'success':![],'reason':_0x16e139(0xd8)};if(_0x3f44e0[_0x16e139(0xca)](_0x16e139(0xe4))||_0x3f44e0['toLowerCase']()[_0x16e139(0xca)](_0x16e139(0xed))||_0x3f44e0[_0x16e139(0xd1)]()['includes'](_0x16e139(0xdf)))return{'success':![],'reason':_0x16e139(0xdb),'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':_0x16e139(0xcd),'message':_0x3f44e0};}}function a62_0x4ce4(_0x2e5be8,_0x384258){_0x2e5be8=_0x2e5be8-0xc7;const _0x10548b=a62_0x1054();let _0x4ce4f7=_0x10548b[_0x2e5be8];return _0x4ce4f7;}export async function saveKeychainAPIKey(_0x352d33,_0x257222){const _0x269992=a62_0x5f2947,_0x89c128=await getEntryClass();if(!_0x89c128)throw new Error(_0x269992(0xe2));const _0x202562=getAccountName(_0x257222),_0x275886=new _0x89c128(SERVICE_NAME,_0x202562);_0x275886[_0x269992(0xda)](_0x352d33);}export async function deleteKeychainAPIKey(_0x2d0f83){try{const _0x2e03a3=await getEntryClass();if(!_0x2e03a3)return![];const _0x13ab7d=getAccountName(_0x2d0f83),_0x274d04=new _0x2e03a3(SERVICE_NAME,_0x13ab7d);return _0x274d04['deleteCredential'](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x128fb3=a62_0x5f2947;try{const _0x8f6e9=await getEntryClass();if(!_0x8f6e9)return![];const _0x5dc45f=new _0x8f6e9(SERVICE_NAME,_0x128fb3(0xeb));return _0x5dc45f[_0x128fb3(0xdd)](),!![];}catch(_0x1e21a2){const _0x47cf6a=_0x1e21a2 instanceof Error?_0x1e21a2[_0x128fb3(0xdc)][_0x128fb3(0xd1)]():'';if(_0x47cf6a[_0x128fb3(0xca)](_0x128fb3(0xcb))||_0x47cf6a['includes'](_0x128fb3(0xe9))||_0x47cf6a[_0x128fb3(0xca)](_0x128fb3(0xd9)))return![];return!![];}}
1
+ const a62_0x242a31=a62_0x2fd7;(function(_0x4ae686,_0x2b6d43){const _0x90729a=a62_0x2fd7,_0x2c0ab3=_0x4ae686();while(!![]){try{const _0x2081d2=-parseInt(_0x90729a(0x1aa))/0x1*(-parseInt(_0x90729a(0x1ab))/0x2)+parseInt(_0x90729a(0x1ad))/0x3*(-parseInt(_0x90729a(0x1b9))/0x4)+-parseInt(_0x90729a(0x1bf))/0x5*(parseInt(_0x90729a(0x1b5))/0x6)+-parseInt(_0x90729a(0x1a5))/0x7+-parseInt(_0x90729a(0x19d))/0x8+-parseInt(_0x90729a(0x1a9))/0x9+parseInt(_0x90729a(0x1a7))/0xa;if(_0x2081d2===_0x2b6d43)break;else _0x2c0ab3['push'](_0x2c0ab3['shift']());}catch(_0x5ec7d2){_0x2c0ab3['push'](_0x2c0ab3['shift']());}}}(a62_0x2c42,0x6d8aa));const SERVICE_NAME=a62_0x242a31(0x1a4);function a62_0x2c42(){const _0x4eca47=['5347560JMuvTF','Entry','not_found','cannot\x20find','includes','reason','toLowerCase','tdx','3637228EVGdVK','System\x20keychain\x20is\x20not\x20available','22185880obGpka','access_denied','2753145rpTXcr','13709MkVOpN','34nOFjYk','restricted','3dYcyvZ','deleteCredential','not\x20available','no\x20matching\x20entry','-25300','access','profile:',':api_key','263316DokOna','value','not\x20supported','success','280580gbQKBk','Warning:\x20','getPassword','could\x20not\x20be\x20found','message','unavailable','50vmpLcN','__keychain_test__','@napi-rs/keyring'];a62_0x2c42=function(){return _0x4eca47;};return a62_0x2c42();}let EntryClass=null,keyringLoadError=null;function a62_0x2fd7(_0x45e26b,_0x1b6c2c){_0x45e26b=_0x45e26b-0x19d;const _0x2c420d=a62_0x2c42();let _0x2fd76a=_0x2c420d[_0x45e26b];return _0x2fd76a;}async function getEntryClass(){const _0x5bb751=a62_0x242a31;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x36da47=await import(_0x5bb751(0x1c1));return EntryClass=_0x36da47[_0x5bb751(0x19e)],EntryClass;}catch(_0x3b55cb){return keyringLoadError=_0x3b55cb instanceof Error?_0x3b55cb:new Error(String(_0x3b55cb)),null;}}function getAccountName(_0x79f39a){const _0x32fce9=a62_0x242a31,_0x1e1693=_0x79f39a||'';return _0x32fce9(0x1b3)+_0x1e1693+_0x32fce9(0x1b4);}export async function getKeychainAPIKey(_0x3398a1){const _0x3a6e8b=a62_0x242a31,_0x3aad12=await getKeychainAPIKeyWithStatus(_0x3398a1);if(_0x3aad12[_0x3a6e8b(0x1b8)])return _0x3aad12[_0x3a6e8b(0x1b6)];return _0x3aad12[_0x3a6e8b(0x1a2)]===_0x3a6e8b(0x1a8)&&console['error'](_0x3a6e8b(0x1ba)+_0x3aad12[_0x3a6e8b(0x1bd)]),null;}export async function getKeychainAPIKeyWithStatus(_0x9c43b5){const _0x533432=a62_0x242a31;try{const _0x1fa346=await getEntryClass();if(!_0x1fa346)return{'success':![],'reason':_0x533432(0x1be)};const _0x50d6bb=getAccountName(_0x9c43b5),_0x8f67e6=new _0x1fa346(SERVICE_NAME,_0x50d6bb),_0x145485=_0x8f67e6[_0x533432(0x1bb)]();if(_0x145485)return{'success':!![],'value':_0x145485};return{'success':![],'reason':_0x533432(0x19f)};}catch(_0x26d390){const _0x49df67=_0x26d390 instanceof Error?_0x26d390[_0x533432(0x1bd)]:String(_0x26d390);if(_0x49df67[_0x533432(0x1a1)](_0x533432(0x1b1))||_0x49df67[_0x533432(0x1a3)]()[_0x533432(0x1a1)](_0x533432(0x1bc))||_0x49df67['toLowerCase']()['includes']('not\x20found')||_0x49df67[_0x533432(0x1a3)]()[_0x533432(0x1a1)](_0x533432(0x1b0)))return{'success':![],'reason':_0x533432(0x19f)};if(_0x49df67[_0x533432(0x1a1)]('-25293')||_0x49df67[_0x533432(0x1a3)]()[_0x533432(0x1a1)](_0x533432(0x1ac))||_0x49df67[_0x533432(0x1a3)]()[_0x533432(0x1a1)](_0x533432(0x1b2)))return{'success':![],'reason':_0x533432(0x1a8),'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':'unavailable','message':_0x49df67};}}export async function saveKeychainAPIKey(_0xa10cd3,_0x336624){const _0x8f6330=a62_0x242a31,_0x40c4f6=await getEntryClass();if(!_0x40c4f6)throw new Error(_0x8f6330(0x1a6));const _0x58b56a=getAccountName(_0x336624),_0x5b5de0=new _0x40c4f6(SERVICE_NAME,_0x58b56a);_0x5b5de0['setPassword'](_0xa10cd3);}export async function deleteKeychainAPIKey(_0x262e2b){const _0x389726=a62_0x242a31;try{const _0x18006b=await getEntryClass();if(!_0x18006b)return![];const _0xb6b59a=getAccountName(_0x262e2b),_0x2aab26=new _0x18006b(SERVICE_NAME,_0xb6b59a);return _0x2aab26[_0x389726(0x1ae)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x4432da=a62_0x242a31;try{const _0x4b8055=await getEntryClass();if(!_0x4b8055)return![];const _0x453c66=new _0x4b8055(SERVICE_NAME,_0x4432da(0x1c0));return _0x453c66[_0x4432da(0x1bb)](),!![];}catch(_0x3b4492){const _0xd42e60=_0x3b4492 instanceof Error?_0x3b4492['message'][_0x4432da(0x1a3)]():'';if(_0xd42e60[_0x4432da(0x1a1)](_0x4432da(0x1af))||_0xd42e60[_0x4432da(0x1a1)](_0x4432da(0x1b7))||_0xd42e60[_0x4432da(0x1a1)](_0x4432da(0x1a0)))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x54c224,_0xb1662e){const _0x4bac32=a63_0x1e64,_0x52daeb=_0x54c224();while(!![]){try{const _0x33e240=parseInt(_0x4bac32(0x17c))/0x1+parseInt(_0x4bac32(0x172))/0x2*(parseInt(_0x4bac32(0x17d))/0x3)+-parseInt(_0x4bac32(0x173))/0x4*(-parseInt(_0x4bac32(0x176))/0x5)+parseInt(_0x4bac32(0x17a))/0x6+-parseInt(_0x4bac32(0x177))/0x7*(-parseInt(_0x4bac32(0x16d))/0x8)+-parseInt(_0x4bac32(0x17b))/0x9+-parseInt(_0x4bac32(0x16f))/0xa;if(_0x33e240===_0xb1662e)break;else _0x52daeb['push'](_0x52daeb['shift']());}catch(_0x23eb89){_0x52daeb['push'](_0x52daeb['shift']());}}}(a63_0x1abe,0x4cf45));const SERVICE_NAME='tdx';function a63_0x1e64(_0xf6bb84,_0x2b0b56){_0xf6bb84=_0xf6bb84-0x16c;const _0x1abe98=a63_0x1abe();let _0x1e6465=_0x1abe98[_0xf6bb84];return _0x1e6465;}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x1e5966=a63_0x1e64;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x3bd01f=await import(_0x1e5966(0x174));return EntryClass=_0x3bd01f['Entry'],EntryClass;}catch(_0x4dab47){return keyringLoadError=_0x4dab47 instanceof Error?_0x4dab47:new Error(String(_0x4dab47)),null;}}function getOAuthAccountName(_0x7b6ab0){const _0x534db0=a63_0x1e64,_0x50020c=_0x7b6ab0||'';return _0x534db0(0x16e)+_0x50020c+_0x534db0(0x16c);}export async function saveOAuthTokens(_0x6d20d,_0x41c8e9){const _0xce3c60=a63_0x1e64,_0x3126e5=await getEntryClass();if(!_0x3126e5)throw new Error(_0xce3c60(0x179));const _0x5a6884=getOAuthAccountName(_0x41c8e9),_0x5752c9=new _0x3126e5(SERVICE_NAME,_0x5a6884);_0x5752c9[_0xce3c60(0x178)](JSON[_0xce3c60(0x170)](_0x6d20d));}export async function getOAuthTokens(_0x120d7a){const _0xd1b352=a63_0x1e64;try{const _0x54b697=await getEntryClass();if(!_0x54b697)return null;const _0x194a61=getOAuthAccountName(_0x120d7a),_0x30a0f4=new _0x54b697(SERVICE_NAME,_0x194a61),_0xa1b60f=_0x30a0f4[_0xd1b352(0x175)]();if(_0xa1b60f)return JSON['parse'](_0xa1b60f);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x243c1c){const _0x3f6572=a63_0x1e64;try{const _0x1447bc=await getEntryClass();if(!_0x1447bc)return![];const _0x4ca945=getOAuthAccountName(_0x243c1c),_0x285b1a=new _0x1447bc(SERVICE_NAME,_0x4ca945);return _0x285b1a[_0x3f6572(0x171)](),!![];}catch{return![];}}function a63_0x1abe(){const _0x8377b5=['16ifqDIk','profile:','11164000NNVwNR','stringify','deleteCredential','25178oFpsek','128532SsJgnD','@napi-rs/keyring','getPassword','45SnymmP','1269415KRaWGa','setPassword','System\x20keychain\x20is\x20not\x20available','2707674oCNDtg','4938345aAwSkp','335817ANkfue','129BJIqEA',':oauth_tokens'];a63_0x1abe=function(){return _0x8377b5;};return a63_0x1abe();}
1
+ const a63_0x81669b=a63_0x53ec;(function(_0x314bb7,_0x3967c6){const _0x572ecb=a63_0x53ec,_0x5e7db4=_0x314bb7();while(!![]){try{const _0x5ccdf7=-parseInt(_0x572ecb(0x142))/0x1+-parseInt(_0x572ecb(0x13e))/0x2+parseInt(_0x572ecb(0x139))/0x3+-parseInt(_0x572ecb(0x134))/0x4*(-parseInt(_0x572ecb(0x137))/0x5)+parseInt(_0x572ecb(0x143))/0x6*(-parseInt(_0x572ecb(0x13f))/0x7)+-parseInt(_0x572ecb(0x133))/0x8*(-parseInt(_0x572ecb(0x13c))/0x9)+-parseInt(_0x572ecb(0x141))/0xa*(-parseInt(_0x572ecb(0x140))/0xb);if(_0x5ccdf7===_0x3967c6)break;else _0x5e7db4['push'](_0x5e7db4['shift']());}catch(_0x3cd032){_0x5e7db4['push'](_0x5e7db4['shift']());}}}(a63_0x1889,0x492ea));const SERVICE_NAME=a63_0x81669b(0x13a);let EntryClass=null,keyringLoadError=null;function a63_0x53ec(_0x52f2d5,_0x813247){_0x52f2d5=_0x52f2d5-0x133;const _0x188937=a63_0x1889();let _0x53ec6c=_0x188937[_0x52f2d5];return _0x53ec6c;}async function getEntryClass(){const _0x116d68=a63_0x81669b;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0xb52f40=await import('@napi-rs/keyring');return EntryClass=_0xb52f40[_0x116d68(0x138)],EntryClass;}catch(_0x1e9fe9){return keyringLoadError=_0x1e9fe9 instanceof Error?_0x1e9fe9:new Error(String(_0x1e9fe9)),null;}}function getOAuthAccountName(_0x46d35a){const _0x3bfc34=_0x46d35a||'';return'profile:'+_0x3bfc34+':oauth_tokens';}export async function saveOAuthTokens(_0x2c78f4,_0x533405){const _0x1a8235=a63_0x81669b,_0x1bf392=await getEntryClass();if(!_0x1bf392)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x532bf6=getOAuthAccountName(_0x533405),_0x51bfd7=new _0x1bf392(SERVICE_NAME,_0x532bf6);_0x51bfd7[_0x1a8235(0x13d)](JSON[_0x1a8235(0x136)](_0x2c78f4));}function a63_0x1889(){const _0xb7c192=['518414OzmwDO','6yNVgTR','8SVZgIs','3028qeRZaM','getPassword','stringify','2225YZMiDV','Entry','1564578RCnCJS','tdx','parse','3680613wEnuYa','setPassword','514196VSatXl','1402142eDafZy','176ABJFWt','5140rQifqi'];a63_0x1889=function(){return _0xb7c192;};return a63_0x1889();}export async function getOAuthTokens(_0x279098){const _0x395eb0=a63_0x81669b;try{const _0x11795a=await getEntryClass();if(!_0x11795a)return null;const _0x18e720=getOAuthAccountName(_0x279098),_0x24d7f2=new _0x11795a(SERVICE_NAME,_0x18e720),_0x216c97=_0x24d7f2[_0x395eb0(0x135)]();if(_0x216c97)return JSON[_0x395eb0(0x13b)](_0x216c97);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x4c506b){try{const _0x1c786e=await getEntryClass();if(!_0x1c786e)return![];const _0x506a77=getOAuthAccountName(_0x4c506b),_0x2a1b26=new _0x1c786e(SERVICE_NAME,_0x506a77);return _0x2a1b26['deleteCredential'](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- const a64_0x44f132=a64_0x5c44;(function(_0x2a5f62,_0x5642bf){const _0x581f55=a64_0x5c44,_0x50ba11=_0x2a5f62();while(!![]){try{const _0x151356=-parseInt(_0x581f55(0x233))/0x1+-parseInt(_0x581f55(0x20c))/0x2*(-parseInt(_0x581f55(0x214))/0x3)+parseInt(_0x581f55(0x211))/0x4*(parseInt(_0x581f55(0x22a))/0x5)+parseInt(_0x581f55(0x20d))/0x6*(-parseInt(_0x581f55(0x21a))/0x7)+-parseInt(_0x581f55(0x1fc))/0x8+parseInt(_0x581f55(0x21b))/0x9+-parseInt(_0x581f55(0x222))/0xa*(-parseInt(_0x581f55(0x208))/0xb);if(_0x151356===_0x5642bf)break;else _0x50ba11['push'](_0x50ba11['shift']());}catch(_0x35a4f7){_0x50ba11['push'](_0x50ba11['shift']());}}}(a64_0x2a7d,0x7af5d));import*as a64_0x51d03d from'node:crypto';import*as a64_0x1c7887 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a64_0x44f132(0x22c)+OAUTH_CALLBACK_PORT+'/oauth/callback';function a64_0x5c44(_0x2290dc,_0x175d73){_0x2290dc=_0x2290dc-0x1f3;const _0x2a7db7=a64_0x2a7d();let _0x5c4459=_0x2a7db7[_0x2290dc];return _0x5c4459;}export function getOAuthClientId(){const _0xf202c5=a64_0x44f132;return process.env.TD_OAUTH_CLIENT_ID||_0xf202c5(0x210);}export function generatePKCEPair(){const _0x442e2a=a64_0x44f132,_0x166ce6=a64_0x51d03d[_0x442e2a(0x230)](0x20)['toString'](_0x442e2a(0x232)),_0xe78e25=a64_0x51d03d[_0x442e2a(0x223)](_0x442e2a(0x20f))[_0x442e2a(0x21d)](_0x166ce6)[_0x442e2a(0x21c)]('base64url');return{'verifier':_0x166ce6,'challenge':_0xe78e25};}export function buildAuthorizeURL(_0x526f6a,_0x132c26){const _0x5ee98a=a64_0x44f132,_0x4b4101=new URL(_0x5ee98a(0x202),_0x526f6a);return _0x4b4101[_0x5ee98a(0x201)][_0x5ee98a(0x22f)](_0x5ee98a(0x215),_0x5ee98a(0x213)),_0x4b4101[_0x5ee98a(0x201)][_0x5ee98a(0x22f)](_0x5ee98a(0x209),_0x132c26[_0x5ee98a(0x20a)]),_0x4b4101[_0x5ee98a(0x201)]['set'](_0x5ee98a(0x1f5),_0x132c26[_0x5ee98a(0x216)]),_0x4b4101['searchParams']['set'](_0x5ee98a(0x1fb),_0x132c26[_0x5ee98a(0x1fb)]),_0x4b4101[_0x5ee98a(0x201)]['set'](_0x5ee98a(0x219),_0x132c26[_0x5ee98a(0x1f8)]),_0x4b4101['searchParams'][_0x5ee98a(0x22f)](_0x5ee98a(0x21e),_0x5ee98a(0x1f3)),_0x132c26[_0x5ee98a(0x227)]&&_0x4b4101[_0x5ee98a(0x201)][_0x5ee98a(0x22f)](_0x5ee98a(0x227),_0x132c26[_0x5ee98a(0x227)]),_0x4b4101[_0x5ee98a(0x228)]();}function a64_0x2a7d(){const _0x57fb5e=['redirectUri','writeHead','refresh_token','code_challenge','3224956IyMQTF','3474036EicVRW','digest','update','code_challenge_method','json','listen','text/html','10JKBpgJ','createHash','get','close','waitForCallback','scope','toString','OAuth\x20token\x20request\x20failed\x20(','29105dpuXqt','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','http://localhost:','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','http://127.0.0.1','set','randomBytes','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','base64url','445893hemhYm','S256','error','redirect_uri','application/x-www-form-urlencoded','EADDRINUSE','codeChallenge','account_name','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','state','2396384sLOUkO','POST','/oauth/callback','accountName','status','searchParams','/oauth/authorize','end','createServer','/users/initiate_sso','expires_in','text','12232968wbDSaI','client_id','clientId','url','82nIHiNn','12ZzxReJ','now','sha256','tdx','452qkNwtp','replace','code','1071vYShCl','response_type'];a64_0x2a7d=function(){return _0x57fb5e;};return a64_0x2a7d();}export function buildSSOInitiateURL(_0x454a36,_0x2ae3fe,_0x23dfce){const _0x8c1687=a64_0x44f132,_0x18f00b=new URL(_0x8c1687(0x205),_0x454a36);_0x18f00b['searchParams'][_0x8c1687(0x22f)](_0x8c1687(0x1f9),_0x2ae3fe);const _0x355bfa=_0x23dfce[_0x8c1687(0x212)](_0x454a36,'');return _0x18f00b[_0x8c1687(0x201)][_0x8c1687(0x22f)]('redirect_to_path',_0x355bfa),_0x18f00b[_0x8c1687(0x228)]();}export async function postTokenRequest(_0xc51a51,_0x1aa4c4){const _0x485930=a64_0x44f132,_0x48cfba=new URLSearchParams(_0x1aa4c4)[_0x485930(0x228)](),_0x173301=await fetch(_0xc51a51,{'method':_0x485930(0x1fd),'headers':{'Content-Type':_0x485930(0x1f6)},'body':_0x48cfba});if(!_0x173301['ok']){const _0x309267=await _0x173301[_0x485930(0x207)]();throw new Error(_0x485930(0x229)+_0x173301[_0x485930(0x200)]+'):\x20'+_0x309267);}const _0x325b52=await _0x173301[_0x485930(0x21f)]();return{'access_token':_0x325b52['access_token'],'refresh_token':_0x325b52[_0x485930(0x218)],'scope':_0x325b52[_0x485930(0x227)],'expires_at':_0x325b52['expires_in']?Date[_0x485930(0x20e)]()+_0x325b52[_0x485930(0x206)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x562385,_0x4cea43,_0x5e75b5,_0x4e4e6f){const _0x5c488f=_0x562385+'/oauth/token';return postTokenRequest(_0x5c488f,{'grant_type':'authorization_code','client_id':getOAuthClientId(),'code':_0x4cea43,'code_verifier':_0x5e75b5,'redirect_uri':_0x4e4e6f});}export function startLocalCallbackServer(){const _0xf399b1=a64_0x44f132;let _0x211d3f,_0x34edce;const _0x5ce6a7=new Promise((_0x56fb44,_0x14403b)=>{_0x211d3f=_0x56fb44,_0x34edce=_0x14403b;}),_0x255ca6=a64_0x1c7887[_0xf399b1(0x204)]((_0x1bd3e4,_0x130703)=>{const _0x39a4e7=_0xf399b1,_0x3f45ac=new URL(_0x1bd3e4[_0x39a4e7(0x20b)]||'/',_0x39a4e7(0x22e));if(_0x3f45ac['pathname']!==_0x39a4e7(0x1fe)){_0x130703[_0x39a4e7(0x217)](0x194,{'Content-Type':'text/plain'}),_0x130703['end']('Not\x20Found');return;}const _0x3c0a88=_0x3f45ac[_0x39a4e7(0x201)][_0x39a4e7(0x224)]('code'),_0x3bf1a8=_0x3f45ac[_0x39a4e7(0x201)][_0x39a4e7(0x224)]('state'),_0x532f6c=_0x3f45ac[_0x39a4e7(0x201)][_0x39a4e7(0x224)](_0x39a4e7(0x1f4));if(_0x532f6c||!_0x3c0a88||!_0x3bf1a8){_0x130703[_0x39a4e7(0x217)](0x190,{'Content-Type':_0x39a4e7(0x221)}),_0x130703[_0x39a4e7(0x203)]('<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>'),_0x34edce(new Error('OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters'));return;}_0x130703[_0x39a4e7(0x217)](0xc8,{'Content-Type':_0x39a4e7(0x221)}),_0x130703['end'](_0x39a4e7(0x231)),_0x211d3f({'code':_0x3c0a88,'state':_0x3bf1a8});});_0x255ca6['on'](_0xf399b1(0x1f4),_0xc1a598=>{const _0x40e10d=_0xf399b1;_0xc1a598[_0x40e10d(0x213)]===_0x40e10d(0x1f7)?_0x34edce(new Error('Port\x20'+OAUTH_CALLBACK_PORT+_0x40e10d(0x22d))):_0x34edce(new Error(_0x40e10d(0x22b)+_0xc1a598['message']));}),_0x255ca6[_0xf399b1(0x220)](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x5973e7=setTimeout(()=>{const _0x264012=_0xf399b1;_0x34edce(new Error(_0x264012(0x1fa))),_0x255ca6[_0x264012(0x225)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x5ce6a7,'close':()=>{clearTimeout(_0x5973e7),_0x255ca6['close']();}};}export async function startOAuthFlow(_0x251035,_0x44544e){const _0x430504=a64_0x44f132,_0x2db574=getConsoleUrl(_0x251035),_0x5334f5=getOAuthClientId(),{verifier:_0x2b3946,challenge:_0x2957d1}=generatePKCEPair(),_0x4c91bc=a64_0x51d03d[_0x430504(0x230)](0x10)[_0x430504(0x228)]('hex'),_0x12749f=startLocalCallbackServer();try{const _0x2ea0f9=OAUTH_REDIRECT_URI,_0x28b347=buildAuthorizeURL(_0x2db574,{'clientId':_0x5334f5,'redirectUri':_0x2ea0f9,'state':_0x4c91bc,'codeChallenge':_0x2957d1,'scope':'openid\x20email\x20profile'}),_0x3624ee=_0x44544e?.[_0x430504(0x1ff)]?buildSSOInitiateURL(_0x2db574,_0x44544e[_0x430504(0x1ff)],_0x28b347):_0x28b347;openBrowser(_0x3624ee);const _0x4afee2=await _0x12749f[_0x430504(0x226)]();if(_0x4afee2['state']!==_0x4c91bc)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x2db574,_0x4afee2[_0x430504(0x213)],_0x2b3946,_0x2ea0f9);}finally{_0x12749f[_0x430504(0x225)]();}}
1
+ const a64_0x1e0d0d=a64_0x58a0;(function(_0x13eae1,_0x17b024){const _0x138a3a=a64_0x58a0,_0x5b662e=_0x13eae1();while(!![]){try{const _0x18de0d=parseInt(_0x138a3a(0x1f2))/0x1*(-parseInt(_0x138a3a(0x214))/0x2)+-parseInt(_0x138a3a(0x1f7))/0x3*(parseInt(_0x138a3a(0x207))/0x4)+parseInt(_0x138a3a(0x204))/0x5+parseInt(_0x138a3a(0x20d))/0x6*(-parseInt(_0x138a3a(0x206))/0x7)+parseInt(_0x138a3a(0x21d))/0x8+parseInt(_0x138a3a(0x20a))/0x9+parseInt(_0x138a3a(0x205))/0xa;if(_0x18de0d===_0x17b024)break;else _0x5b662e['push'](_0x5b662e['shift']());}catch(_0x21a530){_0x5b662e['push'](_0x5b662e['shift']());}}}(a64_0x30f3,0x31728));import*as a64_0xde60d3 from'node:crypto';import*as a64_0xba5bfd from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a64_0x1e0d0d(0x1e6)+OAUTH_CALLBACK_PORT+a64_0x1e0d0d(0x211);export function getOAuthClientId(){const _0x2b67b9=a64_0x1e0d0d;return process.env.TD_OAUTH_CLIENT_ID||_0x2b67b9(0x20b);}export function generatePKCEPair(){const _0x501cbd=a64_0x1e0d0d,_0x10a819=a64_0xde60d3[_0x501cbd(0x1fb)](0x20)['toString'](_0x501cbd(0x1e7)),_0x19a542=a64_0xde60d3[_0x501cbd(0x1eb)](_0x501cbd(0x1e2))['update'](_0x10a819)[_0x501cbd(0x1e5)](_0x501cbd(0x1e7));return{'verifier':_0x10a819,'challenge':_0x19a542};}export function buildAuthorizeURL(_0x27120e,_0x28fb43){const _0x413471=a64_0x1e0d0d,_0x44346a=new URL(_0x413471(0x1f0),_0x27120e);return _0x44346a[_0x413471(0x1e0)][_0x413471(0x1fe)](_0x413471(0x1f9),_0x413471(0x219)),_0x44346a[_0x413471(0x1e0)]['set'](_0x413471(0x215),_0x28fb43[_0x413471(0x212)]),_0x44346a[_0x413471(0x1e0)]['set'](_0x413471(0x1e1),_0x28fb43[_0x413471(0x1ee)]),_0x44346a[_0x413471(0x1e0)]['set'](_0x413471(0x20e),_0x28fb43['state']),_0x44346a[_0x413471(0x1e0)][_0x413471(0x1fe)](_0x413471(0x213),_0x28fb43[_0x413471(0x200)]),_0x44346a[_0x413471(0x1e0)][_0x413471(0x1fe)]('code_challenge_method','S256'),_0x28fb43[_0x413471(0x1f6)]&&_0x44346a[_0x413471(0x1e0)]['set'](_0x413471(0x1f6),_0x28fb43[_0x413471(0x1f6)]),_0x44346a[_0x413471(0x1fa)]();}function a64_0x58a0(_0x4c55ff,_0x5692b9){_0x4c55ff=_0x4c55ff-0x1df;const _0x30f304=a64_0x30f3();let _0x58a08a=_0x30f304[_0x4c55ff];return _0x58a08a;}export function buildSSOInitiateURL(_0x55c5c3,_0x54bfea,_0x8fd0e3){const _0x505678=a64_0x1e0d0d,_0x462141=new URL('/users/initiate_sso',_0x55c5c3);_0x462141[_0x505678(0x1e0)][_0x505678(0x1fe)](_0x505678(0x216),_0x54bfea);const _0x54ba75=_0x8fd0e3[_0x505678(0x210)](_0x55c5c3,'');return _0x462141[_0x505678(0x1e0)][_0x505678(0x1fe)]('redirect_to_path',_0x54ba75),_0x462141[_0x505678(0x1fa)]();}export async function postTokenRequest(_0x1226d1,_0x13e1ca){const _0x454d1e=a64_0x1e0d0d,_0x5ae678=new URLSearchParams(_0x13e1ca)[_0x454d1e(0x1fa)](),_0x373394=await fetch(_0x1226d1,{'method':_0x454d1e(0x1df),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x5ae678});if(!_0x373394['ok']){const _0x4a2309=await _0x373394[_0x454d1e(0x1f4)]();throw new Error(_0x454d1e(0x21f)+_0x373394[_0x454d1e(0x1f3)]+_0x454d1e(0x1fc)+_0x4a2309);}const _0x5a8250=await _0x373394[_0x454d1e(0x1ea)]();return{'access_token':_0x5a8250[_0x454d1e(0x218)],'refresh_token':_0x5a8250[_0x454d1e(0x1f1)],'scope':_0x5a8250['scope'],'expires_at':_0x5a8250[_0x454d1e(0x208)]?Date[_0x454d1e(0x1ff)]()+_0x5a8250[_0x454d1e(0x208)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x33ad3b,_0x4b11b7,_0x51b481,_0x1fa54d){const _0x93f74f=a64_0x1e0d0d,_0x2b64e3=_0x33ad3b+_0x93f74f(0x1ed);return postTokenRequest(_0x2b64e3,{'grant_type':_0x93f74f(0x20f),'client_id':getOAuthClientId(),'code':_0x4b11b7,'code_verifier':_0x51b481,'redirect_uri':_0x1fa54d});}export function startLocalCallbackServer(){const _0x58c8b9=a64_0x1e0d0d;let _0x4e2ea1,_0x5cc43d;const _0x144038=new Promise((_0x1679d1,_0x38dcbc)=>{_0x4e2ea1=_0x1679d1,_0x5cc43d=_0x38dcbc;}),_0x194d3f=a64_0xba5bfd[_0x58c8b9(0x222)]((_0x1c7a9a,_0x47c52a)=>{const _0x7b7419=_0x58c8b9,_0x3a60b5=new URL(_0x1c7a9a[_0x7b7419(0x1f8)]||'/',_0x7b7419(0x223));if(_0x3a60b5['pathname']!==_0x7b7419(0x211)){_0x47c52a[_0x7b7419(0x20c)](0x194,{'Content-Type':'text/plain'}),_0x47c52a[_0x7b7419(0x21e)]('Not\x20Found');return;}const _0x253fde=_0x3a60b5[_0x7b7419(0x1e0)][_0x7b7419(0x209)](_0x7b7419(0x219)),_0x11cb71=_0x3a60b5['searchParams'][_0x7b7419(0x209)](_0x7b7419(0x20e)),_0x4f6bf4=_0x3a60b5[_0x7b7419(0x1e0)][_0x7b7419(0x209)](_0x7b7419(0x1e4));if(_0x4f6bf4||!_0x253fde||!_0x11cb71){_0x47c52a['writeHead'](0x190,{'Content-Type':_0x7b7419(0x1e3)}),_0x47c52a[_0x7b7419(0x21e)](_0x7b7419(0x203)),_0x5cc43d(new Error(_0x7b7419(0x1ef)));return;}_0x47c52a[_0x7b7419(0x20c)](0xc8,{'Content-Type':'text/html'}),_0x47c52a[_0x7b7419(0x21e)](_0x7b7419(0x1f5)),_0x4e2ea1({'code':_0x253fde,'state':_0x11cb71});});_0x194d3f['on'](_0x58c8b9(0x1e4),_0x33ef47=>{const _0x2e0d05=_0x58c8b9;_0x33ef47[_0x2e0d05(0x219)]==='EADDRINUSE'?_0x5cc43d(new Error(_0x2e0d05(0x217)+OAUTH_CALLBACK_PORT+_0x2e0d05(0x21c))):_0x5cc43d(new Error(_0x2e0d05(0x1ec)+_0x33ef47[_0x2e0d05(0x1fd)]));}),_0x194d3f['listen'](OAUTH_CALLBACK_PORT,_0x58c8b9(0x221));const _0x2a65b1=setTimeout(()=>{const _0xf2f6dc=_0x58c8b9;_0x5cc43d(new Error(_0xf2f6dc(0x201))),_0x194d3f[_0xf2f6dc(0x202)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x144038,'close':()=>{clearTimeout(_0x2a65b1),_0x194d3f['close']();}};}export async function startOAuthFlow(_0x785e3,_0x39ec99){const _0x30c9e1=a64_0x1e0d0d,_0x41797e=getConsoleUrl(_0x785e3),_0x3b634c=getOAuthClientId(),{verifier:_0x91f598,challenge:_0x7dee54}=generatePKCEPair(),_0x34a454=a64_0xde60d3[_0x30c9e1(0x1fb)](0x10)[_0x30c9e1(0x1fa)](_0x30c9e1(0x1e9)),_0x16d1c8=startLocalCallbackServer();try{const _0x3ce4cd=OAUTH_REDIRECT_URI,_0xe695c4=buildAuthorizeURL(_0x41797e,{'clientId':_0x3b634c,'redirectUri':_0x3ce4cd,'state':_0x34a454,'codeChallenge':_0x7dee54,'scope':_0x30c9e1(0x21a)}),_0x51fa6f=_0x39ec99?.[_0x30c9e1(0x21b)]?buildSSOInitiateURL(_0x41797e,_0x39ec99[_0x30c9e1(0x21b)],_0xe695c4):_0xe695c4;openBrowser(_0x51fa6f);const _0x233707=await _0x16d1c8[_0x30c9e1(0x220)]();if(_0x233707['state']!==_0x34a454)throw new Error(_0x30c9e1(0x1e8));return await exchangeCodeForTokens(_0x41797e,_0x233707[_0x30c9e1(0x219)],_0x91f598,_0x3ce4cd);}finally{_0x16d1c8[_0x30c9e1(0x202)]();}}function a64_0x30f3(){const _0x4a632b=['2752442XDsZgA','4EOXtll','expires_in','get','215667AoxMwS','tdx','writeHead','6ZyZwbk','state','authorization_code','replace','/oauth/callback','clientId','code_challenge','534AfBRJC','client_id','account_name','Port\x20','access_token','code','openid\x20email\x20profile','accountName','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','2074152QhmfGB','end','OAuth\x20token\x20request\x20failed\x20(','waitForCallback','127.0.0.1','createServer','http://127.0.0.1','POST','searchParams','redirect_uri','sha256','text/html','error','digest','http://localhost:','base64url','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','hex','json','createHash','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','/oauth/token','redirectUri','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','/oauth/authorize','refresh_token','663FageVp','status','text','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','scope','523401JlODDW','url','response_type','toString','randomBytes','):\x20','message','set','now','codeChallenge','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','close','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','1127600TPiHNe','4384780oFAdGv'];a64_0x30f3=function(){return _0x4a632b;};return a64_0x30f3();}
@@ -1 +1 @@
1
- const a65_0x4238ab=a65_0x25cb;(function(_0x29d315,_0x4a447d){const _0x2f6d0a=a65_0x25cb,_0xd8a8a4=_0x29d315();while(!![]){try{const _0x4701b9=-parseInt(_0x2f6d0a(0x167))/0x1*(parseInt(_0x2f6d0a(0x119))/0x2)+-parseInt(_0x2f6d0a(0x161))/0x3+parseInt(_0x2f6d0a(0x11d))/0x4+-parseInt(_0x2f6d0a(0x150))/0x5*(parseInt(_0x2f6d0a(0x144))/0x6)+parseInt(_0x2f6d0a(0x11f))/0x7+-parseInt(_0x2f6d0a(0x166))/0x8+parseInt(_0x2f6d0a(0x160))/0x9;if(_0x4701b9===_0x4a447d)break;else _0xd8a8a4['push'](_0xd8a8a4['shift']());}catch(_0x38bf2c){_0xd8a8a4['push'](_0xd8a8a4['shift']());}}}(a65_0x4ef5,0x3071a));import*as a65_0x20a008 from'node:fs';function a65_0x25cb(_0x34270a,_0x20e11b){_0x34270a=_0x34270a-0x119;const _0x4ef504=a65_0x4ef5();let _0x25cbbe=_0x4ef504[_0x34270a];return _0x25cbbe;}import*as a65_0x2b42cd from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a65_0x4238ab(0x16c);export function getProfileParams(_0x1c61b0){const _0x530cee=a65_0x4238ab,_0x5096f5={};if(!_0x1c61b0)return _0x5096f5;for(const [_0x27f8ac,_0x5170e2]of Object[_0x530cee(0x153)](_0x1c61b0)){_0x27f8ac!=='description'&&_0x5170e2!==undefined&&(_0x5096f5[_0x27f8ac]=_0x5170e2);}return _0x5096f5;}export function getProfilesDir(){const _0x2b7633=a65_0x4238ab;return a65_0x2b42cd[_0x2b7633(0x169)](getConfigDir(),_0x2b7633(0x130));}function getProfileDir(_0x16617a){const _0x5b328c=a65_0x4238ab;return a65_0x2b42cd[_0x5b328c(0x169)](getProfilesDir(),_0x16617a);}function getProfileConfigPath(_0x2aec49){const _0x5514a3=a65_0x4238ab;return a65_0x2b42cd[_0x5514a3(0x169)](getProfileDir(_0x2aec49),_0x5514a3(0x168));}function getProfileEnvPath(_0x2e09b0){const _0x199d84=a65_0x4238ab;return a65_0x2b42cd[_0x199d84(0x169)](getProfileDir(_0x2e09b0),_0x199d84(0x148));}function getGlobalConfigPath(){const _0x545e20=a65_0x4238ab;return a65_0x2b42cd[_0x545e20(0x169)](getConfigDir(),_0x545e20(0x168));}function validateProfileName(_0x683c3f){const _0x47dd9e=a65_0x4238ab;if(/^@?[a-zA-Z0-9_-]+$/[_0x47dd9e(0x138)](_0x683c3f))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x47dd9e(0x138)](_0x683c3f))return;throw new Error(_0x47dd9e(0x133)+_0x683c3f+_0x47dd9e(0x14b));}function validateProfileConfig(_0x37094c,_0x4f7523){const _0x11fb03=a65_0x4238ab;if(typeof _0x37094c!==_0x11fb03(0x128)||_0x37094c===null)throw new SDKError(ErrorCode[_0x11fb03(0x135)],'Profile\x20\x27'+_0x4f7523+_0x11fb03(0x12f));const _0x5b6d21=['description',_0x11fb03(0x11b),_0x11fb03(0x142),_0x11fb03(0x11c),'llm_project',_0x11fb03(0x145),'user_info'],_0x263a7e=_0x37094c;for(const _0x1060d2 of Object[_0x11fb03(0x15a)](_0x263a7e)){!_0x5b6d21[_0x11fb03(0x13d)](_0x1060d2)&&console[_0x11fb03(0x15e)](_0x11fb03(0x15f)+_0x4f7523+_0x11fb03(0x123)+_0x1060d2+_0x11fb03(0x122));}if(_0x263a7e[_0x11fb03(0x14f)]!==undefined&&typeof _0x263a7e[_0x11fb03(0x14f)]!=='string')throw new SDKError(ErrorCode[_0x11fb03(0x135)],_0x11fb03(0x136)+_0x4f7523+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x263a7e[_0x11fb03(0x11b)]!==undefined&&typeof _0x263a7e[_0x11fb03(0x11b)]!=='string')throw new SDKError(ErrorCode[_0x11fb03(0x135)],_0x11fb03(0x136)+_0x4f7523+_0x11fb03(0x157));if(_0x263a7e[_0x11fb03(0x142)]!==undefined&&typeof _0x263a7e[_0x11fb03(0x142)]!==_0x11fb03(0x127))throw new SDKError(ErrorCode[_0x11fb03(0x135)],_0x11fb03(0x136)+_0x4f7523+_0x11fb03(0x13b));if(_0x263a7e[_0x11fb03(0x11c)]!==undefined&&typeof _0x263a7e['parent_segment']!==_0x11fb03(0x127))throw new SDKError(ErrorCode[_0x11fb03(0x135)],_0x11fb03(0x136)+_0x4f7523+_0x11fb03(0x15b));if(_0x263a7e[_0x11fb03(0x15d)]!==undefined&&typeof _0x263a7e[_0x11fb03(0x15d)]!==_0x11fb03(0x127))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x4f7523+_0x11fb03(0x14e));if(_0x263a7e[_0x11fb03(0x145)]!==undefined&&typeof _0x263a7e[_0x11fb03(0x145)]!==_0x11fb03(0x127))throw new SDKError(ErrorCode[_0x11fb03(0x135)],_0x11fb03(0x136)+_0x4f7523+_0x11fb03(0x158));return!![];}function loadProfilesFromTdxJson(_0x3a9d4d,_0x420c42){const _0x4e56d0=a65_0x4238ab;if(!a65_0x20a008[_0x4e56d0(0x165)](_0x3a9d4d))return[];try{const _0x3cd29c=a65_0x20a008['readFileSync'](_0x3a9d4d,_0x4e56d0(0x14c)),_0x1668ab=JSON[_0x4e56d0(0x143)](_0x3cd29c);if(!_0x1668ab[_0x4e56d0(0x130)]||typeof _0x1668ab[_0x4e56d0(0x130)]!=='object')return[];const _0x203359=[];for(const [_0x1f6659,_0x1791b0]of Object[_0x4e56d0(0x153)](_0x1668ab[_0x4e56d0(0x130)])){try{validateProfileConfig(_0x1791b0,_0x1f6659);const _0x550ab3=getNewCredentialPath(_0x1f6659),_0xb42b43=getOldCredentialPath(_0x1f6659),_0xda7ddd=a65_0x20a008['existsSync'](_0x550ab3)||a65_0x20a008[_0x4e56d0(0x165)](_0xb42b43);_0x203359[_0x4e56d0(0x11a)]({'name':_0x1f6659,'config':_0x1791b0,'metadata':{'name':_0x1f6659,'createdAt':new Date()[_0x4e56d0(0x120)]()},'hasCredentials':_0xda7ddd,'scope':_0x420c42});}catch(_0x1bb151){_0x1bb151 instanceof Error&&(console[_0x4e56d0(0x15e)](_0x4e56d0(0x12e)+_0x3a9d4d+':'),console['warn']('\x20\x20'+_0x1bb151[_0x4e56d0(0x124)]+'\x0a'));}}return _0x203359;}catch(_0x504bd2){return _0x504bd2 instanceof SyntaxError?(console[_0x4e56d0(0x15e)](_0x4e56d0(0x13e)+_0x3a9d4d+_0x4e56d0(0x13f)),console[_0x4e56d0(0x15e)](_0x4e56d0(0x125)+_0x504bd2[_0x4e56d0(0x124)]+'\x0a')):console['warn'](_0x4e56d0(0x132)+_0x3a9d4d+':\x20'+_0x504bd2+'\x0a'),[];}}export function getNewCredentialPath(_0x4933e7){const _0x1ff48a=a65_0x4238ab;return a65_0x2b42cd[_0x1ff48a(0x169)](getConfigDir(),_0x1ff48a(0x131)+_0x4933e7);}function getOldCredentialPath(_0x5f5395){const _0x1d26e7=a65_0x4238ab;return a65_0x2b42cd[_0x1d26e7(0x169)](getProfilesDir(),_0x5f5395,_0x1d26e7(0x148));}function loadProfilesFromTdxJsonFiles(){const _0x16397e=a65_0x4238ab,_0x165fa2=[],_0xe2100a=findProjectConfigPath();_0xe2100a&&_0x165fa2[_0x16397e(0x11a)](...loadProfilesFromTdxJson(_0xe2100a,_0x16397e(0x121)));const _0x510284=a65_0x2b42cd[_0x16397e(0x169)](getConfigDir(),_0x16397e(0x168));return _0x165fa2[_0x16397e(0x11a)](...loadProfilesFromTdxJson(_0x510284,_0x16397e(0x16b))),_0x165fa2;}function loadProfilesFromDirectories(){const _0x592799=a65_0x4238ab,_0x1e02f5=getProfilesDir();if(!a65_0x20a008[_0x592799(0x165)](_0x1e02f5))return[];try{return a65_0x20a008[_0x592799(0x14a)](_0x1e02f5,{'withFileTypes':!![]})[_0x592799(0x147)](_0x4b2c00=>_0x4b2c00[_0x592799(0x163)]())[_0x592799(0x12d)](_0x509501=>_0x509501[_0x592799(0x13c)])['filter'](_0x1971f9=>{const _0x5a2798=_0x592799,_0x257a60=getProfileConfigPath(_0x1971f9),_0x46e3f8=getProfileEnvPath(_0x1971f9);return a65_0x20a008[_0x5a2798(0x165)](_0x257a60)||a65_0x20a008[_0x5a2798(0x165)](_0x46e3f8);})[_0x592799(0x12d)](_0x41da97=>{const _0x920451=_0x592799,_0x4a8dfc=loadProfileFromDirectory(_0x41da97);if(_0x4a8dfc)return{..._0x4a8dfc,'scope':_0x920451(0x15c)};return null;})[_0x592799(0x147)](_0x2255e8=>_0x2255e8!==null);}catch{return[];}}function loadProfileFromDirectory(_0x1b9f3b){const _0x98f56c=a65_0x4238ab,_0x264d12=getProfileConfigPath(_0x1b9f3b),_0x390ba4=getOldCredentialPath(_0x1b9f3b);if(!a65_0x20a008[_0x98f56c(0x165)](_0x264d12)&&!a65_0x20a008[_0x98f56c(0x165)](_0x390ba4))return null;let _0x1fd625={},_0x41f3c7={'name':_0x1b9f3b,'createdAt':new Date()[_0x98f56c(0x120)]()};if(a65_0x20a008['existsSync'](_0x264d12))try{const _0x266c67=a65_0x20a008[_0x98f56c(0x129)](_0x264d12,'utf-8'),_0x3dc2df=JSON['parse'](_0x266c67),{metadata:_0x4c65ae,..._0x26aa7a}=_0x3dc2df;_0x1fd625=_0x26aa7a,_0x4c65ae&&(_0x41f3c7=_0x4c65ae);}catch{}return{'name':_0x1b9f3b,'config':_0x1fd625,'metadata':_0x41f3c7,'hasCredentials':a65_0x20a008['existsSync'](_0x390ba4),'scope':_0x98f56c(0x15c)};}export function listProfiles(){const _0x48697c=a65_0x4238ab,_0x1296df=loadProfilesFromTdxJsonFiles(),_0xfacc30=loadProfilesFromDirectories();if(_0xfacc30[_0x48697c(0x11e)]>0x0){const _0x2534f4=_0xfacc30['map'](_0x39de56=>_0x39de56[_0x48697c(0x13c)])[_0x48697c(0x169)](',\x20'),_0x18b0f5=getConfigDir();console[_0x48697c(0x15e)](_0x48697c(0x164)+_0x2534f4),console[_0x48697c(0x15e)](_0x48697c(0x146)),console['warn'](_0x48697c(0x137)+a65_0x2b42cd[_0x48697c(0x169)](_0x18b0f5,_0x48697c(0x168))),console['warn'](_0x48697c(0x141)),console[_0x48697c(0x15e)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x5debac=[..._0x1296df,..._0xfacc30],_0x5bd5a6=new Map();for(const _0x39b793 of _0x5debac){!_0x5bd5a6['has'](_0x39b793[_0x48697c(0x13c)])&&_0x5bd5a6['set'](_0x39b793[_0x48697c(0x13c)],_0x39b793);}return Array[_0x48697c(0x134)](_0x5bd5a6[_0x48697c(0x151)]())[_0x48697c(0x12c)]((_0x443c03,_0x3c8206)=>_0x443c03['name'][_0x48697c(0x16a)](_0x3c8206[_0x48697c(0x13c)]));}export function profileExists(_0x4db75e){const _0x545f2d=a65_0x4238ab,_0x11de26=listProfiles();return _0x11de26[_0x545f2d(0x152)](_0x5d2f4e=>_0x5d2f4e['name']===_0x4db75e);}export function loadProfile(_0x2d5cfa){const _0x38e4a3=a65_0x4238ab;validateProfileName(_0x2d5cfa);const _0x4a1cd1=listProfiles(),_0x26f250=_0x4a1cd1[_0x38e4a3(0x14d)](_0x58bae8=>_0x58bae8[_0x38e4a3(0x13c)]===_0x2d5cfa);return _0x26f250||null;}export function saveProfile(_0x5251f6,_0x1eb1c3,_0x4371b2=![]){saveProfileToUserConfig(_0x5251f6,_0x1eb1c3);}export function deleteProfile(_0x41bd7f){const _0x40f14c=a65_0x4238ab;validateProfileName(_0x41bd7f);const _0x363d0b=getProfileDir(_0x41bd7f);if(!a65_0x20a008['existsSync'](_0x363d0b))throw new Error(_0x40f14c(0x140)+_0x41bd7f+'\x20does\x20not\x20exist');a65_0x20a008[_0x40f14c(0x159)](_0x363d0b,{'recursive':!![],'force':!![]});}function a65_0x4ef5(){const _0x35a111=['\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','directory','llm_project','warn','Warning:\x20Profile\x20\x27','7924482rgNvMZ','664272BjgNie','To\x20migrate:','isDirectory','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','existsSync','1376848VNtwfS','150461ycuXpy','tdx.json','join','localeCompare','user','@tdx-studio','4LdBpAD','push','site','parent_segment','671520pVUzhO','length','458584rUzfqm','toISOString','local','\x27\x20will\x20be\x20ignored','\x27:\x20unknown\x20config\x20key\x20\x27','message','Error:\x20','Failed\x20to\x20parse\x20','string','object','readFileSync','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27',',\x20creating\x20new\x20file','sort','map','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x27:\x20config\x20must\x20be\x20an\x20object','profiles','.env.','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','Invalid\x20profile\x20name:\x20','from','INVALID_PROFILE_CONFIG','Profile\x20\x27','\x20\x201.\x20Edit:\x20','test','stringify','profile','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','name','includes','\x0aWarning:\x20Failed\x20to\x20parse\x20',':\x20Invalid\x20JSON\x20syntax','Profile\x20','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','database','parse','30138BgjCQw','llm_agent','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','filter','.env','\x20already\x20exists','readdirSync','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','utf-8','find','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','description','220kxhcrI','values','some','entries','\x20does\x20not\x20exist','\x20\x20mv\x20\x22','Warning:\x20Failed\x20to\x20parse\x20','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','rmSync','keys'];a65_0x4ef5=function(){return _0x35a111;};return a65_0x4ef5();}export function saveProfileToUserConfig(_0x5503e6,_0x5afb8a){const _0x272649=a65_0x4238ab;validateProfileName(_0x5503e6);const _0x287a0a=getGlobalConfigPath(),_0x5ea2f2=getConfigDir();!a65_0x20a008[_0x272649(0x165)](_0x5ea2f2)&&createSecureDirectory(_0x5ea2f2);let _0x4a5b89={};if(a65_0x20a008[_0x272649(0x165)](_0x287a0a))try{const _0x1cdc59=a65_0x20a008[_0x272649(0x129)](_0x287a0a,'utf-8');_0x4a5b89=JSON['parse'](_0x1cdc59);}catch{console[_0x272649(0x15e)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x287a0a+_0x272649(0x12b));}!_0x4a5b89[_0x272649(0x130)]&&(_0x4a5b89[_0x272649(0x130)]={}),_0x4a5b89[_0x272649(0x130)][_0x5503e6]=_0x5afb8a,writeSecureFile(_0x287a0a,JSON[_0x272649(0x139)](_0x4a5b89,null,0x2));}export function removeProfileFromUserConfig(_0x15aa89){const _0x5eea6a=a65_0x4238ab;validateProfileName(_0x15aa89);const _0x2867b0=getGlobalConfigPath();if(!a65_0x20a008[_0x5eea6a(0x165)](_0x2867b0))throw new Error(_0x5eea6a(0x136)+_0x15aa89+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x1fa083={};try{const _0x41e1bc=a65_0x20a008[_0x5eea6a(0x129)](_0x2867b0,_0x5eea6a(0x14c));_0x1fa083=JSON[_0x5eea6a(0x143)](_0x41e1bc);}catch{throw new Error(_0x5eea6a(0x126)+_0x2867b0);}if(!_0x1fa083[_0x5eea6a(0x130)]||!_0x1fa083[_0x5eea6a(0x130)][_0x15aa89])throw new Error(_0x5eea6a(0x136)+_0x15aa89+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x1fa083[_0x5eea6a(0x130)][_0x15aa89],_0x1fa083[_0x5eea6a(0x13a)]===_0x15aa89&&delete _0x1fa083[_0x5eea6a(0x13a)],writeSecureFile(_0x2867b0,JSON['stringify'](_0x1fa083,null,0x2));}export function getActiveProfile(){const _0x548a99=a65_0x4238ab,_0x1cf25d=loadSessionContext();if(_0x1cf25d?.[_0x548a99(0x13a)])return _0x1cf25d[_0x548a99(0x13a)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0xdac08=getGlobalConfigPath();if(!a65_0x20a008['existsSync'](_0xdac08))return null;try{const _0xeae082=a65_0x20a008[_0x548a99(0x129)](_0xdac08,_0x548a99(0x14c)),_0x30cdd5=JSON[_0x548a99(0x143)](_0xeae082);return _0x30cdd5[_0x548a99(0x13a)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x5228b5){const _0x5669aa=a65_0x4238ab,_0x2b98a8=getGlobalConfigPath(),_0x22bd2f=getConfigDir();!a65_0x20a008[_0x5669aa(0x165)](_0x22bd2f)&&createSecureDirectory(_0x22bd2f);let _0xfac728={};if(a65_0x20a008['existsSync'](_0x2b98a8))try{const _0x4147e4=a65_0x20a008['readFileSync'](_0x2b98a8,_0x5669aa(0x14c));_0xfac728=JSON[_0x5669aa(0x143)](_0x4147e4);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x2b98a8+_0x5669aa(0x12b));}_0xfac728['site']=_0x5228b5,writeSecureFile(_0x2b98a8,JSON[_0x5669aa(0x139)](_0xfac728,null,0x2));}export function saveActiveProfileToUserConfig(_0x1a3d23){const _0x434ca2=a65_0x4238ab;validateProfileName(_0x1a3d23);const _0x562ec8=getGlobalConfigPath(),_0x51fd6b=getConfigDir();!a65_0x20a008[_0x434ca2(0x165)](_0x51fd6b)&&createSecureDirectory(_0x51fd6b);let _0x1faa9a={};if(a65_0x20a008[_0x434ca2(0x165)](_0x562ec8))try{const _0x7065c2=a65_0x20a008['readFileSync'](_0x562ec8,'utf-8');_0x1faa9a=JSON['parse'](_0x7065c2);}catch{console['warn'](_0x434ca2(0x156)+_0x562ec8+_0x434ca2(0x12b));}_0x1faa9a['profile']=_0x1a3d23,writeSecureFile(_0x562ec8,JSON['stringify'](_0x1faa9a,null,0x2));}function clearFieldFromUserConfig(_0x2e20c4){const _0x4e36f8=a65_0x4238ab,_0x401545=getGlobalConfigPath();if(!a65_0x20a008[_0x4e36f8(0x165)](_0x401545))return;let _0x157e9c={};try{const _0x191496=a65_0x20a008[_0x4e36f8(0x129)](_0x401545,_0x4e36f8(0x14c));_0x157e9c=JSON[_0x4e36f8(0x143)](_0x191496);}catch{return;}delete _0x157e9c[_0x2e20c4],writeSecureFile(_0x401545,JSON[_0x4e36f8(0x139)](_0x157e9c,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x193feb=a65_0x4238ab;clearFieldFromUserConfig(_0x193feb(0x11b));}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x14c3f9,_0x25e3f8){const _0x1fa7c5=a65_0x4238ab;validateProfileName(_0x14c3f9);if(profileExists(_0x14c3f9))throw new Error(_0x1fa7c5(0x140)+_0x14c3f9+_0x1fa7c5(0x149));saveProfile(_0x14c3f9,_0x25e3f8);}export function saveProfileCredentials(_0x5ea30d,_0xfe7e5c){const _0x4dd057=a65_0x4238ab;validateProfileName(_0x5ea30d);if(!profileExists(_0x5ea30d))throw new Error(_0x4dd057(0x140)+_0x5ea30d+_0x4dd057(0x154));const _0x5baf72=getNewCredentialPath(_0x5ea30d);writeSecureFile(_0x5baf72,_0xfe7e5c);}export function loadProfileCredentials(_0x1bf9f6){const _0x45eb7e=a65_0x4238ab;validateProfileName(_0x1bf9f6);const _0x38fbd5=getNewCredentialPath(_0x1bf9f6);if(a65_0x20a008[_0x45eb7e(0x165)](_0x38fbd5))try{return a65_0x20a008[_0x45eb7e(0x129)](_0x38fbd5,_0x45eb7e(0x14c));}catch{}const _0x5a9064=getOldCredentialPath(_0x1bf9f6);if(a65_0x20a008['existsSync'](_0x5a9064)){console[_0x45eb7e(0x15e)](_0x45eb7e(0x12a)+_0x1bf9f6+'\x27'),console[_0x45eb7e(0x15e)](_0x45eb7e(0x162)),console[_0x45eb7e(0x15e)](_0x45eb7e(0x155)+_0x5a9064+'\x22\x20\x22'+_0x38fbd5+'\x22'),console[_0x45eb7e(0x15e)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a65_0x20a008[_0x45eb7e(0x129)](_0x5a9064,_0x45eb7e(0x14c));}catch{return null;}}return null;}
1
+ const a65_0xc765c3=a65_0x1d1b;(function(_0x2d7139,_0x270d17){const _0x43ce26=a65_0x1d1b,_0x24f180=_0x2d7139();while(!![]){try{const _0x9239e0=parseInt(_0x43ce26(0x121))/0x1+-parseInt(_0x43ce26(0xe8))/0x2+-parseInt(_0x43ce26(0xf4))/0x3+-parseInt(_0x43ce26(0xf2))/0x4+-parseInt(_0x43ce26(0x11d))/0x5*(-parseInt(_0x43ce26(0x122))/0x6)+parseInt(_0x43ce26(0x126))/0x7+parseInt(_0x43ce26(0xe2))/0x8;if(_0x9239e0===_0x270d17)break;else _0x24f180['push'](_0x24f180['shift']());}catch(_0x572173){_0x24f180['push'](_0x24f180['shift']());}}}(a65_0x491f,0x88f0b));import*as a65_0x263f5b from'node:fs';import*as a65_0xd93fcb from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a65_0xc765c3(0xe9);export function getProfileParams(_0x2c5852){const _0x82ed06=a65_0xc765c3,_0xd06600={};if(!_0x2c5852)return _0xd06600;for(const [_0x3a0c43,_0x1c82c2]of Object[_0x82ed06(0x112)](_0x2c5852)){_0x3a0c43!==_0x82ed06(0x10f)&&_0x1c82c2!==undefined&&(_0xd06600[_0x3a0c43]=_0x1c82c2);}return _0xd06600;}export function getProfilesDir(){const _0x5ca645=a65_0xc765c3;return a65_0xd93fcb[_0x5ca645(0xe4)](getConfigDir(),_0x5ca645(0xee));}function getProfileDir(_0x3e6947){return a65_0xd93fcb['join'](getProfilesDir(),_0x3e6947);}function getProfileConfigPath(_0x2cc967){const _0x5243ba=a65_0xc765c3;return a65_0xd93fcb[_0x5243ba(0xe4)](getProfileDir(_0x2cc967),_0x5243ba(0xf9));}function a65_0x1d1b(_0x45a635,_0x5e1dea){_0x45a635=_0x45a635-0xda;const _0x491f23=a65_0x491f();let _0x1d1b27=_0x491f23[_0x45a635];return _0x1d1b27;}function getProfileEnvPath(_0x56cedf){const _0x3513a0=a65_0xc765c3;return a65_0xd93fcb[_0x3513a0(0xe4)](getProfileDir(_0x56cedf),'.env');}function getGlobalConfigPath(){const _0x2b68d2=a65_0xc765c3;return a65_0xd93fcb[_0x2b68d2(0xe4)](getConfigDir(),_0x2b68d2(0xf9));}function validateProfileName(_0x2c4875){const _0x398c06=a65_0xc765c3;if(/^@?[a-zA-Z0-9_-]+$/[_0x398c06(0xe7)](_0x2c4875))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x398c06(0xe7)](_0x2c4875))return;throw new Error(_0x398c06(0x110)+_0x2c4875+_0x398c06(0xfe));}function validateProfileConfig(_0x4e4176,_0x5a0bba){const _0x515854=a65_0xc765c3;if(typeof _0x4e4176!==_0x515854(0xe5)||_0x4e4176===null)throw new SDKError(ErrorCode[_0x515854(0x118)],'Profile\x20\x27'+_0x5a0bba+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x55e4f3=['description',_0x515854(0xda),_0x515854(0x119),_0x515854(0x120),_0x515854(0x109),_0x515854(0x111),_0x515854(0xfb)],_0x1d940a=_0x4e4176;for(const _0x3d2958 of Object[_0x515854(0xe1)](_0x1d940a)){!_0x55e4f3[_0x515854(0x100)](_0x3d2958)&&console[_0x515854(0xf0)](_0x515854(0xdc)+_0x5a0bba+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x3d2958+'\x27\x20will\x20be\x20ignored');}if(_0x1d940a[_0x515854(0x10f)]!==undefined&&typeof _0x1d940a['description']!==_0x515854(0xfa))throw new SDKError(ErrorCode[_0x515854(0x118)],_0x515854(0xdb)+_0x5a0bba+_0x515854(0x123));if(_0x1d940a['site']!==undefined&&typeof _0x1d940a[_0x515854(0xda)]!=='string')throw new SDKError(ErrorCode[_0x515854(0x118)],_0x515854(0xdb)+_0x5a0bba+_0x515854(0x117));if(_0x1d940a[_0x515854(0x119)]!==undefined&&typeof _0x1d940a['database']!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x5a0bba+_0x515854(0x10a));if(_0x1d940a[_0x515854(0x120)]!==undefined&&typeof _0x1d940a[_0x515854(0x120)]!==_0x515854(0xfa))throw new SDKError(ErrorCode[_0x515854(0x118)],_0x515854(0xdb)+_0x5a0bba+_0x515854(0x11b));if(_0x1d940a[_0x515854(0x109)]!==undefined&&typeof _0x1d940a['llm_project']!==_0x515854(0xfa))throw new SDKError(ErrorCode[_0x515854(0x118)],'Profile\x20\x27'+_0x5a0bba+_0x515854(0x10d));if(_0x1d940a[_0x515854(0x111)]!==undefined&&typeof _0x1d940a[_0x515854(0x111)]!==_0x515854(0xfa))throw new SDKError(ErrorCode[_0x515854(0x118)],_0x515854(0xdb)+_0x5a0bba+_0x515854(0x125));return!![];}function loadProfilesFromTdxJson(_0x7cee83,_0x2d09a3){const _0x5926e0=a65_0xc765c3;if(!a65_0x263f5b[_0x5926e0(0x113)](_0x7cee83))return[];try{const _0x1e5959=a65_0x263f5b[_0x5926e0(0xed)](_0x7cee83,'utf-8'),_0x5845a1=JSON[_0x5926e0(0xf6)](_0x1e5959);if(!_0x5845a1['profiles']||typeof _0x5845a1[_0x5926e0(0xee)]!==_0x5926e0(0xe5))return[];const _0x20a9a8=[];for(const [_0x8bb761,_0x3972e4]of Object['entries'](_0x5845a1['profiles'])){try{validateProfileConfig(_0x3972e4,_0x8bb761);const _0x3821c8=getNewCredentialPath(_0x8bb761),_0x491701=getOldCredentialPath(_0x8bb761),_0x2461eb=a65_0x263f5b[_0x5926e0(0x113)](_0x3821c8)||a65_0x263f5b[_0x5926e0(0x113)](_0x491701);_0x20a9a8[_0x5926e0(0x105)]({'name':_0x8bb761,'config':_0x3972e4,'metadata':{'name':_0x8bb761,'createdAt':new Date()[_0x5926e0(0xfc)]()},'hasCredentials':_0x2461eb,'scope':_0x2d09a3});}catch(_0x476e83){_0x476e83 instanceof Error&&(console[_0x5926e0(0xf0)](_0x5926e0(0xdf)+_0x7cee83+':'),console[_0x5926e0(0xf0)]('\x20\x20'+_0x476e83[_0x5926e0(0xe0)]+'\x0a'));}}return _0x20a9a8;}catch(_0x2570bc){return _0x2570bc instanceof SyntaxError?(console[_0x5926e0(0xf0)](_0x5926e0(0x11a)+_0x7cee83+_0x5926e0(0x127)),console['warn'](_0x5926e0(0x11c)+_0x2570bc[_0x5926e0(0xe0)]+'\x0a')):console[_0x5926e0(0xf0)](_0x5926e0(0xfd)+_0x7cee83+':\x20'+_0x2570bc+'\x0a'),[];}}export function getNewCredentialPath(_0x1bdd12){const _0x39714e=a65_0xc765c3;return a65_0xd93fcb['join'](getConfigDir(),_0x39714e(0x102)+_0x1bdd12);}function getOldCredentialPath(_0x81f270){return a65_0xd93fcb['join'](getProfilesDir(),_0x81f270,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x4f91d3=a65_0xc765c3,_0x492206=[],_0x1fb9aa=findProjectConfigPath();_0x1fb9aa&&_0x492206['push'](...loadProfilesFromTdxJson(_0x1fb9aa,_0x4f91d3(0x116)));const _0x431154=a65_0xd93fcb[_0x4f91d3(0xe4)](getConfigDir(),_0x4f91d3(0xf9));return _0x492206[_0x4f91d3(0x105)](...loadProfilesFromTdxJson(_0x431154,'user')),_0x492206;}function loadProfilesFromDirectories(){const _0x33d554=a65_0xc765c3,_0x1fad81=getProfilesDir();if(!a65_0x263f5b['existsSync'](_0x1fad81))return[];try{return a65_0x263f5b[_0x33d554(0xf1)](_0x1fad81,{'withFileTypes':!![]})[_0x33d554(0x104)](_0x1be6bc=>_0x1be6bc[_0x33d554(0x10b)]())['map'](_0x5dd532=>_0x5dd532[_0x33d554(0xf8)])[_0x33d554(0x104)](_0x137b31=>{const _0x50baf2=_0x33d554,_0xb8d00e=getProfileConfigPath(_0x137b31),_0x1bae5a=getProfileEnvPath(_0x137b31);return a65_0x263f5b[_0x50baf2(0x113)](_0xb8d00e)||a65_0x263f5b[_0x50baf2(0x113)](_0x1bae5a);})['map'](_0x1a14e4=>{const _0x167063=_0x33d554,_0x1cd4c3=loadProfileFromDirectory(_0x1a14e4);if(_0x1cd4c3)return{..._0x1cd4c3,'scope':_0x167063(0xe3)};return null;})['filter'](_0x3381dd=>_0x3381dd!==null);}catch{return[];}}function loadProfileFromDirectory(_0xb0c7cb){const _0x1bb94b=a65_0xc765c3,_0x330188=getProfileConfigPath(_0xb0c7cb),_0x412ccb=getOldCredentialPath(_0xb0c7cb);if(!a65_0x263f5b[_0x1bb94b(0x113)](_0x330188)&&!a65_0x263f5b[_0x1bb94b(0x113)](_0x412ccb))return null;let _0x543423={},_0x4c4792={'name':_0xb0c7cb,'createdAt':new Date()[_0x1bb94b(0xfc)]()};if(a65_0x263f5b['existsSync'](_0x330188))try{const _0x318631=a65_0x263f5b['readFileSync'](_0x330188,_0x1bb94b(0x106)),_0x4e2edd=JSON[_0x1bb94b(0xf6)](_0x318631),{metadata:_0x70e59a,..._0x18e864}=_0x4e2edd;_0x543423=_0x18e864,_0x70e59a&&(_0x4c4792=_0x70e59a);}catch{}return{'name':_0xb0c7cb,'config':_0x543423,'metadata':_0x4c4792,'hasCredentials':a65_0x263f5b[_0x1bb94b(0x113)](_0x412ccb),'scope':_0x1bb94b(0xe3)};}export function listProfiles(){const _0xb93bec=a65_0xc765c3,_0x1068af=loadProfilesFromTdxJsonFiles(),_0x12d6a7=loadProfilesFromDirectories();if(_0x12d6a7[_0xb93bec(0x10e)]>0x0){const _0x1629fe=_0x12d6a7[_0xb93bec(0x103)](_0x1e5cea=>_0x1e5cea[_0xb93bec(0xf8)])['join'](',\x20'),_0x242928=getConfigDir();console[_0xb93bec(0xf0)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x1629fe),console[_0xb93bec(0xf0)](_0xb93bec(0x115)),console[_0xb93bec(0xf0)]('\x20\x201.\x20Edit:\x20'+a65_0xd93fcb[_0xb93bec(0xe4)](_0x242928,_0xb93bec(0xf9))),console['warn'](_0xb93bec(0xeb)),console[_0xb93bec(0xf0)](_0xb93bec(0xdd));}const _0x41e18a=[..._0x1068af,..._0x12d6a7],_0xff0891=new Map();for(const _0x3ca2bd of _0x41e18a){!_0xff0891[_0xb93bec(0xff)](_0x3ca2bd[_0xb93bec(0xf8)])&&_0xff0891[_0xb93bec(0x11e)](_0x3ca2bd['name'],_0x3ca2bd);}return Array[_0xb93bec(0x101)](_0xff0891[_0xb93bec(0x107)]())[_0xb93bec(0xe6)]((_0x595b76,_0x5539f0)=>_0x595b76['name'][_0xb93bec(0x11f)](_0x5539f0[_0xb93bec(0xf8)]));}export function profileExists(_0x46abca){const _0x133d27=a65_0xc765c3,_0x497086=listProfiles();return _0x497086['some'](_0x29fd8c=>_0x29fd8c[_0x133d27(0xf8)]===_0x46abca);}export function loadProfile(_0x22c727){const _0x4a7f03=a65_0xc765c3;validateProfileName(_0x22c727);const _0x5d7583=listProfiles(),_0x650fd=_0x5d7583['find'](_0xdaac84=>_0xdaac84[_0x4a7f03(0xf8)]===_0x22c727);return _0x650fd||null;}export function saveProfile(_0x35b630,_0x588305,_0x5c95a3=![]){saveProfileToUserConfig(_0x35b630,_0x588305);}function a65_0x491f(){const _0x386578=['set','localeCompare','parent_segment','745334nwfwBE','32652UaMDod','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x27\x20not\x20found\x20in\x20user\x20configuration','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','6034637vMOkJE',':\x20Invalid\x20JSON\x20syntax','site','Profile\x20\x27','Warning:\x20Profile\x20\x27','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','stringify','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','message','keys','10203968MrzTxd','directory','join','object','sort','test','783744AgUOFs','@tdx-studio','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','\x20does\x20not\x20exist','readFileSync','profiles','\x20already\x20exists','warn','readdirSync','4375108wpimFh',',\x20creating\x20new\x20file','2672355ttEZLj','Profile\x20','parse','Failed\x20to\x20parse\x20','name','tdx.json','string','user_info','toISOString','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','has','includes','from','.env.','map','filter','push','utf-8','values','Warning:\x20Failed\x20to\x20parse\x20','llm_project','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','isDirectory','profile','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','length','description','Invalid\x20profile\x20name:\x20','llm_agent','entries','existsSync','\x20\x20mv\x20\x22','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','local','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','INVALID_PROFILE_CONFIG','database','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Error:\x20','50xGNlnZ'];a65_0x491f=function(){return _0x386578;};return a65_0x491f();}export function deleteProfile(_0x134d42){const _0x48195c=a65_0xc765c3;validateProfileName(_0x134d42);const _0x20d7ac=getProfileDir(_0x134d42);if(!a65_0x263f5b[_0x48195c(0x113)](_0x20d7ac))throw new Error(_0x48195c(0xf5)+_0x134d42+_0x48195c(0xec));a65_0x263f5b['rmSync'](_0x20d7ac,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x1df3d4,_0x566ebe){const _0x2e63a9=a65_0xc765c3;validateProfileName(_0x1df3d4);const _0x5b549d=getGlobalConfigPath(),_0x35a4d3=getConfigDir();!a65_0x263f5b['existsSync'](_0x35a4d3)&&createSecureDirectory(_0x35a4d3);let _0x230545={};if(a65_0x263f5b['existsSync'](_0x5b549d))try{const _0x2f63e2=a65_0x263f5b[_0x2e63a9(0xed)](_0x5b549d,_0x2e63a9(0x106));_0x230545=JSON[_0x2e63a9(0xf6)](_0x2f63e2);}catch{console[_0x2e63a9(0xf0)](_0x2e63a9(0x108)+_0x5b549d+_0x2e63a9(0xf3));}!_0x230545[_0x2e63a9(0xee)]&&(_0x230545[_0x2e63a9(0xee)]={}),_0x230545[_0x2e63a9(0xee)][_0x1df3d4]=_0x566ebe,writeSecureFile(_0x5b549d,JSON[_0x2e63a9(0xde)](_0x230545,null,0x2));}export function removeProfileFromUserConfig(_0x12e19c){const _0xe5e191=a65_0xc765c3;validateProfileName(_0x12e19c);const _0x44b61d=getGlobalConfigPath();if(!a65_0x263f5b[_0xe5e191(0x113)](_0x44b61d))throw new Error(_0xe5e191(0xdb)+_0x12e19c+_0xe5e191(0x124));let _0x294b09={};try{const _0x489d2b=a65_0x263f5b[_0xe5e191(0xed)](_0x44b61d,_0xe5e191(0x106));_0x294b09=JSON['parse'](_0x489d2b);}catch{throw new Error(_0xe5e191(0xf7)+_0x44b61d);}if(!_0x294b09['profiles']||!_0x294b09[_0xe5e191(0xee)][_0x12e19c])throw new Error(_0xe5e191(0xdb)+_0x12e19c+_0xe5e191(0x124));delete _0x294b09[_0xe5e191(0xee)][_0x12e19c],_0x294b09[_0xe5e191(0x10c)]===_0x12e19c&&delete _0x294b09['profile'],writeSecureFile(_0x44b61d,JSON[_0xe5e191(0xde)](_0x294b09,null,0x2));}export function getActiveProfile(){const _0x2cb7c8=a65_0xc765c3,_0x47c880=loadSessionContext();if(_0x47c880?.[_0x2cb7c8(0x10c)])return _0x47c880[_0x2cb7c8(0x10c)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x6c4527=getGlobalConfigPath();if(!a65_0x263f5b[_0x2cb7c8(0x113)](_0x6c4527))return null;try{const _0x26e54b=a65_0x263f5b[_0x2cb7c8(0xed)](_0x6c4527,_0x2cb7c8(0x106)),_0x45888f=JSON[_0x2cb7c8(0xf6)](_0x26e54b);return _0x45888f[_0x2cb7c8(0x10c)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x546062){const _0x248241=a65_0xc765c3,_0x5078be=getGlobalConfigPath(),_0x4bee85=getConfigDir();!a65_0x263f5b[_0x248241(0x113)](_0x4bee85)&&createSecureDirectory(_0x4bee85);let _0x43670d={};if(a65_0x263f5b[_0x248241(0x113)](_0x5078be))try{const _0xab53c6=a65_0x263f5b[_0x248241(0xed)](_0x5078be,'utf-8');_0x43670d=JSON[_0x248241(0xf6)](_0xab53c6);}catch{console[_0x248241(0xf0)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x5078be+',\x20creating\x20new\x20file');}_0x43670d['site']=_0x546062,writeSecureFile(_0x5078be,JSON[_0x248241(0xde)](_0x43670d,null,0x2));}export function saveActiveProfileToUserConfig(_0x1c2ebe){const _0x5a4813=a65_0xc765c3;validateProfileName(_0x1c2ebe);const _0x295ebd=getGlobalConfigPath(),_0x1582df=getConfigDir();!a65_0x263f5b[_0x5a4813(0x113)](_0x1582df)&&createSecureDirectory(_0x1582df);let _0x40a309={};if(a65_0x263f5b[_0x5a4813(0x113)](_0x295ebd))try{const _0x279bc2=a65_0x263f5b['readFileSync'](_0x295ebd,_0x5a4813(0x106));_0x40a309=JSON[_0x5a4813(0xf6)](_0x279bc2);}catch{console['warn'](_0x5a4813(0x108)+_0x295ebd+_0x5a4813(0xf3));}_0x40a309[_0x5a4813(0x10c)]=_0x1c2ebe,writeSecureFile(_0x295ebd,JSON[_0x5a4813(0xde)](_0x40a309,null,0x2));}function clearFieldFromUserConfig(_0x5ad726){const _0x4ace8b=a65_0xc765c3,_0x3aeaf1=getGlobalConfigPath();if(!a65_0x263f5b[_0x4ace8b(0x113)](_0x3aeaf1))return;let _0x48f964={};try{const _0x11dac7=a65_0x263f5b[_0x4ace8b(0xed)](_0x3aeaf1,_0x4ace8b(0x106));_0x48f964=JSON[_0x4ace8b(0xf6)](_0x11dac7);}catch{return;}delete _0x48f964[_0x5ad726],writeSecureFile(_0x3aeaf1,JSON[_0x4ace8b(0xde)](_0x48f964,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x1d9dac=a65_0xc765c3;clearFieldFromUserConfig(_0x1d9dac(0xda));}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x4937f3,_0x374ca9){const _0xd2728d=a65_0xc765c3;validateProfileName(_0x4937f3);if(profileExists(_0x4937f3))throw new Error(_0xd2728d(0xf5)+_0x4937f3+_0xd2728d(0xef));saveProfile(_0x4937f3,_0x374ca9);}export function saveProfileCredentials(_0x23ff52,_0x733be4){const _0x3e90a9=a65_0xc765c3;validateProfileName(_0x23ff52);if(!profileExists(_0x23ff52))throw new Error(_0x3e90a9(0xf5)+_0x23ff52+_0x3e90a9(0xec));const _0x1743b6=getNewCredentialPath(_0x23ff52);writeSecureFile(_0x1743b6,_0x733be4);}export function loadProfileCredentials(_0x1b1842){const _0x3196e1=a65_0xc765c3;validateProfileName(_0x1b1842);const _0x3d85cd=getNewCredentialPath(_0x1b1842);if(a65_0x263f5b[_0x3196e1(0x113)](_0x3d85cd))try{return a65_0x263f5b[_0x3196e1(0xed)](_0x3d85cd,_0x3196e1(0x106));}catch{}const _0x163b6a=getOldCredentialPath(_0x1b1842);if(a65_0x263f5b[_0x3196e1(0x113)](_0x163b6a)){console['warn'](_0x3196e1(0xea)+_0x1b1842+'\x27'),console[_0x3196e1(0xf0)]('To\x20migrate:'),console[_0x3196e1(0xf0)](_0x3196e1(0x114)+_0x163b6a+'\x22\x20\x22'+_0x3d85cd+'\x22'),console[_0x3196e1(0xf0)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a65_0x263f5b[_0x3196e1(0xed)](_0x163b6a,'utf-8');}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a66_0x51d934=a66_0x338b;(function(_0x47910c,_0x4dddeb){const _0x439774=a66_0x338b,_0x4591c5=_0x47910c();while(!![]){try{const _0x17d801=parseInt(_0x439774(0x1b9))/0x1*(-parseInt(_0x439774(0x1aa))/0x2)+parseInt(_0x439774(0x1a8))/0x3+-parseInt(_0x439774(0x1a2))/0x4*(-parseInt(_0x439774(0x1b5))/0x5)+-parseInt(_0x439774(0x1ac))/0x6*(-parseInt(_0x439774(0x1b2))/0x7)+-parseInt(_0x439774(0x1b4))/0x8+-parseInt(_0x439774(0x19d))/0x9*(parseInt(_0x439774(0x1b6))/0xa)+parseInt(_0x439774(0x19b))/0xb;if(_0x17d801===_0x4dddeb)break;else _0x4591c5['push'](_0x4591c5['shift']());}catch(_0x4edbd6){_0x4591c5['push'](_0x4591c5['shift']());}}}(a66_0xc9a6,0xa0dc8));import*as a66_0x3b1cf0 from'node:fs';function a66_0xc9a6(){const _0x205cc8=['ENOENT','includes','16193OzwjcS','readFileSync','\x20is\x20ignored.\x20','existsSync','tdx.json','11393250ZuPBLE','warn','3555bvAiqc','cwd','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','code','Warning:\x20\x27profile\x27\x20field\x20in\x20','724oPYUiZ',').\x20','TD_API_KEY','dirname','stringify','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','2571372QEBLOc','apiKey','118CMPrTQ','api_key','3047742rGtotG','profile','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','join','Failed\x20to\x20load\x20project\x20config\x20from\x20','14kLbAYf','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','10188352yrDqwh','11980vdbQCV','11510bURoHA'];a66_0xc9a6=function(){return _0x205cc8;};return a66_0xc9a6();}import*as a66_0x3a3c97 from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x51d934(0x19a);export function findProjectConfigPath(_0x43cdd7){const _0x551fb2=a66_0x51d934;let _0x5c7506=_0x43cdd7||process[_0x551fb2(0x19e)]();while(!![]){const _0x4ff686=a66_0x3a3c97[_0x551fb2(0x1b0)](_0x5c7506,PROJECT_CONFIG_FILENAME);if(a66_0x3b1cf0[_0x551fb2(0x1bc)](_0x4ff686))return _0x4ff686;const _0x1a3258=a66_0x3a3c97[_0x551fb2(0x1a5)](_0x5c7506);if(_0x1a3258===_0x5c7506)return null;_0x5c7506=_0x1a3258;}}export function loadProjectConfig(_0x5aa9cd){const _0x2d2716=a66_0x51d934,_0x138f25=findProjectConfigPath(_0x5aa9cd);if(!_0x138f25)return null;try{const _0x3189cf=a66_0x3b1cf0[_0x2d2716(0x1ba)](_0x138f25,'utf-8'),_0x405a48=JSON['parse'](_0x3189cf),_0x5e1005=JSON['stringify'](_0x405a48);if(_0x5e1005[_0x2d2716(0x1b8)](_0x2d2716(0x1a4))||_0x5e1005[_0x2d2716(0x1b8)](_0x2d2716(0x1a9))||_0x5e1005[_0x2d2716(0x1b8)]('api_key'))throw new Error(_0x2d2716(0x1a7)+_0x138f25+_0x2d2716(0x1a3)+_0x2d2716(0x1b3));const {metadata:_0x4a798d,profile:_0x5dbbdd,..._0x228309}=_0x405a48;return _0x5dbbdd&&console[_0x2d2716(0x19c)](_0x2d2716(0x1a1)+_0x138f25+_0x2d2716(0x1bb)+_0x2d2716(0x1ae)),_0x228309;}catch(_0x4247c4){if(_0x4247c4 instanceof Error&&_0x2d2716(0x1a0)in _0x4247c4&&_0x4247c4[_0x2d2716(0x1a0)]===_0x2d2716(0x1b7))return null;throw new Error(_0x2d2716(0x1b1)+_0x138f25+':\x20'+_0x4247c4);}}function a66_0x338b(_0x1d0c49,_0x8c82bd){_0x1d0c49=_0x1d0c49-0x19a;const _0xc9a683=a66_0xc9a6();let _0x338b52=_0xc9a683[_0x1d0c49];return _0x338b52;}export function saveProjectConfig(_0x3a8cba,_0x3e46f1){const _0x33e8ce=a66_0x51d934,_0x1c1ba0=_0x3e46f1||process[_0x33e8ce(0x19e)](),_0x2df769=a66_0x3a3c97['join'](_0x1c1ba0,PROJECT_CONFIG_FILENAME),_0x90dd0a=JSON[_0x33e8ce(0x1a6)](_0x3a8cba);if(_0x90dd0a['includes'](_0x33e8ce(0x1a4))||_0x90dd0a['includes'](_0x33e8ce(0x1a9))||_0x90dd0a[_0x33e8ce(0x1b8)](_0x33e8ce(0x1ab)))throw new Error(_0x33e8ce(0x19f));if(_0x33e8ce(0x1ad)in _0x3a8cba)throw new Error(_0x33e8ce(0x1af));a66_0x3b1cf0['writeFileSync'](_0x2df769,JSON[_0x33e8ce(0x1a6)](_0x3a8cba,null,0x2));}export function hasProjectConfig(_0x524789){return findProjectConfigPath(_0x524789)!==null;}export function getProjectRoot(_0x5d5e5d){const _0x423038=a66_0x51d934,_0x1f5d27=findProjectConfigPath(_0x5d5e5d);return _0x1f5d27?a66_0x3a3c97[_0x423038(0x1a5)](_0x1f5d27):null;}
1
+ const a66_0x593d44=a66_0xcaa1;(function(_0x53c2a1,_0x5573e0){const _0x2561b9=a66_0xcaa1,_0x585301=_0x53c2a1();while(!![]){try{const _0x364887=parseInt(_0x2561b9(0x1bb))/0x1+parseInt(_0x2561b9(0x1b9))/0x2+parseInt(_0x2561b9(0x1a9))/0x3+-parseInt(_0x2561b9(0x1ab))/0x4*(parseInt(_0x2561b9(0x1b2))/0x5)+parseInt(_0x2561b9(0x1a6))/0x6*(parseInt(_0x2561b9(0x1a1))/0x7)+parseInt(_0x2561b9(0x1b5))/0x8+-parseInt(_0x2561b9(0x1b8))/0x9*(parseInt(_0x2561b9(0x1b4))/0xa);if(_0x364887===_0x5573e0)break;else _0x585301['push'](_0x585301['shift']());}catch(_0x17ee84){_0x585301['push'](_0x585301['shift']());}}}(a66_0x4dc4,0x9d1c9));function a66_0xcaa1(_0x4cf0ee,_0x15e1dc){_0x4cf0ee=_0x4cf0ee-0x1a1;const _0x4dc41e=a66_0x4dc4();let _0xcaa1e4=_0x4dc41e[_0x4cf0ee];return _0xcaa1e4;}import*as a66_0x2fcdbb from'node:fs';import*as a66_0x5ebb62 from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x593d44(0x1a8);export function findProjectConfigPath(_0x388210){const _0x370ca2=a66_0x593d44;let _0x4ed9d3=_0x388210||process['cwd']();while(!![]){const _0x2997f9=a66_0x5ebb62[_0x370ca2(0x1b3)](_0x4ed9d3,PROJECT_CONFIG_FILENAME);if(a66_0x2fcdbb[_0x370ca2(0x1ac)](_0x2997f9))return _0x2997f9;const _0x67916a=a66_0x5ebb62['dirname'](_0x4ed9d3);if(_0x67916a===_0x4ed9d3)return null;_0x4ed9d3=_0x67916a;}}export function loadProjectConfig(_0x3c4624){const _0x2a99f3=a66_0x593d44,_0x1afca7=findProjectConfigPath(_0x3c4624);if(!_0x1afca7)return null;try{const _0x601c85=a66_0x2fcdbb['readFileSync'](_0x1afca7,_0x2a99f3(0x1bc)),_0x1efe33=JSON[_0x2a99f3(0x1c0)](_0x601c85),_0x4b5bba=JSON[_0x2a99f3(0x1bd)](_0x1efe33);if(_0x4b5bba[_0x2a99f3(0x1aa)]('TD_API_KEY')||_0x4b5bba['includes']('apiKey')||_0x4b5bba[_0x2a99f3(0x1aa)](_0x2a99f3(0x1a4)))throw new Error(_0x2a99f3(0x1a7)+_0x1afca7+_0x2a99f3(0x1a2)+_0x2a99f3(0x1ad));const {metadata:_0x2c95ee,profile:_0x307e75,..._0x10247b}=_0x1efe33;return _0x307e75&&console[_0x2a99f3(0x1b1)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x1afca7+_0x2a99f3(0x1b6)+_0x2a99f3(0x1a3)),_0x10247b;}catch(_0x3825ed){if(_0x3825ed instanceof Error&&_0x2a99f3(0x1be)in _0x3825ed&&_0x3825ed[_0x2a99f3(0x1be)]===_0x2a99f3(0x1ba))return null;throw new Error(_0x2a99f3(0x1c1)+_0x1afca7+':\x20'+_0x3825ed);}}export function saveProjectConfig(_0x2410ff,_0x1bbfa9){const _0x53834e=a66_0x593d44,_0x58df62=_0x1bbfa9||process['cwd'](),_0xa259ee=a66_0x5ebb62[_0x53834e(0x1b3)](_0x58df62,PROJECT_CONFIG_FILENAME),_0x422be7=JSON['stringify'](_0x2410ff);if(_0x422be7[_0x53834e(0x1aa)](_0x53834e(0x1a5))||_0x422be7['includes'](_0x53834e(0x1bf))||_0x422be7[_0x53834e(0x1aa)](_0x53834e(0x1a4)))throw new Error(_0x53834e(0x1b7));if(_0x53834e(0x1af)in _0x2410ff)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a66_0x2fcdbb[_0x53834e(0x1ae)](_0xa259ee,JSON['stringify'](_0x2410ff,null,0x2));}function a66_0x4dc4(){const _0x9b1757=['62772JzIBMZ','existsSync','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','writeFileSync','profile','dirname','warn','105ddyeiM','join','13507440aJROep','5918920YRERLY','\x20is\x20ignored.\x20','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','18kFmlhk','1094574kFtkma','ENOENT','834918JptFGp','utf-8','stringify','code','apiKey','parse','Failed\x20to\x20load\x20project\x20config\x20from\x20','710444CylEnS',').\x20','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','api_key','TD_API_KEY','54hfRJcD','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','tdx.json','1917216XVbYwS','includes'];a66_0x4dc4=function(){return _0x9b1757;};return a66_0x4dc4();}export function hasProjectConfig(_0x1e7edf){return findProjectConfigPath(_0x1e7edf)!==null;}export function getProjectRoot(_0x2a83c7){const _0x5b62c9=a66_0x593d44,_0x452f0c=findProjectConfigPath(_0x2a83c7);return _0x452f0c?a66_0x5ebb62[_0x5b62c9(0x1b0)](_0x452f0c):null;}
@@ -1 +1 @@
1
- function a67_0x2de7(){const _0x2fec21=['11999808flRIHA','unlinkSync','toString','36fjUrwE','utf-8','5901973NrAkKf','toISOString','includes','writeFileSync','tdx','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','.\x20This\x20is\x20insecure.\x20Removing\x20session.','test','push','stringify','apiKey','api_key','warn','now','3853725KKwVAr','join','2531200SeiKop','homedir','.json','readdirSync','1558332pPITip','existsSync','TD_API_KEY','3140PFKrPz','replace','getTime','createdAt','parse','240aAMFSz','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','readFileSync','306093QQtQtg'];a67_0x2de7=function(){return _0x2fec21;};return a67_0x2de7();}(function(_0x3b2e41,_0x1ec245){const _0x4c4d96=a67_0x35b6,_0x26aade=_0x3b2e41();while(!![]){try{const _0x36d36f=parseInt(_0x4c4d96(0x1d2))/0x1*(parseInt(_0x4c4d96(0x1cd))/0x2)+parseInt(_0x4c4d96(0x1d5))/0x3*(parseInt(_0x4c4d96(0x1d9))/0x4)+parseInt(_0x4c4d96(0x1c4))/0x5+parseInt(_0x4c4d96(0x1ca))/0x6+-parseInt(_0x4c4d96(0x1db))/0x7+parseInt(_0x4c4d96(0x1c6))/0x8+-parseInt(_0x4c4d96(0x1d6))/0x9;if(_0x36d36f===_0x1ec245)break;else _0x26aade['push'](_0x26aade['shift']());}catch(_0x198561){_0x26aade['push'](_0x26aade['shift']());}}}(a67_0x2de7,0x71a57));import*as a67_0x1afcee from'node:fs';import*as a67_0x49cdc8 from'node:path';import*as a67_0x4d6681 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 _0x23d528=a67_0x35b6,_0x16bc1b=process.env.TDX_CONFIG_DIR||a67_0x49cdc8['join'](a67_0x4d6681[_0x23d528(0x1c7)](),'.config',_0x23d528(0x1df));return a67_0x49cdc8[_0x23d528(0x1c5)](_0x16bc1b,'sessions');}function getSessionPath(_0x1e169b){const _0x1c1e15=a67_0x35b6;return a67_0x49cdc8[_0x1c1e15(0x1c5)](getSessionsDir(),_0x1e169b+_0x1c1e15(0x1c8));}export function getCurrentSessionPID(){return getPPID();}function a67_0x35b6(_0x4e0b9b,_0x4748b7){_0x4e0b9b=_0x4e0b9b-0x1c2;const _0x2de700=a67_0x2de7();let _0x35b60d=_0x2de700[_0x4e0b9b];return _0x35b60d;}export function getSessionID(_0x5a78a4){const _0x335874=a67_0x35b6;if(_0x5a78a4)return _0x5a78a4;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x335874(0x1d8)]();}export function loadSessionContext(_0x2b460a){const _0x1d455f=getSessionID(_0x2b460a),_0xf37cad=/^\d+$/['test'](_0x1d455f)?parseInt(_0x1d455f,0xa):null;return _0xf37cad!==null?loadSessionContextByPID(_0xf37cad):loadSessionContextByString(_0x1d455f);}export function loadSessionContextByPID(_0x30c5e0){const _0x49ee84=a67_0x35b6,_0x5407da=getSessionPath(_0x30c5e0);if(!a67_0x1afcee[_0x49ee84(0x1cb)](_0x5407da))return null;try{const _0x249388=a67_0x1afcee[_0x49ee84(0x1d4)](_0x5407da,_0x49ee84(0x1da)),_0x2b7d0b=JSON[_0x49ee84(0x1d1)](_0x249388),_0x5c7f13=new Date(_0x2b7d0b['createdAt'])[_0x49ee84(0x1cf)](),_0x4acc40=Date[_0x49ee84(0x1c3)]();if(_0x4acc40-_0x5c7f13>SESSION_EXPIRATION_MS)return a67_0x1afcee['unlinkSync'](_0x5407da),null;const _0x159aea=JSON[_0x49ee84(0x1e4)](_0x2b7d0b);if(_0x159aea[_0x49ee84(0x1dd)](_0x49ee84(0x1cc))||_0x159aea['includes'](_0x49ee84(0x1e5))||_0x159aea[_0x49ee84(0x1dd)](_0x49ee84(0x1e6)))return console[_0x49ee84(0x1c2)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x5407da+_0x49ee84(0x1e1)),a67_0x1afcee[_0x49ee84(0x1d7)](_0x5407da),null;return _0x2b7d0b;}catch{try{a67_0x1afcee[_0x49ee84(0x1d7)](_0x5407da);}catch{}return null;}}function loadSessionContextByString(_0x31a18c){const _0x4c3423=a67_0x35b6,_0x1fe7e7=a67_0x49cdc8[_0x4c3423(0x1c5)](getSessionsDir(),_0x31a18c+'.json');if(!a67_0x1afcee['existsSync'](_0x1fe7e7))return null;try{const _0x158a07=a67_0x1afcee['readFileSync'](_0x1fe7e7,_0x4c3423(0x1da)),_0x377aa8=JSON[_0x4c3423(0x1d1)](_0x158a07),_0x5e7e9b=new Date(_0x377aa8[_0x4c3423(0x1d0)])[_0x4c3423(0x1cf)](),_0x12ba4e=Date[_0x4c3423(0x1c3)]();if(_0x12ba4e-_0x5e7e9b>SESSION_EXPIRATION_MS)return a67_0x1afcee[_0x4c3423(0x1d7)](_0x1fe7e7),null;const _0x269f1c=JSON[_0x4c3423(0x1e4)](_0x377aa8);if(_0x269f1c[_0x4c3423(0x1dd)](_0x4c3423(0x1cc))||_0x269f1c[_0x4c3423(0x1dd)](_0x4c3423(0x1e5))||_0x269f1c[_0x4c3423(0x1dd)]('api_key'))return console[_0x4c3423(0x1c2)](_0x4c3423(0x1e0)+_0x1fe7e7+_0x4c3423(0x1e1)),a67_0x1afcee['unlinkSync'](_0x1fe7e7),null;return _0x377aa8;}catch{try{a67_0x1afcee[_0x4c3423(0x1d7)](_0x1fe7e7);}catch{}return null;}}export function saveSessionContext(_0x4a4be0,_0x26da54){const _0x3b408a=a67_0x35b6,_0x592d70=getSessionID(_0x26da54),_0x24fe4f=/^\d+$/[_0x3b408a(0x1e2)](_0x592d70)?parseInt(_0x592d70,0xa):getCurrentSessionPID(),_0xec5ff5=a67_0x49cdc8[_0x3b408a(0x1c5)](getSessionsDir(),_0x592d70+'.json'),_0x4a2670=getSessionsDir();createSecureDirectory(_0x4a2670);const _0x282f5d=JSON[_0x3b408a(0x1e4)](_0x4a4be0);if(_0x282f5d['includes'](_0x3b408a(0x1cc))||_0x282f5d[_0x3b408a(0x1dd)](_0x3b408a(0x1e5))||_0x282f5d['includes'](_0x3b408a(0x1e6)))throw new Error(_0x3b408a(0x1d3));let _0x2d8968;const _0x81b0f3=/^\d+$/['test'](_0x592d70)?loadSessionContextByPID(parseInt(_0x592d70,0xa)):loadSessionContextByString(_0x592d70);_0x81b0f3?_0x2d8968={..._0x81b0f3,..._0x4a4be0,'pid':_0x24fe4f,'sessionId':_0x592d70!==_0x24fe4f[_0x3b408a(0x1d8)]()?_0x592d70:undefined,'updatedAt':new Date()[_0x3b408a(0x1dc)]()}:_0x2d8968={'pid':_0x24fe4f,'sessionId':_0x592d70!==_0x24fe4f[_0x3b408a(0x1d8)]()?_0x592d70:undefined,..._0x4a4be0,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x3b408a(0x1dc)]()},a67_0x1afcee['writeFileSync'](_0xec5ff5,JSON[_0x3b408a(0x1e4)](_0x2d8968,null,0x2));}export function clearSessionContext(_0x4b8527){const _0x1721ab=a67_0x35b6,_0x59eae4=getSessionID(_0x4b8527),_0x33be38=a67_0x49cdc8[_0x1721ab(0x1c5)](getSessionsDir(),_0x59eae4+_0x1721ab(0x1c8));a67_0x1afcee[_0x1721ab(0x1cb)](_0x33be38)&&a67_0x1afcee[_0x1721ab(0x1d7)](_0x33be38);}export function clearSessionContextField(_0x3f9d8a,_0x2f2926){const _0x3a647a=a67_0x35b6,_0xbcfa74=getSessionID(_0x2f2926),_0x4f7576=a67_0x49cdc8[_0x3a647a(0x1c5)](getSessionsDir(),_0xbcfa74+'.json');if(!a67_0x1afcee[_0x3a647a(0x1cb)](_0x4f7576))return;try{const _0x27068c=a67_0x1afcee['readFileSync'](_0x4f7576,'utf-8'),_0x27b168=JSON['parse'](_0x27068c);delete _0x27b168[_0x3f9d8a],a67_0x1afcee[_0x3a647a(0x1de)](_0x4f7576,JSON[_0x3a647a(0x1e4)](_0x27b168,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x565cf9=a67_0x35b6,_0x4699f7=getSessionsDir();if(!a67_0x1afcee[_0x565cf9(0x1cb)](_0x4699f7))return 0x0;let _0xf541e=0x0;const _0x3fc969=Date[_0x565cf9(0x1c3)]();try{const _0x1ee30e=a67_0x1afcee['readdirSync'](_0x4699f7);for(const _0x3d3dd1 of _0x1ee30e){if(!_0x3d3dd1['endsWith'](_0x565cf9(0x1c8)))continue;const _0x34491d=a67_0x49cdc8[_0x565cf9(0x1c5)](_0x4699f7,_0x3d3dd1),_0x25ca00=_0x3d3dd1['replace'](_0x565cf9(0x1c8),''),_0x152c60=parseInt(_0x25ca00,0xa),_0x60f7a=!isNaN(_0x152c60);if(_0x60f7a){if(!isProcessRunning(_0x152c60)){a67_0x1afcee[_0x565cf9(0x1d7)](_0x34491d),_0xf541e++;continue;}}try{const _0xbd7df0=a67_0x1afcee[_0x565cf9(0x1d4)](_0x34491d,'utf-8'),_0x3f282f=JSON[_0x565cf9(0x1d1)](_0xbd7df0),_0x23ee8f=new Date(_0x3f282f[_0x565cf9(0x1d0)])[_0x565cf9(0x1cf)]();_0x3fc969-_0x23ee8f>SESSION_EXPIRATION_MS&&(a67_0x1afcee['unlinkSync'](_0x34491d),_0xf541e++);}catch{a67_0x1afcee[_0x565cf9(0x1d7)](_0x34491d),_0xf541e++;}}}catch{}return _0xf541e;}export function listActiveSessions(){const _0x3586c9=a67_0x35b6,_0x2bc3af=getSessionsDir();if(!a67_0x1afcee[_0x3586c9(0x1cb)](_0x2bc3af))return[];try{const _0x3e6d97=a67_0x1afcee[_0x3586c9(0x1c9)](_0x2bc3af),_0x35f978=[];for(const _0x3127ed of _0x3e6d97){if(!_0x3127ed['endsWith']('.json'))continue;const _0x353e81=_0x3127ed[_0x3586c9(0x1ce)](_0x3586c9(0x1c8),''),_0xe85fc0=parseInt(_0x353e81,0xa);!isNaN(_0xe85fc0)&&isProcessRunning(_0xe85fc0)&&_0x35f978[_0x3586c9(0x1e3)](_0xe85fc0);}return _0x35f978['sort']((_0x3f3f49,_0x29bd19)=>_0x3f3f49-_0x29bd19);}catch{return[];}}
1
+ (function(_0x5a7a44,_0x42b3e1){const _0x462eb2=a67_0xe0ab,_0x2ccfa4=_0x5a7a44();while(!![]){try{const _0x2c5d37=parseInt(_0x462eb2(0xb1))/0x1+-parseInt(_0x462eb2(0xd1))/0x2+parseInt(_0x462eb2(0xd3))/0x3*(parseInt(_0x462eb2(0xd6))/0x4)+parseInt(_0x462eb2(0xb5))/0x5*(-parseInt(_0x462eb2(0xb9))/0x6)+parseInt(_0x462eb2(0xc6))/0x7+-parseInt(_0x462eb2(0xcc))/0x8+parseInt(_0x462eb2(0xba))/0x9*(parseInt(_0x462eb2(0xc4))/0xa);if(_0x2c5d37===_0x42b3e1)break;else _0x2ccfa4['push'](_0x2ccfa4['shift']());}catch(_0x390338){_0x2ccfa4['push'](_0x2ccfa4['shift']());}}}(a67_0x5655,0xe1e99));import*as a67_0x5f1716 from'node:fs';import*as a67_0x5ba0f1 from'node:path';import*as a67_0x6f69b7 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 _0x21f96e=a67_0xe0ab,_0x5e7280=process.env.TDX_CONFIG_DIR||a67_0x5ba0f1[_0x21f96e(0xc5)](a67_0x6f69b7['homedir'](),'.config',_0x21f96e(0xce));return a67_0x5ba0f1['join'](_0x5e7280,_0x21f96e(0xc9));}function getSessionPath(_0x5890bf){const _0x561d19=a67_0xe0ab;return a67_0x5ba0f1[_0x561d19(0xc5)](getSessionsDir(),_0x5890bf+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x13d88f){if(_0x13d88f)return _0x13d88f;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x4235ad){const _0x483c1d=getSessionID(_0x4235ad),_0x2d9267=/^\d+$/['test'](_0x483c1d)?parseInt(_0x483c1d,0xa):null;return _0x2d9267!==null?loadSessionContextByPID(_0x2d9267):loadSessionContextByString(_0x483c1d);}export function loadSessionContextByPID(_0x583e0f){const _0x23b9df=a67_0xe0ab,_0x3ffbfc=getSessionPath(_0x583e0f);if(!a67_0x5f1716[_0x23b9df(0xc7)](_0x3ffbfc))return null;try{const _0x401c1e=a67_0x5f1716[_0x23b9df(0xd5)](_0x3ffbfc,_0x23b9df(0xbc)),_0x5515fa=JSON[_0x23b9df(0xc3)](_0x401c1e),_0x3de6d8=new Date(_0x5515fa[_0x23b9df(0xd2)])[_0x23b9df(0xca)](),_0x16f4be=Date[_0x23b9df(0xc1)]();if(_0x16f4be-_0x3de6d8>SESSION_EXPIRATION_MS)return a67_0x5f1716[_0x23b9df(0xb3)](_0x3ffbfc),null;const _0x5a7a34=JSON[_0x23b9df(0xbf)](_0x5515fa);if(_0x5a7a34[_0x23b9df(0xbb)](_0x23b9df(0xcb))||_0x5a7a34[_0x23b9df(0xbb)](_0x23b9df(0xcd))||_0x5a7a34[_0x23b9df(0xbb)](_0x23b9df(0xd4)))return console[_0x23b9df(0xbd)](_0x23b9df(0xb7)+_0x3ffbfc+_0x23b9df(0xc8)),a67_0x5f1716['unlinkSync'](_0x3ffbfc),null;return _0x5515fa;}catch{try{a67_0x5f1716[_0x23b9df(0xb3)](_0x3ffbfc);}catch{}return null;}}function a67_0xe0ab(_0x2279d0,_0x2c98af){_0x2279d0=_0x2279d0-0xb1;const _0x565549=a67_0x5655();let _0xe0abe=_0x565549[_0x2279d0];return _0xe0abe;}function loadSessionContextByString(_0x15a5a8){const _0x4afabe=a67_0xe0ab,_0x346395=a67_0x5ba0f1['join'](getSessionsDir(),_0x15a5a8+_0x4afabe(0xd0));if(!a67_0x5f1716[_0x4afabe(0xc7)](_0x346395))return null;try{const _0x9a3376=a67_0x5f1716[_0x4afabe(0xd5)](_0x346395,'utf-8'),_0x17fda0=JSON[_0x4afabe(0xc3)](_0x9a3376),_0x1a8526=new Date(_0x17fda0[_0x4afabe(0xd2)])[_0x4afabe(0xca)](),_0x7e7fa4=Date[_0x4afabe(0xc1)]();if(_0x7e7fa4-_0x1a8526>SESSION_EXPIRATION_MS)return a67_0x5f1716[_0x4afabe(0xb3)](_0x346395),null;const _0x22138f=JSON[_0x4afabe(0xbf)](_0x17fda0);if(_0x22138f[_0x4afabe(0xbb)](_0x4afabe(0xcb))||_0x22138f[_0x4afabe(0xbb)](_0x4afabe(0xcd))||_0x22138f[_0x4afabe(0xbb)](_0x4afabe(0xd4)))return console[_0x4afabe(0xbd)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x346395+_0x4afabe(0xc8)),a67_0x5f1716['unlinkSync'](_0x346395),null;return _0x17fda0;}catch{try{a67_0x5f1716[_0x4afabe(0xb3)](_0x346395);}catch{}return null;}}export function saveSessionContext(_0x477823,_0x4f501e){const _0x1d0654=a67_0xe0ab,_0x21ec5b=getSessionID(_0x4f501e),_0x14c202=/^\d+$/[_0x1d0654(0xc2)](_0x21ec5b)?parseInt(_0x21ec5b,0xa):getCurrentSessionPID(),_0x43b255=a67_0x5ba0f1['join'](getSessionsDir(),_0x21ec5b+_0x1d0654(0xd0)),_0x325bb8=getSessionsDir();createSecureDirectory(_0x325bb8);const _0x11a19a=JSON[_0x1d0654(0xbf)](_0x477823);if(_0x11a19a[_0x1d0654(0xbb)](_0x1d0654(0xcb))||_0x11a19a['includes'](_0x1d0654(0xcd))||_0x11a19a[_0x1d0654(0xbb)](_0x1d0654(0xd4)))throw new Error(_0x1d0654(0xb2));let _0x55d359;const _0x2e6b9c=/^\d+$/[_0x1d0654(0xc2)](_0x21ec5b)?loadSessionContextByPID(parseInt(_0x21ec5b,0xa)):loadSessionContextByString(_0x21ec5b);_0x2e6b9c?_0x55d359={..._0x2e6b9c,..._0x477823,'pid':_0x14c202,'sessionId':_0x21ec5b!==_0x14c202[_0x1d0654(0xc0)]()?_0x21ec5b:undefined,'updatedAt':new Date()[_0x1d0654(0xb4)]()}:_0x55d359={'pid':_0x14c202,'sessionId':_0x21ec5b!==_0x14c202['toString']()?_0x21ec5b:undefined,..._0x477823,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x1d0654(0xb4)]()},a67_0x5f1716['writeFileSync'](_0x43b255,JSON['stringify'](_0x55d359,null,0x2));}export function clearSessionContext(_0x12570e){const _0xf45da=a67_0xe0ab,_0x25ad0f=getSessionID(_0x12570e),_0xb68836=a67_0x5ba0f1[_0xf45da(0xc5)](getSessionsDir(),_0x25ad0f+_0xf45da(0xd0));a67_0x5f1716['existsSync'](_0xb68836)&&a67_0x5f1716['unlinkSync'](_0xb68836);}export function clearSessionContextField(_0x515ff0,_0x1e9e25){const _0x5f1a1e=a67_0xe0ab,_0x42624e=getSessionID(_0x1e9e25),_0xb16b17=a67_0x5ba0f1[_0x5f1a1e(0xc5)](getSessionsDir(),_0x42624e+'.json');if(!a67_0x5f1716['existsSync'](_0xb16b17))return;try{const _0x1cad01=a67_0x5f1716[_0x5f1a1e(0xd5)](_0xb16b17,_0x5f1a1e(0xbc)),_0x43296a=JSON[_0x5f1a1e(0xc3)](_0x1cad01);delete _0x43296a[_0x515ff0],a67_0x5f1716[_0x5f1a1e(0xcf)](_0xb16b17,JSON['stringify'](_0x43296a,null,0x2));}catch{}}function a67_0x5655(){const _0x4551fd=['sessions','getTime','TD_API_KEY','11528064QHkGqQ','apiKey','tdx','writeFileSync','.json','1648380WlFGcu','createdAt','6zpZuGY','api_key','readFileSync','3569764RWMbHu','replace','853808tSKbSJ','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','unlinkSync','toISOString','2315395UmWukh','readdirSync','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','sort','18wUaCsx','36jeYUVs','includes','utf-8','warn','endsWith','stringify','toString','now','test','parse','1580840kTVEuq','join','9161222wvOczf','existsSync','.\x20This\x20is\x20insecure.\x20Removing\x20session.'];a67_0x5655=function(){return _0x4551fd;};return a67_0x5655();}export function cleanExpiredSessions(){const _0x145f3f=a67_0xe0ab,_0x29fb6b=getSessionsDir();if(!a67_0x5f1716['existsSync'](_0x29fb6b))return 0x0;let _0x40ae7e=0x0;const _0x2a1c53=Date[_0x145f3f(0xc1)]();try{const _0x8cd8=a67_0x5f1716['readdirSync'](_0x29fb6b);for(const _0x3c64bd of _0x8cd8){if(!_0x3c64bd[_0x145f3f(0xbe)](_0x145f3f(0xd0)))continue;const _0x46d7bf=a67_0x5ba0f1['join'](_0x29fb6b,_0x3c64bd),_0x59eba4=_0x3c64bd[_0x145f3f(0xd7)]('.json',''),_0x30e315=parseInt(_0x59eba4,0xa),_0x1ec8e0=!isNaN(_0x30e315);if(_0x1ec8e0){if(!isProcessRunning(_0x30e315)){a67_0x5f1716[_0x145f3f(0xb3)](_0x46d7bf),_0x40ae7e++;continue;}}try{const _0x5332a4=a67_0x5f1716[_0x145f3f(0xd5)](_0x46d7bf,_0x145f3f(0xbc)),_0x549ffe=JSON[_0x145f3f(0xc3)](_0x5332a4),_0x333fa9=new Date(_0x549ffe[_0x145f3f(0xd2)])['getTime']();_0x2a1c53-_0x333fa9>SESSION_EXPIRATION_MS&&(a67_0x5f1716['unlinkSync'](_0x46d7bf),_0x40ae7e++);}catch{a67_0x5f1716[_0x145f3f(0xb3)](_0x46d7bf),_0x40ae7e++;}}}catch{}return _0x40ae7e;}export function listActiveSessions(){const _0x32bf4f=a67_0xe0ab,_0x5262c7=getSessionsDir();if(!a67_0x5f1716[_0x32bf4f(0xc7)](_0x5262c7))return[];try{const _0x5d3922=a67_0x5f1716[_0x32bf4f(0xb6)](_0x5262c7),_0x1792a0=[];for(const _0x4d4ac6 of _0x5d3922){if(!_0x4d4ac6[_0x32bf4f(0xbe)]('.json'))continue;const _0x4d97c4=_0x4d4ac6[_0x32bf4f(0xd7)]('.json',''),_0xa4ddf8=parseInt(_0x4d97c4,0xa);!isNaN(_0xa4ddf8)&&isProcessRunning(_0xa4ddf8)&&_0x1792a0['push'](_0xa4ddf8);}return _0x1792a0[_0x32bf4f(0xb8)]((_0x1e3216,_0x4369c8)=>_0x1e3216-_0x4369c8);}catch{return[];}}
@@ -1 +1 @@
1
- const a68_0x58739b=a68_0x5474;(function(_0x4b0838,_0x462fad){const _0x185bc3=a68_0x5474,_0x2caee6=_0x4b0838();while(!![]){try{const _0x6b0ce5=parseInt(_0x185bc3(0xf6))/0x1+-parseInt(_0x185bc3(0xfd))/0x2*(-parseInt(_0x185bc3(0xfc))/0x3)+-parseInt(_0x185bc3(0xf8))/0x4+-parseInt(_0x185bc3(0x100))/0x5+-parseInt(_0x185bc3(0xff))/0x6+-parseInt(_0x185bc3(0xfe))/0x7*(parseInt(_0x185bc3(0xf4))/0x8)+parseInt(_0x185bc3(0xfa))/0x9;if(_0x6b0ce5===_0x462fad)break;else _0x2caee6['push'](_0x2caee6['shift']());}catch(_0x7319e4){_0x2caee6['push'](_0x2caee6['shift']());}}}(a68_0xe29e,0x46e6a));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x58739b(0x101),a68_0x58739b(0xfb));export function loadCachedUsers(_0x453b55){const _0x4f3e92=a68_0x58739b,_0x27e1f3=userCache[_0x4f3e92(0x102)](_0x453b55);return _0x27e1f3?.[_0x4f3e92(0xf5)]??null;}export function saveCachedUsers(_0x23a834,_0x372c39){const _0x1acb84=a68_0x58739b;userCache[_0x1acb84(0xf9)](_0x23a834,{'users':_0x372c39,'cachedAt':Date[_0x1acb84(0x103)]()});}function a68_0x5474(_0x2c1d6f,_0x3d4fdf){_0x2c1d6f=_0x2c1d6f-0xf4;const _0xe29eb7=a68_0xe29e();let _0x547400=_0xe29eb7[_0x2c1d6f];return _0x547400;}function a68_0xe29e(){const _0xc9a816=['clear','1435356VQrclX','write','7970778nACFjy','core/user-cache','504333nNuunt','4BGBKfg','2981643QgDtcy','1547064WUHArB','987915GmvTkT','users-{profile}.json','read','now','8lGBwJc','users','308761fHjIsY'];a68_0xe29e=function(){return _0xc9a816;};return a68_0xe29e();}export function clearUserCache(_0x3a5b66){const _0x2f03cc=a68_0x58739b;userCache[_0x2f03cc(0xf7)](_0x3a5b66);}
1
+ function a68_0x1169(){const _0xa62ba5=['1230GkTHoA','now','460tMlkSL','read','4319350ZjSElx','6436536wjBeap','135126XwOJRD','863804LzgUyV','800274LweiSX','2847IDixQf','3790lpESlh','clear','502hwPlhg','write'];a68_0x1169=function(){return _0xa62ba5;};return a68_0x1169();}(function(_0x2567dd,_0x549194){const _0x3c355=a68_0x2917,_0x4c8f02=_0x2567dd();while(!![]){try{const _0xb24906=parseInt(_0x3c355(0x7d))/0x1+parseInt(_0x3c355(0x82))/0x2*(parseInt(_0x3c355(0x7f))/0x3)+parseInt(_0x3c355(0x78))/0x4*(-parseInt(_0x3c355(0x80))/0x5)+-parseInt(_0x3c355(0x7e))/0x6+parseInt(_0x3c355(0x7a))/0x7+parseInt(_0x3c355(0x7b))/0x8+parseInt(_0x3c355(0x7c))/0x9*(-parseInt(_0x3c355(0x76))/0xa);if(_0xb24906===_0x549194)break;else _0x4c8f02['push'](_0x4c8f02['shift']());}catch(_0x4926be){_0x4c8f02['push'](_0x4c8f02['shift']());}}}(a68_0x1169,0x6f69d));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json','core/user-cache');function a68_0x2917(_0xf5ec98,_0x3f7427){_0xf5ec98=_0xf5ec98-0x76;const _0x11696d=a68_0x1169();let _0x29171b=_0x11696d[_0xf5ec98];return _0x29171b;}export function loadCachedUsers(_0x4de7e1){const _0x462b2f=a68_0x2917,_0x1b9515=userCache[_0x462b2f(0x79)](_0x4de7e1);return _0x1b9515?.['users']??null;}export function saveCachedUsers(_0x40b6a2,_0x58998b){const _0x171c96=a68_0x2917;userCache[_0x171c96(0x83)](_0x40b6a2,{'users':_0x58998b,'cachedAt':Date[_0x171c96(0x77)]()});}export function clearUserCache(_0xc951de){const _0x5e372f=a68_0x2917;userCache[_0x5e372f(0x81)](_0xc951de);}
@@ -1 +1 @@
1
- function a69_0x38fb(){const _0x5eb98c=['3238295ykyutB','18879468EAspUc','7HrihVn','1067590jkbyva','../build-info.json','2509538CaXEuM','.dev','12XejrZw','4cOCtev','4148019VigmcK','0.0.0','1HhnCyH','parse','11WrKXkS','1482776loriax','../../package.json','2261310xEEeCV','version','utf-8'];a69_0x38fb=function(){return _0x5eb98c;};return a69_0x38fb();}(function(_0x267485,_0x4d1686){const _0xf72a63=a69_0x474b,_0x150de9=_0x267485();while(!![]){try{const _0xd8c675=-parseInt(_0xf72a63(0x191))/0x1*(parseInt(_0xf72a63(0x18b))/0x2)+-parseInt(_0xf72a63(0x183))/0x3*(parseInt(_0xf72a63(0x18e))/0x4)+-parseInt(_0xf72a63(0x186))/0x5*(-parseInt(_0xf72a63(0x18d))/0x6)+parseInt(_0xf72a63(0x188))/0x7*(parseInt(_0xf72a63(0x181))/0x8)+-parseInt(_0xf72a63(0x18f))/0x9+parseInt(_0xf72a63(0x189))/0xa*(parseInt(_0xf72a63(0x180))/0xb)+parseInt(_0xf72a63(0x187))/0xc;if(_0xd8c675===_0x4d1686)break;else _0x150de9['push'](_0x150de9['shift']());}catch(_0x271ea1){_0x150de9['push'](_0x150de9['shift']());}}}(a69_0x38fb,0xa8c53));import{readFileSync}from'fs';function a69_0x474b(_0x37549a,_0x2303b3){_0x37549a=_0x37549a-0x17f;const _0x38fb88=a69_0x38fb();let _0x474b35=_0x38fb88[_0x37549a];return _0x474b35;}import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x394208=a69_0x474b;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4fe3c3=fileURLToPath(import.meta.url),_0x5d9917=dirname(_0x4fe3c3);try{const _0x2fa590=join(_0x5d9917,_0x394208(0x18a));cachedBuildInfo=JSON['parse'](readFileSync(_0x2fa590,_0x394208(0x185)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0xb2da64=a69_0x474b;if(cachedVersion!==null)return cachedVersion;const _0x35e508=fileURLToPath(import.meta.url),_0xed61f9=dirname(_0x35e508),_0x42a841=getBuildInfo();if(_0x42a841[_0xb2da64(0x184)])return cachedVersion=_0x42a841['version'],cachedVersion;try{const _0x40e9f2=join(_0xed61f9,_0xb2da64(0x182)),_0x579f1a=JSON[_0xb2da64(0x17f)](readFileSync(_0x40e9f2,_0xb2da64(0x185)));cachedVersion=_0x579f1a[_0xb2da64(0x184)];}catch{cachedVersion=_0xb2da64(0x190);}return cachedVersion;}export function isDevVersion(){const _0x422bce=a69_0x474b,_0x4614c9=getVersion();return _0x4614c9['includes'](_0x422bce(0x18c))||_0x4614c9['includes']('-');}
1
+ function a69_0xd46f(_0xd356c3,_0x3bc078){_0xd356c3=_0xd356c3-0x9f;const _0x9aa8f5=a69_0x9aa8();let _0xd46fa7=_0x9aa8f5[_0xd356c3];return _0xd46fa7;}(function(_0x133cfa,_0x5d0764){const _0x1b26f4=a69_0xd46f,_0x4b9b1f=_0x133cfa();while(!![]){try{const _0x44d8a6=-parseInt(_0x1b26f4(0xa7))/0x1+-parseInt(_0x1b26f4(0xa4))/0x2+-parseInt(_0x1b26f4(0xa6))/0x3+parseInt(_0x1b26f4(0xa5))/0x4*(parseInt(_0x1b26f4(0xa9))/0x5)+-parseInt(_0x1b26f4(0x9f))/0x6*(parseInt(_0x1b26f4(0xa1))/0x7)+-parseInt(_0x1b26f4(0xa8))/0x8+parseInt(_0x1b26f4(0xa0))/0x9*(parseInt(_0x1b26f4(0xab))/0xa);if(_0x44d8a6===_0x5d0764)break;else _0x4b9b1f['push'](_0x4b9b1f['shift']());}catch(_0x33481a){_0x4b9b1f['push'](_0x4b9b1f['shift']());}}}(a69_0x9aa8,0xef637));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a69_0x9aa8(){const _0x5e78b7=['4HVJdaA','4829835mLgdxA','1570172MCeexS','7927504Ozklgz','4295315NhFwbn','includes','20skaIHg','../build-info.json','4739970WKljGa','23672115SMKChx','7vlHJNw','version','parse','355896CgnMSr'];a69_0x9aa8=function(){return _0x5e78b7;};return a69_0x9aa8();}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x4d8e20=a69_0xd46f;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x238796=fileURLToPath(import.meta.url),_0x33bb3b=dirname(_0x238796);try{const _0x59db1c=join(_0x33bb3b,_0x4d8e20(0xac));cachedBuildInfo=JSON[_0x4d8e20(0xa3)](readFileSync(_0x59db1c,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x4f4162=a69_0xd46f;if(cachedVersion!==null)return cachedVersion;const _0xbd990f=fileURLToPath(import.meta.url),_0x2e9af0=dirname(_0xbd990f),_0x1a1d24=getBuildInfo();if(_0x1a1d24[_0x4f4162(0xa2)])return cachedVersion=_0x1a1d24[_0x4f4162(0xa2)],cachedVersion;try{const _0x9dd28b=join(_0x2e9af0,'../../package.json'),_0x3c20cd=JSON[_0x4f4162(0xa3)](readFileSync(_0x9dd28b,'utf-8'));cachedVersion=_0x3c20cd[_0x4f4162(0xa2)];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x6696e6=a69_0xd46f,_0x492021=getVersion();return _0x492021[_0x6696e6(0xaa)]('.dev')||_0x492021[_0x6696e6(0xaa)]('-');}