@treasuredata/tdx 0.16.4 → 0.16.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.d.ts.map +1 -1
  9. package/dist/commands/agent-command.js +1 -1
  10. package/dist/commands/agent-command.js.map +1 -1
  11. package/dist/commands/agent-test-command.d.ts +4 -0
  12. package/dist/commands/agent-test-command.d.ts.map +1 -1
  13. package/dist/commands/agent-test-command.js +1 -1
  14. package/dist/commands/agent-test-command.js.map +1 -1
  15. package/dist/commands/api-command.js +1 -1
  16. package/dist/commands/auth-command.d.ts.map +1 -1
  17. package/dist/commands/auth-command.js +1 -1
  18. package/dist/commands/auth-command.js.map +1 -1
  19. package/dist/commands/chat-command.js +1 -1
  20. package/dist/commands/claude-command.js +1 -1
  21. package/dist/commands/claude-statusline-command.js +1 -1
  22. package/dist/commands/claude-usage-command.js +1 -1
  23. package/dist/commands/command.js +1 -1
  24. package/dist/commands/connection-command.js +1 -1
  25. package/dist/commands/databases.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/llm-proxy.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/profile-command.d.ts.map +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profile-command.js.map +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/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.js +1 -1
  55. package/dist/core/auth.js +1 -1
  56. package/dist/core/command-output.js +1 -1
  57. package/dist/core/config.d.ts +7 -5
  58. package/dist/core/config.d.ts.map +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/config.js.map +1 -1
  61. package/dist/core/connection-cache.d.ts.map +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/connection-cache.js.map +1 -1
  64. package/dist/core/constants.d.ts +22 -0
  65. package/dist/core/constants.d.ts.map +1 -1
  66. package/dist/core/constants.js +1 -1
  67. package/dist/core/constants.js.map +1 -1
  68. package/dist/core/credential-cache.js +1 -1
  69. package/dist/core/global-context.js +1 -1
  70. package/dist/core/keychain.d.ts.map +1 -1
  71. package/dist/core/keychain.js +1 -1
  72. package/dist/core/keychain.js.map +1 -1
  73. package/dist/core/profile.js +1 -1
  74. package/dist/core/project-config.js +1 -1
  75. package/dist/core/session.js +1 -1
  76. package/dist/core/user-cache.d.ts.map +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/user-cache.js.map +1 -1
  79. package/dist/core/version.d.ts +2 -2
  80. package/dist/core/version.js +1 -1
  81. package/dist/index.js +1 -1
  82. package/dist/mcp/server.js +1 -1
  83. package/dist/mcp/tools/index.js +1 -1
  84. package/dist/mcp/tools/tdx-run.js +1 -1
  85. package/dist/mcp/tools/tdx-search.js +1 -1
  86. package/dist/mcp/utils.js +1 -1
  87. package/dist/proxy/anthropic-adapter.js +1 -1
  88. package/dist/proxy/claude-usage-tracker.js +1 -1
  89. package/dist/proxy/claude-usage-tracker.js.map +1 -1
  90. package/dist/proxy/context-signature.js +1 -1
  91. package/dist/proxy/conversation-utils.js +1 -1
  92. package/dist/proxy/passthrough-server.js +1 -1
  93. package/dist/proxy/server.js +1 -1
  94. package/dist/proxy/session-cache.js +1 -1
  95. package/dist/proxy/sse-usage-parser.js +1 -1
  96. package/dist/sdk/agent/agent-config.js +1 -1
  97. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  98. package/dist/sdk/agent/agent-yaml.d.ts +2 -0
  99. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  100. package/dist/sdk/agent/agent-yaml.js +1 -1
  101. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  102. package/dist/sdk/agent/test/evaluator.d.ts +3 -6
  103. package/dist/sdk/agent/test/evaluator.d.ts.map +1 -1
  104. package/dist/sdk/agent/test/evaluator.js +1 -1
  105. package/dist/sdk/agent/test/evaluator.js.map +1 -1
  106. package/dist/sdk/agent/test/executor.d.ts +57 -1
  107. package/dist/sdk/agent/test/executor.d.ts.map +1 -1
  108. package/dist/sdk/agent/test/executor.js +1 -1
  109. package/dist/sdk/agent/test/executor.js.map +1 -1
  110. package/dist/sdk/agent/test/index.d.ts +2 -2
  111. package/dist/sdk/agent/test/index.d.ts.map +1 -1
  112. package/dist/sdk/agent/test/index.js +1 -1
  113. package/dist/sdk/agent/test/index.js.map +1 -1
  114. package/dist/sdk/agent/test/output.js +1 -1
  115. package/dist/sdk/agent/test/parser.d.ts.map +1 -1
  116. package/dist/sdk/agent/test/parser.js +1 -1
  117. package/dist/sdk/agent/test/parser.js.map +1 -1
  118. package/dist/sdk/agent/test/types.d.ts +44 -0
  119. package/dist/sdk/agent/test/types.d.ts.map +1 -1
  120. package/dist/sdk/api.js +1 -1
  121. package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
  122. package/dist/sdk/claude-agent/environment.js +1 -1
  123. package/dist/sdk/claude-agent/index.js +1 -1
  124. package/dist/sdk/claude-agent/system-prompts.js +1 -1
  125. package/dist/sdk/client/cdp-api-client.js +1 -1
  126. package/dist/sdk/client/endpoints.js +1 -1
  127. package/dist/sdk/client/endpoints.js.map +1 -1
  128. package/dist/sdk/client/engage-api-client.js +1 -1
  129. package/dist/sdk/client/http-client.js +1 -1
  130. package/dist/sdk/client/llm-api-client.d.ts +6 -0
  131. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  132. package/dist/sdk/client/llm-api-client.js +1 -1
  133. package/dist/sdk/client/llm-api-client.js.map +1 -1
  134. package/dist/sdk/client/rate-limiter.js +1 -1
  135. package/dist/sdk/client/td-api-client.js +1 -1
  136. package/dist/sdk/client/trino-api-client.js +1 -1
  137. package/dist/sdk/client/workflow-client.js +1 -1
  138. package/dist/sdk/connection-validator.js +1 -1
  139. package/dist/sdk/connection.js +1 -1
  140. package/dist/sdk/engage.js +1 -1
  141. package/dist/sdk/errors.js +1 -1
  142. package/dist/sdk/index.js +1 -1
  143. package/dist/sdk/io/index.js +1 -1
  144. package/dist/sdk/io/node-filesystem.js +1 -1
  145. package/dist/sdk/job.js +1 -1
  146. package/dist/sdk/journey.js +1 -1
  147. package/dist/sdk/llm/chat-cache.d.ts.map +1 -1
  148. package/dist/sdk/llm/chat-cache.js +1 -1
  149. package/dist/sdk/llm/chat-cache.js.map +1 -1
  150. package/dist/sdk/llm/index.d.ts +11 -3
  151. package/dist/sdk/llm/index.d.ts.map +1 -1
  152. package/dist/sdk/llm/index.js +1 -1
  153. package/dist/sdk/llm/index.js.map +1 -1
  154. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  155. package/dist/sdk/llm/model-aliases.js +1 -1
  156. package/dist/sdk/llm/model-factors.js +1 -1
  157. package/dist/sdk/query/index.js +1 -1
  158. package/dist/sdk/query/sql-parser.js +1 -1
  159. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  160. package/dist/sdk/segment/fields-display.js +1 -1
  161. package/dist/sdk/segment/file-discovery.js +1 -1
  162. package/dist/sdk/segment/journey-utils.js +1 -1
  163. package/dist/sdk/segment/journey-yaml.js +1 -1
  164. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  165. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  166. package/dist/sdk/segment/pull-workflow.js +1 -1
  167. package/dist/sdk/segment/push-workflow.js +1 -1
  168. package/dist/sdk/segment/resolution-context.js +1 -1
  169. package/dist/sdk/segment/segment-path-parser.js +1 -1
  170. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  171. package/dist/sdk/segment/target-resolution.js +1 -1
  172. package/dist/sdk/segment/tdx-config.js +1 -1
  173. package/dist/sdk/segment/validate-files.js +1 -1
  174. package/dist/sdk/segment/yaml-validator.js +1 -1
  175. package/dist/sdk/segment.js +1 -1
  176. package/dist/sdk/types/index.js +1 -1
  177. package/dist/sdk/types/llm.d.ts +39 -0
  178. package/dist/sdk/types/llm.d.ts.map +1 -1
  179. package/dist/sdk/types/progress.js +1 -1
  180. package/dist/sdk/user.js +1 -1
  181. package/dist/sdk/util/format-detector.js +1 -1
  182. package/dist/sdk/util/formatters.js +1 -1
  183. package/dist/sdk/util/index.js +1 -1
  184. package/dist/sdk/util/tree-formatter.js +1 -1
  185. package/dist/sdk/workflow/clone-workflow.js +1 -1
  186. package/dist/sdk/workflow/index.js +1 -1
  187. package/dist/sdk/workflow/pull-workflow.js +1 -1
  188. package/dist/sdk/workflow/push-workflow.js +1 -1
  189. package/dist/sdk/workflow/tdx-config.js +1 -1
  190. package/dist/sdk/workflow/workflow-utils.js +1 -1
  191. package/dist/utils/async.js +1 -1
  192. package/dist/utils/colors.js +1 -1
  193. package/dist/utils/diff.js +1 -1
  194. package/dist/utils/file-permissions.js +1 -1
  195. package/dist/utils/global-cache.d.ts +88 -0
  196. package/dist/utils/global-cache.d.ts.map +1 -0
  197. package/dist/utils/global-cache.js +1 -0
  198. package/dist/utils/global-cache.js.map +1 -0
  199. package/dist/utils/json-loader.js +1 -1
  200. package/dist/utils/local-cache.d.ts +48 -0
  201. package/dist/utils/local-cache.d.ts.map +1 -0
  202. package/dist/utils/local-cache.js +1 -0
  203. package/dist/utils/local-cache.js.map +1 -0
  204. package/dist/utils/option-validation.js +1 -1
  205. package/dist/utils/port.js +1 -1
  206. package/dist/utils/process.js +1 -1
  207. package/dist/utils/prompt.js +1 -1
  208. package/dist/utils/spinner.js +1 -1
  209. package/dist/utils/sse-parser.js +1 -1
  210. package/dist/utils/string-utils.js +1 -1
  211. package/dist/utils/table-ref-parser.js +1 -1
  212. package/dist/utils/tdx-logger.js +1 -1
  213. package/dist/utils/tdx-logger.js.map +1 -1
  214. package/dist/utils/version-check.d.ts.map +1 -1
  215. package/dist/utils/version-check.js +1 -1
  216. package/dist/utils/version-check.js.map +1 -1
  217. package/package.json +2 -2
@@ -1 +1 @@
1
- const a16_0x469af2=a16_0xbbc7;(function(_0x3f741a,_0x3395ec){const _0x3093aa=a16_0xbbc7,_0x56f9fa=_0x3f741a();while(!![]){try{const _0x3a4558=parseInt(_0x3093aa(0x165))/0x1+-parseInt(_0x3093aa(0x1a5))/0x2*(parseInt(_0x3093aa(0x163))/0x3)+-parseInt(_0x3093aa(0x19d))/0x4+-parseInt(_0x3093aa(0x16c))/0x5+-parseInt(_0x3093aa(0x12c))/0x6*(parseInt(_0x3093aa(0x17d))/0x7)+-parseInt(_0x3093aa(0x126))/0x8+parseInt(_0x3093aa(0x122))/0x9;if(_0x3a4558===_0x3395ec)break;else _0x56f9fa['push'](_0x56f9fa['shift']());}catch(_0x30f51a){_0x56f9fa['push'](_0x56f9fa['shift']());}}}(a16_0x2182,0x3c98a));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';function a16_0x2182(){const _0x2fc9be=['engage:workspace:show','Updating\x20workspace\x20\x27','filter','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','1978292EYKYwr','updateCampaign','Engage\x20workspace\x20set\x20to:\x20','duplicateCampaign','List\x20campaigns','Operation\x20cancelled','Set\x20workspace\x20context\x20for\x20Engage\x20commands','Fetching\x20campaign\x20\x27','175000UipGzv','limit','createCampaign','listTemplates','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','engage:campaign:launch','emailSenderId','17498394CiBgqI','List\x20email\x20templates','engage:campaign:resume','Duplicating\x20campaign\x20\x27','3906824giJfbN','keys','Verifying\x20workspace\x20\x27','workspace','createWorkspace','Error:\x20--html\x20is\x20required','11010jsLlCm','Launching\x20campaign\x20\x27','segment','full','engage:templates','engage:template:show','Creating\x20campaign\x20\x27','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','html','\x27?\x20This\x20cannot\x20be\x20undone.','fromEntries','Duplicate\x20a\x20campaign','deleteWorkspace','subject','editorType','Fetching\x20template\x20\x27','Pause\x20a\x20campaign','segmentId','type','Delete\x20a\x20workspace','deleteTemplate','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','\x27\x20deleted\x20successfully','Deleting\x20campaign\x20\x27','getCampaign','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','engage:campaign:duplicate','Template\x20\x27','timezone','Pausing\x20campaign\x20\x27','data','Fetching\x20workspace\x20\x27','getWorkspaceFull','Updating\x20campaign\x20\x27','length','getTemplateFull','execute','name','engage','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','MISSING_ARGUMENT','engage:template:create','resolveWorkspaceId','engage:workspace:update','engage:campaign:show','yes','\x27...','Workspace\x20is\x20required\x20for\x20this\x20operation','plaintext','engage:workspace:create','engage:campaign:update','Delete\x20a\x20campaign','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','status','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','9McODAP','Launch\x20a\x20campaign','123702LXKVDO','Error:\x20Workspace\x20name\x20is\x20required','Error:\x20--name\x20is\x20required','log','engage_workspace','Workspace\x20\x27','engage:template:delete','1844100hwOykd','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Fetching\x20templates...','entries','Update\x20an\x20email\x20template','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','Delete\x20an\x20email\x20template','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','resumeCampaign','getWorkspace','List\x20workspaces','Error:\x20--subject\x20is\x20required','Resuming\x20campaign\x20\x27','Fetching\x20campaigns...','Creating\x20template\x20\x27','updateWorkspace','784YMHPME','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Deleting\x20workspace\x20\x27','engage:workspaces','Deleting\x20template\x20\x27','engage:campaign:pause','verbose','error','startAt','resolvePathToResource','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Create\x20an\x20email\x20template','Creating\x20workspace\x20\x27','deleteCampaign','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','createTemplate','engage:campaign:create','description','listWorkspaces','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','Campaign\x20\x27','engage:workspace:use','parentName','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Show\x20email\x20template\x20details'];a16_0x2182=function(){return _0x2fc9be;};return a16_0x2182();}import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x2c2885,_0xdeffdc,_0x1aaa28=![]){const _0x79d507=a16_0xbbc7;if(_0x2c2885[_0x79d507(0x129)])return await _0xdeffdc[_0x79d507(0x152)]['resolveWorkspaceId'](_0x2c2885[_0x79d507(0x129)]);const _0x1bdd9a=loadSessionContext(_0x2c2885['session']);if(_0x1bdd9a?.[_0x79d507(0x169)])return await _0xdeffdc['engage'][_0x79d507(0x156)](_0x1bdd9a[_0x79d507(0x169)]);if(_0x1aaa28)throw new SDKError(ErrorCode[_0x79d507(0x154)],_0x79d507(0x15b),undefined,{'helpText':_0x79d507(0x162)});return undefined;}async function resolveSegmentFromOptions(_0x31b4d5,_0x1be268){const _0x5e472f=a16_0xbbc7;if(!_0x31b4d5[_0x5e472f(0x12e)])return{};const _0x580f5d=_0x31b4d5[_0x5e472f(0x12e)],_0x4beb48=await _0x1be268[_0x5e472f(0x12e)][_0x5e472f(0x187)](_0x580f5d);return{'audienceId':_0x4beb48['parentId'],'audienceName':_0x4beb48[_0x5e472f(0x194)],..._0x4beb48[_0x5e472f(0x13d)]&&{'segmentId':_0x4beb48[_0x5e472f(0x13d)],'segmentName':_0x4beb48['segmentName']}};}function buildConnectorConfig(_0x1d9a60){const _0xfc0c7c=a16_0xbbc7,_0x2350d0=_0x1d9a60[_0xfc0c7c(0x121)],_0x15e188=_0x1d9a60['jsonColumns'];if(!_0x2350d0&&!_0x15e188)return undefined;return{..._0x2350d0&&{'emailSenderId':_0x2350d0},..._0x15e188&&{'jsonColumns':_0x15e188}};}export class EngageCampaignsCommand extends BaseCommand{[a16_0x469af2(0x151)]='engage:campaigns';[a16_0x469af2(0x18f)]=a16_0x469af2(0x1a1);async[a16_0x469af2(0x150)](_0x5351b9){const _0x4db609=a16_0x469af2,{options:_0x47b43e,args:_0x7e93b5,tdx:_0x28208d}=_0x5351b9,_0x517a50=_0x7e93b5[0x0],_0x407e49=resolveLimit(_0x47b43e[_0x4db609(0x1a6)],DEFAULT_LLM_LIMIT),_0x1064a6=_0x47b43e,_0x5c6637=_0x1064a6['type'],_0x2b42f9=_0x1064a6[_0x4db609(0x161)],_0x3d3e5d=await resolveWorkspaceIdFromOptions(_0x1064a6,_0x28208d),_0x68c948=await withSpinner(_0x4db609(0x17a),()=>_0x28208d['engage']['listCampaigns']({'type':_0x5c6637,'status':_0x2b42f9,'workspaceId':_0x3d3e5d,'limit':_0x407e49}),{'verbose':_0x47b43e['verbose']});let _0x5cbb32=_0x68c948[_0x4db609(0x14a)];return _0x517a50&&(_0x5cbb32=_0x68c948[_0x4db609(0x14a)][_0x4db609(0x199)](_0x55e78d=>matchGlobPattern(_0x55e78d['name'],_0x517a50))),await handleSDKOutput(_0x5cbb32,_0x47b43e),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x469af2(0x151)]=a16_0x469af2(0x158);[a16_0x469af2(0x18f)]='Show\x20campaign\x20details';async[a16_0x469af2(0x150)](_0x72c789){const _0xdda30=a16_0x469af2,{options:_0x1e2d07,args:_0x297815,tdx:_0x40ae84}=_0x72c789;if(_0x297815[_0xdda30(0x14e)]===0x0)return console[_0xdda30(0x185)](_0xdda30(0x133)),console[_0xdda30(0x185)](_0xdda30(0x141)),0x1;const _0x51ba00=_0x297815[0x0],_0xd9dd2c=_0x1e2d07,_0x41d39e=await resolveWorkspaceIdFromOptions(_0xd9dd2c,_0x40ae84),_0x3d60df=_0xd9dd2c['full'];if(_0x3d60df){const _0x276c3d=await withSpinner('Fetching\x20campaign\x20\x27'+_0x51ba00+_0xdda30(0x15a),()=>_0x40ae84[_0xdda30(0x152)]['getCampaignFull'](_0x51ba00,_0x41d39e),{'verbose':_0x1e2d07[_0xdda30(0x184)]});await handleSDKOutput([_0x276c3d],_0x1e2d07);}else{const _0x5ed827=await withSpinner(_0xdda30(0x1a4)+_0x51ba00+_0xdda30(0x15a),()=>_0x40ae84[_0xdda30(0x152)][_0xdda30(0x144)](_0x51ba00,_0x41d39e),{'verbose':_0x1e2d07[_0xdda30(0x184)]});await handleSDKOutput([_0x5ed827],_0x1e2d07);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a16_0x469af2(0x151)]=a16_0x469af2(0x18e);[a16_0x469af2(0x18f)]='Create\x20a\x20new\x20campaign';async[a16_0x469af2(0x150)](_0x802c70){const _0x38087a=a16_0x469af2,{options:_0x5835d6,tdx:_0x5a91fd}=_0x802c70,_0x2d1ec8=_0x5835d6,_0x5ea397=_0x2d1ec8[_0x38087a(0x151)],_0x3f85ba=_0x2d1ec8[_0x38087a(0x13e)];if(!_0x5ea397)return console[_0x38087a(0x185)](_0x38087a(0x167)),console['error'](_0x38087a(0x195)),0x1;if(!_0x3f85ba)return console[_0x38087a(0x185)](_0x38087a(0x19b)),console[_0x38087a(0x185)]('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;const _0x2d0e53=await resolveWorkspaceIdFromOptions(_0x2d1ec8,_0x5a91fd,!![]),_0x482696=await resolveSegmentFromOptions(_0x2d1ec8,_0x5a91fd),_0x5796da=buildConnectorConfig(_0x2d1ec8),_0x2ce560={'name':_0x5ea397,'campaignType':_0x3f85ba,'workspaceId':_0x2d0e53,'description':_0x2d1ec8[_0x38087a(0x18f)],..._0x482696,'connectorConfig':_0x5796da,'startAt':_0x2d1ec8[_0x38087a(0x186)],'timezone':_0x2d1ec8[_0x38087a(0x148)]},_0x5c84ba=await withSpinner(_0x38087a(0x132)+_0x5ea397+_0x38087a(0x15a),()=>_0x5a91fd['engage'][_0x38087a(0x1a7)](_0x2ce560));return await handleSDKOutput([_0x5c84ba[_0x38087a(0x14a)]],_0x5835d6),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x469af2(0x151)]=a16_0x469af2(0x15e);['description']='Update\x20a\x20campaign';async['execute'](_0xa70fb2){const _0x396962=a16_0x469af2,{options:_0x907602,args:_0x4decd8,tdx:_0x52d976}=_0xa70fb2;if(_0x4decd8['length']===0x0)return console[_0x396962(0x185)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x396962(0x185)](_0x396962(0x18c)),0x1;const _0x30702d=_0x4decd8[0x0],_0xafc8e7=_0x907602,_0x3968ad=await resolveWorkspaceIdFromOptions(_0xafc8e7,_0x52d976),_0x4129be=await resolveSegmentFromOptions(_0xafc8e7,_0x52d976),_0x16be24=buildConnectorConfig(_0xafc8e7),_0x493372={'name':_0xafc8e7[_0x396962(0x151)],'description':_0xafc8e7['description'],..._0x4129be,'connectorConfig':_0x16be24,'startAt':_0xafc8e7[_0x396962(0x186)],'timezone':_0xafc8e7[_0x396962(0x148)]},_0x536585=Object[_0x396962(0x136)](Object['entries'](_0x493372)[_0x396962(0x199)](([,_0x54e79a])=>_0x54e79a!==undefined));if(Object[_0x396962(0x127)](_0x536585)[_0x396962(0x14e)]===0x0)return console[_0x396962(0x185)](_0x396962(0x153)),console[_0x396962(0x185)]('Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone'),0x1;const _0x1b57dd=await withSpinner(_0x396962(0x14d)+_0x30702d+'\x27...',()=>_0x52d976[_0x396962(0x152)][_0x396962(0x19e)](_0x30702d,_0x536585,_0x3968ad),{'verbose':_0x907602[_0x396962(0x184)]});return await handleSDKOutput([_0x1b57dd[_0x396962(0x14a)]],_0x907602),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a16_0x469af2(0x151)]='engage:campaign:delete';[a16_0x469af2(0x18f)]=a16_0x469af2(0x15f);async['execute'](_0x4fa6a2){const _0x37b24a=a16_0x469af2,{options:_0x5bc4e9,args:_0x25a342,tdx:_0xbf6e29}=_0x4fa6a2;if(_0x25a342['length']===0x0)return console[_0x37b24a(0x185)](_0x37b24a(0x133)),console[_0x37b24a(0x185)](_0x37b24a(0x174)),0x1;const _0x36bed5=_0x25a342[0x0],_0x11ff6c=_0x5bc4e9,_0x5cf5de=await resolveWorkspaceIdFromOptions(_0x11ff6c,_0xbf6e29);if(!_0x5bc4e9[_0x37b24a(0x159)]){const _0x53eaf1=await confirm(_0x37b24a(0x188)+_0x36bed5+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x53eaf1)return console[_0x37b24a(0x168)](_0x37b24a(0x1a2)),0x0;}return await withSpinner(_0x37b24a(0x143)+_0x36bed5+_0x37b24a(0x15a),()=>_0xbf6e29[_0x37b24a(0x152)][_0x37b24a(0x18b)](_0x36bed5,_0x5cf5de),{'verbose':_0x5bc4e9[_0x37b24a(0x184)]}),console['log'](_0x37b24a(0x192)+_0x36bed5+_0x37b24a(0x142)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x469af2(0x151)]=a16_0x469af2(0x120);[a16_0x469af2(0x18f)]=a16_0x469af2(0x164);async[a16_0x469af2(0x150)](_0x2fd170){const _0x4536b3=a16_0x469af2,{options:_0x5a2d7d,args:_0x333d28,tdx:_0x497a06}=_0x2fd170;if(_0x333d28[_0x4536b3(0x14e)]===0x0)return console[_0x4536b3(0x185)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x4536b3(0x19a)),0x1;const _0x5efb39=_0x333d28[0x0],_0x17e71c=_0x5a2d7d,_0x20d1fd=await resolveWorkspaceIdFromOptions(_0x17e71c,_0x497a06);return await withSpinner(_0x4536b3(0x12d)+_0x5efb39+_0x4536b3(0x15a),()=>_0x497a06[_0x4536b3(0x152)]['launchCampaign'](_0x5efb39,_0x20d1fd),{'verbose':_0x5a2d7d['verbose']}),console['log'](_0x4536b3(0x192)+_0x5efb39+'\x27\x20launched\x20successfully'),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x469af2(0x151)]=a16_0x469af2(0x183);['description']=a16_0x469af2(0x13c);async[a16_0x469af2(0x150)](_0xb9a8b7){const _0x3f0d25=a16_0x469af2,{options:_0x304449,args:_0x532742,tdx:_0x150aa5}=_0xb9a8b7;if(_0x532742[_0x3f0d25(0x14e)]===0x0)return console[_0x3f0d25(0x185)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x3f0d25(0x185)](_0x3f0d25(0x17e)),0x1;const _0x3b08cd=_0x532742[0x0],_0x4ed78e=_0x304449,_0x1b4e40=await resolveWorkspaceIdFromOptions(_0x4ed78e,_0x150aa5);return await withSpinner(_0x3f0d25(0x149)+_0x3b08cd+_0x3f0d25(0x15a),()=>_0x150aa5['engage']['pauseCampaign'](_0x3b08cd,_0x1b4e40),{'verbose':_0x304449[_0x3f0d25(0x184)]}),console[_0x3f0d25(0x168)](_0x3f0d25(0x192)+_0x3b08cd+'\x27\x20paused\x20successfully'),0x0;}}function a16_0xbbc7(_0x4c9cd1,_0x2746fc){_0x4c9cd1=_0x4c9cd1-0x11e;const _0x21825f=a16_0x2182();let _0xbbc749=_0x21825f[_0x4c9cd1];return _0xbbc749;}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x469af2(0x151)]=a16_0x469af2(0x124);['description']='Resume\x20a\x20paused\x20campaign';async['execute'](_0x4333b6){const _0xf7be76=a16_0x469af2,{options:_0x212a40,args:_0x4d63d0,tdx:_0x43cc51}=_0x4333b6;if(_0x4d63d0[_0xf7be76(0x14e)]===0x0)return console[_0xf7be76(0x185)](_0xf7be76(0x133)),console[_0xf7be76(0x185)]('Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>'),0x1;const _0x9005e6=_0x4d63d0[0x0],_0x72eba3=_0x212a40,_0x550675=await resolveWorkspaceIdFromOptions(_0x72eba3,_0x43cc51);return await withSpinner(_0xf7be76(0x179)+_0x9005e6+_0xf7be76(0x15a),()=>_0x43cc51[_0xf7be76(0x152)][_0xf7be76(0x175)](_0x9005e6,_0x550675),{'verbose':_0x212a40[_0xf7be76(0x184)]}),console[_0xf7be76(0x168)]('Campaign\x20\x27'+_0x9005e6+'\x27\x20resumed\x20successfully'),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']=a16_0x469af2(0x146);[a16_0x469af2(0x18f)]=a16_0x469af2(0x137);async['execute'](_0x5d93bd){const _0x566206=a16_0x469af2,{options:_0x463ab4,args:_0xc38fa0,tdx:_0x1ab5d1}=_0x5d93bd;if(_0xc38fa0['length']===0x0)return console[_0x566206(0x185)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x566206(0x185)]('Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>'),0x1;const _0x233322=_0xc38fa0[0x0],_0x327e3b=_0x463ab4,_0x51d961=await resolveWorkspaceIdFromOptions(_0x327e3b,_0x1ab5d1),_0x538805=await withSpinner(_0x566206(0x125)+_0x233322+'\x27...',()=>_0x1ab5d1[_0x566206(0x152)][_0x566206(0x1a0)](_0x233322,_0x51d961),{'verbose':_0x463ab4[_0x566206(0x184)]});return await handleSDKOutput([_0x538805[_0x566206(0x14a)]],_0x463ab4),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']=a16_0x469af2(0x130);[a16_0x469af2(0x18f)]=a16_0x469af2(0x123);async[a16_0x469af2(0x150)](_0x273c47){const _0x5b1ed7=a16_0x469af2,{options:_0x45261e,args:_0x50f2b3,tdx:_0x45eaad}=_0x273c47,_0x477297=_0x50f2b3[0x0],_0x255c7b=resolveLimit(_0x45261e[_0x5b1ed7(0x1a6)],DEFAULT_LLM_LIMIT),_0x18cf4c=_0x45261e,_0x307ad1=await resolveWorkspaceIdFromOptions(_0x18cf4c,_0x45eaad),_0x576387=await withSpinner(_0x5b1ed7(0x16f),()=>_0x45eaad[_0x5b1ed7(0x152)][_0x5b1ed7(0x1a8)]({'workspaceId':_0x307ad1,'limit':_0x255c7b}),{'verbose':_0x45261e[_0x5b1ed7(0x184)]});let _0x15b5a4=_0x576387[_0x5b1ed7(0x14a)];return _0x477297&&(_0x15b5a4=_0x576387[_0x5b1ed7(0x14a)][_0x5b1ed7(0x199)](_0x39db4b=>matchGlobPattern(_0x39db4b[_0x5b1ed7(0x151)],_0x477297))),await handleSDKOutput(_0x15b5a4,_0x45261e),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{['name']=a16_0x469af2(0x131);[a16_0x469af2(0x18f)]=a16_0x469af2(0x196);async[a16_0x469af2(0x150)](_0x3fdfa2){const _0x6a9563=a16_0x469af2,{options:_0x5dbe17,args:_0x3e3540,tdx:_0x233f5f}=_0x3fdfa2;if(_0x3e3540[_0x6a9563(0x14e)]===0x0)return console[_0x6a9563(0x185)](_0x6a9563(0x16d)),console[_0x6a9563(0x185)](_0x6a9563(0x145)),0x1;const _0x45c96f=_0x3e3540[0x0],_0x181597=_0x5dbe17,_0x4a8a07=await resolveWorkspaceIdFromOptions(_0x181597,_0x233f5f),_0x2fcafd=_0x181597[_0x6a9563(0x12f)];if(_0x2fcafd){const _0x2284fe=await withSpinner('Fetching\x20template\x20\x27'+_0x45c96f+_0x6a9563(0x15a),()=>_0x233f5f['engage'][_0x6a9563(0x14f)](_0x45c96f,_0x4a8a07),{'verbose':_0x5dbe17[_0x6a9563(0x184)]});await handleSDKOutput([_0x2284fe],_0x5dbe17);}else{const _0x3c338d=await withSpinner(_0x6a9563(0x13b)+_0x45c96f+_0x6a9563(0x15a),()=>_0x233f5f[_0x6a9563(0x152)]['getTemplate'](_0x45c96f,_0x4a8a07),{'verbose':_0x5dbe17['verbose']});await handleSDKOutput([_0x3c338d],_0x5dbe17);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x469af2(0x151)]=a16_0x469af2(0x155);[a16_0x469af2(0x18f)]=a16_0x469af2(0x189);async[a16_0x469af2(0x150)](_0x55c8fd){const _0x5854df=a16_0x469af2,{options:_0x199427,tdx:_0x2d03f4}=_0x55c8fd,_0x1a3707=_0x199427,_0x5a4bda=_0x1a3707[_0x5854df(0x151)],_0x1d98cb=_0x1a3707[_0x5854df(0x139)],_0xcc051b=_0x1a3707[_0x5854df(0x134)];if(!_0x5a4bda)return console[_0x5854df(0x185)](_0x5854df(0x167)),console['error']('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x1d98cb)return console[_0x5854df(0x185)](_0x5854df(0x178)),0x1;if(!_0xcc051b)return console[_0x5854df(0x185)](_0x5854df(0x12b)),0x1;const _0x552edc=await resolveWorkspaceIdFromOptions(_0x1a3707,_0x2d03f4,!![]),_0xe5322e={'name':_0x5a4bda,'subjectTemplate':_0x1d98cb,'htmlTemplate':_0xcc051b,'workspaceId':_0x552edc,'plaintextTemplate':_0x1a3707[_0x5854df(0x15c)],'editorType':_0x1a3707[_0x5854df(0x13a)]},_0x48092f=await withSpinner(_0x5854df(0x17b)+_0x5a4bda+_0x5854df(0x15a),()=>_0x2d03f4[_0x5854df(0x152)][_0x5854df(0x18d)](_0xe5322e));return await handleSDKOutput([_0x48092f[_0x5854df(0x14a)]],_0x199427),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{['name']='engage:template:update';['description']=a16_0x469af2(0x171);async[a16_0x469af2(0x150)](_0x4ee18c){const _0x27fc7c=a16_0x469af2,{options:_0x248544,args:_0x1164e1,tdx:_0x584bbc}=_0x4ee18c;if(_0x1164e1[_0x27fc7c(0x14e)]===0x0)return console['error'](_0x27fc7c(0x16d)),console[_0x27fc7c(0x185)]('Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x5312c8=_0x1164e1[0x0],_0x47db3b=_0x248544,_0x964854=await resolveWorkspaceIdFromOptions(_0x47db3b,_0x584bbc),_0x494880={'name':_0x47db3b[_0x27fc7c(0x151)],'subjectTemplate':_0x47db3b[_0x27fc7c(0x139)],'htmlTemplate':_0x47db3b[_0x27fc7c(0x134)],'plaintextTemplate':_0x47db3b[_0x27fc7c(0x15c)]},_0x53cf16=Object[_0x27fc7c(0x136)](Object[_0x27fc7c(0x170)](_0x494880)[_0x27fc7c(0x199)](([,_0x1b444d])=>_0x1b444d!==undefined));if(Object[_0x27fc7c(0x127)](_0x53cf16)[_0x27fc7c(0x14e)]===0x0)return console[_0x27fc7c(0x185)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console['error'](_0x27fc7c(0x11e)),0x1;const _0x458d47=await withSpinner('Updating\x20template\x20\x27'+_0x5312c8+_0x27fc7c(0x15a),()=>_0x584bbc[_0x27fc7c(0x152)]['updateTemplate'](_0x5312c8,_0x53cf16,_0x964854),{'verbose':_0x248544[_0x27fc7c(0x184)]});return await handleSDKOutput([_0x458d47[_0x27fc7c(0x14a)]],_0x248544),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a16_0x469af2(0x151)]=a16_0x469af2(0x16b);['description']=a16_0x469af2(0x173);async[a16_0x469af2(0x150)](_0x27fa00){const _0x17f7f8=a16_0x469af2,{options:_0x190dce,args:_0x2e69b7,tdx:_0x36fc55}=_0x27fa00;if(_0x2e69b7['length']===0x0)return console[_0x17f7f8(0x185)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x17f7f8(0x185)](_0x17f7f8(0x172)),0x1;const _0x153a68=_0x2e69b7[0x0],_0xd84f8a=_0x190dce,_0x437836=await resolveWorkspaceIdFromOptions(_0xd84f8a,_0x36fc55);if(!_0x190dce['yes']){const _0x26c67b=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x153a68+_0x17f7f8(0x135));if(!_0x26c67b)return console[_0x17f7f8(0x168)](_0x17f7f8(0x1a2)),0x0;}return await withSpinner(_0x17f7f8(0x182)+_0x153a68+'\x27...',()=>_0x36fc55[_0x17f7f8(0x152)][_0x17f7f8(0x140)](_0x153a68,_0x437836),{'verbose':_0x190dce[_0x17f7f8(0x184)]}),console[_0x17f7f8(0x168)](_0x17f7f8(0x147)+_0x153a68+_0x17f7f8(0x142)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a16_0x469af2(0x151)]=a16_0x469af2(0x181);[a16_0x469af2(0x18f)]=a16_0x469af2(0x177);async[a16_0x469af2(0x150)](_0xdf7a){const _0x50fbeb=a16_0x469af2,{options:_0x59f8f5,args:_0x423d8d,tdx:_0x35f96b}=_0xdf7a,_0x24d9ed=_0x423d8d[0x0],_0x4d4a95=resolveLimit(_0x59f8f5['limit'],DEFAULT_LLM_LIMIT),_0x8dfbdc=await withSpinner('Fetching\x20workspaces...',()=>_0x35f96b[_0x50fbeb(0x152)][_0x50fbeb(0x190)]({'limit':_0x4d4a95}),{'verbose':_0x59f8f5[_0x50fbeb(0x184)]});let _0x1ed674=_0x8dfbdc['data'];return _0x24d9ed&&(_0x1ed674=_0x8dfbdc[_0x50fbeb(0x14a)][_0x50fbeb(0x199)](_0x187a9e=>matchGlobPattern(_0x187a9e[_0x50fbeb(0x151)],_0x24d9ed))),await handleSDKOutput(_0x1ed674,_0x59f8f5),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x469af2(0x151)]=a16_0x469af2(0x197);[a16_0x469af2(0x18f)]='Show\x20workspace\x20details';async[a16_0x469af2(0x150)](_0x543ba3){const _0x398f1e=a16_0x469af2,{options:_0x457d18,args:_0x20c76c,tdx:_0x104451}=_0x543ba3;if(_0x20c76c[_0x398f1e(0x14e)]===0x0)return console[_0x398f1e(0x185)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console[_0x398f1e(0x185)](_0x398f1e(0x160)),0x1;const _0x51063e=_0x20c76c[0x0],_0x19d64a=_0x457d18,_0x3dcb35=_0x19d64a[_0x398f1e(0x12f)];if(_0x3dcb35){const _0x3adc94=await withSpinner('Fetching\x20workspace\x20\x27'+_0x51063e+_0x398f1e(0x15a),()=>_0x104451[_0x398f1e(0x152)][_0x398f1e(0x14c)](_0x51063e),{'verbose':_0x457d18[_0x398f1e(0x184)]});await handleSDKOutput([_0x3adc94],_0x457d18);}else{const _0x1e47af=await withSpinner(_0x398f1e(0x14b)+_0x51063e+'\x27...',()=>_0x104451['engage'][_0x398f1e(0x176)](_0x51063e),{'verbose':_0x457d18[_0x398f1e(0x184)]});await handleSDKOutput([_0x1e47af],_0x457d18);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a16_0x469af2(0x15d);[a16_0x469af2(0x18f)]='Create\x20a\x20workspace';async[a16_0x469af2(0x150)](_0x348e3a){const _0x135958=a16_0x469af2,{options:_0x460666,tdx:_0x21e049}=_0x348e3a,_0x4cd00=_0x460666,_0x196b20=_0x4cd00['name'];if(!_0x196b20)return console['error']('Error:\x20--name\x20is\x20required'),console[_0x135958(0x185)](_0x135958(0x191)),0x1;const _0x3f81c1={'name':_0x196b20,'description':_0x4cd00[_0x135958(0x18f)]},_0x56d81e=await withSpinner(_0x135958(0x18a)+_0x196b20+'\x27...',()=>_0x21e049['engage'][_0x135958(0x12a)](_0x3f81c1));return await handleSDKOutput([_0x56d81e['data']],_0x460666),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{['name']=a16_0x469af2(0x157);[a16_0x469af2(0x18f)]='Update\x20a\x20workspace';async[a16_0x469af2(0x150)](_0xd2e93e){const _0x5bc0c1=a16_0x469af2,{options:_0x59b5bf,args:_0x1632ac,tdx:_0x142d83}=_0xd2e93e;if(_0x1632ac[_0x5bc0c1(0x14e)]===0x0)return console[_0x5bc0c1(0x185)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console[_0x5bc0c1(0x185)](_0x5bc0c1(0x19c)),0x1;const _0x334c88=_0x1632ac[0x0],_0x41428d=_0x59b5bf,_0xa87af4={'name':_0x41428d[_0x5bc0c1(0x151)],'description':_0x41428d[_0x5bc0c1(0x18f)]},_0xa86b53=Object[_0x5bc0c1(0x136)](Object[_0x5bc0c1(0x170)](_0xa87af4)[_0x5bc0c1(0x199)](([,_0x40fc76])=>_0x40fc76!==undefined));if(Object['keys'](_0xa86b53)[_0x5bc0c1(0x14e)]===0x0)return console[_0x5bc0c1(0x185)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console['error']('Options:\x20--name,\x20--description'),0x1;const _0x21f9d2=await withSpinner(_0x5bc0c1(0x198)+_0x334c88+_0x5bc0c1(0x15a),()=>_0x142d83[_0x5bc0c1(0x152)][_0x5bc0c1(0x17c)](_0x334c88,_0xa86b53),{'verbose':_0x59b5bf[_0x5bc0c1(0x184)]});return await handleSDKOutput([_0x21f9d2[_0x5bc0c1(0x14a)]],_0x59b5bf),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x469af2(0x151)]='engage:workspace:delete';[a16_0x469af2(0x18f)]=a16_0x469af2(0x13f);async[a16_0x469af2(0x150)](_0x496965){const _0xbcb984=a16_0x469af2,{options:_0x5bbaff,args:_0x2b5091,tdx:_0x52288b}=_0x496965;if(_0x2b5091[_0xbcb984(0x14e)]===0x0)return console['error'](_0xbcb984(0x16e)),console['error'](_0xbcb984(0x17f)),0x1;const _0xa10510=_0x2b5091[0x0];if(!_0x5bbaff['yes']){const _0x600922=await confirm(_0xbcb984(0x11f)+_0xa10510+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x600922)return console['log'](_0xbcb984(0x1a2)),0x0;}return await withSpinner(_0xbcb984(0x180)+_0xa10510+_0xbcb984(0x15a),()=>_0x52288b[_0xbcb984(0x152)][_0xbcb984(0x138)](_0xa10510),{'verbose':_0x5bbaff[_0xbcb984(0x184)]}),console['log'](_0xbcb984(0x16a)+_0xa10510+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{['name']=a16_0x469af2(0x193);['description']=a16_0x469af2(0x1a3);async['execute'](_0x2ff165){const _0x562056=a16_0x469af2,{options:_0x42fb69,args:_0xb2c4a,tdx:_0x359dce}=_0x2ff165;if(_0xb2c4a['length']===0x0)return console[_0x562056(0x185)](_0x562056(0x166)),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>'),0x1;const _0x3e4683=_0xb2c4a[0x0];await withSpinner(_0x562056(0x128)+_0x3e4683+'\x27...',()=>_0x359dce[_0x562056(0x152)][_0x562056(0x156)](_0x3e4683));const _0x5a68a6=_0x42fb69['session']||undefined;return saveSessionContext({'engage_workspace':_0x3e4683},_0x5a68a6),console['log'](_0x562056(0x19f)+_0x3e4683),console[_0x562056(0x168)]('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides'),0x0;}}
1
+ const a16_0x300c1e=a16_0x10cd;(function(_0x4ef8cb,_0x35ca14){const _0x5d53dd=a16_0x10cd,_0x18aca6=_0x4ef8cb();while(!![]){try{const _0x524ce7=-parseInt(_0x5d53dd(0x169))/0x1+-parseInt(_0x5d53dd(0x17f))/0x2+-parseInt(_0x5d53dd(0x14a))/0x3*(-parseInt(_0x5d53dd(0x192))/0x4)+parseInt(_0x5d53dd(0x125))/0x5+parseInt(_0x5d53dd(0x11d))/0x6+parseInt(_0x5d53dd(0x161))/0x7+-parseInt(_0x5d53dd(0x134))/0x8*(parseInt(_0x5d53dd(0x141))/0x9);if(_0x524ce7===_0x35ca14)break;else _0x18aca6['push'](_0x18aca6['shift']());}catch(_0x224ddf){_0x18aca6['push'](_0x18aca6['shift']());}}}(a16_0x57f9,0xd4a4d));import{BaseCommand}from'./command.js';function a16_0x10cd(_0x1cf248,_0x8304c4){_0x1cf248=_0x1cf248-0x112;const _0x57f9b7=a16_0x57f9();let _0x10cd5c=_0x57f9b7[_0x1cf248];return _0x10cd5c;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x2c3e00,_0x5ccbff,_0x152574=![]){const _0x43f7d=a16_0x10cd;if(_0x2c3e00[_0x43f7d(0x16e)])return await _0x5ccbff[_0x43f7d(0x18f)][_0x43f7d(0x142)](_0x2c3e00[_0x43f7d(0x16e)]);const _0x51092c=loadSessionContext(_0x2c3e00[_0x43f7d(0x119)]);if(_0x51092c?.['engage_workspace'])return await _0x5ccbff['engage'][_0x43f7d(0x142)](_0x51092c['engage_workspace']);if(_0x152574)throw new SDKError(ErrorCode[_0x43f7d(0x15e)],_0x43f7d(0x13d),undefined,{'helpText':_0x43f7d(0x15f)});return undefined;}async function resolveSegmentFromOptions(_0x33529a,_0x2eb228){const _0x7fe61=a16_0x10cd;if(!_0x33529a[_0x7fe61(0x16c)])return{};const _0x60ab9a=_0x33529a[_0x7fe61(0x16c)],_0x3a2699=await _0x2eb228['segment'][_0x7fe61(0x188)](_0x60ab9a);return{'audienceId':_0x3a2699[_0x7fe61(0x121)],'audienceName':_0x3a2699[_0x7fe61(0x132)],..._0x3a2699[_0x7fe61(0x16a)]&&{'segmentId':_0x3a2699[_0x7fe61(0x16a)],'segmentName':_0x3a2699[_0x7fe61(0x11a)]}};}function buildConnectorConfig(_0x1ea017){const _0x1f6fee=a16_0x10cd,_0x28ba2c=_0x1ea017[_0x1f6fee(0x124)],_0x2fcf4d=_0x1ea017[_0x1f6fee(0x129)];if(!_0x28ba2c&&!_0x2fcf4d)return undefined;return{..._0x28ba2c&&{'emailSenderId':_0x28ba2c},..._0x2fcf4d&&{'jsonColumns':_0x2fcf4d}};}export class EngageCampaignsCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x181);[a16_0x300c1e(0x13a)]='List\x20campaigns';async[a16_0x300c1e(0x168)](_0x1fb303){const _0x408775=a16_0x300c1e,{options:_0x2248d8,args:_0x59fda3,tdx:_0x6033f3}=_0x1fb303,_0x54cab4=_0x59fda3[0x0],_0x1c5e2c=resolveLimit(_0x2248d8[_0x408775(0x12d)],DEFAULT_LLM_LIMIT),_0xcd7f40=_0x2248d8,_0x37c212=_0xcd7f40[_0x408775(0x157)],_0x559bf3=_0xcd7f40[_0x408775(0x118)],_0x5ea15f=await resolveWorkspaceIdFromOptions(_0xcd7f40,_0x6033f3),_0x5b8f7e=await withSpinner(_0x408775(0x126),()=>_0x6033f3['engage'][_0x408775(0x19b)]({'type':_0x37c212,'status':_0x559bf3,'workspaceId':_0x5ea15f,'limit':_0x1c5e2c}),{'verbose':_0x2248d8[_0x408775(0x18a)]});let _0x5ef7e5=_0x5b8f7e[_0x408775(0x12e)];return _0x54cab4&&(_0x5ef7e5=_0x5b8f7e[_0x408775(0x12e)]['filter'](_0x3577f8=>matchGlobPattern(_0x3577f8[_0x408775(0x177)],_0x54cab4))),await handleSDKOutput(_0x5ef7e5,_0x2248d8),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x14c);['description']=a16_0x300c1e(0x185);async[a16_0x300c1e(0x168)](_0x1f69ca){const _0x19c5b2=a16_0x300c1e,{options:_0x1acd81,args:_0x53b002,tdx:_0x11c4a3}=_0x1f69ca;if(_0x53b002['length']===0x0)return console[_0x19c5b2(0x196)](_0x19c5b2(0x12c)),console[_0x19c5b2(0x196)]('Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>'),0x1;const _0xbeb044=_0x53b002[0x0],_0x3f0e8d=_0x1acd81,_0x3ffed9=await resolveWorkspaceIdFromOptions(_0x3f0e8d,_0x11c4a3),_0x544bde=_0x3f0e8d[_0x19c5b2(0x165)];if(_0x544bde){const _0x266656=await withSpinner(_0x19c5b2(0x13e)+_0xbeb044+_0x19c5b2(0x146),()=>_0x11c4a3[_0x19c5b2(0x18f)]['getCampaignFull'](_0xbeb044,_0x3ffed9),{'verbose':_0x1acd81[_0x19c5b2(0x18a)]});await handleSDKOutput([_0x266656],_0x1acd81);}else{const _0x4706dc=await withSpinner(_0x19c5b2(0x13e)+_0xbeb044+_0x19c5b2(0x146),()=>_0x11c4a3[_0x19c5b2(0x18f)][_0x19c5b2(0x186)](_0xbeb044,_0x3ffed9),{'verbose':_0x1acd81[_0x19c5b2(0x18a)]});await handleSDKOutput([_0x4706dc],_0x1acd81);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x19c);['description']='Create\x20a\x20new\x20campaign';async[a16_0x300c1e(0x168)](_0x47c859){const _0x192dfd=a16_0x300c1e,{options:_0x58abf7,tdx:_0x1d1fad}=_0x47c859,_0xa19b4a=_0x58abf7,_0x26b951=_0xa19b4a[_0x192dfd(0x177)],_0x3f81e4=_0xa19b4a[_0x192dfd(0x157)];if(!_0x26b951)return console['error'](_0x192dfd(0x114)),console['error'](_0x192dfd(0x14f)),0x1;if(!_0x3f81e4)return console['error'](_0x192dfd(0x18e)),console[_0x192dfd(0x196)](_0x192dfd(0x14f)),0x1;const _0x316af5=await resolveWorkspaceIdFromOptions(_0xa19b4a,_0x1d1fad,!![]),_0x59b1ec=await resolveSegmentFromOptions(_0xa19b4a,_0x1d1fad),_0x2a93a6=buildConnectorConfig(_0xa19b4a),_0x44f445={'name':_0x26b951,'campaignType':_0x3f81e4,'workspaceId':_0x316af5,'description':_0xa19b4a[_0x192dfd(0x13a)],..._0x59b1ec,'connectorConfig':_0x2a93a6,'startAt':_0xa19b4a[_0x192dfd(0x179)],'timezone':_0xa19b4a[_0x192dfd(0x17b)]},_0x218e79=await withSpinner('Creating\x20campaign\x20\x27'+_0x26b951+'\x27...',()=>_0x1d1fad[_0x192dfd(0x18f)][_0x192dfd(0x18c)](_0x44f445));return await handleSDKOutput([_0x218e79[_0x192dfd(0x12e)]],_0x58abf7),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x15b);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x11f);async[a16_0x300c1e(0x168)](_0x419f83){const _0x1fafb3=a16_0x300c1e,{options:_0x1e5b48,args:_0x3501d7,tdx:_0x58a121}=_0x419f83;if(_0x3501d7['length']===0x0)return console[_0x1fafb3(0x196)](_0x1fafb3(0x12c)),console['error'](_0x1fafb3(0x13f)),0x1;const _0x3a9b55=_0x3501d7[0x0],_0x232be1=_0x1e5b48,_0x426003=await resolveWorkspaceIdFromOptions(_0x232be1,_0x58a121),_0x4d3500=await resolveSegmentFromOptions(_0x232be1,_0x58a121),_0x8b7d67=buildConnectorConfig(_0x232be1),_0x39dcbf={'name':_0x232be1[_0x1fafb3(0x177)],'description':_0x232be1[_0x1fafb3(0x13a)],..._0x4d3500,'connectorConfig':_0x8b7d67,'startAt':_0x232be1[_0x1fafb3(0x179)],'timezone':_0x232be1[_0x1fafb3(0x17b)]},_0x17c0c6=Object['fromEntries'](Object['entries'](_0x39dcbf)[_0x1fafb3(0x19e)](([,_0x58a5e0])=>_0x58a5e0!==undefined));if(Object['keys'](_0x17c0c6)[_0x1fafb3(0x190)]===0x0)return console[_0x1fafb3(0x196)](_0x1fafb3(0x17a)),console[_0x1fafb3(0x196)](_0x1fafb3(0x172)),0x1;const _0x15beb0=await withSpinner(_0x1fafb3(0x122)+_0x3a9b55+_0x1fafb3(0x146),()=>_0x58a121[_0x1fafb3(0x18f)][_0x1fafb3(0x197)](_0x3a9b55,_0x17c0c6,_0x426003),{'verbose':_0x1e5b48[_0x1fafb3(0x18a)]});return await handleSDKOutput([_0x15beb0[_0x1fafb3(0x12e)]],_0x1e5b48),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{['name']=a16_0x300c1e(0x193);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x163);async[a16_0x300c1e(0x168)](_0x4f46f9){const _0x46bac9=a16_0x300c1e,{options:_0x5ba919,args:_0x3eda93,tdx:_0x307e0a}=_0x4f46f9;if(_0x3eda93[_0x46bac9(0x190)]===0x0)return console[_0x46bac9(0x196)](_0x46bac9(0x12c)),console[_0x46bac9(0x196)]('Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>'),0x1;const _0x4ebe2a=_0x3eda93[0x0],_0xceae42=_0x5ba919,_0x5258f5=await resolveWorkspaceIdFromOptions(_0xceae42,_0x307e0a);if(!_0x5ba919[_0x46bac9(0x19a)]){const _0x26771b=await confirm(_0x46bac9(0x180)+_0x4ebe2a+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x26771b)return console[_0x46bac9(0x127)](_0x46bac9(0x173)),0x0;}return await withSpinner(_0x46bac9(0x159)+_0x4ebe2a+_0x46bac9(0x146),()=>_0x307e0a[_0x46bac9(0x18f)][_0x46bac9(0x15c)](_0x4ebe2a,_0x5258f5),{'verbose':_0x5ba919[_0x46bac9(0x18a)]}),console[_0x46bac9(0x127)](_0x46bac9(0x11e)+_0x4ebe2a+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x152);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x113);async[a16_0x300c1e(0x168)](_0x374f75){const _0xe63980=a16_0x300c1e,{options:_0x32506f,args:_0xf5215c,tdx:_0x48f52a}=_0x374f75;if(_0xf5215c[_0xe63980(0x190)]===0x0)return console[_0xe63980(0x196)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0xe63980(0x196)](_0xe63980(0x130)),0x1;const _0x330fe3=_0xf5215c[0x0],_0x1ac03c=_0x32506f,_0x5f261a=await resolveWorkspaceIdFromOptions(_0x1ac03c,_0x48f52a);return await withSpinner(_0xe63980(0x14b)+_0x330fe3+_0xe63980(0x146),()=>_0x48f52a['engage'][_0xe63980(0x12a)](_0x330fe3,_0x5f261a),{'verbose':_0x32506f['verbose']}),console['log']('Campaign\x20\x27'+_0x330fe3+'\x27\x20launched\x20successfully'),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x300c1e(0x177)]='engage:campaign:pause';[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x15d);async[a16_0x300c1e(0x168)](_0x121fbf){const _0x262b79=a16_0x300c1e,{options:_0x2f3218,args:_0x3c3b74,tdx:_0x2bef9a}=_0x121fbf;if(_0x3c3b74[_0x262b79(0x190)]===0x0)return console[_0x262b79(0x196)](_0x262b79(0x12c)),console[_0x262b79(0x196)]('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x193002=_0x3c3b74[0x0],_0x28c8b7=_0x2f3218,_0x152d1a=await resolveWorkspaceIdFromOptions(_0x28c8b7,_0x2bef9a);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x193002+'\x27...',()=>_0x2bef9a['engage']['pauseCampaign'](_0x193002,_0x152d1a),{'verbose':_0x2f3218[_0x262b79(0x18a)]}),console['log'](_0x262b79(0x11e)+_0x193002+_0x262b79(0x16d)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x135);['description']='Resume\x20a\x20paused\x20campaign';async[a16_0x300c1e(0x168)](_0x324d7d){const _0x25cac4=a16_0x300c1e,{options:_0x349030,args:_0x4504ff,tdx:_0x286dfd}=_0x324d7d;if(_0x4504ff[_0x25cac4(0x190)]===0x0)return console[_0x25cac4(0x196)](_0x25cac4(0x12c)),console[_0x25cac4(0x196)]('Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>'),0x1;const _0x5a46c2=_0x4504ff[0x0],_0x98ae44=_0x349030,_0x1c349f=await resolveWorkspaceIdFromOptions(_0x98ae44,_0x286dfd);return await withSpinner(_0x25cac4(0x189)+_0x5a46c2+_0x25cac4(0x146),()=>_0x286dfd[_0x25cac4(0x18f)][_0x25cac4(0x115)](_0x5a46c2,_0x1c349f),{'verbose':_0x349030[_0x25cac4(0x18a)]}),console[_0x25cac4(0x127)](_0x25cac4(0x11e)+_0x5a46c2+_0x25cac4(0x191)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']=a16_0x300c1e(0x133);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x154);async['execute'](_0x31de2b){const _0x21174f=a16_0x300c1e,{options:_0x5e8f2a,args:_0x1a04ed,tdx:_0x45b1ef}=_0x31de2b;if(_0x1a04ed[_0x21174f(0x190)]===0x0)return console[_0x21174f(0x196)](_0x21174f(0x12c)),console[_0x21174f(0x196)](_0x21174f(0x187)),0x1;const _0x1c9b11=_0x1a04ed[0x0],_0x5bce5a=_0x5e8f2a,_0x297158=await resolveWorkspaceIdFromOptions(_0x5bce5a,_0x45b1ef),_0x8a82da=await withSpinner('Duplicating\x20campaign\x20\x27'+_0x1c9b11+_0x21174f(0x146),()=>_0x45b1ef[_0x21174f(0x18f)]['duplicateCampaign'](_0x1c9b11,_0x297158),{'verbose':_0x5e8f2a['verbose']});return await handleSDKOutput([_0x8a82da[_0x21174f(0x12e)]],_0x5e8f2a),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']=a16_0x300c1e(0x14d);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x131);async[a16_0x300c1e(0x168)](_0xd73c95){const _0x53063c=a16_0x300c1e,{options:_0x4b346d,args:_0x1220ad,tdx:_0x574d7a}=_0xd73c95,_0x39bfab=_0x1220ad[0x0],_0x10c6f0=resolveLimit(_0x4b346d[_0x53063c(0x12d)],DEFAULT_LLM_LIMIT),_0x50615b=_0x4b346d,_0x1b7d90=await resolveWorkspaceIdFromOptions(_0x50615b,_0x574d7a),_0x1d573a=await withSpinner(_0x53063c(0x148),()=>_0x574d7a['engage']['listTemplates']({'workspaceId':_0x1b7d90,'limit':_0x10c6f0}),{'verbose':_0x4b346d['verbose']});let _0x350dbc=_0x1d573a[_0x53063c(0x12e)];return _0x39bfab&&(_0x350dbc=_0x1d573a['data']['filter'](_0xced6a6=>matchGlobPattern(_0xced6a6[_0x53063c(0x177)],_0x39bfab))),await handleSDKOutput(_0x350dbc,_0x4b346d),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x18d);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x19f);async[a16_0x300c1e(0x168)](_0x3c70ae){const _0x531c88=a16_0x300c1e,{options:_0x16eb06,args:_0x352ca0,tdx:_0x3430a7}=_0x3c70ae;if(_0x352ca0['length']===0x0)return console[_0x531c88(0x196)](_0x531c88(0x143)),console[_0x531c88(0x196)](_0x531c88(0x16f)),0x1;const _0x99a60d=_0x352ca0[0x0],_0x15792d=_0x16eb06,_0x3db649=await resolveWorkspaceIdFromOptions(_0x15792d,_0x3430a7),_0x42fec4=_0x15792d[_0x531c88(0x165)];if(_0x42fec4){const _0x2d8c46=await withSpinner(_0x531c88(0x170)+_0x99a60d+_0x531c88(0x146),()=>_0x3430a7[_0x531c88(0x18f)][_0x531c88(0x13c)](_0x99a60d,_0x3db649),{'verbose':_0x16eb06[_0x531c88(0x18a)]});await handleSDKOutput([_0x2d8c46],_0x16eb06);}else{const _0x27bec5=await withSpinner(_0x531c88(0x170)+_0x99a60d+'\x27...',()=>_0x3430a7[_0x531c88(0x18f)][_0x531c88(0x11c)](_0x99a60d,_0x3db649),{'verbose':_0x16eb06[_0x531c88(0x18a)]});await handleSDKOutput([_0x27bec5],_0x16eb06);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x160);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x171);async['execute'](_0x5853c8){const _0x2e562e=a16_0x300c1e,{options:_0x2abce5,tdx:_0x3ddbbb}=_0x5853c8,_0x1103fc=_0x2abce5,_0x8f955f=_0x1103fc[_0x2e562e(0x177)],_0x1699fd=_0x1103fc[_0x2e562e(0x17c)],_0x54533b=_0x1103fc[_0x2e562e(0x137)];if(!_0x8f955f)return console[_0x2e562e(0x196)](_0x2e562e(0x114)),console[_0x2e562e(0x196)]('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x1699fd)return console[_0x2e562e(0x196)](_0x2e562e(0x164)),0x1;if(!_0x54533b)return console[_0x2e562e(0x196)](_0x2e562e(0x176)),0x1;const _0x4ff81e=await resolveWorkspaceIdFromOptions(_0x1103fc,_0x3ddbbb,!![]),_0x2aceea={'name':_0x8f955f,'subjectTemplate':_0x1699fd,'htmlTemplate':_0x54533b,'workspaceId':_0x4ff81e,'plaintextTemplate':_0x1103fc['plaintext'],'editorType':_0x1103fc[_0x2e562e(0x14e)]},_0x1718b2=await withSpinner(_0x2e562e(0x198)+_0x8f955f+_0x2e562e(0x146),()=>_0x3ddbbb[_0x2e562e(0x18f)][_0x2e562e(0x116)](_0x2aceea));return await handleSDKOutput([_0x1718b2['data']],_0x2abce5),0x0;}}function a16_0x57f9(){const _0x53a993=['Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','engage:template:create','5145994nppBtt','engage:workspace:use','Delete\x20a\x20campaign','Error:\x20--subject\x20is\x20required','full','engage:template:delete','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','execute','916578MaAmJk','segmentId','Options:\x20--name,\x20--description','segment','\x27\x20paused\x20successfully','workspace','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','Fetching\x20template\x20\x27','Create\x20an\x20email\x20template','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','Operation\x20cancelled','engage:template:update','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','Error:\x20--html\x20is\x20required','name','Deleting\x20workspace\x20\x27','startAt','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','timezone','subject','Delete\x20a\x20workspace','\x27\x20deleted\x20successfully','1032750MIerKh','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','engage:campaigns','entries','deleteTemplate','listWorkspaces','Show\x20campaign\x20details','getCampaign','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','resolvePathToResource','Resuming\x20campaign\x20\x27','verbose','updateTemplate','createCampaign','engage:template:show','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','engage','length','\x27\x20resumed\x20successfully','48FUDGsp','engage:campaign:delete','Error:\x20Workspace\x20name\x20is\x20required','Deleting\x20template\x20\x27','error','updateCampaign','Creating\x20template\x20\x27','Engage\x20workspace\x20set\x20to:\x20','yes','listCampaigns','engage:campaign:create','fromEntries','filter','Show\x20email\x20template\x20details','Verifying\x20workspace\x20\x27','Launch\x20a\x20campaign','Error:\x20--name\x20is\x20required','resumeCampaign','createTemplate','engage:workspace:show','status','session','segmentName','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','getTemplate','7346400vAHvqV','Campaign\x20\x27','Update\x20a\x20campaign','deleteWorkspace','parentId','Updating\x20campaign\x20\x27','Updating\x20template\x20\x27','emailSenderId','4953895SirfUl','Fetching\x20campaigns...','log','engage:workspace:update','jsonColumns','launchCampaign','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','limit','data','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','List\x20email\x20templates','parentName','engage:campaign:duplicate','8DcxYRG','engage:campaign:resume','Template\x20\x27','html','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Update\x20a\x20workspace','description','Workspace\x20\x27','getTemplateFull','Workspace\x20is\x20required\x20for\x20this\x20operation','Fetching\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','\x27?\x20This\x20cannot\x20be\x20undone.','8450667veThMm','resolveWorkspaceId','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','Fetching\x20workspace\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','\x27...','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Fetching\x20templates...','keys','73146BHxKrd','Launching\x20campaign\x20\x27','engage:campaign:show','engage:templates','editorType','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Creating\x20workspace\x20\x27','engage:campaign:launch','Update\x20an\x20email\x20template','Duplicate\x20a\x20campaign','Create\x20a\x20workspace','Show\x20workspace\x20details','type','engage:workspace:create','Deleting\x20campaign\x20\x27','updateWorkspace','engage:campaign:update','deleteCampaign','Pause\x20a\x20campaign','MISSING_ARGUMENT'];a16_0x57f9=function(){return _0x53a993;};return a16_0x57f9();}export class EngageTemplateUpdateCommand extends BaseCommand{['name']=a16_0x300c1e(0x174);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x153);async[a16_0x300c1e(0x168)](_0x10389a){const _0x453903=a16_0x300c1e,{options:_0x553efe,args:_0x24c5bb,tdx:_0x9d0584}=_0x10389a;if(_0x24c5bb[_0x453903(0x190)]===0x0)return console[_0x453903(0x196)](_0x453903(0x143)),console[_0x453903(0x196)](_0x453903(0x12b)),0x1;const _0x5c00fe=_0x24c5bb[0x0],_0x312372=_0x553efe,_0x4edb2b=await resolveWorkspaceIdFromOptions(_0x312372,_0x9d0584),_0x3e4fc8={'name':_0x312372['name'],'subjectTemplate':_0x312372[_0x453903(0x17c)],'htmlTemplate':_0x312372['html'],'plaintextTemplate':_0x312372['plaintext']},_0x4b4b18=Object[_0x453903(0x19d)](Object[_0x453903(0x182)](_0x3e4fc8)[_0x453903(0x19e)](([,_0x385df9])=>_0x385df9!==undefined));if(Object[_0x453903(0x149)](_0x4b4b18)[_0x453903(0x190)]===0x0)return console[_0x453903(0x196)](_0x453903(0x17a)),console[_0x453903(0x196)](_0x453903(0x167)),0x1;const _0x478e0e=await withSpinner(_0x453903(0x123)+_0x5c00fe+_0x453903(0x146),()=>_0x9d0584[_0x453903(0x18f)][_0x453903(0x18b)](_0x5c00fe,_0x4b4b18,_0x4edb2b),{'verbose':_0x553efe[_0x453903(0x18a)]});return await handleSDKOutput([_0x478e0e[_0x453903(0x12e)]],_0x553efe),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x166);[a16_0x300c1e(0x13a)]='Delete\x20an\x20email\x20template';async[a16_0x300c1e(0x168)](_0xd90071){const _0x358f2e=a16_0x300c1e,{options:_0x1fbe2b,args:_0x397106,tdx:_0x4004f7}=_0xd90071;if(_0x397106[_0x358f2e(0x190)]===0x0)return console['error'](_0x358f2e(0x143)),console[_0x358f2e(0x196)]('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x3fcb1f=_0x397106[0x0],_0x2c3693=_0x1fbe2b,_0x273ff0=await resolveWorkspaceIdFromOptions(_0x2c3693,_0x4004f7);if(!_0x1fbe2b[_0x358f2e(0x19a)]){const _0x1a94f6=await confirm(_0x358f2e(0x138)+_0x3fcb1f+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x1a94f6)return console['log']('Operation\x20cancelled'),0x0;}return await withSpinner(_0x358f2e(0x195)+_0x3fcb1f+_0x358f2e(0x146),()=>_0x4004f7[_0x358f2e(0x18f)][_0x358f2e(0x183)](_0x3fcb1f,_0x273ff0),{'verbose':_0x1fbe2b['verbose']}),console[_0x358f2e(0x127)](_0x358f2e(0x136)+_0x3fcb1f+_0x358f2e(0x17e)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']='engage:workspaces';['description']='List\x20workspaces';async[a16_0x300c1e(0x168)](_0x5070d8){const _0x3ea7f7=a16_0x300c1e,{options:_0x52ebad,args:_0x3690f8,tdx:_0x248be3}=_0x5070d8,_0x42dd5b=_0x3690f8[0x0],_0x2dbd26=resolveLimit(_0x52ebad[_0x3ea7f7(0x12d)],DEFAULT_LLM_LIMIT),_0x1e9845=await withSpinner('Fetching\x20workspaces...',()=>_0x248be3[_0x3ea7f7(0x18f)][_0x3ea7f7(0x184)]({'limit':_0x2dbd26}),{'verbose':_0x52ebad[_0x3ea7f7(0x18a)]});let _0x35d493=_0x1e9845[_0x3ea7f7(0x12e)];return _0x42dd5b&&(_0x35d493=_0x1e9845[_0x3ea7f7(0x12e)][_0x3ea7f7(0x19e)](_0x5010a9=>matchGlobPattern(_0x5010a9[_0x3ea7f7(0x177)],_0x42dd5b))),await handleSDKOutput(_0x35d493,_0x52ebad),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x117);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x156);async[a16_0x300c1e(0x168)](_0x47e22c){const _0x373c21=a16_0x300c1e,{options:_0x1bc374,args:_0x427a1a,tdx:_0x204840}=_0x47e22c;if(_0x427a1a[_0x373c21(0x190)]===0x0)return console[_0x373c21(0x196)](_0x373c21(0x11b)),console[_0x373c21(0x196)](_0x373c21(0x145)),0x1;const _0x1f50f8=_0x427a1a[0x0],_0x49830c=_0x1bc374,_0xddd68c=_0x49830c[_0x373c21(0x165)];if(_0xddd68c){const _0x34f0b1=await withSpinner(_0x373c21(0x144)+_0x1f50f8+_0x373c21(0x146),()=>_0x204840[_0x373c21(0x18f)]['getWorkspaceFull'](_0x1f50f8),{'verbose':_0x1bc374[_0x373c21(0x18a)]});await handleSDKOutput([_0x34f0b1],_0x1bc374);}else{const _0x488a66=await withSpinner(_0x373c21(0x144)+_0x1f50f8+_0x373c21(0x146),()=>_0x204840['engage']['getWorkspace'](_0x1f50f8),{'verbose':_0x1bc374[_0x373c21(0x18a)]});await handleSDKOutput([_0x488a66],_0x1bc374);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x158);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x155);async[a16_0x300c1e(0x168)](_0x153754){const _0x139746=a16_0x300c1e,{options:_0x59d4f7,tdx:_0x37afba}=_0x153754,_0x342e63=_0x59d4f7,_0x82f740=_0x342e63[_0x139746(0x177)];if(!_0x82f740)return console[_0x139746(0x196)](_0x139746(0x114)),console[_0x139746(0x196)](_0x139746(0x175)),0x1;const _0x4921b2={'name':_0x82f740,'description':_0x342e63[_0x139746(0x13a)]},_0x504a61=await withSpinner(_0x139746(0x151)+_0x82f740+_0x139746(0x146),()=>_0x37afba['engage']['createWorkspace'](_0x4921b2));return await handleSDKOutput([_0x504a61[_0x139746(0x12e)]],_0x59d4f7),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{['name']=a16_0x300c1e(0x128);[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x139);async[a16_0x300c1e(0x168)](_0x51bca9){const _0x24d485=a16_0x300c1e,{options:_0x2ebd7b,args:_0x25a5d4,tdx:_0x1fbae6}=_0x51bca9;if(_0x25a5d4[_0x24d485(0x190)]===0x0)return console['error'](_0x24d485(0x11b)),console[_0x24d485(0x196)](_0x24d485(0x150)),0x1;const _0x723024=_0x25a5d4[0x0],_0x473945=_0x2ebd7b,_0x4ab434={'name':_0x473945[_0x24d485(0x177)],'description':_0x473945[_0x24d485(0x13a)]},_0x310122=Object[_0x24d485(0x19d)](Object[_0x24d485(0x182)](_0x4ab434)[_0x24d485(0x19e)](([,_0x4ae51c])=>_0x4ae51c!==undefined));if(Object[_0x24d485(0x149)](_0x310122)[_0x24d485(0x190)]===0x0)return console['error']('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x24d485(0x196)](_0x24d485(0x16b)),0x1;const _0x174f13=await withSpinner('Updating\x20workspace\x20\x27'+_0x723024+_0x24d485(0x146),()=>_0x1fbae6[_0x24d485(0x18f)][_0x24d485(0x15a)](_0x723024,_0x310122),{'verbose':_0x2ebd7b[_0x24d485(0x18a)]});return await handleSDKOutput([_0x174f13[_0x24d485(0x12e)]],_0x2ebd7b),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x300c1e(0x177)]='engage:workspace:delete';[a16_0x300c1e(0x13a)]=a16_0x300c1e(0x17d);async[a16_0x300c1e(0x168)](_0x4891f5){const _0x236df5=a16_0x300c1e,{options:_0x438517,args:_0x298dd4,tdx:_0x3d123b}=_0x4891f5;if(_0x298dd4[_0x236df5(0x190)]===0x0)return console['error'](_0x236df5(0x11b)),console[_0x236df5(0x196)](_0x236df5(0x147)),0x1;const _0x5be41f=_0x298dd4[0x0];if(!_0x438517[_0x236df5(0x19a)]){const _0x4b282a=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27'+_0x5be41f+_0x236df5(0x140));if(!_0x4b282a)return console[_0x236df5(0x127)](_0x236df5(0x173)),0x0;}return await withSpinner(_0x236df5(0x178)+_0x5be41f+_0x236df5(0x146),()=>_0x3d123b[_0x236df5(0x18f)][_0x236df5(0x120)](_0x5be41f),{'verbose':_0x438517[_0x236df5(0x18a)]}),console[_0x236df5(0x127)](_0x236df5(0x13b)+_0x5be41f+_0x236df5(0x17e)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a16_0x300c1e(0x177)]=a16_0x300c1e(0x162);['description']='Set\x20workspace\x20context\x20for\x20Engage\x20commands';async[a16_0x300c1e(0x168)](_0x31a7cb){const _0x3a43bc=a16_0x300c1e,{options:_0x1de68e,args:_0x5b0ee0,tdx:_0x50928d}=_0x31a7cb;if(_0x5b0ee0['length']===0x0)return console[_0x3a43bc(0x196)](_0x3a43bc(0x194)),console[_0x3a43bc(0x196)](_0x3a43bc(0x12f)),0x1;const _0x44ab68=_0x5b0ee0[0x0];await withSpinner(_0x3a43bc(0x112)+_0x44ab68+'\x27...',()=>_0x50928d[_0x3a43bc(0x18f)][_0x3a43bc(0x142)](_0x44ab68));const _0x41dd84=_0x1de68e[_0x3a43bc(0x119)]||undefined;return saveSessionContext({'engage_workspace':_0x44ab68},_0x41dd84),console[_0x3a43bc(0x127)](_0x3a43bc(0x199)+_0x44ab68),console[_0x3a43bc(0x127)]('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides'),0x0;}}
@@ -1 +1 @@
1
- const a17_0x298d66=a17_0x5472;function a17_0x5472(_0x4452ae,_0x2da21d){_0x4452ae=_0x4452ae-0x82;const _0x4269a8=a17_0x4269();let _0x5472c2=_0x4269a8[_0x4452ae];return _0x5472c2;}(function(_0x213376,_0x273254){const _0x3bd909=a17_0x5472,_0x299c60=_0x213376();while(!![]){try{const _0x3ddc9b=-parseInt(_0x3bd909(0xa9))/0x1+-parseInt(_0x3bd909(0x90))/0x2+parseInt(_0x3bd909(0xbb))/0x3*(parseInt(_0x3bd909(0xae))/0x4)+parseInt(_0x3bd909(0xc0))/0x5*(-parseInt(_0x3bd909(0xa1))/0x6)+-parseInt(_0x3bd909(0xa3))/0x7+parseInt(_0x3bd909(0xc4))/0x8+parseInt(_0x3bd909(0xa7))/0x9;if(_0x3ddc9b===_0x273254)break;else _0x299c60['push'](_0x299c60['shift']());}catch(_0x5c1c43){_0x299c60['push'](_0x299c60['shift']());}}}(a17_0x4269,0x57dc0));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a17_0x298d66(0xa6)]=a17_0x298d66(0xba);['description']=a17_0x298d66(0x9a);async['execute'](_0x4f714){const _0x39d2d5=a17_0x298d66,{options:_0x1136b5,tdx:_0x5a0cc0}=_0x4f714;try{const _0x2875aa=resolveLimit(_0x1136b5[_0x39d2d5(0xb1)],DEFAULT_DISPLAY_LIMIT),_0x1ed8b7=_0x1136b5[_0x39d2d5(0xad)];_0x1136b5[_0x39d2d5(0xaf)]&&(console[_0x39d2d5(0x99)](_0x39d2d5(0xbf)+_0x2875aa+_0x39d2d5(0xbc)),_0x1ed8b7&&console[_0x39d2d5(0x99)](_0x39d2d5(0xcc)+_0x1ed8b7));const _0x35dc49=await withSpinner(_0x39d2d5(0xb6),()=>_0x5a0cc0[_0x39d2d5(0xba)]['list']({'from':0x0,'to':_0x2875aa-0x1,'status':_0x1ed8b7}),{'verbose':_0x1136b5[_0x39d2d5(0xaf)]}),_0x872227=_0x35dc49[_0x39d2d5(0xc5)];console['error'](_0x39d2d5(0x88)+_0x872227[_0x39d2d5(0xa8)]+'\x20job'+(_0x872227[_0x39d2d5(0xa8)]!==0x1?'s':''));const _0x18c6e2=_0x872227['map'](_0x217c2c=>{const _0x21f5e8=_0x39d2d5;let _0x4b2351;if(_0x217c2c[_0x21f5e8(0xa2)]&&_0x217c2c[_0x21f5e8(0x94)]){const _0x41bc7=new Date(_0x217c2c[_0x21f5e8(0xa2)])[_0x21f5e8(0xb4)](),_0x5c3695=new Date(_0x217c2c['end_at'])[_0x21f5e8(0xb4)]();_0x4b2351=Math['round']((_0x5c3695-_0x41bc7)/0x3e8);}return{'job_id':_0x217c2c['job_id'],'type':_0x217c2c[_0x21f5e8(0xb9)],'status':_0x217c2c[_0x21f5e8(0xad)],'user_name':_0x217c2c[_0x21f5e8(0x82)],'duration_sec':_0x4b2351,'created_at':_0x217c2c['created_at'],'started_at':_0x217c2c[_0x21f5e8(0xa2)],'end_at':_0x217c2c[_0x21f5e8(0x94)]};});return await handleSDKOutput(_0x18c6e2,_0x1136b5),0x0;}catch(_0x2cb1c4){if(_0x2cb1c4 instanceof SDKError)return console[_0x39d2d5(0x99)](_0x39d2d5(0xaa)+_0x2cb1c4[_0x39d2d5(0xbe)]),_0x2cb1c4[_0x39d2d5(0xcb)]&&console[_0x39d2d5(0x99)](_0x39d2d5(0xb8)+_0x2cb1c4[_0x39d2d5(0xcb)]),0x1;throw _0x2cb1c4;}}}export class JobShowCommand extends BaseCommand{[a17_0x298d66(0xa6)]=a17_0x298d66(0x9f);[a17_0x298d66(0xc3)]=a17_0x298d66(0x8c);async[a17_0x298d66(0x92)](_0x59aee0){const _0x1f12fa=a17_0x298d66,{options:_0x3c3f68,args:_0x391e13,tdx:_0x1c7d28}=_0x59aee0,_0x4d4a0b=_0x391e13[0x0];if(!_0x4d4a0b)return console['error'](_0x1f12fa(0xca)),console[_0x1f12fa(0x99)](_0x1f12fa(0x83)),0x1;try{const _0x3ef940=await withSpinner(_0x1f12fa(0xc6),()=>_0x1c7d28['jobs'][_0x1f12fa(0xbd)](_0x4d4a0b),{'verbose':_0x3c3f68[_0x1f12fa(0xaf)]}),_0x3aa726=_0x3ef940[_0x1f12fa(0xc5)];let _0x5686d3;if(_0x3aa726[_0x1f12fa(0xa2)]&&_0x3aa726[_0x1f12fa(0x94)]){const _0x5a73ab=new Date(_0x3aa726[_0x1f12fa(0xa2)])['getTime'](),_0x426a54=new Date(_0x3aa726[_0x1f12fa(0x94)])[_0x1f12fa(0xb4)]();_0x5686d3=Math[_0x1f12fa(0x96)]((_0x426a54-_0x5a73ab)/0x3e8);}const _0x1b43a7={'job_id':_0x3aa726[_0x1f12fa(0xab)],'type':_0x3aa726[_0x1f12fa(0xb9)],'status':_0x3aa726[_0x1f12fa(0xad)],..._0x3aa726[_0x1f12fa(0x82)]&&{'user_name':_0x3aa726[_0x1f12fa(0x82)]},..._0x5686d3!==undefined&&{'duration_sec':_0x5686d3},..._0x3aa726['created_at']&&{'created_at':_0x3aa726[_0x1f12fa(0x98)]},..._0x3aa726[_0x1f12fa(0xa2)]&&{'started_at':_0x3aa726[_0x1f12fa(0xa2)]},..._0x3aa726[_0x1f12fa(0x94)]&&{'end_at':_0x3aa726[_0x1f12fa(0x94)]},..._0x3aa726[_0x1f12fa(0x93)]&&{'database':_0x3aa726['database']},..._0x3aa726[_0x1f12fa(0x84)]!==undefined&&{'priority':_0x3aa726['priority']},..._0x3aa726[_0x1f12fa(0x8f)]&&{'url':_0x3aa726[_0x1f12fa(0x8f)]},..._0x3aa726[_0x1f12fa(0x9d)]&&{'query':_0x3aa726[_0x1f12fa(0x9d)]},..._0x3aa726['debug']&&{'debug':_0x3aa726['debug']}};return await handleSingleObjectOutput(_0x1b43a7,_0x3c3f68),0x0;}catch(_0x207319){if(_0x207319 instanceof SDKError)return console[_0x1f12fa(0x99)](_0x1f12fa(0xaa)+_0x207319[_0x1f12fa(0xbe)]),_0x207319['cause']&&console[_0x1f12fa(0x99)](_0x1f12fa(0xb8)+_0x207319['cause']),0x1;throw _0x207319;}}}export class JobKillCommand extends BaseCommand{['name']=a17_0x298d66(0x8a);[a17_0x298d66(0xc3)]=a17_0x298d66(0xa0);async[a17_0x298d66(0x92)](_0x28a96d){const _0x5848cf=a17_0x298d66,{options:_0x8841bc,args:_0x1b9b6a,tdx:_0x328351}=_0x28a96d,_0x55d0ef=_0x1b9b6a[0x0];if(!_0x55d0ef)return console['error'](_0x5848cf(0xca)),console[_0x5848cf(0x99)](_0x5848cf(0xb2)),0x1;try{if(!_0x8841bc['yes']){const _0xee07dd=await confirm(_0x5848cf(0xc1)+_0x55d0ef+'?');if(!_0xee07dd)return console[_0x5848cf(0x99)]('Cancelled'),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x328351[_0x5848cf(0xba)][_0x5848cf(0xa5)](_0x55d0ef),{'verbose':_0x8841bc[_0x5848cf(0xaf)]}),console[_0x5848cf(0x99)](_0x5848cf(0x85)+_0x55d0ef),console[_0x5848cf(0x99)](_0x5848cf(0xb7)+_0x55d0ef+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0x353335){if(_0x353335 instanceof SDKError)return console['error'](_0x5848cf(0xaa)+_0x353335[_0x5848cf(0xbe)]),_0x353335['cause']&&console[_0x5848cf(0x99)]('\x20\x20Cause:\x20'+_0x353335[_0x5848cf(0xcb)]),0x1;throw _0x353335;}}}export class JobSubmitCommand extends BaseCommand{[a17_0x298d66(0xa6)]='job:submit';[a17_0x298d66(0xc3)]=a17_0x298d66(0x89);async[a17_0x298d66(0x92)](_0x3d3079){const _0x2c3ae5=a17_0x298d66,{options:_0x423872,args:_0x90ee5e,tdx:_0xcb3b7f}=_0x3d3079;try{const _0x26bcf6=_0x423872[_0x2c3ae5(0x86)]||'trino',_0x2e7cd7=_0x423872[_0x2c3ae5(0x9c)],_0x2d0b15=_0x423872['database']||_0x2c3ae5(0x8e);if(_0x26bcf6!==_0x2c3ae5(0xc7)&&_0x26bcf6!==_0x2c3ae5(0xb0))return console[_0x2c3ae5(0x99)]('Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22'),0x1;let _0x5ce017;if(_0x2e7cd7){if(_0x90ee5e[0x0])return console[_0x2c3ae5(0x99)](_0x2c3ae5(0x97)),0x1;const _0x3c8f31=readSqlStatementsFromFile(_0x2e7cd7);if(_0x3c8f31[_0x2c3ae5(0xa8)]===0x0)return console['error']('Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file'),0x1;if(_0x3c8f31[_0x2c3ae5(0xa8)]>0x1)return console[_0x2c3ae5(0x99)]('Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.'),0x1;_0x5ce017=_0x3c8f31[0x0];}else{if(!_0x90ee5e[0x0])return console['error'](_0x2c3ae5(0xc9)),console[_0x2c3ae5(0x99)]('Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>'),0x1;_0x5ce017=_0x90ee5e[0x0];}_0x423872[_0x2c3ae5(0xaf)]&&(console['error'](_0x2c3ae5(0x95)+_0x26bcf6),console[_0x2c3ae5(0x99)](_0x2c3ae5(0xc2)+_0x2d0b15),console[_0x2c3ae5(0x99)](_0x2c3ae5(0xb3)+_0x5ce017[_0x2c3ae5(0xb5)](0x0,0x64)+(_0x5ce017['length']>0x64?_0x2c3ae5(0x9b):'')));const _0x4721df=await withSpinner('Submitting\x20job...',()=>_0xcb3b7f['jobs']['submit'](_0x2d0b15,_0x5ce017,_0x26bcf6),{'verbose':_0x423872[_0x2c3ae5(0xaf)]}),_0x5ec2d7=_0x4721df['data'];return console[_0x2c3ae5(0x99)]('✔\x20Job\x20submitted'),console[_0x2c3ae5(0x99)](_0x2c3ae5(0xc8)+_0x5ec2d7[_0x2c3ae5(0xab)]),await handleSDKOutput([_0x5ec2d7],_0x423872),0x0;}catch(_0x363bdd){if(_0x363bdd instanceof SDKError)return console['error'](_0x2c3ae5(0xaa)+_0x363bdd[_0x2c3ae5(0xbe)]),_0x363bdd[_0x2c3ae5(0xcb)]&&console[_0x2c3ae5(0x99)](_0x2c3ae5(0xb8)+_0x363bdd['cause']),0x1;throw _0x363bdd;}}}function a17_0x4269(){const _0x560079=['status','754996YkZPzF','verbose','hive','limit','Usage:\x20job\x20kill\x20<job-id>','Query:\x20','getTime','substring','Listing\x20jobs...','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','\x20\x20Cause:\x20','type','jobs','6MIEftc','\x20jobs','show','message','Limit:\x20','110gqyPCN','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','Database:\x20','description','5079536hsbTga','data','Getting\x20job\x20details...','trino','\x20\x20Job\x20ID:\x20','Error:\x20Query\x20is\x20required','Error:\x20Job\x20ID\x20is\x20required','cause','Status\x20filter:\x20','user_name','Usage:\x20job\x20show\x20<job-id>','priority','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','jobType','job:result','✔\x20Found\x20','Submit\x20a\x20job','job:kill','\x20row','Show\x20job\x20details','✔\x20Retrieved\x20','information_schema','url','485968xbYWLd','result','execute','database','end_at','Job\x20type:\x20','round','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','created_at','error','List\x20jobs','...','file','query','Getting\x20job\x20results...','job:show','Kill\x20a\x20job','10446XfZVWS','start_at','1023372refVXY','Get\x20job\x20results','kill','name','2356569uiLZlm','length','486927qBQEmY','Error:\x20','job_id','Usage:\x20job\x20result\x20<job-id>'];a17_0x4269=function(){return _0x560079;};return a17_0x4269();}export class JobResultCommand extends BaseCommand{[a17_0x298d66(0xa6)]=a17_0x298d66(0x87);[a17_0x298d66(0xc3)]=a17_0x298d66(0xa4);async['execute'](_0x4714ba){const _0x5b9f53=a17_0x298d66,{options:_0x38b524,args:_0x48a55e,tdx:_0x5376e5}=_0x4714ba,_0x2bc1d8=_0x48a55e[0x0];if(!_0x2bc1d8)return console[_0x5b9f53(0x99)](_0x5b9f53(0xca)),console[_0x5b9f53(0x99)](_0x5b9f53(0xac)),0x1;try{const _0x6ff3f4=await withSpinner(_0x5b9f53(0x9e),()=>_0x5376e5[_0x5b9f53(0xba)][_0x5b9f53(0x91)](_0x2bc1d8),{'verbose':_0x38b524['verbose']}),_0x150a1f=_0x6ff3f4[_0x5b9f53(0xc5)];return console[_0x5b9f53(0x99)](_0x5b9f53(0x8d)+_0x150a1f[_0x5b9f53(0xa8)]+_0x5b9f53(0x8b)+(_0x150a1f[_0x5b9f53(0xa8)]!==0x1?'s':'')),await handleSDKOutput(_0x150a1f,_0x38b524),0x0;}catch(_0xe3ed93){if(_0xe3ed93 instanceof SDKError)return console[_0x5b9f53(0x99)](_0x5b9f53(0xaa)+_0xe3ed93[_0x5b9f53(0xbe)]),_0xe3ed93[_0x5b9f53(0xcb)]&&console[_0x5b9f53(0x99)](_0x5b9f53(0xb8)+_0xe3ed93[_0x5b9f53(0xcb)]),0x1;throw _0xe3ed93;}}}
1
+ const a17_0x16d09e=a17_0x584b;(function(_0xe42a7,_0x591b7d){const _0xe89836=a17_0x584b,_0x18c60b=_0xe42a7();while(!![]){try{const _0x4593aa=parseInt(_0xe89836(0x14f))/0x1+-parseInt(_0xe89836(0x161))/0x2+parseInt(_0xe89836(0x138))/0x3+-parseInt(_0xe89836(0x12f))/0x4*(parseInt(_0xe89836(0x14b))/0x5)+-parseInt(_0xe89836(0x167))/0x6*(parseInt(_0xe89836(0x139))/0x7)+parseInt(_0xe89836(0x15e))/0x8+-parseInt(_0xe89836(0x153))/0x9;if(_0x4593aa===_0x591b7d)break;else _0x18c60b['push'](_0x18c60b['shift']());}catch(_0x13d93d){_0x18c60b['push'](_0x18c60b['shift']());}}}(a17_0x3469,0x8f472));function a17_0x3469(){const _0xb17ea5=['10650goiBRv','result','query','Database:\x20','user_name','Job\x20type:\x20','name','Usage:\x20job\x20result\x20<job-id>','substring','type','job_id','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','map','trino','Listing\x20jobs...','round','url','list','4QNRpcJ','data','status','cause','\x27\x20to\x20verify\x20the\x20job\x20status','Getting\x20job\x20results...','created_at','Status\x20filter:\x20','verbose','2173245ktdYqR','4501aZXmlQ','✔\x20Job\x20submitted','Show\x20job\x20details','length','show','error','getTime','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','List\x20jobs','database','\x20jobs','description','\x20\x20Cause:\x20','start_at','Usage:\x20job\x20kill\x20<job-id>','kill','file','Kill\x20a\x20job','1029130qJIVEx','jobs','Error:\x20','jobType','1172907fcmlCw','Usage:\x20job\x20show\x20<job-id>','job:show','...','2707686BFzNmk','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','Getting\x20job\x20details...','debug','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','message','Query:\x20','\x20job','Error:\x20Job\x20ID\x20is\x20required','end_at','Get\x20job\x20results','8259784ZtAyai','Submitting\x20job...','execute','1389848LLgnYN','Error:\x20Query\x20is\x20required','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','hive','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','Submitting\x20kill\x20request...'];a17_0x3469=function(){return _0xb17ea5;};return a17_0x3469();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a17_0x16d09e(0x16d)]=a17_0x16d09e(0x14c);[a17_0x16d09e(0x144)]=a17_0x16d09e(0x141);async[a17_0x16d09e(0x160)](_0x5b5295){const _0x363720=a17_0x16d09e,{options:_0x388a70,tdx:_0x579a66}=_0x5b5295;try{const _0x4e751e=resolveLimit(_0x388a70['limit'],DEFAULT_DISPLAY_LIMIT),_0x1e8fa8=_0x388a70['status'];_0x388a70[_0x363720(0x137)]&&(console[_0x363720(0x13e)]('Limit:\x20'+_0x4e751e+_0x363720(0x143)),_0x1e8fa8&&console[_0x363720(0x13e)](_0x363720(0x136)+_0x1e8fa8));const _0x201aae=await withSpinner(_0x363720(0x12b),()=>_0x579a66[_0x363720(0x14c)][_0x363720(0x12e)]({'from':0x0,'to':_0x4e751e-0x1,'status':_0x1e8fa8}),{'verbose':_0x388a70[_0x363720(0x137)]}),_0x36d4a2=_0x201aae[_0x363720(0x130)];console[_0x363720(0x13e)]('✔\x20Found\x20'+_0x36d4a2[_0x363720(0x13c)]+_0x363720(0x15a)+(_0x36d4a2[_0x363720(0x13c)]!==0x1?'s':''));const _0x8c6ffe=_0x36d4a2[_0x363720(0x129)](_0x1f7e1b=>{const _0x544c85=_0x363720;let _0x89d4c6;if(_0x1f7e1b[_0x544c85(0x146)]&&_0x1f7e1b[_0x544c85(0x15c)]){const _0x391bf9=new Date(_0x1f7e1b[_0x544c85(0x146)])[_0x544c85(0x13f)](),_0x593a7e=new Date(_0x1f7e1b[_0x544c85(0x15c)])[_0x544c85(0x13f)]();_0x89d4c6=Math[_0x544c85(0x12c)]((_0x593a7e-_0x391bf9)/0x3e8);}return{'job_id':_0x1f7e1b[_0x544c85(0x127)],'type':_0x1f7e1b[_0x544c85(0x126)],'status':_0x1f7e1b[_0x544c85(0x131)],'user_name':_0x1f7e1b[_0x544c85(0x16b)],'duration_sec':_0x89d4c6,'created_at':_0x1f7e1b[_0x544c85(0x135)],'started_at':_0x1f7e1b[_0x544c85(0x146)],'end_at':_0x1f7e1b[_0x544c85(0x15c)]};});return await handleSDKOutput(_0x8c6ffe,_0x388a70),0x0;}catch(_0x49163c){if(_0x49163c instanceof SDKError)return console[_0x363720(0x13e)](_0x363720(0x14d)+_0x49163c[_0x363720(0x158)]),_0x49163c[_0x363720(0x132)]&&console[_0x363720(0x13e)](_0x363720(0x145)+_0x49163c[_0x363720(0x132)]),0x1;throw _0x49163c;}}}export class JobShowCommand extends BaseCommand{[a17_0x16d09e(0x16d)]=a17_0x16d09e(0x151);['description']=a17_0x16d09e(0x13b);async[a17_0x16d09e(0x160)](_0x2d7549){const _0x3e9215=a17_0x16d09e,{options:_0x4ece96,args:_0x424f15,tdx:_0x21205a}=_0x2d7549,_0xd70d2f=_0x424f15[0x0];if(!_0xd70d2f)return console[_0x3e9215(0x13e)](_0x3e9215(0x15b)),console[_0x3e9215(0x13e)](_0x3e9215(0x150)),0x1;try{const _0x1e4e88=await withSpinner(_0x3e9215(0x155),()=>_0x21205a[_0x3e9215(0x14c)][_0x3e9215(0x13d)](_0xd70d2f),{'verbose':_0x4ece96[_0x3e9215(0x137)]}),_0x4d4f1a=_0x1e4e88['data'];let _0x1062bb;if(_0x4d4f1a[_0x3e9215(0x146)]&&_0x4d4f1a[_0x3e9215(0x15c)]){const _0x5c5e81=new Date(_0x4d4f1a[_0x3e9215(0x146)])[_0x3e9215(0x13f)](),_0x3b0cd2=new Date(_0x4d4f1a[_0x3e9215(0x15c)])['getTime']();_0x1062bb=Math[_0x3e9215(0x12c)]((_0x3b0cd2-_0x5c5e81)/0x3e8);}const _0x4990fe={'job_id':_0x4d4f1a[_0x3e9215(0x127)],'type':_0x4d4f1a[_0x3e9215(0x126)],'status':_0x4d4f1a[_0x3e9215(0x131)],..._0x4d4f1a[_0x3e9215(0x16b)]&&{'user_name':_0x4d4f1a[_0x3e9215(0x16b)]},..._0x1062bb!==undefined&&{'duration_sec':_0x1062bb},..._0x4d4f1a[_0x3e9215(0x135)]&&{'created_at':_0x4d4f1a[_0x3e9215(0x135)]},..._0x4d4f1a[_0x3e9215(0x146)]&&{'started_at':_0x4d4f1a[_0x3e9215(0x146)]},..._0x4d4f1a[_0x3e9215(0x15c)]&&{'end_at':_0x4d4f1a[_0x3e9215(0x15c)]},..._0x4d4f1a[_0x3e9215(0x142)]&&{'database':_0x4d4f1a['database']},..._0x4d4f1a['priority']!==undefined&&{'priority':_0x4d4f1a['priority']},..._0x4d4f1a[_0x3e9215(0x12d)]&&{'url':_0x4d4f1a[_0x3e9215(0x12d)]},..._0x4d4f1a[_0x3e9215(0x169)]&&{'query':_0x4d4f1a[_0x3e9215(0x169)]},..._0x4d4f1a[_0x3e9215(0x156)]&&{'debug':_0x4d4f1a['debug']}};return await handleSingleObjectOutput(_0x4990fe,_0x4ece96),0x0;}catch(_0xe53853){if(_0xe53853 instanceof SDKError)return console['error'](_0x3e9215(0x14d)+_0xe53853['message']),_0xe53853[_0x3e9215(0x132)]&&console[_0x3e9215(0x13e)](_0x3e9215(0x145)+_0xe53853[_0x3e9215(0x132)]),0x1;throw _0xe53853;}}}export class JobKillCommand extends BaseCommand{[a17_0x16d09e(0x16d)]='job:kill';['description']=a17_0x16d09e(0x14a);async[a17_0x16d09e(0x160)](_0x224708){const _0x4c031d=a17_0x16d09e,{options:_0x59f35a,args:_0x3c4c36,tdx:_0x4b7637}=_0x224708,_0x97281a=_0x3c4c36[0x0];if(!_0x97281a)return console[_0x4c031d(0x13e)](_0x4c031d(0x15b)),console['error'](_0x4c031d(0x147)),0x1;try{if(!_0x59f35a['yes']){const _0x196e34=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x97281a+'?');if(!_0x196e34)return console[_0x4c031d(0x13e)]('Cancelled'),0x0;}return await withSpinner(_0x4c031d(0x166),()=>_0x4b7637[_0x4c031d(0x14c)][_0x4c031d(0x148)](_0x97281a),{'verbose':_0x59f35a[_0x4c031d(0x137)]}),console['error'](_0x4c031d(0x163)+_0x97281a),console[_0x4c031d(0x13e)](_0x4c031d(0x128)+_0x97281a+_0x4c031d(0x133)),0x0;}catch(_0x20f830){if(_0x20f830 instanceof SDKError)return console[_0x4c031d(0x13e)]('Error:\x20'+_0x20f830[_0x4c031d(0x158)]),_0x20f830[_0x4c031d(0x132)]&&console['error'](_0x4c031d(0x145)+_0x20f830['cause']),0x1;throw _0x20f830;}}}function a17_0x584b(_0x1f26b8,_0x19f9ea){_0x1f26b8=_0x1f26b8-0x124;const _0x34697c=a17_0x3469();let _0x584b21=_0x34697c[_0x1f26b8];return _0x584b21;}export class JobSubmitCommand extends BaseCommand{['name']='job:submit';[a17_0x16d09e(0x144)]='Submit\x20a\x20job';async[a17_0x16d09e(0x160)](_0x5ef919){const _0x4473bc=a17_0x16d09e,{options:_0x30416e,args:_0x24a2d3,tdx:_0x10150a}=_0x5ef919;try{const _0x152fbf=_0x30416e[_0x4473bc(0x14e)]||_0x4473bc(0x12a),_0x557573=_0x30416e[_0x4473bc(0x149)],_0x1b8964=_0x30416e['database']||'information_schema';if(_0x152fbf!==_0x4473bc(0x12a)&&_0x152fbf!==_0x4473bc(0x164))return console[_0x4473bc(0x13e)](_0x4473bc(0x140)),0x1;let _0x1ac813;if(_0x557573){if(_0x24a2d3[0x0])return console['error'](_0x4473bc(0x165)),0x1;const _0x2ca173=readSqlStatementsFromFile(_0x557573);if(_0x2ca173[_0x4473bc(0x13c)]===0x0)return console[_0x4473bc(0x13e)]('Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file'),0x1;if(_0x2ca173[_0x4473bc(0x13c)]>0x1)return console[_0x4473bc(0x13e)](_0x4473bc(0x154)),0x1;_0x1ac813=_0x2ca173[0x0];}else{if(!_0x24a2d3[0x0])return console[_0x4473bc(0x13e)](_0x4473bc(0x162)),console[_0x4473bc(0x13e)](_0x4473bc(0x157)),0x1;_0x1ac813=_0x24a2d3[0x0];}_0x30416e[_0x4473bc(0x137)]&&(console['error'](_0x4473bc(0x16c)+_0x152fbf),console[_0x4473bc(0x13e)](_0x4473bc(0x16a)+_0x1b8964),console[_0x4473bc(0x13e)](_0x4473bc(0x159)+_0x1ac813[_0x4473bc(0x125)](0x0,0x64)+(_0x1ac813[_0x4473bc(0x13c)]>0x64?_0x4473bc(0x152):'')));const _0x59326f=await withSpinner(_0x4473bc(0x15f),()=>_0x10150a[_0x4473bc(0x14c)]['submit'](_0x1b8964,_0x1ac813,_0x152fbf),{'verbose':_0x30416e[_0x4473bc(0x137)]}),_0x9c19d9=_0x59326f[_0x4473bc(0x130)];return console[_0x4473bc(0x13e)](_0x4473bc(0x13a)),console[_0x4473bc(0x13e)]('\x20\x20Job\x20ID:\x20'+_0x9c19d9[_0x4473bc(0x127)]),await handleSDKOutput([_0x9c19d9],_0x30416e),0x0;}catch(_0x29a166){if(_0x29a166 instanceof SDKError)return console[_0x4473bc(0x13e)](_0x4473bc(0x14d)+_0x29a166[_0x4473bc(0x158)]),_0x29a166[_0x4473bc(0x132)]&&console[_0x4473bc(0x13e)](_0x4473bc(0x145)+_0x29a166[_0x4473bc(0x132)]),0x1;throw _0x29a166;}}}export class JobResultCommand extends BaseCommand{['name']='job:result';['description']=a17_0x16d09e(0x15d);async['execute'](_0x2ab739){const _0x1f76cc=a17_0x16d09e,{options:_0x250eb9,args:_0x116e45,tdx:_0x9d3414}=_0x2ab739,_0x521689=_0x116e45[0x0];if(!_0x521689)return console[_0x1f76cc(0x13e)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x1f76cc(0x13e)](_0x1f76cc(0x124)),0x1;try{const _0x3fb7fe=await withSpinner(_0x1f76cc(0x134),()=>_0x9d3414['jobs'][_0x1f76cc(0x168)](_0x521689),{'verbose':_0x250eb9[_0x1f76cc(0x137)]}),_0x10a7f2=_0x3fb7fe[_0x1f76cc(0x130)];return console['error']('✔\x20Retrieved\x20'+_0x10a7f2['length']+'\x20row'+(_0x10a7f2['length']!==0x1?'s':'')),await handleSDKOutput(_0x10a7f2,_0x250eb9),0x0;}catch(_0x48b215){if(_0x48b215 instanceof SDKError)return console['error'](_0x1f76cc(0x14d)+_0x48b215[_0x1f76cc(0x158)]),_0x48b215[_0x1f76cc(0x132)]&&console[_0x1f76cc(0x13e)](_0x1f76cc(0x145)+_0x48b215[_0x1f76cc(0x132)]),0x1;throw _0x48b215;}}}
@@ -1 +1 @@
1
- const a18_0x5ceb5b=a18_0x49fe;(function(_0xbcafba,_0x7af78d){const _0x4fa3e2=a18_0x49fe,_0x213966=_0xbcafba();while(!![]){try{const _0x4dcc3b=parseInt(_0x4fa3e2(0x141))/0x1+-parseInt(_0x4fa3e2(0xc6))/0x2+-parseInt(_0x4fa3e2(0x116))/0x3+-parseInt(_0x4fa3e2(0xfd))/0x4*(-parseInt(_0x4fa3e2(0xe8))/0x5)+parseInt(_0x4fa3e2(0x17c))/0x6+-parseInt(_0x4fa3e2(0xbc))/0x7*(-parseInt(_0x4fa3e2(0xbb))/0x8)+-parseInt(_0x4fa3e2(0xc5))/0x9;if(_0x4dcc3b===_0x7af78d)break;else _0x213966['push'](_0x213966['shift']());}catch(_0x37d6e6){_0x213966['push'](_0x213966['shift']());}}}(a18_0x3f33,0x92942));import a18_0x2db01d from'chalk';import a18_0xeb7b53 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';function a18_0x49fe(_0x1b26e6,_0x560318){_0x1b26e6=_0x1b26e6-0xb4;const _0x3f3301=a18_0x3f33();let _0x49fe9a=_0x3f3301[_0x1b26e6];return _0x49fe9a;}import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x3bf8df){const _0x4f902e=a18_0x49fe;switch(_0x3bf8df){case _0x4f902e(0xdd):return a18_0x2db01d[_0x4f902e(0x184)](_0x4f902e(0x11c));case _0x4f902e(0xff):return a18_0x2db01d['dim']('(draft)');case'paused':return a18_0x2db01d[_0x4f902e(0x110)](_0x4f902e(0xfb));case _0x4f902e(0x11a):return a18_0x2db01d['blue'](_0x4f902e(0xd1));case _0x4f902e(0x14b):return a18_0x2db01d['dim'](_0x4f902e(0xdb));default:return'('+_0x3bf8df+')';}}function formatJourneyItem(_0x4d0b37,_0x1bc3d2='',_0xdc4558){const _0x3ba674=a18_0x49fe,_0x17d6e9=formatJourneyState(_0x4d0b37[_0x3ba674(0xde)]),_0x378448=_0xdc4558?hyperlink(_0x4d0b37[_0x3ba674(0xf4)],_0xdc4558):_0x4d0b37[_0x3ba674(0xf4)];return _0x1bc3d2+_0x3ba674(0x108)+_0x378448+'\x20'+_0x17d6e9;}function escapeRegex(_0x5b7e2c){const _0x5e955f=a18_0x49fe;return _0x5b7e2c[_0x5e955f(0x151)](/[.*+?^${}()|[\]\\]/g,_0x5e955f(0xe6));}function globToRegex(_0x24d69f){const _0x2f342e=a18_0x49fe,_0x48422f=_0x24d69f[_0x2f342e(0x182)]('*')[_0x2f342e(0x14a)](escapeRegex);return new RegExp(_0x48422f[_0x2f342e(0xe7)]('.*'),'i');}function buildRuleToNameMapping(_0x122349){const _0x41ffc0=a18_0x49fe,_0x18bad8=new Map();if(_0x122349['segments'])for(const [_0x54d5b8,_0x4356cd]of Object[_0x41ffc0(0x131)](_0x122349[_0x41ffc0(0xe5)])){if(_0x4356cd[_0x41ffc0(0xc2)]){const _0x5459f7=serializeRule(_0x4356cd[_0x41ffc0(0xc2)]),_0x15ba53=_0x18bad8[_0x41ffc0(0x13d)](_0x5459f7);_0x15ba53?_0x15ba53[_0x41ffc0(0x164)](_0x54d5b8):_0x18bad8[_0x41ffc0(0xc1)](_0x5459f7,[_0x54d5b8]);}}return _0x18bad8;}async function resolveJourneyTarget(_0x5e40ef,_0xa39607,_0x1c9afb){const _0x1c05d1=a18_0x49fe;if(isYamlFilePath(_0x5e40ef))try{const _0x379ccf=await resolveYamlFilePath(_0x5e40ef);return _0x1c9afb&&(console['error'](_0x1c05d1(0x109)+_0x5e40ef),console['error']('\x20\x20Parent\x20segment:\x20'+_0x379ccf[_0x1c05d1(0xd5)]),console[_0x1c05d1(0x145)]('\x20\x20Name:\x20'+_0x379ccf['segmentName']),console['error'](_0x1c05d1(0x112)+(_0x379ccf[_0x1c05d1(0x117)]||_0x1c05d1(0xb7)))),{'journeyName':_0x379ccf[_0x1c05d1(0x187)],'parentSegment':_0x379ccf[_0x1c05d1(0xd5)],'resolved':_0x379ccf};}catch(_0x3a0297){throw new SDKError(ErrorCode[_0x1c05d1(0xbf)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x3a0297[_0x1c05d1(0xeb)]);}if(!_0xa39607)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1c05d1(0x130));return{'journeyName':_0x5e40ef,'parentSegment':_0xa39607};}export class JourneyListCommand extends BaseCommand{[a18_0x5ceb5b(0x174)]=a18_0x5ceb5b(0x15f);[a18_0x5ceb5b(0x189)]=a18_0x5ceb5b(0x167);async[a18_0x5ceb5b(0xf0)](_0x93ef40){const _0x4d6640=a18_0x5ceb5b,{options:_0x258b0f,args:_0x4d91c2,tdx:_0x3fa01}=_0x93ef40,_0xca9233=_0x4d91c2[0x0],_0x490559=_0x258b0f[_0x4d6640(0xd5)];if(!_0x490559)return console[_0x4d6640(0x145)]('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x4d6640(0x145)]('Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22'),0x1;const _0x1911ca=await withSpinner(_0x4d6640(0x154),()=>_0x3fa01[_0x4d6640(0x156)][_0x4d6640(0xd6)](_0x490559),{'verbose':_0x258b0f[_0x4d6640(0x173)]}),_0x1dbc07=_0x1911ca[_0x4d6640(0x10a)];_0x258b0f[_0x4d6640(0x173)]&&(console[_0x4d6640(0x145)]('Parent\x20segment:\x20'+_0x490559+_0x4d6640(0xf1)+_0x1dbc07+')'),_0xca9233&&console['error'](_0x4d6640(0xf3)+_0xca9233));const _0x324f7b=await withSpinner(_0x4d6640(0x13a),()=>_0x3fa01[_0x4d6640(0x156)][_0x4d6640(0x180)](_0x1dbc07),{'verbose':_0x258b0f['verbose']}),_0x666820=_0x324f7b[_0x4d6640(0x10a)],_0x277918=_0x666820[_0x4d6640(0x134)],_0x2ffa7f=await withSpinner(_0x4d6640(0x13e),()=>_0x3fa01[_0x4d6640(0x177)][_0x4d6640(0x135)](_0x1dbc07,_0x277918),{'verbose':_0x258b0f['verbose']});let _0x20152f=_0x2ffa7f[_0x4d6640(0x10a)][_0x4d6640(0xcf)];const _0x3fd039=_0x2ffa7f['data']['folders'],_0x11d559=new Map();for(const _0x408956 of _0x3fd039){_0x11d559[_0x4d6640(0xc1)](_0x408956['id'],_0x408956['name']);}if(_0xca9233){const _0x246b3f=globToRegex(_0xca9233);_0x20152f=_0x20152f[_0x4d6640(0x144)](_0x158d1f=>_0x246b3f['test'](_0x158d1f[_0x4d6640(0xf4)]));}console[_0x4d6640(0x145)](_0x4d6640(0xe4)+_0x20152f[_0x4d6640(0x175)]+_0x4d6640(0xb8)+(_0x20152f[_0x4d6640(0x175)]!==0x1?'s':''));const _0x39fc4b=_0x258010=>{const _0x17014e=_0x4d6640;return getConsoleNextUrl(_0x258b0f[_0x17014e(0x14f)],_0x17014e(0x128)+_0x1dbc07+_0x17014e(0x163)+_0x258010+_0x17014e(0xcd));};if(_0x258b0f[_0x4d6640(0x102)]==='table')await handleSDKOutput(_0x20152f,_0x258b0f);else{if(_0x258b0f[_0x4d6640(0x102)]===_0x4d6640(0x18c)){const _0x51d882=_0x20152f['map'](_0x3fd90a=>({..._0x3fd90a,'url':_0x39fc4b(_0x3fd90a['id'])}));await handleSDKOutput(_0x51d882,_0x258b0f);}else{console[_0x4d6640(0xef)]('['+_0x490559+']');const _0x36314e=new Map(),_0xa7b47f=[];for(const _0xbf7791 of _0x20152f){if(!_0xbf7791[_0x4d6640(0x122)]||_0xbf7791[_0x4d6640(0x122)]===_0x277918)_0xa7b47f[_0x4d6640(0x164)](_0xbf7791);else{const _0x56a6fa=_0x36314e[_0x4d6640(0x13d)](_0xbf7791[_0x4d6640(0x122)])||[];_0x56a6fa[_0x4d6640(0x164)](_0xbf7791),_0x36314e[_0x4d6640(0xc1)](_0xbf7791['folderId'],_0x56a6fa);}}const _0x4ff0c5=(_0x14ece1,_0xc2d5d7)=>_0x14ece1[_0x4d6640(0xf4)][_0x4d6640(0x176)](_0xc2d5d7[_0x4d6640(0xf4)],undefined,{'sensitivity':_0x4d6640(0x13b)});_0xa7b47f[_0x4d6640(0x118)](_0x4ff0c5);for(const _0x3f9a2b of _0xa7b47f){console[_0x4d6640(0xef)](formatJourneyItem(_0x3f9a2b,'',_0x39fc4b(_0x3f9a2b['id'])));}const _0x18e24e=[..._0x36314e[_0x4d6640(0x131)]()][_0x4d6640(0x118)]((_0xc6a953,_0x171bf3)=>{const _0x548f86=_0x4d6640,_0xedfb0d=_0x11d559[_0x548f86(0x13d)](_0xc6a953[0x0])||_0xc6a953[0x0],_0x58bf12=_0x11d559[_0x548f86(0x13d)](_0x171bf3[0x0])||_0x171bf3[0x0];return _0xedfb0d[_0x548f86(0x176)](_0x58bf12,undefined,{'sensitivity':_0x548f86(0x13b)});});for(const [_0x138256,_0x3e9665]of _0x18e24e){const _0x346830=_0x11d559[_0x4d6640(0x13d)](_0x138256)||_0x138256;console['log']('📁\x20'+_0x346830),_0x3e9665['sort'](_0x4ff0c5);for(const _0x3a513f of _0x3e9665){console['log'](formatJourneyItem(_0x3a513f,'\x20\x20',_0x39fc4b(_0x3a513f['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{['name']=a18_0x5ceb5b(0x133);[a18_0x5ceb5b(0x189)]=a18_0x5ceb5b(0xea);async[a18_0x5ceb5b(0xf0)](_0x4aeccb){const _0xbc3535=a18_0x5ceb5b,{options:_0x2b52e0,args:_0x3410e2,tdx:_0x15d550}=_0x4aeccb,_0x259c1b=_0x3410e2[0x0];if(!_0x259c1b)return console[_0xbc3535(0x145)](_0xbc3535(0x150)),console[_0xbc3535(0x145)](_0xbc3535(0x16d)),console['error'](_0xbc3535(0x12a)),console[_0xbc3535(0x145)]('\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser'),0x1;_0x2b52e0[_0xbc3535(0x173)]&&console[_0xbc3535(0x145)](_0xbc3535(0x11e)+_0x259c1b);const _0x1c3808=await resolveJourneyTarget(_0x259c1b,_0x2b52e0[_0xbc3535(0xd5)],_0x2b52e0['verbose']),_0x5dfe88=await withSpinner(_0xbc3535(0x154),()=>_0x15d550[_0xbc3535(0x156)][_0xbc3535(0xd6)](_0x1c3808['parentSegment']),{'verbose':_0x2b52e0[_0xbc3535(0x173)]}),_0x54f6a1=_0x5dfe88['data'],_0x36dfdc=await withSpinner(_0xbc3535(0x105),()=>_0x15d550['journey'][_0xbc3535(0x12d)](_0x54f6a1,_0x1c3808['journeyName']),{'verbose':_0x2b52e0[_0xbc3535(0x173)]}),_0x333060=_0x36dfdc[_0xbc3535(0x10a)];if(_0x2b52e0[_0xbc3535(0x111)]){const _0x3ca45e=getConsoleNextUrl(_0x2b52e0[_0xbc3535(0x14f)],_0xbc3535(0x128)+_0x54f6a1+_0xbc3535(0x163)+_0x333060+_0xbc3535(0xdc));return console[_0xbc3535(0x145)](a18_0x2db01d[_0xbc3535(0x184)]('✔')+_0xbc3535(0x17d)+a18_0x2db01d[_0xbc3535(0x10d)](_0x3ca45e)),openBrowser(_0x3ca45e),0x0;}const _0x24153a=await withSpinner(_0xbc3535(0x161),()=>_0x15d550[_0xbc3535(0x177)][_0xbc3535(0x17b)](_0x333060),{'verbose':_0x2b52e0[_0xbc3535(0x173)]}),_0x3a6c7a=_0x24153a[_0xbc3535(0x10a)],_0x3f88aa=_0x2b52e0[_0xbc3535(0x18a)];let _0x4ac6c0;if(_0x3f88aa)try{const _0x179233=await withSpinner(_0xbc3535(0xbd),()=>_0x15d550[_0xbc3535(0x177)][_0xbc3535(0x140)](_0x333060),{'verbose':_0x2b52e0[_0xbc3535(0x173)]});_0x4ac6c0=_0x179233['data'];}catch{_0x2b52e0[_0xbc3535(0x173)]&&console[_0xbc3535(0x145)](_0xbc3535(0x10e));}const _0x4936b9=getConsoleNextUrl(_0x2b52e0[_0xbc3535(0x14f)],'/app/ps/'+_0x54f6a1+_0xbc3535(0x163)+_0x333060+_0xbc3535(0xdc)),_0x3ba4f7={'id':_0x3a6c7a['id'],'name':_0x3a6c7a[_0xbc3535(0xcc)][_0xbc3535(0x174)],'description':_0x3a6c7a['attributes'][_0xbc3535(0x189)],'state':_0x3a6c7a[_0xbc3535(0xcc)][_0xbc3535(0xde)],'paused':_0x3a6c7a['attributes'][_0xbc3535(0xb4)],'reentry_mode':_0x3a6c7a[_0xbc3535(0xcc)][_0xbc3535(0x16a)],'stages':_0x3a6c7a[_0xbc3535(0xcc)][_0xbc3535(0x136)]?.[_0xbc3535(0x175)]||0x0,..._0x3a6c7a[_0xbc3535(0xcc)]['goal']&&{'goal':_0x3a6c7a[_0xbc3535(0xcc)][_0xbc3535(0x107)]['name']},..._0x4ac6c0&&{'statistics':{'total_entered':_0x4ac6c0[_0xbc3535(0x17f)],'goal_achieved':_0x4ac6c0[_0xbc3535(0x15d)],'goal_rate':_0x4ac6c0[_0xbc3535(0x12c)],'stages':_0x4ac6c0[_0xbc3535(0x17e)]}},'url':_0x4936b9};return await handleSingleObjectOutput(_0x3ba4f7,_0x2b52e0),0x0;}}function a18_0x3f33(){const _0x104a48=['attributes','/j/da','add','journeys','Pausing\x20journey...','(completed)','repeat','find','connection','parentSegment','resolveParentId','stageName','Cancelled','resolveSegment','journeyBundleId','(archived)','/j/da/je','launched','state','\x20\x20-\x20','Target\x20directory:\x20','Usage:\x20journey\x20stats\x20<name-or-path>','Parent\x20segment:\x20','type','✔\x20Found\x20','segments','\x5c$&','join','1449215ZibyZt','Fetching\x20','Show\x20journey\x20details','message','entered','pause','no_parent','log','execute','\x20(ID:\x20','population','Pattern:\x20','journeyBundleName','\x20unchanged\x20files','Error:\x20Journey\x20\x27','yes','Journey\x20name:\x20','.yml','Pause\x20a\x20running\x20journey','(paused)','Warning:\x20Stage\x20\x22','4rpHXME','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','draft','segmentPushCommand','session','format','journeyName','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','Resolving\x20journey...','journeyId','goal','🗺️\x20','Resolved\x20YAML\x20file:\x20','data','No\x20journeys\x20found','journey:push','cyan','\x20\x20Statistics\x20not\x20available','\x20files?','yellow','web','\x20\x20Folder\x20path:\x20','\x20\x20Consolidating\x20duplicate\x20segment:\x20','args','size','2430855gGYLES','folderPath','sort','red','completed','✔\x20All\x20files\x20are\x20up\x20to\x20date','(running)','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','Input:\x20','Found\x20','then','buildIdToNameMap','folderId','isNew','Usage:\x20journey\x20resume\x20<name-or-path>','No\x20statistics\x20available\x20for\x20journey:\x20','Target\x20file:\x20','✔\x20Pulled\x20','/app/ps/','has','Options:','root\x20folder','goalRate','resolveJourneyId','\x20journey\x20files\x20to\x20','buildIdToEmailMap','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','entries','stringify','journey:view','rootFolderId','listJourneysWithFolders','journeyStages','diff','Export\x20journey(s)\x20as\x20YAML\x20files','\x27\x20not\x20found\x20in\x20','Fetching\x20parent\x20segment...','base','setPhase','get','Listing\x20journeys...','Listing\x20folders...','getStatistics','1132935YVXmXg','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','versionNumber','filter','error','cwd','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','parentName','Fetching\x20users\x20for\x20email\x20resolution...','map','archived','\x22\x20paused','utf-8','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','site','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','replace','filePath','values','Resolving\x20parent\x20segment...','hasChanges','segment','Resume\x20a\x20paused\x20journey','conversionRate','Warning:\x20Could\x20not\x20resolve\x20segment\x20','\x20->\x20','\x20=\x20','resourceName','totalGoalAchieved','\x20journeys','journey:list','journey:pull','Getting\x20journey\x20details...','resume','/e/','push','helpText','options','List\x20journeys\x20in\x20current\x20context','file','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','reentryMode','activationParams','\x20versions)','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','getSegment','exited','\x20changed\x20files','Warning:\x20Could\x20not\x20resolve\x20activation\x20','activation_','verbose','name','length','localeCompare','journey','Error:\x20','\x20(rule\x20match)','parent_segment','getJourney','1819986xjrBiC','\x20Opening\x20','stages','totalEntered','getParentFull','targetDir','split','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','green','content','Write\x20','segmentName','✔\x20Context\x20set:\x20','description','includeStats','...','json','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','paused','dim','user','(root)','\x20journey','\x0aPull\x20summary:','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','24ouzjOP','338401JKCpSJ','Getting\x20journey\x20statistics...','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','INVALID_ARGUMENT','relativePath','set','rule','toLowerCase','journey:resume','2716488AqutPd','317270WzNETf','Folder\x20path:\x20','relative','\x20new\x20files','absolutePath','getActivation'];a18_0x3f33=function(){return _0x104a48;};return a18_0x3f33();}export class JourneyStatsCommand extends BaseCommand{[a18_0x5ceb5b(0x174)]='journey:stats';[a18_0x5ceb5b(0x189)]='Show\x20journey\x20statistics';async['execute'](_0x41292e){const _0x1b4f9c=a18_0x5ceb5b,{options:_0x1e7969,args:_0x2525a1,tdx:_0x33a6f0}=_0x41292e,_0x103721=_0x2525a1[0x0];if(!_0x103721)return console[_0x1b4f9c(0x145)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x1b4f9c(0x145)](_0x1b4f9c(0xe1)),0x1;_0x1e7969[_0x1b4f9c(0x173)]&&console[_0x1b4f9c(0x145)](_0x1b4f9c(0x11e)+_0x103721);const _0xd7d206=await resolveJourneyTarget(_0x103721,_0x1e7969['parentSegment'],_0x1e7969['verbose']),_0x334dcd=await withSpinner(_0x1b4f9c(0x154),()=>_0x33a6f0[_0x1b4f9c(0x156)][_0x1b4f9c(0xd6)](_0xd7d206[_0x1b4f9c(0xd5)]),{'verbose':_0x1e7969[_0x1b4f9c(0x173)]}),_0x1a7a2d=_0x334dcd[_0x1b4f9c(0x10a)],_0x50c6b3=await withSpinner(_0x1b4f9c(0x105),()=>_0x33a6f0['journey'][_0x1b4f9c(0x12d)](_0x1a7a2d,_0xd7d206[_0x1b4f9c(0x103)]),{'verbose':_0x1e7969[_0x1b4f9c(0x173)]}),_0x4b042d=_0x50c6b3[_0x1b4f9c(0x10a)],_0x910a6a=await withSpinner(_0x1b4f9c(0xbd),()=>_0x33a6f0[_0x1b4f9c(0x177)][_0x1b4f9c(0x140)](_0x4b042d),{'verbose':_0x1e7969[_0x1b4f9c(0x173)]}),_0x4a0514=_0x910a6a[_0x1b4f9c(0x10a)];if(!_0x4a0514||_0x4a0514[_0x1b4f9c(0x106)]===null)return console['error'](_0x1b4f9c(0x125)+_0xd7d206[_0x1b4f9c(0x103)]),console[_0x1b4f9c(0x145)](_0x1b4f9c(0xba)),0x0;const _0x4c1e3e={'journey_id':_0x4a0514['journeyId'],'total_entered':_0x4a0514['totalEntered'],'goal_achieved':_0x4a0514[_0x1b4f9c(0x15d)],'goal_rate':_0x4a0514[_0x1b4f9c(0x12c)],'stages':_0x4a0514[_0x1b4f9c(0x17e)]?.['map'](_0x5ca95b=>({'name':_0x5ca95b[_0x1b4f9c(0xd7)],'population':_0x5ca95b['population'],'entered':_0x5ca95b[_0x1b4f9c(0xec)],'exited':_0x5ca95b[_0x1b4f9c(0x16f)],'conversion_rate':_0x5ca95b[_0x1b4f9c(0x158)]}))},_0x39fdb8=_0x1e7969['stage'];if(_0x39fdb8&&_0x4a0514[_0x1b4f9c(0x17e)]){const _0x1c4746=_0x4a0514['stages'][_0x1b4f9c(0xd3)](_0x5c16bd=>_0x5c16bd[_0x1b4f9c(0xd7)][_0x1b4f9c(0xc3)]()===_0x39fdb8[_0x1b4f9c(0xc3)]());if(_0x1c4746)return await handleSingleObjectOutput({'stage_name':_0x1c4746[_0x1b4f9c(0xd7)],'population':_0x1c4746[_0x1b4f9c(0xf2)],'entered':_0x1c4746['entered'],'exited':_0x1c4746[_0x1b4f9c(0x16f)],'conversion_rate':_0x1c4746[_0x1b4f9c(0x158)]},_0x1e7969),0x0;console[_0x1b4f9c(0x145)](_0x1b4f9c(0xfc)+_0x39fdb8+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0x4c1e3e,_0x1e7969),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0x5ceb5b(0x174)]='journey:pause';['description']=a18_0x5ceb5b(0xfa);async[a18_0x5ceb5b(0xf0)](_0xe7ae8e){const _0x22a2c8=a18_0x5ceb5b,{options:_0x4609d0,args:_0x529b05,tdx:_0x2771d8}=_0xe7ae8e,_0x49841d=_0x529b05[0x0];if(!_0x49841d)return console[_0x22a2c8(0x145)](_0x22a2c8(0x150)),console[_0x22a2c8(0x145)]('Usage:\x20journey\x20pause\x20<name-or-path>'),0x1;_0x4609d0[_0x22a2c8(0x173)]&&console[_0x22a2c8(0x145)](_0x22a2c8(0x11e)+_0x49841d);const _0x3f4360=await resolveJourneyTarget(_0x49841d,_0x4609d0[_0x22a2c8(0xd5)],_0x4609d0['verbose']),_0x2dde3b=await withSpinner(_0x22a2c8(0x154),()=>_0x2771d8['segment']['resolveParentId'](_0x3f4360['parentSegment']),{'verbose':_0x4609d0[_0x22a2c8(0x173)]}),_0x8ccaea=_0x2dde3b[_0x22a2c8(0x10a)],_0x17a913=await withSpinner(_0x22a2c8(0x105),()=>_0x2771d8['journey'][_0x22a2c8(0x12d)](_0x8ccaea,_0x3f4360[_0x22a2c8(0x103)]),{'verbose':_0x4609d0[_0x22a2c8(0x173)]}),_0x2f976f=_0x17a913[_0x22a2c8(0x10a)];if(!_0x4609d0[_0x22a2c8(0xf7)]){const _0x4b9498=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0x3f4360[_0x22a2c8(0x103)]+'\x22?');if(!_0x4b9498)return console[_0x22a2c8(0x145)]('Cancelled'),0x0;}const _0x21e17d=await withSpinner(_0x22a2c8(0xd0),()=>_0x2771d8[_0x22a2c8(0x177)][_0x22a2c8(0xed)](_0x2f976f),{'verbose':_0x4609d0[_0x22a2c8(0x173)]}),_0x385df6=_0x21e17d[_0x22a2c8(0x10a)];return console[_0x22a2c8(0x145)]('✔\x20Journey\x20\x22'+_0x385df6[_0x22a2c8(0xcc)][_0x22a2c8(0x174)]+_0x22a2c8(0x14c)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x5ceb5b(0x174)]=a18_0x5ceb5b(0xc4);['description']=a18_0x5ceb5b(0x157);async[a18_0x5ceb5b(0xf0)](_0x413124){const _0x521fca=a18_0x5ceb5b,{options:_0x5a8c7d,args:_0x1bcb59,tdx:_0xa40c67}=_0x413124,_0x4efa52=_0x1bcb59[0x0];if(!_0x4efa52)return console[_0x521fca(0x145)](_0x521fca(0x150)),console[_0x521fca(0x145)](_0x521fca(0x124)),0x1;_0x5a8c7d[_0x521fca(0x173)]&&console[_0x521fca(0x145)](_0x521fca(0x11e)+_0x4efa52);const _0x2abc4f=await resolveJourneyTarget(_0x4efa52,_0x5a8c7d[_0x521fca(0xd5)],_0x5a8c7d['verbose']),_0x1f455b=await withSpinner(_0x521fca(0x154),()=>_0xa40c67[_0x521fca(0x156)][_0x521fca(0xd6)](_0x2abc4f[_0x521fca(0xd5)]),{'verbose':_0x5a8c7d['verbose']}),_0x1d61dd=_0x1f455b[_0x521fca(0x10a)],_0x28cded=await withSpinner(_0x521fca(0x105),()=>_0xa40c67[_0x521fca(0x177)][_0x521fca(0x12d)](_0x1d61dd,_0x2abc4f[_0x521fca(0x103)]),{'verbose':_0x5a8c7d[_0x521fca(0x173)]}),_0x414d27=_0x28cded[_0x521fca(0x10a)];if(!_0x5a8c7d['yes']){const _0x35a12f=await confirm(_0x521fca(0xbe)+_0x2abc4f['journeyName']+'\x22?');if(!_0x35a12f)return console[_0x521fca(0x145)](_0x521fca(0xd8)),0x0;}const _0x24a254=await withSpinner('Resuming\x20journey...',()=>_0xa40c67[_0x521fca(0x177)][_0x521fca(0x162)](_0x414d27),{'verbose':_0x5a8c7d[_0x521fca(0x173)]}),_0x1d3069=_0x24a254['data'];return console[_0x521fca(0x145)]('✔\x20Journey\x20\x22'+_0x1d3069[_0x521fca(0xcc)][_0x521fca(0x174)]+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']=a18_0x5ceb5b(0x160);[a18_0x5ceb5b(0x189)]=a18_0x5ceb5b(0x138);async['execute'](_0x3c6d60){const _0x4218f1=a18_0x5ceb5b,{options:_0x18ba6c,args:_0x8e6f3a,tdx:_0x234979}=_0x3c6d60,_0x105155=_0x18ba6c,_0x119000=_0x8e6f3a[0x0],_0x2eb6dd=_0x119000&&isYamlFilePath(_0x119000),_0x534972=await resolveTarget({'arg':_0x2eb6dd?_0x119000:undefined,'contextParent':_0x18ba6c[_0x4218f1(0xd5)],'cwd':process[_0x4218f1(0x146)]()});if(!isSuccessfulResolution(_0x534972))return _0x534972['errorCode']===_0x4218f1(0xee)?(console['error'](a18_0x2db01d[_0x4218f1(0x110)](_0x4218f1(0x169))),console[_0x4218f1(0x145)](_0x4218f1(0x147)),console[_0x4218f1(0x145)](_0x4218f1(0x14e)),console[_0x4218f1(0x145)](_0x4218f1(0x142)),console[_0x4218f1(0x145)](_0x4218f1(0xfe))):(console['error'](a18_0x2db01d[_0x4218f1(0x119)](_0x4218f1(0x178)+_0x534972[_0x4218f1(0xeb)]+'\x0a')),_0x534972['helpText']&&console[_0x4218f1(0x145)](a18_0x2db01d[_0x4218f1(0x10d)](_0x534972[_0x4218f1(0x165)]))),0x1;let _0x176883=_0x2eb6dd?undefined:_0x119000,_0x955ec1,_0x28819f;_0x534972[_0x4218f1(0xe3)]==='file'&&(_0x176883=_0x534972[_0x4218f1(0x15c)],_0x955ec1=_0x534972[_0x4218f1(0x152)],_0x28819f=_0x534972[_0x4218f1(0x117)]);const _0xe87cbf=_0x534972[_0x4218f1(0x148)],_0x5380be=_0x534972[_0x4218f1(0x181)];_0x105155[_0x4218f1(0x173)]&&(console[_0x4218f1(0x145)](_0x4218f1(0xe2)+_0xe87cbf),console[_0x4218f1(0x145)](_0x4218f1(0xe0)+_0x5380be),_0x176883&&console['error'](_0x4218f1(0xf8)+_0x176883),_0x955ec1&&console['error'](_0x4218f1(0x126)+_0x955ec1),_0x28819f&&console[_0x4218f1(0x145)](_0x4218f1(0xc7)+_0x28819f));const _0x30598b=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x234979[_0x4218f1(0x156)]['resolveParentId'](_0xe87cbf),{'verbose':_0x18ba6c[_0x4218f1(0x173)]}),_0x1bd2b5=_0x30598b[_0x4218f1(0x10a)],[_0x59f034,_0x51028c]=await Promise['all']([withSpinner(_0x4218f1(0x13e),()=>_0x234979['journey']['listJourneysFromParentSegment'](_0x1bd2b5,undefined,{'includeAllVersions':!![]}),{'verbose':_0x18ba6c[_0x4218f1(0x173)]}),withSpinner(_0x4218f1(0x13f),()=>_0x234979['segment']['listFolders'](_0x1bd2b5),{'verbose':_0x18ba6c[_0x4218f1(0x173)]})]);let _0x166956=_0x59f034[_0x4218f1(0x10a)];const _0x4a6cd7=_0x51028c[_0x4218f1(0x10a)],_0x562164=buildFolderIdToPathMap(_0x4a6cd7);if(_0x176883){const _0x7b7a24=_0x166956[_0x4218f1(0x144)](_0x141099=>_0x141099[_0x4218f1(0xf4)][_0x4218f1(0xc3)]()===_0x176883[_0x4218f1(0xc3)]());if(_0x7b7a24[_0x4218f1(0x175)]===0x0)return console['error']('Error:\x20Journey\x20not\x20found:\x20'+_0x176883),console[_0x4218f1(0x145)](_0x4218f1(0x18d)),0x1;_0x166956=_0x7b7a24;}if(_0x28819f!==undefined){const _0x58f916=_0x166956[_0x4218f1(0x144)](_0x3c3f20=>{const _0x2074cd=_0x3c3f20['folderId']?_0x562164['get'](_0x3c3f20['folderId'])||'':'';return _0x2074cd===_0x28819f;});if(_0x58f916['length']===0x0&&_0x166956[_0x4218f1(0x175)]>0x0){console[_0x4218f1(0x145)](_0x4218f1(0xf6)+_0x176883+_0x4218f1(0x139)+(_0x28819f||_0x4218f1(0x12b))),console['error'](_0x4218f1(0x11d));for(const _0xefadef of _0x166956){const _0x70dea2=_0xefadef['folderId']?_0x562164[_0x4218f1(0x13d)](_0xefadef[_0x4218f1(0x122)])||'':'';console[_0x4218f1(0x145)](_0x4218f1(0xdf)+(_0x70dea2||_0x4218f1(0xb7))+'/'+_0xefadef[_0x4218f1(0xf4)]);}return 0x1;}_0x166956=_0x58f916;}if(_0x166956[_0x4218f1(0x175)]===0x0)return console[_0x4218f1(0x145)](_0x4218f1(0x10b)),0x0;const _0x29ac3e=new Map();for(const _0x23d69e of _0x166956){const _0x3f7dfe=_0x23d69e[_0x4218f1(0xda)];!_0x29ac3e['has'](_0x3f7dfe)&&_0x29ac3e[_0x4218f1(0xc1)](_0x3f7dfe,[]),_0x29ac3e[_0x4218f1(0x13d)](_0x3f7dfe)['push'](_0x23d69e);}for(const _0x25aebd of _0x29ac3e[_0x4218f1(0x153)]()){_0x25aebd[_0x4218f1(0x118)]((_0x49436d,_0x250488)=>(_0x49436d['versionNumber']||0x0)-(_0x250488['versionNumber']||0x0));}const _0x4ddef4=[],[_0x86b3e,_0x1649db]=await Promise['all']([withSpinner(_0x4218f1(0x149),()=>_0x234979[_0x4218f1(0xb6)][_0x4218f1(0x12f)](),{'verbose':_0x18ba6c[_0x4218f1(0x173)]})[_0x4218f1(0x120)](_0x149419=>_0x149419['data']),withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',()=>_0x234979[_0x4218f1(0xd4)][_0x4218f1(0x121)](),{'verbose':_0x18ba6c[_0x4218f1(0x173)]})['then'](_0x348c05=>_0x348c05[_0x4218f1(0x10a)])]);for(const _0x36463b of _0x29ac3e[_0x4218f1(0x153)]()){const _0xda7386=_0x36463b[0x0]['journeyBundleName'],_0x4cc8bc=_0x36463b[0x0][_0x4218f1(0x122)],_0x25ea03=_0x4cc8bc?_0x562164['get'](_0x4cc8bc)||'':'',_0x593338=_0x25ea03?a18_0xeb7b53[_0x4218f1(0xe7)](_0x5380be,_0x25ea03):_0x5380be,_0xe5546f=_0x955ec1||a18_0xeb7b53[_0x4218f1(0xe7)](_0x593338,sanitizeFileName(_0xda7386)+_0x4218f1(0xf9));let _0x41bed3,_0x2ce976;if(existsSync(_0xe5546f))try{const _0x1776d5=readFileSync(_0xe5546f,'utf-8'),_0x6a2f14=parseYamlString(_0x1776d5);_0x2ce976=_0x6a2f14,_0x41bed3=buildRuleToNameMapping(_0x6a2f14),_0x105155[_0x4218f1(0x173)]&&_0x41bed3[_0x4218f1(0x115)]>0x0&&console['error'](_0x4218f1(0x11f)+_0x41bed3[_0x4218f1(0x115)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0xda7386);}catch(_0x31abb1){_0x105155[_0x4218f1(0x173)]&&console[_0x4218f1(0x145)](_0x4218f1(0x104)+_0x31abb1[_0x4218f1(0xeb)]);}const _0x22aa36=[],_0x127905=new Set(),_0x3e45f2=new Map(),_0x1a0d51=new Map(),_0xfa32cf=new Set(),_0x520d42=new Map(),_0x31cf89=new Map(),_0x37d0b9=createJumpTargetCache();await withProgressSpinner(_0x4218f1(0xe9)+_0xda7386+_0x4218f1(0x18b),async _0xe37970=>{const _0x40c19f=_0x4218f1;for(const _0x20f376 of _0x36463b){const _0x32c005=_0x36463b[_0x40c19f(0x175)]>0x1?_0x20f376[_0x40c19f(0xf4)]+'\x20v'+(_0x20f376[_0x40c19f(0x143)]||0x1):_0x20f376[_0x40c19f(0xf4)];_0xe37970[_0x40c19f(0x13c)](_0x40c19f(0xe9)+_0x32c005);const _0x427b41=await _0x234979[_0x40c19f(0x177)][_0x40c19f(0x17b)](_0x20f376['id']),_0x1f37a4=_0x427b41[_0x40c19f(0xcc)]?.['audienceId'],_0x599a4={'resolveSegment':async _0x35d9cb=>{const _0x12ca33=_0x40c19f;if(!_0x1f37a4)return{'name':_0x35d9cb,'isJourneyLocal':![]};const _0x4114d9=_0x3e45f2['get'](_0x35d9cb);if(_0x4114d9)return _0x4114d9;try{const _0x582bf6=await _0x234979['segment'][_0x12ca33(0x16e)](_0x1f37a4,_0x35d9cb),_0x32b9a6=_0x582bf6['kind']===SEGMENT_KIND_JOURNEY;let _0x26099c,_0x14619f=_0x582bf6[_0x12ca33(0x174)];if(_0x32b9a6&&_0x582bf6['rule']){const _0x526565=await segmentResponseToDef(_0x582bf6,{'resolveSegmentName':async _0x932be7=>{const _0x4564a4=_0x12ca33,_0xea970f=_0x3e45f2['get'](_0x932be7);if(_0xea970f)return _0xea970f[_0x4564a4(0x174)];const _0x3a349e=await _0x599a4[_0x4564a4(0xd9)](_0x932be7);return _0x3a349e[_0x4564a4(0x174)];}}),_0x5a3b74=_0x526565[_0x12ca33(0xc2)];_0x26099c={'description':_0x582bf6[_0x12ca33(0x189)],'rule':_0x5a3b74};const _0x3f3d15=serializeRule(_0x5a3b74),_0x390f06=_0x1a0d51[_0x12ca33(0x13d)](_0x3f3d15);if(_0x390f06)_0x14619f=_0x390f06,_0x26099c=undefined,_0x105155[_0x12ca33(0x173)]&&console[_0x12ca33(0x145)](_0x12ca33(0x113)+_0x582bf6[_0x12ca33(0x174)]+_0x12ca33(0x15a)+_0x390f06);else{let _0x37aba6=![];if(_0x41bed3){const _0x46bb19=_0x41bed3[_0x12ca33(0x13d)](_0x3f3d15);if(_0x46bb19){const _0x14d7b8=_0x46bb19['find'](_0x2ed3e1=>!_0x127905[_0x12ca33(0x129)](_0x2ed3e1));_0x14d7b8&&(_0x14619f=_0x14d7b8,_0x127905[_0x12ca33(0xce)](_0x14d7b8),_0x1a0d51[_0x12ca33(0xc1)](_0x3f3d15,_0x14d7b8),_0x37aba6=!![],_0x105155['verbose']&&console['error']('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x14d7b8+_0x12ca33(0x179)));}}if(!_0x37aba6){const _0x1ecfe4=generateJourneyLocalName(_0x582bf6[_0x12ca33(0x174)]);_0x1ecfe4&&(_0x14619f=_0x1ecfe4);let _0x331e3b=_0x14619f,_0x407699=0x2;while(_0x127905[_0x12ca33(0x129)](_0x331e3b)){_0x331e3b=_0x14619f+'_'+_0x407699,_0x407699++;}_0x127905[_0x12ca33(0xce)](_0x331e3b),_0x1a0d51[_0x12ca33(0xc1)](_0x3f3d15,_0x331e3b),_0x14619f=_0x331e3b;}}}const _0x1ae402={'name':_0x14619f,'isJourneyLocal':_0x32b9a6,'definition':_0x26099c};return _0x3e45f2[_0x12ca33(0xc1)](_0x35d9cb,_0x1ae402),_0x1ae402;}catch(_0x29e9d9){return _0x18ba6c[_0x12ca33(0x173)]&&console[_0x12ca33(0x145)](_0x12ca33(0x159)+_0x35d9cb+':\x20'+_0x29e9d9[_0x12ca33(0xeb)]),{'name':_0x35d9cb,'isJourneyLocal':![]};}},'resolveActivation':async _0x4a6834=>{const _0x4fe766=_0x40c19f,_0x44f788=_0x520d42[_0x4fe766(0x13d)](_0x4a6834);if(_0x44f788)return _0x44f788;try{const _0x2a7530=await _0x234979[_0x4fe766(0x177)][_0x4fe766(0xcb)](_0x20f376['id'],_0x4a6834),_0x411a42=journeyActivationStepToYaml(_0x2a7530,_0x86b3e,_0x1649db),_0x5ac07d=JSON[_0x4fe766(0x132)]({'name':_0x411a42['name'],'connection':_0x411a42[_0x4fe766(0xd4)],'connector_config':_0x411a42['connector_config']}),_0x413409=_0x31cf89['get'](_0x5ac07d);if(_0x413409){const _0x335170={'name':_0x413409,'isJourneyLocal':!![],'definition':_0x411a42};return _0x520d42[_0x4fe766(0xc1)](_0x4a6834,_0x335170),_0x335170;}const _0x20287c=_0x2a7530[_0x4fe766(0xcc)][_0x4fe766(0x16b)][_0x4fe766(0x174)]||_0x4a6834,_0x382afc=sanitizeYamlKey(_0x20287c)||_0x4fe766(0x172)+_0x4a6834;let _0x51ce45=_0x382afc,_0xd058a2=0x2;while(_0xfa32cf[_0x4fe766(0x129)](_0x51ce45)){_0x51ce45=_0x382afc+'_'+_0xd058a2,_0xd058a2++;}_0xfa32cf[_0x4fe766(0xce)](_0x51ce45),_0x31cf89[_0x4fe766(0xc1)](_0x5ac07d,_0x51ce45);const _0x193a0c={'name':_0x51ce45,'isJourneyLocal':!![],'definition':_0x411a42};return _0x520d42[_0x4fe766(0xc1)](_0x4a6834,_0x193a0c),_0x193a0c;}catch(_0x29788e){return _0x18ba6c[_0x4fe766(0x173)]&&console[_0x4fe766(0x145)](_0x4fe766(0x171)+_0x4a6834+':\x20'+_0x29788e[_0x4fe766(0xeb)]),{'name':_0x4a6834,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x5a155a,_0x1414de)=>{const _0x13888a=_0x40c19f;return resolveJumpTarget(_0x5a155a,_0x1414de,_0x37d0b9,_0x2604b1=>_0x234979[_0x13888a(0x177)][_0x13888a(0x17b)](_0x2604b1));}},_0x14bdbf=await journeyResponseToDef(_0x427b41,_0x599a4);_0x22aa36['push']({'item':_0x20f376,'yaml':_0x14bdbf});}},{'verbose':_0x18ba6c[_0x4218f1(0x173)]});const _0x5205db=buildMergedJourneyDef(_0x22aa36,_0x41bed3),_0x2f3907=normalizeJourneyDef(_0x5205db,_0x2ce976),_0x46d382=toYamlString(_0x2f3907),_0x75cccf=_0x955ec1||a18_0xeb7b53[_0x4218f1(0xe7)](_0x593338,sanitizeFileName(_0xda7386)+'.yml');!_0x955ec1&&_0x25ea03&&!existsSync(_0x593338)&&mkdirSync(_0x593338,{'recursive':!![]});const _0x23fd04=a18_0xeb7b53[_0x4218f1(0xc8)](process[_0x4218f1(0x146)](),_0x75cccf);if(existsSync(_0x75cccf)){const _0x94b94=readFileSync(_0x75cccf,'utf-8'),_0x36977f=generateDiff(_0x94b94,_0x46d382),_0x4c44c0=hasChanges(_0x36977f);_0x4ddef4[_0x4218f1(0x164)]({'relativePath':_0x23fd04,'absolutePath':_0x75cccf,'content':_0x46d382,'isNew':![],'hasChanges':_0x4c44c0,'diff':_0x4c44c0?formatDiffWithColors(_0x36977f):undefined});}else _0x4ddef4[_0x4218f1(0x164)]({'relativePath':_0x23fd04,'absolutePath':_0x75cccf,'content':_0x46d382,'isNew':!![],'hasChanges':![]});}const _0x37c440=_0x4ddef4[_0x4218f1(0x144)](_0x20670f=>_0x20670f[_0x4218f1(0x123)]),_0x4422bc=_0x4ddef4[_0x4218f1(0x144)](_0x146631=>!_0x146631[_0x4218f1(0x123)]&&_0x146631[_0x4218f1(0x155)]),_0xa2828e=_0x4ddef4['filter'](_0xa6cd66=>!_0xa6cd66[_0x4218f1(0x123)]&&!_0xa6cd66[_0x4218f1(0x155)]),_0xb81309=_0x166956[_0x4218f1(0x175)],_0x4eba46=_0x29ac3e[_0x4218f1(0x115)],_0x1e7569=_0xb81309>_0x4eba46?'\x20('+_0xb81309+_0x4218f1(0x16c):'';console['error'](_0x4218f1(0xb9)),console['error']('\x20\x20'+a18_0x2db01d[_0x4218f1(0x10d)](_0x4eba46+_0x4218f1(0x15e))+a18_0x2db01d[_0x4218f1(0xb5)](_0x1e7569)),console[_0x4218f1(0x145)]('\x20\x20'+a18_0x2db01d['green']('+\x20'+_0x37c440['length']+_0x4218f1(0xc9))),console[_0x4218f1(0x145)]('\x20\x20'+a18_0x2db01d[_0x4218f1(0x110)]('~\x20'+_0x4422bc[_0x4218f1(0x175)]+_0x4218f1(0x170))),console[_0x4218f1(0x145)]('\x20\x20'+a18_0x2db01d['dim']('=\x20'+_0xa2828e[_0x4218f1(0x175)]+_0x4218f1(0xf5))),console[_0x4218f1(0x145)]('\x20\x20Target:\x20'+a18_0x2db01d[_0x4218f1(0x10d)](_0x5380be)+'\x0a');if(_0x4422bc[_0x4218f1(0x175)]>0x0)for(const _0x4ae55f of _0x4422bc){console[_0x4218f1(0x145)]('\x0aChanges\x20to\x20\x27'+_0x4ae55f[_0x4218f1(0xc0)]+'\x27:'),console[_0x4218f1(0x145)]('─'[_0x4218f1(0xd2)](0x3c)),console[_0x4218f1(0x145)](_0x4ae55f[_0x4218f1(0x137)]),console['error']('─'[_0x4218f1(0xd2)](0x3c));}if(_0x105155['dryRun'])return console[_0x4218f1(0x145)](a18_0x2db01d[_0x4218f1(0x110)](_0x4218f1(0x183))),0x0;if(_0x37c440[_0x4218f1(0x175)]===0x0&&_0x4422bc[_0x4218f1(0x175)]===0x0)return console[_0x4218f1(0x145)](a18_0x2db01d['green'](_0x4218f1(0x11b))),saveSessionContext({'parent_segment':_0xe87cbf},_0x105155[_0x4218f1(0x101)]),console[_0x4218f1(0x145)](a18_0x2db01d[_0x4218f1(0x184)]('✔\x20Context\x20set:\x20'+a18_0x2db01d[_0x4218f1(0xb5)](_0x4218f1(0x17a))+_0x4218f1(0x15b)+a18_0x2db01d[_0x4218f1(0x10d)](_0xe87cbf))),0x0;if(!_0x105155[_0x4218f1(0xf7)]&&(_0x37c440[_0x4218f1(0x175)]>0x0||_0x4422bc['length']>0x0)){const _0x2eeafa=await confirmKey(_0x4218f1(0x186)+(_0x37c440[_0x4218f1(0x175)]+_0x4422bc['length'])+_0x4218f1(0x10f));if(!_0x2eeafa)return console[_0x4218f1(0x145)]('Aborted.'),0x1;}!existsSync(_0x5380be)&&mkdirSync(_0x5380be,{'recursive':!![]});for(const _0x291837 of _0x4ddef4){(_0x291837[_0x4218f1(0x123)]||_0x291837[_0x4218f1(0x155)])&&writeFileSync(_0x291837[_0x4218f1(0xca)],_0x291837[_0x4218f1(0x185)],_0x4218f1(0x14d));}return console[_0x4218f1(0x145)](a18_0x2db01d['green'](_0x4218f1(0x127)+(_0x37c440['length']+_0x4422bc['length'])+_0x4218f1(0x12e)+_0x5380be)),saveSessionContext({'parent_segment':_0xe87cbf},_0x105155[_0x4218f1(0x101)]),console[_0x4218f1(0x145)](a18_0x2db01d['green'](_0x4218f1(0x188)+a18_0x2db01d[_0x4218f1(0xb5)]('parent_segment')+_0x4218f1(0x15b)+a18_0x2db01d[_0x4218f1(0x10d)](_0xe87cbf))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x5ceb5b(0x174)]=a18_0x5ceb5b(0x10c);[a18_0x5ceb5b(0x189)]='Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data';['segmentPushCommand']=new SegmentPushCommand();async[a18_0x5ceb5b(0xf0)](_0x182bbc){const _0x307c35=a18_0x5ceb5b,_0x288965=_0x182bbc[_0x307c35(0x114)][0x0];let _0x110ffc;if(_0x288965){const _0x1fcad5=await resolveTarget({'arg':_0x288965,'contextParent':_0x182bbc[_0x307c35(0x166)][_0x307c35(0xd5)],'cwd':process[_0x307c35(0x146)]()});isSuccessfulResolution(_0x1fcad5)&&_0x1fcad5[_0x307c35(0xe3)]===_0x307c35(0x168)&&(_0x110ffc=_0x1fcad5[_0x307c35(0x152)]);}const _0x4e10d3={..._0x182bbc,'options':{..._0x182bbc['options'],'journeysOnly':!![],..._0x110ffc&&{'singleFilePath':_0x110ffc}}};return this[_0x307c35(0x100)][_0x307c35(0xf0)](_0x4e10d3);}}
1
+ const a18_0x1cfbec=a18_0x156d;(function(_0x57a697,_0x2f8554){const _0x48c6ef=a18_0x156d,_0x4a357e=_0x57a697();while(!![]){try{const _0x41cb9b=-parseInt(_0x48c6ef(0x12a))/0x1+parseInt(_0x48c6ef(0x188))/0x2*(-parseInt(_0x48c6ef(0x160))/0x3)+-parseInt(_0x48c6ef(0x138))/0x4+parseInt(_0x48c6ef(0x120))/0x5+-parseInt(_0x48c6ef(0x1bb))/0x6*(-parseInt(_0x48c6ef(0x16b))/0x7)+parseInt(_0x48c6ef(0x169))/0x8*(-parseInt(_0x48c6ef(0x179))/0x9)+parseInt(_0x48c6ef(0x158))/0xa;if(_0x41cb9b===_0x2f8554)break;else _0x4a357e['push'](_0x4a357e['shift']());}catch(_0xa01b7){_0x4a357e['push'](_0x4a357e['shift']());}}}(a18_0x3e81,0xc4433));import a18_0x27c2c4 from'chalk';import a18_0x3bf54e from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';function a18_0x3e81(){const _0x425403=['Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','Warning:\x20Could\x20not\x20resolve\x20activation\x20','2FogKHf','\x20\x20Consolidating\x20duplicate\x20segment:\x20','journeyStages','get','Warning:\x20Could\x20not\x20resolve\x20segment\x20','message','Target\x20file:\x20','repeat','green','name','goal','journeys','dim','filePath','Folder\x20path:\x20','/e/','🗺️\x20','Error:\x20Parent\x20segment\x20context\x20required','getSegment','resolveSegment','\x20(ID:\x20','getStatistics','population','parent_segment','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','/j/da/je','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','helpText','activationParams','segment','segments','\x5c$&','filter','type','conversionRate','totalEntered','segmentName','includeStats','\x20\x20Target:\x20','\x20\x20Name:\x20','\x22\x20resumed','launched','Usage:\x20journey\x20pause\x20<name-or-path>','journey:resume','(completed)','journey:pull','Getting\x20journey\x20details...','base','description','Parent\x20segment:\x20','stageName','6251808sqBmCW','/app/ps/','Fetching\x20users\x20for\x20email\x20resolution...','📁\x20','✔\x20Context\x20set:\x20','goalRate','table','resolveJourneyId','journey:push','add','Show\x20journey\x20statistics','(paused)','cyan','journey:pause','Listing\x20folders...','all','journey:view','Fetching\x20connections\x20for\x20name\x20resolution...','session','\x20(rule\x20match)','Found\x20','✔\x20Journey\x20\x22','log','buildIdToEmailMap','setPhase','toLowerCase','yellow','versionNumber','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','(root)','rule','hasChanges','\x20\x20-\x20','attributes','stages','✔\x20All\x20files\x20are\x20up\x20to\x20date','red','replace','\x27\x20not\x20found\x20in\x20','parentName','Resolving\x20parent\x20segment...','relative','(draft)','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','\x20new\x20files','error','Write\x20','file','audienceId','content','map','join','Error:\x20','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','format','1569655YaUpgV','Resume\x20a\x20paused\x20journey','yes','\x20\x20Preserving\x20local\x20segment\x20name:\x20','\x20\x20Folder\x20path:\x20','size','Usage:\x20journey\x20resume\x20<name-or-path>','cwd','parentSegment','execute','1043612aMnbpy','Resuming\x20journey...','sort','set','entered','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','connection','\x22\x20not\x20found','completed','activation_','segmentPushCommand','journeyBundleName','...','137160YNpJrP','journeyBundleId','Resolving\x20journey...','Show\x20journey\x20details','has','No\x20journeys\x20found','exited','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Resolved\x20YAML\x20file:\x20','folders','connector_config','\x20journey','isNew','journeyName','\x20journeys','buildIdToNameMap','getActivation','rootFolderId','diff','folderId','relativePath','getParentFull','find','state','\x20Opening\x20','verbose','push','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','stringify','resourceName','No\x20statistics\x20available\x20for\x20journey:\x20','stage','21366430HEwbRN','\x0aPull\x20summary:','then','✔\x20Pulled\x20','Getting\x20journey\x20statistics...','Input:\x20','localeCompare','journey','2845671anmvlZ','data','utf-8','Aborted.','getJourney','dryRun','Fetching\x20','\x20versions)','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','16VjtQeL','\x20\x20Parent\x20segment:\x20','7cIOYKw','length','Target\x20directory:\x20','\x20=\x20','\x20unchanged\x20files','journeyId','draft','/j/da','no_parent','totalGoalAchieved','folderPath','values','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','INVALID_ARGUMENT','2979864xWOPUt','web','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','site','\x20journey\x20files\x20to\x20','Options:','\x22\x20paused','Pattern:\x20','\x20files?','Cancelled','resolveParentId','Warning:\x20Stage\x20\x22','Listing\x20journeys...'];a18_0x3e81=function(){return _0x425403;};return a18_0x3e81();}function a18_0x156d(_0x330f54,_0x10df22){_0x330f54=_0x330f54-0xfa;const _0x3e81a4=a18_0x3e81();let _0x156d55=_0x3e81a4[_0x330f54];return _0x156d55;}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x2ebf8b){const _0xcbdf1f=a18_0x156d;switch(_0x2ebf8b){case _0xcbdf1f(0x1b1):return a18_0x27c2c4[_0xcbdf1f(0x190)]('(running)');case _0xcbdf1f(0x171):return a18_0x27c2c4[_0xcbdf1f(0x194)](_0xcbdf1f(0x113));case'paused':return a18_0x27c2c4['yellow'](_0xcbdf1f(0x1c6));case _0xcbdf1f(0x133):return a18_0x27c2c4['blue'](_0xcbdf1f(0x1b4));case'archived':return a18_0x27c2c4[_0xcbdf1f(0x194)]('(archived)');default:return'('+_0x2ebf8b+')';}}function formatJourneyItem(_0x11af53,_0x9d5ff7='',_0x1be75b){const _0x2b2cc4=a18_0x156d,_0x12d500=formatJourneyState(_0x11af53[_0x2b2cc4(0x14f)]),_0x2f5e3c=_0x1be75b?hyperlink(_0x11af53[_0x2b2cc4(0x136)],_0x1be75b):_0x11af53[_0x2b2cc4(0x136)];return _0x9d5ff7+_0x2b2cc4(0x198)+_0x2f5e3c+'\x20'+_0x12d500;}function escapeRegex(_0x3b06fd){const _0x2f26c0=a18_0x156d;return _0x3b06fd[_0x2f26c0(0x10e)](/[.*+?^${}()|[\]\\]/g,_0x2f26c0(0x1a7));}function globToRegex(_0x217342){const _0xfe2f31=a18_0x156d,_0x1cf2b9=_0x217342['split']('*')[_0xfe2f31(0x11b)](escapeRegex);return new RegExp(_0x1cf2b9['join']('.*'),'i');}function buildRuleToNameMapping(_0x4460d9){const _0x298ce2=a18_0x156d,_0x465807=new Map();if(_0x4460d9['segments'])for(const [_0x3db413,_0x569c0e]of Object['entries'](_0x4460d9[_0x298ce2(0x1a6)])){if(_0x569c0e[_0x298ce2(0x107)]){const _0x40cdb5=serializeRule(_0x569c0e['rule']),_0x5e6bf8=_0x465807[_0x298ce2(0x18b)](_0x40cdb5);_0x5e6bf8?_0x5e6bf8['push'](_0x3db413):_0x465807['set'](_0x40cdb5,[_0x3db413]);}}return _0x465807;}async function resolveJourneyTarget(_0x300a79,_0x3fc64d,_0x242d65){const _0x16c3b3=a18_0x156d;if(isYamlFilePath(_0x300a79))try{const _0x319d83=await resolveYamlFilePath(_0x300a79);return _0x242d65&&(console['error'](_0x16c3b3(0x140)+_0x300a79),console[_0x16c3b3(0x116)](_0x16c3b3(0x16a)+_0x319d83[_0x16c3b3(0x128)]),console[_0x16c3b3(0x116)](_0x16c3b3(0x1af)+_0x319d83[_0x16c3b3(0x1ac)]),console['error'](_0x16c3b3(0x124)+(_0x319d83[_0x16c3b3(0x175)]||_0x16c3b3(0x106)))),{'journeyName':_0x319d83['segmentName'],'parentSegment':_0x319d83[_0x16c3b3(0x128)],'resolved':_0x319d83};}catch(_0x13ac4e){throw new SDKError(ErrorCode[_0x16c3b3(0x178)],_0x16c3b3(0x1a0)+_0x13ac4e[_0x16c3b3(0x18d)]);}if(!_0x3fc64d)throw new SDKError(ErrorCode[_0x16c3b3(0x178)],_0x16c3b3(0x1a2));return{'journeyName':_0x300a79,'parentSegment':_0x3fc64d};}export class JourneyListCommand extends BaseCommand{[a18_0x1cfbec(0x191)]='journey:list';['description']='List\x20journeys\x20in\x20current\x20context';async[a18_0x1cfbec(0x129)](_0x2913c5){const _0x4d4c8e=a18_0x1cfbec,{options:_0xe73969,args:_0x2cf603,tdx:_0x4993e8}=_0x2913c5,_0x3b41df=_0x2cf603[0x0],_0x475927=_0xe73969[_0x4d4c8e(0x128)];if(!_0x475927)return console['error'](_0x4d4c8e(0x199)),console[_0x4d4c8e(0x116)](_0x4d4c8e(0x13f)),0x1;const _0x550af0=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x4993e8[_0x4d4c8e(0x1a5)]['resolveParentId'](_0x475927),{'verbose':_0xe73969[_0x4d4c8e(0x151)]}),_0x2a02cc=_0x550af0[_0x4d4c8e(0x161)];_0xe73969['verbose']&&(console[_0x4d4c8e(0x116)](_0x4d4c8e(0x1b9)+_0x475927+_0x4d4c8e(0x19c)+_0x2a02cc+')'),_0x3b41df&&console[_0x4d4c8e(0x116)](_0x4d4c8e(0x180)+_0x3b41df));const _0x487245=await withSpinner('Fetching\x20parent\x20segment...',()=>_0x4993e8['segment'][_0x4d4c8e(0x14d)](_0x2a02cc),{'verbose':_0xe73969[_0x4d4c8e(0x151)]}),_0x564e89=_0x487245[_0x4d4c8e(0x161)],_0x41ca93=_0x564e89[_0x4d4c8e(0x149)],_0x52f123=await withSpinner(_0x4d4c8e(0x185),()=>_0x4993e8[_0x4d4c8e(0x15f)]['listJourneysWithFolders'](_0x2a02cc,_0x41ca93),{'verbose':_0xe73969['verbose']});let _0x25ec5c=_0x52f123[_0x4d4c8e(0x161)][_0x4d4c8e(0x193)];const _0x52cf3d=_0x52f123[_0x4d4c8e(0x161)][_0x4d4c8e(0x141)],_0x24a9de=new Map();for(const _0x368513 of _0x52cf3d){_0x24a9de[_0x4d4c8e(0x12d)](_0x368513['id'],_0x368513[_0x4d4c8e(0x191)]);}if(_0x3b41df){const _0x26fec9=globToRegex(_0x3b41df);_0x25ec5c=_0x25ec5c[_0x4d4c8e(0x1a8)](_0x1d98a7=>_0x26fec9['test'](_0x1d98a7[_0x4d4c8e(0x136)]));}console[_0x4d4c8e(0x116)]('✔\x20Found\x20'+_0x25ec5c[_0x4d4c8e(0x16c)]+_0x4d4c8e(0x143)+(_0x25ec5c['length']!==0x1?'s':''));const _0x11a575=_0x42f026=>{const _0x2a2a2d=_0x4d4c8e;return getConsoleNextUrl(_0xe73969[_0x2a2a2d(0x17c)],_0x2a2a2d(0x1bc)+_0x2a02cc+_0x2a2a2d(0x197)+_0x42f026+_0x2a2a2d(0x172));};if(_0xe73969[_0x4d4c8e(0x11f)]===_0x4d4c8e(0x1c1))await handleSDKOutput(_0x25ec5c,_0xe73969);else{if(_0xe73969['format']==='json'){const _0x35ccb2=_0x25ec5c['map'](_0x193308=>({..._0x193308,'url':_0x11a575(_0x193308['id'])}));await handleSDKOutput(_0x35ccb2,_0xe73969);}else{console[_0x4d4c8e(0xff)]('['+_0x475927+']');const _0x2659d9=new Map(),_0x433677=[];for(const _0x4eedd0 of _0x25ec5c){if(!_0x4eedd0[_0x4d4c8e(0x14b)]||_0x4eedd0['folderId']===_0x41ca93)_0x433677[_0x4d4c8e(0x152)](_0x4eedd0);else{const _0xb633af=_0x2659d9[_0x4d4c8e(0x18b)](_0x4eedd0[_0x4d4c8e(0x14b)])||[];_0xb633af[_0x4d4c8e(0x152)](_0x4eedd0),_0x2659d9['set'](_0x4eedd0['folderId'],_0xb633af);}}const _0x54fbc1=(_0x5053d6,_0x2bbf96)=>_0x5053d6['journeyBundleName'][_0x4d4c8e(0x15e)](_0x2bbf96[_0x4d4c8e(0x136)],undefined,{'sensitivity':'base'});_0x433677[_0x4d4c8e(0x12c)](_0x54fbc1);for(const _0x53a3c1 of _0x433677){console[_0x4d4c8e(0xff)](formatJourneyItem(_0x53a3c1,'',_0x11a575(_0x53a3c1['id'])));}const _0x1aa26d=[..._0x2659d9['entries']()][_0x4d4c8e(0x12c)]((_0x82842c,_0x1093c1)=>{const _0x417256=_0x4d4c8e,_0x3270e2=_0x24a9de[_0x417256(0x18b)](_0x82842c[0x0])||_0x82842c[0x0],_0x374cf6=_0x24a9de[_0x417256(0x18b)](_0x1093c1[0x0])||_0x1093c1[0x0];return _0x3270e2[_0x417256(0x15e)](_0x374cf6,undefined,{'sensitivity':_0x417256(0x1b7)});});for(const [_0x4c1281,_0x165f05]of _0x1aa26d){const _0x215e17=_0x24a9de[_0x4d4c8e(0x18b)](_0x4c1281)||_0x4c1281;console[_0x4d4c8e(0xff)](_0x4d4c8e(0x1be)+_0x215e17),_0x165f05['sort'](_0x54fbc1);for(const _0x2edb6c of _0x165f05){console[_0x4d4c8e(0xff)](formatJourneyItem(_0x2edb6c,'\x20\x20',_0x11a575(_0x2edb6c['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x1cfbec(0x191)]=a18_0x1cfbec(0x1cb);[a18_0x1cfbec(0x1b8)]=a18_0x1cfbec(0x13b);async[a18_0x1cfbec(0x129)](_0x5d66cb){const _0x4118ca=a18_0x1cfbec,{options:_0x6f70f7,args:_0x198b7c,tdx:_0x2eb4ca}=_0x5d66cb,_0x25f372=_0x198b7c[0x0];if(!_0x25f372)return console['error']('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x4118ca(0x116)](_0x4118ca(0x11e)),console[_0x4118ca(0x116)](_0x4118ca(0x17e)),console[_0x4118ca(0x116)](_0x4118ca(0x153)),0x1;_0x6f70f7[_0x4118ca(0x151)]&&console[_0x4118ca(0x116)](_0x4118ca(0x15d)+_0x25f372);const _0x182c8f=await resolveJourneyTarget(_0x25f372,_0x6f70f7[_0x4118ca(0x128)],_0x6f70f7['verbose']),_0x378579=await withSpinner(_0x4118ca(0x111),()=>_0x2eb4ca[_0x4118ca(0x1a5)][_0x4118ca(0x183)](_0x182c8f[_0x4118ca(0x128)]),{'verbose':_0x6f70f7[_0x4118ca(0x151)]}),_0x237af1=_0x378579[_0x4118ca(0x161)],_0xcf191c=await withSpinner('Resolving\x20journey...',()=>_0x2eb4ca[_0x4118ca(0x15f)][_0x4118ca(0x1c2)](_0x237af1,_0x182c8f['journeyName']),{'verbose':_0x6f70f7[_0x4118ca(0x151)]}),_0x2eff47=_0xcf191c[_0x4118ca(0x161)];if(_0x6f70f7[_0x4118ca(0x17a)]){const _0x4b6712=getConsoleNextUrl(_0x6f70f7[_0x4118ca(0x17c)],'/app/ps/'+_0x237af1+_0x4118ca(0x197)+_0x2eff47+_0x4118ca(0x1a1));return console[_0x4118ca(0x116)](a18_0x27c2c4[_0x4118ca(0x190)]('✔')+_0x4118ca(0x150)+a18_0x27c2c4[_0x4118ca(0x1c7)](_0x4b6712)),openBrowser(_0x4b6712),0x0;}const _0x92af4a=await withSpinner(_0x4118ca(0x1b6),()=>_0x2eb4ca['journey'][_0x4118ca(0x164)](_0x2eff47),{'verbose':_0x6f70f7[_0x4118ca(0x151)]}),_0x1c0c83=_0x92af4a[_0x4118ca(0x161)],_0x579351=_0x6f70f7[_0x4118ca(0x1ad)];let _0x16534c;if(_0x579351)try{const _0x29f6bb=await withSpinner(_0x4118ca(0x15c),()=>_0x2eb4ca[_0x4118ca(0x15f)]['getStatistics'](_0x2eff47),{'verbose':_0x6f70f7[_0x4118ca(0x151)]});_0x16534c=_0x29f6bb[_0x4118ca(0x161)];}catch{_0x6f70f7[_0x4118ca(0x151)]&&console[_0x4118ca(0x116)]('\x20\x20Statistics\x20not\x20available');}const _0x587620=getConsoleNextUrl(_0x6f70f7[_0x4118ca(0x17c)],_0x4118ca(0x1bc)+_0x237af1+_0x4118ca(0x197)+_0x2eff47+_0x4118ca(0x1a1)),_0x192192={'id':_0x1c0c83['id'],'name':_0x1c0c83[_0x4118ca(0x10a)][_0x4118ca(0x191)],'description':_0x1c0c83[_0x4118ca(0x10a)]['description'],'state':_0x1c0c83[_0x4118ca(0x10a)][_0x4118ca(0x14f)],'paused':_0x1c0c83[_0x4118ca(0x10a)]['paused'],'reentry_mode':_0x1c0c83[_0x4118ca(0x10a)]['reentryMode'],'stages':_0x1c0c83[_0x4118ca(0x10a)][_0x4118ca(0x18a)]?.[_0x4118ca(0x16c)]||0x0,..._0x1c0c83['attributes'][_0x4118ca(0x192)]&&{'goal':_0x1c0c83[_0x4118ca(0x10a)][_0x4118ca(0x192)]['name']},..._0x16534c&&{'statistics':{'total_entered':_0x16534c[_0x4118ca(0x1ab)],'goal_achieved':_0x16534c[_0x4118ca(0x174)],'goal_rate':_0x16534c[_0x4118ca(0x1c0)],'stages':_0x16534c['stages']}},'url':_0x587620};return await handleSingleObjectOutput(_0x192192,_0x6f70f7),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x1cfbec(0x191)]='journey:stats';[a18_0x1cfbec(0x1b8)]=a18_0x1cfbec(0x1c5);async[a18_0x1cfbec(0x129)](_0x2184bf){const _0x43cdbd=a18_0x1cfbec,{options:_0x3ee2c7,args:_0x12b42a,tdx:_0x49c2cf}=_0x2184bf,_0x3fc784=_0x12b42a[0x0];if(!_0x3fc784)return console[_0x43cdbd(0x116)](_0x43cdbd(0x17b)),console[_0x43cdbd(0x116)]('Usage:\x20journey\x20stats\x20<name-or-path>'),0x1;_0x3ee2c7[_0x43cdbd(0x151)]&&console[_0x43cdbd(0x116)](_0x43cdbd(0x15d)+_0x3fc784);const _0x5aa72c=await resolveJourneyTarget(_0x3fc784,_0x3ee2c7['parentSegment'],_0x3ee2c7[_0x43cdbd(0x151)]),_0x55ed49=await withSpinner(_0x43cdbd(0x111),()=>_0x49c2cf[_0x43cdbd(0x1a5)]['resolveParentId'](_0x5aa72c['parentSegment']),{'verbose':_0x3ee2c7['verbose']}),_0x1b3e45=_0x55ed49[_0x43cdbd(0x161)],_0x1034a5=await withSpinner('Resolving\x20journey...',()=>_0x49c2cf[_0x43cdbd(0x15f)][_0x43cdbd(0x1c2)](_0x1b3e45,_0x5aa72c[_0x43cdbd(0x145)]),{'verbose':_0x3ee2c7[_0x43cdbd(0x151)]}),_0x33e3dd=_0x1034a5['data'],_0x5ae09d=await withSpinner(_0x43cdbd(0x15c),()=>_0x49c2cf[_0x43cdbd(0x15f)][_0x43cdbd(0x19d)](_0x33e3dd),{'verbose':_0x3ee2c7[_0x43cdbd(0x151)]}),_0x165d98=_0x5ae09d['data'];if(!_0x165d98||_0x165d98[_0x43cdbd(0x170)]===null)return console[_0x43cdbd(0x116)](_0x43cdbd(0x156)+_0x5aa72c[_0x43cdbd(0x145)]),console[_0x43cdbd(0x116)]('Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),0x0;const _0x53d8dc={'journey_id':_0x165d98[_0x43cdbd(0x170)],'total_entered':_0x165d98[_0x43cdbd(0x1ab)],'goal_achieved':_0x165d98['totalGoalAchieved'],'goal_rate':_0x165d98[_0x43cdbd(0x1c0)],'stages':_0x165d98[_0x43cdbd(0x10b)]?.[_0x43cdbd(0x11b)](_0x54184c=>({'name':_0x54184c[_0x43cdbd(0x1ba)],'population':_0x54184c[_0x43cdbd(0x19e)],'entered':_0x54184c[_0x43cdbd(0x12e)],'exited':_0x54184c[_0x43cdbd(0x13e)],'conversion_rate':_0x54184c[_0x43cdbd(0x1aa)]}))},_0x31ad23=_0x3ee2c7[_0x43cdbd(0x157)];if(_0x31ad23&&_0x165d98[_0x43cdbd(0x10b)]){const _0x224662=_0x165d98[_0x43cdbd(0x10b)][_0x43cdbd(0x14e)](_0x1fe854=>_0x1fe854[_0x43cdbd(0x1ba)][_0x43cdbd(0x102)]()===_0x31ad23['toLowerCase']());if(_0x224662)return await handleSingleObjectOutput({'stage_name':_0x224662['stageName'],'population':_0x224662['population'],'entered':_0x224662['entered'],'exited':_0x224662[_0x43cdbd(0x13e)],'conversion_rate':_0x224662[_0x43cdbd(0x1aa)]},_0x3ee2c7),0x0;console[_0x43cdbd(0x116)](_0x43cdbd(0x184)+_0x31ad23+_0x43cdbd(0x132));}return await handleSingleObjectOutput(_0x53d8dc,_0x3ee2c7),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0x1cfbec(0x191)]=a18_0x1cfbec(0x1c8);[a18_0x1cfbec(0x1b8)]='Pause\x20a\x20running\x20journey';async[a18_0x1cfbec(0x129)](_0x57f208){const _0x3ade21=a18_0x1cfbec,{options:_0x3d0054,args:_0x3ebd1a,tdx:_0x1b59bb}=_0x57f208,_0x2ff980=_0x3ebd1a[0x0];if(!_0x2ff980)return console['error'](_0x3ade21(0x17b)),console[_0x3ade21(0x116)](_0x3ade21(0x1b2)),0x1;_0x3d0054[_0x3ade21(0x151)]&&console[_0x3ade21(0x116)](_0x3ade21(0x15d)+_0x2ff980);const _0x15c16d=await resolveJourneyTarget(_0x2ff980,_0x3d0054[_0x3ade21(0x128)],_0x3d0054[_0x3ade21(0x151)]),_0x2272e1=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x1b59bb['segment'][_0x3ade21(0x183)](_0x15c16d[_0x3ade21(0x128)]),{'verbose':_0x3d0054[_0x3ade21(0x151)]}),_0x29bd9f=_0x2272e1[_0x3ade21(0x161)],_0x36bd92=await withSpinner(_0x3ade21(0x13a),()=>_0x1b59bb[_0x3ade21(0x15f)]['resolveJourneyId'](_0x29bd9f,_0x15c16d[_0x3ade21(0x145)]),{'verbose':_0x3d0054[_0x3ade21(0x151)]}),_0x38dfcf=_0x36bd92[_0x3ade21(0x161)];if(!_0x3d0054[_0x3ade21(0x122)]){const _0x287e67=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0x15c16d[_0x3ade21(0x145)]+'\x22?');if(!_0x287e67)return console[_0x3ade21(0x116)](_0x3ade21(0x182)),0x0;}const _0x170653=await withSpinner('Pausing\x20journey...',()=>_0x1b59bb[_0x3ade21(0x15f)]['pause'](_0x38dfcf),{'verbose':_0x3d0054['verbose']}),_0x120ce3=_0x170653[_0x3ade21(0x161)];return console[_0x3ade21(0x116)](_0x3ade21(0xfe)+_0x120ce3[_0x3ade21(0x10a)][_0x3ade21(0x191)]+_0x3ade21(0x17f)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x1cfbec(0x191)]=a18_0x1cfbec(0x1b3);[a18_0x1cfbec(0x1b8)]=a18_0x1cfbec(0x121);async['execute'](_0x261851){const _0x591ec1=a18_0x1cfbec,{options:_0x18dac9,args:_0x274847,tdx:_0x1694c2}=_0x261851,_0x417bb6=_0x274847[0x0];if(!_0x417bb6)return console['error'](_0x591ec1(0x17b)),console[_0x591ec1(0x116)](_0x591ec1(0x126)),0x1;_0x18dac9['verbose']&&console['error'](_0x591ec1(0x15d)+_0x417bb6);const _0x491a7b=await resolveJourneyTarget(_0x417bb6,_0x18dac9[_0x591ec1(0x128)],_0x18dac9[_0x591ec1(0x151)]),_0x4c2071=await withSpinner(_0x591ec1(0x111),()=>_0x1694c2[_0x591ec1(0x1a5)][_0x591ec1(0x183)](_0x491a7b[_0x591ec1(0x128)]),{'verbose':_0x18dac9[_0x591ec1(0x151)]}),_0xdccdb4=_0x4c2071[_0x591ec1(0x161)],_0x159bf6=await withSpinner(_0x591ec1(0x13a),()=>_0x1694c2[_0x591ec1(0x15f)][_0x591ec1(0x1c2)](_0xdccdb4,_0x491a7b[_0x591ec1(0x145)]),{'verbose':_0x18dac9[_0x591ec1(0x151)]}),_0x4b84df=_0x159bf6[_0x591ec1(0x161)];if(!_0x18dac9['yes']){const _0x27848c=await confirm(_0x591ec1(0x168)+_0x491a7b[_0x591ec1(0x145)]+'\x22?');if(!_0x27848c)return console[_0x591ec1(0x116)](_0x591ec1(0x182)),0x0;}const _0x3cad25=await withSpinner(_0x591ec1(0x12b),()=>_0x1694c2[_0x591ec1(0x15f)]['resume'](_0x4b84df),{'verbose':_0x18dac9[_0x591ec1(0x151)]}),_0x25cc4d=_0x3cad25[_0x591ec1(0x161)];return console['error'](_0x591ec1(0xfe)+_0x25cc4d['attributes'][_0x591ec1(0x191)]+_0x591ec1(0x1b0)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x1cfbec(0x191)]=a18_0x1cfbec(0x1b5);[a18_0x1cfbec(0x1b8)]='Export\x20journey(s)\x20as\x20YAML\x20files';async['execute'](_0x9bdae3){const _0x4e31cc=a18_0x1cfbec,{options:_0x348f0b,args:_0x691102,tdx:_0x554606}=_0x9bdae3,_0x232ec8=_0x348f0b,_0x1c38ee=_0x691102[0x0],_0x198475=_0x1c38ee&&isYamlFilePath(_0x1c38ee),_0x3d1953=await resolveTarget({'arg':_0x198475?_0x1c38ee:undefined,'contextParent':_0x348f0b['parentSegment'],'cwd':process[_0x4e31cc(0x127)]()});if(!isSuccessfulResolution(_0x3d1953))return _0x3d1953['errorCode']===_0x4e31cc(0x173)?(console[_0x4e31cc(0x116)](a18_0x27c2c4[_0x4e31cc(0x103)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x4e31cc(0x116)](_0x4e31cc(0x114)),console[_0x4e31cc(0x116)](_0x4e31cc(0x130)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0x4e31cc(0x116)]('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')):(console['error'](a18_0x27c2c4[_0x4e31cc(0x10d)](_0x4e31cc(0x11d)+_0x3d1953[_0x4e31cc(0x18d)]+'\x0a')),_0x3d1953[_0x4e31cc(0x1a3)]&&console[_0x4e31cc(0x116)](a18_0x27c2c4[_0x4e31cc(0x1c7)](_0x3d1953[_0x4e31cc(0x1a3)]))),0x1;let _0x2dcb13=_0x198475?undefined:_0x1c38ee,_0x5ec722,_0x5aa558;_0x3d1953[_0x4e31cc(0x1a9)]===_0x4e31cc(0x118)&&(_0x2dcb13=_0x3d1953[_0x4e31cc(0x155)],_0x5ec722=_0x3d1953[_0x4e31cc(0x195)],_0x5aa558=_0x3d1953[_0x4e31cc(0x175)]);const _0x1b7161=_0x3d1953[_0x4e31cc(0x110)],_0x43a17b=_0x3d1953['targetDir'];_0x232ec8[_0x4e31cc(0x151)]&&(console[_0x4e31cc(0x116)](_0x4e31cc(0x1b9)+_0x1b7161),console[_0x4e31cc(0x116)](_0x4e31cc(0x16d)+_0x43a17b),_0x2dcb13&&console['error']('Journey\x20name:\x20'+_0x2dcb13),_0x5ec722&&console[_0x4e31cc(0x116)](_0x4e31cc(0x18e)+_0x5ec722),_0x5aa558&&console[_0x4e31cc(0x116)](_0x4e31cc(0x196)+_0x5aa558));const _0x2c80aa=await withSpinner(_0x4e31cc(0x111),()=>_0x554606[_0x4e31cc(0x1a5)][_0x4e31cc(0x183)](_0x1b7161),{'verbose':_0x348f0b[_0x4e31cc(0x151)]}),_0x18ac43=_0x2c80aa[_0x4e31cc(0x161)],[_0x4c8091,_0x4542b5]=await Promise['all']([withSpinner(_0x4e31cc(0x185),()=>_0x554606[_0x4e31cc(0x15f)]['listJourneysFromParentSegment'](_0x18ac43,undefined,{'includeAllVersions':!![]}),{'verbose':_0x348f0b[_0x4e31cc(0x151)]}),withSpinner(_0x4e31cc(0x1c9),()=>_0x554606['segment']['listFolders'](_0x18ac43),{'verbose':_0x348f0b['verbose']})]);let _0x2a1ac9=_0x4c8091[_0x4e31cc(0x161)];const _0x116fd4=_0x4542b5['data'],_0x1506d6=buildFolderIdToPathMap(_0x116fd4);if(_0x2dcb13){const _0x3767b5=_0x2a1ac9[_0x4e31cc(0x1a8)](_0x256c85=>_0x256c85[_0x4e31cc(0x136)][_0x4e31cc(0x102)]()===_0x2dcb13[_0x4e31cc(0x102)]());if(_0x3767b5[_0x4e31cc(0x16c)]===0x0)return console[_0x4e31cc(0x116)]('Error:\x20Journey\x20not\x20found:\x20'+_0x2dcb13),console[_0x4e31cc(0x116)](_0x4e31cc(0x12f)),0x1;_0x2a1ac9=_0x3767b5;}if(_0x5aa558!==undefined){const _0x3a091e=_0x2a1ac9[_0x4e31cc(0x1a8)](_0x241376=>{const _0x5651ea=_0x4e31cc,_0x50baba=_0x241376[_0x5651ea(0x14b)]?_0x1506d6[_0x5651ea(0x18b)](_0x241376[_0x5651ea(0x14b)])||'':'';return _0x50baba===_0x5aa558;});if(_0x3a091e[_0x4e31cc(0x16c)]===0x0&&_0x2a1ac9[_0x4e31cc(0x16c)]>0x0){console[_0x4e31cc(0x116)]('Error:\x20Journey\x20\x27'+_0x2dcb13+_0x4e31cc(0x10f)+(_0x5aa558||'root\x20folder')),console['error'](_0x4e31cc(0x177));for(const _0x20a900 of _0x2a1ac9){const _0x580605=_0x20a900[_0x4e31cc(0x14b)]?_0x1506d6['get'](_0x20a900[_0x4e31cc(0x14b)])||'':'';console['error'](_0x4e31cc(0x109)+(_0x580605||'(root)')+'/'+_0x20a900['journeyBundleName']);}return 0x1;}_0x2a1ac9=_0x3a091e;}if(_0x2a1ac9['length']===0x0)return console[_0x4e31cc(0x116)](_0x4e31cc(0x13d)),0x0;const _0x121bd9=new Map();for(const _0x564400 of _0x2a1ac9){const _0x216c0d=_0x564400[_0x4e31cc(0x139)];!_0x121bd9[_0x4e31cc(0x13c)](_0x216c0d)&&_0x121bd9[_0x4e31cc(0x12d)](_0x216c0d,[]),_0x121bd9['get'](_0x216c0d)[_0x4e31cc(0x152)](_0x564400);}for(const _0x5777d6 of _0x121bd9[_0x4e31cc(0x176)]()){_0x5777d6['sort']((_0x10f5c9,_0x1a3f24)=>(_0x10f5c9[_0x4e31cc(0x104)]||0x0)-(_0x1a3f24[_0x4e31cc(0x104)]||0x0));}const _0x5f56ec=[],[_0x21c1e2,_0x484ec7]=await Promise[_0x4e31cc(0x1ca)]([withSpinner(_0x4e31cc(0x1bd),()=>_0x554606['user'][_0x4e31cc(0x100)](),{'verbose':_0x348f0b['verbose']})[_0x4e31cc(0x15a)](_0x4a09d5=>_0x4a09d5['data']),withSpinner(_0x4e31cc(0xfa),()=>_0x554606['connection'][_0x4e31cc(0x147)](),{'verbose':_0x348f0b[_0x4e31cc(0x151)]})[_0x4e31cc(0x15a)](_0x34977e=>_0x34977e[_0x4e31cc(0x161)])]);for(const _0x497d63 of _0x121bd9['values']()){const _0x354440=_0x497d63[0x0]['journeyBundleName'],_0x3bdfee=_0x497d63[0x0][_0x4e31cc(0x14b)],_0x5e1c8e=_0x3bdfee?_0x1506d6['get'](_0x3bdfee)||'':'',_0x4d2e76=_0x5e1c8e?a18_0x3bf54e['join'](_0x43a17b,_0x5e1c8e):_0x43a17b,_0x2d36d4=_0x5ec722||a18_0x3bf54e[_0x4e31cc(0x11c)](_0x4d2e76,sanitizeFileName(_0x354440)+'.yml');let _0x18c46a,_0x2ea9a2;if(existsSync(_0x2d36d4))try{const _0x337d55=readFileSync(_0x2d36d4,_0x4e31cc(0x162)),_0x26701c=parseYamlString(_0x337d55);_0x2ea9a2=_0x26701c,_0x18c46a=buildRuleToNameMapping(_0x26701c),_0x232ec8[_0x4e31cc(0x151)]&&_0x18c46a[_0x4e31cc(0x125)]>0x0&&console['error'](_0x4e31cc(0xfd)+_0x18c46a['size']+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x354440);}catch(_0x1ffc49){_0x232ec8['verbose']&&console[_0x4e31cc(0x116)](_0x4e31cc(0x186)+_0x1ffc49['message']);}const _0xfed585=[],_0x4bd5da=new Set(),_0x2965ec=new Map(),_0x1f0c96=new Map(),_0x4593d4=new Set(),_0xcb50dd=new Map(),_0x25e10c=new Map(),_0x979ef3=createJumpTargetCache();await withProgressSpinner(_0x4e31cc(0x166)+_0x354440+_0x4e31cc(0x137),async _0xf00f55=>{const _0x57287a=_0x4e31cc;for(const _0x2e1117 of _0x497d63){const _0x387a08=_0x497d63['length']>0x1?_0x2e1117['journeyBundleName']+'\x20v'+(_0x2e1117[_0x57287a(0x104)]||0x1):_0x2e1117[_0x57287a(0x136)];_0xf00f55[_0x57287a(0x101)]('Fetching\x20'+_0x387a08);const _0x36a618=await _0x554606[_0x57287a(0x15f)][_0x57287a(0x164)](_0x2e1117['id']),_0x4e4779=_0x36a618[_0x57287a(0x10a)]?.[_0x57287a(0x119)],_0x4dd827={'resolveSegment':async _0x4cdcf6=>{const _0x4d13f8=_0x57287a;if(!_0x4e4779)return{'name':_0x4cdcf6,'isJourneyLocal':![]};const _0x13dbd0=_0x2965ec['get'](_0x4cdcf6);if(_0x13dbd0)return _0x13dbd0;try{const _0x455da5=await _0x554606['segment'][_0x4d13f8(0x19a)](_0x4e4779,_0x4cdcf6),_0x1d1f6e=_0x455da5['kind']===SEGMENT_KIND_JOURNEY;let _0x143e5b,_0x346df1=_0x455da5[_0x4d13f8(0x191)];if(_0x1d1f6e&&_0x455da5[_0x4d13f8(0x107)]){const _0x3fd3e6=await segmentResponseToDef(_0x455da5,{'resolveSegmentName':async _0x429f6c=>{const _0x146424=_0x4d13f8,_0x2217d4=_0x2965ec[_0x146424(0x18b)](_0x429f6c);if(_0x2217d4)return _0x2217d4['name'];const _0x803d84=await _0x4dd827[_0x146424(0x19b)](_0x429f6c);return _0x803d84[_0x146424(0x191)];}}),_0x19b423=_0x3fd3e6['rule'];_0x143e5b={'description':_0x455da5[_0x4d13f8(0x1b8)],'rule':_0x19b423};const _0x5dcedf=serializeRule(_0x19b423),_0x16a0d0=_0x1f0c96[_0x4d13f8(0x18b)](_0x5dcedf);if(_0x16a0d0)_0x346df1=_0x16a0d0,_0x143e5b=undefined,_0x232ec8[_0x4d13f8(0x151)]&&console['error'](_0x4d13f8(0x189)+_0x455da5[_0x4d13f8(0x191)]+'\x20->\x20'+_0x16a0d0);else{let _0x5ca1d7=![];if(_0x18c46a){const _0x507b32=_0x18c46a[_0x4d13f8(0x18b)](_0x5dcedf);if(_0x507b32){const _0x1ba8fa=_0x507b32[_0x4d13f8(0x14e)](_0x5041c7=>!_0x4bd5da['has'](_0x5041c7));_0x1ba8fa&&(_0x346df1=_0x1ba8fa,_0x4bd5da['add'](_0x1ba8fa),_0x1f0c96[_0x4d13f8(0x12d)](_0x5dcedf,_0x1ba8fa),_0x5ca1d7=!![],_0x232ec8[_0x4d13f8(0x151)]&&console[_0x4d13f8(0x116)](_0x4d13f8(0x123)+_0x1ba8fa+_0x4d13f8(0xfc)));}}if(!_0x5ca1d7){const _0x213ed7=generateJourneyLocalName(_0x455da5[_0x4d13f8(0x191)]);_0x213ed7&&(_0x346df1=_0x213ed7);let _0x484221=_0x346df1,_0x195d9d=0x2;while(_0x4bd5da[_0x4d13f8(0x13c)](_0x484221)){_0x484221=_0x346df1+'_'+_0x195d9d,_0x195d9d++;}_0x4bd5da[_0x4d13f8(0x1c4)](_0x484221),_0x1f0c96['set'](_0x5dcedf,_0x484221),_0x346df1=_0x484221;}}}const _0x11b32b={'name':_0x346df1,'isJourneyLocal':_0x1d1f6e,'definition':_0x143e5b};return _0x2965ec[_0x4d13f8(0x12d)](_0x4cdcf6,_0x11b32b),_0x11b32b;}catch(_0x219836){return _0x348f0b[_0x4d13f8(0x151)]&&console[_0x4d13f8(0x116)](_0x4d13f8(0x18c)+_0x4cdcf6+':\x20'+_0x219836['message']),{'name':_0x4cdcf6,'isJourneyLocal':![]};}},'resolveActivation':async _0x463143=>{const _0xf7dccc=_0x57287a,_0x1a5a65=_0xcb50dd[_0xf7dccc(0x18b)](_0x463143);if(_0x1a5a65)return _0x1a5a65;try{const _0x42db14=await _0x554606[_0xf7dccc(0x15f)][_0xf7dccc(0x148)](_0x2e1117['id'],_0x463143),_0x256dc9=journeyActivationStepToYaml(_0x42db14,_0x21c1e2,_0x484ec7),_0x1446ad=JSON[_0xf7dccc(0x154)]({'name':_0x256dc9[_0xf7dccc(0x191)],'connection':_0x256dc9[_0xf7dccc(0x131)],'connector_config':_0x256dc9[_0xf7dccc(0x142)]}),_0x48d1cc=_0x25e10c[_0xf7dccc(0x18b)](_0x1446ad);if(_0x48d1cc){const _0x36a8cf={'name':_0x48d1cc,'isJourneyLocal':!![],'definition':_0x256dc9};return _0xcb50dd['set'](_0x463143,_0x36a8cf),_0x36a8cf;}const _0x48ff56=_0x42db14[_0xf7dccc(0x10a)][_0xf7dccc(0x1a4)][_0xf7dccc(0x191)]||_0x463143,_0x45ea67=sanitizeYamlKey(_0x48ff56)||_0xf7dccc(0x134)+_0x463143;let _0x5a067c=_0x45ea67,_0x3ee008=0x2;while(_0x4593d4['has'](_0x5a067c)){_0x5a067c=_0x45ea67+'_'+_0x3ee008,_0x3ee008++;}_0x4593d4['add'](_0x5a067c),_0x25e10c[_0xf7dccc(0x12d)](_0x1446ad,_0x5a067c);const _0x353f5b={'name':_0x5a067c,'isJourneyLocal':!![],'definition':_0x256dc9};return _0xcb50dd['set'](_0x463143,_0x353f5b),_0x353f5b;}catch(_0x15cf0a){return _0x348f0b[_0xf7dccc(0x151)]&&console[_0xf7dccc(0x116)](_0xf7dccc(0x187)+_0x463143+':\x20'+_0x15cf0a['message']),{'name':_0x463143,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x530756,_0x33973a)=>{const _0x5ea640=_0x57287a;return resolveJumpTarget(_0x530756,_0x33973a,_0x979ef3,_0xd0bce3=>_0x554606[_0x5ea640(0x15f)][_0x5ea640(0x164)](_0xd0bce3));}},_0x3ebdfd=await journeyResponseToDef(_0x36a618,_0x4dd827);_0xfed585[_0x57287a(0x152)]({'item':_0x2e1117,'yaml':_0x3ebdfd});}},{'verbose':_0x348f0b[_0x4e31cc(0x151)]});const _0x4ecf1d=buildMergedJourneyDef(_0xfed585,_0x18c46a),_0x24e510=normalizeJourneyDef(_0x4ecf1d,_0x2ea9a2),_0x1c06bf=toYamlString(_0x24e510),_0x5e3e92=_0x5ec722||a18_0x3bf54e[_0x4e31cc(0x11c)](_0x4d2e76,sanitizeFileName(_0x354440)+'.yml');!_0x5ec722&&_0x5e1c8e&&!existsSync(_0x4d2e76)&&mkdirSync(_0x4d2e76,{'recursive':!![]});const _0x1e0dbc=a18_0x3bf54e[_0x4e31cc(0x112)](process[_0x4e31cc(0x127)](),_0x5e3e92);if(existsSync(_0x5e3e92)){const _0x54cfdc=readFileSync(_0x5e3e92,_0x4e31cc(0x162)),_0x16ff4e=generateDiff(_0x54cfdc,_0x1c06bf),_0x250c23=hasChanges(_0x16ff4e);_0x5f56ec[_0x4e31cc(0x152)]({'relativePath':_0x1e0dbc,'absolutePath':_0x5e3e92,'content':_0x1c06bf,'isNew':![],'hasChanges':_0x250c23,'diff':_0x250c23?formatDiffWithColors(_0x16ff4e):undefined});}else _0x5f56ec['push']({'relativePath':_0x1e0dbc,'absolutePath':_0x5e3e92,'content':_0x1c06bf,'isNew':!![],'hasChanges':![]});}const _0xb5e510=_0x5f56ec[_0x4e31cc(0x1a8)](_0x8a502f=>_0x8a502f[_0x4e31cc(0x144)]),_0x496c51=_0x5f56ec[_0x4e31cc(0x1a8)](_0x1f7001=>!_0x1f7001[_0x4e31cc(0x144)]&&_0x1f7001[_0x4e31cc(0x108)]),_0x35eb33=_0x5f56ec[_0x4e31cc(0x1a8)](_0xf0f0c5=>!_0xf0f0c5[_0x4e31cc(0x144)]&&!_0xf0f0c5['hasChanges']),_0x2a295a=_0x2a1ac9[_0x4e31cc(0x16c)],_0x49be2e=_0x121bd9[_0x4e31cc(0x125)],_0x5e4e26=_0x2a295a>_0x49be2e?'\x20('+_0x2a295a+_0x4e31cc(0x167):'';console['error'](_0x4e31cc(0x159)),console['error']('\x20\x20'+a18_0x27c2c4['cyan'](_0x49be2e+_0x4e31cc(0x146))+a18_0x27c2c4[_0x4e31cc(0x194)](_0x5e4e26)),console[_0x4e31cc(0x116)]('\x20\x20'+a18_0x27c2c4[_0x4e31cc(0x190)]('+\x20'+_0xb5e510[_0x4e31cc(0x16c)]+_0x4e31cc(0x115))),console[_0x4e31cc(0x116)]('\x20\x20'+a18_0x27c2c4[_0x4e31cc(0x103)]('~\x20'+_0x496c51[_0x4e31cc(0x16c)]+'\x20changed\x20files')),console[_0x4e31cc(0x116)]('\x20\x20'+a18_0x27c2c4['dim']('=\x20'+_0x35eb33[_0x4e31cc(0x16c)]+_0x4e31cc(0x16f))),console[_0x4e31cc(0x116)](_0x4e31cc(0x1ae)+a18_0x27c2c4['cyan'](_0x43a17b)+'\x0a');if(_0x496c51[_0x4e31cc(0x16c)]>0x0)for(const _0x233a83 of _0x496c51){console[_0x4e31cc(0x116)]('\x0aChanges\x20to\x20\x27'+_0x233a83[_0x4e31cc(0x14c)]+'\x27:'),console[_0x4e31cc(0x116)]('─'[_0x4e31cc(0x18f)](0x3c)),console[_0x4e31cc(0x116)](_0x233a83[_0x4e31cc(0x14a)]),console['error']('─'[_0x4e31cc(0x18f)](0x3c));}if(_0x232ec8[_0x4e31cc(0x165)])return console[_0x4e31cc(0x116)](a18_0x27c2c4[_0x4e31cc(0x103)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0xb5e510[_0x4e31cc(0x16c)]===0x0&&_0x496c51[_0x4e31cc(0x16c)]===0x0)return console[_0x4e31cc(0x116)](a18_0x27c2c4['green'](_0x4e31cc(0x10c))),saveSessionContext({'parent_segment':_0x1b7161},_0x232ec8['session']),console['error'](a18_0x27c2c4[_0x4e31cc(0x190)](_0x4e31cc(0x1bf)+a18_0x27c2c4[_0x4e31cc(0x194)]('parent_segment')+_0x4e31cc(0x16e)+a18_0x27c2c4['cyan'](_0x1b7161))),0x0;if(!_0x232ec8[_0x4e31cc(0x122)]&&(_0xb5e510['length']>0x0||_0x496c51[_0x4e31cc(0x16c)]>0x0)){const _0x165773=await confirmKey(_0x4e31cc(0x117)+(_0xb5e510[_0x4e31cc(0x16c)]+_0x496c51[_0x4e31cc(0x16c)])+_0x4e31cc(0x181));if(!_0x165773)return console[_0x4e31cc(0x116)](_0x4e31cc(0x163)),0x1;}!existsSync(_0x43a17b)&&mkdirSync(_0x43a17b,{'recursive':!![]});for(const _0x273804 of _0x5f56ec){(_0x273804['isNew']||_0x273804[_0x4e31cc(0x108)])&&writeFileSync(_0x273804['absolutePath'],_0x273804[_0x4e31cc(0x11a)],_0x4e31cc(0x162));}return console[_0x4e31cc(0x116)](a18_0x27c2c4['green'](_0x4e31cc(0x15b)+(_0xb5e510['length']+_0x496c51['length'])+_0x4e31cc(0x17d)+_0x43a17b)),saveSessionContext({'parent_segment':_0x1b7161},_0x232ec8[_0x4e31cc(0xfb)]),console[_0x4e31cc(0x116)](a18_0x27c2c4['green']('✔\x20Context\x20set:\x20'+a18_0x27c2c4[_0x4e31cc(0x194)](_0x4e31cc(0x19f))+_0x4e31cc(0x16e)+a18_0x27c2c4[_0x4e31cc(0x1c7)](_0x1b7161))),0x0;}}export class JourneyPushCommand extends BaseCommand{['name']=a18_0x1cfbec(0x1c3);[a18_0x1cfbec(0x1b8)]=a18_0x1cfbec(0x105);[a18_0x1cfbec(0x135)]=new SegmentPushCommand();async['execute'](_0x3b6f8f){const _0x127521=a18_0x1cfbec,_0x2b2a2c=_0x3b6f8f['args'][0x0];let _0x1050e5;if(_0x2b2a2c){const _0x56bb97=await resolveTarget({'arg':_0x2b2a2c,'contextParent':_0x3b6f8f['options']['parentSegment'],'cwd':process[_0x127521(0x127)]()});isSuccessfulResolution(_0x56bb97)&&_0x56bb97[_0x127521(0x1a9)]==='file'&&(_0x1050e5=_0x56bb97[_0x127521(0x195)]);}const _0x33f2ed={..._0x3b6f8f,'options':{..._0x3b6f8f['options'],'journeysOnly':!![],..._0x1050e5&&{'singleFilePath':_0x1050e5}}};return this[_0x127521(0x135)]['execute'](_0x33f2ed);}}
@@ -1 +1 @@
1
- const a19_0x1a641b=a19_0x291a;(function(_0x3d527d,_0x3000d8){const _0x189c8c=a19_0x291a,_0x30337c=_0x3d527d();while(!![]){try{const _0x4c311b=parseInt(_0x189c8c(0xa6))/0x1*(-parseInt(_0x189c8c(0xc6))/0x2)+parseInt(_0x189c8c(0xaf))/0x3+-parseInt(_0x189c8c(0xaa))/0x4*(-parseInt(_0x189c8c(0x9d))/0x5)+-parseInt(_0x189c8c(0x8d))/0x6+-parseInt(_0x189c8c(0xa0))/0x7+-parseInt(_0x189c8c(0x98))/0x8+parseInt(_0x189c8c(0xc4))/0x9;if(_0x4c311b===_0x3000d8)break;else _0x30337c['push'](_0x30337c['shift']());}catch(_0x34827e){_0x30337c['push'](_0x30337c['shift']());}}}(a19_0x1275,0x3962c));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';function a19_0x1275(){const _0x3ea15b=['error','length','green','filter','skippedCount','type','6270336ctvXBB','validCount','42062OKjrvx','reason','2699298NDWHOe','journey','description','warningCount','errorCode','execute','Error:\x20','✔\x20All\x20','dim','hasErrors','warnings','611752yBAKNE','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','Error:\x20Directory\x20not\x20found:\x20','no_parent','\x20segment\x20file(s)\x20skipped','5BfiEay','\x20segment\x20file(s)\x20skipped)','\x20(skipped:\x20','1496425TazvtB','file','.yaml','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','verbose','errors','7KEzutc','filePath','\x20journey(s)\x20valid','log','763004MuvOVY','cwd','yellow','Validate\x20journey\x20YAML\x20files','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','704823RPWUvt','\x20warning(s)\x20found','journey:validate','red','\x20valid','\x20warning(s)','cyan','helpText','endsWith','parentSegment','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','No\x20journey\x20YAML\x20files\x20found\x20in\x20','Validation\x20failed:\x20','targetDir','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file'];a19_0x1275=function(){return _0x3ea15b;};return a19_0x1275();}import a19_0x544099 from'chalk';function a19_0x291a(_0x2e977f,_0xbae8e1){_0x2e977f=_0x2e977f-0x8d;const _0x12757c=a19_0x1275();let _0x291a24=_0x12757c[_0x2e977f];return _0x291a24;}import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{['name']=a19_0x1a641b(0xb1);[a19_0x1a641b(0x8f)]=a19_0x1a641b(0xad);async[a19_0x1a641b(0x92)](_0x208cad){const _0x14c2f8=a19_0x1a641b,{options:_0x4c3a17,args:_0x3141ae}=_0x208cad,_0x2b614f=_0x4c3a17,_0x32406e=await resolveTarget({'arg':_0x3141ae[0x0],'contextParent':_0x4c3a17[_0x14c2f8(0xb8)],'cwd':process[_0x14c2f8(0xab)]()});if(!isSuccessfulResolution(_0x32406e))return _0x32406e[_0x14c2f8(0x91)]===_0x14c2f8(0x9b)?(console[_0x14c2f8(0xbe)](a19_0x544099[_0x14c2f8(0xac)](_0x14c2f8(0xb9))),console[_0x14c2f8(0xbe)](_0x14c2f8(0xa3)),console[_0x14c2f8(0xbe)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory'),console[_0x14c2f8(0xbe)](_0x14c2f8(0xbd))):(console[_0x14c2f8(0xbe)](a19_0x544099['red'](_0x14c2f8(0x93)+_0x32406e['message']+'\x0a')),_0x32406e[_0x14c2f8(0xb6)]&&console[_0x14c2f8(0xbe)](a19_0x544099[_0x14c2f8(0xb5)](_0x32406e[_0x14c2f8(0xb6)]))),0x1;const _0x52e961=_0x32406e[_0x14c2f8(0xbc)],_0x42fa32=_0x32406e[_0x14c2f8(0xc3)]===_0x14c2f8(0xa1)?_0x32406e[_0x14c2f8(0xa7)]:undefined;if(!_0x42fa32&&!existsSync(_0x52e961))return console[_0x14c2f8(0xbe)](a19_0x544099['red'](_0x14c2f8(0x9a)+_0x52e961+'\x0a')),0x1;let _0x4d201a;if(_0x42fa32){if(!_0x42fa32[_0x14c2f8(0xb7)]('.yml')&&!_0x42fa32[_0x14c2f8(0xb7)](_0x14c2f8(0xa2)))return console['error'](a19_0x544099[_0x14c2f8(0xb2)](_0x14c2f8(0x99)+_0x42fa32+'\x0a')),0x1;_0x4d201a=[_0x42fa32];}else _0x4d201a=findYamlFiles(_0x52e961);if(_0x4d201a['length']===0x0)return console['error'](a19_0x544099[_0x14c2f8(0xb2)](_0x14c2f8(0xae)+_0x52e961+'\x0a')),0x1;const _0x279c79=validateYamlFiles(_0x4d201a,_0x52e961,{'filterType':_0x14c2f8(0x8e)}),_0x14d853=calculateSummary(_0x279c79),_0x1f740c=_0x279c79[_0x14c2f8(0xc1)](isValidationResult);if(_0x1f740c[_0x14c2f8(0xbf)]===0x0)return console[_0x14c2f8(0xbe)](a19_0x544099['yellow'](_0x14c2f8(0xba)+_0x52e961+'\x0a')),_0x14d853[_0x14c2f8(0xc2)]>0x0&&console[_0x14c2f8(0xbe)](a19_0x544099[_0x14c2f8(0x95)]('('+_0x14d853['skippedCount']+_0x14c2f8(0x9e))),0x0;for(const _0x37465e of _0x279c79){if(!isValidationResult(_0x37465e)){_0x2b614f[_0x14c2f8(0xa4)]&&console[_0x14c2f8(0xa9)](a19_0x544099[_0x14c2f8(0x95)]('-\x20'+_0x37465e['relativePath']+_0x14c2f8(0x9f)+_0x37465e[_0x14c2f8(0xc7)]+')'));continue;}const {relativePath:_0x44a629,source:_0x18fa31,result:_0x530db4}=_0x37465e;if(_0x530db4['valid']&&_0x530db4[_0x14c2f8(0x97)][_0x14c2f8(0xbf)]===0x0)_0x2b614f['verbose']&&console[_0x14c2f8(0xa9)](a19_0x544099[_0x14c2f8(0xc0)]('✔\x20'+_0x44a629));else _0x530db4['valid']?(console[_0x14c2f8(0xa9)](a19_0x544099[_0x14c2f8(0xac)]('⚠\x20'+_0x44a629+':\x20'+_0x530db4[_0x14c2f8(0x97)][_0x14c2f8(0xbf)]+_0x14c2f8(0xb4))),console['log'](formatValidationResult(_0x530db4,_0x18fa31,_0x44a629))):(console[_0x14c2f8(0xa9)](a19_0x544099[_0x14c2f8(0xb2)]('✖\x20'+_0x44a629+':\x20'+_0x530db4[_0x14c2f8(0xa5)]['length']+'\x20error(s)')),console['log'](formatValidationResult(_0x530db4,_0x18fa31,_0x44a629)));}return console[_0x14c2f8(0xa9)](''),_0x14d853[_0x14c2f8(0x96)]?(console[_0x14c2f8(0xa9)](a19_0x544099[_0x14c2f8(0xb2)](_0x14c2f8(0xbb)+_0x14d853['invalidCount']+'\x20journey(s)\x20with\x20errors,\x20'+_0x14d853['validCount']+_0x14c2f8(0xb3))),_0x14d853[_0x14c2f8(0x90)]>0x0&&console['log'](a19_0x544099['yellow'](_0x14d853[_0x14c2f8(0x90)]+'\x20warning(s)\x20found')),_0x14d853['skippedCount']>0x0&&console[_0x14c2f8(0xa9)](a19_0x544099[_0x14c2f8(0x95)](_0x14d853['skippedCount']+_0x14c2f8(0x9c))),0x1):(console[_0x14c2f8(0xa9)](a19_0x544099[_0x14c2f8(0xc0)](_0x14c2f8(0x94)+_0x14d853[_0x14c2f8(0xc5)]+_0x14c2f8(0xa8))),_0x14d853[_0x14c2f8(0x90)]>0x0&&console[_0x14c2f8(0xa9)](a19_0x544099[_0x14c2f8(0xac)](_0x14d853[_0x14c2f8(0x90)]+_0x14c2f8(0xb0))),_0x14d853[_0x14c2f8(0xc2)]>0x0&&console[_0x14c2f8(0xa9)](a19_0x544099['dim'](_0x14d853[_0x14c2f8(0xc2)]+_0x14c2f8(0x9c))),0x0);}}
1
+ const a19_0x443210=a19_0x4eb4;(function(_0x332eb3,_0x527466){const _0x12b2e3=a19_0x4eb4,_0x1511f0=_0x332eb3();while(!![]){try{const _0x19180c=-parseInt(_0x12b2e3(0xa3))/0x1+parseInt(_0x12b2e3(0x9a))/0x2*(-parseInt(_0x12b2e3(0x80))/0x3)+-parseInt(_0x12b2e3(0x8b))/0x4*(-parseInt(_0x12b2e3(0x89))/0x5)+-parseInt(_0x12b2e3(0xa8))/0x6+-parseInt(_0x12b2e3(0x93))/0x7*(parseInt(_0x12b2e3(0x99))/0x8)+-parseInt(_0x12b2e3(0x84))/0x9+parseInt(_0x12b2e3(0x9e))/0xa;if(_0x19180c===_0x527466)break;else _0x1511f0['push'](_0x1511f0['shift']());}catch(_0x124e84){_0x1511f0['push'](_0x1511f0['shift']());}}}(a19_0x22a3,0xadd90));import{BaseCommand}from'./command.js';function a19_0x4eb4(_0x3f7eb1,_0x220f33){_0x3f7eb1=_0x3f7eb1-0x80;const _0x22a396=a19_0x22a3();let _0x4eb462=_0x22a396[_0x3f7eb1];return _0x4eb462;}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a19_0x22a3(){const _0x3b2f9a=['\x20warning(s)','\x20error(s)','green','length','\x20journey(s)\x20with\x20errors,\x20','14nkXtBE','✔\x20All\x20','\x20valid','skippedCount','Validation\x20failed:\x20','parentSegment','2542056UdekYd','18WAdzBQ','Error:\x20','no_parent','helpText','19952890ckEptJ','.yml','\x20segment\x20file(s)\x20skipped','dim','\x20segment\x20file(s)\x20skipped)','538284GcdXNG','description','errorCode','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','warnings','903108sakILT','filePath','execute','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','name','warningCount','\x20journey(s)\x20valid','hasErrors','targetDir','errors','Error:\x20Directory\x20not\x20found:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','message','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','filter','375213BfhVCx','endsWith','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','file','1833633ZWflaw','error','validCount','red','log','5NJBDCb','yellow','5481932QjRrMO','journey:validate','\x20warning(s)\x20found'];a19_0x22a3=function(){return _0x3b2f9a;};return a19_0x22a3();}import{existsSync}from'fs';import a19_0x34f16b from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a19_0x443210(0xac)]=a19_0x443210(0x8c);[a19_0x443210(0xa4)]='Validate\x20journey\x20YAML\x20files';async[a19_0x443210(0xaa)](_0x38ac24){const _0x15e15a=a19_0x443210,{options:_0x5d5778,args:_0x3ef79b}=_0x38ac24,_0xcef47c=_0x5d5778,_0x13cf08=await resolveTarget({'arg':_0x3ef79b[0x0],'contextParent':_0x5d5778[_0x15e15a(0x98)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x13cf08))return _0x13cf08[_0x15e15a(0xa5)]===_0x15e15a(0x9c)?(console[_0x15e15a(0x85)](a19_0x34f16b[_0x15e15a(0x8a)](_0x15e15a(0xb3))),console[_0x15e15a(0x85)]('Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)'),console[_0x15e15a(0x85)](_0x15e15a(0xa6)),console['error'](_0x15e15a(0xab))):(console['error'](a19_0x34f16b[_0x15e15a(0x87)](_0x15e15a(0x9b)+_0x13cf08[_0x15e15a(0xb4)]+'\x0a')),_0x13cf08['helpText']&&console[_0x15e15a(0x85)](a19_0x34f16b['cyan'](_0x13cf08[_0x15e15a(0x9d)]))),0x1;const _0x54d857=_0x13cf08[_0x15e15a(0xb0)],_0x43a25b=_0x13cf08['type']===_0x15e15a(0x83)?_0x13cf08[_0x15e15a(0xa9)]:undefined;if(!_0x43a25b&&!existsSync(_0x54d857))return console[_0x15e15a(0x85)](a19_0x34f16b[_0x15e15a(0x87)](_0x15e15a(0xb2)+_0x54d857+'\x0a')),0x1;let _0x308308;if(_0x43a25b){if(!_0x43a25b[_0x15e15a(0x81)](_0x15e15a(0x9f))&&!_0x43a25b[_0x15e15a(0x81)]('.yaml'))return console['error'](a19_0x34f16b[_0x15e15a(0x87)](_0x15e15a(0x82)+_0x43a25b+'\x0a')),0x1;_0x308308=[_0x43a25b];}else _0x308308=findYamlFiles(_0x54d857);if(_0x308308['length']===0x0)return console[_0x15e15a(0x85)](a19_0x34f16b[_0x15e15a(0x87)](_0x15e15a(0xb5)+_0x54d857+'\x0a')),0x1;const _0x4e8c36=validateYamlFiles(_0x308308,_0x54d857,{'filterType':'journey'}),_0x1bb7cb=calculateSummary(_0x4e8c36),_0x29e825=_0x4e8c36[_0x15e15a(0xb6)](isValidationResult);if(_0x29e825['length']===0x0)return console[_0x15e15a(0x85)](a19_0x34f16b[_0x15e15a(0x8a)]('No\x20journey\x20YAML\x20files\x20found\x20in\x20'+_0x54d857+'\x0a')),_0x1bb7cb[_0x15e15a(0x96)]>0x0&&console[_0x15e15a(0x85)](a19_0x34f16b['dim']('('+_0x1bb7cb[_0x15e15a(0x96)]+_0x15e15a(0xa2))),0x0;for(const _0x2a8aec of _0x4e8c36){if(!isValidationResult(_0x2a8aec)){_0xcef47c['verbose']&&console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0xa1)]('-\x20'+_0x2a8aec['relativePath']+'\x20(skipped:\x20'+_0x2a8aec['reason']+')'));continue;}const {relativePath:_0x2c5718,source:_0x255b07,result:_0x2df3de}=_0x2a8aec;if(_0x2df3de['valid']&&_0x2df3de[_0x15e15a(0xa7)]['length']===0x0)_0xcef47c['verbose']&&console['log'](a19_0x34f16b[_0x15e15a(0x90)]('✔\x20'+_0x2c5718));else _0x2df3de['valid']?(console['log'](a19_0x34f16b['yellow']('⚠\x20'+_0x2c5718+':\x20'+_0x2df3de[_0x15e15a(0xa7)][_0x15e15a(0x91)]+_0x15e15a(0x8e))),console['log'](formatValidationResult(_0x2df3de,_0x255b07,_0x2c5718))):(console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0x87)]('✖\x20'+_0x2c5718+':\x20'+_0x2df3de[_0x15e15a(0xb1)][_0x15e15a(0x91)]+_0x15e15a(0x8f))),console['log'](formatValidationResult(_0x2df3de,_0x255b07,_0x2c5718)));}return console['log'](''),_0x1bb7cb[_0x15e15a(0xaf)]?(console[_0x15e15a(0x88)](a19_0x34f16b['red'](_0x15e15a(0x97)+_0x1bb7cb['invalidCount']+_0x15e15a(0x92)+_0x1bb7cb[_0x15e15a(0x86)]+_0x15e15a(0x95))),_0x1bb7cb['warningCount']>0x0&&console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0x8a)](_0x1bb7cb[_0x15e15a(0xad)]+_0x15e15a(0x8d))),_0x1bb7cb[_0x15e15a(0x96)]>0x0&&console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0xa1)](_0x1bb7cb[_0x15e15a(0x96)]+_0x15e15a(0xa0))),0x1):(console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0x90)](_0x15e15a(0x94)+_0x1bb7cb[_0x15e15a(0x86)]+_0x15e15a(0xae))),_0x1bb7cb[_0x15e15a(0xad)]>0x0&&console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0x8a)](_0x1bb7cb[_0x15e15a(0xad)]+_0x15e15a(0x8d))),_0x1bb7cb['skippedCount']>0x0&&console[_0x15e15a(0x88)](a19_0x34f16b[_0x15e15a(0xa1)](_0x1bb7cb[_0x15e15a(0x96)]+_0x15e15a(0xa0))),0x0);}}