@treasuredata/tdx 2026.4.13 → 2026.4.14

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_0x2f3093=a57_0x451b;(function(_0x56308d,_0xb9ecb2){const _0x507da5=a57_0x451b,_0x400734=_0x56308d();while(!![]){try{const _0x43fec1=-parseInt(_0x507da5(0xf1))/0x1*(-parseInt(_0x507da5(0x108))/0x2)+-parseInt(_0x507da5(0x110))/0x3+parseInt(_0x507da5(0x137))/0x4*(parseInt(_0x507da5(0x131))/0x5)+-parseInt(_0x507da5(0x118))/0x6*(parseInt(_0x507da5(0x109))/0x7)+parseInt(_0x507da5(0xf9))/0x8+-parseInt(_0x507da5(0x12c))/0x9*(-parseInt(_0x507da5(0xfc))/0xa)+-parseInt(_0x507da5(0x102))/0xb*(-parseInt(_0x507da5(0x11b))/0xc);if(_0x43fec1===_0xb9ecb2)break;else _0x400734['push'](_0x400734['shift']());}catch(_0x250353){_0x400734['push'](_0x400734['shift']());}}}(a57_0x30f3,0x39cb4));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x15ca53 from'node:fs';import*as a57_0x8d98d9 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';function a57_0x451b(_0x4eb09e,_0x16fa83){_0x4eb09e=_0x4eb09e-0xef;const _0x30f3d7=a57_0x30f3();let _0x451ba0=_0x30f3d7[_0x4eb09e];return _0x451ba0;}import a57_0x3eedd8 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x55d6f0=a57_0x451b;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x55d6f0(0x106),_0x55d6f0(0x10e));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x31d495){const _0x263cc0=a57_0x451b,_0xfc67b9=getConfigDir();return _0x31d495?a57_0x8d98d9[_0x263cc0(0x11a)](_0xfc67b9,'.env.'+_0x31d495):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x2f3093(0xfa),a57_0x2f3093(0x101));export function getLLMProjectCacheFile(_0x39792f){const _0x1d7241=a57_0x2f3093;return llmProjectCache[_0x1d7241(0xf2)](_0x39792f);}export function readCachedLLMProject(_0x43973e){const _0x4aa0f4=a57_0x2f3093,_0x429dc8=llmProjectCache[_0x4aa0f4(0x100)](_0x43973e);if(_0x429dc8&&typeof _0x429dc8['id']===_0x4aa0f4(0xfe)&&typeof _0x429dc8['name']===_0x4aa0f4(0xfe))return _0x429dc8;return null;}export function writeCachedLLMProject(_0xe25992,_0x2d20ac,_0xf22033){const _0x18ade2=a57_0x2f3093;try{llmProjectCache[_0x18ade2(0x123)]({'name':_0xe25992,'id':_0x2d20ac},_0xf22033);}catch{}}function a57_0x30f3(){const _0x1a2405=['TDX_ACCESS_TOKEN\x20env\x20var','write','existsSync','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','number','us01','site','entries','next','config/llm-agent','62235AANLBj','replace','stg-ap03','tdx.json','stg-us01','728300GskZqo','apiKeys','account_info','apiKey','TDX_API_KEY\x20env\x20var','source','8yolxQj','slice','.json','Warning:\x20Failed\x20to\x20read\x20','warn','199qzvAmI','path','stg-ap01','keychain\x20(profile:\x20','ap02','TDX_ACCESS_TOKEN_FILE','TDX_API_KEY_','map','1979432kBQTXc','llm_default_project','ap01','230ywkzgt','match','string','parse','read','config/llm-project','449845LLafeu','dev-us01','llm_default_agent','name','.config','projectId','1038jVJgvE','21xQKVYy','TD_API_KEY_','yellow','readFileSync','TDX_ACCESS_TOKEN_','tdx','toUpperCase','1393245QQAalM','includes','release_channel','dev-eu01','stable','trim','eu01','\x27,\x20defaulting\x20to\x20us01','445242exElxM','accessToken','join','36SnvufS','Warning:\x20Unknown\x20site\x20\x27','ap03','split','keychain','startsWith','utf-8'];a57_0x30f3=function(){return _0x1a2405;};return a57_0x30f3();}const llmAgentCache=createOptionalProfileCache(a57_0x2f3093(0x104),a57_0x2f3093(0x12b));export function getLLMAgentCacheFile(_0x44c0e5){const _0x50a3d4=a57_0x2f3093;return llmAgentCache[_0x50a3d4(0xf2)](_0x44c0e5);}export function readCachedLLMAgent(_0x24c71f){const _0x52701f=a57_0x2f3093,_0x50f8a8=llmAgentCache[_0x52701f(0x100)](_0x24c71f);if(_0x50f8a8&&typeof _0x50f8a8['id']===_0x52701f(0xfe)&&typeof _0x50f8a8[_0x52701f(0x105)]===_0x52701f(0xfe)&&typeof _0x50f8a8[_0x52701f(0x107)]===_0x52701f(0xfe))return _0x50f8a8;return null;}export function writeCachedLLMAgent(_0x4e104e,_0x443a60,_0xba9d97,_0xe15307){const _0x57510=a57_0x2f3093;try{llmAgentCache[_0x57510(0x123)]({'name':_0x4e104e,'id':_0x443a60,'projectId':_0xba9d97},_0xe15307);}catch{}}export function clearCachedLLMAgent(_0x41b90f){try{llmAgentCache['clear'](_0x41b90f);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x2f3093(0x133),'config/account-info',{'suffix':a57_0x2f3093(0x139)});export function getAccountInfoCacheFile(_0x4281fe){const _0x3a9d61=a57_0x2f3093;return accountInfoCache[_0x3a9d61(0xf2)](_0x4281fe);}export function readCachedAccountInfo(_0x5aac63){const _0x441109=a57_0x2f3093,_0x3a39e4=accountInfoCache['read'](_0x5aac63);if(_0x3a39e4&&typeof _0x3a39e4[_0x441109(0x128)]===_0x441109(0xfe)&&typeof _0x3a39e4['accountId']===_0x441109(0x126))return _0x3a39e4;return null;}export function writeCachedAccountInfo(_0x4cde99,_0x5b75ed,_0x41f535){const _0x2806e0=a57_0x2f3093;try{accountInfoCache[_0x2806e0(0x123)]({'site':_0x4cde99,'accountId':_0x5b75ed,'cachedAt':new Date()['toISOString']()},_0x41f535);}catch{}}export function parseEnvFile(_0x5e801b){const _0x205ba3=a57_0x2f3093,_0x4fc32b={};for(const _0x3c0149 of _0x5e801b[_0x205ba3(0x11e)]('\x0a')){const _0x267018=_0x3c0149['trim']();if(!_0x267018||_0x267018['startsWith']('#'))continue;const _0x1918b1=_0x267018[_0x205ba3(0xfd)](/^([^=]+)=(.*)$/);if(_0x1918b1){const _0x103504=_0x1918b1[0x1][_0x205ba3(0x115)]();let _0x2dd021=_0x1918b1[0x2][_0x205ba3(0x115)]();(_0x2dd021[_0x205ba3(0x120)]('\x22')&&_0x2dd021['endsWith']('\x22')||_0x2dd021[_0x205ba3(0x120)]('\x27')&&_0x2dd021['endsWith']('\x27'))&&(_0x2dd021=_0x2dd021[_0x205ba3(0x138)](0x1,-0x1)),_0x4fc32b[_0x103504]=_0x2dd021;}}return _0x4fc32b;}export function readUserConfig(){const _0x842447=a57_0x2f3093,_0x1f1ada=getConfigFile();if(!existsSync(_0x1f1ada))return{};try{const _0x4dcdb2=readFileSync(_0x1f1ada,'utf-8');return parseEnvFile(_0x4dcdb2);}catch(_0x5e7696){return console[_0x842447(0xf0)](_0x842447(0x125)+_0x1f1ada+':',_0x5e7696),{};}}export function resolveSite(_0xa6329d){const _0x16d523=a57_0x2f3093,_0x288c58=['us01',_0x16d523(0xfb),_0x16d523(0x116),'ap02',_0x16d523(0x11d),_0x16d523(0x103),_0x16d523(0x113),_0x16d523(0x130),'stg-ap01',_0x16d523(0x12e)];if(_0x288c58[_0x16d523(0x111)](_0xa6329d))return _0xa6329d;if(_0xa6329d in SITE_ALIASES)return SITE_ALIASES[_0xa6329d];return console['warn'](_0x16d523(0x11c)+_0xa6329d+_0x16d523(0x117)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x5a4a65){const _0x240dde=a57_0x2f3093,_0x2770ab=_0x5a4a65||getActiveProfileName()||undefined;if(_0x2770ab){const _0x10578c=_0x240dde(0x10d)+normalizeProfileForEnvVar(_0x2770ab);if(process.env[_0x10578c])return{'accessToken':process.env[_0x10578c],'source':_0x10578c+'\x20env\x20var'};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x240dde(0x122)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x433a04=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x433a04)return{'accessToken':_0x433a04,'source':_0x240dde(0xf6)};}return null;}function readAccessTokenFile(_0x22e2f3){const _0x5decae=a57_0x2f3093;try{const _0x2ee724=readFileSync(_0x22e2f3,_0x5decae(0x121))['trim']();return _0x2ee724||null;}catch{return null;}}export function getAccessToken(_0x7e7949){const _0x3fc00c=a57_0x2f3093;return resolveAccessToken(_0x7e7949)?.[_0x3fc00c(0x119)];}export function getAPIKey(_0x66320e){const _0x1255e5=a57_0x2f3093,_0x14eae7=_0x66320e||getActiveProfileName();if(_0x14eae7){const _0x5b2c4b=_0x1255e5(0xf7)+normalizeProfileForEnvVar(_0x14eae7);if(process.env[_0x5b2c4b])return process.env[_0x5b2c4b];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x30a5f3){const _0x395f21=a57_0x2f3093;return _0x30a5f3[_0x395f21(0x10f)]()[_0x395f21(0x12d)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x1faaa0,_0x584235){const _0x3fc715=a57_0x2f3093,_0x463c69=resolveAccessToken(_0x584235);if(_0x463c69)return{'apiKey':_0x463c69['accessToken'],'source':_0x463c69[_0x3fc715(0x136)],'isDeprecated':![]};const _0x355a4f=_0x584235||getActiveProfileName()||undefined;if(_0x355a4f){const _0x69c987='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x355a4f);if(process.env[_0x69c987])return{'apiKey':process.env[_0x69c987],'source':_0x69c987+'\x20env\x20var','isDeprecated':![]};const _0x338ed=getCachedCredential(_0x1faaa0,_0x355a4f);if(_0x338ed)return{'apiKey':_0x338ed,'source':_0x3fc715(0xf4)+_0x355a4f+')','isDeprecated':![]};const _0x8834e8=await getKeychainAPIKey(_0x355a4f);if(_0x8834e8)return setCachedCredential(_0x8834e8,_0x1faaa0,_0x355a4f),{'apiKey':_0x8834e8,'source':_0x3fc715(0xf4)+_0x355a4f+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x3fc715(0x135),'isDeprecated':![]};if(!_0x355a4f){const _0x50592f=getCachedCredential(_0x1faaa0,undefined);if(_0x50592f)return{'apiKey':_0x50592f,'source':'keychain','isDeprecated':![]};const _0x3cca11=await getKeychainAPIKey(undefined);if(_0x3cca11)return setCachedCredential(_0x3cca11,_0x1faaa0,undefined),{'apiKey':_0x3cca11,'source':_0x3fc715(0x11f),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x2ddd42,_0x330bb2){const _0x53174c=a57_0x2f3093,_0x4be9f5=await resolveAPIKeyAsync(_0x2ddd42,_0x330bb2);return _0x4be9f5?.[_0x53174c(0x134)];}function cleanupLegacyEnvFile(_0x10fe47){const _0x412e42=a57_0x2f3093;if(!existsSync(_0x10fe47))return![];try{const _0x31fea7=readFileSync(_0x10fe47,_0x412e42(0x121)),_0x14a618=_0x31fea7[_0x412e42(0x11e)]('\x0a'),_0x2552cf=_0x14a618['filter'](_0x2c03b6=>{const _0x39cbb6=_0x412e42,_0x3f6b2f=_0x2c03b6['trim']();if(!_0x3f6b2f||_0x3f6b2f[_0x39cbb6(0x120)]('#'))return!![];const [_0x44e76e]=_0x3f6b2f[_0x39cbb6(0x11e)]('=');return!_0x44e76e['startsWith']('TD_API_KEY');}),_0x31a5ef=_0x2552cf['some'](_0x11b55b=>{const _0x560e19=_0x412e42,_0x1b240b=_0x11b55b[_0x560e19(0x115)]();return _0x1b240b&&!_0x1b240b['startsWith']('#');});if(!_0x31a5ef)return unlinkSync(_0x10fe47),!![];return writeFileSync(_0x10fe47,_0x2552cf[_0x412e42(0x11a)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x318b63=a57_0x2f3093;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0xca15cc=a57_0x8d98d9[_0x318b63(0x11a)](getConfigDir(),_0x318b63(0x12f));if(!a57_0x15ca53[_0x318b63(0x124)](_0xca15cc))return null;try{const _0x179d0b=a57_0x15ca53['readFileSync'](_0xca15cc,_0x318b63(0x121)),_0x3f8416=JSON[_0x318b63(0xff)](_0x179d0b);return _0x3f8416['profile']||null;}catch{return null;}}export function saveAPIKey(_0x2a5e69,_0x29d3c4,_0x4af294){const _0x44c0b3=a57_0x2f3093,_0x205fc2=getConfigDir(),_0x4d909a=getConfigFilePath(_0x4af294);!existsSync(_0x205fc2)&&mkdirSync(_0x205fc2,{'recursive':!![],'mode':0x1c0});let _0x10dcd6={};if(existsSync(_0x4d909a))try{const _0x5c220d=readFileSync(_0x4d909a,_0x44c0b3(0x121));_0x10dcd6=parseEnvFile(_0x5c220d);}catch(_0x4e7599){console[_0x44c0b3(0xf0)](_0x44c0b3(0xef)+_0x4d909a+':',_0x4e7599);}const _0xdc98db=_0x2a5e69['toUpperCase']()[_0x44c0b3(0x12d)](/-/g,'_');_0x10dcd6[_0x44c0b3(0x10a)+_0xdc98db]=_0x29d3c4;const _0x17293a=Object[_0x44c0b3(0x129)](_0x10dcd6)[_0x44c0b3(0xf8)](([_0x3a23f7,_0x938510])=>_0x3a23f7+'='+_0x938510);writeFileSync(_0x4d909a,_0x17293a['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x23d8ed,_0x35da4b,_0x403f35){const _0x30e153=a57_0x2f3093;await saveKeychainAPIKey(_0x23d8ed,_0x403f35),setCachedCredential(_0x23d8ed,_0x35da4b,_0x403f35);const _0x3da03b=getConfigFilePath(_0x403f35);cleanupLegacyEnvFile(_0x3da03b)&&console['warn'](a57_0x3eedd8[_0x30e153(0x10b)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x5a939=a57_0x2f3093,_0x1a12b7={'apiKeys':{},'defaultSite':_0x5a939(0x127)},_0x3ce193=[_0x5a939(0x127),'ap01',_0x5a939(0x116),_0x5a939(0xf5),'ap03','dev-us01','dev-eu01',_0x5a939(0x130),_0x5a939(0xf3),'stg-ap03'],_0x1a841e=getAPIKey();if(_0x1a841e)for(const _0x255b75 of _0x3ce193){_0x1a12b7[_0x5a939(0x132)][_0x255b75]=_0x1a841e;}return _0x1a12b7;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x24b49d=a57_0x2f3093,_0x2105f7=a57_0x8d98d9[_0x24b49d(0x11a)](getConfigDir(),_0x24b49d(0x12f));if(!a57_0x15ca53['existsSync'](_0x2105f7))return undefined;try{const _0x4d7c42=a57_0x15ca53[_0x24b49d(0x10c)](_0x2105f7,_0x24b49d(0x121)),_0x1aa796=JSON[_0x24b49d(0xff)](_0x4d7c42);return typeof _0x1aa796['proxy']===_0x24b49d(0xfe)?_0x1aa796['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x3aabbb=a57_0x2f3093,_0x492d3b=process.env.TDX_RELEASE_CHANNEL;if(_0x492d3b===_0x3aabbb(0x12a)||_0x492d3b===_0x3aabbb(0x114))return _0x492d3b;const _0x41e454=a57_0x8d98d9['join'](getConfigDir(),'tdx.json');if(!a57_0x15ca53[_0x3aabbb(0x124)](_0x41e454))return'stable';try{const _0x2cbb84=a57_0x15ca53[_0x3aabbb(0x10c)](_0x41e454,_0x3aabbb(0x121)),_0x17bfe1=JSON[_0x3aabbb(0xff)](_0x2cbb84);if(_0x17bfe1[_0x3aabbb(0x112)]==='next')return _0x3aabbb(0x12a);}catch{}return _0x3aabbb(0x114);}export function saveReleaseChannel(_0x2914ac){const _0x50af98=a57_0x2f3093,_0x2abf66=getConfigDir(),_0x208b85=a57_0x8d98d9[_0x50af98(0x11a)](_0x2abf66,_0x50af98(0x12f));!existsSync(_0x2abf66)&&mkdirSync(_0x2abf66,{'recursive':!![],'mode':0x1c0});let _0x39b4a3={};if(existsSync(_0x208b85))try{const _0x395029=readFileSync(_0x208b85,_0x50af98(0x121));_0x39b4a3=JSON[_0x50af98(0xff)](_0x395029);}catch{}_0x39b4a3[_0x50af98(0x112)]=_0x2914ac,writeFileSync(_0x208b85,JSON['stringify'](_0x39b4a3,null,0x2),{'mode':0x180});}
1
+ const a57_0x3b75d1=a57_0x35c4;(function(_0x288a0a,_0x3af3ed){const _0x6ef190=a57_0x35c4,_0x51a72d=_0x288a0a();while(!![]){try{const _0x9e38c9=-parseInt(_0x6ef190(0x14d))/0x1+-parseInt(_0x6ef190(0x174))/0x2+-parseInt(_0x6ef190(0x170))/0x3+parseInt(_0x6ef190(0x14e))/0x4*(-parseInt(_0x6ef190(0x12b))/0x5)+parseInt(_0x6ef190(0x176))/0x6*(-parseInt(_0x6ef190(0x16a))/0x7)+parseInt(_0x6ef190(0x142))/0x8+parseInt(_0x6ef190(0x156))/0x9*(parseInt(_0x6ef190(0x140))/0xa);if(_0x9e38c9===_0x3af3ed)break;else _0x51a72d['push'](_0x51a72d['shift']());}catch(_0x42c989){_0x51a72d['push'](_0x51a72d['shift']());}}}(a57_0x25c5,0x9ab57));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x2398f7 from'node:fs';import*as a57_0x1a8cf5 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_0x4ec2e4 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x445fe7=a57_0x35c4;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x445fe7(0x138),'tdx');}export function getConfigFile(){const _0x116064=a57_0x35c4;return join(getConfigDir(),_0x116064(0x151));}export function getConfigFilePath(_0x59e1cb){const _0x3e5dea=a57_0x35c4,_0x3dba66=getConfigDir();return _0x59e1cb?a57_0x1a8cf5[_0x3e5dea(0x132)](_0x3dba66,'.env.'+_0x59e1cb):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x3b75d1(0x13f),a57_0x3b75d1(0x13e));export function getLLMProjectCacheFile(_0x5ad25b){return llmProjectCache['path'](_0x5ad25b);}export function readCachedLLMProject(_0x3fc77f){const _0x8aa268=a57_0x3b75d1,_0x47848e=llmProjectCache[_0x8aa268(0x150)](_0x3fc77f);if(_0x47848e&&typeof _0x47848e['id']==='string'&&typeof _0x47848e[_0x8aa268(0x13a)]==='string')return _0x47848e;return null;}export function writeCachedLLMProject(_0x1194f3,_0x673e45,_0x5332ff){try{llmProjectCache['write']({'name':_0x1194f3,'id':_0x673e45},_0x5332ff);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a57_0x3b75d1(0x14c));export function getLLMAgentCacheFile(_0x41b3bb){const _0x533779=a57_0x3b75d1;return llmAgentCache[_0x533779(0x145)](_0x41b3bb);}export function readCachedLLMAgent(_0x494f5c){const _0x4a4910=a57_0x3b75d1,_0x56e851=llmAgentCache[_0x4a4910(0x150)](_0x494f5c);if(_0x56e851&&typeof _0x56e851['id']===_0x4a4910(0x165)&&typeof _0x56e851['name']===_0x4a4910(0x165)&&typeof _0x56e851[_0x4a4910(0x17a)]==='string')return _0x56e851;return null;}export function writeCachedLLMAgent(_0x5759bd,_0x21ee98,_0x19e5e4,_0x107c0b){const _0x24ee6c=a57_0x3b75d1;try{llmAgentCache[_0x24ee6c(0x167)]({'name':_0x5759bd,'id':_0x21ee98,'projectId':_0x19e5e4},_0x107c0b);}catch{}}export function clearCachedLLMAgent(_0xda4066){const _0x35f6e2=a57_0x3b75d1;try{llmAgentCache[_0x35f6e2(0x14b)](_0xda4066);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x3b75d1(0x148),a57_0x3b75d1(0x15a),{'suffix':a57_0x3b75d1(0x12c)});export function getAccountInfoCacheFile(_0x4ceb6a){const _0x44eee5=a57_0x3b75d1;return accountInfoCache[_0x44eee5(0x145)](_0x4ceb6a);}export function readCachedAccountInfo(_0x1e84dc){const _0x28b204=a57_0x3b75d1,_0x1bac28=accountInfoCache[_0x28b204(0x150)](_0x1e84dc);if(_0x1bac28&&typeof _0x1bac28[_0x28b204(0x134)]==='string'&&typeof _0x1bac28[_0x28b204(0x12f)]===_0x28b204(0x130))return _0x1bac28;return null;}export function writeCachedAccountInfo(_0x4f7a74,_0x5671ef,_0x38af4b){const _0x2d6922=a57_0x3b75d1;try{accountInfoCache[_0x2d6922(0x167)]({'site':_0x4f7a74,'accountId':_0x5671ef,'cachedAt':new Date()['toISOString']()},_0x38af4b);}catch{}}export function parseEnvFile(_0x27569f){const _0x2500d5=a57_0x3b75d1,_0x2631bd={};for(const _0x3569f5 of _0x27569f['split']('\x0a')){const _0x1743d1=_0x3569f5[_0x2500d5(0x162)]();if(!_0x1743d1||_0x1743d1[_0x2500d5(0x133)]('#'))continue;const _0x190bf6=_0x1743d1[_0x2500d5(0x15b)](/^([^=]+)=(.*)$/);if(_0x190bf6){const _0x3dae68=_0x190bf6[0x1][_0x2500d5(0x162)]();let _0x3736d4=_0x190bf6[0x2]['trim']();(_0x3736d4[_0x2500d5(0x133)]('\x22')&&_0x3736d4['endsWith']('\x22')||_0x3736d4[_0x2500d5(0x133)]('\x27')&&_0x3736d4[_0x2500d5(0x14f)]('\x27'))&&(_0x3736d4=_0x3736d4[_0x2500d5(0x135)](0x1,-0x1)),_0x2631bd[_0x3dae68]=_0x3736d4;}}return _0x2631bd;}export function readUserConfig(){const _0x3f0d41=a57_0x3b75d1,_0x333c10=getConfigFile();if(!existsSync(_0x333c10))return{};try{const _0x4072f9=readFileSync(_0x333c10,_0x3f0d41(0x152));return parseEnvFile(_0x4072f9);}catch(_0x14cf20){return console['warn']('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x333c10+':',_0x14cf20),{};}}export function resolveSite(_0x5c4a94){const _0x2d3f05=a57_0x3b75d1,_0x534226=[_0x2d3f05(0x160),_0x2d3f05(0x15c),'eu01',_0x2d3f05(0x175),_0x2d3f05(0x153),_0x2d3f05(0x141),'dev-eu01',_0x2d3f05(0x177),'stg-ap01','stg-ap03'];if(_0x534226[_0x2d3f05(0x159)](_0x5c4a94))return _0x5c4a94;if(_0x5c4a94 in SITE_ALIASES)return SITE_ALIASES[_0x5c4a94];return console[_0x2d3f05(0x179)](_0x2d3f05(0x143)+_0x5c4a94+_0x2d3f05(0x172)),'us01';}let cachedUserConfig=null;function a57_0x35c4(_0x18a1aa,_0x47e85f){_0x18a1aa=_0x18a1aa-0x12b;const _0x25c529=a57_0x25c5();let _0x35c432=_0x25c529[_0x18a1aa];return _0x35c432;}export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x3cb0da){const _0x20dbbd=a57_0x3b75d1,_0x41d300=_0x3cb0da||getActiveProfileName()||undefined;if(_0x41d300){const _0x5c567f=_0x20dbbd(0x12e)+normalizeProfileForEnvVar(_0x41d300);if(process.env[_0x5c567f])return{'accessToken':process.env[_0x5c567f],'source':_0x5c567f+_0x20dbbd(0x147)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x20dbbd(0x164)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x53e1c8=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x53e1c8)return{'accessToken':_0x53e1c8,'source':_0x20dbbd(0x157)};}return null;}function readAccessTokenFile(_0x59b874){const _0x32bbb7=a57_0x3b75d1;try{const _0xe07db9=readFileSync(_0x59b874,_0x32bbb7(0x152))[_0x32bbb7(0x162)]();return _0xe07db9||null;}catch{return null;}}function a57_0x25c5(){const _0x17422e=['accountId','number','TD_API_KEY_','join','startsWith','site','slice','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','tdx.json','.config','eu01','name','keychain','stg-ap03','Warning:\x20Failed\x20to\x20read\x20','config/llm-project','llm_default_project','36830FmnPgE','dev-us01','4751952XttLYd','Warning:\x20Unknown\x20site\x20\x27','dev-eu01','path','TDX_API_KEY\x20env\x20var','\x20env\x20var','account_info','source','toUpperCase','clear','config/llm-agent','1024143RnXADm','68764DurLfa','endsWith','read','.env','utf-8','ap03','existsSync','next','12249mGPKeJ','TDX_ACCESS_TOKEN_FILE','proxy','includes','config/account-info','match','ap01','profile','some','yellow','us01','parse','trim','stable','TDX_ACCESS_TOKEN\x20env\x20var','string','split','write','TD_API_KEY','release_channel','55951mnayJT','stringify','filter','replace','readFileSync','keychain\x20(profile:\x20','3548946soIaqS','accessToken','\x27,\x20defaulting\x20to\x20us01','entries','2182060AzWdwy','ap02','870KAFoyI','stg-us01','map','warn','projectId','150xibuau','.json','TDX_API_KEY_','TDX_ACCESS_TOKEN_'];a57_0x25c5=function(){return _0x17422e;};return a57_0x25c5();}export function getAccessToken(_0x1700c1){return resolveAccessToken(_0x1700c1)?.['accessToken'];}export function getAPIKey(_0x5d06ff){const _0x3be966=a57_0x3b75d1,_0x436025=_0x5d06ff||getActiveProfileName();if(_0x436025){const _0x2fc6bd=_0x3be966(0x12d)+normalizeProfileForEnvVar(_0x436025);if(process.env[_0x2fc6bd])return process.env[_0x2fc6bd];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x29df2e){const _0x4007a9=a57_0x3b75d1;return _0x29df2e[_0x4007a9(0x14a)]()[_0x4007a9(0x16d)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x6caa0d,_0x3c2f58){const _0x57edae=a57_0x3b75d1,_0x1ddac5=resolveAccessToken(_0x3c2f58);if(_0x1ddac5)return{'apiKey':_0x1ddac5[_0x57edae(0x171)],'source':_0x1ddac5[_0x57edae(0x149)],'isDeprecated':![]};const _0x1290d9=_0x3c2f58||getActiveProfileName()||undefined;if(_0x1290d9){const _0x5ea1e4=_0x57edae(0x12d)+normalizeProfileForEnvVar(_0x1290d9);if(process.env[_0x5ea1e4])return{'apiKey':process.env[_0x5ea1e4],'source':_0x5ea1e4+_0x57edae(0x147),'isDeprecated':![]};const _0x4d7ea9=getCachedCredential(_0x6caa0d,_0x1290d9);if(_0x4d7ea9)return{'apiKey':_0x4d7ea9,'source':_0x57edae(0x16f)+_0x1290d9+')','isDeprecated':![]};const _0x4d5dd1=await getKeychainAPIKey(_0x1290d9);if(_0x4d5dd1)return setCachedCredential(_0x4d5dd1,_0x6caa0d,_0x1290d9),{'apiKey':_0x4d5dd1,'source':_0x57edae(0x16f)+_0x1290d9+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x57edae(0x146),'isDeprecated':![]};if(!_0x1290d9){const _0x2e60a9=getCachedCredential(_0x6caa0d,undefined);if(_0x2e60a9)return{'apiKey':_0x2e60a9,'source':_0x57edae(0x13b),'isDeprecated':![]};const _0x44e406=await getKeychainAPIKey(undefined);if(_0x44e406)return setCachedCredential(_0x44e406,_0x6caa0d,undefined),{'apiKey':_0x44e406,'source':_0x57edae(0x13b),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x450e73,_0x135ff){const _0x5334f0=await resolveAPIKeyAsync(_0x450e73,_0x135ff);return _0x5334f0?.['apiKey'];}function cleanupLegacyEnvFile(_0x419a31){const _0x294230=a57_0x3b75d1;if(!existsSync(_0x419a31))return![];try{const _0x3ed09d=readFileSync(_0x419a31,_0x294230(0x152)),_0x83360e=_0x3ed09d[_0x294230(0x166)]('\x0a'),_0x4742b2=_0x83360e[_0x294230(0x16c)](_0xf1bc9f=>{const _0x543d36=_0x294230,_0x2a21ea=_0xf1bc9f[_0x543d36(0x162)]();if(!_0x2a21ea||_0x2a21ea[_0x543d36(0x133)]('#'))return!![];const [_0x2d9ac6]=_0x2a21ea['split']('=');return!_0x2d9ac6[_0x543d36(0x133)](_0x543d36(0x168));}),_0x1c755b=_0x4742b2[_0x294230(0x15e)](_0x1041d3=>{const _0x7bb576=_0x294230,_0xed9d43=_0x1041d3[_0x7bb576(0x162)]();return _0xed9d43&&!_0xed9d43[_0x7bb576(0x133)]('#');});if(!_0x1c755b)return unlinkSync(_0x419a31),!![];return writeFileSync(_0x419a31,_0x4742b2['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x5132d8=a57_0x3b75d1;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x15bb85=a57_0x1a8cf5[_0x5132d8(0x132)](getConfigDir(),_0x5132d8(0x137));if(!a57_0x2398f7[_0x5132d8(0x154)](_0x15bb85))return null;try{const _0x11e754=a57_0x2398f7[_0x5132d8(0x16e)](_0x15bb85,_0x5132d8(0x152)),_0x3cf271=JSON[_0x5132d8(0x161)](_0x11e754);return _0x3cf271[_0x5132d8(0x15d)]||null;}catch{return null;}}export function saveAPIKey(_0x3d8af7,_0x420669,_0x22f27f){const _0x3d7a92=a57_0x3b75d1,_0x14d4e6=getConfigDir(),_0x1a6475=getConfigFilePath(_0x22f27f);!existsSync(_0x14d4e6)&&mkdirSync(_0x14d4e6,{'recursive':!![],'mode':0x1c0});let _0xd96e85={};if(existsSync(_0x1a6475))try{const _0x2105a5=readFileSync(_0x1a6475,_0x3d7a92(0x152));_0xd96e85=parseEnvFile(_0x2105a5);}catch(_0x276745){console[_0x3d7a92(0x179)](_0x3d7a92(0x13d)+_0x1a6475+':',_0x276745);}const _0x58a321=_0x3d8af7[_0x3d7a92(0x14a)]()[_0x3d7a92(0x16d)](/-/g,'_');_0xd96e85[_0x3d7a92(0x131)+_0x58a321]=_0x420669;const _0x2bd601=Object[_0x3d7a92(0x173)](_0xd96e85)[_0x3d7a92(0x178)](([_0x20d798,_0x4b7e07])=>_0x20d798+'='+_0x4b7e07);writeFileSync(_0x1a6475,_0x2bd601['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x2427cc,_0x40f246,_0x3f681a){const _0x3f8b68=a57_0x3b75d1;await saveKeychainAPIKey(_0x2427cc,_0x3f681a),setCachedCredential(_0x2427cc,_0x40f246,_0x3f681a);const _0x4453f6=getConfigFilePath(_0x3f681a);cleanupLegacyEnvFile(_0x4453f6)&&console[_0x3f8b68(0x179)](a57_0x4ec2e4[_0x3f8b68(0x15f)](_0x3f8b68(0x136)));}export function loadConfig(){const _0x384bde=a57_0x3b75d1,_0x3223d3={'apiKeys':{},'defaultSite':_0x384bde(0x160)},_0x4c3cdf=['us01','ap01',_0x384bde(0x139),_0x384bde(0x175),_0x384bde(0x153),_0x384bde(0x141),_0x384bde(0x144),_0x384bde(0x177),'stg-ap01',_0x384bde(0x13c)],_0x19e44a=getAPIKey();if(_0x19e44a)for(const _0x53439e of _0x4c3cdf){_0x3223d3['apiKeys'][_0x53439e]=_0x19e44a;}return _0x3223d3;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x2109e5=a57_0x3b75d1,_0x2669c0=a57_0x1a8cf5[_0x2109e5(0x132)](getConfigDir(),_0x2109e5(0x137));if(!a57_0x2398f7[_0x2109e5(0x154)](_0x2669c0))return undefined;try{const _0x15837c=a57_0x2398f7['readFileSync'](_0x2669c0,_0x2109e5(0x152)),_0x859739=JSON[_0x2109e5(0x161)](_0x15837c);return typeof _0x859739['proxy']===_0x2109e5(0x165)?_0x859739[_0x2109e5(0x158)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x25595a=a57_0x3b75d1,_0x1a9133=process.env.TDX_RELEASE_CHANNEL;if(_0x1a9133==='next'||_0x1a9133===_0x25595a(0x163))return _0x1a9133;const _0xdc8d9c=a57_0x1a8cf5[_0x25595a(0x132)](getConfigDir(),'tdx.json');if(!a57_0x2398f7['existsSync'](_0xdc8d9c))return _0x25595a(0x163);try{const _0x1420ac=a57_0x2398f7[_0x25595a(0x16e)](_0xdc8d9c,_0x25595a(0x152)),_0x4755c7=JSON['parse'](_0x1420ac);if(_0x4755c7[_0x25595a(0x169)]===_0x25595a(0x155))return _0x25595a(0x155);}catch{}return'stable';}export function saveReleaseChannel(_0x225249){const _0x28a88c=a57_0x3b75d1,_0x3bc89d=getConfigDir(),_0x586e1d=a57_0x1a8cf5['join'](_0x3bc89d,_0x28a88c(0x137));!existsSync(_0x3bc89d)&&mkdirSync(_0x3bc89d,{'recursive':!![],'mode':0x1c0});let _0x4b7327={};if(existsSync(_0x586e1d))try{const _0x31096f=readFileSync(_0x586e1d,_0x28a88c(0x152));_0x4b7327=JSON[_0x28a88c(0x161)](_0x31096f);}catch{}_0x4b7327[_0x28a88c(0x169)]=_0x225249,writeFileSync(_0x586e1d,JSON[_0x28a88c(0x16b)](_0x4b7327,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a58_0x593d73=a58_0x14d5;function a58_0x1028(){const _0x19eec8=['read','262260KMlnDB','core/connection-cache','66KuDxgP','18478528cNXmnP','connections','4009785AmhAAe','2100092CwwYvY','now','connections-{profile}.json','write','clear','1024304VzZQwH','499656EsEzFm','209405MerapK'];a58_0x1028=function(){return _0x19eec8;};return a58_0x1028();}(function(_0xb4f49,_0x29ea8d){const _0x2baffc=a58_0x14d5,_0x3b5956=_0xb4f49();while(!![]){try{const _0x59df14=parseInt(_0x2baffc(0x10b))/0x1+parseInt(_0x2baffc(0x10a))/0x2+parseInt(_0x2baffc(0x10e))/0x3+parseInt(_0x2baffc(0x114))/0x4+parseInt(_0x2baffc(0x113))/0x5+parseInt(_0x2baffc(0x110))/0x6*(parseInt(_0x2baffc(0x10c))/0x7)+-parseInt(_0x2baffc(0x111))/0x8;if(_0x59df14===_0x29ea8d)break;else _0x3b5956['push'](_0x3b5956['shift']());}catch(_0x3a5461){_0x3b5956['push'](_0x3b5956['shift']());}}}(a58_0x1028,0x6cc11));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x593d73(0x116),a58_0x593d73(0x10f));export function loadCachedConnections(_0x41ecd0){const _0x13a2b3=a58_0x593d73,_0xd41c83=connectionCache[_0x13a2b3(0x10d)](_0x41ecd0);return _0xd41c83?.[_0x13a2b3(0x112)]??null;}function a58_0x14d5(_0x6248ee,_0x3e2b55){_0x6248ee=_0x6248ee-0x10a;const _0x102813=a58_0x1028();let _0x14d594=_0x102813[_0x6248ee];return _0x14d594;}export function saveCachedConnections(_0x4c722f,_0x2128b7){const _0x52c9c3=a58_0x593d73;connectionCache[_0x52c9c3(0x117)](_0x4c722f,{'connections':_0x2128b7,'cachedAt':Date[_0x52c9c3(0x115)]()});}export function clearConnectionCache(_0x5bada5){const _0x267f12=a58_0x593d73;connectionCache[_0x267f12(0x118)](_0x5bada5);}
1
+ function a58_0x5167(){const _0x405ba0=['3929224NiMJxv','1753689HOpPNJ','clear','7938228YGtbom','25xfjEOi','write','1971117Qjbqjd','20aJvDwQ','connections-{profile}.json','9662303rybDWO','2FTFzeV','now','1131436sqsKiW','core/connection-cache','1092684WCSrVV','connections','read'];a58_0x5167=function(){return _0x405ba0;};return a58_0x5167();}function a58_0x3df8(_0x32517e,_0x4dcff8){_0x32517e=_0x32517e-0x136;const _0x516736=a58_0x5167();let _0x3df8d1=_0x516736[_0x32517e];return _0x3df8d1;}const a58_0x201153=a58_0x3df8;(function(_0x41c8f0,_0x223584){const _0x48b4a9=a58_0x3df8,_0x17a9c3=_0x41c8f0();while(!![]){try{const _0x201a06=-parseInt(_0x48b4a9(0x142))/0x1+parseInt(_0x48b4a9(0x13e))/0x2*(-parseInt(_0x48b4a9(0x146))/0x3)+parseInt(_0x48b4a9(0x140))/0x4*(parseInt(_0x48b4a9(0x138))/0x5)+-parseInt(_0x48b4a9(0x137))/0x6+parseInt(_0x48b4a9(0x13d))/0x7+parseInt(_0x48b4a9(0x145))/0x8+-parseInt(_0x48b4a9(0x13a))/0x9*(-parseInt(_0x48b4a9(0x13b))/0xa);if(_0x201a06===_0x223584)break;else _0x17a9c3['push'](_0x17a9c3['shift']());}catch(_0xef7ef1){_0x17a9c3['push'](_0x17a9c3['shift']());}}}(a58_0x5167,0xb0a3e));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x201153(0x13c),a58_0x201153(0x141));export function loadCachedConnections(_0x56dcf0){const _0xc7c48d=a58_0x201153,_0x3ea1e8=connectionCache[_0xc7c48d(0x144)](_0x56dcf0);return _0x3ea1e8?.[_0xc7c48d(0x143)]??null;}export function saveCachedConnections(_0x239a9c,_0x4f2b7f){const _0x1c7af2=a58_0x201153;connectionCache[_0x1c7af2(0x139)](_0x239a9c,{'connections':_0x4f2b7f,'cachedAt':Date[_0x1c7af2(0x13f)]()});}export function clearConnectionCache(_0x1d4e27){const _0x3b5a1f=a58_0x201153;connectionCache[_0x3b5a1f(0x136)](_0x1d4e27);}
@@ -1 +1 @@
1
- const a59_0x49c07c=a59_0x23bb;(function(_0x183b98,_0x5294b1){const _0x2c64c8=a59_0x23bb,_0x5a0c6b=_0x183b98();while(!![]){try{const _0x1fb309=parseInt(_0x2c64c8(0x107))/0x1+parseInt(_0x2c64c8(0xfb))/0x2*(-parseInt(_0x2c64c8(0xf9))/0x3)+-parseInt(_0x2c64c8(0x10e))/0x4+-parseInt(_0x2c64c8(0x10a))/0x5+parseInt(_0x2c64c8(0x104))/0x6+-parseInt(_0x2c64c8(0x102))/0x7*(-parseInt(_0x2c64c8(0xf5))/0x8)+parseInt(_0x2c64c8(0xf8))/0x9;if(_0x1fb309===_0x5294b1)break;else _0x5a0c6b['push'](_0x5a0c6b['shift']());}catch(_0x5225c1){_0x5a0c6b['push'](_0x5a0c6b['shift']());}}}(a59_0x43b2,0x5fe31));function a59_0x23bb(_0x53a729,_0x52bf37){_0x53a729=_0x53a729-0xf5;const _0x43b28a=a59_0x43b2();let _0x23bb8c=_0x43b28a[_0x53a729];return _0x23bb8c;}import a59_0x2ccd01 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x3f6012,_0x556ea2){if(_0x3f6012===undefined)return _0x556ea2;if(typeof _0x3f6012==='number')return _0x3f6012;return parseInt(_0x3f6012,0xa);}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':a59_0x49c07c(0x108)},{'title':'jp\x20\x20\x20-\x20Japan','value':a59_0x49c07c(0x105)},{'title':a59_0x49c07c(0xfe),'value':a59_0x49c07c(0xfd)},{'title':'ap02\x20-\x20Korea','value':'ap02'}];export function buildSiteChoices(_0x5e9fb4){const _0x5ee16d=a59_0x49c07c,_0x2a537=[...STANDARD_SITE_CHOICES];let _0x4b6c64=_0x2a537[_0x5ee16d(0x10b)](_0x2a77b4=>_0x2a77b4[_0x5ee16d(0x103)]===_0x5e9fb4);return _0x4b6c64===-0x1&&_0x5e9fb4!==_0x5ee16d(0x108)&&(_0x2a537['push']({'title':_0x5e9fb4,'value':_0x5e9fb4}),_0x4b6c64=_0x2a537[_0x5ee16d(0x10c)]-0x1),_0x2a537[_0x5ee16d(0x106)]({'title':_0x5ee16d(0xf7),'value':'other'}),{'choices':_0x2a537,'initialIndex':_0x4b6c64>=0x0?_0x4b6c64:0x0};}function a59_0x43b2(){const _0x220a7f=['6670161NSIMwJ','46524mjJdrv','test','98GaIApm','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','eu01','eu\x20\x20\x20-\x20Europe','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','trim','site','49qgVIIR','value','2029806HvjCdw','ap01','push','584680PZARpK','us01','customSite','3630330OGmUyv','findIndex','length','Cancelled','2099292pxyGPe','Site\x20name\x20cannot\x20be\x20empty','select','845056ziasXo','log','Enter\x20custom\x20site'];a59_0x43b2=function(){return _0x220a7f;};return a59_0x43b2();}export async function promptSiteSelection(_0x19944d,_0x202386,_0x2a1d1d=a59_0x49c07c(0x10d)){const _0x4eb0dc=a59_0x49c07c,{choices:_0x5cb6d7,initialIndex:_0x5b235d}=buildSiteChoices(_0x19944d),_0xd22070=_0x202386?_0x4eb0dc(0xff)+_0x202386+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x5ec6bd=await a59_0x2ccd01({'type':_0x4eb0dc(0x110),'name':_0x4eb0dc(0x101),'message':_0xd22070,'choices':_0x5cb6d7,'initial':_0x5b235d});if(!_0x5ec6bd[_0x4eb0dc(0x101)])return console['log']('\x0a'+_0x2a1d1d),null;if(_0x5ec6bd['site']!=='other')return _0x5ec6bd[_0x4eb0dc(0x101)];const _0x5f34f5=await a59_0x2ccd01({'type':'text','name':_0x4eb0dc(0x109),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x12ff09=>{const _0x4117e0=_0x4eb0dc;if(!_0x12ff09||!_0x12ff09[_0x4117e0(0x100)]())return _0x4117e0(0x10f);if(!/^[a-z0-9-]+$/[_0x4117e0(0xfa)](_0x12ff09[_0x4117e0(0x100)]()))return _0x4117e0(0xfc);return!![];}});if(!_0x5f34f5[_0x4eb0dc(0x109)])return console[_0x4eb0dc(0xf6)]('\x0a'+_0x2a1d1d),null;return _0x5f34f5[_0x4eb0dc(0x109)];}
1
+ const a59_0x2b5ba3=a59_0x29b7;(function(_0x3105d5,_0x6deb00){const _0x3c5465=a59_0x29b7,_0x11909a=_0x3105d5();while(!![]){try{const _0x821fad=parseInt(_0x3c5465(0x1f0))/0x1*(parseInt(_0x3c5465(0x1f6))/0x2)+parseInt(_0x3c5465(0x202))/0x3*(parseInt(_0x3c5465(0x1ff))/0x4)+parseInt(_0x3c5465(0x1f8))/0x5*(-parseInt(_0x3c5465(0x1e7))/0x6)+parseInt(_0x3c5465(0x1e8))/0x7*(-parseInt(_0x3c5465(0x1ec))/0x8)+parseInt(_0x3c5465(0x1fc))/0x9+parseInt(_0x3c5465(0x1ed))/0xa+-parseInt(_0x3c5465(0x1f5))/0xb*(parseInt(_0x3c5465(0x1ef))/0xc);if(_0x821fad===_0x6deb00)break;else _0x11909a['push'](_0x11909a['shift']());}catch(_0x5d38a1){_0x11909a['push'](_0x11909a['shift']());}}}(a59_0x47f1,0xe309a));import a59_0x30015c from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;function a59_0x47f1(){const _0x186124=['ap02\x20-\x20Korea','1684885eKWQjM','Enter\x20custom\x20site','trim','push','7503309LZOmVw','other','Select\x20your\x20Treasure\x20Data\x20site:','3157144ehclFp','number','customSite','3WHVpJx','eu01','log','jp\x20\x20\x20-\x20Japan','findIndex','Site\x20name\x20cannot\x20be\x20empty','length','test','ap02','24RRsDQu','277417LPeIgt','Enter\x20site\x20name:','text','value','352jEdIax','14571170fIBrUw','site','4560JJsFgX','20819hrdCTP','us\x20\x20\x20-\x20United\x20States','us01','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','ap01','24574yEdnpt','172sjuyHn'];a59_0x47f1=function(){return _0x186124;};return a59_0x47f1();}export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0xe58f9f,_0x2b2a1){const _0x54f702=a59_0x29b7;if(_0xe58f9f===undefined)return _0x2b2a1;if(typeof _0xe58f9f===_0x54f702(0x200))return _0xe58f9f;return parseInt(_0xe58f9f,0xa);}function a59_0x29b7(_0x1c8615,_0xe0f8f3){_0x1c8615=_0x1c8615-0x1df;const _0x47f19e=a59_0x47f1();let _0x29b710=_0x47f19e[_0x1c8615];return _0x29b710;}export const STANDARD_SITE_CHOICES=[{'title':a59_0x2b5ba3(0x1f1),'value':a59_0x2b5ba3(0x1f2)},{'title':a59_0x2b5ba3(0x1e1),'value':a59_0x2b5ba3(0x1f4)},{'title':'eu\x20\x20\x20-\x20Europe','value':a59_0x2b5ba3(0x1df)},{'title':a59_0x2b5ba3(0x1f7),'value':a59_0x2b5ba3(0x1e6)}];export function buildSiteChoices(_0x390e8f){const _0x2374ed=a59_0x2b5ba3,_0x25ded8=[...STANDARD_SITE_CHOICES];let _0x1a6c1d=_0x25ded8[_0x2374ed(0x1e2)](_0x39b274=>_0x39b274[_0x2374ed(0x1eb)]===_0x390e8f);return _0x1a6c1d===-0x1&&_0x390e8f!=='us01'&&(_0x25ded8[_0x2374ed(0x1fb)]({'title':_0x390e8f,'value':_0x390e8f}),_0x1a6c1d=_0x25ded8[_0x2374ed(0x1e4)]-0x1),_0x25ded8[_0x2374ed(0x1fb)]({'title':_0x2374ed(0x1f9),'value':'other'}),{'choices':_0x25ded8,'initialIndex':_0x1a6c1d>=0x0?_0x1a6c1d:0x0};}export async function promptSiteSelection(_0x163745,_0xb88b85,_0x31e652='Cancelled'){const _0x40d926=a59_0x2b5ba3,{choices:_0x5ecc1f,initialIndex:_0x13aaea}=buildSiteChoices(_0x163745),_0x2e0dce=_0xb88b85?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0xb88b85+'):':_0x40d926(0x1fe),_0x3e93c7=await a59_0x30015c({'type':'select','name':_0x40d926(0x1ee),'message':_0x2e0dce,'choices':_0x5ecc1f,'initial':_0x13aaea});if(!_0x3e93c7[_0x40d926(0x1ee)])return console[_0x40d926(0x1e0)]('\x0a'+_0x31e652),null;if(_0x3e93c7[_0x40d926(0x1ee)]!==_0x40d926(0x1fd))return _0x3e93c7[_0x40d926(0x1ee)];const _0x2e5d50=await a59_0x30015c({'type':_0x40d926(0x1ea),'name':'customSite','message':_0x40d926(0x1e9),'initial':_0x40d926(0x1f2),'validate':_0x182850=>{const _0x1ff5c2=_0x40d926;if(!_0x182850||!_0x182850[_0x1ff5c2(0x1fa)]())return _0x1ff5c2(0x1e3);if(!/^[a-z0-9-]+$/[_0x1ff5c2(0x1e5)](_0x182850[_0x1ff5c2(0x1fa)]()))return _0x1ff5c2(0x1f3);return!![];}});if(!_0x2e5d50['customSite'])return console[_0x40d926(0x1e0)]('\x0a'+_0x31e652),null;return _0x2e5d50[_0x40d926(0x201)];}
@@ -1 +1 @@
1
- function a60_0x3391(_0xbfb284,_0x4ff4dc){_0xbfb284=_0xbfb284-0x7d;const _0x336025=a60_0x3360();let _0x339187=_0x336025[_0xbfb284];return _0x339187;}(function(_0x278330,_0x509d28){const _0x285a9c=a60_0x3391,_0x4c4174=_0x278330();while(!![]){try{const _0x19266b=parseInt(_0x285a9c(0x8f))/0x1*(parseInt(_0x285a9c(0x86))/0x2)+-parseInt(_0x285a9c(0x87))/0x3*(parseInt(_0x285a9c(0x82))/0x4)+parseInt(_0x285a9c(0x7d))/0x5*(parseInt(_0x285a9c(0x8a))/0x6)+-parseInt(_0x285a9c(0x7e))/0x7*(parseInt(_0x285a9c(0x8b))/0x8)+parseInt(_0x285a9c(0x8c))/0x9+-parseInt(_0x285a9c(0x7f))/0xa*(parseInt(_0x285a9c(0x84))/0xb)+parseInt(_0x285a9c(0x81))/0xc*(parseInt(_0x285a9c(0x83))/0xd);if(_0x19266b===_0x509d28)break;else _0x4c4174['push'](_0x4c4174['shift']());}catch(_0x4813bf){_0x4c4174['push'](_0x4c4174['shift']());}}}(a60_0x3360,0x3f9f4));function a60_0x3360(){const _0x476f1f=['delete','1JomLHi','1710oTNmpJ','1776628SormyZ','860AGfvBb','clear','60NUYjVU','1397252HokMpk','275067IdnuZe','18469uCPjgS','apiKey','140564iObQhn','3PIwGRn','loadedAt','now','7068ZCsTsR','8dzQDZi','3862386yordXi','set'];a60_0x3360=function(){return _0x476f1f;};return a60_0x3360();}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x1af4b3,_0x1d8dbb){const _0x2b25f9=_0x1af4b3||'__default_site__',_0x3b2699=_0x1d8dbb||'__default_profile__';return _0x2b25f9+':'+_0x3b2699;}export function getCachedCredential(_0x4b06b6,_0x4faefd){const _0x427962=a60_0x3391,_0x4a2977=getCacheKey(_0x4b06b6,_0x4faefd),_0x282b90=cache['get'](_0x4a2977);if(!_0x282b90)return null;if(Date['now']()-_0x282b90[_0x427962(0x88)]>CACHE_TTL_MS)return cache[_0x427962(0x8e)](_0x4a2977),null;return _0x282b90[_0x427962(0x85)];}export function setCachedCredential(_0x4e6b5c,_0x295356,_0x35b8ee){const _0x23febe=a60_0x3391,_0x30e1a6=getCacheKey(_0x295356,_0x35b8ee);cache[_0x23febe(0x8d)](_0x30e1a6,{'apiKey':_0x4e6b5c,'loadedAt':Date[_0x23febe(0x89)]()});}export function clearCredentialCache(){const _0x3080e1=a60_0x3391;cache[_0x3080e1(0x80)]();}export function clearCachedCredential(_0x3e1ddb,_0x12d792){const _0x535046=a60_0x3391,_0x10a448=getCacheKey(_0x3e1ddb,_0x12d792);cache[_0x535046(0x8e)](_0x10a448);}
1
+ (function(_0x4c5d72,_0x4f6d07){const _0x21867c=a60_0x4a73,_0x3771ea=_0x4c5d72();while(!![]){try{const _0x7e2620=parseInt(_0x21867c(0x93))/0x1+parseInt(_0x21867c(0x9b))/0x2+parseInt(_0x21867c(0x8d))/0x3*(parseInt(_0x21867c(0x9c))/0x4)+-parseInt(_0x21867c(0x90))/0x5+parseInt(_0x21867c(0x91))/0x6*(-parseInt(_0x21867c(0x98))/0x7)+parseInt(_0x21867c(0x8e))/0x8*(parseInt(_0x21867c(0x8f))/0x9)+-parseInt(_0x21867c(0x99))/0xa*(parseInt(_0x21867c(0x94))/0xb);if(_0x7e2620===_0x4f6d07)break;else _0x3771ea['push'](_0x3771ea['shift']());}catch(_0x38b3d0){_0x3771ea['push'](_0x3771ea['shift']());}}}(a60_0x64fb,0x8532e));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x580ffc,_0x405355){const _0xfb4ec0=a60_0x4a73,_0x4a7253=_0x580ffc||'__default_site__',_0x3a7e92=_0x405355||_0xfb4ec0(0x96);return _0x4a7253+':'+_0x3a7e92;}export function getCachedCredential(_0x3e618e,_0x4cdfdf){const _0x35b47d=a60_0x4a73,_0x4497a7=getCacheKey(_0x3e618e,_0x4cdfdf),_0x210a46=cache[_0x35b47d(0x8c)](_0x4497a7);if(!_0x210a46)return null;if(Date[_0x35b47d(0x95)]()-_0x210a46[_0x35b47d(0x9a)]>CACHE_TTL_MS)return cache['delete'](_0x4497a7),null;return _0x210a46[_0x35b47d(0x97)];}export function setCachedCredential(_0x3dda1a,_0x55fe04,_0x5e2125){const _0x36ba37=getCacheKey(_0x55fe04,_0x5e2125);cache['set'](_0x36ba37,{'apiKey':_0x3dda1a,'loadedAt':Date['now']()});}function a60_0x4a73(_0x5b32db,_0x256595){_0x5b32db=_0x5b32db-0x8c;const _0x64fb65=a60_0x64fb();let _0x4a7329=_0x64fb65[_0x5b32db];return _0x4a7329;}export function clearCredentialCache(){const _0xe62561=a60_0x4a73;cache[_0xe62561(0x9d)]();}function a60_0x64fb(){const _0xefeb=['328689MyNdsk','2954005nrxnjn','6wrzjSA','delete','1073580FFqAdr','187WbrEqx','now','__default_profile__','apiKey','2659034zumnzQ','804290ezWPHP','loadedAt','1085228JrKbnq','4bBqbdS','clear','get','3035091xEVAnV','56uRqNcY'];a60_0x64fb=function(){return _0xefeb;};return a60_0x64fb();}export function clearCachedCredential(_0x1ed91b,_0x242903){const _0x5db2dc=a60_0x4a73,_0x78229b=getCacheKey(_0x1ed91b,_0x242903);cache[_0x5db2dc(0x92)](_0x78229b);}
@@ -1 +1 @@
1
- const a61_0x455589=a61_0x22b8;(function(_0x45a35c,_0x55ca7a){const _0x3db64e=a61_0x22b8,_0x386099=_0x45a35c();while(!![]){try{const _0x130a76=-parseInt(_0x3db64e(0x160))/0x1*(parseInt(_0x3db64e(0x199))/0x2)+parseInt(_0x3db64e(0x195))/0x3*(-parseInt(_0x3db64e(0x192))/0x4)+parseInt(_0x3db64e(0x16b))/0x5*(parseInt(_0x3db64e(0x179))/0x6)+parseInt(_0x3db64e(0x154))/0x7+parseInt(_0x3db64e(0x16c))/0x8*(parseInt(_0x3db64e(0x193))/0x9)+-parseInt(_0x3db64e(0x1a4))/0xa*(-parseInt(_0x3db64e(0x168))/0xb)+parseInt(_0x3db64e(0x152))/0xc;if(_0x130a76===_0x55ca7a)break;else _0x386099['push'](_0x386099['shift']());}catch(_0x487ba5){_0x386099['push'](_0x386099['shift']());}}}(a61_0x448c,0x1cbb2));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a61_0x22b8(_0x38461f,_0x5ca697){_0x38461f=_0x38461f-0x14f;const _0x448c79=a61_0x448c();let _0x22b88d=_0x448c79[_0x38461f];return _0x22b88d;}import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';function a61_0x448c(){const _0x1a3372=['us01','parent_segment','assign','composableAudience','session','resolveAPIKeyAsync','apiKey','replace','bold','layers','profileSource','1RqzWRP','tdx.json','Project','Profile\x20Credentials','parentSegment','profile','INFO','llm_agent','49401VPqaOe','(session:\x20','default','5ozcUqv','1016664LQznVV','[configuration\x20files]','accessToken','segment_path','logLevel','site','refresh_token','.env','env','[context]','getSource','dim','cli','1315452dSHkWg','verbose','profile:\x20','llmAgent','string','llm_project','not\x20set','(using\x20session:\x20','expires_at','activeProfile','composable_audience','database','displayWithSources','loadGlobalConfig','profiles','globalCredentials','none','createAsync','access_token','Global\x20Credentials','global','configFiles','log','llmProject','Profile','20jxhhZJ','9SyGZwB','utf-8','88353ijlqki','workflowProject','config','segmentPath','299986oKLWvT','existsSync','getParameters','green','Session','profileCredentials','proxy','cyan','CLI\x20flag:\x20--','.json','sessionId','20TShyRk','workflow_project','display','join','cliFlags','now','Global','sessions','readFileSync','494856sHPpfi','project','128695Zndgby'];a61_0x448c=function(){return _0x1a3372;};return a61_0x448c();}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_0x5dc2e6 from'node:fs';import*as a61_0x3fa129 from'node:path';import a61_0x2204bb from'chalk';export class GlobalContext{['site'];[a61_0x455589(0x184)];[a61_0x455589(0x156)];['segment_path'];[a61_0x455589(0x17e)];[a61_0x455589(0x167)];[a61_0x455589(0x1a5)];[a61_0x455589(0x183)];['apiKey'];['accessToken'];[a61_0x455589(0x19f)];[a61_0x455589(0x17a)];[a61_0x455589(0x170)];[a61_0x455589(0x165)];[a61_0x455589(0x15f)]=null;['layers'];[a61_0x455589(0x182)];[a61_0x455589(0x1a3)];['configFiles'];constructor(_0x14f92a){const _0x2e1bce=a61_0x455589;this['sessionId']=getSessionID(_0x14f92a[_0x2e1bce(0x159)]);const _0x421981=loadSessionContext(_0x14f92a[_0x2e1bce(0x159)]),_0x3428b1=loadProjectConfig(),_0x5819a4=this[_0x2e1bce(0x186)]();if(_0x14f92a[_0x2e1bce(0x165)])this[_0x2e1bce(0x182)]=_0x14f92a[_0x2e1bce(0x165)],this['profileSource']=_0x2e1bce(0x178);else{if(_0x421981?.[_0x2e1bce(0x165)])this[_0x2e1bce(0x182)]=_0x421981[_0x2e1bce(0x165)],this['profileSource']='session';else{if(_0x5819a4[_0x2e1bce(0x165)])this[_0x2e1bce(0x182)]=_0x5819a4[_0x2e1bce(0x165)],this[_0x2e1bce(0x15f)]=_0x2e1bce(0x197);else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this[_0x2e1bce(0x15f)]=_0x2e1bce(0x174)):(this[_0x2e1bce(0x182)]=null,this['profileSource']=null);}}const _0x42d6e7=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x5f1e60=_0x365c03=>{const _0x50b88b=_0x2e1bce;if(!_0x365c03)return{};const _0xd5c126=_0x365c03,_0x44ad8c={};for(const [_0x14ffb9,_0x2dd421]of Object['entries'](_0xd5c126)){typeof _0x2dd421===_0x50b88b(0x17d)&&(_0x44ad8c[_0x14ffb9]=_0x2dd421);}return _0x44ad8c;},_0x1fa949={},_0x2cef42=(_0x4be20d,_0x1bb511,_0x2237e3)=>{const _0x450d4e=_0x2e1bce;if(!_0x4be20d)return![];if(_0x2237e3&&_0x4be20d===_0x2237e3)return![];const _0x1a26a2=_0x421981,_0x564db8=_0x3428b1,_0x52538c=_0x42d6e7?.[_0x450d4e(0x197)],_0x28006b=_0x5819a4,_0xa3b454=_0x1a26a2?.[_0x1bb511],_0x47a461=_0x564db8?.[_0x1bb511],_0xd41177=_0x52538c?.[_0x1bb511],_0x209419=_0x28006b[_0x1bb511];return _0x4be20d!==_0xa3b454&&_0x4be20d!==_0x47a461&&_0x4be20d!==_0xd41177&&_0x4be20d!==_0x209419;},_0x5b1d66=[{'optionKey':_0x2e1bce(0x171),'contextKey':_0x2e1bce(0x171),'defaultValue':_0x2e1bce(0x155)},{'optionKey':_0x2e1bce(0x184),'contextKey':'database'},{'optionKey':'parentSegment','contextKey':_0x2e1bce(0x156)},{'optionKey':_0x2e1bce(0x190),'contextKey':_0x2e1bce(0x17e)},{'optionKey':_0x2e1bce(0x17c),'contextKey':_0x2e1bce(0x167)},{'optionKey':_0x2e1bce(0x158),'contextKey':_0x2e1bce(0x183)},{'optionKey':_0x2e1bce(0x165),'contextKey':_0x2e1bce(0x165)}];for(const {optionKey:_0x34297f,contextKey:_0x5ae896,defaultValue:_0x3f7e14}of _0x5b1d66){const _0x15fb2b=_0x14f92a[_0x34297f];_0x2cef42(_0x15fb2b,_0x5ae896,_0x3f7e14)&&(_0x1fa949[_0x5ae896]=_0x15fb2b);}this['layers']={'cliFlags':_0x1fa949,'session':_0x5f1e60(_0x421981),'project':_0x5f1e60(_0x3428b1),'profile':_0x5f1e60(_0x42d6e7?.[_0x2e1bce(0x197)]),'global':_0x5f1e60(_0x5819a4)};const _0x25e011={...this['layers']['global'],...this[_0x2e1bce(0x15e)]['profile'],...this[_0x2e1bce(0x15e)][_0x2e1bce(0x153)]};process.env.TDX_SITE&&!this['layers'][_0x2e1bce(0x159)]['site']&&!this[_0x2e1bce(0x15e)][_0x2e1bce(0x1a8)][_0x2e1bce(0x171)]&&(_0x25e011[_0x2e1bce(0x171)]=process.env.TDX_SITE);Object[_0x2e1bce(0x157)](_0x25e011,this[_0x2e1bce(0x15e)][_0x2e1bce(0x159)]),Object['assign'](_0x25e011,this[_0x2e1bce(0x15e)][_0x2e1bce(0x1a8)]);const _0x4b5a35=_0x25e011[_0x2e1bce(0x171)]||_0x2e1bce(0x155);this[_0x2e1bce(0x171)]=resolveSite(_0x4b5a35),this[_0x2e1bce(0x184)]=_0x25e011[_0x2e1bce(0x184)],this[_0x2e1bce(0x156)]=_0x25e011[_0x2e1bce(0x156)],this[_0x2e1bce(0x16f)]=_0x25e011['segment_path'],this[_0x2e1bce(0x17e)]=_0x25e011[_0x2e1bce(0x17e)],this['llm_agent']=_0x25e011[_0x2e1bce(0x167)],this[_0x2e1bce(0x1a5)]=_0x25e011[_0x2e1bce(0x1a5)],this['composable_audience']=_0x25e011[_0x2e1bce(0x183)],this['verbose']=_0x14f92a[_0x2e1bce(0x17a)]||![],this[_0x2e1bce(0x170)]=_0x14f92a[_0x2e1bce(0x170)]??LogLevel[_0x2e1bce(0x166)],this[_0x2e1bce(0x165)]=this[_0x2e1bce(0x182)]||undefined,this[_0x2e1bce(0x16e)]=getAccessToken(this[_0x2e1bce(0x182)]||undefined),this[_0x2e1bce(0x15b)]=getAPIKey(this[_0x2e1bce(0x182)]||undefined);const _0x1e098b=typeof _0x5819a4[_0x2e1bce(0x19f)]===_0x2e1bce(0x17d)?_0x5819a4[_0x2e1bce(0x19f)]:undefined;this[_0x2e1bce(0x19f)]=_0x1e098b||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x5241c4=getConfigDir(),_0x53d545=a61_0x3fa129[_0x2e1bce(0x1a7)](_0x5241c4,_0x2e1bce(0x150),this[_0x2e1bce(0x1a3)]+_0x2e1bce(0x1a2)),_0x271f14=findProjectConfigPath(),_0x56136f=a61_0x3fa129[_0x2e1bce(0x1a7)](_0x5241c4,_0x2e1bce(0x161)),_0x38b8e9=a61_0x3fa129[_0x2e1bce(0x1a7)](_0x5241c4,_0x2e1bce(0x173));let _0x40b06b=null,_0x100ea1=null;this[_0x2e1bce(0x182)]&&(_0x40b06b=a61_0x3fa129[_0x2e1bce(0x1a7)](_0x5241c4,'profiles',this[_0x2e1bce(0x182)],_0x2e1bce(0x161)),_0x100ea1=a61_0x3fa129[_0x2e1bce(0x1a7)](_0x5241c4,_0x2e1bce(0x187),this[_0x2e1bce(0x182)],_0x2e1bce(0x173))),this[_0x2e1bce(0x18e)]={'session':a61_0x5dc2e6[_0x2e1bce(0x19a)](_0x53d545)?_0x53d545:null,'project':_0x271f14,'profile':_0x40b06b&&a61_0x5dc2e6[_0x2e1bce(0x19a)](_0x40b06b)?_0x40b06b:null,'profileCredentials':_0x100ea1&&a61_0x5dc2e6[_0x2e1bce(0x19a)](_0x100ea1)?_0x100ea1:null,'global':a61_0x5dc2e6['existsSync'](_0x56136f)?_0x56136f:null,'globalCredentials':a61_0x5dc2e6[_0x2e1bce(0x19a)](_0x38b8e9)?_0x38b8e9:null};}[a61_0x455589(0x176)](_0x495219,_0x2d52c6){const _0x47d6eb=a61_0x455589;if(!_0x2d52c6)return _0x47d6eb(0x17f);const _0x144917=_0x2d52c6;if(this[_0x47d6eb(0x15e)][_0x47d6eb(0x1a8)][_0x495219]===_0x144917){if(_0x495219===_0x47d6eb(0x171)&&_0x144917===_0x47d6eb(0x155)&&!this[_0x47d6eb(0x15e)][_0x47d6eb(0x159)][_0x47d6eb(0x171)]&&!this['layers'][_0x47d6eb(0x153)][_0x47d6eb(0x171)]&&!this[_0x47d6eb(0x15e)][_0x47d6eb(0x165)]['site']&&!this[_0x47d6eb(0x15e)][_0x47d6eb(0x18d)][_0x47d6eb(0x171)])return _0x47d6eb(0x16a);return _0x47d6eb(0x1a1)+_0x495219[_0x47d6eb(0x15c)](/_/g,'-');}if(this['layers'][_0x47d6eb(0x159)][_0x495219]===_0x144917)return _0x47d6eb(0x159);if(this['layers'][_0x47d6eb(0x153)][_0x495219]===_0x144917)return _0x47d6eb(0x153);if(this['layers'][_0x47d6eb(0x165)][_0x495219]===_0x144917)return _0x47d6eb(0x17b)+this['activeProfile'];if(this['layers'][_0x47d6eb(0x18d)][_0x495219]===_0x144917)return'global';return _0x47d6eb(0x16a);}[a61_0x455589(0x186)](){const _0x19d79a=a61_0x455589,_0x52fd0b=a61_0x3fa129['join'](getConfigDir(),_0x19d79a(0x161));if(!a61_0x5dc2e6[_0x19d79a(0x19a)](_0x52fd0b))return{};try{const _0x17a0f4=a61_0x5dc2e6[_0x19d79a(0x151)](_0x52fd0b,_0x19d79a(0x194));return JSON['parse'](_0x17a0f4);}catch{return{};}}['injectIntoOptions'](_0x11d59e){const _0x10317f=a61_0x455589;_0x11d59e[_0x10317f(0x171)]=this[_0x10317f(0x171)],!_0x11d59e[_0x10317f(0x184)]&&this['database']&&(_0x11d59e['database']=this['database']),!_0x11d59e[_0x10317f(0x164)]&&this[_0x10317f(0x156)]&&(_0x11d59e[_0x10317f(0x164)]=this[_0x10317f(0x156)]),!_0x11d59e[_0x10317f(0x198)]&&this[_0x10317f(0x16f)]&&(_0x11d59e[_0x10317f(0x198)]=this[_0x10317f(0x16f)]),!_0x11d59e[_0x10317f(0x190)]&&this[_0x10317f(0x17e)]&&(_0x11d59e['llmProject']=this[_0x10317f(0x17e)]),!_0x11d59e[_0x10317f(0x17c)]&&this['llm_agent']&&(_0x11d59e[_0x10317f(0x17c)]=this[_0x10317f(0x167)]),!_0x11d59e[_0x10317f(0x196)]&&this[_0x10317f(0x1a5)]&&(_0x11d59e['workflowProject']=this[_0x10317f(0x1a5)]),!_0x11d59e[_0x10317f(0x158)]&&this[_0x10317f(0x183)]&&(_0x11d59e[_0x10317f(0x158)]=this[_0x10317f(0x183)]);}[a61_0x455589(0x19b)](){const _0x339f20=a61_0x455589;return[{'key':_0x339f20(0x171),'value':this[_0x339f20(0x171)]},{'key':'database','value':this[_0x339f20(0x184)]},{'key':_0x339f20(0x156),'value':this[_0x339f20(0x156)]},{'key':_0x339f20(0x16f),'value':this['segment_path']},{'key':'llm_project','value':this['llm_project']},{'key':_0x339f20(0x167),'value':this[_0x339f20(0x167)]},{'key':'workflow_project','value':this[_0x339f20(0x1a5)]},{'key':_0x339f20(0x183),'value':this[_0x339f20(0x183)]},{'key':_0x339f20(0x165),'value':this[_0x339f20(0x182)]||undefined}];}[a61_0x455589(0x1a6)](){const _0x113cbe=a61_0x455589;console['log'](a61_0x2204bb['bold']('[context]'));for(const {key:_0x43c7d2,value:_0x3b932c}of this[_0x113cbe(0x19b)]()){_0x3b932c&&console[_0x113cbe(0x18f)](a61_0x2204bb[_0x113cbe(0x1a0)](_0x43c7d2)+':\x20'+_0x3b932c);}}[a61_0x455589(0x185)](){const _0x319b61=a61_0x455589;console[_0x319b61(0x18f)](a61_0x2204bb[_0x319b61(0x15d)](_0x319b61(0x175)));for(const {key:_0x317280,value:_0x37d740}of this['getParameters']()){if(_0x37d740){const _0xed3065=_0x317280==='profile'?'(active)':'('+this[_0x319b61(0x176)](_0x317280,_0x37d740)+')';console['log'](a61_0x2204bb[_0x319b61(0x1a0)](_0x317280)+':\x20'+_0x37d740+'\x20'+a61_0x2204bb['dim'](_0xed3065));}}console[_0x319b61(0x18f)]('\x0a'+a61_0x2204bb[_0x319b61(0x15d)](_0x319b61(0x16d)));const _0x5612f3=[{'label':_0x319b61(0x19d),'path':this[_0x319b61(0x18e)][_0x319b61(0x159)],'extra':_0x319b61(0x169)+this[_0x319b61(0x1a3)]+')'},{'label':_0x319b61(0x162),'path':this['configFiles'][_0x319b61(0x153)]},{'label':_0x319b61(0x191),'path':this['configFiles'][_0x319b61(0x165)]},{'label':_0x319b61(0x163),'path':this[_0x319b61(0x18e)][_0x319b61(0x19e)]},{'label':_0x319b61(0x14f),'path':this['configFiles'][_0x319b61(0x18d)]},{'label':_0x319b61(0x18c),'path':this['configFiles'][_0x319b61(0x188)]}];for(const {label:_0x4d57c0,path:_0x1bbd28,extra:_0x4d7e56}of _0x5612f3){if(_0x1bbd28)console[_0x319b61(0x18f)](a61_0x2204bb[_0x319b61(0x1a0)](_0x4d57c0)+':\x20'+_0x1bbd28+'\x20'+a61_0x2204bb[_0x319b61(0x19c)]('✓')+(_0x4d7e56?'\x20'+a61_0x2204bb[_0x319b61(0x177)](_0x4d7e56):''));else{if(_0x4d57c0===_0x319b61(0x19d))console['log'](a61_0x2204bb[_0x319b61(0x1a0)](_0x4d57c0)+':\x20'+a61_0x2204bb[_0x319b61(0x177)](_0x319b61(0x189))+'\x20'+a61_0x2204bb[_0x319b61(0x177)](_0x319b61(0x180)+this[_0x319b61(0x1a3)]+')'));else(_0x4d57c0==='Project'||_0x4d57c0==='Global')&&console['log'](a61_0x2204bb[_0x319b61(0x1a0)](_0x4d57c0)+':\x20'+a61_0x2204bb['dim']('none'));}}}async[a61_0x455589(0x15a)](){const _0x56e123=a61_0x455589;if(!this[_0x56e123(0x16e)]){const _0x3afd1b=await getOAuthTokens(this[_0x56e123(0x182)]||undefined);if(_0x3afd1b){const _0x4dc186=0x5*0x3c*0x3e8,_0x4f4a71=!_0x3afd1b[_0x56e123(0x181)]||_0x3afd1b[_0x56e123(0x181)]<Date[_0x56e123(0x1a9)]()+_0x4dc186;if(_0x4f4a71&&_0x3afd1b[_0x56e123(0x172)])try{const _0x30da36=getConsoleUrl(this[_0x56e123(0x171)]),_0x11a94d=await refreshAccessToken(_0x30da36,_0x3afd1b[_0x56e123(0x172)]);await saveOAuthTokens(_0x11a94d,this[_0x56e123(0x182)]||undefined),this['accessToken']=_0x11a94d[_0x56e123(0x18b)];}catch{this[_0x56e123(0x16e)]=_0x3afd1b[_0x56e123(0x18b)];}else this['accessToken']=_0x3afd1b[_0x56e123(0x18b)];return undefined;}}return this[_0x56e123(0x15b)]=await getAPIKeyAsync(this[_0x56e123(0x171)],this['activeProfile']||undefined),this[_0x56e123(0x15b)];}static async[a61_0x455589(0x18a)](_0x51d766){const _0x40f2b0=a61_0x455589,_0x5c7d44=new GlobalContext(_0x51d766);return await _0x5c7d44[_0x40f2b0(0x15a)](),_0x5c7d44;}}
1
+ const a61_0x247f34=a61_0x1b0b;(function(_0x3b78b6,_0x3b84de){const _0x2d85d5=a61_0x1b0b,_0x31c30c=_0x3b78b6();while(!![]){try{const _0x4030ce=-parseInt(_0x2d85d5(0x1ee))/0x1*(parseInt(_0x2d85d5(0x1a4))/0x2)+parseInt(_0x2d85d5(0x1db))/0x3*(parseInt(_0x2d85d5(0x1f1))/0x4)+-parseInt(_0x2d85d5(0x1e6))/0x5*(-parseInt(_0x2d85d5(0x1bf))/0x6)+parseInt(_0x2d85d5(0x1e2))/0x7*(-parseInt(_0x2d85d5(0x1d3))/0x8)+-parseInt(_0x2d85d5(0x1c9))/0x9+parseInt(_0x2d85d5(0x1b9))/0xa*(-parseInt(_0x2d85d5(0x1c5))/0xb)+-parseInt(_0x2d85d5(0x1ce))/0xc*(-parseInt(_0x2d85d5(0x1ca))/0xd);if(_0x4030ce===_0x3b84de)break;else _0x31c30c['push'](_0x31c30c['shift']());}catch(_0x3d1282){_0x31c30c['push'](_0x31c30c['shift']());}}}(a61_0x5e31,0x8d569));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a61_0x5e31(){const _0x98256f=['logLevel','refresh_token','activeProfile','accessToken','apiKey','layers','sessionId','622942PCtcwF','log','site','(active)','assign','llm_project','access_token','workflowProject','join','Global','[context]','verbose','global','Session','sessions','config','string','profile','workflow_project','CLI\x20flag:\x20--','entries','5255410aKiSnq','expires_at','composableAudience','readFileSync','now','.env','438DFmfPt','Profile','database','profileSource','Profile\x20Credentials','existsSync','22ubkPfL','default','getSource','llmAgent','3767787yIaRGA','169663iWJgsk','cliFlags','configFiles','(using\x20session:\x20','1908fiIUSj','cli','profile:\x20','none','display','1936yCjQdH','us01','profileCredentials','llmProject','cyan','loadGlobalConfig','segment_path','parent_segment','30327GTuqDL','displayWithSources','bold','parentSegment','proxy','.json','profiles','28378DejDBD','replace','resolveAPIKeyAsync','createAsync','19555dPieMr','not\x20set','composable_audience','session','tdx.json','dim','getParameters','segmentPath','1WlmsNi','utf-8','project','388fjcdbZ','Project','llm_agent'];a61_0x5e31=function(){return _0x98256f;};return a61_0x5e31();}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';function a61_0x1b0b(_0x311a5f,_0x2acfa4){_0x311a5f=_0x311a5f-0x1a1;const _0x5e31e5=a61_0x5e31();let _0x1b0ba5=_0x5e31e5[_0x311a5f];return _0x1b0ba5;}import*as a61_0x561009 from'node:fs';import*as a61_0xe561ba from'node:path';import a61_0xe55df0 from'chalk';export class GlobalContext{[a61_0x247f34(0x1a6)];['database'];['parent_segment'];[a61_0x247f34(0x1d9)];[a61_0x247f34(0x1a9)];[a61_0x247f34(0x1f3)];[a61_0x247f34(0x1b6)];['composable_audience'];[a61_0x247f34(0x1a1)];[a61_0x247f34(0x1f7)];['proxy'];[a61_0x247f34(0x1af)];[a61_0x247f34(0x1f4)];['profile'];[a61_0x247f34(0x1c2)]=null;[a61_0x247f34(0x1a2)];['activeProfile'];['sessionId'];[a61_0x247f34(0x1cc)];constructor(_0x28487d){const _0x260a43=a61_0x247f34;this['sessionId']=getSessionID(_0x28487d['session']);const _0x16e953=loadSessionContext(_0x28487d['session']),_0x2c5be0=loadProjectConfig(),_0xf76098=this[_0x260a43(0x1d8)]();if(_0x28487d[_0x260a43(0x1b5)])this[_0x260a43(0x1f6)]=_0x28487d[_0x260a43(0x1b5)],this['profileSource']=_0x260a43(0x1cf);else{if(_0x16e953?.[_0x260a43(0x1b5)])this[_0x260a43(0x1f6)]=_0x16e953[_0x260a43(0x1b5)],this[_0x260a43(0x1c2)]=_0x260a43(0x1e9);else{if(_0xf76098[_0x260a43(0x1b5)])this[_0x260a43(0x1f6)]=_0xf76098['profile'],this[_0x260a43(0x1c2)]=_0x260a43(0x1b3);else process.env.TDX_PROFILE?(this[_0x260a43(0x1f6)]=process.env.TDX_PROFILE,this[_0x260a43(0x1c2)]='env'):(this[_0x260a43(0x1f6)]=null,this[_0x260a43(0x1c2)]=null);}}const _0x13eb3a=this['activeProfile']?loadProfile(this[_0x260a43(0x1f6)]):null,_0x5e3086=_0x6add85=>{const _0x329352=_0x260a43;if(!_0x6add85)return{};const _0x53b504=_0x6add85,_0x1c7725={};for(const [_0x27f748,_0x3565c8]of Object[_0x329352(0x1b8)](_0x53b504)){typeof _0x3565c8===_0x329352(0x1b4)&&(_0x1c7725[_0x27f748]=_0x3565c8);}return _0x1c7725;},_0x549b8e={},_0x4c2c4d=(_0x516e26,_0x32cdf6,_0x1a5830)=>{const _0x89f2ab=_0x260a43;if(!_0x516e26)return![];if(_0x1a5830&&_0x516e26===_0x1a5830)return![];const _0x5294c3=_0x16e953,_0x4d1f31=_0x2c5be0,_0x43ba58=_0x13eb3a?.[_0x89f2ab(0x1b3)],_0x38a3b6=_0xf76098,_0x2422da=_0x5294c3?.[_0x32cdf6],_0x611da5=_0x4d1f31?.[_0x32cdf6],_0x5ed6c3=_0x43ba58?.[_0x32cdf6],_0x2cbef3=_0x38a3b6[_0x32cdf6];return _0x516e26!==_0x2422da&&_0x516e26!==_0x611da5&&_0x516e26!==_0x5ed6c3&&_0x516e26!==_0x2cbef3;},_0x614dc9=[{'optionKey':'site','contextKey':_0x260a43(0x1a6),'defaultValue':'us01'},{'optionKey':_0x260a43(0x1c1),'contextKey':'database'},{'optionKey':'parentSegment','contextKey':_0x260a43(0x1da)},{'optionKey':'llmProject','contextKey':_0x260a43(0x1a9)},{'optionKey':'llmAgent','contextKey':_0x260a43(0x1f3)},{'optionKey':'composableAudience','contextKey':_0x260a43(0x1e8)},{'optionKey':'profile','contextKey':'profile'}];for(const {optionKey:_0x495e13,contextKey:_0x99ed0b,defaultValue:_0x409413}of _0x614dc9){const _0x4343a7=_0x28487d[_0x495e13];_0x4c2c4d(_0x4343a7,_0x99ed0b,_0x409413)&&(_0x549b8e[_0x99ed0b]=_0x4343a7);}this['layers']={'cliFlags':_0x549b8e,'session':_0x5e3086(_0x16e953),'project':_0x5e3086(_0x2c5be0),'profile':_0x5e3086(_0x13eb3a?.[_0x260a43(0x1b3)]),'global':_0x5e3086(_0xf76098)};const _0x23fdd7={...this['layers']['global'],...this[_0x260a43(0x1a2)][_0x260a43(0x1b5)],...this[_0x260a43(0x1a2)][_0x260a43(0x1f0)]};process.env.TDX_SITE&&!this[_0x260a43(0x1a2)][_0x260a43(0x1e9)]['site']&&!this[_0x260a43(0x1a2)][_0x260a43(0x1cb)]['site']&&(_0x23fdd7[_0x260a43(0x1a6)]=process.env.TDX_SITE);Object[_0x260a43(0x1a8)](_0x23fdd7,this[_0x260a43(0x1a2)]['session']),Object[_0x260a43(0x1a8)](_0x23fdd7,this[_0x260a43(0x1a2)]['cliFlags']);const _0x7a2bad=_0x23fdd7['site']||_0x260a43(0x1d4);this[_0x260a43(0x1a6)]=resolveSite(_0x7a2bad),this[_0x260a43(0x1c1)]=_0x23fdd7[_0x260a43(0x1c1)],this[_0x260a43(0x1da)]=_0x23fdd7[_0x260a43(0x1da)],this['segment_path']=_0x23fdd7[_0x260a43(0x1d9)],this[_0x260a43(0x1a9)]=_0x23fdd7[_0x260a43(0x1a9)],this['llm_agent']=_0x23fdd7['llm_agent'],this['workflow_project']=_0x23fdd7[_0x260a43(0x1b6)],this[_0x260a43(0x1e8)]=_0x23fdd7['composable_audience'],this[_0x260a43(0x1af)]=_0x28487d[_0x260a43(0x1af)]||![],this[_0x260a43(0x1f4)]=_0x28487d[_0x260a43(0x1f4)]??LogLevel['INFO'],this['profile']=this[_0x260a43(0x1f6)]||undefined,this[_0x260a43(0x1f7)]=getAccessToken(this[_0x260a43(0x1f6)]||undefined),this[_0x260a43(0x1a1)]=getAPIKey(this[_0x260a43(0x1f6)]||undefined);const _0xd821ac=typeof _0xf76098[_0x260a43(0x1df)]==='string'?_0xf76098[_0x260a43(0x1df)]:undefined;this[_0x260a43(0x1df)]=_0xd821ac||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x58b44f=getConfigDir(),_0x22c52d=a61_0xe561ba['join'](_0x58b44f,_0x260a43(0x1b2),this[_0x260a43(0x1a3)]+_0x260a43(0x1e0)),_0x57b071=findProjectConfigPath(),_0x293405=a61_0xe561ba[_0x260a43(0x1ac)](_0x58b44f,_0x260a43(0x1ea)),_0x36931f=a61_0xe561ba[_0x260a43(0x1ac)](_0x58b44f,_0x260a43(0x1be));let _0x2767fe=null,_0x1e2f66=null;this['activeProfile']&&(_0x2767fe=a61_0xe561ba[_0x260a43(0x1ac)](_0x58b44f,_0x260a43(0x1e1),this['activeProfile'],'tdx.json'),_0x1e2f66=a61_0xe561ba[_0x260a43(0x1ac)](_0x58b44f,'profiles',this[_0x260a43(0x1f6)],'.env')),this[_0x260a43(0x1cc)]={'session':a61_0x561009[_0x260a43(0x1c4)](_0x22c52d)?_0x22c52d:null,'project':_0x57b071,'profile':_0x2767fe&&a61_0x561009[_0x260a43(0x1c4)](_0x2767fe)?_0x2767fe:null,'profileCredentials':_0x1e2f66&&a61_0x561009[_0x260a43(0x1c4)](_0x1e2f66)?_0x1e2f66:null,'global':a61_0x561009[_0x260a43(0x1c4)](_0x293405)?_0x293405:null,'globalCredentials':a61_0x561009['existsSync'](_0x36931f)?_0x36931f:null};}[a61_0x247f34(0x1c7)](_0x516320,_0x18fd61){const _0x302177=a61_0x247f34;if(!_0x18fd61)return _0x302177(0x1e7);const _0xb61eaf=_0x18fd61;if(this[_0x302177(0x1a2)][_0x302177(0x1cb)][_0x516320]===_0xb61eaf){if(_0x516320===_0x302177(0x1a6)&&_0xb61eaf==='us01'&&!this['layers']['session'][_0x302177(0x1a6)]&&!this[_0x302177(0x1a2)][_0x302177(0x1f0)]['site']&&!this[_0x302177(0x1a2)][_0x302177(0x1b5)]['site']&&!this['layers'][_0x302177(0x1b0)][_0x302177(0x1a6)])return _0x302177(0x1c6);return _0x302177(0x1b7)+_0x516320[_0x302177(0x1e3)](/_/g,'-');}if(this[_0x302177(0x1a2)][_0x302177(0x1e9)][_0x516320]===_0xb61eaf)return'session';if(this[_0x302177(0x1a2)][_0x302177(0x1f0)][_0x516320]===_0xb61eaf)return _0x302177(0x1f0);if(this[_0x302177(0x1a2)][_0x302177(0x1b5)][_0x516320]===_0xb61eaf)return _0x302177(0x1d0)+this[_0x302177(0x1f6)];if(this[_0x302177(0x1a2)][_0x302177(0x1b0)][_0x516320]===_0xb61eaf)return _0x302177(0x1b0);return _0x302177(0x1c6);}[a61_0x247f34(0x1d8)](){const _0x4f33f9=a61_0x247f34,_0x1ed804=a61_0xe561ba[_0x4f33f9(0x1ac)](getConfigDir(),'tdx.json');if(!a61_0x561009[_0x4f33f9(0x1c4)](_0x1ed804))return{};try{const _0x170312=a61_0x561009[_0x4f33f9(0x1bc)](_0x1ed804,_0x4f33f9(0x1ef));return JSON['parse'](_0x170312);}catch{return{};}}['injectIntoOptions'](_0x281009){const _0x581d36=a61_0x247f34;_0x281009[_0x581d36(0x1a6)]=this[_0x581d36(0x1a6)],!_0x281009[_0x581d36(0x1c1)]&&this['database']&&(_0x281009[_0x581d36(0x1c1)]=this[_0x581d36(0x1c1)]),!_0x281009[_0x581d36(0x1de)]&&this[_0x581d36(0x1da)]&&(_0x281009[_0x581d36(0x1de)]=this[_0x581d36(0x1da)]),!_0x281009[_0x581d36(0x1ed)]&&this['segment_path']&&(_0x281009['segmentPath']=this[_0x581d36(0x1d9)]),!_0x281009[_0x581d36(0x1d6)]&&this[_0x581d36(0x1a9)]&&(_0x281009['llmProject']=this['llm_project']),!_0x281009['llmAgent']&&this[_0x581d36(0x1f3)]&&(_0x281009[_0x581d36(0x1c8)]=this[_0x581d36(0x1f3)]),!_0x281009[_0x581d36(0x1ab)]&&this['workflow_project']&&(_0x281009['workflowProject']=this[_0x581d36(0x1b6)]),!_0x281009[_0x581d36(0x1bb)]&&this[_0x581d36(0x1e8)]&&(_0x281009[_0x581d36(0x1bb)]=this[_0x581d36(0x1e8)]);}[a61_0x247f34(0x1ec)](){const _0x341f8a=a61_0x247f34;return[{'key':'site','value':this['site']},{'key':_0x341f8a(0x1c1),'value':this['database']},{'key':'parent_segment','value':this[_0x341f8a(0x1da)]},{'key':_0x341f8a(0x1d9),'value':this[_0x341f8a(0x1d9)]},{'key':_0x341f8a(0x1a9),'value':this[_0x341f8a(0x1a9)]},{'key':'llm_agent','value':this['llm_agent']},{'key':_0x341f8a(0x1b6),'value':this[_0x341f8a(0x1b6)]},{'key':_0x341f8a(0x1e8),'value':this[_0x341f8a(0x1e8)]},{'key':_0x341f8a(0x1b5),'value':this[_0x341f8a(0x1f6)]||undefined}];}[a61_0x247f34(0x1d2)](){const _0x109fe=a61_0x247f34;console[_0x109fe(0x1a5)](a61_0xe55df0['bold'](_0x109fe(0x1ae)));for(const {key:_0x15bb1b,value:_0x192f05}of this[_0x109fe(0x1ec)]()){_0x192f05&&console[_0x109fe(0x1a5)](a61_0xe55df0[_0x109fe(0x1d7)](_0x15bb1b)+':\x20'+_0x192f05);}}[a61_0x247f34(0x1dc)](){const _0x13a197=a61_0x247f34;console[_0x13a197(0x1a5)](a61_0xe55df0[_0x13a197(0x1dd)](_0x13a197(0x1ae)));for(const {key:_0xc4a335,value:_0x96757d}of this[_0x13a197(0x1ec)]()){if(_0x96757d){const _0x4e436c=_0xc4a335==='profile'?_0x13a197(0x1a7):'('+this[_0x13a197(0x1c7)](_0xc4a335,_0x96757d)+')';console[_0x13a197(0x1a5)](a61_0xe55df0[_0x13a197(0x1d7)](_0xc4a335)+':\x20'+_0x96757d+'\x20'+a61_0xe55df0['dim'](_0x4e436c));}}console[_0x13a197(0x1a5)]('\x0a'+a61_0xe55df0[_0x13a197(0x1dd)]('[configuration\x20files]'));const _0x458118=[{'label':_0x13a197(0x1b1),'path':this[_0x13a197(0x1cc)]['session'],'extra':'(session:\x20'+this[_0x13a197(0x1a3)]+')'},{'label':_0x13a197(0x1f2),'path':this[_0x13a197(0x1cc)][_0x13a197(0x1f0)]},{'label':_0x13a197(0x1c0),'path':this[_0x13a197(0x1cc)][_0x13a197(0x1b5)]},{'label':_0x13a197(0x1c3),'path':this[_0x13a197(0x1cc)][_0x13a197(0x1d5)]},{'label':_0x13a197(0x1ad),'path':this[_0x13a197(0x1cc)][_0x13a197(0x1b0)]},{'label':'Global\x20Credentials','path':this[_0x13a197(0x1cc)]['globalCredentials']}];for(const {label:_0x244b24,path:_0x55cd3c,extra:_0x335e2f}of _0x458118){if(_0x55cd3c)console['log'](a61_0xe55df0[_0x13a197(0x1d7)](_0x244b24)+':\x20'+_0x55cd3c+'\x20'+a61_0xe55df0['green']('✓')+(_0x335e2f?'\x20'+a61_0xe55df0[_0x13a197(0x1eb)](_0x335e2f):''));else{if(_0x244b24===_0x13a197(0x1b1))console[_0x13a197(0x1a5)](a61_0xe55df0[_0x13a197(0x1d7)](_0x244b24)+':\x20'+a61_0xe55df0[_0x13a197(0x1eb)]('none')+'\x20'+a61_0xe55df0[_0x13a197(0x1eb)](_0x13a197(0x1cd)+this[_0x13a197(0x1a3)]+')'));else(_0x244b24==='Project'||_0x244b24===_0x13a197(0x1ad))&&console[_0x13a197(0x1a5)](a61_0xe55df0['cyan'](_0x244b24)+':\x20'+a61_0xe55df0[_0x13a197(0x1eb)](_0x13a197(0x1d1)));}}}async['resolveAPIKeyAsync'](){const _0x17370d=a61_0x247f34;if(!this[_0x17370d(0x1f7)]){const _0x200d46=await getOAuthTokens(this[_0x17370d(0x1f6)]||undefined);if(_0x200d46){const _0x1feab7=0x5*0x3c*0x3e8,_0x3345c8=!_0x200d46['expires_at']||_0x200d46[_0x17370d(0x1ba)]<Date[_0x17370d(0x1bd)]()+_0x1feab7;if(_0x3345c8&&_0x200d46[_0x17370d(0x1f5)])try{const _0x44379e=getConsoleUrl(this[_0x17370d(0x1a6)]),_0x744786=await refreshAccessToken(_0x44379e,_0x200d46['refresh_token']);await saveOAuthTokens(_0x744786,this[_0x17370d(0x1f6)]||undefined),this[_0x17370d(0x1f7)]=_0x744786[_0x17370d(0x1aa)];}catch{this[_0x17370d(0x1f7)]=_0x200d46[_0x17370d(0x1aa)];}else this['accessToken']=_0x200d46['access_token'];return undefined;}}return this[_0x17370d(0x1a1)]=await getAPIKeyAsync(this[_0x17370d(0x1a6)],this[_0x17370d(0x1f6)]||undefined),this[_0x17370d(0x1a1)];}static async[a61_0x247f34(0x1e5)](_0x2e50e6){const _0x2b4578=a61_0x247f34,_0x502a58=new GlobalContext(_0x2e50e6);return await _0x502a58[_0x2b4578(0x1e4)](),_0x502a58;}}
@@ -1 +1 @@
1
- const a62_0x23703c=a62_0x4d7f;function a62_0x4d7f(_0x2a4270,_0x258782){_0x2a4270=_0x2a4270-0x79;const _0x10fd8a=a62_0x10fd();let _0x4d7f67=_0x10fd8a[_0x2a4270];return _0x4d7f67;}(function(_0x1b23e6,_0x5ebd9c){const _0x30f70a=a62_0x4d7f,_0x392c49=_0x1b23e6();while(!![]){try{const _0x3e9171=parseInt(_0x30f70a(0x81))/0x1*(-parseInt(_0x30f70a(0x9c))/0x2)+parseInt(_0x30f70a(0x88))/0x3*(-parseInt(_0x30f70a(0x8c))/0x4)+parseInt(_0x30f70a(0x82))/0x5*(-parseInt(_0x30f70a(0x91))/0x6)+-parseInt(_0x30f70a(0x85))/0x7*(parseInt(_0x30f70a(0x95))/0x8)+-parseInt(_0x30f70a(0x99))/0x9+-parseInt(_0x30f70a(0x79))/0xa*(parseInt(_0x30f70a(0x89))/0xb)+parseInt(_0x30f70a(0x97))/0xc*(parseInt(_0x30f70a(0x80))/0xd);if(_0x3e9171===_0x5ebd9c)break;else _0x392c49['push'](_0x392c49['shift']());}catch(_0x3bb78b){_0x392c49['push'](_0x392c49['shift']());}}}(a62_0x10fd,0xde36f));const SERVICE_NAME=a62_0x23703c(0x7e);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x1fdaf2=a62_0x23703c;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x466b2b=await import(_0x1fdaf2(0x8f));return EntryClass=_0x466b2b['Entry'],EntryClass;}catch(_0x21e8e4){return keyringLoadError=_0x21e8e4 instanceof Error?_0x21e8e4:new Error(String(_0x21e8e4)),null;}}function getAccountName(_0x51c6e0){const _0x455b28=a62_0x23703c,_0x216a34=_0x51c6e0||'';return _0x455b28(0x7a)+_0x216a34+_0x455b28(0x96);}export async function getKeychainAPIKey(_0x5c811a){const _0x553015=a62_0x23703c,_0x4b4a17=await getKeychainAPIKeyWithStatus(_0x5c811a);if(_0x4b4a17[_0x553015(0x98)])return _0x4b4a17[_0x553015(0x7d)];return _0x4b4a17[_0x553015(0x90)]===_0x553015(0x83)&&console[_0x553015(0x9b)](_0x553015(0x9a)+_0x4b4a17[_0x553015(0x86)]),null;}export async function getKeychainAPIKeyWithStatus(_0xca1ac2){const _0x518f78=a62_0x23703c;try{const _0x55c6ba=await getEntryClass();if(!_0x55c6ba)return{'success':![],'reason':_0x518f78(0x84)};const _0x409a21=getAccountName(_0xca1ac2),_0x52db18=new _0x55c6ba(SERVICE_NAME,_0x409a21),_0x5b141c=_0x52db18[_0x518f78(0x92)]();if(_0x5b141c)return{'success':!![],'value':_0x5b141c};return{'success':![],'reason':_0x518f78(0x94)};}catch(_0x599eb6){const _0xdb87b5=_0x599eb6 instanceof Error?_0x599eb6[_0x518f78(0x86)]:String(_0x599eb6);if(_0xdb87b5[_0x518f78(0x7f)](_0x518f78(0x87))||_0xdb87b5[_0x518f78(0x9f)]()[_0x518f78(0x7f)]('could\x20not\x20be\x20found')||_0xdb87b5[_0x518f78(0x9f)]()['includes'](_0x518f78(0x8a))||_0xdb87b5[_0x518f78(0x9f)]()[_0x518f78(0x7f)](_0x518f78(0x7c)))return{'success':![],'reason':'not_found'};if(_0xdb87b5['includes'](_0x518f78(0x8d))||_0xdb87b5['toLowerCase']()[_0x518f78(0x7f)](_0x518f78(0x8b))||_0xdb87b5[_0x518f78(0x9f)]()[_0x518f78(0x7f)](_0x518f78(0x93)))return{'success':![],'reason':_0x518f78(0x83),'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':_0x518f78(0x84),'message':_0xdb87b5};}}export async function saveKeychainAPIKey(_0x16c204,_0x2b81cd){const _0x3fd89b=a62_0x23703c,_0x171709=await getEntryClass();if(!_0x171709)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x54ad1f=getAccountName(_0x2b81cd),_0x131548=new _0x171709(SERVICE_NAME,_0x54ad1f);_0x131548[_0x3fd89b(0x8e)](_0x16c204);}function a62_0x10fd(){const _0x58432e=['430XSbYZR','access_denied','unavailable','56WeDRdc','message','-25300','474hSWQrx','13717YzvWvY','not\x20found','restricted','34108kdCdmd','-25293','setPassword','@napi-rs/keyring','reason','92268jFAjvd','getPassword','access','not_found','691576tclLHm',':api_key','6628596gIbRuG','success','7146063CorQbt','Warning:\x20','error','1460794qBnNVt','not\x20available','__keychain_test__','toLowerCase','deleteCredential','820uIdApX','profile:','cannot\x20find','no\x20matching\x20entry','value','tdx','includes','156fOgsio','2KxxRGt'];a62_0x10fd=function(){return _0x58432e;};return a62_0x10fd();}export async function deleteKeychainAPIKey(_0x592d68){const _0x559c51=a62_0x23703c;try{const _0x133fef=await getEntryClass();if(!_0x133fef)return![];const _0x11f2c4=getAccountName(_0x592d68),_0x44dbb9=new _0x133fef(SERVICE_NAME,_0x11f2c4);return _0x44dbb9[_0x559c51(0xa0)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x4512d9=a62_0x23703c;try{const _0x210efc=await getEntryClass();if(!_0x210efc)return![];const _0x4078a0=new _0x210efc(SERVICE_NAME,_0x4512d9(0x9e));return _0x4078a0[_0x4512d9(0x92)](),!![];}catch(_0xe4892d){const _0x39dab8=_0xe4892d instanceof Error?_0xe4892d['message'][_0x4512d9(0x9f)]():'';if(_0x39dab8['includes'](_0x4512d9(0x9d))||_0x39dab8[_0x4512d9(0x7f)]('not\x20supported')||_0x39dab8[_0x4512d9(0x7f)](_0x4512d9(0x7b)))return![];return!![];}}
1
+ function a62_0x423b(){const _0x5a2da0=['tdx','117915XmalIK','660sbuhEp','toLowerCase','access_denied','unavailable','2008430YLaYco','not_found','profile:','111015KpBvNu','restricted','-25293','deleteCredential','getPassword','access','not\x20available','Warning:\x20','cannot\x20find','message','17709gZKqmQ',':api_key','8088272FTROtr','System\x20keychain\x20is\x20not\x20available','setPassword','5196457qLSiBZ','reason','not\x20found','819516GXtsVu','includes','__keychain_test__','6oysnCt','@napi-rs/keyring','could\x20not\x20be\x20found','not\x20supported','error','176YFciNa'];a62_0x423b=function(){return _0x5a2da0;};return a62_0x423b();}const a62_0x1c66be=a62_0x3bf5;(function(_0x54ff,_0x2d6013){const _0x13f004=a62_0x3bf5,_0x231e3b=_0x54ff();while(!![]){try{const _0x4abe99=-parseInt(_0x13f004(0x149))/0x1+-parseInt(_0x13f004(0x158))/0x2+parseInt(_0x13f004(0x141))/0x3*(-parseInt(_0x13f004(0x151))/0x4)+parseInt(_0x13f004(0x153))/0x5+parseInt(_0x13f004(0x14c))/0x6*(parseInt(_0x13f004(0x146))/0x7)+parseInt(_0x13f004(0x143))/0x8+-parseInt(_0x13f004(0x15b))/0x9*(-parseInt(_0x13f004(0x154))/0xa);if(_0x4abe99===_0x2d6013)break;else _0x231e3b['push'](_0x231e3b['shift']());}catch(_0x3bbf88){_0x231e3b['push'](_0x231e3b['shift']());}}}(a62_0x423b,0x7bedf));const SERVICE_NAME=a62_0x1c66be(0x152);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2c2fdf=a62_0x1c66be;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x1fa752=await import(_0x2c2fdf(0x14d));return EntryClass=_0x1fa752['Entry'],EntryClass;}catch(_0x5b52ab){return keyringLoadError=_0x5b52ab instanceof Error?_0x5b52ab:new Error(String(_0x5b52ab)),null;}}function getAccountName(_0x13cb8c){const _0x147696=a62_0x1c66be,_0x2fef87=_0x13cb8c||'';return _0x147696(0x15a)+_0x2fef87+_0x147696(0x142);}export async function getKeychainAPIKey(_0x57d2a8){const _0x3edb4f=a62_0x1c66be,_0x91c8d1=await getKeychainAPIKeyWithStatus(_0x57d2a8);if(_0x91c8d1['success'])return _0x91c8d1['value'];return _0x91c8d1[_0x3edb4f(0x147)]===_0x3edb4f(0x156)&&console[_0x3edb4f(0x150)](_0x3edb4f(0x13e)+_0x91c8d1['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x399a77){const _0x174f68=a62_0x1c66be;try{const _0x48ae91=await getEntryClass();if(!_0x48ae91)return{'success':![],'reason':'unavailable'};const _0x532c92=getAccountName(_0x399a77),_0x4ea452=new _0x48ae91(SERVICE_NAME,_0x532c92),_0x5675c0=_0x4ea452[_0x174f68(0x13b)]();if(_0x5675c0)return{'success':!![],'value':_0x5675c0};return{'success':![],'reason':_0x174f68(0x159)};}catch(_0x1089e8){const _0x3c165e=_0x1089e8 instanceof Error?_0x1089e8[_0x174f68(0x140)]:String(_0x1089e8);if(_0x3c165e[_0x174f68(0x14a)]('-25300')||_0x3c165e[_0x174f68(0x155)]()['includes'](_0x174f68(0x14e))||_0x3c165e['toLowerCase']()['includes'](_0x174f68(0x148))||_0x3c165e['toLowerCase']()[_0x174f68(0x14a)]('no\x20matching\x20entry'))return{'success':![],'reason':_0x174f68(0x159)};if(_0x3c165e[_0x174f68(0x14a)](_0x174f68(0x139))||_0x3c165e[_0x174f68(0x155)]()[_0x174f68(0x14a)](_0x174f68(0x138))||_0x3c165e[_0x174f68(0x155)]()[_0x174f68(0x14a)](_0x174f68(0x13c)))return{'success':![],'reason':_0x174f68(0x156),'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':_0x174f68(0x157),'message':_0x3c165e};}}export async function saveKeychainAPIKey(_0x13beac,_0xdad36b){const _0x394109=a62_0x1c66be,_0x15fd03=await getEntryClass();if(!_0x15fd03)throw new Error(_0x394109(0x144));const _0x4b8981=getAccountName(_0xdad36b),_0x3a9e07=new _0x15fd03(SERVICE_NAME,_0x4b8981);_0x3a9e07[_0x394109(0x145)](_0x13beac);}function a62_0x3bf5(_0x5de4c8,_0x5e4344){_0x5de4c8=_0x5de4c8-0x138;const _0x423b44=a62_0x423b();let _0x3bf538=_0x423b44[_0x5de4c8];return _0x3bf538;}export async function deleteKeychainAPIKey(_0x35d18a){const _0x50d09d=a62_0x1c66be;try{const _0x1a9037=await getEntryClass();if(!_0x1a9037)return![];const _0xf3ec0e=getAccountName(_0x35d18a),_0x4a366e=new _0x1a9037(SERVICE_NAME,_0xf3ec0e);return _0x4a366e[_0x50d09d(0x13a)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x2457f7=a62_0x1c66be;try{const _0x46e360=await getEntryClass();if(!_0x46e360)return![];const _0x3c53b2=new _0x46e360(SERVICE_NAME,_0x2457f7(0x14b));return _0x3c53b2[_0x2457f7(0x13b)](),!![];}catch(_0x35fb46){const _0x426452=_0x35fb46 instanceof Error?_0x35fb46[_0x2457f7(0x140)][_0x2457f7(0x155)]():'';if(_0x426452[_0x2457f7(0x14a)](_0x2457f7(0x13d))||_0x426452[_0x2457f7(0x14a)](_0x2457f7(0x14f))||_0x426452[_0x2457f7(0x14a)](_0x2457f7(0x13f)))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x463e9c,_0x158deb){const _0x172a6a=a63_0x42f8,_0x5e3bc9=_0x463e9c();while(!![]){try{const _0x5101f9=-parseInt(_0x172a6a(0x107))/0x1+-parseInt(_0x172a6a(0x114))/0x2+parseInt(_0x172a6a(0x10b))/0x3+-parseInt(_0x172a6a(0x10f))/0x4+parseInt(_0x172a6a(0x10e))/0x5+parseInt(_0x172a6a(0x111))/0x6*(parseInt(_0x172a6a(0x112))/0x7)+-parseInt(_0x172a6a(0x10a))/0x8*(-parseInt(_0x172a6a(0x115))/0x9);if(_0x5101f9===_0x158deb)break;else _0x5e3bc9['push'](_0x5e3bc9['shift']());}catch(_0x3c3d75){_0x5e3bc9['push'](_0x5e3bc9['shift']());}}}(a63_0x29e9,0x738e3));const SERVICE_NAME='tdx';function a63_0x42f8(_0x27ea7c,_0x30a149){_0x27ea7c=_0x27ea7c-0x106;const _0x29e9cd=a63_0x29e9();let _0x42f86=_0x29e9cd[_0x27ea7c];return _0x42f86;}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2752f0=a63_0x42f8;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0xbdd738=await import(_0x2752f0(0x113));return EntryClass=_0xbdd738[_0x2752f0(0x106)],EntryClass;}catch(_0x110285){return keyringLoadError=_0x110285 instanceof Error?_0x110285:new Error(String(_0x110285)),null;}}function a63_0x29e9(){const _0x4ee2c7=['394560ZdWxqq','1807888zwwwyU',':oauth_tokens','54MWZXko','397817niKsON','@napi-rs/keyring','970232MLJVDF','40401yKVqyV','Entry','602661xFgafH','deleteCredential','setPassword','2168vywpHy','618462nFjOUZ','parse','stringify'];a63_0x29e9=function(){return _0x4ee2c7;};return a63_0x29e9();}function getOAuthAccountName(_0x2e57b8){const _0x5c2c40=a63_0x42f8,_0x3718fb=_0x2e57b8||'';return'profile:'+_0x3718fb+_0x5c2c40(0x110);}export async function saveOAuthTokens(_0x4c42cb,_0x14e59c){const _0x17819c=a63_0x42f8,_0xaf3898=await getEntryClass();if(!_0xaf3898)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x4fa6be=getOAuthAccountName(_0x14e59c),_0x14c896=new _0xaf3898(SERVICE_NAME,_0x4fa6be);_0x14c896[_0x17819c(0x109)](JSON[_0x17819c(0x10d)](_0x4c42cb));}export async function getOAuthTokens(_0x34b2c1){const _0x2635a1=a63_0x42f8;try{const _0x1f1dc1=await getEntryClass();if(!_0x1f1dc1)return null;const _0x23dc96=getOAuthAccountName(_0x34b2c1),_0x4f4872=new _0x1f1dc1(SERVICE_NAME,_0x23dc96),_0x4d0465=_0x4f4872['getPassword']();if(_0x4d0465)return JSON[_0x2635a1(0x10c)](_0x4d0465);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x19ca50){const _0x5357ae=a63_0x42f8;try{const _0x296ec0=await getEntryClass();if(!_0x296ec0)return![];const _0x5eda09=getOAuthAccountName(_0x19ca50),_0x5dda70=new _0x296ec0(SERVICE_NAME,_0x5eda09);return _0x5dda70[_0x5357ae(0x108)](),!![];}catch{return![];}}
1
+ const a63_0x30b4bf=a63_0x4d77;(function(_0x34cc72,_0x4d0b54){const _0x324b60=a63_0x4d77,_0x57d60f=_0x34cc72();while(!![]){try{const _0x33b7b8=parseInt(_0x324b60(0xce))/0x1*(-parseInt(_0x324b60(0xc1))/0x2)+-parseInt(_0x324b60(0xc2))/0x3+parseInt(_0x324b60(0xc7))/0x4+-parseInt(_0x324b60(0xd0))/0x5+parseInt(_0x324b60(0xcc))/0x6*(-parseInt(_0x324b60(0xca))/0x7)+-parseInt(_0x324b60(0xc3))/0x8+parseInt(_0x324b60(0xbe))/0x9*(parseInt(_0x324b60(0xcb))/0xa);if(_0x33b7b8===_0x4d0b54)break;else _0x57d60f['push'](_0x57d60f['shift']());}catch(_0x425a5e){_0x57d60f['push'](_0x57d60f['shift']());}}}(a63_0x2856,0xc73a3));const SERVICE_NAME=a63_0x30b4bf(0xcf);let EntryClass=null,keyringLoadError=null;function a63_0x2856(){const _0x18df04=['parse','6496796huGISI','System\x20keychain\x20is\x20not\x20available','getPassword','130340uEgixv','1510XFpQHS','258ukuSvJ','setPassword','10299MAPANu','tdx','5358940rprOjP','profile:','Entry','176787jaTsJh','@napi-rs/keyring',':oauth_tokens','130WbqUBC','1032177DMFSud','7106520PbBwGC','deleteCredential','stringify'];a63_0x2856=function(){return _0x18df04;};return a63_0x2856();}async function getEntryClass(){const _0xcca708=a63_0x30b4bf;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x52fdf0=await import(_0xcca708(0xbf));return EntryClass=_0x52fdf0[_0xcca708(0xbd)],EntryClass;}catch(_0x4a629d){return keyringLoadError=_0x4a629d instanceof Error?_0x4a629d:new Error(String(_0x4a629d)),null;}}function a63_0x4d77(_0x1ed2cf,_0x4ff5aa){_0x1ed2cf=_0x1ed2cf-0xbd;const _0x28560e=a63_0x2856();let _0x4d77d1=_0x28560e[_0x1ed2cf];return _0x4d77d1;}function getOAuthAccountName(_0x28cc33){const _0x341115=a63_0x30b4bf,_0x2e8638=_0x28cc33||'';return _0x341115(0xd1)+_0x2e8638+_0x341115(0xc0);}export async function saveOAuthTokens(_0x397d53,_0x295226){const _0x5dc890=a63_0x30b4bf,_0x4ff515=await getEntryClass();if(!_0x4ff515)throw new Error(_0x5dc890(0xc8));const _0x4aa15d=getOAuthAccountName(_0x295226),_0x576d54=new _0x4ff515(SERVICE_NAME,_0x4aa15d);_0x576d54[_0x5dc890(0xcd)](JSON[_0x5dc890(0xc5)](_0x397d53));}export async function getOAuthTokens(_0x3d1665){const _0x4b2fc2=a63_0x30b4bf;try{const _0xc9f404=await getEntryClass();if(!_0xc9f404)return null;const _0x2049e7=getOAuthAccountName(_0x3d1665),_0x2ee01b=new _0xc9f404(SERVICE_NAME,_0x2049e7),_0x8392ba=_0x2ee01b[_0x4b2fc2(0xc9)]();if(_0x8392ba)return JSON[_0x4b2fc2(0xc6)](_0x8392ba);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x437117){const _0x464733=a63_0x30b4bf;try{const _0x5bc64f=await getEntryClass();if(!_0x5bc64f)return![];const _0x1a30ea=getOAuthAccountName(_0x437117),_0x4b775b=new _0x5bc64f(SERVICE_NAME,_0x1a30ea);return _0x4b775b[_0x464733(0xc4)](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- function a64_0x1948(){const _0x2e8735=['/oauth/token','text/html','toString','POST','629811bOYzEC','828FmKQxu','code','url','EADDRINUSE','127.0.0.1','error','scope','state','expires_in','pathname','146eOqYDZ','replace','get','now','redirect_to_path','clientId','waitForCallback','redirectUri','4333RCdXkN','client_id','json','accountName','1412584BWTwBC','searchParams','code_challenge','end','close','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','authorization_code','Not\x20Found','575PAkvuK','text','):\x20','writeHead','code_challenge_method','tdx','text/plain','S256','OAuth\x20token\x20request\x20failed\x20(','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','application/x-www-form-urlencoded','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','redirect_uri','1695560CzxDlD','base64url','set','87136hWJugB','/oauth/callback','message','Port\x20','hex','sha256','1615590GAHiqb','openid\x20email\x20profile','update','access_token','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','30WqqYVy','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','randomBytes'];a64_0x1948=function(){return _0x2e8735;};return a64_0x1948();}const a64_0x3bef71=a64_0x3325;(function(_0x308fa9,_0x462b64){const _0x4780c1=a64_0x3325,_0x3f9dcc=_0x308fa9();while(!![]){try{const _0x17f1d9=-parseInt(_0x4780c1(0x131))/0x1*(parseInt(_0x4780c1(0x15e))/0x2)+parseInt(_0x4780c1(0x153))/0x3+-parseInt(_0x4780c1(0x141))/0x4*(parseInt(_0x4780c1(0x14c))/0x5)+parseInt(_0x4780c1(0x154))/0x6*(-parseInt(_0x4780c1(0x166))/0x7)+-parseInt(_0x4780c1(0x129))/0x8+parseInt(_0x4780c1(0x147))/0x9+parseInt(_0x4780c1(0x13e))/0xa;if(_0x17f1d9===_0x462b64)break;else _0x3f9dcc['push'](_0x3f9dcc['shift']());}catch(_0x5692b6){_0x3f9dcc['push'](_0x3f9dcc['shift']());}}}(a64_0x1948,0x1e5a9));import*as a64_0x58f746 from'node:crypto';import*as a64_0x3f8fa0 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a64_0x3bef71(0x142);export function getOAuthClientId(){const _0x14b330=a64_0x3bef71;return process.env.TD_OAUTH_CLIENT_ID||_0x14b330(0x136);}export function generatePKCEPair(){const _0x5872f6=a64_0x3bef71,_0x47811c=a64_0x58f746[_0x5872f6(0x14e)](0x20)[_0x5872f6(0x151)](_0x5872f6(0x13f)),_0x5d27b0=a64_0x58f746['createHash'](_0x5872f6(0x146))[_0x5872f6(0x149)](_0x47811c)['digest'](_0x5872f6(0x13f));return{'verifier':_0x47811c,'challenge':_0x5d27b0};}export function buildAuthorizeURL(_0x265aca,_0x53e63){const _0x33b109=a64_0x3bef71,_0x49db3d=new URL('/oauth/authorize',_0x265aca);return _0x49db3d[_0x33b109(0x12a)][_0x33b109(0x140)]('response_type',_0x33b109(0x155)),_0x49db3d[_0x33b109(0x12a)][_0x33b109(0x140)](_0x33b109(0x167),_0x53e63[_0x33b109(0x163)]),_0x49db3d[_0x33b109(0x12a)]['set'](_0x33b109(0x13d),_0x53e63[_0x33b109(0x165)]),_0x49db3d[_0x33b109(0x12a)]['set'](_0x33b109(0x15b),_0x53e63[_0x33b109(0x15b)]),_0x49db3d[_0x33b109(0x12a)]['set'](_0x33b109(0x12b),_0x53e63['codeChallenge']),_0x49db3d[_0x33b109(0x12a)][_0x33b109(0x140)](_0x33b109(0x135),_0x33b109(0x138)),_0x53e63['scope']&&_0x49db3d['searchParams'][_0x33b109(0x140)](_0x33b109(0x15a),_0x53e63[_0x33b109(0x15a)]),_0x49db3d['toString']();}function a64_0x3325(_0x447c5f,_0x5495fb){_0x447c5f=_0x447c5f-0x128;const _0x194801=a64_0x1948();let _0x3325a9=_0x194801[_0x447c5f];return _0x3325a9;}export function buildSSOInitiateURL(_0xfcf1b8,_0x3ff7a1,_0x2ff472){const _0x56c235=a64_0x3bef71,_0x4bcfa0=new URL('/users/initiate_sso',_0xfcf1b8);_0x4bcfa0[_0x56c235(0x12a)][_0x56c235(0x140)]('account_name',_0x3ff7a1);const _0xccdecc=_0x2ff472[_0x56c235(0x15f)](_0xfcf1b8,'');return _0x4bcfa0[_0x56c235(0x12a)][_0x56c235(0x140)](_0x56c235(0x162),_0xccdecc),_0x4bcfa0['toString']();}export async function postTokenRequest(_0x38fc85,_0x43a3bf){const _0x28a7c6=a64_0x3bef71,_0x5eef93=new URLSearchParams(_0x43a3bf)[_0x28a7c6(0x151)](),_0x14ce2f=await fetch(_0x38fc85,{'method':_0x28a7c6(0x152),'headers':{'Content-Type':_0x28a7c6(0x13b)},'body':_0x5eef93});if(!_0x14ce2f['ok']){const _0x34945a=await _0x14ce2f[_0x28a7c6(0x132)]();throw new Error(_0x28a7c6(0x139)+_0x14ce2f['status']+_0x28a7c6(0x133)+_0x34945a);}const _0xfd19fd=await _0x14ce2f[_0x28a7c6(0x168)]();return{'access_token':_0xfd19fd[_0x28a7c6(0x14a)],'refresh_token':_0xfd19fd['refresh_token'],'scope':_0xfd19fd['scope'],'expires_at':_0xfd19fd[_0x28a7c6(0x15c)]?Date[_0x28a7c6(0x161)]()+_0xfd19fd['expires_in']*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x2808a0,_0x1b3756,_0x593c2f,_0x1b398c){const _0x3af476=a64_0x3bef71,_0x54688c=_0x2808a0+_0x3af476(0x14f);return postTokenRequest(_0x54688c,{'grant_type':_0x3af476(0x12f),'client_id':getOAuthClientId(),'code':_0x1b3756,'code_verifier':_0x593c2f,'redirect_uri':_0x1b398c});}export function startLocalCallbackServer(){const _0x233369=a64_0x3bef71;let _0x2ffa33,_0x576228;const _0xb7d336=new Promise((_0x225243,_0x4244c1)=>{_0x2ffa33=_0x225243,_0x576228=_0x4244c1;}),_0x154268=a64_0x3f8fa0['createServer']((_0x4105c6,_0x4fc27b)=>{const _0x11ce8e=a64_0x3325,_0x34f369=new URL(_0x4105c6[_0x11ce8e(0x156)]||'/','http://127.0.0.1');if(_0x34f369[_0x11ce8e(0x15d)]!==_0x11ce8e(0x142)){_0x4fc27b[_0x11ce8e(0x134)](0x194,{'Content-Type':_0x11ce8e(0x137)}),_0x4fc27b[_0x11ce8e(0x12c)](_0x11ce8e(0x130));return;}const _0xa7dd93=_0x34f369['searchParams'][_0x11ce8e(0x160)]('code'),_0x557130=_0x34f369[_0x11ce8e(0x12a)]['get'](_0x11ce8e(0x15b)),_0x5d8498=_0x34f369[_0x11ce8e(0x12a)][_0x11ce8e(0x160)](_0x11ce8e(0x159));if(_0x5d8498||!_0xa7dd93||!_0x557130){_0x4fc27b[_0x11ce8e(0x134)](0x190,{'Content-Type':_0x11ce8e(0x150)}),_0x4fc27b['end'](_0x11ce8e(0x13a)),_0x576228(new Error(_0x11ce8e(0x14d)));return;}_0x4fc27b[_0x11ce8e(0x134)](0xc8,{'Content-Type':_0x11ce8e(0x150)}),_0x4fc27b[_0x11ce8e(0x12c)](_0x11ce8e(0x13c)),_0x2ffa33({'code':_0xa7dd93,'state':_0x557130});});_0x154268['on']('error',_0x92ac60=>{const _0x153c41=a64_0x3325;_0x92ac60['code']===_0x153c41(0x157)?_0x576228(new Error(_0x153c41(0x144)+OAUTH_CALLBACK_PORT+_0x153c41(0x12e))):_0x576228(new Error(_0x153c41(0x14b)+_0x92ac60[_0x153c41(0x143)]));}),_0x154268['listen'](OAUTH_CALLBACK_PORT,_0x233369(0x158));const _0x212b86=setTimeout(()=>{const _0x289e3b=_0x233369;_0x576228(new Error('OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes')),_0x154268[_0x289e3b(0x12d)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0xb7d336,'close':()=>{const _0x207ba4=_0x233369;clearTimeout(_0x212b86),_0x154268[_0x207ba4(0x12d)]();}};}export async function startOAuthFlow(_0x34cb8c,_0x47a4cb){const _0xe4204f=a64_0x3bef71,_0x55f563=getConsoleUrl(_0x34cb8c),_0x12b032=getOAuthClientId(),{verifier:_0x34fbcd,challenge:_0x4ce99b}=generatePKCEPair(),_0x929ca8=a64_0x58f746['randomBytes'](0x10)[_0xe4204f(0x151)](_0xe4204f(0x145)),_0x2187b3=startLocalCallbackServer();try{const _0x173aca=OAUTH_REDIRECT_URI,_0x3157fe=buildAuthorizeURL(_0x55f563,{'clientId':_0x12b032,'redirectUri':_0x173aca,'state':_0x929ca8,'codeChallenge':_0x4ce99b,'scope':_0xe4204f(0x148)}),_0x57cae0=_0x47a4cb?.[_0xe4204f(0x128)]?buildSSOInitiateURL(_0x55f563,_0x47a4cb[_0xe4204f(0x128)],_0x3157fe):_0x3157fe;openBrowser(_0x57cae0);const _0x4a4173=await _0x2187b3[_0xe4204f(0x164)]();if(_0x4a4173[_0xe4204f(0x15b)]!==_0x929ca8)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x55f563,_0x4a4173['code'],_0x34fbcd,_0x173aca);}finally{_0x2187b3['close']();}}
1
+ const a64_0x3d9c2f=a64_0x11c0;(function(_0x244e46,_0x156674){const _0x37a424=a64_0x11c0,_0x4c0a6d=_0x244e46();while(!![]){try{const _0xc0e137=-parseInt(_0x37a424(0x12f))/0x1+parseInt(_0x37a424(0x141))/0x2*(parseInt(_0x37a424(0x149))/0x3)+-parseInt(_0x37a424(0x135))/0x4+parseInt(_0x37a424(0x121))/0x5*(parseInt(_0x37a424(0x125))/0x6)+-parseInt(_0x37a424(0x130))/0x7*(parseInt(_0x37a424(0x15f))/0x8)+parseInt(_0x37a424(0x124))/0x9+parseInt(_0x37a424(0x122))/0xa;if(_0xc0e137===_0x156674)break;else _0x4c0a6d['push'](_0x4c0a6d['shift']());}catch(_0x474795){_0x4c0a6d['push'](_0x4c0a6d['shift']());}}}(a64_0x339c,0xaf912));import*as a64_0x5c5271 from'node:crypto';import*as a64_0x39862f from'node:http';function a64_0x11c0(_0x595ce1,_0x2a7533){_0x595ce1=_0x595ce1-0x11c;const _0x339c26=a64_0x339c();let _0x11c070=_0x339c26[_0x595ce1];return _0x11c070;}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;function a64_0x339c(){const _0x502371=['OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','access_token','EADDRINUSE','1186864PSzONO','26922FsRLwg','message','replace','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','OAuth\x20token\x20request\x20failed\x20(','4259540mFsWpl','json','state','refresh_token','now','redirect_uri','text/html','scope','get','redirect_to_path','response_type','redirectUri','2wDHhEj','toString','hex','/users/initiate_sso','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','127.0.0.1','text','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','1218285DSMOwD','POST','searchParams','waitForCallback','authorization_code','randomBytes','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','application/x-www-form-urlencoded','Port\x20','code_challenge','expires_in','end','clientId','createHash','accountName','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','close','codeChallenge','writeHead','Not\x20Found','error','/oauth/callback','1704tclfzU','set','text/plain','http://127.0.0.1','/oauth/token','base64url','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','273315qYktYL','16007550brZiRq','S256','10145367gTuvxV','72KEoeQf','createServer','client_id','sha256','update','code','listen'];a64_0x339c=function(){return _0x502371;};return a64_0x339c();}export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a64_0x3d9c2f(0x15e);export function getOAuthClientId(){return process.env.TD_OAUTH_CLIENT_ID||'tdx';}export function generatePKCEPair(){const _0x5323b6=a64_0x3d9c2f,_0x435865=a64_0x5c5271[_0x5323b6(0x14e)](0x20)[_0x5323b6(0x142)](_0x5323b6(0x11f)),_0x2df63f=a64_0x5c5271[_0x5323b6(0x156)](_0x5323b6(0x128))[_0x5323b6(0x129)](_0x435865)['digest'](_0x5323b6(0x11f));return{'verifier':_0x435865,'challenge':_0x2df63f};}export function buildAuthorizeURL(_0xae6681,_0x389fe0){const _0xf5a297=a64_0x3d9c2f,_0x4b4e5a=new URL('/oauth/authorize',_0xae6681);return _0x4b4e5a['searchParams'][_0xf5a297(0x160)](_0xf5a297(0x13f),_0xf5a297(0x12a)),_0x4b4e5a[_0xf5a297(0x14b)][_0xf5a297(0x160)](_0xf5a297(0x127),_0x389fe0[_0xf5a297(0x155)]),_0x4b4e5a[_0xf5a297(0x14b)]['set'](_0xf5a297(0x13a),_0x389fe0[_0xf5a297(0x140)]),_0x4b4e5a[_0xf5a297(0x14b)][_0xf5a297(0x160)]('state',_0x389fe0[_0xf5a297(0x137)]),_0x4b4e5a[_0xf5a297(0x14b)][_0xf5a297(0x160)](_0xf5a297(0x152),_0x389fe0[_0xf5a297(0x15a)]),_0x4b4e5a[_0xf5a297(0x14b)][_0xf5a297(0x160)]('code_challenge_method',_0xf5a297(0x123)),_0x389fe0[_0xf5a297(0x13c)]&&_0x4b4e5a[_0xf5a297(0x14b)][_0xf5a297(0x160)](_0xf5a297(0x13c),_0x389fe0[_0xf5a297(0x13c)]),_0x4b4e5a[_0xf5a297(0x142)]();}export function buildSSOInitiateURL(_0x4b20c9,_0x463b31,_0x329dab){const _0x1dbe44=a64_0x3d9c2f,_0x2c0599=new URL(_0x1dbe44(0x144),_0x4b20c9);_0x2c0599[_0x1dbe44(0x14b)]['set']('account_name',_0x463b31);const _0x90d030=_0x329dab[_0x1dbe44(0x132)](_0x4b20c9,'');return _0x2c0599[_0x1dbe44(0x14b)][_0x1dbe44(0x160)](_0x1dbe44(0x13e),_0x90d030),_0x2c0599[_0x1dbe44(0x142)]();}export async function postTokenRequest(_0x19d283,_0x3f61dd){const _0x5e1149=a64_0x3d9c2f,_0x51ac3c=new URLSearchParams(_0x3f61dd)[_0x5e1149(0x142)](),_0x4e5ba6=await fetch(_0x19d283,{'method':_0x5e1149(0x14a),'headers':{'Content-Type':_0x5e1149(0x150)},'body':_0x51ac3c});if(!_0x4e5ba6['ok']){const _0x3b03ab=await _0x4e5ba6[_0x5e1149(0x147)]();throw new Error(_0x5e1149(0x134)+_0x4e5ba6['status']+'):\x20'+_0x3b03ab);}const _0x2e92a0=await _0x4e5ba6[_0x5e1149(0x136)]();return{'access_token':_0x2e92a0[_0x5e1149(0x12d)],'refresh_token':_0x2e92a0[_0x5e1149(0x138)],'scope':_0x2e92a0[_0x5e1149(0x13c)],'expires_at':_0x2e92a0[_0x5e1149(0x153)]?Date[_0x5e1149(0x139)]()+_0x2e92a0[_0x5e1149(0x153)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x2860af,_0x2da5a4,_0x54f349,_0x3c6319){const _0x5399b2=a64_0x3d9c2f,_0x1de9f7=_0x2860af+_0x5399b2(0x11e);return postTokenRequest(_0x1de9f7,{'grant_type':_0x5399b2(0x14d),'client_id':getOAuthClientId(),'code':_0x2da5a4,'code_verifier':_0x54f349,'redirect_uri':_0x3c6319});}export function startLocalCallbackServer(){const _0x552aea=a64_0x3d9c2f;let _0x305608,_0x3850be;const _0x4162b5=new Promise((_0x5add43,_0x25f315)=>{_0x305608=_0x5add43,_0x3850be=_0x25f315;}),_0x25ad40=a64_0x39862f[_0x552aea(0x126)]((_0x337e9b,_0x47705c)=>{const _0x12c10f=_0x552aea,_0x3f8937=new URL(_0x337e9b['url']||'/',_0x12c10f(0x11d));if(_0x3f8937['pathname']!=='/oauth/callback'){_0x47705c[_0x12c10f(0x15b)](0x194,{'Content-Type':_0x12c10f(0x11c)}),_0x47705c['end'](_0x12c10f(0x15c));return;}const _0x3c52be=_0x3f8937[_0x12c10f(0x14b)][_0x12c10f(0x13d)](_0x12c10f(0x12a)),_0x5aa511=_0x3f8937['searchParams'][_0x12c10f(0x13d)]('state'),_0x12977a=_0x3f8937['searchParams'][_0x12c10f(0x13d)](_0x12c10f(0x15d));if(_0x12977a||!_0x3c52be||!_0x5aa511){_0x47705c[_0x12c10f(0x15b)](0x190,{'Content-Type':_0x12c10f(0x13b)}),_0x47705c[_0x12c10f(0x154)](_0x12c10f(0x148)),_0x3850be(new Error(_0x12c10f(0x12c)));return;}_0x47705c['writeHead'](0xc8,{'Content-Type':_0x12c10f(0x13b)}),_0x47705c[_0x12c10f(0x154)](_0x12c10f(0x145)),_0x305608({'code':_0x3c52be,'state':_0x5aa511});});_0x25ad40['on'](_0x552aea(0x15d),_0x5c6412=>{const _0x25aa95=_0x552aea;_0x5c6412[_0x25aa95(0x12a)]===_0x25aa95(0x12e)?_0x3850be(new Error(_0x25aa95(0x151)+OAUTH_CALLBACK_PORT+_0x25aa95(0x14f))):_0x3850be(new Error(_0x25aa95(0x120)+_0x5c6412[_0x25aa95(0x131)]));}),_0x25ad40[_0x552aea(0x12b)](OAUTH_CALLBACK_PORT,_0x552aea(0x146));const _0x4d29b9=setTimeout(()=>{const _0x93d035=_0x552aea;_0x3850be(new Error(_0x93d035(0x158))),_0x25ad40['close']();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x4162b5,'close':()=>{const _0x561e3e=_0x552aea;clearTimeout(_0x4d29b9),_0x25ad40[_0x561e3e(0x159)]();}};}export async function startOAuthFlow(_0x32d35d,_0xc93b61){const _0x3ae0d1=a64_0x3d9c2f,_0x1a03af=getConsoleUrl(_0x32d35d),_0x2b4b25=getOAuthClientId(),{verifier:_0x2dc17b,challenge:_0x3a83d7}=generatePKCEPair(),_0x1c5cfe=a64_0x5c5271[_0x3ae0d1(0x14e)](0x10)[_0x3ae0d1(0x142)](_0x3ae0d1(0x143)),_0x1a26c7=startLocalCallbackServer();try{const _0x11d776=OAUTH_REDIRECT_URI,_0x2925ba=buildAuthorizeURL(_0x1a03af,{'clientId':_0x2b4b25,'redirectUri':_0x11d776,'state':_0x1c5cfe,'codeChallenge':_0x3a83d7,'scope':'openid\x20email\x20profile'}),_0x4e9f6a=_0xc93b61?.[_0x3ae0d1(0x157)]?buildSSOInitiateURL(_0x1a03af,_0xc93b61[_0x3ae0d1(0x157)],_0x2925ba):_0x2925ba;openBrowser(_0x4e9f6a);const _0x359aab=await _0x1a26c7[_0x3ae0d1(0x14c)]();if(_0x359aab[_0x3ae0d1(0x137)]!==_0x1c5cfe)throw new Error(_0x3ae0d1(0x133));return await exchangeCodeForTokens(_0x1a03af,_0x359aab[_0x3ae0d1(0x12a)],_0x2dc17b,_0x11d776);}finally{_0x1a26c7[_0x3ae0d1(0x159)]();}}
@@ -1 +1 @@
1
- const a65_0x1bd7a1=a65_0x41b0;(function(_0x415286,_0x321b45){const _0x5eda2d=a65_0x41b0,_0x3f4c0c=_0x415286();while(!![]){try{const _0x35ae0b=-parseInt(_0x5eda2d(0x17d))/0x1*(-parseInt(_0x5eda2d(0x198))/0x2)+parseInt(_0x5eda2d(0x17e))/0x3*(-parseInt(_0x5eda2d(0x1a6))/0x4)+parseInt(_0x5eda2d(0x1a9))/0x5*(-parseInt(_0x5eda2d(0x189))/0x6)+-parseInt(_0x5eda2d(0x18d))/0x7+parseInt(_0x5eda2d(0x18f))/0x8+-parseInt(_0x5eda2d(0x19f))/0x9+parseInt(_0x5eda2d(0x185))/0xa;if(_0x35ae0b===_0x321b45)break;else _0x3f4c0c['push'](_0x3f4c0c['shift']());}catch(_0x3a2eef){_0x3f4c0c['push'](_0x3f4c0c['shift']());}}}(a65_0x3159,0xaf5f2));import*as a65_0x6b1c53 from'node:fs';import*as a65_0x49fa67 from'node:path';function a65_0x3159(){const _0x5e2a40=['test','6497136VSCnYP','stringify','\x27\x20must\x20be\x20a\x20string','Profile\x20\x27','To\x20migrate:','database','INVALID_PROFILE_CONFIG','2084wtgCRu','name','profiles','35005uccZdN','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','Profile\x20','warn','directory','\x27\x20will\x20be\x20ignored','readdirSync','push','llm_agent',',\x20creating\x20new\x20file','entries','local','account_name','description','.env.','\x20already\x20exists','tdx.json','includes','utf-8','.env','sort','message','some','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x20\x201.\x20Edit:\x20','values','Warning:\x20Failed\x20to\x20parse\x20','set','join','Failed\x20to\x20parse\x20','has','\x22\x20\x22','\x27:\x20config\x20must\x20be\x20an\x20object','site','Invalid\x20profile\x20name:\x20','\x27\x20not\x20found\x20in\x20user\x20configuration','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','2iNuPKF','2289YFQfKq','isDirectory','existsSync','@tdx-studio','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','readFileSync','\x27:\x20unknown\x20config\x20key\x20\x27','9513470GYLrdI','parse','toISOString','from','492twZYfY',':\x20Invalid\x20JSON\x20syntax','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','map','2840733lJxval','Error:\x20','10592680pybrga','llm_project','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','keys','\x20does\x20not\x20exist','localeCompare','rmSync','filter','Warning:\x20Profile\x20\x27','542218MnmXdt','find','user_info','profile','\x20\x20mv\x20\x22','string'];a65_0x3159=function(){return _0x5e2a40;};return a65_0x3159();}import{SDKError,ErrorCode}from'../sdk/errors.js';function a65_0x41b0(_0x124fdf,_0x3df04e){_0x124fdf=_0x124fdf-0x172;const _0x3159f=a65_0x3159();let _0x41b06d=_0x3159f[_0x124fdf];return _0x41b06d;}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_0x1bd7a1(0x181);export function getProfileParams(_0x4ece97){const _0x31d455=a65_0x1bd7a1,_0x3cba5a={};if(!_0x4ece97)return _0x3cba5a;for(const [_0xaedc03,_0x459576]of Object[_0x31d455(0x1b3)](_0x4ece97)){_0xaedc03!==_0x31d455(0x1b6)&&_0x459576!==undefined&&(_0x3cba5a[_0xaedc03]=_0x459576);}return _0x3cba5a;}export function getProfilesDir(){const _0x3bbea6=a65_0x1bd7a1;return a65_0x49fa67[_0x3bbea6(0x173)](getConfigDir(),_0x3bbea6(0x1a8));}function getProfileDir(_0x48b803){const _0x34ade6=a65_0x1bd7a1;return a65_0x49fa67[_0x34ade6(0x173)](getProfilesDir(),_0x48b803);}function getProfileConfigPath(_0x2398da){const _0x4aa860=a65_0x1bd7a1;return a65_0x49fa67[_0x4aa860(0x173)](getProfileDir(_0x2398da),_0x4aa860(0x1b9));}function getProfileEnvPath(_0x100646){const _0x4f157d=a65_0x1bd7a1;return a65_0x49fa67[_0x4f157d(0x173)](getProfileDir(_0x100646),'.env');}function getGlobalConfigPath(){const _0x750bb6=a65_0x1bd7a1;return a65_0x49fa67['join'](getConfigDir(),_0x750bb6(0x1b9));}function validateProfileName(_0x46ea11){const _0x95112a=a65_0x1bd7a1;if(/^@?[a-zA-Z0-9_-]+$/[_0x95112a(0x19e)](_0x46ea11))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x95112a(0x19e)](_0x46ea11))return;throw new Error(_0x95112a(0x179)+_0x46ea11+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x58d81c,_0x48943b){const _0x4e5d56=a65_0x1bd7a1;if(typeof _0x58d81c!=='object'||_0x58d81c===null)throw new SDKError(ErrorCode[_0x4e5d56(0x1a5)],_0x4e5d56(0x1a2)+_0x48943b+_0x4e5d56(0x177));const _0x57ed0f=[_0x4e5d56(0x1b6),'site',_0x4e5d56(0x1a4),'parent_segment',_0x4e5d56(0x190),_0x4e5d56(0x1b1),_0x4e5d56(0x1b5),_0x4e5d56(0x19a)],_0x1dcced=_0x58d81c;for(const _0x247d92 of Object[_0x4e5d56(0x192)](_0x1dcced)){!_0x57ed0f[_0x4e5d56(0x1ba)](_0x247d92)&&console[_0x4e5d56(0x1ac)](_0x4e5d56(0x197)+_0x48943b+_0x4e5d56(0x184)+_0x247d92+_0x4e5d56(0x1ae));}const _0x1e901b=_0x57ed0f[_0x4e5d56(0x196)](_0x369396=>_0x369396!==_0x4e5d56(0x19a));for(const _0x486dca of _0x1e901b){if(_0x1dcced[_0x486dca]!==undefined&&typeof _0x1dcced[_0x486dca]!==_0x4e5d56(0x19d))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x48943b+'\x27:\x20\x27'+_0x486dca+_0x4e5d56(0x1a1));}return!![];}function loadProfilesFromTdxJson(_0x37af25,_0x4873c5){const _0x5b553a=a65_0x1bd7a1;if(!a65_0x6b1c53[_0x5b553a(0x180)](_0x37af25))return[];try{const _0x2a797e=a65_0x6b1c53[_0x5b553a(0x183)](_0x37af25,'utf-8'),_0xd35ccd=JSON['parse'](_0x2a797e);if(!_0xd35ccd[_0x5b553a(0x1a8)]||typeof _0xd35ccd['profiles']!=='object')return[];const _0x3c25f6=[];for(const [_0x24de9e,_0x47c1d6]of Object[_0x5b553a(0x1b3)](_0xd35ccd[_0x5b553a(0x1a8)])){try{validateProfileConfig(_0x47c1d6,_0x24de9e);const _0x1c87fa=getNewCredentialPath(_0x24de9e),_0x1ca63c=getOldCredentialPath(_0x24de9e),_0x442e45=a65_0x6b1c53[_0x5b553a(0x180)](_0x1c87fa)||a65_0x6b1c53[_0x5b553a(0x180)](_0x1ca63c);_0x3c25f6[_0x5b553a(0x1b0)]({'name':_0x24de9e,'config':_0x47c1d6,'metadata':{'name':_0x24de9e,'createdAt':new Date()[_0x5b553a(0x187)]()},'hasCredentials':_0x442e45,'scope':_0x4873c5});}catch(_0x5c2d31){_0x5c2d31 instanceof Error&&(console[_0x5b553a(0x1ac)](_0x5b553a(0x1aa)+_0x37af25+':'),console[_0x5b553a(0x1ac)]('\x20\x20'+_0x5c2d31[_0x5b553a(0x1be)]+'\x0a'));}}return _0x3c25f6;}catch(_0x23474f){return _0x23474f instanceof SyntaxError?(console[_0x5b553a(0x1ac)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x37af25+_0x5b553a(0x18a)),console['warn'](_0x5b553a(0x18e)+_0x23474f[_0x5b553a(0x1be)]+'\x0a')):console['warn'](_0x5b553a(0x1c0)+_0x37af25+':\x20'+_0x23474f+'\x0a'),[];}}export function getNewCredentialPath(_0x2d55bc){const _0x4da0a4=a65_0x1bd7a1;return a65_0x49fa67[_0x4da0a4(0x173)](getConfigDir(),_0x4da0a4(0x1b7)+_0x2d55bc);}function getOldCredentialPath(_0x7443df){const _0x17cfa3=a65_0x1bd7a1;return a65_0x49fa67[_0x17cfa3(0x173)](getProfilesDir(),_0x7443df,_0x17cfa3(0x1bc));}function loadProfilesFromTdxJsonFiles(){const _0x197c93=a65_0x1bd7a1,_0x10c4c4=[],_0x441134=findProjectConfigPath();_0x441134&&_0x10c4c4[_0x197c93(0x1b0)](...loadProfilesFromTdxJson(_0x441134,_0x197c93(0x1b4)));const _0x3d6b8f=a65_0x49fa67['join'](getConfigDir(),_0x197c93(0x1b9));return _0x10c4c4[_0x197c93(0x1b0)](...loadProfilesFromTdxJson(_0x3d6b8f,'user')),_0x10c4c4;}function loadProfilesFromDirectories(){const _0xdfefc1=a65_0x1bd7a1,_0x268998=getProfilesDir();if(!a65_0x6b1c53[_0xdfefc1(0x180)](_0x268998))return[];try{return a65_0x6b1c53[_0xdfefc1(0x1af)](_0x268998,{'withFileTypes':!![]})['filter'](_0x5beb61=>_0x5beb61[_0xdfefc1(0x17f)]())[_0xdfefc1(0x18c)](_0x3f004c=>_0x3f004c[_0xdfefc1(0x1a7)])[_0xdfefc1(0x196)](_0x5174ca=>{const _0x44872e=_0xdfefc1,_0x3789a8=getProfileConfigPath(_0x5174ca),_0x410200=getProfileEnvPath(_0x5174ca);return a65_0x6b1c53[_0x44872e(0x180)](_0x3789a8)||a65_0x6b1c53['existsSync'](_0x410200);})[_0xdfefc1(0x18c)](_0x320686=>{const _0x33b6fe=_0xdfefc1,_0xee2a46=loadProfileFromDirectory(_0x320686);if(_0xee2a46)return{..._0xee2a46,'scope':_0x33b6fe(0x1ad)};return null;})[_0xdfefc1(0x196)](_0xaf10bc=>_0xaf10bc!==null);}catch{return[];}}function loadProfileFromDirectory(_0x2f0fcf){const _0x310458=a65_0x1bd7a1,_0xab2933=getProfileConfigPath(_0x2f0fcf),_0x19027a=getOldCredentialPath(_0x2f0fcf);if(!a65_0x6b1c53[_0x310458(0x180)](_0xab2933)&&!a65_0x6b1c53[_0x310458(0x180)](_0x19027a))return null;let _0xb44abd={},_0x38947a={'name':_0x2f0fcf,'createdAt':new Date()[_0x310458(0x187)]()};if(a65_0x6b1c53['existsSync'](_0xab2933))try{const _0x589860=a65_0x6b1c53[_0x310458(0x183)](_0xab2933,_0x310458(0x1bb)),_0x344413=JSON[_0x310458(0x186)](_0x589860),{metadata:_0x244020,..._0x3f98f7}=_0x344413;_0xb44abd=_0x3f98f7,_0x244020&&(_0x38947a=_0x244020);}catch{}return{'name':_0x2f0fcf,'config':_0xb44abd,'metadata':_0x38947a,'hasCredentials':a65_0x6b1c53[_0x310458(0x180)](_0x19027a),'scope':_0x310458(0x1ad)};}export function listProfiles(){const _0x3b3561=a65_0x1bd7a1,_0x3ded53=loadProfilesFromTdxJsonFiles(),_0x1f1511=loadProfilesFromDirectories();if(_0x1f1511['length']>0x0){const _0x1b8a7c=_0x1f1511['map'](_0x49770c=>_0x49770c[_0x3b3561(0x1a7)])[_0x3b3561(0x173)](',\x20'),_0x29dee4=getConfigDir();console['warn'](_0x3b3561(0x17c)+_0x1b8a7c),console[_0x3b3561(0x1ac)](_0x3b3561(0x18b)),console['warn'](_0x3b3561(0x1c1)+a65_0x49fa67['join'](_0x29dee4,_0x3b3561(0x1b9))),console[_0x3b3561(0x1ac)](_0x3b3561(0x191)),console['warn']('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x2d82e1=[..._0x3ded53,..._0x1f1511],_0x53fd34=new Map();for(const _0x47edcc of _0x2d82e1){!_0x53fd34[_0x3b3561(0x175)](_0x47edcc[_0x3b3561(0x1a7)])&&_0x53fd34[_0x3b3561(0x172)](_0x47edcc[_0x3b3561(0x1a7)],_0x47edcc);}return Array[_0x3b3561(0x188)](_0x53fd34[_0x3b3561(0x1c2)]())[_0x3b3561(0x1bd)]((_0x37fa4c,_0x30e454)=>_0x37fa4c['name'][_0x3b3561(0x194)](_0x30e454[_0x3b3561(0x1a7)]));}export function profileExists(_0x4d81d7){const _0x3928b8=a65_0x1bd7a1,_0x2cad69=listProfiles();return _0x2cad69[_0x3928b8(0x1bf)](_0x1461f5=>_0x1461f5[_0x3928b8(0x1a7)]===_0x4d81d7);}export function loadProfile(_0x1098ab){const _0x4ea7a2=a65_0x1bd7a1;validateProfileName(_0x1098ab);const _0x11e1a4=listProfiles(),_0x420917=_0x11e1a4[_0x4ea7a2(0x199)](_0xe6a86d=>_0xe6a86d['name']===_0x1098ab);return _0x420917||null;}export function saveProfile(_0x288026,_0x257c52,_0x45b3e1=![]){saveProfileToUserConfig(_0x288026,_0x257c52);}export function deleteProfile(_0x43cf7e){const _0x1b8390=a65_0x1bd7a1;validateProfileName(_0x43cf7e);const _0xabff91=getProfileDir(_0x43cf7e);if(!a65_0x6b1c53['existsSync'](_0xabff91))throw new Error('Profile\x20'+_0x43cf7e+_0x1b8390(0x193));a65_0x6b1c53[_0x1b8390(0x195)](_0xabff91,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x4806d1,_0x447ffc){const _0x4c88e7=a65_0x1bd7a1;validateProfileName(_0x4806d1);const _0x4a6792=getGlobalConfigPath(),_0xa47ebc=getConfigDir();!a65_0x6b1c53['existsSync'](_0xa47ebc)&&createSecureDirectory(_0xa47ebc);let _0xc7c862={};if(a65_0x6b1c53[_0x4c88e7(0x180)](_0x4a6792))try{const _0x15de0b=a65_0x6b1c53[_0x4c88e7(0x183)](_0x4a6792,'utf-8');_0xc7c862=JSON[_0x4c88e7(0x186)](_0x15de0b);}catch{console[_0x4c88e7(0x1ac)](_0x4c88e7(0x1c3)+_0x4a6792+_0x4c88e7(0x1b2));}!_0xc7c862[_0x4c88e7(0x1a8)]&&(_0xc7c862[_0x4c88e7(0x1a8)]={}),_0xc7c862[_0x4c88e7(0x1a8)][_0x4806d1]=_0x447ffc,writeSecureFile(_0x4a6792,JSON[_0x4c88e7(0x1a0)](_0xc7c862,null,0x2));}export function removeProfileFromUserConfig(_0x59e6ef){const _0x275075=a65_0x1bd7a1;validateProfileName(_0x59e6ef);const _0x31f5bb=getGlobalConfigPath();if(!a65_0x6b1c53[_0x275075(0x180)](_0x31f5bb))throw new Error(_0x275075(0x1a2)+_0x59e6ef+_0x275075(0x17a));let _0x19a4f7={};try{const _0x34348c=a65_0x6b1c53['readFileSync'](_0x31f5bb,_0x275075(0x1bb));_0x19a4f7=JSON[_0x275075(0x186)](_0x34348c);}catch{throw new Error(_0x275075(0x174)+_0x31f5bb);}if(!_0x19a4f7[_0x275075(0x1a8)]||!_0x19a4f7[_0x275075(0x1a8)][_0x59e6ef])throw new Error(_0x275075(0x1a2)+_0x59e6ef+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x19a4f7[_0x275075(0x1a8)][_0x59e6ef],_0x19a4f7[_0x275075(0x19b)]===_0x59e6ef&&delete _0x19a4f7[_0x275075(0x19b)],writeSecureFile(_0x31f5bb,JSON['stringify'](_0x19a4f7,null,0x2));}export function getActiveProfile(){const _0x4270d2=a65_0x1bd7a1,_0x3fd5d0=loadSessionContext();if(_0x3fd5d0?.['profile'])return _0x3fd5d0[_0x4270d2(0x19b)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x3831cb=getGlobalConfigPath();if(!a65_0x6b1c53[_0x4270d2(0x180)](_0x3831cb))return null;try{const _0x25b1a7=a65_0x6b1c53[_0x4270d2(0x183)](_0x3831cb,'utf-8'),_0x21bb5c=JSON[_0x4270d2(0x186)](_0x25b1a7);return _0x21bb5c[_0x4270d2(0x19b)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x596b42){const _0x5cf0ca=a65_0x1bd7a1,_0x3cc33f=getGlobalConfigPath(),_0x2c72c8=getConfigDir();!a65_0x6b1c53['existsSync'](_0x2c72c8)&&createSecureDirectory(_0x2c72c8);let _0x2d9de7={};if(a65_0x6b1c53['existsSync'](_0x3cc33f))try{const _0xe236a3=a65_0x6b1c53[_0x5cf0ca(0x183)](_0x3cc33f,_0x5cf0ca(0x1bb));_0x2d9de7=JSON['parse'](_0xe236a3);}catch{console[_0x5cf0ca(0x1ac)](_0x5cf0ca(0x1c3)+_0x3cc33f+_0x5cf0ca(0x1b2));}_0x2d9de7[_0x5cf0ca(0x178)]=_0x596b42,writeSecureFile(_0x3cc33f,JSON[_0x5cf0ca(0x1a0)](_0x2d9de7,null,0x2));}export function saveActiveProfileToUserConfig(_0x25d653){const _0x4c851b=a65_0x1bd7a1;validateProfileName(_0x25d653);const _0xe6459e=getGlobalConfigPath(),_0x1ef6b0=getConfigDir();!a65_0x6b1c53[_0x4c851b(0x180)](_0x1ef6b0)&&createSecureDirectory(_0x1ef6b0);let _0x189acb={};if(a65_0x6b1c53['existsSync'](_0xe6459e))try{const _0x3ed63e=a65_0x6b1c53[_0x4c851b(0x183)](_0xe6459e,_0x4c851b(0x1bb));_0x189acb=JSON[_0x4c851b(0x186)](_0x3ed63e);}catch{console[_0x4c851b(0x1ac)](_0x4c851b(0x1c3)+_0xe6459e+_0x4c851b(0x1b2));}_0x189acb[_0x4c851b(0x19b)]=_0x25d653,writeSecureFile(_0xe6459e,JSON[_0x4c851b(0x1a0)](_0x189acb,null,0x2));}function clearFieldFromUserConfig(_0x5628a8){const _0x13436f=a65_0x1bd7a1,_0x15d87e=getGlobalConfigPath();if(!a65_0x6b1c53[_0x13436f(0x180)](_0x15d87e))return;let _0x3d33c5={};try{const _0x8ef919=a65_0x6b1c53[_0x13436f(0x183)](_0x15d87e,_0x13436f(0x1bb));_0x3d33c5=JSON[_0x13436f(0x186)](_0x8ef919);}catch{return;}delete _0x3d33c5[_0x5628a8],writeSecureFile(_0x15d87e,JSON[_0x13436f(0x1a0)](_0x3d33c5,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x2b3a24=a65_0x1bd7a1;clearFieldFromUserConfig(_0x2b3a24(0x178));}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x273f45,_0x5ac790){const _0x7ffe70=a65_0x1bd7a1;validateProfileName(_0x273f45);if(profileExists(_0x273f45))throw new Error(_0x7ffe70(0x1ab)+_0x273f45+_0x7ffe70(0x1b8));saveProfile(_0x273f45,_0x5ac790);}export function saveProfileCredentials(_0x25b849,_0x455c23){const _0x2a8c14=a65_0x1bd7a1;validateProfileName(_0x25b849);if(!profileExists(_0x25b849))throw new Error(_0x2a8c14(0x1ab)+_0x25b849+_0x2a8c14(0x193));const _0x5af0b8=getNewCredentialPath(_0x25b849);writeSecureFile(_0x5af0b8,_0x455c23);}export function loadProfileCredentials(_0x40dcf4){const _0x3c84dc=a65_0x1bd7a1;validateProfileName(_0x40dcf4);const _0x37fc7c=getNewCredentialPath(_0x40dcf4);if(a65_0x6b1c53[_0x3c84dc(0x180)](_0x37fc7c))try{return a65_0x6b1c53[_0x3c84dc(0x183)](_0x37fc7c,_0x3c84dc(0x1bb));}catch{}const _0x14273b=getOldCredentialPath(_0x40dcf4);if(a65_0x6b1c53[_0x3c84dc(0x180)](_0x14273b)){console[_0x3c84dc(0x1ac)](_0x3c84dc(0x17b)+_0x40dcf4+'\x27'),console[_0x3c84dc(0x1ac)](_0x3c84dc(0x1a3)),console[_0x3c84dc(0x1ac)](_0x3c84dc(0x19c)+_0x14273b+_0x3c84dc(0x176)+_0x37fc7c+'\x22'),console[_0x3c84dc(0x1ac)](_0x3c84dc(0x182));try{return a65_0x6b1c53[_0x3c84dc(0x183)](_0x14273b,_0x3c84dc(0x1bb));}catch{return null;}}return null;}
1
+ const a65_0x21099c=a65_0xc376;(function(_0x390e62,_0x195f0d){const _0xdb692f=a65_0xc376,_0x14a779=_0x390e62();while(!![]){try{const _0xca96d1=parseInt(_0xdb692f(0xdd))/0x1*(parseInt(_0xdb692f(0xab))/0x2)+-parseInt(_0xdb692f(0xd6))/0x3*(-parseInt(_0xdb692f(0xd1))/0x4)+-parseInt(_0xdb692f(0xbf))/0x5*(-parseInt(_0xdb692f(0xbd))/0x6)+parseInt(_0xdb692f(0xd2))/0x7*(parseInt(_0xdb692f(0xaa))/0x8)+-parseInt(_0xdb692f(0xb1))/0x9*(parseInt(_0xdb692f(0xc6))/0xa)+-parseInt(_0xdb692f(0xb2))/0xb+parseInt(_0xdb692f(0xdb))/0xc*(parseInt(_0xdb692f(0xb8))/0xd);if(_0xca96d1===_0x195f0d)break;else _0x14a779['push'](_0x14a779['shift']());}catch(_0x26d04f){_0x14a779['push'](_0x14a779['shift']());}}}(a65_0x2ffb,0xc6020));import*as a65_0x5f5989 from'node:fs';import*as a65_0x1c5b99 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_0x21099c(0xe1);export function getProfileParams(_0x1bf0d6){const _0x83f031=a65_0x21099c,_0xcf2000={};if(!_0x1bf0d6)return _0xcf2000;for(const [_0x22d094,_0x1e88dd]of Object[_0x83f031(0xdf)](_0x1bf0d6)){_0x22d094!=='description'&&_0x1e88dd!==undefined&&(_0xcf2000[_0x22d094]=_0x1e88dd);}return _0xcf2000;}export function getProfilesDir(){const _0x3f5ea1=a65_0x21099c;return a65_0x1c5b99[_0x3f5ea1(0xce)](getConfigDir(),'profiles');}function getProfileDir(_0x5c830a){const _0x177bc1=a65_0x21099c;return a65_0x1c5b99[_0x177bc1(0xce)](getProfilesDir(),_0x5c830a);}function getProfileConfigPath(_0x3b3681){const _0x26fe07=a65_0x21099c;return a65_0x1c5b99['join'](getProfileDir(_0x3b3681),_0x26fe07(0xaf));}function getProfileEnvPath(_0x2d2683){const _0x70f221=a65_0x21099c;return a65_0x1c5b99[_0x70f221(0xce)](getProfileDir(_0x2d2683),'.env');}function getGlobalConfigPath(){const _0x120c6d=a65_0x21099c;return a65_0x1c5b99['join'](getConfigDir(),_0x120c6d(0xaf));}function validateProfileName(_0x293b56){const _0x4713f3=a65_0x21099c;if(/^@?[a-zA-Z0-9_-]+$/[_0x4713f3(0xa0)](_0x293b56))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x4713f3(0xa0)](_0x293b56))return;throw new Error(_0x4713f3(0xca)+_0x293b56+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x4be9f0,_0x5a51aa){const _0x45ce48=a65_0x21099c;if(typeof _0x4be9f0!==_0x45ce48(0xe4)||_0x4be9f0===null)throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x5a51aa+_0x45ce48(0xd9));const _0x329773=[_0x45ce48(0xbb),_0x45ce48(0xc0),_0x45ce48(0xc3),'parent_segment',_0x45ce48(0xb5),'llm_agent',_0x45ce48(0xdc),_0x45ce48(0xa7)],_0x43d45b=_0x4be9f0;for(const _0x52f633 of Object['keys'](_0x43d45b)){!_0x329773['includes'](_0x52f633)&&console[_0x45ce48(0xcd)](_0x45ce48(0xb4)+_0x5a51aa+_0x45ce48(0xac)+_0x52f633+_0x45ce48(0xc2));}const _0x47d0eb=_0x329773['filter'](_0x3081e1=>_0x3081e1!==_0x45ce48(0xa7));for(const _0x360fe4 of _0x47d0eb){if(_0x43d45b[_0x360fe4]!==undefined&&typeof _0x43d45b[_0x360fe4]!==_0x45ce48(0xb9))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x5a51aa+_0x45ce48(0xcb)+_0x360fe4+_0x45ce48(0xcf));}return!![];}function loadProfilesFromTdxJson(_0x333b02,_0x33bd4e){const _0x1149e8=a65_0x21099c;if(!a65_0x5f5989[_0x1149e8(0xe5)](_0x333b02))return[];try{const _0x1ccdc8=a65_0x5f5989[_0x1149e8(0xe0)](_0x333b02,_0x1149e8(0x9f)),_0x2ccc3f=JSON['parse'](_0x1ccdc8);if(!_0x2ccc3f[_0x1149e8(0xcc)]||typeof _0x2ccc3f['profiles']!==_0x1149e8(0xe4))return[];const _0x2856e5=[];for(const [_0x425807,_0x4fb1ed]of Object[_0x1149e8(0xdf)](_0x2ccc3f[_0x1149e8(0xcc)])){try{validateProfileConfig(_0x4fb1ed,_0x425807);const _0x3e34ea=getNewCredentialPath(_0x425807),_0x5e0ce7=getOldCredentialPath(_0x425807),_0x29a9dc=a65_0x5f5989[_0x1149e8(0xe5)](_0x3e34ea)||a65_0x5f5989[_0x1149e8(0xe5)](_0x5e0ce7);_0x2856e5['push']({'name':_0x425807,'config':_0x4fb1ed,'metadata':{'name':_0x425807,'createdAt':new Date()[_0x1149e8(0xd8)]()},'hasCredentials':_0x29a9dc,'scope':_0x33bd4e});}catch(_0x5c85c6){_0x5c85c6 instanceof Error&&(console[_0x1149e8(0xcd)](_0x1149e8(0xd5)+_0x333b02+':'),console[_0x1149e8(0xcd)]('\x20\x20'+_0x5c85c6[_0x1149e8(0xbc)]+'\x0a'));}}return _0x2856e5;}catch(_0x3011ec){return _0x3011ec instanceof SyntaxError?(console[_0x1149e8(0xcd)](_0x1149e8(0xc7)+_0x333b02+_0x1149e8(0xb0)),console[_0x1149e8(0xcd)]('Error:\x20'+_0x3011ec['message']+'\x0a')):console[_0x1149e8(0xcd)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x333b02+':\x20'+_0x3011ec+'\x0a'),[];}}export function getNewCredentialPath(_0x38cde9){const _0x177033=a65_0x21099c;return a65_0x1c5b99[_0x177033(0xce)](getConfigDir(),'.env.'+_0x38cde9);}function getOldCredentialPath(_0x1da5b0){const _0x1c61b6=a65_0x21099c;return a65_0x1c5b99[_0x1c61b6(0xce)](getProfilesDir(),_0x1da5b0,_0x1c61b6(0xa4));}function loadProfilesFromTdxJsonFiles(){const _0x73a4d=a65_0x21099c,_0x470ea6=[],_0x2502a0=findProjectConfigPath();_0x2502a0&&_0x470ea6[_0x73a4d(0xad)](...loadProfilesFromTdxJson(_0x2502a0,_0x73a4d(0xe2)));const _0x43497d=a65_0x1c5b99['join'](getConfigDir(),_0x73a4d(0xaf));return _0x470ea6[_0x73a4d(0xad)](...loadProfilesFromTdxJson(_0x43497d,_0x73a4d(0xd3))),_0x470ea6;}function loadProfilesFromDirectories(){const _0x4ad30b=a65_0x21099c,_0x134131=getProfilesDir();if(!a65_0x5f5989[_0x4ad30b(0xe5)](_0x134131))return[];try{return a65_0x5f5989['readdirSync'](_0x134131,{'withFileTypes':!![]})[_0x4ad30b(0xa5)](_0x42b1be=>_0x42b1be[_0x4ad30b(0xc8)]())['map'](_0x3e98e9=>_0x3e98e9[_0x4ad30b(0xd0)])[_0x4ad30b(0xa5)](_0x4cf010=>{const _0x19198b=_0x4ad30b,_0x5592e4=getProfileConfigPath(_0x4cf010),_0x82f1a6=getProfileEnvPath(_0x4cf010);return a65_0x5f5989[_0x19198b(0xe5)](_0x5592e4)||a65_0x5f5989[_0x19198b(0xe5)](_0x82f1a6);})[_0x4ad30b(0xbe)](_0x3ae371=>{const _0x283f2c=_0x4ad30b,_0x5a077c=loadProfileFromDirectory(_0x3ae371);if(_0x5a077c)return{..._0x5a077c,'scope':_0x283f2c(0xb3)};return null;})['filter'](_0x1d3de3=>_0x1d3de3!==null);}catch{return[];}}function loadProfileFromDirectory(_0x543426){const _0xdc56b=a65_0x21099c,_0x182434=getProfileConfigPath(_0x543426),_0x50f836=getOldCredentialPath(_0x543426);if(!a65_0x5f5989[_0xdc56b(0xe5)](_0x182434)&&!a65_0x5f5989[_0xdc56b(0xe5)](_0x50f836))return null;let _0x2f6141={},_0x46722f={'name':_0x543426,'createdAt':new Date()['toISOString']()};if(a65_0x5f5989[_0xdc56b(0xe5)](_0x182434))try{const _0xdc3ecd=a65_0x5f5989['readFileSync'](_0x182434,'utf-8'),_0x32700a=JSON['parse'](_0xdc3ecd),{metadata:_0x4b3b7e,..._0x27e455}=_0x32700a;_0x2f6141=_0x27e455,_0x4b3b7e&&(_0x46722f=_0x4b3b7e);}catch{}return{'name':_0x543426,'config':_0x2f6141,'metadata':_0x46722f,'hasCredentials':a65_0x5f5989[_0xdc56b(0xe5)](_0x50f836),'scope':_0xdc56b(0xb3)};}function a65_0xc376(_0x4c3e35,_0x259ca6){_0x4c3e35=_0x4c3e35-0x9d;const _0x2ffb24=a65_0x2ffb();let _0xc3762e=_0x2ffb24[_0x4c3e35];return _0xc3762e;}export function listProfiles(){const _0x17d55a=a65_0x21099c,_0x454f52=loadProfilesFromTdxJsonFiles(),_0x340853=loadProfilesFromDirectories();if(_0x340853['length']>0x0){const _0x108afc=_0x340853[_0x17d55a(0xbe)](_0x57bfde=>_0x57bfde[_0x17d55a(0xd0)])[_0x17d55a(0xce)](',\x20'),_0x24fd0d=getConfigDir();console[_0x17d55a(0xcd)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x108afc),console['warn'](_0x17d55a(0xe3)),console[_0x17d55a(0xcd)](_0x17d55a(0xa9)+a65_0x1c5b99[_0x17d55a(0xce)](_0x24fd0d,_0x17d55a(0xaf))),console[_0x17d55a(0xcd)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x17d55a(0xcd)](_0x17d55a(0x9d));}const _0x567943=[..._0x454f52,..._0x340853],_0x4e09d1=new Map();for(const _0x5107db of _0x567943){!_0x4e09d1[_0x17d55a(0xa2)](_0x5107db['name'])&&_0x4e09d1[_0x17d55a(0xc9)](_0x5107db[_0x17d55a(0xd0)],_0x5107db);}return Array[_0x17d55a(0xc5)](_0x4e09d1['values']())['sort']((_0x11c60f,_0x3dc6ad)=>_0x11c60f[_0x17d55a(0xd0)]['localeCompare'](_0x3dc6ad[_0x17d55a(0xd0)]));}export function profileExists(_0x3a898a){const _0x3ed7fd=a65_0x21099c,_0x1387ad=listProfiles();return _0x1387ad[_0x3ed7fd(0xd7)](_0x5bbba7=>_0x5bbba7['name']===_0x3a898a);}export function loadProfile(_0x1abae1){const _0xfaf613=a65_0x21099c;validateProfileName(_0x1abae1);const _0x1a2f06=listProfiles(),_0x4afbf7=_0x1a2f06['find'](_0x20f418=>_0x20f418[_0xfaf613(0xd0)]===_0x1abae1);return _0x4afbf7||null;}export function saveProfile(_0x2742ba,_0x3407ee,_0x17206c=![]){saveProfileToUserConfig(_0x2742ba,_0x3407ee);}export function deleteProfile(_0x469228){const _0x58c7b1=a65_0x21099c;validateProfileName(_0x469228);const _0x5ec828=getProfileDir(_0x469228);if(!a65_0x5f5989['existsSync'](_0x5ec828))throw new Error(_0x58c7b1(0xa6)+_0x469228+_0x58c7b1(0x9e));a65_0x5f5989['rmSync'](_0x5ec828,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0xc64d32,_0x1fd9bf){const _0x55d99c=a65_0x21099c;validateProfileName(_0xc64d32);const _0x59defe=getGlobalConfigPath(),_0x456ff0=getConfigDir();!a65_0x5f5989[_0x55d99c(0xe5)](_0x456ff0)&&createSecureDirectory(_0x456ff0);let _0x2d00ee={};if(a65_0x5f5989['existsSync'](_0x59defe))try{const _0x3b52ce=a65_0x5f5989['readFileSync'](_0x59defe,_0x55d99c(0x9f));_0x2d00ee=JSON[_0x55d99c(0xa1)](_0x3b52ce);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x59defe+_0x55d99c(0xba));}!_0x2d00ee[_0x55d99c(0xcc)]&&(_0x2d00ee['profiles']={}),_0x2d00ee[_0x55d99c(0xcc)][_0xc64d32]=_0x1fd9bf,writeSecureFile(_0x59defe,JSON[_0x55d99c(0xc4)](_0x2d00ee,null,0x2));}export function removeProfileFromUserConfig(_0x3ac742){const _0xe4a9f5=a65_0x21099c;validateProfileName(_0x3ac742);const _0x2bfac4=getGlobalConfigPath();if(!a65_0x5f5989[_0xe4a9f5(0xe5)](_0x2bfac4))throw new Error(_0xe4a9f5(0xae)+_0x3ac742+_0xe4a9f5(0xc1));let _0x141994={};try{const _0x4ca193=a65_0x5f5989[_0xe4a9f5(0xe0)](_0x2bfac4,'utf-8');_0x141994=JSON[_0xe4a9f5(0xa1)](_0x4ca193);}catch{throw new Error(_0xe4a9f5(0xb6)+_0x2bfac4);}if(!_0x141994[_0xe4a9f5(0xcc)]||!_0x141994[_0xe4a9f5(0xcc)][_0x3ac742])throw new Error(_0xe4a9f5(0xae)+_0x3ac742+_0xe4a9f5(0xc1));delete _0x141994['profiles'][_0x3ac742],_0x141994[_0xe4a9f5(0xa3)]===_0x3ac742&&delete _0x141994[_0xe4a9f5(0xa3)],writeSecureFile(_0x2bfac4,JSON[_0xe4a9f5(0xc4)](_0x141994,null,0x2));}export function getActiveProfile(){const _0x229707=a65_0x21099c,_0x211052=loadSessionContext();if(_0x211052?.[_0x229707(0xa3)])return _0x211052['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x2e95dc=getGlobalConfigPath();if(!a65_0x5f5989[_0x229707(0xe5)](_0x2e95dc))return null;try{const _0x376479=a65_0x5f5989[_0x229707(0xe0)](_0x2e95dc,_0x229707(0x9f)),_0x2db56f=JSON[_0x229707(0xa1)](_0x376479);return _0x2db56f['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x108785){const _0x28efe9=a65_0x21099c,_0x12c9da=getGlobalConfigPath(),_0x2078f0=getConfigDir();!a65_0x5f5989[_0x28efe9(0xe5)](_0x2078f0)&&createSecureDirectory(_0x2078f0);let _0x44a03f={};if(a65_0x5f5989[_0x28efe9(0xe5)](_0x12c9da))try{const _0x435e6c=a65_0x5f5989[_0x28efe9(0xe0)](_0x12c9da,'utf-8');_0x44a03f=JSON[_0x28efe9(0xa1)](_0x435e6c);}catch{console[_0x28efe9(0xcd)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x12c9da+',\x20creating\x20new\x20file');}_0x44a03f['site']=_0x108785,writeSecureFile(_0x12c9da,JSON['stringify'](_0x44a03f,null,0x2));}export function saveActiveProfileToUserConfig(_0x4e6b2b){const _0x5dde83=a65_0x21099c;validateProfileName(_0x4e6b2b);const _0x5cdbdc=getGlobalConfigPath(),_0x4653df=getConfigDir();!a65_0x5f5989[_0x5dde83(0xe5)](_0x4653df)&&createSecureDirectory(_0x4653df);let _0x316884={};if(a65_0x5f5989[_0x5dde83(0xe5)](_0x5cdbdc))try{const _0x40ad0a=a65_0x5f5989[_0x5dde83(0xe0)](_0x5cdbdc,_0x5dde83(0x9f));_0x316884=JSON[_0x5dde83(0xa1)](_0x40ad0a);}catch{console[_0x5dde83(0xcd)](_0x5dde83(0xa8)+_0x5cdbdc+_0x5dde83(0xba));}_0x316884['profile']=_0x4e6b2b,writeSecureFile(_0x5cdbdc,JSON[_0x5dde83(0xc4)](_0x316884,null,0x2));}function a65_0x2ffb(){const _0x519673=['\x27:\x20\x27','profiles','warn','join','\x27\x20must\x20be\x20a\x20string','name','344YnyrlQ','2541FtNgZP','user','\x22\x20\x22','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','26802OqMIsm','some','toISOString','\x27:\x20config\x20must\x20be\x20an\x20object','\x20\x20mv\x20\x22','12tCVvFJ','account_name','10TlBpPn','To\x20migrate:','entries','readFileSync','@tdx-studio','local','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','object','existsSync','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x20does\x20not\x20exist','utf-8','test','parse','has','profile','.env','filter','Profile\x20','user_info','Warning:\x20Failed\x20to\x20parse\x20','\x20\x201.\x20Edit:\x20','5960CwmVQE','72484gvneFb','\x27:\x20unknown\x20config\x20key\x20\x27','push','Profile\x20\x27','tdx.json',':\x20Invalid\x20JSON\x20syntax','9VhlMRN','10822889CBFMej','directory','Warning:\x20Profile\x20\x27','llm_project','Failed\x20to\x20parse\x20','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','7478887XjwTkz','string',',\x20creating\x20new\x20file','description','message','3900FfgHIn','map','7400RdIvDp','site','\x27\x20not\x20found\x20in\x20user\x20configuration','\x27\x20will\x20be\x20ignored','database','stringify','from','11435390SWIMog','\x0aWarning:\x20Failed\x20to\x20parse\x20','isDirectory','set','Invalid\x20profile\x20name:\x20'];a65_0x2ffb=function(){return _0x519673;};return a65_0x2ffb();}function clearFieldFromUserConfig(_0x58a15c){const _0x38f0be=a65_0x21099c,_0x4bbc3e=getGlobalConfigPath();if(!a65_0x5f5989[_0x38f0be(0xe5)](_0x4bbc3e))return;let _0x249753={};try{const _0x5608dd=a65_0x5f5989['readFileSync'](_0x4bbc3e,_0x38f0be(0x9f));_0x249753=JSON['parse'](_0x5608dd);}catch{return;}delete _0x249753[_0x58a15c],writeSecureFile(_0x4bbc3e,JSON['stringify'](_0x249753,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0x5023b5=a65_0x21099c;clearFieldFromUserConfig(_0x5023b5(0xa3));}export function createProfile(_0x4c3c23,_0x4d224a){const _0x3daf2e=a65_0x21099c;validateProfileName(_0x4c3c23);if(profileExists(_0x4c3c23))throw new Error(_0x3daf2e(0xa6)+_0x4c3c23+'\x20already\x20exists');saveProfile(_0x4c3c23,_0x4d224a);}export function saveProfileCredentials(_0x5e5ab9,_0x4f7039){const _0x18e67e=a65_0x21099c;validateProfileName(_0x5e5ab9);if(!profileExists(_0x5e5ab9))throw new Error(_0x18e67e(0xa6)+_0x5e5ab9+_0x18e67e(0x9e));const _0x14af8f=getNewCredentialPath(_0x5e5ab9);writeSecureFile(_0x14af8f,_0x4f7039);}export function loadProfileCredentials(_0xb6d1af){const _0x29c5d9=a65_0x21099c;validateProfileName(_0xb6d1af);const _0x1809d0=getNewCredentialPath(_0xb6d1af);if(a65_0x5f5989[_0x29c5d9(0xe5)](_0x1809d0))try{return a65_0x5f5989['readFileSync'](_0x1809d0,'utf-8');}catch{}const _0x31dbf2=getOldCredentialPath(_0xb6d1af);if(a65_0x5f5989['existsSync'](_0x31dbf2)){console['warn']('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0xb6d1af+'\x27'),console[_0x29c5d9(0xcd)](_0x29c5d9(0xde)),console['warn'](_0x29c5d9(0xda)+_0x31dbf2+_0x29c5d9(0xd4)+_0x1809d0+'\x22'),console[_0x29c5d9(0xcd)](_0x29c5d9(0xb7));try{return a65_0x5f5989[_0x29c5d9(0xe0)](_0x31dbf2,_0x29c5d9(0x9f));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a66_0x4f6beb=a66_0x3d24;function a66_0x3cb1(){const _0x1e82d4=['api_key','2xeidPF','887184cLzbLc','includes','11301hHvtyE','Failed\x20to\x20load\x20project\x20config\x20from\x20','join','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','cwd','existsSync','parse','24225AWJycg','\x20is\x20ignored.\x20','apiKey','TD_API_KEY','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','ENOENT','1204154GUGbKO','writeFileSync','400124rZsNjC','utf-8','6nZRDpc','profile','183672lhfnwi','dirname','tdx.json',').\x20','warn','stringify','220317BfMsjb','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','Warning:\x20\x27profile\x27\x20field\x20in\x20'];a66_0x3cb1=function(){return _0x1e82d4;};return a66_0x3cb1();}function a66_0x3d24(_0x5e587a,_0x1aa60c){_0x5e587a=_0x5e587a-0x1d9;const _0x3cb15e=a66_0x3cb1();let _0x3d2400=_0x3cb15e[_0x5e587a];return _0x3d2400;}(function(_0x30b6d3,_0x540d4f){const _0x20524c=a66_0x3d24,_0x2b00c1=_0x30b6d3();while(!![]){try{const _0x2783a0=parseInt(_0x20524c(0x1f4))/0x1*(-parseInt(_0x20524c(0x1f1))/0x2)+-parseInt(_0x20524c(0x1ed))/0x3+parseInt(_0x20524c(0x1e3))/0x4+parseInt(_0x20524c(0x1db))/0x5+parseInt(_0x20524c(0x1e5))/0x6*(parseInt(_0x20524c(0x1e1))/0x7)+-parseInt(_0x20524c(0x1f2))/0x8+parseInt(_0x20524c(0x1e7))/0x9;if(_0x2783a0===_0x540d4f)break;else _0x2b00c1['push'](_0x2b00c1['shift']());}catch(_0x3a47eb){_0x2b00c1['push'](_0x2b00c1['shift']());}}}(a66_0x3cb1,0x18d24));import*as a66_0x40570d from'node:fs';import*as a66_0x261031 from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x4f6beb(0x1e9);export function findProjectConfigPath(_0x230e54){const _0x305224=a66_0x4f6beb;let _0x34b089=_0x230e54||process[_0x305224(0x1f8)]();while(!![]){const _0xebb58f=a66_0x261031[_0x305224(0x1f6)](_0x34b089,PROJECT_CONFIG_FILENAME);if(a66_0x40570d[_0x305224(0x1d9)](_0xebb58f))return _0xebb58f;const _0x30b7bf=a66_0x261031[_0x305224(0x1e8)](_0x34b089);if(_0x30b7bf===_0x34b089)return null;_0x34b089=_0x30b7bf;}}export function loadProjectConfig(_0x2350d9){const _0x28c45e=a66_0x4f6beb,_0x347c34=findProjectConfigPath(_0x2350d9);if(!_0x347c34)return null;try{const _0x45ac64=a66_0x40570d['readFileSync'](_0x347c34,_0x28c45e(0x1e4)),_0x14c41c=JSON[_0x28c45e(0x1da)](_0x45ac64),_0x2cf256=JSON[_0x28c45e(0x1ec)](_0x14c41c);if(_0x2cf256[_0x28c45e(0x1f3)]('TD_API_KEY')||_0x2cf256[_0x28c45e(0x1f3)](_0x28c45e(0x1dd))||_0x2cf256[_0x28c45e(0x1f3)](_0x28c45e(0x1f0)))throw new Error(_0x28c45e(0x1f7)+_0x347c34+_0x28c45e(0x1ea)+_0x28c45e(0x1ee));const {metadata:_0x415862,profile:_0x563dee,..._0x54d4c5}=_0x14c41c;return _0x563dee&&console[_0x28c45e(0x1eb)](_0x28c45e(0x1ef)+_0x347c34+_0x28c45e(0x1dc)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x54d4c5;}catch(_0x47cc58){if(_0x47cc58 instanceof Error&&'code'in _0x47cc58&&_0x47cc58['code']===_0x28c45e(0x1e0))return null;throw new Error(_0x28c45e(0x1f5)+_0x347c34+':\x20'+_0x47cc58);}}export function saveProjectConfig(_0x2989fc,_0x390fea){const _0x198bd1=a66_0x4f6beb,_0x33b8bc=_0x390fea||process[_0x198bd1(0x1f8)](),_0x16d35f=a66_0x261031['join'](_0x33b8bc,PROJECT_CONFIG_FILENAME),_0x2f10f5=JSON[_0x198bd1(0x1ec)](_0x2989fc);if(_0x2f10f5['includes'](_0x198bd1(0x1de))||_0x2f10f5[_0x198bd1(0x1f3)](_0x198bd1(0x1dd))||_0x2f10f5[_0x198bd1(0x1f3)](_0x198bd1(0x1f0)))throw new Error(_0x198bd1(0x1df));if(_0x198bd1(0x1e6)in _0x2989fc)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a66_0x40570d[_0x198bd1(0x1e2)](_0x16d35f,JSON[_0x198bd1(0x1ec)](_0x2989fc,null,0x2));}export function hasProjectConfig(_0x4456ed){return findProjectConfigPath(_0x4456ed)!==null;}export function getProjectRoot(_0x3c97ac){const _0x4a3a1a=a66_0x4f6beb,_0xf0f83f=findProjectConfigPath(_0x3c97ac);return _0xf0f83f?a66_0x261031[_0x4a3a1a(0x1e8)](_0xf0f83f):null;}
1
+ const a66_0x452c8a=a66_0x3790;(function(_0x5d6487,_0x51ad1e){const _0x4ed7ef=a66_0x3790,_0x5afd2a=_0x5d6487();while(!![]){try{const _0x226efe=parseInt(_0x4ed7ef(0x14e))/0x1*(-parseInt(_0x4ed7ef(0x157))/0x2)+parseInt(_0x4ed7ef(0x142))/0x3+-parseInt(_0x4ed7ef(0x143))/0x4+-parseInt(_0x4ed7ef(0x13d))/0x5+-parseInt(_0x4ed7ef(0x13f))/0x6+parseInt(_0x4ed7ef(0x153))/0x7*(parseInt(_0x4ed7ef(0x150))/0x8)+parseInt(_0x4ed7ef(0x154))/0x9;if(_0x226efe===_0x51ad1e)break;else _0x5afd2a['push'](_0x5afd2a['shift']());}catch(_0x5be653){_0x5afd2a['push'](_0x5afd2a['shift']());}}}(a66_0x367d,0x34081));import*as a66_0x3f5caf from'node:fs';import*as a66_0x262118 from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x452c8a(0x144);export function findProjectConfigPath(_0x5256cf){const _0x121f33=a66_0x452c8a;let _0x104335=_0x5256cf||process['cwd']();while(!![]){const _0x183027=a66_0x262118['join'](_0x104335,PROJECT_CONFIG_FILENAME);if(a66_0x3f5caf[_0x121f33(0x13a)](_0x183027))return _0x183027;const _0x1537b2=a66_0x262118[_0x121f33(0x14d)](_0x104335);if(_0x1537b2===_0x104335)return null;_0x104335=_0x1537b2;}}export function loadProjectConfig(_0x579758){const _0x54350c=a66_0x452c8a,_0x27c965=findProjectConfigPath(_0x579758);if(!_0x27c965)return null;try{const _0x71babf=a66_0x3f5caf['readFileSync'](_0x27c965,_0x54350c(0x147)),_0x542af0=JSON[_0x54350c(0x14a)](_0x71babf),_0x240d63=JSON['stringify'](_0x542af0);if(_0x240d63[_0x54350c(0x141)]('TD_API_KEY')||_0x240d63[_0x54350c(0x141)](_0x54350c(0x149))||_0x240d63[_0x54350c(0x141)](_0x54350c(0x152)))throw new Error(_0x54350c(0x13b)+_0x27c965+_0x54350c(0x13c)+_0x54350c(0x155));const {metadata:_0x2f299d,profile:_0x1d57da,..._0x40d379}=_0x542af0;return _0x1d57da&&console[_0x54350c(0x14b)](_0x54350c(0x159)+_0x27c965+_0x54350c(0x14c)+_0x54350c(0x140)),_0x40d379;}catch(_0x3dd3f9){if(_0x3dd3f9 instanceof Error&&_0x54350c(0x14f)in _0x3dd3f9&&_0x3dd3f9['code']==='ENOENT')return null;throw new Error(_0x54350c(0x145)+_0x27c965+':\x20'+_0x3dd3f9);}}export function saveProjectConfig(_0x247caa,_0x23620b){const _0x2ebb97=a66_0x452c8a,_0x409663=_0x23620b||process['cwd'](),_0x177c17=a66_0x262118[_0x2ebb97(0x148)](_0x409663,PROJECT_CONFIG_FILENAME),_0xff274a=JSON[_0x2ebb97(0x151)](_0x247caa);if(_0xff274a[_0x2ebb97(0x141)](_0x2ebb97(0x139))||_0xff274a[_0x2ebb97(0x141)](_0x2ebb97(0x149))||_0xff274a[_0x2ebb97(0x141)](_0x2ebb97(0x152)))throw new Error(_0x2ebb97(0x158));if(_0x2ebb97(0x156)in _0x247caa)throw new Error(_0x2ebb97(0x146));a66_0x3f5caf[_0x2ebb97(0x13e)](_0x177c17,JSON[_0x2ebb97(0x151)](_0x247caa,null,0x2));}function a66_0x367d(){const _0x489c0e=['623943fkKsIi','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','profile','606droQJY','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','Warning:\x20\x27profile\x27\x20field\x20in\x20','TD_API_KEY','existsSync','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(',').\x20','193885vZNNqT','writeFileSync','258684vNXMpT','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','includes','930087tBygQl','731348HklvHn','tdx.json','Failed\x20to\x20load\x20project\x20config\x20from\x20','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','utf-8','join','apiKey','parse','warn','\x20is\x20ignored.\x20','dirname','566hDMkUm','code','3144AIFslA','stringify','api_key','4809ciPJAP'];a66_0x367d=function(){return _0x489c0e;};return a66_0x367d();}export function hasProjectConfig(_0x567f2b){return findProjectConfigPath(_0x567f2b)!==null;}function a66_0x3790(_0x20877b,_0x1bfd27){_0x20877b=_0x20877b-0x139;const _0x367d99=a66_0x367d();let _0x3790c3=_0x367d99[_0x20877b];return _0x3790c3;}export function getProjectRoot(_0x3019e5){const _0x1db9ee=a66_0x452c8a,_0x44e7d1=findProjectConfigPath(_0x3019e5);return _0x44e7d1?a66_0x262118[_0x1db9ee(0x14d)](_0x44e7d1):null;}
@@ -1 +1 @@
1
- (function(_0x557186,_0x5b500a){const _0x2671da=a67_0x2059,_0xcbab22=_0x557186();while(!![]){try{const _0x1f4bc2=-parseInt(_0x2671da(0x82))/0x1*(parseInt(_0x2671da(0x81))/0x2)+-parseInt(_0x2671da(0x86))/0x3+parseInt(_0x2671da(0x73))/0x4*(parseInt(_0x2671da(0x8b))/0x5)+-parseInt(_0x2671da(0x76))/0x6+-parseInt(_0x2671da(0x67))/0x7+-parseInt(_0x2671da(0x6d))/0x8*(parseInt(_0x2671da(0x6e))/0x9)+parseInt(_0x2671da(0x7f))/0xa;if(_0x1f4bc2===_0x5b500a)break;else _0xcbab22['push'](_0xcbab22['shift']());}catch(_0x587c21){_0xcbab22['push'](_0xcbab22['shift']());}}}(a67_0x34f4,0x23b02));import*as a67_0x1f8468 from'node:fs';import*as a67_0x226a5e from'node:path';import*as a67_0x576a25 from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';function a67_0x34f4(){const _0x1092d9=['parse','6634210KWItYG','endsWith','76058MAzyZG','5GHxJuE','toString','api_key','stringify','190479ntHvuc','now','.\x20This\x20is\x20insecure.\x20Removing\x20session.','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','homedir','5vZlEzk','sessions','test','apiKey','getTime','854672IkWhJR','utf-8','join','.json','toISOString','includes','546632YAaVNj','9exHyJj','existsSync','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','push','readFileSync','6680YAoQIg','tdx','unlinkSync','449100RWBVFP','writeFileSync','sort','readdirSync','TD_API_KEY','replace','warn','createdAt'];a67_0x34f4=function(){return _0x1092d9;};return a67_0x34f4();}import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x1dc253=a67_0x2059,_0x21e4aa=process.env.TDX_CONFIG_DIR||a67_0x226a5e[_0x1dc253(0x69)](a67_0x576a25[_0x1dc253(0x8a)](),'.config',_0x1dc253(0x74));return a67_0x226a5e['join'](_0x21e4aa,_0x1dc253(0x8c));}function getSessionPath(_0x176cae){const _0x24ec98=a67_0x2059;return a67_0x226a5e['join'](getSessionsDir(),_0x176cae+_0x24ec98(0x6a));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x471fc9){const _0x6f6c84=a67_0x2059;if(_0x471fc9)return _0x471fc9;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x6f6c84(0x83)]();}export function loadSessionContext(_0x3df489){const _0x262dd5=a67_0x2059,_0x1d8573=getSessionID(_0x3df489),_0x46ed88=/^\d+$/[_0x262dd5(0x64)](_0x1d8573)?parseInt(_0x1d8573,0xa):null;return _0x46ed88!==null?loadSessionContextByPID(_0x46ed88):loadSessionContextByString(_0x1d8573);}export function loadSessionContextByPID(_0x4c3598){const _0x2ef95d=a67_0x2059,_0x2241e6=getSessionPath(_0x4c3598);if(!a67_0x1f8468['existsSync'](_0x2241e6))return null;try{const _0x4ec713=a67_0x1f8468[_0x2ef95d(0x72)](_0x2241e6,_0x2ef95d(0x68)),_0x560716=JSON[_0x2ef95d(0x7e)](_0x4ec713),_0x419561=new Date(_0x560716[_0x2ef95d(0x7d)])[_0x2ef95d(0x66)](),_0x5a0276=Date[_0x2ef95d(0x87)]();if(_0x5a0276-_0x419561>SESSION_EXPIRATION_MS)return a67_0x1f8468[_0x2ef95d(0x75)](_0x2241e6),null;const _0x144e6a=JSON['stringify'](_0x560716);if(_0x144e6a[_0x2ef95d(0x6c)](_0x2ef95d(0x7a))||_0x144e6a[_0x2ef95d(0x6c)]('apiKey')||_0x144e6a['includes'](_0x2ef95d(0x84)))return console[_0x2ef95d(0x7c)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x2241e6+_0x2ef95d(0x88)),a67_0x1f8468[_0x2ef95d(0x75)](_0x2241e6),null;return _0x560716;}catch{try{a67_0x1f8468['unlinkSync'](_0x2241e6);}catch{}return null;}}function loadSessionContextByString(_0x4cb805){const _0x4ec381=a67_0x2059,_0x1b1d07=a67_0x226a5e[_0x4ec381(0x69)](getSessionsDir(),_0x4cb805+'.json');if(!a67_0x1f8468[_0x4ec381(0x6f)](_0x1b1d07))return null;try{const _0x21a742=a67_0x1f8468[_0x4ec381(0x72)](_0x1b1d07,'utf-8'),_0x49e3f8=JSON[_0x4ec381(0x7e)](_0x21a742),_0x33dc6c=new Date(_0x49e3f8[_0x4ec381(0x7d)])[_0x4ec381(0x66)](),_0x5a9f26=Date[_0x4ec381(0x87)]();if(_0x5a9f26-_0x33dc6c>SESSION_EXPIRATION_MS)return a67_0x1f8468[_0x4ec381(0x75)](_0x1b1d07),null;const _0x496dc9=JSON[_0x4ec381(0x85)](_0x49e3f8);if(_0x496dc9[_0x4ec381(0x6c)]('TD_API_KEY')||_0x496dc9[_0x4ec381(0x6c)](_0x4ec381(0x65))||_0x496dc9[_0x4ec381(0x6c)](_0x4ec381(0x84)))return console[_0x4ec381(0x7c)](_0x4ec381(0x70)+_0x1b1d07+_0x4ec381(0x88)),a67_0x1f8468[_0x4ec381(0x75)](_0x1b1d07),null;return _0x49e3f8;}catch{try{a67_0x1f8468[_0x4ec381(0x75)](_0x1b1d07);}catch{}return null;}}export function saveSessionContext(_0x2416c2,_0x5f0986){const _0x40a8df=a67_0x2059,_0x1993f7=getSessionID(_0x5f0986),_0x1c0c88=/^\d+$/['test'](_0x1993f7)?parseInt(_0x1993f7,0xa):getCurrentSessionPID(),_0x4f58ee=a67_0x226a5e['join'](getSessionsDir(),_0x1993f7+_0x40a8df(0x6a)),_0x3b5e5b=getSessionsDir();createSecureDirectory(_0x3b5e5b);const _0x2a59c0=JSON['stringify'](_0x2416c2);if(_0x2a59c0['includes']('TD_API_KEY')||_0x2a59c0[_0x40a8df(0x6c)]('apiKey')||_0x2a59c0[_0x40a8df(0x6c)](_0x40a8df(0x84)))throw new Error(_0x40a8df(0x89));let _0x8d7269;const _0x4524df=/^\d+$/[_0x40a8df(0x64)](_0x1993f7)?loadSessionContextByPID(parseInt(_0x1993f7,0xa)):loadSessionContextByString(_0x1993f7);_0x4524df?_0x8d7269={..._0x4524df,..._0x2416c2,'pid':_0x1c0c88,'sessionId':_0x1993f7!==_0x1c0c88[_0x40a8df(0x83)]()?_0x1993f7:undefined,'updatedAt':new Date()['toISOString']()}:_0x8d7269={'pid':_0x1c0c88,'sessionId':_0x1993f7!==_0x1c0c88[_0x40a8df(0x83)]()?_0x1993f7:undefined,..._0x2416c2,'createdAt':new Date()[_0x40a8df(0x6b)](),'updatedAt':new Date()[_0x40a8df(0x6b)]()},a67_0x1f8468[_0x40a8df(0x77)](_0x4f58ee,JSON[_0x40a8df(0x85)](_0x8d7269,null,0x2));}export function clearSessionContext(_0x52a4f9){const _0x9ba843=a67_0x2059,_0x54c565=getSessionID(_0x52a4f9),_0x253be6=a67_0x226a5e[_0x9ba843(0x69)](getSessionsDir(),_0x54c565+'.json');a67_0x1f8468['existsSync'](_0x253be6)&&a67_0x1f8468['unlinkSync'](_0x253be6);}export function clearSessionContextField(_0x2da459,_0x44a530){const _0x5aa013=a67_0x2059,_0x1f6ae5=getSessionID(_0x44a530),_0x14fb67=a67_0x226a5e[_0x5aa013(0x69)](getSessionsDir(),_0x1f6ae5+'.json');if(!a67_0x1f8468['existsSync'](_0x14fb67))return;try{const _0x7d76bf=a67_0x1f8468[_0x5aa013(0x72)](_0x14fb67,_0x5aa013(0x68)),_0xce1bd5=JSON[_0x5aa013(0x7e)](_0x7d76bf);delete _0xce1bd5[_0x2da459],a67_0x1f8468[_0x5aa013(0x77)](_0x14fb67,JSON[_0x5aa013(0x85)](_0xce1bd5,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x28cddf=a67_0x2059,_0x35f82f=getSessionsDir();if(!a67_0x1f8468['existsSync'](_0x35f82f))return 0x0;let _0x113788=0x0;const _0x336989=Date['now']();try{const _0x53ff54=a67_0x1f8468[_0x28cddf(0x79)](_0x35f82f);for(const _0x222f9b of _0x53ff54){if(!_0x222f9b[_0x28cddf(0x80)]('.json'))continue;const _0x6cfe6a=a67_0x226a5e[_0x28cddf(0x69)](_0x35f82f,_0x222f9b),_0x3db251=_0x222f9b['replace']('.json',''),_0x4a938e=parseInt(_0x3db251,0xa),_0x28c447=!isNaN(_0x4a938e);if(_0x28c447){if(!isProcessRunning(_0x4a938e)){a67_0x1f8468[_0x28cddf(0x75)](_0x6cfe6a),_0x113788++;continue;}}try{const _0x12e4b5=a67_0x1f8468[_0x28cddf(0x72)](_0x6cfe6a,_0x28cddf(0x68)),_0x2f66c4=JSON[_0x28cddf(0x7e)](_0x12e4b5),_0xfe1a58=new Date(_0x2f66c4[_0x28cddf(0x7d)])['getTime']();_0x336989-_0xfe1a58>SESSION_EXPIRATION_MS&&(a67_0x1f8468[_0x28cddf(0x75)](_0x6cfe6a),_0x113788++);}catch{a67_0x1f8468[_0x28cddf(0x75)](_0x6cfe6a),_0x113788++;}}}catch{}return _0x113788;}function a67_0x2059(_0x194e22,_0x93eb39){_0x194e22=_0x194e22-0x64;const _0x34f4db=a67_0x34f4();let _0x205930=_0x34f4db[_0x194e22];return _0x205930;}export function listActiveSessions(){const _0x3e2b11=a67_0x2059,_0x233cc5=getSessionsDir();if(!a67_0x1f8468[_0x3e2b11(0x6f)](_0x233cc5))return[];try{const _0x5d3f4b=a67_0x1f8468['readdirSync'](_0x233cc5),_0x223b0c=[];for(const _0x2c30c of _0x5d3f4b){if(!_0x2c30c[_0x3e2b11(0x80)](_0x3e2b11(0x6a)))continue;const _0x582905=_0x2c30c[_0x3e2b11(0x7b)](_0x3e2b11(0x6a),''),_0x37016b=parseInt(_0x582905,0xa);!isNaN(_0x37016b)&&isProcessRunning(_0x37016b)&&_0x223b0c[_0x3e2b11(0x71)](_0x37016b);}return _0x223b0c[_0x3e2b11(0x78)]((_0x4ce10c,_0x653838)=>_0x4ce10c-_0x653838);}catch{return[];}}
1
+ (function(_0x314eba,_0x2742f5){const _0x51d61b=a67_0x54e9,_0x726324=_0x314eba();while(!![]){try{const _0x5e4568=-parseInt(_0x51d61b(0x161))/0x1+parseInt(_0x51d61b(0x14e))/0x2*(-parseInt(_0x51d61b(0x163))/0x3)+parseInt(_0x51d61b(0x15f))/0x4+parseInt(_0x51d61b(0x150))/0x5+-parseInt(_0x51d61b(0x16b))/0x6*(parseInt(_0x51d61b(0x15a))/0x7)+parseInt(_0x51d61b(0x167))/0x8*(-parseInt(_0x51d61b(0x162))/0x9)+parseInt(_0x51d61b(0x149))/0xa;if(_0x5e4568===_0x2742f5)break;else _0x726324['push'](_0x726324['shift']());}catch(_0x446665){_0x726324['push'](_0x726324['shift']());}}}(a67_0x4890,0x8af92));import*as a67_0x21fead from'node:fs';import*as a67_0x31ce29 from'node:path';import*as a67_0x1cc271 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 _0x70173e=a67_0x54e9,_0x53a4d1=process.env.TDX_CONFIG_DIR||a67_0x31ce29[_0x70173e(0x169)](a67_0x1cc271[_0x70173e(0x152)](),'.config','tdx');return a67_0x31ce29[_0x70173e(0x169)](_0x53a4d1,_0x70173e(0x166));}function getSessionPath(_0x28174b){const _0x5d36e6=a67_0x54e9;return a67_0x31ce29[_0x5d36e6(0x169)](getSessionsDir(),_0x28174b+_0x5d36e6(0x159));}export function getCurrentSessionPID(){return getPPID();}function a67_0x54e9(_0x4f1d0a,_0x33f3f8){_0x4f1d0a=_0x4f1d0a-0x146;const _0x48906f=a67_0x4890();let _0x54e920=_0x48906f[_0x4f1d0a];return _0x54e920;}export function getSessionID(_0x5e8db2){const _0x2fd9d9=a67_0x54e9;if(_0x5e8db2)return _0x5e8db2;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x2fd9d9(0x157)]();}export function loadSessionContext(_0x579ed4){const _0x57b59=a67_0x54e9,_0x291836=getSessionID(_0x579ed4),_0x136eb1=/^\d+$/[_0x57b59(0x14c)](_0x291836)?parseInt(_0x291836,0xa):null;return _0x136eb1!==null?loadSessionContextByPID(_0x136eb1):loadSessionContextByString(_0x291836);}export function loadSessionContextByPID(_0x1d776b){const _0x39d4a9=a67_0x54e9,_0x952421=getSessionPath(_0x1d776b);if(!a67_0x21fead[_0x39d4a9(0x15b)](_0x952421))return null;try{const _0xf07c51=a67_0x21fead[_0x39d4a9(0x160)](_0x952421,_0x39d4a9(0x14b)),_0x9a898f=JSON[_0x39d4a9(0x146)](_0xf07c51),_0x5f3970=new Date(_0x9a898f['createdAt'])[_0x39d4a9(0x15c)](),_0xc0376f=Date[_0x39d4a9(0x164)]();if(_0xc0376f-_0x5f3970>SESSION_EXPIRATION_MS)return a67_0x21fead['unlinkSync'](_0x952421),null;const _0x3a9e56=JSON[_0x39d4a9(0x153)](_0x9a898f);if(_0x3a9e56[_0x39d4a9(0x168)](_0x39d4a9(0x165))||_0x3a9e56[_0x39d4a9(0x168)](_0x39d4a9(0x15e))||_0x3a9e56[_0x39d4a9(0x168)](_0x39d4a9(0x16a)))return console['warn'](_0x39d4a9(0x155)+_0x952421+_0x39d4a9(0x14a)),a67_0x21fead['unlinkSync'](_0x952421),null;return _0x9a898f;}catch{try{a67_0x21fead['unlinkSync'](_0x952421);}catch{}return null;}}function loadSessionContextByString(_0x16636a){const _0x209bb4=a67_0x54e9,_0x21f0e0=a67_0x31ce29[_0x209bb4(0x169)](getSessionsDir(),_0x16636a+_0x209bb4(0x159));if(!a67_0x21fead['existsSync'](_0x21f0e0))return null;try{const _0x30b1b7=a67_0x21fead[_0x209bb4(0x160)](_0x21f0e0,_0x209bb4(0x14b)),_0x5e003e=JSON[_0x209bb4(0x146)](_0x30b1b7),_0x63e285=new Date(_0x5e003e['createdAt'])[_0x209bb4(0x15c)](),_0x49e0c0=Date[_0x209bb4(0x164)]();if(_0x49e0c0-_0x63e285>SESSION_EXPIRATION_MS)return a67_0x21fead[_0x209bb4(0x15d)](_0x21f0e0),null;const _0x11462c=JSON[_0x209bb4(0x153)](_0x5e003e);if(_0x11462c[_0x209bb4(0x168)](_0x209bb4(0x165))||_0x11462c[_0x209bb4(0x168)](_0x209bb4(0x15e))||_0x11462c[_0x209bb4(0x168)](_0x209bb4(0x16a)))return console[_0x209bb4(0x156)](_0x209bb4(0x155)+_0x21f0e0+_0x209bb4(0x14a)),a67_0x21fead[_0x209bb4(0x15d)](_0x21f0e0),null;return _0x5e003e;}catch{try{a67_0x21fead['unlinkSync'](_0x21f0e0);}catch{}return null;}}export function saveSessionContext(_0x1a1cd,_0x367de6){const _0x44c805=a67_0x54e9,_0x351802=getSessionID(_0x367de6),_0x48963a=/^\d+$/[_0x44c805(0x14c)](_0x351802)?parseInt(_0x351802,0xa):getCurrentSessionPID(),_0x3e72c7=a67_0x31ce29[_0x44c805(0x169)](getSessionsDir(),_0x351802+_0x44c805(0x159)),_0x683a67=getSessionsDir();createSecureDirectory(_0x683a67);const _0x2bcdb7=JSON[_0x44c805(0x153)](_0x1a1cd);if(_0x2bcdb7[_0x44c805(0x168)]('TD_API_KEY')||_0x2bcdb7[_0x44c805(0x168)](_0x44c805(0x15e))||_0x2bcdb7[_0x44c805(0x168)](_0x44c805(0x16a)))throw new Error(_0x44c805(0x158));let _0x248e3a;const _0x5513c6=/^\d+$/['test'](_0x351802)?loadSessionContextByPID(parseInt(_0x351802,0xa)):loadSessionContextByString(_0x351802);_0x5513c6?_0x248e3a={..._0x5513c6,..._0x1a1cd,'pid':_0x48963a,'sessionId':_0x351802!==_0x48963a[_0x44c805(0x157)]()?_0x351802:undefined,'updatedAt':new Date()[_0x44c805(0x147)]()}:_0x248e3a={'pid':_0x48963a,'sessionId':_0x351802!==_0x48963a[_0x44c805(0x157)]()?_0x351802:undefined,..._0x1a1cd,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()['toISOString']()},a67_0x21fead[_0x44c805(0x14f)](_0x3e72c7,JSON[_0x44c805(0x153)](_0x248e3a,null,0x2));}function a67_0x4890(){const _0x35ab7a=['1300880eXhaAd','readdirSync','homedir','stringify','replace','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','warn','toString','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','.json','2554118DxgmiW','existsSync','getTime','unlinkSync','apiKey','3187728DdJBIv','readFileSync','905868KdVXMT','3771864WxzIFX','369xCuhXl','now','TD_API_KEY','sessions','16DIubtL','includes','join','api_key','12DGsBDC','parse','toISOString','endsWith','24305790MgbmLs','.\x20This\x20is\x20insecure.\x20Removing\x20session.','utf-8','test','push','7230PDNMBT','writeFileSync'];a67_0x4890=function(){return _0x35ab7a;};return a67_0x4890();}export function clearSessionContext(_0x1e87be){const _0x2ec01a=a67_0x54e9,_0x2df567=getSessionID(_0x1e87be),_0x308594=a67_0x31ce29[_0x2ec01a(0x169)](getSessionsDir(),_0x2df567+'.json');a67_0x21fead[_0x2ec01a(0x15b)](_0x308594)&&a67_0x21fead[_0x2ec01a(0x15d)](_0x308594);}export function clearSessionContextField(_0x45f8d9,_0x4a97a2){const _0x4f9ad2=a67_0x54e9,_0x2ec59d=getSessionID(_0x4a97a2),_0x32ab36=a67_0x31ce29['join'](getSessionsDir(),_0x2ec59d+_0x4f9ad2(0x159));if(!a67_0x21fead[_0x4f9ad2(0x15b)](_0x32ab36))return;try{const _0x22d481=a67_0x21fead[_0x4f9ad2(0x160)](_0x32ab36,_0x4f9ad2(0x14b)),_0x35d9b7=JSON[_0x4f9ad2(0x146)](_0x22d481);delete _0x35d9b7[_0x45f8d9],a67_0x21fead['writeFileSync'](_0x32ab36,JSON[_0x4f9ad2(0x153)](_0x35d9b7,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x55dbb0=a67_0x54e9,_0x2430d5=getSessionsDir();if(!a67_0x21fead[_0x55dbb0(0x15b)](_0x2430d5))return 0x0;let _0x367ebe=0x0;const _0x372492=Date[_0x55dbb0(0x164)]();try{const _0x428ea2=a67_0x21fead[_0x55dbb0(0x151)](_0x2430d5);for(const _0x57b300 of _0x428ea2){if(!_0x57b300[_0x55dbb0(0x148)](_0x55dbb0(0x159)))continue;const _0x56868d=a67_0x31ce29['join'](_0x2430d5,_0x57b300),_0x1aac77=_0x57b300[_0x55dbb0(0x154)]('.json',''),_0x50b4ad=parseInt(_0x1aac77,0xa),_0x42540b=!isNaN(_0x50b4ad);if(_0x42540b){if(!isProcessRunning(_0x50b4ad)){a67_0x21fead['unlinkSync'](_0x56868d),_0x367ebe++;continue;}}try{const _0x11503d=a67_0x21fead['readFileSync'](_0x56868d,_0x55dbb0(0x14b)),_0x27c464=JSON['parse'](_0x11503d),_0x2a1def=new Date(_0x27c464['createdAt'])[_0x55dbb0(0x15c)]();_0x372492-_0x2a1def>SESSION_EXPIRATION_MS&&(a67_0x21fead[_0x55dbb0(0x15d)](_0x56868d),_0x367ebe++);}catch{a67_0x21fead[_0x55dbb0(0x15d)](_0x56868d),_0x367ebe++;}}}catch{}return _0x367ebe;}export function listActiveSessions(){const _0xf9e547=a67_0x54e9,_0x579a02=getSessionsDir();if(!a67_0x21fead[_0xf9e547(0x15b)](_0x579a02))return[];try{const _0x8d13b5=a67_0x21fead[_0xf9e547(0x151)](_0x579a02),_0x449b1f=[];for(const _0x5dfa95 of _0x8d13b5){if(!_0x5dfa95['endsWith']('.json'))continue;const _0xc9d924=_0x5dfa95['replace'](_0xf9e547(0x159),''),_0x3b59bb=parseInt(_0xc9d924,0xa);!isNaN(_0x3b59bb)&&isProcessRunning(_0x3b59bb)&&_0x449b1f[_0xf9e547(0x14d)](_0x3b59bb);}return _0x449b1f['sort']((_0x2ad067,_0x305dfe)=>_0x2ad067-_0x305dfe);}catch{return[];}}
@@ -1 +1 @@
1
- const a68_0x32da44=a68_0x30c2;(function(_0x1240ce,_0x219ee4){const _0x5129bb=a68_0x30c2,_0x135e66=_0x1240ce();while(!![]){try{const _0x387f03=parseInt(_0x5129bb(0x121))/0x1+parseInt(_0x5129bb(0x11d))/0x2+-parseInt(_0x5129bb(0x123))/0x3+parseInt(_0x5129bb(0x11f))/0x4+-parseInt(_0x5129bb(0x11b))/0x5+parseInt(_0x5129bb(0x11e))/0x6*(parseInt(_0x5129bb(0x11c))/0x7)+parseInt(_0x5129bb(0x117))/0x8*(-parseInt(_0x5129bb(0x120))/0x9);if(_0x387f03===_0x219ee4)break;else _0x135e66['push'](_0x135e66['shift']());}catch(_0x106df5){_0x135e66['push'](_0x135e66['shift']());}}}(a68_0x5bd5,0x2b273));import{createProfileCache}from'../utils/global-cache.js';function a68_0x5bd5(){const _0x652ac7=['1196160IgfEIu','7VNEstG','65280WlfjqW','293022AbQLJw','1230940AFkOVq','801CgQtrm','64307fDMHpG','users','51453ZlSpjm','read','1832KYAtKZ','users-{profile}.json','clear','core/user-cache'];a68_0x5bd5=function(){return _0x652ac7;};return a68_0x5bd5();}const userCache=createProfileCache(a68_0x32da44(0x118),a68_0x32da44(0x11a));export function loadCachedUsers(_0x2d4160){const _0x2b9ed2=a68_0x32da44,_0x6a6fcb=userCache[_0x2b9ed2(0x124)](_0x2d4160);return _0x6a6fcb?.[_0x2b9ed2(0x122)]??null;}function a68_0x30c2(_0x3ab531,_0x3c7dd5){_0x3ab531=_0x3ab531-0x117;const _0x5bd5ef=a68_0x5bd5();let _0x30c237=_0x5bd5ef[_0x3ab531];return _0x30c237;}export function saveCachedUsers(_0x281859,_0x5f36da){userCache['write'](_0x281859,{'users':_0x5f36da,'cachedAt':Date['now']()});}export function clearUserCache(_0x95ba47){const _0x21a715=a68_0x32da44;userCache[_0x21a715(0x119)](_0x95ba47);}
1
+ const a68_0x4b8330=a68_0x4c98;(function(_0xc3e8e7,_0x464ffe){const _0x50ed6c=a68_0x4c98,_0x51eabd=_0xc3e8e7();while(!![]){try{const _0x5993a2=-parseInt(_0x50ed6c(0xee))/0x1*(parseInt(_0x50ed6c(0xeb))/0x2)+-parseInt(_0x50ed6c(0xea))/0x3+-parseInt(_0x50ed6c(0xef))/0x4+-parseInt(_0x50ed6c(0xf5))/0x5*(-parseInt(_0x50ed6c(0xed))/0x6)+-parseInt(_0x50ed6c(0xf1))/0x7*(parseInt(_0x50ed6c(0xf3))/0x8)+parseInt(_0x50ed6c(0xf2))/0x9*(parseInt(_0x50ed6c(0xe8))/0xa)+parseInt(_0x50ed6c(0xe9))/0xb;if(_0x5993a2===_0x464ffe)break;else _0x51eabd['push'](_0x51eabd['shift']());}catch(_0xbd4d9a){_0x51eabd['push'](_0x51eabd['shift']());}}}(a68_0x5b1e,0xea3fb));function a68_0x4c98(_0x47e71e,_0x2fe103){_0x47e71e=_0x47e71e-0xe8;const _0x5b1ed9=a68_0x5b1e();let _0x4c982e=_0x5b1ed9[_0x47e71e];return _0x4c982e;}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x4b8330(0xf0),a68_0x4b8330(0xec));function a68_0x5b1e(){const _0x591390=['32157FSSIFa','56aklCFE','now','130METxSb','read','users','210xtmSUT','30738741GfiHYQ','2096793pLZMfH','208218QJjTVi','core/user-cache','197952FgGQAX','15nFUJOw','229380mhooZC','users-{profile}.json','449862fhCPMk'];a68_0x5b1e=function(){return _0x591390;};return a68_0x5b1e();}export function loadCachedUsers(_0x493ddc){const _0x3b4229=a68_0x4b8330,_0x4c2de5=userCache[_0x3b4229(0xf6)](_0x493ddc);return _0x4c2de5?.[_0x3b4229(0xf7)]??null;}export function saveCachedUsers(_0x4474aa,_0x11fc60){const _0x5e5925=a68_0x4b8330;userCache['write'](_0x4474aa,{'users':_0x11fc60,'cachedAt':Date[_0x5e5925(0xf4)]()});}export function clearUserCache(_0x57a5d2){userCache['clear'](_0x57a5d2);}
@@ -1 +1 @@
1
- (function(_0x1ed496,_0x3c60fe){const _0x22a0b6=a69_0x1ea7,_0x517842=_0x1ed496();while(!![]){try{const _0xd3eb45=-parseInt(_0x22a0b6(0xd9))/0x1*(parseInt(_0x22a0b6(0xd1))/0x2)+parseInt(_0x22a0b6(0xd5))/0x3+-parseInt(_0x22a0b6(0xd8))/0x4*(-parseInt(_0x22a0b6(0xc9))/0x5)+-parseInt(_0x22a0b6(0xda))/0x6*(parseInt(_0x22a0b6(0xce))/0x7)+-parseInt(_0x22a0b6(0xcc))/0x8*(parseInt(_0x22a0b6(0xd7))/0x9)+-parseInt(_0x22a0b6(0xc7))/0xa*(-parseInt(_0x22a0b6(0xd3))/0xb)+parseInt(_0x22a0b6(0xd2))/0xc*(-parseInt(_0x22a0b6(0xca))/0xd);if(_0xd3eb45===_0x3c60fe)break;else _0x517842['push'](_0x517842['shift']());}catch(_0x4f5e50){_0x517842['push'](_0x517842['shift']());}}}(a69_0x4b99,0xca345));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a69_0x4b99(){const _0x17b55b=['../build-info.json','225955JfuRSc','2495727FXxXTm','.dev','4552OnytNa','version','416913HftajM','../../package.json','utf-8','451378jBrexP','12PGiJAu','11297DTRwBa','includes','497097AHbBar','parse','522jJQRHD','116QhciBd','4DXsAue','102qauaTA','14530hwHcwB'];a69_0x4b99=function(){return _0x17b55b;};return a69_0x4b99();}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x565a5b=a69_0x1ea7;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x12b507=fileURLToPath(import.meta.url),_0x30d923=dirname(_0x12b507);try{const _0x36b27d=join(_0x30d923,_0x565a5b(0xc8));cachedBuildInfo=JSON[_0x565a5b(0xd6)](readFileSync(_0x36b27d,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x3d0f90=a69_0x1ea7;if(cachedVersion!==null)return cachedVersion;const _0x5a7237=fileURLToPath(import.meta.url),_0x723ed=dirname(_0x5a7237),_0xe5df62=getBuildInfo();if(_0xe5df62[_0x3d0f90(0xcd)])return cachedVersion=_0xe5df62['version'],cachedVersion;try{const _0x5589b6=join(_0x723ed,_0x3d0f90(0xcf)),_0x108e67=JSON['parse'](readFileSync(_0x5589b6,_0x3d0f90(0xd0)));cachedVersion=_0x108e67[_0x3d0f90(0xcd)];}catch{cachedVersion='0.0.0';}return cachedVersion;}function a69_0x1ea7(_0x244ee1,_0x5bcd2a){_0x244ee1=_0x244ee1-0xc7;const _0x4b99fd=a69_0x4b99();let _0x1ea763=_0x4b99fd[_0x244ee1];return _0x1ea763;}export function isDevVersion(){const _0x4aba34=a69_0x1ea7,_0x5a6fe7=getVersion();return _0x5a6fe7[_0x4aba34(0xd4)](_0x4aba34(0xcb))||_0x5a6fe7[_0x4aba34(0xd4)]('-');}
1
+ (function(_0x9ee4f1,_0x237135){const _0x3856ea=a69_0x44cc,_0x3f2e7f=_0x9ee4f1();while(!![]){try{const _0x2b9d06=-parseInt(_0x3856ea(0xca))/0x1*(parseInt(_0x3856ea(0xbe))/0x2)+-parseInt(_0x3856ea(0xbd))/0x3+parseInt(_0x3856ea(0xcb))/0x4+-parseInt(_0x3856ea(0xc1))/0x5+-parseInt(_0x3856ea(0xcc))/0x6+parseInt(_0x3856ea(0xc4))/0x7*(parseInt(_0x3856ea(0xce))/0x8)+-parseInt(_0x3856ea(0xc9))/0x9*(-parseInt(_0x3856ea(0xc0))/0xa);if(_0x2b9d06===_0x237135)break;else _0x3f2e7f['push'](_0x3f2e7f['shift']());}catch(_0x177691){_0x3f2e7f['push'](_0x3f2e7f['shift']());}}}(a69_0x1ab3,0xac7ba));import{readFileSync}from'fs';function a69_0x44cc(_0x5473fa,_0x1d3ccf){_0x5473fa=_0x5473fa-0xbd;const _0x1ab3ba=a69_0x1ab3();let _0x44cc94=_0x1ab3ba[_0x5473fa];return _0x44cc94;}import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x1bd3a0=a69_0x44cc;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4562ea=fileURLToPath(import.meta.url),_0x4f26e9=dirname(_0x4562ea);try{const _0x127687=join(_0x4f26e9,_0x1bd3a0(0xc7));cachedBuildInfo=JSON['parse'](readFileSync(_0x127687,_0x1bd3a0(0xc5)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x160c22=a69_0x44cc;if(cachedVersion!==null)return cachedVersion;const _0x1f5428=fileURLToPath(import.meta.url),_0x3ba912=dirname(_0x1f5428),_0x2fe43b=getBuildInfo();if(_0x2fe43b[_0x160c22(0xc8)])return cachedVersion=_0x2fe43b[_0x160c22(0xc8)],cachedVersion;try{const _0x971770=join(_0x3ba912,_0x160c22(0xc6)),_0x10496e=JSON[_0x160c22(0xcd)](readFileSync(_0x971770,_0x160c22(0xc5)));cachedVersion=_0x10496e['version'];}catch{cachedVersion=_0x160c22(0xc3);}return cachedVersion;}export function isDevVersion(){const _0x342fd9=a69_0x44cc,_0x51721d=getVersion();return _0x51721d[_0x342fd9(0xc2)](_0x342fd9(0xbf))||_0x51721d['includes']('-');}function a69_0x1ab3(){const _0xa9bdc5=['77uXAdmc','utf-8','../../package.json','../build-info.json','version','18797067oXQXHp','131uzKbcc','184316eAnLKM','7742100HBHXts','parse','454472NKsgrE','375405jUZdkg','5712gOzgfQ','.dev','10FIXLbR','1317150NDxvgN','includes','0.0.0'];a69_0x1ab3=function(){return _0xa9bdc5;};return a69_0x1ab3();}