@treasuredata/tdx 0.8.0 → 0.8.1

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 (123) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.d.ts +2 -0
  11. package/dist/client/td-api-client.d.ts.map +1 -1
  12. package/dist/client/td-api-client.js +1 -1
  13. package/dist/client/td-api-client.js.map +1 -1
  14. package/dist/client/trino-api-client.js +1 -1
  15. package/dist/client/workflow-client.js +1 -1
  16. package/dist/commands/activations.js +1 -1
  17. package/dist/commands/api-command.js +1 -1
  18. package/dist/commands/auth-command.js +1 -1
  19. package/dist/commands/chat-command.js +1 -1
  20. package/dist/commands/claude-command.d.ts.map +1 -1
  21. package/dist/commands/claude-command.js +1 -1
  22. package/dist/commands/claude-command.js.map +1 -1
  23. package/dist/commands/claude-statusline-command.d.ts +1 -1
  24. package/dist/commands/claude-statusline-command.d.ts.map +1 -1
  25. package/dist/commands/claude-statusline-command.js +1 -1
  26. package/dist/commands/claude-statusline-command.js.map +1 -1
  27. package/dist/commands/claude-usage-command.js +1 -1
  28. package/dist/commands/command.js +1 -1
  29. package/dist/commands/connection-command.js +1 -1
  30. package/dist/commands/context-command.js +1 -1
  31. package/dist/commands/databases.js +1 -1
  32. package/dist/commands/describe.js +1 -1
  33. package/dist/commands/engage-command.js +1 -1
  34. package/dist/commands/job-command.js +1 -1
  35. package/dist/commands/llm-command.js +1 -1
  36. package/dist/commands/llm-proxy.js +1 -1
  37. package/dist/commands/parent-segment-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/use-command.js +1 -1
  51. package/dist/commands/user-command.js +1 -1
  52. package/dist/commands/workflow-command.js +1 -1
  53. package/dist/core/auth.js +1 -1
  54. package/dist/core/config.d.ts +26 -0
  55. package/dist/core/config.d.ts.map +1 -1
  56. package/dist/core/config.js +1 -1
  57. package/dist/core/config.js.map +1 -1
  58. package/dist/core/connection-cache.js +1 -1
  59. package/dist/core/credential-cache.js +1 -1
  60. package/dist/core/global-context.js +1 -1
  61. package/dist/core/keychain.js +1 -1
  62. package/dist/core/profile.js +1 -1
  63. package/dist/core/project-config.js +1 -1
  64. package/dist/core/session.js +1 -1
  65. package/dist/core/user-cache.js +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/proxy/anthropic-adapter.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.js +1 -1
  69. package/dist/proxy/context-signature.js +1 -1
  70. package/dist/proxy/conversation-utils.js +1 -1
  71. package/dist/proxy/server.js +1 -1
  72. package/dist/proxy/session-cache.js +1 -1
  73. package/dist/sdk/api.js +1 -1
  74. package/dist/sdk/connection.js +1 -1
  75. package/dist/sdk/engage.js +1 -1
  76. package/dist/sdk/errors.js +1 -1
  77. package/dist/sdk/index.js +1 -1
  78. package/dist/sdk/job.js +1 -1
  79. package/dist/sdk/llm.js +1 -1
  80. package/dist/sdk/query.js +1 -1
  81. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  82. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  83. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  84. package/dist/sdk/segment.js +1 -1
  85. package/dist/sdk/user.js +1 -1
  86. package/dist/sdk/workflow.js +1 -1
  87. package/dist/types/endpoints.js +1 -1
  88. package/dist/types/index.d.ts +20 -1
  89. package/dist/types/index.d.ts.map +1 -1
  90. package/dist/types/index.js +1 -1
  91. package/dist/types/index.js.map +1 -1
  92. package/dist/utils/agent-ref-parser.js +1 -1
  93. package/dist/utils/async.js +1 -1
  94. package/dist/utils/chat-cache.js +1 -1
  95. package/dist/utils/colors.js +1 -1
  96. package/dist/utils/command-output.js +1 -1
  97. package/dist/utils/constants.js +1 -1
  98. package/dist/utils/diff.js +1 -1
  99. package/dist/utils/fields-display.js +1 -1
  100. package/dist/utils/file-permissions.js +1 -1
  101. package/dist/utils/format-detector.js +1 -1
  102. package/dist/utils/formatters.js +1 -1
  103. package/dist/utils/json-loader.js +1 -1
  104. package/dist/utils/llm-backup-utils.js +1 -1
  105. package/dist/utils/model-aliases.js +1 -1
  106. package/dist/utils/model-factors.js +1 -1
  107. package/dist/utils/option-validation.js +1 -1
  108. package/dist/utils/port.js +1 -1
  109. package/dist/utils/process.js +1 -1
  110. package/dist/utils/prompt.js +1 -1
  111. package/dist/utils/segment-path-parser.js +1 -1
  112. package/dist/utils/segment-ref-parser.js +1 -1
  113. package/dist/utils/spinner.js +1 -1
  114. package/dist/utils/sql-parser.js +1 -1
  115. package/dist/utils/sse-parser.js +1 -1
  116. package/dist/utils/string-utils.js +1 -1
  117. package/dist/utils/table-ref-parser.js +1 -1
  118. package/dist/utils/tdx-config.js +1 -1
  119. package/dist/utils/tdx-logger.js +1 -1
  120. package/dist/utils/tree-formatter.js +1 -1
  121. package/dist/utils/version-check.js +1 -1
  122. package/dist/utils/workflow-utils.js +1 -1
  123. package/package.json +1 -1
@@ -1 +1 @@
1
- const a25_0x149c90=a25_0x5b7a;(function(_0x1eb5a6,_0x16b222){const _0x275827=a25_0x5b7a,_0x34a32a=_0x1eb5a6();while(!![]){try{const _0x49611a=parseInt(_0x275827(0xb7))/0x1+-parseInt(_0x275827(0xb6))/0x2*(parseInt(_0x275827(0xa3))/0x3)+-parseInt(_0x275827(0x137))/0x4+-parseInt(_0x275827(0x125))/0x5*(-parseInt(_0x275827(0x70))/0x6)+-parseInt(_0x275827(0x74))/0x7+parseInt(_0x275827(0xbf))/0x8+-parseInt(_0x275827(0x6f))/0x9*(-parseInt(_0x275827(0x11f))/0xa);if(_0x49611a===_0x16b222)break;else _0x34a32a['push'](_0x34a32a['shift']());}catch(_0x396654){_0x34a32a['push'](_0x34a32a['shift']());}}}(a25_0x5b55,0x86c2c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a25_0x5b7a(_0x30531e,_0x150000){_0x30531e=_0x30531e-0x67;const _0x5b55aa=a25_0x5b55();let _0x5b7a88=_0x5b55aa[_0x30531e];return _0x5b7a88;}import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a25_0x909bbb from'node:fs';function handleSDKError(_0x4c1d57,_0x2aac81){const _0x223452=a25_0x5b7a;if(_0x4c1d57 instanceof SDKError)console[_0x223452(0xaf)]('Error:\x20'+_0x4c1d57['message']),_0x2aac81[_0x223452(0x88)]&&(_0x4c1d57[_0x223452(0x134)]&&console['error'](_0x223452(0xf2)+_0x4c1d57[_0x223452(0x134)]),_0x4c1d57[_0x223452(0x117)]&&(console[_0x223452(0xaf)](_0x223452(0x92)),console[_0x223452(0xaf)](_0x4c1d57['stack'])));else throw _0x4c1d57;}function formatChatHistoryEntry(_0x29c49d,_0x77d876){const _0x3bfc03=a25_0x5b7a,_0x4fc92a=getChalk(_0x77d876),_0x308151=_0x4fc92a[_0x3bfc03(0x77)](_0x29c49d['at']);if(_0x3bfc03(0xd5)in _0x29c49d){const _0x6562c5=_0x4fc92a[_0x3bfc03(0xe9)](_0x3bfc03(0x99));return _0x308151+'\x20'+_0x6562c5+':\x20'+_0x29c49d[_0x3bfc03(0xd5)];}if(_0x3bfc03(0xe8)in _0x29c49d){const _0x5ed377=_0x4fc92a[_0x3bfc03(0x8d)](_0x3bfc03(0x118));return _0x308151+'\x20'+_0x5ed377+':\x20'+_0x29c49d[_0x3bfc03(0xe8)];}if(_0x3bfc03(0xd1)in _0x29c49d){const _0x53b5d9=_0x4fc92a['yellow']('[tool_call]'),{functionName:_0x4b1307,functionArguments:_0x2542a2,targetFunction:_0x3c533a}=_0x29c49d['tool_call'];let _0x362b4c=_0x308151+'\x20'+_0x53b5d9+':\x20'+_0x4fc92a[_0x3bfc03(0xd0)](_0x4b1307);if(_0x2542a2&&Object[_0x3bfc03(0xdf)](_0x2542a2)['length']>0x0){const _0x28d481=Object[_0x3bfc03(0x113)](_0x2542a2)[_0x3bfc03(0x11b)](([_0x2ed094,_0x271586])=>_0x2ed094+'='+JSON[_0x3bfc03(0x91)](_0x271586))[_0x3bfc03(0xcc)](',\x20');_0x362b4c+='('+_0x28d481+')';}_0x3c533a&&(_0x362b4c+=_0x4fc92a['dim']('\x20['+_0x3c533a+']'));let _0x430e37='';if(_0x29c49d[_0x3bfc03(0xd1)][_0x3bfc03(0x6e)])_0x430e37=_0x3bfc03(0xab)+_0x29c49d[_0x3bfc03(0xd1)][_0x3bfc03(0x6e)]['name'];else{if(_0x29c49d['tool_call']['targetAgent'])_0x430e37='\x20->\x20Agent:'+_0x29c49d['tool_call'][_0x3bfc03(0xe7)]['name'];else{if(_0x29c49d[_0x3bfc03(0xd1)]['targetWebSearchTool'])_0x430e37=_0x3bfc03(0xf0)+_0x29c49d[_0x3bfc03(0xd1)][_0x3bfc03(0xf6)][_0x3bfc03(0x85)];else _0x29c49d['tool_call'][_0x3bfc03(0xc5)]&&(_0x430e37=_0x3bfc03(0x6d)+_0x29c49d[_0x3bfc03(0xd1)]['targetImageGenerator']['name']);}}return _0x362b4c+_0x430e37;}if(_0x3bfc03(0xf3)in _0x29c49d){const _0x513978=_0x4fc92a[_0x3bfc03(0xad)](_0x3bfc03(0x67)),{functionName:_0x3863b6,functionArguments:_0x1f18cd,content:_0x72cea8,newChat:_0x569e39}=_0x29c49d['tool'];let _0xa2292c=_0x308151+'\x20'+_0x513978+':\x20'+_0x4fc92a[_0x3bfc03(0xd0)](_0x3863b6);if(_0x1f18cd){const _0x37f6d8=typeof _0x1f18cd===_0x3bfc03(0x89)?_0x1f18cd:JSON[_0x3bfc03(0x91)](_0x1f18cd);_0xa2292c+='('+_0x37f6d8+')';}return _0x72cea8&&(_0xa2292c+='\x0a'+_0x4fc92a[_0x3bfc03(0x77)](_0x72cea8)),_0x569e39&&(_0xa2292c+=_0x4fc92a['dim']('\x20→\x20chat:\x20'+_0x569e39['id'])),_0xa2292c;}if(_0x3bfc03(0xb4)in _0x29c49d){const _0x133893=_0x4fc92a['blue'](_0x3bfc03(0x8c));return _0x308151+'\x20'+_0x133893+':\x20'+_0x29c49d[_0x3bfc03(0xb4)][_0x3bfc03(0x85)]+'\x20('+_0x29c49d[_0x3bfc03(0xb4)][_0x3bfc03(0xe8)][_0x3bfc03(0xdd)]+'\x20bytes)';}if('image'in _0x29c49d){const _0x3a5edd=_0x4fc92a['blue']('[image]\x20\x20'),{width:_0x46eb57,height:_0x367a4d,headerText:_0xa42a95}=_0x29c49d[_0x3bfc03(0xa5)],_0x4f31e0=_0xa42a95?_0x3bfc03(0xde)+_0xa42a95:'';return _0x308151+'\x20'+_0x3a5edd+':\x20'+_0x46eb57+'x'+_0x367a4d+_0x4f31e0;}if('error'in _0x29c49d){const _0x226c27=_0x4fc92a['red'](_0x3bfc03(0x87));return _0x308151+'\x20'+_0x226c27+':\x20'+_0x29c49d['error'];}return _0x308151+'\x20'+_0x4fc92a['dim'](_0x3bfc03(0x105))+':\x20'+JSON[_0x3bfc03(0x91)](_0x29c49d);}async function executeChatHistoryCommand(_0x3fef2a,_0x27877c){const _0x2043a3=a25_0x5b7a,{options:_0x50080e,args:_0x18abe0,tdx:_0x1a2c0c}=_0x3fef2a,_0x31f622=_0x18abe0[0x0],_0x3ca74b=_0x50080e,_0xe75186=_0x3ca74b[_0x2043a3(0xcd)];try{if(_0xe75186&&_0x31f622)return console['error'](_0x2043a3(0xfe)),console[_0x2043a3(0xaf)](_0x2043a3(0x7d)+_0x27877c+_0x2043a3(0x78)),0x1;if(!_0x31f622&&!_0xe75186&&_0x50080e[_0x2043a3(0x83)]!==undefined){const _0x97268c=resolveLimit(_0x50080e[_0x2043a3(0xe5)],DEFAULT_LLM_LIMIT),_0x12ef0b=await withSpinner(_0x2043a3(0xd2),()=>_0x1a2c0c[_0x2043a3(0x12d)][_0x2043a3(0xf1)](_0x97268c),{'verbose':_0x50080e[_0x2043a3(0x88)]});return await handleSDKOutput(_0x12ef0b[_0x2043a3(0xb2)],_0x50080e),0x0;}const _0x4e5ea7=await getChatIdOrSelect(_0x1a2c0c,_0x50080e,_0xe75186,_0x31f622);if(!_0x4e5ea7)return 0x0;return await displayChatHistory(_0x4e5ea7,_0x1a2c0c,_0x50080e),0x0;}catch(_0x5a1bb2){return handleSDKError(_0x5a1bb2,_0x50080e),0x1;}}async function displayChatHistory(_0x7358b,_0x46978c,_0x43f106){const _0x1dd8e7=a25_0x5b7a,_0x4d3aa8=await withSpinner(_0x1dd8e7(0x115)+_0x7358b+_0x1dd8e7(0x12f),()=>_0x46978c[_0x1dd8e7(0x12d)]['history'](_0x7358b),{'verbose':_0x43f106['verbose']}),_0x1c2d31=_0x4d3aa8[_0x1dd8e7(0xb2)][_0x1dd8e7(0xb2)]??[];if(_0x1c2d31[_0x1dd8e7(0xdd)]===0x0){console[_0x1dd8e7(0x6a)]('No\x20messages\x20found\x20in\x20chat\x20history.');return;}if(_0x43f106['format']!==undefined)await handleSDKOutput(_0x1c2d31,_0x43f106);else{const _0x3f9363=_0x1c2d31[_0x1dd8e7(0x11b)](_0x5557cf=>formatChatHistoryEntry(_0x5557cf,_0x43f106)),_0x544766=_0x3f9363[_0x1dd8e7(0xcc)]('\x0a');await writeOutput(_0x544766,_0x43f106['output'],_0x1dd8e7(0x8b));}}async function getChatIdOrSelect(_0x13e2e0,_0x336437,_0x83fd1c,_0x2757bd){const _0x1c5182=a25_0x5b7a;if(_0x2757bd)return _0x2757bd;if(_0x83fd1c){const _0x5744a8=await withSpinner(_0x1c5182(0xe2),()=>_0x13e2e0[_0x1c5182(0x12d)][_0x1c5182(0xf1)](0x1),{'verbose':_0x336437[_0x1c5182(0x88)]});if(_0x5744a8['data'][_0x1c5182(0xdd)]===0x0)return console[_0x1c5182(0x6a)](_0x1c5182(0x72)),undefined;return _0x5744a8[_0x1c5182(0xb2)][0x0]['id'];}const _0x480b81=await selectChatInteractively(_0x13e2e0,_0x336437);if(!_0x480b81)return console[_0x1c5182(0x6a)](_0x1c5182(0xc8)),undefined;return _0x480b81;}function a25_0x5b55(){const _0x20403a=['Setting\x20project\x20context\x20to\x20\x27','targetWebSearchTool','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','sourceSite','d\x20ago','.llm','default','tdx\x20chats','Set\x20current\x20project\x20context','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','Fetching\x20agents...','createProject','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','\x20\x20Agents:\x20','exportedFrom','set','[unknown]','Agent\x20created:\x20','INVALID_ARGUMENT','knowledgeBases','maxToolIterations','model','prompt','(no\x20agent)','yes','Delete\x20an\x20LLM\x20project','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','slice','llm:projects','Creating\x20agent\x20\x27','entries','floor','Fetching\x20chat\x20history\x20for\x20\x27','getOrCreateDefaultProject','stack','[content]','attributes','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','map','Project\x20restored:\x20','llm:agent:update','projectName','11980qWHVKb','Create\x20a\x20new\x20LLM\x20project','Project\x20backed\x20up\x20to:\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','dryRun','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','132160AnBaOm','Resolving\x20agent\x20\x27','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','createdAt','Analyzing\x20project\x20\x27','all','Project\x20created:\x20','Fetching\x20projects...','llm','llm:project:restore','\x27...','Use\x20format:\x20project-name/agent-name','agent','Update\x20an\x20existing\x20agent','Fetching\x20available\x20models...','cause','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','counts','2827300SrXBUl','[tool]\x20\x20\x20','llm:project:backup','just\x20now','log','tdx\x20llm\x20history','Updating\x20agent...','\x20->\x20ImageGen:','targetKnowledgeBase','3051CrcMNV','228xXintP','description','No\x20chat\x20sessions\x20found.','Delete\x20an\x20agent','2833334gEGiHE','json','jsonl','dim','\x20--last','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','List\x20available\x20LLM\x20models','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','Project\x20not\x20found:\x20','Usage:\x20','llm:models','Project\x20deleted:\x20','models','toLocaleDateString','find','format','short','name','select','[error]\x20\x20','verbose','string','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','table','[output]\x20','green','getTime','push','Restoring\x20project\x20from\x20\x27','stringify','\x0aStack\x20trace:','restoreProject','resolveAgentId','llm:use','rmSync','Error:\x20Project\x20name\x20is\x20required','toLowerCase','[input]\x20\x20','starterMessage','projectId','\x20\x20Integrations:\x20','Error:\x20Backup\x20folder\x20path\x20is\x20required','llm:project:delete','\x20\x20Knowledge\x20Bases:\x20','Agent\x20deleted:\x20','Restore\x20cancelled.','split','1465752VGMQMn','integrations','image','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','getCurrentProject','existsSync','getBackupMetadata','substring','\x20->\x20KB:','...','magenta','prompts','error','A\x20project\x20named\x20\x27','Select\x20a\x20chat\x20session:','data','llm:history','output','chatId','2kqPEiS','165949mbomkJ','llmProject','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','outputDir','__load_more__','deleteProject','\x20\x20Prompts:\x20','projects','4605312PjxSAh','agentId','Getting\x20default\x20project...','\x27\x20already\x20exists.\x20Overwrite?','llm:agent:create','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','targetImageGenerator','systemPrompt','Error:\x20Agent\x20name\x20is\x20required','\x0aCancelled','(no\x20message)','temperature','llm:project:create','join','last','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','firstInputContent','bold','tool_call','Fetching\x20chat\x20sessions...','setCurrentProject','filter','input','resolveProjectId','Backup\x20cancelled.','Agent\x20updated:\x20','execute','updatedAt','includes','Load\x20more...','length','\x20-\x20','keys','numeric','Deleting\x20agent...','Fetching\x20most\x20recent\x20chat...','Validating\x20backup\x20from\x20\x27','m\x20ago','limit','Deleting\x20project\x20\x27','targetAgent','content','cyan','Resolving\x20project\x20\x27','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Show\x20agent\x20details','agents','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','Invalid\x20path\x20syntax:\x20','\x20->\x20WebSearch:','chats','\x20\x20Cause:\x20','tool','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]'];a25_0x5b55=function(){return _0x20403a;};return a25_0x5b55();}async function getProjectIdOrDefault(_0x5a8ad7){const _0x38d143=a25_0x5b7a,{tdx:_0x5db16b,options:_0xa0fc4b}=_0x5a8ad7,_0xc9306e=_0xa0fc4b[_0x38d143(0xb8)];if(_0xc9306e){const _0x3ae8a4=await withSpinner(_0x38d143(0xea)+_0xc9306e+_0x38d143(0x12f),()=>_0x5db16b[_0x38d143(0x12d)][_0x38d143(0xd6)](_0xc9306e),{'verbose':_0xa0fc4b['verbose']});return _0x3ae8a4[_0x38d143(0xb2)];}let _0x5df08f=_0x5db16b['llm'][_0x38d143(0xa7)]();if(_0x5df08f)return _0x5df08f;const _0x5d1f98=await withSpinner(_0x38d143(0xc1),()=>_0x5db16b[_0x38d143(0x12d)][_0x38d143(0x116)](),{'verbose':_0xa0fc4b[_0x38d143(0x88)]});return _0x5d1f98[_0x38d143(0xb2)]['id'];}function toLLMProjectInfo(_0x112e60){const _0x106026=a25_0x5b7a;return{'name':_0x112e60['attributes'][_0x106026(0x85)],'description':_0x112e60[_0x106026(0x119)][_0x106026(0x71)],'createdAt':_0x112e60[_0x106026(0x119)][_0x106026(0x128)],'updatedAt':_0x112e60[_0x106026(0x119)][_0x106026(0xda)]};}function toAgentInfo(_0x50d274){const _0x191df3=a25_0x5b7a;return{'name':_0x50d274[_0x191df3(0x119)][_0x191df3(0x85)],'description':_0x50d274['attributes']['description'],'prompt':truncatePrompt(_0x50d274[_0x191df3(0x119)][_0x191df3(0x10b)]),'createdAt':_0x50d274['attributes'][_0x191df3(0x128)],'updatedAt':_0x50d274[_0x191df3(0x119)]['updatedAt']};}function truncatePrompt(_0x2ca43e){const _0x509882=a25_0x5b7a;if(!_0x2ca43e)return undefined;const _0x7b239c=0x64;if(_0x2ca43e[_0x509882(0xdd)]<=_0x7b239c)return _0x2ca43e;return _0x2ca43e['slice'](0x0,_0x7b239c)+_0x509882(0xac);}export class LLMModelsCommand extends BaseCommand{[a25_0x149c90(0x85)]=a25_0x149c90(0x7e);[a25_0x149c90(0x71)]=a25_0x149c90(0x7a);async['execute'](_0x43e949){const _0x21dbce=a25_0x149c90,{options:_0x594e7a,tdx:_0x34c8a0}=_0x43e949;try{const _0x45eb6d=await withSpinner(_0x21dbce(0x133),()=>_0x34c8a0['llm'][_0x21dbce(0x80)](),{'verbose':_0x594e7a[_0x21dbce(0x88)]});return await handleSDKOutput(_0x45eb6d['data'],_0x594e7a),0x0;}catch(_0x38978d){return handleSDKError(_0x38978d,_0x594e7a),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a25_0x149c90(0x85)]=a25_0x149c90(0x111);[a25_0x149c90(0x71)]='List\x20all\x20LLM\x20projects';async[a25_0x149c90(0xd9)](_0x29b2f9){const _0x4d145b=a25_0x149c90,{options:_0x1bfff2,args:_0x35a78e,tdx:_0x34f6f8}=_0x29b2f9;try{const _0xd1261=_0x35a78e[0x0],_0x18a610=resolveLimit(_0x1bfff2[_0x4d145b(0xe5)],DEFAULT_LLM_LIMIT),_0x5da151=await withSpinner(_0x4d145b(0x12c),()=>_0x34f6f8[_0x4d145b(0x12d)]['projects'](_0x18a610),{'verbose':_0x1bfff2[_0x4d145b(0x88)]});let _0x5a8b3b=_0x5da151[_0x4d145b(0xb2)];_0xd1261&&(_0x5a8b3b=_0x5da151['data'][_0x4d145b(0xd4)](_0x387eee=>matchGlobPattern(_0x387eee[_0x4d145b(0x119)]['name'],_0xd1261)));const _0x1da00f=_0x5a8b3b[_0x4d145b(0x11b)](toLLMProjectInfo);return await handleSDKOutput(_0x1da00f,_0x1bfff2),0x0;}catch(_0x4ee05e){return handleSDKError(_0x4ee05e,_0x1bfff2),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a25_0x149c90(0x85)]='llm:agents';['description']='List\x20agents\x20in\x20current\x20project';async[a25_0x149c90(0xd9)](_0x1ab690){const _0x30a39f=a25_0x149c90,{options:_0x1f6423,args:_0x2e80ff,tdx:_0xa7572}=_0x1ab690;try{const _0x30295f=_0x2e80ff[0x0];let _0x3604b7,_0x32090b=_0x30295f;if(_0x30295f&&_0x30295f[_0x30a39f(0xdb)]('/')){const _0x3f73e6=_0x30295f[_0x30a39f(0xa2)]('/');if(_0x3f73e6['length']===0x2){const [_0x3c691f,_0x17014f]=_0x3f73e6,_0xdd7ae6=await _0xa7572['llm'][_0x30a39f(0xbe)](),_0x4469f1=_0xdd7ae6[_0x30a39f(0x82)](_0x2a2b59=>_0x2a2b59['attributes'][_0x30a39f(0x85)][_0x30a39f(0x98)]()===_0x3c691f['toLowerCase']());if(!_0x4469f1)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x30a39f(0x7c)+_0x3c691f,undefined,{'helpText':_0x30a39f(0x122)});_0x3604b7=_0x4469f1['id'],_0x32090b=_0x17014f;}else throw new SDKError(ErrorCode[_0x30a39f(0x107)],_0x30a39f(0xef)+_0x30295f,undefined,{'helpText':_0x30a39f(0x130)});}else _0x3604b7=await getProjectIdOrDefault(_0x1ab690);const _0x479aac=await withSpinner(_0x30a39f(0xff),()=>_0xa7572['llm'][_0x30a39f(0xed)](_0x3604b7),{'verbose':_0x1f6423[_0x30a39f(0x88)]});let _0x575dd0=_0x479aac[_0x30a39f(0xb2)];_0x32090b&&(_0x575dd0=_0x479aac[_0x30a39f(0xb2)]['filter'](_0x416a53=>matchGlobPattern(_0x416a53[_0x30a39f(0x119)][_0x30a39f(0x85)],_0x32090b)));const _0xf8e5ef=_0x575dd0[_0x30a39f(0x11b)](toAgentInfo);return await handleSDKOutput(_0xf8e5ef,_0x1f6423),0x0;}catch(_0x56d45){return handleSDKError(_0x56d45,_0x1f6423),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a25_0x149c90(0x85)]='llm:agent:show';[a25_0x149c90(0x71)]=a25_0x149c90(0xec);async[a25_0x149c90(0xd9)](_0x29f488){const _0x4c9d0a=a25_0x149c90,{options:_0xbd1cdc,args:_0x50c9a9,tdx:_0x3f1175}=_0x29f488;if(_0x50c9a9[_0x4c9d0a(0xdd)]===0x0)return console[_0x4c9d0a(0xaf)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x4c9d0a(0xaf)]('Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>'),0x1;const _0x82932e=_0x50c9a9[0x0];try{const _0x2672fc=await getProjectIdOrDefault(_0x29f488),_0x526630=await withSpinner(_0x4c9d0a(0x126)+_0x82932e+_0x4c9d0a(0x12f),()=>_0x3f1175[_0x4c9d0a(0x12d)][_0x4c9d0a(0x94)](_0x82932e,_0x2672fc),{'verbose':_0xbd1cdc['verbose']}),_0x8db464=await withSpinner('Fetching\x20agent...',()=>_0x3f1175[_0x4c9d0a(0x12d)][_0x4c9d0a(0x131)](_0x526630['data']),{'verbose':_0xbd1cdc[_0x4c9d0a(0x88)]});return await handleSDKOutput([_0x8db464['data']],_0xbd1cdc),0x0;}catch(_0x1ad782){return handleSDKError(_0x1ad782,_0xbd1cdc),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{['name']=a25_0x149c90(0xc3);['description']=a25_0x149c90(0xeb);async['execute'](_0x311827){const _0x2c0df9=a25_0x149c90,{options:_0x50280e,args:_0x2d172e,tdx:_0x331e51}=_0x311827;if(_0x2d172e[_0x2c0df9(0xdd)]===0x0)return console[_0x2c0df9(0xaf)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x2c0df9(0xaf)]('Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]'),console[_0x2c0df9(0xaf)](_0x2c0df9(0xf7)),0x1;const _0x4996e9=_0x2d172e[0x0],_0x1bdf1f=_0x50280e,_0x2e3b66=_0x1bdf1f[_0x2c0df9(0xc6)],_0x504abb=_0x1bdf1f[_0x2c0df9(0x10a)]||'claude-4.5-haiku',_0x8e9f67=_0x1bdf1f[_0x2c0df9(0x9a)],_0x1271c0=_0x1bdf1f[_0x2c0df9(0x109)]?Number(_0x1bdf1f[_0x2c0df9(0x109)]):undefined,_0x12de72=_0x1bdf1f['temperature']?Number(_0x1bdf1f[_0x2c0df9(0xca)]):undefined;try{let _0x2f95eb,_0x9cd7b2;if(_0x4996e9[_0x2c0df9(0xdb)]('/')){const _0x46db79=_0x4996e9[_0x2c0df9(0xa2)]('/');if(_0x46db79[_0x2c0df9(0xdd)]===0x2){const [_0x3160dd,_0x2a9e5f]=_0x46db79,_0x3a4c6a=await withSpinner(_0x2c0df9(0xea)+_0x3160dd+_0x2c0df9(0x12f),()=>_0x331e51[_0x2c0df9(0x12d)][_0x2c0df9(0xd6)](_0x3160dd),{'verbose':_0x50280e['verbose']});_0x2f95eb=_0x3a4c6a['data'],_0x9cd7b2=_0x2a9e5f;}else throw new SDKError(ErrorCode[_0x2c0df9(0x107)],'Invalid\x20path\x20syntax:\x20'+_0x4996e9,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x2f95eb=await getProjectIdOrDefault(_0x311827),_0x9cd7b2=_0x4996e9;const _0x2959a0=await withSpinner(_0x2c0df9(0x112)+_0x9cd7b2+'\x27...',()=>_0x331e51['llm']['createAgent']({'name':_0x9cd7b2,'projectId':_0x2f95eb,'modelType':_0x504abb,'systemPrompt':_0x2e3b66,'starterMessage':_0x8e9f67,'maxToolIterations':_0x1271c0,'temperature':_0x12de72}),{'verbose':_0x50280e[_0x2c0df9(0x88)]});return console[_0x2c0df9(0x6a)](_0x2c0df9(0x106)+_0x2959a0[_0x2c0df9(0xb2)]['id']),await handleSDKOutput([_0x2959a0[_0x2c0df9(0xb2)]],_0x50280e),0x0;}catch(_0x11018c){return handleSDKError(_0x11018c,_0x50280e),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a25_0x149c90(0x85)]=a25_0x149c90(0x11d);[a25_0x149c90(0x71)]=a25_0x149c90(0x132);async[a25_0x149c90(0xd9)](_0x3aae6a){const _0x3a9360=a25_0x149c90,{options:_0x5dd20d,args:_0xf01277,tdx:_0x1f68ee}=_0x3aae6a;if(_0xf01277['length']===0x0)return console[_0x3a9360(0xaf)](_0x3a9360(0xc7)),console[_0x3a9360(0xaf)](_0x3a9360(0xf4)),0x1;const _0x96ca1e=_0xf01277[0x0],_0x30a26a=_0x5dd20d,_0x1de66b=_0x30a26a['name'],_0x5d6842=_0x30a26a[_0x3a9360(0x10b)],_0x19e865=_0x30a26a[_0x3a9360(0x71)],_0x18c2b1=_0x30a26a[_0x3a9360(0x9a)];if(!_0x1de66b&&!_0x5d6842&&!_0x19e865&&!_0x18c2b1)return console[_0x3a9360(0xaf)](_0x3a9360(0x8a)),console[_0x3a9360(0xaf)]('Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message'),0x1;try{const _0x390e22=await getProjectIdOrDefault(_0x3aae6a),_0x28c85b=await withSpinner(_0x3a9360(0x126)+_0x96ca1e+_0x3a9360(0x12f),()=>_0x1f68ee[_0x3a9360(0x12d)][_0x3a9360(0x94)](_0x96ca1e,_0x390e22),{'verbose':_0x5dd20d[_0x3a9360(0x88)]}),_0x43d604=_0x28c85b[_0x3a9360(0xb2)],_0x127da7=await withSpinner(_0x3a9360(0x6c),()=>_0x1f68ee[_0x3a9360(0x12d)]['updateAgent'](_0x43d604,{'name':_0x1de66b,'prompt':_0x5d6842,'description':_0x19e865,'starterMessage':_0x18c2b1}),{'verbose':_0x5dd20d[_0x3a9360(0x88)]});return console['log'](_0x3a9360(0xd8)+_0x127da7[_0x3a9360(0xb2)]['id']),await handleSDKOutput([_0x127da7[_0x3a9360(0xb2)]],_0x5dd20d),0x0;}catch(_0x5b210b){return handleSDKError(_0x5b210b,_0x5dd20d),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']='llm:agent:delete';['description']=a25_0x149c90(0x73);async[a25_0x149c90(0xd9)](_0x40d45c){const _0x2c9fe3=a25_0x149c90,{options:_0x5631b4,args:_0x4c38c9,tdx:_0x4742c8}=_0x40d45c;if(_0x4c38c9['length']===0x0)return console['error'](_0x2c9fe3(0xc7)),console['error'](_0x2c9fe3(0x124)),0x1;const _0x46c29c=_0x4c38c9[0x0];try{const _0x38d00a=await getProjectIdOrDefault(_0x40d45c),_0x59a6f2=await withSpinner(_0x2c9fe3(0x126)+_0x46c29c+_0x2c9fe3(0x12f),()=>_0x4742c8[_0x2c9fe3(0x12d)][_0x2c9fe3(0x94)](_0x46c29c,_0x38d00a),{'verbose':_0x5631b4['verbose']}),_0x26753e=_0x59a6f2[_0x2c9fe3(0xb2)];return await withSpinner(_0x2c9fe3(0xe1),()=>_0x4742c8[_0x2c9fe3(0x12d)]['deleteAgent'](_0x26753e),{'verbose':_0x5631b4[_0x2c9fe3(0x88)]}),console[_0x2c9fe3(0x6a)](_0x2c9fe3(0xa0)+_0x26753e),0x0;}catch(_0x4bbc60){return handleSDKError(_0x4bbc60,_0x5631b4),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a25_0x149c90(0xb3);[a25_0x149c90(0x71)]=a25_0x149c90(0x101);async[a25_0x149c90(0xd9)](_0x485478){const _0x2cb550=a25_0x149c90;return executeChatHistoryCommand(_0x485478,_0x2cb550(0x6b));}}export class LLMUseCommand extends BaseCommand{[a25_0x149c90(0x85)]=a25_0x149c90(0x95);[a25_0x149c90(0x71)]=a25_0x149c90(0xfd);async['execute'](_0x3f66bf){const _0x417b68=a25_0x149c90,{options:_0x4f2246,args:_0x545155,tdx:_0x269685}=_0x3f66bf;if(_0x545155['length']===0x0)return console[_0x417b68(0xaf)](_0x417b68(0x97)),console['error']('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x20e537=_0x545155[0x0];try{return await withSpinner(_0x417b68(0xf5)+_0x20e537+_0x417b68(0x12f),()=>_0x269685['llm'][_0x417b68(0xd3)](_0x20e537),{'verbose':_0x4f2246[_0x417b68(0x88)]}),console[_0x417b68(0x6a)]('Project\x20context\x20set\x20to:\x20'+_0x20e537),0x0;}catch(_0xf285b){return handleSDKError(_0xf285b,_0x4f2246),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a25_0x149c90(0x85)]=a25_0x149c90(0xcb);[a25_0x149c90(0x71)]=a25_0x149c90(0x120);async[a25_0x149c90(0xd9)](_0x2dca1c){const _0x33f2b3=a25_0x149c90,{options:_0x345a8b,args:_0x510279,tdx:_0x286010}=_0x2dca1c;if(_0x510279[_0x33f2b3(0xdd)]===0x0)return console[_0x33f2b3(0xaf)](_0x33f2b3(0x97)),console[_0x33f2b3(0xaf)](_0x33f2b3(0xa6)),0x1;const _0x470650=_0x510279[0x0],_0x217038=_0x345a8b,_0x969acf=_0x217038['description'];try{const _0x2712b4=await withSpinner('Creating\x20project\x20\x27'+_0x470650+'\x27...',()=>_0x286010['llm'][_0x33f2b3(0x100)]({'name':_0x470650,'description':_0x969acf}),{'verbose':_0x345a8b['verbose']});console[_0x33f2b3(0x6a)](_0x33f2b3(0x12b)+_0x2712b4[_0x33f2b3(0xb2)]['id']);const _0x43d8ec=toLLMProjectInfo(_0x2712b4[_0x33f2b3(0xb2)]);return await handleSDKOutput([_0x43d8ec],_0x345a8b),0x0;}catch(_0x305c1e){return handleSDKError(_0x305c1e,_0x345a8b),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a25_0x149c90(0x85)]=a25_0x149c90(0x9e);[a25_0x149c90(0x71)]=a25_0x149c90(0x10e);async[a25_0x149c90(0xd9)](_0x34f6d0){const _0x897050=a25_0x149c90,{options:_0x3af33b,args:_0x2e4cfd,tdx:_0x2bca3c}=_0x34f6d0;if(_0x2e4cfd[_0x897050(0xdd)]===0x0)return console[_0x897050(0xaf)]('Error:\x20Project\x20name\x20is\x20required'),console['error'](_0x897050(0xb9)),0x1;const _0xceaae3=_0x2e4cfd[0x0];try{return await withSpinner(_0x897050(0xe6)+_0xceaae3+_0x897050(0x12f),()=>_0x2bca3c['llm'][_0x897050(0xbc)](_0xceaae3),{'verbose':_0x3af33b[_0x897050(0x88)]}),console['log'](_0x897050(0x7f)+_0xceaae3),0x0;}catch(_0x4b143a){return handleSDKError(_0x4b143a,_0x3af33b),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a25_0x149c90(0x85)]=a25_0x149c90(0x68);[a25_0x149c90(0x71)]=a25_0x149c90(0x135);async['execute'](_0x407380){const _0x3551b3=a25_0x149c90,{options:_0xaecfb6,args:_0x1b16d8,tdx:_0x3c7aec}=_0x407380;if(_0x1b16d8[_0x3551b3(0xdd)]===0x0)return console['error'](_0x3551b3(0x97)),console[_0x3551b3(0xaf)](_0x3551b3(0x79)),0x1;const _0x183bc6=_0x1b16d8[0x0],_0x5a9e68=_0xaecfb6,_0x1a7091=_0x5a9e68[_0x3551b3(0xb4)],_0x36440e=_0x5a9e68[_0x3551b3(0x123)];try{const _0x210b2=_0x1a7091||_0x183bc6+_0x3551b3(0xfa);if(a25_0x909bbb[_0x3551b3(0xa8)](_0x210b2)&&!_0x36440e){if(!_0xaecfb6[_0x3551b3(0x10d)]){const _0x3fad31=await confirm('Output\x20directory\x20\x27'+_0x210b2+_0x3551b3(0xc2));if(!_0x3fad31)return console['log'](_0x3551b3(0xd7)),0x0;}a25_0x909bbb[_0x3551b3(0x96)](_0x210b2,{'recursive':!![]});}const _0x2c1249=await withSpinner(_0x36440e?_0x3551b3(0x129)+_0x183bc6+_0x3551b3(0x12f):'Backing\x20up\x20project\x20\x27'+_0x183bc6+_0x3551b3(0x12f),()=>_0x3c7aec[_0x3551b3(0x12d)]['backupProject'](_0x183bc6,_0x1a7091,{'dryRun':_0x36440e}),{'verbose':_0xaecfb6[_0x3551b3(0x88)]}),_0x1408ae=_0x2c1249[_0x3551b3(0xb2)];return _0x36440e?console[_0x3551b3(0x6a)](_0x3551b3(0x127)+_0x1408ae['outputDir']):console[_0x3551b3(0x6a)](_0x3551b3(0x121)+_0x1408ae[_0x3551b3(0xba)]),console[_0x3551b3(0x6a)](_0x3551b3(0x102)+_0x1408ae[_0x3551b3(0x136)][_0x3551b3(0xed)]),console[_0x3551b3(0x6a)](_0x3551b3(0x9f)+_0x1408ae['counts']['knowledgeBases']),console[_0x3551b3(0x6a)](_0x3551b3(0xbd)+_0x1408ae['counts']['prompts']),console[_0x3551b3(0x6a)](_0x3551b3(0x9c)+_0x1408ae[_0x3551b3(0x136)][_0x3551b3(0xa4)]),(_0xaecfb6[_0x3551b3(0x83)]===_0x3551b3(0x75)||_0xaecfb6[_0x3551b3(0x83)]===_0x3551b3(0x76))&&await handleSDKOutput([_0x1408ae],_0xaecfb6),0x0;}catch(_0x51eb7f){return handleSDKError(_0x51eb7f,_0xaecfb6),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a25_0x149c90(0x85)]=a25_0x149c90(0x12e);[a25_0x149c90(0x71)]='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder';async[a25_0x149c90(0xd9)](_0x1fa64c){const _0xca519b=a25_0x149c90,{options:_0x469e1b,args:_0x23fad9,tdx:_0x25d6c6}=_0x1fa64c;if(_0x23fad9['length']===0x0)return console[_0xca519b(0xaf)](_0xca519b(0x9d)),console['error'](_0xca519b(0x7b)),0x1;const _0x2bad9e=_0x23fad9[0x0],_0x6437f7=_0x469e1b,_0x5e953c=_0x6437f7[_0xca519b(0x85)],_0x21d58e=_0x6437f7['dryRun'];try{if(!_0x21d58e){const _0x13b215=_0x25d6c6[_0xca519b(0x12d)][_0xca519b(0xa9)](_0x2bad9e),_0x562cf9=_0x5e953c||_0x13b215[_0xca519b(0x103)][_0xca519b(0x11e)],_0x46bee8=await withSpinner('Checking\x20for\x20existing\x20projects...',()=>_0x25d6c6[_0xca519b(0x12d)][_0xca519b(0xbe)](),{'verbose':_0x469e1b[_0xca519b(0x88)]}),_0x22a8af=_0x46bee8[_0xca519b(0xb2)][_0xca519b(0x82)](_0x508eb6=>_0x508eb6[_0xca519b(0x119)]['name']===_0x562cf9);if(_0x22a8af&&!_0x469e1b[_0xca519b(0x10d)]){const _0x46290a=await confirm(_0xca519b(0xb0)+_0x562cf9+_0xca519b(0x10f));if(!_0x46290a)return console[_0xca519b(0x6a)](_0xca519b(0xa1)),0x0;}}const _0x3895d7=await withSpinner(_0x21d58e?_0xca519b(0xe3)+_0x2bad9e+_0xca519b(0x12f):_0xca519b(0x90)+_0x2bad9e+_0xca519b(0x12f),()=>_0x25d6c6[_0xca519b(0x12d)][_0xca519b(0x93)](_0x2bad9e,{'name':_0x5e953c,'dryRun':_0x21d58e}),{'verbose':_0x469e1b['verbose']}),_0x137b8e=_0x3895d7['data'];return _0x137b8e[_0xca519b(0xf8)]&&console[_0xca519b(0x6a)](_0xca519b(0xee)+_0x137b8e[_0xca519b(0xf8)]+'\x27'),_0x21d58e?console[_0xca519b(0x6a)](_0xca519b(0xce)+_0x137b8e[_0xca519b(0x11e)]):console[_0xca519b(0x6a)](_0xca519b(0x11c)+_0x137b8e[_0xca519b(0x11e)]+'\x20('+_0x137b8e[_0xca519b(0x9b)]+')'),console['log'](_0xca519b(0x102)+_0x137b8e['counts'][_0xca519b(0xed)]),console['log'](_0xca519b(0x9f)+_0x137b8e['counts'][_0xca519b(0x108)]),console[_0xca519b(0x6a)](_0xca519b(0xbd)+_0x137b8e[_0xca519b(0x136)][_0xca519b(0xae)]),console['log']('\x20\x20Integrations:\x20'+_0x137b8e[_0xca519b(0x136)][_0xca519b(0xa4)]),(_0x469e1b[_0xca519b(0x83)]===_0xca519b(0x75)||_0x469e1b['format']===_0xca519b(0x76))&&await handleSDKOutput([_0x137b8e],_0x469e1b),0x0;}catch(_0x3a2bfa){return handleSDKError(_0x3a2bfa,_0x469e1b),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0xc5c051,_0x5b5401){const _0x309494=a25_0x149c90,_0x5b5555=_0x5b5401['limit']||CHAT_SELECTOR_PAGE_SIZE;let _0x57a268=0x0,_0x4cf458=[];const _0x47ebf9=(await import(_0x309494(0xae)))[_0x309494(0xfb)],_0x3c37c1=getChalk(_0x5b5401);while(!![]){const _0x5c01f5=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0xc5c051['llm'][_0x309494(0xf1)](_0x5b5555+_0x57a268),{'verbose':_0x5b5401['verbose']});_0x4cf458=_0x5c01f5[_0x309494(0xb2)];const _0x540d77=_0x4cf458[_0x309494(0x110)](_0x57a268,_0x57a268+_0x5b5555),_0x52cb10=_0x4cf458[_0x309494(0xdd)]>_0x57a268+_0x5b5555,_0x5359f7=[...new Set(_0x540d77[_0x309494(0x11b)](_0x2bc27f=>_0x2bc27f['attributes']['agentId'])[_0x309494(0xd4)](_0x36e89c=>_0x36e89c!==undefined))],_0x4d1fa0=new Map();await Promise[_0x309494(0x12a)](_0x5359f7['map'](async _0xf7c0df=>{const _0x4564a7=_0x309494;try{const _0x5bb956=await _0xc5c051[_0x4564a7(0x12d)][_0x4564a7(0x131)](_0xf7c0df);_0x4d1fa0[_0x4564a7(0x104)](_0xf7c0df,_0x5bb956[_0x4564a7(0x119)][_0x4564a7(0x85)]);}catch{_0x4d1fa0['set'](_0xf7c0df,_0xf7c0df);}}));const _0x2393fe=_0x540d77[_0x309494(0x11b)](_0x3efe29=>{const _0x891979=_0x309494,_0x2c2123=_0x3efe29['attributes'][_0x891979(0xcf)]||_0x891979(0xc9),_0x12479d=_0x2c2123[_0x891979(0xa2)]('\x0a')[0x0],_0x256953=_0x12479d[_0x891979(0xdd)]>0x50?_0x12479d[_0x891979(0xaa)](0x0,0x4d)+_0x891979(0xac):_0x12479d,_0x677fbc=_0x3efe29[_0x891979(0x119)][_0x891979(0xc0)]?_0x4d1fa0['get'](_0x3efe29[_0x891979(0x119)][_0x891979(0xc0)])||_0x3efe29[_0x891979(0x119)]['agentId']:_0x891979(0x10c),_0x548681=_0x3efe29[_0x891979(0x119)]['lastConversationAt']||_0x3efe29[_0x891979(0x119)]['updatedAt'],_0x426f25=new Date(_0x548681),_0xf8ad5b=new Date(),_0xd1b585=_0xf8ad5b[_0x891979(0x8e)]()-_0x426f25[_0x891979(0x8e)](),_0x837911=Math[_0x891979(0x114)](_0xd1b585/0xea60),_0x3f2e17=Math[_0x891979(0x114)](_0xd1b585/0x36ee80),_0x5d9b4d=Math[_0x891979(0x114)](_0xd1b585/0x5265c00);let _0x43f92b;if(_0x837911<0x1)_0x43f92b=_0x891979(0x69);else{if(_0x837911<0x3c)_0x43f92b=_0x837911+_0x891979(0xe4);else{if(_0x3f2e17<0x18)_0x43f92b=_0x3f2e17+'h\x20ago';else _0x5d9b4d<0x7?_0x43f92b=_0x5d9b4d+_0x891979(0xf9):_0x43f92b=_0x426f25[_0x891979(0x81)]('en-US',{'month':_0x891979(0x84),'day':_0x891979(0xe0)});}}return{'title':_0x256953+'\x20'+_0x3c37c1[_0x891979(0x77)]('['+_0x677fbc+']\x20'+_0x43f92b),'value':_0x3efe29['id']};});_0x52cb10&&_0x2393fe[_0x309494(0x8f)]({'title':_0x3c37c1[_0x309494(0xe9)](_0x309494(0xdc)),'value':_0x309494(0xbb)});const _0xa6e4e5=await _0x47ebf9({'type':_0x309494(0x86),'name':_0x309494(0xb5),'message':_0x309494(0xb1),'choices':_0x2393fe,'hint':_0x309494(0xc4)});if(!_0xa6e4e5['chatId'])return undefined;if(_0xa6e4e5['chatId']===_0x309494(0xbb)){_0x57a268+=_0x5b5555;continue;}return _0xa6e4e5[_0x309494(0xb5)];}}export class ChatsCommand extends BaseCommand{[a25_0x149c90(0x85)]=a25_0x149c90(0xf1);[a25_0x149c90(0x71)]=a25_0x149c90(0x11a);async['execute'](_0x590a4d){const _0x11cc19=a25_0x149c90;return executeChatHistoryCommand(_0x590a4d,_0x11cc19(0xfc));}}
1
+ const a25_0x203df8=a25_0x35f0;(function(_0x150692,_0x270b40){const _0x286b70=a25_0x35f0,_0x58f98a=_0x150692();while(!![]){try{const _0x51719b=-parseInt(_0x286b70(0xc7))/0x1+parseInt(_0x286b70(0xe0))/0x2+-parseInt(_0x286b70(0x17b))/0x3*(-parseInt(_0x286b70(0xda))/0x4)+-parseInt(_0x286b70(0xb3))/0x5+-parseInt(_0x286b70(0x149))/0x6+parseInt(_0x286b70(0xc8))/0x7*(-parseInt(_0x286b70(0x177))/0x8)+parseInt(_0x286b70(0x11c))/0x9;if(_0x51719b===_0x270b40)break;else _0x58f98a['push'](_0x58f98a['shift']());}catch(_0x2a3704){_0x58f98a['push'](_0x58f98a['shift']());}}}(a25_0x4902,0x2bb06));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a25_0x35f0(_0x4ea390,_0x3ac540){_0x4ea390=_0x4ea390-0xb3;const _0x4902f2=a25_0x4902();let _0x35f094=_0x4902f2[_0x4ea390];return _0x35f094;}import{handleSDKOutput,writeOutput}from'../utils/command-output.js';function a25_0x4902(){const _0xc89bab=['[unknown]','restoreProject','d\x20ago','targetKnowledgeBase','agents','getTime','red','8rShnOh','tdx\x20chats','string','llm:agent:delete','54vRtvpH','526040VllXHt','\x27\x20already\x20exists.\x20Overwrite?','data','agent','Agent\x20updated:\x20','Use\x20format:\x20project-name/agent-name','\x20-\x20','includes','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','cause','List\x20available\x20LLM\x20models','temperature','execute','yes','tool_call','llm:project:create','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','\x20bytes)','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Output\x20directory\x20\x27','225661XwCrFA','1674351UkRmLp','model','slice','Creating\x20agent\x20\x27','find','\x27...','error','.llm','Fetching\x20chat\x20history\x20for\x20\x27','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','Usage:\x20tdx\x20llm\x20use\x20<project-name>','updatedAt','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','tdx\x20llm\x20history','length','[input]\x20\x20','prompt','75860PeNmkO','Fetching\x20most\x20recent\x20chat...','createProject','resolveAgentId','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','limit','473086ftoXaC','dim','m\x20ago','Getting\x20default\x20project...','\x20->\x20ImageGen:','chatId','table','log','Setting\x20project\x20context\x20to\x20\x27','projects','attributes','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','llm:agent:update','LLM_PROJECT_NOT_FOUND','jsonl','\x0aCancelled','models','knowledgeBases','systemPrompt','\x20\x20Prompts:\x20','prompts','llmProject','integrations','yellow','Creating\x20project\x20\x27','description','filter','name','substring','toLowerCase','projectName','agentId','[image]\x20\x20','\x20->\x20Agent:','push','llm:agent:show','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','outputDir','Fetching\x20chat\x20sessions...','bold','content','Error:\x20Project\x20name\x20is\x20required','blue','json','llm:agents','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','keys','Error:\x20','Resolving\x20agent\x20\x27','\x20->\x20WebSearch:','split','\x0aStack\x20trace:','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','default','Set\x20current\x20project\x20context','numeric','rmSync','en-US','set','verbose','2636649KKQNkX','\x20\x20Agents:\x20','Project\x20restored:\x20','No\x20chat\x20sessions\x20found.','Deleting\x20project\x20\x27','history','image','Resolving\x20project\x20\x27','INVALID_ARGUMENT','chats','stringify','[error]\x20\x20','\x20\x20Integrations:\x20','floor','...','exportedFrom','getBackupMetadata','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','__load_more__','\x20--last','Update\x20an\x20existing\x20agent','Restoring\x20project\x20from\x20\x27','just\x20now','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','Updating\x20agent...','toLocaleDateString','tool','get','entries','Backing\x20up\x20project\x20\x27','updateAgent','output','llm:project:delete','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','Fetching\x20available\x20models...','format','select','green','[tool]\x20\x20\x20','llm:project:backup','magenta','Agent\x20created:\x20','Error:\x20Agent\x20name\x20is\x20required','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','Checking\x20for\x20existing\x20projects...','731172BwtbPt','Create\x20a\x20new\x20LLM\x20project','llm:use','getCurrentProject','Fetching\x20agents...','Load\x20more...','Invalid\x20path\x20syntax:\x20','Project\x20not\x20found:\x20','createdAt','llm:projects','stack','getOrCreateDefaultProject','llm','Create\x20a\x20new\x20agent\x20in\x20current\x20project','counts','h\x20ago','input','setCurrentProject','(no\x20message)','sourceSite','Deleting\x20agent...','Project\x20backed\x20up\x20to:\x20','resolveProjectId','dryRun','Restore\x20cancelled.','targetAgent','\x20\x20Cause:\x20','Analyzing\x20project\x20\x27','Select\x20a\x20chat\x20session:','List\x20all\x20LLM\x20projects','Error:\x20Backup\x20folder\x20path\x20is\x20required','map','No\x20messages\x20found\x20in\x20chat\x20history.','createAgent','\x20\x20Knowledge\x20Bases:\x20','targetImageGenerator','[output]\x20','\x20→\x20chat:\x20','firstInputContent'];a25_0x4902=function(){return _0xc89bab;};return a25_0x4902();}import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a25_0x20bc81 from'node:fs';function handleSDKError(_0xff684e,_0x4ec880){const _0x40edd9=a25_0x35f0;if(_0xff684e instanceof SDKError)console[_0x40edd9(0xce)](_0x40edd9(0x10f)+_0xff684e['message']),_0x4ec880['verbose']&&(_0xff684e[_0x40edd9(0xbc)]&&console[_0x40edd9(0xce)](_0x40edd9(0x163)+_0xff684e[_0x40edd9(0xbc)]),_0xff684e[_0x40edd9(0x153)]&&(console[_0x40edd9(0xce)](_0x40edd9(0x113)),console[_0x40edd9(0xce)](_0xff684e[_0x40edd9(0x153)])));else throw _0xff684e;}function formatChatHistoryEntry(_0x13d47e,_0x23bb64){const _0x3b5146=a25_0x35f0,_0x431b7c=getChalk(_0x23bb64),_0x489860=_0x431b7c[_0x3b5146(0xe1)](_0x13d47e['at']);if('input'in _0x13d47e){const _0x2d694a=_0x431b7c['cyan'](_0x3b5146(0xd8));return _0x489860+'\x20'+_0x2d694a+':\x20'+_0x13d47e[_0x3b5146(0x159)];}if('content'in _0x13d47e){const _0x5cd035=_0x431b7c[_0x3b5146(0x141)]('[content]');return _0x489860+'\x20'+_0x5cd035+':\x20'+_0x13d47e[_0x3b5146(0x108)];}if(_0x3b5146(0xc1)in _0x13d47e){const _0x2ca63a=_0x431b7c[_0x3b5146(0xf7)]('[tool_call]'),{functionName:_0x5b3191,functionArguments:_0x45916f,targetFunction:_0x13aacf}=_0x13d47e['tool_call'];let _0x120ced=_0x489860+'\x20'+_0x2ca63a+':\x20'+_0x431b7c[_0x3b5146(0x107)](_0x5b3191);if(_0x45916f&&Object[_0x3b5146(0x10e)](_0x45916f)[_0x3b5146(0xd7)]>0x0){const _0x25c30e=Object[_0x3b5146(0x138)](_0x45916f)[_0x3b5146(0x168)](([_0x576df3,_0xf38694])=>_0x576df3+'='+JSON[_0x3b5146(0x126)](_0xf38694))['join'](',\x20');_0x120ced+='('+_0x25c30e+')';}_0x13aacf&&(_0x120ced+=_0x431b7c[_0x3b5146(0xe1)]('\x20['+_0x13aacf+']'));let _0x1c7268='';if(_0x13d47e[_0x3b5146(0xc1)][_0x3b5146(0x173)])_0x1c7268='\x20->\x20KB:'+_0x13d47e['tool_call'][_0x3b5146(0x173)][_0x3b5146(0xfb)];else{if(_0x13d47e['tool_call'][_0x3b5146(0x162)])_0x1c7268=_0x3b5146(0x101)+_0x13d47e[_0x3b5146(0xc1)][_0x3b5146(0x162)][_0x3b5146(0xfb)];else{if(_0x13d47e[_0x3b5146(0xc1)]['targetWebSearchTool'])_0x1c7268=_0x3b5146(0x111)+_0x13d47e[_0x3b5146(0xc1)]['targetWebSearchTool'][_0x3b5146(0xfb)];else _0x13d47e[_0x3b5146(0xc1)][_0x3b5146(0x16c)]&&(_0x1c7268=_0x3b5146(0xe4)+_0x13d47e[_0x3b5146(0xc1)]['targetImageGenerator'][_0x3b5146(0xfb)]);}}return _0x120ced+_0x1c7268;}if('tool'in _0x13d47e){const _0x48e59a=_0x431b7c[_0x3b5146(0x144)](_0x3b5146(0x142)),{functionName:_0x1838dc,functionArguments:_0x278ed8,content:_0x38a6fe,newChat:_0x225acc}=_0x13d47e[_0x3b5146(0x136)];let _0x20cf38=_0x489860+'\x20'+_0x48e59a+':\x20'+_0x431b7c[_0x3b5146(0x107)](_0x1838dc);if(_0x278ed8){const _0x605146=typeof _0x278ed8===_0x3b5146(0x179)?_0x278ed8:JSON[_0x3b5146(0x126)](_0x278ed8);_0x20cf38+='('+_0x605146+')';}return _0x38a6fe&&(_0x20cf38+='\x0a'+_0x431b7c['dim'](_0x38a6fe)),_0x225acc&&(_0x20cf38+=_0x431b7c['dim'](_0x3b5146(0x16e)+_0x225acc['id'])),_0x20cf38;}if(_0x3b5146(0x13b)in _0x13d47e){const _0x19a98d=_0x431b7c['blue'](_0x3b5146(0x16d));return _0x489860+'\x20'+_0x19a98d+':\x20'+_0x13d47e['output']['name']+'\x20('+_0x13d47e[_0x3b5146(0x13b)][_0x3b5146(0x108)][_0x3b5146(0xd7)]+_0x3b5146(0xc4);}if(_0x3b5146(0x122)in _0x13d47e){const _0x4c9e89=_0x431b7c[_0x3b5146(0x10a)](_0x3b5146(0x100)),{width:_0x292b67,height:_0x4d6602,headerText:_0x7c3077}=_0x13d47e[_0x3b5146(0x122)],_0x210627=_0x7c3077?_0x3b5146(0xb9)+_0x7c3077:'';return _0x489860+'\x20'+_0x4c9e89+':\x20'+_0x292b67+'x'+_0x4d6602+_0x210627;}if('error'in _0x13d47e){const _0x4aab87=_0x431b7c[_0x3b5146(0x176)](_0x3b5146(0x127));return _0x489860+'\x20'+_0x4aab87+':\x20'+_0x13d47e[_0x3b5146(0xce)];}return _0x489860+'\x20'+_0x431b7c[_0x3b5146(0xe1)](_0x3b5146(0x170))+':\x20'+JSON['stringify'](_0x13d47e);}async function executeChatHistoryCommand(_0x1ba20,_0x408976){const _0x269a75=a25_0x35f0,{options:_0x319f83,args:_0x308d87,tdx:_0x5c6209}=_0x1ba20,_0x3b95a5=_0x308d87[0x0],_0x3f1d9d=_0x319f83,_0x1e0c49=_0x3f1d9d['last'];try{if(_0x1e0c49&&_0x3b95a5)return console[_0x269a75(0xce)]('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x269a75(0xce)]('Usage:\x20'+_0x408976+_0x269a75(0x12f)),0x1;if(!_0x3b95a5&&!_0x1e0c49&&_0x319f83[_0x269a75(0x13f)]!==undefined){const _0x4e6937=resolveLimit(_0x319f83[_0x269a75(0xdf)],DEFAULT_LLM_LIMIT),_0x690384=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x5c6209[_0x269a75(0x155)][_0x269a75(0x125)](_0x4e6937),{'verbose':_0x319f83['verbose']});return await handleSDKOutput(_0x690384[_0x269a75(0xb5)],_0x319f83),0x0;}const _0x578fc3=await getChatIdOrSelect(_0x5c6209,_0x319f83,_0x1e0c49,_0x3b95a5);if(!_0x578fc3)return 0x0;return await displayChatHistory(_0x578fc3,_0x5c6209,_0x319f83),0x0;}catch(_0x5a4de6){return handleSDKError(_0x5a4de6,_0x319f83),0x1;}}async function displayChatHistory(_0x21e146,_0x4cff57,_0x26a05f){const _0x5acd74=a25_0x35f0,_0x49265a=await withSpinner(_0x5acd74(0xd0)+_0x21e146+_0x5acd74(0xcd),()=>_0x4cff57[_0x5acd74(0x155)][_0x5acd74(0x121)](_0x21e146),{'verbose':_0x26a05f[_0x5acd74(0x11b)]}),_0x3935e5=_0x49265a[_0x5acd74(0xb5)][_0x5acd74(0xb5)]??[];if(_0x3935e5['length']===0x0){console[_0x5acd74(0xe7)](_0x5acd74(0x169));return;}if(_0x26a05f[_0x5acd74(0x13f)]!==undefined)await handleSDKOutput(_0x3935e5,_0x26a05f);else{const _0x3a4a4a=_0x3935e5[_0x5acd74(0x168)](_0x2781fb=>formatChatHistoryEntry(_0x2781fb,_0x26a05f)),_0x1edba8=_0x3a4a4a['join']('\x0a');await writeOutput(_0x1edba8,_0x26a05f['output'],_0x5acd74(0xe6));}}async function getChatIdOrSelect(_0x27236e,_0x21cd45,_0xae0bd3,_0x5e200b){const _0x7d24fb=a25_0x35f0;if(_0x5e200b)return _0x5e200b;if(_0xae0bd3){const _0x38f55d=await withSpinner(_0x7d24fb(0xdb),()=>_0x27236e[_0x7d24fb(0x155)][_0x7d24fb(0x125)](0x1),{'verbose':_0x21cd45[_0x7d24fb(0x11b)]});if(_0x38f55d[_0x7d24fb(0xb5)]['length']===0x0)return console[_0x7d24fb(0xe7)](_0x7d24fb(0x11f)),undefined;return _0x38f55d[_0x7d24fb(0xb5)][0x0]['id'];}const _0x5c12f7=await selectChatInteractively(_0x27236e,_0x21cd45);if(!_0x5c12f7)return console[_0x7d24fb(0xe7)](_0x7d24fb(0xef)),undefined;return _0x5c12f7;}async function getProjectIdOrDefault(_0x1cf611){const _0x3e5ee1=a25_0x35f0,{tdx:_0x32d114,options:_0x1d5964}=_0x1cf611,_0x618e01=_0x1d5964[_0x3e5ee1(0xf5)];if(_0x618e01){const _0x54ad63=await withSpinner('Resolving\x20project\x20\x27'+_0x618e01+_0x3e5ee1(0xcd),()=>_0x32d114[_0x3e5ee1(0x155)][_0x3e5ee1(0x15f)](_0x618e01),{'verbose':_0x1d5964[_0x3e5ee1(0x11b)]});return _0x54ad63[_0x3e5ee1(0xb5)];}let _0x4cf89e=_0x32d114[_0x3e5ee1(0x155)][_0x3e5ee1(0x14c)]();if(_0x4cf89e)return _0x4cf89e;const _0xbc112e=await withSpinner(_0x3e5ee1(0xe3),()=>_0x32d114[_0x3e5ee1(0x155)][_0x3e5ee1(0x154)](),{'verbose':_0x1d5964[_0x3e5ee1(0x11b)]});return _0xbc112e[_0x3e5ee1(0xb5)]['id'];}function toLLMProjectInfo(_0x35ab8a){const _0x5e8569=a25_0x35f0;return{'name':_0x35ab8a[_0x5e8569(0xea)][_0x5e8569(0xfb)],'description':_0x35ab8a['attributes'][_0x5e8569(0xf9)],'createdAt':_0x35ab8a[_0x5e8569(0xea)][_0x5e8569(0x151)],'updatedAt':_0x35ab8a[_0x5e8569(0xea)][_0x5e8569(0xd4)]};}function toAgentInfo(_0x5d35ab){const _0x30ac61=a25_0x35f0;return{'name':_0x5d35ab[_0x30ac61(0xea)][_0x30ac61(0xfb)],'description':_0x5d35ab['attributes'][_0x30ac61(0xf9)],'prompt':truncatePrompt(_0x5d35ab[_0x30ac61(0xea)][_0x30ac61(0xd9)]),'createdAt':_0x5d35ab[_0x30ac61(0xea)][_0x30ac61(0x151)],'updatedAt':_0x5d35ab['attributes'][_0x30ac61(0xd4)]};}function truncatePrompt(_0x5a8037){const _0x263cc3=a25_0x35f0;if(!_0x5a8037)return undefined;const _0x1852d5=0x64;if(_0x5a8037['length']<=_0x1852d5)return _0x5a8037;return _0x5a8037['slice'](0x0,_0x1852d5)+_0x263cc3(0x12a);}export class LLMModelsCommand extends BaseCommand{['name']='llm:models';[a25_0x203df8(0xf9)]=a25_0x203df8(0xbd);async['execute'](_0x8d06e8){const _0x228a12=a25_0x203df8,{options:_0x1c94ae,tdx:_0x179508}=_0x8d06e8;try{const _0x348106=await withSpinner(_0x228a12(0x13e),()=>_0x179508[_0x228a12(0x155)][_0x228a12(0xf0)](),{'verbose':_0x1c94ae[_0x228a12(0x11b)]});return await handleSDKOutput(_0x348106[_0x228a12(0xb5)],_0x1c94ae),0x0;}catch(_0x5ae033){return handleSDKError(_0x5ae033,_0x1c94ae),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a25_0x203df8(0xfb)]=a25_0x203df8(0x152);['description']=a25_0x203df8(0x166);async[a25_0x203df8(0xbf)](_0x3a3029){const _0x14334b=a25_0x203df8,{options:_0xbeecc0,args:_0x427f27,tdx:_0x1f65f5}=_0x3a3029;try{const _0x241b72=_0x427f27[0x0],_0x2254f4=resolveLimit(_0xbeecc0['limit'],DEFAULT_LLM_LIMIT),_0x5d8483=await withSpinner('Fetching\x20projects...',()=>_0x1f65f5[_0x14334b(0x155)][_0x14334b(0xe9)](_0x2254f4),{'verbose':_0xbeecc0[_0x14334b(0x11b)]});let _0x236333=_0x5d8483['data'];_0x241b72&&(_0x236333=_0x5d8483[_0x14334b(0xb5)][_0x14334b(0xfa)](_0x323dd0=>matchGlobPattern(_0x323dd0[_0x14334b(0xea)][_0x14334b(0xfb)],_0x241b72)));const _0x5d01a6=_0x236333[_0x14334b(0x168)](toLLMProjectInfo);return await handleSDKOutput(_0x5d01a6,_0xbeecc0),0x0;}catch(_0x387f75){return handleSDKError(_0x387f75,_0xbeecc0),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']=a25_0x203df8(0x10c);[a25_0x203df8(0xf9)]='List\x20agents\x20in\x20current\x20project';async[a25_0x203df8(0xbf)](_0x5d261b){const _0x3b1c53=a25_0x203df8,{options:_0x5c32d2,args:_0x1ec95f,tdx:_0x568384}=_0x5d261b;try{const _0x48a5fa=_0x1ec95f[0x0];let _0x3f7483,_0x51ca55=_0x48a5fa;if(_0x48a5fa&&_0x48a5fa[_0x3b1c53(0xba)]('/')){const _0x345721=_0x48a5fa[_0x3b1c53(0x112)]('/');if(_0x345721['length']===0x2){const [_0xb299c1,_0x4d6769]=_0x345721,_0x33bca0=await _0x568384[_0x3b1c53(0x155)]['projects'](),_0x27cb7b=_0x33bca0[_0x3b1c53(0xcc)](_0x3c8bcb=>_0x3c8bcb[_0x3b1c53(0xea)]['name'][_0x3b1c53(0xfd)]()===_0xb299c1[_0x3b1c53(0xfd)]());if(!_0x27cb7b)throw new SDKError(ErrorCode[_0x3b1c53(0xed)],_0x3b1c53(0x150)+_0xb299c1,undefined,{'helpText':_0x3b1c53(0xc5)});_0x3f7483=_0x27cb7b['id'],_0x51ca55=_0x4d6769;}else throw new SDKError(ErrorCode[_0x3b1c53(0x124)],_0x3b1c53(0x14f)+_0x48a5fa,undefined,{'helpText':_0x3b1c53(0xb8)});}else _0x3f7483=await getProjectIdOrDefault(_0x5d261b);const _0x15aa88=await withSpinner(_0x3b1c53(0x14d),()=>_0x568384[_0x3b1c53(0x155)][_0x3b1c53(0x174)](_0x3f7483),{'verbose':_0x5c32d2[_0x3b1c53(0x11b)]});let _0x79db6c=_0x15aa88[_0x3b1c53(0xb5)];_0x51ca55&&(_0x79db6c=_0x15aa88[_0x3b1c53(0xb5)][_0x3b1c53(0xfa)](_0x191243=>matchGlobPattern(_0x191243[_0x3b1c53(0xea)][_0x3b1c53(0xfb)],_0x51ca55)));const _0x12bdb5=_0x79db6c[_0x3b1c53(0x168)](toAgentInfo);return await handleSDKOutput(_0x12bdb5,_0x5c32d2),0x0;}catch(_0x2f1d23){return handleSDKError(_0x2f1d23,_0x5c32d2),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']=a25_0x203df8(0x103);[a25_0x203df8(0xf9)]='Show\x20agent\x20details';async[a25_0x203df8(0xbf)](_0x2eb279){const _0x450751=a25_0x203df8,{options:_0x525613,args:_0x2e01d3,tdx:_0x2a62f5}=_0x2eb279;if(_0x2e01d3[_0x450751(0xd7)]===0x0)return console[_0x450751(0xce)](_0x450751(0x146)),console[_0x450751(0xce)](_0x450751(0xc3)),0x1;const _0xff8bb=_0x2e01d3[0x0];try{const _0x5e23e0=await getProjectIdOrDefault(_0x2eb279),_0x5976cd=await withSpinner(_0x450751(0x110)+_0xff8bb+'\x27...',()=>_0x2a62f5[_0x450751(0x155)][_0x450751(0xdd)](_0xff8bb,_0x5e23e0),{'verbose':_0x525613[_0x450751(0x11b)]}),_0x3aa993=await withSpinner('Fetching\x20agent...',()=>_0x2a62f5['llm']['agent'](_0x5976cd[_0x450751(0xb5)]),{'verbose':_0x525613[_0x450751(0x11b)]});return await handleSDKOutput([_0x3aa993[_0x450751(0xb5)]],_0x525613),0x0;}catch(_0x285db0){return handleSDKError(_0x285db0,_0x525613),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{['name']='llm:agent:create';[a25_0x203df8(0xf9)]=a25_0x203df8(0x156);async[a25_0x203df8(0xbf)](_0x200bc6){const _0x12c140=a25_0x203df8,{options:_0xb3fbf4,args:_0x14ea97,tdx:_0xafac77}=_0x200bc6;if(_0x14ea97[_0x12c140(0xd7)]===0x0)return console[_0x12c140(0xce)](_0x12c140(0x146)),console[_0x12c140(0xce)]('Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]'),console[_0x12c140(0xce)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]'),0x1;const _0x2e465b=_0x14ea97[0x0],_0x5e2e5b=_0xb3fbf4,_0x4bd0f5=_0x5e2e5b[_0x12c140(0xf2)],_0x34027b=_0x5e2e5b[_0x12c140(0xc9)]||'claude-4.5-haiku',_0xa4dea9=_0x5e2e5b['starterMessage'],_0x2f616e=_0x5e2e5b['maxToolIterations']?Number(_0x5e2e5b['maxToolIterations']):undefined,_0x3f77cf=_0x5e2e5b[_0x12c140(0xbe)]?Number(_0x5e2e5b[_0x12c140(0xbe)]):undefined;try{let _0x9e1832,_0x25e8ff;if(_0x2e465b[_0x12c140(0xba)]('/')){const _0x5bb508=_0x2e465b[_0x12c140(0x112)]('/');if(_0x5bb508['length']===0x2){const [_0x479122,_0x5cca36]=_0x5bb508,_0x4814d8=await withSpinner(_0x12c140(0x123)+_0x479122+'\x27...',()=>_0xafac77[_0x12c140(0x155)][_0x12c140(0x15f)](_0x479122),{'verbose':_0xb3fbf4[_0x12c140(0x11b)]});_0x9e1832=_0x4814d8['data'],_0x25e8ff=_0x5cca36;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x12c140(0x14f)+_0x2e465b,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x9e1832=await getProjectIdOrDefault(_0x200bc6),_0x25e8ff=_0x2e465b;const _0x4d67c1=await withSpinner(_0x12c140(0xcb)+_0x25e8ff+_0x12c140(0xcd),()=>_0xafac77[_0x12c140(0x155)][_0x12c140(0x16a)]({'name':_0x25e8ff,'projectId':_0x9e1832,'modelType':_0x34027b,'systemPrompt':_0x4bd0f5,'starterMessage':_0xa4dea9,'maxToolIterations':_0x2f616e,'temperature':_0x3f77cf}),{'verbose':_0xb3fbf4[_0x12c140(0x11b)]});return console[_0x12c140(0xe7)](_0x12c140(0x145)+_0x4d67c1[_0x12c140(0xb5)]['id']),await handleSDKOutput([_0x4d67c1['data']],_0xb3fbf4),0x0;}catch(_0x40c0e5){return handleSDKError(_0x40c0e5,_0xb3fbf4),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{['name']=a25_0x203df8(0xec);[a25_0x203df8(0xf9)]=a25_0x203df8(0x130);async[a25_0x203df8(0xbf)](_0x38400f){const _0x26d1e3=a25_0x203df8,{options:_0x358682,args:_0x150184,tdx:_0x37ff02}=_0x38400f;if(_0x150184[_0x26d1e3(0xd7)]===0x0)return console[_0x26d1e3(0xce)]('Error:\x20Agent\x20name\x20is\x20required'),console['error'](_0x26d1e3(0x13d)),0x1;const _0x503fa8=_0x150184[0x0],_0x17a662=_0x358682,_0x127b97=_0x17a662[_0x26d1e3(0xfb)],_0x3f5ad6=_0x17a662[_0x26d1e3(0xd9)],_0x34ea39=_0x17a662[_0x26d1e3(0xf9)],_0x119d46=_0x17a662['starterMessage'];if(!_0x127b97&&!_0x3f5ad6&&!_0x34ea39&&!_0x119d46)return console[_0x26d1e3(0xce)](_0x26d1e3(0xeb)),console['error'](_0x26d1e3(0x10d)),0x1;try{const _0x2f93b8=await getProjectIdOrDefault(_0x38400f),_0x53bcee=await withSpinner(_0x26d1e3(0x110)+_0x503fa8+_0x26d1e3(0xcd),()=>_0x37ff02[_0x26d1e3(0x155)][_0x26d1e3(0xdd)](_0x503fa8,_0x2f93b8),{'verbose':_0x358682[_0x26d1e3(0x11b)]}),_0xbc1e1d=_0x53bcee[_0x26d1e3(0xb5)],_0x57b25d=await withSpinner(_0x26d1e3(0x134),()=>_0x37ff02[_0x26d1e3(0x155)][_0x26d1e3(0x13a)](_0xbc1e1d,{'name':_0x127b97,'prompt':_0x3f5ad6,'description':_0x34ea39,'starterMessage':_0x119d46}),{'verbose':_0x358682['verbose']});return console[_0x26d1e3(0xe7)](_0x26d1e3(0xb7)+_0x57b25d[_0x26d1e3(0xb5)]['id']),await handleSDKOutput([_0x57b25d[_0x26d1e3(0xb5)]],_0x358682),0x0;}catch(_0x58edb4){return handleSDKError(_0x58edb4,_0x358682),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']=a25_0x203df8(0x17a);[a25_0x203df8(0xf9)]='Delete\x20an\x20agent';async[a25_0x203df8(0xbf)](_0x2ab8dc){const _0x4305e2=a25_0x203df8,{options:_0x3bceee,args:_0xf116e,tdx:_0x3a9597}=_0x2ab8dc;if(_0xf116e['length']===0x0)return console[_0x4305e2(0xce)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x4305e2(0xce)](_0x4305e2(0xd5)),0x1;const _0x583e32=_0xf116e[0x0];try{const _0x1fda7c=await getProjectIdOrDefault(_0x2ab8dc),_0x1a4ad1=await withSpinner(_0x4305e2(0x110)+_0x583e32+'\x27...',()=>_0x3a9597[_0x4305e2(0x155)][_0x4305e2(0xdd)](_0x583e32,_0x1fda7c),{'verbose':_0x3bceee[_0x4305e2(0x11b)]}),_0x531cac=_0x1a4ad1[_0x4305e2(0xb5)];return await withSpinner(_0x4305e2(0x15d),()=>_0x3a9597[_0x4305e2(0x155)]['deleteAgent'](_0x531cac),{'verbose':_0x3bceee[_0x4305e2(0x11b)]}),console[_0x4305e2(0xe7)]('Agent\x20deleted:\x20'+_0x531cac),0x0;}catch(_0x486449){return handleSDKError(_0x486449,_0x3bceee),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a25_0x203df8(0xfb)]='llm:history';[a25_0x203df8(0xf9)]=a25_0x203df8(0x147);async[a25_0x203df8(0xbf)](_0x5da60f){const _0x225996=a25_0x203df8;return executeChatHistoryCommand(_0x5da60f,_0x225996(0xd6));}}export class LLMUseCommand extends BaseCommand{[a25_0x203df8(0xfb)]=a25_0x203df8(0x14b);[a25_0x203df8(0xf9)]=a25_0x203df8(0x116);async[a25_0x203df8(0xbf)](_0x54ed96){const _0x2b0f16=a25_0x203df8,{options:_0x184951,args:_0x42b561,tdx:_0x6479f5}=_0x54ed96;if(_0x42b561['length']===0x0)return console[_0x2b0f16(0xce)](_0x2b0f16(0x109)),console[_0x2b0f16(0xce)](_0x2b0f16(0xd3)),0x1;const _0x1f9a64=_0x42b561[0x0];try{return await withSpinner(_0x2b0f16(0xe8)+_0x1f9a64+'\x27...',()=>_0x6479f5['llm'][_0x2b0f16(0x15a)](_0x1f9a64),{'verbose':_0x184951[_0x2b0f16(0x11b)]}),console[_0x2b0f16(0xe7)]('Project\x20context\x20set\x20to:\x20'+_0x1f9a64),0x0;}catch(_0x226b26){return handleSDKError(_0x226b26,_0x184951),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a25_0x203df8(0xfb)]=a25_0x203df8(0xc2);[a25_0x203df8(0xf9)]=a25_0x203df8(0x14a);async[a25_0x203df8(0xbf)](_0x32fa48){const _0xc87100=a25_0x203df8,{options:_0x36a3a7,args:_0x13d1a4,tdx:_0x62b84d}=_0x32fa48;if(_0x13d1a4[_0xc87100(0xd7)]===0x0)return console[_0xc87100(0xce)](_0xc87100(0x109)),console['error'](_0xc87100(0xd2)),0x1;const _0x551438=_0x13d1a4[0x0],_0x17f0cb=_0x36a3a7,_0x35e8ef=_0x17f0cb['description'];try{const _0x4d7998=await withSpinner(_0xc87100(0xf8)+_0x551438+_0xc87100(0xcd),()=>_0x62b84d[_0xc87100(0x155)][_0xc87100(0xdc)]({'name':_0x551438,'description':_0x35e8ef}),{'verbose':_0x36a3a7[_0xc87100(0x11b)]});console[_0xc87100(0xe7)]('Project\x20created:\x20'+_0x4d7998[_0xc87100(0xb5)]['id']);const _0x15d7c0=toLLMProjectInfo(_0x4d7998['data']);return await handleSDKOutput([_0x15d7c0],_0x36a3a7),0x0;}catch(_0x36c461){return handleSDKError(_0x36c461,_0x36a3a7),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a25_0x203df8(0xfb)]=a25_0x203df8(0x13c);[a25_0x203df8(0xf9)]='Delete\x20an\x20LLM\x20project';async['execute'](_0x300938){const _0x5ca846=a25_0x203df8,{options:_0xeebc05,args:_0x185ac0,tdx:_0xe9f98d}=_0x300938;if(_0x185ac0[_0x5ca846(0xd7)]===0x0)return console[_0x5ca846(0xce)](_0x5ca846(0x109)),console['error']('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x3a3016=_0x185ac0[0x0];try{return await withSpinner(_0x5ca846(0x120)+_0x3a3016+_0x5ca846(0xcd),()=>_0xe9f98d[_0x5ca846(0x155)]['deleteProject'](_0x3a3016),{'verbose':_0xeebc05[_0x5ca846(0x11b)]}),console[_0x5ca846(0xe7)]('Project\x20deleted:\x20'+_0x3a3016),0x0;}catch(_0x1075b0){return handleSDKError(_0x1075b0,_0xeebc05),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a25_0x203df8(0x143);[a25_0x203df8(0xf9)]=a25_0x203df8(0x133);async['execute'](_0xed5640){const _0x3563cb=a25_0x203df8,{options:_0x2a9e82,args:_0x1a2c51,tdx:_0x5c1272}=_0xed5640;if(_0x1a2c51['length']===0x0)return console[_0x3563cb(0xce)](_0x3563cb(0x109)),console[_0x3563cb(0xce)]('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0x43803b=_0x1a2c51[0x0],_0x13e19a=_0x2a9e82,_0x3318f9=_0x13e19a[_0x3563cb(0x13b)],_0x4f885b=_0x13e19a[_0x3563cb(0x160)];try{const _0x823ca4=_0x3318f9||_0x43803b+_0x3563cb(0xcf);if(a25_0x20bc81['existsSync'](_0x823ca4)&&!_0x4f885b){if(!_0x2a9e82[_0x3563cb(0xc0)]){const _0x3b8382=await confirm(_0x3563cb(0xc6)+_0x823ca4+_0x3563cb(0xb4));if(!_0x3b8382)return console['log']('Backup\x20cancelled.'),0x0;}a25_0x20bc81[_0x3563cb(0x118)](_0x823ca4,{'recursive':!![]});}const _0x57588d=await withSpinner(_0x4f885b?_0x3563cb(0x164)+_0x43803b+_0x3563cb(0xcd):_0x3563cb(0x139)+_0x43803b+_0x3563cb(0xcd),()=>_0x5c1272[_0x3563cb(0x155)]['backupProject'](_0x43803b,_0x3318f9,{'dryRun':_0x4f885b}),{'verbose':_0x2a9e82['verbose']}),_0x54fe7=_0x57588d['data'];return _0x4f885b?console['log']('[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20'+_0x54fe7[_0x3563cb(0x105)]):console[_0x3563cb(0xe7)](_0x3563cb(0x15e)+_0x54fe7['outputDir']),console[_0x3563cb(0xe7)](_0x3563cb(0x11d)+_0x54fe7[_0x3563cb(0x157)]['agents']),console['log']('\x20\x20Knowledge\x20Bases:\x20'+_0x54fe7[_0x3563cb(0x157)]['knowledgeBases']),console[_0x3563cb(0xe7)](_0x3563cb(0xf3)+_0x54fe7['counts'][_0x3563cb(0xf4)]),console[_0x3563cb(0xe7)](_0x3563cb(0x128)+_0x54fe7['counts']['integrations']),(_0x2a9e82['format']===_0x3563cb(0x10b)||_0x2a9e82[_0x3563cb(0x13f)]===_0x3563cb(0xee))&&await handleSDKOutput([_0x54fe7],_0x2a9e82),0x0;}catch(_0xaee5f7){return handleSDKError(_0xaee5f7,_0x2a9e82),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a25_0x203df8(0xfb)]='llm:project:restore';[a25_0x203df8(0xf9)]=a25_0x203df8(0xbb);async['execute'](_0x1ee019){const _0x147b96=a25_0x203df8,{options:_0x16c1f3,args:_0x45dced,tdx:_0x463279}=_0x1ee019;if(_0x45dced[_0x147b96(0xd7)]===0x0)return console[_0x147b96(0xce)](_0x147b96(0x167)),console[_0x147b96(0xce)](_0x147b96(0x114)),0x1;const _0x1a0419=_0x45dced[0x0],_0xf02290=_0x16c1f3,_0xca93f8=_0xf02290['name'],_0x55acfd=_0xf02290['dryRun'];try{if(!_0x55acfd){const _0x4796c7=_0x463279['llm'][_0x147b96(0x12c)](_0x1a0419),_0x47ed65=_0xca93f8||_0x4796c7[_0x147b96(0x12b)][_0x147b96(0xfe)],_0x10aaba=await withSpinner(_0x147b96(0x148),()=>_0x463279[_0x147b96(0x155)][_0x147b96(0xe9)](),{'verbose':_0x16c1f3[_0x147b96(0x11b)]}),_0xa9ff1=_0x10aaba[_0x147b96(0xb5)][_0x147b96(0xcc)](_0x4af3b3=>_0x4af3b3['attributes'][_0x147b96(0xfb)]===_0x47ed65);if(_0xa9ff1&&!_0x16c1f3[_0x147b96(0xc0)]){const _0x17e623=await confirm('A\x20project\x20named\x20\x27'+_0x47ed65+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x17e623)return console[_0x147b96(0xe7)](_0x147b96(0x161)),0x0;}}const _0x2d7d80=await withSpinner(_0x55acfd?'Validating\x20backup\x20from\x20\x27'+_0x1a0419+'\x27...':_0x147b96(0x131)+_0x1a0419+_0x147b96(0xcd),()=>_0x463279[_0x147b96(0x155)][_0x147b96(0x171)](_0x1a0419,{'name':_0xca93f8,'dryRun':_0x55acfd}),{'verbose':_0x16c1f3[_0x147b96(0x11b)]}),_0x10c23e=_0x2d7d80['data'];return _0x10c23e[_0x147b96(0x15c)]&&console[_0x147b96(0xe7)](_0x147b96(0x12d)+_0x10c23e[_0x147b96(0x15c)]+'\x27'),_0x55acfd?console[_0x147b96(0xe7)](_0x147b96(0xde)+_0x10c23e[_0x147b96(0xfe)]):console['log'](_0x147b96(0x11e)+_0x10c23e['projectName']+'\x20('+_0x10c23e['projectId']+')'),console[_0x147b96(0xe7)](_0x147b96(0x11d)+_0x10c23e[_0x147b96(0x157)][_0x147b96(0x174)]),console[_0x147b96(0xe7)](_0x147b96(0x16b)+_0x10c23e['counts'][_0x147b96(0xf1)]),console['log']('\x20\x20Prompts:\x20'+_0x10c23e[_0x147b96(0x157)]['prompts']),console[_0x147b96(0xe7)]('\x20\x20Integrations:\x20'+_0x10c23e['counts'][_0x147b96(0xf6)]),(_0x16c1f3['format']===_0x147b96(0x10b)||_0x16c1f3[_0x147b96(0x13f)]==='jsonl')&&await handleSDKOutput([_0x10c23e],_0x16c1f3),0x0;}catch(_0x21290e){return handleSDKError(_0x21290e,_0x16c1f3),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x114172,_0x2ebc62){const _0x18226c=a25_0x203df8,_0x15faae=_0x2ebc62['limit']||CHAT_SELECTOR_PAGE_SIZE;let _0xc2e239=0x0,_0x24fb30=[];const _0x36ec11=(await import('prompts'))[_0x18226c(0x115)],_0x51fb65=getChalk(_0x2ebc62);while(!![]){const _0x2f1066=await withSpinner(_0x18226c(0x106),()=>_0x114172[_0x18226c(0x155)][_0x18226c(0x125)](_0x15faae+_0xc2e239),{'verbose':_0x2ebc62[_0x18226c(0x11b)]});_0x24fb30=_0x2f1066[_0x18226c(0xb5)];const _0x52ecfd=_0x24fb30[_0x18226c(0xca)](_0xc2e239,_0xc2e239+_0x15faae),_0x22f7d5=_0x24fb30[_0x18226c(0xd7)]>_0xc2e239+_0x15faae,_0xe43126=[...new Set(_0x52ecfd['map'](_0xfa7db4=>_0xfa7db4[_0x18226c(0xea)][_0x18226c(0xff)])[_0x18226c(0xfa)](_0x222fad=>_0x222fad!==undefined))],_0x3cbc6a=new Map();await Promise['all'](_0xe43126[_0x18226c(0x168)](async _0x2d427c=>{const _0x3ad529=_0x18226c;try{const _0x4cbbd5=await _0x114172['llm'][_0x3ad529(0xb6)](_0x2d427c);_0x3cbc6a[_0x3ad529(0x11a)](_0x2d427c,_0x4cbbd5['attributes'][_0x3ad529(0xfb)]);}catch{_0x3cbc6a[_0x3ad529(0x11a)](_0x2d427c,_0x2d427c);}}));const _0x6c0311=_0x52ecfd[_0x18226c(0x168)](_0x486dc2=>{const _0x1249fa=_0x18226c,_0x4b1fa5=_0x486dc2[_0x1249fa(0xea)][_0x1249fa(0x16f)]||_0x1249fa(0x15b),_0x9c01da=_0x4b1fa5['split']('\x0a')[0x0],_0x3563d4=_0x9c01da[_0x1249fa(0xd7)]>0x50?_0x9c01da[_0x1249fa(0xfc)](0x0,0x4d)+_0x1249fa(0x12a):_0x9c01da,_0x1ab69c=_0x486dc2[_0x1249fa(0xea)][_0x1249fa(0xff)]?_0x3cbc6a[_0x1249fa(0x137)](_0x486dc2[_0x1249fa(0xea)]['agentId'])||_0x486dc2['attributes'][_0x1249fa(0xff)]:'(no\x20agent)',_0x577d1b=_0x486dc2[_0x1249fa(0xea)]['lastConversationAt']||_0x486dc2[_0x1249fa(0xea)][_0x1249fa(0xd4)],_0x3a7d58=new Date(_0x577d1b),_0x10e7bd=new Date(),_0x12cd48=_0x10e7bd[_0x1249fa(0x175)]()-_0x3a7d58[_0x1249fa(0x175)](),_0x2fb69a=Math[_0x1249fa(0x129)](_0x12cd48/0xea60),_0x376071=Math[_0x1249fa(0x129)](_0x12cd48/0x36ee80),_0x5dcff2=Math['floor'](_0x12cd48/0x5265c00);let _0x1825c2;if(_0x2fb69a<0x1)_0x1825c2=_0x1249fa(0x132);else{if(_0x2fb69a<0x3c)_0x1825c2=_0x2fb69a+_0x1249fa(0xe2);else{if(_0x376071<0x18)_0x1825c2=_0x376071+_0x1249fa(0x158);else _0x5dcff2<0x7?_0x1825c2=_0x5dcff2+_0x1249fa(0x172):_0x1825c2=_0x3a7d58[_0x1249fa(0x135)](_0x1249fa(0x119),{'month':'short','day':_0x1249fa(0x117)});}}return{'title':_0x3563d4+'\x20'+_0x51fb65[_0x1249fa(0xe1)]('['+_0x1ab69c+']\x20'+_0x1825c2),'value':_0x486dc2['id']};});_0x22f7d5&&_0x6c0311[_0x18226c(0x102)]({'title':_0x51fb65['cyan'](_0x18226c(0x14e)),'value':'__load_more__'});const _0x2d6841=await _0x36ec11({'type':_0x18226c(0x140),'name':_0x18226c(0xe5),'message':_0x18226c(0x165),'choices':_0x6c0311,'hint':_0x18226c(0xd1)});if(!_0x2d6841[_0x18226c(0xe5)])return undefined;if(_0x2d6841['chatId']===_0x18226c(0x12e)){_0xc2e239+=_0x15faae;continue;}return _0x2d6841[_0x18226c(0xe5)];}}export class ChatsCommand extends BaseCommand{[a25_0x203df8(0xfb)]='chats';[a25_0x203df8(0xf9)]=a25_0x203df8(0x104);async[a25_0x203df8(0xbf)](_0x32b030){const _0x1a7659=a25_0x203df8;return executeChatHistoryCommand(_0x32b030,_0x1a7659(0x178));}}
@@ -1 +1 @@
1
- const a26_0x3d1013=a26_0x3dae;function a26_0x574e(){const _0x1b392e=['llmProject','exit','logLevel','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','\x27\x20not\x20found','117678nQQyKJ','Port\x20','close','\x20\x20Agents:','find','6583640GDAMBl','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','Starting\x20proxy\x20server...','yellow','1345074znYLqJ','\x20\x20Site:','llm','\x0a\x0aShutting\x20down\x20proxy\x20server...','NOT_FOUND','attributes','dim','Resolving\x20project...','http://0.0.0.0:','execute','port','bold','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','\x20\x20Project:','stop','name','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','8806875ypLsAS','logger','\x20is\x20unavailable,\x20using\x20port\x20','start','white','project','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','23970248WNhbjh','log','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','init','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','1238718jDfAIh','\x20\x20\x20\x20\x22env\x22:\x20{','server','\x20\x20Address:','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','description','Server\x20Configuration:','\x20\x20{','llm:proxy','\x20\x20}','1203430vebNCl','SIGTERM','SIGINT','cyan','projects','site','Project\x20\x27','5wyvGSI'];a26_0x574e=function(){return _0x1b392e;};return a26_0x574e();}function a26_0x3dae(_0x5bdb3c,_0x32e531){_0x5bdb3c=_0x5bdb3c-0x144;const _0x574e81=a26_0x574e();let _0x3dae49=_0x574e81[_0x5bdb3c];return _0x3dae49;}(function(_0x4cc44f,_0x479db3){const _0x18eea9=a26_0x3dae,_0x54e271=_0x4cc44f();while(!![]){try{const _0x49a643=parseInt(_0x18eea9(0x150))/0x1+-parseInt(_0x18eea9(0x15a))/0x2+parseInt(_0x18eea9(0x168))/0x3+-parseInt(_0x18eea9(0x16d))/0x4+parseInt(_0x18eea9(0x161))/0x5*(parseInt(_0x18eea9(0x171))/0x6)+-parseInt(_0x18eea9(0x144))/0x7+parseInt(_0x18eea9(0x14b))/0x8;if(_0x49a643===_0x479db3)break;else _0x54e271['push'](_0x54e271['shift']());}catch(_0x3c4fa8){_0x54e271['push'](_0x54e271['shift']());}}}(a26_0x574e,0xf258e));import a26_0x1ac561 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x555524,_0x43f6d7){const _0x12227f=a26_0x3dae,{tdx:_0x2b7a88,options:_0x401d82}=_0x555524,_0x1d45d1=_0x43f6d7||_0x401d82[_0x12227f(0x162)];if(_0x1d45d1){const _0xc72270=await _0x2b7a88[_0x12227f(0x173)][_0x12227f(0x15e)](),_0x5b2b83=_0xc72270['find'](_0xdaade4=>_0xdaade4[_0x12227f(0x176)][_0x12227f(0x180)]===_0x1d45d1);if(!_0x5b2b83)throw new SDKError(ErrorCode[_0x12227f(0x175)],_0x12227f(0x160)+_0x1d45d1+_0x12227f(0x167),undefined,{'helpText':_0x12227f(0x14a)});return _0x5b2b83['id'];}const _0xf9f07b=await _0x2b7a88[_0x12227f(0x173)]['getOrCreateDefaultProject']();return _0xf9f07b['id'];}export class LLMProxyCommand extends BaseCommand{[a26_0x3d1013(0x180)]=a26_0x3d1013(0x158);[a26_0x3d1013(0x155)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a26_0x3d1013(0x152)];['logger'];async[a26_0x3d1013(0x17a)](_0x1f03e9){const _0x4946fa=a26_0x3d1013,{tdx:_0x346c80,options:_0x16b66b}=_0x1f03e9;try{const _0x400864=_0x16b66b,_0x5725a7=_0x400864[_0x4946fa(0x17b)]||0xfa0,_0x33671e=_0x400864[_0x4946fa(0x149)],_0x1dfd74=await findAvailablePort(_0x5725a7);console[_0x4946fa(0x14c)](a26_0x1ac561[_0x4946fa(0x177)](_0x4946fa(0x178)));const _0x1dd0cd=await getProjectIdOrDefault(_0x1f03e9,_0x33671e),_0xf0a6b3=await _0x346c80[_0x4946fa(0x173)][_0x4946fa(0x15e)](),_0x43e310=_0xf0a6b3[_0x4946fa(0x16c)](_0x2898a0=>_0x2898a0['id']===_0x1dd0cd);this[_0x4946fa(0x145)]=new TDXLogger(_0x16b66b[_0x4946fa(0x164)]),await this[_0x4946fa(0x145)][_0x4946fa(0x14e)](),console[_0x4946fa(0x14c)](a26_0x1ac561[_0x4946fa(0x177)](_0x4946fa(0x16f)));_0x1dfd74!==_0x5725a7&&console['log'](a26_0x1ac561[_0x4946fa(0x170)](_0x4946fa(0x169)+_0x5725a7+_0x4946fa(0x146)+_0x1dfd74));this[_0x4946fa(0x152)]=new ProxyServer({'port':_0x1dfd74,'projectId':_0x1dd0cd,'tdx':_0x346c80,'logger':this[_0x4946fa(0x145)],'site':_0x16b66b[_0x4946fa(0x15f)]}),await this[_0x4946fa(0x152)][_0x4946fa(0x147)](),console[_0x4946fa(0x14c)](a26_0x1ac561[_0x4946fa(0x170)][_0x4946fa(0x17c)](_0x4946fa(0x16e))),console['log'](a26_0x1ac561['yellow'](_0x4946fa(0x165))),console[_0x4946fa(0x14c)](a26_0x1ac561[_0x4946fa(0x170)]('Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a')),console[_0x4946fa(0x14c)](a26_0x1ac561['green'][_0x4946fa(0x17c)](_0x4946fa(0x14f))),console['log'](a26_0x1ac561[_0x4946fa(0x15d)](_0x4946fa(0x156))),console['log'](a26_0x1ac561[_0x4946fa(0x177)](_0x4946fa(0x153)),a26_0x1ac561[_0x4946fa(0x148)](_0x4946fa(0x179)+_0x1dfd74)),console[_0x4946fa(0x14c)](a26_0x1ac561['dim'](_0x4946fa(0x17e)),a26_0x1ac561['white'](_0x43e310?.[_0x4946fa(0x176)]['name']||_0x1dd0cd)),console[_0x4946fa(0x14c)](a26_0x1ac561[_0x4946fa(0x177)](_0x4946fa(0x16b)),a26_0x1ac561['white']('created\x20on-demand\x20per\x20model')),console['log'](a26_0x1ac561[_0x4946fa(0x177)](_0x4946fa(0x172)),a26_0x1ac561['white'](_0x16b66b['site'])),console['log'](a26_0x1ac561[_0x4946fa(0x15d)]('\x0aClaude\x20Code\x20Configuration:')),console['log'](a26_0x1ac561[_0x4946fa(0x177)](_0x4946fa(0x181))),console['log'](a26_0x1ac561[_0x4946fa(0x148)](_0x4946fa(0x157))),console[_0x4946fa(0x14c)](a26_0x1ac561[_0x4946fa(0x148)](_0x4946fa(0x151))),console['log'](a26_0x1ac561['white'](_0x4946fa(0x17d)+_0x1dfd74+'\x22,')),console[_0x4946fa(0x14c)](a26_0x1ac561[_0x4946fa(0x148)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22')),console['log'](a26_0x1ac561[_0x4946fa(0x148)]('\x20\x20\x20\x20}')),console[_0x4946fa(0x14c)](a26_0x1ac561['white'](_0x4946fa(0x159))),console[_0x4946fa(0x14c)](a26_0x1ac561[_0x4946fa(0x15d)]('\x0aTesting\x20with\x20Agent\x20SDK:')),console[_0x4946fa(0x14c)](a26_0x1ac561['dim'](_0x4946fa(0x154))),console[_0x4946fa(0x14c)](a26_0x1ac561[_0x4946fa(0x177)](_0x4946fa(0x166))),console['log'](a26_0x1ac561[_0x4946fa(0x177)]('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console['log'](a26_0x1ac561[_0x4946fa(0x170)](_0x4946fa(0x14d)));const _0x3d983b=async()=>{const _0xde86ea=_0x4946fa;console[_0xde86ea(0x14c)](a26_0x1ac561[_0xde86ea(0x177)](_0xde86ea(0x174))),this[_0xde86ea(0x152)]&&await this[_0xde86ea(0x152)][_0xde86ea(0x17f)](),this[_0xde86ea(0x145)]&&await this[_0xde86ea(0x145)][_0xde86ea(0x16a)](),console['log'](a26_0x1ac561['green']('✓\x20Proxy\x20server\x20stopped')),process[_0xde86ea(0x163)](0x0);};return process['on'](_0x4946fa(0x15c),_0x3d983b),process['on'](_0x4946fa(0x15b),_0x3d983b),await new Promise(()=>{}),0x0;}catch(_0x43e0e0){this[_0x4946fa(0x152)]&&await this[_0x4946fa(0x152)]['stop']();this[_0x4946fa(0x145)]&&await this[_0x4946fa(0x145)][_0x4946fa(0x16a)]();throw _0x43e0e0;}}}
1
+ const a26_0x3c7251=a26_0x5b58;(function(_0x1e0748,_0x30005e){const _0x5a2deb=a26_0x5b58,_0x2f30e4=_0x1e0748();while(!![]){try{const _0x303dc6=-parseInt(_0x5a2deb(0x19e))/0x1+-parseInt(_0x5a2deb(0x1b5))/0x2*(-parseInt(_0x5a2deb(0x17f))/0x3)+parseInt(_0x5a2deb(0x19d))/0x4*(parseInt(_0x5a2deb(0x17b))/0x5)+parseInt(_0x5a2deb(0x193))/0x6*(-parseInt(_0x5a2deb(0x1a2))/0x7)+parseInt(_0x5a2deb(0x180))/0x8+-parseInt(_0x5a2deb(0x179))/0x9*(-parseInt(_0x5a2deb(0x17e))/0xa)+-parseInt(_0x5a2deb(0x1af))/0xb;if(_0x303dc6===_0x30005e)break;else _0x2f30e4['push'](_0x2f30e4['shift']());}catch(_0x54d94e){_0x2f30e4['push'](_0x2f30e4['shift']());}}}(a26_0x1b44,0x9052f));import a26_0x49ac94 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';function a26_0x5b58(_0xdd951e,_0x27b89d){_0xdd951e=_0xdd951e-0x173;const _0x1b44b1=a26_0x1b44();let _0x5b5817=_0x1b44b1[_0xdd951e];return _0x5b5817;}function a26_0x1b44(){const _0x2d8348=['765685yisGkS','yellow','Starting\x20proxy\x20server...','1013730nQcOmS','33INocYk','4064048aVAMlm','created\x20on-demand\x20per\x20model','Project\x20\x27','http://0.0.0.0:','\x20\x20}','\x0aTesting\x20with\x20Agent\x20SDK:','description','SIGINT','find','start','exit','execute','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','Server\x20Configuration:','\x0a\x0aShutting\x20down\x20proxy\x20server...','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','init','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','attributes','1890HUdPBN','SIGTERM','site','name','\x0aClaude\x20Code\x20Configuration:','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22','white','bold','Resolving\x20project...','log','12rFTDvP','59247WbSoVO','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','llm:proxy','✓\x20Proxy\x20server\x20stopped','8953bwWAii','port','green','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20\x20\x20\x20}','NOT_FOUND','Port\x20','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','\x20\x20Address:','\x20\x20\x20\x20\x22env\x22:\x20{','logLevel','dim','project','14531231GsDDZA','logger','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','close','cyan','server','108346gEbikD','stop','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','\x20\x20Site:','\x20\x20{','llm','72umTKOl','projects'];a26_0x1b44=function(){return _0x2d8348;};return a26_0x1b44();}import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x543537,_0x2b7bb0){const _0x31b3f4=a26_0x5b58,{tdx:_0x385509,options:_0x59adbc}=_0x543537,_0x14444b=_0x2b7bb0||_0x59adbc['llmProject'];if(_0x14444b){const _0x223604=await _0x385509[_0x31b3f4(0x178)][_0x31b3f4(0x17a)](),_0x530885=_0x223604[_0x31b3f4(0x188)](_0x4e803e=>_0x4e803e[_0x31b3f4(0x192)]['name']===_0x14444b);if(!_0x530885)throw new SDKError(ErrorCode[_0x31b3f4(0x1a7)],_0x31b3f4(0x182)+_0x14444b+'\x27\x20not\x20found',undefined,{'helpText':_0x31b3f4(0x1a5)});return _0x530885['id'];}const _0x294923=await _0x385509['llm']['getOrCreateDefaultProject']();return _0x294923['id'];}export class LLMProxyCommand extends BaseCommand{['name']=a26_0x3c7251(0x1a0);[a26_0x3c7251(0x186)]=a26_0x3c7251(0x175);[a26_0x3c7251(0x1b4)];[a26_0x3c7251(0x1b0)];async[a26_0x3c7251(0x18b)](_0x4b1b48){const _0x11bdfb=a26_0x3c7251,{tdx:_0x1d7823,options:_0x475888}=_0x4b1b48;try{const _0x4f8480=_0x475888,_0x5e80e6=_0x4f8480[_0x11bdfb(0x1a3)]||0xfa0,_0xc6bf76=_0x4f8480[_0x11bdfb(0x1ae)],_0x4de51d=await findAvailablePort(_0x5e80e6);console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1ad)](_0x11bdfb(0x19b)));const _0x2db1e7=await getProjectIdOrDefault(_0x4b1b48,_0xc6bf76),_0x1d8eac=await _0x1d7823[_0x11bdfb(0x178)][_0x11bdfb(0x17a)](),_0x143f3c=_0x1d8eac['find'](_0x4e051e=>_0x4e051e['id']===_0x2db1e7);this[_0x11bdfb(0x1b0)]=new TDXLogger(_0x475888[_0x11bdfb(0x1ac)]),await this[_0x11bdfb(0x1b0)][_0x11bdfb(0x190)](),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1ad)](_0x11bdfb(0x17d)));_0x4de51d!==_0x5e80e6&&console['log'](a26_0x49ac94['yellow'](_0x11bdfb(0x1a8)+_0x5e80e6+'\x20is\x20unavailable,\x20using\x20port\x20'+_0x4de51d));this[_0x11bdfb(0x1b4)]=new ProxyServer({'port':_0x4de51d,'projectId':_0x2db1e7,'tdx':_0x1d7823,'logger':this[_0x11bdfb(0x1b0)],'site':_0x475888[_0x11bdfb(0x195)]}),await this[_0x11bdfb(0x1b4)][_0x11bdfb(0x189)](),console['log'](a26_0x49ac94[_0x11bdfb(0x17c)]['bold']('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console[_0x11bdfb(0x19c)](a26_0x49ac94['yellow'](_0x11bdfb(0x18f))),console[_0x11bdfb(0x19c)](a26_0x49ac94['yellow'](_0x11bdfb(0x174))),console[_0x11bdfb(0x19c)](a26_0x49ac94['green'][_0x11bdfb(0x19a)]('✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a')),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1b3)](_0x11bdfb(0x18d))),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1ad)](_0x11bdfb(0x1aa)),a26_0x49ac94[_0x11bdfb(0x199)](_0x11bdfb(0x183)+_0x4de51d)),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1ad)]('\x20\x20Project:'),a26_0x49ac94['white'](_0x143f3c?.['attributes'][_0x11bdfb(0x196)]||_0x2db1e7)),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1ad)]('\x20\x20Agents:'),a26_0x49ac94[_0x11bdfb(0x199)](_0x11bdfb(0x181))),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1ad)](_0x11bdfb(0x176)),a26_0x49ac94[_0x11bdfb(0x199)](_0x475888[_0x11bdfb(0x195)])),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1b3)](_0x11bdfb(0x197))),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1ad)](_0x11bdfb(0x19f))),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x199)](_0x11bdfb(0x177))),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x199)](_0x11bdfb(0x1ab))),console['log'](a26_0x49ac94[_0x11bdfb(0x199)](_0x11bdfb(0x191)+_0x4de51d+'\x22,')),console[_0x11bdfb(0x19c)](a26_0x49ac94['white'](_0x11bdfb(0x198))),console[_0x11bdfb(0x19c)](a26_0x49ac94['white'](_0x11bdfb(0x1a6))),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x199)](_0x11bdfb(0x184))),console['log'](a26_0x49ac94['cyan'](_0x11bdfb(0x185))),console['log'](a26_0x49ac94[_0x11bdfb(0x1ad)]('\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK')),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1ad)](_0x11bdfb(0x18c))),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x1ad)](_0x11bdfb(0x1a9))),console[_0x11bdfb(0x19c)](a26_0x49ac94[_0x11bdfb(0x17c)](_0x11bdfb(0x1b1)));const _0x49c09f=async()=>{const _0x426f68=_0x11bdfb;console[_0x426f68(0x19c)](a26_0x49ac94[_0x426f68(0x1ad)](_0x426f68(0x18e))),this[_0x426f68(0x1b4)]&&await this[_0x426f68(0x1b4)][_0x426f68(0x173)](),this[_0x426f68(0x1b0)]&&await this[_0x426f68(0x1b0)][_0x426f68(0x1b2)](),console[_0x426f68(0x19c)](a26_0x49ac94[_0x426f68(0x1a4)](_0x426f68(0x1a1))),process[_0x426f68(0x18a)](0x0);};return process['on'](_0x11bdfb(0x187),_0x49c09f),process['on'](_0x11bdfb(0x194),_0x49c09f),await new Promise(()=>{}),0x0;}catch(_0x51dc52){this[_0x11bdfb(0x1b4)]&&await this[_0x11bdfb(0x1b4)][_0x11bdfb(0x173)]();this['logger']&&await this[_0x11bdfb(0x1b0)][_0x11bdfb(0x1b2)]();throw _0x51dc52;}}}
@@ -1 +1 @@
1
- const a27_0x4dd8e0=a27_0xfc7f;(function(_0x1064b3,_0x39236f){const _0x126fca=a27_0xfc7f,_0x466e98=_0x1064b3();while(!![]){try{const _0x56f840=parseInt(_0x126fca(0x13e))/0x1+parseInt(_0x126fca(0x1bf))/0x2+parseInt(_0x126fca(0x217))/0x3*(parseInt(_0x126fca(0x24a))/0x4)+parseInt(_0x126fca(0x136))/0x5+parseInt(_0x126fca(0x189))/0x6*(parseInt(_0x126fca(0x17e))/0x7)+parseInt(_0x126fca(0x1eb))/0x8+-parseInt(_0x126fca(0x18f))/0x9*(parseInt(_0x126fca(0x150))/0xa);if(_0x56f840===_0x39236f)break;else _0x466e98['push'](_0x466e98['shift']());}catch(_0x46fb93){_0x466e98['push'](_0x466e98['shift']());}}}(a27_0x201c,0x496a2));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a27_0xb78e46 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a27_0xfc7f(_0xdc981f,_0x529d70){_0xdc981f=_0xdc981f-0x12f;const _0x201cd0=a27_0x201c();let _0xfc7fbb=_0x201cd0[_0xdc981f];return _0xfc7fbb;}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a27_0x580f47 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';const PARENT_SEGMENT_DIR=a27_0x4dd8e0(0x1c5),LEGACY_PARENT_SEGMENT_DIR=a27_0x4dd8e0(0x148);function openBrowser(_0x18eaba){const _0x16dc34=a27_0x4dd8e0,_0x37a571=process[_0x16dc34(0x141)],_0x6a6145=_0x37a571===_0x16dc34(0x1d0)?_0x16dc34(0x239):_0x37a571===_0x16dc34(0x1ca)?_0x16dc34(0x1f8):_0x16dc34(0x16f);spawn(_0x6a6145,[_0x18eaba],{'detached':!![],'stdio':_0x16dc34(0x201)})['unref']();}function sanitizeFileName(_0x568bf7){const _0x5a9bb9=a27_0x4dd8e0;return _0x568bf7[_0x5a9bb9(0x15b)]()['replace'](/[/\\:*?"<>|]/g,'-')[_0x5a9bb9(0x1b6)](/\s+/g,'-')[_0x5a9bb9(0x1b6)](/-+/g,'-')[_0x5a9bb9(0x1b6)](/^-|-$/g,'');}function migrateLegacyDirectory(){const _0x207487=a27_0x4dd8e0;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x18ec75=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x18ec75['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x207487(0x146)](a27_0x580f47[_0x207487(0x1ab)](_0x207487(0x23a)+LEGACY_PARENT_SEGMENT_DIR+_0x207487(0x132)+PARENT_SEGMENT_DIR+_0x207487(0x159))),console[_0x207487(0x146)](a27_0x580f47[_0x207487(0x206)](_0x207487(0x139)+LEGACY_PARENT_SEGMENT_DIR+_0x207487(0x195))),![];console[_0x207487(0x146)](a27_0x580f47[_0x207487(0x1ab)](_0x207487(0x1ad)+LEGACY_PARENT_SEGMENT_DIR+_0x207487(0x21b)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x207487(0x146)](a27_0x580f47[_0x207487(0x1f1)](_0x207487(0x223)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x32bfce){const _0x264ea1=_0x32bfce instanceof Error?_0x32bfce['message']:String(_0x32bfce);return console[_0x207487(0x146)](a27_0x580f47[_0x207487(0x24c)](_0x207487(0x1df)+_0x264ea1+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a27_0x4dd8e0(0x13f)](_0x38cdef){const _0x52fc88=a27_0x4dd8e0;return migrateLegacyDirectory(),super[_0x52fc88(0x13f)](_0x38cdef);}}function resolveYamlFile(_0x3a7706){const _0x4626f6=a27_0x4dd8e0;if(_0x3a7706[_0x4626f6(0x1fc)](_0x4626f6(0x1b9))||_0x3a7706[_0x4626f6(0x1fc)](_0x4626f6(0x16e)))return _0x3a7706;return a27_0xb78e46['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3a7706)+_0x4626f6(0x1b9));}function formatProgressMessage(_0x46e5b6){const _0x446e3e=a27_0x4dd8e0,_0x359c5c=_0x46e5b6[_0x446e3e(0x186)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x359c5c){const [,_0x365380,_0x5741ae,_0x124ddb='']=_0x359c5c;return a27_0x580f47[_0x446e3e(0x206)](_0x365380+':')+'\x20'+_0x5741ae+a27_0x580f47[_0x446e3e(0x206)](_0x124ddb);}return a27_0x580f47['dim'](_0x46e5b6);}function showFileNotFoundError(_0xccaf5e,_0x480dbf){const _0x55e1d5=a27_0x4dd8e0;console[_0x55e1d5(0x146)](a27_0x580f47[_0x55e1d5(0x24c)](_0x55e1d5(0x24d)+_0xccaf5e+'\x0a')),console['error'](a27_0x580f47[_0x55e1d5(0x1c2)](_0x55e1d5(0x1a1)+_0x480dbf+_0x55e1d5(0x15d)));}export class ParentSegmentListCommand extends BaseCommand{[a27_0x4dd8e0(0x210)]=a27_0x4dd8e0(0x174);[a27_0x4dd8e0(0x21f)]=a27_0x4dd8e0(0x218);async[a27_0x4dd8e0(0x165)](_0x24673e){const _0x17abde=a27_0x4dd8e0,{options:_0x517c2d,args:_0x18c46d,tdx:_0x2aa3a2}=_0x24673e,_0x5cacfb=_0x18c46d[0x0];_0x517c2d[_0x17abde(0x23b)]&&(console[_0x17abde(0x146)](_0x17abde(0x1f9)+_0x517c2d['site']),_0x5cacfb&&console[_0x17abde(0x146)](_0x17abde(0x234)+_0x5cacfb));const _0x2bf7ab=await withSpinner(_0x5cacfb?_0x17abde(0x184)+_0x5cacfb+_0x17abde(0x23f):'Listing\x20parent\x20segments...',()=>_0x2aa3a2[_0x17abde(0x13d)][_0x17abde(0x1e3)](),{'verbose':_0x517c2d[_0x17abde(0x23b)]});let _0x3bd33d=_0x2bf7ab['data'];if(_0x5cacfb){const _0x510290=_0x5cacfb['replace'](/[.+^${}()|[\]\\]/g,_0x17abde(0x18d))[_0x17abde(0x1b6)](/\*/g,'.*')[_0x17abde(0x1b6)](/\?/g,'.'),_0x5ab119=new RegExp('^'+_0x510290+'$','i');_0x3bd33d=_0x3bd33d[_0x17abde(0x222)](_0x2ccdc8=>_0x5ab119[_0x17abde(0x196)](_0x2ccdc8[_0x17abde(0x1db)]['name']));}_0x3bd33d[_0x17abde(0x1dc)]((_0x4e9ea1,_0x16349d)=>_0x4e9ea1['attributes'][_0x17abde(0x210)][_0x17abde(0x142)](_0x16349d[_0x17abde(0x1db)]['name'])),console[_0x17abde(0x146)](_0x17abde(0x1b5)+_0x3bd33d[_0x17abde(0x24f)]+'\x20parent\x20segment'+(_0x3bd33d[_0x17abde(0x24f)]!==0x1?'s':''));if(_0x517c2d['format']==='json'||_0x517c2d['format']===_0x17abde(0x23d))await handleSDKOutput(_0x3bd33d,_0x517c2d);else{if(_0x3bd33d[_0x17abde(0x24f)]===0x0)_0x5cacfb?console[_0x17abde(0x20d)](_0x17abde(0x173)+_0x5cacfb):console[_0x17abde(0x20d)](_0x17abde(0x212));else for(const _0x3ba98d of _0x3bd33d){const _0x2fff51=_0x3ba98d[_0x17abde(0x1db)][_0x17abde(0x230)]?a27_0x580f47[_0x17abde(0x206)]('\x20('+formatRows(_0x3ba98d[_0x17abde(0x1db)][_0x17abde(0x230)])+')'):'';console[_0x17abde(0x20d)]('👥\x20'+_0x3ba98d[_0x17abde(0x1db)][_0x17abde(0x210)]+_0x2fff51);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a27_0x4dd8e0(0x210)]=a27_0x4dd8e0(0x156);[a27_0x4dd8e0(0x21f)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a27_0x4dd8e0(0x165)](_0x2d327a){const _0x1753d9=a27_0x4dd8e0,{options:_0x4ea227,args:_0x355dcc,tdx:_0x74fc76}=_0x2d327a;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x46d44b=_0x4ea227;if(_0x355dcc[_0x1753d9(0x24f)]===0x0)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x1753d9(0x146)](_0x1753d9(0x22c)),0x1;const _0x1fb6e4=_0x355dcc[0x0];if(!_0x46d44b[_0x1753d9(0x14d)]||!_0x46d44b['table'])return console[_0x1753d9(0x146)](_0x1753d9(0x182)),console[_0x1753d9(0x146)](_0x1753d9(0x22c)),0x1;_0x46d44b[_0x1753d9(0x23b)]&&(console[_0x1753d9(0x146)](_0x1753d9(0x1f9)+_0x46d44b[_0x1753d9(0x17f)]),console[_0x1753d9(0x146)]('Name:\x20'+_0x1fb6e4),console['error']('Database:\x20'+_0x46d44b[_0x1753d9(0x14d)]),console[_0x1753d9(0x146)](_0x1753d9(0x153)+_0x46d44b[_0x1753d9(0x1cc)]));const _0x2e70eb=await loadJSONFromOptions(_0x46d44b[_0x1753d9(0x1db)],_0x46d44b['attributesFile']),_0x4e0ffb=await loadJSONFromOptions(_0x46d44b['behaviors'],_0x46d44b['behaviorsFile']),_0x27882e=await loadJSONFromOptions(_0x46d44b['customerGroup'],_0x46d44b[_0x1753d9(0x211)]),_0x2ea061={'name':_0x1fb6e4,'description':_0x46d44b['description'],'scheduleType':_0x46d44b[_0x1753d9(0x1e4)],'scheduleOption':_0x46d44b[_0x1753d9(0x164)],'timezone':_0x46d44b[_0x1753d9(0x1d3)],'master':{'parentDatabaseName':_0x46d44b[_0x1753d9(0x14d)],'parentTableName':_0x46d44b[_0x1753d9(0x1cc)]},'attributes':_0x2e70eb,'behaviors':_0x4e0ffb,'customerGroup':_0x27882e},_0x1edd9b=await withSpinner(_0x1753d9(0x12f)+_0x1fb6e4+'\x27...',()=>_0x74fc76[_0x1753d9(0x13d)][_0x1753d9(0x13b)](_0x2ea061),{'verbose':_0x4ea227[_0x1753d9(0x23b)]}),_0x59a7e1=_0x1edd9b[_0x1753d9(0x1e0)];return console[_0x1753d9(0x146)](_0x1753d9(0x14b)+_0x59a7e1[_0x1753d9(0x210)]+'\x27\x20with\x20ID:\x20'+_0x59a7e1['id']),await handleSDKOutput([_0x59a7e1],_0x4ea227),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a27_0x4dd8e0(0x210)]='segment:parent:update';[a27_0x4dd8e0(0x21f)]=a27_0x4dd8e0(0x1bd);async['execute'](_0x1dee90){const _0x1a4b8b=a27_0x4dd8e0,{options:_0x1f3ec2,args:_0x1fb267,tdx:_0x1f958f}=_0x1dee90;console[_0x1a4b8b(0x146)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x1a4b8b(0x20e)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x5ef48e=_0x1f3ec2;if(_0x1fb267[_0x1a4b8b(0x24f)]===0x0)return console['error'](_0x1a4b8b(0x23c)),console['error'](_0x1a4b8b(0x1e1)),0x1;const _0x25fd38=_0x1fb267[0x0];_0x5ef48e[_0x1a4b8b(0x23b)]&&(console[_0x1a4b8b(0x146)](_0x1a4b8b(0x1f9)+_0x5ef48e['site']),console[_0x1a4b8b(0x146)](_0x1a4b8b(0x14e)+_0x25fd38));const _0x8b36d5=await withSpinner(_0x1a4b8b(0x133)+_0x25fd38+'\x27...',()=>_0x1f958f[_0x1a4b8b(0x13d)][_0x1a4b8b(0x19e)](_0x25fd38),{'verbose':_0x5ef48e[_0x1a4b8b(0x23b)]}),_0x475f84=_0x8b36d5[_0x1a4b8b(0x1e0)],_0x4b27d0=await loadJSONFromOptions(_0x5ef48e['addAttributes'],_0x5ef48e[_0x1a4b8b(0x1e8)]),_0x44315a=await loadJSONFromOptions(_0x5ef48e['addBehaviors'],_0x5ef48e['addBehaviorsFile']),_0x49df7e={'name':_0x475f84[_0x1a4b8b(0x210)],'description':_0x5ef48e['description']!==undefined?_0x5ef48e['description']:_0x475f84[_0x1a4b8b(0x21f)],'scheduleType':_0x5ef48e[_0x1a4b8b(0x1e4)]!==undefined?_0x5ef48e[_0x1a4b8b(0x1e4)]:_0x475f84[_0x1a4b8b(0x1e4)],'scheduleOption':_0x5ef48e[_0x1a4b8b(0x164)]!==undefined?_0x5ef48e[_0x1a4b8b(0x164)]:_0x475f84[_0x1a4b8b(0x164)],'timezone':_0x5ef48e[_0x1a4b8b(0x1d3)]!==undefined?_0x5ef48e[_0x1a4b8b(0x1d3)]:_0x475f84[_0x1a4b8b(0x1d3)],'master':_0x475f84[_0x1a4b8b(0x235)],'attributes':_0x4b27d0?[..._0x475f84['attributes']||[],..._0x4b27d0]:_0x475f84[_0x1a4b8b(0x1db)],'behaviors':_0x44315a?[..._0x475f84[_0x1a4b8b(0x197)]||[],..._0x44315a]:_0x475f84['behaviors'],'customerGroup':_0x475f84[_0x1a4b8b(0x14c)]},_0x37a968=await withSpinner(_0x1a4b8b(0x19d)+_0x25fd38+_0x1a4b8b(0x23f),()=>_0x1f958f[_0x1a4b8b(0x13d)]['updateParent'](_0x25fd38,_0x49df7e),{'verbose':_0x5ef48e['verbose']}),_0x4b814e=_0x37a968['data'];return console[_0x1a4b8b(0x146)](_0x1a4b8b(0x15a)+_0x4b814e[_0x1a4b8b(0x210)]+'\x27'),await handleSDKOutput([_0x4b814e],_0x5ef48e),0x0;}}function a27_0x201c(){const _0x1f9f9b=['varchar','start','Site:\x20','limit','Usage:\x20tdx\x20ps\x20fields\x20[name]\x0a','endsWith','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x0aChanges\x20to\x20\x27','Options:','text','ignore','Validating\x20configuration...','use','/app/workflows/','\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','dim','Source:','format','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','rowCount','\x20Opening\x20','matchedCount','log','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','segment:parent:preview','name','customerGroupFile','No\x20parent\x20segments\x20found','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20use\x20`tdx\x20ps\x20pull`\x20to\x20get\x20a\x20YAML\x20file\x20first','schemaValid','keys','Coverage:','159nCmvTO','List\x20parent\x20segments','\x0aNo\x20sample\x20data\x20available','schemaError','/\x20→\x20','Options\x20(one\x20required):','\x20tdx\x20wf\x20attempt\x20','errors','description','output','FINISHED','filter','✔\x20Renamed\x20directory\x20to\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','displaySummary','enriched','\x20--enriched','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Usage:\x20tdx\x20ps\x20show\x20[name]\x0a','toLocaleString','displayValidateResults','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','YAML\x20file:\x20','json','/app/dw/parentSegments/','population','Listing\x20fields\x20for\x20\x27','Apply\x20changes\x20to\x20\x27','segment:parent:sql','Pattern:\x20','master','\x27\x20and\x20run\x20workflow?','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','segment:parent:view','open','\x0a⚠️\x20\x20Both\x20','verbose','Error:\x20Parent\x20segment\x20name\x20is\x20required','jsonl','Usage:\x20tdx\x20ps\x20desc\x20[name]\x0a','\x27...','-1d','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Usage:\x20tdx\x20ps\x20push\x20[name]\x20[-y]\x0a','displayBehaviorsStats','segment:parent:fields','Enriched:','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)','\x20--behavior\x20\x22<name>\x22','\x20--attribute\x20\x22<name>\x22','validateParentYaml','5660eBfntD','resolveParentId','red','Error:\x20File\x20not\x20found:\x20','\x27\x20is\x20up\x20to\x20date','length','interval','\x0aChanges\x20to\x20apply\x20to\x20\x27','using\x20the\x20default\x20path:\x20','double','stats','displayAttributesStats','Creating\x20parent\x20segment\x20\x27','\x0aNew\x20parent\x20segment\x20\x27','List\x20available\x20fields\x20for\x20segmentation','/\x20and\x20','Fetching\x20current\x20configuration\x20for\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','Validate:','779950HkwnmO','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','✔\x20No\x20changes\x20-\x20\x27','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Events:','createParent','displayMasterInfo','segment','177144HLSJcr','run','\x20Configuration\x20is\x20valid','platform','localeCompare','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','segment:parent:validate','\x20--interval\x20','error','%)\x20','parent_segment','SQL\x20query:\x0a','To\x20cancel:','✔\x20Created\x20parent\x20segment\x20\x27','customerGroup','database','Parent\x20segment:\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)','15646450QIuCiU','segment:parent:show','stop','Table:\x20','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','elapsedTimeMillis','segment:parent:create','pullParentYaml','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','/\x20directories\x20exist.','✔\x20Updated\x20parent\x20segment\x20\x27','toLowerCase','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','`\x20to\x20download\x20the\x20configuration\x20first','message','\x20[Job\x20ID:\x20','Columns:','/{name}.yml\x0a','session','Master\x20+\x20Attributes','scheduleOption','execute','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20Context\x20set:\x20','\x20\x20\x20\x20-\x20','dirname','Join\x20on:','map','Fetching\x20SQL\x20for\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','.yaml','xdg-open','\x20--behavior\x20\x22','parentSegment','string','No\x20parent\x20segments\x20match\x20pattern:\x20','segment:parent:list','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','pushParentYaml','bold','displaySampleData','segment:parent:run','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Executing\x20parent\x20segment\x20query...','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20rows)','7HnoKwp','site','\x20--attribute\x20\x22','allValid','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Listing\x20parent\x20segments\x20matching\x20\x27','processedRows','match','Attribute:','toFixed','3517854UXOoKZ','displayPreviewResults','workflowSessionId','Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a','\x5c$&','✔\x20Query\x20completed:\x20Processed\x20','9yvTOhx','Behavior:','Attempt:','Error\x20reading\x20file:\x20','Behaviors','\x20parent\x20segment\x20\x27','/\x20directory.\x0a','test','behaviors','customerPercent','query','getParentSQL','Status:','behavior','Updating\x20parent\x20segment\x20\x27','getParentFull','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','trim','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','setJobId','listFields','Analyzing\x20changes...','\x20\x20No\x20sample\x20data\x20available','\x20No\x20changes\x20-\x20','Created','Aborted.','Preview:','Found\x20YAML\x20file:\x20','yellow','all','\x0a⚠️\x20\x20Migrating:\x20','Error:\x20--attribute\x20requires\x20a\x20name\x0a','foreignKey','\x20field','workflowId','tdx\x20segment\x20parent\x20preview\x20','Attributes','jobId','✔\x20Found\x20','replace','columns','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','.yml','segment:parent:push','coveragePercent','customersWithEvents','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','1129020mkDyWJ','Customers:','yes','cyan','Create\x20parent\x20segment\x20\x27','previewParentYaml','parent_segments','Available\x20behaviors:','column','SELECT\x20*\x20FROM\x20(\x0a','displayColumns','win32','Creating','table','Output\x20file:\x20','apply','joinKey','darwin','repeat','\x20=\x20','timezone','totalEvents','sampleData','Join:','Errors:','attribute','Usage:\x20tdx\x20parent-segment\x20validate\x20<name>\x20[options]\x0a','label','attributes','sort','\x0a✔\x20Workflow\x20started','preview','✘\x20Failed\x20to\x20rename\x20directory:\x20','data','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','displayPreviewHints','listParents','scheduleType','Get\x20SQL\x20query\x20for\x20parent\x20segment','information_schema','Show\x20parent\x20segment\x20details','addAttributesFile','Resolving\x20parent\x20segment\x20\x27','Updated','2451224YByohH','\x20kill','utf-8','Usage:\x20tdx\x20ps\x20sql\x20[name]\x0a','Fetching\x20parent\x20segment\x20\x27','status','green','\x0aUsage:\x20tdx\x20ps\x20preview\x20','workflowAttemptId','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Error:','To\x20view\x20sample\x20data:'];a27_0x201c=function(){return _0x1f9f9b;};return a27_0x201c();}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a27_0x4dd8e0(0x210)]='segment:parent:pull';[a27_0x4dd8e0(0x21f)]=a27_0x4dd8e0(0x1fd);async['execute'](_0x2b1be8){const _0x262cb0=a27_0x4dd8e0,{options:_0x44599c,args:_0x1700f1,tdx:_0x58ee37}=_0x2b1be8,_0x2430be=_0x44599c,_0x4e7928=_0x1700f1[0x0]||_0x44599c[_0x262cb0(0x171)];if(!_0x4e7928)return console[_0x262cb0(0x146)](a27_0x580f47[_0x262cb0(0x24c)](_0x262cb0(0x18c))),console[_0x262cb0(0x146)]('Usage:\x20tdx\x20ps\x20pull\x20[name]\x20[-o\x20output.yml]\x20[-y]\x0a'),console[_0x262cb0(0x146)](a27_0x580f47[_0x262cb0(0x1c2)](_0x262cb0(0x175))),0x1;if(_0x2430be[_0x262cb0(0x203)]&&_0x2430be[_0x262cb0(0x220)])return console[_0x262cb0(0x146)](a27_0x580f47[_0x262cb0(0x24c)](_0x262cb0(0x228))),console[_0x262cb0(0x146)](a27_0x580f47[_0x262cb0(0x206)](_0x262cb0(0x1f4))),console[_0x262cb0(0x146)](a27_0x580f47[_0x262cb0(0x206)](_0x262cb0(0x252)+PARENT_SEGMENT_DIR+_0x262cb0(0x161))),console[_0x262cb0(0x146)](a27_0x580f47[_0x262cb0(0x1c2)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x124533=_0x2430be['output']||a27_0xb78e46['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4e7928)+'.yml');_0x2430be['verbose']&&(console[_0x262cb0(0x146)](_0x262cb0(0x1f9)+_0x2430be['site']),console[_0x262cb0(0x146)](_0x262cb0(0x14e)+_0x4e7928),console[_0x262cb0(0x146)](_0x262cb0(0x1cd)+_0x124533));const _0x39741b=await withSpinner(_0x262cb0(0x1ef)+_0x4e7928+_0x262cb0(0x23f),()=>_0x58ee37[_0x262cb0(0x13d)][_0x262cb0(0x157)](_0x4e7928),{'verbose':_0x2430be['verbose']}),_0x28795f=_0x39741b['data'];if(existsSync(_0x124533)){const _0x48ce9d=readFileSync(_0x124533,'utf-8'),_0xc869a9=generateDiff(_0x48ce9d,_0x28795f);if(!hasChanges(_0xc869a9))console[_0x262cb0(0x146)](a27_0x580f47[_0x262cb0(0x1f1)]('✔')+_0x262cb0(0x1a6)+a27_0x580f47[_0x262cb0(0x1c2)](_0x124533)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x262cb0(0x146)](_0x262cb0(0x1fe)+_0x124533+'\x27:'),console[_0x262cb0(0x146)]('─'['repeat'](0x3c)),console['error'](formatDiffWithColors(_0xc869a9)),console['error']('─'[_0x262cb0(0x1d1)](0x3c));if(!_0x2430be['yes']){const _0x55ed6e=await confirmKey('Overwrite\x20\x27'+_0x124533+'\x27?');if(!_0x55ed6e)return console[_0x262cb0(0x146)](_0x262cb0(0x1a8)),0x1;}writeFileSync(_0x124533,_0x28795f,_0x262cb0(0x1ed)),console[_0x262cb0(0x146)](a27_0x580f47['green']('✔')+_0x262cb0(0x154)+a27_0x580f47['cyan'](_0x124533));}}else{const _0x15bdee=a27_0xb78e46[_0x262cb0(0x169)](_0x124533);!existsSync(_0x15bdee)&&mkdirSync(_0x15bdee,{'recursive':!![]}),writeFileSync(_0x124533,_0x28795f,'utf-8'),console[_0x262cb0(0x146)](a27_0x580f47['green']('✔')+_0x262cb0(0x154)+a27_0x580f47['cyan'](_0x124533));}return saveSessionContext({'parent_segment':_0x4e7928},_0x2430be[_0x262cb0(0x162)]),console['error'](a27_0x580f47[_0x262cb0(0x1f1)]('✔')+_0x262cb0(0x167)+a27_0x580f47[_0x262cb0(0x206)](_0x262cb0(0x148))+'\x20=\x20'+a27_0x580f47[_0x262cb0(0x1c2)](_0x4e7928)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a27_0x4dd8e0(0x210)]=a27_0x4dd8e0(0x1ba);['description']=a27_0x4dd8e0(0x17a);async[a27_0x4dd8e0(0x165)](_0x220cdd){const _0x57d766=a27_0x4dd8e0,{options:_0x402540,args:_0x1de4e0,tdx:_0x5c704c}=_0x220cdd,_0x523a2c=_0x402540,_0x4b8a4e=_0x1de4e0[0x0]||_0x402540[_0x57d766(0x171)];if(!_0x4b8a4e)return console['error'](a27_0x580f47[_0x57d766(0x24c)](_0x57d766(0x18c))),console[_0x57d766(0x146)](_0x57d766(0x242)),console[_0x57d766(0x146)](a27_0x580f47[_0x57d766(0x1c2)](_0x57d766(0x213))),0x1;const _0x38c99e=resolveYamlFile(_0x4b8a4e);if(!existsSync(_0x38c99e))return showFileNotFoundError(_0x38c99e,_0x4b8a4e),0x1;_0x523a2c[_0x57d766(0x23b)]&&(console['error'](_0x57d766(0x1f9)+_0x523a2c[_0x57d766(0x17f)]),console[_0x57d766(0x146)](_0x57d766(0x22d)+_0x38c99e));let _0x385c8b;try{_0x385c8b=readFileSync(_0x38c99e,_0x57d766(0x1ed));}catch(_0xad0b5e){const _0x3aa222=_0xad0b5e instanceof Error?_0xad0b5e['message']:String(_0xad0b5e);return console['error'](_0x57d766(0x192)+_0x3aa222),0x1;}const _0x105cd6=await withSpinner(_0x57d766(0x1a4),()=>_0x5c704c[_0x57d766(0x13d)][_0x57d766(0x176)](_0x385c8b),{'verbose':_0x523a2c[_0x57d766(0x23b)]}),_0x1660a9=_0x105cd6['data'],{isNew:_0x21bfb8,name:_0xca6c76,hasChanges:_0x26e468,diffFormatted:_0x552847}=_0x1660a9;if(!_0x26e468)return console['error'](_0x57d766(0x138)+_0xca6c76+_0x57d766(0x134)),0x0;_0x21bfb8?console['error'](_0x57d766(0x130)+_0xca6c76+'\x27:'):console['error'](_0x57d766(0x251)+_0xca6c76+'\x27:');console[_0x57d766(0x146)]('─'['repeat'](0x3c)),console['error'](_0x552847),console[_0x57d766(0x146)]('─'[_0x57d766(0x1d1)](0x3c));const _0x13cd7d=_0x21bfb8?_0x57d766(0x1c3)+_0xca6c76+'\x27?':_0x57d766(0x232)+_0xca6c76+'\x27?';if(!_0x523a2c[_0x57d766(0x1c1)]){const _0xe9a3da=await confirmKey(_0x13cd7d);if(!_0xe9a3da)return console['error'](_0x57d766(0x1a8)),0x1;}const _0x5526df=_0x21bfb8?_0x57d766(0x1cb):'Updating',_0x270eae=await withSpinner(_0x5526df+_0x57d766(0x194)+_0xca6c76+_0x57d766(0x23f),()=>_0x1660a9['apply'](),{'verbose':_0x523a2c['verbose']}),_0x1ada26=_0x270eae['data'],_0x2c6152=getConsoleNextUrl(_0x523a2c[_0x57d766(0x17f)],_0x57d766(0x22f)+_0x1ada26['id']),_0xeb2498=_0x21bfb8?_0x57d766(0x1a7):_0x57d766(0x1ea);return console[_0x57d766(0x146)]('✔\x20'+_0xeb2498+_0x57d766(0x194)+_0x1ada26[_0x57d766(0x210)]+'\x27'),console[_0x57d766(0x146)]('\x20\x20'+_0x2c6152),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a27_0x4dd8e0(0x210)]=a27_0x4dd8e0(0x144);[a27_0x4dd8e0(0x21f)]=a27_0x4dd8e0(0x1be);async[a27_0x4dd8e0(0x165)](_0x225452){const _0x205c08=a27_0x4dd8e0,{options:_0x11f186,args:_0x4364dc,tdx:_0x4e5718}=_0x225452,_0x722a85=_0x11f186,_0x1e2b23=_0x4364dc[0x0]||_0x11f186[_0x205c08(0x171)];if(!_0x1e2b23)return console['error'](a27_0x580f47['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x205c08(0x146)](_0x205c08(0x1d9)),console[_0x205c08(0x146)]('Options:'),console[_0x205c08(0x146)](_0x205c08(0x246)),console[_0x205c08(0x146)](_0x205c08(0x14f)),console[_0x205c08(0x146)](_0x205c08(0x15c)),console[_0x205c08(0x146)](a27_0x580f47[_0x205c08(0x1c2)](_0x205c08(0x205))),0x1;const _0x3661e3=resolveYamlFile(_0x1e2b23);if(!existsSync(_0x3661e3))return showFileNotFoundError(_0x3661e3,_0x1e2b23),0x1;_0x722a85[_0x205c08(0x23b)]&&(console[_0x205c08(0x146)](_0x205c08(0x1f9)+_0x722a85[_0x205c08(0x17f)]),console[_0x205c08(0x146)](_0x205c08(0x22d)+_0x3661e3));let _0xfedc89;try{_0xfedc89=readFileSync(_0x3661e3,'utf-8');}catch(_0xdbd622){const _0x585473=_0xdbd622 instanceof Error?_0xdbd622[_0x205c08(0x15e)]:String(_0xdbd622);return console[_0x205c08(0x146)](_0x205c08(0x192)+_0x585473),0x1;}const _0x24e823=createCommandSpinner(a27_0x580f47[_0x205c08(0x206)](_0x205c08(0x202)),{'verbose':_0x722a85[_0x205c08(0x23b)]});_0x24e823[_0x205c08(0x1f8)]();const _0x2e80b3={'onProgress':_0x53d263=>{_0x24e823['text']=formatProgressMessage(_0x53d263);}};if(_0x722a85[_0x205c08(0x235)])_0x2e80b3['master']=!![];if(_0x722a85[_0x205c08(0x226)])_0x2e80b3[_0x205c08(0x226)]=!![];_0x722a85['attribute']&&(_0x2e80b3[_0x205c08(0x1d8)]=_0x722a85['attribute']);_0x722a85[_0x205c08(0x19c)]&&(_0x2e80b3[_0x205c08(0x19c)]=_0x722a85['behavior']);if(_0x722a85[_0x205c08(0x250)])_0x2e80b3[_0x205c08(0x250)]=_0x722a85[_0x205c08(0x250)];let _0x5ddf4a;try{_0x5ddf4a=await _0x4e5718[_0x205c08(0x13d)][_0x205c08(0x249)](_0xfedc89,_0x2e80b3),_0x24e823[_0x205c08(0x152)]();}catch(_0x324056){_0x24e823[_0x205c08(0x152)]();throw _0x324056;}const _0x3cb732=_0x722a85[_0x205c08(0x250)]||_0x205c08(0x240);return this[_0x205c08(0x22b)](_0x5ddf4a,_0x2e80b3,_0x3661e3,_0x3cb732),_0x5ddf4a['allValid']?0x0:0x1;}[a27_0x4dd8e0(0x22b)](_0x519641,_0x534dc1,_0x16d9ca,_0x7a7a28){const _0x509ce3=a27_0x4dd8e0;console[_0x509ce3(0x146)]('\x0a'+a27_0x580f47[_0x509ce3(0x177)](_0x509ce3(0x135))+'\x20'+_0x519641[_0x509ce3(0x210)]),console[_0x509ce3(0x146)]('═'[_0x509ce3(0x1d1)](0x3c)),this[_0x509ce3(0x13c)](_0x519641);if(typeof _0x534dc1['attribute']===_0x509ce3(0x172)){this[_0x509ce3(0x255)](_0x519641),this[_0x509ce3(0x225)](_0x519641),this[_0x509ce3(0x1e2)](_0x16d9ca,_0x7a7a28,_0x509ce3(0x1d8),_0x534dc1[_0x509ce3(0x1d8)]);return;}if(_0x534dc1[_0x509ce3(0x1d8)]===!![]){this[_0x509ce3(0x255)](_0x519641),this[_0x509ce3(0x225)](_0x519641),this[_0x509ce3(0x1e2)](_0x16d9ca,_0x7a7a28,_0x509ce3(0x1db));return;}if(typeof _0x534dc1['behavior']===_0x509ce3(0x172)){this[_0x509ce3(0x243)](_0x519641,_0x7a7a28),this[_0x509ce3(0x225)](_0x519641),this[_0x509ce3(0x1e2)](_0x16d9ca,_0x7a7a28,_0x509ce3(0x19c),_0x534dc1['behavior']);return;}if(_0x534dc1[_0x509ce3(0x19c)]===!![]){this[_0x509ce3(0x243)](_0x519641,_0x7a7a28),this[_0x509ce3(0x225)](_0x519641),this[_0x509ce3(0x1e2)](_0x16d9ca,_0x7a7a28,_0x509ce3(0x197));return;}this[_0x509ce3(0x255)](_0x519641),this['displayBehaviorsStats'](_0x519641,_0x7a7a28),this[_0x509ce3(0x225)](_0x519641),this[_0x509ce3(0x1e2)](_0x16d9ca,_0x7a7a28,_0x509ce3(0x1ac));}[a27_0x4dd8e0(0x1e2)](_0x265588,_0x11458f,_0x5b00f3,_0x239935){const _0xc77515=a27_0x4dd8e0;console[_0xc77515(0x146)]('\x0a'+a27_0x580f47['dim'](_0xc77515(0x1f6)));const _0x30f5e7=_0x11458f!==_0xc77515(0x240)?_0xc77515(0x145)+_0x11458f:'';if(_0x5b00f3===_0xc77515(0x1d8)&&_0x239935)console[_0xc77515(0x146)]('\x20\x20'+a27_0x580f47[_0xc77515(0x206)](_0xc77515(0x1b2)+_0x265588+'\x20--attribute\x20\x22'+_0x239935+'\x22'+_0x30f5e7));else{if(_0x5b00f3==='behavior'&&_0x239935)console[_0xc77515(0x146)]('\x20\x20'+a27_0x580f47[_0xc77515(0x206)](_0xc77515(0x1b2)+_0x265588+_0xc77515(0x170)+_0x239935+'\x22'+_0x30f5e7));else(_0x5b00f3===_0xc77515(0x1db)||_0x5b00f3==='all')&&console[_0xc77515(0x146)]('\x20\x20'+a27_0x580f47[_0xc77515(0x206)](_0xc77515(0x1b2)+_0x265588+_0xc77515(0x248)+_0x30f5e7));}(_0x5b00f3==='behaviors'||_0x5b00f3===_0xc77515(0x1ac))&&console[_0xc77515(0x146)]('\x20\x20'+a27_0x580f47[_0xc77515(0x206)]('tdx\x20segment\x20parent\x20preview\x20'+_0x265588+_0xc77515(0x247)+_0x30f5e7)),_0x5b00f3===_0xc77515(0x1ac)&&console[_0xc77515(0x146)]('\x20\x20'+a27_0x580f47[_0xc77515(0x206)](_0xc77515(0x1b2)+_0x265588+_0xc77515(0x227)+_0x30f5e7));}['displayMasterInfo'](_0xf0a18e){const _0x41b443=a27_0x4dd8e0,{master:_0x27c989}=_0xf0a18e,_0x10d26e=_0x27c989[_0x41b443(0x214)]?a27_0x580f47['green']('✔'):a27_0x580f47[_0x41b443(0x24c)]('✘');console[_0x41b443(0x146)]('\x0a'+a27_0x580f47[_0x41b443(0x206)]('Master\x20Table')),console[_0x41b443(0x146)](_0x10d26e+'\x20'+a27_0x580f47[_0x41b443(0x177)](_0x27c989[_0x41b443(0x14d)]+'.'+_0x27c989[_0x41b443(0x1cc)])),_0x27c989[_0x41b443(0x214)]?_0x27c989[_0x41b443(0x20a)]!==undefined&&console['error']('\x20\x20'+a27_0x580f47[_0x41b443(0x206)]('Rows:')+'\x20'+a27_0x580f47[_0x41b443(0x1c2)](formatRows(_0x27c989[_0x41b443(0x20a)]))):console['error']('\x20\x20'+a27_0x580f47[_0x41b443(0x24c)](_0x41b443(0x1f5))+'\x20'+_0x27c989[_0x41b443(0x21a)]);}[a27_0x4dd8e0(0x255)](_0x53a2ae){const _0x517c08=a27_0x4dd8e0;if(_0x53a2ae[_0x517c08(0x1db)][_0x517c08(0x24f)]===0x0)return;console[_0x517c08(0x146)]('\x0a'+a27_0x580f47['dim'](_0x517c08(0x1b3)));for(const _0x1bf339 of _0x53a2ae[_0x517c08(0x1db)]){const _0x34dd41=_0x1bf339[_0x517c08(0x214)]?a27_0x580f47[_0x517c08(0x1f1)]('✔'):a27_0x580f47['red']('✘');let _0x2fe581='';if(_0x1bf339[_0x517c08(0x214)]&&_0x1bf339['matchedCount']!==undefined&&_0x1bf339['coveragePercent']!==undefined){const _0x12d226=_0x1bf339[_0x517c08(0x1bb)]['toFixed'](0x1),_0x1a5abb=_0x1bf339[_0x517c08(0x1bb)]>=0x50?a27_0x580f47[_0x517c08(0x1f1)]:_0x1bf339[_0x517c08(0x1bb)]>=0x32?a27_0x580f47[_0x517c08(0x1ab)]:a27_0x580f47[_0x517c08(0x24c)];_0x2fe581='\x20'+a27_0x580f47[_0x517c08(0x206)](_0x517c08(0x216))+'\x20'+_0x1a5abb(_0x12d226+'%')+'\x20('+formatRows(_0x1bf339[_0x517c08(0x20c)])+_0x517c08(0x17d);}console['error'](_0x34dd41+'\x20'+a27_0x580f47['bold'](_0x1bf339[_0x517c08(0x210)])+_0x2fe581),console[_0x517c08(0x146)]('\x20\x20'+a27_0x580f47['dim']('Source:')+'\x20'+a27_0x580f47[_0x517c08(0x177)](_0x1bf339[_0x517c08(0x14d)]+'.'+_0x1bf339[_0x517c08(0x1cc)]));const _0x1f3779=_0x1bf339[_0x517c08(0x1cf)]===_0x1bf339['foreignKey']?a27_0x580f47['dim'](_0x517c08(0x16a))+'\x20'+_0x1bf339[_0x517c08(0x1cf)]:a27_0x580f47['dim'](_0x517c08(0x1d6))+'\x20'+_0x1bf339[_0x517c08(0x1cf)]+_0x517c08(0x1d2)+_0x1bf339[_0x517c08(0x1af)];console['error']('\x20\x20'+_0x1f3779),console['error']('\x20\x20'+a27_0x580f47['dim'](_0x517c08(0x160))),this[_0x517c08(0x1c9)](_0x1bf339[_0x517c08(0x1b7)]),!_0x1bf339[_0x517c08(0x214)]&&console[_0x517c08(0x146)]('\x20\x20'+a27_0x580f47[_0x517c08(0x24c)](_0x517c08(0x1f5))+'\x20'+_0x1bf339[_0x517c08(0x21a)]);}}[a27_0x4dd8e0(0x243)](_0x492940,_0x55e820){const _0x472a85=a27_0x4dd8e0;if(_0x492940[_0x472a85(0x197)][_0x472a85(0x24f)]===0x0)return;console[_0x472a85(0x146)]('\x0a'+a27_0x580f47[_0x472a85(0x206)](_0x472a85(0x193))+'\x20'+a27_0x580f47[_0x472a85(0x206)]('('+_0x55e820+')'));for(const _0x4fe61e of _0x492940[_0x472a85(0x197)]){const _0x251d0c=_0x4fe61e[_0x472a85(0x214)]?a27_0x580f47[_0x472a85(0x1f1)]('✔'):a27_0x580f47[_0x472a85(0x24c)]('✘');let _0x52be28='';if(_0x4fe61e[_0x472a85(0x214)]&&_0x4fe61e[_0x472a85(0x1bc)]!==undefined&&_0x4fe61e['totalEvents']!==undefined){const _0x28dfd9=_0x4fe61e[_0x472a85(0x198)]?.[_0x472a85(0x188)](0x1)||'?',_0x5e9dbc=(_0x4fe61e[_0x472a85(0x198)]??0x0)>=0x32?a27_0x580f47['green']:(_0x4fe61e[_0x472a85(0x198)]??0x0)>=0x14?a27_0x580f47['yellow']:a27_0x580f47['red'];_0x52be28='\x20'+a27_0x580f47[_0x472a85(0x206)](_0x472a85(0x1c0))+'\x20'+_0x5e9dbc(formatRows(_0x4fe61e['customersWithEvents']))+'\x20('+_0x28dfd9+_0x472a85(0x147)+a27_0x580f47[_0x472a85(0x206)](_0x472a85(0x13a))+'\x20'+a27_0x580f47[_0x472a85(0x1c2)](formatRows(_0x4fe61e[_0x472a85(0x1d4)]));}console[_0x472a85(0x146)](_0x251d0c+'\x20'+a27_0x580f47[_0x472a85(0x177)](_0x4fe61e[_0x472a85(0x210)])+_0x52be28),console[_0x472a85(0x146)]('\x20\x20'+a27_0x580f47[_0x472a85(0x206)](_0x472a85(0x207))+'\x20'+a27_0x580f47[_0x472a85(0x177)](_0x4fe61e[_0x472a85(0x14d)]+'.'+_0x4fe61e[_0x472a85(0x1cc)]));const _0x111e07=_0x4fe61e['joinKey']===_0x4fe61e[_0x472a85(0x1af)]?a27_0x580f47[_0x472a85(0x206)](_0x472a85(0x16a))+'\x20'+_0x4fe61e['joinKey']:a27_0x580f47[_0x472a85(0x206)](_0x472a85(0x1d6))+'\x20'+_0x4fe61e[_0x472a85(0x1cf)]+_0x472a85(0x1d2)+_0x4fe61e[_0x472a85(0x1af)];console[_0x472a85(0x146)]('\x20\x20'+_0x111e07),console[_0x472a85(0x146)]('\x20\x20'+a27_0x580f47[_0x472a85(0x206)](_0x472a85(0x160))),this['displayColumns'](_0x4fe61e[_0x472a85(0x1b7)]),!_0x4fe61e[_0x472a85(0x214)]&&console['error']('\x20\x20'+a27_0x580f47['red'](_0x472a85(0x1f5))+'\x20'+_0x4fe61e['schemaError']);}}[a27_0x4dd8e0(0x1c9)](_0xb634bb){const _0x52f236=a27_0x4dd8e0;for(const _0x2c6166 of _0xb634bb){_0x2c6166[_0x52f236(0x1da)]===_0x2c6166[_0x52f236(0x1c7)]||_0x2c6166['column']==='*'?console['error']('\x20\x20\x20\x20-\x20'+_0x2c6166[_0x52f236(0x1da)]):console[_0x52f236(0x146)](_0x52f236(0x168)+_0x2c6166[_0x52f236(0x1da)]+'\x20'+a27_0x580f47[_0x52f236(0x206)]('('+_0x2c6166[_0x52f236(0x1c7)]+')'));}}[a27_0x4dd8e0(0x225)](_0x12c14e){const _0x213aaf=a27_0x4dd8e0;console['error']('─'['repeat'](0x3c));if(_0x12c14e[_0x213aaf(0x21e)][_0x213aaf(0x24f)]>0x0){console[_0x213aaf(0x146)]('\x0a'+a27_0x580f47[_0x213aaf(0x24c)]('Errors:'));for(const _0x2d523f of _0x12c14e[_0x213aaf(0x21e)]){console[_0x213aaf(0x146)]('\x20\x20'+a27_0x580f47[_0x213aaf(0x24c)]('•')+'\x20'+_0x2d523f);}}_0x12c14e[_0x213aaf(0x181)]&&console[_0x213aaf(0x146)]('\x0a'+a27_0x580f47[_0x213aaf(0x1f1)]('✔')+_0x213aaf(0x140));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a27_0x4dd8e0(0x210)]=a27_0x4dd8e0(0x20f);['description']=a27_0x4dd8e0(0x137);async[a27_0x4dd8e0(0x165)](_0x58a38){const _0x5c0ea9=a27_0x4dd8e0,{options:_0x2561da,args:_0x4aa632,tdx:_0x42523e}=_0x58a38,_0x4edcd5=_0x2561da,_0x457bb9=_0x4aa632[0x0]||_0x2561da[_0x5c0ea9(0x171)];if(!_0x457bb9)return console[_0x5c0ea9(0x146)](a27_0x580f47[_0x5c0ea9(0x24c)]('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x5c0ea9(0x146)](_0x5c0ea9(0x209)),console['error'](_0x5c0ea9(0x21c)),console[_0x5c0ea9(0x146)](_0x5c0ea9(0x1b8)),console[_0x5c0ea9(0x146)](_0x5c0ea9(0x166)),console[_0x5c0ea9(0x146)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x5c0ea9(0x146)](_0x5c0ea9(0x183)),console['error'](_0x5c0ea9(0x15c)),console['error'](a27_0x580f47['cyan'](_0x5c0ea9(0x205))),0x1;if(!_0x4edcd5[_0x5c0ea9(0x235)]&&!_0x4edcd5[_0x5c0ea9(0x1d8)]&&!_0x4edcd5[_0x5c0ea9(0x19c)]&&!_0x4edcd5[_0x5c0ea9(0x226)])return console[_0x5c0ea9(0x146)](a27_0x580f47[_0x5c0ea9(0x24c)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x5c0ea9(0x146)](_0x5c0ea9(0x209)),console[_0x5c0ea9(0x146)]('Options:'),console[_0x5c0ea9(0x146)](_0x5c0ea9(0x1b8)),console['error'](_0x5c0ea9(0x166)),console['error'](_0x5c0ea9(0x16d)),console[_0x5c0ea9(0x146)](_0x5c0ea9(0x183)),0x1;const _0xe4bc7=resolveYamlFile(_0x457bb9);if(!existsSync(_0xe4bc7))return showFileNotFoundError(_0xe4bc7,_0x457bb9),0x1;_0x4edcd5[_0x5c0ea9(0x23b)]&&(console[_0x5c0ea9(0x146)]('Site:\x20'+_0x4edcd5[_0x5c0ea9(0x17f)]),console[_0x5c0ea9(0x146)]('YAML\x20file:\x20'+_0xe4bc7));let _0xc75449;try{_0xc75449=readFileSync(_0xe4bc7,_0x5c0ea9(0x1ed));}catch(_0x3039e1){const _0x2cd15c=_0x3039e1 instanceof Error?_0x3039e1['message']:String(_0x3039e1);return console['error']('Error\x20reading\x20file:\x20'+_0x2cd15c),0x1;}let _0xf3f81a;try{_0xf3f81a=parseYamlString(_0xc75449);}catch(_0x3d2bae){const _0x1500a8=_0x3d2bae instanceof Error?_0x3d2bae[_0x5c0ea9(0x15e)]:String(_0x3d2bae);return console['error'](a27_0x580f47['red']('Error\x20parsing\x20YAML:\x20'+_0x1500a8)),0x1;}if(_0x4edcd5[_0x5c0ea9(0x1d8)]===!![]||_0x4edcd5[_0x5c0ea9(0x1d8)]===''){const _0x531f03=_0xf3f81a[_0x5c0ea9(0x1db)]?.['map'](_0x5ac494=>_0x5ac494['name'])||[];if(_0x531f03[_0x5c0ea9(0x24f)]===0x0)console['error'](a27_0x580f47['red'](_0x5c0ea9(0x237)));else{console[_0x5c0ea9(0x146)](a27_0x580f47[_0x5c0ea9(0x24c)](_0x5c0ea9(0x1ae))),console['error']('Available\x20attributes:');for(const _0x3bced3 of _0x531f03){console[_0x5c0ea9(0x146)]('\x20\x20'+a27_0x580f47[_0x5c0ea9(0x1c2)](_0x3bced3));}console['error'](_0x5c0ea9(0x1f2)+_0x457bb9+_0x5c0ea9(0x180)+_0x531f03[0x0]+'\x22');}return 0x1;}if(_0x4edcd5[_0x5c0ea9(0x19c)]===!![]||_0x4edcd5[_0x5c0ea9(0x19c)]===''){const _0x5b7d6d=_0xf3f81a['behaviors']?.[_0x5c0ea9(0x16b)](_0x54f117=>_0x54f117['name'])||[];if(_0x5b7d6d[_0x5c0ea9(0x24f)]===0x0)console['error'](a27_0x580f47['red'](_0x5c0ea9(0x158)));else{console['error'](a27_0x580f47[_0x5c0ea9(0x24c)](_0x5c0ea9(0x224))),console['error'](_0x5c0ea9(0x1c6));for(const _0xd0d700 of _0x5b7d6d){console[_0x5c0ea9(0x146)]('\x20\x20'+a27_0x580f47[_0x5c0ea9(0x1c2)](_0xd0d700));}console[_0x5c0ea9(0x146)](_0x5c0ea9(0x1f2)+_0x457bb9+'\x20--behavior\x20\x22'+_0x5b7d6d[0x0]+'\x22');}return 0x1;}const _0x343cf7=createCommandSpinner(a27_0x580f47[_0x5c0ea9(0x206)]('Fetching\x20sample\x20data...'),{'verbose':_0x4edcd5[_0x5c0ea9(0x23b)]});_0x343cf7[_0x5c0ea9(0x1f8)]();const _0x5c21fc={'onProgress':_0x8c97a4=>{const _0x5d6749=_0x5c0ea9;_0x343cf7[_0x5d6749(0x200)]=formatProgressMessage(_0x8c97a4);}};if(_0x4edcd5[_0x5c0ea9(0x235)])_0x5c21fc[_0x5c0ea9(0x235)]=!![];if(_0x4edcd5[_0x5c0ea9(0x1d8)]&&typeof _0x4edcd5[_0x5c0ea9(0x1d8)]===_0x5c0ea9(0x172))_0x5c21fc['attribute']=_0x4edcd5[_0x5c0ea9(0x1d8)];if(_0x4edcd5[_0x5c0ea9(0x19c)]&&typeof _0x4edcd5[_0x5c0ea9(0x19c)]===_0x5c0ea9(0x172))_0x5c21fc[_0x5c0ea9(0x19c)]=_0x4edcd5['behavior'];if(_0x4edcd5[_0x5c0ea9(0x226)])_0x5c21fc[_0x5c0ea9(0x226)]=!![];if(_0x4edcd5['interval'])_0x5c21fc[_0x5c0ea9(0x250)]=_0x4edcd5['interval'];let _0x3674ad;try{_0x3674ad=await _0x42523e[_0x5c0ea9(0x13d)][_0x5c0ea9(0x1c4)](_0xc75449,_0x5c21fc),_0x343cf7[_0x5c0ea9(0x152)]();}catch(_0x53d68b){_0x343cf7[_0x5c0ea9(0x152)]();throw _0x53d68b;}return await this['displayPreviewResults'](_0x3674ad,{'master':_0x4edcd5[_0x5c0ea9(0x235)],'attribute':typeof _0x4edcd5[_0x5c0ea9(0x1d8)]==='string'?_0x4edcd5[_0x5c0ea9(0x1d8)]:undefined,'behavior':typeof _0x4edcd5[_0x5c0ea9(0x19c)]==='string'?_0x4edcd5[_0x5c0ea9(0x19c)]:undefined,'enriched':_0x4edcd5['enriched']}),_0x3674ad[_0x5c0ea9(0x181)]?0x0:0x1;}async[a27_0x4dd8e0(0x18a)](_0x566944,_0x59a4b1){const _0x57f710=a27_0x4dd8e0;console['error']('\x0a'+a27_0x580f47[_0x57f710(0x177)](_0x57f710(0x1a9))+'\x20'+_0x566944[_0x57f710(0x210)]),console[_0x57f710(0x146)]('═'[_0x57f710(0x1d1)](0x3c));if(_0x59a4b1[_0x57f710(0x235)]&&_0x566944[_0x57f710(0x1d5)]){const _0x182f76=a27_0x580f47[_0x57f710(0x206)]('Master:')+'\x20'+a27_0x580f47[_0x57f710(0x177)](_0x566944['master'][_0x57f710(0x14d)]+'.'+_0x566944[_0x57f710(0x235)][_0x57f710(0x1cc)]);await this[_0x57f710(0x178)](_0x182f76,_0x566944[_0x57f710(0x1d5)]);}else{if(_0x59a4b1['attribute']&&_0x566944['sampleData']){const _0x1ec830=a27_0x580f47[_0x57f710(0x206)](_0x57f710(0x187))+'\x20'+a27_0x580f47[_0x57f710(0x177)](_0x59a4b1['attribute']);await this[_0x57f710(0x178)](_0x1ec830,_0x566944[_0x57f710(0x1d5)]);}else{if(_0x59a4b1['behavior']&&_0x566944[_0x57f710(0x1d5)]){const _0x7be190=a27_0x580f47['dim'](_0x57f710(0x190))+'\x20'+a27_0x580f47[_0x57f710(0x177)](_0x59a4b1[_0x57f710(0x19c)]);await this[_0x57f710(0x178)](_0x7be190,_0x566944[_0x57f710(0x1d5)]);}else{if(_0x59a4b1['enriched']&&_0x566944[_0x57f710(0x1d5)]){const _0x3c3f53=a27_0x580f47[_0x57f710(0x206)](_0x57f710(0x245))+'\x20'+a27_0x580f47['bold'](_0x57f710(0x163));await this[_0x57f710(0x178)](_0x3c3f53,_0x566944['sampleData']);}else!_0x566944['sampleData']&&console[_0x57f710(0x146)](_0x57f710(0x219));}}}if(_0x566944[_0x57f710(0x21e)][_0x57f710(0x24f)]>0x0){console[_0x57f710(0x146)]('─'[_0x57f710(0x1d1)](0x3c)),console[_0x57f710(0x146)]('\x0a'+a27_0x580f47[_0x57f710(0x24c)](_0x57f710(0x1d7)));for(const _0x447b77 of _0x566944[_0x57f710(0x21e)]){console[_0x57f710(0x146)]('\x20\x20'+a27_0x580f47['red']('•')+'\x20'+_0x447b77);}}}async[a27_0x4dd8e0(0x178)](_0x2e0098,_0x1f87de){const _0x2dace2=a27_0x4dd8e0;if(_0x1f87de[_0x2dace2(0x24f)]===0x0){console[_0x2dace2(0x146)]('\x0a'+_0x2e0098),console['error'](_0x2dace2(0x1a5));return;}console['error']('\x0a'+_0x2e0098);const _0x59926e=Object[_0x2dace2(0x215)](_0x1f87de[0x0])['map'](_0x31453d=>({'name':_0x31453d,'type':typeof _0x1f87de[0x0][_0x31453d]==='number'?_0x2dace2(0x253):_0x2dace2(0x1f7)})),_0x243279={'queryId':_0x2dace2(0x1de),'columns':_0x59926e,'data':_0x1f87de,'stats':{'state':_0x2dace2(0x221),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1f87de[_0x2dace2(0x24f)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x34dd7b=formatAsTable(_0x243279,_0x1f87de[_0x2dace2(0x24f)],!![]);await writeOutput(_0x34dd7b,undefined,_0x2dace2(0x1cc));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a27_0x4dd8e0(0x210)]=a27_0x4dd8e0(0x179);[a27_0x4dd8e0(0x21f)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async['execute'](_0x41f18c){const _0x9543e3=a27_0x4dd8e0,{options:_0x187c41,args:_0x5afa6f,tdx:_0x23d0f1}=_0x41f18c,_0x3394b9=_0x187c41,_0xc8dd6=_0x5afa6f[0x0]||_0x187c41[_0x9543e3(0x171)];if(!_0xc8dd6)return console['error'](a27_0x580f47[_0x9543e3(0x24c)](_0x9543e3(0x18c))),console[_0x9543e3(0x146)]('Usage:\x20tdx\x20parent-segment\x20run\x20<name>\x20[-y]\x0a'),console[_0x9543e3(0x146)](a27_0x580f47['cyan'](_0x9543e3(0x175))),0x1;const _0x54dc18=resolveYamlFile(_0xc8dd6);if(existsSync(_0x54dc18)){_0x3394b9[_0x9543e3(0x23b)]&&console[_0x9543e3(0x146)](_0x9543e3(0x1aa)+_0x54dc18);let _0x27b6b1;try{_0x27b6b1=readFileSync(_0x54dc18,_0x9543e3(0x1ed));}catch(_0x4e47cf){const _0x3c5503=_0x4e47cf instanceof Error?_0x4e47cf[_0x9543e3(0x15e)]:String(_0x4e47cf);return console['error'](_0x9543e3(0x192)+_0x3c5503),0x1;}const _0x1b279c=await withSpinner('Analyzing\x20changes...',()=>_0x23d0f1[_0x9543e3(0x13d)][_0x9543e3(0x176)](_0x27b6b1),{'verbose':_0x3394b9[_0x9543e3(0x23b)]}),_0x140fb5=_0x1b279c['data'],{isNew:_0x2c2752,name:_0x589f5a,hasChanges:_0x4c9030,diffFormatted:_0x454ea7}=_0x140fb5;if(_0x4c9030){_0x2c2752?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0x589f5a+'\x27:'):console[_0x9543e3(0x146)](_0x9543e3(0x251)+_0x589f5a+'\x27:');console[_0x9543e3(0x146)]('─'['repeat'](0x3c)),console[_0x9543e3(0x146)](_0x454ea7),console['error']('─'[_0x9543e3(0x1d1)](0x3c));const _0xc7e69f=_0x2c2752?_0x9543e3(0x1c3)+_0x589f5a+'\x27\x20and\x20run\x20workflow?':_0x9543e3(0x232)+_0x589f5a+_0x9543e3(0x236);if(!_0x3394b9['yes']){const _0x71b6ce=await confirmKey(_0xc7e69f);if(!_0x71b6ce)return console[_0x9543e3(0x146)](_0x9543e3(0x1a8)),0x1;}const _0x901d48=_0x2c2752?_0x9543e3(0x1cb):'Updating';await withSpinner(_0x901d48+_0x9543e3(0x194)+_0x589f5a+_0x9543e3(0x23f),()=>_0x140fb5[_0x9543e3(0x1ce)](),{'verbose':_0x3394b9['verbose']});const _0x5e7798=_0x2c2752?_0x9543e3(0x1a7):'Updated';console['error']('✔\x20'+_0x5e7798+_0x9543e3(0x194)+_0x589f5a+'\x27');}else console[_0x9543e3(0x146)]('✔\x20No\x20changes\x20-\x20\x27'+_0x589f5a+_0x9543e3(0x24e));}const _0x15ae69=await withSpinner(_0x9543e3(0x143)+_0xc8dd6+_0x9543e3(0x23f),()=>_0x23d0f1[_0x9543e3(0x13d)]['runParent'](_0xc8dd6),{'verbose':_0x3394b9[_0x9543e3(0x23b)]}),_0x4b9eff=_0x15ae69[_0x9543e3(0x1e0)],_0x5dbee3=getConsoleUrl(_0x3394b9['site'],_0x9543e3(0x204)+_0x4b9eff[_0x9543e3(0x1b1)]+'/sessions/'+_0x4b9eff[_0x9543e3(0x18b)]+'/attempt/'+_0x4b9eff['workflowAttemptId']);return console[_0x9543e3(0x146)](_0x9543e3(0x1dd)),console[_0x9543e3(0x146)]('\x20\x20'+a27_0x580f47[_0x9543e3(0x206)]('Audience\x20ID:')+'\x20'+_0x4b9eff['audienceId']),console[_0x9543e3(0x146)]('\x20\x20'+a27_0x580f47['dim'](_0x9543e3(0x19b))+'\x20'+_0x4b9eff[_0x9543e3(0x1f0)]),console[_0x9543e3(0x146)]('\x20\x20'+a27_0x580f47[_0x9543e3(0x206)]('Session:')+'\x20'+_0x4b9eff[_0x9543e3(0x18b)]),console[_0x9543e3(0x146)]('\x20\x20'+a27_0x580f47['dim'](_0x9543e3(0x191))+'\x20'+_0x4b9eff[_0x9543e3(0x1f3)]),console[_0x9543e3(0x146)]('\x20\x20'+_0x5dbee3),console['error']('\x0a'+a27_0x580f47[_0x9543e3(0x206)](_0x9543e3(0x14a))+_0x9543e3(0x21d)+_0x4b9eff[_0x9543e3(0x1f3)]+_0x9543e3(0x1ec)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a27_0x4dd8e0(0x210)]=a27_0x4dd8e0(0x244);['description']=a27_0x4dd8e0(0x131);async['execute'](_0x53f32e){const _0x24dcac=a27_0x4dd8e0,{options:_0x1d8609,args:_0x1b5333,tdx:_0x1d625c}=_0x53f32e,_0x2015c8=_0x1b5333[0x0]||_0x1d8609[_0x24dcac(0x171)];if(!_0x2015c8)return console[_0x24dcac(0x146)](a27_0x580f47[_0x24dcac(0x24c)](_0x24dcac(0x18c))),console[_0x24dcac(0x146)](_0x24dcac(0x1fb)),console[_0x24dcac(0x146)](a27_0x580f47[_0x24dcac(0x1c2)](_0x24dcac(0x175))),0x1;_0x1d8609[_0x24dcac(0x23b)]&&(console[_0x24dcac(0x146)](_0x24dcac(0x1f9)+_0x1d8609[_0x24dcac(0x17f)]),console[_0x24dcac(0x146)](_0x24dcac(0x14e)+_0x2015c8));const _0x507aba=await withSpinner(_0x24dcac(0x231)+_0x2015c8+_0x24dcac(0x23f),()=>_0x1d625c['segment'][_0x24dcac(0x1a3)](_0x2015c8),{'verbose':_0x1d8609[_0x24dcac(0x23b)]}),_0x464202=_0x507aba[_0x24dcac(0x1e0)];console['error'](_0x24dcac(0x1b5)+_0x464202[_0x24dcac(0x24f)]+_0x24dcac(0x1b0)+(_0x464202[_0x24dcac(0x24f)]!==0x1?'s':''));if(_0x1d8609[_0x24dcac(0x22e)]||_0x1d8609[_0x24dcac(0x23d)])return await handleSDKOutput(_0x464202,_0x1d8609),0x0;return displayFieldsHumanReadable(_0x464202,_0x2015c8),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a27_0x4dd8e0(0x210)]=a27_0x4dd8e0(0x238);[a27_0x4dd8e0(0x21f)]=a27_0x4dd8e0(0x1e7);async[a27_0x4dd8e0(0x165)](_0x26cdda){const _0xa030e6=a27_0x4dd8e0,{options:_0x13b0fa,args:_0x1768a1,tdx:_0x252f89}=_0x26cdda,_0xc146fc=_0x13b0fa,_0x15a109=_0x1768a1[0x0]||_0x13b0fa['parentSegment'];if(!_0x15a109)return console[_0xa030e6(0x146)](a27_0x580f47[_0xa030e6(0x24c)](_0xa030e6(0x18c))),console['error']('Usage:\x20tdx\x20ps\x20view\x20[name]\x20[-w]\x0a'),console[_0xa030e6(0x146)](_0xa030e6(0x1ff)),console[_0xa030e6(0x146)](_0xa030e6(0x19f)),console[_0xa030e6(0x146)](a27_0x580f47['cyan'](_0xa030e6(0x205))),0x1;_0x13b0fa[_0xa030e6(0x23b)]&&(console['error'](_0xa030e6(0x1f9)+_0x13b0fa[_0xa030e6(0x17f)]),console[_0xa030e6(0x146)]('Parent\x20segment:\x20'+_0x15a109));const _0x3881f6=await withSpinner(_0xa030e6(0x1ef)+_0x15a109+_0xa030e6(0x23f),()=>_0x252f89[_0xa030e6(0x13d)][_0xa030e6(0x19e)](_0x15a109),{'verbose':_0x13b0fa[_0xa030e6(0x23b)]}),_0x4719c4=_0x3881f6[_0xa030e6(0x1e0)];if(_0xc146fc['web']){const _0x3ded2c=getConsoleNextUrl(_0xc146fc[_0xa030e6(0x17f)],_0xa030e6(0x22f)+_0x4719c4['id']);return console[_0xa030e6(0x146)](a27_0x580f47[_0xa030e6(0x1f1)]('✔')+_0xa030e6(0x20b)+a27_0x580f47[_0xa030e6(0x1c2)](_0x3ded2c)),openBrowser(_0x3ded2c),0x0;}return await handleSingleObjectOutput(_0x4719c4,_0x13b0fa),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a27_0x4dd8e0(0x210)]='segment:parent:desc';[a27_0x4dd8e0(0x21f)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a27_0x4dd8e0(0x165)](_0xd6327){const _0x37e01d=a27_0x4dd8e0,{options:_0x5888b8,args:_0x3ac89b,tdx:_0x26e43b}=_0xd6327,_0x3603f5=_0x3ac89b[0x0]||_0x5888b8['parentSegment'];if(!_0x3603f5)return console['error'](a27_0x580f47[_0x37e01d(0x24c)](_0x37e01d(0x18c))),console['error'](_0x37e01d(0x23e)),console[_0x37e01d(0x146)](a27_0x580f47[_0x37e01d(0x1c2)](_0x37e01d(0x175))),0x1;_0x5888b8[_0x37e01d(0x23b)]&&(console['error'](_0x37e01d(0x1f9)+_0x5888b8['site']),console[_0x37e01d(0x146)](_0x37e01d(0x14e)+_0x3603f5));const _0xe0cb0=await withSpinner(_0x37e01d(0x1e9)+_0x3603f5+_0x37e01d(0x23f),()=>_0x26e43b[_0x37e01d(0x13d)][_0x37e01d(0x24b)](_0x3603f5),{'verbose':_0x5888b8['verbose']}),_0x4064bf=_0xe0cb0[_0x37e01d(0x1e0)],_0x46c59f=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x3603f5+'\x27...',()=>_0x26e43b[_0x37e01d(0x13d)][_0x37e01d(0x19a)](_0x4064bf),{'verbose':_0x5888b8[_0x37e01d(0x23b)]}),_0x52aa3a=await executeSchemaQuery(_0x46c59f['data'],_0x26e43b,_0x5888b8);return await handleQueryOutput(_0x52aa3a,_0x5888b8),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a27_0x4dd8e0(0x233);[a27_0x4dd8e0(0x21f)]=a27_0x4dd8e0(0x1e5);async[a27_0x4dd8e0(0x165)](_0x1246f7){const _0x3109e9=a27_0x4dd8e0,{options:_0x66c533,args:_0x1307da,tdx:_0x4f61f9}=_0x1246f7,_0x3bc53b=_0x1307da[0x0]||_0x66c533[_0x3109e9(0x171)];if(!_0x3bc53b)return console[_0x3109e9(0x146)](a27_0x580f47[_0x3109e9(0x24c)](_0x3109e9(0x18c))),console[_0x3109e9(0x146)](_0x3109e9(0x1ee)),console[_0x3109e9(0x146)](a27_0x580f47['cyan'](_0x3109e9(0x175))),0x1;_0x66c533[_0x3109e9(0x23b)]&&(console[_0x3109e9(0x146)](_0x3109e9(0x1f9)+_0x66c533['site']),console['error']('Parent\x20segment:\x20'+_0x3bc53b));const _0x1a3011=await withSpinner(_0x3109e9(0x1e9)+_0x3bc53b+_0x3109e9(0x23f),()=>_0x4f61f9[_0x3109e9(0x13d)]['resolveParentId'](_0x3bc53b),{'verbose':_0x66c533[_0x3109e9(0x23b)]}),_0x102d72=_0x1a3011['data'],_0x377223=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x3bc53b+_0x3109e9(0x23f),()=>_0x4f61f9[_0x3109e9(0x13d)][_0x3109e9(0x19a)](_0x102d72),{'verbose':_0x66c533[_0x3109e9(0x23b)]}),_0x4d22a7=_0x377223[_0x3109e9(0x1e0)];return _0x66c533[_0x3109e9(0x208)]==='json'||_0x66c533[_0x3109e9(0x208)]===_0x3109e9(0x23d)?await handleSDKOutput([{'sql':_0x4d22a7}],_0x66c533):console[_0x3109e9(0x20d)](_0x4d22a7),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a27_0x4dd8e0(0x210)]=a27_0x4dd8e0(0x151);[a27_0x4dd8e0(0x21f)]=a27_0x4dd8e0(0x17c);async[a27_0x4dd8e0(0x165)](_0x3117ba){const _0x6b3b88=a27_0x4dd8e0,{options:_0x5040d5,args:_0x55a8a7,tdx:_0x2818d4}=_0x3117ba,_0x59105b=_0x55a8a7[0x0]||_0x5040d5[_0x6b3b88(0x171)];if(!_0x59105b)return console['error'](a27_0x580f47[_0x6b3b88(0x24c)](_0x6b3b88(0x18c))),console[_0x6b3b88(0x146)](_0x6b3b88(0x229)),console['error'](a27_0x580f47[_0x6b3b88(0x1c2)](_0x6b3b88(0x175))),0x1;_0x5040d5[_0x6b3b88(0x23b)]&&(console[_0x6b3b88(0x146)](_0x6b3b88(0x1f9)+_0x5040d5[_0x6b3b88(0x17f)]),console[_0x6b3b88(0x146)](_0x6b3b88(0x14e)+_0x59105b));const _0x443f00=await withSpinner(_0x6b3b88(0x1e9)+_0x59105b+'\x27...',()=>_0x2818d4[_0x6b3b88(0x13d)][_0x6b3b88(0x24b)](_0x59105b),{'verbose':_0x5040d5[_0x6b3b88(0x23b)]}),_0x3b4013=_0x443f00['data'],_0x272009=await withSpinner(_0x6b3b88(0x16c)+_0x59105b+_0x6b3b88(0x23f),()=>_0x2818d4[_0x6b3b88(0x13d)][_0x6b3b88(0x19a)](_0x3b4013),{'verbose':_0x5040d5[_0x6b3b88(0x23b)]});let _0x269d52=_0x272009['data'];const _0x361fdc=resolveLimit(_0x5040d5[_0x6b3b88(0x1fa)],DEFAULT_DISPLAY_LIMIT),_0x22c7a7=/\bLIMIT\s+\d+/i['test'](_0x269d52);!_0x22c7a7&&(_0x269d52=_0x269d52[_0x6b3b88(0x1a0)]()[_0x6b3b88(0x1b6)](/;+$/,''),_0x269d52=_0x6b3b88(0x1c8)+_0x269d52+_0x6b3b88(0x241)+_0x361fdc);_0x5040d5[_0x6b3b88(0x23b)]&&console[_0x6b3b88(0x146)](_0x6b3b88(0x149)+_0x269d52);const _0x3dd2fd=await withQuerySpinner(_0x6b3b88(0x17b),async _0x112e94=>{const _0x47d2d9=_0x6b3b88,_0x4c9070=await _0x2818d4[_0x47d2d9(0x199)]['execute'](_0x269d52,{'catalog':'td','schema':_0x47d2d9(0x1e6),'onJobId':_0x1bef08=>{const _0x224fed=_0x47d2d9;_0x112e94[_0x224fed(0x1a2)](_0x1bef08);}});return _0x4c9070;},{'verbose':_0x5040d5[_0x6b3b88(0x23b)]}),_0x189272=_0x3dd2fd[_0x6b3b88(0x1e0)],_0xb2645d=_0x189272[_0x6b3b88(0x1b4)]?_0x6b3b88(0x15f)+_0x189272[_0x6b3b88(0x1b4)]+']':'';return console[_0x6b3b88(0x146)](_0x6b3b88(0x18e)+_0x189272[_0x6b3b88(0x254)][_0x6b3b88(0x185)][_0x6b3b88(0x22a)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x189272[_0x6b3b88(0x254)][_0x6b3b88(0x155)])+_0xb2645d)),await handleQueryOutput(_0x189272,_0x5040d5),0x0;}}
1
+ const a27_0x5f1085=a27_0xa2d9;(function(_0x49da18,_0x3fb43f){const _0x4ab8c8=a27_0xa2d9,_0x2eb221=_0x49da18();while(!![]){try{const _0x1fcfd3=parseInt(_0x4ab8c8(0x1c3))/0x1*(parseInt(_0x4ab8c8(0x23b))/0x2)+-parseInt(_0x4ab8c8(0x233))/0x3+-parseInt(_0x4ab8c8(0x247))/0x4*(parseInt(_0x4ab8c8(0x1e3))/0x5)+parseInt(_0x4ab8c8(0x24b))/0x6*(parseInt(_0x4ab8c8(0x254))/0x7)+-parseInt(_0x4ab8c8(0x217))/0x8*(-parseInt(_0x4ab8c8(0x1f9))/0x9)+-parseInt(_0x4ab8c8(0x19e))/0xa+parseInt(_0x4ab8c8(0x1f1))/0xb;if(_0x1fcfd3===_0x3fb43f)break;else _0x2eb221['push'](_0x2eb221['shift']());}catch(_0x328920){_0x2eb221['push'](_0x2eb221['shift']());}}}(a27_0x1165,0xed1e0));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a27_0xf7f5a from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';function a27_0xa2d9(_0x1debd4,_0xc9f7a1){_0x1debd4=_0x1debd4-0x17f;const _0x1165e2=a27_0x1165();let _0xa2d940=_0x1165e2[_0x1debd4];return _0xa2d940;}import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a27_0x4111a0 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';const PARENT_SEGMENT_DIR=a27_0x5f1085(0x182),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x314752){const _0xff2fa4=a27_0x5f1085,_0x16e93c=process[_0xff2fa4(0x1a6)],_0x541f2a=_0x16e93c==='darwin'?_0xff2fa4(0x18a):_0x16e93c===_0xff2fa4(0x1a1)?_0xff2fa4(0x1ab):_0xff2fa4(0x22d);spawn(_0x541f2a,[_0x314752],{'detached':!![],'stdio':_0xff2fa4(0x1a7)})[_0xff2fa4(0x286)]();}function sanitizeFileName(_0xa8100a){const _0x3d7cf4=a27_0x5f1085;return _0xa8100a[_0x3d7cf4(0x240)]()[_0x3d7cf4(0x1cb)](/[/\\:*?"<>|]/g,'-')[_0x3d7cf4(0x1cb)](/\s+/g,'-')['replace'](/-+/g,'-')['replace'](/^-|-$/g,'');}function migrateLegacyDirectory(){const _0x12b5dd=a27_0x5f1085;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x2f5778=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x2f5778[_0x12b5dd(0x1c6)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x12b5dd(0x1bf)](a27_0x4111a0[_0x12b5dd(0x261)](_0x12b5dd(0x206)+LEGACY_PARENT_SEGMENT_DIR+_0x12b5dd(0x204)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x12b5dd(0x1bf)](a27_0x4111a0[_0x12b5dd(0x186)](_0x12b5dd(0x20d)+LEGACY_PARENT_SEGMENT_DIR+_0x12b5dd(0x1f4))),![];console['error'](a27_0x4111a0[_0x12b5dd(0x261)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x12b5dd(0x1fd)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x12b5dd(0x1bf)](a27_0x4111a0[_0x12b5dd(0x1de)](_0x12b5dd(0x265)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x15deb9){const _0x43ee4b=_0x15deb9 instanceof Error?_0x15deb9[_0x12b5dd(0x276)]:String(_0x15deb9);return console['error'](a27_0x4111a0[_0x12b5dd(0x258)](_0x12b5dd(0x299)+_0x43ee4b+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a27_0x5f1085(0x1a4)](_0x422960){const _0x47d199=a27_0x5f1085;return migrateLegacyDirectory(),super[_0x47d199(0x1a4)](_0x422960);}}function resolveYamlFile(_0x3ffa22){const _0x3be30b=a27_0x5f1085;if(_0x3ffa22[_0x3be30b(0x275)](_0x3be30b(0x18b))||_0x3ffa22[_0x3be30b(0x275)](_0x3be30b(0x199)))return _0x3ffa22;return a27_0xf7f5a[_0x3be30b(0x295)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3ffa22)+_0x3be30b(0x18b));}function a27_0x1165(){const _0x41dcae=['table','No\x20parent\x20segments\x20match\x20pattern:\x20','validateParentYaml','utf-8','xdg-open','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','label','cyan','map','population','3339231tJOcKC','stats','data','description','displayBehaviorsStats','repeat','\x27\x20and\x20run\x20workflow?','Error:\x20--database\x20and\x20--table\x20are\x20required','444646NrpLwr','\x20Opening\x20','\x0aChanges\x20to\x20apply\x20to\x20\x27','trim','\x20--interval\x20','toLowerCase','attributes','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','No\x20parent\x20segments\x20found','\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','segment:parent:sql','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','3542192xNKFKe','behaviorsFile','segment:parent:preview','segment:parent:validate','6SpdxcE','all','allValid','execute','behaviors','\x0aUsage:\x20tdx\x20ps\x20preview\x20','segment:parent:show','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20use\x20`tdx\x20ps\x20pull`\x20to\x20get\x20a\x20YAML\x20file\x20first','Executing\x20parent\x20segment\x20query...','4283342akJuTe','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Fetching\x20SQL\x20for\x20\x27','rowCount','red','Preview:','Validate:','varchar','Usage:\x20tdx\x20ps\x20view\x20[name]\x20[-w]\x0a','elapsedTimeMillis','\x20tdx\x20wf\x20attempt\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x27...','yellow','Aborted.','Status:','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','✔\x20Renamed\x20directory\x20to\x20','\x0aNew\x20parent\x20segment\x20\x27','scheduleType','Join:','totalEvents','enriched','\x27\x20is\x20already\x20up\x20to\x20date','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20No\x20sample\x20data\x20available','customerPercent','Resolving\x20parent\x20segment\x20\x27','output','\x20--enriched','Fetching\x20sample\x20data...','\x0a✔\x20Workflow\x20started','Apply\x20changes\x20to\x20\x27','endsWith','message','Found\x20YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20sql\x20[name]\x0a','previewParentYaml','workflowAttemptId','Error:','workflowSessionId','segment:parent:create','yes','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','displayPreviewHints','Available\x20behaviors:','Get\x20SQL\x20query\x20for\x20parent\x20segment','foreignKey','segment:parent:run','sort','unref','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','listFields','\x20=\x20','segment:parent:update','\x20\x20\x20\x20-\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','addAttributes','Events:','master','Pattern:\x20','behavior','Error:\x20File\x20not\x20found:\x20','length','✔\x20Created\x20parent\x20segment\x20\x27','join','createParent','string','match','✘\x20Failed\x20to\x20rename\x20directory:\x20','Usage:\x20tdx\x20parent-segment\x20run\x20<name>\x20[-y]\x0a','Name:\x20','apply','\x20field','Table:\x20','Behavior:','test','number','YAML\x20file:\x20','Attempt:','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','parent_segments','getParentFull','Usage:\x20tdx\x20ps\x20fields\x20[name]\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','dim','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20[Job\x20ID:\x20','Error\x20parsing\x20YAML:\x20','open','.yml','log','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','displayPreviewResults','site','use','Usage:\x20tdx\x20ps\x20pull\x20[name]\x20[-o\x20output.yml]\x20[-y]\x0a','parentSegment','Site:\x20','pushParentYaml','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','displayColumns','Columns:','Parent\x20segment:\x20','.yaml','customerGroupFile','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20Configuration\x20is\x20valid','To\x20view\x20sample\x20data:','1137040pTeIzd','name','%)\x20','win32','Output\x20file:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','run','displayValidateResults','platform','ignore','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','verbose','jobId','start','\x27\x20with\x20ID:\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','schemaValid','interval','attribute','text','SQL\x20query:\x0a','Listing\x20fields\x20for\x20\x27','\x20No\x20changes\x20-\x20','toFixed','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','parent_segment','using\x20the\x20default\x20path:\x20','stop','limit','/sessions/','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','updateParent','Updated','error','\x20rows\x20','resolveParentId','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','1YQGMpL','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','dirname','isDirectory','/app/workflows/','`\x20to\x20download\x20the\x20configuration\x20first','Available\x20attributes:','sampleData','replace','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Errors:','Source:','toLocaleString','schemaError','\x20rows)','coveragePercent','Fetching\x20current\x20configuration\x20for\x20\x27','matchedCount','customerGroup','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','setJobId','query','segment:parent:list','preview','Listing\x20parent\x20segments\x20matching\x20\x27','✔\x20Found\x20','Enriched:','green','jsonl','Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a','\x20--behavior\x20\x22','✔\x20Query\x20completed:\x20Processed\x20','5wdViDS','\x20--attribute\x20\x22','List\x20parent\x20segments','Analyzing\x20changes...','Fetching\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22<name>\x22','format','Behaviors','Create\x20parent\x20segment\x20\x27','\x20parent\x20segment','\x20Context\x20set:\x20','audienceId','\x20is\x20already\x20up\x20to\x20date','Join\x20on:','22098846rVIXFd','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','displaySummary','/\x20directory.\x0a','Overwrite\x20\x27','keys','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','9EfwvIK','\x0aChanges\x20to\x20\x27','attributesFile','addBehaviorsFile','/\x20→\x20','processedRows','json','column','\x5c$&','bold','web','/\x20and\x20','tdx\x20segment\x20parent\x20preview\x20','\x0a⚠️\x20\x20Both\x20','Created','displaySampleData','timezone','customersWithEvents','scheduleOption','segment','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','joinKey','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','errors','status','Creating','displayAttributesStats','Options:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Master:','1922768HZTkMa','displayMasterInfo','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','database','✔\x20No\x20changes\x20-\x20\x27','getParentSQL','segment:parent:view','👥\x20','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)','\x20kill','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)','Usage:\x20tdx\x20parent-segment\x20validate\x20<name>\x20[options]\x0a','segment:parent:push','\x20parent\x20segment\x20\x27','Error\x20reading\x20file:\x20','SELECT\x20*\x20FROM\x20(\x0a','Customers:','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'];a27_0x1165=function(){return _0x41dcae;};return a27_0x1165();}function formatProgressMessage(_0x13513a){const _0xb61e=a27_0x5f1085,_0xd24c10=_0x13513a[_0xb61e(0x298)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0xd24c10){const [,_0x4948ee,_0x3fb79,_0x4866f8='']=_0xd24c10;return a27_0x4111a0[_0xb61e(0x186)](_0x4948ee+':')+'\x20'+_0x3fb79+a27_0x4111a0[_0xb61e(0x186)](_0x4866f8);}return a27_0x4111a0['dim'](_0x13513a);}function showFileNotFoundError(_0x3bb1d7,_0x34f1fc){const _0x2de45e=a27_0x5f1085;console[_0x2de45e(0x1bf)](a27_0x4111a0[_0x2de45e(0x258)](_0x2de45e(0x292)+_0x3bb1d7+'\x0a')),console['error'](a27_0x4111a0[_0x2de45e(0x230)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x34f1fc+_0x2de45e(0x1c8)));}export class ParentSegmentListCommand extends BaseCommand{[a27_0x5f1085(0x19f)]=a27_0x5f1085(0x1d9);[a27_0x5f1085(0x236)]=a27_0x5f1085(0x1e5);async[a27_0x5f1085(0x24e)](_0x33a38e){const _0x3683ce=a27_0x5f1085,{options:_0x28f0ab,args:_0x2133fe,tdx:_0x2bfd62}=_0x33a38e,_0x796d7b=_0x2133fe[0x0];_0x28f0ab['verbose']&&(console[_0x3683ce(0x1bf)](_0x3683ce(0x193)+_0x28f0ab['site']),_0x796d7b&&console['error'](_0x3683ce(0x290)+_0x796d7b));const _0x1772f1=await withSpinner(_0x796d7b?_0x3683ce(0x1db)+_0x796d7b+_0x3683ce(0x260):'Listing\x20parent\x20segments...',()=>_0x2bfd62['segment']['listParents'](),{'verbose':_0x28f0ab[_0x3683ce(0x1a9)]});let _0x218efd=_0x1772f1['data'];if(_0x796d7b){const _0x3d70b9=_0x796d7b[_0x3683ce(0x1cb)](/[.+^${}()|[\]\\]/g,_0x3683ce(0x201))['replace'](/\*/g,'.*')[_0x3683ce(0x1cb)](/\?/g,'.'),_0x3f786b=new RegExp('^'+_0x3d70b9+'$','i');_0x218efd=_0x218efd['filter'](_0x3f867a=>_0x3f786b[_0x3683ce(0x2a0)](_0x3f867a['attributes']['name']));}_0x218efd[_0x3683ce(0x285)]((_0x56bd14,_0x2e52de)=>_0x56bd14[_0x3683ce(0x241)][_0x3683ce(0x19f)]['localeCompare'](_0x2e52de['attributes'][_0x3683ce(0x19f)])),console[_0x3683ce(0x1bf)](_0x3683ce(0x1dc)+_0x218efd[_0x3683ce(0x293)]+_0x3683ce(0x1ec)+(_0x218efd[_0x3683ce(0x293)]!==0x1?'s':''));if(_0x28f0ab[_0x3683ce(0x1e9)]===_0x3683ce(0x1ff)||_0x28f0ab[_0x3683ce(0x1e9)]===_0x3683ce(0x1df))await handleSDKOutput(_0x218efd,_0x28f0ab);else{if(_0x218efd['length']===0x0)_0x796d7b?console['log'](_0x3683ce(0x22a)+_0x796d7b):console[_0x3683ce(0x18c)](_0x3683ce(0x243));else for(const _0x1a6273 of _0x218efd){const _0x4f7681=_0x1a6273[_0x3683ce(0x241)]['population']?a27_0x4111a0[_0x3683ce(0x186)]('\x20('+formatRows(_0x1a6273[_0x3683ce(0x241)][_0x3683ce(0x232)])+')'):'';console[_0x3683ce(0x18c)](_0x3683ce(0x21e)+_0x1a6273[_0x3683ce(0x241)][_0x3683ce(0x19f)]+_0x4f7681);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a27_0x5f1085(0x19f)]=a27_0x5f1085(0x27d);[a27_0x5f1085(0x236)]=a27_0x5f1085(0x1ad);async[a27_0x5f1085(0x24e)](_0x27ae71){const _0x1b8a7e=a27_0x5f1085,{options:_0x143561,args:_0x298780,tdx:_0x1256e8}=_0x27ae71;console[_0x1b8a7e(0x1bf)](_0x1b8a7e(0x1f7)+_0x1b8a7e(0x27f)+_0x1b8a7e(0x1c4));const _0x5f39c7=_0x143561;if(_0x298780['length']===0x0)return console[_0x1b8a7e(0x1bf)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x1b8a7e(0x1bf)](_0x1b8a7e(0x228)),0x1;const _0x3a2029=_0x298780[0x0];if(!_0x5f39c7[_0x1b8a7e(0x21a)]||!_0x5f39c7[_0x1b8a7e(0x229)])return console['error'](_0x1b8a7e(0x23a)),console['error'](_0x1b8a7e(0x228)),0x1;_0x5f39c7[_0x1b8a7e(0x1a9)]&&(console['error'](_0x1b8a7e(0x193)+_0x5f39c7[_0x1b8a7e(0x18f)]),console[_0x1b8a7e(0x1bf)](_0x1b8a7e(0x29b)+_0x3a2029),console[_0x1b8a7e(0x1bf)]('Database:\x20'+_0x5f39c7[_0x1b8a7e(0x21a)]),console['error'](_0x1b8a7e(0x29e)+_0x5f39c7[_0x1b8a7e(0x229)]));const _0x1ed5fc=await loadJSONFromOptions(_0x5f39c7[_0x1b8a7e(0x241)],_0x5f39c7[_0x1b8a7e(0x1fb)]),_0x1b0c96=await loadJSONFromOptions(_0x5f39c7[_0x1b8a7e(0x24f)],_0x5f39c7[_0x1b8a7e(0x248)]),_0x59c148=await loadJSONFromOptions(_0x5f39c7[_0x1b8a7e(0x1d5)],_0x5f39c7[_0x1b8a7e(0x19a)]),_0x38deb2={'name':_0x3a2029,'description':_0x5f39c7[_0x1b8a7e(0x236)],'scheduleType':_0x5f39c7['scheduleType'],'scheduleOption':_0x5f39c7[_0x1b8a7e(0x20b)],'timezone':_0x5f39c7[_0x1b8a7e(0x209)],'master':{'parentDatabaseName':_0x5f39c7[_0x1b8a7e(0x21a)],'parentTableName':_0x5f39c7[_0x1b8a7e(0x229)]},'attributes':_0x1ed5fc,'behaviors':_0x1b0c96,'customerGroup':_0x59c148},_0x2172e1=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x3a2029+'\x27...',()=>_0x1256e8[_0x1b8a7e(0x20c)][_0x1b8a7e(0x296)](_0x38deb2),{'verbose':_0x143561[_0x1b8a7e(0x1a9)]}),_0x3d7825=_0x2172e1[_0x1b8a7e(0x235)];return console['error'](_0x1b8a7e(0x294)+_0x3d7825[_0x1b8a7e(0x19f)]+_0x1b8a7e(0x1ac)+_0x3d7825['id']),await handleSDKOutput([_0x3d7825],_0x143561),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a27_0x5f1085(0x19f)]=a27_0x5f1085(0x28a);[a27_0x5f1085(0x236)]=a27_0x5f1085(0x246);async[a27_0x5f1085(0x24e)](_0x1f0db8){const _0x185ef7=a27_0x5f1085,{options:_0x2d4795,args:_0x5b88df,tdx:_0x2fdc8a}=_0x1f0db8;console[_0x185ef7(0x1bf)](_0x185ef7(0x20f)+_0x185ef7(0x27f)+_0x185ef7(0x1c4));const _0x582622=_0x2d4795;if(_0x5b88df[_0x185ef7(0x293)]===0x0)return console['error'](_0x185ef7(0x1a3)),console['error'](_0x185ef7(0x1c2)),0x1;const _0x3e009d=_0x5b88df[0x0];_0x582622[_0x185ef7(0x1a9)]&&(console[_0x185ef7(0x1bf)]('Site:\x20'+_0x582622[_0x185ef7(0x18f)]),console['error'](_0x185ef7(0x198)+_0x3e009d));const _0x14c8ac=await withSpinner(_0x185ef7(0x1d3)+_0x3e009d+_0x185ef7(0x260),()=>_0x2fdc8a[_0x185ef7(0x20c)][_0x185ef7(0x183)](_0x3e009d),{'verbose':_0x582622[_0x185ef7(0x1a9)]}),_0x497827=_0x14c8ac[_0x185ef7(0x235)],_0x389b10=await loadJSONFromOptions(_0x582622[_0x185ef7(0x28d)],_0x582622['addAttributesFile']),_0x538324=await loadJSONFromOptions(_0x582622['addBehaviors'],_0x582622[_0x185ef7(0x1fc)]),_0x4bbd2d={'name':_0x497827[_0x185ef7(0x19f)],'description':_0x582622[_0x185ef7(0x236)]!==undefined?_0x582622['description']:_0x497827[_0x185ef7(0x236)],'scheduleType':_0x582622[_0x185ef7(0x267)]!==undefined?_0x582622[_0x185ef7(0x267)]:_0x497827[_0x185ef7(0x267)],'scheduleOption':_0x582622[_0x185ef7(0x20b)]!==undefined?_0x582622[_0x185ef7(0x20b)]:_0x497827[_0x185ef7(0x20b)],'timezone':_0x582622[_0x185ef7(0x209)]!==undefined?_0x582622[_0x185ef7(0x209)]:_0x497827['timezone'],'master':_0x497827[_0x185ef7(0x28f)],'attributes':_0x389b10?[..._0x497827[_0x185ef7(0x241)]||[],..._0x389b10]:_0x497827[_0x185ef7(0x241)],'behaviors':_0x538324?[..._0x497827[_0x185ef7(0x24f)]||[],..._0x538324]:_0x497827[_0x185ef7(0x24f)],'customerGroup':_0x497827[_0x185ef7(0x1d5)]},_0x395170=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x3e009d+'\x27...',()=>_0x2fdc8a[_0x185ef7(0x20c)][_0x185ef7(0x1bd)](_0x3e009d,_0x4bbd2d),{'verbose':_0x582622[_0x185ef7(0x1a9)]}),_0x427df9=_0x395170[_0x185ef7(0x235)];return console['error'](_0x185ef7(0x185)+_0x427df9['name']+'\x27'),await handleSDKOutput([_0x427df9],_0x582622),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']='segment:parent:pull';[a27_0x5f1085(0x236)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a27_0x5f1085(0x24e)](_0x192374){const _0x5001b5=a27_0x5f1085,{options:_0x45fc9d,args:_0x13812f,tdx:_0x264ced}=_0x192374,_0x54fb20=_0x45fc9d,_0x26fc62=_0x13812f[0x0]||_0x45fc9d[_0x5001b5(0x192)];if(!_0x26fc62)return console[_0x5001b5(0x1bf)](a27_0x4111a0[_0x5001b5(0x258)]('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x5001b5(0x1bf)](_0x5001b5(0x191)),console['error'](a27_0x4111a0[_0x5001b5(0x230)](_0x5001b5(0x18d))),0x1;if(_0x54fb20[_0x5001b5(0x190)]&&_0x54fb20[_0x5001b5(0x270)])return console[_0x5001b5(0x1bf)](a27_0x4111a0[_0x5001b5(0x258)](_0x5001b5(0x242))),console[_0x5001b5(0x1bf)](a27_0x4111a0[_0x5001b5(0x186)](_0x5001b5(0x195))),console[_0x5001b5(0x1bf)](a27_0x4111a0[_0x5001b5(0x186)](_0x5001b5(0x1b8)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x5001b5(0x1bf)](a27_0x4111a0[_0x5001b5(0x230)](_0x5001b5(0x219))),0x1;const _0x3b337d=_0x54fb20[_0x5001b5(0x270)]||a27_0xf7f5a[_0x5001b5(0x295)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x26fc62)+_0x5001b5(0x18b));_0x54fb20[_0x5001b5(0x1a9)]&&(console[_0x5001b5(0x1bf)](_0x5001b5(0x193)+_0x54fb20[_0x5001b5(0x18f)]),console['error'](_0x5001b5(0x198)+_0x26fc62),console[_0x5001b5(0x1bf)](_0x5001b5(0x1a2)+_0x3b337d));const _0x57d2b9=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x26fc62+_0x5001b5(0x260),()=>_0x264ced[_0x5001b5(0x20c)]['pullParentYaml'](_0x26fc62),{'verbose':_0x54fb20[_0x5001b5(0x1a9)]}),_0x197a61=_0x57d2b9[_0x5001b5(0x235)];if(existsSync(_0x3b337d)){const _0x5395cc=readFileSync(_0x3b337d,_0x5001b5(0x22c)),_0x2097d3=generateDiff(_0x5395cc,_0x197a61);if(!hasChanges(_0x2097d3))console[_0x5001b5(0x1bf)](a27_0x4111a0[_0x5001b5(0x1de)]('✔')+_0x5001b5(0x1b4)+a27_0x4111a0[_0x5001b5(0x230)](_0x3b337d)+_0x5001b5(0x1ef));else{console[_0x5001b5(0x1bf)](_0x5001b5(0x1fa)+_0x3b337d+'\x27:'),console[_0x5001b5(0x1bf)]('─'['repeat'](0x3c)),console['error'](formatDiffWithColors(_0x2097d3)),console[_0x5001b5(0x1bf)]('─'[_0x5001b5(0x238)](0x3c));if(!_0x54fb20[_0x5001b5(0x27e)]){const _0x2721ea=await confirmKey(_0x5001b5(0x1f5)+_0x3b337d+'\x27?');if(!_0x2721ea)return console[_0x5001b5(0x1bf)](_0x5001b5(0x262)),0x1;}writeFileSync(_0x3b337d,_0x197a61,_0x5001b5(0x22c)),console[_0x5001b5(0x1bf)](a27_0x4111a0[_0x5001b5(0x1de)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a27_0x4111a0[_0x5001b5(0x230)](_0x3b337d));}}else{const _0x5514a1=a27_0xf7f5a[_0x5001b5(0x1c5)](_0x3b337d);!existsSync(_0x5514a1)&&mkdirSync(_0x5514a1,{'recursive':!![]}),writeFileSync(_0x3b337d,_0x197a61,_0x5001b5(0x22c)),console[_0x5001b5(0x1bf)](a27_0x4111a0[_0x5001b5(0x1de)]('✔')+_0x5001b5(0x187)+a27_0x4111a0[_0x5001b5(0x230)](_0x3b337d));}return saveSessionContext({'parent_segment':_0x26fc62},_0x54fb20['session']),console[_0x5001b5(0x1bf)](a27_0x4111a0[_0x5001b5(0x1de)]('✔')+_0x5001b5(0x1ed)+a27_0x4111a0['dim'](_0x5001b5(0x1b7))+_0x5001b5(0x289)+a27_0x4111a0[_0x5001b5(0x230)](_0x26fc62)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a27_0x5f1085(0x19f)]=a27_0x5f1085(0x223);['description']=a27_0x5f1085(0x1f2);async[a27_0x5f1085(0x24e)](_0x189df0){const _0x2173f6=a27_0x5f1085,{options:_0x58cb2b,args:_0x474733,tdx:_0x423690}=_0x189df0,_0x355fb7=_0x58cb2b,_0x2826f4=_0x474733[0x0]||_0x58cb2b['parentSegment'];if(!_0x2826f4)return console[_0x2173f6(0x1bf)](a27_0x4111a0['red'](_0x2173f6(0x1e0))),console[_0x2173f6(0x1bf)]('Usage:\x20tdx\x20ps\x20push\x20[name]\x20[-y]\x0a'),console[_0x2173f6(0x1bf)](a27_0x4111a0[_0x2173f6(0x230)](_0x2173f6(0x252))),0x1;const _0xe2d784=resolveYamlFile(_0x2826f4);if(!existsSync(_0xe2d784))return showFileNotFoundError(_0xe2d784,_0x2826f4),0x1;_0x355fb7[_0x2173f6(0x1a9)]&&(console[_0x2173f6(0x1bf)](_0x2173f6(0x193)+_0x355fb7[_0x2173f6(0x18f)]),console[_0x2173f6(0x1bf)](_0x2173f6(0x17f)+_0xe2d784));let _0x56a518;try{_0x56a518=readFileSync(_0xe2d784,_0x2173f6(0x22c));}catch(_0x5391ef){const _0x2f6bb9=_0x5391ef instanceof Error?_0x5391ef[_0x2173f6(0x276)]:String(_0x5391ef);return console[_0x2173f6(0x1bf)](_0x2173f6(0x225)+_0x2f6bb9),0x1;}const _0x147c15=await withSpinner(_0x2173f6(0x1e6),()=>_0x423690[_0x2173f6(0x20c)][_0x2173f6(0x194)](_0x56a518),{'verbose':_0x355fb7[_0x2173f6(0x1a9)]}),_0x1cf991=_0x147c15[_0x2173f6(0x235)],{isNew:_0x3cae83,name:_0x22f89b,hasChanges:_0x453db8,diffFormatted:_0x266c7c}=_0x1cf991;if(!_0x453db8)return console[_0x2173f6(0x1bf)]('✔\x20No\x20changes\x20-\x20\x27'+_0x22f89b+_0x2173f6(0x26b)),0x0;_0x3cae83?console[_0x2173f6(0x1bf)](_0x2173f6(0x266)+_0x22f89b+'\x27:'):console[_0x2173f6(0x1bf)](_0x2173f6(0x23d)+_0x22f89b+'\x27:');console[_0x2173f6(0x1bf)]('─'[_0x2173f6(0x238)](0x3c)),console[_0x2173f6(0x1bf)](_0x266c7c),console[_0x2173f6(0x1bf)]('─'[_0x2173f6(0x238)](0x3c));const _0x4b38a8=_0x3cae83?_0x2173f6(0x1eb)+_0x22f89b+'\x27?':_0x2173f6(0x274)+_0x22f89b+'\x27?';if(!_0x355fb7[_0x2173f6(0x27e)]){const _0x494617=await confirmKey(_0x4b38a8);if(!_0x494617)return console['error'](_0x2173f6(0x262)),0x1;}const _0x3cb17b=_0x3cae83?_0x2173f6(0x212):'Updating',_0x4d7a13=await withSpinner(_0x3cb17b+_0x2173f6(0x224)+_0x22f89b+_0x2173f6(0x260),()=>_0x1cf991[_0x2173f6(0x29c)](),{'verbose':_0x355fb7[_0x2173f6(0x1a9)]}),_0x3158da=_0x4d7a13[_0x2173f6(0x235)],_0x5c9e09=getConsoleNextUrl(_0x355fb7[_0x2173f6(0x18f)],'/app/dw/parentSegments/'+_0x3158da['id']),_0x414555=_0x3cae83?_0x2173f6(0x207):'Updated';return console['error']('✔\x20'+_0x414555+_0x2173f6(0x224)+_0x3158da[_0x2173f6(0x19f)]+'\x27'),console[_0x2173f6(0x1bf)]('\x20\x20'+_0x5c9e09),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a27_0x5f1085(0x19f)]=a27_0x5f1085(0x24a);[a27_0x5f1085(0x236)]=a27_0x5f1085(0x25f);async[a27_0x5f1085(0x24e)](_0x1396f1){const _0x5a5331=a27_0x5f1085,{options:_0x5d640c,args:_0x2e8dfc,tdx:_0xcc67ff}=_0x1396f1,_0x1764a6=_0x5d640c,_0x2206bf=_0x2e8dfc[0x0]||_0x5d640c[_0x5a5331(0x192)];if(!_0x2206bf)return console[_0x5a5331(0x1bf)](a27_0x4111a0[_0x5a5331(0x258)](_0x5a5331(0x1e0))),console[_0x5a5331(0x1bf)](_0x5a5331(0x222)),console['error']('Options:'),console[_0x5a5331(0x1bf)](_0x5a5331(0x21f)),console['error'](_0x5a5331(0x221)),console[_0x5a5331(0x1bf)](_0x5a5331(0x1cc)),console[_0x5a5331(0x1bf)](a27_0x4111a0[_0x5a5331(0x230)]('\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;const _0x4a7b9b=resolveYamlFile(_0x2206bf);if(!existsSync(_0x4a7b9b))return showFileNotFoundError(_0x4a7b9b,_0x2206bf),0x1;_0x1764a6[_0x5a5331(0x1a9)]&&(console['error'](_0x5a5331(0x193)+_0x1764a6['site']),console[_0x5a5331(0x1bf)](_0x5a5331(0x17f)+_0x4a7b9b));let _0x1b2d19;try{_0x1b2d19=readFileSync(_0x4a7b9b,_0x5a5331(0x22c));}catch(_0x442b11){const _0x26f1da=_0x442b11 instanceof Error?_0x442b11[_0x5a5331(0x276)]:String(_0x442b11);return console[_0x5a5331(0x1bf)](_0x5a5331(0x225)+_0x26f1da),0x1;}const _0xa94860=createCommandSpinner(a27_0x4111a0[_0x5a5331(0x186)]('Validating\x20configuration...'),{'verbose':_0x1764a6[_0x5a5331(0x1a9)]});_0xa94860[_0x5a5331(0x1ab)]();const _0x2fe192={'onProgress':_0x2e1cfa=>{const _0xe1e670=_0x5a5331;_0xa94860[_0xe1e670(0x1b1)]=formatProgressMessage(_0x2e1cfa);}};if(_0x1764a6[_0x5a5331(0x28f)])_0x2fe192[_0x5a5331(0x28f)]=!![];if(_0x1764a6[_0x5a5331(0x26a)])_0x2fe192[_0x5a5331(0x26a)]=!![];_0x1764a6[_0x5a5331(0x1b0)]&&(_0x2fe192[_0x5a5331(0x1b0)]=_0x1764a6[_0x5a5331(0x1b0)]);_0x1764a6[_0x5a5331(0x291)]&&(_0x2fe192[_0x5a5331(0x291)]=_0x1764a6[_0x5a5331(0x291)]);if(_0x1764a6[_0x5a5331(0x1af)])_0x2fe192[_0x5a5331(0x1af)]=_0x1764a6[_0x5a5331(0x1af)];let _0x233842;try{_0x233842=await _0xcc67ff[_0x5a5331(0x20c)][_0x5a5331(0x22b)](_0x1b2d19,_0x2fe192),_0xa94860[_0x5a5331(0x1b9)]();}catch(_0x45200c){_0xa94860[_0x5a5331(0x1b9)]();throw _0x45200c;}const _0x229df7=_0x1764a6[_0x5a5331(0x1af)]||'-1d';return this[_0x5a5331(0x1a5)](_0x233842,_0x2fe192,_0x4a7b9b,_0x229df7),_0x233842[_0x5a5331(0x24d)]?0x0:0x1;}[a27_0x5f1085(0x1a5)](_0x16ebe8,_0x348cfc,_0x14fc82,_0x2a11f4){const _0x1a72f8=a27_0x5f1085;console[_0x1a72f8(0x1bf)]('\x0a'+a27_0x4111a0['bold'](_0x1a72f8(0x25a))+'\x20'+_0x16ebe8[_0x1a72f8(0x19f)]),console['error']('═'[_0x1a72f8(0x238)](0x3c)),this[_0x1a72f8(0x218)](_0x16ebe8);if(typeof _0x348cfc[_0x1a72f8(0x1b0)]===_0x1a72f8(0x297)){this['displayAttributesStats'](_0x16ebe8),this['displaySummary'](_0x16ebe8),this['displayPreviewHints'](_0x14fc82,_0x2a11f4,'attribute',_0x348cfc['attribute']);return;}if(_0x348cfc[_0x1a72f8(0x1b0)]===!![]){this[_0x1a72f8(0x213)](_0x16ebe8),this['displaySummary'](_0x16ebe8),this[_0x1a72f8(0x280)](_0x14fc82,_0x2a11f4,_0x1a72f8(0x241));return;}if(typeof _0x348cfc[_0x1a72f8(0x291)]===_0x1a72f8(0x297)){this['displayBehaviorsStats'](_0x16ebe8,_0x2a11f4),this[_0x1a72f8(0x1f3)](_0x16ebe8),this[_0x1a72f8(0x280)](_0x14fc82,_0x2a11f4,_0x1a72f8(0x291),_0x348cfc[_0x1a72f8(0x291)]);return;}if(_0x348cfc[_0x1a72f8(0x291)]===!![]){this[_0x1a72f8(0x237)](_0x16ebe8,_0x2a11f4),this[_0x1a72f8(0x1f3)](_0x16ebe8),this['displayPreviewHints'](_0x14fc82,_0x2a11f4,_0x1a72f8(0x24f));return;}this['displayAttributesStats'](_0x16ebe8),this[_0x1a72f8(0x237)](_0x16ebe8,_0x2a11f4),this['displaySummary'](_0x16ebe8),this['displayPreviewHints'](_0x14fc82,_0x2a11f4,_0x1a72f8(0x24c));}[a27_0x5f1085(0x280)](_0xdc19e4,_0x4369c5,_0x3e560f,_0xb07fd4){const _0x780f7a=a27_0x5f1085;console[_0x780f7a(0x1bf)]('\x0a'+a27_0x4111a0[_0x780f7a(0x186)](_0x780f7a(0x19d)));const _0x346e93=_0x4369c5!=='-1d'?_0x780f7a(0x23f)+_0x4369c5:'';if(_0x3e560f===_0x780f7a(0x1b0)&&_0xb07fd4)console[_0x780f7a(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x780f7a(0x186)]('tdx\x20segment\x20parent\x20preview\x20'+_0xdc19e4+_0x780f7a(0x1e4)+_0xb07fd4+'\x22'+_0x346e93));else{if(_0x3e560f===_0x780f7a(0x291)&&_0xb07fd4)console[_0x780f7a(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x780f7a(0x186)](_0x780f7a(0x205)+_0xdc19e4+'\x20--behavior\x20\x22'+_0xb07fd4+'\x22'+_0x346e93));else(_0x3e560f===_0x780f7a(0x241)||_0x3e560f==='all')&&console[_0x780f7a(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x780f7a(0x186)](_0x780f7a(0x205)+_0xdc19e4+_0x780f7a(0x1e8)+_0x346e93));}(_0x3e560f===_0x780f7a(0x24f)||_0x3e560f===_0x780f7a(0x24c))&&console[_0x780f7a(0x1bf)]('\x20\x20'+a27_0x4111a0['dim'](_0x780f7a(0x205)+_0xdc19e4+'\x20--behavior\x20\x22<name>\x22'+_0x346e93)),_0x3e560f===_0x780f7a(0x24c)&&console['error']('\x20\x20'+a27_0x4111a0[_0x780f7a(0x186)](_0x780f7a(0x205)+_0xdc19e4+_0x780f7a(0x271)+_0x346e93));}[a27_0x5f1085(0x218)](_0x275642){const _0x1968ee=a27_0x5f1085,{master:_0x5bf801}=_0x275642,_0x56cdff=_0x5bf801['schemaValid']?a27_0x4111a0[_0x1968ee(0x1de)]('✔'):a27_0x4111a0[_0x1968ee(0x258)]('✘');console[_0x1968ee(0x1bf)]('\x0a'+a27_0x4111a0[_0x1968ee(0x186)]('Master\x20Table')),console['error'](_0x56cdff+'\x20'+a27_0x4111a0[_0x1968ee(0x202)](_0x5bf801[_0x1968ee(0x21a)]+'.'+_0x5bf801[_0x1968ee(0x229)])),_0x5bf801[_0x1968ee(0x1ae)]?_0x5bf801[_0x1968ee(0x257)]!==undefined&&console[_0x1968ee(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x1968ee(0x186)]('Rows:')+'\x20'+a27_0x4111a0['cyan'](formatRows(_0x5bf801[_0x1968ee(0x257)]))):console['error']('\x20\x20'+a27_0x4111a0[_0x1968ee(0x258)](_0x1968ee(0x27b))+'\x20'+_0x5bf801[_0x1968ee(0x1d0)]);}[a27_0x5f1085(0x213)](_0x53fec4){const _0x42cde0=a27_0x5f1085;if(_0x53fec4[_0x42cde0(0x241)]['length']===0x0)return;console['error']('\x0a'+a27_0x4111a0[_0x42cde0(0x186)]('Attributes'));for(const _0x279f5f of _0x53fec4[_0x42cde0(0x241)]){const _0x195a99=_0x279f5f[_0x42cde0(0x1ae)]?a27_0x4111a0['green']('✔'):a27_0x4111a0[_0x42cde0(0x258)]('✘');let _0x19fbfa='';if(_0x279f5f[_0x42cde0(0x1ae)]&&_0x279f5f['matchedCount']!==undefined&&_0x279f5f[_0x42cde0(0x1d2)]!==undefined){const _0x34bfcc=_0x279f5f[_0x42cde0(0x1d2)]['toFixed'](0x1),_0x302152=_0x279f5f['coveragePercent']>=0x50?a27_0x4111a0['green']:_0x279f5f['coveragePercent']>=0x32?a27_0x4111a0[_0x42cde0(0x261)]:a27_0x4111a0['red'];_0x19fbfa='\x20'+a27_0x4111a0[_0x42cde0(0x186)]('Coverage:')+'\x20'+_0x302152(_0x34bfcc+'%')+'\x20('+formatRows(_0x279f5f[_0x42cde0(0x1d4)])+_0x42cde0(0x1d1);}console[_0x42cde0(0x1bf)](_0x195a99+'\x20'+a27_0x4111a0['bold'](_0x279f5f[_0x42cde0(0x19f)])+_0x19fbfa),console[_0x42cde0(0x1bf)]('\x20\x20'+a27_0x4111a0['dim'](_0x42cde0(0x1ce))+'\x20'+a27_0x4111a0['bold'](_0x279f5f['database']+'.'+_0x279f5f[_0x42cde0(0x229)]));const _0x7b6e3d=_0x279f5f[_0x42cde0(0x20e)]===_0x279f5f[_0x42cde0(0x283)]?a27_0x4111a0['dim'](_0x42cde0(0x1f0))+'\x20'+_0x279f5f['joinKey']:a27_0x4111a0[_0x42cde0(0x186)](_0x42cde0(0x268))+'\x20'+_0x279f5f['joinKey']+_0x42cde0(0x289)+_0x279f5f[_0x42cde0(0x283)];console[_0x42cde0(0x1bf)]('\x20\x20'+_0x7b6e3d),console[_0x42cde0(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x42cde0(0x186)](_0x42cde0(0x197))),this[_0x42cde0(0x196)](_0x279f5f['columns']),!_0x279f5f[_0x42cde0(0x1ae)]&&console[_0x42cde0(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x42cde0(0x258)](_0x42cde0(0x27b))+'\x20'+_0x279f5f['schemaError']);}}[a27_0x5f1085(0x237)](_0xa46525,_0xd0b6df){const _0x170a10=a27_0x5f1085;if(_0xa46525[_0x170a10(0x24f)][_0x170a10(0x293)]===0x0)return;console['error']('\x0a'+a27_0x4111a0[_0x170a10(0x186)](_0x170a10(0x1ea))+'\x20'+a27_0x4111a0[_0x170a10(0x186)]('('+_0xd0b6df+')'));for(const _0x2acbd8 of _0xa46525[_0x170a10(0x24f)]){const _0x1f7df6=_0x2acbd8[_0x170a10(0x1ae)]?a27_0x4111a0[_0x170a10(0x1de)]('✔'):a27_0x4111a0[_0x170a10(0x258)]('✘');let _0x46b2cf='';if(_0x2acbd8['schemaValid']&&_0x2acbd8['customersWithEvents']!==undefined&&_0x2acbd8['totalEvents']!==undefined){const _0x2345d2=_0x2acbd8[_0x170a10(0x26e)]?.[_0x170a10(0x1b5)](0x1)||'?',_0x2ad160=(_0x2acbd8[_0x170a10(0x26e)]??0x0)>=0x32?a27_0x4111a0[_0x170a10(0x1de)]:(_0x2acbd8[_0x170a10(0x26e)]??0x0)>=0x14?a27_0x4111a0[_0x170a10(0x261)]:a27_0x4111a0[_0x170a10(0x258)];_0x46b2cf='\x20'+a27_0x4111a0['dim'](_0x170a10(0x227))+'\x20'+_0x2ad160(formatRows(_0x2acbd8[_0x170a10(0x20a)]))+'\x20('+_0x2345d2+_0x170a10(0x1a0)+a27_0x4111a0[_0x170a10(0x186)](_0x170a10(0x28e))+'\x20'+a27_0x4111a0[_0x170a10(0x230)](formatRows(_0x2acbd8[_0x170a10(0x269)]));}console[_0x170a10(0x1bf)](_0x1f7df6+'\x20'+a27_0x4111a0[_0x170a10(0x202)](_0x2acbd8[_0x170a10(0x19f)])+_0x46b2cf),console[_0x170a10(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x170a10(0x186)](_0x170a10(0x1ce))+'\x20'+a27_0x4111a0[_0x170a10(0x202)](_0x2acbd8[_0x170a10(0x21a)]+'.'+_0x2acbd8[_0x170a10(0x229)]));const _0xf10840=_0x2acbd8[_0x170a10(0x20e)]===_0x2acbd8[_0x170a10(0x283)]?a27_0x4111a0['dim'](_0x170a10(0x1f0))+'\x20'+_0x2acbd8[_0x170a10(0x20e)]:a27_0x4111a0[_0x170a10(0x186)](_0x170a10(0x268))+'\x20'+_0x2acbd8[_0x170a10(0x20e)]+_0x170a10(0x289)+_0x2acbd8[_0x170a10(0x283)];console[_0x170a10(0x1bf)]('\x20\x20'+_0xf10840),console['error']('\x20\x20'+a27_0x4111a0['dim'](_0x170a10(0x197))),this[_0x170a10(0x196)](_0x2acbd8['columns']),!_0x2acbd8['schemaValid']&&console[_0x170a10(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x170a10(0x258)](_0x170a10(0x27b))+'\x20'+_0x2acbd8['schemaError']);}}['displayColumns'](_0x4b1927){const _0x10b6fa=a27_0x5f1085;for(const _0x4e9784 of _0x4b1927){_0x4e9784[_0x10b6fa(0x22f)]===_0x4e9784[_0x10b6fa(0x200)]||_0x4e9784[_0x10b6fa(0x200)]==='*'?console['error']('\x20\x20\x20\x20-\x20'+_0x4e9784[_0x10b6fa(0x22f)]):console[_0x10b6fa(0x1bf)](_0x10b6fa(0x28b)+_0x4e9784[_0x10b6fa(0x22f)]+'\x20'+a27_0x4111a0[_0x10b6fa(0x186)]('('+_0x4e9784['column']+')'));}}['displaySummary'](_0x443157){const _0x7783ba=a27_0x5f1085;console['error']('─'['repeat'](0x3c));if(_0x443157[_0x7783ba(0x210)][_0x7783ba(0x293)]>0x0){console['error']('\x0a'+a27_0x4111a0['red'](_0x7783ba(0x1cd)));for(const _0x2d4dfb of _0x443157['errors']){console['error']('\x20\x20'+a27_0x4111a0[_0x7783ba(0x258)]('•')+'\x20'+_0x2d4dfb);}}_0x443157[_0x7783ba(0x24d)]&&console['error']('\x0a'+a27_0x4111a0[_0x7783ba(0x1de)]('✔')+_0x7783ba(0x19c));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a27_0x5f1085(0x19f)]=a27_0x5f1085(0x249);[a27_0x5f1085(0x236)]=a27_0x5f1085(0x287);async[a27_0x5f1085(0x24e)](_0x5ed23a){const _0x45891e=a27_0x5f1085,{options:_0x57459c,args:_0x4eb401,tdx:_0x93414b}=_0x5ed23a,_0x2a615f=_0x57459c,_0x69bb57=_0x4eb401[0x0]||_0x57459c[_0x45891e(0x192)];if(!_0x69bb57)return console[_0x45891e(0x1bf)](a27_0x4111a0[_0x45891e(0x258)](_0x45891e(0x1e0))),console['error'](_0x45891e(0x181)),console['error']('Options\x20(one\x20required):'),console['error'](_0x45891e(0x1bc)),console[_0x45891e(0x1bf)](_0x45891e(0x215)),console[_0x45891e(0x1bf)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error'](_0x45891e(0x1a8)),console[_0x45891e(0x1bf)]('\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),console[_0x45891e(0x1bf)](a27_0x4111a0['cyan'](_0x45891e(0x244))),0x1;if(!_0x2a615f[_0x45891e(0x28f)]&&!_0x2a615f[_0x45891e(0x1b0)]&&!_0x2a615f['behavior']&&!_0x2a615f[_0x45891e(0x26a)])return console[_0x45891e(0x1bf)](a27_0x4111a0[_0x45891e(0x258)](_0x45891e(0x1f8))),console[_0x45891e(0x1bf)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error'](_0x45891e(0x214)),console['error'](_0x45891e(0x1bc)),console['error'](_0x45891e(0x215)),console[_0x45891e(0x1bf)](_0x45891e(0x255)),console[_0x45891e(0x1bf)](_0x45891e(0x1a8)),0x1;const _0x3e32ec=resolveYamlFile(_0x69bb57);if(!existsSync(_0x3e32ec))return showFileNotFoundError(_0x3e32ec,_0x69bb57),0x1;_0x2a615f['verbose']&&(console[_0x45891e(0x1bf)](_0x45891e(0x193)+_0x2a615f['site']),console[_0x45891e(0x1bf)](_0x45891e(0x17f)+_0x3e32ec));let _0x1afc9f;try{_0x1afc9f=readFileSync(_0x3e32ec,'utf-8');}catch(_0x135d65){const _0x3acec9=_0x135d65 instanceof Error?_0x135d65['message']:String(_0x135d65);return console[_0x45891e(0x1bf)](_0x45891e(0x225)+_0x3acec9),0x1;}let _0x55dbe2;try{_0x55dbe2=parseYamlString(_0x1afc9f);}catch(_0x43251b){const _0x4da266=_0x43251b instanceof Error?_0x43251b[_0x45891e(0x276)]:String(_0x43251b);return console[_0x45891e(0x1bf)](a27_0x4111a0[_0x45891e(0x258)](_0x45891e(0x189)+_0x4da266)),0x1;}if(_0x2a615f['attribute']===!![]||_0x2a615f[_0x45891e(0x1b0)]===''){const _0x18689b=_0x55dbe2[_0x45891e(0x241)]?.[_0x45891e(0x231)](_0xb816dd=>_0xb816dd['name'])||[];if(_0x18689b['length']===0x0)console[_0x45891e(0x1bf)](a27_0x4111a0[_0x45891e(0x258)](_0x45891e(0x26c)));else{console[_0x45891e(0x1bf)](a27_0x4111a0[_0x45891e(0x258)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error'](_0x45891e(0x1c9));for(const _0xb633dc of _0x18689b){console['error']('\x20\x20'+a27_0x4111a0[_0x45891e(0x230)](_0xb633dc));}console['error'](_0x45891e(0x250)+_0x69bb57+_0x45891e(0x1e4)+_0x18689b[0x0]+'\x22');}return 0x1;}if(_0x2a615f[_0x45891e(0x291)]===!![]||_0x2a615f[_0x45891e(0x291)]===''){const _0x270f92=_0x55dbe2[_0x45891e(0x24f)]?.['map'](_0x62b4ef=>_0x62b4ef[_0x45891e(0x19f)])||[];if(_0x270f92[_0x45891e(0x293)]===0x0)console[_0x45891e(0x1bf)](a27_0x4111a0[_0x45891e(0x258)](_0x45891e(0x264)));else{console[_0x45891e(0x1bf)](a27_0x4111a0['red'](_0x45891e(0x28c))),console[_0x45891e(0x1bf)](_0x45891e(0x281));for(const _0x8319df of _0x270f92){console['error']('\x20\x20'+a27_0x4111a0[_0x45891e(0x230)](_0x8319df));}console['error'](_0x45891e(0x250)+_0x69bb57+_0x45891e(0x1e1)+_0x270f92[0x0]+'\x22');}return 0x1;}const _0x58a043=createCommandSpinner(a27_0x4111a0[_0x45891e(0x186)](_0x45891e(0x272)),{'verbose':_0x2a615f[_0x45891e(0x1a9)]});_0x58a043['start']();const _0x12bdec={'onProgress':_0x565c67=>{const _0xff2b63=_0x45891e;_0x58a043[_0xff2b63(0x1b1)]=formatProgressMessage(_0x565c67);}};if(_0x2a615f[_0x45891e(0x28f)])_0x12bdec[_0x45891e(0x28f)]=!![];if(_0x2a615f['attribute']&&typeof _0x2a615f[_0x45891e(0x1b0)]==='string')_0x12bdec['attribute']=_0x2a615f[_0x45891e(0x1b0)];if(_0x2a615f[_0x45891e(0x291)]&&typeof _0x2a615f['behavior']===_0x45891e(0x297))_0x12bdec[_0x45891e(0x291)]=_0x2a615f['behavior'];if(_0x2a615f[_0x45891e(0x26a)])_0x12bdec['enriched']=!![];if(_0x2a615f[_0x45891e(0x1af)])_0x12bdec['interval']=_0x2a615f['interval'];let _0x547111;try{_0x547111=await _0x93414b[_0x45891e(0x20c)][_0x45891e(0x279)](_0x1afc9f,_0x12bdec),_0x58a043['stop']();}catch(_0x31e649){_0x58a043[_0x45891e(0x1b9)]();throw _0x31e649;}return await this[_0x45891e(0x18e)](_0x547111,{'master':_0x2a615f[_0x45891e(0x28f)],'attribute':typeof _0x2a615f[_0x45891e(0x1b0)]==='string'?_0x2a615f[_0x45891e(0x1b0)]:undefined,'behavior':typeof _0x2a615f[_0x45891e(0x291)]==='string'?_0x2a615f[_0x45891e(0x291)]:undefined,'enriched':_0x2a615f['enriched']}),_0x547111[_0x45891e(0x24d)]?0x0:0x1;}async[a27_0x5f1085(0x18e)](_0x57f2e9,_0x2e23ae){const _0x2557c4=a27_0x5f1085;console['error']('\x0a'+a27_0x4111a0[_0x2557c4(0x202)](_0x2557c4(0x259))+'\x20'+_0x57f2e9['name']),console[_0x2557c4(0x1bf)]('═'[_0x2557c4(0x238)](0x3c));if(_0x2e23ae[_0x2557c4(0x28f)]&&_0x57f2e9[_0x2557c4(0x1ca)]){const _0x183554=a27_0x4111a0[_0x2557c4(0x186)](_0x2557c4(0x216))+'\x20'+a27_0x4111a0[_0x2557c4(0x202)](_0x57f2e9[_0x2557c4(0x28f)][_0x2557c4(0x21a)]+'.'+_0x57f2e9['master'][_0x2557c4(0x229)]);await this[_0x2557c4(0x208)](_0x183554,_0x57f2e9[_0x2557c4(0x1ca)]);}else{if(_0x2e23ae[_0x2557c4(0x1b0)]&&_0x57f2e9[_0x2557c4(0x1ca)]){const _0x50ff27=a27_0x4111a0[_0x2557c4(0x186)]('Attribute:')+'\x20'+a27_0x4111a0[_0x2557c4(0x202)](_0x2e23ae[_0x2557c4(0x1b0)]);await this[_0x2557c4(0x208)](_0x50ff27,_0x57f2e9[_0x2557c4(0x1ca)]);}else{if(_0x2e23ae['behavior']&&_0x57f2e9['sampleData']){const _0x1e51f7=a27_0x4111a0[_0x2557c4(0x186)](_0x2557c4(0x29f))+'\x20'+a27_0x4111a0[_0x2557c4(0x202)](_0x2e23ae['behavior']);await this[_0x2557c4(0x208)](_0x1e51f7,_0x57f2e9[_0x2557c4(0x1ca)]);}else{if(_0x2e23ae['enriched']&&_0x57f2e9[_0x2557c4(0x1ca)]){const _0x17e835=a27_0x4111a0[_0x2557c4(0x186)](_0x2557c4(0x1dd))+'\x20'+a27_0x4111a0[_0x2557c4(0x202)]('Master\x20+\x20Attributes');await this[_0x2557c4(0x208)](_0x17e835,_0x57f2e9['sampleData']);}else!_0x57f2e9[_0x2557c4(0x1ca)]&&console[_0x2557c4(0x1bf)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x57f2e9[_0x2557c4(0x210)]['length']>0x0){console[_0x2557c4(0x1bf)]('─'[_0x2557c4(0x238)](0x3c)),console['error']('\x0a'+a27_0x4111a0[_0x2557c4(0x258)](_0x2557c4(0x1cd)));for(const _0x3e99c5 of _0x57f2e9[_0x2557c4(0x210)]){console[_0x2557c4(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x2557c4(0x258)]('•')+'\x20'+_0x3e99c5);}}}async[a27_0x5f1085(0x208)](_0x4bb3fc,_0x296d1){const _0x233704=a27_0x5f1085;if(_0x296d1[_0x233704(0x293)]===0x0){console['error']('\x0a'+_0x4bb3fc),console['error'](_0x233704(0x26d));return;}console[_0x233704(0x1bf)]('\x0a'+_0x4bb3fc);const _0x34e13d=Object[_0x233704(0x1f6)](_0x296d1[0x0])['map'](_0x337d8b=>({'name':_0x337d8b,'type':typeof _0x296d1[0x0][_0x337d8b]===_0x233704(0x2a1)?'double':_0x233704(0x25b)})),_0x303664={'queryId':_0x233704(0x1da),'columns':_0x34e13d,'data':_0x296d1,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x296d1['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2a182a=formatAsTable(_0x303664,_0x296d1[_0x233704(0x293)],!![]);await writeOutput(_0x2a182a,undefined,_0x233704(0x229));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a27_0x5f1085(0x19f)]=a27_0x5f1085(0x284);[a27_0x5f1085(0x236)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a27_0x5f1085(0x24e)](_0x3d6414){const _0x5b7ae9=a27_0x5f1085,{options:_0x77ab54,args:_0x3780d0,tdx:_0x3532b1}=_0x3d6414,_0x9787c8=_0x77ab54,_0x300be8=_0x3780d0[0x0]||_0x77ab54[_0x5b7ae9(0x192)];if(!_0x300be8)return console['error'](a27_0x4111a0[_0x5b7ae9(0x258)]('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x5b7ae9(0x1bf)](_0x5b7ae9(0x29a)),console[_0x5b7ae9(0x1bf)](a27_0x4111a0[_0x5b7ae9(0x230)](_0x5b7ae9(0x18d))),0x1;const _0x5dbf2e=resolveYamlFile(_0x300be8);if(existsSync(_0x5dbf2e)){_0x9787c8[_0x5b7ae9(0x1a9)]&&console[_0x5b7ae9(0x1bf)](_0x5b7ae9(0x277)+_0x5dbf2e);let _0x37af1d;try{_0x37af1d=readFileSync(_0x5dbf2e,_0x5b7ae9(0x22c));}catch(_0x3cf2c3){const _0x1edb5b=_0x3cf2c3 instanceof Error?_0x3cf2c3['message']:String(_0x3cf2c3);return console[_0x5b7ae9(0x1bf)](_0x5b7ae9(0x225)+_0x1edb5b),0x1;}const _0x52974a=await withSpinner('Analyzing\x20changes...',()=>_0x3532b1[_0x5b7ae9(0x20c)][_0x5b7ae9(0x194)](_0x37af1d),{'verbose':_0x9787c8[_0x5b7ae9(0x1a9)]}),_0x196855=_0x52974a[_0x5b7ae9(0x235)],{isNew:_0x5cfec6,name:_0x42723b,hasChanges:_0x277dd6,diffFormatted:_0x4e78fa}=_0x196855;if(_0x277dd6){_0x5cfec6?console[_0x5b7ae9(0x1bf)](_0x5b7ae9(0x266)+_0x42723b+'\x27:'):console[_0x5b7ae9(0x1bf)](_0x5b7ae9(0x23d)+_0x42723b+'\x27:');console[_0x5b7ae9(0x1bf)]('─'['repeat'](0x3c)),console[_0x5b7ae9(0x1bf)](_0x4e78fa),console['error']('─'[_0x5b7ae9(0x238)](0x3c));const _0x1e461b=_0x5cfec6?_0x5b7ae9(0x1eb)+_0x42723b+_0x5b7ae9(0x239):'Apply\x20changes\x20to\x20\x27'+_0x42723b+_0x5b7ae9(0x239);if(!_0x9787c8['yes']){const _0x53bdef=await confirmKey(_0x1e461b);if(!_0x53bdef)return console[_0x5b7ae9(0x1bf)](_0x5b7ae9(0x262)),0x1;}const _0x20aa10=_0x5cfec6?'Creating':'Updating';await withSpinner(_0x20aa10+_0x5b7ae9(0x224)+_0x42723b+'\x27...',()=>_0x196855['apply'](),{'verbose':_0x9787c8[_0x5b7ae9(0x1a9)]});const _0x2ff6ce=_0x5cfec6?_0x5b7ae9(0x207):_0x5b7ae9(0x1be);console['error']('✔\x20'+_0x2ff6ce+_0x5b7ae9(0x224)+_0x42723b+'\x27');}else console[_0x5b7ae9(0x1bf)](_0x5b7ae9(0x21b)+_0x42723b+'\x27\x20is\x20up\x20to\x20date');}const _0x5d0b17=await withSpinner(_0x5b7ae9(0x19b)+_0x300be8+_0x5b7ae9(0x260),()=>_0x3532b1[_0x5b7ae9(0x20c)]['runParent'](_0x300be8),{'verbose':_0x9787c8['verbose']}),_0x1f91a2=_0x5d0b17[_0x5b7ae9(0x235)],_0x56e48e=getConsoleUrl(_0x9787c8[_0x5b7ae9(0x18f)],_0x5b7ae9(0x1c7)+_0x1f91a2['workflowId']+_0x5b7ae9(0x1bb)+_0x1f91a2[_0x5b7ae9(0x27c)]+'/attempt/'+_0x1f91a2[_0x5b7ae9(0x27a)]);return console[_0x5b7ae9(0x1bf)](_0x5b7ae9(0x273)),console['error']('\x20\x20'+a27_0x4111a0[_0x5b7ae9(0x186)]('Audience\x20ID:')+'\x20'+_0x1f91a2[_0x5b7ae9(0x1ee)]),console[_0x5b7ae9(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x5b7ae9(0x186)](_0x5b7ae9(0x263))+'\x20'+_0x1f91a2[_0x5b7ae9(0x211)]),console[_0x5b7ae9(0x1bf)]('\x20\x20'+a27_0x4111a0[_0x5b7ae9(0x186)]('Session:')+'\x20'+_0x1f91a2[_0x5b7ae9(0x27c)]),console['error']('\x20\x20'+a27_0x4111a0['dim'](_0x5b7ae9(0x180))+'\x20'+_0x1f91a2[_0x5b7ae9(0x27a)]),console['error']('\x20\x20'+_0x56e48e),console[_0x5b7ae9(0x1bf)]('\x0a'+a27_0x4111a0['dim']('To\x20cancel:')+_0x5b7ae9(0x25e)+_0x1f91a2[_0x5b7ae9(0x27a)]+_0x5b7ae9(0x220)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a27_0x5f1085(0x19f)]='segment:parent:fields';[a27_0x5f1085(0x236)]='List\x20available\x20fields\x20for\x20segmentation';async[a27_0x5f1085(0x24e)](_0x2a9837){const _0x1116c2=a27_0x5f1085,{options:_0x139480,args:_0x58f943,tdx:_0x1dc3ed}=_0x2a9837,_0x3fe0a8=_0x58f943[0x0]||_0x139480[_0x1116c2(0x192)];if(!_0x3fe0a8)return console[_0x1116c2(0x1bf)](a27_0x4111a0[_0x1116c2(0x258)]('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x1116c2(0x1bf)](_0x1116c2(0x184)),console[_0x1116c2(0x1bf)](a27_0x4111a0['cyan'](_0x1116c2(0x18d))),0x1;_0x139480[_0x1116c2(0x1a9)]&&(console[_0x1116c2(0x1bf)](_0x1116c2(0x193)+_0x139480[_0x1116c2(0x18f)]),console[_0x1116c2(0x1bf)](_0x1116c2(0x198)+_0x3fe0a8));const _0x4dd5c9=await withSpinner(_0x1116c2(0x1b3)+_0x3fe0a8+'\x27...',()=>_0x1dc3ed[_0x1116c2(0x20c)][_0x1116c2(0x288)](_0x3fe0a8),{'verbose':_0x139480[_0x1116c2(0x1a9)]}),_0x3a621f=_0x4dd5c9['data'];console[_0x1116c2(0x1bf)]('✔\x20Found\x20'+_0x3a621f[_0x1116c2(0x293)]+_0x1116c2(0x29d)+(_0x3a621f['length']!==0x1?'s':''));if(_0x139480['json']||_0x139480[_0x1116c2(0x1df)])return await handleSDKOutput(_0x3a621f,_0x139480),0x0;return displayFieldsHumanReadable(_0x3a621f,_0x3fe0a8),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a27_0x5f1085(0x19f)]=a27_0x5f1085(0x21d);[a27_0x5f1085(0x236)]='Show\x20parent\x20segment\x20details';async[a27_0x5f1085(0x24e)](_0x2cbbb1){const _0x227cda=a27_0x5f1085,{options:_0x154109,args:_0x1b928f,tdx:_0x42147a}=_0x2cbbb1,_0x4fc2db=_0x154109,_0x1de7b1=_0x1b928f[0x0]||_0x154109[_0x227cda(0x192)];if(!_0x1de7b1)return console[_0x227cda(0x1bf)](a27_0x4111a0[_0x227cda(0x258)]('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console['error'](_0x227cda(0x25c)),console[_0x227cda(0x1bf)](_0x227cda(0x214)),console[_0x227cda(0x1bf)](_0x227cda(0x1b6)),console[_0x227cda(0x1bf)](a27_0x4111a0[_0x227cda(0x230)](_0x227cda(0x244))),0x1;_0x154109[_0x227cda(0x1a9)]&&(console[_0x227cda(0x1bf)](_0x227cda(0x193)+_0x154109['site']),console[_0x227cda(0x1bf)]('Parent\x20segment:\x20'+_0x1de7b1));const _0x27b344=await withSpinner(_0x227cda(0x1e7)+_0x1de7b1+_0x227cda(0x260),()=>_0x42147a['segment']['getParentFull'](_0x1de7b1),{'verbose':_0x154109['verbose']}),_0x46c5e5=_0x27b344[_0x227cda(0x235)];if(_0x4fc2db[_0x227cda(0x203)]){const _0x13bda5=getConsoleNextUrl(_0x4fc2db[_0x227cda(0x18f)],'/app/dw/parentSegments/'+_0x46c5e5['id']);return console[_0x227cda(0x1bf)](a27_0x4111a0[_0x227cda(0x1de)]('✔')+_0x227cda(0x23c)+a27_0x4111a0[_0x227cda(0x230)](_0x13bda5)),openBrowser(_0x13bda5),0x0;}return await handleSingleObjectOutput(_0x46c5e5,_0x154109),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a27_0x5f1085(0x19f)]='segment:parent:desc';[a27_0x5f1085(0x236)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a27_0x5f1085(0x24e)](_0x1d7310){const _0x1892d9=a27_0x5f1085,{options:_0x59f9e7,args:_0x26581d,tdx:_0x39f029}=_0x1d7310,_0x50ed2c=_0x26581d[0x0]||_0x59f9e7['parentSegment'];if(!_0x50ed2c)return console[_0x1892d9(0x1bf)](a27_0x4111a0['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x1892d9(0x1bf)]('Usage:\x20tdx\x20ps\x20desc\x20[name]\x0a'),console[_0x1892d9(0x1bf)](a27_0x4111a0[_0x1892d9(0x230)]('Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;_0x59f9e7[_0x1892d9(0x1a9)]&&(console[_0x1892d9(0x1bf)]('Site:\x20'+_0x59f9e7[_0x1892d9(0x18f)]),console['error']('Parent\x20segment:\x20'+_0x50ed2c));const _0x4ad64c=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x50ed2c+_0x1892d9(0x260),()=>_0x39f029[_0x1892d9(0x20c)][_0x1892d9(0x1c1)](_0x50ed2c),{'verbose':_0x59f9e7[_0x1892d9(0x1a9)]}),_0x8b5a1b=_0x4ad64c['data'],_0x38bc1b=await withSpinner(_0x1892d9(0x256)+_0x50ed2c+_0x1892d9(0x260),()=>_0x39f029[_0x1892d9(0x20c)][_0x1892d9(0x21c)](_0x8b5a1b),{'verbose':_0x59f9e7['verbose']}),_0x237e6e=await executeSchemaQuery(_0x38bc1b[_0x1892d9(0x235)],_0x39f029,_0x59f9e7);return await handleQueryOutput(_0x237e6e,_0x59f9e7),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a27_0x5f1085(0x19f)]=a27_0x5f1085(0x245);[a27_0x5f1085(0x236)]=a27_0x5f1085(0x282);async[a27_0x5f1085(0x24e)](_0x1bac8c){const _0x318ca7=a27_0x5f1085,{options:_0x36ac4d,args:_0x5b2a4a,tdx:_0x2cc8f0}=_0x1bac8c,_0x122f11=_0x5b2a4a[0x0]||_0x36ac4d[_0x318ca7(0x192)];if(!_0x122f11)return console['error'](a27_0x4111a0['red'](_0x318ca7(0x1e0))),console[_0x318ca7(0x1bf)](_0x318ca7(0x278)),console[_0x318ca7(0x1bf)](a27_0x4111a0[_0x318ca7(0x230)](_0x318ca7(0x18d))),0x1;_0x36ac4d[_0x318ca7(0x1a9)]&&(console[_0x318ca7(0x1bf)](_0x318ca7(0x193)+_0x36ac4d[_0x318ca7(0x18f)]),console[_0x318ca7(0x1bf)](_0x318ca7(0x198)+_0x122f11));const _0x472b1a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x122f11+_0x318ca7(0x260),()=>_0x2cc8f0[_0x318ca7(0x20c)][_0x318ca7(0x1c1)](_0x122f11),{'verbose':_0x36ac4d[_0x318ca7(0x1a9)]}),_0xbe059f=_0x472b1a[_0x318ca7(0x235)],_0x1413c5=await withSpinner(_0x318ca7(0x256)+_0x122f11+_0x318ca7(0x260),()=>_0x2cc8f0[_0x318ca7(0x20c)][_0x318ca7(0x21c)](_0xbe059f),{'verbose':_0x36ac4d['verbose']}),_0x487ca8=_0x1413c5['data'];return _0x36ac4d[_0x318ca7(0x1e9)]==='json'||_0x36ac4d['format']==='jsonl'?await handleSDKOutput([{'sql':_0x487ca8}],_0x36ac4d):console['log'](_0x487ca8),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a27_0x5f1085(0x251);[a27_0x5f1085(0x236)]=a27_0x5f1085(0x22e);async[a27_0x5f1085(0x24e)](_0x1d036a){const _0xb72a08=a27_0x5f1085,{options:_0x12e14a,args:_0x4445cd,tdx:_0x4f19bc}=_0x1d036a,_0x2539b0=_0x4445cd[0x0]||_0x12e14a[_0xb72a08(0x192)];if(!_0x2539b0)return console[_0xb72a08(0x1bf)](a27_0x4111a0['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console['error']('Usage:\x20tdx\x20ps\x20show\x20[name]\x0a'),console[_0xb72a08(0x1bf)](a27_0x4111a0[_0xb72a08(0x230)](_0xb72a08(0x18d))),0x1;_0x12e14a[_0xb72a08(0x1a9)]&&(console[_0xb72a08(0x1bf)]('Site:\x20'+_0x12e14a[_0xb72a08(0x18f)]),console[_0xb72a08(0x1bf)](_0xb72a08(0x198)+_0x2539b0));const _0x4eef86=await withSpinner(_0xb72a08(0x26f)+_0x2539b0+_0xb72a08(0x260),()=>_0x4f19bc[_0xb72a08(0x20c)][_0xb72a08(0x1c1)](_0x2539b0),{'verbose':_0x12e14a[_0xb72a08(0x1a9)]}),_0x3ab308=_0x4eef86[_0xb72a08(0x235)],_0x2c1634=await withSpinner(_0xb72a08(0x256)+_0x2539b0+_0xb72a08(0x260),()=>_0x4f19bc[_0xb72a08(0x20c)][_0xb72a08(0x21c)](_0x3ab308),{'verbose':_0x12e14a[_0xb72a08(0x1a9)]});let _0x1a97d2=_0x2c1634['data'];const _0x3a9e1c=resolveLimit(_0x12e14a[_0xb72a08(0x1ba)],DEFAULT_DISPLAY_LIMIT),_0x4704bb=/\bLIMIT\s+\d+/i[_0xb72a08(0x2a0)](_0x1a97d2);!_0x4704bb&&(_0x1a97d2=_0x1a97d2[_0xb72a08(0x23e)]()[_0xb72a08(0x1cb)](/;+$/,''),_0x1a97d2=_0xb72a08(0x226)+_0x1a97d2+_0xb72a08(0x1d6)+_0x3a9e1c);_0x12e14a['verbose']&&console[_0xb72a08(0x1bf)](_0xb72a08(0x1b2)+_0x1a97d2);const _0x16e72d=await withQuerySpinner(_0xb72a08(0x253),async _0x5d0ea7=>{const _0x1025b5=_0xb72a08,_0xe374e7=await _0x4f19bc[_0x1025b5(0x1d8)]['execute'](_0x1a97d2,{'catalog':'td','schema':'information_schema','onJobId':_0x4937dd=>{const _0xc17871=_0x1025b5;_0x5d0ea7[_0xc17871(0x1d7)](_0x4937dd);}});return _0xe374e7;},{'verbose':_0x12e14a[_0xb72a08(0x1a9)]}),_0x4f5dc8=_0x16e72d[_0xb72a08(0x235)],_0xb0f810=_0x4f5dc8[_0xb72a08(0x1aa)]?_0xb72a08(0x188)+_0x4f5dc8[_0xb72a08(0x1aa)]+']':'';return console[_0xb72a08(0x1bf)](_0xb72a08(0x1e2)+_0x4f5dc8['stats'][_0xb72a08(0x1fe)][_0xb72a08(0x1cf)]()+_0xb72a08(0x1c0)+('in\x20'+formatElapsed(_0x4f5dc8[_0xb72a08(0x234)][_0xb72a08(0x25d)])+_0xb0f810)),await handleQueryOutput(_0x4f5dc8,_0x12e14a),0x0;}}
@@ -1 +1 @@
1
- const a28_0x53b54b=a28_0x22b9;(function(_0x4eb427,_0x57fca0){const _0x28a164=a28_0x22b9,_0x30bcbe=_0x4eb427();while(!![]){try{const _0x415b0c=parseInt(_0x28a164(0xe9))/0x1+parseInt(_0x28a164(0xec))/0x2+parseInt(_0x28a164(0xe7))/0x3+parseInt(_0x28a164(0xf6))/0x4*(parseInt(_0x28a164(0xf2))/0x5)+-parseInt(_0x28a164(0xe6))/0x6*(-parseInt(_0x28a164(0xea))/0x7)+-parseInt(_0x28a164(0xe4))/0x8+-parseInt(_0x28a164(0xf5))/0x9;if(_0x415b0c===_0x57fca0)break;else _0x30bcbe['push'](_0x30bcbe['shift']());}catch(_0x3b4da0){_0x30bcbe['push'](_0x30bcbe['shift']());}}}(a28_0x11ad,0xa7806));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x53b54b(0xf4)]=a28_0x53b54b(0xf7);[a28_0x53b54b(0xeb)]=a28_0x53b54b(0xf1);async[a28_0x53b54b(0xfc)](_0x366450){const _0x41766b=a28_0x53b54b,{options:_0x394fdb}=_0x366450;try{const _0xc44c1d=listProfiles(),_0x5a5965=getActiveProfile();if(_0xc44c1d[_0x41766b(0xf9)]===0x0)return console[_0x41766b(0xe8)](_0x41766b(0xe5)),console[_0x41766b(0xe8)](_0x41766b(0xf3)),console['log'](_0x41766b(0xfa)),0x0;const _0x21bbeb=_0xc44c1d[_0x41766b(0xfb)](_0xe088b6=>{const _0x5f22ac=_0x41766b,_0x10d379=_0xe088b6['name']===_0x5a5965,_0x5e0289=getProfileParams(_0xe088b6[_0x5f22ac(0xf8)]);return{'name':_0xe088b6[_0x5f22ac(0xf4)],'active':_0x10d379,'scope':_0xe088b6[_0x5f22ac(0xf0)],'description':_0xe088b6[_0x5f22ac(0xf8)][_0x5f22ac(0xeb)]||'','params':_0x5e0289};});return await handleSDKOutput(_0x21bbeb,_0x394fdb),0x0;}catch(_0xcb80a1){return _0xcb80a1 instanceof Error&&console[_0x41766b(0xef)](_0x41766b(0xee)+_0xcb80a1[_0x41766b(0xed)]),0x1;}}}function a28_0x22b9(_0x22e1a8,_0x8a3a4c){_0x22e1a8=_0x22e1a8-0xe4;const _0x11ade4=a28_0x11ad();let _0x22b9d4=_0x11ade4[_0x22e1a8];return _0x22b9d4;}function a28_0x11ad(){const _0x2f1ede=['log','22223cyESgK','161ctcMxb','description','926162KOKXmH','message','Error:\x20','error','scope','List\x20all\x20available\x20profiles','21315cXARoJ','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','name','15443622GimDCY','648kXEXRs','profiles','config','length','\x20\x20Global:\x20~/.config/tdx/tdx.json','map','execute','2886616NkyNfP','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','281472PFxElY','1523955nufjLt'];a28_0x11ad=function(){return _0x2f1ede;};return a28_0x11ad();}
1
+ const a28_0x32031f=a28_0x3338;(function(_0x22f1f9,_0x15e51f){const _0xac4e28=a28_0x3338,_0xa1fd3c=_0x22f1f9();while(!![]){try{const _0x30a25a=parseInt(_0xac4e28(0x1ba))/0x1+-parseInt(_0xac4e28(0x1af))/0x2+-parseInt(_0xac4e28(0x1b6))/0x3+-parseInt(_0xac4e28(0x1a9))/0x4*(parseInt(_0xac4e28(0x1b3))/0x5)+-parseInt(_0xac4e28(0x1ac))/0x6+-parseInt(_0xac4e28(0x1b4))/0x7*(-parseInt(_0xac4e28(0x1a6))/0x8)+parseInt(_0xac4e28(0x1aa))/0x9*(parseInt(_0xac4e28(0x1a7))/0xa);if(_0x30a25a===_0x15e51f)break;else _0xa1fd3c['push'](_0xa1fd3c['shift']());}catch(_0xd260ee){_0xa1fd3c['push'](_0xa1fd3c['shift']());}}}(a28_0x352f,0x29737));import{BaseCommand}from'./command.js';function a28_0x352f(){const _0x6b3c7c=['length','712LHxvkz','8924166BcdhPr','log','1386828sNjILX','error','map','612846JvxZqw','profiles','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','description','6360qicJmx','2415FXVvio','List\x20all\x20available\x20profiles','459912yDJLRX','Error:\x20','name','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','20280shzwRa','config','scope','1744bYoixj','10YSACvH'];a28_0x352f=function(){return _0x6b3c7c;};return a28_0x352f();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a28_0x3338(_0x28c195,_0x26cb1e){_0x28c195=_0x28c195-0x1a5;const _0x352f9f=a28_0x352f();let _0x3338b2=_0x352f9f[_0x28c195];return _0x3338b2;}import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x32031f(0x1b8)]=a28_0x32031f(0x1b0);[a28_0x32031f(0x1b2)]=a28_0x32031f(0x1b5);async['execute'](_0x1803a2){const _0x27e698=a28_0x32031f,{options:_0x326771}=_0x1803a2;try{const _0x24f5ca=listProfiles(),_0x4659b1=getActiveProfile();if(_0x24f5ca[_0x27e698(0x1a8)]===0x0)return console['log'](_0x27e698(0x1b9)),console[_0x27e698(0x1ab)](_0x27e698(0x1b1)),console[_0x27e698(0x1ab)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x58d118=_0x24f5ca[_0x27e698(0x1ae)](_0x436f8a=>{const _0x54f737=_0x27e698,_0x1a4354=_0x436f8a[_0x54f737(0x1b8)]===_0x4659b1,_0x18f618=getProfileParams(_0x436f8a[_0x54f737(0x1bb)]);return{'name':_0x436f8a[_0x54f737(0x1b8)],'active':_0x1a4354,'scope':_0x436f8a[_0x54f737(0x1a5)],'description':_0x436f8a[_0x54f737(0x1bb)][_0x54f737(0x1b2)]||'','params':_0x18f618};});return await handleSDKOutput(_0x58d118,_0x326771),0x0;}catch(_0x5b3677){return _0x5b3677 instanceof Error&&console[_0x27e698(0x1ad)](_0x27e698(0x1b7)+_0x5b3677['message']),0x1;}}}