@treasuredata/tdx 2026.3.48 → 2026.3.49

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 (255) 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.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.d.ts +22 -0
  12. package/dist/commands/auth-command.d.ts.map +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/auth-command.js.map +1 -1
  15. package/dist/commands/cas-command.js +1 -1
  16. package/dist/commands/cas-segment-command.js +1 -1
  17. package/dist/commands/chat-command.js +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/claude-statusline-command.js +1 -1
  20. package/dist/commands/claude-usage-command.js +1 -1
  21. package/dist/commands/command.js +1 -1
  22. package/dist/commands/connection-command.js +1 -1
  23. package/dist/commands/databases.js +1 -1
  24. package/dist/commands/delivery-command.js +1 -1
  25. package/dist/commands/describe.js +1 -1
  26. package/dist/commands/engage-campaign-pull-command.js +1 -1
  27. package/dist/commands/engage-campaign-push-command.js +1 -1
  28. package/dist/commands/engage-campaign-validate-command.js +1 -1
  29. package/dist/commands/engage-command.js +1 -1
  30. package/dist/commands/engage-template-pull-command.js +1 -1
  31. package/dist/commands/engage-template-push-command.js +1 -1
  32. package/dist/commands/engage-template-validate-command.js +1 -1
  33. package/dist/commands/job-command.js +1 -1
  34. package/dist/commands/journey-command.js +1 -1
  35. package/dist/commands/journey-validate-command.js +1 -1
  36. package/dist/commands/llm-command.js +1 -1
  37. package/dist/commands/mcp-command.js +1 -1
  38. package/dist/commands/parent-segment-command.js +1 -1
  39. package/dist/commands/policy-command.js +1 -1
  40. package/dist/commands/profile-command.d.ts +5 -5
  41. package/dist/commands/profile-command.d.ts.map +1 -1
  42. package/dist/commands/profile-command.js +1 -1
  43. package/dist/commands/profile-command.js.map +1 -1
  44. package/dist/commands/profiles-command.js +1 -1
  45. package/dist/commands/query-command.js +1 -1
  46. package/dist/commands/schedule-command.js +1 -1
  47. package/dist/commands/segment-command.js +1 -1
  48. package/dist/commands/segment-create-command.js +1 -1
  49. package/dist/commands/segment-fields-command.js +1 -1
  50. package/dist/commands/segment-pull-command.js +1 -1
  51. package/dist/commands/segment-push-command.js +1 -1
  52. package/dist/commands/segment-update-command.js +1 -1
  53. package/dist/commands/segment-use-command.js +1 -1
  54. package/dist/commands/segment-validate-command.js +1 -1
  55. package/dist/commands/segments.js +1 -1
  56. package/dist/commands/show.js +1 -1
  57. package/dist/commands/status-command.js +1 -1
  58. package/dist/commands/tables.js +1 -1
  59. package/dist/commands/unset-command.js +1 -1
  60. package/dist/commands/upgrade-command.js +1 -1
  61. package/dist/commands/use-command.js +1 -1
  62. package/dist/commands/user-command.js +1 -1
  63. package/dist/commands/work-command.js +1 -1
  64. package/dist/commands/workflow-command.js +1 -1
  65. package/dist/core/auth.js +1 -1
  66. package/dist/core/command-output.js +1 -1
  67. package/dist/core/config.js +1 -1
  68. package/dist/core/connection-cache.js +1 -1
  69. package/dist/core/constants.js +1 -1
  70. package/dist/core/credential-cache.js +1 -1
  71. package/dist/core/global-context.js +1 -1
  72. package/dist/core/keychain.js +1 -1
  73. package/dist/core/oauth-keychain.js +1 -1
  74. package/dist/core/oauth.d.ts +12 -8
  75. package/dist/core/oauth.d.ts.map +1 -1
  76. package/dist/core/oauth.js +1 -1
  77. package/dist/core/oauth.js.map +1 -1
  78. package/dist/core/profile.js +1 -1
  79. package/dist/core/project-config.js +1 -1
  80. package/dist/core/session.js +1 -1
  81. package/dist/core/user-cache.js +1 -1
  82. package/dist/core/version.js +1 -1
  83. package/dist/index.js +1 -1
  84. package/dist/mcp/server.js +1 -1
  85. package/dist/mcp/tools/index.js +1 -1
  86. package/dist/mcp/tools/tdx-run.js +1 -1
  87. package/dist/mcp/tools/tdx-search.js +1 -1
  88. package/dist/mcp/utils.d.ts.map +1 -1
  89. package/dist/mcp/utils.js +1 -1
  90. package/dist/mcp/utils.js.map +1 -1
  91. package/dist/proxy/claude-usage-tracker.js +1 -1
  92. package/dist/proxy/passthrough-server.js +1 -1
  93. package/dist/proxy/sse-usage-parser.js +1 -1
  94. package/dist/sdk/agent/agent-config.js +1 -1
  95. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  96. package/dist/sdk/agent/agent-yaml.js +1 -1
  97. package/dist/sdk/agent/test/evaluator.js +1 -1
  98. package/dist/sdk/agent/test/executor.js +1 -1
  99. package/dist/sdk/agent/test/index.js +1 -1
  100. package/dist/sdk/agent/test/output.js +1 -1
  101. package/dist/sdk/agent/test/parser.js +1 -1
  102. package/dist/sdk/agent/tool-target-registry.js +1 -1
  103. package/dist/sdk/api.js +1 -1
  104. package/dist/sdk/cas/cas-api-client.js +1 -1
  105. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  106. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  107. package/dist/sdk/cas/index.js +1 -1
  108. package/dist/sdk/cas/pull-workflow.js +1 -1
  109. package/dist/sdk/cas/push-workflow.js +1 -1
  110. package/dist/sdk/client/cdp-api-client.js +1 -1
  111. package/dist/sdk/client/delivery-api-client.js +1 -1
  112. package/dist/sdk/client/endpoints.js +1 -1
  113. package/dist/sdk/client/engage-api-client.js +1 -1
  114. package/dist/sdk/client/http-client.js +1 -1
  115. package/dist/sdk/client/llm-api-client.js +1 -1
  116. package/dist/sdk/client/oauth-refresh.js +1 -1
  117. package/dist/sdk/client/rate-limiter.js +1 -1
  118. package/dist/sdk/client/td-api-client.js +1 -1
  119. package/dist/sdk/client/trino-api-client.js +1 -1
  120. package/dist/sdk/client/workflow-client.js +1 -1
  121. package/dist/sdk/connection-validator.js +1 -1
  122. package/dist/sdk/connection.js +1 -1
  123. package/dist/sdk/delivery.js +1 -1
  124. package/dist/sdk/engage/campaign-pull.js +1 -1
  125. package/dist/sdk/engage/campaign-push.js +1 -1
  126. package/dist/sdk/engage/campaign-validator.js +1 -1
  127. package/dist/sdk/engage/campaign-yaml.js +1 -1
  128. package/dist/sdk/engage/template-pull.js +1 -1
  129. package/dist/sdk/engage/template-push.js +1 -1
  130. package/dist/sdk/engage/template-validator.js +1 -1
  131. package/dist/sdk/engage/template-yaml.js +1 -1
  132. package/dist/sdk/engage/types/campaign-def.js +1 -1
  133. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  134. package/dist/sdk/engage/types/template-schema.js +1 -1
  135. package/dist/sdk/engage.js +1 -1
  136. package/dist/sdk/errors.js +1 -1
  137. package/dist/sdk/index.js +1 -1
  138. package/dist/sdk/io/index.js +1 -1
  139. package/dist/sdk/io/node-filesystem.js +1 -1
  140. package/dist/sdk/job.js +1 -1
  141. package/dist/sdk/journey.js +1 -1
  142. package/dist/sdk/llm/chat-cache.js +1 -1
  143. package/dist/sdk/llm/index.js +1 -1
  144. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  145. package/dist/sdk/llm/model-factors.js +1 -1
  146. package/dist/sdk/personalization.js +1 -1
  147. package/dist/sdk/policy.js +1 -1
  148. package/dist/sdk/query/index.js +1 -1
  149. package/dist/sdk/query/sql-parser.js +1 -1
  150. package/dist/sdk/realtime.js +1 -1
  151. package/dist/sdk/schedule.js +1 -1
  152. package/dist/sdk/segment/child-segment-yaml.d.ts +8 -0
  153. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  154. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  155. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  156. package/dist/sdk/segment/fields-display.js +1 -1
  157. package/dist/sdk/segment/file-discovery.js +1 -1
  158. package/dist/sdk/segment/journey-utils.js +1 -1
  159. package/dist/sdk/segment/journey-validator.js +1 -1
  160. package/dist/sdk/segment/journey-yaml.js +1 -1
  161. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  162. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  163. package/dist/sdk/segment/pull-workflow.js +1 -1
  164. package/dist/sdk/segment/push-recovery.js +1 -1
  165. package/dist/sdk/segment/push-workflow.js +1 -1
  166. package/dist/sdk/segment/resolution-context.js +1 -1
  167. package/dist/sdk/segment/segment-path-parser.js +1 -1
  168. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  169. package/dist/sdk/segment/segment-validator.js +1 -1
  170. package/dist/sdk/segment/target-resolution.js +1 -1
  171. package/dist/sdk/segment/tdx-config.js +1 -1
  172. package/dist/sdk/segment/types/activation-schema.js +1 -1
  173. package/dist/sdk/segment/types/journey-def.js +1 -1
  174. package/dist/sdk/segment/types/journey-schema.js +1 -1
  175. package/dist/sdk/segment/types/segment-def.js +1 -1
  176. package/dist/sdk/segment/types/segment-schema.js +1 -1
  177. package/dist/sdk/segment/validate-files.js +1 -1
  178. package/dist/sdk/segment/yaml-validator.js +1 -1
  179. package/dist/sdk/segment.js +1 -1
  180. package/dist/sdk/types/index.d.ts +1 -1
  181. package/dist/sdk/types/index.d.ts.map +1 -1
  182. package/dist/sdk/types/index.js +1 -1
  183. package/dist/sdk/types/index.js.map +1 -1
  184. package/dist/sdk/types/progress.js +1 -1
  185. package/dist/sdk/types/workspace.d.ts +29 -0
  186. package/dist/sdk/types/workspace.d.ts.map +1 -1
  187. package/dist/sdk/types/workspace.js +1 -1
  188. package/dist/sdk/user.js +1 -1
  189. package/dist/sdk/util/format-detector.js +1 -1
  190. package/dist/sdk/util/formatters.js +1 -1
  191. package/dist/sdk/util/index.js +1 -1
  192. package/dist/sdk/util/paginate.js +1 -1
  193. package/dist/sdk/util/tree-formatter.js +1 -1
  194. package/dist/sdk/workflow/archive-validation.js +1 -1
  195. package/dist/sdk/workflow/clone-workflow.js +1 -1
  196. package/dist/sdk/workflow/index.js +1 -1
  197. package/dist/sdk/workflow/pull-workflow.js +1 -1
  198. package/dist/sdk/workflow/push-workflow.js +1 -1
  199. package/dist/sdk/workflow/tdx-config.js +1 -1
  200. package/dist/sdk/workflow/workflow-utils.js +1 -1
  201. package/dist/sdk/workspace/frontmatter.js +1 -1
  202. package/dist/sdk/workspace/git.d.ts +4 -1
  203. package/dist/sdk/workspace/git.d.ts.map +1 -1
  204. package/dist/sdk/workspace/git.js +1 -1
  205. package/dist/sdk/workspace/git.js.map +1 -1
  206. package/dist/sdk/workspace/index.d.ts +8 -15
  207. package/dist/sdk/workspace/index.d.ts.map +1 -1
  208. package/dist/sdk/workspace/index.js +1 -1
  209. package/dist/sdk/workspace/index.js.map +1 -1
  210. package/dist/sdk/workspace/templates.js +1 -1
  211. package/dist/sdk/workspace/weekly.d.ts +3 -13
  212. package/dist/sdk/workspace/weekly.d.ts.map +1 -1
  213. package/dist/sdk/workspace/weekly.js +1 -1
  214. package/dist/sdk/workspace/weekly.js.map +1 -1
  215. package/dist/sdk/workspace/wikilinks.d.ts +15 -0
  216. package/dist/sdk/workspace/wikilinks.d.ts.map +1 -1
  217. package/dist/sdk/workspace/wikilinks.js +1 -1
  218. package/dist/sdk/workspace/wikilinks.js.map +1 -1
  219. package/dist/test-utils/command-runner.js +1 -1
  220. package/dist/test-utils/factories.js +1 -1
  221. package/dist/test-utils/fixtures.js +1 -1
  222. package/dist/test-utils/http-mock.js +1 -1
  223. package/dist/test-utils/index.js +1 -1
  224. package/dist/utils/async.js +1 -1
  225. package/dist/utils/colors.js +1 -1
  226. package/dist/utils/diff.js +1 -1
  227. package/dist/utils/file-permissions.js +1 -1
  228. package/dist/utils/file-reader.js +1 -1
  229. package/dist/utils/github-releases.js +1 -1
  230. package/dist/utils/global-cache.js +1 -1
  231. package/dist/utils/json-loader.js +1 -1
  232. package/dist/utils/local-cache.js +1 -1
  233. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  234. package/dist/utils/logger/formatters/index.js +1 -1
  235. package/dist/utils/logger/handlers/console-handler.js +1 -1
  236. package/dist/utils/logger/handlers/file-handler.js +1 -1
  237. package/dist/utils/logger/handlers/index.js +1 -1
  238. package/dist/utils/logger/handlers/null-handler.js +1 -1
  239. package/dist/utils/logger/index.js +1 -1
  240. package/dist/utils/logger/logger.js +1 -1
  241. package/dist/utils/logger/types.js +1 -1
  242. package/dist/utils/option-validation.js +1 -1
  243. package/dist/utils/process.js +1 -1
  244. package/dist/utils/prompt.js +1 -1
  245. package/dist/utils/spinner.js +1 -1
  246. package/dist/utils/sse-parser.js +1 -1
  247. package/dist/utils/string-utils.js +1 -1
  248. package/dist/utils/table-ref-parser.js +1 -1
  249. package/dist/utils/tdx-logger.js +1 -1
  250. package/dist/utils/version-check.js +1 -1
  251. package/package.json +1 -1
  252. package/dist/commands/auth-login-command.d.ts +0 -29
  253. package/dist/commands/auth-login-command.d.ts.map +0 -1
  254. package/dist/commands/auth-login-command.js +0 -1
  255. package/dist/commands/auth-login-command.js.map +0 -1
@@ -1 +1 @@
1
- const a26_0x54ee4d=a26_0x3f37;(function(_0x53a698,_0x2ee14f){const _0xc95ac=a26_0x3f37,_0x1c5e35=_0x53a698();while(!![]){try{const _0x5e70e8=parseInt(_0xc95ac(0x197))/0x1*(-parseInt(_0xc95ac(0x19d))/0x2)+-parseInt(_0xc95ac(0x191))/0x3+-parseInt(_0xc95ac(0x18f))/0x4*(-parseInt(_0xc95ac(0x196))/0x5)+parseInt(_0xc95ac(0x1a1))/0x6*(parseInt(_0xc95ac(0x1aa))/0x7)+-parseInt(_0xc95ac(0x1a0))/0x8+parseInt(_0xc95ac(0x199))/0x9+-parseInt(_0xc95ac(0x19b))/0xa*(parseInt(_0xc95ac(0x193))/0xb);if(_0x5e70e8===_0x2ee14f)break;else _0x1c5e35['push'](_0x1c5e35['shift']());}catch(_0x1ac6c9){_0x1c5e35['push'](_0x1c5e35['shift']());}}}(a26_0x3328,0xd0ac2));import{BaseCommand}from'./command.js';function a26_0x3f37(_0x4235e5,_0x5634e5){_0x4235e5=_0x4235e5-0x17e;const _0x332897=a26_0x3328();let _0x3f3730=_0x332897[_0x4235e5];return _0x3f3730;}import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a26_0x3ecec2 from'chalk';function a26_0x3328(){const _0x11895f=['skippedCount','green','6463440NdqrtW','161358qJPiIC','dirname','resolve','invalidCount','log','\x20warning(s)\x20found','\x20non-template\x20file(s)\x20skipped','No\x20template\x20YAML\x20files\x20found\x20in\x20','\x20error(s)','343sKdIdC','\x20template(s)\x20valid','\x20template(s)\x20with\x20errors,\x20','\x20valid','validCount','\x20warning(s)','name','.yaml','Validation\x20failed:\x20','warningCount','length','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','.yml','errors','template','verbose','dim','error','warnings','yellow','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','4tYSHPg','red','621069WwHZEK','valid','22oPBcdX','Error:\x20Directory\x20not\x20found:\x20','hasErrors','7575905GexDiG','23RRtDME','cwd','13765842UcEWfg','endsWith','4098790vjKqoE','\x20non-template\x20file(s)\x20skipped)','145482CcFBuF'];a26_0x3328=function(){return _0x11895f;};return a26_0x3328();}import a26_0x254869 from'path';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class EngageTemplateValidateCommand extends BaseCommand{[a26_0x54ee4d(0x180)]='engage:template:validate';['description']='Validate\x20template\x20YAML\x20files';async['execute'](_0x35a1b0){const _0x3086dc=a26_0x54ee4d,{options:_0x58299c,args:_0x4aa1f9}=_0x35a1b0,_0x333775=_0x58299c,_0x5baf51=_0x4aa1f9[0x0],_0x3a212c=_0x5baf51?a26_0x254869[_0x3086dc(0x1a3)](_0x5baf51):undefined,_0x179141=_0x3a212c?isYamlFile(_0x3a212c):![];let _0x3d056a,_0x15188a;if(_0x179141&&_0x3a212c)_0x3d056a=a26_0x254869[_0x3086dc(0x1a2)](_0x3a212c),_0x15188a=_0x3a212c;else _0x3a212c?_0x3d056a=_0x3a212c:_0x3d056a=process[_0x3086dc(0x198)]();if(!_0x15188a&&!existsSync(_0x3d056a))return console['error'](a26_0x3ecec2[_0x3086dc(0x190)](_0x3086dc(0x194)+_0x3d056a+'\x0a')),0x1;let _0x2eb5d6;if(_0x15188a){if(!_0x15188a[_0x3086dc(0x19a)](_0x3086dc(0x186))&&!_0x15188a[_0x3086dc(0x19a)](_0x3086dc(0x181)))return console['error'](a26_0x3ecec2[_0x3086dc(0x190)](_0x3086dc(0x18e)+_0x15188a+'\x0a')),0x1;_0x2eb5d6=[_0x15188a];}else _0x2eb5d6=findYamlFiles(_0x3d056a);if(_0x2eb5d6[_0x3086dc(0x184)]===0x0)return console[_0x3086dc(0x18b)](a26_0x3ecec2[_0x3086dc(0x190)](_0x3086dc(0x185)+_0x3d056a+'\x0a')),0x1;const _0x3563c5=validateYamlFiles(_0x2eb5d6,_0x3d056a,{'filterType':_0x3086dc(0x188)}),_0x6caf01=calculateSummary(_0x3563c5),_0x7bffda=_0x3563c5['filter'](isValidationResult);if(_0x7bffda[_0x3086dc(0x184)]===0x0)return console[_0x3086dc(0x18b)](a26_0x3ecec2[_0x3086dc(0x18d)](_0x3086dc(0x1a8)+_0x3d056a+'\x0a')),_0x6caf01[_0x3086dc(0x19e)]>0x0&&console[_0x3086dc(0x18b)](a26_0x3ecec2[_0x3086dc(0x18a)]('('+_0x6caf01[_0x3086dc(0x19e)]+_0x3086dc(0x19c))),0x0;for(const _0xd6c246 of _0x3563c5){if(!isValidationResult(_0xd6c246)){_0x333775[_0x3086dc(0x189)]&&console['log'](a26_0x3ecec2[_0x3086dc(0x18a)]('-\x20'+_0xd6c246['relativePath']+'\x20(skipped:\x20'+_0xd6c246['reason']+')'));continue;}const {relativePath:_0x8a4b37,source:_0x350e7a,result:_0x73214a}=_0xd6c246;if(_0x73214a[_0x3086dc(0x192)]&&_0x73214a[_0x3086dc(0x18c)][_0x3086dc(0x184)]===0x0)_0x333775[_0x3086dc(0x189)]&&console[_0x3086dc(0x1a5)](a26_0x3ecec2[_0x3086dc(0x19f)]('✔\x20'+_0x8a4b37));else _0x73214a['valid']?(console['log'](a26_0x3ecec2['yellow']('⚠\x20'+_0x8a4b37+':\x20'+_0x73214a[_0x3086dc(0x18c)][_0x3086dc(0x184)]+_0x3086dc(0x17f))),console['log'](formatValidationResult(_0x73214a,_0x350e7a,_0x8a4b37))):(console[_0x3086dc(0x1a5)](a26_0x3ecec2[_0x3086dc(0x190)]('✖\x20'+_0x8a4b37+':\x20'+_0x73214a[_0x3086dc(0x187)]['length']+_0x3086dc(0x1a9))),console[_0x3086dc(0x1a5)](formatValidationResult(_0x73214a,_0x350e7a,_0x8a4b37)));}return console[_0x3086dc(0x1a5)](''),_0x6caf01[_0x3086dc(0x195)]?(console[_0x3086dc(0x1a5)](a26_0x3ecec2[_0x3086dc(0x190)](_0x3086dc(0x182)+_0x6caf01[_0x3086dc(0x1a4)]+_0x3086dc(0x1ac)+_0x6caf01[_0x3086dc(0x17e)]+_0x3086dc(0x1ad))),_0x6caf01[_0x3086dc(0x183)]>0x0&&console[_0x3086dc(0x1a5)](a26_0x3ecec2[_0x3086dc(0x18d)](_0x6caf01[_0x3086dc(0x183)]+_0x3086dc(0x1a6))),_0x6caf01[_0x3086dc(0x19e)]>0x0&&console[_0x3086dc(0x1a5)](a26_0x3ecec2['dim'](_0x6caf01[_0x3086dc(0x19e)]+_0x3086dc(0x1a7))),0x1):(console[_0x3086dc(0x1a5)](a26_0x3ecec2[_0x3086dc(0x19f)]('✔\x20All\x20'+_0x6caf01[_0x3086dc(0x17e)]+_0x3086dc(0x1ab))),_0x6caf01[_0x3086dc(0x183)]>0x0&&console[_0x3086dc(0x1a5)](a26_0x3ecec2[_0x3086dc(0x18d)](_0x6caf01['warningCount']+'\x20warning(s)\x20found')),_0x6caf01[_0x3086dc(0x19e)]>0x0&&console[_0x3086dc(0x1a5)](a26_0x3ecec2[_0x3086dc(0x18a)](_0x6caf01[_0x3086dc(0x19e)]+_0x3086dc(0x1a7))),0x0);}}
1
+ const a25_0x31fdf0=a25_0x3101;(function(_0x461155,_0x56a0f0){const _0x27b4c9=a25_0x3101,_0x18df5a=_0x461155();while(!![]){try{const _0x3c92b3=parseInt(_0x27b4c9(0x1d8))/0x1+parseInt(_0x27b4c9(0x1fc))/0x2+parseInt(_0x27b4c9(0x1f5))/0x3*(parseInt(_0x27b4c9(0x1eb))/0x4)+parseInt(_0x27b4c9(0x1e6))/0x5*(-parseInt(_0x27b4c9(0x1e5))/0x6)+parseInt(_0x27b4c9(0x1d2))/0x7+parseInt(_0x27b4c9(0x1f2))/0x8+parseInt(_0x27b4c9(0x1f1))/0x9*(-parseInt(_0x27b4c9(0x1d1))/0xa);if(_0x3c92b3===_0x56a0f0)break;else _0x18df5a['push'](_0x18df5a['shift']());}catch(_0x33e9d9){_0x18df5a['push'](_0x18df5a['shift']());}}}(a25_0x4af3,0xb3c2d));import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';function a25_0x4af3(){const _0x51af56=['endsWith','filter','.yml','564MvNmUF','\x20template(s)\x20with\x20errors,\x20','\x20non-template\x20file(s)\x20skipped','verbose','Validate\x20template\x20YAML\x20files','description','18nFqpal','10838152scPxcg','\x20warning(s)\x20found','dirname','29331yxaXGJ','skippedCount','\x20(skipped:\x20','name','warningCount','length','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','1336098IZKaQt','hasErrors','template','error','valid','log','Validation\x20failed:\x20','11946170lGPWkQ','241640OJEgun','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','execute','\x20warning(s)','engage:template:validate','\x20template(s)\x20valid','468553WNPdcx','errors','\x20valid','invalidCount','\x20non-template\x20file(s)\x20skipped)','green','dim','Error:\x20Directory\x20not\x20found:\x20','cwd','red','warnings','relativePath','yellow','6erDkXa','3894565PQfWZz','validCount'];a25_0x4af3=function(){return _0x51af56;};return a25_0x4af3();}import{existsSync}from'fs';import a25_0x53f4b6 from'chalk';import a25_0x5da660 from'path';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';function a25_0x3101(_0x309fc1,_0x13168b){_0x309fc1=_0x309fc1-0x1ce;const _0x4af38c=a25_0x4af3();let _0x3101b0=_0x4af38c[_0x309fc1];return _0x3101b0;}import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class EngageTemplateValidateCommand extends BaseCommand{[a25_0x31fdf0(0x1f8)]=a25_0x31fdf0(0x1d6);[a25_0x31fdf0(0x1f0)]=a25_0x31fdf0(0x1ef);async[a25_0x31fdf0(0x1d4)](_0x104023){const _0x55f928=a25_0x31fdf0,{options:_0xdb66a4,args:_0x1441a2}=_0x104023,_0x41f5c5=_0xdb66a4,_0xabc3fe=_0x1441a2[0x0],_0x3b55b7=_0xabc3fe?a25_0x5da660['resolve'](_0xabc3fe):undefined,_0x6b5c3=_0x3b55b7?isYamlFile(_0x3b55b7):![];let _0x164f06,_0x4edc8e;if(_0x6b5c3&&_0x3b55b7)_0x164f06=a25_0x5da660[_0x55f928(0x1f4)](_0x3b55b7),_0x4edc8e=_0x3b55b7;else _0x3b55b7?_0x164f06=_0x3b55b7:_0x164f06=process[_0x55f928(0x1e0)]();if(!_0x4edc8e&&!existsSync(_0x164f06))return console[_0x55f928(0x1ff)](a25_0x53f4b6[_0x55f928(0x1e1)](_0x55f928(0x1df)+_0x164f06+'\x0a')),0x1;let _0x2e4607;if(_0x4edc8e){if(!_0x4edc8e[_0x55f928(0x1e8)](_0x55f928(0x1ea))&&!_0x4edc8e[_0x55f928(0x1e8)]('.yaml'))return console[_0x55f928(0x1ff)](a25_0x53f4b6[_0x55f928(0x1e1)](_0x55f928(0x1fb)+_0x4edc8e+'\x0a')),0x1;_0x2e4607=[_0x4edc8e];}else _0x2e4607=findYamlFiles(_0x164f06);if(_0x2e4607[_0x55f928(0x1fa)]===0x0)return console[_0x55f928(0x1ff)](a25_0x53f4b6[_0x55f928(0x1e1)](_0x55f928(0x1d3)+_0x164f06+'\x0a')),0x1;const _0x2c6863=validateYamlFiles(_0x2e4607,_0x164f06,{'filterType':_0x55f928(0x1fe)}),_0x239f4c=calculateSummary(_0x2c6863),_0x4a9ab5=_0x2c6863[_0x55f928(0x1e9)](isValidationResult);if(_0x4a9ab5[_0x55f928(0x1fa)]===0x0)return console[_0x55f928(0x1ff)](a25_0x53f4b6['yellow']('No\x20template\x20YAML\x20files\x20found\x20in\x20'+_0x164f06+'\x0a')),_0x239f4c['skippedCount']>0x0&&console[_0x55f928(0x1ff)](a25_0x53f4b6[_0x55f928(0x1de)]('('+_0x239f4c[_0x55f928(0x1f6)]+_0x55f928(0x1dc))),0x0;for(const _0x30715a of _0x2c6863){if(!isValidationResult(_0x30715a)){_0x41f5c5[_0x55f928(0x1ee)]&&console[_0x55f928(0x1cf)](a25_0x53f4b6[_0x55f928(0x1de)]('-\x20'+_0x30715a[_0x55f928(0x1e3)]+_0x55f928(0x1f7)+_0x30715a['reason']+')'));continue;}const {relativePath:_0x564452,source:_0x12785a,result:_0x1d286a}=_0x30715a;if(_0x1d286a[_0x55f928(0x1ce)]&&_0x1d286a[_0x55f928(0x1e2)]['length']===0x0)_0x41f5c5['verbose']&&console[_0x55f928(0x1cf)](a25_0x53f4b6[_0x55f928(0x1dd)]('✔\x20'+_0x564452));else _0x1d286a['valid']?(console[_0x55f928(0x1cf)](a25_0x53f4b6[_0x55f928(0x1e4)]('⚠\x20'+_0x564452+':\x20'+_0x1d286a['warnings'][_0x55f928(0x1fa)]+_0x55f928(0x1d5))),console['log'](formatValidationResult(_0x1d286a,_0x12785a,_0x564452))):(console[_0x55f928(0x1cf)](a25_0x53f4b6[_0x55f928(0x1e1)]('✖\x20'+_0x564452+':\x20'+_0x1d286a[_0x55f928(0x1d9)][_0x55f928(0x1fa)]+'\x20error(s)')),console['log'](formatValidationResult(_0x1d286a,_0x12785a,_0x564452)));}return console['log'](''),_0x239f4c[_0x55f928(0x1fd)]?(console['log'](a25_0x53f4b6[_0x55f928(0x1e1)](_0x55f928(0x1d0)+_0x239f4c[_0x55f928(0x1db)]+_0x55f928(0x1ec)+_0x239f4c['validCount']+_0x55f928(0x1da))),_0x239f4c['warningCount']>0x0&&console[_0x55f928(0x1cf)](a25_0x53f4b6[_0x55f928(0x1e4)](_0x239f4c[_0x55f928(0x1f9)]+'\x20warning(s)\x20found')),_0x239f4c['skippedCount']>0x0&&console[_0x55f928(0x1cf)](a25_0x53f4b6[_0x55f928(0x1de)](_0x239f4c[_0x55f928(0x1f6)]+'\x20non-template\x20file(s)\x20skipped')),0x1):(console[_0x55f928(0x1cf)](a25_0x53f4b6[_0x55f928(0x1dd)]('✔\x20All\x20'+_0x239f4c[_0x55f928(0x1e7)]+_0x55f928(0x1d7))),_0x239f4c[_0x55f928(0x1f9)]>0x0&&console['log'](a25_0x53f4b6[_0x55f928(0x1e4)](_0x239f4c[_0x55f928(0x1f9)]+_0x55f928(0x1f3))),_0x239f4c[_0x55f928(0x1f6)]>0x0&&console[_0x55f928(0x1cf)](a25_0x53f4b6['dim'](_0x239f4c[_0x55f928(0x1f6)]+_0x55f928(0x1ed))),0x0);}}
@@ -1 +1 @@
1
- const a27_0x2b2d97=a27_0x2ffc;(function(_0x4f6cd8,_0x2c6c5f){const _0x522247=a27_0x2ffc,_0x5e131b=_0x4f6cd8();while(!![]){try{const _0x4c220b=-parseInt(_0x522247(0x194))/0x1*(parseInt(_0x522247(0x19a))/0x2)+-parseInt(_0x522247(0x15e))/0x3+parseInt(_0x522247(0x1a3))/0x4+-parseInt(_0x522247(0x18a))/0x5+parseInt(_0x522247(0x1ae))/0x6*(-parseInt(_0x522247(0x16f))/0x7)+parseInt(_0x522247(0x171))/0x8*(parseInt(_0x522247(0x162))/0x9)+parseInt(_0x522247(0x1ad))/0xa;if(_0x4c220b===_0x2c6c5f)break;else _0x5e131b['push'](_0x5e131b['shift']());}catch(_0x16a200){_0x5e131b['push'](_0x5e131b['shift']());}}}(a27_0x415d,0xdef4a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a27_0x415d(){const _0x544e7a=['✔\x20Found\x20','red','kill','✔\x20Job\x20submitted','floor','submit','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','yes','map','file','status','priority','just\x20now','Limit:\x20','dim','Database:\x20','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','job:result','debug','Status\x20filter:\x20','url','join','4478030bhtNoe','Getting\x20job\x20results...','job_id','args','database','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','Submit\x20a\x20job','start_at','Submitting\x20job...','1qcxfcP','\x20job','type','h\x20ago','No\x20SQL\x20statements\x20found\x20in\x20file','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','3070842QZqsqb','length','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','round','result','jobs','\x20\x20Job\x20ID:\x20','log','✔\x20Retrieved\x20','486928jMNwgl','abs','execute','site','m\x20ago','user_name','Cancelled','data','Query:\x20','now','45607920FjIkDM','6ZgQmGR','verbose','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','hive','Listing\x20jobs...','list','job:kill','Get\x20job\x20results','green','List\x20jobs','4193484XvZdXv','Job\x20type:\x20','presto','created_at','879354APipTX','job:submit','error','name','query','getTime','end_at','Show\x20job\x20details','success','push','trino','validate','description','1634927oPvgJN','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','24SJLMyf','INVALID_ARGUMENT','job:show'];a27_0x415d=function(){return _0x544e7a;};return a27_0x415d();}import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}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';import{getJobUrl}from'../sdk/client/endpoints.js';function a27_0x2ffc(_0x52c070,_0x4a0d0d){_0x52c070=_0x52c070-0x157;const _0x415df4=a27_0x415d();let _0x2ffcac=_0x415df4[_0x52c070];return _0x2ffcac;}import{hyperlink}from'../sdk/util/formatters.js';import a27_0x2870ad from'chalk';function formatDuration(_0x4f6f17){const _0x393bcb=a27_0x2ffc;if(_0x4f6f17<0x3c)return _0x4f6f17+'s';if(_0x4f6f17<0xe10)return Math[_0x393bcb(0x178)](_0x4f6f17/0x3c)+'m\x20'+_0x4f6f17%0x3c+'s';const _0x1c143b=Math['floor'](_0x4f6f17/0xe10),_0x1ff579=Math[_0x393bcb(0x178)](_0x4f6f17%0xe10/0x3c);return _0x1ff579>0x0?_0x1c143b+'h\x20'+_0x1ff579+'m':_0x1c143b+'h';}function formatRelativeTime(_0x227254){const _0x3db378=a27_0x2ffc,_0x1cd64d=Date[_0x3db378(0x1ac)]()-_0x227254[_0x3db378(0x167)](),_0x2602d3=Math['floor'](Math[_0x3db378(0x1a4)](_0x1cd64d)/0x3e8);if(_0x2602d3<0x3c)return _0x3db378(0x180);const _0x5f4cf7=Math['floor'](_0x2602d3/0x3c);if(_0x5f4cf7<0x3c)return _0x5f4cf7+_0x3db378(0x1a7);const _0x353d87=Math[_0x3db378(0x178)](_0x5f4cf7/0x3c);if(_0x353d87<0x18)return _0x353d87+_0x3db378(0x197);const _0x15f5f5=Math[_0x3db378(0x178)](_0x353d87/0x18);if(_0x15f5f5<0x1e)return _0x15f5f5+'d\x20ago';return Math[_0x3db378(0x178)](_0x15f5f5/0x1e)+'mo\x20ago';}export class JobListCommand extends BaseCommand{[a27_0x2b2d97(0x165)]='jobs';[a27_0x2b2d97(0x16e)]=a27_0x2b2d97(0x15d);async[a27_0x2b2d97(0x1a5)](_0x1110f4){const _0xdcfc4f=a27_0x2b2d97,{options:_0x299088,tdx:_0x47dd02}=_0x1110f4,_0x32656f=resolveLimit(_0x299088['limit'],DEFAULT_DISPLAY_LIMIT),_0x350775=_0x299088['status'];_0x299088[_0xdcfc4f(0x1af)]&&(console['error'](_0xdcfc4f(0x181)+_0x32656f+'\x20jobs'),_0x350775&&console['error'](_0xdcfc4f(0x187)+_0x350775));const _0xc1415d=await withSpinner(_0xdcfc4f(0x158),()=>_0x47dd02[_0xdcfc4f(0x19f)][_0xdcfc4f(0x159)]({'from':0x0,'to':_0x32656f-0x1,'status':_0x350775}),{'verbose':_0x299088[_0xdcfc4f(0x1af)]}),_0x3fb333=_0xc1415d[_0xdcfc4f(0x1aa)];console[_0xdcfc4f(0x164)](_0xdcfc4f(0x174)+_0x3fb333[_0xdcfc4f(0x19b)]+_0xdcfc4f(0x195)+(_0x3fb333['length']!==0x1?'s':''));const _0x4fc5c=_0x299088[_0xdcfc4f(0x1a6)];if(isStructuredFormat(_0x299088)){const _0x11823e=_0x3fb333[_0xdcfc4f(0x17c)](_0x2f1f56=>{const _0x1b4a8f=_0xdcfc4f;let _0x14af9c;if(_0x2f1f56[_0x1b4a8f(0x192)]&&_0x2f1f56[_0x1b4a8f(0x168)]){const _0x97257c=new Date(_0x2f1f56[_0x1b4a8f(0x192)])[_0x1b4a8f(0x167)](),_0x4f79f2=new Date(_0x2f1f56[_0x1b4a8f(0x168)])['getTime']();_0x14af9c=Math[_0x1b4a8f(0x19d)]((_0x4f79f2-_0x97257c)/0x3e8);}return{'job_id':_0x2f1f56[_0x1b4a8f(0x18c)],'type':_0x2f1f56[_0x1b4a8f(0x196)]===_0x1b4a8f(0x160)?'trino':_0x2f1f56['type'],'status':_0x2f1f56[_0x1b4a8f(0x17e)],'user_name':_0x2f1f56[_0x1b4a8f(0x1a8)],'duration_sec':_0x14af9c,'created_at':_0x2f1f56[_0x1b4a8f(0x161)],'started_at':_0x2f1f56[_0x1b4a8f(0x192)],'end_at':_0x2f1f56[_0x1b4a8f(0x168)]};});await handleSDKOutput(_0x11823e,_0x299088);}else for(const _0x1f853e of _0x3fb333){const _0x52c267=_0x1f853e[_0xdcfc4f(0x17e)]===_0xdcfc4f(0x16a)?a27_0x2870ad[_0xdcfc4f(0x15c)]:_0x1f853e[_0xdcfc4f(0x17e)]==='error'?a27_0x2870ad[_0xdcfc4f(0x175)]:a27_0x2870ad[_0xdcfc4f(0x182)],_0x3aea76=_0x52c267(_0x1f853e['status']),_0x49b7e2=getJobUrl(_0x4fc5c,_0x1f853e[_0xdcfc4f(0x18c)]),_0x4b7ce0=hyperlink(_0x1f853e[_0xdcfc4f(0x18c)],_0x49b7e2),_0x5e6b64=a27_0x2870ad[_0xdcfc4f(0x182)](_0x1f853e['type']===_0xdcfc4f(0x160)?_0xdcfc4f(0x16c):_0x1f853e[_0xdcfc4f(0x196)]),_0x537d20=[];if(_0x1f853e[_0xdcfc4f(0x192)]&&_0x1f853e[_0xdcfc4f(0x168)]){const _0x30f0a6=Math[_0xdcfc4f(0x19d)]((new Date(_0x1f853e[_0xdcfc4f(0x168)])[_0xdcfc4f(0x167)]()-new Date(_0x1f853e[_0xdcfc4f(0x192)])[_0xdcfc4f(0x167)]())/0x3e8);_0x537d20[_0xdcfc4f(0x16b)](formatDuration(_0x30f0a6));}if(_0x1f853e[_0xdcfc4f(0x168)])_0x537d20[_0xdcfc4f(0x16b)](formatRelativeTime(new Date(_0x1f853e['end_at'])));else _0x1f853e[_0xdcfc4f(0x192)]&&_0x537d20[_0xdcfc4f(0x16b)](formatRelativeTime(new Date(_0x1f853e[_0xdcfc4f(0x192)])));const _0x49846a=_0x537d20[_0xdcfc4f(0x19b)]>0x0?a27_0x2870ad[_0xdcfc4f(0x182)]('\x20'+_0x537d20[_0xdcfc4f(0x189)](',\x20')):'';console[_0xdcfc4f(0x1a1)]('⚡\x20'+_0x4b7ce0+'\x20'+_0x5e6b64+'\x20'+_0x3aea76+_0x49846a);}return 0x0;}}export class JobShowCommand extends BaseCommand{[a27_0x2b2d97(0x165)]=a27_0x2b2d97(0x173);[a27_0x2b2d97(0x16e)]=a27_0x2b2d97(0x169);[a27_0x2b2d97(0x16d)](_0x147a70){const _0x32c4c4=a27_0x2b2d97,_0x2fb64e=_0x147a70[_0x32c4c4(0x18d)][0x0];if(!_0x2fb64e)return _0x32c4c4(0x184);return undefined;}async['execute'](_0x4e8b92){const _0x47c2d4=a27_0x2b2d97,{options:_0x301039,args:_0x52850c,tdx:_0x35a772}=_0x4e8b92,_0x1e15bc=_0x52850c[0x0],_0x2fd992=await withSpinner('Getting\x20job\x20details...',()=>_0x35a772[_0x47c2d4(0x19f)]['show'](_0x1e15bc),{'verbose':_0x301039[_0x47c2d4(0x1af)]}),_0x38e7a2=_0x2fd992[_0x47c2d4(0x1aa)];let _0x540e5f;if(_0x38e7a2[_0x47c2d4(0x192)]&&_0x38e7a2[_0x47c2d4(0x168)]){const _0x50884a=new Date(_0x38e7a2[_0x47c2d4(0x192)])[_0x47c2d4(0x167)](),_0x4cb888=new Date(_0x38e7a2['end_at'])[_0x47c2d4(0x167)]();_0x540e5f=Math[_0x47c2d4(0x19d)]((_0x4cb888-_0x50884a)/0x3e8);}const _0xd4bcaa={'job_id':_0x38e7a2[_0x47c2d4(0x18c)],'type':_0x38e7a2[_0x47c2d4(0x196)],'status':_0x38e7a2[_0x47c2d4(0x17e)],..._0x38e7a2[_0x47c2d4(0x1a8)]&&{'user_name':_0x38e7a2[_0x47c2d4(0x1a8)]},..._0x540e5f!==undefined&&{'duration_sec':_0x540e5f},..._0x38e7a2[_0x47c2d4(0x161)]&&{'created_at':_0x38e7a2[_0x47c2d4(0x161)]},..._0x38e7a2[_0x47c2d4(0x192)]&&{'started_at':_0x38e7a2[_0x47c2d4(0x192)]},..._0x38e7a2['end_at']&&{'end_at':_0x38e7a2['end_at']},..._0x38e7a2[_0x47c2d4(0x18e)]&&{'database':_0x38e7a2[_0x47c2d4(0x18e)]},..._0x38e7a2['priority']!==undefined&&{'priority':_0x38e7a2[_0x47c2d4(0x17f)]},..._0x38e7a2[_0x47c2d4(0x188)]&&{'url':_0x38e7a2[_0x47c2d4(0x188)]},..._0x38e7a2[_0x47c2d4(0x166)]&&{'query':_0x38e7a2[_0x47c2d4(0x166)]},..._0x38e7a2[_0x47c2d4(0x186)]&&{'debug':_0x38e7a2['debug']}};return await handleSingleObjectOutput(_0xd4bcaa,_0x301039),0x0;}}export class JobKillCommand extends BaseCommand{['name']=a27_0x2b2d97(0x15a);[a27_0x2b2d97(0x16e)]='Kill\x20a\x20job';[a27_0x2b2d97(0x16d)](_0x557de7){const _0x170219=a27_0x2b2d97,_0x3eb009=_0x557de7[_0x170219(0x18d)][0x0];if(!_0x3eb009)return _0x170219(0x170);return undefined;}async[a27_0x2b2d97(0x1a5)](_0x4aa92c){const _0x4a4ba3=a27_0x2b2d97,{options:_0x4a6689,args:_0x39fd25,tdx:_0x2c7d90}=_0x4aa92c,_0x4c9cb7=_0x39fd25[0x0];if(!_0x4a6689[_0x4a4ba3(0x17b)]){const _0x4dcb23=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x4c9cb7+'?');if(!_0x4dcb23)return console[_0x4a4ba3(0x164)](_0x4a4ba3(0x1a9)),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x2c7d90[_0x4a4ba3(0x19f)][_0x4a4ba3(0x176)](_0x4c9cb7),{'verbose':_0x4a6689[_0x4a4ba3(0x1af)]}),console['error'](_0x4a4ba3(0x1b0)+_0x4c9cb7),console['error'](_0x4a4ba3(0x199)+_0x4c9cb7+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}}export class JobSubmitCommand extends BaseCommand{[a27_0x2b2d97(0x165)]=a27_0x2b2d97(0x163);[a27_0x2b2d97(0x16e)]=a27_0x2b2d97(0x191);async[a27_0x2b2d97(0x1a5)](_0x1b3f49){const _0x2e478a=a27_0x2b2d97,{options:_0x9980a,args:_0x5281d0,tdx:_0x3bcf7f}=_0x1b3f49,_0x5e533c=_0x9980a['jobType']||_0x2e478a(0x16c),_0x3ea830=_0x9980a[_0x2e478a(0x17d)],_0x139e19=_0x9980a['database']||'information_schema',_0x4dace7=_0x9980a[_0x2e478a(0x19e)];if(_0x5e533c!==_0x2e478a(0x16c)&&_0x5e533c!==_0x2e478a(0x157))throw new SDKError(ErrorCode[_0x2e478a(0x172)],_0x2e478a(0x18f));let _0x2c2f6a;if(_0x3ea830){if(_0x5281d0[0x0])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2e478a(0x190));const _0x31c576=readSqlStatementsFromFile(_0x3ea830);if(_0x31c576[_0x2e478a(0x19b)]===0x0)throw new SDKError(ErrorCode[_0x2e478a(0x172)],_0x2e478a(0x198));if(_0x31c576['length']>0x1)throw new SDKError(ErrorCode[_0x2e478a(0x172)],'Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.');_0x2c2f6a=_0x31c576[0x0];}else{if(!_0x5281d0[0x0])throw new SDKError(ErrorCode[_0x2e478a(0x172)],_0x2e478a(0x19c));_0x2c2f6a=_0x5281d0[0x0];}_0x9980a[_0x2e478a(0x1af)]&&(console[_0x2e478a(0x164)](_0x2e478a(0x15f)+_0x5e533c),console[_0x2e478a(0x164)](_0x2e478a(0x183)+_0x139e19),console[_0x2e478a(0x164)](_0x2e478a(0x1ab)+_0x2c2f6a['substring'](0x0,0x64)+(_0x2c2f6a['length']>0x64?'...':'')));const _0x314033=await withSpinner(_0x2e478a(0x193),()=>_0x3bcf7f[_0x2e478a(0x19f)][_0x2e478a(0x179)](_0x139e19,_0x2c2f6a,_0x5e533c,_0x4dace7),{'verbose':_0x9980a['verbose']}),_0x5a29ee=_0x314033['data'];return console[_0x2e478a(0x164)](_0x2e478a(0x177)),console[_0x2e478a(0x164)](_0x2e478a(0x1a0)+_0x5a29ee[_0x2e478a(0x18c)]),await handleSDKOutput([_0x5a29ee],_0x9980a),0x0;}}export class JobResultCommand extends BaseCommand{[a27_0x2b2d97(0x165)]=a27_0x2b2d97(0x185);[a27_0x2b2d97(0x16e)]=a27_0x2b2d97(0x15b);[a27_0x2b2d97(0x16d)](_0x7dbe7b){const _0x4233bc=a27_0x2b2d97,_0x3f44ff=_0x7dbe7b[_0x4233bc(0x18d)][0x0];if(!_0x3f44ff)return _0x4233bc(0x17a);return undefined;}async[a27_0x2b2d97(0x1a5)](_0x563416){const _0x5b9a2d=a27_0x2b2d97,{options:_0x718fdd,args:_0x52dad6,tdx:_0x26ffaf}=_0x563416,_0x5734a0=_0x52dad6[0x0],_0x89791f=await withSpinner(_0x5b9a2d(0x18b),()=>_0x26ffaf['jobs']['result'](_0x5734a0),{'verbose':_0x718fdd[_0x5b9a2d(0x1af)]}),_0x20db71=_0x89791f['data'];return console[_0x5b9a2d(0x164)](_0x5b9a2d(0x1a2)+_0x20db71[_0x5b9a2d(0x19b)]+'\x20row'+(_0x20db71['length']!==0x1?'s':'')),await handleSDKOutput(_0x20db71,_0x718fdd),0x0;}}
1
+ const a26_0x277631=a26_0x431f;(function(_0x290a34,_0x1c6db5){const _0x6591ca=a26_0x431f,_0x56f023=_0x290a34();while(!![]){try{const _0x5627f7=parseInt(_0x6591ca(0x196))/0x1+-parseInt(_0x6591ca(0x1a4))/0x2+-parseInt(_0x6591ca(0x19c))/0x3+-parseInt(_0x6591ca(0x1a7))/0x4*(-parseInt(_0x6591ca(0x1c6))/0x5)+parseInt(_0x6591ca(0x1b6))/0x6*(parseInt(_0x6591ca(0x191))/0x7)+-parseInt(_0x6591ca(0x193))/0x8+parseInt(_0x6591ca(0x1c7))/0x9*(-parseInt(_0x6591ca(0x19d))/0xa);if(_0x5627f7===_0x1c6db5)break;else _0x56f023['push'](_0x56f023['shift']());}catch(_0x31fbee){_0x56f023['push'](_0x56f023['shift']());}}}(a26_0x16a2,0x32b08));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a26_0x431f(_0x5272d4,_0x2c794b){_0x5272d4=_0x5272d4-0x173;const _0x16a28a=a26_0x16a2();let _0x431f81=_0x16a28a[_0x5272d4];return _0x431f81;}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';import{getJobUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x809e52 from'chalk';function formatDuration(_0x364275){const _0x153514=a26_0x431f;if(_0x364275<0x3c)return _0x364275+'s';if(_0x364275<0xe10)return Math[_0x153514(0x1c0)](_0x364275/0x3c)+'m\x20'+_0x364275%0x3c+'s';const _0x2e20a8=Math[_0x153514(0x1c0)](_0x364275/0xe10),_0x17b739=Math[_0x153514(0x1c0)](_0x364275%0xe10/0x3c);return _0x17b739>0x0?_0x2e20a8+'h\x20'+_0x17b739+'m':_0x2e20a8+'h';}function formatRelativeTime(_0x3886bc){const _0x1a395f=a26_0x431f,_0x5ed47a=Date[_0x1a395f(0x184)]()-_0x3886bc[_0x1a395f(0x1c3)](),_0x19c49c=Math['floor'](Math[_0x1a395f(0x1b7)](_0x5ed47a)/0x3e8);if(_0x19c49c<0x3c)return _0x1a395f(0x1be);const _0x4092de=Math[_0x1a395f(0x1c0)](_0x19c49c/0x3c);if(_0x4092de<0x3c)return _0x4092de+_0x1a395f(0x1c9);const _0x18c458=Math['floor'](_0x4092de/0x3c);if(_0x18c458<0x18)return _0x18c458+'h\x20ago';const _0x47e74e=Math[_0x1a395f(0x1c0)](_0x18c458/0x18);if(_0x47e74e<0x1e)return _0x47e74e+_0x1a395f(0x1c2);return Math['floor'](_0x47e74e/0x1e)+_0x1a395f(0x1bc);}export class JobListCommand extends BaseCommand{[a26_0x277631(0x177)]=a26_0x277631(0x1a5);[a26_0x277631(0x1b1)]=a26_0x277631(0x186);async['execute'](_0x423e0e){const _0x2ac00c=a26_0x277631,{options:_0x258243,tdx:_0x31f905}=_0x423e0e,_0x3862a5=resolveLimit(_0x258243['limit'],DEFAULT_DISPLAY_LIMIT),_0x104720=_0x258243[_0x2ac00c(0x18a)];_0x258243[_0x2ac00c(0x1bf)]&&(console[_0x2ac00c(0x1b8)](_0x2ac00c(0x199)+_0x3862a5+_0x2ac00c(0x1ab)),_0x104720&&console['error'](_0x2ac00c(0x1c1)+_0x104720));const _0x480b99=await withSpinner(_0x2ac00c(0x173),()=>_0x31f905['jobs'][_0x2ac00c(0x1a3)]({'from':0x0,'to':_0x3862a5-0x1,'status':_0x104720}),{'verbose':_0x258243['verbose']}),_0x3fd607=_0x480b99[_0x2ac00c(0x1bb)];console[_0x2ac00c(0x1b8)]('✔\x20Found\x20'+_0x3fd607['length']+'\x20job'+(_0x3fd607['length']!==0x1?'s':''));const _0x26b78c=_0x258243[_0x2ac00c(0x18c)];if(isStructuredFormat(_0x258243)){const _0x11b295=_0x3fd607[_0x2ac00c(0x1aa)](_0x44f721=>{const _0x27da01=_0x2ac00c;let _0x300111;if(_0x44f721['start_at']&&_0x44f721[_0x27da01(0x195)]){const _0x48e0a2=new Date(_0x44f721[_0x27da01(0x183)])[_0x27da01(0x1c3)](),_0x2c468b=new Date(_0x44f721[_0x27da01(0x195)])[_0x27da01(0x1c3)]();_0x300111=Math[_0x27da01(0x190)]((_0x2c468b-_0x48e0a2)/0x3e8);}return{'job_id':_0x44f721['job_id'],'type':_0x44f721[_0x27da01(0x18e)]===_0x27da01(0x194)?_0x27da01(0x1ca):_0x44f721['type'],'status':_0x44f721['status'],'user_name':_0x44f721[_0x27da01(0x1a8)],'duration_sec':_0x300111,'created_at':_0x44f721[_0x27da01(0x1a6)],'started_at':_0x44f721['start_at'],'end_at':_0x44f721[_0x27da01(0x195)]};});await handleSDKOutput(_0x11b295,_0x258243);}else for(const _0x5ca939 of _0x3fd607){const _0x1339fa=_0x5ca939[_0x2ac00c(0x18a)]==='success'?a26_0x809e52[_0x2ac00c(0x1b4)]:_0x5ca939['status']==='error'?a26_0x809e52['red']:a26_0x809e52[_0x2ac00c(0x17b)],_0x229861=_0x1339fa(_0x5ca939[_0x2ac00c(0x18a)]),_0x21484b=getJobUrl(_0x26b78c,_0x5ca939['job_id']),_0x489af9=hyperlink(_0x5ca939[_0x2ac00c(0x1ae)],_0x21484b),_0x25ca91=a26_0x809e52['dim'](_0x5ca939[_0x2ac00c(0x18e)]==='presto'?_0x2ac00c(0x1ca):_0x5ca939[_0x2ac00c(0x18e)]),_0x426157=[];if(_0x5ca939[_0x2ac00c(0x183)]&&_0x5ca939[_0x2ac00c(0x195)]){const _0x440057=Math[_0x2ac00c(0x190)]((new Date(_0x5ca939[_0x2ac00c(0x195)])['getTime']()-new Date(_0x5ca939[_0x2ac00c(0x183)])[_0x2ac00c(0x1c3)]())/0x3e8);_0x426157[_0x2ac00c(0x198)](formatDuration(_0x440057));}if(_0x5ca939['end_at'])_0x426157[_0x2ac00c(0x198)](formatRelativeTime(new Date(_0x5ca939[_0x2ac00c(0x195)])));else _0x5ca939[_0x2ac00c(0x183)]&&_0x426157[_0x2ac00c(0x198)](formatRelativeTime(new Date(_0x5ca939[_0x2ac00c(0x183)])));const _0x70a84=_0x426157[_0x2ac00c(0x1b3)]>0x0?a26_0x809e52[_0x2ac00c(0x17b)]('\x20'+_0x426157[_0x2ac00c(0x1c5)](',\x20')):'';console[_0x2ac00c(0x1b2)]('⚡\x20'+_0x489af9+'\x20'+_0x25ca91+'\x20'+_0x229861+_0x70a84);}return 0x0;}}function a26_0x16a2(){const _0x56a939=['submit','Getting\x20job\x20details...','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','status','✔\x20Retrieved\x20','site','job:kill','type','result','round','15036cOgHWr','url','2127280yzNjEc','presto','end_at','127902razxrT','job:submit','push','Limit:\x20','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','query','485943QwlTcD','224570hRswuH','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','file','debug','substring','Show\x20job\x20details','list','149446DqmYLR','jobs','created_at','35132UtMAiA','user_name','validate','map','\x20jobs','execute','✔\x20Job\x20submitted','job_id','Query:\x20','Cancelled','description','log','length','green','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','1158LaLSxQ','abs','error','database','information_schema','data','mo\x20ago','Kill\x20a\x20job','just\x20now','verbose','floor','Status\x20filter:\x20','d\x20ago','getTime','kill','join','185mhYMVy','63ZwrixW','Submitting\x20kill\x20request...','m\x20ago','trino','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','Listing\x20jobs...','\x20\x20Job\x20ID:\x20','\x27\x20to\x20verify\x20the\x20job\x20status','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','name','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','Submit\x20a\x20job','hive','dim','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','Get\x20job\x20results','show','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','INVALID_ARGUMENT','args','priority','start_at','now','...','List\x20jobs'];a26_0x16a2=function(){return _0x56a939;};return a26_0x16a2();}export class JobShowCommand extends BaseCommand{['name']='job:show';['description']=a26_0x277631(0x1a2);[a26_0x277631(0x1a9)](_0x2e8650){const _0x527906=a26_0x277631,_0x158aad=_0x2e8650[_0x527906(0x181)][0x0];if(!_0x158aad)return _0x527906(0x178);return undefined;}async['execute'](_0x4be18f){const _0xa92d4=a26_0x277631,{options:_0x2f5e3b,args:_0x5d748b,tdx:_0xed75a7}=_0x4be18f,_0x26abb2=_0x5d748b[0x0],_0x11a58a=await withSpinner(_0xa92d4(0x188),()=>_0xed75a7[_0xa92d4(0x1a5)][_0xa92d4(0x17e)](_0x26abb2),{'verbose':_0x2f5e3b[_0xa92d4(0x1bf)]}),_0x431dd5=_0x11a58a[_0xa92d4(0x1bb)];let _0x240be3;if(_0x431dd5[_0xa92d4(0x183)]&&_0x431dd5[_0xa92d4(0x195)]){const _0x5dc1f2=new Date(_0x431dd5[_0xa92d4(0x183)])['getTime'](),_0x6e135c=new Date(_0x431dd5[_0xa92d4(0x195)])[_0xa92d4(0x1c3)]();_0x240be3=Math['round']((_0x6e135c-_0x5dc1f2)/0x3e8);}const _0x53c17c={'job_id':_0x431dd5[_0xa92d4(0x1ae)],'type':_0x431dd5[_0xa92d4(0x18e)],'status':_0x431dd5['status'],..._0x431dd5[_0xa92d4(0x1a8)]&&{'user_name':_0x431dd5[_0xa92d4(0x1a8)]},..._0x240be3!==undefined&&{'duration_sec':_0x240be3},..._0x431dd5['created_at']&&{'created_at':_0x431dd5[_0xa92d4(0x1a6)]},..._0x431dd5[_0xa92d4(0x183)]&&{'started_at':_0x431dd5[_0xa92d4(0x183)]},..._0x431dd5[_0xa92d4(0x195)]&&{'end_at':_0x431dd5[_0xa92d4(0x195)]},..._0x431dd5[_0xa92d4(0x1b9)]&&{'database':_0x431dd5['database']},..._0x431dd5[_0xa92d4(0x182)]!==undefined&&{'priority':_0x431dd5[_0xa92d4(0x182)]},..._0x431dd5[_0xa92d4(0x192)]&&{'url':_0x431dd5[_0xa92d4(0x192)]},..._0x431dd5['query']&&{'query':_0x431dd5[_0xa92d4(0x19b)]},..._0x431dd5['debug']&&{'debug':_0x431dd5[_0xa92d4(0x1a0)]}};return await handleSingleObjectOutput(_0x53c17c,_0x2f5e3b),0x0;}}export class JobKillCommand extends BaseCommand{[a26_0x277631(0x177)]=a26_0x277631(0x18d);[a26_0x277631(0x1b1)]=a26_0x277631(0x1bd);['validate'](_0x9096e8){const _0x483a7f=a26_0x277631,_0x533259=_0x9096e8[_0x483a7f(0x181)][0x0];if(!_0x533259)return _0x483a7f(0x189);return undefined;}async[a26_0x277631(0x1ac)](_0x2ec594){const _0x852442=a26_0x277631,{options:_0x536866,args:_0x2eae6a,tdx:_0x59d4fc}=_0x2ec594,_0x34f4d9=_0x2eae6a[0x0];if(!_0x536866['yes']){const _0xca7356=await confirm(_0x852442(0x176)+_0x34f4d9+'?');if(!_0xca7356)return console[_0x852442(0x1b8)](_0x852442(0x1b0)),0x0;}return await withSpinner(_0x852442(0x1c8),()=>_0x59d4fc[_0x852442(0x1a5)][_0x852442(0x1c4)](_0x34f4d9),{'verbose':_0x536866[_0x852442(0x1bf)]}),console['error'](_0x852442(0x17c)+_0x34f4d9),console['error']('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x34f4d9+_0x852442(0x175)),0x0;}}export class JobSubmitCommand extends BaseCommand{[a26_0x277631(0x177)]=a26_0x277631(0x197);[a26_0x277631(0x1b1)]=a26_0x277631(0x179);async[a26_0x277631(0x1ac)](_0x5700af){const _0xc7a765=a26_0x277631,{options:_0x16b657,args:_0x21662a,tdx:_0xbc8b5e}=_0x5700af,_0x36c34a=_0x16b657['jobType']||_0xc7a765(0x1ca),_0x243227=_0x16b657[_0xc7a765(0x19f)],_0x4a835b=_0x16b657['database']||_0xc7a765(0x1ba),_0x3d00bf=_0x16b657[_0xc7a765(0x18f)];if(_0x36c34a!==_0xc7a765(0x1ca)&&_0x36c34a!==_0xc7a765(0x17a))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xc7a765(0x19e));let _0x5eb285;if(_0x243227){if(_0x21662a[0x0])throw new SDKError(ErrorCode[_0xc7a765(0x180)],_0xc7a765(0x17f));const _0x502c26=readSqlStatementsFromFile(_0x243227);if(_0x502c26[_0xc7a765(0x1b3)]===0x0)throw new SDKError(ErrorCode[_0xc7a765(0x180)],'No\x20SQL\x20statements\x20found\x20in\x20file');if(_0x502c26[_0xc7a765(0x1b3)]>0x1)throw new SDKError(ErrorCode[_0xc7a765(0x180)],_0xc7a765(0x1b5));_0x5eb285=_0x502c26[0x0];}else{if(!_0x21662a[0x0])throw new SDKError(ErrorCode[_0xc7a765(0x180)],_0xc7a765(0x19a));_0x5eb285=_0x21662a[0x0];}_0x16b657[_0xc7a765(0x1bf)]&&(console[_0xc7a765(0x1b8)]('Job\x20type:\x20'+_0x36c34a),console['error']('Database:\x20'+_0x4a835b),console[_0xc7a765(0x1b8)](_0xc7a765(0x1af)+_0x5eb285[_0xc7a765(0x1a1)](0x0,0x64)+(_0x5eb285[_0xc7a765(0x1b3)]>0x64?_0xc7a765(0x185):'')));const _0x54026a=await withSpinner('Submitting\x20job...',()=>_0xbc8b5e[_0xc7a765(0x1a5)][_0xc7a765(0x187)](_0x4a835b,_0x5eb285,_0x36c34a,_0x3d00bf),{'verbose':_0x16b657[_0xc7a765(0x1bf)]}),_0x45950f=_0x54026a[_0xc7a765(0x1bb)];return console['error'](_0xc7a765(0x1ad)),console[_0xc7a765(0x1b8)](_0xc7a765(0x174)+_0x45950f[_0xc7a765(0x1ae)]),await handleSDKOutput([_0x45950f],_0x16b657),0x0;}}export class JobResultCommand extends BaseCommand{[a26_0x277631(0x177)]='job:result';[a26_0x277631(0x1b1)]=a26_0x277631(0x17d);[a26_0x277631(0x1a9)](_0x32bb27){const _0x9123e0=a26_0x277631,_0x3f2583=_0x32bb27['args'][0x0];if(!_0x3f2583)return _0x9123e0(0x1cb);return undefined;}async[a26_0x277631(0x1ac)](_0x2a24e4){const _0xac97ce=a26_0x277631,{options:_0x45ff28,args:_0x31c3db,tdx:_0x12e131}=_0x2a24e4,_0x4a75c1=_0x31c3db[0x0],_0x2d5da6=await withSpinner('Getting\x20job\x20results...',()=>_0x12e131[_0xac97ce(0x1a5)][_0xac97ce(0x18f)](_0x4a75c1),{'verbose':_0x45ff28[_0xac97ce(0x1bf)]}),_0x592b5a=_0x2d5da6[_0xac97ce(0x1bb)];return console['error'](_0xac97ce(0x18b)+_0x592b5a[_0xac97ce(0x1b3)]+'\x20row'+(_0x592b5a[_0xac97ce(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x592b5a,_0x45ff28),0x0;}}
@@ -1 +1 @@
1
- const a28_0x4d4d86=a28_0x4fe4;(function(_0x57ef9c,_0x38d14d){const _0x3401ed=a28_0x4fe4,_0x22e9cf=_0x57ef9c();while(!![]){try{const _0x40928e=-parseInt(_0x3401ed(0x232))/0x1*(parseInt(_0x3401ed(0x27e))/0x2)+-parseInt(_0x3401ed(0x284))/0x3*(parseInt(_0x3401ed(0x23c))/0x4)+-parseInt(_0x3401ed(0x237))/0x5+parseInt(_0x3401ed(0x1ba))/0x6*(parseInt(_0x3401ed(0x1e4))/0x7)+parseInt(_0x3401ed(0x1ac))/0x8*(-parseInt(_0x3401ed(0x1c9))/0x9)+-parseInt(_0x3401ed(0x212))/0xa*(-parseInt(_0x3401ed(0x28d))/0xb)+parseInt(_0x3401ed(0x1d5))/0xc*(parseInt(_0x3401ed(0x1a6))/0xd);if(_0x40928e===_0x38d14d)break;else _0x22e9cf['push'](_0x22e9cf['shift']());}catch(_0xd00538){_0x22e9cf['push'](_0x22e9cf['shift']());}}}(a28_0x1a48,0xe0bba));import a28_0x4474e0 from'chalk';import a28_0x3aa0f7 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{aggregateStageHistory,assembleJourneyStats,buildStageNameMap}from'../sdk/journey.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}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';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{createTdxConfigContent}from'../sdk/segment/tdx-config.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 requireNameOrPath(_0x354dc1){const _0xff3422=a28_0x4fe4;return!_0x354dc1&&(console[_0xff3422(0x1cd)](_0xff3422(0x26c)),console[_0xff3422(0x1cd)](_0xff3422(0x1c6))),!!_0x354dc1;}function withJsonFormat(_0x32c71f){const _0x48aabb=a28_0x4fe4;if(!_0x32c71f[_0x48aabb(0x259)]&&!_0x32c71f[_0x48aabb(0x1e3)]&&!_0x32c71f[_0x48aabb(0x21a)]&&!_0x32c71f['tsv'])return{..._0x32c71f,'format':_0x48aabb(0x1e3),'json':!![]};return _0x32c71f;}function formatJourneyState(_0x3d1b79){const _0x1c13be=a28_0x4fe4;switch(_0x3d1b79){case _0x1c13be(0x280):return a28_0x4474e0[_0x1c13be(0x1f0)]('(running)');case'draft':return a28_0x4474e0['dim']('(draft)');case'paused':return a28_0x4474e0[_0x1c13be(0x270)]('(paused)');case _0x1c13be(0x1fb):return a28_0x4474e0[_0x1c13be(0x266)]('(completed)');case _0x1c13be(0x209):return a28_0x4474e0['dim']('(archived)');default:return'('+_0x3d1b79+')';}}function a28_0x4fe4(_0x5be1bc,_0x4df57c){_0x5be1bc=_0x5be1bc-0x181;const _0x1a4851=a28_0x1a48();let _0x4fe489=_0x1a4851[_0x5be1bc];return _0x4fe489;}function formatJourneyItem(_0xdce187,_0x4838d2='',_0x3025c1){const _0x2366fb=a28_0x4fe4,_0x40e7a0=formatJourneyState(_0xdce187[_0x2366fb(0x25b)]),_0x4d8452=_0x3025c1?hyperlink(_0xdce187[_0x2366fb(0x213)],_0x3025c1):_0xdce187[_0x2366fb(0x213)];return _0x4838d2+'🗺️\x20'+_0x4d8452+'\x20'+_0x40e7a0;}function escapeRegex(_0x15e6f7){const _0xfd557c=a28_0x4fe4;return _0x15e6f7[_0xfd557c(0x1cf)](/[.*+?^${}()|[\]\\]/g,_0xfd557c(0x189));}function globToRegex(_0x2b0c37){const _0x129045=a28_0x4fe4,_0xc60f0d=_0x2b0c37[_0x129045(0x257)]('*')[_0x129045(0x203)](escapeRegex);return new RegExp(_0xc60f0d['join']('.*'),'i');}function buildRuleToNameMapping(_0x18e07e){const _0x54348b=a28_0x4fe4,_0x163b28=new Map();if(_0x18e07e['segments'])for(const [_0x459866,_0x427382]of Object[_0x54348b(0x260)](_0x18e07e['segments'])){if(_0x427382['rule']){const _0x191b09=serializeRule(_0x427382[_0x54348b(0x25f)]),_0x4838f6=_0x163b28[_0x54348b(0x1ec)](_0x191b09);_0x4838f6?_0x4838f6[_0x54348b(0x1bb)](_0x459866):_0x163b28[_0x54348b(0x24e)](_0x191b09,[_0x459866]);}}return _0x163b28;}async function resolveJourneyIdFromInput(_0x484802,_0x187424,_0x2242cb){const _0x35dc70=a28_0x4fe4,_0x10d202=await resolveJourneyTarget(_0x484802,_0x187424[_0x35dc70(0x271)],_0x187424[_0x35dc70(0x217)]),_0x4c1637=_0x10d202['parentSegment'];if(!_0x4c1637)throw new SDKError(ErrorCode[_0x35dc70(0x1f9)],_0x35dc70(0x1fe));const _0x2f4790=await withSpinner(_0x35dc70(0x250),()=>_0x2242cb[_0x35dc70(0x1ed)]['resolveParentId'](_0x4c1637),{'verbose':_0x187424[_0x35dc70(0x217)]}),_0x1bc984=_0x2f4790['data'],_0x49d996=await withSpinner(_0x35dc70(0x221),()=>_0x2242cb[_0x35dc70(0x276)][_0x35dc70(0x1df)](_0x1bc984,_0x10d202['journeyName']),{'verbose':_0x187424[_0x35dc70(0x217)]});return{'journeyId':_0x49d996['data'],'journeyName':_0x10d202[_0x35dc70(0x18b)],'parentSegmentId':_0x1bc984};}async function resolveJourneyTarget(_0x2f383a,_0x2e722c,_0x478c54){const _0x287ede=a28_0x4fe4;if(isYamlFilePath(_0x2f383a))try{const _0x3716d3=await resolveYamlFilePath(_0x2f383a);return _0x478c54&&(console[_0x287ede(0x1cd)](_0x287ede(0x26e)+_0x2f383a),console[_0x287ede(0x1cd)]('\x20\x20Parent\x20segment:\x20'+_0x3716d3['parentSegment']),console['error'](_0x287ede(0x214)+_0x3716d3[_0x287ede(0x256)]),console[_0x287ede(0x1cd)](_0x287ede(0x220)+(_0x3716d3['folderPath']||_0x287ede(0x27b)))),{'journeyName':_0x3716d3[_0x287ede(0x256)],'parentSegment':_0x3716d3[_0x287ede(0x271)],'resolved':_0x3716d3};}catch(_0x94d124){throw new SDKError(ErrorCode[_0x287ede(0x1f9)],_0x287ede(0x223)+_0x94d124[_0x287ede(0x23b)]);}if(!_0x2e722c)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x287ede(0x1ce));return{'journeyName':_0x2f383a,'parentSegment':_0x2e722c};}export class JourneyListCommand extends BaseCommand{[a28_0x4d4d86(0x233)]=a28_0x4d4d86(0x191);['description']='List\x20journeys\x20in\x20current\x20context';async[a28_0x4d4d86(0x1b9)](_0x589bf2){const _0x421175=a28_0x4d4d86,{options:_0x37059b,args:_0x1f8edb,tdx:_0x5b2dcc}=_0x589bf2,_0x5c0a39=_0x1f8edb[0x0],_0x307c12=_0x37059b['parentSegment'];if(!_0x307c12)return console['error'](_0x421175(0x1db)),console[_0x421175(0x1cd)](_0x421175(0x27c)),0x1;const _0x7fbe6a=await withSpinner(_0x421175(0x250),()=>_0x5b2dcc[_0x421175(0x1ed)][_0x421175(0x278)](_0x307c12),{'verbose':_0x37059b[_0x421175(0x217)]}),_0x262f32=_0x7fbe6a[_0x421175(0x26d)];_0x37059b['verbose']&&(console['error'](_0x421175(0x1cb)+_0x307c12+'\x20(ID:\x20'+_0x262f32+')'),_0x5c0a39&&console['error'](_0x421175(0x264)+_0x5c0a39));const _0x44037b=await withSpinner('Fetching\x20parent\x20segment...',()=>_0x5b2dcc[_0x421175(0x1ed)][_0x421175(0x28b)](_0x262f32),{'verbose':_0x37059b['verbose']}),_0x35c524=_0x44037b['data'],_0x3d0b56=_0x35c524[_0x421175(0x205)],_0xa0449b=await withSpinner(_0x421175(0x1af),()=>_0x5b2dcc['journey'][_0x421175(0x28f)](_0x262f32,_0x3d0b56),{'verbose':_0x37059b[_0x421175(0x217)]});let _0x2cb23d=_0xa0449b[_0x421175(0x26d)][_0x421175(0x282)];const _0x150ec9=_0xa0449b[_0x421175(0x26d)][_0x421175(0x1d4)],_0x47012e=new Map();for(const _0x5028d5 of _0x150ec9){_0x47012e[_0x421175(0x24e)](_0x5028d5['id'],_0x5028d5[_0x421175(0x233)]);}if(_0x5c0a39){const _0x19e562=globToRegex(_0x5c0a39);_0x2cb23d=_0x2cb23d[_0x421175(0x22b)](_0x27f618=>_0x19e562[_0x421175(0x1c2)](_0x27f618['journeyBundleName']));}console[_0x421175(0x1cd)](_0x421175(0x1ff)+_0x2cb23d[_0x421175(0x18c)]+_0x421175(0x19b)+(_0x2cb23d[_0x421175(0x18c)]!==0x1?'s':''));const _0xc295a2=_0x289e6b=>{const _0x51686d=_0x421175;return getConsoleNextUrl(_0x37059b[_0x51686d(0x21f)],'/app/ps/'+_0x262f32+_0x51686d(0x1c4)+_0x289e6b+'/j/da');};if(_0x37059b[_0x421175(0x259)]===_0x421175(0x1d1))await handleSDKOutput(_0x2cb23d,_0x37059b);else{if(_0x37059b[_0x421175(0x259)]===_0x421175(0x1e3)){const _0x5c7dcc=_0x2cb23d['map'](_0x5dcea9=>({..._0x5dcea9,'url':_0xc295a2(_0x5dcea9['id'])}));await handleSDKOutput(_0x5c7dcc,_0x37059b);}else{console[_0x421175(0x291)]('['+_0x307c12+']');const _0x42f34a=new Map(),_0x29aebc=[];for(const _0x48c71d of _0x2cb23d){if(!_0x48c71d[_0x421175(0x20e)]||_0x48c71d[_0x421175(0x20e)]===_0x3d0b56)_0x29aebc['push'](_0x48c71d);else{const _0x3e874c=_0x42f34a[_0x421175(0x1ec)](_0x48c71d['folderId'])||[];_0x3e874c['push'](_0x48c71d),_0x42f34a[_0x421175(0x24e)](_0x48c71d['folderId'],_0x3e874c);}}const _0x4cdeb7=(_0x453126,_0x372621)=>_0x453126[_0x421175(0x213)][_0x421175(0x1f5)](_0x372621[_0x421175(0x213)],undefined,{'sensitivity':_0x421175(0x1a2)});_0x29aebc['sort'](_0x4cdeb7);for(const _0x4add4c of _0x29aebc){console[_0x421175(0x291)](formatJourneyItem(_0x4add4c,'',_0xc295a2(_0x4add4c['id'])));}const _0x11b9a8=[..._0x42f34a[_0x421175(0x260)]()]['sort']((_0x30cb18,_0x40f44e)=>{const _0x528c5b=_0x421175,_0x28406a=_0x47012e['get'](_0x30cb18[0x0])||_0x30cb18[0x0],_0x485880=_0x47012e[_0x528c5b(0x1ec)](_0x40f44e[0x0])||_0x40f44e[0x0];return _0x28406a[_0x528c5b(0x1f5)](_0x485880,undefined,{'sensitivity':_0x528c5b(0x1a2)});});for(const [_0x3c2be4,_0x2747fd]of _0x11b9a8){const _0x1f85ff=_0x47012e[_0x421175(0x1ec)](_0x3c2be4)||_0x3c2be4;console[_0x421175(0x291)](_0x421175(0x263)+_0x1f85ff),_0x2747fd['sort'](_0x4cdeb7);for(const _0x4f10bc of _0x2747fd){console[_0x421175(0x291)](formatJourneyItem(_0x4f10bc,'\x20\x20',_0xc295a2(_0x4f10bc['id'])));}}}}return 0x0;}}function a28_0x1a48(){const _0xa7c4af=['enteredSize','site','\x20\x20Folder\x20path:\x20','Resolving\x20journey...','reentryMode','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','repeat','file','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','Error:\x20Journey\x20not\x20found:\x20','\x20\x20Target:\x20','Show\x20journey\x20details','filter','\x0aError:','Getting\x20journey\x20statistics...','stages','then','\x20not\x20found.\x20Available:\x20','journey:pull','3TotHgF','name','Journey\x20name:\x20','all','goalSize','6385635pjysIS','Getting\x20column\x20mapping...','yes','Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22','message','4UugYhQ','Getting\x20journey\x20details...','folderPath','\x20files?','goal','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','Error:\x20Invalid\x20--type\x20\x22','resourceName','View\x20a\x20specific\x20version\x20of\x20a\x20journey','connector_config','/j/da/je','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','exitOrJumpSize','red','find','targetDir','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','set','listFolders','Resolving\x20parent\x20segment...','type','No\x20traffic\x20data\x20available\x20for\x20journey:\x20','setPhase','Error:\x20Invalid\x20version\x20number:\x20','.yml','segmentName','split','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','format','conversion','state','\x20versions)','\x22\x20paused','Aborted.','rule','entries','Listing\x20journey\x20activations...','\x20Created\x20v','📁\x20','Pattern:\x20','stringify','blue','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','root\x20folder','has','paused','journeyStages','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','data','Resolved\x20YAML\x20file:\x20','\x20version','yellow','parentSegment','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','journeyId','sort','audienceId','journey','buildIdToEmailMap','resolveParentId','user','helpText','(root)','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','utf-8','38186hCHpWV','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','launched','database','journeys','Pausing\x20journey...','2229801EDHiJb','parentName','\x20->\x20','Input:\x20','join','createdAt','activation_','getParentFull','Fetching\x20users\x20and\x20connections...','11gGLkZF','/app/ps/','listJourneysWithFolders','nodes','log','listJourneysFromParentSegment','activation','getLatestJourneyId','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','toLowerCase','Resolving\x20version...','journey:activations','Listing\x20journey\x20versions...','List\x20all\x20versions\x20of\x20a\x20journey','\x5c$&','segmentPushCommand','journeyName','length','journeyBundleId','resume','filePath','\x20\x20Statistics\x20not\x20available','journey:list','isNew','cwd','✔\x20All\x20files\x20are\x20up\x20to\x20date','journey:resume','Fetching\x20journeys\x20and\x20folders...','pause','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','Write\x20','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','\x20journey','\x20Opening\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','from','Options:','limit','renderStats','base','description','Database:\x20','links','281047uoOJbb','values','args','Getting\x20journey\x20traffic\x20data...','\x20details...','tdx.json','32rUUJMB','Resume\x20a\x20paused\x20journey','Error:\x20Stage\x20\x22','Listing\x20journeys...','stageNameMap','Creating\x20new\x20version...','getStatistics','journey:view','Error:\x20Version\x20','versionNumber','getColumnMapping','\x0aChanges\x20to\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','execute','1542858IxOxxr','push','activationParams','\x20\x20-\x20','parent_segment','version','bold','Table:\x20','test','cyan','/e/','listActivationsFlat','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','milestoneSize','diff','1884456RUFABG','createVersion','Parent\x20segment:\x20','\x20(rule\x20match)','error','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','replace','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)','table','Found\x20','\x20(draft)\x20—\x20\x22','folders','1644jBFFFI','journey:traffic','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','✔\x20Pulled\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','session','Error:\x20Parent\x20segment\x20context\x20required','\x22\x20resumed','updatedAt','Folder\x20path:\x20','resolveJourneyId','exitOrJumpRate','\x20\x20Preserving\x20local\x20segment\x20name:\x20','web','json','7xRavlc','journey:versions','buildIdToNameMap','includeHistory','Resuming\x20journey...','Fetching\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','relative','get','segment','\x22\x20not\x20found','dim','green','✔\x20Journey\x20\x22','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','hasPeriod','relativePath','localeCompare','\x20journey\x20files\x20to\x20','Available\x20stages:\x20','kind','INVALID_ARGUMENT','...','completed','\x20=\x20',',\x20version:\x20','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','✔\x20Found\x20','getActivation','Warning:\x20Could\x20not\x20resolve\x20segment\x20','size','map','✔\x20Context\x20set:\x20','rootFolderId','listVersions','Cancelled','attributes','archived','journey:version:view','getTrafficData','getJourney','options','folderId','journey:stats','history','completeMilestoneRate','6167690ueWriP','journeyBundleName','\x20\x20Name:\x20','completionRate','add','verbose','dryRun','\x27\x20not\x20found\x20in\x20','jsonl','Getting\x20version\x20','hasChanges','\x20new\x20files'];a28_0x1a48=function(){return _0xa7c4af;};return a28_0x1a48();}export class JourneyViewCommand extends BaseCommand{['name']=a28_0x4d4d86(0x1b3);[a28_0x4d4d86(0x1a3)]=a28_0x4d4d86(0x22a);async[a28_0x4d4d86(0x1b9)](_0x48b8e9){const _0x4dec94=a28_0x4d4d86,{options:_0x26bdce,args:_0x730394,tdx:_0x2487e3}=_0x48b8e9,_0x14b4e6=_0x730394[0x0];if(!_0x14b4e6)return console[_0x4dec94(0x1cd)](_0x4dec94(0x26c)),console[_0x4dec94(0x1cd)](_0x4dec94(0x226)),console[_0x4dec94(0x1cd)](_0x4dec94(0x19f)),console[_0x4dec94(0x1cd)](_0x4dec94(0x1b8)),0x1;_0x26bdce[_0x4dec94(0x217)]&&console['error'](_0x4dec94(0x287)+_0x14b4e6);const {journeyId:_0x331a2a,parentSegmentId:_0x4769c6}=await resolveJourneyIdFromInput(_0x14b4e6,_0x26bdce,_0x2487e3);if(_0x26bdce[_0x4dec94(0x1e2)]){const _0x27349b=getConsoleNextUrl(_0x26bdce[_0x4dec94(0x21f)],_0x4dec94(0x28e)+_0x4769c6+_0x4dec94(0x1c4)+_0x331a2a+_0x4dec94(0x247));return console[_0x4dec94(0x1cd)](a28_0x4474e0['green']('✔')+_0x4dec94(0x19c)+a28_0x4474e0[_0x4dec94(0x1c3)](_0x27349b)),openBrowser(_0x27349b),0x0;}const _0x2d26c6=await withSpinner(_0x4dec94(0x23d),()=>_0x2487e3[_0x4dec94(0x276)][_0x4dec94(0x20c)](_0x331a2a),{'verbose':_0x26bdce[_0x4dec94(0x217)]}),_0x271798=_0x2d26c6[_0x4dec94(0x26d)],_0xdf07a5=_0x26bdce['includeStats'];let _0x1d5b6a;if(_0xdf07a5)try{const _0x290014=await withSpinner(_0x4dec94(0x22d),()=>_0x2487e3[_0x4dec94(0x276)][_0x4dec94(0x1b2)](_0x331a2a),{'verbose':_0x26bdce['verbose']});_0x1d5b6a=_0x290014['data'];}catch{_0x26bdce[_0x4dec94(0x217)]&&console[_0x4dec94(0x1cd)](_0x4dec94(0x190));}const _0x28acd9=getConsoleNextUrl(_0x26bdce[_0x4dec94(0x21f)],_0x4dec94(0x28e)+_0x4769c6+_0x4dec94(0x1c4)+_0x331a2a+'/j/da/je'),_0x59b845={'id':_0x271798['id'],'name':_0x271798['attributes'][_0x4dec94(0x233)],'description':_0x271798[_0x4dec94(0x208)]['description'],'state':_0x271798[_0x4dec94(0x208)][_0x4dec94(0x25b)],'paused':_0x271798[_0x4dec94(0x208)][_0x4dec94(0x26a)],'reentry_mode':_0x271798[_0x4dec94(0x208)][_0x4dec94(0x222)],'stages':_0x271798[_0x4dec94(0x208)]['journeyStages']?.['length']||0x0,..._0x271798[_0x4dec94(0x208)]['goal']&&{'goal':_0x271798[_0x4dec94(0x208)][_0x4dec94(0x240)][_0x4dec94(0x233)]},..._0x1d5b6a&&{'statistics':{'size':_0x1d5b6a[_0x4dec94(0x202)],'entered':_0x1d5b6a[_0x4dec94(0x21e)],'goal_achieved':_0x1d5b6a[_0x4dec94(0x236)],'completion_rate':_0x1d5b6a[_0x4dec94(0x215)],'exit_or_jump':_0x1d5b6a[_0x4dec94(0x249)],'exit_or_jump_rate':_0x1d5b6a['exitOrJumpRate'],'stages':_0x1d5b6a[_0x4dec94(0x22e)]}},'url':_0x28acd9};return await handleSingleObjectOutput(_0x59b845,_0x26bdce),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a28_0x4d4d86(0x233)]=a28_0x4d4d86(0x20f);[a28_0x4d4d86(0x1a3)]='Show\x20journey\x20statistics';async[a28_0x4d4d86(0x1b9)](_0xcc1ccc){const _0x990ac9=a28_0x4d4d86,{options:_0x2b9fda,args:_0x563848,tdx:_0x1690fb}=_0xcc1ccc,_0x4e7f46=_0x563848[0x0];if(!requireNameOrPath(_0x4e7f46))return 0x1;_0x2b9fda[_0x990ac9(0x217)]&&console[_0x990ac9(0x1cd)]('Input:\x20'+_0x4e7f46);const _0x38b8d8=_0x2b9fda,_0x948fcb=_0x38b8d8[_0x990ac9(0x19e)],_0x50d088=_0x38b8d8['to'],_0x4eb07d=_0x38b8d8[_0x990ac9(0x1e7)],_0x287cea=_0x38b8d8['stage'];_0x4eb07d&&!_0x948fcb&&!_0x50d088&&console[_0x990ac9(0x1cd)]('Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history');const _0x4168b2=_0x4eb07d?withJsonFormat(_0x2b9fda):_0x2b9fda,{journeyId:_0x16ebd1,journeyName:_0x441841}=await resolveJourneyIdFromInput(_0x4e7f46,_0x4168b2,_0x1690fb),_0x328330=_0x948fcb||_0x50d088?{'from':_0x948fcb,'to':_0x50d088}:undefined,_0x3a21a5=await withSpinner('Getting\x20journey\x20statistics...',()=>Promise[_0x990ac9(0x235)]([_0x1690fb[_0x990ac9(0x276)][_0x990ac9(0x20c)](_0x16ebd1),_0x1690fb['journey'][_0x990ac9(0x1b2)](_0x16ebd1,_0x328330)]),{'verbose':_0x4168b2[_0x990ac9(0x217)]}),[_0x1eb54f,_0x25dbef]=_0x3a21a5['data'];if(!_0x25dbef||_0x25dbef[_0x990ac9(0x273)]===null)return console['error']('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x441841),console[_0x990ac9(0x1cd)](_0x990ac9(0x198)),0x0;const _0x2e8521=buildStageNameMap(_0x1eb54f),_0x1d8ac6=!!(_0x328330&&_0x25dbef[_0x990ac9(0x210)]?.[_0x990ac9(0x18c)]),_0x3738bd={'stageNameMap':_0x2e8521,'hasPeriod':_0x1d8ac6,'includeHistory':!!_0x4eb07d};if(_0x287cea&&_0x25dbef[_0x990ac9(0x22e)]){const _0xafd151=_0x25dbef[_0x990ac9(0x22e)][_0x990ac9(0x24b)](_0x44c86e=>{const _0x21f85f=_0x990ac9,_0x387c57=_0x2e8521['get'](_0x44c86e['id'])??'';return _0x387c57[_0x21f85f(0x184)]()===_0x287cea[_0x21f85f(0x184)]();});if(_0xafd151)return await handleSingleObjectOutput(formatStageStats(_0xafd151,_0x3738bd),_0x4168b2),0x0;const _0x3cf312=_0x25dbef[_0x990ac9(0x22e)][_0x990ac9(0x203)](_0x455071=>_0x2e8521['get'](_0x455071['id'])??_0x455071['id']);return console['error'](_0x990ac9(0x1ae)+_0x287cea+_0x990ac9(0x1ee)),console[_0x990ac9(0x1cd)](_0x990ac9(0x1f7)+_0x3cf312['join'](',\x20')),0x1;}const _0x5e0642=_0x25dbef['stages']?.['map'](_0xd13d28=>formatStageStats(_0xd13d28,_0x3738bd)),_0x1a4d5d=assembleJourneyStats(_0x25dbef,{'from':_0x948fcb,'to':_0x50d088,'includeHistory':_0x4eb07d});return await this[_0x990ac9(0x1a1)](_0x1a4d5d,_0x5e0642??[],_0x4168b2),0x0;}async[a28_0x4d4d86(0x1a1)](_0x3c7ec0,_0x139498,_0x5b0242){const _0x2c7100=a28_0x4d4d86,_0x361f58=_0x5b0242[_0x2c7100(0x259)]===_0x2c7100(0x1e3)||_0x5b0242[_0x2c7100(0x259)]===_0x2c7100(0x21a)||_0x5b0242[_0x2c7100(0x1e3)]||_0x5b0242['jsonl'];if(_0x361f58){_0x3c7ec0[_0x2c7100(0x22e)]=_0x139498,await handleSingleObjectOutput(_0x3c7ec0,_0x5b0242);return;}await handleSingleObjectOutput(_0x3c7ec0,_0x5b0242);for(const _0x2e946c of _0x139498){console[_0x2c7100(0x291)](''),console['log'](String(a28_0x4474e0['cyan'][_0x2c7100(0x1c0)]('['+_0x2e946c[_0x2c7100(0x233)]+']'))+a28_0x4474e0[_0x2c7100(0x1ef)]('\x20'+_0x2e946c['id']));const {id:_0x42227e,name:_0x2094f9,..._0x1f1818}=_0x2e946c;await handleSingleObjectOutput(_0x1f1818,_0x5b0242);}}}export class JourneyTrafficCommand extends BaseCommand{[a28_0x4d4d86(0x233)]=a28_0x4d4d86(0x1d6);[a28_0x4d4d86(0x1a3)]=a28_0x4d4d86(0x227);async[a28_0x4d4d86(0x1b9)](_0x2ff006){const _0x805ea=a28_0x4d4d86,{options:_0x3d5764,args:_0x43512e,tdx:_0x42d455}=_0x2ff006,_0x332ae3=_0x43512e[0x0];if(!requireNameOrPath(_0x332ae3))return 0x1;_0x3d5764[_0x805ea(0x217)]&&console[_0x805ea(0x1cd)]('Input:\x20'+_0x332ae3);const _0x2d8a7b=_0x3d5764,_0x293852=_0x2d8a7b[_0x805ea(0x251)],_0x28ebec=_0x2d8a7b[_0x805ea(0x19e)],_0x1ac7bd=_0x2d8a7b['to'],_0x35491c=_0x2d8a7b[_0x805ea(0x1a0)];if(_0x293852&&_0x293852!==_0x805ea(0x25a)&&_0x293852!==_0x805ea(0x181))return console[_0x805ea(0x1cd)](_0x805ea(0x243)+_0x293852+_0x805ea(0x272)),0x1;const _0x473275=withJsonFormat(_0x3d5764),{journeyId:_0x51d6ad,journeyName:_0x35e732}=await resolveJourneyIdFromInput(_0x332ae3,_0x473275,_0x42d455),_0x168336={'type':_0x293852,'from':_0x28ebec,'to':_0x1ac7bd,'limit':_0x35491c},_0x359ba1=await withSpinner(_0x805ea(0x1a9),()=>_0x42d455[_0x805ea(0x276)][_0x805ea(0x20b)](_0x51d6ad,_0x168336),{'verbose':_0x473275[_0x805ea(0x217)]}),_0x30b130=_0x359ba1[_0x805ea(0x26d)],_0x19aef2=_0x30b130[_0x805ea(0x25a)]&&(_0x30b130[_0x805ea(0x25a)][_0x805ea(0x290)][_0x805ea(0x18c)]>0x0||_0x30b130[_0x805ea(0x25a)][_0x805ea(0x1a5)][_0x805ea(0x18c)]>0x0),_0x1ac608=_0x30b130[_0x805ea(0x181)]&&_0x30b130[_0x805ea(0x181)][_0x805ea(0x18c)]>0x0;if(!_0x19aef2&&!_0x1ac608)return console[_0x805ea(0x1cd)](_0x805ea(0x252)+_0x35e732),console[_0x805ea(0x1cd)](_0x805ea(0x241)),_0x28ebec&&_0x1ac7bd&&console[_0x805ea(0x1cd)](_0x805ea(0x27f)),0x0;return await handleSingleObjectOutput(_0x30b130,_0x473275),0x0;}}function formatStageStats(_0x123dbd,_0x1121b1){const _0x3fd692=a28_0x4d4d86,_0x535b48=_0x1121b1[_0x3fd692(0x1f3)]&&_0x123dbd[_0x3fd692(0x210)]?.[_0x3fd692(0x18c)]?aggregateStageHistory(_0x123dbd[_0x3fd692(0x210)]):{'size':_0x123dbd[_0x3fd692(0x202)],'entered':_0x123dbd[_0x3fd692(0x21e)],'milestone':_0x123dbd[_0x3fd692(0x1c7)],'milestone_rate':_0x123dbd[_0x3fd692(0x211)],'exit_or_jump':_0x123dbd[_0x3fd692(0x249)],'exit_or_jump_rate':_0x123dbd[_0x3fd692(0x1e0)]},_0x8fffe7={'id':_0x123dbd['id'],'name':_0x1121b1[_0x3fd692(0x1b0)]['get'](_0x123dbd['id'])??_0x123dbd['id'],..._0x535b48};return _0x1121b1[_0x3fd692(0x1f3)]&&_0x1121b1['includeHistory']&&_0x123dbd[_0x3fd692(0x210)]&&(_0x8fffe7['history']=_0x123dbd[_0x3fd692(0x210)]),_0x8fffe7;}export class JourneyPauseCommand extends BaseCommand{[a28_0x4d4d86(0x233)]='journey:pause';[a28_0x4d4d86(0x1a3)]='Pause\x20a\x20running\x20journey';async[a28_0x4d4d86(0x1b9)](_0x3fcacb){const _0x1e4cc6=a28_0x4d4d86,{options:_0x3c303b,args:_0xa752ba,tdx:_0x5efd13}=_0x3fcacb,_0x18d4a6=_0xa752ba[0x0];if(!requireNameOrPath(_0x18d4a6))return 0x1;_0x3c303b[_0x1e4cc6(0x217)]&&console[_0x1e4cc6(0x1cd)](_0x1e4cc6(0x287)+_0x18d4a6);const {journeyId:_0x2535df,journeyName:_0x2cb045}=await resolveJourneyIdFromInput(_0x18d4a6,_0x3c303b,_0x5efd13);if(!_0x3c303b[_0x1e4cc6(0x239)]){const _0x1e3e11=await confirm(_0x1e4cc6(0x1d9)+_0x2cb045+'\x22?');if(!_0x1e3e11)return console['error']('Cancelled'),0x0;}const _0x2df818=await withSpinner(_0x1e4cc6(0x283),()=>_0x5efd13['journey'][_0x1e4cc6(0x197)](_0x2535df),{'verbose':_0x3c303b['verbose']}),_0x12b3c7=_0x2df818[_0x1e4cc6(0x26d)];return console['error']('✔\x20Journey\x20\x22'+_0x12b3c7['attributes'][_0x1e4cc6(0x233)]+_0x1e4cc6(0x25d)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a28_0x4d4d86(0x233)]=a28_0x4d4d86(0x195);['description']=a28_0x4d4d86(0x1ad);async[a28_0x4d4d86(0x1b9)](_0xf3de0f){const _0x447499=a28_0x4d4d86,{options:_0x1c73d9,args:_0xe0b46e,tdx:_0xe60e07}=_0xf3de0f,_0x4bf5e5=_0xe0b46e[0x0];if(!requireNameOrPath(_0x4bf5e5))return 0x1;_0x1c73d9[_0x447499(0x217)]&&console[_0x447499(0x1cd)](_0x447499(0x287)+_0x4bf5e5);const {journeyId:_0xf68519,journeyName:_0x5be6b3}=await resolveJourneyIdFromInput(_0x4bf5e5,_0x1c73d9,_0xe60e07);if(!_0x1c73d9[_0x447499(0x239)]){const _0x28e595=await confirm(_0x447499(0x19d)+_0x5be6b3+'\x22?');if(!_0x28e595)return console['error']('Cancelled'),0x0;}const _0x14c426=await withSpinner(_0x447499(0x1e8),()=>_0xe60e07[_0x447499(0x276)][_0x447499(0x18e)](_0xf68519),{'verbose':_0x1c73d9[_0x447499(0x217)]}),_0x590404=_0x14c426[_0x447499(0x26d)];return console[_0x447499(0x1cd)](_0x447499(0x1f1)+_0x590404[_0x447499(0x208)][_0x447499(0x233)]+_0x447499(0x1dc)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a28_0x4d4d86(0x233)]=a28_0x4d4d86(0x231);[a28_0x4d4d86(0x1a3)]='Export\x20journey(s)\x20as\x20YAML\x20files';async[a28_0x4d4d86(0x1b9)](_0x54cae1){const _0x4299ad=a28_0x4d4d86,{options:_0x2977bc,args:_0x57dcda,tdx:_0x34db8e}=_0x54cae1,_0x101303=_0x2977bc,_0x5a6ab2=_0x57dcda[0x0],_0x373f6c=_0x5a6ab2&&isYamlFilePath(_0x5a6ab2),_0x41d9fe=await resolveTarget({'arg':_0x373f6c?_0x5a6ab2:undefined,'contextParent':_0x2977bc['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x41d9fe))return _0x41d9fe['errorCode']==='no_parent'?(console[_0x4299ad(0x1cd)](a28_0x4474e0[_0x4299ad(0x270)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x4299ad(0x1cd)](_0x4299ad(0x1d0)),console['error'](_0x4299ad(0x258)),console[_0x4299ad(0x1cd)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0x4299ad(0x1cd)](_0x4299ad(0x183))):(console[_0x4299ad(0x1cd)](a28_0x4474e0[_0x4299ad(0x24a)]('Error:\x20'+_0x41d9fe[_0x4299ad(0x23b)]+'\x0a')),_0x41d9fe[_0x4299ad(0x27a)]&&console[_0x4299ad(0x1cd)](a28_0x4474e0[_0x4299ad(0x1c3)](_0x41d9fe[_0x4299ad(0x27a)]))),0x1;let _0x16e8c7=_0x373f6c?undefined:_0x5a6ab2,_0x3f8b97,_0x1c75bd;_0x41d9fe[_0x4299ad(0x251)]===_0x4299ad(0x225)&&(_0x16e8c7=_0x41d9fe[_0x4299ad(0x244)],_0x3f8b97=_0x41d9fe[_0x4299ad(0x18f)],_0x1c75bd=_0x41d9fe[_0x4299ad(0x23e)]);const _0x473227=_0x41d9fe[_0x4299ad(0x285)],_0x1072d4=_0x41d9fe[_0x4299ad(0x24c)];_0x101303[_0x4299ad(0x217)]&&(console[_0x4299ad(0x1cd)]('Parent\x20segment:\x20'+_0x473227),console[_0x4299ad(0x1cd)]('Target\x20directory:\x20'+_0x1072d4),_0x16e8c7&&console[_0x4299ad(0x1cd)](_0x4299ad(0x234)+_0x16e8c7),_0x3f8b97&&console[_0x4299ad(0x1cd)]('Target\x20file:\x20'+_0x3f8b97),_0x1c75bd&&console[_0x4299ad(0x1cd)](_0x4299ad(0x1de)+_0x1c75bd));const _0x5ebbb2=await withSpinner(_0x4299ad(0x250),()=>_0x34db8e[_0x4299ad(0x1ed)][_0x4299ad(0x278)](_0x473227),{'verbose':_0x2977bc[_0x4299ad(0x217)]}),_0x57defd=_0x5ebbb2[_0x4299ad(0x26d)],{journeys:_0x1ce01b,folders:_0xe2e803}=await withSpinner(_0x4299ad(0x196),async()=>{const _0x45acbb=_0x4299ad,[_0x15b355,_0xd8c10a]=await Promise[_0x45acbb(0x235)]([_0x34db8e[_0x45acbb(0x276)][_0x45acbb(0x292)](_0x57defd,undefined,{'includeAllVersions':!![]}),_0x34db8e[_0x45acbb(0x1ed)][_0x45acbb(0x24f)](_0x57defd)]);return{'journeys':_0x15b355,'folders':_0xd8c10a};},{'verbose':_0x2977bc['verbose']})[_0x4299ad(0x22f)](_0x132b75=>_0x132b75[_0x4299ad(0x26d)]);let _0x6c98b6=_0x1ce01b;const _0x2a972c=buildFolderIdToPathMap(_0xe2e803);if(_0x16e8c7){const _0x3d881c=_0x6c98b6[_0x4299ad(0x22b)](_0x141bfe=>_0x141bfe[_0x4299ad(0x213)][_0x4299ad(0x184)]()===_0x16e8c7['toLowerCase']());if(_0x3d881c[_0x4299ad(0x18c)]===0x0)return console['error'](_0x4299ad(0x228)+_0x16e8c7),console['error'](_0x4299ad(0x248)),0x1;_0x6c98b6=_0x3d881c;}if(_0x1c75bd!==undefined){const _0x46f9bf=_0x6c98b6['filter'](_0x2b1d4f=>{const _0x1341d0=_0x4299ad,_0x14849a=_0x2b1d4f['folderId']?_0x2a972c[_0x1341d0(0x1ec)](_0x2b1d4f[_0x1341d0(0x20e)])||'':'';return _0x14849a===_0x1c75bd;});if(_0x46f9bf['length']===0x0&&_0x6c98b6['length']>0x0){console['error']('Error:\x20Journey\x20\x27'+_0x16e8c7+_0x4299ad(0x219)+(_0x1c75bd||_0x4299ad(0x268))),console[_0x4299ad(0x1cd)](_0x4299ad(0x242));for(const _0x2862bd of _0x6c98b6){const _0x4b31f1=_0x2862bd[_0x4299ad(0x20e)]?_0x2a972c['get'](_0x2862bd[_0x4299ad(0x20e)])||'':'';console[_0x4299ad(0x1cd)](_0x4299ad(0x1bd)+(_0x4b31f1||'(root)')+'/'+_0x2862bd[_0x4299ad(0x213)]);}return 0x1;}_0x6c98b6=_0x46f9bf;}if(_0x6c98b6[_0x4299ad(0x18c)]===0x0)return console['error']('No\x20journeys\x20found'),0x0;const _0x26a98c=new Map();for(const _0x4ed8ba of _0x6c98b6){const _0x548869=_0x4ed8ba[_0x4299ad(0x18d)];!_0x26a98c['has'](_0x548869)&&_0x26a98c['set'](_0x548869,[]),_0x26a98c[_0x4299ad(0x1ec)](_0x548869)['push'](_0x4ed8ba);}for(const _0x4546a8 of _0x26a98c[_0x4299ad(0x1a7)]()){_0x4546a8[_0x4299ad(0x274)]((_0x36d479,_0x10b46e)=>(_0x36d479[_0x4299ad(0x1b5)]||0x0)-(_0x10b46e['versionNumber']||0x0));}const _0x41e5ee=[],{idToEmailMap:_0x1746c2,connectionIdToNameMap:_0x5ca9dd}=await withSpinner(_0x4299ad(0x28c),async()=>{const _0x2dd53e=_0x4299ad,[_0x34072e,_0x2d9e25]=await Promise['all']([_0x34db8e[_0x2dd53e(0x279)][_0x2dd53e(0x277)](),_0x34db8e['connection'][_0x2dd53e(0x1e6)]()]);return{'idToEmailMap':_0x34072e,'connectionIdToNameMap':_0x2d9e25};},{'verbose':_0x2977bc[_0x4299ad(0x217)]})['then'](_0x35ad7e=>_0x35ad7e[_0x4299ad(0x26d)]);for(const _0x63e3f of _0x26a98c['values']()){const _0x3e0d3d=_0x63e3f[0x0][_0x4299ad(0x213)],_0x2255d7=_0x63e3f[0x0][_0x4299ad(0x20e)],_0x3a62d6=_0x2255d7?_0x2a972c[_0x4299ad(0x1ec)](_0x2255d7)||'':'',_0x4e8b50=_0x3a62d6?a28_0x3aa0f7[_0x4299ad(0x288)](_0x1072d4,_0x3a62d6):_0x1072d4,_0x15980e=_0x3f8b97||a28_0x3aa0f7[_0x4299ad(0x288)](_0x4e8b50,sanitizeFileName(_0x3e0d3d)+_0x4299ad(0x255));let _0x36f7fd,_0x59b9bf;if(existsSync(_0x15980e))try{const _0x23f6d0=readFileSync(_0x15980e,_0x4299ad(0x27d)),_0x2c1ac1=parseYamlString(_0x23f6d0);_0x59b9bf=_0x2c1ac1,_0x36f7fd=buildRuleToNameMapping(_0x2c1ac1),_0x101303[_0x4299ad(0x217)]&&_0x36f7fd[_0x4299ad(0x202)]>0x0&&console[_0x4299ad(0x1cd)](_0x4299ad(0x1d2)+_0x36f7fd[_0x4299ad(0x202)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x3e0d3d);}catch(_0x1df7cc){_0x101303[_0x4299ad(0x217)]&&console[_0x4299ad(0x1cd)](_0x4299ad(0x24d)+_0x1df7cc[_0x4299ad(0x23b)]);}const _0x32f382=[],_0x377588=new Set(),_0x293d1b=new Map(),_0x15fad0=new Map(),_0x4966dd=new Set(),_0x9f3e13=new Map(),_0x29d6bb=new Map(),_0x3b9eb2=createJumpTargetCache();await withProgressSpinner('Fetching\x20'+_0x3e0d3d+_0x4299ad(0x1fa),async _0x3abe3f=>{const _0x51cf4c=_0x4299ad;for(const _0x35d2d7 of _0x63e3f){const _0x24c5d5=_0x63e3f['length']>0x1?_0x35d2d7[_0x51cf4c(0x213)]+'\x20v'+(_0x35d2d7[_0x51cf4c(0x1b5)]||0x1):_0x35d2d7[_0x51cf4c(0x213)];_0x3abe3f[_0x51cf4c(0x253)](_0x51cf4c(0x1e9)+_0x24c5d5);const _0x2f9976=await _0x34db8e[_0x51cf4c(0x276)][_0x51cf4c(0x20c)](_0x35d2d7['id']),_0x2a36d3=_0x2f9976[_0x51cf4c(0x208)]?.[_0x51cf4c(0x275)],_0x5a92f={'resolveSegment':async _0x1bdf50=>{const _0x1cf2be=_0x51cf4c;if(!_0x2a36d3)return{'name':_0x1bdf50,'isJourneyLocal':![]};const _0x4d9ed6=_0x293d1b[_0x1cf2be(0x1ec)](_0x1bdf50);if(_0x4d9ed6)return _0x4d9ed6;try{const _0x1a8f6a=await _0x34db8e['segment']['getSegment'](_0x2a36d3,_0x1bdf50),_0x390a45=_0x1a8f6a[_0x1cf2be(0x1f8)]===SEGMENT_KIND_JOURNEY;let _0x16348f,_0x469abf=_0x1a8f6a[_0x1cf2be(0x233)];if(_0x390a45&&_0x1a8f6a[_0x1cf2be(0x25f)]){const _0x5920d6=await segmentResponseToDef(_0x1a8f6a,{'resolveSegmentName':async _0x2a6d2d=>{const _0x13781b=_0x1cf2be,_0x2f8099=_0x293d1b['get'](_0x2a6d2d);if(_0x2f8099)return _0x2f8099[_0x13781b(0x233)];const _0x41d4aa=await _0x5a92f['resolveSegment'](_0x2a6d2d);return _0x41d4aa[_0x13781b(0x233)];}}),_0x43ef0a=_0x5920d6[_0x1cf2be(0x25f)];_0x16348f={'description':_0x1a8f6a[_0x1cf2be(0x1a3)],'rule':_0x43ef0a};const _0x2da19c=serializeRule(_0x43ef0a),_0x352001=_0x15fad0[_0x1cf2be(0x1ec)](_0x2da19c);if(_0x352001)_0x469abf=_0x352001,_0x16348f=undefined,_0x101303[_0x1cf2be(0x217)]&&console[_0x1cf2be(0x1cd)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x1a8f6a[_0x1cf2be(0x233)]+_0x1cf2be(0x286)+_0x352001);else{let _0x1bd531=![];if(_0x36f7fd){const _0x168b6f=_0x36f7fd[_0x1cf2be(0x1ec)](_0x2da19c);if(_0x168b6f){const _0x5436cd=_0x168b6f['find'](_0x552ee0=>!_0x377588[_0x1cf2be(0x269)](_0x552ee0));_0x5436cd&&(_0x469abf=_0x5436cd,_0x377588[_0x1cf2be(0x216)](_0x5436cd),_0x15fad0[_0x1cf2be(0x24e)](_0x2da19c,_0x5436cd),_0x1bd531=!![],_0x101303['verbose']&&console[_0x1cf2be(0x1cd)](_0x1cf2be(0x1e1)+_0x5436cd+_0x1cf2be(0x1cc)));}}if(!_0x1bd531){const _0x5d30ad=generateJourneyLocalName(_0x1a8f6a[_0x1cf2be(0x233)]);_0x5d30ad&&(_0x469abf=_0x5d30ad);let _0x43de72=_0x469abf,_0x6e774a=0x2;while(_0x377588[_0x1cf2be(0x269)](_0x43de72)){_0x43de72=_0x469abf+'_'+_0x6e774a,_0x6e774a++;}_0x377588[_0x1cf2be(0x216)](_0x43de72),_0x15fad0[_0x1cf2be(0x24e)](_0x2da19c,_0x43de72),_0x469abf=_0x43de72;}}}const _0xd8121f={'name':_0x469abf,'isJourneyLocal':_0x390a45,'definition':_0x16348f};return _0x293d1b[_0x1cf2be(0x24e)](_0x1bdf50,_0xd8121f),_0xd8121f;}catch(_0x5821db){return _0x2977bc['verbose']&&console[_0x1cf2be(0x1cd)](_0x1cf2be(0x201)+_0x1bdf50+':\x20'+_0x5821db[_0x1cf2be(0x23b)]),{'name':_0x1bdf50,'isJourneyLocal':![]};}},'resolveActivation':async _0xd9aab=>{const _0x54e994=_0x51cf4c,_0x3c2d4f=_0x9f3e13[_0x54e994(0x1ec)](_0xd9aab);if(_0x3c2d4f)return _0x3c2d4f;try{const _0xcd95d1=await _0x34db8e['journey'][_0x54e994(0x200)](_0x35d2d7['id'],_0xd9aab),_0x562354=journeyActivationStepToYaml(_0xcd95d1,_0x1746c2,_0x5ca9dd),_0x108f64=JSON[_0x54e994(0x265)]({'name':_0x562354[_0x54e994(0x233)],'connection':_0x562354['connection'],'connector_config':_0x562354[_0x54e994(0x246)]}),_0x227406=_0x29d6bb[_0x54e994(0x1ec)](_0x108f64);if(_0x227406){const _0x181b9f={'name':_0x227406,'isJourneyLocal':!![],'definition':_0x562354};return _0x9f3e13['set'](_0xd9aab,_0x181b9f),_0x181b9f;}const _0x497518=_0xcd95d1[_0x54e994(0x208)][_0x54e994(0x1bc)][_0x54e994(0x233)]||_0xd9aab,_0x42816d=sanitizeYamlKey(_0x497518)||_0x54e994(0x28a)+_0xd9aab;let _0x96f1dc=_0x42816d,_0x4266ee=0x2;while(_0x4966dd[_0x54e994(0x269)](_0x96f1dc)){_0x96f1dc=_0x42816d+'_'+_0x4266ee,_0x4266ee++;}_0x4966dd[_0x54e994(0x216)](_0x96f1dc),_0x29d6bb[_0x54e994(0x24e)](_0x108f64,_0x96f1dc);const _0x3cc2b6={'name':_0x96f1dc,'isJourneyLocal':!![],'definition':_0x562354};return _0x9f3e13['set'](_0xd9aab,_0x3cc2b6),_0x3cc2b6;}catch(_0xfd680a){return _0x2977bc[_0x54e994(0x217)]&&console[_0x54e994(0x1cd)]('Warning:\x20Could\x20not\x20resolve\x20activation\x20'+_0xd9aab+':\x20'+_0xfd680a[_0x54e994(0x23b)]),{'name':_0xd9aab,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x3674fb,_0x13a6fd)=>{const _0x5cb913=_0x51cf4c;return resolveJumpTarget(_0x3674fb,_0x13a6fd,_0x3b9eb2,_0x5c4a38=>_0x34db8e[_0x5cb913(0x276)][_0x5cb913(0x20c)](_0x5c4a38));}},_0x52cce7=await journeyResponseToDef(_0x2f9976,_0x5a92f);_0x32f382[_0x51cf4c(0x1bb)]({'item':_0x35d2d7,'yaml':_0x52cce7});}},{'verbose':_0x2977bc[_0x4299ad(0x217)]});const _0x118606=await _0x34db8e[_0x4299ad(0x276)][_0x4299ad(0x182)](_0x63e3f[0x0]['journeyBundleId']),_0x4ecd20=buildMergedJourneyDef(_0x32f382,_0x36f7fd,_0x118606),_0x197cdc=normalizeJourneyDef(_0x4ecd20,_0x59b9bf),_0x4ef554=toYamlString(_0x197cdc),_0x19c187=_0x3f8b97||a28_0x3aa0f7[_0x4299ad(0x288)](_0x4e8b50,sanitizeFileName(_0x3e0d3d)+'.yml');!_0x3f8b97&&_0x3a62d6&&!existsSync(_0x4e8b50)&&mkdirSync(_0x4e8b50,{'recursive':!![]});const _0x44fcba=a28_0x3aa0f7[_0x4299ad(0x1eb)](process['cwd'](),_0x19c187);if(existsSync(_0x19c187)){const _0x93af09=readFileSync(_0x19c187,_0x4299ad(0x27d)),_0x192e29=generateDiff(_0x93af09,_0x4ef554),_0x2bfa7a=hasChanges(_0x192e29);_0x41e5ee[_0x4299ad(0x1bb)]({'relativePath':_0x44fcba,'absolutePath':_0x19c187,'content':_0x4ef554,'isNew':![],'hasChanges':_0x2bfa7a,'diff':_0x2bfa7a?formatDiffWithColors(_0x192e29):undefined});}else _0x41e5ee[_0x4299ad(0x1bb)]({'relativePath':_0x44fcba,'absolutePath':_0x19c187,'content':_0x4ef554,'isNew':!![],'hasChanges':![]});}const _0x595816=_0x41e5ee[_0x4299ad(0x22b)](_0x3f7ef2=>_0x3f7ef2[_0x4299ad(0x192)]),_0x3e0a48=_0x41e5ee[_0x4299ad(0x22b)](_0x66b4a6=>!_0x66b4a6['isNew']&&_0x66b4a6[_0x4299ad(0x21c)]),_0x95f1db=_0x41e5ee[_0x4299ad(0x22b)](_0x5e196d=>!_0x5e196d[_0x4299ad(0x192)]&&!_0x5e196d[_0x4299ad(0x21c)]),_0xdc8dd4=_0x6c98b6['length'],_0x4b67a5=_0x26a98c[_0x4299ad(0x202)],_0x26b0eb=_0xdc8dd4>_0x4b67a5?'\x20('+_0xdc8dd4+_0x4299ad(0x25c):'';console[_0x4299ad(0x1cd)]('\x0aPull\x20summary:'),console['error']('\x20\x20'+a28_0x4474e0[_0x4299ad(0x1c3)](_0x4b67a5+'\x20journeys')+a28_0x4474e0['dim'](_0x26b0eb)),console[_0x4299ad(0x1cd)]('\x20\x20'+a28_0x4474e0['green']('+\x20'+_0x595816[_0x4299ad(0x18c)]+_0x4299ad(0x21d))),console[_0x4299ad(0x1cd)]('\x20\x20'+a28_0x4474e0[_0x4299ad(0x270)]('~\x20'+_0x3e0a48[_0x4299ad(0x18c)]+'\x20changed\x20files')),console['error']('\x20\x20'+a28_0x4474e0[_0x4299ad(0x1ef)]('=\x20'+_0x95f1db[_0x4299ad(0x18c)]+'\x20unchanged\x20files')),console['error'](_0x4299ad(0x229)+a28_0x4474e0[_0x4299ad(0x1c3)](_0x1072d4)+'\x0a');if(_0x3e0a48['length']>0x0)for(const _0x241026 of _0x3e0a48){console['error'](_0x4299ad(0x1b7)+_0x241026[_0x4299ad(0x1f4)]+'\x27:'),console[_0x4299ad(0x1cd)]('─'['repeat'](0x3c)),console[_0x4299ad(0x1cd)](_0x241026[_0x4299ad(0x1c8)]),console[_0x4299ad(0x1cd)]('─'[_0x4299ad(0x224)](0x3c));}if(_0x101303[_0x4299ad(0x218)])return console[_0x4299ad(0x1cd)](a28_0x4474e0[_0x4299ad(0x270)](_0x4299ad(0x1f2))),0x0;if(_0x595816[_0x4299ad(0x18c)]===0x0&&_0x3e0a48['length']===0x0)return console[_0x4299ad(0x1cd)](a28_0x4474e0['green'](_0x4299ad(0x194))),saveSessionContext({'parent_segment':_0x473227},_0x101303[_0x4299ad(0x1da)]),console[_0x4299ad(0x1cd)](a28_0x4474e0[_0x4299ad(0x1f0)](_0x4299ad(0x204)+a28_0x4474e0[_0x4299ad(0x1ef)](_0x4299ad(0x1be))+_0x4299ad(0x1fc)+a28_0x4474e0[_0x4299ad(0x1c3)](_0x473227))),0x0;if(!_0x101303[_0x4299ad(0x239)]&&(_0x595816[_0x4299ad(0x18c)]>0x0||_0x3e0a48[_0x4299ad(0x18c)]>0x0)){if(!isInteractive())return console[_0x4299ad(0x1cd)](a28_0x4474e0[_0x4299ad(0x24a)](_0x4299ad(0x22c)),_0x4299ad(0x1d7)),console[_0x4299ad(0x1cd)](a28_0x4474e0['dim'](_0x4299ad(0x1ea))),0x1;const _0x479512=await confirmKey(_0x4299ad(0x199)+(_0x595816[_0x4299ad(0x18c)]+_0x3e0a48[_0x4299ad(0x18c)])+_0x4299ad(0x23f));if(!_0x479512)return console[_0x4299ad(0x1cd)](a28_0x4474e0[_0x4299ad(0x270)](_0x4299ad(0x25e)),'-\x20no\x20files\x20written'),0x1;}!existsSync(_0x1072d4)&&mkdirSync(_0x1072d4,{'recursive':!![]});const _0x31c1f1=a28_0x3aa0f7[_0x4299ad(0x288)](_0x1072d4,_0x4299ad(0x1ab));writeFileSync(_0x31c1f1,createTdxConfigContent(_0x473227),_0x4299ad(0x27d));for(const _0x1ca77f of _0x41e5ee){(_0x1ca77f[_0x4299ad(0x192)]||_0x1ca77f[_0x4299ad(0x21c)])&&writeFileSync(_0x1ca77f['absolutePath'],_0x1ca77f['content'],_0x4299ad(0x27d));}return console[_0x4299ad(0x1cd)](a28_0x4474e0[_0x4299ad(0x1f0)](_0x4299ad(0x1d8)+(_0x595816[_0x4299ad(0x18c)]+_0x3e0a48[_0x4299ad(0x18c)])+_0x4299ad(0x1f6)+_0x1072d4)),saveSessionContext({'parent_segment':_0x473227},_0x101303[_0x4299ad(0x1da)]),console['error'](a28_0x4474e0[_0x4299ad(0x1f0)](_0x4299ad(0x204)+a28_0x4474e0[_0x4299ad(0x1ef)](_0x4299ad(0x1be))+_0x4299ad(0x1fc)+a28_0x4474e0[_0x4299ad(0x1c3)](_0x473227))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{['name']='journey:columns';[a28_0x4d4d86(0x1a3)]='Show\x20journey\x20table\x20column\x20mapping';async['execute'](_0x2e20d5){const _0x4db939=a28_0x4d4d86,{options:_0x575d55,args:_0x2976ba,tdx:_0x2238bb}=_0x2e20d5,_0x427fed=_0x2976ba[0x0];if(!requireNameOrPath(_0x427fed))return 0x1;_0x575d55[_0x4db939(0x217)]&&console[_0x4db939(0x1cd)](_0x4db939(0x287)+_0x427fed);const {journeyId:_0x2f5b03}=await resolveJourneyIdFromInput(_0x427fed,_0x575d55,_0x2238bb),_0x1d31e1=await withSpinner(_0x4db939(0x238),()=>_0x2238bb[_0x4db939(0x276)][_0x4db939(0x1b6)](_0x2f5b03),{'verbose':_0x575d55[_0x4db939(0x217)]}),_0x1deb9e=_0x1d31e1[_0x4db939(0x26d)];return console[_0x4db939(0x291)](_0x4db939(0x1a4)+_0x1deb9e[_0x4db939(0x281)]),console['log'](_0x4db939(0x1c1)+_0x1deb9e[_0x4db939(0x1d1)]),await handleSDKOutput(_0x1deb9e['columns'],_0x575d55),0x0;}}export class JourneyActivationsCommand extends BaseCommand{['name']=a28_0x4d4d86(0x186);[a28_0x4d4d86(0x1a3)]='List\x20activations\x20for\x20a\x20journey';async[a28_0x4d4d86(0x1b9)](_0x1f8f61){const _0x4c1b68=a28_0x4d4d86,{options:_0x4b7614,args:_0x28710c,tdx:_0x183cb1}=_0x1f8f61,_0x1ac3d7=_0x28710c[0x0];if(!requireNameOrPath(_0x1ac3d7))return 0x1;_0x4b7614['verbose']&&console['error'](_0x4c1b68(0x287)+_0x1ac3d7);const {journeyId:_0x228f84}=await resolveJourneyIdFromInput(_0x1ac3d7,_0x4b7614,_0x183cb1),_0x1401b2=await withSpinner(_0x4c1b68(0x261),()=>_0x183cb1['journey'][_0x4c1b68(0x1c5)](_0x228f84),{'verbose':_0x4b7614[_0x4c1b68(0x217)]}),_0x13611a=_0x1401b2[_0x4c1b68(0x26d)];return console[_0x4c1b68(0x1cd)](_0x4c1b68(0x1d2)+_0x13611a['length']+'\x20activation'+(_0x13611a[_0x4c1b68(0x18c)]!==0x1?'s':'')),await handleSDKOutput(_0x13611a,_0x4b7614),0x0;}}export class JourneyPushCommand extends BaseCommand{[a28_0x4d4d86(0x233)]='journey:push';[a28_0x4d4d86(0x1a3)]=a28_0x4d4d86(0x267);[a28_0x4d4d86(0x18a)]=new SegmentPushCommand();async[a28_0x4d4d86(0x1b9)](_0x42759a){const _0x319ff4=a28_0x4d4d86,_0x5ea6bf=_0x42759a[_0x319ff4(0x1a8)][0x0];let _0x2dada9;if(_0x5ea6bf){const _0x254b37=await resolveTarget({'arg':_0x5ea6bf,'contextParent':_0x42759a[_0x319ff4(0x20d)][_0x319ff4(0x271)],'cwd':process[_0x319ff4(0x193)]()});isSuccessfulResolution(_0x254b37)&&_0x254b37[_0x319ff4(0x251)]==='file'&&(_0x2dada9=_0x254b37[_0x319ff4(0x18f)]);}const _0xbc230a={..._0x42759a,'options':{..._0x42759a['options'],'journeysOnly':!![],..._0x2dada9&&{'singleFilePath':_0x2dada9}}};return this[_0x319ff4(0x18a)]['execute'](_0xbc230a);}}export class JourneyVersionsCommand extends BaseCommand{['name']=a28_0x4d4d86(0x1e5);[a28_0x4d4d86(0x1a3)]=a28_0x4d4d86(0x188);async[a28_0x4d4d86(0x1b9)](_0x3219ac){const _0x26c6c2=a28_0x4d4d86,{options:_0x2f7c58,args:_0x51c308,tdx:_0x255c96}=_0x3219ac,_0xb16bb7=_0x51c308[0x0];if(!requireNameOrPath(_0xb16bb7))return 0x1;if(_0x2f7c58[_0x26c6c2(0x217)])console['error'](_0x26c6c2(0x287)+_0xb16bb7);const {journeyId:_0x276a27}=await resolveJourneyIdFromInput(_0xb16bb7,_0x2f7c58,_0x255c96),_0x3c9986=await withSpinner(_0x26c6c2(0x187),()=>_0x255c96[_0x26c6c2(0x276)][_0x26c6c2(0x206)](_0x276a27),{'verbose':_0x2f7c58[_0x26c6c2(0x217)]}),{bundleName:_0x11f408,versions:_0x1a1308,latestJourneyId:_0x1313e3}=_0x3c9986['data'];console['error'](_0x11f408+':\x20'+_0x1a1308[_0x26c6c2(0x18c)]+_0x26c6c2(0x26f)+(_0x1a1308[_0x26c6c2(0x18c)]!==0x1?'s':''));const _0x194bf1=_0x1a1308[_0x26c6c2(0x203)](_0x289ff7=>({'version':_0x289ff7[_0x26c6c2(0x1b5)],'journey_id':_0x289ff7['journeyId'],'name':_0x289ff7['name'],'state':_0x289ff7[_0x26c6c2(0x25b)],'paused':_0x289ff7['paused'],'latest':_0x289ff7[_0x26c6c2(0x273)]===_0x1313e3,'created_at':_0x289ff7[_0x26c6c2(0x289)]}));return await handleSDKOutput(_0x194bf1,_0x2f7c58),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{[a28_0x4d4d86(0x233)]='journey:version:create';[a28_0x4d4d86(0x1a3)]='Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey';async[a28_0x4d4d86(0x1b9)](_0x4b0d7c){const _0xe032e6=a28_0x4d4d86,{options:_0x139f2d,args:_0x545ded,tdx:_0x1b324e}=_0x4b0d7c,_0x4abf29=_0x545ded[0x0];if(!requireNameOrPath(_0x4abf29))return 0x1;if(_0x139f2d[_0xe032e6(0x217)])console['error'](_0xe032e6(0x287)+_0x4abf29);const {journeyId:_0x2fad12,journeyName:_0x34e627}=await resolveJourneyIdFromInput(_0x4abf29,_0x139f2d,_0x1b324e);if(!_0x139f2d[_0xe032e6(0x239)]){const _0x14527a=await confirm(_0xe032e6(0x23a)+_0x34e627+'\x22?');if(!_0x14527a)return console[_0xe032e6(0x1cd)](_0xe032e6(0x207)),0x0;}const _0x34c2c7=await withSpinner(_0xe032e6(0x1b1),()=>_0x1b324e[_0xe032e6(0x276)][_0xe032e6(0x1ca)](_0x2fad12),{'verbose':_0x139f2d[_0xe032e6(0x217)]}),_0x4b209e=_0x34c2c7[_0xe032e6(0x26d)];return console[_0xe032e6(0x1cd)](a28_0x4474e0['green']('✔')+_0xe032e6(0x262)+_0x4b209e[_0xe032e6(0x208)]['versionNumber']+_0xe032e6(0x1d3)+_0x4b209e[_0xe032e6(0x208)][_0xe032e6(0x233)]+'\x22'),console[_0xe032e6(0x1cd)]('\x20\x20Journey\x20ID:\x20'+_0x4b209e['id']),await handleSingleObjectOutput({'id':_0x4b209e['id'],'name':_0x4b209e[_0xe032e6(0x208)][_0xe032e6(0x233)],'version':_0x4b209e['attributes'][_0xe032e6(0x1b5)],'state':_0x4b209e['attributes'][_0xe032e6(0x25b)],'bundle_id':_0x4b209e[_0xe032e6(0x208)][_0xe032e6(0x18d)],'created_at':_0x4b209e[_0xe032e6(0x208)]['createdAt']},_0x139f2d),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a28_0x4d4d86(0x233)]=a28_0x4d4d86(0x20a);[a28_0x4d4d86(0x1a3)]=a28_0x4d4d86(0x245);async[a28_0x4d4d86(0x1b9)](_0x464b5b){const _0x31cf93=a28_0x4d4d86,{options:_0xf93f1,args:_0x376b5c,tdx:_0x2d68bb}=_0x464b5b,_0xa0aa46=_0x376b5c[0x0];if(!requireNameOrPath(_0xa0aa46))return 0x1;const _0x172251=_0xf93f1[_0x31cf93(0x1bf)];if(!_0x172251)return console[_0x31cf93(0x1cd)]('Error:\x20--version\x20option\x20is\x20required'),console[_0x31cf93(0x1cd)](_0x31cf93(0x19a)),0x1;const _0x16ed33=parseInt(_0x172251,0xa);if(isNaN(_0x16ed33)||_0x16ed33<0x1)return console[_0x31cf93(0x1cd)](_0x31cf93(0x254)+_0x172251),0x1;if(_0xf93f1[_0x31cf93(0x217)])console[_0x31cf93(0x1cd)](_0x31cf93(0x287)+_0xa0aa46+_0x31cf93(0x1fd)+_0x16ed33);const {journeyId:_0xec543f,parentSegmentId:_0x3fb9b0}=await resolveJourneyIdFromInput(_0xa0aa46,_0xf93f1,_0x2d68bb),_0x249fd6=await withSpinner(_0x31cf93(0x185),()=>_0x2d68bb[_0x31cf93(0x276)]['listVersions'](_0xec543f),{'verbose':_0xf93f1[_0x31cf93(0x217)]}),{versions:_0x53b2d5,latestJourneyId:_0xaa9e7e}=_0x249fd6[_0x31cf93(0x26d)],_0xfc4345=_0x53b2d5[_0x31cf93(0x24b)](_0x21f9c1=>_0x21f9c1[_0x31cf93(0x1b5)]===_0x16ed33);if(!_0xfc4345){const _0x45d37b=_0x53b2d5[_0x31cf93(0x203)](_0x56d389=>'v'+_0x56d389[_0x31cf93(0x1b5)])[_0x31cf93(0x288)](',\x20');return console[_0x31cf93(0x1cd)](_0x31cf93(0x1b4)+_0x16ed33+_0x31cf93(0x230)+_0x45d37b),0x1;}const _0x3c0d2d=await withSpinner(_0x31cf93(0x21b)+_0x16ed33+_0x31cf93(0x1aa),()=>_0x2d68bb[_0x31cf93(0x276)][_0x31cf93(0x20c)](_0xfc4345['journeyId']),{'verbose':_0xf93f1['verbose']}),_0x231393=_0x3c0d2d['data'],_0x35bcd1=getConsoleNextUrl(_0xf93f1[_0x31cf93(0x21f)],_0x31cf93(0x28e)+_0x3fb9b0+'/e/'+_0xfc4345[_0x31cf93(0x273)]+_0x31cf93(0x247));return await handleSingleObjectOutput({'id':_0x231393['id'],'name':_0x231393[_0x31cf93(0x208)][_0x31cf93(0x233)],'version':_0x231393[_0x31cf93(0x208)][_0x31cf93(0x1b5)],'description':_0x231393[_0x31cf93(0x208)][_0x31cf93(0x1a3)],'state':_0x231393[_0x31cf93(0x208)][_0x31cf93(0x25b)],'paused':_0x231393[_0x31cf93(0x208)][_0x31cf93(0x26a)],'reentry_mode':_0x231393['attributes']['reentryMode'],'stages':_0x231393[_0x31cf93(0x208)][_0x31cf93(0x26b)]?.[_0x31cf93(0x18c)]||0x0,..._0x231393['attributes'][_0x31cf93(0x240)]&&{'goal':_0x231393[_0x31cf93(0x208)][_0x31cf93(0x240)][_0x31cf93(0x233)]},'latest':_0xfc4345['journeyId']===_0xaa9e7e,'created_at':_0x231393['attributes'][_0x31cf93(0x289)],'updated_at':_0x231393['attributes'][_0x31cf93(0x1dd)],'url':_0x35bcd1},_0xf93f1),0x0;}}
1
+ const a27_0x5cdbb3=a27_0x597f;(function(_0x349260,_0x90bcbc){const _0x180a5c=a27_0x597f,_0x5c46a6=_0x349260();while(!![]){try{const _0x59d1b7=parseInt(_0x180a5c(0x1b3))/0x1*(parseInt(_0x180a5c(0x1b4))/0x2)+-parseInt(_0x180a5c(0x1bf))/0x3+parseInt(_0x180a5c(0x185))/0x4+parseInt(_0x180a5c(0x102))/0x5+parseInt(_0x180a5c(0x123))/0x6+parseInt(_0x180a5c(0xf3))/0x7+-parseInt(_0x180a5c(0x158))/0x8;if(_0x59d1b7===_0x90bcbc)break;else _0x5c46a6['push'](_0x5c46a6['shift']());}catch(_0x517475){_0x5c46a6['push'](_0x5c46a6['shift']());}}}(a27_0x4513,0xdf5d2));import a27_0x11882f from'chalk';import a27_0x1dc4f8 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{aggregateStageHistory,assembleJourneyStats,buildStageNameMap}from'../sdk/journey.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}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';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';function a27_0x4513(){const _0x1eec92=['test','buildIdToNameMap','\x20\x20Statistics\x20not\x20available','resolveSegment','bold','✔\x20Found\x20','Warning:\x20Could\x20not\x20resolve\x20activation\x20','\x20\x20Preserving\x20local\x20segment\x20name:\x20','hasPeriod','\x20activation','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','27717840lQrRyM','history','\x20not\x20found.\x20Available:\x20','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','✔\x20Journey\x20\x22','Options:','filter','web','Error:\x20Journey\x20\x27','sort','\x20\x20Folder\x20path:\x20','🗺️\x20','\x20\x20Name:\x20','journey:traffic','columns','then','stages','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','links','segments','\x0aChanges\x20to\x20\x27','getStatistics','createVersion','\x22\x20not\x20found','\x27\x20not\x20found\x20in\x20','archived','Input:\x20','activation','rootFolderId','pause','diff','session','journeyName','/j/da','cwd','journey:version:create','journeyStages','limit','has','No\x20traffic\x20data\x20available\x20for\x20journey:\x20','size','Fetching\x20','Error:\x20Invalid\x20version\x20number:\x20','Show\x20journey\x20statistics','\x20version','6653296EVfDHj','listFolders','\x20=\x20','tsv','\x20details...','Resolving\x20parent\x20segment...','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','stageNameMap','✔\x20All\x20files\x20are\x20up\x20to\x20date','\x0aPull\x20summary:','draft','milestoneSize','replace','Creating\x20new\x20version...','format','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','folderId','audienceId','args','segmentPushCommand','tdx.json','journeyBundleName','Warning:\x20Could\x20not\x20resolve\x20segment\x20','(root)','entries','folderPath','yes','journey:version:view','/j/da/je','user','values','parent_segment','completeMilestoneRate','Show\x20journey\x20details','✔\x20Pulled\x20','Write\x20','No\x20statistics\x20available\x20for\x20journey:\x20','options','data','Error:\x20--version\x20option\x20is\x20required','nodes','\x20unchanged\x20files','helpText','\x20(ID:\x20','/e/','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','160639YBGATg','2pUmgWi','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','getSegment','Resolving\x20journey...','green','targetDir','Pattern:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Table:\x20','red','name','3302856BvRbjR','conversion','✔\x20Context\x20set:\x20','setPhase','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','file','dim','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','state','connection','Getting\x20journey\x20statistics...','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Found\x20','Folder\x20path:\x20','Getting\x20column\x20mapping...','(paused)','map','completionRate','execute','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','journey','log','all','listJourneysWithFolders','Fetching\x20users\x20and\x20connections...','journey:pull','errorCode','description','site','hasChanges','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','localeCompare','/app/ps/','length','Listing\x20journey\x20activations...','\x20\x20Journey\x20ID:\x20','error','relative','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','\x5c$&','yellow','Getting\x20journey\x20traffic\x20data...','Aborted.','\x20\x20Target:\x20','Cancelled','jsonl','journeyBundleId','journeyId','table','goalSize',',\x20version:\x20','\x20(rule\x20match)','completed','no_parent','getJourney','(running)','7983815PjEUZP','Error:\x20','type','activationParams','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','versionNumber','toLowerCase','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','message','Resolving\x20version...','absolutePath','enteredSize','\x20\x20-\x20','resolveParentId','Journey\x20name:\x20','9126995KfsMHX','base','getTrafficData','journey:columns','Parent\x20segment:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','set','\x20journey','buildIdToEmailMap','version','Show\x20journey\x20table\x20column\x20mapping','segmentName','join','reentryMode','json','paused','Resolved\x20YAML\x20file:\x20','exitOrJumpRate','repeat','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','\x20files?','Fetching\x20parent\x20segment...','find','segment','kind','filePath','goal','\x20\x20Consolidating\x20duplicate\x20segment:\x20','Export\x20journey(s)\x20as\x20YAML\x20files','content','(completed)','Resume\x20a\x20paused\x20journey','blue','4144038wYsajg','\x20changed\x20files','dryRun','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','No\x20journeys\x20found','cyan','INVALID_ARGUMENT','updatedAt','\x22\x20paused','includeStats','Database:\x20','journey:view','add','verbose','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','database','isNew','Resuming\x20journey...','utf-8','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','includeHistory','get','View\x20a\x20specific\x20version\x20of\x20a\x20journey','\x20new\x20files','renderStats','relativePath','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','push','exitOrJumpSize','createdAt','parentSegment','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','\x20journeys','rule','attributes','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','listVersions','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','List\x20journeys\x20in\x20current\x20context','listActivationsFlat','listJourneysFromParentSegment','from'];a27_0x4513=function(){return _0x1eec92;};return a27_0x4513();}import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{createTdxConfigContent}from'../sdk/segment/tdx-config.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 requireNameOrPath(_0x50bbbb){const _0x42f5d5=a27_0x597f;return!_0x50bbbb&&(console['error']('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x42f5d5(0x1e3)](_0x42f5d5(0x131))),!!_0x50bbbb;}function withJsonFormat(_0x417c9d){const _0x53172f=a27_0x597f;if(!_0x417c9d[_0x53172f(0x193)]&&!_0x417c9d[_0x53172f(0x110)]&&!_0x417c9d['jsonl']&&!_0x417c9d[_0x53172f(0x188)])return{..._0x417c9d,'format':_0x53172f(0x110),'json':!![]};return _0x417c9d;}function formatJourneyState(_0x38d60b){const _0x276c57=a27_0x597f;switch(_0x38d60b){case'launched':return a27_0x11882f[_0x276c57(0x1b8)](_0x276c57(0xf2));case _0x276c57(0x18f):return a27_0x11882f[_0x276c57(0x1c5)]('(draft)');case _0x276c57(0x111):return a27_0x11882f[_0x276c57(0x1e7)](_0x276c57(0x1ce));case _0x276c57(0xef):return a27_0x11882f[_0x276c57(0x122)](_0x276c57(0x120));case _0x276c57(0x171):return a27_0x11882f[_0x276c57(0x1c5)]('(archived)');default:return'('+_0x38d60b+')';}}function formatJourneyItem(_0x4ef996,_0x471bfb='',_0x43e70e){const _0x5c1880=a27_0x597f,_0x593ea8=formatJourneyState(_0x4ef996['state']),_0x161963=_0x43e70e?hyperlink(_0x4ef996[_0x5c1880(0x19a)],_0x43e70e):_0x4ef996[_0x5c1880(0x19a)];return _0x471bfb+_0x5c1880(0x163)+_0x161963+'\x20'+_0x593ea8;}function escapeRegex(_0x29ec2a){const _0x330295=a27_0x597f;return _0x29ec2a[_0x330295(0x191)](/[.*+?^${}()|[\]\\]/g,_0x330295(0x1e6));}function globToRegex(_0x4576ed){const _0x4c0494=a27_0x597f,_0xb0fba6=_0x4576ed['split']('*')[_0x4c0494(0x1cf)](escapeRegex);return new RegExp(_0xb0fba6['join']('.*'),'i');}function buildRuleToNameMapping(_0x3d2068){const _0x37ec46=a27_0x597f,_0x19d9ff=new Map();if(_0x3d2068[_0x37ec46(0x16b)])for(const [_0x5938d5,_0x4e77b0]of Object[_0x37ec46(0x19d)](_0x3d2068['segments'])){if(_0x4e77b0[_0x37ec46(0x144)]){const _0x469e10=serializeRule(_0x4e77b0['rule']),_0x3d93cb=_0x19d9ff[_0x37ec46(0x138)](_0x469e10);_0x3d93cb?_0x3d93cb['push'](_0x5938d5):_0x19d9ff[_0x37ec46(0x108)](_0x469e10,[_0x5938d5]);}}return _0x19d9ff;}async function resolveJourneyIdFromInput(_0xb5cf92,_0x2a3241,_0x26a23d){const _0x2662ab=a27_0x597f,_0xfe1286=await resolveJourneyTarget(_0xb5cf92,_0x2a3241[_0x2662ab(0x141)],_0x2a3241[_0x2662ab(0x130)]),_0x3bab85=_0xfe1286['parentSegment'];if(!_0x3bab85)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2662ab(0x1ca));const _0x56d132=await withSpinner(_0x2662ab(0x18a),()=>_0x26a23d[_0x2662ab(0x119)][_0x2662ab(0x100)](_0x3bab85),{'verbose':_0x2a3241['verbose']}),_0x51a63d=_0x56d132[_0x2662ab(0x1ab)],_0x1366cd=await withSpinner(_0x2662ab(0x1b7),()=>_0x26a23d[_0x2662ab(0x1d3)]['resolveJourneyId'](_0x51a63d,_0xfe1286[_0x2662ab(0x178)]),{'verbose':_0x2a3241[_0x2662ab(0x130)]});return{'journeyId':_0x1366cd[_0x2662ab(0x1ab)],'journeyName':_0xfe1286[_0x2662ab(0x178)],'parentSegmentId':_0x51a63d};}function a27_0x597f(_0x2c06ec,_0xdff5c3){_0x2c06ec=_0x2c06ec-0xef;const _0x4513b3=a27_0x4513();let _0x597fe3=_0x4513b3[_0x2c06ec];return _0x597fe3;}async function resolveJourneyTarget(_0x11e4df,_0x305578,_0x13a68a){const _0x4e0f02=a27_0x597f;if(isYamlFilePath(_0x11e4df))try{const _0x50ec24=await resolveYamlFilePath(_0x11e4df);return _0x13a68a&&(console[_0x4e0f02(0x1e3)](_0x4e0f02(0x112)+_0x11e4df),console[_0x4e0f02(0x1e3)]('\x20\x20Parent\x20segment:\x20'+_0x50ec24[_0x4e0f02(0x141)]),console[_0x4e0f02(0x1e3)](_0x4e0f02(0x164)+_0x50ec24[_0x4e0f02(0x10d)]),console['error'](_0x4e0f02(0x162)+(_0x50ec24[_0x4e0f02(0x19e)]||_0x4e0f02(0x19c)))),{'journeyName':_0x50ec24[_0x4e0f02(0x10d)],'parentSegment':_0x50ec24[_0x4e0f02(0x141)],'resolved':_0x50ec24};}catch(_0x50b68a){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x50b68a[_0x4e0f02(0xfb)]);}if(!_0x305578)throw new SDKError(ErrorCode[_0x4e0f02(0x129)],_0x4e0f02(0x107));return{'journeyName':_0x11e4df,'parentSegment':_0x305578};}export class JourneyListCommand extends BaseCommand{[a27_0x5cdbb3(0x1be)]='journey:list';[a27_0x5cdbb3(0x1da)]=a27_0x5cdbb3(0x149);async[a27_0x5cdbb3(0x1d1)](_0x3d5d13){const _0x1a3a7d=a27_0x5cdbb3,{options:_0x1f091b,args:_0x3faaad,tdx:_0x12103a}=_0x3d5d13,_0xc8da97=_0x3faaad[0x0],_0xfcc7f5=_0x1f091b[_0x1a3a7d(0x141)];if(!_0xfcc7f5)return console[_0x1a3a7d(0x1e3)]('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x1a3a7d(0x1e3)](_0x1a3a7d(0x148)),0x1;const _0x282e04=await withSpinner(_0x1a3a7d(0x18a),()=>_0x12103a[_0x1a3a7d(0x119)][_0x1a3a7d(0x100)](_0xfcc7f5),{'verbose':_0x1f091b[_0x1a3a7d(0x130)]}),_0x238745=_0x282e04[_0x1a3a7d(0x1ab)];_0x1f091b[_0x1a3a7d(0x130)]&&(console[_0x1a3a7d(0x1e3)](_0x1a3a7d(0x106)+_0xfcc7f5+_0x1a3a7d(0x1b0)+_0x238745+')'),_0xc8da97&&console['error'](_0x1a3a7d(0x1ba)+_0xc8da97));const _0x55831e=await withSpinner(_0x1a3a7d(0x117),()=>_0x12103a[_0x1a3a7d(0x119)]['getParentFull'](_0x238745),{'verbose':_0x1f091b['verbose']}),_0x19e609=_0x55831e[_0x1a3a7d(0x1ab)],_0x992e65=_0x19e609[_0x1a3a7d(0x174)],_0x1b8f54=await withSpinner('Listing\x20journeys...',()=>_0x12103a[_0x1a3a7d(0x1d3)][_0x1a3a7d(0x1d6)](_0x238745,_0x992e65),{'verbose':_0x1f091b[_0x1a3a7d(0x130)]});let _0x20e5f3=_0x1b8f54[_0x1a3a7d(0x1ab)]['journeys'];const _0x5a9ac4=_0x1b8f54[_0x1a3a7d(0x1ab)]['folders'],_0x47749c=new Map();for(const _0x4c0978 of _0x5a9ac4){_0x47749c[_0x1a3a7d(0x108)](_0x4c0978['id'],_0x4c0978[_0x1a3a7d(0x1be)]);}if(_0xc8da97){const _0x411c47=globToRegex(_0xc8da97);_0x20e5f3=_0x20e5f3[_0x1a3a7d(0x15e)](_0x3fb999=>_0x411c47[_0x1a3a7d(0x14d)](_0x3fb999[_0x1a3a7d(0x19a)]));}console[_0x1a3a7d(0x1e3)](_0x1a3a7d(0x152)+_0x20e5f3['length']+_0x1a3a7d(0x109)+(_0x20e5f3[_0x1a3a7d(0x1e0)]!==0x1?'s':''));const _0x2c2b24=_0x27c24d=>{const _0x36ff93=_0x1a3a7d;return getConsoleNextUrl(_0x1f091b[_0x36ff93(0x1db)],'/app/ps/'+_0x238745+_0x36ff93(0x1b1)+_0x27c24d+_0x36ff93(0x179));};if(_0x1f091b[_0x1a3a7d(0x193)]==='table')await handleSDKOutput(_0x20e5f3,_0x1f091b);else{if(_0x1f091b[_0x1a3a7d(0x193)]==='json'){const _0x460571=_0x20e5f3[_0x1a3a7d(0x1cf)](_0x427917=>({..._0x427917,'url':_0x2c2b24(_0x427917['id'])}));await handleSDKOutput(_0x460571,_0x1f091b);}else{console['log']('['+_0xfcc7f5+']');const _0x32769a=new Map(),_0x4d26da=[];for(const _0x5bdc44 of _0x20e5f3){if(!_0x5bdc44[_0x1a3a7d(0x195)]||_0x5bdc44[_0x1a3a7d(0x195)]===_0x992e65)_0x4d26da[_0x1a3a7d(0x13e)](_0x5bdc44);else{const _0x564dc2=_0x32769a[_0x1a3a7d(0x138)](_0x5bdc44[_0x1a3a7d(0x195)])||[];_0x564dc2[_0x1a3a7d(0x13e)](_0x5bdc44),_0x32769a[_0x1a3a7d(0x108)](_0x5bdc44[_0x1a3a7d(0x195)],_0x564dc2);}}const _0x4e97de=(_0xcb9c6,_0x3f8c5f)=>_0xcb9c6[_0x1a3a7d(0x19a)][_0x1a3a7d(0x1de)](_0x3f8c5f['journeyBundleName'],undefined,{'sensitivity':'base'});_0x4d26da[_0x1a3a7d(0x161)](_0x4e97de);for(const _0x3f8ed1 of _0x4d26da){console[_0x1a3a7d(0x1d4)](formatJourneyItem(_0x3f8ed1,'',_0x2c2b24(_0x3f8ed1['id'])));}const _0x5bfaa8=[..._0x32769a['entries']()]['sort']((_0x557f95,_0x400cd3)=>{const _0x17f80d=_0x1a3a7d,_0x51dfd4=_0x47749c['get'](_0x557f95[0x0])||_0x557f95[0x0],_0x2e66b0=_0x47749c['get'](_0x400cd3[0x0])||_0x400cd3[0x0];return _0x51dfd4['localeCompare'](_0x2e66b0,undefined,{'sensitivity':_0x17f80d(0x103)});});for(const [_0x14bd02,_0x2b3884]of _0x5bfaa8){const _0x1777a9=_0x47749c[_0x1a3a7d(0x138)](_0x14bd02)||_0x14bd02;console[_0x1a3a7d(0x1d4)]('📁\x20'+_0x1777a9),_0x2b3884['sort'](_0x4e97de);for(const _0xe31129 of _0x2b3884){console[_0x1a3a7d(0x1d4)](formatJourneyItem(_0xe31129,'\x20\x20',_0x2c2b24(_0xe31129['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{['name']=a27_0x5cdbb3(0x12e);[a27_0x5cdbb3(0x1da)]=a27_0x5cdbb3(0x1a6);async[a27_0x5cdbb3(0x1d1)](_0x54a590){const _0x45701e=a27_0x5cdbb3,{options:_0x371bd2,args:_0x461384,tdx:_0x318dc6}=_0x54a590,_0x5cb4cf=_0x461384[0x0];if(!_0x5cb4cf)return console[_0x45701e(0x1e3)](_0x45701e(0x142)),console[_0x45701e(0x1e3)](_0x45701e(0x18b)),console[_0x45701e(0x1e3)](_0x45701e(0x15d)),console['error'](_0x45701e(0xf7)),0x1;_0x371bd2[_0x45701e(0x130)]&&console[_0x45701e(0x1e3)]('Input:\x20'+_0x5cb4cf);const {journeyId:_0x3ab05d,parentSegmentId:_0x5855c8}=await resolveJourneyIdFromInput(_0x5cb4cf,_0x371bd2,_0x318dc6);if(_0x371bd2[_0x45701e(0x15f)]){const _0xd44576=getConsoleNextUrl(_0x371bd2[_0x45701e(0x1db)],_0x45701e(0x1df)+_0x5855c8+_0x45701e(0x1b1)+_0x3ab05d+'/j/da/je');return console['error'](a27_0x11882f[_0x45701e(0x1b8)]('✔')+'\x20Opening\x20'+a27_0x11882f[_0x45701e(0x128)](_0xd44576)),openBrowser(_0xd44576),0x0;}const _0x1c5a29=await withSpinner('Getting\x20journey\x20details...',()=>_0x318dc6['journey'][_0x45701e(0xf1)](_0x3ab05d),{'verbose':_0x371bd2[_0x45701e(0x130)]}),_0x122c20=_0x1c5a29[_0x45701e(0x1ab)],_0x2400f9=_0x371bd2[_0x45701e(0x12c)];let _0x2ae812;if(_0x2400f9)try{const _0x1a7680=await withSpinner(_0x45701e(0x1c9),()=>_0x318dc6[_0x45701e(0x1d3)][_0x45701e(0x16d)](_0x3ab05d),{'verbose':_0x371bd2[_0x45701e(0x130)]});_0x2ae812=_0x1a7680[_0x45701e(0x1ab)];}catch{_0x371bd2['verbose']&&console[_0x45701e(0x1e3)](_0x45701e(0x14f));}const _0x4098e3=getConsoleNextUrl(_0x371bd2['site'],_0x45701e(0x1df)+_0x5855c8+_0x45701e(0x1b1)+_0x3ab05d+_0x45701e(0x1a1)),_0x4af42d={'id':_0x122c20['id'],'name':_0x122c20[_0x45701e(0x145)]['name'],'description':_0x122c20[_0x45701e(0x145)]['description'],'state':_0x122c20[_0x45701e(0x145)]['state'],'paused':_0x122c20[_0x45701e(0x145)][_0x45701e(0x111)],'reentry_mode':_0x122c20['attributes'][_0x45701e(0x10f)],'stages':_0x122c20['attributes']['journeyStages']?.[_0x45701e(0x1e0)]||0x0,..._0x122c20[_0x45701e(0x145)][_0x45701e(0x11c)]&&{'goal':_0x122c20[_0x45701e(0x145)][_0x45701e(0x11c)][_0x45701e(0x1be)]},..._0x2ae812&&{'statistics':{'size':_0x2ae812[_0x45701e(0x180)],'entered':_0x2ae812[_0x45701e(0xfe)],'goal_achieved':_0x2ae812[_0x45701e(0x1f0)],'completion_rate':_0x2ae812[_0x45701e(0x1d0)],'exit_or_jump':_0x2ae812[_0x45701e(0x13f)],'exit_or_jump_rate':_0x2ae812[_0x45701e(0x113)],'stages':_0x2ae812['stages']}},'url':_0x4098e3};return await handleSingleObjectOutput(_0x4af42d,_0x371bd2),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a27_0x5cdbb3(0x1be)]='journey:stats';[a27_0x5cdbb3(0x1da)]=a27_0x5cdbb3(0x183);async[a27_0x5cdbb3(0x1d1)](_0x560760){const _0x252742=a27_0x5cdbb3,{options:_0x9852ec,args:_0x27aed0,tdx:_0x3d3ba2}=_0x560760,_0x3c56f6=_0x27aed0[0x0];if(!requireNameOrPath(_0x3c56f6))return 0x1;_0x9852ec[_0x252742(0x130)]&&console[_0x252742(0x1e3)](_0x252742(0x172)+_0x3c56f6);const _0x3bda79=_0x9852ec,_0x28dcb5=_0x3bda79[_0x252742(0x14c)],_0x34cdb7=_0x3bda79['to'],_0x457b7c=_0x3bda79[_0x252742(0x137)],_0x3aff2f=_0x3bda79['stage'];_0x457b7c&&!_0x28dcb5&&!_0x34cdb7&&console[_0x252742(0x1e3)]('Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history');const _0x5c8cc4=_0x457b7c?withJsonFormat(_0x9852ec):_0x9852ec,{journeyId:_0x2fead4,journeyName:_0x357a7b}=await resolveJourneyIdFromInput(_0x3c56f6,_0x5c8cc4,_0x3d3ba2),_0x23985a=_0x28dcb5||_0x34cdb7?{'from':_0x28dcb5,'to':_0x34cdb7}:undefined,_0x4ef75d=await withSpinner(_0x252742(0x1c9),()=>Promise[_0x252742(0x1d5)]([_0x3d3ba2[_0x252742(0x1d3)]['getJourney'](_0x2fead4),_0x3d3ba2[_0x252742(0x1d3)][_0x252742(0x16d)](_0x2fead4,_0x23985a)]),{'verbose':_0x5c8cc4[_0x252742(0x130)]}),[_0x20022c,_0x51baa2]=_0x4ef75d[_0x252742(0x1ab)];if(!_0x51baa2||_0x51baa2[_0x252742(0x1ee)]===null)return console[_0x252742(0x1e3)](_0x252742(0x1a9)+_0x357a7b),console[_0x252742(0x1e3)](_0x252742(0x1c3)),0x0;const _0x1fa849=buildStageNameMap(_0x20022c),_0x56ed25=!!(_0x23985a&&_0x51baa2[_0x252742(0x159)]?.[_0x252742(0x1e0)]),_0xab29ac={'stageNameMap':_0x1fa849,'hasPeriod':_0x56ed25,'includeHistory':!!_0x457b7c};if(_0x3aff2f&&_0x51baa2['stages']){const _0x5b3dd3=_0x51baa2['stages'][_0x252742(0x118)](_0x498fe6=>{const _0x5d72a6=_0x252742,_0x5642f4=_0x1fa849[_0x5d72a6(0x138)](_0x498fe6['id'])??'';return _0x5642f4['toLowerCase']()===_0x3aff2f[_0x5d72a6(0xf9)]();});if(_0x5b3dd3)return await handleSingleObjectOutput(formatStageStats(_0x5b3dd3,_0xab29ac),_0x5c8cc4),0x0;const _0x4e08b6=_0x51baa2[_0x252742(0x168)]['map'](_0x353045=>_0x1fa849[_0x252742(0x138)](_0x353045['id'])??_0x353045['id']);return console[_0x252742(0x1e3)]('Error:\x20Stage\x20\x22'+_0x3aff2f+_0x252742(0x16f)),console[_0x252742(0x1e3)]('Available\x20stages:\x20'+_0x4e08b6[_0x252742(0x10e)](',\x20')),0x1;}const _0x18c4e1=_0x51baa2[_0x252742(0x168)]?.['map'](_0x5db1a8=>formatStageStats(_0x5db1a8,_0xab29ac)),_0x1ce26d=assembleJourneyStats(_0x51baa2,{'from':_0x28dcb5,'to':_0x34cdb7,'includeHistory':_0x457b7c});return await this[_0x252742(0x13b)](_0x1ce26d,_0x18c4e1??[],_0x5c8cc4),0x0;}async['renderStats'](_0x1fc171,_0x2e78ea,_0x36bd6c){const _0x3b66f1=a27_0x5cdbb3,_0x1315c0=_0x36bd6c[_0x3b66f1(0x193)]===_0x3b66f1(0x110)||_0x36bd6c['format']===_0x3b66f1(0x1ec)||_0x36bd6c[_0x3b66f1(0x110)]||_0x36bd6c[_0x3b66f1(0x1ec)];if(_0x1315c0){_0x1fc171[_0x3b66f1(0x168)]=_0x2e78ea,await handleSingleObjectOutput(_0x1fc171,_0x36bd6c);return;}await handleSingleObjectOutput(_0x1fc171,_0x36bd6c);for(const _0x343523 of _0x2e78ea){console['log'](''),console[_0x3b66f1(0x1d4)](String(a27_0x11882f['cyan'][_0x3b66f1(0x151)]('['+_0x343523['name']+']'))+a27_0x11882f['dim']('\x20'+_0x343523['id']));const {id:_0x36e7f2,name:_0x2a9fca,..._0x8ae207}=_0x343523;await handleSingleObjectOutput(_0x8ae207,_0x36bd6c);}}}export class JourneyTrafficCommand extends BaseCommand{[a27_0x5cdbb3(0x1be)]=a27_0x5cdbb3(0x165);['description']=a27_0x5cdbb3(0x169);async['execute'](_0x2ca8b5){const _0x11c318=a27_0x5cdbb3,{options:_0x5bf151,args:_0x39138c,tdx:_0x1d56b5}=_0x2ca8b5,_0x5dc996=_0x39138c[0x0];if(!requireNameOrPath(_0x5dc996))return 0x1;_0x5bf151[_0x11c318(0x130)]&&console[_0x11c318(0x1e3)](_0x11c318(0x172)+_0x5dc996);const _0x396d6c=_0x5bf151,_0x39f2f1=_0x396d6c[_0x11c318(0xf5)],_0x5c0dbe=_0x396d6c[_0x11c318(0x14c)],_0xa99ba0=_0x396d6c['to'],_0x13d5e7=_0x396d6c[_0x11c318(0x17d)];if(_0x39f2f1&&_0x39f2f1!=='conversion'&&_0x39f2f1!==_0x11c318(0x173))return console[_0x11c318(0x1e3)]('Error:\x20Invalid\x20--type\x20\x22'+_0x39f2f1+_0x11c318(0x115)),0x1;const _0x1b25e1=withJsonFormat(_0x5bf151),{journeyId:_0x1ed140,journeyName:_0x230e79}=await resolveJourneyIdFromInput(_0x5dc996,_0x1b25e1,_0x1d56b5),_0x4c5ae4={'type':_0x39f2f1,'from':_0x5c0dbe,'to':_0xa99ba0,'limit':_0x13d5e7},_0x28e2af=await withSpinner(_0x11c318(0x1e8),()=>_0x1d56b5[_0x11c318(0x1d3)][_0x11c318(0x104)](_0x1ed140,_0x4c5ae4),{'verbose':_0x1b25e1[_0x11c318(0x130)]}),_0x2be62d=_0x28e2af[_0x11c318(0x1ab)],_0x1ebbd4=_0x2be62d['conversion']&&(_0x2be62d[_0x11c318(0x1c0)][_0x11c318(0x1ad)][_0x11c318(0x1e0)]>0x0||_0x2be62d[_0x11c318(0x1c0)][_0x11c318(0x16a)]['length']>0x0),_0x23d587=_0x2be62d[_0x11c318(0x173)]&&_0x2be62d[_0x11c318(0x173)]['length']>0x0;if(!_0x1ebbd4&&!_0x23d587)return console[_0x11c318(0x1e3)](_0x11c318(0x17f)+_0x230e79),console[_0x11c318(0x1e3)](_0x11c318(0x1b5)),_0x5c0dbe&&_0xa99ba0&&console[_0x11c318(0x1e3)](_0x11c318(0x13d)),0x0;return await handleSingleObjectOutput(_0x2be62d,_0x1b25e1),0x0;}}function formatStageStats(_0xaa366f,_0x8944c2){const _0x13373d=a27_0x5cdbb3,_0x3daa5f=_0x8944c2['hasPeriod']&&_0xaa366f['history']?.[_0x13373d(0x1e0)]?aggregateStageHistory(_0xaa366f[_0x13373d(0x159)]):{'size':_0xaa366f['size'],'entered':_0xaa366f[_0x13373d(0xfe)],'milestone':_0xaa366f[_0x13373d(0x190)],'milestone_rate':_0xaa366f[_0x13373d(0x1a5)],'exit_or_jump':_0xaa366f['exitOrJumpSize'],'exit_or_jump_rate':_0xaa366f[_0x13373d(0x113)]},_0x8d9762={'id':_0xaa366f['id'],'name':_0x8944c2[_0x13373d(0x18c)][_0x13373d(0x138)](_0xaa366f['id'])??_0xaa366f['id'],..._0x3daa5f};return _0x8944c2[_0x13373d(0x155)]&&_0x8944c2[_0x13373d(0x137)]&&_0xaa366f[_0x13373d(0x159)]&&(_0x8d9762['history']=_0xaa366f[_0x13373d(0x159)]),_0x8d9762;}export class JourneyPauseCommand extends BaseCommand{['name']='journey:pause';[a27_0x5cdbb3(0x1da)]='Pause\x20a\x20running\x20journey';async[a27_0x5cdbb3(0x1d1)](_0x37340f){const _0x251f60=a27_0x5cdbb3,{options:_0x3e6250,args:_0x437f62,tdx:_0x19b0d2}=_0x37340f,_0x276b06=_0x437f62[0x0];if(!requireNameOrPath(_0x276b06))return 0x1;_0x3e6250[_0x251f60(0x130)]&&console['error']('Input:\x20'+_0x276b06);const {journeyId:_0x5988e3,journeyName:_0x58b4ad}=await resolveJourneyIdFromInput(_0x276b06,_0x3e6250,_0x19b0d2);if(!_0x3e6250[_0x251f60(0x19f)]){const _0x609649=await confirm(_0x251f60(0x194)+_0x58b4ad+'\x22?');if(!_0x609649)return console[_0x251f60(0x1e3)]('Cancelled'),0x0;}const _0x34d8bb=await withSpinner('Pausing\x20journey...',()=>_0x19b0d2['journey'][_0x251f60(0x175)](_0x5988e3),{'verbose':_0x3e6250['verbose']}),_0x49b0ba=_0x34d8bb[_0x251f60(0x1ab)];return console['error'](_0x251f60(0x15c)+_0x49b0ba['attributes']['name']+_0x251f60(0x12b)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a27_0x5cdbb3(0x1be)]='journey:resume';['description']=a27_0x5cdbb3(0x121);async[a27_0x5cdbb3(0x1d1)](_0xc42e8e){const _0x21a109=a27_0x5cdbb3,{options:_0x5af522,args:_0x56b079,tdx:_0x4c6148}=_0xc42e8e,_0x2770b1=_0x56b079[0x0];if(!requireNameOrPath(_0x2770b1))return 0x1;_0x5af522[_0x21a109(0x130)]&&console[_0x21a109(0x1e3)](_0x21a109(0x172)+_0x2770b1);const {journeyId:_0xfacbbd,journeyName:_0x187e85}=await resolveJourneyIdFromInput(_0x2770b1,_0x5af522,_0x4c6148);if(!_0x5af522['yes']){const _0x2c5e01=await confirm(_0x21a109(0x126)+_0x187e85+'\x22?');if(!_0x2c5e01)return console[_0x21a109(0x1e3)](_0x21a109(0x1eb)),0x0;}const _0x29168e=await withSpinner(_0x21a109(0x134),()=>_0x4c6148[_0x21a109(0x1d3)]['resume'](_0xfacbbd),{'verbose':_0x5af522[_0x21a109(0x130)]}),_0x32b90f=_0x29168e[_0x21a109(0x1ab)];return console[_0x21a109(0x1e3)]('✔\x20Journey\x20\x22'+_0x32b90f[_0x21a109(0x145)][_0x21a109(0x1be)]+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{[a27_0x5cdbb3(0x1be)]=a27_0x5cdbb3(0x1d8);[a27_0x5cdbb3(0x1da)]=a27_0x5cdbb3(0x11e);async['execute'](_0x4c4766){const _0x2d50e9=a27_0x5cdbb3,{options:_0x526498,args:_0x5b8e8e,tdx:_0x27ba7b}=_0x4c4766,_0x440101=_0x526498,_0x275ac5=_0x5b8e8e[0x0],_0x21b6d4=_0x275ac5&&isYamlFilePath(_0x275ac5),_0x11396a=await resolveTarget({'arg':_0x21b6d4?_0x275ac5:undefined,'contextParent':_0x526498[_0x2d50e9(0x141)],'cwd':process[_0x2d50e9(0x17a)]()});if(!isSuccessfulResolution(_0x11396a))return _0x11396a[_0x2d50e9(0x1d9)]===_0x2d50e9(0xf0)?(console[_0x2d50e9(0x1e3)](a27_0x11882f[_0x2d50e9(0x1e7)](_0x2d50e9(0x157))),console[_0x2d50e9(0x1e3)]('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)'),console[_0x2d50e9(0x1e3)](_0x2d50e9(0x1dd)),console[_0x2d50e9(0x1e3)](_0x2d50e9(0x1c6)),console[_0x2d50e9(0x1e3)]('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')):(console[_0x2d50e9(0x1e3)](a27_0x11882f[_0x2d50e9(0x1bd)](_0x2d50e9(0xf4)+_0x11396a[_0x2d50e9(0xfb)]+'\x0a')),_0x11396a[_0x2d50e9(0x1af)]&&console['error'](a27_0x11882f[_0x2d50e9(0x128)](_0x11396a[_0x2d50e9(0x1af)]))),0x1;let _0x23d0da=_0x21b6d4?undefined:_0x275ac5,_0x45b180,_0x38f261;_0x11396a['type']===_0x2d50e9(0x1c4)&&(_0x23d0da=_0x11396a['resourceName'],_0x45b180=_0x11396a[_0x2d50e9(0x11b)],_0x38f261=_0x11396a[_0x2d50e9(0x19e)]);const _0x50c46b=_0x11396a['parentName'],_0x4583ed=_0x11396a[_0x2d50e9(0x1b9)];_0x440101[_0x2d50e9(0x130)]&&(console['error'](_0x2d50e9(0x106)+_0x50c46b),console[_0x2d50e9(0x1e3)]('Target\x20directory:\x20'+_0x4583ed),_0x23d0da&&console[_0x2d50e9(0x1e3)](_0x2d50e9(0x101)+_0x23d0da),_0x45b180&&console[_0x2d50e9(0x1e3)]('Target\x20file:\x20'+_0x45b180),_0x38f261&&console['error'](_0x2d50e9(0x1cc)+_0x38f261));const _0x42e622=await withSpinner(_0x2d50e9(0x18a),()=>_0x27ba7b[_0x2d50e9(0x119)][_0x2d50e9(0x100)](_0x50c46b),{'verbose':_0x526498[_0x2d50e9(0x130)]}),_0x159b06=_0x42e622[_0x2d50e9(0x1ab)],{journeys:_0x31d116,folders:_0x3f7d59}=await withSpinner('Fetching\x20journeys\x20and\x20folders...',async()=>{const _0x2f940c=_0x2d50e9,[_0x5a8b7c,_0x5930d0]=await Promise[_0x2f940c(0x1d5)]([_0x27ba7b['journey'][_0x2f940c(0x14b)](_0x159b06,undefined,{'includeAllVersions':!![]}),_0x27ba7b[_0x2f940c(0x119)][_0x2f940c(0x186)](_0x159b06)]);return{'journeys':_0x5a8b7c,'folders':_0x5930d0};},{'verbose':_0x526498[_0x2d50e9(0x130)]})[_0x2d50e9(0x167)](_0x3d7048=>_0x3d7048['data']);let _0x4775f3=_0x31d116;const _0x59b123=buildFolderIdToPathMap(_0x3f7d59);if(_0x23d0da){const _0x46896a=_0x4775f3[_0x2d50e9(0x15e)](_0x5c8609=>_0x5c8609[_0x2d50e9(0x19a)][_0x2d50e9(0xf9)]()===_0x23d0da['toLowerCase']());if(_0x46896a[_0x2d50e9(0x1e0)]===0x0)return console[_0x2d50e9(0x1e3)]('Error:\x20Journey\x20not\x20found:\x20'+_0x23d0da),console[_0x2d50e9(0x1e3)](_0x2d50e9(0xfa)),0x1;_0x4775f3=_0x46896a;}if(_0x38f261!==undefined){const _0x5bec2d=_0x4775f3[_0x2d50e9(0x15e)](_0x4ed409=>{const _0x596956=_0x2d50e9,_0xed78=_0x4ed409[_0x596956(0x195)]?_0x59b123['get'](_0x4ed409[_0x596956(0x195)])||'':'';return _0xed78===_0x38f261;});if(_0x5bec2d[_0x2d50e9(0x1e0)]===0x0&&_0x4775f3['length']>0x0){console[_0x2d50e9(0x1e3)](_0x2d50e9(0x160)+_0x23d0da+_0x2d50e9(0x170)+(_0x38f261||'root\x20folder')),console[_0x2d50e9(0x1e3)]('Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:');for(const _0x523bd5 of _0x4775f3){const _0x5052af=_0x523bd5[_0x2d50e9(0x195)]?_0x59b123['get'](_0x523bd5[_0x2d50e9(0x195)])||'':'';console[_0x2d50e9(0x1e3)](_0x2d50e9(0xff)+(_0x5052af||_0x2d50e9(0x19c))+'/'+_0x523bd5[_0x2d50e9(0x19a)]);}return 0x1;}_0x4775f3=_0x5bec2d;}if(_0x4775f3[_0x2d50e9(0x1e0)]===0x0)return console[_0x2d50e9(0x1e3)](_0x2d50e9(0x127)),0x0;const _0x17d7c1=new Map();for(const _0x3c86a5 of _0x4775f3){const _0x50c528=_0x3c86a5[_0x2d50e9(0x1ed)];!_0x17d7c1['has'](_0x50c528)&&_0x17d7c1[_0x2d50e9(0x108)](_0x50c528,[]),_0x17d7c1[_0x2d50e9(0x138)](_0x50c528)[_0x2d50e9(0x13e)](_0x3c86a5);}for(const _0x508365 of _0x17d7c1[_0x2d50e9(0x1a3)]()){_0x508365[_0x2d50e9(0x161)]((_0x307c90,_0x10c39b)=>(_0x307c90['versionNumber']||0x0)-(_0x10c39b[_0x2d50e9(0xf8)]||0x0));}const _0x5d8a8a=[],{idToEmailMap:_0x191b88,connectionIdToNameMap:_0x2a74a7}=await withSpinner(_0x2d50e9(0x1d7),async()=>{const _0x4f5237=_0x2d50e9,[_0x1e3f70,_0x43a67b]=await Promise['all']([_0x27ba7b[_0x4f5237(0x1a2)][_0x4f5237(0x10a)](),_0x27ba7b[_0x4f5237(0x1c8)][_0x4f5237(0x14e)]()]);return{'idToEmailMap':_0x1e3f70,'connectionIdToNameMap':_0x43a67b};},{'verbose':_0x526498[_0x2d50e9(0x130)]})[_0x2d50e9(0x167)](_0x45b699=>_0x45b699[_0x2d50e9(0x1ab)]);for(const _0xb0d0ce of _0x17d7c1[_0x2d50e9(0x1a3)]()){const _0x36813a=_0xb0d0ce[0x0][_0x2d50e9(0x19a)],_0x204d62=_0xb0d0ce[0x0][_0x2d50e9(0x195)],_0x2947f5=_0x204d62?_0x59b123['get'](_0x204d62)||'':'',_0xbc7acb=_0x2947f5?a27_0x1dc4f8[_0x2d50e9(0x10e)](_0x4583ed,_0x2947f5):_0x4583ed,_0x30e90e=_0x45b180||a27_0x1dc4f8[_0x2d50e9(0x10e)](_0xbc7acb,sanitizeFileName(_0x36813a)+'.yml');let _0x451ee6,_0x402cc3;if(existsSync(_0x30e90e))try{const _0x2cae67=readFileSync(_0x30e90e,_0x2d50e9(0x135)),_0x209d8d=parseYamlString(_0x2cae67);_0x402cc3=_0x209d8d,_0x451ee6=buildRuleToNameMapping(_0x209d8d),_0x440101[_0x2d50e9(0x130)]&&_0x451ee6[_0x2d50e9(0x180)]>0x0&&console['error'](_0x2d50e9(0x1cb)+_0x451ee6['size']+_0x2d50e9(0x1b2)+_0x36813a);}catch(_0x3d91c0){_0x440101[_0x2d50e9(0x130)]&&console[_0x2d50e9(0x1e3)](_0x2d50e9(0x1e5)+_0x3d91c0[_0x2d50e9(0xfb)]);}const _0xacbbd=[],_0x4d1e42=new Set(),_0x322117=new Map(),_0x2539bf=new Map(),_0x3f09e1=new Set(),_0x32cbb6=new Map(),_0x479f5a=new Map(),_0x140ed2=createJumpTargetCache();await withProgressSpinner(_0x2d50e9(0x181)+_0x36813a+'...',async _0x52b440=>{const _0x1c66a4=_0x2d50e9;for(const _0x9cf8bd of _0xb0d0ce){const _0x18a53c=_0xb0d0ce[_0x1c66a4(0x1e0)]>0x1?_0x9cf8bd[_0x1c66a4(0x19a)]+'\x20v'+(_0x9cf8bd['versionNumber']||0x1):_0x9cf8bd[_0x1c66a4(0x19a)];_0x52b440[_0x1c66a4(0x1c2)](_0x1c66a4(0x181)+_0x18a53c);const _0x296ca0=await _0x27ba7b[_0x1c66a4(0x1d3)][_0x1c66a4(0xf1)](_0x9cf8bd['id']),_0xf76e3b=_0x296ca0['attributes']?.[_0x1c66a4(0x196)],_0x2639cb={'resolveSegment':async _0x4c5861=>{const _0x57e85f=_0x1c66a4;if(!_0xf76e3b)return{'name':_0x4c5861,'isJourneyLocal':![]};const _0x5f254e=_0x322117[_0x57e85f(0x138)](_0x4c5861);if(_0x5f254e)return _0x5f254e;try{const _0x59191a=await _0x27ba7b[_0x57e85f(0x119)][_0x57e85f(0x1b6)](_0xf76e3b,_0x4c5861),_0x21f537=_0x59191a[_0x57e85f(0x11a)]===SEGMENT_KIND_JOURNEY;let _0x21aac0,_0x15c6a7=_0x59191a['name'];if(_0x21f537&&_0x59191a[_0x57e85f(0x144)]){const _0x4f1788=await segmentResponseToDef(_0x59191a,{'resolveSegmentName':async _0x40e873=>{const _0x5abcda=_0x57e85f,_0x448cdd=_0x322117['get'](_0x40e873);if(_0x448cdd)return _0x448cdd['name'];const _0x2d3fc6=await _0x2639cb[_0x5abcda(0x150)](_0x40e873);return _0x2d3fc6['name'];}}),_0xefb06b=_0x4f1788[_0x57e85f(0x144)];_0x21aac0={'description':_0x59191a[_0x57e85f(0x1da)],'rule':_0xefb06b};const _0x49253c=serializeRule(_0xefb06b),_0x182241=_0x2539bf[_0x57e85f(0x138)](_0x49253c);if(_0x182241)_0x15c6a7=_0x182241,_0x21aac0=undefined,_0x440101['verbose']&&console['error'](_0x57e85f(0x11d)+_0x59191a[_0x57e85f(0x1be)]+'\x20->\x20'+_0x182241);else{let _0x15978d=![];if(_0x451ee6){const _0xc90df5=_0x451ee6[_0x57e85f(0x138)](_0x49253c);if(_0xc90df5){const _0x1d6955=_0xc90df5[_0x57e85f(0x118)](_0x45d3b8=>!_0x4d1e42[_0x57e85f(0x17e)](_0x45d3b8));_0x1d6955&&(_0x15c6a7=_0x1d6955,_0x4d1e42[_0x57e85f(0x12f)](_0x1d6955),_0x2539bf[_0x57e85f(0x108)](_0x49253c,_0x1d6955),_0x15978d=!![],_0x440101[_0x57e85f(0x130)]&&console[_0x57e85f(0x1e3)](_0x57e85f(0x154)+_0x1d6955+_0x57e85f(0x1f2)));}}if(!_0x15978d){const _0x40193b=generateJourneyLocalName(_0x59191a['name']);_0x40193b&&(_0x15c6a7=_0x40193b);let _0x3fb245=_0x15c6a7,_0x5cd94d=0x2;while(_0x4d1e42[_0x57e85f(0x17e)](_0x3fb245)){_0x3fb245=_0x15c6a7+'_'+_0x5cd94d,_0x5cd94d++;}_0x4d1e42[_0x57e85f(0x12f)](_0x3fb245),_0x2539bf[_0x57e85f(0x108)](_0x49253c,_0x3fb245),_0x15c6a7=_0x3fb245;}}}const _0x288695={'name':_0x15c6a7,'isJourneyLocal':_0x21f537,'definition':_0x21aac0};return _0x322117['set'](_0x4c5861,_0x288695),_0x288695;}catch(_0x6c16c4){return _0x526498[_0x57e85f(0x130)]&&console[_0x57e85f(0x1e3)](_0x57e85f(0x19b)+_0x4c5861+':\x20'+_0x6c16c4[_0x57e85f(0xfb)]),{'name':_0x4c5861,'isJourneyLocal':![]};}},'resolveActivation':async _0x2c9583=>{const _0x16cbf5=_0x1c66a4,_0x1cb094=_0x32cbb6['get'](_0x2c9583);if(_0x1cb094)return _0x1cb094;try{const _0x372f2a=await _0x27ba7b['journey']['getActivation'](_0x9cf8bd['id'],_0x2c9583),_0x1c3f29=journeyActivationStepToYaml(_0x372f2a,_0x191b88,_0x2a74a7),_0x443352=JSON['stringify']({'name':_0x1c3f29['name'],'connection':_0x1c3f29[_0x16cbf5(0x1c8)],'connector_config':_0x1c3f29['connector_config']}),_0x4f27d6=_0x479f5a[_0x16cbf5(0x138)](_0x443352);if(_0x4f27d6){const _0x36ab61={'name':_0x4f27d6,'isJourneyLocal':!![],'definition':_0x1c3f29};return _0x32cbb6[_0x16cbf5(0x108)](_0x2c9583,_0x36ab61),_0x36ab61;}const _0x40a349=_0x372f2a[_0x16cbf5(0x145)][_0x16cbf5(0xf6)][_0x16cbf5(0x1be)]||_0x2c9583,_0x22981d=sanitizeYamlKey(_0x40a349)||'activation_'+_0x2c9583;let _0x5987d3=_0x22981d,_0x4aa733=0x2;while(_0x3f09e1[_0x16cbf5(0x17e)](_0x5987d3)){_0x5987d3=_0x22981d+'_'+_0x4aa733,_0x4aa733++;}_0x3f09e1[_0x16cbf5(0x12f)](_0x5987d3),_0x479f5a['set'](_0x443352,_0x5987d3);const _0x25817b={'name':_0x5987d3,'isJourneyLocal':!![],'definition':_0x1c3f29};return _0x32cbb6[_0x16cbf5(0x108)](_0x2c9583,_0x25817b),_0x25817b;}catch(_0x53146d){return _0x526498['verbose']&&console[_0x16cbf5(0x1e3)](_0x16cbf5(0x153)+_0x2c9583+':\x20'+_0x53146d[_0x16cbf5(0xfb)]),{'name':_0x2c9583,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x2ce204,_0x442898)=>{return resolveJumpTarget(_0x2ce204,_0x442898,_0x140ed2,_0x4ff8dc=>_0x27ba7b['journey']['getJourney'](_0x4ff8dc));}},_0x7bf75d=await journeyResponseToDef(_0x296ca0,_0x2639cb);_0xacbbd[_0x1c66a4(0x13e)]({'item':_0x9cf8bd,'yaml':_0x7bf75d});}},{'verbose':_0x526498['verbose']});const _0xb021af=await _0x27ba7b[_0x2d50e9(0x1d3)]['getLatestJourneyId'](_0xb0d0ce[0x0]['journeyBundleId']),_0x21580e=buildMergedJourneyDef(_0xacbbd,_0x451ee6,_0xb021af),_0xa48425=normalizeJourneyDef(_0x21580e,_0x402cc3),_0x2a813c=toYamlString(_0xa48425),_0xb2e36b=_0x45b180||a27_0x1dc4f8['join'](_0xbc7acb,sanitizeFileName(_0x36813a)+'.yml');!_0x45b180&&_0x2947f5&&!existsSync(_0xbc7acb)&&mkdirSync(_0xbc7acb,{'recursive':!![]});const _0x51c913=a27_0x1dc4f8[_0x2d50e9(0x1e4)](process[_0x2d50e9(0x17a)](),_0xb2e36b);if(existsSync(_0xb2e36b)){const _0x2e0f46=readFileSync(_0xb2e36b,_0x2d50e9(0x135)),_0x358d37=generateDiff(_0x2e0f46,_0x2a813c),_0x359e80=hasChanges(_0x358d37);_0x5d8a8a['push']({'relativePath':_0x51c913,'absolutePath':_0xb2e36b,'content':_0x2a813c,'isNew':![],'hasChanges':_0x359e80,'diff':_0x359e80?formatDiffWithColors(_0x358d37):undefined});}else _0x5d8a8a['push']({'relativePath':_0x51c913,'absolutePath':_0xb2e36b,'content':_0x2a813c,'isNew':!![],'hasChanges':![]});}const _0x3ed462=_0x5d8a8a['filter'](_0x1a430f=>_0x1a430f['isNew']),_0x2251d6=_0x5d8a8a[_0x2d50e9(0x15e)](_0x21d76a=>!_0x21d76a[_0x2d50e9(0x133)]&&_0x21d76a[_0x2d50e9(0x1dc)]),_0x51ae33=_0x5d8a8a[_0x2d50e9(0x15e)](_0x6f1fc=>!_0x6f1fc[_0x2d50e9(0x133)]&&!_0x6f1fc[_0x2d50e9(0x1dc)]),_0x16fadb=_0x4775f3[_0x2d50e9(0x1e0)],_0x1f6f59=_0x17d7c1['size'],_0x4e60a0=_0x16fadb>_0x1f6f59?'\x20('+_0x16fadb+'\x20versions)':'';console['error'](_0x2d50e9(0x18e)),console[_0x2d50e9(0x1e3)]('\x20\x20'+a27_0x11882f[_0x2d50e9(0x128)](_0x1f6f59+_0x2d50e9(0x143))+a27_0x11882f['dim'](_0x4e60a0)),console[_0x2d50e9(0x1e3)]('\x20\x20'+a27_0x11882f['green']('+\x20'+_0x3ed462[_0x2d50e9(0x1e0)]+_0x2d50e9(0x13a))),console[_0x2d50e9(0x1e3)]('\x20\x20'+a27_0x11882f[_0x2d50e9(0x1e7)]('~\x20'+_0x2251d6['length']+_0x2d50e9(0x124))),console['error']('\x20\x20'+a27_0x11882f[_0x2d50e9(0x1c5)]('=\x20'+_0x51ae33[_0x2d50e9(0x1e0)]+_0x2d50e9(0x1ae))),console['error'](_0x2d50e9(0x1ea)+a27_0x11882f[_0x2d50e9(0x128)](_0x4583ed)+'\x0a');if(_0x2251d6[_0x2d50e9(0x1e0)]>0x0)for(const _0x668a32 of _0x2251d6){console[_0x2d50e9(0x1e3)](_0x2d50e9(0x16c)+_0x668a32[_0x2d50e9(0x13c)]+'\x27:'),console[_0x2d50e9(0x1e3)]('─'['repeat'](0x3c)),console[_0x2d50e9(0x1e3)](_0x668a32[_0x2d50e9(0x176)]),console[_0x2d50e9(0x1e3)]('─'[_0x2d50e9(0x114)](0x3c));}if(_0x440101[_0x2d50e9(0x125)])return console['error'](a27_0x11882f[_0x2d50e9(0x1e7)](_0x2d50e9(0x15b))),0x0;if(_0x3ed462[_0x2d50e9(0x1e0)]===0x0&&_0x2251d6[_0x2d50e9(0x1e0)]===0x0)return console[_0x2d50e9(0x1e3)](a27_0x11882f[_0x2d50e9(0x1b8)](_0x2d50e9(0x18d))),saveSessionContext({'parent_segment':_0x50c46b},_0x440101[_0x2d50e9(0x177)]),console[_0x2d50e9(0x1e3)](a27_0x11882f['green'](_0x2d50e9(0x1c1)+a27_0x11882f['dim'](_0x2d50e9(0x1a4))+_0x2d50e9(0x187)+a27_0x11882f[_0x2d50e9(0x128)](_0x50c46b))),0x0;if(!_0x440101[_0x2d50e9(0x19f)]&&(_0x3ed462[_0x2d50e9(0x1e0)]>0x0||_0x2251d6[_0x2d50e9(0x1e0)]>0x0)){if(!isInteractive())return console[_0x2d50e9(0x1e3)](a27_0x11882f[_0x2d50e9(0x1bd)]('\x0aError:'),_0x2d50e9(0x146)),console[_0x2d50e9(0x1e3)](a27_0x11882f[_0x2d50e9(0x1c5)](_0x2d50e9(0x1bb))),0x1;const _0x48206a=await confirmKey(_0x2d50e9(0x1a8)+(_0x3ed462[_0x2d50e9(0x1e0)]+_0x2251d6[_0x2d50e9(0x1e0)])+_0x2d50e9(0x116));if(!_0x48206a)return console[_0x2d50e9(0x1e3)](a27_0x11882f[_0x2d50e9(0x1e7)](_0x2d50e9(0x1e9)),'-\x20no\x20files\x20written'),0x1;}!existsSync(_0x4583ed)&&mkdirSync(_0x4583ed,{'recursive':!![]});const _0x521878=a27_0x1dc4f8[_0x2d50e9(0x10e)](_0x4583ed,_0x2d50e9(0x199));writeFileSync(_0x521878,createTdxConfigContent(_0x50c46b),'utf-8');for(const _0x302249 of _0x5d8a8a){(_0x302249['isNew']||_0x302249['hasChanges'])&&writeFileSync(_0x302249[_0x2d50e9(0xfd)],_0x302249[_0x2d50e9(0x11f)],_0x2d50e9(0x135));}return console['error'](a27_0x11882f[_0x2d50e9(0x1b8)](_0x2d50e9(0x1a7)+(_0x3ed462['length']+_0x2251d6[_0x2d50e9(0x1e0)])+'\x20journey\x20files\x20to\x20'+_0x4583ed)),saveSessionContext({'parent_segment':_0x50c46b},_0x440101[_0x2d50e9(0x177)]),console[_0x2d50e9(0x1e3)](a27_0x11882f[_0x2d50e9(0x1b8)](_0x2d50e9(0x1c1)+a27_0x11882f[_0x2d50e9(0x1c5)](_0x2d50e9(0x1a4))+_0x2d50e9(0x187)+a27_0x11882f[_0x2d50e9(0x128)](_0x50c46b))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{['name']=a27_0x5cdbb3(0x105);[a27_0x5cdbb3(0x1da)]=a27_0x5cdbb3(0x10c);async[a27_0x5cdbb3(0x1d1)](_0x22f9f6){const _0xc086fe=a27_0x5cdbb3,{options:_0x310176,args:_0xbfd725,tdx:_0x39e29e}=_0x22f9f6,_0x4d48f0=_0xbfd725[0x0];if(!requireNameOrPath(_0x4d48f0))return 0x1;_0x310176[_0xc086fe(0x130)]&&console[_0xc086fe(0x1e3)](_0xc086fe(0x172)+_0x4d48f0);const {journeyId:_0x296ad4}=await resolveJourneyIdFromInput(_0x4d48f0,_0x310176,_0x39e29e),_0x942936=await withSpinner(_0xc086fe(0x1cd),()=>_0x39e29e[_0xc086fe(0x1d3)]['getColumnMapping'](_0x296ad4),{'verbose':_0x310176['verbose']}),_0x539d3f=_0x942936[_0xc086fe(0x1ab)];return console[_0xc086fe(0x1d4)](_0xc086fe(0x12d)+_0x539d3f[_0xc086fe(0x132)]),console[_0xc086fe(0x1d4)](_0xc086fe(0x1bc)+_0x539d3f[_0xc086fe(0x1ef)]),await handleSDKOutput(_0x539d3f[_0xc086fe(0x166)],_0x310176),0x0;}}export class JourneyActivationsCommand extends BaseCommand{['name']='journey:activations';[a27_0x5cdbb3(0x1da)]='List\x20activations\x20for\x20a\x20journey';async['execute'](_0x3dbfcf){const _0x2102b9=a27_0x5cdbb3,{options:_0x42e58c,args:_0x4bac47,tdx:_0x40fcb4}=_0x3dbfcf,_0xc356f3=_0x4bac47[0x0];if(!requireNameOrPath(_0xc356f3))return 0x1;_0x42e58c[_0x2102b9(0x130)]&&console['error']('Input:\x20'+_0xc356f3);const {journeyId:_0x5b2a93}=await resolveJourneyIdFromInput(_0xc356f3,_0x42e58c,_0x40fcb4),_0x715791=await withSpinner(_0x2102b9(0x1e1),()=>_0x40fcb4[_0x2102b9(0x1d3)][_0x2102b9(0x14a)](_0x5b2a93),{'verbose':_0x42e58c[_0x2102b9(0x130)]}),_0x19b9e=_0x715791['data'];return console[_0x2102b9(0x1e3)]('Found\x20'+_0x19b9e['length']+_0x2102b9(0x156)+(_0x19b9e[_0x2102b9(0x1e0)]!==0x1?'s':'')),await handleSDKOutput(_0x19b9e,_0x42e58c),0x0;}}export class JourneyPushCommand extends BaseCommand{[a27_0x5cdbb3(0x1be)]='journey:push';[a27_0x5cdbb3(0x1da)]=a27_0x5cdbb3(0x136);[a27_0x5cdbb3(0x198)]=new SegmentPushCommand();async[a27_0x5cdbb3(0x1d1)](_0x9d4f31){const _0x205283=a27_0x5cdbb3,_0x55ad76=_0x9d4f31[_0x205283(0x197)][0x0];let _0x38af72;if(_0x55ad76){const _0x53d940=await resolveTarget({'arg':_0x55ad76,'contextParent':_0x9d4f31[_0x205283(0x1aa)][_0x205283(0x141)],'cwd':process[_0x205283(0x17a)]()});isSuccessfulResolution(_0x53d940)&&_0x53d940[_0x205283(0xf5)]==='file'&&(_0x38af72=_0x53d940[_0x205283(0x11b)]);}const _0x5df996={..._0x9d4f31,'options':{..._0x9d4f31['options'],'journeysOnly':!![],..._0x38af72&&{'singleFilePath':_0x38af72}}};return this['segmentPushCommand'][_0x205283(0x1d1)](_0x5df996);}}export class JourneyVersionsCommand extends BaseCommand{[a27_0x5cdbb3(0x1be)]='journey:versions';[a27_0x5cdbb3(0x1da)]='List\x20all\x20versions\x20of\x20a\x20journey';async[a27_0x5cdbb3(0x1d1)](_0x9ce4d0){const _0x8b64e=a27_0x5cdbb3,{options:_0x1b49f7,args:_0x24075f,tdx:_0x470e39}=_0x9ce4d0,_0xa61fe0=_0x24075f[0x0];if(!requireNameOrPath(_0xa61fe0))return 0x1;if(_0x1b49f7[_0x8b64e(0x130)])console[_0x8b64e(0x1e3)](_0x8b64e(0x172)+_0xa61fe0);const {journeyId:_0x1ed483}=await resolveJourneyIdFromInput(_0xa61fe0,_0x1b49f7,_0x470e39),_0x1f2c46=await withSpinner('Listing\x20journey\x20versions...',()=>_0x470e39[_0x8b64e(0x1d3)][_0x8b64e(0x147)](_0x1ed483),{'verbose':_0x1b49f7[_0x8b64e(0x130)]}),{bundleName:_0x42f6a1,versions:_0x25e650,latestJourneyId:_0x2fdec3}=_0x1f2c46['data'];console[_0x8b64e(0x1e3)](_0x42f6a1+':\x20'+_0x25e650[_0x8b64e(0x1e0)]+_0x8b64e(0x184)+(_0x25e650['length']!==0x1?'s':''));const _0x2304a8=_0x25e650['map'](_0x838cae=>({'version':_0x838cae[_0x8b64e(0xf8)],'journey_id':_0x838cae[_0x8b64e(0x1ee)],'name':_0x838cae[_0x8b64e(0x1be)],'state':_0x838cae[_0x8b64e(0x1c7)],'paused':_0x838cae[_0x8b64e(0x111)],'latest':_0x838cae[_0x8b64e(0x1ee)]===_0x2fdec3,'created_at':_0x838cae[_0x8b64e(0x140)]}));return await handleSDKOutput(_0x2304a8,_0x1b49f7),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{[a27_0x5cdbb3(0x1be)]=a27_0x5cdbb3(0x17b);[a27_0x5cdbb3(0x1da)]='Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey';async['execute'](_0x37fcc3){const _0x33fd7d=a27_0x5cdbb3,{options:_0x1f90fa,args:_0x3a70f4,tdx:_0x1ccafa}=_0x37fcc3,_0x2012f8=_0x3a70f4[0x0];if(!requireNameOrPath(_0x2012f8))return 0x1;if(_0x1f90fa[_0x33fd7d(0x130)])console['error'](_0x33fd7d(0x172)+_0x2012f8);const {journeyId:_0x4e7959,journeyName:_0x1e23df}=await resolveJourneyIdFromInput(_0x2012f8,_0x1f90fa,_0x1ccafa);if(!_0x1f90fa[_0x33fd7d(0x19f)]){const _0x56d64c=await confirm('Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22'+_0x1e23df+'\x22?');if(!_0x56d64c)return console[_0x33fd7d(0x1e3)](_0x33fd7d(0x1eb)),0x0;}const _0x432fa9=await withSpinner(_0x33fd7d(0x192),()=>_0x1ccafa[_0x33fd7d(0x1d3)][_0x33fd7d(0x16e)](_0x4e7959),{'verbose':_0x1f90fa[_0x33fd7d(0x130)]}),_0x4224ee=_0x432fa9[_0x33fd7d(0x1ab)];return console[_0x33fd7d(0x1e3)](a27_0x11882f[_0x33fd7d(0x1b8)]('✔')+'\x20Created\x20v'+_0x4224ee[_0x33fd7d(0x145)][_0x33fd7d(0xf8)]+'\x20(draft)\x20—\x20\x22'+_0x4224ee['attributes'][_0x33fd7d(0x1be)]+'\x22'),console[_0x33fd7d(0x1e3)](_0x33fd7d(0x1e2)+_0x4224ee['id']),await handleSingleObjectOutput({'id':_0x4224ee['id'],'name':_0x4224ee['attributes'][_0x33fd7d(0x1be)],'version':_0x4224ee[_0x33fd7d(0x145)][_0x33fd7d(0xf8)],'state':_0x4224ee[_0x33fd7d(0x145)][_0x33fd7d(0x1c7)],'bundle_id':_0x4224ee[_0x33fd7d(0x145)]['journeyBundleId'],'created_at':_0x4224ee[_0x33fd7d(0x145)][_0x33fd7d(0x140)]},_0x1f90fa),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a27_0x5cdbb3(0x1be)]=a27_0x5cdbb3(0x1a0);[a27_0x5cdbb3(0x1da)]=a27_0x5cdbb3(0x139);async[a27_0x5cdbb3(0x1d1)](_0x407f39){const _0x5ed306=a27_0x5cdbb3,{options:_0x4802fd,args:_0x4bfafa,tdx:_0x2c82c0}=_0x407f39,_0xf16e1=_0x4bfafa[0x0];if(!requireNameOrPath(_0xf16e1))return 0x1;const _0x9bb498=_0x4802fd[_0x5ed306(0x10b)];if(!_0x9bb498)return console['error'](_0x5ed306(0x1ac)),console['error'](_0x5ed306(0x1d2)),0x1;const _0xccddfd=parseInt(_0x9bb498,0xa);if(isNaN(_0xccddfd)||_0xccddfd<0x1)return console[_0x5ed306(0x1e3)](_0x5ed306(0x182)+_0x9bb498),0x1;if(_0x4802fd[_0x5ed306(0x130)])console[_0x5ed306(0x1e3)](_0x5ed306(0x172)+_0xf16e1+_0x5ed306(0x1f1)+_0xccddfd);const {journeyId:_0x52203a,parentSegmentId:_0x202f38}=await resolveJourneyIdFromInput(_0xf16e1,_0x4802fd,_0x2c82c0),_0xb6a5bf=await withSpinner(_0x5ed306(0xfc),()=>_0x2c82c0[_0x5ed306(0x1d3)][_0x5ed306(0x147)](_0x52203a),{'verbose':_0x4802fd['verbose']}),{versions:_0x1ee9de,latestJourneyId:_0x991f0e}=_0xb6a5bf['data'],_0x1c416a=_0x1ee9de[_0x5ed306(0x118)](_0x222d00=>_0x222d00[_0x5ed306(0xf8)]===_0xccddfd);if(!_0x1c416a){const _0x409e24=_0x1ee9de[_0x5ed306(0x1cf)](_0x1c2a8f=>'v'+_0x1c2a8f[_0x5ed306(0xf8)])['join'](',\x20');return console[_0x5ed306(0x1e3)]('Error:\x20Version\x20'+_0xccddfd+_0x5ed306(0x15a)+_0x409e24),0x1;}const _0xc53550=await withSpinner('Getting\x20version\x20'+_0xccddfd+_0x5ed306(0x189),()=>_0x2c82c0[_0x5ed306(0x1d3)][_0x5ed306(0xf1)](_0x1c416a['journeyId']),{'verbose':_0x4802fd['verbose']}),_0x4b676c=_0xc53550['data'],_0x57eabe=getConsoleNextUrl(_0x4802fd[_0x5ed306(0x1db)],_0x5ed306(0x1df)+_0x202f38+'/e/'+_0x1c416a[_0x5ed306(0x1ee)]+'/j/da/je');return await handleSingleObjectOutput({'id':_0x4b676c['id'],'name':_0x4b676c[_0x5ed306(0x145)]['name'],'version':_0x4b676c[_0x5ed306(0x145)]['versionNumber'],'description':_0x4b676c[_0x5ed306(0x145)]['description'],'state':_0x4b676c[_0x5ed306(0x145)][_0x5ed306(0x1c7)],'paused':_0x4b676c[_0x5ed306(0x145)]['paused'],'reentry_mode':_0x4b676c['attributes'][_0x5ed306(0x10f)],'stages':_0x4b676c[_0x5ed306(0x145)][_0x5ed306(0x17c)]?.[_0x5ed306(0x1e0)]||0x0,..._0x4b676c['attributes'][_0x5ed306(0x11c)]&&{'goal':_0x4b676c['attributes'][_0x5ed306(0x11c)]['name']},'latest':_0x1c416a[_0x5ed306(0x1ee)]===_0x991f0e,'created_at':_0x4b676c[_0x5ed306(0x145)][_0x5ed306(0x140)],'updated_at':_0x4b676c[_0x5ed306(0x145)][_0x5ed306(0x12a)],'url':_0x57eabe},_0x4802fd),0x0;}}
@@ -1 +1 @@
1
- const a29_0x328bdf=a29_0x49e1;(function(_0x3ec81e,_0x2557df){const _0x2aa990=a29_0x49e1,_0x274a1d=_0x3ec81e();while(!![]){try{const _0x245ba5=parseInt(_0x2aa990(0x1b0))/0x1*(parseInt(_0x2aa990(0x1b8))/0x2)+parseInt(_0x2aa990(0x1dc))/0x3*(parseInt(_0x2aa990(0x1e4))/0x4)+-parseInt(_0x2aa990(0x1bf))/0x5*(-parseInt(_0x2aa990(0x1cd))/0x6)+-parseInt(_0x2aa990(0x1df))/0x7+-parseInt(_0x2aa990(0x1d4))/0x8+-parseInt(_0x2aa990(0x1c9))/0x9+parseInt(_0x2aa990(0x1d8))/0xa*(parseInt(_0x2aa990(0x1c7))/0xb);if(_0x245ba5===_0x2557df)break;else _0x274a1d['push'](_0x274a1d['shift']());}catch(_0xc82cf7){_0x274a1d['push'](_0x274a1d['shift']());}}}(a29_0x2336,0x1cd59));function a29_0x2336(){const _0x5ccb9f=['\x20valid','Validation\x20failed:\x20','type','warningCount','134005yzzSNH','Error:\x20Directory\x20not\x20found:\x20','reason','\x20segment\x20file(s)\x20skipped','relativePath','red','targetDir','\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','1847747lzBYNy','Validate\x20journey\x20YAML\x20files','16164pOmRJR','filter','skippedCount','\x20error(s)','18UylLsh','log','No\x20journey\x20YAML\x20files\x20found\x20in\x20','hasErrors','\x20warning(s)\x20found','warnings','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','1386520oojvEP','name','journey:validate','\x20warning(s)','10AGAteW','.yaml','invalidCount','file','6nNJCgf','✔\x20All\x20','validCount','126112tPBSDy','valid','dim','verbose','\x20journey(s)\x20valid','3084POPjuI','cwd','errorCode','error','endsWith','6131tObQDC','length','helpText','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','errors','.yml','\x20journey(s)\x20with\x20errors,\x20','yellow','20RIynHQ','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','green'];a29_0x2336=function(){return _0x5ccb9f;};return a29_0x2336();}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';import a29_0x1fe165 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';function a29_0x49e1(_0x4cb966,_0x2b9ef2){_0x4cb966=_0x4cb966-0x1b0;const _0x233697=a29_0x2336();let _0x49e110=_0x233697[_0x4cb966];return _0x49e110;}import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a29_0x328bdf(0x1d5)]=a29_0x328bdf(0x1d6);['description']=a29_0x328bdf(0x1c8);async['execute'](_0x53959e){const _0x40f5df=a29_0x328bdf,{options:_0x1a2db3,args:_0x3ccea4}=_0x53959e,_0x1cf06c=_0x1a2db3,_0x136ddc=await resolveTarget({'arg':_0x3ccea4[0x0],'contextParent':_0x1a2db3['parentSegment'],'cwd':process[_0x40f5df(0x1e5)]()});if(!isSuccessfulResolution(_0x136ddc))return _0x136ddc[_0x40f5df(0x1e6)]==='no_parent'?(console[_0x40f5df(0x1e7)](a29_0x1fe165[_0x40f5df(0x1b7)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x40f5df(0x1e7)](_0x40f5df(0x1b3)),console[_0x40f5df(0x1e7)](_0x40f5df(0x1c6)),console[_0x40f5df(0x1e7)](_0x40f5df(0x1b9))):(console['error'](a29_0x1fe165[_0x40f5df(0x1c4)]('Error:\x20'+_0x136ddc['message']+'\x0a')),_0x136ddc['helpText']&&console[_0x40f5df(0x1e7)](a29_0x1fe165['cyan'](_0x136ddc[_0x40f5df(0x1b2)]))),0x1;const _0x17a593=_0x136ddc[_0x40f5df(0x1c5)],_0x48eb35=_0x136ddc[_0x40f5df(0x1bd)]===_0x40f5df(0x1db)?_0x136ddc['filePath']:undefined;if(!_0x48eb35&&!existsSync(_0x17a593))return console['error'](a29_0x1fe165[_0x40f5df(0x1c4)](_0x40f5df(0x1c0)+_0x17a593+'\x0a')),0x1;let _0x39fca8;if(_0x48eb35){if(!_0x48eb35[_0x40f5df(0x1e8)](_0x40f5df(0x1b5))&&!_0x48eb35['endsWith'](_0x40f5df(0x1d9)))return console[_0x40f5df(0x1e7)](a29_0x1fe165[_0x40f5df(0x1c4)](_0x40f5df(0x1d3)+_0x48eb35+'\x0a')),0x1;_0x39fca8=[_0x48eb35];}else _0x39fca8=findYamlFiles(_0x17a593);if(_0x39fca8['length']===0x0)return console[_0x40f5df(0x1e7)](a29_0x1fe165[_0x40f5df(0x1c4)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x17a593+'\x0a')),0x1;const _0x133b1b=validateYamlFiles(_0x39fca8,_0x17a593,{'filterType':'journey'}),_0x315dee=calculateSummary(_0x133b1b),_0x490dc6=_0x133b1b[_0x40f5df(0x1ca)](isValidationResult);if(_0x490dc6[_0x40f5df(0x1b1)]===0x0)return console['error'](a29_0x1fe165[_0x40f5df(0x1b7)](_0x40f5df(0x1cf)+_0x17a593+'\x0a')),_0x315dee[_0x40f5df(0x1cb)]>0x0&&console[_0x40f5df(0x1e7)](a29_0x1fe165['dim']('('+_0x315dee['skippedCount']+'\x20segment\x20file(s)\x20skipped)')),0x0;for(const _0x2d7c1d of _0x133b1b){if(!isValidationResult(_0x2d7c1d)){_0x1cf06c[_0x40f5df(0x1e2)]&&console[_0x40f5df(0x1ce)](a29_0x1fe165[_0x40f5df(0x1e1)]('-\x20'+_0x2d7c1d[_0x40f5df(0x1c3)]+'\x20(skipped:\x20'+_0x2d7c1d[_0x40f5df(0x1c1)]+')'));continue;}const {relativePath:_0x39fe7d,source:_0x5b092c,result:_0x262a24}=_0x2d7c1d;if(_0x262a24[_0x40f5df(0x1e0)]&&_0x262a24[_0x40f5df(0x1d2)]['length']===0x0)_0x1cf06c[_0x40f5df(0x1e2)]&&console['log'](a29_0x1fe165[_0x40f5df(0x1ba)]('✔\x20'+_0x39fe7d));else _0x262a24[_0x40f5df(0x1e0)]?(console[_0x40f5df(0x1ce)](a29_0x1fe165['yellow']('⚠\x20'+_0x39fe7d+':\x20'+_0x262a24['warnings']['length']+_0x40f5df(0x1d7))),console['log'](formatValidationResult(_0x262a24,_0x5b092c,_0x39fe7d))):(console[_0x40f5df(0x1ce)](a29_0x1fe165[_0x40f5df(0x1c4)]('✖\x20'+_0x39fe7d+':\x20'+_0x262a24[_0x40f5df(0x1b4)][_0x40f5df(0x1b1)]+_0x40f5df(0x1cc))),console['log'](formatValidationResult(_0x262a24,_0x5b092c,_0x39fe7d)));}return console[_0x40f5df(0x1ce)](''),_0x315dee[_0x40f5df(0x1d0)]?(console[_0x40f5df(0x1ce)](a29_0x1fe165['red'](_0x40f5df(0x1bc)+_0x315dee[_0x40f5df(0x1da)]+_0x40f5df(0x1b6)+_0x315dee['validCount']+_0x40f5df(0x1bb))),_0x315dee[_0x40f5df(0x1be)]>0x0&&console[_0x40f5df(0x1ce)](a29_0x1fe165[_0x40f5df(0x1b7)](_0x315dee[_0x40f5df(0x1be)]+_0x40f5df(0x1d1))),_0x315dee[_0x40f5df(0x1cb)]>0x0&&console[_0x40f5df(0x1ce)](a29_0x1fe165['dim'](_0x315dee[_0x40f5df(0x1cb)]+'\x20segment\x20file(s)\x20skipped')),0x1):(console['log'](a29_0x1fe165[_0x40f5df(0x1ba)](_0x40f5df(0x1dd)+_0x315dee[_0x40f5df(0x1de)]+_0x40f5df(0x1e3))),_0x315dee[_0x40f5df(0x1be)]>0x0&&console['log'](a29_0x1fe165['yellow'](_0x315dee['warningCount']+'\x20warning(s)\x20found')),_0x315dee[_0x40f5df(0x1cb)]>0x0&&console[_0x40f5df(0x1ce)](a29_0x1fe165[_0x40f5df(0x1e1)](_0x315dee[_0x40f5df(0x1cb)]+_0x40f5df(0x1c2))),0x0);}}
1
+ const a28_0x317361=a28_0xcad2;(function(_0xf3f9be,_0x151c05){const _0x5cccd5=a28_0xcad2,_0x52fcb2=_0xf3f9be();while(!![]){try{const _0x49087d=-parseInt(_0x5cccd5(0xbd))/0x1+-parseInt(_0x5cccd5(0xc8))/0x2*(-parseInt(_0x5cccd5(0xae))/0x3)+-parseInt(_0x5cccd5(0xa6))/0x4+parseInt(_0x5cccd5(0xb7))/0x5+parseInt(_0x5cccd5(0xa9))/0x6*(-parseInt(_0x5cccd5(0xb8))/0x7)+-parseInt(_0x5cccd5(0x97))/0x8+parseInt(_0x5cccd5(0xb6))/0x9*(parseInt(_0x5cccd5(0xa5))/0xa);if(_0x49087d===_0x151c05)break;else _0x52fcb2['push'](_0x52fcb2['shift']());}catch(_0x5e8059){_0x52fcb2['push'](_0x52fcb2['shift']());}}}(a28_0x37ce,0x20233));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a28_0x37ce(){const _0x22f2ac=['yellow','cyan','verbose','endsWith','error','\x20journey(s)\x20with\x20errors,\x20','helpText','\x20error(s)','warningCount','No\x20journey\x20YAML\x20files\x20found\x20in\x20','341396qduyKm','green','filter','length','Error:\x20Directory\x20not\x20found:\x20','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','dim','607504PpdkjH','execute','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20segment\x20file(s)\x20skipped)','reason','journey:validate','.yml','invalidCount','warnings','message','validCount','.yaml','relativePath','Validation\x20failed:\x20','10670TPZFzd','312708FSgRVx','skippedCount','name','1100070wMgnKI','\x20warning(s)\x20found','file','Error:\x20','\x20(skipped:\x20','3lYZMGv','log','parentSegment','\x20valid','\x20warning(s)','\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','targetDir','type','3492ejyEak','714880NTbNmN','7zHoQjH','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','red','valid','cwd','258575KGRicv'];a28_0x37ce=function(){return _0x22f2ac;};return a28_0x37ce();}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';function a28_0xcad2(_0x450a8a,_0x35f4cf){_0x450a8a=_0x450a8a-0x95;const _0x37cea7=a28_0x37ce();let _0xcad299=_0x37cea7[_0x450a8a];return _0xcad299;}import a28_0x1b6f89 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{[a28_0x317361(0xa8)]=a28_0x317361(0x9c);['description']='Validate\x20journey\x20YAML\x20files';async[a28_0x317361(0x98)](_0x332c58){const _0x379c7d=a28_0x317361,{options:_0x131995,args:_0x243d7f}=_0x332c58,_0x51092a=_0x131995,_0x599e8c=await resolveTarget({'arg':_0x243d7f[0x0],'contextParent':_0x131995[_0x379c7d(0xb0)],'cwd':process[_0x379c7d(0xbc)]()});if(!isSuccessfulResolution(_0x599e8c))return _0x599e8c['errorCode']==='no_parent'?(console['error'](a28_0x1b6f89['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x379c7d(0xc2)]('Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)'),console['error'](_0x379c7d(0xb3)),console['error'](_0x379c7d(0xb9))):(console[_0x379c7d(0xc2)](a28_0x1b6f89[_0x379c7d(0xba)](_0x379c7d(0xac)+_0x599e8c[_0x379c7d(0xa0)]+'\x0a')),_0x599e8c[_0x379c7d(0xc4)]&&console[_0x379c7d(0xc2)](a28_0x1b6f89[_0x379c7d(0xbf)](_0x599e8c['helpText']))),0x1;const _0x4f3d2b=_0x599e8c[_0x379c7d(0xb4)],_0x2bea1b=_0x599e8c[_0x379c7d(0xb5)]===_0x379c7d(0xab)?_0x599e8c['filePath']:undefined;if(!_0x2bea1b&&!existsSync(_0x4f3d2b))return console[_0x379c7d(0xc2)](a28_0x1b6f89['red'](_0x379c7d(0xcc)+_0x4f3d2b+'\x0a')),0x1;let _0x218596;if(_0x2bea1b){if(!_0x2bea1b[_0x379c7d(0xc1)](_0x379c7d(0x9d))&&!_0x2bea1b[_0x379c7d(0xc1)](_0x379c7d(0xa2)))return console[_0x379c7d(0xc2)](a28_0x1b6f89['red'](_0x379c7d(0x99)+_0x2bea1b+'\x0a')),0x1;_0x218596=[_0x2bea1b];}else _0x218596=findYamlFiles(_0x4f3d2b);if(_0x218596[_0x379c7d(0xcb)]===0x0)return console['error'](a28_0x1b6f89[_0x379c7d(0xba)](_0x379c7d(0x95)+_0x4f3d2b+'\x0a')),0x1;const _0x346d81=validateYamlFiles(_0x218596,_0x4f3d2b,{'filterType':'journey'}),_0x4e7a6c=calculateSummary(_0x346d81),_0xc2b079=_0x346d81[_0x379c7d(0xca)](isValidationResult);if(_0xc2b079['length']===0x0)return console['error'](a28_0x1b6f89[_0x379c7d(0xbe)](_0x379c7d(0xc7)+_0x4f3d2b+'\x0a')),_0x4e7a6c['skippedCount']>0x0&&console['error'](a28_0x1b6f89[_0x379c7d(0x96)]('('+_0x4e7a6c[_0x379c7d(0xa7)]+_0x379c7d(0x9a))),0x0;for(const _0x2ff722 of _0x346d81){if(!isValidationResult(_0x2ff722)){_0x51092a[_0x379c7d(0xc0)]&&console[_0x379c7d(0xaf)](a28_0x1b6f89[_0x379c7d(0x96)]('-\x20'+_0x2ff722[_0x379c7d(0xa3)]+_0x379c7d(0xad)+_0x2ff722[_0x379c7d(0x9b)]+')'));continue;}const {relativePath:_0x349603,source:_0x32e29c,result:_0x317831}=_0x2ff722;if(_0x317831['valid']&&_0x317831[_0x379c7d(0x9f)][_0x379c7d(0xcb)]===0x0)_0x51092a[_0x379c7d(0xc0)]&&console[_0x379c7d(0xaf)](a28_0x1b6f89[_0x379c7d(0xc9)]('✔\x20'+_0x349603));else _0x317831[_0x379c7d(0xbb)]?(console['log'](a28_0x1b6f89[_0x379c7d(0xbe)]('⚠\x20'+_0x349603+':\x20'+_0x317831[_0x379c7d(0x9f)][_0x379c7d(0xcb)]+_0x379c7d(0xb2))),console[_0x379c7d(0xaf)](formatValidationResult(_0x317831,_0x32e29c,_0x349603))):(console[_0x379c7d(0xaf)](a28_0x1b6f89[_0x379c7d(0xba)]('✖\x20'+_0x349603+':\x20'+_0x317831['errors'][_0x379c7d(0xcb)]+_0x379c7d(0xc5))),console['log'](formatValidationResult(_0x317831,_0x32e29c,_0x349603)));}return console['log'](''),_0x4e7a6c['hasErrors']?(console['log'](a28_0x1b6f89[_0x379c7d(0xba)](_0x379c7d(0xa4)+_0x4e7a6c[_0x379c7d(0x9e)]+_0x379c7d(0xc3)+_0x4e7a6c['validCount']+_0x379c7d(0xb1))),_0x4e7a6c[_0x379c7d(0xc6)]>0x0&&console['log'](a28_0x1b6f89['yellow'](_0x4e7a6c[_0x379c7d(0xc6)]+_0x379c7d(0xaa))),_0x4e7a6c['skippedCount']>0x0&&console[_0x379c7d(0xaf)](a28_0x1b6f89[_0x379c7d(0x96)](_0x4e7a6c[_0x379c7d(0xa7)]+'\x20segment\x20file(s)\x20skipped')),0x1):(console['log'](a28_0x1b6f89[_0x379c7d(0xc9)]('✔\x20All\x20'+_0x4e7a6c[_0x379c7d(0xa1)]+'\x20journey(s)\x20valid')),_0x4e7a6c['warningCount']>0x0&&console[_0x379c7d(0xaf)](a28_0x1b6f89['yellow'](_0x4e7a6c[_0x379c7d(0xc6)]+_0x379c7d(0xaa))),_0x4e7a6c[_0x379c7d(0xa7)]>0x0&&console[_0x379c7d(0xaf)](a28_0x1b6f89['dim'](_0x4e7a6c[_0x379c7d(0xa7)]+'\x20segment\x20file(s)\x20skipped')),0x0);}}