@treasuredata/tdx 2026.8.6 → 2026.8.7

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 (291) 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.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/codex-command.d.ts +2 -1
  19. package/dist/commands/codex-command.d.ts.map +1 -1
  20. package/dist/commands/codex-command.js +1 -1
  21. package/dist/commands/codex-command.js.map +1 -1
  22. package/dist/commands/command.js +1 -1
  23. package/dist/commands/connection-command.js +1 -1
  24. package/dist/commands/databases.js +1 -1
  25. package/dist/commands/delivery-command.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
  28. package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
  29. package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
  30. package/dist/commands/engage-campaign-pull-command.js +1 -1
  31. package/dist/commands/engage-campaign-push-command.js +1 -1
  32. package/dist/commands/engage-campaign-validate-command.js +1 -1
  33. package/dist/commands/engage-command.d.ts.map +1 -1
  34. package/dist/commands/engage-command.js +1 -1
  35. package/dist/commands/engage-command.js.map +1 -1
  36. package/dist/commands/engage-template-pull-command.js +1 -1
  37. package/dist/commands/engage-template-push-command.js +1 -1
  38. package/dist/commands/engage-template-validate-command.js +1 -1
  39. package/dist/commands/job-command.js +1 -1
  40. package/dist/commands/journey-command.js +1 -1
  41. package/dist/commands/journey-validate-command.js +1 -1
  42. package/dist/commands/llm-command.js +1 -1
  43. package/dist/commands/mcp-command.js +1 -1
  44. package/dist/commands/p13n-command.d.ts +16 -1
  45. package/dist/commands/p13n-command.d.ts.map +1 -1
  46. package/dist/commands/p13n-command.js +1 -1
  47. package/dist/commands/p13n-command.js.map +1 -1
  48. package/dist/commands/parent-segment-command.js +1 -1
  49. package/dist/commands/policy-command.js +1 -1
  50. package/dist/commands/profile-command.js +1 -1
  51. package/dist/commands/profiles-command.js +1 -1
  52. package/dist/commands/query-command.js +1 -1
  53. package/dist/commands/schedule-command.js +1 -1
  54. package/dist/commands/segment-command.js +1 -1
  55. package/dist/commands/segment-create-command.js +1 -1
  56. package/dist/commands/segment-fields-command.js +1 -1
  57. package/dist/commands/segment-move-command.js +1 -1
  58. package/dist/commands/segment-pull-command.js +1 -1
  59. package/dist/commands/segment-push-command.js +1 -1
  60. package/dist/commands/segment-update-command.js +1 -1
  61. package/dist/commands/segment-use-command.js +1 -1
  62. package/dist/commands/segment-validate-command.js +1 -1
  63. package/dist/commands/segments.js +1 -1
  64. package/dist/commands/show.js +1 -1
  65. package/dist/commands/status-command.js +1 -1
  66. package/dist/commands/table-deleted.js +1 -1
  67. package/dist/commands/tables.js +1 -1
  68. package/dist/commands/unset-command.d.ts +1 -0
  69. package/dist/commands/unset-command.d.ts.map +1 -1
  70. package/dist/commands/unset-command.js +1 -1
  71. package/dist/commands/unset-command.js.map +1 -1
  72. package/dist/commands/upgrade-command.js +1 -1
  73. package/dist/commands/use-command.d.ts +1 -0
  74. package/dist/commands/use-command.d.ts.map +1 -1
  75. package/dist/commands/use-command.js +1 -1
  76. package/dist/commands/use-command.js.map +1 -1
  77. package/dist/commands/user-command.js +1 -1
  78. package/dist/commands/work-command.js +1 -1
  79. package/dist/commands/workflow-command.js +1 -1
  80. package/dist/core/auth.js +1 -1
  81. package/dist/core/command-output.js +1 -1
  82. package/dist/core/config.js +1 -1
  83. package/dist/core/connection-cache.js +1 -1
  84. package/dist/core/constants.js +1 -1
  85. package/dist/core/credential-cache.js +1 -1
  86. package/dist/core/global-context.d.ts +1 -0
  87. package/dist/core/global-context.d.ts.map +1 -1
  88. package/dist/core/global-context.js +1 -1
  89. package/dist/core/global-context.js.map +1 -1
  90. package/dist/core/keychain.js +1 -1
  91. package/dist/core/oauth-keychain.js +1 -1
  92. package/dist/core/oauth.js +1 -1
  93. package/dist/core/profile.js +1 -1
  94. package/dist/core/project-config.js +1 -1
  95. package/dist/core/session.d.ts +2 -1
  96. package/dist/core/session.d.ts.map +1 -1
  97. package/dist/core/session.js +1 -1
  98. package/dist/core/session.js.map +1 -1
  99. package/dist/core/site-mismatch.js +1 -1
  100. package/dist/core/user-cache.js +1 -1
  101. package/dist/core/version.js +1 -1
  102. package/dist/index.js +1 -1
  103. package/dist/mcp/server.js +1 -1
  104. package/dist/mcp/tools/index.js +1 -1
  105. package/dist/mcp/tools/tdx-run.js +1 -1
  106. package/dist/mcp/tools/tdx-search.js +1 -1
  107. package/dist/mcp/tools/work-create-item.js +1 -1
  108. package/dist/mcp/utils.js +1 -1
  109. package/dist/proxy/claude-usage-tracker.js +1 -1
  110. package/dist/proxy/passthrough-server.js +1 -1
  111. package/dist/proxy/sse-usage-parser.js +1 -1
  112. package/dist/sdk/agent/agent-config.js +1 -1
  113. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  114. package/dist/sdk/agent/agent-yaml.js +1 -1
  115. package/dist/sdk/agent/test/evaluator.js +1 -1
  116. package/dist/sdk/agent/test/executor.js +1 -1
  117. package/dist/sdk/agent/test/index.js +1 -1
  118. package/dist/sdk/agent/test/output.js +1 -1
  119. package/dist/sdk/agent/test/parser.js +1 -1
  120. package/dist/sdk/agent/tool-target-registry.js +1 -1
  121. package/dist/sdk/api.js +1 -1
  122. package/dist/sdk/auth-token.js +1 -1
  123. package/dist/sdk/cas/cas-api-client.js +1 -1
  124. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  125. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  126. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  127. package/dist/sdk/cas/cas-segment-schema.js +1 -1
  128. package/dist/sdk/cas/cas-segment-validator.js +1 -1
  129. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  130. package/dist/sdk/cas/index.js +1 -1
  131. package/dist/sdk/cas/pull-workflow.js +1 -1
  132. package/dist/sdk/cas/push-workflow.js +1 -1
  133. package/dist/sdk/cas/validate-files.js +1 -1
  134. package/dist/sdk/client/cdp-api-client.js +1 -1
  135. package/dist/sdk/client/delivery-api-client.js +1 -1
  136. package/dist/sdk/client/endpoints.js +1 -1
  137. package/dist/sdk/client/engage-api-client.d.ts +10 -2
  138. package/dist/sdk/client/engage-api-client.d.ts.map +1 -1
  139. package/dist/sdk/client/engage-api-client.js +1 -1
  140. package/dist/sdk/client/engage-api-client.js.map +1 -1
  141. package/dist/sdk/client/http-client.js +1 -1
  142. package/dist/sdk/client/llm-api-client.js +1 -1
  143. package/dist/sdk/client/oauth-refresh.js +1 -1
  144. package/dist/sdk/client/p13n-studio-api-client.d.ts +65 -1
  145. package/dist/sdk/client/p13n-studio-api-client.d.ts.map +1 -1
  146. package/dist/sdk/client/p13n-studio-api-client.js +1 -1
  147. package/dist/sdk/client/p13n-studio-api-client.js.map +1 -1
  148. package/dist/sdk/client/rate-limiter.js +1 -1
  149. package/dist/sdk/client/td-api-client.js +1 -1
  150. package/dist/sdk/client/trino-api-client.js +1 -1
  151. package/dist/sdk/client/workflow-client.js +1 -1
  152. package/dist/sdk/connection-validator.js +1 -1
  153. package/dist/sdk/connection.js +1 -1
  154. package/dist/sdk/delivery.js +1 -1
  155. package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
  156. package/dist/sdk/engage/always-on-campaign-push.js +1 -1
  157. package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
  158. package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
  159. package/dist/sdk/engage/campaign-pull.js +1 -1
  160. package/dist/sdk/engage/campaign-push.js +1 -1
  161. package/dist/sdk/engage/campaign-validator.js +1 -1
  162. package/dist/sdk/engage/campaign-yaml.js +1 -1
  163. package/dist/sdk/engage/template-pull.js +1 -1
  164. package/dist/sdk/engage/template-push.js +1 -1
  165. package/dist/sdk/engage/template-validator.js +1 -1
  166. package/dist/sdk/engage/template-yaml.js +1 -1
  167. package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
  168. package/dist/sdk/engage/types/campaign-def.js +1 -1
  169. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  170. package/dist/sdk/engage/types/template-schema.js +1 -1
  171. package/dist/sdk/engage.d.ts +7 -2
  172. package/dist/sdk/engage.d.ts.map +1 -1
  173. package/dist/sdk/engage.js +1 -1
  174. package/dist/sdk/engage.js.map +1 -1
  175. package/dist/sdk/errors.js +1 -1
  176. package/dist/sdk/index.d.ts +5 -1
  177. package/dist/sdk/index.d.ts.map +1 -1
  178. package/dist/sdk/index.js +1 -1
  179. package/dist/sdk/index.js.map +1 -1
  180. package/dist/sdk/io/index.js +1 -1
  181. package/dist/sdk/io/node-filesystem.js +1 -1
  182. package/dist/sdk/job.js +1 -1
  183. package/dist/sdk/journey.js +1 -1
  184. package/dist/sdk/llm/chat-cache.js +1 -1
  185. package/dist/sdk/llm/index.js +1 -1
  186. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  187. package/dist/sdk/llm/model-factors.js +1 -1
  188. package/dist/sdk/llm/user-settings.js +1 -1
  189. package/dist/sdk/p13n-studio.d.ts +148 -1
  190. package/dist/sdk/p13n-studio.d.ts.map +1 -1
  191. package/dist/sdk/p13n-studio.js +1 -1
  192. package/dist/sdk/p13n-studio.js.map +1 -1
  193. package/dist/sdk/personalization.js +1 -1
  194. package/dist/sdk/policy.js +1 -1
  195. package/dist/sdk/query/deleted-table-validation.js +1 -1
  196. package/dist/sdk/query/index.js +1 -1
  197. package/dist/sdk/query/sql-parser.js +1 -1
  198. package/dist/sdk/realtime.js +1 -1
  199. package/dist/sdk/schedule.js +1 -1
  200. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  201. package/dist/sdk/segment/fields-display.js +1 -1
  202. package/dist/sdk/segment/file-discovery.js +1 -1
  203. package/dist/sdk/segment/journey-utils.js +1 -1
  204. package/dist/sdk/segment/journey-validator.js +1 -1
  205. package/dist/sdk/segment/journey-yaml.js +1 -1
  206. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  207. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  208. package/dist/sdk/segment/pull-workflow.js +1 -1
  209. package/dist/sdk/segment/push-recovery.js +1 -1
  210. package/dist/sdk/segment/push-workflow.js +1 -1
  211. package/dist/sdk/segment/resolution-context.js +1 -1
  212. package/dist/sdk/segment/segment-path-parser.js +1 -1
  213. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  214. package/dist/sdk/segment/segment-validator.js +1 -1
  215. package/dist/sdk/segment/target-resolution.js +1 -1
  216. package/dist/sdk/segment/tdx-config.js +1 -1
  217. package/dist/sdk/segment/types/activation-schema.js +1 -1
  218. package/dist/sdk/segment/types/journey-def.js +1 -1
  219. package/dist/sdk/segment/types/journey-schema.js +1 -1
  220. package/dist/sdk/segment/types/segment-def.js +1 -1
  221. package/dist/sdk/segment/types/segment-schema.js +1 -1
  222. package/dist/sdk/segment/validate-files.js +1 -1
  223. package/dist/sdk/segment/yaml-validator.js +1 -1
  224. package/dist/sdk/segment.js +1 -1
  225. package/dist/sdk/types/engage.d.ts +41 -0
  226. package/dist/sdk/types/engage.d.ts.map +1 -1
  227. package/dist/sdk/types/index.d.ts +3 -2
  228. package/dist/sdk/types/index.d.ts.map +1 -1
  229. package/dist/sdk/types/index.js +1 -1
  230. package/dist/sdk/types/index.js.map +1 -1
  231. package/dist/sdk/types/p13n-studio.d.ts +73 -0
  232. package/dist/sdk/types/p13n-studio.d.ts.map +1 -1
  233. package/dist/sdk/types/progress.js +1 -1
  234. package/dist/sdk/types/workspace.js +1 -1
  235. package/dist/sdk/user.js +1 -1
  236. package/dist/sdk/util/format-detector.js +1 -1
  237. package/dist/sdk/util/formatters.js +1 -1
  238. package/dist/sdk/util/index.js +1 -1
  239. package/dist/sdk/util/paginate.js +1 -1
  240. package/dist/sdk/util/tree-formatter.js +1 -1
  241. package/dist/sdk/util/tree-search.js +1 -1
  242. package/dist/sdk/workflow/archive-validation.js +1 -1
  243. package/dist/sdk/workflow/clone-workflow.js +1 -1
  244. package/dist/sdk/workflow/index.js +1 -1
  245. package/dist/sdk/workflow/pull-workflow.js +1 -1
  246. package/dist/sdk/workflow/push-workflow.js +1 -1
  247. package/dist/sdk/workflow/task-graph.js +1 -1
  248. package/dist/sdk/workflow/tdx-config.js +1 -1
  249. package/dist/sdk/workflow/workflow-utils.js +1 -1
  250. package/dist/sdk/workspace/access-tracker.js +1 -1
  251. package/dist/sdk/workspace/frontmatter.js +1 -1
  252. package/dist/sdk/workspace/git.js +1 -1
  253. package/dist/sdk/workspace/index.js +1 -1
  254. package/dist/sdk/workspace/templates.js +1 -1
  255. package/dist/sdk/workspace/weekly.js +1 -1
  256. package/dist/sdk/workspace/wikilinks.js +1 -1
  257. package/dist/test-utils/command-runner.js +1 -1
  258. package/dist/test-utils/factories.js +1 -1
  259. package/dist/test-utils/fixtures.js +1 -1
  260. package/dist/test-utils/http-mock.js +1 -1
  261. package/dist/test-utils/index.js +1 -1
  262. package/dist/utils/async.js +1 -1
  263. package/dist/utils/claude-code-state.js +1 -1
  264. package/dist/utils/colors.js +1 -1
  265. package/dist/utils/diff.js +1 -1
  266. package/dist/utils/file-permissions.js +1 -1
  267. package/dist/utils/file-reader.js +1 -1
  268. package/dist/utils/github-releases.js +1 -1
  269. package/dist/utils/global-cache.js +1 -1
  270. package/dist/utils/json-loader.js +1 -1
  271. package/dist/utils/local-cache.js +1 -1
  272. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  273. package/dist/utils/logger/formatters/index.js +1 -1
  274. package/dist/utils/logger/handlers/console-handler.js +1 -1
  275. package/dist/utils/logger/handlers/file-handler.js +1 -1
  276. package/dist/utils/logger/handlers/index.js +1 -1
  277. package/dist/utils/logger/handlers/null-handler.js +1 -1
  278. package/dist/utils/logger/index.js +1 -1
  279. package/dist/utils/logger/logger.js +1 -1
  280. package/dist/utils/logger/types.js +1 -1
  281. package/dist/utils/option-validation.js +1 -1
  282. package/dist/utils/process.js +1 -1
  283. package/dist/utils/prompt.js +1 -1
  284. package/dist/utils/proxy-fetch.js +1 -1
  285. package/dist/utils/spinner.js +1 -1
  286. package/dist/utils/sse-parser.js +1 -1
  287. package/dist/utils/string-utils.js +1 -1
  288. package/dist/utils/table-ref-parser.js +1 -1
  289. package/dist/utils/tdx-logger.js +1 -1
  290. package/dist/utils/version-check.js +1 -1
  291. package/package.json +1 -1
@@ -1 +1 @@
1
- const a27_0x307037=a27_0x3386;(function(_0x2b85ee,_0xb43f6e){const _0x23ca62=a27_0x3386,_0x443dbe=_0x2b85ee();while(!![]){try{const _0x173d38=parseInt(_0x23ca62(0x1e2))/0x1+-parseInt(_0x23ca62(0x1cf))/0x2+parseInt(_0x23ca62(0x1e0))/0x3*(-parseInt(_0x23ca62(0x1db))/0x4)+parseInt(_0x23ca62(0x1d8))/0x5+-parseInt(_0x23ca62(0x1c4))/0x6*(-parseInt(_0x23ca62(0x1b8))/0x7)+-parseInt(_0x23ca62(0x1bc))/0x8+-parseInt(_0x23ca62(0x1ae))/0x9*(-parseInt(_0x23ca62(0x1c6))/0xa);if(_0x173d38===_0xb43f6e)break;else _0x443dbe['push'](_0x443dbe['shift']());}catch(_0xc225ac){_0x443dbe['push'](_0x443dbe['shift']());}}}(a27_0x11fb,0x316f4));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext,loadSessionContext}from'../core/session.js';import{tryFindTdxConfig}from'../sdk/segment/tdx-config.js';import a27_0x174ba5 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';function a27_0x3386(_0x88cd9b,_0x3283c0){_0x88cd9b=_0x88cd9b-0x1ac;const _0x11fb77=a27_0x11fb();let _0x3386ba=_0x11fb77[_0x88cd9b];return _0x3386ba;}function a27_0x11fb(){const _0x5add6e=['relativePath','engage:template:pull','Aborted.','workspace','files','dirname','✔\x20All\x20files\x20are\x20up\x20to\x20date','1802665hSlkhc','\x0aPull\x20summary\x20for\x20workspace\x20\x27','✔\x20Context\x20set:\x20','690884xUwRsY','hasChanges','yes','\x0aError:','Pull\x20templates\x20to\x20YAML\x20files','3UqVXwR','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','256132qKgwfM','filter','\x20new\x20files','absolutePath','yellow','length','\x0aOr\x20set\x20workspace\x20context\x20with:\x20tdx\x20use\x20engage_workspace\x20<name>','isNew','workspaceName','dim','Pulling\x20templates\x20from\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20unchanged\x20files','14778MfnAGn','cyan','setPhase','\x20files\x20to\x20','dryRun','utf-8','targetDir','diff','templates','engage','98EYIZtA','\x20templates','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20pull\x20--workspace\x20<name>','2587744rOHnLb','red','config','engage_workspace','\x20=\x20','\x20files?','\x0aChanges\x20to\x20\x27','error','18822pGvDbv','counts','2430DFtfYK','repeat','name','session','No\x20templates\x20found\x20in\x20workspace\x20\x27','\x0aUsage:\x20tdx\x20engage\x20template\x20pull\x20<workspace-name>','verbose','green','data','721832hbBKiY','Write\x20'];a27_0x11fb=function(){return _0x5add6e;};return a27_0x11fb();}import a27_0x2ab319 from'path';import{pullTemplates}from'../sdk/engage/template-pull.js';export class EngageTemplatePullCommand extends BaseCommand{[a27_0x307037(0x1c8)]=a27_0x307037(0x1d2);[a27_0x307037(0x1ba)]=a27_0x307037(0x1df);async['execute'](_0x212bb6){const _0x5b9192=a27_0x307037,{options:_0x1027ae,args:_0x497125,tdx:_0x267f27}=_0x212bb6,_0x5f29aa=_0x1027ae,_0x4b8cfe=await resolveWorkspaceName(_0x497125[0x0],_0x5f29aa);if(!_0x4b8cfe)return console[_0x5b9192(0x1c3)](a27_0x174ba5[_0x5b9192(0x1e6)]('Workspace\x20is\x20required.')),console[_0x5b9192(0x1c3)](_0x5b9192(0x1cb)),console[_0x5b9192(0x1c3)](_0x5b9192(0x1bb)),console[_0x5b9192(0x1c3)](_0x5b9192(0x1e8)),0x1;const _0x2fe3b1=await withProgressSpinner(_0x5b9192(0x1ec)+_0x4b8cfe+'\x27...',_0x638cd0=>pullTemplates({'engage':_0x267f27[_0x5b9192(0x1b7)]},_0x4b8cfe,{'templateName':_0x5f29aa[_0x5b9192(0x1c8)],'progress':{'update':_0x5ad442=>{const _0x3fd9a6=_0x5b9192;_0x638cd0[_0x3fd9a6(0x1b0)](_0x5ad442);}}}),{'verbose':_0x5f29aa[_0x5b9192(0x1cc)]}),_0x3f781b=_0x2fe3b1[_0x5b9192(0x1ce)];if(_0x3f781b['counts']['templates']===0x0)return console['error'](a27_0x174ba5[_0x5b9192(0x1e6)](_0x5b9192(0x1ca)+_0x3f781b[_0x5b9192(0x1ea)]+'\x27')),0x0;const _0x3929f2=_0x3f781b[_0x5b9192(0x1d5)][_0x5b9192(0x1e3)](_0x582cdf=>_0x582cdf[_0x5b9192(0x1e9)]),_0x481b3f=_0x3f781b[_0x5b9192(0x1d5)][_0x5b9192(0x1e3)](_0x450f14=>!_0x450f14[_0x5b9192(0x1e9)]&&_0x450f14[_0x5b9192(0x1dc)]),_0xcda5b3=_0x3f781b[_0x5b9192(0x1d5)][_0x5b9192(0x1e3)](_0x43e02e=>!_0x43e02e[_0x5b9192(0x1e9)]&&!_0x43e02e[_0x5b9192(0x1dc)]);console['error'](_0x5b9192(0x1d9)+_0x3f781b[_0x5b9192(0x1ea)]+'\x27:'),console['error']('\x20\x20'+a27_0x174ba5['cyan'](_0x3f781b[_0x5b9192(0x1c5)][_0x5b9192(0x1b6)]+_0x5b9192(0x1b9))),console[_0x5b9192(0x1c3)]('\x20\x20'+a27_0x174ba5[_0x5b9192(0x1cd)]('+\x20'+_0x3929f2[_0x5b9192(0x1e7)]+_0x5b9192(0x1e4))),console[_0x5b9192(0x1c3)]('\x20\x20'+a27_0x174ba5['yellow']('~\x20'+_0x481b3f[_0x5b9192(0x1e7)]+'\x20changed\x20files')),console[_0x5b9192(0x1c3)]('\x20\x20'+a27_0x174ba5['dim']('=\x20'+_0xcda5b3[_0x5b9192(0x1e7)]+_0x5b9192(0x1ad))),console['error']('\x20\x20Target:\x20'+a27_0x174ba5[_0x5b9192(0x1af)](_0x3f781b[_0x5b9192(0x1b4)])+'\x0a');if(_0x481b3f['length']>0x0)for(const _0xb5a261 of _0x481b3f){console[_0x5b9192(0x1c3)](_0x5b9192(0x1c2)+_0xb5a261[_0x5b9192(0x1d1)]+'\x27:'),console[_0x5b9192(0x1c3)]('\u2500'[_0x5b9192(0x1c7)](0x3c)),console['error'](_0xb5a261[_0x5b9192(0x1b5)]),console[_0x5b9192(0x1c3)]('\u2500'[_0x5b9192(0x1c7)](0x3c));}if(_0x5f29aa[_0x5b9192(0x1b2)])return console[_0x5b9192(0x1c3)](a27_0x174ba5[_0x5b9192(0x1e6)](_0x5b9192(0x1e1))),0x0;if(_0x3929f2[_0x5b9192(0x1e7)]===0x0&&_0x481b3f[_0x5b9192(0x1e7)]===0x0)return console[_0x5b9192(0x1c3)](a27_0x174ba5[_0x5b9192(0x1cd)](_0x5b9192(0x1d7))),saveSessionContext({'engage_workspace':_0x3f781b[_0x5b9192(0x1ea)]},_0x5f29aa[_0x5b9192(0x1c9)]),0x0;if(!_0x5f29aa[_0x5b9192(0x1dd)]){if(!isInteractive())return console[_0x5b9192(0x1c3)](a27_0x174ba5[_0x5b9192(0x1bd)](_0x5b9192(0x1de)),_0x5b9192(0x1ac)),console[_0x5b9192(0x1c3)](a27_0x174ba5[_0x5b9192(0x1eb)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x45419f=await confirmKey(_0x5b9192(0x1d0)+(_0x3929f2['length']+_0x481b3f['length'])+_0x5b9192(0x1c1));if(!_0x45419f)return console['error'](a27_0x174ba5[_0x5b9192(0x1e6)](_0x5b9192(0x1d3)),'-\x20no\x20files\x20written'),0x1;}for(const _0x3d379d of _0x3f781b[_0x5b9192(0x1d5)]){if(_0x3d379d[_0x5b9192(0x1e9)]||_0x3d379d[_0x5b9192(0x1dc)]){const _0x1a9879=a27_0x2ab319[_0x5b9192(0x1d6)](_0x3d379d[_0x5b9192(0x1e5)]);!existsSync(_0x1a9879)&&mkdirSync(_0x1a9879,{'recursive':!![]}),writeFileSync(_0x3d379d['absolutePath'],_0x3d379d['content'],_0x5b9192(0x1b3));}}return console[_0x5b9192(0x1c3)](a27_0x174ba5[_0x5b9192(0x1cd)]('✔\x20Pulled\x20'+(_0x3929f2[_0x5b9192(0x1e7)]+_0x481b3f[_0x5b9192(0x1e7)])+_0x5b9192(0x1b1)+_0x3f781b[_0x5b9192(0x1b4)])),saveSessionContext({'engage_workspace':_0x3f781b[_0x5b9192(0x1ea)]},_0x5f29aa['session']),console['error'](a27_0x174ba5['green'](_0x5b9192(0x1da)+a27_0x174ba5[_0x5b9192(0x1eb)](_0x5b9192(0x1bf))+_0x5b9192(0x1c0)+a27_0x174ba5[_0x5b9192(0x1af)](_0x3f781b[_0x5b9192(0x1ea)]))),0x0;}}async function resolveWorkspaceName(_0x1d8134,_0x715d7){const _0x3c6914=a27_0x307037;if(_0x1d8134)return _0x1d8134;if(_0x715d7['workspace'])return _0x715d7[_0x3c6914(0x1d4)];const _0x46da9e=tryFindTdxConfig(process['cwd']());if(_0x46da9e?.[_0x3c6914(0x1be)]['engage_workspace'])return _0x46da9e[_0x3c6914(0x1be)]['engage_workspace'];const _0x4e8335=loadSessionContext(_0x715d7[_0x3c6914(0x1c9)]);if(_0x4e8335?.[_0x3c6914(0x1bf)])return _0x4e8335[_0x3c6914(0x1bf)];return undefined;}
1
+ const a27_0x10cead=a27_0x3038;(function(_0x58dbeb,_0x3b8ad2){const _0x2b75e6=a27_0x3038,_0x5d0c82=_0x58dbeb();while(!![]){try{const _0x7bf495=parseInt(_0x2b75e6(0x101))/0x1*(parseInt(_0x2b75e6(0xfb))/0x2)+parseInt(_0x2b75e6(0xff))/0x3*(-parseInt(_0x2b75e6(0x10d))/0x4)+parseInt(_0x2b75e6(0xf6))/0x5*(-parseInt(_0x2b75e6(0xfc))/0x6)+-parseInt(_0x2b75e6(0x115))/0x7*(parseInt(_0x2b75e6(0x129))/0x8)+-parseInt(_0x2b75e6(0x105))/0x9*(-parseInt(_0x2b75e6(0x10b))/0xa)+parseInt(_0x2b75e6(0xef))/0xb+parseInt(_0x2b75e6(0x10a))/0xc;if(_0x7bf495===_0x3b8ad2)break;else _0x5d0c82['push'](_0x5d0c82['shift']());}catch(_0x2a5e38){_0x5d0c82['push'](_0x5d0c82['shift']());}}}(a27_0x15c2,0x8d527));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext,loadSessionContext}from'../core/session.js';function a27_0x3038(_0x1b5976,_0x911431){_0x1b5976=_0x1b5976-0xef;const _0x15c22b=a27_0x15c2();let _0x3038d4=_0x15c22b[_0x1b5976];return _0x3038d4;}import{tryFindTdxConfig}from'../sdk/segment/tdx-config.js';import a27_0x25975c from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a27_0x108113 from'path';import{pullTemplates}from'../sdk/engage/template-pull.js';function a27_0x15c2(){const _0x4a17f6=['relativePath','✔\x20All\x20files\x20are\x20up\x20to\x20date','config','Write\x20','verbose','32pHODOc','\x20\x20Target:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20pull\x20--workspace\x20<name>','✔\x20Context\x20set:\x20','files','\x20templates','diff','No\x20templates\x20found\x20in\x20workspace\x20\x27','8009287RrhEtK','dim','error','workspace','\x0aError:','absolutePath','utf-8','187715FbpEch','Workspace\x20is\x20required.','\x0aPull\x20summary\x20for\x20workspace\x20\x27','targetDir','dryRun','2XTiwpU','114ntvmUg','\x20files?','engage','1980513owoJlr','name','100109vIhyKQ','templates','Pull\x20templates\x20to\x20YAML\x20files','✔\x20Pulled\x20','5931wiXFFg','yellow','isNew','\x0aUsage:\x20tdx\x20engage\x20template\x20pull\x20<workspace-name>','\x20changed\x20files','14892180pknfIJ','15020yGNDxf','\x27...','4kdTJtL','length','yes','content','cyan','execute','green','workspaceName','1936753jjexsZ','session','counts','\x0aChanges\x20to\x20\x27','Pulling\x20templates\x20from\x20\x27','setPhase','hasChanges','\x20unchanged\x20files','\x20files\x20to\x20','filter','description','engage_workspace','engage:template:pull','dirname','Aborted.'];a27_0x15c2=function(){return _0x4a17f6;};return a27_0x15c2();}export class EngageTemplatePullCommand extends BaseCommand{[a27_0x10cead(0x100)]=a27_0x10cead(0x121);[a27_0x10cead(0x11f)]=a27_0x10cead(0x103);async[a27_0x10cead(0x112)](_0x3be57f){const _0x4dab7f=a27_0x10cead,{options:_0x58a896,args:_0x4d5afa,tdx:_0x427d41}=_0x3be57f,_0x25235c=_0x58a896,_0x1723c0=await resolveWorkspaceName(_0x4d5afa[0x0],_0x25235c);if(!_0x1723c0)return console[_0x4dab7f(0xf1)](a27_0x25975c[_0x4dab7f(0x106)](_0x4dab7f(0xf7))),console[_0x4dab7f(0xf1)](_0x4dab7f(0x108)),console[_0x4dab7f(0xf1)](_0x4dab7f(0x12b)),console['error']('\x0aOr\x20set\x20workspace\x20context\x20with:\x20tdx\x20use\x20engage_workspace\x20<name>'),0x1;const _0x479091=await withProgressSpinner(_0x4dab7f(0x119)+_0x1723c0+_0x4dab7f(0x10c),_0x4c9fa3=>pullTemplates({'engage':_0x427d41[_0x4dab7f(0xfe)]},_0x1723c0,{'templateName':_0x25235c[_0x4dab7f(0x100)],'progress':{'update':_0x10a9fe=>{const _0x1f0569=_0x4dab7f;_0x4c9fa3[_0x1f0569(0x11a)](_0x10a9fe);}}}),{'verbose':_0x25235c[_0x4dab7f(0x128)]}),_0x313b31=_0x479091['data'];if(_0x313b31[_0x4dab7f(0x117)][_0x4dab7f(0x102)]===0x0)return console[_0x4dab7f(0xf1)](a27_0x25975c[_0x4dab7f(0x106)](_0x4dab7f(0x130)+_0x313b31[_0x4dab7f(0x114)]+'\x27')),0x0;const _0xff6e00=_0x313b31[_0x4dab7f(0x12d)][_0x4dab7f(0x11e)](_0x2922fc=>_0x2922fc[_0x4dab7f(0x107)]),_0x5571de=_0x313b31['files'][_0x4dab7f(0x11e)](_0x241286=>!_0x241286['isNew']&&_0x241286[_0x4dab7f(0x11b)]),_0x2d4ef7=_0x313b31[_0x4dab7f(0x12d)][_0x4dab7f(0x11e)](_0xa0eb80=>!_0xa0eb80['isNew']&&!_0xa0eb80[_0x4dab7f(0x11b)]);console[_0x4dab7f(0xf1)](_0x4dab7f(0xf8)+_0x313b31[_0x4dab7f(0x114)]+'\x27:'),console[_0x4dab7f(0xf1)]('\x20\x20'+a27_0x25975c[_0x4dab7f(0x111)](_0x313b31[_0x4dab7f(0x117)][_0x4dab7f(0x102)]+_0x4dab7f(0x12e))),console[_0x4dab7f(0xf1)]('\x20\x20'+a27_0x25975c['green']('+\x20'+_0xff6e00[_0x4dab7f(0x10e)]+'\x20new\x20files')),console[_0x4dab7f(0xf1)]('\x20\x20'+a27_0x25975c[_0x4dab7f(0x106)]('~\x20'+_0x5571de[_0x4dab7f(0x10e)]+_0x4dab7f(0x109))),console[_0x4dab7f(0xf1)]('\x20\x20'+a27_0x25975c['dim']('=\x20'+_0x2d4ef7['length']+_0x4dab7f(0x11c))),console[_0x4dab7f(0xf1)](_0x4dab7f(0x12a)+a27_0x25975c['cyan'](_0x313b31[_0x4dab7f(0xf9)])+'\x0a');if(_0x5571de['length']>0x0)for(const _0x18a3ea of _0x5571de){console[_0x4dab7f(0xf1)](_0x4dab7f(0x118)+_0x18a3ea[_0x4dab7f(0x124)]+'\x27:'),console[_0x4dab7f(0xf1)]('\u2500'['repeat'](0x3c)),console[_0x4dab7f(0xf1)](_0x18a3ea[_0x4dab7f(0x12f)]),console[_0x4dab7f(0xf1)]('\u2500'['repeat'](0x3c));}if(_0x25235c[_0x4dab7f(0xfa)])return console[_0x4dab7f(0xf1)](a27_0x25975c[_0x4dab7f(0x106)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0xff6e00[_0x4dab7f(0x10e)]===0x0&&_0x5571de[_0x4dab7f(0x10e)]===0x0)return console[_0x4dab7f(0xf1)](a27_0x25975c[_0x4dab7f(0x113)](_0x4dab7f(0x125))),saveSessionContext({'engage_workspace':_0x313b31[_0x4dab7f(0x114)]},_0x25235c[_0x4dab7f(0x116)]),0x0;if(!_0x25235c[_0x4dab7f(0x10f)]){if(!isInteractive())return console[_0x4dab7f(0xf1)](a27_0x25975c['red'](_0x4dab7f(0xf3)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x4dab7f(0xf1)](a27_0x25975c[_0x4dab7f(0xf0)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x4527b2=await confirmKey(_0x4dab7f(0x127)+(_0xff6e00[_0x4dab7f(0x10e)]+_0x5571de[_0x4dab7f(0x10e)])+_0x4dab7f(0xfd));if(!_0x4527b2)return console[_0x4dab7f(0xf1)](a27_0x25975c[_0x4dab7f(0x106)](_0x4dab7f(0x123)),'-\x20no\x20files\x20written'),0x1;}for(const _0x142ae6 of _0x313b31['files']){if(_0x142ae6[_0x4dab7f(0x107)]||_0x142ae6['hasChanges']){const _0x324111=a27_0x108113[_0x4dab7f(0x122)](_0x142ae6[_0x4dab7f(0xf4)]);!existsSync(_0x324111)&&mkdirSync(_0x324111,{'recursive':!![]}),writeFileSync(_0x142ae6[_0x4dab7f(0xf4)],_0x142ae6[_0x4dab7f(0x110)],_0x4dab7f(0xf5));}}return console['error'](a27_0x25975c[_0x4dab7f(0x113)](_0x4dab7f(0x104)+(_0xff6e00[_0x4dab7f(0x10e)]+_0x5571de['length'])+_0x4dab7f(0x11d)+_0x313b31[_0x4dab7f(0xf9)])),saveSessionContext({'engage_workspace':_0x313b31[_0x4dab7f(0x114)]},_0x25235c['session']),console[_0x4dab7f(0xf1)](a27_0x25975c['green'](_0x4dab7f(0x12c)+a27_0x25975c[_0x4dab7f(0xf0)](_0x4dab7f(0x120))+'\x20=\x20'+a27_0x25975c[_0x4dab7f(0x111)](_0x313b31['workspaceName']))),0x0;}}async function resolveWorkspaceName(_0x70df4b,_0x44f78a){const _0x4b3d07=a27_0x10cead;if(_0x70df4b)return _0x70df4b;if(_0x44f78a['workspace'])return _0x44f78a[_0x4b3d07(0xf2)];const _0x3e98da=tryFindTdxConfig(process['cwd']());if(_0x3e98da?.['config'][_0x4b3d07(0x120)])return _0x3e98da[_0x4b3d07(0x126)][_0x4b3d07(0x120)];const _0xdb4303=loadSessionContext(_0x44f78a[_0x4b3d07(0x116)]);if(_0xdb4303?.[_0x4b3d07(0x120)])return _0xdb4303['engage_workspace'];return undefined;}
@@ -1 +1 @@
1
- const a28_0x90673b=a28_0x93a2;(function(_0x143e14,_0x4c0e1b){const _0x3d5d5d=a28_0x93a2,_0x55984d=_0x143e14();while(!![]){try{const _0x51c529=-parseInt(_0x3d5d5d(0x10c))/0x1+parseInt(_0x3d5d5d(0x12b))/0x2*(-parseInt(_0x3d5d5d(0x12d))/0x3)+parseInt(_0x3d5d5d(0x107))/0x4+parseInt(_0x3d5d5d(0x112))/0x5*(parseInt(_0x3d5d5d(0x125))/0x6)+-parseInt(_0x3d5d5d(0x126))/0x7*(parseInt(_0x3d5d5d(0x11e))/0x8)+-parseInt(_0x3d5d5d(0xfa))/0x9+parseInt(_0x3d5d5d(0x135))/0xa*(parseInt(_0x3d5d5d(0x13d))/0xb);if(_0x51c529===_0x4c0e1b)break;else _0x55984d['push'](_0x55984d['shift']());}catch(_0x796351){_0x55984d['push'](_0x55984d['shift']());}}}(a28_0x2a54,0x41204));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a28_0x2a54(){const _0x368612=['Pushing\x20templates...','-\x20no\x20changes\x20applied','error','engage_workspace','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20applied','description','Push\x20YAML\x20files\x20to\x20Engage\x20API\x20as\x20templates','dim','423712GvQWOv','create','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','config','setPhase','224899DXdCTq','dirname','cyan','created','resolveWorkspaceId','message','5xBXQOn','\x20template\x20files','Resolving\x20references...','cwd','templateId','errors','Preparing\x20push\x20to\x20workspace\x20\x27','engage','✔\x20All\x20templates\x20are\x20up\x20to\x20date','relativePath','\x0aValidation\x20errors\x20in\x20','\x0aUsage:\x20tdx\x20engage\x20template\x20push\x20<file.yaml>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20single\x20file','104dQqsOH','valid','Push\x20','length','yellow','update','Found\x20','2591910CbAxjd','262465KZfWvm','red','\x0aError:','\x20new\x20templates:','results','2186sDvTdB','def','501dRHpuE','session','green','\x0aValidation\x20failed.\x20Fix\x20the\x20errors\x20above\x20before\x20pushing.','action','path','Aborted.','\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20(requires\x20tdx.json)','9402180fzNRpk','updated','No\x20template\x20YAML\x20files\x20found\x20in\x20','name','execute','workspace','\x20\x20\x20\x20','1\x20template\x20file:\x20','11DmMawa','✔\x20Created\x20','dryRun','data','\x20templates?','\x20errors:','resolve','2848590volRwK','\x20templates','filter','warnings','verbose'];a28_0x2a54=function(){return _0x368612;};return a28_0x2a54();}function a28_0x93a2(_0x4f00fa,_0x2454e8){_0x4f00fa=_0x4f00fa-0xf8;const _0x2a548c=a28_0x2a54();let _0x93a218=_0x2a548c[_0x4f00fa];return _0x93a218;}import{saveSessionContext,loadSessionContext}from'../core/session.js';import{tryFindTdxConfig}from'../sdk/segment/tdx-config.js';import{isYamlFile}from'../sdk/segment/file-discovery.js';import a28_0x506025 from'chalk';import a28_0x556b7e from'path';import{discoverAndParseTemplateFiles,parseTemplateFile,preparePush,resolveAndBuildInputs,executePush}from'../sdk/engage/template-push.js';import{validateTemplateDef}from'../sdk/engage/template-validator.js';import{getTemplateUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';export class EngageTemplatePushCommand extends BaseCommand{[a28_0x90673b(0x138)]='engage:template:push';[a28_0x90673b(0x104)]=a28_0x90673b(0x105);async[a28_0x90673b(0x139)](_0x1a8bb2){const _0x51cc09=a28_0x90673b,{options:_0x32f0aa,args:_0x2acf4e,tdx:_0x451120}=_0x1a8bb2,_0x5347f6=_0x32f0aa,_0x22569a=_0x2acf4e[0x0],_0x10a99a=_0x22569a?a28_0x556b7e[_0x51cc09(0xf9)](_0x22569a):undefined,_0x3fea81=_0x10a99a?isYamlFile(_0x10a99a):![];let _0x154c36;if(_0x3fea81&&_0x10a99a)_0x154c36=a28_0x556b7e[_0x51cc09(0x10d)](_0x10a99a);else _0x10a99a?_0x154c36=_0x10a99a:_0x154c36=process[_0x51cc09(0x115)]();let _0x57edfb;const _0x4d6c45=tryFindTdxConfig(_0x154c36);_0x4d6c45?.['config'][_0x51cc09(0x102)]&&(_0x57edfb=_0x4d6c45[_0x51cc09(0x10a)][_0x51cc09(0x102)],!_0x3fea81&&(_0x154c36=_0x4d6c45['configDir']));_0x5347f6[_0x51cc09(0x13a)]&&(_0x57edfb=_0x5347f6[_0x51cc09(0x13a)]);if(!_0x57edfb){const _0x39a6cc=loadSessionContext(_0x5347f6[_0x51cc09(0x12e)]);_0x39a6cc?.[_0x51cc09(0x102)]&&(_0x57edfb=_0x39a6cc[_0x51cc09(0x102)]);}if(!_0x57edfb)return console[_0x51cc09(0x101)](a28_0x506025[_0x51cc09(0x122)]('Workspace\x20is\x20required.')),console[_0x51cc09(0x101)](_0x51cc09(0x11d)),console[_0x51cc09(0x101)](_0x51cc09(0x134)),console[_0x51cc09(0x101)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20push\x20--workspace\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20with\x20explicit\x20workspace'),console[_0x51cc09(0x101)]('\x0aOr\x20set\x20workspace\x20context\x20with:\x20tdx\x20use\x20engage_workspace\x20<name>'),0x1;let _0x3156f6;_0x3fea81&&_0x10a99a?_0x3156f6=[parseTemplateFile(_0x10a99a,a28_0x556b7e[_0x51cc09(0x10d)](_0x10a99a))]:_0x3156f6=discoverAndParseTemplateFiles(_0x154c36);if(_0x3156f6['length']===0x0)return console[_0x51cc09(0x101)](a28_0x506025[_0x51cc09(0x122)](_0x51cc09(0x137)+_0x154c36)),console[_0x51cc09(0x101)](a28_0x506025[_0x51cc09(0x106)]('Template\x20YAML\x20files\x20must\x20have\x20type:\x20template\x20in\x20their\x20definition.')),0x1;const _0x32c62d=_0x3156f6[_0x51cc09(0x121)]===0x1?_0x51cc09(0x13c)+_0x3156f6[0x0][_0x51cc09(0x12c)][_0x51cc09(0x138)]:_0x3156f6[_0x51cc09(0x121)]+_0x51cc09(0x113);console[_0x51cc09(0x101)](_0x51cc09(0x124)+a28_0x506025[_0x51cc09(0x10e)](_0x32c62d));let _0x8594c8=![];for(const _0x2cd0f2 of _0x3156f6){const _0x26bbc6=validateTemplateDef(_0x2cd0f2[_0x51cc09(0x12c)]);if(!_0x26bbc6[_0x51cc09(0x11f)]){_0x8594c8=!![],console[_0x51cc09(0x101)](a28_0x506025[_0x51cc09(0x127)](_0x51cc09(0x11c)+_0x2cd0f2[_0x51cc09(0x11b)]+':'));for(const _0xf76111 of _0x26bbc6[_0x51cc09(0x117)]){console[_0x51cc09(0x101)]('\x20\x20'+a28_0x506025[_0x51cc09(0x127)]('✗')+'\x20'+_0xf76111[_0x51cc09(0x132)]+':\x20'+_0xf76111[_0x51cc09(0x111)]);}}for(const _0x1b77b4 of _0x26bbc6[_0x51cc09(0xfd)]){console[_0x51cc09(0x101)]('\x20\x20'+a28_0x506025['yellow']('⚠')+'\x20'+_0x1b77b4[_0x51cc09(0x132)]+':\x20'+_0x1b77b4['message']);}}if(_0x8594c8)return console[_0x51cc09(0x101)](a28_0x506025[_0x51cc09(0x127)](_0x51cc09(0x130))),0x1;const _0x1ae163=await _0x451120['engage'][_0x51cc09(0x110)](_0x57edfb),_0x3a5baa=await withProgressSpinner(_0x51cc09(0x118)+_0x57edfb+'\x27...',_0x3e8c4b=>preparePush({'engage':_0x451120[_0x51cc09(0x119)]},_0x3156f6,_0x1ae163,{'progress':{'update':_0x4aef41=>_0x3e8c4b[_0x51cc09(0x10b)](_0x4aef41)}}),{'verbose':_0x5347f6[_0x51cc09(0xfe)]}),_0x4b7665=_0x3a5baa['data'];await withProgressSpinner(_0x51cc09(0x114),_0x44e913=>resolveAndBuildInputs({'engage':_0x451120['engage']},_0x4b7665,_0x1ae163,{'progress':{'update':_0x1045fe=>_0x44e913[_0x51cc09(0x10b)](_0x1045fe)}}),{'verbose':_0x5347f6['verbose']});const _0x3c54fa=_0x4b7665[_0x51cc09(0xfc)](_0x2e0b16=>_0x2e0b16[_0x51cc09(0x131)]===_0x51cc09(0x108)),_0x1f76d4=_0x4b7665['filter'](_0x403684=>_0x403684[_0x51cc09(0x131)]===_0x51cc09(0x123));console[_0x51cc09(0x101)]('\x0aPush\x20summary\x20for\x20workspace\x20\x27'+_0x57edfb+'\x27:');if(_0x3c54fa['length']>0x0){console[_0x51cc09(0x101)]('\x20\x20'+a28_0x506025[_0x51cc09(0x12f)]('+\x20'+_0x3c54fa[_0x51cc09(0x121)]+_0x51cc09(0x129)));for(const _0x151b89 of _0x3c54fa){console[_0x51cc09(0x101)](_0x51cc09(0x13b)+a28_0x506025['green']('+')+'\x20'+_0x151b89[_0x51cc09(0x12c)]['name']);}}if(_0x1f76d4['length']>0x0){console[_0x51cc09(0x101)]('\x20\x20'+a28_0x506025[_0x51cc09(0x122)]('~\x20'+_0x1f76d4[_0x51cc09(0x121)]+'\x20templates\x20to\x20update:'));for(const _0xba3564 of _0x1f76d4){console[_0x51cc09(0x101)](_0x51cc09(0x13b)+a28_0x506025['yellow']('~')+'\x20'+_0xba3564['def'][_0x51cc09(0x138)]);}}if(_0x3c54fa[_0x51cc09(0x121)]===0x0&&_0x1f76d4[_0x51cc09(0x121)]===0x0)return console[_0x51cc09(0x101)](a28_0x506025[_0x51cc09(0x12f)](_0x51cc09(0x11a))),0x0;if(_0x5347f6[_0x51cc09(0x13f)])return console[_0x51cc09(0x101)](a28_0x506025[_0x51cc09(0x122)](_0x51cc09(0x103))),0x0;if(!_0x5347f6['yes']){if(!isInteractive())return console['error'](a28_0x506025[_0x51cc09(0x127)](_0x51cc09(0x128)),_0x51cc09(0x109)),console[_0x51cc09(0x101)](a28_0x506025[_0x51cc09(0x106)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x1619ae=await confirmKey(_0x51cc09(0x120)+(_0x3c54fa[_0x51cc09(0x121)]+_0x1f76d4[_0x51cc09(0x121)])+_0x51cc09(0x141));if(!_0x1619ae)return console[_0x51cc09(0x101)](a28_0x506025['yellow'](_0x51cc09(0x133)),_0x51cc09(0x100)),0x1;}const _0x2b08f7=await withProgressSpinner(_0x51cc09(0xff),_0x540da7=>executePush({'engage':_0x451120[_0x51cc09(0x119)]},_0x4b7665,{'progress':{'update':_0x3808d2=>_0x540da7[_0x51cc09(0x10b)](_0x3808d2)}}),{'verbose':_0x5347f6[_0x51cc09(0xfe)]}),_0x22e441=_0x2b08f7[_0x51cc09(0x140)];for(const _0x5aba8f of _0x22e441[_0x51cc09(0x12a)]){if(_0x5aba8f[_0x51cc09(0x116)]&&(_0x5aba8f[_0x51cc09(0x131)]===_0x51cc09(0x10f)||_0x5aba8f['action']===_0x51cc09(0x136))){const _0xf4902b=getTemplateUrl(_0x5347f6['site'],_0x1ae163,_0x5aba8f[_0x51cc09(0x116)]),_0x32b732=_0x5aba8f['action']===_0x51cc09(0x10f)?'+':'~',_0x17cd5e=_0x5aba8f['action']===_0x51cc09(0x10f)?a28_0x506025[_0x51cc09(0x12f)](_0x32b732):a28_0x506025[_0x51cc09(0x122)](_0x32b732);console[_0x51cc09(0x101)]('\x20\x20'+_0x17cd5e+'\x20'+hyperlink(_0x5aba8f[_0x51cc09(0x138)],_0xf4902b)+'\x20'+a28_0x506025['dim'](_0xf4902b));}}_0x22e441['created']>0x0&&console[_0x51cc09(0x101)](a28_0x506025[_0x51cc09(0x12f)](_0x51cc09(0x13e)+_0x22e441[_0x51cc09(0x10f)]+_0x51cc09(0xfb)));_0x22e441[_0x51cc09(0x136)]>0x0&&console[_0x51cc09(0x101)](a28_0x506025[_0x51cc09(0x12f)]('✔\x20Updated\x20'+_0x22e441[_0x51cc09(0x136)]+_0x51cc09(0xfb)));if(_0x22e441[_0x51cc09(0x117)][_0x51cc09(0x121)]>0x0){console['error'](a28_0x506025[_0x51cc09(0x127)]('✘\x20'+_0x22e441['errors'][_0x51cc09(0x121)]+_0x51cc09(0xf8)));for(const _0x36d7d8 of _0x22e441[_0x51cc09(0x117)]){console[_0x51cc09(0x101)]('\x20\x20'+a28_0x506025['red'](_0x36d7d8[_0x51cc09(0x138)])+':\x20'+_0x36d7d8[_0x51cc09(0x101)]);}}return saveSessionContext({'engage_workspace':_0x57edfb},_0x5347f6['session']),_0x22e441[_0x51cc09(0x117)][_0x51cc09(0x121)]>0x0?0x1:0x0;}}
1
+ const a28_0x57f926=a28_0x2d46;(function(_0x3f874e,_0x5b741c){const _0x14b5d9=a28_0x2d46,_0x408cc2=_0x3f874e();while(!![]){try{const _0x3aeb9a=parseInt(_0x14b5d9(0x1a3))/0x1*(parseInt(_0x14b5d9(0x184))/0x2)+parseInt(_0x14b5d9(0x195))/0x3+-parseInt(_0x14b5d9(0x17e))/0x4*(parseInt(_0x14b5d9(0x18c))/0x5)+parseInt(_0x14b5d9(0x171))/0x6*(parseInt(_0x14b5d9(0x16a))/0x7)+-parseInt(_0x14b5d9(0x16d))/0x8*(parseInt(_0x14b5d9(0x1a1))/0x9)+parseInt(_0x14b5d9(0x17a))/0xa*(-parseInt(_0x14b5d9(0x167))/0xb)+-parseInt(_0x14b5d9(0x16f))/0xc;if(_0x3aeb9a===_0x5b741c)break;else _0x408cc2['push'](_0x408cc2['shift']());}catch(_0x3bc1c9){_0x408cc2['push'](_0x408cc2['shift']());}}}(a28_0x46e0,0xa7c31));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext,loadSessionContext}from'../core/session.js';import{tryFindTdxConfig}from'../sdk/segment/tdx-config.js';function a28_0x2d46(_0x21b4c8,_0x29ff2e){_0x21b4c8=_0x21b4c8-0x15f;const _0x46e036=a28_0x46e0();let _0x2d460b=_0x46e036[_0x21b4c8];return _0x2d460b;}function a28_0x46e0(){const _0x558621=['Found\x20','errors','def','Pushing\x20templates...','4IVQGmj','workspace','path','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20applied','resolveWorkspaceId','Push\x20','\x20\x20\x20\x20','yellow','120115AYKvFf','yes','created','\x27...','\x0aValidation\x20errors\x20in\x20','\x20templates?','configDir','\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20push\x20--workspace\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20with\x20explicit\x20workspace','action','1119222EehTxS','verbose','templateId','dim','\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20(requires\x20tdx.json)','resolve','engage_workspace','\x0aError:','cyan','create','message','data','54864YdrpmM','engage','583826thjRLA','relativePath','config','filter','\x0aUsage:\x20tdx\x20engage\x20template\x20push\x20<file.yaml>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20single\x20file','Workspace\x20is\x20required.','length','\x0aPush\x20summary\x20for\x20workspace\x20\x27','description','red','Push\x20YAML\x20files\x20to\x20Engage\x20API\x20as\x20templates','error','green','cwd','165lceyJs','1\x20template\x20file:\x20','setPhase','210cgIwRA','session','name','960lKLscl','Resolving\x20references...','3584772tZmwMv','\x20templates','233262kOhPBA','results','✔\x20All\x20templates\x20are\x20up\x20to\x20date','dryRun','-\x20no\x20changes\x20applied','Preparing\x20push\x20to\x20workspace\x20\x27','No\x20template\x20YAML\x20files\x20found\x20in\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20new\x20templates:','195310fCNPHP','execute','dirname','\x0aOr\x20set\x20workspace\x20context\x20with:\x20tdx\x20use\x20engage_workspace\x20<name>','116jmplHi','\x0aValidation\x20failed.\x20Fix\x20the\x20errors\x20above\x20before\x20pushing.'];a28_0x46e0=function(){return _0x558621;};return a28_0x46e0();}import{isYamlFile}from'../sdk/segment/file-discovery.js';import a28_0x25467c from'chalk';import a28_0x3b6207 from'path';import{discoverAndParseTemplateFiles,parseTemplateFile,preparePush,resolveAndBuildInputs,executePush}from'../sdk/engage/template-push.js';import{validateTemplateDef}from'../sdk/engage/template-validator.js';import{getTemplateUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';export class EngageTemplatePushCommand extends BaseCommand{[a28_0x57f926(0x16c)]='engage:template:push';[a28_0x57f926(0x161)]=a28_0x57f926(0x163);async[a28_0x57f926(0x17b)](_0x152887){const _0x3e29c9=a28_0x57f926,{options:_0x2006a6,args:_0x1986d2,tdx:_0x43c4d6}=_0x152887,_0x48ef82=_0x2006a6,_0x1ee4fa=_0x1986d2[0x0],_0x271517=_0x1ee4fa?a28_0x3b6207[_0x3e29c9(0x19a)](_0x1ee4fa):undefined,_0x433d39=_0x271517?isYamlFile(_0x271517):![];let _0x38919e;if(_0x433d39&&_0x271517)_0x38919e=a28_0x3b6207[_0x3e29c9(0x17c)](_0x271517);else _0x271517?_0x38919e=_0x271517:_0x38919e=process[_0x3e29c9(0x166)]();let _0x3e4c5d;const _0x4d438e=tryFindTdxConfig(_0x38919e);_0x4d438e?.[_0x3e29c9(0x1a5)][_0x3e29c9(0x19b)]&&(_0x3e4c5d=_0x4d438e[_0x3e29c9(0x1a5)][_0x3e29c9(0x19b)],!_0x433d39&&(_0x38919e=_0x4d438e[_0x3e29c9(0x192)]));_0x48ef82[_0x3e29c9(0x185)]&&(_0x3e4c5d=_0x48ef82[_0x3e29c9(0x185)]);if(!_0x3e4c5d){const _0x26b79f=loadSessionContext(_0x48ef82[_0x3e29c9(0x16b)]);_0x26b79f?.[_0x3e29c9(0x19b)]&&(_0x3e4c5d=_0x26b79f[_0x3e29c9(0x19b)]);}if(!_0x3e4c5d)return console[_0x3e29c9(0x164)](a28_0x25467c[_0x3e29c9(0x18b)](_0x3e29c9(0x1a8))),console[_0x3e29c9(0x164)](_0x3e29c9(0x1a7)),console[_0x3e29c9(0x164)](_0x3e29c9(0x199)),console[_0x3e29c9(0x164)](_0x3e29c9(0x193)),console[_0x3e29c9(0x164)](_0x3e29c9(0x17d)),0x1;let _0xf9da1;_0x433d39&&_0x271517?_0xf9da1=[parseTemplateFile(_0x271517,a28_0x3b6207[_0x3e29c9(0x17c)](_0x271517))]:_0xf9da1=discoverAndParseTemplateFiles(_0x38919e);if(_0xf9da1[_0x3e29c9(0x15f)]===0x0)return console['error'](a28_0x25467c[_0x3e29c9(0x18b)](_0x3e29c9(0x177)+_0x38919e)),console['error'](a28_0x25467c['dim']('Template\x20YAML\x20files\x20must\x20have\x20type:\x20template\x20in\x20their\x20definition.')),0x1;const _0x2ab6b8=_0xf9da1[_0x3e29c9(0x15f)]===0x1?_0x3e29c9(0x168)+_0xf9da1[0x0][_0x3e29c9(0x182)][_0x3e29c9(0x16c)]:_0xf9da1[_0x3e29c9(0x15f)]+'\x20template\x20files';console['error'](_0x3e29c9(0x180)+a28_0x25467c[_0x3e29c9(0x19d)](_0x2ab6b8));let _0x4a053c=![];for(const _0x258aab of _0xf9da1){const _0x46743b=validateTemplateDef(_0x258aab[_0x3e29c9(0x182)]);if(!_0x46743b['valid']){_0x4a053c=!![],console['error'](a28_0x25467c[_0x3e29c9(0x162)](_0x3e29c9(0x190)+_0x258aab[_0x3e29c9(0x1a4)]+':'));for(const _0x307f92 of _0x46743b[_0x3e29c9(0x181)]){console[_0x3e29c9(0x164)]('\x20\x20'+a28_0x25467c[_0x3e29c9(0x162)]('✗')+'\x20'+_0x307f92[_0x3e29c9(0x186)]+':\x20'+_0x307f92[_0x3e29c9(0x19f)]);}}for(const _0x3c7a5e of _0x46743b['warnings']){console['error']('\x20\x20'+a28_0x25467c[_0x3e29c9(0x18b)]('⚠')+'\x20'+_0x3c7a5e[_0x3e29c9(0x186)]+':\x20'+_0x3c7a5e[_0x3e29c9(0x19f)]);}}if(_0x4a053c)return console[_0x3e29c9(0x164)](a28_0x25467c[_0x3e29c9(0x162)](_0x3e29c9(0x17f))),0x1;const _0x3fbead=await _0x43c4d6[_0x3e29c9(0x1a2)][_0x3e29c9(0x188)](_0x3e4c5d),_0x181f2f=await withProgressSpinner(_0x3e29c9(0x176)+_0x3e4c5d+_0x3e29c9(0x18f),_0x56405a=>preparePush({'engage':_0x43c4d6['engage']},_0xf9da1,_0x3fbead,{'progress':{'update':_0x2ed072=>_0x56405a['setPhase'](_0x2ed072)}}),{'verbose':_0x48ef82[_0x3e29c9(0x196)]}),_0xb95077=_0x181f2f[_0x3e29c9(0x1a0)];await withProgressSpinner(_0x3e29c9(0x16e),_0x5252af=>resolveAndBuildInputs({'engage':_0x43c4d6[_0x3e29c9(0x1a2)]},_0xb95077,_0x3fbead,{'progress':{'update':_0x4b592f=>_0x5252af[_0x3e29c9(0x169)](_0x4b592f)}}),{'verbose':_0x48ef82[_0x3e29c9(0x196)]});const _0x354062=_0xb95077[_0x3e29c9(0x1a6)](_0x1d3151=>_0x1d3151[_0x3e29c9(0x194)]===_0x3e29c9(0x19e)),_0x2e6364=_0xb95077[_0x3e29c9(0x1a6)](_0x43e0ca=>_0x43e0ca[_0x3e29c9(0x194)]==='update');console['error'](_0x3e29c9(0x160)+_0x3e4c5d+'\x27:');if(_0x354062[_0x3e29c9(0x15f)]>0x0){console[_0x3e29c9(0x164)]('\x20\x20'+a28_0x25467c[_0x3e29c9(0x165)]('+\x20'+_0x354062[_0x3e29c9(0x15f)]+_0x3e29c9(0x179)));for(const _0x49ed1a of _0x354062){console[_0x3e29c9(0x164)](_0x3e29c9(0x18a)+a28_0x25467c[_0x3e29c9(0x165)]('+')+'\x20'+_0x49ed1a['def']['name']);}}if(_0x2e6364['length']>0x0){console['error']('\x20\x20'+a28_0x25467c[_0x3e29c9(0x18b)]('~\x20'+_0x2e6364[_0x3e29c9(0x15f)]+'\x20templates\x20to\x20update:'));for(const _0x39a492 of _0x2e6364){console[_0x3e29c9(0x164)](_0x3e29c9(0x18a)+a28_0x25467c['yellow']('~')+'\x20'+_0x39a492['def'][_0x3e29c9(0x16c)]);}}if(_0x354062[_0x3e29c9(0x15f)]===0x0&&_0x2e6364[_0x3e29c9(0x15f)]===0x0)return console['error'](a28_0x25467c['green'](_0x3e29c9(0x173))),0x0;if(_0x48ef82[_0x3e29c9(0x174)])return console[_0x3e29c9(0x164)](a28_0x25467c['yellow'](_0x3e29c9(0x187))),0x0;if(!_0x48ef82[_0x3e29c9(0x18d)]){if(!isInteractive())return console[_0x3e29c9(0x164)](a28_0x25467c[_0x3e29c9(0x162)](_0x3e29c9(0x19c)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x3e29c9(0x164)](a28_0x25467c[_0x3e29c9(0x198)](_0x3e29c9(0x178))),0x1;const _0x1a92b3=await confirmKey(_0x3e29c9(0x189)+(_0x354062[_0x3e29c9(0x15f)]+_0x2e6364[_0x3e29c9(0x15f)])+_0x3e29c9(0x191));if(!_0x1a92b3)return console[_0x3e29c9(0x164)](a28_0x25467c[_0x3e29c9(0x18b)]('Aborted.'),_0x3e29c9(0x175)),0x1;}const _0x4e79b4=await withProgressSpinner(_0x3e29c9(0x183),_0x481df3=>executePush({'engage':_0x43c4d6[_0x3e29c9(0x1a2)]},_0xb95077,{'progress':{'update':_0x9881e7=>_0x481df3[_0x3e29c9(0x169)](_0x9881e7)}}),{'verbose':_0x48ef82[_0x3e29c9(0x196)]}),_0x42e0ab=_0x4e79b4[_0x3e29c9(0x1a0)];for(const _0x22b74d of _0x42e0ab[_0x3e29c9(0x172)]){if(_0x22b74d['templateId']&&(_0x22b74d[_0x3e29c9(0x194)]===_0x3e29c9(0x18e)||_0x22b74d[_0x3e29c9(0x194)]==='updated')){const _0x1b2e92=getTemplateUrl(_0x48ef82['site'],_0x3fbead,_0x22b74d[_0x3e29c9(0x197)]),_0x4beab5=_0x22b74d[_0x3e29c9(0x194)]===_0x3e29c9(0x18e)?'+':'~',_0x5b7e79=_0x22b74d[_0x3e29c9(0x194)]===_0x3e29c9(0x18e)?a28_0x25467c[_0x3e29c9(0x165)](_0x4beab5):a28_0x25467c['yellow'](_0x4beab5);console[_0x3e29c9(0x164)]('\x20\x20'+_0x5b7e79+'\x20'+hyperlink(_0x22b74d['name'],_0x1b2e92)+'\x20'+a28_0x25467c[_0x3e29c9(0x198)](_0x1b2e92));}}_0x42e0ab[_0x3e29c9(0x18e)]>0x0&&console['error'](a28_0x25467c[_0x3e29c9(0x165)]('✔\x20Created\x20'+_0x42e0ab[_0x3e29c9(0x18e)]+_0x3e29c9(0x170)));_0x42e0ab['updated']>0x0&&console['error'](a28_0x25467c[_0x3e29c9(0x165)]('✔\x20Updated\x20'+_0x42e0ab['updated']+_0x3e29c9(0x170)));if(_0x42e0ab[_0x3e29c9(0x181)][_0x3e29c9(0x15f)]>0x0){console[_0x3e29c9(0x164)](a28_0x25467c[_0x3e29c9(0x162)]('✘\x20'+_0x42e0ab['errors'][_0x3e29c9(0x15f)]+'\x20errors:'));for(const _0x344427 of _0x42e0ab[_0x3e29c9(0x181)]){console[_0x3e29c9(0x164)]('\x20\x20'+a28_0x25467c[_0x3e29c9(0x162)](_0x344427[_0x3e29c9(0x16c)])+':\x20'+_0x344427['error']);}}return saveSessionContext({'engage_workspace':_0x3e4c5d},_0x48ef82[_0x3e29c9(0x16b)]),_0x42e0ab['errors'][_0x3e29c9(0x15f)]>0x0?0x1:0x0;}}
@@ -1 +1 @@
1
- const a29_0x4a3d20=a29_0x2f9e;(function(_0x4bdd34,_0x1365e3){const _0x542837=a29_0x2f9e,_0x31eca5=_0x4bdd34();while(!![]){try{const _0x588a5e=-parseInt(_0x542837(0x20d))/0x1+parseInt(_0x542837(0x20a))/0x2*(parseInt(_0x542837(0x20f))/0x3)+-parseInt(_0x542837(0x209))/0x4*(parseInt(_0x542837(0x20e))/0x5)+parseInt(_0x542837(0x1e1))/0x6+-parseInt(_0x542837(0x203))/0x7+-parseInt(_0x542837(0x204))/0x8+parseInt(_0x542837(0x202))/0x9;if(_0x588a5e===_0x1365e3)break;else _0x31eca5['push'](_0x31eca5['shift']());}catch(_0x4a6a51){_0x31eca5['push'](_0x31eca5['shift']());}}}(a29_0xf0c5,0x6d05a));import{BaseCommand}from'./command.js';function a29_0x2f9e(_0x28dc74,_0x2885ca){_0x28dc74=_0x28dc74-0x1e1;const _0xf0c5fd=a29_0xf0c5();let _0x2f9e95=_0xf0c5fd[_0x28dc74];return _0x2f9e95;}import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';function a29_0xf0c5(){const _0x5149f7=['4966576TYhHRH','endsWith','warnings','yellow','\x20warning(s)','24Fwtnxj','3502AyFabX','reason','cwd','293776MGYnQE','714265gmQzXS','690MkZTfT','3167322vCtDNV','log','warningCount','skippedCount','resolve','validCount','verbose','name','Error:\x20Directory\x20not\x20found:\x20','\x20error(s)','Validate\x20template\x20YAML\x20files','green','\x20template(s)\x20valid','red','relativePath','template','dirname','errors','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20non-template\x20file(s)\x20skipped','\x20warning(s)\x20found','\x20valid','description','.yaml','dim','.yml','valid','error','length','\x20(skipped:\x20','No\x20template\x20YAML\x20files\x20found\x20in\x20','invalidCount','engage:template:validate','16884945rPiqwJ','4119164HrUVoF'];a29_0xf0c5=function(){return _0x5149f7;};return a29_0xf0c5();}import a29_0x276e0e from'chalk';import a29_0x8135e1 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{[a29_0x4a3d20(0x1e8)]=a29_0x4a3d20(0x201);[a29_0x4a3d20(0x1f7)]=a29_0x4a3d20(0x1eb);async['execute'](_0x1edc42){const _0x4d9723=a29_0x4a3d20,{options:_0x5b9439,args:_0x3fc18f}=_0x1edc42,_0x38e003=_0x5b9439,_0x53fccc=_0x3fc18f[0x0],_0x23d98e=_0x53fccc?a29_0x8135e1[_0x4d9723(0x1e5)](_0x53fccc):undefined,_0x4bfb78=_0x23d98e?isYamlFile(_0x23d98e):![];let _0x2b668a,_0x36e261;if(_0x4bfb78&&_0x23d98e)_0x2b668a=a29_0x8135e1[_0x4d9723(0x1f1)](_0x23d98e),_0x36e261=_0x23d98e;else _0x23d98e?_0x2b668a=_0x23d98e:_0x2b668a=process[_0x4d9723(0x20c)]();if(!_0x36e261&&!existsSync(_0x2b668a))return console[_0x4d9723(0x1fc)](a29_0x276e0e[_0x4d9723(0x1ee)](_0x4d9723(0x1e9)+_0x2b668a+'\x0a')),0x1;let _0x558b20;if(_0x36e261){if(!_0x36e261[_0x4d9723(0x205)](_0x4d9723(0x1fa))&&!_0x36e261['endsWith'](_0x4d9723(0x1f8)))return console[_0x4d9723(0x1fc)](a29_0x276e0e[_0x4d9723(0x1ee)](_0x4d9723(0x1f3)+_0x36e261+'\x0a')),0x1;_0x558b20=[_0x36e261];}else _0x558b20=findYamlFiles(_0x2b668a);if(_0x558b20[_0x4d9723(0x1fd)]===0x0)return console[_0x4d9723(0x1fc)](a29_0x276e0e[_0x4d9723(0x1ee)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x2b668a+'\x0a')),0x1;const _0x516012=validateYamlFiles(_0x558b20,_0x2b668a,{'filterType':_0x4d9723(0x1f0)}),_0x450f62=calculateSummary(_0x516012),_0x105a2c=_0x516012['filter'](isValidationResult);if(_0x105a2c[_0x4d9723(0x1fd)]===0x0)return console[_0x4d9723(0x1fc)](a29_0x276e0e[_0x4d9723(0x207)](_0x4d9723(0x1ff)+_0x2b668a+'\x0a')),_0x450f62[_0x4d9723(0x1e4)]>0x0&&console['error'](a29_0x276e0e[_0x4d9723(0x1f9)]('('+_0x450f62[_0x4d9723(0x1e4)]+'\x20non-template\x20file(s)\x20skipped)')),0x0;for(const _0x3f02d6 of _0x516012){if(!isValidationResult(_0x3f02d6)){_0x38e003[_0x4d9723(0x1e7)]&&console['log'](a29_0x276e0e[_0x4d9723(0x1f9)]('-\x20'+_0x3f02d6[_0x4d9723(0x1ef)]+_0x4d9723(0x1fe)+_0x3f02d6[_0x4d9723(0x20b)]+')'));continue;}const {relativePath:_0x5dd325,source:_0x591a00,result:_0x430f1a}=_0x3f02d6;if(_0x430f1a[_0x4d9723(0x1fb)]&&_0x430f1a[_0x4d9723(0x206)][_0x4d9723(0x1fd)]===0x0)_0x38e003[_0x4d9723(0x1e7)]&&console[_0x4d9723(0x1e2)](a29_0x276e0e[_0x4d9723(0x1ec)]('✔\x20'+_0x5dd325));else _0x430f1a['valid']?(console['log'](a29_0x276e0e[_0x4d9723(0x207)]('⚠\x20'+_0x5dd325+':\x20'+_0x430f1a['warnings']['length']+_0x4d9723(0x208))),console['log'](formatValidationResult(_0x430f1a,_0x591a00,_0x5dd325))):(console['log'](a29_0x276e0e[_0x4d9723(0x1ee)]('✖\x20'+_0x5dd325+':\x20'+_0x430f1a[_0x4d9723(0x1f2)]['length']+_0x4d9723(0x1ea))),console[_0x4d9723(0x1e2)](formatValidationResult(_0x430f1a,_0x591a00,_0x5dd325)));}return console['log'](''),_0x450f62['hasErrors']?(console[_0x4d9723(0x1e2)](a29_0x276e0e[_0x4d9723(0x1ee)]('Validation\x20failed:\x20'+_0x450f62[_0x4d9723(0x200)]+'\x20template(s)\x20with\x20errors,\x20'+_0x450f62[_0x4d9723(0x1e6)]+_0x4d9723(0x1f6))),_0x450f62[_0x4d9723(0x1e3)]>0x0&&console[_0x4d9723(0x1e2)](a29_0x276e0e[_0x4d9723(0x207)](_0x450f62['warningCount']+_0x4d9723(0x1f5))),_0x450f62[_0x4d9723(0x1e4)]>0x0&&console[_0x4d9723(0x1e2)](a29_0x276e0e[_0x4d9723(0x1f9)](_0x450f62[_0x4d9723(0x1e4)]+_0x4d9723(0x1f4))),0x1):(console[_0x4d9723(0x1e2)](a29_0x276e0e[_0x4d9723(0x1ec)]('✔\x20All\x20'+_0x450f62['validCount']+_0x4d9723(0x1ed))),_0x450f62['warningCount']>0x0&&console['log'](a29_0x276e0e[_0x4d9723(0x207)](_0x450f62[_0x4d9723(0x1e3)]+_0x4d9723(0x1f5))),_0x450f62[_0x4d9723(0x1e4)]>0x0&&console[_0x4d9723(0x1e2)](a29_0x276e0e[_0x4d9723(0x1f9)](_0x450f62[_0x4d9723(0x1e4)]+'\x20non-template\x20file(s)\x20skipped')),0x0);}}
1
+ function a29_0x2efe(_0x4ce803,_0x2d9c6b){_0x4ce803=_0x4ce803-0x7f;const _0x25ae66=a29_0x25ae();let _0x2efe26=_0x25ae66[_0x4ce803];return _0x2efe26;}const a29_0x4f6d1c=a29_0x2efe;(function(_0xc0776f,_0x312bf7){const _0xd20a2a=a29_0x2efe,_0x18f9f6=_0xc0776f();while(!![]){try{const _0x4d9de2=-parseInt(_0xd20a2a(0x9b))/0x1*(-parseInt(_0xd20a2a(0x85))/0x2)+parseInt(_0xd20a2a(0xa1))/0x3+parseInt(_0xd20a2a(0x97))/0x4+-parseInt(_0xd20a2a(0x89))/0x5*(parseInt(_0xd20a2a(0xa5))/0x6)+parseInt(_0xd20a2a(0x91))/0x7*(parseInt(_0xd20a2a(0x8f))/0x8)+-parseInt(_0xd20a2a(0x9a))/0x9+-parseInt(_0xd20a2a(0x7f))/0xa;if(_0x4d9de2===_0x312bf7)break;else _0x18f9f6['push'](_0x18f9f6['shift']());}catch(_0xf3dc4){_0x18f9f6['push'](_0x18f9f6['shift']());}}}(a29_0x25ae,0xace8d));import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';function a29_0x25ae(){const _0x553f1a=['95ccYRcT','\x20template(s)\x20valid','.yml','endsWith','description','✔\x20All\x20','1096dRiULh','dirname','32228TlUNRl','log','template','Validate\x20template\x20YAML\x20files','verbose','validCount','2695904FRoyqA','\x20template(s)\x20with\x20errors,\x20','engage:template:validate','4552929gyfMor','23RHLijr','dim','red','warningCount','yellow','error','1716591VdnQmP','\x20valid','.yaml','\x20(skipped:\x20','103782mwQnbB','\x20error(s)','valid','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20warning(s)','invalidCount','execute','Error:\x20Directory\x20not\x20found:\x20','filter','13938390rszttf','resolve','skippedCount','\x20non-template\x20file(s)\x20skipped','green','length','92146rbOkjX','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','reason','errors'];a29_0x25ae=function(){return _0x553f1a;};return a29_0x25ae();}import{existsSync}from'fs';import a29_0x4d9df6 from'chalk';import a29_0x4b1ad5 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{['name']=a29_0x4f6d1c(0x99);[a29_0x4f6d1c(0x8d)]=a29_0x4f6d1c(0x94);async[a29_0x4f6d1c(0xab)](_0x156862){const _0x71e01e=a29_0x4f6d1c,{options:_0x442a6c,args:_0x1f59ac}=_0x156862,_0x46f41b=_0x442a6c,_0x360a06=_0x1f59ac[0x0],_0x345815=_0x360a06?a29_0x4b1ad5[_0x71e01e(0x80)](_0x360a06):undefined,_0xfc5420=_0x345815?isYamlFile(_0x345815):![];let _0x15ebad,_0x5ac431;if(_0xfc5420&&_0x345815)_0x15ebad=a29_0x4b1ad5[_0x71e01e(0x90)](_0x345815),_0x5ac431=_0x345815;else _0x345815?_0x15ebad=_0x345815:_0x15ebad=process['cwd']();if(!_0x5ac431&&!existsSync(_0x15ebad))return console[_0x71e01e(0xa0)](a29_0x4d9df6[_0x71e01e(0x9d)](_0x71e01e(0xac)+_0x15ebad+'\x0a')),0x1;let _0x59e575;if(_0x5ac431){if(!_0x5ac431['endsWith'](_0x71e01e(0x8b))&&!_0x5ac431[_0x71e01e(0x8c)](_0x71e01e(0xa3)))return console[_0x71e01e(0xa0)](a29_0x4d9df6[_0x71e01e(0x9d)](_0x71e01e(0xa8)+_0x5ac431+'\x0a')),0x1;_0x59e575=[_0x5ac431];}else _0x59e575=findYamlFiles(_0x15ebad);if(_0x59e575[_0x71e01e(0x84)]===0x0)return console[_0x71e01e(0xa0)](a29_0x4d9df6[_0x71e01e(0x9d)](_0x71e01e(0x86)+_0x15ebad+'\x0a')),0x1;const _0x3f2b12=validateYamlFiles(_0x59e575,_0x15ebad,{'filterType':_0x71e01e(0x93)}),_0x5587fc=calculateSummary(_0x3f2b12),_0x3135eb=_0x3f2b12[_0x71e01e(0xad)](isValidationResult);if(_0x3135eb['length']===0x0)return console[_0x71e01e(0xa0)](a29_0x4d9df6['yellow']('No\x20template\x20YAML\x20files\x20found\x20in\x20'+_0x15ebad+'\x0a')),_0x5587fc['skippedCount']>0x0&&console[_0x71e01e(0xa0)](a29_0x4d9df6[_0x71e01e(0x9c)]('('+_0x5587fc[_0x71e01e(0x81)]+'\x20non-template\x20file(s)\x20skipped)')),0x0;for(const _0x395675 of _0x3f2b12){if(!isValidationResult(_0x395675)){_0x46f41b[_0x71e01e(0x95)]&&console[_0x71e01e(0x92)](a29_0x4d9df6[_0x71e01e(0x9c)]('-\x20'+_0x395675['relativePath']+_0x71e01e(0xa4)+_0x395675[_0x71e01e(0x87)]+')'));continue;}const {relativePath:_0x356751,source:_0xe8a9f7,result:_0xe76aa1}=_0x395675;if(_0xe76aa1[_0x71e01e(0xa7)]&&_0xe76aa1['warnings']['length']===0x0)_0x46f41b[_0x71e01e(0x95)]&&console[_0x71e01e(0x92)](a29_0x4d9df6['green']('✔\x20'+_0x356751));else _0xe76aa1['valid']?(console[_0x71e01e(0x92)](a29_0x4d9df6[_0x71e01e(0x9f)]('⚠\x20'+_0x356751+':\x20'+_0xe76aa1['warnings'][_0x71e01e(0x84)]+_0x71e01e(0xa9))),console[_0x71e01e(0x92)](formatValidationResult(_0xe76aa1,_0xe8a9f7,_0x356751))):(console[_0x71e01e(0x92)](a29_0x4d9df6['red']('✖\x20'+_0x356751+':\x20'+_0xe76aa1[_0x71e01e(0x88)][_0x71e01e(0x84)]+_0x71e01e(0xa6))),console[_0x71e01e(0x92)](formatValidationResult(_0xe76aa1,_0xe8a9f7,_0x356751)));}return console['log'](''),_0x5587fc['hasErrors']?(console[_0x71e01e(0x92)](a29_0x4d9df6[_0x71e01e(0x9d)]('Validation\x20failed:\x20'+_0x5587fc[_0x71e01e(0xaa)]+_0x71e01e(0x98)+_0x5587fc[_0x71e01e(0x96)]+_0x71e01e(0xa2))),_0x5587fc[_0x71e01e(0x9e)]>0x0&&console[_0x71e01e(0x92)](a29_0x4d9df6[_0x71e01e(0x9f)](_0x5587fc[_0x71e01e(0x9e)]+'\x20warning(s)\x20found')),_0x5587fc[_0x71e01e(0x81)]>0x0&&console[_0x71e01e(0x92)](a29_0x4d9df6[_0x71e01e(0x9c)](_0x5587fc[_0x71e01e(0x81)]+_0x71e01e(0x82))),0x1):(console[_0x71e01e(0x92)](a29_0x4d9df6[_0x71e01e(0x83)](_0x71e01e(0x8e)+_0x5587fc['validCount']+_0x71e01e(0x8a))),_0x5587fc['warningCount']>0x0&&console[_0x71e01e(0x92)](a29_0x4d9df6[_0x71e01e(0x9f)](_0x5587fc['warningCount']+'\x20warning(s)\x20found')),_0x5587fc[_0x71e01e(0x81)]>0x0&&console[_0x71e01e(0x92)](a29_0x4d9df6[_0x71e01e(0x9c)](_0x5587fc[_0x71e01e(0x81)]+_0x71e01e(0x82))),0x0);}}
@@ -1 +1 @@
1
- function a30_0x3880(){const _0x324c24=['Limit:\x20','Get\x20job\x20results','type','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','getTime','name','12QJmOPK','red','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','just\x20now','Query:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','push','jobs','1383376QnzQfb','user_name','presto','site','Listing\x20jobs...','args','green','execute','No\x20SQL\x20statements\x20found\x20in\x20file','908883jBNTnp','Getting\x20job\x20results...','length','verbose','✔\x20Job\x20submitted','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','round','Cancelled','jobType','INVALID_ARGUMENT','created_at','h\x20ago','end_at','log','✔\x20Retrieved\x20','8YolgIQ','substring','List\x20jobs','database','1011115VoiwWs','Kill\x20a\x20job','2589660SpIclF','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','577971xEMdWf','job:kill','Submit\x20a\x20job','Submitting\x20job...','success','data','join','63jYYOxw','trino','8526602ufSmPb','abs','map','validate','error','floor','d\x20ago','limit','Show\x20job\x20details','description','Status\x20filter:\x20','priority','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','result','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','job:result','\x20jobs','query','job_id','Database:\x20','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','Submitting\x20kill\x20request...','8629860xyZmtI','url','status','dim','mo\x20ago','job:show','show','start_at','✔\x20Found\x20','\x27\x20to\x20verify\x20the\x20job\x20status'];a30_0x3880=function(){return _0x324c24;};return a30_0x3880();}const a30_0x43efe0=a30_0x12d6;(function(_0x4242de,_0xe51d2d){const _0x5c93ee=a30_0x12d6,_0x5516da=_0x4242de();while(!![]){try{const _0x220e93=-parseInt(_0x5c93ee(0x148))/0x1+parseInt(_0x5c93ee(0x128))/0x2+-parseInt(_0x5c93ee(0x131))/0x3*(parseInt(_0x5c93ee(0x120))/0x4)+parseInt(_0x5c93ee(0x144))/0x5+-parseInt(_0x5c93ee(0x168))/0x6+-parseInt(_0x5c93ee(0x151))/0x7*(-parseInt(_0x5c93ee(0x140))/0x8)+-parseInt(_0x5c93ee(0x14f))/0x9*(-parseInt(_0x5c93ee(0x146))/0xa);if(_0x220e93===_0xe51d2d)break;else _0x5516da['push'](_0x5516da['shift']());}catch(_0x5b2f93){_0x5516da['push'](_0x5516da['shift']());}}}(a30_0x3880,0xf40ab));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';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';import{hyperlink}from'../sdk/util/formatters.js';import a30_0x3c461c from'chalk';function formatDuration(_0x2ec609){const _0x1c5e21=a30_0x12d6;if(_0x2ec609<0x3c)return _0x2ec609+'s';if(_0x2ec609<0xe10)return Math['floor'](_0x2ec609/0x3c)+'m\x20'+_0x2ec609%0x3c+'s';const _0x863deb=Math[_0x1c5e21(0x156)](_0x2ec609/0xe10),_0x45faad=Math['floor'](_0x2ec609%0xe10/0x3c);return _0x45faad>0x0?_0x863deb+'h\x20'+_0x45faad+'m':_0x863deb+'h';}function formatRelativeTime(_0x34c1b8){const _0x27c929=a30_0x12d6,_0x5333de=Date['now']()-_0x34c1b8['getTime'](),_0x2ad57d=Math['floor'](Math[_0x27c929(0x152)](_0x5333de)/0x3e8);if(_0x2ad57d<0x3c)return _0x27c929(0x123);const _0x2bcf14=Math[_0x27c929(0x156)](_0x2ad57d/0x3c);if(_0x2bcf14<0x3c)return _0x2bcf14+'m\x20ago';const _0x3e84bf=Math[_0x27c929(0x156)](_0x2bcf14/0x3c);if(_0x3e84bf<0x18)return _0x3e84bf+_0x27c929(0x13c);const _0x26238e=Math[_0x27c929(0x156)](_0x3e84bf/0x18);if(_0x26238e<0x1e)return _0x26238e+_0x27c929(0x157);return Math[_0x27c929(0x156)](_0x26238e/0x1e)+_0x27c929(0x16c);}export class JobListCommand extends BaseCommand{['name']=a30_0x43efe0(0x127);[a30_0x43efe0(0x15a)]=a30_0x43efe0(0x142);async[a30_0x43efe0(0x12f)](_0x51ca51){const _0x2a3d20=a30_0x43efe0,{options:_0x130bfd,tdx:_0x2ea1af}=_0x51ca51,_0x133643=resolveLimit(_0x130bfd[_0x2a3d20(0x158)],DEFAULT_DISPLAY_LIMIT),_0x379078=_0x130bfd[_0x2a3d20(0x16a)];_0x130bfd[_0x2a3d20(0x134)]&&(console['error'](_0x2a3d20(0x172)+_0x133643+_0x2a3d20(0x162)),_0x379078&&console[_0x2a3d20(0x155)](_0x2a3d20(0x15b)+_0x379078));const _0x4a6d3a=await withSpinner(_0x2a3d20(0x12c),()=>_0x2ea1af[_0x2a3d20(0x127)]['list']({'from':0x0,'to':_0x133643-0x1,'status':_0x379078}),{'verbose':_0x130bfd[_0x2a3d20(0x134)]}),_0x8ad345=_0x4a6d3a['data'];console[_0x2a3d20(0x155)](_0x2a3d20(0x170)+_0x8ad345[_0x2a3d20(0x133)]+'\x20job'+(_0x8ad345['length']!==0x1?'s':''));const _0x34022a=_0x130bfd[_0x2a3d20(0x12b)];if(isStructuredFormat(_0x130bfd)){const _0x2cc061=_0x8ad345[_0x2a3d20(0x153)](_0x343f5c=>{const _0x3cd083=_0x2a3d20;let _0x22bc62;if(_0x343f5c['start_at']&&_0x343f5c['end_at']){const _0x3c60d2=new Date(_0x343f5c[_0x3cd083(0x16f)])[_0x3cd083(0x176)](),_0x5a172f=new Date(_0x343f5c[_0x3cd083(0x13d)])[_0x3cd083(0x176)]();_0x22bc62=Math[_0x3cd083(0x137)]((_0x5a172f-_0x3c60d2)/0x3e8);}return{'job_id':_0x343f5c[_0x3cd083(0x164)],'type':_0x343f5c[_0x3cd083(0x174)]==='presto'?'trino':_0x343f5c['type'],'status':_0x343f5c['status'],'user_name':_0x343f5c[_0x3cd083(0x129)],'duration_sec':_0x22bc62,'created_at':_0x343f5c['created_at'],'started_at':_0x343f5c[_0x3cd083(0x16f)],'end_at':_0x343f5c[_0x3cd083(0x13d)]};});await handleSDKOutput(_0x2cc061,_0x130bfd);}else for(const _0x314202 of _0x8ad345){const _0x29a334=_0x314202[_0x2a3d20(0x16a)]===_0x2a3d20(0x14c)?a30_0x3c461c[_0x2a3d20(0x12e)]:_0x314202[_0x2a3d20(0x16a)]===_0x2a3d20(0x155)?a30_0x3c461c[_0x2a3d20(0x121)]:a30_0x3c461c[_0x2a3d20(0x16b)],_0x37b125=_0x29a334(_0x314202['status']),_0x30ec90=getJobUrl(_0x34022a,_0x314202[_0x2a3d20(0x164)]),_0x2d736d=hyperlink(_0x314202[_0x2a3d20(0x164)],_0x30ec90),_0x3db7bc=a30_0x3c461c[_0x2a3d20(0x16b)](_0x314202[_0x2a3d20(0x174)]===_0x2a3d20(0x12a)?_0x2a3d20(0x150):_0x314202[_0x2a3d20(0x174)]),_0x1ca96d=[];if(_0x314202[_0x2a3d20(0x16f)]&&_0x314202['end_at']){const _0x1d1905=Math['round']((new Date(_0x314202[_0x2a3d20(0x13d)])['getTime']()-new Date(_0x314202[_0x2a3d20(0x16f)])[_0x2a3d20(0x176)]())/0x3e8);_0x1ca96d[_0x2a3d20(0x126)](formatDuration(_0x1d1905));}if(_0x314202['end_at'])_0x1ca96d[_0x2a3d20(0x126)](formatRelativeTime(new Date(_0x314202['end_at'])));else _0x314202[_0x2a3d20(0x16f)]&&_0x1ca96d[_0x2a3d20(0x126)](formatRelativeTime(new Date(_0x314202['start_at'])));const _0x5d213f=_0x1ca96d[_0x2a3d20(0x133)]>0x0?a30_0x3c461c[_0x2a3d20(0x16b)]('\x20'+_0x1ca96d[_0x2a3d20(0x14e)](',\x20')):'';console[_0x2a3d20(0x13e)]('⚡\x20'+_0x2d736d+'\x20'+_0x3db7bc+'\x20'+_0x37b125+_0x5d213f);}return 0x0;}}export class JobShowCommand extends BaseCommand{[a30_0x43efe0(0x177)]=a30_0x43efe0(0x16d);[a30_0x43efe0(0x15a)]=a30_0x43efe0(0x159);['validate'](_0x51d821){const _0x3191cb=a30_0x43efe0,_0xbb6393=_0x51d821[_0x3191cb(0x12d)][0x0];if(!_0xbb6393)return _0x3191cb(0x136);return undefined;}async[a30_0x43efe0(0x12f)](_0x51d423){const _0x43bdaa=a30_0x43efe0,{options:_0x5e8433,args:_0x5f53e1,tdx:_0x354cbf}=_0x51d423,_0x47a61c=_0x5f53e1[0x0],_0x102e9c=await withSpinner('Getting\x20job\x20details...',()=>_0x354cbf['jobs'][_0x43bdaa(0x16e)](_0x47a61c),{'verbose':_0x5e8433[_0x43bdaa(0x134)]}),_0xb4421c=_0x102e9c[_0x43bdaa(0x14d)];let _0x4c058b;if(_0xb4421c['start_at']&&_0xb4421c[_0x43bdaa(0x13d)]){const _0x59a832=new Date(_0xb4421c[_0x43bdaa(0x16f)])[_0x43bdaa(0x176)](),_0x5180d6=new Date(_0xb4421c['end_at'])[_0x43bdaa(0x176)]();_0x4c058b=Math['round']((_0x5180d6-_0x59a832)/0x3e8);}const _0x153803={'job_id':_0xb4421c[_0x43bdaa(0x164)],'type':_0xb4421c[_0x43bdaa(0x174)],'status':_0xb4421c[_0x43bdaa(0x16a)],..._0xb4421c[_0x43bdaa(0x129)]&&{'user_name':_0xb4421c[_0x43bdaa(0x129)]},..._0x4c058b!==undefined&&{'duration_sec':_0x4c058b},..._0xb4421c[_0x43bdaa(0x13b)]&&{'created_at':_0xb4421c[_0x43bdaa(0x13b)]},..._0xb4421c[_0x43bdaa(0x16f)]&&{'started_at':_0xb4421c[_0x43bdaa(0x16f)]},..._0xb4421c[_0x43bdaa(0x13d)]&&{'end_at':_0xb4421c[_0x43bdaa(0x13d)]},..._0xb4421c[_0x43bdaa(0x143)]&&{'database':_0xb4421c[_0x43bdaa(0x143)]},..._0xb4421c['priority']!==undefined&&{'priority':_0xb4421c[_0x43bdaa(0x15c)]},..._0xb4421c[_0x43bdaa(0x169)]&&{'url':_0xb4421c[_0x43bdaa(0x169)]},..._0xb4421c[_0x43bdaa(0x163)]&&{'query':_0xb4421c['query']},..._0xb4421c['debug']&&{'debug':_0xb4421c['debug']}};return await handleSingleObjectOutput(_0x153803,_0x5e8433),0x0;}}export class JobKillCommand extends BaseCommand{[a30_0x43efe0(0x177)]=a30_0x43efe0(0x149);[a30_0x43efe0(0x15a)]=a30_0x43efe0(0x145);[a30_0x43efe0(0x154)](_0x1da0df){const _0x4ef9f5=a30_0x43efe0,_0x3857ce=_0x1da0df[_0x4ef9f5(0x12d)][0x0];if(!_0x3857ce)return _0x4ef9f5(0x166);return undefined;}async['execute'](_0x5d6214){const _0x3ad164=a30_0x43efe0,{options:_0x332e26,args:_0x326689,tdx:_0x39c1a2}=_0x5d6214,_0x111302=_0x326689[0x0];if(!_0x332e26['yes']){const _0x4c55ee=await confirm(_0x3ad164(0x125)+_0x111302+'?');if(!_0x4c55ee)return console[_0x3ad164(0x155)](_0x3ad164(0x138)),0x0;}return await withSpinner(_0x3ad164(0x167),()=>_0x39c1a2['jobs']['kill'](_0x111302),{'verbose':_0x332e26[_0x3ad164(0x134)]}),console[_0x3ad164(0x155)](_0x3ad164(0x147)+_0x111302),console['error'](_0x3ad164(0x175)+_0x111302+_0x3ad164(0x171)),0x0;}}function a30_0x12d6(_0x407597,_0x3c39dc){_0x407597=_0x407597-0x120;const _0x38809b=a30_0x3880();let _0x12d61a=_0x38809b[_0x407597];return _0x12d61a;}export class JobSubmitCommand extends BaseCommand{[a30_0x43efe0(0x177)]='job:submit';['description']=a30_0x43efe0(0x14a);async[a30_0x43efe0(0x12f)](_0xa37ef3){const _0x4a92ff=a30_0x43efe0,{options:_0x420a17,args:_0x31ebb4,tdx:_0x5b6978}=_0xa37ef3,_0x57c240=_0x420a17[_0x4a92ff(0x139)]||_0x4a92ff(0x150),_0x42bbac=_0x420a17['file'],_0x33cf55=_0x420a17[_0x4a92ff(0x143)]||'information_schema',_0xe91940=_0x420a17[_0x4a92ff(0x15f)];if(_0x57c240!==_0x4a92ff(0x150)&&_0x57c240!=='hive')throw new SDKError(ErrorCode[_0x4a92ff(0x13a)],_0x4a92ff(0x160));let _0x3ad798;if(_0x42bbac){if(_0x31ebb4[0x0])throw new SDKError(ErrorCode[_0x4a92ff(0x13a)],_0x4a92ff(0x15d));const _0x194cf3=readSqlStatementsFromFile(_0x42bbac);if(_0x194cf3[_0x4a92ff(0x133)]===0x0)throw new SDKError(ErrorCode[_0x4a92ff(0x13a)],_0x4a92ff(0x130));if(_0x194cf3[_0x4a92ff(0x133)]>0x1)throw new SDKError(ErrorCode[_0x4a92ff(0x13a)],_0x4a92ff(0x15e));_0x3ad798=_0x194cf3[0x0];}else{if(!_0x31ebb4[0x0])throw new SDKError(ErrorCode[_0x4a92ff(0x13a)],_0x4a92ff(0x122));_0x3ad798=_0x31ebb4[0x0];}_0x420a17['verbose']&&(console[_0x4a92ff(0x155)]('Job\x20type:\x20'+_0x57c240),console['error'](_0x4a92ff(0x165)+_0x33cf55),console[_0x4a92ff(0x155)](_0x4a92ff(0x124)+_0x3ad798[_0x4a92ff(0x141)](0x0,0x64)+(_0x3ad798['length']>0x64?'...':'')));const _0xa0caeb=await withSpinner(_0x4a92ff(0x14b),()=>_0x5b6978['jobs']['submit'](_0x33cf55,_0x3ad798,_0x57c240,_0xe91940),{'verbose':_0x420a17[_0x4a92ff(0x134)]}),_0x54c087=_0xa0caeb[_0x4a92ff(0x14d)];return console[_0x4a92ff(0x155)](_0x4a92ff(0x135)),console['error']('\x20\x20Job\x20ID:\x20'+_0x54c087[_0x4a92ff(0x164)]),await handleSDKOutput([_0x54c087],_0x420a17),0x0;}}export class JobResultCommand extends BaseCommand{[a30_0x43efe0(0x177)]=a30_0x43efe0(0x161);[a30_0x43efe0(0x15a)]=a30_0x43efe0(0x173);[a30_0x43efe0(0x154)](_0x37d011){const _0x2bb083=a30_0x43efe0,_0x3e66cc=_0x37d011[_0x2bb083(0x12d)][0x0];if(!_0x3e66cc)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>';return undefined;}async[a30_0x43efe0(0x12f)](_0x52b3fe){const _0x788900=a30_0x43efe0,{options:_0x7547bc,args:_0x1262db,tdx:_0x25a211}=_0x52b3fe,_0x247e69=_0x1262db[0x0],_0x4a408d=await withSpinner(_0x788900(0x132),()=>_0x25a211[_0x788900(0x127)]['result'](_0x247e69),{'verbose':_0x7547bc[_0x788900(0x134)]}),_0x597bcb=_0x4a408d['data'];return console[_0x788900(0x155)](_0x788900(0x13f)+_0x597bcb[_0x788900(0x133)]+'\x20row'+(_0x597bcb['length']!==0x1?'s':'')),await handleSDKOutput(_0x597bcb,_0x7547bc),0x0;}}
1
+ const a30_0x82e7d7=a30_0x1802;(function(_0x474bab,_0x17d78a){const _0x1200b5=a30_0x1802,_0x221769=_0x474bab();while(!![]){try{const _0x69d757=-parseInt(_0x1200b5(0xda))/0x1+parseInt(_0x1200b5(0xfc))/0x2+parseInt(_0x1200b5(0xf2))/0x3+parseInt(_0x1200b5(0x10f))/0x4*(parseInt(_0x1200b5(0xed))/0x5)+-parseInt(_0x1200b5(0xea))/0x6+parseInt(_0x1200b5(0x107))/0x7*(-parseInt(_0x1200b5(0x115))/0x8)+parseInt(_0x1200b5(0xcb))/0x9*(parseInt(_0x1200b5(0xd3))/0xa);if(_0x69d757===_0x17d78a)break;else _0x221769['push'](_0x221769['shift']());}catch(_0xa3ab8f){_0x221769['push'](_0x221769['shift']());}}}(a30_0x454f,0x9706c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';function a30_0x1802(_0x4b665e,_0xbea13c){_0x4b665e=_0x4b665e-0xc0;const _0x454fe8=a30_0x454f();let _0x18027f=_0x454fe8[_0x4b665e];return _0x18027f;}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 a30_0x51a2d1 from'chalk';function formatDuration(_0x54f2a7){const _0x3325a7=a30_0x1802;if(_0x54f2a7<0x3c)return _0x54f2a7+'s';if(_0x54f2a7<0xe10)return Math[_0x3325a7(0xe2)](_0x54f2a7/0x3c)+'m\x20'+_0x54f2a7%0x3c+'s';const _0x8349dd=Math['floor'](_0x54f2a7/0xe10),_0x27feb3=Math['floor'](_0x54f2a7%0xe10/0x3c);return _0x27feb3>0x0?_0x8349dd+'h\x20'+_0x27feb3+'m':_0x8349dd+'h';}function formatRelativeTime(_0x45a1ad){const _0x242951=a30_0x1802,_0x38b059=Date['now']()-_0x45a1ad[_0x242951(0x110)](),_0x418142=Math['floor'](Math['abs'](_0x38b059)/0x3e8);if(_0x418142<0x3c)return _0x242951(0xe0);const _0xc0b9dc=Math[_0x242951(0xe2)](_0x418142/0x3c);if(_0xc0b9dc<0x3c)return _0xc0b9dc+'m\x20ago';const _0x563e8e=Math[_0x242951(0xe2)](_0xc0b9dc/0x3c);if(_0x563e8e<0x18)return _0x563e8e+_0x242951(0xc6);const _0x56f1f1=Math['floor'](_0x563e8e/0x18);if(_0x56f1f1<0x1e)return _0x56f1f1+_0x242951(0x117);return Math[_0x242951(0xe2)](_0x56f1f1/0x1e)+_0x242951(0xca);}export class JobListCommand extends BaseCommand{[a30_0x82e7d7(0xc9)]=a30_0x82e7d7(0xd7);['description']=a30_0x82e7d7(0xdb);async['execute'](_0x362ba2){const _0x2951f0=a30_0x82e7d7,{options:_0x3059f8,tdx:_0xef8a4a}=_0x362ba2,_0x13a16a=resolveLimit(_0x3059f8[_0x2951f0(0xd6)],DEFAULT_DISPLAY_LIMIT),_0x446b80=_0x3059f8[_0x2951f0(0xec)];_0x3059f8['verbose']&&(console[_0x2951f0(0xe1)](_0x2951f0(0xe9)+_0x13a16a+_0x2951f0(0xee)),_0x446b80&&console[_0x2951f0(0xe1)](_0x2951f0(0xf3)+_0x446b80));const _0x479ed4=await withSpinner(_0x2951f0(0x108),()=>_0xef8a4a[_0x2951f0(0xd7)][_0x2951f0(0xe6)]({'from':0x0,'to':_0x13a16a-0x1,'status':_0x446b80}),{'verbose':_0x3059f8['verbose']}),_0x50500e=_0x479ed4['data'];console[_0x2951f0(0xe1)](_0x2951f0(0xc4)+_0x50500e[_0x2951f0(0xe4)]+_0x2951f0(0xcc)+(_0x50500e['length']!==0x1?'s':''));const _0x4dfc05=_0x3059f8['site'];if(isStructuredFormat(_0x3059f8)){const _0x57428b=_0x50500e[_0x2951f0(0x10b)](_0x407384=>{const _0x347c2f=_0x2951f0;let _0x2653f4;if(_0x407384[_0x347c2f(0x116)]&&_0x407384[_0x347c2f(0x118)]){const _0xf898ec=new Date(_0x407384['start_at'])[_0x347c2f(0x110)](),_0xc02d4=new Date(_0x407384[_0x347c2f(0x118)])[_0x347c2f(0x110)]();_0x2653f4=Math[_0x347c2f(0xc0)]((_0xc02d4-_0xf898ec)/0x3e8);}return{'job_id':_0x407384[_0x347c2f(0x10e)],'type':_0x407384[_0x347c2f(0xd8)]===_0x347c2f(0x10a)?_0x347c2f(0x104):_0x407384[_0x347c2f(0xd8)],'status':_0x407384['status'],'user_name':_0x407384[_0x347c2f(0xf5)],'duration_sec':_0x2653f4,'created_at':_0x407384[_0x347c2f(0xd4)],'started_at':_0x407384[_0x347c2f(0x116)],'end_at':_0x407384[_0x347c2f(0x118)]};});await handleSDKOutput(_0x57428b,_0x3059f8);}else for(const _0x301290 of _0x50500e){const _0x5e242f=_0x301290[_0x2951f0(0xec)]===_0x2951f0(0xe7)?a30_0x51a2d1[_0x2951f0(0x112)]:_0x301290[_0x2951f0(0xec)]==='error'?a30_0x51a2d1[_0x2951f0(0xe8)]:a30_0x51a2d1['dim'],_0x1136d5=_0x5e242f(_0x301290[_0x2951f0(0xec)]),_0x878455=getJobUrl(_0x4dfc05,_0x301290['job_id']),_0x277978=hyperlink(_0x301290[_0x2951f0(0x10e)],_0x878455),_0x45b443=a30_0x51a2d1['dim'](_0x301290['type']===_0x2951f0(0x10a)?_0x2951f0(0x104):_0x301290['type']),_0x5d00f0=[];if(_0x301290[_0x2951f0(0x116)]&&_0x301290['end_at']){const _0xff219a=Math[_0x2951f0(0xc0)]((new Date(_0x301290[_0x2951f0(0x118)])[_0x2951f0(0x110)]()-new Date(_0x301290['start_at'])[_0x2951f0(0x110)]())/0x3e8);_0x5d00f0[_0x2951f0(0x111)](formatDuration(_0xff219a));}if(_0x301290['end_at'])_0x5d00f0[_0x2951f0(0x111)](formatRelativeTime(new Date(_0x301290[_0x2951f0(0x118)])));else _0x301290[_0x2951f0(0x116)]&&_0x5d00f0['push'](formatRelativeTime(new Date(_0x301290[_0x2951f0(0x116)])));const _0x34c53c=_0x5d00f0[_0x2951f0(0xe4)]>0x0?a30_0x51a2d1[_0x2951f0(0xf8)]('\x20'+_0x5d00f0['join'](',\x20')):'';console[_0x2951f0(0x10c)]('⚡\x20'+_0x277978+'\x20'+_0x45b443+'\x20'+_0x1136d5+_0x34c53c);}return 0x0;}}export class JobShowCommand extends BaseCommand{[a30_0x82e7d7(0xc9)]=a30_0x82e7d7(0x106);[a30_0x82e7d7(0x109)]=a30_0x82e7d7(0x113);[a30_0x82e7d7(0xc2)](_0x307854){const _0x4d4c47=a30_0x82e7d7,_0x5cdb69=_0x307854[_0x4d4c47(0x105)][0x0];if(!_0x5cdb69)return _0x4d4c47(0xc5);return undefined;}async[a30_0x82e7d7(0xef)](_0x403d11){const _0x48fd65=a30_0x82e7d7,{options:_0x4d0eb6,args:_0x59f8c1,tdx:_0x10eb64}=_0x403d11,_0x39bed5=_0x59f8c1[0x0],_0x373660=await withSpinner(_0x48fd65(0xff),()=>_0x10eb64[_0x48fd65(0xd7)][_0x48fd65(0xc8)](_0x39bed5),{'verbose':_0x4d0eb6[_0x48fd65(0xcf)]}),_0x435ab2=_0x373660['data'];let _0x3fb58a;if(_0x435ab2[_0x48fd65(0x116)]&&_0x435ab2['end_at']){const _0x2c2a29=new Date(_0x435ab2[_0x48fd65(0x116)])[_0x48fd65(0x110)](),_0x4a1b77=new Date(_0x435ab2[_0x48fd65(0x118)])[_0x48fd65(0x110)]();_0x3fb58a=Math[_0x48fd65(0xc0)]((_0x4a1b77-_0x2c2a29)/0x3e8);}const _0x5b39a8={'job_id':_0x435ab2[_0x48fd65(0x10e)],'type':_0x435ab2['type'],'status':_0x435ab2[_0x48fd65(0xec)],..._0x435ab2[_0x48fd65(0xf5)]&&{'user_name':_0x435ab2[_0x48fd65(0xf5)]},..._0x3fb58a!==undefined&&{'duration_sec':_0x3fb58a},..._0x435ab2['created_at']&&{'created_at':_0x435ab2[_0x48fd65(0xd4)]},..._0x435ab2[_0x48fd65(0x116)]&&{'started_at':_0x435ab2[_0x48fd65(0x116)]},..._0x435ab2[_0x48fd65(0x118)]&&{'end_at':_0x435ab2['end_at']},..._0x435ab2[_0x48fd65(0x100)]&&{'database':_0x435ab2[_0x48fd65(0x100)]},..._0x435ab2['priority']!==undefined&&{'priority':_0x435ab2['priority']},..._0x435ab2[_0x48fd65(0xf4)]&&{'url':_0x435ab2[_0x48fd65(0xf4)]},..._0x435ab2[_0x48fd65(0xe5)]&&{'query':_0x435ab2[_0x48fd65(0xe5)]},..._0x435ab2['debug']&&{'debug':_0x435ab2['debug']}};return await handleSingleObjectOutput(_0x5b39a8,_0x4d0eb6),0x0;}}export class JobKillCommand extends BaseCommand{[a30_0x82e7d7(0xc9)]='job:kill';[a30_0x82e7d7(0x109)]=a30_0x82e7d7(0xf1);[a30_0x82e7d7(0xc2)](_0x24008a){const _0xf2fc32=a30_0x82e7d7,_0x1caf80=_0x24008a[_0xf2fc32(0x105)][0x0];if(!_0x1caf80)return _0xf2fc32(0xeb);return undefined;}async[a30_0x82e7d7(0xef)](_0x2442b6){const _0x58d67c=a30_0x82e7d7,{options:_0x59e52b,args:_0x3314fe,tdx:_0x5256a6}=_0x2442b6,_0x2da7ec=_0x3314fe[0x0];if(!_0x59e52b[_0x58d67c(0xd5)]){const _0x21fbd4=await confirm(_0x58d67c(0xf9)+_0x2da7ec+'?');if(!_0x21fbd4)return console[_0x58d67c(0xe1)](_0x58d67c(0xe3)),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x5256a6[_0x58d67c(0xd7)][_0x58d67c(0xc1)](_0x2da7ec),{'verbose':_0x59e52b[_0x58d67c(0xcf)]}),console[_0x58d67c(0xe1)](_0x58d67c(0xf6)+_0x2da7ec),console[_0x58d67c(0xe1)](_0x58d67c(0xf0)+_0x2da7ec+_0x58d67c(0x102)),0x0;}}function a30_0x454f(){const _0xe5fef7=['information_schema','10dygQpD','created_at','yes','limit','jobs','type','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','894719kCMfVC','List\x20jobs','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','job:submit','Job\x20type:\x20','file','just\x20now','error','floor','Cancelled','length','query','list','success','red','Limit:\x20','529350AsKMiA','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','status','5GeTntF','\x20jobs','execute','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','Kill\x20a\x20job','431409LQUgaY','Status\x20filter:\x20','url','user_name','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','Query:\x20','dim','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','Database:\x20','...','1070780uUnaSC','Getting\x20job\x20results...','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','Getting\x20job\x20details...','database','✔\x20Retrieved\x20','\x27\x20to\x20verify\x20the\x20job\x20status','✔\x20Job\x20submitted','trino','args','job:show','9667jtwFOe','Listing\x20jobs...','description','presto','map','log','Submitting\x20job...','job_id','2031404amloXf','getTime','push','green','Show\x20job\x20details','Get\x20job\x20results','4552gJCqkb','start_at','d\x20ago','end_at','round','kill','validate','INVALID_ARGUMENT','✔\x20Found\x20','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','h\x20ago','Submit\x20a\x20job','show','name','mo\x20ago','10802637sVLgCG','\x20job','\x20\x20Job\x20ID:\x20','data','verbose','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','result'];a30_0x454f=function(){return _0xe5fef7;};return a30_0x454f();}export class JobSubmitCommand extends BaseCommand{['name']=a30_0x82e7d7(0xdd);['description']=a30_0x82e7d7(0xc7);async[a30_0x82e7d7(0xef)](_0x5e7492){const _0x59fe8d=a30_0x82e7d7,{options:_0x258d87,args:_0x1edf26,tdx:_0x353246}=_0x5e7492,_0x93ccb2=_0x258d87['jobType']||_0x59fe8d(0x104),_0x369bf6=_0x258d87[_0x59fe8d(0xdf)],_0xd8e241=_0x258d87[_0x59fe8d(0x100)]||_0x59fe8d(0xd2),_0x39b84e=_0x258d87[_0x59fe8d(0xd1)];if(_0x93ccb2!==_0x59fe8d(0x104)&&_0x93ccb2!=='hive')throw new SDKError(ErrorCode[_0x59fe8d(0xc3)],_0x59fe8d(0xd0));let _0x5d5ef5;if(_0x369bf6){if(_0x1edf26[0x0])throw new SDKError(ErrorCode[_0x59fe8d(0xc3)],_0x59fe8d(0xfe));const _0x8184aa=readSqlStatementsFromFile(_0x369bf6);if(_0x8184aa[_0x59fe8d(0xe4)]===0x0)throw new SDKError(ErrorCode[_0x59fe8d(0xc3)],'No\x20SQL\x20statements\x20found\x20in\x20file');if(_0x8184aa['length']>0x1)throw new SDKError(ErrorCode[_0x59fe8d(0xc3)],'Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.');_0x5d5ef5=_0x8184aa[0x0];}else{if(!_0x1edf26[0x0])throw new SDKError(ErrorCode[_0x59fe8d(0xc3)],_0x59fe8d(0xdc));_0x5d5ef5=_0x1edf26[0x0];}_0x258d87[_0x59fe8d(0xcf)]&&(console['error'](_0x59fe8d(0xde)+_0x93ccb2),console[_0x59fe8d(0xe1)](_0x59fe8d(0xfa)+_0xd8e241),console[_0x59fe8d(0xe1)](_0x59fe8d(0xf7)+_0x5d5ef5['substring'](0x0,0x64)+(_0x5d5ef5[_0x59fe8d(0xe4)]>0x64?_0x59fe8d(0xfb):'')));const _0x109f15=await withSpinner(_0x59fe8d(0x10d),()=>_0x353246[_0x59fe8d(0xd7)]['submit'](_0xd8e241,_0x5d5ef5,_0x93ccb2,_0x39b84e),{'verbose':_0x258d87[_0x59fe8d(0xcf)]}),_0x4b7f35=_0x109f15[_0x59fe8d(0xce)];return console['error'](_0x59fe8d(0x103)),console[_0x59fe8d(0xe1)](_0x59fe8d(0xcd)+_0x4b7f35[_0x59fe8d(0x10e)]),await handleSDKOutput([_0x4b7f35],_0x258d87),0x0;}}export class JobResultCommand extends BaseCommand{[a30_0x82e7d7(0xc9)]='job:result';[a30_0x82e7d7(0x109)]=a30_0x82e7d7(0x114);[a30_0x82e7d7(0xc2)](_0x2cc83b){const _0x128956=a30_0x82e7d7,_0x24ff35=_0x2cc83b[_0x128956(0x105)][0x0];if(!_0x24ff35)return _0x128956(0xd9);return undefined;}async[a30_0x82e7d7(0xef)](_0x1583f6){const _0x91bd4f=a30_0x82e7d7,{options:_0x430606,args:_0x50d728,tdx:_0x1a7f14}=_0x1583f6,_0x541360=_0x50d728[0x0],_0x51aa39=await withSpinner(_0x91bd4f(0xfd),()=>_0x1a7f14[_0x91bd4f(0xd7)]['result'](_0x541360),{'verbose':_0x430606[_0x91bd4f(0xcf)]}),_0x330fd2=_0x51aa39[_0x91bd4f(0xce)];return console['error'](_0x91bd4f(0x101)+_0x330fd2['length']+'\x20row'+(_0x330fd2[_0x91bd4f(0xe4)]!==0x1?'s':'')),await handleSDKOutput(_0x330fd2,_0x430606),0x0;}}
@@ -1 +1 @@
1
- const a31_0x44af6e=a31_0x5cfe;(function(_0x2c8d6b,_0x1b3ea7){const _0x4e96e9=a31_0x5cfe,_0x29499c=_0x2c8d6b();while(!![]){try{const _0x598dc6=-parseInt(_0x4e96e9(0x1f6))/0x1+parseInt(_0x4e96e9(0x172))/0x2*(parseInt(_0x4e96e9(0x193))/0x3)+parseInt(_0x4e96e9(0x10d))/0x4+parseInt(_0x4e96e9(0x1aa))/0x5+-parseInt(_0x4e96e9(0x175))/0x6*(parseInt(_0x4e96e9(0xfb))/0x7)+parseInt(_0x4e96e9(0x162))/0x8*(parseInt(_0x4e96e9(0x1de))/0x9)+parseInt(_0x4e96e9(0x161))/0xa*(-parseInt(_0x4e96e9(0x1e7))/0xb);if(_0x598dc6===_0x1b3ea7)break;else _0x29499c['push'](_0x29499c['shift']());}catch(_0x133b8b){_0x29499c['push'](_0x29499c['shift']());}}}(a31_0x1a43,0x64d30));function a31_0x1a43(){const _0x19473c=['\x22\x20paused','renderStats','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','map','46584YRUynB','/app/ps/','errorCode','runAfterJourneyRefresh','\x20\x20Target:\x20','repeat','find','listFolders','toLowerCase','Error:\x20Stage\x20\x22','filePath','journeyBundleId','rootFolderId','journey:columns',',\x20schedule:\x20','View\x20a\x20specific\x20version\x20of\x20a\x20journey','no\x20connection','goal','\x20unchanged\x20files','execute','Trigger\x20on-demand\x20workflow\x20execution\x20for\x20journey\x20\x22','\x20(ID:\x20','blue','3951610FvlqmN','relative','\x20journey','type','length','📁\x20','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','journey:traffic','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','\x20=\x20','folderPath','Getting\x20journey\x20details...','site','Resolving\x20version...','Journey:','args','state','get','\x20(draft)\x20—\x20\x22','State:','(unnamed)','completeMilestoneRate','tsv','Listing\x20journey\x20versions...','\x20\x20Consolidating\x20duplicate\x20segment:\x20','Session:','history','Fetching\x20','Target\x20file:\x20','Listing\x20journeys...','bold','Pausing\x20journey...','getStatistics','log','push','Folder\x20path:\x20','Activations:','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','has','Show\x20journey\x20table\x20column\x20mapping','goalSize','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','options','journey:push','getLatestJourneyId','buildIdToNameMap','resolveParentId','No\x20traffic\x20data\x20available\x20for\x20journey:\x20','localeCompare','✔\x20Journey\x20\x22','hasChanges','\x20\x20Journey\x20ID:\x20','1170ncIGQZ','Trigger\x20on-demand\x20journey\x20workflow\x20execution','nodes','/e/','version','launched','Fetching\x20users\x20and\x20connections...','Error:\x20Parent\x20segment\x20context\x20required','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','3519549MwpUjm','attributes','INVALID_ARGUMENT','No\x20journeys\x20found',',\x20version:\x20','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','Resuming\x20journey...','file','Resolving\x20parent\x20segment...','parentName','(none)','Parent\x20segment\x20ID:','\x22\x20resumed','listJourneysFromParentSegment','\x22\x20not\x20found','435200pPyyKI','sort','paused','\x20Journey\x20workflow\x20started','\x0aPull\x20summary:','listJourneysWithFolders','✔\x20Pulled\x20','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','🗺️\x20','red','journey:resume','Cancelled','connection\x20','Parent\x20segment:\x20','listVersions','scheduleType','\x20\x20←\x20','Creating\x20new\x20version...','\x20version','Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey','pausedAt','ID:','\x20details...','verbose','Input:\x20','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','(completed)','Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22','.journey.yml','content','\x20\x20Preserving\x20local\x20segment\x20name:\x20','getJourney','json','Table:\x20','conversion','milestoneSize','executeDryRun','jsonl','\x20versions)','Resume\x20a\x20paused\x20journey','folderId','then','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x20files?','\x20journeys','description','Error:\x20Version\x20','stages','workflowSessionId','dryRun','\x20\x20Statistics\x20not\x20available','\x20Opening\x20','cwd','✔\x20Found\x20','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','message','List\x20activations\x20for\x20a\x20journey','createdAt','run','exitOrJumpSize','table','7gcZXtB','helpText','kind','\x20Created\x20v','parentSegment','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','journey:versions','web','\x20[runs\x20on\x20refresh]','cyan','/j/da/je','(root)','Paused\x20at:','parent_segment','folders','exitOrJumpRate','Getting\x20journey\x20statistics...','add','1817784lwFhvb','journey:run','\x0aError:','rule','journeyName','\x20\x20Name:\x20','Available\x20stages:\x20','journeyId','connectionId','journey:version:create','filter','\x20changed\x20files','stringify','listActivationsFlat','journey:pause','getActivation','journey:view','resolveSegment','format','\x20\x20Folder\x20path:\x20','enteredSize','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','segment','root\x20folder','session','journeyBundleName','⚠️\x20','set','Pause\x20a\x20running\x20journey','Resolved\x20YAML\x20file:\x20','Triggering\x20journey\x20workflow...','Stages:','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20AI','all','error','journeyStages','Error:\x20Journey\x20\x27','Paused:','archived','...','versionNumber','\x0a[Dry\x20run]\x20Journey\x20workflow\x20was\x20NOT\x20triggered.','limit','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','updatedAt','runAt','workflowId','segmentName','Write\x20','hasPeriod','setPhase','\x5c$&','none','base','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','List\x20journeys\x20in\x20current\x20context','Getting\x20column\x20mapping...','journeys','isNew','/j/da','\x20not\x20found.\x20Available:\x20','join','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','Fetching\x20parent\x20segment...','segments','from','green','audienceId','✔\x20Context\x20set:\x20','yellow','connection','Journey\x20name:\x20','Show\x20journey\x20details','Warning:\x20Could\x20not\x20resolve\x20segment\x20','journey','utf-8','includeStats','replace','\x27\x20not\x20found\x20in\x20','resolveJourneyId','\x20activation','status','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)','30Yjmtzz','7928fWwlLp','size','-\x20no\x20files\x20written','reentryMode','(paused)','dim','pause','getParentFull','\x0a[Dry\x20run]\x20Journey\x20was\x20NOT\x20resumed.','includeHistory','\x20->\x20','links','Error:\x20--version\x20option\x20is\x20required','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','journey:list','List\x20all\x20versions\x20of\x20a\x20journey','66kqDNKg','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','activationParams','467814IbhqtJ','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','yes','Status:','getSegment','Fetching\x20journey\x20','draft','data','split','Pattern:\x20','columns','segmentPushCommand','stage','Listing\x20journey\x20activations...','name','entries','relativePath','createVersion','journey:stats','buildIdToEmailMap','Show\x20journey\x20statistics','targetDir','activation','absolutePath','resume','tdx.json'];a31_0x1a43=function(){return _0x19473c;};return a31_0x1a43();}import a31_0x42ca21 from'chalk';import a31_0x191789 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,getWorkflowSessionUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function requireNameOrPath(_0x29a486){const _0xee8617=a31_0x5cfe;return!_0x29a486&&(console['error'](_0xee8617(0x176)),console['error']('Usage:\x20journey\x20<subcommand>\x20<name-or-path>')),!!_0x29a486;}function withJsonFormat(_0x59653e){const _0x26f4f1=a31_0x5cfe;if(!_0x59653e[_0x26f4f1(0x11f)]&&!_0x59653e['json']&&!_0x59653e['jsonl']&&!_0x59653e[_0x26f4f1(0x1c0)])return{..._0x59653e,'format':'json','json':!![]};return _0x59653e;}function formatJourneyState(_0x1f756e){const _0x392f0d=a31_0x5cfe;switch(_0x1f756e){case _0x392f0d(0x1e3):return a31_0x42ca21['green']('(running)');case _0x392f0d(0x17b):return a31_0x42ca21['dim']('(draft)');case _0x392f0d(0x1f8):return a31_0x42ca21['yellow'](_0x392f0d(0x166));case'completed':return a31_0x42ca21[_0x392f0d(0x1a9)](_0x392f0d(0xd8));case _0x392f0d(0x133):return a31_0x42ca21['dim']('(archived)');default:return'('+_0x1f756e+')';}}function formatJourneyItem(_0x518764,_0x261caf='',_0x30c81c){const _0x5a6b07=a31_0x5cfe,_0x56373a=formatJourneyState(_0x518764[_0x5a6b07(0x1ba)]),_0xa6eea2=_0x30c81c?hyperlink(_0x518764['journeyBundleName'],_0x30c81c):_0x518764[_0x5a6b07(0x126)];return _0x261caf+_0x5a6b07(0x1fe)+_0xa6eea2+'\x20'+_0x56373a;}function escapeRegex(_0x3f0316){const _0x286833=a31_0x5cfe;return _0x3f0316[_0x286833(0x15b)](/[.*+?^${}()|[\]\\]/g,_0x286833(0x141));}function globToRegex(_0x579505){const _0x28a3c6=a31_0x5cfe,_0x25ef58=_0x579505[_0x28a3c6(0x17d)]('*')['map'](escapeRegex);return new RegExp(_0x25ef58['join']('.*'),'i');}function buildRuleToNameMapping(_0x3f712e){const _0xa1905b=a31_0x5cfe,_0x1b1d71=new Map();if(_0x3f712e['segments'])for(const [_0x25e872,_0x16c1ca]of Object[_0xa1905b(0x184)](_0x3f712e[_0xa1905b(0x14e)])){if(_0x16c1ca[_0xa1905b(0x110)]){const _0x7a6bbe=serializeRule(_0x16c1ca[_0xa1905b(0x110)]),_0x5d5ee0=_0x1b1d71['get'](_0x7a6bbe);_0x5d5ee0?_0x5d5ee0[_0xa1905b(0x1cc)](_0x25e872):_0x1b1d71[_0xa1905b(0x128)](_0x7a6bbe,[_0x25e872]);}}return _0x1b1d71;}async function resolveJourneyIdFromInput(_0x4e58e8,_0xd171a1,_0x1fb177){const _0x4aefbd=a31_0x5cfe,_0x34334c=await resolveJourneyTarget(_0x4e58e8,_0xd171a1['parentSegment'],_0xd171a1[_0x4aefbd(0xd5)]),_0x2b6753=_0x34334c[_0x4aefbd(0xff)];if(!_0x2b6753)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');const _0x2917ac=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x1fb177[_0x4aefbd(0x123)][_0x4aefbd(0x1d8)](_0x2b6753),{'verbose':_0xd171a1[_0x4aefbd(0xd5)]}),_0x1918cb=_0x2917ac[_0x4aefbd(0x17c)],_0x938834=await withSpinner('Resolving\x20journey...',()=>_0x1fb177['journey'][_0x4aefbd(0x15d)](_0x1918cb,_0x34334c[_0x4aefbd(0x111)]),{'verbose':_0xd171a1['verbose']});return{'journeyId':_0x938834['data'],'journeyName':_0x34334c[_0x4aefbd(0x111)],'parentSegmentId':_0x1918cb};}async function resolveJourneyTarget(_0x3de199,_0x148476,_0x25eba9){const _0x521249=a31_0x5cfe;if(isYamlFilePath(_0x3de199))try{const _0x2adaa6=await resolveYamlFilePath(_0x3de199);return _0x25eba9&&(console[_0x521249(0x12f)](_0x521249(0x12a)+_0x3de199),console[_0x521249(0x12f)]('\x20\x20Parent\x20segment:\x20'+_0x2adaa6[_0x521249(0xff)]),console[_0x521249(0x12f)](_0x521249(0x112)+_0x2adaa6[_0x521249(0x13d)]),console['error'](_0x521249(0x120)+(_0x2adaa6['folderPath']||_0x521249(0x106)))),{'journeyName':_0x2adaa6[_0x521249(0x13d)],'parentSegment':_0x2adaa6['parentSegment'],'resolved':_0x2adaa6};}catch(_0x6188c2){throw new SDKError(ErrorCode[_0x521249(0x1e9)],_0x521249(0x1cf)+_0x6188c2['message']);}if(!_0x148476)throw new SDKError(ErrorCode[_0x521249(0x1e9)],_0x521249(0x191));return{'journeyName':_0x3de199,'parentSegment':_0x148476};}export class JourneyListCommand extends BaseCommand{[a31_0x44af6e(0x183)]=a31_0x44af6e(0x170);[a31_0x44af6e(0xeb)]=a31_0x44af6e(0x145);async[a31_0x44af6e(0x1a6)](_0x4e5f34){const _0x2433ee=a31_0x44af6e,{options:_0x553167,args:_0x1389b6,tdx:_0x23e8bb}=_0x4e5f34,_0x2284c1=_0x1389b6[0x0],_0xa0d588=_0x553167[_0x2433ee(0xff)];if(!_0xa0d588)return console[_0x2433ee(0x12f)](_0x2433ee(0x1e5)),console[_0x2433ee(0x12f)](_0x2433ee(0x122)),0x1;const _0x594e14=await withSpinner(_0x2433ee(0x1ef),()=>_0x23e8bb[_0x2433ee(0x123)]['resolveParentId'](_0xa0d588),{'verbose':_0x553167[_0x2433ee(0xd5)]}),_0x4fac06=_0x594e14[_0x2433ee(0x17c)];_0x553167['verbose']&&(console[_0x2433ee(0x12f)]('Parent\x20segment:\x20'+_0xa0d588+_0x2433ee(0x1a8)+_0x4fac06+')'),_0x2284c1&&console['error'](_0x2433ee(0x17e)+_0x2284c1));const _0x25fcfb=await withSpinner(_0x2433ee(0x14d),()=>_0x23e8bb['segment'][_0x2433ee(0x169)](_0x4fac06),{'verbose':_0x553167[_0x2433ee(0xd5)]}),_0x34ec16=_0x25fcfb[_0x2433ee(0x17c)],_0x26ad87=_0x34ec16[_0x2433ee(0x19f)],_0x37e645=await withSpinner(_0x2433ee(0x1c7),()=>_0x23e8bb[_0x2433ee(0x158)][_0x2433ee(0x1fb)](_0x4fac06,_0x26ad87),{'verbose':_0x553167[_0x2433ee(0xd5)]});let _0x33ea00=_0x37e645[_0x2433ee(0x17c)][_0x2433ee(0x147)];const _0x18cb21=_0x37e645['data'][_0x2433ee(0x109)],_0x704937=new Map();for(const _0x211256 of _0x18cb21){_0x704937[_0x2433ee(0x128)](_0x211256['id'],_0x211256[_0x2433ee(0x183)]);}if(_0x2284c1){const _0x269284=globToRegex(_0x2284c1);_0x33ea00=_0x33ea00['filter'](_0x44b799=>_0x269284['test'](_0x44b799[_0x2433ee(0x126)]));}console[_0x2433ee(0x12f)](_0x2433ee(0xf3)+_0x33ea00[_0x2433ee(0x1ae)]+_0x2433ee(0x1ac)+(_0x33ea00[_0x2433ee(0x1ae)]!==0x1?'s':''));const _0x26cf0b=_0x2b0a1f=>{const _0x53f2b3=_0x2433ee;return getConsoleNextUrl(_0x553167[_0x53f2b3(0x1b6)],'/app/ps/'+_0x4fac06+_0x53f2b3(0x1e1)+_0x2b0a1f+_0x53f2b3(0x149));};if(_0x553167['format']===_0x2433ee(0xfa))await handleSDKOutput(_0x33ea00,_0x553167);else{if(_0x553167[_0x2433ee(0x11f)]===_0x2433ee(0xde)){const _0x57035c=_0x33ea00[_0x2433ee(0x192)](_0x12c254=>({..._0x12c254,'url':_0x26cf0b(_0x12c254['id'])}));await handleSDKOutput(_0x57035c,_0x553167);}else{console[_0x2433ee(0x1cb)]('['+_0xa0d588+']');const _0x166f29=new Map(),_0x5cd7dd=[];for(const _0x1cd423 of _0x33ea00){if(!_0x1cd423[_0x2433ee(0xe6)]||_0x1cd423[_0x2433ee(0xe6)]===_0x26ad87)_0x5cd7dd[_0x2433ee(0x1cc)](_0x1cd423);else{const _0x10916b=_0x166f29[_0x2433ee(0x1bb)](_0x1cd423[_0x2433ee(0xe6)])||[];_0x10916b[_0x2433ee(0x1cc)](_0x1cd423),_0x166f29['set'](_0x1cd423['folderId'],_0x10916b);}}const _0x1fdd9e=(_0x467f42,_0x2e76d8)=>_0x467f42['journeyBundleName'][_0x2433ee(0x1da)](_0x2e76d8[_0x2433ee(0x126)],undefined,{'sensitivity':_0x2433ee(0x143)});_0x5cd7dd['sort'](_0x1fdd9e);for(const _0x4a37cb of _0x5cd7dd){console[_0x2433ee(0x1cb)](formatJourneyItem(_0x4a37cb,'',_0x26cf0b(_0x4a37cb['id'])));}const _0x19f617=[..._0x166f29[_0x2433ee(0x184)]()][_0x2433ee(0x1f7)]((_0x3fc6d5,_0x4a41c5)=>{const _0x17f4b5=_0x2433ee,_0xfac0a8=_0x704937[_0x17f4b5(0x1bb)](_0x3fc6d5[0x0])||_0x3fc6d5[0x0],_0x1abae5=_0x704937[_0x17f4b5(0x1bb)](_0x4a41c5[0x0])||_0x4a41c5[0x0];return _0xfac0a8[_0x17f4b5(0x1da)](_0x1abae5,undefined,{'sensitivity':_0x17f4b5(0x143)});});for(const [_0x188f58,_0x43c2d7]of _0x19f617){const _0x1aa8a5=_0x704937[_0x2433ee(0x1bb)](_0x188f58)||_0x188f58;console[_0x2433ee(0x1cb)](_0x2433ee(0x1af)+_0x1aa8a5),_0x43c2d7[_0x2433ee(0x1f7)](_0x1fdd9e);for(const _0x505665 of _0x43c2d7){console[_0x2433ee(0x1cb)](formatJourneyItem(_0x505665,'\x20\x20',_0x26cf0b(_0x505665['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a31_0x44af6e(0x183)]=a31_0x44af6e(0x11d);[a31_0x44af6e(0xeb)]=a31_0x44af6e(0x156);async[a31_0x44af6e(0x1a6)](_0x169ad0){const _0x5cea22=a31_0x44af6e,{options:_0x18697b,args:_0x18a0c4,tdx:_0x2d9e20}=_0x169ad0,_0x1ee67e=_0x18a0c4[0x0];if(!_0x1ee67e)return console[_0x5cea22(0x12f)](_0x5cea22(0x176)),console['error']('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x5cea22(0x12f)]('Options:'),console[_0x5cea22(0x12f)]('\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser'),0x1;_0x18697b[_0x5cea22(0xd5)]&&console['error'](_0x5cea22(0xd6)+_0x1ee67e);const {journeyId:_0x316d38,parentSegmentId:_0x253394}=await resolveJourneyIdFromInput(_0x1ee67e,_0x18697b,_0x2d9e20);if(_0x18697b[_0x5cea22(0x102)]){const _0x5cc997=getConsoleNextUrl(_0x18697b[_0x5cea22(0x1b6)],'/app/ps/'+_0x253394+_0x5cea22(0x1e1)+_0x316d38+'/j/da/je');return console[_0x5cea22(0x12f)](a31_0x42ca21[_0x5cea22(0x150)]('✔')+_0x5cea22(0xf1)+a31_0x42ca21[_0x5cea22(0x104)](_0x5cc997)),openBrowser(_0x5cc997),0x0;}const _0x5acde7=await withSpinner(_0x5cea22(0x1b5),()=>_0x2d9e20[_0x5cea22(0x158)][_0x5cea22(0xdd)](_0x316d38),{'verbose':_0x18697b[_0x5cea22(0xd5)]}),_0x2b7552=_0x5acde7[_0x5cea22(0x17c)],_0x242158=_0x18697b[_0x5cea22(0x15a)];let _0x108bf8;if(_0x242158)try{const _0x4e5d6e=await withSpinner(_0x5cea22(0x10b),()=>_0x2d9e20['journey'][_0x5cea22(0x1ca)](_0x316d38),{'verbose':_0x18697b['verbose']});_0x108bf8=_0x4e5d6e[_0x5cea22(0x17c)];}catch{_0x18697b['verbose']&&console['error'](_0x5cea22(0xf0));}const _0x3aefcd=getConsoleNextUrl(_0x18697b[_0x5cea22(0x1b6)],_0x5cea22(0x194)+_0x253394+_0x5cea22(0x1e1)+_0x316d38+'/j/da/je'),_0x5ed225={'id':_0x2b7552['id'],'name':_0x2b7552[_0x5cea22(0x1e8)]['name'],'description':_0x2b7552[_0x5cea22(0x1e8)][_0x5cea22(0xeb)],'state':_0x2b7552[_0x5cea22(0x1e8)][_0x5cea22(0x1ba)],'paused':_0x2b7552['attributes']['paused'],'reentry_mode':_0x2b7552[_0x5cea22(0x1e8)][_0x5cea22(0x165)],'stages':_0x2b7552[_0x5cea22(0x1e8)]['journeyStages']?.[_0x5cea22(0x1ae)]||0x0,..._0x2b7552[_0x5cea22(0x1e8)]['goal']&&{'goal':_0x2b7552[_0x5cea22(0x1e8)]['goal'][_0x5cea22(0x183)]},..._0x108bf8&&{'statistics':{'size':_0x108bf8[_0x5cea22(0x163)],'entered':_0x108bf8['enteredSize'],'goal_achieved':_0x108bf8[_0x5cea22(0x1d2)],'completion_rate':_0x108bf8['completionRate'],'exit_or_jump':_0x108bf8['exitOrJumpSize'],'exit_or_jump_rate':_0x108bf8[_0x5cea22(0x10a)],'stages':_0x108bf8['stages']}},'url':_0x3aefcd};return await handleSingleObjectOutput(_0x5ed225,_0x18697b),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a31_0x44af6e(0x183)]=a31_0x44af6e(0x187);[a31_0x44af6e(0xeb)]=a31_0x44af6e(0x189);async[a31_0x44af6e(0x1a6)](_0x261ada){const _0x750603=a31_0x44af6e,{options:_0x555116,args:_0x3a4ef5,tdx:_0x308e01}=_0x261ada,_0x9e31a6=_0x3a4ef5[0x0];if(!requireNameOrPath(_0x9e31a6))return 0x1;_0x555116['verbose']&&console[_0x750603(0x12f)](_0x750603(0xd6)+_0x9e31a6);const _0x15d3bf=_0x555116,_0x5304f8=_0x15d3bf['from'],_0x3a5d29=_0x15d3bf['to'],_0x111d39=_0x15d3bf[_0x750603(0x16b)],_0xd3f74b=_0x15d3bf[_0x750603(0x181)];_0x111d39&&!_0x5304f8&&!_0x3a5d29&&console[_0x750603(0x12f)]('Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history');const _0x27ef7b=_0x111d39?withJsonFormat(_0x555116):_0x555116,{journeyId:_0x4b42ed,journeyName:_0x535bfb}=await resolveJourneyIdFromInput(_0x9e31a6,_0x27ef7b,_0x308e01),_0x364547=_0x5304f8||_0x3a5d29?{'from':_0x5304f8,'to':_0x3a5d29}:undefined,_0x4d89af=await withSpinner('Getting\x20journey\x20statistics...',()=>Promise['all']([_0x308e01['journey'][_0x750603(0xdd)](_0x4b42ed),_0x308e01['journey']['getStatistics'](_0x4b42ed,_0x364547)]),{'verbose':_0x27ef7b['verbose']}),[_0x2ddf12,_0x102348]=_0x4d89af[_0x750603(0x17c)];if(!_0x102348||_0x102348['journeyId']===null)return console['error']('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x535bfb),console[_0x750603(0x12f)]('Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),0x0;const _0x46c047=buildStageNameMap(_0x2ddf12),_0x1b143a=!!(_0x364547&&_0x102348[_0x750603(0x1c4)]?.['length']),_0x4f8375={'stageNameMap':_0x46c047,'hasPeriod':_0x1b143a,'includeHistory':!!_0x111d39};if(_0xd3f74b&&_0x102348[_0x750603(0xed)]){const _0x8ade41=_0x102348[_0x750603(0xed)][_0x750603(0x199)](_0x5378bf=>{const _0x4bb59a=_0x750603,_0x5714fb=_0x46c047[_0x4bb59a(0x1bb)](_0x5378bf['id'])??'';return _0x5714fb[_0x4bb59a(0x19b)]()===_0xd3f74b[_0x4bb59a(0x19b)]();});if(_0x8ade41)return await handleSingleObjectOutput(formatStageStats(_0x8ade41,_0x4f8375),_0x27ef7b),0x0;const _0xcbe86a=_0x102348['stages']['map'](_0x1cf227=>_0x46c047[_0x750603(0x1bb)](_0x1cf227['id'])??_0x1cf227['id']);return console[_0x750603(0x12f)](_0x750603(0x19c)+_0xd3f74b+_0x750603(0x1f5)),console[_0x750603(0x12f)](_0x750603(0x113)+_0xcbe86a[_0x750603(0x14b)](',\x20')),0x1;}const _0x7515ed=_0x102348[_0x750603(0xed)]?.['map'](_0x583131=>formatStageStats(_0x583131,_0x4f8375)),_0x43ea78=assembleJourneyStats(_0x102348,{'from':_0x5304f8,'to':_0x3a5d29,'includeHistory':_0x111d39});return await this[_0x750603(0x190)](_0x43ea78,_0x7515ed??[],_0x27ef7b),0x0;}async[a31_0x44af6e(0x190)](_0x1fad88,_0x4b4da2,_0x8e534a){const _0x50a0c3=a31_0x44af6e,_0x493528=_0x8e534a[_0x50a0c3(0x11f)]===_0x50a0c3(0xde)||_0x8e534a['format']==='jsonl'||_0x8e534a[_0x50a0c3(0xde)]||_0x8e534a[_0x50a0c3(0xe3)];if(_0x493528){_0x1fad88[_0x50a0c3(0xed)]=_0x4b4da2,await handleSingleObjectOutput(_0x1fad88,_0x8e534a);return;}await handleSingleObjectOutput(_0x1fad88,_0x8e534a);for(const _0x427902 of _0x4b4da2){console[_0x50a0c3(0x1cb)](''),console[_0x50a0c3(0x1cb)](String(a31_0x42ca21[_0x50a0c3(0x104)][_0x50a0c3(0x1c8)]('['+_0x427902[_0x50a0c3(0x183)]+']'))+a31_0x42ca21[_0x50a0c3(0x167)]('\x20'+_0x427902['id']));const {id:_0x438166,name:_0x1e1e74,..._0x677d4c}=_0x427902;await handleSingleObjectOutput(_0x677d4c,_0x8e534a);}}}export class JourneyTrafficCommand extends BaseCommand{[a31_0x44af6e(0x183)]=a31_0x44af6e(0x1b1);[a31_0x44af6e(0xeb)]=a31_0x44af6e(0x1ec);async[a31_0x44af6e(0x1a6)](_0xc7c9d5){const _0xe9c8d3=a31_0x44af6e,{options:_0x5b7e98,args:_0x2e8363,tdx:_0xf96fc5}=_0xc7c9d5,_0x5bbf4d=_0x2e8363[0x0];if(!requireNameOrPath(_0x5bbf4d))return 0x1;_0x5b7e98[_0xe9c8d3(0xd5)]&&console[_0xe9c8d3(0x12f)]('Input:\x20'+_0x5bbf4d);const _0x14b2e4=_0x5b7e98,_0x1b9d08=_0x14b2e4[_0xe9c8d3(0x1ad)],_0x44aa69=_0x14b2e4[_0xe9c8d3(0x14f)],_0x365cc1=_0x14b2e4['to'],_0x593907=_0x14b2e4[_0xe9c8d3(0x137)];if(_0x1b9d08&&_0x1b9d08!==_0xe9c8d3(0xe0)&&_0x1b9d08!==_0xe9c8d3(0x18b))return console[_0xe9c8d3(0x12f)]('Error:\x20Invalid\x20--type\x20\x22'+_0x1b9d08+_0xe9c8d3(0x138)),0x1;const _0x4aed24=withJsonFormat(_0x5b7e98),{journeyId:_0x165f9e,journeyName:_0x367070}=await resolveJourneyIdFromInput(_0x5bbf4d,_0x4aed24,_0xf96fc5),_0x4f5429={'type':_0x1b9d08,'from':_0x44aa69,'to':_0x365cc1,'limit':_0x593907},_0x1be7d1=await withSpinner('Getting\x20journey\x20traffic\x20data...',()=>_0xf96fc5[_0xe9c8d3(0x158)]['getTrafficData'](_0x165f9e,_0x4f5429),{'verbose':_0x4aed24['verbose']}),_0x593c8d=_0x1be7d1[_0xe9c8d3(0x17c)],_0x35e5ae=_0x593c8d[_0xe9c8d3(0xe0)]&&(_0x593c8d[_0xe9c8d3(0xe0)][_0xe9c8d3(0x1e0)][_0xe9c8d3(0x1ae)]>0x0||_0x593c8d[_0xe9c8d3(0xe0)][_0xe9c8d3(0x16d)][_0xe9c8d3(0x1ae)]>0x0),_0x6306f8=_0x593c8d['activation']&&_0x593c8d[_0xe9c8d3(0x18b)][_0xe9c8d3(0x1ae)]>0x0;if(!_0x35e5ae&&!_0x6306f8)return console[_0xe9c8d3(0x12f)](_0xe9c8d3(0x1d9)+_0x367070),console[_0xe9c8d3(0x12f)]('Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),_0x44aa69&&_0x365cc1&&console[_0xe9c8d3(0x12f)](_0xe9c8d3(0xf4)),0x0;return await handleSingleObjectOutput(_0x593c8d,_0x4aed24),0x0;}}function a31_0x5cfe(_0x5f2431,_0x24fa0b){_0x5f2431=_0x5f2431-0xce;const _0x1a436e=a31_0x1a43();let _0x5cfe4c=_0x1a436e[_0x5f2431];return _0x5cfe4c;}function formatStageStats(_0x4a9eb1,_0x3a5af3){const _0x578b98=a31_0x44af6e,_0x40443b=_0x3a5af3[_0x578b98(0x13f)]&&_0x4a9eb1[_0x578b98(0x1c4)]?.[_0x578b98(0x1ae)]?aggregateStageHistory(_0x4a9eb1[_0x578b98(0x1c4)]):{'size':_0x4a9eb1[_0x578b98(0x163)],'entered':_0x4a9eb1[_0x578b98(0x121)],'milestone':_0x4a9eb1[_0x578b98(0xe1)],'milestone_rate':_0x4a9eb1[_0x578b98(0x1bf)],'exit_or_jump':_0x4a9eb1[_0x578b98(0xf9)],'exit_or_jump_rate':_0x4a9eb1['exitOrJumpRate']},_0x39ee75={'id':_0x4a9eb1['id'],'name':_0x3a5af3['stageNameMap'][_0x578b98(0x1bb)](_0x4a9eb1['id'])??_0x4a9eb1['id'],..._0x40443b};return _0x3a5af3[_0x578b98(0x13f)]&&_0x3a5af3['includeHistory']&&_0x4a9eb1['history']&&(_0x39ee75[_0x578b98(0x1c4)]=_0x4a9eb1[_0x578b98(0x1c4)]),_0x39ee75;}export class JourneyPauseCommand extends BaseCommand{[a31_0x44af6e(0x183)]=a31_0x44af6e(0x11b);['description']=a31_0x44af6e(0x129);async[a31_0x44af6e(0x1a6)](_0x5a8cc2){const _0x15060a=a31_0x44af6e,{options:_0x571bb2,args:_0x1f6620,tdx:_0x3da796}=_0x5a8cc2,_0x29aeaf=_0x1f6620[0x0];if(!requireNameOrPath(_0x29aeaf))return 0x1;_0x571bb2[_0x15060a(0xd5)]&&console[_0x15060a(0x12f)](_0x15060a(0xd6)+_0x29aeaf);const {journeyId:_0x4f2e5f,journeyName:_0x177870}=await resolveJourneyIdFromInput(_0x29aeaf,_0x571bb2,_0x3da796);if(!_0x571bb2[_0x15060a(0x177)]){const _0x452c39=await confirm(_0x15060a(0x1b2)+_0x177870+'\x22?');if(!_0x452c39)return console[_0x15060a(0x12f)](_0x15060a(0x201)),0x0;}const _0x5422cd=await withSpinner(_0x15060a(0x1c9),()=>_0x3da796['journey'][_0x15060a(0x168)](_0x4f2e5f),{'verbose':_0x571bb2['verbose']}),_0x52cf42=_0x5422cd[_0x15060a(0x17c)];return console[_0x15060a(0x12f)](_0x15060a(0x1db)+_0x52cf42[_0x15060a(0x1e8)][_0x15060a(0x183)]+_0x15060a(0x18f)),0x0;}}export class JourneyRunCommand extends BaseCommand{[a31_0x44af6e(0x183)]=a31_0x44af6e(0x10e);[a31_0x44af6e(0xeb)]=a31_0x44af6e(0x1df);async[a31_0x44af6e(0x1a6)](_0x56546c){const _0x39f5f0=a31_0x44af6e,{options:_0x707c47,args:_0x215b6f,tdx:_0x70e05}=_0x56546c,_0x1b478e=_0x215b6f[0x0];if(!requireNameOrPath(_0x1b478e))return 0x1;_0x707c47[_0x39f5f0(0xd5)]&&console[_0x39f5f0(0x12f)](_0x39f5f0(0xd6)+_0x1b478e);const {journeyId:_0x164f15,journeyName:_0x3a4ec4}=await resolveJourneyIdFromInput(_0x1b478e,_0x707c47,_0x70e05);if(_0x707c47[_0x39f5f0(0xef)])return await this['executeDryRun'](_0x56546c,_0x164f15,_0x3a4ec4);if(!_0x707c47[_0x39f5f0(0x177)]){const _0x16760b=await confirm(_0x39f5f0(0x1a7)+_0x3a4ec4+'\x22?');if(!_0x16760b)return console[_0x39f5f0(0x12f)]('Cancelled'),0x0;}const _0xd72855=await withSpinner(_0x39f5f0(0x12b),()=>_0x70e05[_0x39f5f0(0x158)][_0x39f5f0(0xf8)](_0x164f15),{'verbose':_0x707c47[_0x39f5f0(0xd5)]}),_0x44a4e0=_0xd72855[_0x39f5f0(0x17c)],_0x3ff491=getWorkflowSessionUrl(_0x707c47[_0x39f5f0(0x1b6)],_0x44a4e0[_0x39f5f0(0x13c)],_0x44a4e0[_0x39f5f0(0xee)]);return console['error']('\x0a'+a31_0x42ca21['green']('✔')+_0x39f5f0(0x1f9)),console[_0x39f5f0(0x12f)]('\x20\x20'+a31_0x42ca21[_0x39f5f0(0x167)]('Journey:')+'\x20'+_0x3a4ec4),console[_0x39f5f0(0x12f)]('\x20\x20'+a31_0x42ca21[_0x39f5f0(0x167)](_0x39f5f0(0x178))+'\x20'+_0x44a4e0[_0x39f5f0(0x15f)]),console[_0x39f5f0(0x12f)]('\x20\x20'+a31_0x42ca21['dim'](_0x39f5f0(0x1c3))+'\x20'+_0x44a4e0['workflowSessionId']),console[_0x39f5f0(0x12f)]('\x20\x20'+_0x3ff491),0x0;}async[a31_0x44af6e(0xe2)](_0x1653cd,_0x573d83,_0x3b7143){const _0xa8e23=a31_0x44af6e,{options:_0x222da4,tdx:_0x507531}=_0x1653cd,_0x46e23b=await withSpinner(_0xa8e23(0x17a)+_0x3b7143+'...',()=>Promise[_0xa8e23(0x12e)]([_0x507531['journey'][_0xa8e23(0xdd)](_0x573d83),_0x507531[_0xa8e23(0x158)][_0xa8e23(0x11a)](_0x573d83)]),{'verbose':_0x222da4[_0xa8e23(0xd5)]}),[_0x16fbef,_0x37b76a]=_0x46e23b[_0xa8e23(0x17c)],_0x442be2=_0x16fbef[_0xa8e23(0x1e8)],_0x3db971=_0x442be2[_0xa8e23(0x130)];console[_0xa8e23(0x1cb)](a31_0x42ca21[_0xa8e23(0x1c8)]('Journey:'),_0x442be2['name']),console[_0xa8e23(0x1cb)](a31_0x42ca21[_0xa8e23(0x1c8)](_0xa8e23(0xd3)),_0x16fbef['id']),console[_0xa8e23(0x1cb)](a31_0x42ca21['bold'](_0xa8e23(0x1bd)),_0x442be2[_0xa8e23(0x1ba)]),console[_0xa8e23(0x1cb)](a31_0x42ca21[_0xa8e23(0x1c8)]('Paused:'),_0x442be2[_0xa8e23(0x1f8)]?a31_0x42ca21[_0xa8e23(0x153)](_0xa8e23(0x177)):a31_0x42ca21[_0xa8e23(0x150)]('no')),console['log'](a31_0x42ca21['bold']('Parent\x20segment\x20ID:'),_0x442be2[_0xa8e23(0x151)]);const _0x329fb6=_0x3db971['length']>0x0?'\x20('+_0x3db971[_0xa8e23(0x192)](_0xf39a24=>_0xf39a24['name'])[_0xa8e23(0x14b)](',\x20')+')':'';console[_0xa8e23(0x1cb)](a31_0x42ca21[_0xa8e23(0x1c8)](_0xa8e23(0x12c)),''+_0x3db971[_0xa8e23(0x1ae)]+_0x329fb6),console[_0xa8e23(0x1cb)]('');if(_0x37b76a[_0xa8e23(0x1ae)]===0x0)console[_0xa8e23(0x1cb)](a31_0x42ca21[_0xa8e23(0x1c8)](_0xa8e23(0x1ce)),a31_0x42ca21[_0xa8e23(0x167)](_0xa8e23(0x1f1)));else{console['log'](a31_0x42ca21[_0xa8e23(0x1c8)](_0xa8e23(0x1ce)));for(const _0x4b6315 of _0x37b76a){const _0x18b86f=_0x4b6315[_0xa8e23(0x183)]??_0xa8e23(0x1be),_0x4e475e=_0x4b6315[_0xa8e23(0x115)]!=null?_0xa8e23(0x202)+_0x4b6315[_0xa8e23(0x115)]:_0xa8e23(0x1a3),_0x39d1c0=_0x4b6315['scheduleType']?''+_0x4b6315[_0xa8e23(0x205)]+(_0x4b6315[_0xa8e23(0x13b)]?'\x20@\x20'+_0x4b6315[_0xa8e23(0x13b)]:''):_0xa8e23(0x142),_0xdb3320=_0x4b6315[_0xa8e23(0x196)]?'\x20[runs\x20on\x20refresh]':'';console[_0xa8e23(0x1cb)]('\x20\x20'+a31_0x42ca21[_0xa8e23(0x153)]('⚠️\x20')+'\x20'+_0x18b86f+'\x20\x20←\x20'+_0x4e475e+_0xa8e23(0x1a1)+_0x39d1c0+_0xdb3320);}}return console[_0xa8e23(0x1cb)](a31_0x42ca21[_0xa8e23(0x153)](_0xa8e23(0x136))),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a31_0x44af6e(0x183)]=a31_0x44af6e(0x200);[a31_0x44af6e(0xeb)]=a31_0x44af6e(0xe5);async[a31_0x44af6e(0x1a6)](_0x4dc040){const _0x127efb=a31_0x44af6e,{options:_0x1fa9e9,args:_0x570d12,tdx:_0x5bb344}=_0x4dc040,_0x4d1998=_0x570d12[0x0];if(!requireNameOrPath(_0x4d1998))return 0x1;_0x1fa9e9[_0x127efb(0xd5)]&&console['error'](_0x127efb(0xd6)+_0x4d1998);const {journeyId:_0x3c7f70,journeyName:_0x22def9}=await resolveJourneyIdFromInput(_0x4d1998,_0x1fa9e9,_0x5bb344);if(_0x1fa9e9['dryRun'])return await this['executeDryRun'](_0x4dc040,_0x3c7f70,_0x22def9);if(!_0x1fa9e9[_0x127efb(0x177)]){const _0x3e79a8=await confirm(_0x127efb(0x1e6)+_0x22def9+'\x22?');if(!_0x3e79a8)return console['error'](_0x127efb(0x201)),0x0;}const _0x40acf6=await withSpinner(_0x127efb(0x1ed),()=>_0x5bb344[_0x127efb(0x158)][_0x127efb(0x18d)](_0x3c7f70),{'verbose':_0x1fa9e9['verbose']}),_0x45a1b8=_0x40acf6[_0x127efb(0x17c)];return console[_0x127efb(0x12f)](_0x127efb(0x1db)+_0x45a1b8[_0x127efb(0x1e8)][_0x127efb(0x183)]+_0x127efb(0x1f3)),0x0;}async[a31_0x44af6e(0xe2)](_0x5d055d,_0x5081da,_0x5e20ef){const _0x5f3860=a31_0x44af6e,{options:_0x481fb2,tdx:_0x52c72a}=_0x5d055d,_0x356de0=await withSpinner(_0x5f3860(0x17a)+_0x5e20ef+_0x5f3860(0x134),()=>Promise[_0x5f3860(0x12e)]([_0x52c72a[_0x5f3860(0x158)][_0x5f3860(0xdd)](_0x5081da),_0x52c72a[_0x5f3860(0x158)][_0x5f3860(0x11a)](_0x5081da)]),{'verbose':_0x481fb2[_0x5f3860(0xd5)]}),[_0xe31012,_0x4d9c52]=_0x356de0[_0x5f3860(0x17c)],_0x60cb32=_0xe31012['attributes'],_0x3b7cbe=_0x60cb32[_0x5f3860(0x130)];console['log'](a31_0x42ca21[_0x5f3860(0x1c8)](_0x5f3860(0x1b8)),_0x60cb32[_0x5f3860(0x183)]),console['log'](a31_0x42ca21[_0x5f3860(0x1c8)](_0x5f3860(0xd3)),_0xe31012['id']),console[_0x5f3860(0x1cb)](a31_0x42ca21['bold']('State:'),_0x60cb32[_0x5f3860(0x1ba)]),console[_0x5f3860(0x1cb)](a31_0x42ca21[_0x5f3860(0x1c8)](_0x5f3860(0x132)),_0x60cb32[_0x5f3860(0x1f8)]?a31_0x42ca21[_0x5f3860(0x153)]('yes'):a31_0x42ca21[_0x5f3860(0x150)]('no'));_0x60cb32[_0x5f3860(0xd2)]&&console[_0x5f3860(0x1cb)](a31_0x42ca21[_0x5f3860(0x1c8)](_0x5f3860(0x107)),_0x60cb32[_0x5f3860(0xd2)]);console['log'](a31_0x42ca21[_0x5f3860(0x1c8)](_0x5f3860(0x1f2)),_0x60cb32[_0x5f3860(0x151)]);const _0x99d8f5=_0x3b7cbe['length']>0x0?'\x20('+_0x3b7cbe[_0x5f3860(0x192)](_0x2bb765=>_0x2bb765['name'])[_0x5f3860(0x14b)](',\x20')+')':'';console[_0x5f3860(0x1cb)](a31_0x42ca21[_0x5f3860(0x1c8)](_0x5f3860(0x12c)),''+_0x3b7cbe[_0x5f3860(0x1ae)]+_0x99d8f5),console[_0x5f3860(0x1cb)]('');if(_0x4d9c52[_0x5f3860(0x1ae)]===0x0)console['log'](a31_0x42ca21[_0x5f3860(0x1c8)]('Activations:'),a31_0x42ca21['dim'](_0x5f3860(0x1f1)));else{console['log'](a31_0x42ca21[_0x5f3860(0x1c8)](_0x5f3860(0x1ce)));for(const _0x4301d8 of _0x4d9c52){const _0x176f42=_0x4301d8[_0x5f3860(0x183)]??_0x5f3860(0x1be),_0x56bd05=_0x4301d8[_0x5f3860(0x115)]!=null?_0x5f3860(0x202)+_0x4301d8[_0x5f3860(0x115)]:'no\x20connection',_0x1e0079=_0x4301d8[_0x5f3860(0x205)]?''+_0x4301d8['scheduleType']+(_0x4301d8[_0x5f3860(0x13b)]?'\x20@\x20'+_0x4301d8[_0x5f3860(0x13b)]:''):_0x5f3860(0x142),_0x45f772=_0x4301d8[_0x5f3860(0x196)]?_0x5f3860(0x103):'';console[_0x5f3860(0x1cb)]('\x20\x20'+a31_0x42ca21[_0x5f3860(0x153)](_0x5f3860(0x127))+'\x20'+_0x176f42+_0x5f3860(0xce)+_0x56bd05+_0x5f3860(0x1a1)+_0x1e0079+_0x45f772);}}return console[_0x5f3860(0x1cb)](a31_0x42ca21[_0x5f3860(0x153)](_0x5f3860(0x16a))),0x0;}}export class JourneyPullCommand extends BaseCommand{[a31_0x44af6e(0x183)]='journey:pull';[a31_0x44af6e(0xeb)]='Export\x20journey(s)\x20as\x20YAML\x20files';async[a31_0x44af6e(0x1a6)](_0x31710d){const _0x2bbd20=a31_0x44af6e,{options:_0x1f2bf8,args:_0x2adb14,tdx:_0x2cc3db}=_0x31710d,_0x38551e=_0x1f2bf8,_0x2c5f37=_0x2adb14[0x0],_0x44a35f=_0x2c5f37&&isYamlFilePath(_0x2c5f37),_0x549e77=await resolveTarget({'arg':_0x44a35f?_0x2c5f37:undefined,'contextParent':_0x1f2bf8[_0x2bbd20(0xff)],'cwd':process[_0x2bbd20(0xf2)]()});if(!isSuccessfulResolution(_0x549e77))return _0x549e77[_0x2bbd20(0x195)]==='no_parent'?(console[_0x2bbd20(0x12f)](a31_0x42ca21['yellow'](_0x2bbd20(0x139))),console[_0x2bbd20(0x12f)](_0x2bbd20(0x160)),console['error'](_0x2bbd20(0x144)),console[_0x2bbd20(0x12f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0x2bbd20(0x12f)](_0x2bbd20(0xd7))):(console[_0x2bbd20(0x12f)](a31_0x42ca21[_0x2bbd20(0x1ff)]('Error:\x20'+_0x549e77[_0x2bbd20(0xf5)]+'\x0a')),_0x549e77['helpText']&&console['error'](a31_0x42ca21[_0x2bbd20(0x104)](_0x549e77[_0x2bbd20(0xfc)]))),0x1;let _0x56bb7b=_0x44a35f?undefined:_0x2c5f37,_0x3d9972,_0x18967b;_0x549e77[_0x2bbd20(0x1ad)]===_0x2bbd20(0x1ee)&&(_0x56bb7b=_0x549e77['resourceName'],_0x3d9972=_0x549e77[_0x2bbd20(0x19d)],_0x18967b=_0x549e77[_0x2bbd20(0x1b4)]);const _0x2b27aa=_0x549e77[_0x2bbd20(0x1f0)],_0x4a34b6=_0x549e77[_0x2bbd20(0x18a)];_0x38551e[_0x2bbd20(0xd5)]&&(console[_0x2bbd20(0x12f)](_0x2bbd20(0x203)+_0x2b27aa),console[_0x2bbd20(0x12f)]('Target\x20directory:\x20'+_0x4a34b6),_0x56bb7b&&console[_0x2bbd20(0x12f)](_0x2bbd20(0x155)+_0x56bb7b),_0x3d9972&&console[_0x2bbd20(0x12f)](_0x2bbd20(0x1c6)+_0x3d9972),_0x18967b&&console[_0x2bbd20(0x12f)](_0x2bbd20(0x1cd)+_0x18967b));const _0x362eaf=await withSpinner(_0x2bbd20(0x1ef),()=>_0x2cc3db[_0x2bbd20(0x123)][_0x2bbd20(0x1d8)](_0x2b27aa),{'verbose':_0x1f2bf8[_0x2bbd20(0xd5)]}),_0x408b8e=_0x362eaf[_0x2bbd20(0x17c)],{journeys:_0x8af074,folders:_0x2c197e}=await withSpinner('Fetching\x20journeys\x20and\x20folders...',async()=>{const _0xd8ef97=_0x2bbd20,[_0x4b8c3a,_0x297662]=await Promise[_0xd8ef97(0x12e)]([_0x2cc3db[_0xd8ef97(0x158)][_0xd8ef97(0x1f4)](_0x408b8e,undefined,{'includeAllVersions':!![]}),_0x2cc3db['segment'][_0xd8ef97(0x19a)](_0x408b8e)]);return{'journeys':_0x4b8c3a,'folders':_0x297662};},{'verbose':_0x1f2bf8[_0x2bbd20(0xd5)]})[_0x2bbd20(0xe7)](_0xd736f5=>_0xd736f5[_0x2bbd20(0x17c)]);let _0x3dd968=_0x8af074;const _0x23c561=buildFolderIdToPathMap(_0x2c197e);if(_0x56bb7b){const _0x33e773=_0x3dd968[_0x2bbd20(0x117)](_0x86170f=>_0x86170f['journeyBundleName'][_0x2bbd20(0x19b)]()===_0x56bb7b[_0x2bbd20(0x19b)]());if(_0x33e773[_0x2bbd20(0x1ae)]===0x0)return console['error']('Error:\x20Journey\x20not\x20found:\x20'+_0x56bb7b),console[_0x2bbd20(0x12f)](_0x2bbd20(0x1fd)),0x1;_0x3dd968=_0x33e773;}if(_0x18967b!==undefined){const _0x526132=_0x3dd968[_0x2bbd20(0x117)](_0x4e5865=>{const _0x17c609=_0x2bbd20,_0x26875e=_0x4e5865[_0x17c609(0xe6)]?_0x23c561[_0x17c609(0x1bb)](_0x4e5865['folderId'])||'':'';return _0x26875e===_0x18967b;});if(_0x526132[_0x2bbd20(0x1ae)]===0x0&&_0x3dd968[_0x2bbd20(0x1ae)]>0x0){console[_0x2bbd20(0x12f)](_0x2bbd20(0x131)+_0x56bb7b+_0x2bbd20(0x15c)+(_0x18967b||_0x2bbd20(0x124))),console[_0x2bbd20(0x12f)](_0x2bbd20(0x173));for(const _0x20e77d of _0x3dd968){const _0x284048=_0x20e77d[_0x2bbd20(0xe6)]?_0x23c561['get'](_0x20e77d[_0x2bbd20(0xe6)])||'':'';console[_0x2bbd20(0x12f)]('\x20\x20-\x20'+(_0x284048||_0x2bbd20(0x106))+'/'+_0x20e77d[_0x2bbd20(0x126)]);}return 0x1;}_0x3dd968=_0x526132;}if(_0x3dd968['length']===0x0)return console[_0x2bbd20(0x12f)](_0x2bbd20(0x1ea)),0x0;const _0x82c1ed=new Map();for(const _0x2a1743 of _0x3dd968){const _0x1e4cd5=_0x2a1743[_0x2bbd20(0x19e)];!_0x82c1ed['has'](_0x1e4cd5)&&_0x82c1ed['set'](_0x1e4cd5,[]),_0x82c1ed[_0x2bbd20(0x1bb)](_0x1e4cd5)[_0x2bbd20(0x1cc)](_0x2a1743);}for(const _0x24aa30 of _0x82c1ed['values']()){_0x24aa30[_0x2bbd20(0x1f7)]((_0x2f405c,_0x502c02)=>(_0x2f405c[_0x2bbd20(0x135)]||0x0)-(_0x502c02[_0x2bbd20(0x135)]||0x0));}const _0x739021=[],{idToEmailMap:_0x58cf7f,connectionIdToNameMap:_0x3e3490}=await withSpinner(_0x2bbd20(0x1e4),async()=>{const _0x59fa82=_0x2bbd20,[_0x24c1e9,_0x43d9ed]=await Promise['all']([_0x2cc3db['user'][_0x59fa82(0x188)](),_0x2cc3db[_0x59fa82(0x154)][_0x59fa82(0x1d7)]()]);return{'idToEmailMap':_0x24c1e9,'connectionIdToNameMap':_0x43d9ed};},{'verbose':_0x1f2bf8[_0x2bbd20(0xd5)]})['then'](_0x5d3209=>_0x5d3209[_0x2bbd20(0x17c)]);for(const _0x171138 of _0x82c1ed['values']()){const _0x7cb0e4=_0x171138[0x0][_0x2bbd20(0x126)],_0x3f59ab=_0x171138[0x0]['folderId'],_0x29c6da=_0x3f59ab?_0x23c561[_0x2bbd20(0x1bb)](_0x3f59ab)||'':'',_0x5a4b1e=_0x29c6da?a31_0x191789[_0x2bbd20(0x14b)](_0x4a34b6,_0x29c6da):_0x4a34b6,_0x2a7fa4=_0x3d9972||a31_0x191789['join'](_0x5a4b1e,sanitizeFileName(_0x7cb0e4)+'.journey.yml');let _0x8e4fc7,_0x3c563b;if(existsSync(_0x2a7fa4))try{const _0x1d3428=readFileSync(_0x2a7fa4,_0x2bbd20(0x159)),_0x1c42aa=parseYamlString(_0x1d3428);_0x3c563b=_0x1c42aa,_0x8e4fc7=buildRuleToNameMapping(_0x1c42aa),_0x38551e['verbose']&&_0x8e4fc7['size']>0x0&&console[_0x2bbd20(0x12f)]('Found\x20'+_0x8e4fc7['size']+_0x2bbd20(0x14c)+_0x7cb0e4);}catch(_0x2ed4bb){_0x38551e[_0x2bbd20(0xd5)]&&console[_0x2bbd20(0x12f)](_0x2bbd20(0x100)+_0x2ed4bb[_0x2bbd20(0xf5)]);}const _0xc800ad=[],_0x4cafa5=new Set(),_0x662e9=new Map(),_0x22d45f=new Map(),_0x39eab5=new Set(),_0x3c2cfb=new Map(),_0x31d449=new Map(),_0x565a1f=createJumpTargetCache();await withProgressSpinner('Fetching\x20'+_0x7cb0e4+'...',async _0x5e19ab=>{const _0x4199d4=_0x2bbd20;for(const _0x5e5dd5 of _0x171138){const _0x107269=_0x171138[_0x4199d4(0x1ae)]>0x1?_0x5e5dd5[_0x4199d4(0x126)]+'\x20v'+(_0x5e5dd5[_0x4199d4(0x135)]||0x1):_0x5e5dd5[_0x4199d4(0x126)];_0x5e19ab[_0x4199d4(0x140)](_0x4199d4(0x1c5)+_0x107269);const _0x521c79=await _0x2cc3db[_0x4199d4(0x158)]['getJourney'](_0x5e5dd5['id']),_0x52b005=_0x521c79[_0x4199d4(0x1e8)]?.['audienceId'],_0x318228={'resolveSegment':async _0x41b46d=>{const _0x35065e=_0x4199d4;if(!_0x52b005)return{'name':_0x41b46d,'isJourneyLocal':![]};const _0x9d3b3b=_0x662e9[_0x35065e(0x1bb)](_0x41b46d);if(_0x9d3b3b)return _0x9d3b3b;try{const _0x159c9c=await _0x2cc3db[_0x35065e(0x123)][_0x35065e(0x179)](_0x52b005,_0x41b46d),_0x1205e0=_0x159c9c[_0x35065e(0xfd)]===SEGMENT_KIND_JOURNEY;let _0x41fc9a,_0x273208=_0x159c9c[_0x35065e(0x183)];if(_0x1205e0&&_0x159c9c[_0x35065e(0x110)]){const _0x34dc01=await segmentResponseToDef(_0x159c9c,{'resolveSegmentName':async _0x506e81=>{const _0x41867a=_0x35065e,_0x29d311=_0x662e9['get'](_0x506e81);if(_0x29d311)return _0x29d311[_0x41867a(0x183)];const _0x2c3752=await _0x318228[_0x41867a(0x11e)](_0x506e81);return _0x2c3752[_0x41867a(0x183)];}}),_0xcf7c5f=_0x34dc01['rule'];_0x41fc9a={'description':_0x159c9c[_0x35065e(0xeb)],'rule':_0xcf7c5f};const _0x5388ad=serializeRule(_0xcf7c5f),_0xdaa8d8=_0x22d45f[_0x35065e(0x1bb)](_0x5388ad);if(_0xdaa8d8)_0x273208=_0xdaa8d8,_0x41fc9a=undefined,_0x38551e[_0x35065e(0xd5)]&&console[_0x35065e(0x12f)](_0x35065e(0x1c2)+_0x159c9c[_0x35065e(0x183)]+_0x35065e(0x16c)+_0xdaa8d8);else{let _0xca5927=![];if(_0x8e4fc7){const _0x2fa263=_0x8e4fc7[_0x35065e(0x1bb)](_0x5388ad);if(_0x2fa263){const _0xa78f37=_0x2fa263[_0x35065e(0x199)](_0x17a028=>!_0x4cafa5[_0x35065e(0x1d0)](_0x17a028));_0xa78f37&&(_0x273208=_0xa78f37,_0x4cafa5['add'](_0xa78f37),_0x22d45f['set'](_0x5388ad,_0xa78f37),_0xca5927=!![],_0x38551e[_0x35065e(0xd5)]&&console[_0x35065e(0x12f)](_0x35065e(0xdc)+_0xa78f37+'\x20(rule\x20match)'));}}if(!_0xca5927){const _0x5c0f08=generateJourneyLocalName(_0x159c9c[_0x35065e(0x183)]);_0x5c0f08&&(_0x273208=_0x5c0f08);let _0x3e5f9a=_0x273208,_0x3f2628=0x2;while(_0x4cafa5[_0x35065e(0x1d0)](_0x3e5f9a)){_0x3e5f9a=_0x273208+'_'+_0x3f2628,_0x3f2628++;}_0x4cafa5[_0x35065e(0x10c)](_0x3e5f9a),_0x22d45f[_0x35065e(0x128)](_0x5388ad,_0x3e5f9a),_0x273208=_0x3e5f9a;}}}const _0x4f2911={'name':_0x273208,'isJourneyLocal':_0x1205e0,'definition':_0x41fc9a};return _0x662e9['set'](_0x41b46d,_0x4f2911),_0x4f2911;}catch(_0x54629e){return _0x1f2bf8[_0x35065e(0xd5)]&&console[_0x35065e(0x12f)](_0x35065e(0x157)+_0x41b46d+':\x20'+_0x54629e['message']),{'name':_0x41b46d,'isJourneyLocal':![]};}},'resolveActivation':async _0x4a980c=>{const _0xefca61=_0x4199d4,_0x4d641a=_0x3c2cfb[_0xefca61(0x1bb)](_0x4a980c);if(_0x4d641a)return _0x4d641a;try{const _0x567493=await _0x2cc3db[_0xefca61(0x158)][_0xefca61(0x11c)](_0x5e5dd5['id'],_0x4a980c),_0x57d934=journeyActivationStepToYaml(_0x567493,_0x58cf7f,_0x3e3490),_0x587d46=JSON[_0xefca61(0x119)]({'name':_0x57d934[_0xefca61(0x183)],'connection':_0x57d934[_0xefca61(0x154)],'connector_config':_0x57d934['connector_config']}),_0x4eb545=_0x31d449[_0xefca61(0x1bb)](_0x587d46);if(_0x4eb545){const _0x5b3bbc={'name':_0x4eb545,'isJourneyLocal':!![],'definition':_0x57d934};return _0x3c2cfb['set'](_0x4a980c,_0x5b3bbc),_0x5b3bbc;}const _0xe1e8be=_0x567493[_0xefca61(0x1e8)][_0xefca61(0x174)]['name']||_0x4a980c,_0x29018c=sanitizeYamlKey(_0xe1e8be)||'activation_'+_0x4a980c;let _0x5ed469=_0x29018c,_0x4e4ed8=0x2;while(_0x39eab5['has'](_0x5ed469)){_0x5ed469=_0x29018c+'_'+_0x4e4ed8,_0x4e4ed8++;}_0x39eab5['add'](_0x5ed469),_0x31d449[_0xefca61(0x128)](_0x587d46,_0x5ed469);const _0x4c3171={'name':_0x5ed469,'isJourneyLocal':!![],'definition':_0x57d934};return _0x3c2cfb[_0xefca61(0x128)](_0x4a980c,_0x4c3171),_0x4c3171;}catch(_0x3f8c06){return _0x1f2bf8['verbose']&&console['error']('Warning:\x20Could\x20not\x20resolve\x20activation\x20'+_0x4a980c+':\x20'+_0x3f8c06['message']),{'name':_0x4a980c,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x5a89d4,_0x4db379)=>{const _0xd261bc=_0x4199d4;return resolveJumpTarget(_0x5a89d4,_0x4db379,_0x565a1f,_0x428f99=>_0x2cc3db['journey'][_0xd261bc(0xdd)](_0x428f99));}},_0x1b8240=await journeyResponseToDef(_0x521c79,_0x318228);_0xc800ad['push']({'item':_0x5e5dd5,'yaml':_0x1b8240});}},{'verbose':_0x1f2bf8[_0x2bbd20(0xd5)]});const _0x45d3b8=await _0x2cc3db[_0x2bbd20(0x158)][_0x2bbd20(0x1d6)](_0x171138[0x0]['journeyBundleId']),_0x4e1779=buildMergedJourneyDef(_0xc800ad,_0x8e4fc7,_0x45d3b8),_0x3f5e73=normalizeJourneyDef(_0x4e1779,_0x3c563b),_0x308285=toYamlString(_0x3f5e73),_0x5dd69c=_0x3d9972||a31_0x191789[_0x2bbd20(0x14b)](_0x5a4b1e,sanitizeFileName(_0x7cb0e4)+_0x2bbd20(0xda));!_0x3d9972&&_0x29c6da&&!existsSync(_0x5a4b1e)&&mkdirSync(_0x5a4b1e,{'recursive':!![]});const _0x49c208=a31_0x191789[_0x2bbd20(0x1ab)](process[_0x2bbd20(0xf2)](),_0x5dd69c);if(existsSync(_0x5dd69c)){const _0x4378e1=readFileSync(_0x5dd69c,'utf-8'),_0xda73ce=generateDiff(_0x4378e1,_0x308285),_0x2f950f=hasChanges(_0xda73ce);_0x739021[_0x2bbd20(0x1cc)]({'relativePath':_0x49c208,'absolutePath':_0x5dd69c,'content':_0x308285,'isNew':![],'hasChanges':_0x2f950f,'diff':_0x2f950f?formatDiffWithColors(_0xda73ce):undefined});}else _0x739021[_0x2bbd20(0x1cc)]({'relativePath':_0x49c208,'absolutePath':_0x5dd69c,'content':_0x308285,'isNew':!![],'hasChanges':![]});}const _0x1f5fa2=_0x739021[_0x2bbd20(0x117)](_0x5dfa13=>_0x5dfa13[_0x2bbd20(0x148)]),_0x8cbbe5=_0x739021['filter'](_0x431e82=>!_0x431e82[_0x2bbd20(0x148)]&&_0x431e82[_0x2bbd20(0x1dc)]),_0x5cbe51=_0x739021['filter'](_0x1fb560=>!_0x1fb560[_0x2bbd20(0x148)]&&!_0x1fb560[_0x2bbd20(0x1dc)]),_0x537018=_0x3dd968[_0x2bbd20(0x1ae)],_0x41f204=_0x82c1ed[_0x2bbd20(0x163)],_0x1c4baa=_0x537018>_0x41f204?'\x20('+_0x537018+_0x2bbd20(0xe4):'';console[_0x2bbd20(0x12f)](_0x2bbd20(0x1fa)),console[_0x2bbd20(0x12f)]('\x20\x20'+a31_0x42ca21[_0x2bbd20(0x104)](_0x41f204+_0x2bbd20(0xea))+a31_0x42ca21['dim'](_0x1c4baa)),console[_0x2bbd20(0x12f)]('\x20\x20'+a31_0x42ca21[_0x2bbd20(0x150)]('+\x20'+_0x1f5fa2[_0x2bbd20(0x1ae)]+'\x20new\x20files')),console[_0x2bbd20(0x12f)]('\x20\x20'+a31_0x42ca21[_0x2bbd20(0x153)]('~\x20'+_0x8cbbe5['length']+_0x2bbd20(0x118))),console[_0x2bbd20(0x12f)]('\x20\x20'+a31_0x42ca21[_0x2bbd20(0x167)]('=\x20'+_0x5cbe51[_0x2bbd20(0x1ae)]+_0x2bbd20(0x1a5))),console[_0x2bbd20(0x12f)](_0x2bbd20(0x197)+a31_0x42ca21[_0x2bbd20(0x104)](_0x4a34b6)+'\x0a');if(_0x8cbbe5['length']>0x0)for(const _0x587ebe of _0x8cbbe5){console['error']('\x0aChanges\x20to\x20\x27'+_0x587ebe[_0x2bbd20(0x185)]+'\x27:'),console[_0x2bbd20(0x12f)]('─'[_0x2bbd20(0x198)](0x3c)),console[_0x2bbd20(0x12f)](_0x587ebe['diff']),console[_0x2bbd20(0x12f)]('─'[_0x2bbd20(0x198)](0x3c));}if(_0x38551e['dryRun'])return console['error'](a31_0x42ca21[_0x2bbd20(0x153)](_0x2bbd20(0xe8))),0x0;if(_0x1f5fa2[_0x2bbd20(0x1ae)]===0x0&&_0x8cbbe5['length']===0x0)return console[_0x2bbd20(0x12f)](a31_0x42ca21[_0x2bbd20(0x150)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x2b27aa},_0x38551e[_0x2bbd20(0x125)]),console['error'](a31_0x42ca21['green'](_0x2bbd20(0x152)+a31_0x42ca21[_0x2bbd20(0x167)](_0x2bbd20(0x108))+_0x2bbd20(0x1b3)+a31_0x42ca21[_0x2bbd20(0x104)](_0x2b27aa))),0x0;if(!_0x38551e[_0x2bbd20(0x177)]&&(_0x1f5fa2['length']>0x0||_0x8cbbe5[_0x2bbd20(0x1ae)]>0x0)){if(!isInteractive())return console['error'](a31_0x42ca21[_0x2bbd20(0x1ff)](_0x2bbd20(0x10f)),_0x2bbd20(0x16f)),console[_0x2bbd20(0x12f)](a31_0x42ca21['dim'](_0x2bbd20(0x1d3))),0x1;const _0x12c5ae=await confirmKey(_0x2bbd20(0x13e)+(_0x1f5fa2[_0x2bbd20(0x1ae)]+_0x8cbbe5['length'])+_0x2bbd20(0xe9));if(!_0x12c5ae)return console['error'](a31_0x42ca21[_0x2bbd20(0x153)]('Aborted.'),_0x2bbd20(0x164)),0x1;}!existsSync(_0x4a34b6)&&mkdirSync(_0x4a34b6,{'recursive':!![]});const _0x40d6b8=a31_0x191789[_0x2bbd20(0x14b)](_0x4a34b6,_0x2bbd20(0x18e));writeFileSync(_0x40d6b8,createTdxConfigContent(_0x2b27aa),'utf-8');for(const _0x49d010 of _0x739021){(_0x49d010['isNew']||_0x49d010[_0x2bbd20(0x1dc)])&&writeFileSync(_0x49d010[_0x2bbd20(0x18c)],_0x49d010[_0x2bbd20(0xdb)],_0x2bbd20(0x159));}return console[_0x2bbd20(0x12f)](a31_0x42ca21[_0x2bbd20(0x150)](_0x2bbd20(0x1fc)+(_0x1f5fa2['length']+_0x8cbbe5[_0x2bbd20(0x1ae)])+'\x20journey\x20files\x20to\x20'+_0x4a34b6)),saveSessionContext({'parent_segment':_0x2b27aa},_0x38551e[_0x2bbd20(0x125)]),console[_0x2bbd20(0x12f)](a31_0x42ca21[_0x2bbd20(0x150)](_0x2bbd20(0x152)+a31_0x42ca21[_0x2bbd20(0x167)](_0x2bbd20(0x108))+_0x2bbd20(0x1b3)+a31_0x42ca21['cyan'](_0x2b27aa))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{[a31_0x44af6e(0x183)]=a31_0x44af6e(0x1a0);[a31_0x44af6e(0xeb)]=a31_0x44af6e(0x1d1);async[a31_0x44af6e(0x1a6)](_0xa7aaee){const _0x18ceb=a31_0x44af6e,{options:_0x1b5418,args:_0x1c8613,tdx:_0x48fff8}=_0xa7aaee,_0x5411e5=_0x1c8613[0x0];if(!requireNameOrPath(_0x5411e5))return 0x1;_0x1b5418[_0x18ceb(0xd5)]&&console[_0x18ceb(0x12f)](_0x18ceb(0xd6)+_0x5411e5);const {journeyId:_0xb9137f}=await resolveJourneyIdFromInput(_0x5411e5,_0x1b5418,_0x48fff8),_0x47e03b=await withSpinner(_0x18ceb(0x146),()=>_0x48fff8['journey']['getColumnMapping'](_0xb9137f),{'verbose':_0x1b5418[_0x18ceb(0xd5)]}),_0x509663=_0x47e03b[_0x18ceb(0x17c)];return console[_0x18ceb(0x1cb)]('Database:\x20'+_0x509663['database']),console[_0x18ceb(0x1cb)](_0x18ceb(0xdf)+_0x509663[_0x18ceb(0xfa)]),await handleSDKOutput(_0x509663[_0x18ceb(0x17f)],_0x1b5418),0x0;}}export class JourneyActivationsCommand extends BaseCommand{['name']='journey:activations';[a31_0x44af6e(0xeb)]=a31_0x44af6e(0xf6);async[a31_0x44af6e(0x1a6)](_0x41d021){const _0x11b523=a31_0x44af6e,{options:_0x44f32d,args:_0x3ad35b,tdx:_0x1c612e}=_0x41d021,_0x198a25=_0x3ad35b[0x0];if(!requireNameOrPath(_0x198a25))return 0x1;_0x44f32d['verbose']&&console[_0x11b523(0x12f)](_0x11b523(0xd6)+_0x198a25);const {journeyId:_0x26bcb8}=await resolveJourneyIdFromInput(_0x198a25,_0x44f32d,_0x1c612e),_0x16e1ce=await withSpinner(_0x11b523(0x182),()=>_0x1c612e[_0x11b523(0x158)][_0x11b523(0x11a)](_0x26bcb8),{'verbose':_0x44f32d['verbose']}),_0x47ec0b=_0x16e1ce['data'];return console['error']('Found\x20'+_0x47ec0b[_0x11b523(0x1ae)]+_0x11b523(0x15e)+(_0x47ec0b['length']!==0x1?'s':'')),await handleSDKOutput(_0x47ec0b,_0x44f32d),0x0;}}export class JourneyPushCommand extends BaseCommand{['name']=a31_0x44af6e(0x1d5);[a31_0x44af6e(0xeb)]=a31_0x44af6e(0x12d);[a31_0x44af6e(0x180)]=new SegmentPushCommand();async['execute'](_0x259df4){const _0x54572f=a31_0x44af6e,_0x6835b9=_0x259df4[_0x54572f(0x1b9)][0x0];let _0x5e9be0;if(_0x6835b9){const _0x301ac9=await resolveTarget({'arg':_0x6835b9,'contextParent':_0x259df4[_0x54572f(0x1d4)][_0x54572f(0xff)],'cwd':process['cwd']()});isSuccessfulResolution(_0x301ac9)&&_0x301ac9[_0x54572f(0x1ad)]===_0x54572f(0x1ee)&&(_0x5e9be0=_0x301ac9[_0x54572f(0x19d)]);}const _0x32f86c={..._0x259df4,'options':{..._0x259df4[_0x54572f(0x1d4)],'journeysOnly':!![],..._0x5e9be0&&{'singleFilePath':_0x5e9be0}}};return this[_0x54572f(0x180)]['execute'](_0x32f86c);}}export class JourneyVersionsCommand extends BaseCommand{[a31_0x44af6e(0x183)]=a31_0x44af6e(0x101);['description']=a31_0x44af6e(0x171);async['execute'](_0x297400){const _0x42c793=a31_0x44af6e,{options:_0x538181,args:_0x116ad4,tdx:_0x50003e}=_0x297400,_0x5a9e9a=_0x116ad4[0x0];if(!requireNameOrPath(_0x5a9e9a))return 0x1;if(_0x538181['verbose'])console['error']('Input:\x20'+_0x5a9e9a);const {journeyId:_0x26cfe7}=await resolveJourneyIdFromInput(_0x5a9e9a,_0x538181,_0x50003e),_0x329d94=await withSpinner(_0x42c793(0x1c1),()=>_0x50003e[_0x42c793(0x158)][_0x42c793(0x204)](_0x26cfe7),{'verbose':_0x538181['verbose']}),{bundleName:_0x3875e2,versions:_0x45f817,latestJourneyId:_0x3f2398}=_0x329d94[_0x42c793(0x17c)];console['error'](_0x3875e2+':\x20'+_0x45f817[_0x42c793(0x1ae)]+_0x42c793(0xd0)+(_0x45f817[_0x42c793(0x1ae)]!==0x1?'s':''));const _0x28edf1=_0x45f817[_0x42c793(0x192)](_0xaeab68=>({'version':_0xaeab68[_0x42c793(0x135)],'journey_id':_0xaeab68[_0x42c793(0x114)],'name':_0xaeab68['name'],'state':_0xaeab68['state'],'paused':_0xaeab68[_0x42c793(0x1f8)],'latest':_0xaeab68['journeyId']===_0x3f2398,'created_at':_0xaeab68[_0x42c793(0xf7)]}));return await handleSDKOutput(_0x28edf1,_0x538181),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{[a31_0x44af6e(0x183)]=a31_0x44af6e(0x116);[a31_0x44af6e(0xeb)]=a31_0x44af6e(0xd1);async[a31_0x44af6e(0x1a6)](_0x22b11d){const _0x3577b6=a31_0x44af6e,{options:_0x235eb3,args:_0x1dca59,tdx:_0x4243f7}=_0x22b11d,_0x44c42c=_0x1dca59[0x0];if(!requireNameOrPath(_0x44c42c))return 0x1;if(_0x235eb3[_0x3577b6(0xd5)])console[_0x3577b6(0x12f)](_0x3577b6(0xd6)+_0x44c42c);const {journeyId:_0x1240e8,journeyName:_0xf6ba67}=await resolveJourneyIdFromInput(_0x44c42c,_0x235eb3,_0x4243f7);if(!_0x235eb3[_0x3577b6(0x177)]){const _0x24d4c4=await confirm(_0x3577b6(0xd9)+_0xf6ba67+'\x22?');if(!_0x24d4c4)return console['error']('Cancelled'),0x0;}const _0x8cc40=await withSpinner(_0x3577b6(0xcf),()=>_0x4243f7[_0x3577b6(0x158)][_0x3577b6(0x186)](_0x1240e8),{'verbose':_0x235eb3[_0x3577b6(0xd5)]}),_0x402bfc=_0x8cc40['data'];return console['error'](a31_0x42ca21[_0x3577b6(0x150)]('\u2714')+_0x3577b6(0xfe)+_0x402bfc['attributes'][_0x3577b6(0x135)]+_0x3577b6(0x1bc)+_0x402bfc[_0x3577b6(0x1e8)]['name']+'\x22'),console[_0x3577b6(0x12f)](_0x3577b6(0x1dd)+_0x402bfc['id']),await handleSingleObjectOutput({'id':_0x402bfc['id'],'name':_0x402bfc[_0x3577b6(0x1e8)]['name'],'version':_0x402bfc['attributes']['versionNumber'],'state':_0x402bfc[_0x3577b6(0x1e8)][_0x3577b6(0x1ba)],'bundle_id':_0x402bfc[_0x3577b6(0x1e8)][_0x3577b6(0x19e)],'created_at':_0x402bfc[_0x3577b6(0x1e8)]['createdAt']},_0x235eb3),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a31_0x44af6e(0x183)]='journey:version:view';['description']=a31_0x44af6e(0x1a2);async[a31_0x44af6e(0x1a6)](_0x4e2044){const _0x4c17f1=a31_0x44af6e,{options:_0x3947ee,args:_0xf89201,tdx:_0xcd88d3}=_0x4e2044,_0x2624bb=_0xf89201[0x0];if(!requireNameOrPath(_0x2624bb))return 0x1;const _0x3cc4fd=_0x3947ee[_0x4c17f1(0x1e2)];if(!_0x3cc4fd)return console[_0x4c17f1(0x12f)](_0x4c17f1(0x16e)),console[_0x4c17f1(0x12f)](_0x4c17f1(0x1b0)),0x1;const _0x5a6028=parseInt(_0x3cc4fd,0xa);if(isNaN(_0x5a6028)||_0x5a6028<0x1)return console[_0x4c17f1(0x12f)]('Error:\x20Invalid\x20version\x20number:\x20'+_0x3cc4fd),0x1;if(_0x3947ee[_0x4c17f1(0xd5)])console[_0x4c17f1(0x12f)](_0x4c17f1(0xd6)+_0x2624bb+_0x4c17f1(0x1eb)+_0x5a6028);const {journeyId:_0x249160,parentSegmentId:_0x515eaf}=await resolveJourneyIdFromInput(_0x2624bb,_0x3947ee,_0xcd88d3),_0x273dbe=await withSpinner(_0x4c17f1(0x1b7),()=>_0xcd88d3[_0x4c17f1(0x158)]['listVersions'](_0x249160),{'verbose':_0x3947ee[_0x4c17f1(0xd5)]}),{versions:_0x36c769,latestJourneyId:_0x59f2d1}=_0x273dbe[_0x4c17f1(0x17c)],_0x24587b=_0x36c769[_0x4c17f1(0x199)](_0x4f91dd=>_0x4f91dd['versionNumber']===_0x5a6028);if(!_0x24587b){const _0x3f5eed=_0x36c769['map'](_0x33f0fd=>'v'+_0x33f0fd[_0x4c17f1(0x135)])[_0x4c17f1(0x14b)](',\x20');return console[_0x4c17f1(0x12f)](_0x4c17f1(0xec)+_0x5a6028+_0x4c17f1(0x14a)+_0x3f5eed),0x1;}const _0x481fae=await withSpinner('Getting\x20version\x20'+_0x5a6028+_0x4c17f1(0xd4),()=>_0xcd88d3['journey'][_0x4c17f1(0xdd)](_0x24587b[_0x4c17f1(0x114)]),{'verbose':_0x3947ee['verbose']}),_0x4d8c24=_0x481fae['data'],_0x3e134a=getConsoleNextUrl(_0x3947ee[_0x4c17f1(0x1b6)],_0x4c17f1(0x194)+_0x515eaf+_0x4c17f1(0x1e1)+_0x24587b[_0x4c17f1(0x114)]+_0x4c17f1(0x105));return await handleSingleObjectOutput({'id':_0x4d8c24['id'],'name':_0x4d8c24[_0x4c17f1(0x1e8)][_0x4c17f1(0x183)],'version':_0x4d8c24[_0x4c17f1(0x1e8)][_0x4c17f1(0x135)],'description':_0x4d8c24['attributes'][_0x4c17f1(0xeb)],'state':_0x4d8c24['attributes'][_0x4c17f1(0x1ba)],'paused':_0x4d8c24[_0x4c17f1(0x1e8)][_0x4c17f1(0x1f8)],'reentry_mode':_0x4d8c24[_0x4c17f1(0x1e8)][_0x4c17f1(0x165)],'stages':_0x4d8c24[_0x4c17f1(0x1e8)][_0x4c17f1(0x130)]?.[_0x4c17f1(0x1ae)]||0x0,..._0x4d8c24[_0x4c17f1(0x1e8)][_0x4c17f1(0x1a4)]&&{'goal':_0x4d8c24['attributes'][_0x4c17f1(0x1a4)][_0x4c17f1(0x183)]},'latest':_0x24587b[_0x4c17f1(0x114)]===_0x59f2d1,'created_at':_0x4d8c24[_0x4c17f1(0x1e8)][_0x4c17f1(0xf7)],'updated_at':_0x4d8c24[_0x4c17f1(0x1e8)][_0x4c17f1(0x13a)],'url':_0x3e134a},_0x3947ee),0x0;}}
1
+ const a31_0x2594d4=a31_0x4301;function a31_0x3016(){const _0x25f540=['\x20(rule\x20match)','Trigger\x20on-demand\x20workflow\x20execution\x20for\x20journey\x20\x22','🗺️\x20','Listing\x20journey\x20activations...','/e/','No\x20traffic\x20data\x20available\x20for\x20journey:\x20','completionRate','completed','Journey\x20name:\x20','journey','\x27\x20not\x20found\x20in\x20','resolveSegment','\x20\x20Consolidating\x20duplicate\x20segment:\x20','\x0aPull\x20summary:','Error:\x20Invalid\x20version\x20number:\x20','folderPath','📁\x20','\x0aError:','Fetching\x20','root\x20folder','resolveParentId','segments','INVALID_ARGUMENT','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','find','absolutePath','description','Available\x20stages:\x20','\x20details...','execute','setPhase','then','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','workflowId','options','Resolving\x20parent\x20segment...','getParentFull','workflowSessionId','Export\x20journey(s)\x20as\x20YAML\x20files','\x20Opening\x20','user','Warning:\x20Could\x20not\x20resolve\x20segment\x20','cyan','name','exitOrJumpSize','blue','\x20activation','journey:list','columns','\x20version','Show\x20journey\x20statistics','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','Pause\x20a\x20running\x20journey','Found\x20','segmentPushCommand','goalSize','status','(paused)','\x5c$&','journey:pause','journey:traffic','draft','\x20@\x20','utf-8','⚠️\x20','conversion','no\x20connection','exitOrJumpRate','journeyStages','\x20files?','state','5014614bWfNUy','buildIdToNameMap','milestoneSize','Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey','args','List\x20all\x20versions\x20of\x20a\x20journey','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x22\x20paused','segmentName','Listing\x20journeys...','\x20\x20-\x20','journeyBundleName','getTrafficData','versionNumber','map','goal','getLatestJourneyId','resourceName','size','red','renderStats','Resolved\x20YAML\x20file:\x20','connection','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','Error:\x20','Target\x20directory:\x20','458989YEaSci','has','launched','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Input:\x20','(unnamed)','9DbyfcU','Target\x20file:\x20','Fetching\x20journey\x20','runAt','error','message','filter','run','Table:\x20','scheduleType','journeyName','/app/ps/','.journey.yml','\x20\x20Folder\x20path:\x20','audienceId','relativePath','limit','\x20journey','Parent\x20segment:\x20','✔\x20Context\x20set:\x20','dim','(running)','test','paused','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','\x20=\x20','green','listVersions','✔\x20Found\x20','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','session','Folder\x20path:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','rule','16088570izoCkr','activation_','toLowerCase','getJourney','/j/da/je','4knxNPO','folderId','Listing\x20journey\x20versions...','pausedAt','Getting\x20journey\x20statistics...','listJourneysFromParentSegment','View\x20a\x20specific\x20version\x20of\x20a\x20journey','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','Error:\x20Version\x20','Warning:\x20Could\x20not\x20resolve\x20activation\x20','Show\x20journey\x20details','11309160PtRGmY','add','diff','Error:\x20Stage\x20\x22','Triggering\x20journey\x20workflow...','Write\x20','\x22\x20resumed','journey:push','2cYifRU','journey:pull','journey:columns','site','join','Fetching\x20journeys\x20and\x20folders...','createdAt','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','Resolving\x20journey...','segment','Journey:','log','\x0a[Dry\x20run]\x20Journey\x20was\x20NOT\x20resumed.','-\x20no\x20files\x20written','enteredSize','journey:versions','sort','stage','Aborted.','(draft)','attributes','tdx.json','set','verbose','Error:\x20Parent\x20segment\x20context\x20required','updatedAt','resume','Stages:','/j/da','file','yes','connectionId','get','Show\x20journey\x20table\x20column\x20mapping','format','ID:','6848004pzywPU','\x0a[Dry\x20run]\x20Journey\x20workflow\x20was\x20NOT\x20triggered.','dryRun','\x20\x20Preserving\x20local\x20segment\x20name:\x20','yellow','executeDryRun','getColumnMapping','connection\x20','content','Paused:','reentryMode','rootFolderId',',\x20schedule:\x20','cwd','(none)','\x20\x20Name:\x20','Getting\x20journey\x20traffic\x20data...','✔\x20Journey\x20\x22','entries','stages','getSegment','buildIdToEmailMap','\x20\x20←\x20','Fetching\x20users\x20and\x20connections...','kind','helpText','no_parent','Error:\x20Journey\x20not\x20found:\x20','push','\x20journeys','List\x20journeys\x20in\x20current\x20context','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','json','listJourneysWithFolders','parentName','hasChanges','includeHistory','data','stringify','Resume\x20a\x20paused\x20journey','version','folders','activation','journey:resume','all','\x20\x20Parent\x20segment:\x20','journey:stats','Resuming\x20journey...','\x20changed\x20files','length','base',',\x20version:\x20','parent_segment','Pausing\x20journey...','isNew','jsonl','journeyId','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','localeCompare','Options:','links','journeyBundleId','State:','hasPeriod','parentSegment','Getting\x20journey\x20details...','type','\x20not\x20found.\x20Available:\x20','\x20versions)','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)','filePath','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','history','\x20\x20Journey\x20ID:\x20','\x0aChanges\x20to\x20\x27','2435120EdXvkP','createVersion','(root)','11lOeDva','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','(completed)','...','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','listActivationsFlat','474eCzOXZ','\x20Created\x20v','pause','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','runAfterJourneyRefresh','\x20journey\x20files\x20to\x20','Error:\x20Journey\x20\x27','completeMilestoneRate','No\x20journeys\x20found','Activations:','database','✔\x20All\x20files\x20are\x20up\x20to\x20date','connector_config','none','journey:activations','\x20unchanged\x20files','Error:\x20--version\x20option\x20is\x20required','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','getStatistics','archived','table','bold','Cancelled','nodes','75929mpMOcg','values','split','from','repeat'];a31_0x3016=function(){return _0x25f540;};return a31_0x3016();}(function(_0x27cbdf,_0x365ffb){const _0x49c6f1=a31_0x4301,_0x1a2be2=_0x27cbdf();while(!![]){try{const _0x10fe4f=parseInt(_0x49c6f1(0x2bd))/0x1*(parseInt(_0x49c6f1(0x2fd))/0x2)+-parseInt(_0x49c6f1(0x2a3))/0x3*(parseInt(_0x49c6f1(0x2ea))/0x4)+parseInt(_0x49c6f1(0x236))/0x5+-parseInt(_0x49c6f1(0x23f))/0x6*(-parseInt(_0x49c6f1(0x257))/0x7)+parseInt(_0x49c6f1(0x2f5))/0x8*(-parseInt(_0x49c6f1(0x2c3))/0x9)+parseInt(_0x49c6f1(0x2e5))/0xa+parseInt(_0x49c6f1(0x239))/0xb*(parseInt(_0x49c6f1(0x1eb))/0xc);if(_0x10fe4f===_0x365ffb)break;else _0x1a2be2['push'](_0x1a2be2['shift']());}catch(_0x5c1ed9){_0x1a2be2['push'](_0x1a2be2['shift']());}}}(a31_0x3016,0xdb0f3));import a31_0xbf56a2 from'chalk';import a31_0x28469a 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,getWorkflowSessionUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function a31_0x4301(_0x4b3ea5,_0x229006){_0x4b3ea5=_0x4b3ea5-0x1d8;const _0x30161e=a31_0x3016();let _0x4301aa=_0x30161e[_0x4b3ea5];return _0x4301aa;}function requireNameOrPath(_0x2a37a0){const _0x128598=a31_0x4301;return!_0x2a37a0&&(console[_0x128598(0x2c7)](_0x128598(0x2db)),console['error']('Usage:\x20journey\x20<subcommand>\x20<name-or-path>')),!!_0x2a37a0;}function withJsonFormat(_0x198d55){const _0xcac120=a31_0x4301;if(!_0x198d55[_0xcac120(0x1e9)]&&!_0x198d55['json']&&!_0x198d55[_0xcac120(0x222)]&&!_0x198d55['tsv'])return{..._0x198d55,'format':'json','json':!![]};return _0x198d55;}function formatJourneyState(_0x58e88b){const _0x1643d6=a31_0x4301;switch(_0x58e88b){case _0x1643d6(0x2bf):return a31_0xbf56a2[_0x1643d6(0x2dd)](_0x1643d6(0x2d8));case _0x1643d6(0x299):return a31_0xbf56a2[_0x1643d6(0x2d7)](_0x1643d6(0x1da));case'paused':return a31_0xbf56a2['yellow'](_0x1643d6(0x295));case _0x1643d6(0x263):return a31_0xbf56a2[_0x1643d6(0x289)](_0x1643d6(0x23b));case _0x1643d6(0x252):return a31_0xbf56a2[_0x1643d6(0x2d7)]('(archived)');default:return'('+_0x58e88b+')';}}function formatJourneyItem(_0x195779,_0x4c5936='',_0x2066d7){const _0x4e3091=a31_0x4301,_0x185fdf=formatJourneyState(_0x195779['state']),_0x6260d5=_0x2066d7?hyperlink(_0x195779['journeyBundleName'],_0x2066d7):_0x195779[_0x4e3091(0x2ae)];return _0x4c5936+_0x4e3091(0x25e)+_0x6260d5+'\x20'+_0x185fdf;}function escapeRegex(_0x48575e){const _0x15b59e=a31_0x4301;return _0x48575e['replace'](/[.*+?^${}()|[\]\\]/g,_0x15b59e(0x296));}function globToRegex(_0x397f3d){const _0x4184c0=a31_0x4301,_0x5b204b=_0x397f3d[_0x4184c0(0x259)]('*')[_0x4184c0(0x2b1)](escapeRegex);return new RegExp(_0x5b204b[_0x4184c0(0x301)]('.*'),'i');}function buildRuleToNameMapping(_0x4cb5ec){const _0x1d8a1c=a31_0x4301,_0x496478=new Map();if(_0x4cb5ec[_0x1d8a1c(0x271)])for(const [_0xd87c8,_0x5eb9fb]of Object[_0x1d8a1c(0x1fd)](_0x4cb5ec['segments'])){if(_0x5eb9fb[_0x1d8a1c(0x2e4)]){const _0x3e757c=serializeRule(_0x5eb9fb[_0x1d8a1c(0x2e4)]),_0x3f437b=_0x496478[_0x1d8a1c(0x1e7)](_0x3e757c);_0x3f437b?_0x3f437b[_0x1d8a1c(0x207)](_0xd87c8):_0x496478[_0x1d8a1c(0x1dd)](_0x3e757c,[_0xd87c8]);}}return _0x496478;}async function resolveJourneyIdFromInput(_0x33bf31,_0x230bb9,_0x351c29){const _0x2c3861=a31_0x4301,_0x481b1c=await resolveJourneyTarget(_0x33bf31,_0x230bb9['parentSegment'],_0x230bb9[_0x2c3861(0x1de)]),_0x317a97=_0x481b1c[_0x2c3861(0x22b)];if(!_0x317a97)throw new SDKError(ErrorCode[_0x2c3861(0x272)],'Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');const _0x55d745=await withSpinner(_0x2c3861(0x27f),()=>_0x351c29['segment'][_0x2c3861(0x270)](_0x317a97),{'verbose':_0x230bb9[_0x2c3861(0x1de)]}),_0x5c546f=_0x55d745[_0x2c3861(0x210)],_0x185062=await withSpinner(_0x2c3861(0x305),()=>_0x351c29[_0x2c3861(0x265)]['resolveJourneyId'](_0x5c546f,_0x481b1c[_0x2c3861(0x2cd)]),{'verbose':_0x230bb9[_0x2c3861(0x1de)]});return{'journeyId':_0x185062[_0x2c3861(0x210)],'journeyName':_0x481b1c[_0x2c3861(0x2cd)],'parentSegmentId':_0x5c546f};}async function resolveJourneyTarget(_0x16e833,_0x21748e,_0x1a2e7b){const _0x212386=a31_0x4301;if(isYamlFilePath(_0x16e833))try{const _0x39383c=await resolveYamlFilePath(_0x16e833);return _0x1a2e7b&&(console[_0x212386(0x2c7)](_0x212386(0x2b8)+_0x16e833),console['error'](_0x212386(0x218)+_0x39383c['parentSegment']),console[_0x212386(0x2c7)](_0x212386(0x1fa)+_0x39383c[_0x212386(0x2ab)]),console[_0x212386(0x2c7)](_0x212386(0x2d0)+(_0x39383c[_0x212386(0x26b)]||_0x212386(0x238)))),{'journeyName':_0x39383c[_0x212386(0x2ab)],'parentSegment':_0x39383c[_0x212386(0x22b)],'resolved':_0x39383c};}catch(_0x5ed9a3){throw new SDKError(ErrorCode[_0x212386(0x272)],_0x212386(0x27c)+_0x5ed9a3[_0x212386(0x2c8)]);}if(!_0x21748e)throw new SDKError(ErrorCode[_0x212386(0x272)],_0x212386(0x2c0));return{'journeyName':_0x16e833,'parentSegment':_0x21748e};}export class JourneyListCommand extends BaseCommand{['name']=a31_0x2594d4(0x28b);[a31_0x2594d4(0x276)]=a31_0x2594d4(0x209);async[a31_0x2594d4(0x279)](_0x12a9e6){const _0x449138=a31_0x2594d4,{options:_0x24afa2,args:_0x435c1b,tdx:_0x3b2afa}=_0x12a9e6,_0x7ffe3e=_0x435c1b[0x0],_0xd5a9b4=_0x24afa2[_0x449138(0x22b)];if(!_0xd5a9b4)return console[_0x449138(0x2c7)](_0x449138(0x1df)),console[_0x449138(0x2c7)](_0x449138(0x250)),0x1;const _0x1d03a3=await withSpinner(_0x449138(0x27f),()=>_0x3b2afa[_0x449138(0x306)][_0x449138(0x270)](_0xd5a9b4),{'verbose':_0x24afa2[_0x449138(0x1de)]}),_0x4a3739=_0x1d03a3['data'];_0x24afa2['verbose']&&(console[_0x449138(0x2c7)](_0x449138(0x2d5)+_0xd5a9b4+'\x20(ID:\x20'+_0x4a3739+')'),_0x7ffe3e&&console[_0x449138(0x2c7)]('Pattern:\x20'+_0x7ffe3e));const _0x4a81d3=await withSpinner('Fetching\x20parent\x20segment...',()=>_0x3b2afa['segment'][_0x449138(0x280)](_0x4a3739),{'verbose':_0x24afa2['verbose']}),_0x287b03=_0x4a81d3[_0x449138(0x210)],_0x194308=_0x287b03[_0x449138(0x1f6)],_0x3bcbca=await withSpinner(_0x449138(0x2ac),()=>_0x3b2afa['journey'][_0x449138(0x20c)](_0x4a3739,_0x194308),{'verbose':_0x24afa2[_0x449138(0x1de)]});let _0x1de31c=_0x3bcbca['data']['journeys'];const _0x470793=_0x3bcbca['data'][_0x449138(0x214)],_0x3c9dd0=new Map();for(const _0x49b097 of _0x470793){_0x3c9dd0['set'](_0x49b097['id'],_0x49b097[_0x449138(0x287)]);}if(_0x7ffe3e){const _0x3010b6=globToRegex(_0x7ffe3e);_0x1de31c=_0x1de31c[_0x449138(0x2c9)](_0xdde874=>_0x3010b6[_0x449138(0x2d9)](_0xdde874[_0x449138(0x2ae)]));}console[_0x449138(0x2c7)](_0x449138(0x2df)+_0x1de31c[_0x449138(0x21c)]+_0x449138(0x2d4)+(_0x1de31c[_0x449138(0x21c)]!==0x1?'s':''));const _0x2f5baf=_0x4e415e=>{const _0x19dd09=_0x449138;return getConsoleNextUrl(_0x24afa2[_0x19dd09(0x300)],'/app/ps/'+_0x4a3739+'/e/'+_0x4e415e+_0x19dd09(0x1e3));};if(_0x24afa2['format']===_0x449138(0x253))await handleSDKOutput(_0x1de31c,_0x24afa2);else{if(_0x24afa2[_0x449138(0x1e9)]==='json'){const _0x5d942f=_0x1de31c['map'](_0x132eda=>({..._0x132eda,'url':_0x2f5baf(_0x132eda['id'])}));await handleSDKOutput(_0x5d942f,_0x24afa2);}else{console['log']('['+_0xd5a9b4+']');const _0x3b04ba=new Map(),_0x459cbc=[];for(const _0x140702 of _0x1de31c){if(!_0x140702[_0x449138(0x2eb)]||_0x140702[_0x449138(0x2eb)]===_0x194308)_0x459cbc['push'](_0x140702);else{const _0x1fbfa7=_0x3b04ba[_0x449138(0x1e7)](_0x140702[_0x449138(0x2eb)])||[];_0x1fbfa7[_0x449138(0x207)](_0x140702),_0x3b04ba[_0x449138(0x1dd)](_0x140702[_0x449138(0x2eb)],_0x1fbfa7);}}const _0xe6f00a=(_0x3799a4,_0x5039a2)=>_0x3799a4['journeyBundleName'][_0x449138(0x225)](_0x5039a2[_0x449138(0x2ae)],undefined,{'sensitivity':'base'});_0x459cbc[_0x449138(0x30d)](_0xe6f00a);for(const _0x1eff76 of _0x459cbc){console['log'](formatJourneyItem(_0x1eff76,'',_0x2f5baf(_0x1eff76['id'])));}const _0x15d3e2=[..._0x3b04ba['entries']()][_0x449138(0x30d)]((_0x23d6a4,_0x57bfc1)=>{const _0x126f58=_0x449138,_0x54ba12=_0x3c9dd0[_0x126f58(0x1e7)](_0x23d6a4[0x0])||_0x23d6a4[0x0],_0x486752=_0x3c9dd0['get'](_0x57bfc1[0x0])||_0x57bfc1[0x0];return _0x54ba12['localeCompare'](_0x486752,undefined,{'sensitivity':_0x126f58(0x21d)});});for(const [_0x53a941,_0x4178dd]of _0x15d3e2){const _0x4ad47e=_0x3c9dd0['get'](_0x53a941)||_0x53a941;console['log'](_0x449138(0x26c)+_0x4ad47e),_0x4178dd[_0x449138(0x30d)](_0xe6f00a);for(const _0x3ad692 of _0x4178dd){console[_0x449138(0x308)](formatJourneyItem(_0x3ad692,'\x20\x20',_0x2f5baf(_0x3ad692['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{['name']='journey:view';[a31_0x2594d4(0x276)]=a31_0x2594d4(0x2f4);async[a31_0x2594d4(0x279)](_0x251069){const _0x198b27=a31_0x2594d4,{options:_0x28de68,args:_0x6375bb,tdx:_0x26f7dc}=_0x251069,_0x25061d=_0x6375bb[0x0];if(!_0x25061d)return console[_0x198b27(0x2c7)](_0x198b27(0x2db)),console['error']('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x198b27(0x2c7)](_0x198b27(0x226)),console['error'](_0x198b27(0x20a)),0x1;_0x28de68[_0x198b27(0x1de)]&&console[_0x198b27(0x2c7)](_0x198b27(0x2c1)+_0x25061d);const {journeyId:_0x2b7f79,parentSegmentId:_0x360f9a}=await resolveJourneyIdFromInput(_0x25061d,_0x28de68,_0x26f7dc);if(_0x28de68['web']){const _0x3235a2=getConsoleNextUrl(_0x28de68[_0x198b27(0x300)],_0x198b27(0x2ce)+_0x360f9a+'/e/'+_0x2b7f79+_0x198b27(0x2e9));return console['error'](a31_0xbf56a2['green']('✔')+_0x198b27(0x283)+a31_0xbf56a2[_0x198b27(0x286)](_0x3235a2)),openBrowser(_0x3235a2),0x0;}const _0x2b9ebc=await withSpinner(_0x198b27(0x22c),()=>_0x26f7dc[_0x198b27(0x265)]['getJourney'](_0x2b7f79),{'verbose':_0x28de68[_0x198b27(0x1de)]}),_0xf45ce3=_0x2b9ebc['data'],_0xffc753=_0x28de68['includeStats'];let _0x3fc6bd;if(_0xffc753)try{const _0x2a5aee=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x26f7dc[_0x198b27(0x265)]['getStatistics'](_0x2b7f79),{'verbose':_0x28de68['verbose']});_0x3fc6bd=_0x2a5aee[_0x198b27(0x210)];}catch{_0x28de68[_0x198b27(0x1de)]&&console[_0x198b27(0x2c7)]('\x20\x20Statistics\x20not\x20available');}const _0x2b23de=getConsoleNextUrl(_0x28de68[_0x198b27(0x300)],_0x198b27(0x2ce)+_0x360f9a+_0x198b27(0x260)+_0x2b7f79+_0x198b27(0x2e9)),_0x5ce28d={'id':_0xf45ce3['id'],'name':_0xf45ce3['attributes'][_0x198b27(0x287)],'description':_0xf45ce3[_0x198b27(0x1db)][_0x198b27(0x276)],'state':_0xf45ce3['attributes']['state'],'paused':_0xf45ce3[_0x198b27(0x1db)][_0x198b27(0x2da)],'reentry_mode':_0xf45ce3[_0x198b27(0x1db)][_0x198b27(0x1f5)],'stages':_0xf45ce3[_0x198b27(0x1db)][_0x198b27(0x2a0)]?.[_0x198b27(0x21c)]||0x0,..._0xf45ce3[_0x198b27(0x1db)][_0x198b27(0x2b2)]&&{'goal':_0xf45ce3[_0x198b27(0x1db)][_0x198b27(0x2b2)]['name']},..._0x3fc6bd&&{'statistics':{'size':_0x3fc6bd['size'],'entered':_0x3fc6bd['enteredSize'],'goal_achieved':_0x3fc6bd[_0x198b27(0x293)],'completion_rate':_0x3fc6bd[_0x198b27(0x262)],'exit_or_jump':_0x3fc6bd[_0x198b27(0x288)],'exit_or_jump_rate':_0x3fc6bd[_0x198b27(0x29f)],'stages':_0x3fc6bd[_0x198b27(0x1fe)]}},'url':_0x2b23de};return await handleSingleObjectOutput(_0x5ce28d,_0x28de68),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a31_0x2594d4(0x287)]=a31_0x2594d4(0x219);[a31_0x2594d4(0x276)]=a31_0x2594d4(0x28e);async['execute'](_0x3c3279){const _0x102b9a=a31_0x2594d4,{options:_0x3c3080,args:_0x4c4ece,tdx:_0xd73c89}=_0x3c3279,_0x174c48=_0x4c4ece[0x0];if(!requireNameOrPath(_0x174c48))return 0x1;_0x3c3080[_0x102b9a(0x1de)]&&console['error']('Input:\x20'+_0x174c48);const _0x3c201e=_0x3c3080,_0x4115ec=_0x3c201e['from'],_0x19266b=_0x3c201e['to'],_0x1f0544=_0x3c201e[_0x102b9a(0x20f)],_0x3bec03=_0x3c201e[_0x102b9a(0x1d8)];_0x1f0544&&!_0x4115ec&&!_0x19266b&&console[_0x102b9a(0x2c7)]('Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history');const _0x3d5a92=_0x1f0544?withJsonFormat(_0x3c3080):_0x3c3080,{journeyId:_0x3a269e,journeyName:_0x15ca3c}=await resolveJourneyIdFromInput(_0x174c48,_0x3d5a92,_0xd73c89),_0x43962f=_0x4115ec||_0x19266b?{'from':_0x4115ec,'to':_0x19266b}:undefined,_0x5dcf5a=await withSpinner(_0x102b9a(0x2ee),()=>Promise[_0x102b9a(0x217)]([_0xd73c89[_0x102b9a(0x265)]['getJourney'](_0x3a269e),_0xd73c89['journey'][_0x102b9a(0x251)](_0x3a269e,_0x43962f)]),{'verbose':_0x3d5a92['verbose']}),[_0x5e83a4,_0x1018c4]=_0x5dcf5a[_0x102b9a(0x210)];if(!_0x1018c4||_0x1018c4['journeyId']===null)return console[_0x102b9a(0x2c7)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x15ca3c),console[_0x102b9a(0x2c7)]('Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),0x0;const _0x5b7c0d=buildStageNameMap(_0x5e83a4),_0xc8ae7b=!!(_0x43962f&&_0x1018c4['history']?.[_0x102b9a(0x21c)]),_0x593dbd={'stageNameMap':_0x5b7c0d,'hasPeriod':_0xc8ae7b,'includeHistory':!!_0x1f0544};if(_0x3bec03&&_0x1018c4[_0x102b9a(0x1fe)]){const _0x4fefc5=_0x1018c4[_0x102b9a(0x1fe)][_0x102b9a(0x274)](_0x2e3495=>{const _0x112af6=_0x5b7c0d['get'](_0x2e3495['id'])??'';return _0x112af6['toLowerCase']()===_0x3bec03['toLowerCase']();});if(_0x4fefc5)return await handleSingleObjectOutput(formatStageStats(_0x4fefc5,_0x593dbd),_0x3d5a92),0x0;const _0xfbca7b=_0x1018c4[_0x102b9a(0x1fe)][_0x102b9a(0x2b1)](_0x382d94=>_0x5b7c0d[_0x102b9a(0x1e7)](_0x382d94['id'])??_0x382d94['id']);return console[_0x102b9a(0x2c7)](_0x102b9a(0x2f8)+_0x3bec03+'\x22\x20not\x20found'),console[_0x102b9a(0x2c7)](_0x102b9a(0x277)+_0xfbca7b[_0x102b9a(0x301)](',\x20')),0x1;}const _0x55d051=_0x1018c4[_0x102b9a(0x1fe)]?.[_0x102b9a(0x2b1)](_0x36eb90=>formatStageStats(_0x36eb90,_0x593dbd)),_0x4e826d=assembleJourneyStats(_0x1018c4,{'from':_0x4115ec,'to':_0x19266b,'includeHistory':_0x1f0544});return await this[_0x102b9a(0x2b7)](_0x4e826d,_0x55d051??[],_0x3d5a92),0x0;}async['renderStats'](_0x46d715,_0xabe0dc,_0x7de9c8){const _0x5ddab9=a31_0x2594d4,_0x1f3281=_0x7de9c8[_0x5ddab9(0x1e9)]===_0x5ddab9(0x20b)||_0x7de9c8[_0x5ddab9(0x1e9)]==='jsonl'||_0x7de9c8[_0x5ddab9(0x20b)]||_0x7de9c8[_0x5ddab9(0x222)];if(_0x1f3281){_0x46d715['stages']=_0xabe0dc,await handleSingleObjectOutput(_0x46d715,_0x7de9c8);return;}await handleSingleObjectOutput(_0x46d715,_0x7de9c8);for(const _0x48f3c4 of _0xabe0dc){console['log'](''),console[_0x5ddab9(0x308)](String(a31_0xbf56a2[_0x5ddab9(0x286)]['bold']('['+_0x48f3c4['name']+']'))+a31_0xbf56a2[_0x5ddab9(0x2d7)]('\x20'+_0x48f3c4['id']));const {id:_0x4404f1,name:_0x3111cd,..._0x6c8625}=_0x48f3c4;await handleSingleObjectOutput(_0x6c8625,_0x7de9c8);}}}export class JourneyTrafficCommand extends BaseCommand{[a31_0x2594d4(0x287)]=a31_0x2594d4(0x298);[a31_0x2594d4(0x276)]=a31_0x2594d4(0x273);async[a31_0x2594d4(0x279)](_0x5d67f1){const _0x41bd4f=a31_0x2594d4,{options:_0x111d20,args:_0x2ca0a1,tdx:_0x33c29c}=_0x5d67f1,_0x1905b3=_0x2ca0a1[0x0];if(!requireNameOrPath(_0x1905b3))return 0x1;_0x111d20['verbose']&&console['error'](_0x41bd4f(0x2c1)+_0x1905b3);const _0x546d24=_0x111d20,_0x18253d=_0x546d24[_0x41bd4f(0x22d)],_0x5d0fcb=_0x546d24[_0x41bd4f(0x25a)],_0x472a59=_0x546d24['to'],_0x33746d=_0x546d24[_0x41bd4f(0x2d3)];if(_0x18253d&&_0x18253d!==_0x41bd4f(0x29d)&&_0x18253d!==_0x41bd4f(0x215))return console[_0x41bd4f(0x2c7)]('Error:\x20Invalid\x20--type\x20\x22'+_0x18253d+'\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.'),0x1;const _0x21d313=withJsonFormat(_0x111d20),{journeyId:_0x4d73cb,journeyName:_0x3f2268}=await resolveJourneyIdFromInput(_0x1905b3,_0x21d313,_0x33c29c),_0x9e779b={'type':_0x18253d,'from':_0x5d0fcb,'to':_0x472a59,'limit':_0x33746d},_0x11ce8a=await withSpinner(_0x41bd4f(0x1fb),()=>_0x33c29c[_0x41bd4f(0x265)][_0x41bd4f(0x2af)](_0x4d73cb,_0x9e779b),{'verbose':_0x21d313[_0x41bd4f(0x1de)]}),_0x4d73f8=_0x11ce8a[_0x41bd4f(0x210)],_0x555eb2=_0x4d73f8[_0x41bd4f(0x29d)]&&(_0x4d73f8[_0x41bd4f(0x29d)][_0x41bd4f(0x256)][_0x41bd4f(0x21c)]>0x0||_0x4d73f8[_0x41bd4f(0x29d)][_0x41bd4f(0x227)][_0x41bd4f(0x21c)]>0x0),_0x4e8666=_0x4d73f8['activation']&&_0x4d73f8['activation'][_0x41bd4f(0x21c)]>0x0;if(!_0x555eb2&&!_0x4e8666)return console[_0x41bd4f(0x2c7)](_0x41bd4f(0x261)+_0x3f2268),console[_0x41bd4f(0x2c7)](_0x41bd4f(0x23a)),_0x5d0fcb&&_0x472a59&&console[_0x41bd4f(0x2c7)]('If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).'),0x0;return await handleSingleObjectOutput(_0x4d73f8,_0x21d313),0x0;}}function formatStageStats(_0x4c62b3,_0x3db407){const _0x1b0f2a=a31_0x2594d4,_0x2a255c=_0x3db407[_0x1b0f2a(0x22a)]&&_0x4c62b3[_0x1b0f2a(0x233)]?.[_0x1b0f2a(0x21c)]?aggregateStageHistory(_0x4c62b3[_0x1b0f2a(0x233)]):{'size':_0x4c62b3[_0x1b0f2a(0x2b5)],'entered':_0x4c62b3[_0x1b0f2a(0x30b)],'milestone':_0x4c62b3[_0x1b0f2a(0x2a5)],'milestone_rate':_0x4c62b3[_0x1b0f2a(0x246)],'exit_or_jump':_0x4c62b3['exitOrJumpSize'],'exit_or_jump_rate':_0x4c62b3[_0x1b0f2a(0x29f)]},_0x21e674={'id':_0x4c62b3['id'],'name':_0x3db407['stageNameMap'][_0x1b0f2a(0x1e7)](_0x4c62b3['id'])??_0x4c62b3['id'],..._0x2a255c};return _0x3db407[_0x1b0f2a(0x22a)]&&_0x3db407['includeHistory']&&_0x4c62b3['history']&&(_0x21e674[_0x1b0f2a(0x233)]=_0x4c62b3['history']),_0x21e674;}export class JourneyPauseCommand extends BaseCommand{[a31_0x2594d4(0x287)]=a31_0x2594d4(0x297);[a31_0x2594d4(0x276)]=a31_0x2594d4(0x290);async[a31_0x2594d4(0x279)](_0x1ae706){const _0x1054cb=a31_0x2594d4,{options:_0x18e3b1,args:_0x50dbf1,tdx:_0x4145c3}=_0x1ae706,_0x52cdcf=_0x50dbf1[0x0];if(!requireNameOrPath(_0x52cdcf))return 0x1;_0x18e3b1[_0x1054cb(0x1de)]&&console[_0x1054cb(0x2c7)](_0x1054cb(0x2c1)+_0x52cdcf);const {journeyId:_0xe05ba9,journeyName:_0x453a2a}=await resolveJourneyIdFromInput(_0x52cdcf,_0x18e3b1,_0x4145c3);if(!_0x18e3b1[_0x1054cb(0x1e5)]){const _0x40eeec=await confirm(_0x1054cb(0x2f1)+_0x453a2a+'\x22?');if(!_0x40eeec)return console['error']('Cancelled'),0x0;}const _0x5a1e54=await withSpinner(_0x1054cb(0x220),()=>_0x4145c3[_0x1054cb(0x265)][_0x1054cb(0x241)](_0xe05ba9),{'verbose':_0x18e3b1[_0x1054cb(0x1de)]}),_0x371fb6=_0x5a1e54[_0x1054cb(0x210)];return console[_0x1054cb(0x2c7)]('✔\x20Journey\x20\x22'+_0x371fb6[_0x1054cb(0x1db)]['name']+_0x1054cb(0x2aa)),0x0;}}export class JourneyRunCommand extends BaseCommand{[a31_0x2594d4(0x287)]='journey:run';['description']='Trigger\x20on-demand\x20journey\x20workflow\x20execution';async[a31_0x2594d4(0x279)](_0x59d950){const _0x5cb6ee=a31_0x2594d4,{options:_0x8e7183,args:_0x1dd963,tdx:_0xe6a8b4}=_0x59d950,_0x2bcb7a=_0x1dd963[0x0];if(!requireNameOrPath(_0x2bcb7a))return 0x1;_0x8e7183['verbose']&&console[_0x5cb6ee(0x2c7)](_0x5cb6ee(0x2c1)+_0x2bcb7a);const {journeyId:_0x4d6791,journeyName:_0x514d8e}=await resolveJourneyIdFromInput(_0x2bcb7a,_0x8e7183,_0xe6a8b4);if(_0x8e7183['dryRun'])return await this[_0x5cb6ee(0x1f0)](_0x59d950,_0x4d6791,_0x514d8e);if(!_0x8e7183['yes']){const _0x2c0c03=await confirm(_0x5cb6ee(0x25d)+_0x514d8e+'\x22?');if(!_0x2c0c03)return console[_0x5cb6ee(0x2c7)](_0x5cb6ee(0x255)),0x0;}const _0x204775=await withSpinner(_0x5cb6ee(0x2f9),()=>_0xe6a8b4[_0x5cb6ee(0x265)][_0x5cb6ee(0x2ca)](_0x4d6791),{'verbose':_0x8e7183[_0x5cb6ee(0x1de)]}),_0x2a5407=_0x204775[_0x5cb6ee(0x210)],_0x37f41d=getWorkflowSessionUrl(_0x8e7183[_0x5cb6ee(0x300)],_0x2a5407[_0x5cb6ee(0x27d)],_0x2a5407[_0x5cb6ee(0x281)]);return console[_0x5cb6ee(0x2c7)]('\x0a'+a31_0xbf56a2[_0x5cb6ee(0x2dd)]('✔')+'\x20Journey\x20workflow\x20started'),console[_0x5cb6ee(0x2c7)]('\x20\x20'+a31_0xbf56a2[_0x5cb6ee(0x2d7)](_0x5cb6ee(0x307))+'\x20'+_0x514d8e),console['error']('\x20\x20'+a31_0xbf56a2[_0x5cb6ee(0x2d7)]('Status:')+'\x20'+_0x2a5407[_0x5cb6ee(0x294)]),console[_0x5cb6ee(0x2c7)]('\x20\x20'+a31_0xbf56a2[_0x5cb6ee(0x2d7)]('Session:')+'\x20'+_0x2a5407[_0x5cb6ee(0x281)]),console[_0x5cb6ee(0x2c7)]('\x20\x20'+_0x37f41d),0x0;}async['executeDryRun'](_0x440a74,_0x196445,_0x4bf367){const _0x28a5f6=a31_0x2594d4,{options:_0x111c63,tdx:_0x38ccca}=_0x440a74,_0x2fbb22=await withSpinner(_0x28a5f6(0x2c5)+_0x4bf367+_0x28a5f6(0x23c),()=>Promise[_0x28a5f6(0x217)]([_0x38ccca['journey'][_0x28a5f6(0x2e8)](_0x196445),_0x38ccca[_0x28a5f6(0x265)][_0x28a5f6(0x23e)](_0x196445)]),{'verbose':_0x111c63['verbose']}),[_0x3eddd9,_0x352df1]=_0x2fbb22[_0x28a5f6(0x210)],_0x5403e9=_0x3eddd9[_0x28a5f6(0x1db)],_0x2d4836=_0x5403e9[_0x28a5f6(0x2a0)];console['log'](a31_0xbf56a2[_0x28a5f6(0x254)]('Journey:'),_0x5403e9[_0x28a5f6(0x287)]),console[_0x28a5f6(0x308)](a31_0xbf56a2[_0x28a5f6(0x254)](_0x28a5f6(0x1ea)),_0x3eddd9['id']),console[_0x28a5f6(0x308)](a31_0xbf56a2[_0x28a5f6(0x254)](_0x28a5f6(0x229)),_0x5403e9['state']),console[_0x28a5f6(0x308)](a31_0xbf56a2['bold'](_0x28a5f6(0x1f4)),_0x5403e9[_0x28a5f6(0x2da)]?a31_0xbf56a2[_0x28a5f6(0x1ef)]('yes'):a31_0xbf56a2[_0x28a5f6(0x2dd)]('no')),console[_0x28a5f6(0x308)](a31_0xbf56a2['bold']('Parent\x20segment\x20ID:'),_0x5403e9[_0x28a5f6(0x2d1)]);const _0x588e9c=_0x2d4836[_0x28a5f6(0x21c)]>0x0?'\x20('+_0x2d4836[_0x28a5f6(0x2b1)](_0x506c28=>_0x506c28[_0x28a5f6(0x287)])[_0x28a5f6(0x301)](',\x20')+')':'';console[_0x28a5f6(0x308)](a31_0xbf56a2[_0x28a5f6(0x254)]('Stages:'),''+_0x2d4836[_0x28a5f6(0x21c)]+_0x588e9c),console[_0x28a5f6(0x308)]('');if(_0x352df1[_0x28a5f6(0x21c)]===0x0)console[_0x28a5f6(0x308)](a31_0xbf56a2[_0x28a5f6(0x254)](_0x28a5f6(0x248)),a31_0xbf56a2[_0x28a5f6(0x2d7)](_0x28a5f6(0x1f9)));else{console['log'](a31_0xbf56a2[_0x28a5f6(0x254)]('Activations:'));for(const _0x2a6a5d of _0x352df1){const _0x5e6b11=_0x2a6a5d[_0x28a5f6(0x287)]??'(unnamed)',_0x4909d0=_0x2a6a5d['connectionId']!=null?'connection\x20'+_0x2a6a5d['connectionId']:_0x28a5f6(0x29e),_0x3cd51b=_0x2a6a5d[_0x28a5f6(0x2cc)]?''+_0x2a6a5d[_0x28a5f6(0x2cc)]+(_0x2a6a5d[_0x28a5f6(0x2c6)]?_0x28a5f6(0x29a)+_0x2a6a5d[_0x28a5f6(0x2c6)]:''):'none',_0x5bb212=_0x2a6a5d[_0x28a5f6(0x243)]?'\x20[runs\x20on\x20refresh]':'';console[_0x28a5f6(0x308)]('\x20\x20'+a31_0xbf56a2[_0x28a5f6(0x1ef)](_0x28a5f6(0x29c))+'\x20'+_0x5e6b11+_0x28a5f6(0x201)+_0x4909d0+_0x28a5f6(0x1f7)+_0x3cd51b+_0x5bb212);}}return console['log'](a31_0xbf56a2[_0x28a5f6(0x1ef)](_0x28a5f6(0x1ec))),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a31_0x2594d4(0x287)]=a31_0x2594d4(0x216);[a31_0x2594d4(0x276)]=a31_0x2594d4(0x212);async['execute'](_0x494365){const _0x4827e9=a31_0x2594d4,{options:_0x4f1ecb,args:_0x22dfe9,tdx:_0x32eb22}=_0x494365,_0x58575d=_0x22dfe9[0x0];if(!requireNameOrPath(_0x58575d))return 0x1;_0x4f1ecb[_0x4827e9(0x1de)]&&console['error'](_0x4827e9(0x2c1)+_0x58575d);const {journeyId:_0x53001d,journeyName:_0x24b654}=await resolveJourneyIdFromInput(_0x58575d,_0x4f1ecb,_0x32eb22);if(_0x4f1ecb[_0x4827e9(0x1ed)])return await this[_0x4827e9(0x1f0)](_0x494365,_0x53001d,_0x24b654);if(!_0x4f1ecb[_0x4827e9(0x1e5)]){const _0x3bf777=await confirm(_0x4827e9(0x28f)+_0x24b654+'\x22?');if(!_0x3bf777)return console[_0x4827e9(0x2c7)](_0x4827e9(0x255)),0x0;}const _0x462060=await withSpinner(_0x4827e9(0x21a),()=>_0x32eb22['journey'][_0x4827e9(0x1e1)](_0x53001d),{'verbose':_0x4f1ecb[_0x4827e9(0x1de)]}),_0x9f8a4e=_0x462060[_0x4827e9(0x210)];return console[_0x4827e9(0x2c7)](_0x4827e9(0x1fc)+_0x9f8a4e[_0x4827e9(0x1db)]['name']+_0x4827e9(0x2fb)),0x0;}async[a31_0x2594d4(0x1f0)](_0x4c5a90,_0x3b835e,_0x16a63f){const _0x21194e=a31_0x2594d4,{options:_0xb037b1,tdx:_0x520a3f}=_0x4c5a90,_0x36559d=await withSpinner(_0x21194e(0x2c5)+_0x16a63f+_0x21194e(0x23c),()=>Promise['all']([_0x520a3f['journey'][_0x21194e(0x2e8)](_0x3b835e),_0x520a3f[_0x21194e(0x265)][_0x21194e(0x23e)](_0x3b835e)]),{'verbose':_0xb037b1[_0x21194e(0x1de)]}),[_0x204285,_0x2bb4f3]=_0x36559d[_0x21194e(0x210)],_0x45318c=_0x204285[_0x21194e(0x1db)],_0x263348=_0x45318c[_0x21194e(0x2a0)];console['log'](a31_0xbf56a2[_0x21194e(0x254)]('Journey:'),_0x45318c['name']),console[_0x21194e(0x308)](a31_0xbf56a2[_0x21194e(0x254)](_0x21194e(0x1ea)),_0x204285['id']),console[_0x21194e(0x308)](a31_0xbf56a2[_0x21194e(0x254)](_0x21194e(0x229)),_0x45318c[_0x21194e(0x2a2)]),console[_0x21194e(0x308)](a31_0xbf56a2[_0x21194e(0x254)](_0x21194e(0x1f4)),_0x45318c[_0x21194e(0x2da)]?a31_0xbf56a2['yellow'](_0x21194e(0x1e5)):a31_0xbf56a2[_0x21194e(0x2dd)]('no'));_0x45318c['pausedAt']&&console[_0x21194e(0x308)](a31_0xbf56a2[_0x21194e(0x254)]('Paused\x20at:'),_0x45318c[_0x21194e(0x2ed)]);console[_0x21194e(0x308)](a31_0xbf56a2['bold']('Parent\x20segment\x20ID:'),_0x45318c['audienceId']);const _0x3cabe4=_0x263348[_0x21194e(0x21c)]>0x0?'\x20('+_0x263348[_0x21194e(0x2b1)](_0x508ae7=>_0x508ae7[_0x21194e(0x287)])[_0x21194e(0x301)](',\x20')+')':'';console[_0x21194e(0x308)](a31_0xbf56a2[_0x21194e(0x254)](_0x21194e(0x1e2)),''+_0x263348[_0x21194e(0x21c)]+_0x3cabe4),console[_0x21194e(0x308)]('');if(_0x2bb4f3[_0x21194e(0x21c)]===0x0)console['log'](a31_0xbf56a2[_0x21194e(0x254)](_0x21194e(0x248)),a31_0xbf56a2[_0x21194e(0x2d7)](_0x21194e(0x1f9)));else{console['log'](a31_0xbf56a2['bold'](_0x21194e(0x248)));for(const _0x53d1c8 of _0x2bb4f3){const _0x2ec58c=_0x53d1c8[_0x21194e(0x287)]??_0x21194e(0x2c2),_0x41094b=_0x53d1c8['connectionId']!=null?_0x21194e(0x1f2)+_0x53d1c8[_0x21194e(0x1e6)]:_0x21194e(0x29e),_0x5b1801=_0x53d1c8[_0x21194e(0x2cc)]?''+_0x53d1c8[_0x21194e(0x2cc)]+(_0x53d1c8[_0x21194e(0x2c6)]?'\x20@\x20'+_0x53d1c8[_0x21194e(0x2c6)]:''):_0x21194e(0x24c),_0x3a707b=_0x53d1c8[_0x21194e(0x243)]?'\x20[runs\x20on\x20refresh]':'';console['log']('\x20\x20'+a31_0xbf56a2[_0x21194e(0x1ef)](_0x21194e(0x29c))+'\x20'+_0x2ec58c+_0x21194e(0x201)+_0x41094b+_0x21194e(0x1f7)+_0x5b1801+_0x3a707b);}}return console['log'](a31_0xbf56a2['yellow'](_0x21194e(0x309))),0x0;}}export class JourneyPullCommand extends BaseCommand{[a31_0x2594d4(0x287)]=a31_0x2594d4(0x2fe);[a31_0x2594d4(0x276)]=a31_0x2594d4(0x282);async['execute'](_0xd6abba){const _0x5b28f4=a31_0x2594d4,{options:_0x3fd0ab,args:_0x50bc5d,tdx:_0x29c9c5}=_0xd6abba,_0x290ed8=_0x3fd0ab,_0xa5c89f=_0x50bc5d[0x0],_0x4f3326=_0xa5c89f&&isYamlFilePath(_0xa5c89f),_0x437235=await resolveTarget({'arg':_0x4f3326?_0xa5c89f:undefined,'contextParent':_0x3fd0ab[_0x5b28f4(0x22b)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x437235))return _0x437235['errorCode']===_0x5b28f4(0x205)?(console[_0x5b28f4(0x2c7)](a31_0xbf56a2[_0x5b28f4(0x1ef)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x5b28f4(0x2c7)](_0x5b28f4(0x230)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x5b28f4(0x2c7)](_0x5b28f4(0x2e3)),console[_0x5b28f4(0x2c7)](_0x5b28f4(0x2a9))):(console[_0x5b28f4(0x2c7)](a31_0xbf56a2[_0x5b28f4(0x2b6)](_0x5b28f4(0x2bb)+_0x437235[_0x5b28f4(0x2c8)]+'\x0a')),_0x437235[_0x5b28f4(0x204)]&&console['error'](a31_0xbf56a2['cyan'](_0x437235[_0x5b28f4(0x204)]))),0x1;let _0x4006c9=_0x4f3326?undefined:_0xa5c89f,_0xcc55,_0x242ade;_0x437235[_0x5b28f4(0x22d)]===_0x5b28f4(0x1e4)&&(_0x4006c9=_0x437235[_0x5b28f4(0x2b4)],_0xcc55=_0x437235['filePath'],_0x242ade=_0x437235['folderPath']);const _0x22d50e=_0x437235[_0x5b28f4(0x20d)],_0x371604=_0x437235['targetDir'];_0x290ed8[_0x5b28f4(0x1de)]&&(console[_0x5b28f4(0x2c7)](_0x5b28f4(0x2d5)+_0x22d50e),console['error'](_0x5b28f4(0x2bc)+_0x371604),_0x4006c9&&console[_0x5b28f4(0x2c7)](_0x5b28f4(0x264)+_0x4006c9),_0xcc55&&console[_0x5b28f4(0x2c7)](_0x5b28f4(0x2c4)+_0xcc55),_0x242ade&&console[_0x5b28f4(0x2c7)](_0x5b28f4(0x2e2)+_0x242ade));const _0x1ebd67=await withSpinner(_0x5b28f4(0x27f),()=>_0x29c9c5[_0x5b28f4(0x306)]['resolveParentId'](_0x22d50e),{'verbose':_0x3fd0ab[_0x5b28f4(0x1de)]}),_0x293e14=_0x1ebd67['data'],{journeys:_0x38869b,folders:_0x488a5a}=await withSpinner(_0x5b28f4(0x302),async()=>{const _0x437f4c=_0x5b28f4,[_0x36469e,_0x455a97]=await Promise['all']([_0x29c9c5[_0x437f4c(0x265)][_0x437f4c(0x2ef)](_0x293e14,undefined,{'includeAllVersions':!![]}),_0x29c9c5[_0x437f4c(0x306)]['listFolders'](_0x293e14)]);return{'journeys':_0x36469e,'folders':_0x455a97};},{'verbose':_0x3fd0ab['verbose']})[_0x5b28f4(0x27b)](_0x3da2e8=>_0x3da2e8[_0x5b28f4(0x210)]);let _0x47435c=_0x38869b;const _0x4606c9=buildFolderIdToPathMap(_0x488a5a);if(_0x4006c9){const _0x632334=_0x47435c[_0x5b28f4(0x2c9)](_0x17da97=>_0x17da97['journeyBundleName'][_0x5b28f4(0x2e7)]()===_0x4006c9['toLowerCase']());if(_0x632334['length']===0x0)return console[_0x5b28f4(0x2c7)](_0x5b28f4(0x206)+_0x4006c9),console['error'](_0x5b28f4(0x242)),0x1;_0x47435c=_0x632334;}if(_0x242ade!==undefined){const _0x2f8298=_0x47435c['filter'](_0x5dfea9=>{const _0x4dd6e4=_0x5b28f4,_0x4dba2d=_0x5dfea9[_0x4dd6e4(0x2eb)]?_0x4606c9[_0x4dd6e4(0x1e7)](_0x5dfea9['folderId'])||'':'';return _0x4dba2d===_0x242ade;});if(_0x2f8298[_0x5b28f4(0x21c)]===0x0&&_0x47435c['length']>0x0){console['error'](_0x5b28f4(0x245)+_0x4006c9+_0x5b28f4(0x266)+(_0x242ade||_0x5b28f4(0x26f))),console['error'](_0x5b28f4(0x2ba));for(const _0x1e3cf7 of _0x47435c){const _0xf62a60=_0x1e3cf7[_0x5b28f4(0x2eb)]?_0x4606c9[_0x5b28f4(0x1e7)](_0x1e3cf7[_0x5b28f4(0x2eb)])||'':'';console['error'](_0x5b28f4(0x2ad)+(_0xf62a60||_0x5b28f4(0x238))+'/'+_0x1e3cf7[_0x5b28f4(0x2ae)]);}return 0x1;}_0x47435c=_0x2f8298;}if(_0x47435c[_0x5b28f4(0x21c)]===0x0)return console[_0x5b28f4(0x2c7)](_0x5b28f4(0x247)),0x0;const _0x49021a=new Map();for(const _0x28a789 of _0x47435c){const _0x1e88b9=_0x28a789[_0x5b28f4(0x228)];!_0x49021a[_0x5b28f4(0x2be)](_0x1e88b9)&&_0x49021a['set'](_0x1e88b9,[]),_0x49021a[_0x5b28f4(0x1e7)](_0x1e88b9)[_0x5b28f4(0x207)](_0x28a789);}for(const _0x4a5c7f of _0x49021a[_0x5b28f4(0x258)]()){_0x4a5c7f['sort']((_0x6d3bfc,_0x101171)=>(_0x6d3bfc[_0x5b28f4(0x2b0)]||0x0)-(_0x101171[_0x5b28f4(0x2b0)]||0x0));}const _0x5a53a2=[],{idToEmailMap:_0x19430e,connectionIdToNameMap:_0x10a2f4}=await withSpinner(_0x5b28f4(0x202),async()=>{const _0x550ea0=_0x5b28f4,[_0x260051,_0x365376]=await Promise[_0x550ea0(0x217)]([_0x29c9c5[_0x550ea0(0x284)][_0x550ea0(0x200)](),_0x29c9c5[_0x550ea0(0x2b9)][_0x550ea0(0x2a4)]()]);return{'idToEmailMap':_0x260051,'connectionIdToNameMap':_0x365376};},{'verbose':_0x3fd0ab[_0x5b28f4(0x1de)]})['then'](_0x11c9c8=>_0x11c9c8[_0x5b28f4(0x210)]);for(const _0x4d8890 of _0x49021a[_0x5b28f4(0x258)]()){const _0x137a50=_0x4d8890[0x0][_0x5b28f4(0x2ae)],_0x32c3f8=_0x4d8890[0x0][_0x5b28f4(0x2eb)],_0x424893=_0x32c3f8?_0x4606c9[_0x5b28f4(0x1e7)](_0x32c3f8)||'':'',_0x3f7ff2=_0x424893?a31_0x28469a[_0x5b28f4(0x301)](_0x371604,_0x424893):_0x371604,_0x370522=_0xcc55||a31_0x28469a[_0x5b28f4(0x301)](_0x3f7ff2,sanitizeFileName(_0x137a50)+_0x5b28f4(0x2cf));let _0x50b669,_0x4cd1a5;if(existsSync(_0x370522))try{const _0x2c1a97=readFileSync(_0x370522,'utf-8'),_0x517f91=parseYamlString(_0x2c1a97);_0x4cd1a5=_0x517f91,_0x50b669=buildRuleToNameMapping(_0x517f91),_0x290ed8[_0x5b28f4(0x1de)]&&_0x50b669[_0x5b28f4(0x2b5)]>0x0&&console[_0x5b28f4(0x2c7)](_0x5b28f4(0x291)+_0x50b669[_0x5b28f4(0x2b5)]+_0x5b28f4(0x304)+_0x137a50);}catch(_0x171287){_0x290ed8[_0x5b28f4(0x1de)]&&console[_0x5b28f4(0x2c7)](_0x5b28f4(0x2e0)+_0x171287[_0x5b28f4(0x2c8)]);}const _0x2cb1d2=[],_0x724d95=new Set(),_0x54a949=new Map(),_0xf5f866=new Map(),_0x37a115=new Set(),_0x5ac801=new Map(),_0x497ed7=new Map(),_0x33ccee=createJumpTargetCache();await withProgressSpinner(_0x5b28f4(0x26e)+_0x137a50+_0x5b28f4(0x23c),async _0x1212d4=>{const _0x4c9caa=_0x5b28f4;for(const _0x2705e5 of _0x4d8890){const _0x2669b9=_0x4d8890[_0x4c9caa(0x21c)]>0x1?_0x2705e5[_0x4c9caa(0x2ae)]+'\x20v'+(_0x2705e5[_0x4c9caa(0x2b0)]||0x1):_0x2705e5[_0x4c9caa(0x2ae)];_0x1212d4[_0x4c9caa(0x27a)]('Fetching\x20'+_0x2669b9);const _0x5ad205=await _0x29c9c5[_0x4c9caa(0x265)][_0x4c9caa(0x2e8)](_0x2705e5['id']),_0x3eaf8e=_0x5ad205['attributes']?.['audienceId'],_0x4c95e6={'resolveSegment':async _0x510c73=>{const _0x3b2e47=_0x4c9caa;if(!_0x3eaf8e)return{'name':_0x510c73,'isJourneyLocal':![]};const _0x473e94=_0x54a949['get'](_0x510c73);if(_0x473e94)return _0x473e94;try{const _0x392621=await _0x29c9c5[_0x3b2e47(0x306)][_0x3b2e47(0x1ff)](_0x3eaf8e,_0x510c73),_0x5e41d0=_0x392621[_0x3b2e47(0x203)]===SEGMENT_KIND_JOURNEY;let _0x1d6a87,_0x48c054=_0x392621[_0x3b2e47(0x287)];if(_0x5e41d0&&_0x392621[_0x3b2e47(0x2e4)]){const _0x11ab6d=await segmentResponseToDef(_0x392621,{'resolveSegmentName':async _0x4cc391=>{const _0x14fe66=_0x3b2e47,_0xc80c7a=_0x54a949[_0x14fe66(0x1e7)](_0x4cc391);if(_0xc80c7a)return _0xc80c7a[_0x14fe66(0x287)];const _0xce2845=await _0x4c95e6[_0x14fe66(0x267)](_0x4cc391);return _0xce2845[_0x14fe66(0x287)];}}),_0x2b1c47=_0x11ab6d['rule'];_0x1d6a87={'description':_0x392621['description'],'rule':_0x2b1c47};const _0x54206b=serializeRule(_0x2b1c47),_0x2926d6=_0xf5f866['get'](_0x54206b);if(_0x2926d6)_0x48c054=_0x2926d6,_0x1d6a87=undefined,_0x290ed8[_0x3b2e47(0x1de)]&&console['error'](_0x3b2e47(0x268)+_0x392621[_0x3b2e47(0x287)]+'\x20->\x20'+_0x2926d6);else{let _0x4a7705=![];if(_0x50b669){const _0x4c7e30=_0x50b669[_0x3b2e47(0x1e7)](_0x54206b);if(_0x4c7e30){const _0x505f71=_0x4c7e30[_0x3b2e47(0x274)](_0x39ce2e=>!_0x724d95[_0x3b2e47(0x2be)](_0x39ce2e));_0x505f71&&(_0x48c054=_0x505f71,_0x724d95[_0x3b2e47(0x2f6)](_0x505f71),_0xf5f866[_0x3b2e47(0x1dd)](_0x54206b,_0x505f71),_0x4a7705=!![],_0x290ed8[_0x3b2e47(0x1de)]&&console[_0x3b2e47(0x2c7)](_0x3b2e47(0x1ee)+_0x505f71+_0x3b2e47(0x25c)));}}if(!_0x4a7705){const _0x3b03f9=generateJourneyLocalName(_0x392621[_0x3b2e47(0x287)]);_0x3b03f9&&(_0x48c054=_0x3b03f9);let _0x2a20d8=_0x48c054,_0x3e1b2b=0x2;while(_0x724d95['has'](_0x2a20d8)){_0x2a20d8=_0x48c054+'_'+_0x3e1b2b,_0x3e1b2b++;}_0x724d95[_0x3b2e47(0x2f6)](_0x2a20d8),_0xf5f866['set'](_0x54206b,_0x2a20d8),_0x48c054=_0x2a20d8;}}}const _0x20e961={'name':_0x48c054,'isJourneyLocal':_0x5e41d0,'definition':_0x1d6a87};return _0x54a949[_0x3b2e47(0x1dd)](_0x510c73,_0x20e961),_0x20e961;}catch(_0x578016){return _0x3fd0ab[_0x3b2e47(0x1de)]&&console[_0x3b2e47(0x2c7)](_0x3b2e47(0x285)+_0x510c73+':\x20'+_0x578016[_0x3b2e47(0x2c8)]),{'name':_0x510c73,'isJourneyLocal':![]};}},'resolveActivation':async _0x12aeba=>{const _0x3fed52=_0x4c9caa,_0x1e4c67=_0x5ac801[_0x3fed52(0x1e7)](_0x12aeba);if(_0x1e4c67)return _0x1e4c67;try{const _0x10a0f6=await _0x29c9c5['journey']['getActivation'](_0x2705e5['id'],_0x12aeba),_0xf14e90=journeyActivationStepToYaml(_0x10a0f6,_0x19430e,_0x10a2f4),_0x207fed=JSON[_0x3fed52(0x211)]({'name':_0xf14e90[_0x3fed52(0x287)],'connection':_0xf14e90[_0x3fed52(0x2b9)],'connector_config':_0xf14e90[_0x3fed52(0x24b)]}),_0x35cf9d=_0x497ed7[_0x3fed52(0x1e7)](_0x207fed);if(_0x35cf9d){const _0x464bb5={'name':_0x35cf9d,'isJourneyLocal':!![],'definition':_0xf14e90};return _0x5ac801['set'](_0x12aeba,_0x464bb5),_0x464bb5;}const _0x364b59=_0x10a0f6[_0x3fed52(0x1db)]['activationParams'][_0x3fed52(0x287)]||_0x12aeba,_0x308511=sanitizeYamlKey(_0x364b59)||_0x3fed52(0x2e6)+_0x12aeba;let _0x15759f=_0x308511,_0x576a47=0x2;while(_0x37a115[_0x3fed52(0x2be)](_0x15759f)){_0x15759f=_0x308511+'_'+_0x576a47,_0x576a47++;}_0x37a115[_0x3fed52(0x2f6)](_0x15759f),_0x497ed7['set'](_0x207fed,_0x15759f);const _0x1dd664={'name':_0x15759f,'isJourneyLocal':!![],'definition':_0xf14e90};return _0x5ac801[_0x3fed52(0x1dd)](_0x12aeba,_0x1dd664),_0x1dd664;}catch(_0xc9ba3f){return _0x3fd0ab[_0x3fed52(0x1de)]&&console[_0x3fed52(0x2c7)](_0x3fed52(0x2f3)+_0x12aeba+':\x20'+_0xc9ba3f[_0x3fed52(0x2c8)]),{'name':_0x12aeba,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x52cde3,_0x5c7a8b)=>{const _0x4d1207=_0x4c9caa;return resolveJumpTarget(_0x52cde3,_0x5c7a8b,_0x33ccee,_0x1fe278=>_0x29c9c5[_0x4d1207(0x265)][_0x4d1207(0x2e8)](_0x1fe278));}},_0x13981f=await journeyResponseToDef(_0x5ad205,_0x4c95e6);_0x2cb1d2[_0x4c9caa(0x207)]({'item':_0x2705e5,'yaml':_0x13981f});}},{'verbose':_0x3fd0ab[_0x5b28f4(0x1de)]});const _0x1744c3=await _0x29c9c5['journey'][_0x5b28f4(0x2b3)](_0x4d8890[0x0]['journeyBundleId']),_0x350bf5=buildMergedJourneyDef(_0x2cb1d2,_0x50b669,_0x1744c3),_0x12b766=normalizeJourneyDef(_0x350bf5,_0x4cd1a5),_0x4a02df=toYamlString(_0x12b766),_0x39d006=_0xcc55||a31_0x28469a[_0x5b28f4(0x301)](_0x3f7ff2,sanitizeFileName(_0x137a50)+'.journey.yml');!_0xcc55&&_0x424893&&!existsSync(_0x3f7ff2)&&mkdirSync(_0x3f7ff2,{'recursive':!![]});const _0x337844=a31_0x28469a['relative'](process['cwd'](),_0x39d006);if(existsSync(_0x39d006)){const _0x18d704=readFileSync(_0x39d006,_0x5b28f4(0x29b)),_0x3314cd=generateDiff(_0x18d704,_0x4a02df),_0x13413a=hasChanges(_0x3314cd);_0x5a53a2[_0x5b28f4(0x207)]({'relativePath':_0x337844,'absolutePath':_0x39d006,'content':_0x4a02df,'isNew':![],'hasChanges':_0x13413a,'diff':_0x13413a?formatDiffWithColors(_0x3314cd):undefined});}else _0x5a53a2[_0x5b28f4(0x207)]({'relativePath':_0x337844,'absolutePath':_0x39d006,'content':_0x4a02df,'isNew':!![],'hasChanges':![]});}const _0xb82cdd=_0x5a53a2[_0x5b28f4(0x2c9)](_0x4b8fcc=>_0x4b8fcc['isNew']),_0x4dc8b9=_0x5a53a2[_0x5b28f4(0x2c9)](_0x121b43=>!_0x121b43['isNew']&&_0x121b43[_0x5b28f4(0x20e)]),_0x54e023=_0x5a53a2[_0x5b28f4(0x2c9)](_0x5b99f2=>!_0x5b99f2[_0x5b28f4(0x221)]&&!_0x5b99f2['hasChanges']),_0x5ac01a=_0x47435c[_0x5b28f4(0x21c)],_0x57b92b=_0x49021a[_0x5b28f4(0x2b5)],_0x223345=_0x5ac01a>_0x57b92b?'\x20('+_0x5ac01a+_0x5b28f4(0x22f):'';console[_0x5b28f4(0x2c7)](_0x5b28f4(0x269)),console['error']('\x20\x20'+a31_0xbf56a2['cyan'](_0x57b92b+_0x5b28f4(0x208))+a31_0xbf56a2['dim'](_0x223345)),console[_0x5b28f4(0x2c7)]('\x20\x20'+a31_0xbf56a2['green']('+\x20'+_0xb82cdd[_0x5b28f4(0x21c)]+'\x20new\x20files')),console[_0x5b28f4(0x2c7)]('\x20\x20'+a31_0xbf56a2['yellow']('~\x20'+_0x4dc8b9[_0x5b28f4(0x21c)]+_0x5b28f4(0x21b))),console[_0x5b28f4(0x2c7)]('\x20\x20'+a31_0xbf56a2['dim']('=\x20'+_0x54e023[_0x5b28f4(0x21c)]+_0x5b28f4(0x24e))),console[_0x5b28f4(0x2c7)]('\x20\x20Target:\x20'+a31_0xbf56a2[_0x5b28f4(0x286)](_0x371604)+'\x0a');if(_0x4dc8b9['length']>0x0)for(const _0x234adc of _0x4dc8b9){console['error'](_0x5b28f4(0x235)+_0x234adc[_0x5b28f4(0x2d2)]+'\x27:'),console[_0x5b28f4(0x2c7)]('─'[_0x5b28f4(0x25b)](0x3c)),console[_0x5b28f4(0x2c7)](_0x234adc[_0x5b28f4(0x2f7)]),console['error']('─'['repeat'](0x3c));}if(_0x290ed8[_0x5b28f4(0x1ed)])return console[_0x5b28f4(0x2c7)](a31_0xbf56a2[_0x5b28f4(0x1ef)](_0x5b28f4(0x23d))),0x0;if(_0xb82cdd[_0x5b28f4(0x21c)]===0x0&&_0x4dc8b9[_0x5b28f4(0x21c)]===0x0)return console['error'](a31_0xbf56a2[_0x5b28f4(0x2dd)](_0x5b28f4(0x24a))),saveSessionContext({'parent_segment':_0x22d50e},_0x290ed8[_0x5b28f4(0x2e1)]),console[_0x5b28f4(0x2c7)](a31_0xbf56a2[_0x5b28f4(0x2dd)](_0x5b28f4(0x2d6)+a31_0xbf56a2[_0x5b28f4(0x2d7)]('parent_segment')+'\x20=\x20'+a31_0xbf56a2['cyan'](_0x22d50e))),0x0;if(!_0x290ed8[_0x5b28f4(0x1e5)]&&(_0xb82cdd[_0x5b28f4(0x21c)]>0x0||_0x4dc8b9[_0x5b28f4(0x21c)]>0x0)){if(!isInteractive())return console[_0x5b28f4(0x2c7)](a31_0xbf56a2[_0x5b28f4(0x2b6)](_0x5b28f4(0x26d)),_0x5b28f4(0x224)),console['error'](a31_0xbf56a2['dim'](_0x5b28f4(0x232))),0x1;const _0x3a77c7=await confirmKey(_0x5b28f4(0x2fa)+(_0xb82cdd[_0x5b28f4(0x21c)]+_0x4dc8b9[_0x5b28f4(0x21c)])+_0x5b28f4(0x2a1));if(!_0x3a77c7)return console['error'](a31_0xbf56a2[_0x5b28f4(0x1ef)](_0x5b28f4(0x1d9)),_0x5b28f4(0x30a)),0x1;}!existsSync(_0x371604)&&mkdirSync(_0x371604,{'recursive':!![]});const _0x32a920=a31_0x28469a['join'](_0x371604,_0x5b28f4(0x1dc));writeFileSync(_0x32a920,createTdxConfigContent(_0x22d50e),_0x5b28f4(0x29b));for(const _0xd8283e of _0x5a53a2){(_0xd8283e['isNew']||_0xd8283e[_0x5b28f4(0x20e)])&&writeFileSync(_0xd8283e[_0x5b28f4(0x275)],_0xd8283e[_0x5b28f4(0x1f3)],'utf-8');}return console[_0x5b28f4(0x2c7)](a31_0xbf56a2[_0x5b28f4(0x2dd)]('✔\x20Pulled\x20'+(_0xb82cdd[_0x5b28f4(0x21c)]+_0x4dc8b9[_0x5b28f4(0x21c)])+_0x5b28f4(0x244)+_0x371604)),saveSessionContext({'parent_segment':_0x22d50e},_0x290ed8['session']),console[_0x5b28f4(0x2c7)](a31_0xbf56a2['green'](_0x5b28f4(0x2d6)+a31_0xbf56a2['dim'](_0x5b28f4(0x21f))+_0x5b28f4(0x2dc)+a31_0xbf56a2[_0x5b28f4(0x286)](_0x22d50e))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{[a31_0x2594d4(0x287)]=a31_0x2594d4(0x2ff);[a31_0x2594d4(0x276)]=a31_0x2594d4(0x1e8);async[a31_0x2594d4(0x279)](_0x404b83){const _0x480387=a31_0x2594d4,{options:_0x1641bb,args:_0x503c54,tdx:_0x3ea352}=_0x404b83,_0xb9699f=_0x503c54[0x0];if(!requireNameOrPath(_0xb9699f))return 0x1;_0x1641bb['verbose']&&console[_0x480387(0x2c7)]('Input:\x20'+_0xb9699f);const {journeyId:_0x7a98f7}=await resolveJourneyIdFromInput(_0xb9699f,_0x1641bb,_0x3ea352),_0x200002=await withSpinner('Getting\x20column\x20mapping...',()=>_0x3ea352['journey'][_0x480387(0x1f1)](_0x7a98f7),{'verbose':_0x1641bb[_0x480387(0x1de)]}),_0x2a36ef=_0x200002['data'];return console[_0x480387(0x308)]('Database:\x20'+_0x2a36ef[_0x480387(0x249)]),console['log'](_0x480387(0x2cb)+_0x2a36ef[_0x480387(0x253)]),await handleSDKOutput(_0x2a36ef[_0x480387(0x28c)],_0x1641bb),0x0;}}export class JourneyActivationsCommand extends BaseCommand{[a31_0x2594d4(0x287)]=a31_0x2594d4(0x24d);[a31_0x2594d4(0x276)]='List\x20activations\x20for\x20a\x20journey';async['execute'](_0x3648bb){const _0x12656f=a31_0x2594d4,{options:_0x573f3d,args:_0x48461e,tdx:_0x49203c}=_0x3648bb,_0x17f2aa=_0x48461e[0x0];if(!requireNameOrPath(_0x17f2aa))return 0x1;_0x573f3d[_0x12656f(0x1de)]&&console[_0x12656f(0x2c7)]('Input:\x20'+_0x17f2aa);const {journeyId:_0x7aa8e1}=await resolveJourneyIdFromInput(_0x17f2aa,_0x573f3d,_0x49203c),_0x257b7e=await withSpinner(_0x12656f(0x25f),()=>_0x49203c[_0x12656f(0x265)][_0x12656f(0x23e)](_0x7aa8e1),{'verbose':_0x573f3d[_0x12656f(0x1de)]}),_0x162bed=_0x257b7e[_0x12656f(0x210)];return console[_0x12656f(0x2c7)](_0x12656f(0x291)+_0x162bed[_0x12656f(0x21c)]+_0x12656f(0x28a)+(_0x162bed[_0x12656f(0x21c)]!==0x1?'s':'')),await handleSDKOutput(_0x162bed,_0x573f3d),0x0;}}export class JourneyPushCommand extends BaseCommand{[a31_0x2594d4(0x287)]=a31_0x2594d4(0x2fc);['description']='Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20AI';[a31_0x2594d4(0x292)]=new SegmentPushCommand();async[a31_0x2594d4(0x279)](_0x24a644){const _0x1126e6=a31_0x2594d4,_0x8e2cb8=_0x24a644[_0x1126e6(0x2a7)][0x0];let _0x2d97ed;if(_0x8e2cb8){const _0x48379c=await resolveTarget({'arg':_0x8e2cb8,'contextParent':_0x24a644[_0x1126e6(0x27e)]['parentSegment'],'cwd':process[_0x1126e6(0x1f8)]()});isSuccessfulResolution(_0x48379c)&&_0x48379c[_0x1126e6(0x22d)]===_0x1126e6(0x1e4)&&(_0x2d97ed=_0x48379c[_0x1126e6(0x231)]);}const _0x305d38={..._0x24a644,'options':{..._0x24a644[_0x1126e6(0x27e)],'journeysOnly':!![],..._0x2d97ed&&{'singleFilePath':_0x2d97ed}}};return this[_0x1126e6(0x292)][_0x1126e6(0x279)](_0x305d38);}}export class JourneyVersionsCommand extends BaseCommand{['name']=a31_0x2594d4(0x30c);[a31_0x2594d4(0x276)]=a31_0x2594d4(0x2a8);async[a31_0x2594d4(0x279)](_0x121431){const _0x3f34c8=a31_0x2594d4,{options:_0x3592e6,args:_0x553d9f,tdx:_0x1d0b06}=_0x121431,_0x4e4953=_0x553d9f[0x0];if(!requireNameOrPath(_0x4e4953))return 0x1;if(_0x3592e6[_0x3f34c8(0x1de)])console[_0x3f34c8(0x2c7)](_0x3f34c8(0x2c1)+_0x4e4953);const {journeyId:_0x1b5116}=await resolveJourneyIdFromInput(_0x4e4953,_0x3592e6,_0x1d0b06),_0x40b510=await withSpinner(_0x3f34c8(0x2ec),()=>_0x1d0b06[_0x3f34c8(0x265)][_0x3f34c8(0x2de)](_0x1b5116),{'verbose':_0x3592e6['verbose']}),{bundleName:_0x1c944a,versions:_0x2b484f,latestJourneyId:_0x714506}=_0x40b510[_0x3f34c8(0x210)];console['error'](_0x1c944a+':\x20'+_0x2b484f[_0x3f34c8(0x21c)]+_0x3f34c8(0x28d)+(_0x2b484f[_0x3f34c8(0x21c)]!==0x1?'s':''));const _0xb15e8d=_0x2b484f[_0x3f34c8(0x2b1)](_0x2ede7a=>({'version':_0x2ede7a[_0x3f34c8(0x2b0)],'journey_id':_0x2ede7a[_0x3f34c8(0x223)],'name':_0x2ede7a[_0x3f34c8(0x287)],'state':_0x2ede7a[_0x3f34c8(0x2a2)],'paused':_0x2ede7a[_0x3f34c8(0x2da)],'latest':_0x2ede7a['journeyId']===_0x714506,'created_at':_0x2ede7a[_0x3f34c8(0x303)]}));return await handleSDKOutput(_0xb15e8d,_0x3592e6),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{['name']='journey:version:create';['description']=a31_0x2594d4(0x2a6);async['execute'](_0x5ca9bc){const _0x10eb6c=a31_0x2594d4,{options:_0x495c25,args:_0x278cd1,tdx:_0x48b770}=_0x5ca9bc,_0xcdf91=_0x278cd1[0x0];if(!requireNameOrPath(_0xcdf91))return 0x1;if(_0x495c25['verbose'])console[_0x10eb6c(0x2c7)](_0x10eb6c(0x2c1)+_0xcdf91);const {journeyId:_0x41fce3,journeyName:_0x3fb7be}=await resolveJourneyIdFromInput(_0xcdf91,_0x495c25,_0x48b770);if(!_0x495c25['yes']){const _0x52b9b1=await confirm('Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22'+_0x3fb7be+'\x22?');if(!_0x52b9b1)return console[_0x10eb6c(0x2c7)]('Cancelled'),0x0;}const _0x162b3c=await withSpinner('Creating\x20new\x20version...',()=>_0x48b770[_0x10eb6c(0x265)][_0x10eb6c(0x237)](_0x41fce3),{'verbose':_0x495c25[_0x10eb6c(0x1de)]}),_0x1ec196=_0x162b3c[_0x10eb6c(0x210)];return console[_0x10eb6c(0x2c7)](a31_0xbf56a2[_0x10eb6c(0x2dd)]('\u2714')+_0x10eb6c(0x240)+_0x1ec196[_0x10eb6c(0x1db)][_0x10eb6c(0x2b0)]+'\x20(draft)\x20—\x20\x22'+_0x1ec196[_0x10eb6c(0x1db)][_0x10eb6c(0x287)]+'\x22'),console[_0x10eb6c(0x2c7)](_0x10eb6c(0x234)+_0x1ec196['id']),await handleSingleObjectOutput({'id':_0x1ec196['id'],'name':_0x1ec196[_0x10eb6c(0x1db)][_0x10eb6c(0x287)],'version':_0x1ec196[_0x10eb6c(0x1db)]['versionNumber'],'state':_0x1ec196[_0x10eb6c(0x1db)]['state'],'bundle_id':_0x1ec196['attributes'][_0x10eb6c(0x228)],'created_at':_0x1ec196['attributes'][_0x10eb6c(0x303)]},_0x495c25),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a31_0x2594d4(0x287)]='journey:version:view';['description']=a31_0x2594d4(0x2f0);async[a31_0x2594d4(0x279)](_0x552952){const _0x2f38e2=a31_0x2594d4,{options:_0x1922ae,args:_0x4d3d51,tdx:_0x4587c1}=_0x552952,_0x577dc6=_0x4d3d51[0x0];if(!requireNameOrPath(_0x577dc6))return 0x1;const _0x152e56=_0x1922ae[_0x2f38e2(0x213)];if(!_0x152e56)return console[_0x2f38e2(0x2c7)](_0x2f38e2(0x24f)),console[_0x2f38e2(0x2c7)]('Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N'),0x1;const _0x3d8b8a=parseInt(_0x152e56,0xa);if(isNaN(_0x3d8b8a)||_0x3d8b8a<0x1)return console[_0x2f38e2(0x2c7)](_0x2f38e2(0x26a)+_0x152e56),0x1;if(_0x1922ae[_0x2f38e2(0x1de)])console[_0x2f38e2(0x2c7)]('Input:\x20'+_0x577dc6+_0x2f38e2(0x21e)+_0x3d8b8a);const {journeyId:_0x27c787,parentSegmentId:_0x1be853}=await resolveJourneyIdFromInput(_0x577dc6,_0x1922ae,_0x4587c1),_0x4ba2fe=await withSpinner('Resolving\x20version...',()=>_0x4587c1['journey']['listVersions'](_0x27c787),{'verbose':_0x1922ae[_0x2f38e2(0x1de)]}),{versions:_0x2a3257,latestJourneyId:_0x56027b}=_0x4ba2fe['data'],_0x43c960=_0x2a3257[_0x2f38e2(0x274)](_0x506b1e=>_0x506b1e[_0x2f38e2(0x2b0)]===_0x3d8b8a);if(!_0x43c960){const _0x1f7585=_0x2a3257[_0x2f38e2(0x2b1)](_0x5edd55=>'v'+_0x5edd55[_0x2f38e2(0x2b0)])['join'](',\x20');return console[_0x2f38e2(0x2c7)](_0x2f38e2(0x2f2)+_0x3d8b8a+_0x2f38e2(0x22e)+_0x1f7585),0x1;}const _0x5375d7=await withSpinner('Getting\x20version\x20'+_0x3d8b8a+_0x2f38e2(0x278),()=>_0x4587c1[_0x2f38e2(0x265)][_0x2f38e2(0x2e8)](_0x43c960['journeyId']),{'verbose':_0x1922ae[_0x2f38e2(0x1de)]}),_0x382483=_0x5375d7[_0x2f38e2(0x210)],_0x39630=getConsoleNextUrl(_0x1922ae[_0x2f38e2(0x300)],_0x2f38e2(0x2ce)+_0x1be853+'/e/'+_0x43c960[_0x2f38e2(0x223)]+_0x2f38e2(0x2e9));return await handleSingleObjectOutput({'id':_0x382483['id'],'name':_0x382483[_0x2f38e2(0x1db)][_0x2f38e2(0x287)],'version':_0x382483[_0x2f38e2(0x1db)][_0x2f38e2(0x2b0)],'description':_0x382483[_0x2f38e2(0x1db)][_0x2f38e2(0x276)],'state':_0x382483[_0x2f38e2(0x1db)][_0x2f38e2(0x2a2)],'paused':_0x382483[_0x2f38e2(0x1db)][_0x2f38e2(0x2da)],'reentry_mode':_0x382483['attributes'][_0x2f38e2(0x1f5)],'stages':_0x382483[_0x2f38e2(0x1db)][_0x2f38e2(0x2a0)]?.[_0x2f38e2(0x21c)]||0x0,..._0x382483['attributes'][_0x2f38e2(0x2b2)]&&{'goal':_0x382483['attributes'][_0x2f38e2(0x2b2)][_0x2f38e2(0x287)]},'latest':_0x43c960[_0x2f38e2(0x223)]===_0x56027b,'created_at':_0x382483[_0x2f38e2(0x1db)][_0x2f38e2(0x303)],'updated_at':_0x382483[_0x2f38e2(0x1db)][_0x2f38e2(0x1e0)],'url':_0x39630},_0x1922ae),0x0;}}