@treasuredata/tdx 0.28.7 β†’ 0.29.0

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 (211) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/delivery-command.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-campaign-pull-command.js +1 -1
  20. package/dist/commands/engage-campaign-push-command.js +1 -1
  21. package/dist/commands/engage-campaign-validate-command.js +1 -1
  22. package/dist/commands/engage-command.js +1 -1
  23. package/dist/commands/job-command.js +1 -1
  24. package/dist/commands/journey-command.js +1 -1
  25. package/dist/commands/journey-validate-command.js +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/mcp-command.js +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/schedule-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pull-command.js +1 -1
  37. package/dist/commands/segment-push-command.d.ts.map +1 -1
  38. package/dist/commands/segment-push-command.js +1 -1
  39. package/dist/commands/segment-push-command.js.map +1 -1
  40. package/dist/commands/segment-update-command.js +1 -1
  41. package/dist/commands/segment-use-command.js +1 -1
  42. package/dist/commands/segment-validate-command.js +1 -1
  43. package/dist/commands/segments.js +1 -1
  44. package/dist/commands/show.js +1 -1
  45. package/dist/commands/status-command.js +1 -1
  46. package/dist/commands/tables.js +1 -1
  47. package/dist/commands/unset-command.js +1 -1
  48. package/dist/commands/upgrade-command.js +1 -1
  49. package/dist/commands/use-command.js +1 -1
  50. package/dist/commands/user-command.js +1 -1
  51. package/dist/commands/workflow-command.js +1 -1
  52. package/dist/core/auth.js +1 -1
  53. package/dist/core/command-output.js +1 -1
  54. package/dist/core/config.js +1 -1
  55. package/dist/core/connection-cache.js +1 -1
  56. package/dist/core/constants.js +1 -1
  57. package/dist/core/credential-cache.js +1 -1
  58. package/dist/core/global-context.js +1 -1
  59. package/dist/core/keychain.js +1 -1
  60. package/dist/core/profile.js +1 -1
  61. package/dist/core/project-config.js +1 -1
  62. package/dist/core/session.js +1 -1
  63. package/dist/core/user-cache.js +1 -1
  64. package/dist/core/version.js +1 -1
  65. package/dist/index.js +1 -1
  66. package/dist/mcp/server.js +1 -1
  67. package/dist/mcp/tools/index.js +1 -1
  68. package/dist/mcp/tools/tdx-run.js +1 -1
  69. package/dist/mcp/tools/tdx-search.js +1 -1
  70. package/dist/mcp/utils.js +1 -1
  71. package/dist/proxy/claude-usage-tracker.js +1 -1
  72. package/dist/proxy/passthrough-server.js +1 -1
  73. package/dist/proxy/sse-usage-parser.js +1 -1
  74. package/dist/sdk/agent/agent-config.js +1 -1
  75. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  76. package/dist/sdk/agent/agent-yaml.js +1 -1
  77. package/dist/sdk/agent/test/evaluator.js +1 -1
  78. package/dist/sdk/agent/test/executor.js +1 -1
  79. package/dist/sdk/agent/test/index.js +1 -1
  80. package/dist/sdk/agent/test/output.js +1 -1
  81. package/dist/sdk/agent/test/parser.js +1 -1
  82. package/dist/sdk/agent/tool-target-registry.js +1 -1
  83. package/dist/sdk/api.js +1 -1
  84. package/dist/sdk/client/cdp-api-client.js +1 -1
  85. package/dist/sdk/client/delivery-api-client.js +1 -1
  86. package/dist/sdk/client/endpoints.js +1 -1
  87. package/dist/sdk/client/engage-api-client.js +1 -1
  88. package/dist/sdk/client/http-client.js +1 -1
  89. package/dist/sdk/client/llm-api-client.js +1 -1
  90. package/dist/sdk/client/rate-limiter.js +1 -1
  91. package/dist/sdk/client/td-api-client.js +1 -1
  92. package/dist/sdk/client/trino-api-client.js +1 -1
  93. package/dist/sdk/client/workflow-client.js +1 -1
  94. package/dist/sdk/connection-validator.js +1 -1
  95. package/dist/sdk/connection.js +1 -1
  96. package/dist/sdk/delivery.js +1 -1
  97. package/dist/sdk/engage/campaign-pull.js +1 -1
  98. package/dist/sdk/engage/campaign-push.js +1 -1
  99. package/dist/sdk/engage/campaign-validator.d.ts.map +1 -1
  100. package/dist/sdk/engage/campaign-validator.js +1 -1
  101. package/dist/sdk/engage/campaign-validator.js.map +1 -1
  102. package/dist/sdk/engage/campaign-yaml.d.ts.map +1 -1
  103. package/dist/sdk/engage/campaign-yaml.js +1 -1
  104. package/dist/sdk/engage/campaign-yaml.js.map +1 -1
  105. package/dist/sdk/engage/types/campaign-def.js +1 -1
  106. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  107. package/dist/sdk/engage.js +1 -1
  108. package/dist/sdk/errors.js +1 -1
  109. package/dist/sdk/index.js +1 -1
  110. package/dist/sdk/io/index.js +1 -1
  111. package/dist/sdk/io/node-filesystem.js +1 -1
  112. package/dist/sdk/job.js +1 -1
  113. package/dist/sdk/journey.js +1 -1
  114. package/dist/sdk/llm/chat-cache.js +1 -1
  115. package/dist/sdk/llm/index.js +1 -1
  116. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  117. package/dist/sdk/llm/model-factors.js +1 -1
  118. package/dist/sdk/personalization.js +1 -1
  119. package/dist/sdk/query/index.js +1 -1
  120. package/dist/sdk/query/sql-parser.js +1 -1
  121. package/dist/sdk/realtime.js +1 -1
  122. package/dist/sdk/schedule.js +1 -1
  123. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  124. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  125. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  126. package/dist/sdk/segment/fields-display.js +1 -1
  127. package/dist/sdk/segment/file-discovery.js +1 -1
  128. package/dist/sdk/segment/journey-utils.js +1 -1
  129. package/dist/sdk/segment/journey-validator.js +1 -1
  130. package/dist/sdk/segment/journey-yaml.js +1 -1
  131. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  132. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  133. package/dist/sdk/segment/pull-workflow.js +1 -1
  134. package/dist/sdk/segment/push-recovery.js +1 -1
  135. package/dist/sdk/segment/push-workflow.d.ts +1 -1
  136. package/dist/sdk/segment/push-workflow.d.ts.map +1 -1
  137. package/dist/sdk/segment/push-workflow.js +1 -1
  138. package/dist/sdk/segment/push-workflow.js.map +1 -1
  139. package/dist/sdk/segment/resolution-context.js +1 -1
  140. package/dist/sdk/segment/segment-path-parser.js +1 -1
  141. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  142. package/dist/sdk/segment/segment-validator.d.ts +33 -0
  143. package/dist/sdk/segment/segment-validator.d.ts.map +1 -0
  144. package/dist/sdk/segment/segment-validator.js +1 -0
  145. package/dist/sdk/segment/segment-validator.js.map +1 -0
  146. package/dist/sdk/segment/target-resolution.js +1 -1
  147. package/dist/sdk/segment/tdx-config.js +1 -1
  148. package/dist/sdk/segment/types/segment-def.d.ts +5 -179
  149. package/dist/sdk/segment/types/segment-def.d.ts.map +1 -1
  150. package/dist/sdk/segment/types/segment-def.js +1 -1
  151. package/dist/sdk/segment/types/segment-def.js.map +1 -1
  152. package/dist/sdk/segment/types/segment-schema.d.ts +259 -0
  153. package/dist/sdk/segment/types/segment-schema.d.ts.map +1 -0
  154. package/dist/sdk/segment/types/segment-schema.js +1 -0
  155. package/dist/sdk/segment/types/segment-schema.js.map +1 -0
  156. package/dist/sdk/segment/validate-files.d.ts.map +1 -1
  157. package/dist/sdk/segment/validate-files.js +1 -1
  158. package/dist/sdk/segment/validate-files.js.map +1 -1
  159. package/dist/sdk/segment/yaml-validator.d.ts +27 -10
  160. package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
  161. package/dist/sdk/segment/yaml-validator.js +1 -1
  162. package/dist/sdk/segment/yaml-validator.js.map +1 -1
  163. package/dist/sdk/segment.js +1 -1
  164. package/dist/sdk/types/cdp.d.ts +11 -2
  165. package/dist/sdk/types/cdp.d.ts.map +1 -1
  166. package/dist/sdk/types/index.js +1 -1
  167. package/dist/sdk/types/progress.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/tree-formatter.js +1 -1
  173. package/dist/sdk/workflow/archive-validation.js +1 -1
  174. package/dist/sdk/workflow/clone-workflow.js +1 -1
  175. package/dist/sdk/workflow/index.js +1 -1
  176. package/dist/sdk/workflow/pull-workflow.js +1 -1
  177. package/dist/sdk/workflow/push-workflow.js +1 -1
  178. package/dist/sdk/workflow/tdx-config.js +1 -1
  179. package/dist/sdk/workflow/workflow-utils.js +1 -1
  180. package/dist/test-utils/command-runner.js +1 -1
  181. package/dist/test-utils/factories.js +1 -1
  182. package/dist/test-utils/fixtures.js +1 -1
  183. package/dist/test-utils/http-mock.js +1 -1
  184. package/dist/test-utils/index.js +1 -1
  185. package/dist/utils/async.js +1 -1
  186. package/dist/utils/colors.js +1 -1
  187. package/dist/utils/diff.js +1 -1
  188. package/dist/utils/file-permissions.js +1 -1
  189. package/dist/utils/file-reader.js +1 -1
  190. package/dist/utils/global-cache.js +1 -1
  191. package/dist/utils/json-loader.js +1 -1
  192. package/dist/utils/local-cache.js +1 -1
  193. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  194. package/dist/utils/logger/formatters/index.js +1 -1
  195. package/dist/utils/logger/handlers/console-handler.js +1 -1
  196. package/dist/utils/logger/handlers/file-handler.js +1 -1
  197. package/dist/utils/logger/handlers/index.js +1 -1
  198. package/dist/utils/logger/handlers/null-handler.js +1 -1
  199. package/dist/utils/logger/index.js +1 -1
  200. package/dist/utils/logger/logger.js +1 -1
  201. package/dist/utils/logger/types.js +1 -1
  202. package/dist/utils/option-validation.js +1 -1
  203. package/dist/utils/process.js +1 -1
  204. package/dist/utils/prompt.js +1 -1
  205. package/dist/utils/spinner.js +1 -1
  206. package/dist/utils/sse-parser.js +1 -1
  207. package/dist/utils/string-utils.js +1 -1
  208. package/dist/utils/table-ref-parser.js +1 -1
  209. package/dist/utils/tdx-logger.js +1 -1
  210. package/dist/utils/version-check.js +1 -1
  211. package/package.json +1 -1
@@ -1 +1 @@
1
- const a19_0x2a7f76=a19_0x2bb1;(function(_0x191250,_0x42b10e){const _0x2c731c=a19_0x2bb1,_0x3a064b=_0x191250();while(!![]){try{const _0x1dc093=-parseInt(_0x2c731c(0x189))/0x1*(-parseInt(_0x2c731c(0x184))/0x2)+-parseInt(_0x2c731c(0x1a5))/0x3+parseInt(_0x2c731c(0x1aa))/0x4+-parseInt(_0x2c731c(0x1a1))/0x5+parseInt(_0x2c731c(0x195))/0x6+-parseInt(_0x2c731c(0x197))/0x7+parseInt(_0x2c731c(0x1a3))/0x8;if(_0x1dc093===_0x42b10e)break;else _0x3a064b['push'](_0x3a064b['shift']());}catch(_0x35705c){_0x3a064b['push'](_0x3a064b['shift']());}}}(a19_0x8a6d,0xac4a8));import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';function a19_0x2bb1(_0xbe6e93,_0x3d5fe8){_0xbe6e93=_0xbe6e93-0x180;const _0x8a6d60=a19_0x8a6d();let _0x2bb1ee=_0x8a6d60[_0xbe6e93];return _0x2bb1ee;}import{existsSync}from'fs';import a19_0x14d55d from'chalk';import a19_0x1f02c5 from'path';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class EngageCampaignValidateCommand extends BaseCommand{[a19_0x2a7f76(0x181)]=a19_0x2a7f76(0x1a8);[a19_0x2a7f76(0x185)]=a19_0x2a7f76(0x19b);async['execute'](_0x8d6378){const _0x1d57f7=a19_0x2a7f76,{options:_0x2a94f9,args:_0x10d0ab}=_0x8d6378,_0x1dc6d3=_0x2a94f9,_0x283cef=_0x10d0ab[0x0],_0x12eee2=_0x283cef?a19_0x1f02c5[_0x1d57f7(0x180)](_0x283cef):undefined,_0x5b823f=_0x12eee2?isYamlFile(_0x12eee2):![];let _0x4cee3a,_0xa26f76;if(_0x5b823f&&_0x12eee2)_0x4cee3a=a19_0x1f02c5[_0x1d57f7(0x1ae)](_0x12eee2),_0xa26f76=_0x12eee2;else _0x12eee2?_0x4cee3a=_0x12eee2:_0x4cee3a=process[_0x1d57f7(0x1a0)]();if(!_0xa26f76&&!existsSync(_0x4cee3a))return console['error'](a19_0x14d55d[_0x1d57f7(0x18f)]('Error:\x20Directory\x20not\x20found:\x20'+_0x4cee3a+'\x0a')),0x1;let _0x27be00;if(_0xa26f76){if(!_0xa26f76[_0x1d57f7(0x199)](_0x1d57f7(0x1a4))&&!_0xa26f76[_0x1d57f7(0x199)](_0x1d57f7(0x18d)))return console[_0x1d57f7(0x1a2)](a19_0x14d55d[_0x1d57f7(0x18f)](_0x1d57f7(0x194)+_0xa26f76+'\x0a')),0x1;_0x27be00=[_0xa26f76];}else _0x27be00=findYamlFiles(_0x4cee3a);if(_0x27be00[_0x1d57f7(0x191)]===0x0)return console[_0x1d57f7(0x1a2)](a19_0x14d55d[_0x1d57f7(0x18f)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x4cee3a+'\x0a')),0x1;const _0x5efe46=validateYamlFiles(_0x27be00,_0x4cee3a,{'filterType':_0x1d57f7(0x190)}),_0x4bf8aa=calculateSummary(_0x5efe46),_0x5ac3d5=_0x5efe46[_0x1d57f7(0x1a9)](isValidationResult);if(_0x5ac3d5[_0x1d57f7(0x191)]===0x0)return console['error'](a19_0x14d55d[_0x1d57f7(0x18e)](_0x1d57f7(0x182)+_0x4cee3a+'\x0a')),_0x4bf8aa[_0x1d57f7(0x1ab)]>0x0&&console[_0x1d57f7(0x1a2)](a19_0x14d55d['dim']('('+_0x4bf8aa[_0x1d57f7(0x1ab)]+_0x1d57f7(0x1ac))),0x0;for(const _0x10e305 of _0x5efe46){if(!isValidationResult(_0x10e305)){_0x1dc6d3['verbose']&&console['log'](a19_0x14d55d[_0x1d57f7(0x1ad)]('-\x20'+_0x10e305[_0x1d57f7(0x183)]+_0x1d57f7(0x186)+_0x10e305['reason']+')'));continue;}const {relativePath:_0x1b0763,source:_0x36d89c,result:_0x38174f}=_0x10e305;if(_0x38174f['valid']&&_0x38174f[_0x1d57f7(0x19c)][_0x1d57f7(0x191)]===0x0)_0x1dc6d3[_0x1d57f7(0x18b)]&&console[_0x1d57f7(0x192)](a19_0x14d55d[_0x1d57f7(0x188)]('βœ”\x20'+_0x1b0763));else _0x38174f[_0x1d57f7(0x19a)]?(console[_0x1d57f7(0x192)](a19_0x14d55d['yellow']('⚠\x20'+_0x1b0763+':\x20'+_0x38174f[_0x1d57f7(0x19c)]['length']+_0x1d57f7(0x187))),console[_0x1d57f7(0x192)](formatValidationResult(_0x38174f,_0x36d89c,_0x1b0763))):(console['log'](a19_0x14d55d[_0x1d57f7(0x18f)]('βœ–\x20'+_0x1b0763+':\x20'+_0x38174f[_0x1d57f7(0x18a)][_0x1d57f7(0x191)]+_0x1d57f7(0x19d))),console[_0x1d57f7(0x192)](formatValidationResult(_0x38174f,_0x36d89c,_0x1b0763)));}return console[_0x1d57f7(0x192)](''),_0x4bf8aa[_0x1d57f7(0x1a7)]?(console[_0x1d57f7(0x192)](a19_0x14d55d[_0x1d57f7(0x18f)](_0x1d57f7(0x196)+_0x4bf8aa[_0x1d57f7(0x18c)]+'\x20campaign(s)\x20with\x20errors,\x20'+_0x4bf8aa['validCount']+'\x20valid')),_0x4bf8aa['warningCount']>0x0&&console[_0x1d57f7(0x192)](a19_0x14d55d[_0x1d57f7(0x18e)](_0x4bf8aa['warningCount']+_0x1d57f7(0x19e))),_0x4bf8aa[_0x1d57f7(0x1ab)]>0x0&&console[_0x1d57f7(0x192)](a19_0x14d55d[_0x1d57f7(0x1ad)](_0x4bf8aa[_0x1d57f7(0x1ab)]+_0x1d57f7(0x19f))),0x1):(console[_0x1d57f7(0x192)](a19_0x14d55d[_0x1d57f7(0x188)](_0x1d57f7(0x198)+_0x4bf8aa[_0x1d57f7(0x1a6)]+'\x20campaign(s)\x20valid')),_0x4bf8aa[_0x1d57f7(0x193)]>0x0&&console['log'](a19_0x14d55d['yellow'](_0x4bf8aa[_0x1d57f7(0x193)]+_0x1d57f7(0x19e))),_0x4bf8aa[_0x1d57f7(0x1ab)]>0x0&&console[_0x1d57f7(0x192)](a19_0x14d55d[_0x1d57f7(0x1ad)](_0x4bf8aa[_0x1d57f7(0x1ab)]+_0x1d57f7(0x19f))),0x0);}}function a19_0x8a6d(){const _0x12396e=['filter','81612ZvWHRO','skippedCount','\x20non-campaign\x20file(s)\x20skipped)','dim','dirname','resolve','name','No\x20campaign\x20YAML\x20files\x20found\x20in\x20','relativePath','2iLFSLa','description','\x20(skipped:\x20','\x20warning(s)','green','1089626YGFGvy','errors','verbose','invalidCount','.yaml','yellow','red','campaign','length','log','warningCount','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','6482880FLkijB','Validation\x20failed:\x20','2713445YynMwg','βœ”\x20All\x20','endsWith','valid','Validate\x20campaign\x20YAML\x20files','warnings','\x20error(s)','\x20warning(s)\x20found','\x20non-campaign\x20file(s)\x20skipped','cwd','4796650dNmuEH','error','3972312mzXhMX','.yml','1903137xbUFmZ','validCount','hasErrors','engage:campaign:validate'];a19_0x8a6d=function(){return _0x12396e;};return a19_0x8a6d();}
1
+ const a19_0x47a0c9=a19_0x23e5;function a19_0x23e5(_0x8abc4e,_0x36cbf3){_0x8abc4e=_0x8abc4e-0x1e6;const _0x5db3d5=a19_0x5db3();let _0x23e53e=_0x5db3d5[_0x8abc4e];return _0x23e53e;}(function(_0x19c694,_0x5c2d40){const _0x36a736=a19_0x23e5,_0x4ce46d=_0x19c694();while(!![]){try{const _0x591854=parseInt(_0x36a736(0x201))/0x1+-parseInt(_0x36a736(0x1fc))/0x2*(parseInt(_0x36a736(0x209))/0x3)+-parseInt(_0x36a736(0x1e6))/0x4*(parseInt(_0x36a736(0x20a))/0x5)+-parseInt(_0x36a736(0x1fd))/0x6+-parseInt(_0x36a736(0x212))/0x7*(-parseInt(_0x36a736(0x213))/0x8)+parseInt(_0x36a736(0x214))/0x9+parseInt(_0x36a736(0x1f2))/0xa*(parseInt(_0x36a736(0x211))/0xb);if(_0x591854===_0x5c2d40)break;else _0x4ce46d['push'](_0x4ce46d['shift']());}catch(_0x466bc9){_0x4ce46d['push'](_0x4ce46d['shift']());}}}(a19_0x5db3,0xce920));import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a19_0x3688e4 from'chalk';import a19_0x562629 from'path';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class EngageCampaignValidateCommand extends BaseCommand{[a19_0x47a0c9(0x1ff)]=a19_0x47a0c9(0x1ea);[a19_0x47a0c9(0x1fb)]=a19_0x47a0c9(0x217);async[a19_0x47a0c9(0x20c)](_0x20ea1f){const _0x18f0d4=a19_0x47a0c9,{options:_0x22e815,args:_0x68295c}=_0x20ea1f,_0x5b6457=_0x22e815,_0xe0282b=_0x68295c[0x0],_0x208d37=_0xe0282b?a19_0x562629['resolve'](_0xe0282b):undefined,_0x7dc70=_0x208d37?isYamlFile(_0x208d37):![];let _0x39d9ea,_0x60f980;if(_0x7dc70&&_0x208d37)_0x39d9ea=a19_0x562629[_0x18f0d4(0x1ee)](_0x208d37),_0x60f980=_0x208d37;else _0x208d37?_0x39d9ea=_0x208d37:_0x39d9ea=process['cwd']();if(!_0x60f980&&!existsSync(_0x39d9ea))return console['error'](a19_0x3688e4[_0x18f0d4(0x1ef)](_0x18f0d4(0x206)+_0x39d9ea+'\x0a')),0x1;let _0x14f7bc;if(_0x60f980){if(!_0x60f980[_0x18f0d4(0x1f6)](_0x18f0d4(0x210))&&!_0x60f980[_0x18f0d4(0x1f6)](_0x18f0d4(0x20d)))return console[_0x18f0d4(0x202)](a19_0x3688e4['red'](_0x18f0d4(0x205)+_0x60f980+'\x0a')),0x1;_0x14f7bc=[_0x60f980];}else _0x14f7bc=findYamlFiles(_0x39d9ea);if(_0x14f7bc['length']===0x0)return console['error'](a19_0x3688e4[_0x18f0d4(0x1ef)](_0x18f0d4(0x20e)+_0x39d9ea+'\x0a')),0x1;const _0x258a1e=validateYamlFiles(_0x14f7bc,_0x39d9ea,{'filterType':'campaign'}),_0x193ce1=calculateSummary(_0x258a1e),_0x801457=_0x258a1e[_0x18f0d4(0x1f4)](isValidationResult);if(_0x801457['length']===0x0)return console[_0x18f0d4(0x202)](a19_0x3688e4['yellow'](_0x18f0d4(0x1fe)+_0x39d9ea+'\x0a')),_0x193ce1[_0x18f0d4(0x1ed)]>0x0&&console['error'](a19_0x3688e4['dim']('('+_0x193ce1[_0x18f0d4(0x1ed)]+_0x18f0d4(0x1f5))),0x0;for(const _0x52cf25 of _0x258a1e){if(!isValidationResult(_0x52cf25)){_0x5b6457[_0x18f0d4(0x1f8)]&&console['log'](a19_0x3688e4[_0x18f0d4(0x1e7)]('-\x20'+_0x52cf25['relativePath']+_0x18f0d4(0x203)+_0x52cf25[_0x18f0d4(0x1f9)]+')'));continue;}const {relativePath:_0x4cdfd5,source:_0x473a45,result:_0x95af8b}=_0x52cf25;if(_0x95af8b[_0x18f0d4(0x1fa)]&&_0x95af8b[_0x18f0d4(0x1f3)][_0x18f0d4(0x1ec)]===0x0)_0x5b6457[_0x18f0d4(0x1f8)]&&console[_0x18f0d4(0x204)](a19_0x3688e4[_0x18f0d4(0x1e8)]('βœ”\x20'+_0x4cdfd5));else _0x95af8b[_0x18f0d4(0x1fa)]?(console[_0x18f0d4(0x204)](a19_0x3688e4['yellow']('⚠\x20'+_0x4cdfd5+':\x20'+_0x95af8b['warnings'][_0x18f0d4(0x1ec)]+_0x18f0d4(0x218))),console[_0x18f0d4(0x204)](formatValidationResult(_0x95af8b,_0x473a45,_0x4cdfd5))):(console[_0x18f0d4(0x204)](a19_0x3688e4['red']('βœ–\x20'+_0x4cdfd5+':\x20'+_0x95af8b[_0x18f0d4(0x1eb)]['length']+_0x18f0d4(0x20b))),console[_0x18f0d4(0x204)](formatValidationResult(_0x95af8b,_0x473a45,_0x4cdfd5)));}return console[_0x18f0d4(0x204)](''),_0x193ce1[_0x18f0d4(0x215)]?(console[_0x18f0d4(0x204)](a19_0x3688e4[_0x18f0d4(0x1ef)](_0x18f0d4(0x1f7)+_0x193ce1[_0x18f0d4(0x208)]+_0x18f0d4(0x207)+_0x193ce1[_0x18f0d4(0x200)]+'\x20valid')),_0x193ce1[_0x18f0d4(0x20f)]>0x0&&console[_0x18f0d4(0x204)](a19_0x3688e4[_0x18f0d4(0x216)](_0x193ce1[_0x18f0d4(0x20f)]+_0x18f0d4(0x1e9))),_0x193ce1[_0x18f0d4(0x1ed)]>0x0&&console['log'](a19_0x3688e4[_0x18f0d4(0x1e7)](_0x193ce1[_0x18f0d4(0x1ed)]+_0x18f0d4(0x1f0))),0x1):(console[_0x18f0d4(0x204)](a19_0x3688e4['green']('βœ”\x20All\x20'+_0x193ce1[_0x18f0d4(0x200)]+_0x18f0d4(0x1f1))),_0x193ce1[_0x18f0d4(0x20f)]>0x0&&console[_0x18f0d4(0x204)](a19_0x3688e4[_0x18f0d4(0x216)](_0x193ce1['warningCount']+_0x18f0d4(0x1e9))),_0x193ce1[_0x18f0d4(0x1ed)]>0x0&&console[_0x18f0d4(0x204)](a19_0x3688e4['dim'](_0x193ce1[_0x18f0d4(0x1ed)]+_0x18f0d4(0x1f0))),0x0);}}function a19_0x5db3(){const _0x1c4998=['No\x20campaign\x20YAML\x20files\x20found\x20in\x20','name','validCount','142829TCmlxy','error','\x20(skipped:\x20','log','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','Error:\x20Directory\x20not\x20found:\x20','\x20campaign(s)\x20with\x20errors,\x20','invalidCount','790071LJahbp','5udjMLV','\x20error(s)','execute','.yaml','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','warningCount','.yml','13519GlEmle','5805506mwpYFT','8WQSQLy','490347UAZRyH','hasErrors','yellow','Validate\x20campaign\x20YAML\x20files','\x20warning(s)','1976404oxrAlf','dim','green','\x20warning(s)\x20found','engage:campaign:validate','errors','length','skippedCount','dirname','red','\x20non-campaign\x20file(s)\x20skipped','\x20campaign(s)\x20valid','19850zoDPmG','warnings','filter','\x20non-campaign\x20file(s)\x20skipped)','endsWith','Validation\x20failed:\x20','verbose','reason','valid','description','4wVaHBh','9595848CXjTmG'];a19_0x5db3=function(){return _0x1c4998;};return a19_0x5db3();}
@@ -1 +1 @@
1
- const a20_0x36d42e=a20_0x4838;(function(_0x546503,_0x43d001){const _0x171db0=a20_0x4838,_0x447f2c=_0x546503();while(!![]){try{const _0x54df59=parseInt(_0x171db0(0xef))/0x1+-parseInt(_0x171db0(0xa6))/0x2+-parseInt(_0x171db0(0x92))/0x3+parseInt(_0x171db0(0xe7))/0x4*(parseInt(_0x171db0(0x8b))/0x5)+-parseInt(_0x171db0(0xa2))/0x6+parseInt(_0x171db0(0xd6))/0x7+-parseInt(_0x171db0(0xc3))/0x8;if(_0x54df59===_0x43d001)break;else _0x447f2c['push'](_0x447f2c['shift']());}catch(_0x31ee4b){_0x447f2c['push'](_0x447f2c['shift']());}}}(a20_0x1688,0x83ba6));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{readFileContent}from'../utils/file-reader.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getCampaignUrl}from'../sdk/client/endpoints.js';export async function resolveWorkspaceIdFromOptions(_0x48b137,_0xafffe5,_0x245f1b=![]){const _0x2a1f94=a20_0x4838;if(_0x48b137['workspace'])return await _0xafffe5[_0x2a1f94(0x69)][_0x2a1f94(0xad)](_0x48b137[_0x2a1f94(0x75)]);const _0x3ea4e5=loadSessionContext(_0x48b137[_0x2a1f94(0x7e)]);if(_0x3ea4e5?.[_0x2a1f94(0x6c)])return await _0xafffe5[_0x2a1f94(0x69)]['resolveWorkspaceId'](_0x3ea4e5[_0x2a1f94(0x6c)]);if(_0x245f1b)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x2a1f94(0x7d),undefined,{'helpText':_0x2a1f94(0xeb)});return undefined;}async function resolveSegmentFromOptions(_0x387c20,_0x2ec50f){const _0x3f7a24=a20_0x4838;if(!_0x387c20[_0x3f7a24(0x7f)])return{};const _0xc0559c=_0x387c20['segment'],_0x13f399=await _0x2ec50f[_0x3f7a24(0x7f)][_0x3f7a24(0x73)](_0xc0559c);return{'audienceId':_0x13f399[_0x3f7a24(0xb2)],'audienceName':_0x13f399['parentName'],..._0x13f399[_0x3f7a24(0xfb)]&&{'segmentId':_0x13f399[_0x3f7a24(0xfb)],'segmentName':_0x13f399[_0x3f7a24(0xfa)]}};}function buildConnectorConfig(_0x44f290){const _0xdeff16=a20_0x4838,_0x3022f3=_0x44f290[_0xdeff16(0xb9)],_0xd2407e=_0x44f290['jsonColumns'];if(!_0x3022f3&&!_0xd2407e)return undefined;return{..._0x3022f3&&{'emailSenderId':_0x3022f3},..._0xd2407e&&{'jsonColumns':_0xd2407e}};}export class EngageCampaignsCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0x6f);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0xba);async['execute'](_0x1cbeb9){const _0x35282d=a20_0x36d42e,{options:_0x455b00,args:_0x432140,tdx:_0x472f58}=_0x1cbeb9,_0x1e46c5=_0x432140[0x0],_0x5b2e7a=resolveLimit(_0x455b00[_0x35282d(0x96)],DEFAULT_LLM_LIMIT),_0x4c3486=_0x455b00,_0xd46b51=_0x4c3486[_0x35282d(0x79)],_0x2f46d6=_0x4c3486[_0x35282d(0xcb)],_0x41658c=await resolveWorkspaceIdFromOptions(_0x4c3486,_0x472f58),_0x100ef1=await withSpinner(_0x35282d(0x89),()=>_0x472f58[_0x35282d(0x69)]['listCampaigns']({'type':_0xd46b51,'status':_0x2f46d6,'workspaceId':_0x41658c,'limit':_0x5b2e7a}),{'verbose':_0x455b00[_0x35282d(0x85)]});let _0x2b2d74=_0x100ef1['data'];_0x1e46c5&&(_0x2b2d74=_0x100ef1[_0x35282d(0xf0)][_0x35282d(0xec)](_0x1f77e3=>matchGlobPattern(_0x1f77e3[_0x35282d(0x6d)],_0x1e46c5)));const _0x2568e3=_0x455b00[_0x35282d(0xb5)];if(_0x455b00['format']===_0x35282d(0xfe)||_0x455b00['format']===_0x35282d(0xd0)){const _0x31b2fe=_0x2b2d74['map'](_0x2103ac=>({..._0x2103ac,'url':_0x2103ac['workspaceId']?getCampaignUrl(_0x2568e3,_0x2103ac[_0x35282d(0xa7)],_0x2103ac['id']):undefined}));await handleSDKOutput(_0x31b2fe,_0x455b00);}else await handleSDKOutput(_0x2b2d74,_0x455b00);return 0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0xd5);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0xb3);async[a20_0x36d42e(0x9b)](_0x35e76c){const _0x1faa1c=a20_0x36d42e,{options:_0x361e16,args:_0x55bb00,tdx:_0x1add09}=_0x35e76c;if(_0x55bb00['length']===0x0)return console['error'](_0x1faa1c(0x88)),console[_0x1faa1c(0xda)](_0x1faa1c(0x90)),0x1;const _0x5bee4c=_0x55bb00[0x0],_0x22554c=_0x361e16,_0xa7acba=await resolveWorkspaceIdFromOptions(_0x22554c,_0x1add09),_0x356e00=_0x22554c[_0x1faa1c(0x70)],_0x33971b=_0x361e16[_0x1faa1c(0xb5)];if(_0x356e00){const _0x41d77b=await withSpinner(_0x1faa1c(0xb7)+_0x5bee4c+_0x1faa1c(0xaa),()=>_0x1add09[_0x1faa1c(0x69)][_0x1faa1c(0xa9)](_0x5bee4c,_0xa7acba),{'verbose':_0x361e16['verbose']}),_0x2e91da=_0x41d77b['data'],_0x195a84=_0x2e91da[_0x1faa1c(0xd4)][_0x1faa1c(0xa7)]?getCampaignUrl(_0x33971b,_0x2e91da[_0x1faa1c(0xd4)][_0x1faa1c(0xa7)],_0x2e91da['id']):undefined;await handleSDKOutput([{..._0x2e91da,..._0x195a84&&{'url':_0x195a84}}],_0x361e16);}else{const _0xfccefb=await withSpinner(_0x1faa1c(0xb7)+_0x5bee4c+'\x27...',()=>_0x1add09['engage'][_0x1faa1c(0xc2)](_0x5bee4c,_0xa7acba),{'verbose':_0x361e16[_0x1faa1c(0x85)]}),_0x30d70b=_0xfccefb[_0x1faa1c(0xf0)],_0x41dbc8=_0x30d70b[_0x1faa1c(0xa7)]?getCampaignUrl(_0x33971b,_0x30d70b[_0x1faa1c(0xa7)],_0x30d70b['id']):undefined;await handleSingleObjectOutput({..._0x30d70b,..._0x41dbc8&&{'url':_0x41dbc8}},_0x361e16);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0xf4);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0xb8);async[a20_0x36d42e(0x9b)](_0x57b7e1){const _0x176394=a20_0x36d42e,{options:_0x3a6d46,tdx:_0x220b89}=_0x57b7e1,_0x54193c=_0x3a6d46,_0x296440=_0x54193c[_0x176394(0x6d)],_0x1538bd=_0x54193c[_0x176394(0x79)];if(!_0x296440)return console[_0x176394(0xda)](_0x176394(0xf6)),console['error'](_0x176394(0xd8)),0x1;if(!_0x1538bd)return console['error'](_0x176394(0xd1)),console[_0x176394(0xda)](_0x176394(0xd8)),0x1;const _0x13b4a8=await resolveWorkspaceIdFromOptions(_0x54193c,_0x220b89,!![]),_0x5700ad=await resolveSegmentFromOptions(_0x54193c,_0x220b89),_0x3fdb85=buildConnectorConfig(_0x54193c),_0x34c9ea={'name':_0x296440,'campaignType':_0x1538bd,'workspaceId':_0x13b4a8,'description':_0x54193c[_0x176394(0x8f)],..._0x5700ad,'connectorConfig':_0x3fdb85,'startAt':_0x54193c[_0x176394(0x80)],'timezone':_0x54193c[_0x176394(0xa0)]},_0x3a6aed=await withSpinner(_0x176394(0xe6)+_0x296440+'\x27...',()=>_0x220b89[_0x176394(0x69)]['createCampaign'](_0x34c9ea));return await handleSDKOutput([_0x3a6aed[_0x176394(0xf0)]],_0x3a6d46),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{['name']=a20_0x36d42e(0xc5);[a20_0x36d42e(0x8f)]='Update\x20a\x20campaign';async[a20_0x36d42e(0x9b)](_0x548d21){const _0x585421=a20_0x36d42e,{options:_0x226254,args:_0x1d0cfa,tdx:_0x312a51}=_0x548d21;if(_0x1d0cfa[_0x585421(0x8d)]===0x0)return console[_0x585421(0xda)](_0x585421(0x88)),console[_0x585421(0xda)]('Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x34bfd5=_0x1d0cfa[0x0],_0x2c3d0d=_0x226254,_0x36a637=await resolveWorkspaceIdFromOptions(_0x2c3d0d,_0x312a51),_0x45c74d=await resolveSegmentFromOptions(_0x2c3d0d,_0x312a51),_0x763c3a=buildConnectorConfig(_0x2c3d0d),_0x3fb76f={'name':_0x2c3d0d[_0x585421(0x6d)],'description':_0x2c3d0d[_0x585421(0x8f)],..._0x45c74d,'connectorConfig':_0x763c3a,'startAt':_0x2c3d0d[_0x585421(0x80)],'timezone':_0x2c3d0d[_0x585421(0xa0)]},_0x48fe47=Object[_0x585421(0xae)](Object['entries'](_0x3fb76f)[_0x585421(0xec)](([,_0x35a98a])=>_0x35a98a!==undefined));if(Object[_0x585421(0x82)](_0x48fe47)[_0x585421(0x8d)]===0x0)return console[_0x585421(0xda)](_0x585421(0xc6)),console['error'](_0x585421(0xa4)),0x1;const _0x16e01a=await withSpinner(_0x585421(0xc8)+_0x34bfd5+_0x585421(0xaa),()=>_0x312a51[_0x585421(0x69)][_0x585421(0xe1)](_0x34bfd5,_0x48fe47,_0x36a637),{'verbose':_0x226254[_0x585421(0x85)]});return await handleSDKOutput([_0x16e01a[_0x585421(0xf0)]],_0x226254),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{['name']=a20_0x36d42e(0xff);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0xee);async[a20_0x36d42e(0x9b)](_0x5e9f68){const _0x2a9b4a=a20_0x36d42e,{options:_0x3b2fff,args:_0x72f76d,tdx:_0x102e5a}=_0x5e9f68;if(_0x72f76d[_0x2a9b4a(0x8d)]===0x0)return console['error'](_0x2a9b4a(0x88)),console[_0x2a9b4a(0xda)](_0x2a9b4a(0xcf)),0x1;const _0x313395=_0x72f76d[0x0],_0x50397e=_0x3b2fff,_0x336a13=await resolveWorkspaceIdFromOptions(_0x50397e,_0x102e5a);if(!_0x3b2fff['yes']){const _0x2bd6db=await confirm(_0x2a9b4a(0xcc)+_0x313395+_0x2a9b4a(0x76));if(!_0x2bd6db)return console[_0x2a9b4a(0x8c)](_0x2a9b4a(0xaf)),0x0;}return await withSpinner(_0x2a9b4a(0xab)+_0x313395+_0x2a9b4a(0xaa),()=>_0x102e5a[_0x2a9b4a(0x69)][_0x2a9b4a(0x9a)](_0x313395,_0x336a13),{'verbose':_0x3b2fff['verbose']}),console[_0x2a9b4a(0x8c)](_0x2a9b4a(0x94)+_0x313395+_0x2a9b4a(0x97)),0x0;}}function a20_0x4838(_0x4b4fbe,_0x3c50d4){_0x4b4fbe=_0x4b4fbe-0x68;const _0x1688f0=a20_0x1688();let _0x48383a=_0x1688f0[_0x4b4fbe];return _0x48383a;}export class EngageCampaignLaunchCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0x78);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0x7a);async[a20_0x36d42e(0x9b)](_0x4160eb){const _0x4f9ba8=a20_0x36d42e,{options:_0x3e47e4,args:_0x37f339,tdx:_0x315211}=_0x4160eb;if(_0x37f339[_0x4f9ba8(0x8d)]===0x0)return console[_0x4f9ba8(0xda)](_0x4f9ba8(0x88)),console[_0x4f9ba8(0xda)](_0x4f9ba8(0xd7)),0x1;const _0x444c92=_0x37f339[0x0],_0x5f46ab=_0x3e47e4,_0x4ecf73=await resolveWorkspaceIdFromOptions(_0x5f46ab,_0x315211);return await withSpinner(_0x4f9ba8(0x99)+_0x444c92+'\x27...',()=>_0x315211[_0x4f9ba8(0x69)][_0x4f9ba8(0xe2)](_0x444c92,_0x4ecf73),{'verbose':_0x3e47e4[_0x4f9ba8(0x85)]}),console[_0x4f9ba8(0x8c)](_0x4f9ba8(0x94)+_0x444c92+'\x27\x20launched\x20successfully'),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0xac);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0xc9);async[a20_0x36d42e(0x9b)](_0x375e06){const _0x50e665=a20_0x36d42e,{options:_0x2fa8e6,args:_0x15bfe5,tdx:_0x4dbb4b}=_0x375e06;if(_0x15bfe5['length']===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x3fc93b=_0x15bfe5[0x0],_0x181d90=_0x2fa8e6,_0x1565e5=await resolveWorkspaceIdFromOptions(_0x181d90,_0x4dbb4b);return await withSpinner(_0x50e665(0x9c)+_0x3fc93b+_0x50e665(0xaa),()=>_0x4dbb4b[_0x50e665(0x69)][_0x50e665(0xce)](_0x3fc93b,_0x1565e5),{'verbose':_0x2fa8e6[_0x50e665(0x85)]}),console[_0x50e665(0x8c)](_0x50e665(0x94)+_0x3fc93b+_0x50e665(0x98)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{['name']=a20_0x36d42e(0xf7);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0x91);async['execute'](_0x1d48e8){const _0x28502f=a20_0x36d42e,{options:_0x3c61b0,args:_0x53979e,tdx:_0x273ae8}=_0x1d48e8;if(_0x53979e[_0x28502f(0x8d)]===0x0)return console['error'](_0x28502f(0x88)),console[_0x28502f(0xda)]('Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>'),0x1;const _0x513a6f=_0x53979e[0x0],_0x57882d=_0x3c61b0,_0x2617d3=await resolveWorkspaceIdFromOptions(_0x57882d,_0x273ae8);return await withSpinner('Resuming\x20campaign\x20\x27'+_0x513a6f+_0x28502f(0xaa),()=>_0x273ae8[_0x28502f(0x69)][_0x28502f(0x71)](_0x513a6f,_0x2617d3),{'verbose':_0x3c61b0[_0x28502f(0x85)]}),console[_0x28502f(0x8c)](_0x28502f(0x94)+_0x513a6f+_0x28502f(0x86)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']='engage:campaign:duplicate';['description']=a20_0x36d42e(0xa5);async[a20_0x36d42e(0x9b)](_0xbc209b){const _0x560ae9=a20_0x36d42e,{options:_0x4b052d,args:_0x2677db,tdx:_0x4049a9}=_0xbc209b;if(_0x2677db[_0x560ae9(0x8d)]===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x560ae9(0xda)](_0x560ae9(0xb0)),0x1;const _0x680875=_0x2677db[0x0],_0x58048d=_0x4b052d,_0x49fde4=await resolveWorkspaceIdFromOptions(_0x58048d,_0x4049a9),_0xd87a5f=await withSpinner(_0x560ae9(0xa3)+_0x680875+_0x560ae9(0xaa),()=>_0x4049a9['engage'][_0x560ae9(0xed)](_0x680875,_0x49fde4),{'verbose':_0x4b052d[_0x560ae9(0x85)]});return await handleSDKOutput([_0xd87a5f[_0x560ae9(0xf0)]],_0x4b052d),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0xc0);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0x9e);async['execute'](_0x179397){const _0x21ca7f=a20_0x36d42e,{options:_0x1f254d,args:_0x1d5717,tdx:_0x33c2e3}=_0x179397,_0x189e22=_0x1d5717[0x0],_0x31767c=resolveLimit(_0x1f254d[_0x21ca7f(0x96)],DEFAULT_LLM_LIMIT),_0x1d1a71=_0x1f254d,_0x43130f=await resolveWorkspaceIdFromOptions(_0x1d1a71,_0x33c2e3),_0x2d9aaa=await withSpinner('Fetching\x20templates...',()=>_0x33c2e3['engage'][_0x21ca7f(0xfc)]({'workspaceId':_0x43130f,'limit':_0x31767c}),{'verbose':_0x1f254d[_0x21ca7f(0x85)]});let _0x5cd14c=_0x2d9aaa[_0x21ca7f(0xf0)];return _0x189e22&&(_0x5cd14c=_0x2d9aaa[_0x21ca7f(0xf0)][_0x21ca7f(0xec)](_0x4e867b=>matchGlobPattern(_0x4e867b[_0x21ca7f(0x6d)],_0x189e22))),await handleSDKOutput(_0x5cd14c,_0x1f254d),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{['name']='engage:template:show';[a20_0x36d42e(0x8f)]='Show\x20email\x20template\x20details';async[a20_0x36d42e(0x9b)](_0x54dc89){const _0x38198e=a20_0x36d42e,{options:_0x5bd37b,args:_0x38dd3f,tdx:_0x695bf6}=_0x54dc89;if(_0x38dd3f['length']===0x0)return console[_0x38198e(0xda)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x38198e(0xda)](_0x38198e(0xcd)),0x1;const _0x4797b8=_0x38dd3f[0x0],_0x4b1592=_0x5bd37b,_0x3f6334=await resolveWorkspaceIdFromOptions(_0x4b1592,_0x695bf6),_0x2415ba=_0x4b1592['full'];if(_0x2415ba){const _0x211837=await withSpinner(_0x38198e(0xb1)+_0x4797b8+_0x38198e(0xaa),()=>_0x695bf6[_0x38198e(0x69)]['getTemplateFull'](_0x4797b8,_0x3f6334),{'verbose':_0x5bd37b[_0x38198e(0x85)]});await handleSDKOutput([_0x211837],_0x5bd37b);}else{const _0x511880=await withSpinner(_0x38198e(0xb1)+_0x4797b8+_0x38198e(0xaa),()=>_0x695bf6[_0x38198e(0x69)]['getTemplate'](_0x4797b8,_0x3f6334),{'verbose':_0x5bd37b[_0x38198e(0x85)]});await handleSDKOutput([_0x511880],_0x5bd37b);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a20_0x36d42e(0x6d)]='engage:template:create';['description']=a20_0x36d42e(0xbf);async[a20_0x36d42e(0x9b)](_0x4cd86e){const _0x45f84c=a20_0x36d42e,{options:_0x2823cd,tdx:_0x31dfdc}=_0x4cd86e,_0xb1e2db=_0x2823cd,_0xbe1d0a=_0xb1e2db[_0x45f84c(0x6d)],_0xf8cd7=_0xb1e2db['subject'],_0x485cb4=_0xb1e2db[_0x45f84c(0xb6)],_0x5194b6=_0xb1e2db[_0x45f84c(0xc1)];if(!_0xbe1d0a)return console[_0x45f84c(0xda)](_0x45f84c(0xf6)),console['error'](_0x45f84c(0xdb)),0x1;if(!_0xf8cd7)return console[_0x45f84c(0xda)](_0x45f84c(0x87)),0x1;if(_0x485cb4&&_0x5194b6)return console[_0x45f84c(0xda)](_0x45f84c(0xd2)),0x1;const _0x26ff5e=_0x5194b6?readFileContent(_0x5194b6):_0x485cb4;if(!_0x26ff5e)return console[_0x45f84c(0xda)](_0x45f84c(0xf1)),0x1;const _0x2e4ce2=await resolveWorkspaceIdFromOptions(_0xb1e2db,_0x31dfdc,!![]),_0x12b2f9={'name':_0xbe1d0a,'subjectTemplate':_0xf8cd7,'htmlTemplate':_0x26ff5e,'workspaceId':_0x2e4ce2,'plaintextTemplate':_0xb1e2db['plaintext'],'editorType':_0xb1e2db[_0x45f84c(0xc7)]},_0x3538cd=await withSpinner(_0x45f84c(0xa8)+_0xbe1d0a+'\x27...',()=>_0x31dfdc[_0x45f84c(0x69)]['createTemplate'](_0x12b2f9));return await handleSDKOutput([_0x3538cd[_0x45f84c(0xf0)]],_0x2823cd),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0xbe);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0xdf);async['execute'](_0x6fa08e){const _0x2ff297=a20_0x36d42e,{options:_0xd1faa7,args:_0x3611cf,tdx:_0x37ca13}=_0x6fa08e;if(_0x3611cf[_0x2ff297(0x8d)]===0x0)return console[_0x2ff297(0xda)](_0x2ff297(0xe5)),console['error'](_0x2ff297(0x8e)),0x1;const _0x105ab3=_0x3611cf[0x0],_0x1ae159=_0xd1faa7,_0x58c968=_0x1ae159[_0x2ff297(0xb6)],_0x4f2f8f=_0x1ae159[_0x2ff297(0xc1)];if(_0x58c968&&_0x4f2f8f)return console[_0x2ff297(0xda)](_0x2ff297(0xd2)),0x1;const _0x5e1026=_0x4f2f8f?readFileContent(_0x4f2f8f):_0x58c968,_0x5c936a=await resolveWorkspaceIdFromOptions(_0x1ae159,_0x37ca13),_0x2dd0ef={'name':_0x1ae159[_0x2ff297(0x6d)],'subjectTemplate':_0x1ae159['subject'],'htmlTemplate':_0x5e1026,'plaintextTemplate':_0x1ae159[_0x2ff297(0xa1)]},_0x3903ed=Object[_0x2ff297(0xae)](Object['entries'](_0x2dd0ef)[_0x2ff297(0xec)](([,_0x252a0d])=>_0x252a0d!==undefined));if(Object[_0x2ff297(0x82)](_0x3903ed)[_0x2ff297(0x8d)]===0x0)return console['error'](_0x2ff297(0xc6)),console[_0x2ff297(0xda)]('Options:\x20--name,\x20--subject,\x20--html,\x20--html-file,\x20--plaintext'),0x1;const _0x238d40=await withSpinner('Updating\x20template\x20\x27'+_0x105ab3+'\x27...',()=>_0x37ca13['engage'][_0x2ff297(0x6e)](_0x105ab3,_0x3903ed,_0x5c936a),{'verbose':_0xd1faa7[_0x2ff297(0x85)]});return await handleSDKOutput([_0x238d40[_0x2ff297(0xf0)]],_0xd1faa7),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0x7b);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0x84);async[a20_0x36d42e(0x9b)](_0x309edf){const _0x34d343=a20_0x36d42e,{options:_0x5b57fd,args:_0xaa3a9,tdx:_0x157fb0}=_0x309edf;if(_0xaa3a9[_0x34d343(0x8d)]===0x0)return console[_0x34d343(0xda)](_0x34d343(0xe5)),console[_0x34d343(0xda)](_0x34d343(0x68)),0x1;const _0x4097aa=_0xaa3a9[0x0],_0x3cd9fb=_0x5b57fd,_0x36aca2=await resolveWorkspaceIdFromOptions(_0x3cd9fb,_0x157fb0);if(!_0x5b57fd[_0x34d343(0xca)]){const _0x2c9b10=await confirm(_0x34d343(0xbb)+_0x4097aa+_0x34d343(0x76));if(!_0x2c9b10)return console[_0x34d343(0x8c)](_0x34d343(0xaf)),0x0;}return await withSpinner('Deleting\x20template\x20\x27'+_0x4097aa+'\x27...',()=>_0x157fb0[_0x34d343(0x69)][_0x34d343(0xdd)](_0x4097aa,_0x36aca2),{'verbose':_0x5b57fd[_0x34d343(0x85)]}),console['log'](_0x34d343(0xde)+_0x4097aa+_0x34d343(0x97)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0xc4);['description']=a20_0x36d42e(0xf3);async[a20_0x36d42e(0x9b)](_0x3578c2){const _0x581f3d=a20_0x36d42e,{options:_0x45c9eb,args:_0x2773ea,tdx:_0x151a2e}=_0x3578c2,_0x11ac9f=_0x2773ea[0x0],_0x2ade1e=resolveLimit(_0x45c9eb['limit'],DEFAULT_LLM_LIMIT),_0x593d06=await withSpinner('Fetching\x20workspaces...',()=>_0x151a2e[_0x581f3d(0x69)][_0x581f3d(0xe8)]({'limit':_0x2ade1e}),{'verbose':_0x45c9eb[_0x581f3d(0x85)]});let _0x4655b2=_0x593d06['data'];return _0x11ac9f&&(_0x4655b2=_0x593d06[_0x581f3d(0xf0)][_0x581f3d(0xec)](_0x44e1df=>matchGlobPattern(_0x44e1df[_0x581f3d(0x6d)],_0x11ac9f))),await handleSDKOutput(_0x4655b2,_0x45c9eb),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0x81);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0x9d);async['execute'](_0xc4a424){const _0x38925f=a20_0x36d42e,{options:_0x3d108a,args:_0x232885,tdx:_0x32252e}=_0xc4a424;if(_0x232885[_0x38925f(0x8d)]===0x0)return console[_0x38925f(0xda)](_0x38925f(0x83)),console[_0x38925f(0xda)](_0x38925f(0x93)),0x1;const _0x3998e6=_0x232885[0x0],_0x40a6b7=_0x3d108a,_0x3a907d=_0x40a6b7['full'];if(_0x3a907d){const _0x4b85d3=await withSpinner('Fetching\x20workspace\x20\x27'+_0x3998e6+'\x27...',()=>_0x32252e[_0x38925f(0x69)][_0x38925f(0xea)](_0x3998e6),{'verbose':_0x3d108a[_0x38925f(0x85)]});await handleSDKOutput([_0x4b85d3],_0x3d108a);}else{const _0x38cae8=await withSpinner(_0x38925f(0x6b)+_0x3998e6+_0x38925f(0xaa),()=>_0x32252e[_0x38925f(0x69)][_0x38925f(0xf5)](_0x3998e6),{'verbose':_0x3d108a[_0x38925f(0x85)]});await handleSDKOutput([_0x38cae8],_0x3d108a);}return 0x0;}}function a20_0x1688(){const _0x372093=['Fetching\x20workspace\x20\x27','engage_workspace','name','updateTemplate','engage:campaigns','full','resumeCampaign','Options:\x20--name,\x20--description','resolvePathToResource','engage:workspace:update','workspace','\x27?\x20This\x20cannot\x20be\x20undone.','Update\x20a\x20workspace','engage:campaign:launch','type','Launch\x20a\x20campaign','engage:template:delete','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Workspace\x20is\x20required\x20for\x20this\x20operation','session','segment','startAt','engage:workspace:show','keys','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Delete\x20an\x20email\x20template','verbose','\x27\x20resumed\x20successfully','Error:\x20--subject\x20is\x20required','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Fetching\x20campaigns...','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','8220hLcmio','log','length','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','description','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Resume\x20a\x20paused\x20campaign','1540839tjDVTI','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','Campaign\x20\x27','entries','limit','\x27\x20deleted\x20successfully','\x27\x20paused\x20successfully','Launching\x20campaign\x20\x27','deleteCampaign','execute','Pausing\x20campaign\x20\x27','Show\x20workspace\x20details','List\x20email\x20templates','Delete\x20a\x20workspace','timezone','plaintext','3549108lwHgxF','Duplicating\x20campaign\x20\x27','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','Duplicate\x20a\x20campaign','1263312qYGJgS','workspaceId','Creating\x20template\x20\x27','getCampaignFull','\x27...','Deleting\x20campaign\x20\x27','engage:campaign:pause','resolveWorkspaceId','fromEntries','Operation\x20cancelled','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','Fetching\x20template\x20\x27','parentId','Show\x20campaign\x20details','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','site','html','Fetching\x20campaign\x20\x27','Create\x20a\x20new\x20campaign','emailSenderId','List\x20campaigns','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Verifying\x20workspace\x20\x27','Creating\x20workspace\x20\x27','engage:template:update','Create\x20an\x20email\x20template','engage:templates','htmlFile','getCampaign','2049688UFANZu','engage:workspaces','engage:campaign:update','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','editorType','Updating\x20campaign\x20\x27','Pause\x20a\x20campaign','yes','status','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','pauseCampaign','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','jsonl','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Error:\x20Cannot\x20specify\x20both\x20--html\x20and\x20--html-file','engage:workspace:use','attributes','engage:campaign:show','4922477NYYnmC','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Workspace\x20\x27','error','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','Create\x20a\x20workspace','deleteTemplate','Template\x20\x27','Update\x20an\x20email\x20template','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','updateCampaign','launchCampaign','Updating\x20workspace\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','Creating\x20campaign\x20\x27','2240MAkWRi','listWorkspaces','Deleting\x20workspace\x20\x27','getWorkspaceFull','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','filter','duplicateCampaign','Delete\x20a\x20campaign','908705xaxvHI','data','Error:\x20Either\x20--html\x20or\x20--html-file\x20is\x20required','createWorkspace','List\x20workspaces','engage:campaign:create','getWorkspace','Error:\x20--name\x20is\x20required','engage:campaign:resume','updateWorkspace','Error:\x20Workspace\x20name\x20is\x20required','segmentName','segmentId','listTemplates','deleteWorkspace','json','engage:campaign:delete','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','engage','engage:workspace:create'];a20_0x1688=function(){return _0x372093;};return a20_0x1688();}export class EngageWorkspaceCreateCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0x6a);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0xdc);async[a20_0x36d42e(0x9b)](_0xbef710){const _0x1a226f=a20_0x36d42e,{options:_0x6cdf0,tdx:_0x497960}=_0xbef710,_0x3e3338=_0x6cdf0,_0x38d7d1=_0x3e3338[_0x1a226f(0x6d)];if(!_0x38d7d1)return console[_0x1a226f(0xda)](_0x1a226f(0xf6)),console[_0x1a226f(0xda)](_0x1a226f(0xe0)),0x1;const _0xeb940c={'name':_0x38d7d1,'description':_0x3e3338[_0x1a226f(0x8f)]},_0x2582a1=await withSpinner(_0x1a226f(0xbd)+_0x38d7d1+_0x1a226f(0xaa),()=>_0x497960['engage'][_0x1a226f(0xf2)](_0xeb940c));return await handleSDKOutput([_0x2582a1[_0x1a226f(0xf0)]],_0x6cdf0),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0x74);[a20_0x36d42e(0x8f)]=a20_0x36d42e(0x77);async['execute'](_0x5bbc45){const _0x2d2604=a20_0x36d42e,{options:_0x17d4cc,args:_0x4ee924,tdx:_0x597134}=_0x5bbc45;if(_0x4ee924['length']===0x0)return console[_0x2d2604(0xda)](_0x2d2604(0x83)),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x1ae048=_0x4ee924[0x0],_0x15eccc=_0x17d4cc,_0x3d0215={'name':_0x15eccc['name'],'description':_0x15eccc[_0x2d2604(0x8f)]},_0x1c0b27=Object['fromEntries'](Object[_0x2d2604(0x95)](_0x3d0215)[_0x2d2604(0xec)](([,_0x479eef])=>_0x479eef!==undefined));if(Object[_0x2d2604(0x82)](_0x1c0b27)[_0x2d2604(0x8d)]===0x0)return console['error'](_0x2d2604(0xc6)),console[_0x2d2604(0xda)](_0x2d2604(0x72)),0x1;const _0x37fe9f=await withSpinner(_0x2d2604(0xe3)+_0x1ae048+_0x2d2604(0xaa),()=>_0x597134[_0x2d2604(0x69)][_0x2d2604(0xf8)](_0x1ae048,_0x1c0b27),{'verbose':_0x17d4cc[_0x2d2604(0x85)]});return await handleSDKOutput([_0x37fe9f[_0x2d2604(0xf0)]],_0x17d4cc),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a20_0x36d42e(0x6d)]='engage:workspace:delete';['description']=a20_0x36d42e(0x9f);async[a20_0x36d42e(0x9b)](_0x235fb1){const _0x1ae548=a20_0x36d42e,{options:_0x18bd22,args:_0x9fb244,tdx:_0x36afec}=_0x235fb1;if(_0x9fb244['length']===0x0)return console[_0x1ae548(0xda)](_0x1ae548(0x83)),console[_0x1ae548(0xda)](_0x1ae548(0x8a)),0x1;const _0x2c8177=_0x9fb244[0x0];if(!_0x18bd22[_0x1ae548(0xca)]){const _0x4f2cf9=await confirm(_0x1ae548(0xb4)+_0x2c8177+_0x1ae548(0x76));if(!_0x4f2cf9)return console[_0x1ae548(0x8c)](_0x1ae548(0xaf)),0x0;}return await withSpinner(_0x1ae548(0xe9)+_0x2c8177+_0x1ae548(0xaa),()=>_0x36afec['engage'][_0x1ae548(0xfd)](_0x2c8177),{'verbose':_0x18bd22[_0x1ae548(0x85)]}),console[_0x1ae548(0x8c)](_0x1ae548(0xd9)+_0x2c8177+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a20_0x36d42e(0x6d)]=a20_0x36d42e(0xd3);[a20_0x36d42e(0x8f)]='Set\x20workspace\x20context\x20for\x20Engage\x20commands';async[a20_0x36d42e(0x9b)](_0x8f3647){const _0x1b55ad=a20_0x36d42e,{options:_0x13ff82,args:_0x85f230,tdx:_0xeeffcd}=_0x8f3647;if(_0x85f230[_0x1b55ad(0x8d)]===0x0)return console[_0x1b55ad(0xda)](_0x1b55ad(0xf9)),console[_0x1b55ad(0xda)](_0x1b55ad(0x7c)),0x1;const _0xee46f1=_0x85f230[0x0];await withSpinner(_0x1b55ad(0xbc)+_0xee46f1+_0x1b55ad(0xaa),()=>_0xeeffcd[_0x1b55ad(0x69)][_0x1b55ad(0xad)](_0xee46f1));const _0x4e104f=_0x13ff82[_0x1b55ad(0x7e)]||undefined;return saveSessionContext({'engage_workspace':_0xee46f1},_0x4e104f),console[_0x1b55ad(0x8c)]('Engage\x20workspace\x20set\x20to:\x20'+_0xee46f1),console['log'](_0x1b55ad(0xe4)),0x0;}}
1
+ const a20_0x5043dd=a20_0x6223;(function(_0x1138b8,_0xc59d7e){const _0x208dde=a20_0x6223,_0x569e01=_0x1138b8();while(!![]){try{const _0x29da95=-parseInt(_0x208dde(0x103))/0x1*(parseInt(_0x208dde(0x15f))/0x2)+parseInt(_0x208dde(0x14e))/0x3*(-parseInt(_0x208dde(0x157))/0x4)+-parseInt(_0x208dde(0x168))/0x5*(-parseInt(_0x208dde(0x124))/0x6)+parseInt(_0x208dde(0x184))/0x7*(-parseInt(_0x208dde(0x14b))/0x8)+-parseInt(_0x208dde(0x111))/0x9+parseInt(_0x208dde(0x106))/0xa*(-parseInt(_0x208dde(0x155))/0xb)+parseInt(_0x208dde(0xff))/0xc*(parseInt(_0x208dde(0x12c))/0xd);if(_0x29da95===_0xc59d7e)break;else _0x569e01['push'](_0x569e01['shift']());}catch(_0x165bdc){_0x569e01['push'](_0x569e01['shift']());}}}(a20_0x5761,0x36d1d));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{readFileContent}from'../utils/file-reader.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getCampaignUrl}from'../sdk/client/endpoints.js';export async function resolveWorkspaceIdFromOptions(_0xade471,_0x34ec6b,_0x42530a=![]){const _0x4626ba=a20_0x6223;if(_0xade471['workspace'])return await _0x34ec6b[_0x4626ba(0x183)][_0x4626ba(0x133)](_0xade471['workspace']);const _0x2b1b90=loadSessionContext(_0xade471[_0x4626ba(0x17e)]);if(_0x2b1b90?.[_0x4626ba(0x113)])return await _0x34ec6b['engage'][_0x4626ba(0x133)](_0x2b1b90[_0x4626ba(0x113)]);if(_0x42530a)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x4626ba(0x126),undefined,{'helpText':_0x4626ba(0x146)});return undefined;}async function resolveSegmentFromOptions(_0x1210d4,_0x5d6125){const _0x128b9e=a20_0x6223;if(!_0x1210d4[_0x128b9e(0x151)])return{};const _0x5c6937=_0x1210d4['segment'],_0x5d6270=await _0x5d6125[_0x128b9e(0x151)][_0x128b9e(0x178)](_0x5c6937);return{'audienceId':_0x5d6270['parentId'],'audienceName':_0x5d6270[_0x128b9e(0x12e)],..._0x5d6270[_0x128b9e(0xfc)]&&{'segmentId':_0x5d6270[_0x128b9e(0xfc)],'segmentName':_0x5d6270['segmentName']}};}function buildConnectorConfig(_0x227f3a){const _0x3870a9=a20_0x6223,_0x20eaac=_0x227f3a[_0x3870a9(0x158)],_0x2e79f=_0x227f3a[_0x3870a9(0x156)];if(!_0x20eaac&&!_0x2e79f)return undefined;return{..._0x20eaac&&{'emailSenderId':_0x20eaac},..._0x2e79f&&{'jsonColumns':_0x2e79f}};}export class EngageCampaignsCommand extends BaseCommand{[a20_0x5043dd(0x114)]=a20_0x5043dd(0x12f);[a20_0x5043dd(0x18c)]='List\x20campaigns';async[a20_0x5043dd(0x11b)](_0x584a06){const _0x463c66=a20_0x5043dd,{options:_0x2edd8e,args:_0x2196b8,tdx:_0x14c97d}=_0x584a06,_0x58c3da=_0x2196b8[0x0],_0x20ba83=resolveLimit(_0x2edd8e[_0x463c66(0x18a)],DEFAULT_LLM_LIMIT),_0x1cda98=_0x2edd8e,_0x21a525=_0x1cda98['type'],_0xfa68f0=_0x1cda98[_0x463c66(0x107)],_0x15036d=await resolveWorkspaceIdFromOptions(_0x1cda98,_0x14c97d),_0x3494ea=await withSpinner(_0x463c66(0x10e),()=>_0x14c97d[_0x463c66(0x183)][_0x463c66(0x115)]({'type':_0x21a525,'status':_0xfa68f0,'workspaceId':_0x15036d,'limit':_0x20ba83}),{'verbose':_0x2edd8e['verbose']});let _0x12663c=_0x3494ea[_0x463c66(0x121)];_0x58c3da&&(_0x12663c=_0x3494ea[_0x463c66(0x121)][_0x463c66(0x16d)](_0x1f5652=>matchGlobPattern(_0x1f5652['name'],_0x58c3da)));const _0x476e63=_0x2edd8e[_0x463c66(0x13b)];if(_0x2edd8e['format']===_0x463c66(0x169)||_0x2edd8e[_0x463c66(0x119)]===_0x463c66(0x10f)){const _0x2ce81d=_0x12663c[_0x463c66(0x188)](_0x5b746d=>({..._0x5b746d,'url':_0x5b746d[_0x463c66(0x14a)]?getCampaignUrl(_0x476e63,_0x5b746d[_0x463c66(0x14a)],_0x5b746d['id']):undefined}));await handleSDKOutput(_0x2ce81d,_0x2edd8e);}else await handleSDKOutput(_0x12663c,_0x2edd8e);return 0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a20_0x5043dd(0x114)]=a20_0x5043dd(0x174);[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x147);async['execute'](_0x590bc3){const _0x190869=a20_0x5043dd,{options:_0x56e042,args:_0x212481,tdx:_0x3ab1fe}=_0x590bc3;if(_0x212481['length']===0x0)return console['error'](_0x190869(0x152)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>'),0x1;const _0xd3d620=_0x212481[0x0],_0x1fe5e1=_0x56e042,_0x58d132=await resolveWorkspaceIdFromOptions(_0x1fe5e1,_0x3ab1fe),_0x3671cd=_0x1fe5e1[_0x190869(0x138)],_0x3f27d0=_0x56e042[_0x190869(0x13b)];if(_0x3671cd){const _0x2164e3=await withSpinner(_0x190869(0x18f)+_0xd3d620+_0x190869(0x129),()=>_0x3ab1fe[_0x190869(0x183)][_0x190869(0x161)](_0xd3d620,_0x58d132),{'verbose':_0x56e042[_0x190869(0x154)]}),_0x5048ca=_0x2164e3[_0x190869(0x121)],_0x5d7382=_0x5048ca[_0x190869(0x16e)]['workspaceId']?getCampaignUrl(_0x3f27d0,_0x5048ca[_0x190869(0x16e)][_0x190869(0x14a)],_0x5048ca['id']):undefined;await handleSDKOutput([{..._0x5048ca,..._0x5d7382&&{'url':_0x5d7382}}],_0x56e042);}else{const _0x162a27=await withSpinner(_0x190869(0x18f)+_0xd3d620+_0x190869(0x129),()=>_0x3ab1fe[_0x190869(0x183)][_0x190869(0x172)](_0xd3d620,_0x58d132),{'verbose':_0x56e042['verbose']}),_0x1aa18d=_0x162a27['data'],_0x2080c1=_0x1aa18d['workspaceId']?getCampaignUrl(_0x3f27d0,_0x1aa18d['workspaceId'],_0x1aa18d['id']):undefined;await handleSingleObjectOutput({..._0x1aa18d,..._0x2080c1&&{'url':_0x2080c1}},_0x56e042);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{['name']='engage:campaign:create';[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x116);async[a20_0x5043dd(0x11b)](_0x3cc82e){const _0x55513b=a20_0x5043dd,{options:_0x3c1193,tdx:_0x3dfdda}=_0x3cc82e,_0x2762b1=_0x3c1193,_0x494cc2=_0x2762b1[_0x55513b(0x114)],_0x56ac17=_0x2762b1[_0x55513b(0x108)];if(!_0x494cc2)return console[_0x55513b(0x11d)]('Error:\x20--name\x20is\x20required'),console['error'](_0x55513b(0x135)),0x1;if(!_0x56ac17)return console[_0x55513b(0x11d)](_0x55513b(0x140)),console[_0x55513b(0x11d)](_0x55513b(0x135)),0x1;const _0x351bc8=await resolveWorkspaceIdFromOptions(_0x2762b1,_0x3dfdda,!![]),_0x1cd5c1=await resolveSegmentFromOptions(_0x2762b1,_0x3dfdda),_0x4e1d81=buildConnectorConfig(_0x2762b1),_0x5e2f1f={'name':_0x494cc2,'campaignType':_0x56ac17,'workspaceId':_0x351bc8,'description':_0x2762b1['description'],..._0x1cd5c1,'connectorConfig':_0x4e1d81,'startAt':_0x2762b1['startAt'],'timezone':_0x2762b1[_0x55513b(0x17d)]},_0x11a0aa=await withSpinner(_0x55513b(0x132)+_0x494cc2+_0x55513b(0x129),()=>_0x3dfdda[_0x55513b(0x183)][_0x55513b(0x181)](_0x5e2f1f));return await handleSDKOutput([_0x11a0aa['data']],_0x3c1193),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a20_0x5043dd(0x114)]='engage:campaign:update';[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x16c);async[a20_0x5043dd(0x11b)](_0x19f438){const _0x4427f7=a20_0x5043dd,{options:_0x1b5b8c,args:_0x3d8001,tdx:_0x1e55a8}=_0x19f438;if(_0x3d8001[_0x4427f7(0x109)]===0x0)return console[_0x4427f7(0x11d)](_0x4427f7(0x152)),console['error'](_0x4427f7(0x102)),0x1;const _0x5d62b6=_0x3d8001[0x0],_0x3fb1f6=_0x1b5b8c,_0xdfa99f=await resolveWorkspaceIdFromOptions(_0x3fb1f6,_0x1e55a8),_0x534234=await resolveSegmentFromOptions(_0x3fb1f6,_0x1e55a8),_0x1334e9=buildConnectorConfig(_0x3fb1f6),_0x4ed9df={'name':_0x3fb1f6['name'],'description':_0x3fb1f6[_0x4427f7(0x18c)],..._0x534234,'connectorConfig':_0x1334e9,'startAt':_0x3fb1f6[_0x4427f7(0x139)],'timezone':_0x3fb1f6[_0x4427f7(0x17d)]},_0x22f0aa=Object['fromEntries'](Object['entries'](_0x4ed9df)['filter'](([,_0x27fdc3])=>_0x27fdc3!==undefined));if(Object['keys'](_0x22f0aa)[_0x4427f7(0x109)]===0x0)return console[_0x4427f7(0x11d)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console['error'](_0x4427f7(0x11e)),0x1;const _0x14a6f9=await withSpinner('Updating\x20campaign\x20\x27'+_0x5d62b6+'\x27...',()=>_0x1e55a8[_0x4427f7(0x183)]['updateCampaign'](_0x5d62b6,_0x22f0aa,_0xdfa99f),{'verbose':_0x1b5b8c[_0x4427f7(0x154)]});return await handleSDKOutput([_0x14a6f9[_0x4427f7(0x121)]],_0x1b5b8c),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a20_0x5043dd(0x114)]=a20_0x5043dd(0x185);[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x10a);async['execute'](_0x4793a6){const _0x304a30=a20_0x5043dd,{options:_0x19f654,args:_0x2ee37d,tdx:_0x46f3e9}=_0x4793a6;if(_0x2ee37d[_0x304a30(0x109)]===0x0)return console['error'](_0x304a30(0x152)),console[_0x304a30(0x11d)]('Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>'),0x1;const _0x1bdbd9=_0x2ee37d[0x0],_0x4d1a86=_0x19f654,_0x322127=await resolveWorkspaceIdFromOptions(_0x4d1a86,_0x46f3e9);if(!_0x19f654[_0x304a30(0x16a)]){const _0x4ee401=await confirm(_0x304a30(0x17c)+_0x1bdbd9+_0x304a30(0x12d));if(!_0x4ee401)return console[_0x304a30(0x142)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x304a30(0x164)+_0x1bdbd9+_0x304a30(0x129),()=>_0x46f3e9['engage'][_0x304a30(0x165)](_0x1bdbd9,_0x322127),{'verbose':_0x19f654[_0x304a30(0x154)]}),console[_0x304a30(0x142)](_0x304a30(0x180)+_0x1bdbd9+'\x27\x20deleted\x20successfully'),0x0;}}function a20_0x6223(_0x54efad,_0x4fb7d6){_0x54efad=_0x54efad-0xfc;const _0x5761b6=a20_0x5761();let _0x6223e9=_0x5761b6[_0x54efad];return _0x6223e9;}export class EngageCampaignLaunchCommand extends BaseCommand{[a20_0x5043dd(0x114)]='engage:campaign:launch';[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x171);async[a20_0x5043dd(0x11b)](_0x22936a){const _0x58f510=a20_0x5043dd,{options:_0x888896,args:_0x278d48,tdx:_0x51f48f}=_0x22936a;if(_0x278d48[_0x58f510(0x109)]===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x58f510(0x11d)](_0x58f510(0x125)),0x1;const _0x395e2d=_0x278d48[0x0],_0x5e6dc2=_0x888896,_0x565f92=await resolveWorkspaceIdFromOptions(_0x5e6dc2,_0x51f48f);return await withSpinner('Launching\x20campaign\x20\x27'+_0x395e2d+_0x58f510(0x129),()=>_0x51f48f[_0x58f510(0x183)][_0x58f510(0x187)](_0x395e2d,_0x565f92),{'verbose':_0x888896[_0x58f510(0x154)]}),console[_0x58f510(0x142)](_0x58f510(0x180)+_0x395e2d+'\x27\x20launched\x20successfully'),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{['name']=a20_0x5043dd(0x101);[a20_0x5043dd(0x18c)]='Pause\x20a\x20campaign';async['execute'](_0x545970){const _0x18cb6e=a20_0x5043dd,{options:_0x151898,args:_0x33beb9,tdx:_0x812a3e}=_0x545970;if(_0x33beb9[_0x18cb6e(0x109)]===0x0)return console[_0x18cb6e(0x11d)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x18cb6e(0x11d)]('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0xea52d4=_0x33beb9[0x0],_0x16e40d=_0x151898,_0x579406=await resolveWorkspaceIdFromOptions(_0x16e40d,_0x812a3e);return await withSpinner(_0x18cb6e(0x117)+_0xea52d4+_0x18cb6e(0x129),()=>_0x812a3e[_0x18cb6e(0x183)][_0x18cb6e(0x170)](_0xea52d4,_0x579406),{'verbose':_0x151898['verbose']}),console['log'](_0x18cb6e(0x180)+_0xea52d4+_0x18cb6e(0x162)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a20_0x5043dd(0x114)]=a20_0x5043dd(0x16f);[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x166);async['execute'](_0x101212){const _0xc0e115=a20_0x5043dd,{options:_0x4f5da3,args:_0x293a39,tdx:_0x19a84b}=_0x101212;if(_0x293a39[_0xc0e115(0x109)]===0x0)return console[_0xc0e115(0x11d)](_0xc0e115(0x152)),console[_0xc0e115(0x11d)]('Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>'),0x1;const _0x194442=_0x293a39[0x0],_0x5c2dc3=_0x4f5da3,_0x628b7b=await resolveWorkspaceIdFromOptions(_0x5c2dc3,_0x19a84b);return await withSpinner(_0xc0e115(0x128)+_0x194442+_0xc0e115(0x129),()=>_0x19a84b[_0xc0e115(0x183)][_0xc0e115(0x10d)](_0x194442,_0x628b7b),{'verbose':_0x4f5da3[_0xc0e115(0x154)]}),console[_0xc0e115(0x142)](_0xc0e115(0x180)+_0x194442+_0xc0e115(0x136)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a20_0x5043dd(0x114)]=a20_0x5043dd(0x112);['description']=a20_0x5043dd(0x118);async['execute'](_0x1a1764){const _0x48938b=a20_0x5043dd,{options:_0x47a95c,args:_0x23ba64,tdx:_0x3e84c9}=_0x1a1764;if(_0x23ba64[_0x48938b(0x109)]===0x0)return console[_0x48938b(0x11d)](_0x48938b(0x152)),console['error'](_0x48938b(0x189)),0x1;const _0x438c14=_0x23ba64[0x0],_0x918390=_0x47a95c,_0x2a25f7=await resolveWorkspaceIdFromOptions(_0x918390,_0x3e84c9),_0xe9e97e=await withSpinner(_0x48938b(0x15e)+_0x438c14+_0x48938b(0x129),()=>_0x3e84c9[_0x48938b(0x183)][_0x48938b(0x179)](_0x438c14,_0x2a25f7),{'verbose':_0x47a95c[_0x48938b(0x154)]});return await handleSDKOutput([_0xe9e97e[_0x48938b(0x121)]],_0x47a95c),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a20_0x5043dd(0x114)]=a20_0x5043dd(0x16b);[a20_0x5043dd(0x18c)]='List\x20email\x20templates';async[a20_0x5043dd(0x11b)](_0x148eb3){const _0x464a53=a20_0x5043dd,{options:_0x174c65,args:_0x191584,tdx:_0x12ec8c}=_0x148eb3,_0x2ef509=_0x191584[0x0],_0x28a441=resolveLimit(_0x174c65[_0x464a53(0x18a)],DEFAULT_LLM_LIMIT),_0x4d8c88=_0x174c65,_0x4fa443=await resolveWorkspaceIdFromOptions(_0x4d8c88,_0x12ec8c),_0x4e7733=await withSpinner(_0x464a53(0x13f),()=>_0x12ec8c[_0x464a53(0x183)][_0x464a53(0x14f)]({'workspaceId':_0x4fa443,'limit':_0x28a441}),{'verbose':_0x174c65[_0x464a53(0x154)]});let _0x4485c8=_0x4e7733[_0x464a53(0x121)];return _0x2ef509&&(_0x4485c8=_0x4e7733['data'][_0x464a53(0x16d)](_0x497de2=>matchGlobPattern(_0x497de2[_0x464a53(0x114)],_0x2ef509))),await handleSDKOutput(_0x4485c8,_0x174c65),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a20_0x5043dd(0x114)]='engage:template:show';[a20_0x5043dd(0x18c)]='Show\x20email\x20template\x20details';async[a20_0x5043dd(0x11b)](_0x2efb81){const _0x2d96ab=a20_0x5043dd,{options:_0x188b55,args:_0x4afda3,tdx:_0xfb5ee2}=_0x2efb81;if(_0x4afda3[_0x2d96ab(0x109)]===0x0)return console[_0x2d96ab(0x11d)](_0x2d96ab(0x159)),console[_0x2d96ab(0x11d)]('Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>'),0x1;const _0x31500c=_0x4afda3[0x0],_0xacdd5=_0x188b55,_0x1dc245=await resolveWorkspaceIdFromOptions(_0xacdd5,_0xfb5ee2),_0x2278e8=_0xacdd5[_0x2d96ab(0x138)];if(_0x2278e8){const _0x30ccd4=await withSpinner(_0x2d96ab(0x13d)+_0x31500c+_0x2d96ab(0x129),()=>_0xfb5ee2['engage'][_0x2d96ab(0x131)](_0x31500c,_0x1dc245),{'verbose':_0x188b55['verbose']});await handleSDKOutput([_0x30ccd4],_0x188b55);}else{const _0xd7fef9=await withSpinner(_0x2d96ab(0x13d)+_0x31500c+'\x27...',()=>_0xfb5ee2[_0x2d96ab(0x183)][_0x2d96ab(0xfd)](_0x31500c,_0x1dc245),{'verbose':_0x188b55['verbose']});await handleSDKOutput([_0xd7fef9],_0x188b55);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a20_0x5043dd(0x114)]=a20_0x5043dd(0x10b);[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x17b);async[a20_0x5043dd(0x11b)](_0x594db9){const _0x318ff9=a20_0x5043dd,{options:_0x21dcb5,tdx:_0x124c6c}=_0x594db9,_0x5d095d=_0x21dcb5,_0x46331b=_0x5d095d[_0x318ff9(0x114)],_0x167d26=_0x5d095d[_0x318ff9(0x176)],_0x517f31=_0x5d095d['html'],_0x2f3036=_0x5d095d[_0x318ff9(0x167)];if(!_0x46331b)return console[_0x318ff9(0x11d)](_0x318ff9(0x175)),console[_0x318ff9(0x11d)](_0x318ff9(0x120)),0x1;if(!_0x167d26)return console['error']('Error:\x20--subject\x20is\x20required'),0x1;if(_0x517f31&&_0x2f3036)return console[_0x318ff9(0x11d)](_0x318ff9(0x13a)),0x1;const _0x589f02=_0x2f3036?readFileContent(_0x2f3036):_0x517f31;if(!_0x589f02)return console[_0x318ff9(0x11d)](_0x318ff9(0x182)),0x1;const _0x1d3c91=await resolveWorkspaceIdFromOptions(_0x5d095d,_0x124c6c,!![]),_0x5d868a={'name':_0x46331b,'subjectTemplate':_0x167d26,'htmlTemplate':_0x589f02,'workspaceId':_0x1d3c91,'plaintextTemplate':_0x5d095d[_0x318ff9(0x14d)],'editorType':_0x5d095d[_0x318ff9(0x110)]},_0x8a39fe=await withSpinner(_0x318ff9(0x173)+_0x46331b+_0x318ff9(0x129),()=>_0x124c6c[_0x318ff9(0x183)]['createTemplate'](_0x5d868a));return await handleSDKOutput([_0x8a39fe[_0x318ff9(0x121)]],_0x21dcb5),0x0;}}function a20_0x5761(){const _0x41a565=['151NxpkYp','Update\x20an\x20email\x20template','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','3833030wnWiSe','status','type','length','Delete\x20a\x20campaign','engage:template:create','Updating\x20template\x20\x27','resumeCampaign','Fetching\x20campaigns...','jsonl','editorType','1809918LcyRPE','engage:campaign:duplicate','engage_workspace','name','listCampaigns','Create\x20a\x20new\x20campaign','Pausing\x20campaign\x20\x27','Duplicate\x20a\x20campaign','format','Update\x20a\x20workspace','execute','Create\x20a\x20workspace','error','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','engage:workspace:update','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','data','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','listWorkspaces','1726782qIuHtB','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','Workspace\x20is\x20required\x20for\x20this\x20operation','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Resuming\x20campaign\x20\x27','\x27...','Template\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','4433hAbhVL','\x27?\x20This\x20cannot\x20be\x20undone.','parentName','engage:campaigns','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','getTemplateFull','Creating\x20campaign\x20\x27','resolveWorkspaceId','Updating\x20workspace\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','\x27\x20resumed\x20successfully','Set\x20workspace\x20context\x20for\x20Engage\x20commands','full','startAt','Error:\x20Cannot\x20specify\x20both\x20--html\x20and\x20--html-file','site','updateWorkspace','Fetching\x20template\x20\x27','Creating\x20workspace\x20\x27','Fetching\x20templates...','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Fetching\x20workspaces...','log','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','deleteWorkspace','Verifying\x20workspace\x20\x27','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','Show\x20campaign\x20details','html','engage:workspaces','workspaceId','8pOiCkz','Options:\x20--name,\x20--description','plaintext','28686kcMTGZ','listTemplates','\x27\x20deleted\x20successfully','segment','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','deleteTemplate','verbose','11pVakzL','jsonColumns','96FpRRzH','emailSenderId','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Delete\x20an\x20email\x20template','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','engage:workspace:show','Duplicating\x20campaign\x20\x27','1006ARRdiC','Deleting\x20template\x20\x27','getCampaignFull','\x27\x20paused\x20successfully','Delete\x20a\x20workspace','Deleting\x20campaign\x20\x27','deleteCampaign','Resume\x20a\x20paused\x20campaign','htmlFile','5prTvGk','json','yes','engage:templates','Update\x20a\x20campaign','filter','attributes','engage:campaign:resume','pauseCampaign','Launch\x20a\x20campaign','getCampaign','Creating\x20template\x20\x27','engage:campaign:show','Error:\x20--name\x20is\x20required','subject','entries','resolvePathToResource','duplicateCampaign','engage:workspace:use','Create\x20an\x20email\x20template','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','timezone','session','Operation\x20cancelled','Campaign\x20\x27','createCampaign','Error:\x20Either\x20--html\x20or\x20--html-file\x20is\x20required','engage','2565983yZlObj','engage:campaign:delete','List\x20workspaces','launchCampaign','map','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','limit','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','description','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','fromEntries','Fetching\x20campaign\x20\x27','getWorkspaceFull','Workspace\x20\x27','segmentId','getTemplate','Fetching\x20workspace\x20\x27','41988DgjlhE','keys','engage:campaign:pause','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'];a20_0x5761=function(){return _0x41a565;};return a20_0x5761();}export class EngageTemplateUpdateCommand extends BaseCommand{[a20_0x5043dd(0x114)]='engage:template:update';[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x104);async[a20_0x5043dd(0x11b)](_0x2bf84a){const _0x4796cc=a20_0x5043dd,{options:_0x7c7297,args:_0x571128,tdx:_0x37efb2}=_0x2bf84a;if(_0x571128[_0x4796cc(0x109)]===0x0)return console[_0x4796cc(0x11d)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x4796cc(0x11d)](_0x4796cc(0x18b)),0x1;const _0x408ec9=_0x571128[0x0],_0x5bca07=_0x7c7297,_0x2d590f=_0x5bca07[_0x4796cc(0x148)],_0xb7139=_0x5bca07[_0x4796cc(0x167)];if(_0x2d590f&&_0xb7139)return console['error'](_0x4796cc(0x13a)),0x1;const _0xe57802=_0xb7139?readFileContent(_0xb7139):_0x2d590f,_0x366263=await resolveWorkspaceIdFromOptions(_0x5bca07,_0x37efb2),_0x425a1d={'name':_0x5bca07['name'],'subjectTemplate':_0x5bca07['subject'],'htmlTemplate':_0xe57802,'plaintextTemplate':_0x5bca07[_0x4796cc(0x14d)]},_0x536b72=Object[_0x4796cc(0x18e)](Object[_0x4796cc(0x177)](_0x425a1d)[_0x4796cc(0x16d)](([,_0x165e1a])=>_0x165e1a!==undefined));if(Object[_0x4796cc(0x100)](_0x536b72)[_0x4796cc(0x109)]===0x0)return console[_0x4796cc(0x11d)](_0x4796cc(0x105)),console[_0x4796cc(0x11d)]('Options:\x20--name,\x20--subject,\x20--html,\x20--html-file,\x20--plaintext'),0x1;const _0x2aecaf=await withSpinner(_0x4796cc(0x10c)+_0x408ec9+_0x4796cc(0x129),()=>_0x37efb2[_0x4796cc(0x183)]['updateTemplate'](_0x408ec9,_0x536b72,_0x366263),{'verbose':_0x7c7297[_0x4796cc(0x154)]});return await handleSDKOutput([_0x2aecaf['data']],_0x7c7297),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a20_0x5043dd(0x114)]='engage:template:delete';[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x15b);async[a20_0x5043dd(0x11b)](_0x558e07){const _0x54b5f7=a20_0x5043dd,{options:_0x42175d,args:_0x363afc,tdx:_0x2a42c0}=_0x558e07;if(_0x363afc[_0x54b5f7(0x109)]===0x0)return console[_0x54b5f7(0x11d)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x54b5f7(0x11d)](_0x54b5f7(0x143)),0x1;const _0x2f90bf=_0x363afc[0x0],_0x392d16=_0x42175d,_0x4beb57=await resolveWorkspaceIdFromOptions(_0x392d16,_0x2a42c0);if(!_0x42175d[_0x54b5f7(0x16a)]){const _0x546eaf=await confirm(_0x54b5f7(0x12b)+_0x2f90bf+_0x54b5f7(0x12d));if(!_0x546eaf)return console[_0x54b5f7(0x142)](_0x54b5f7(0x17f)),0x0;}return await withSpinner(_0x54b5f7(0x160)+_0x2f90bf+_0x54b5f7(0x129),()=>_0x2a42c0[_0x54b5f7(0x183)][_0x54b5f7(0x153)](_0x2f90bf,_0x4beb57),{'verbose':_0x42175d[_0x54b5f7(0x154)]}),console[_0x54b5f7(0x142)](_0x54b5f7(0x12a)+_0x2f90bf+_0x54b5f7(0x150)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a20_0x5043dd(0x114)]=a20_0x5043dd(0x149);[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x186);async['execute'](_0x20b1a5){const _0x38b4a7=a20_0x5043dd,{options:_0xb95695,args:_0x52ee5e,tdx:_0x1628dc}=_0x20b1a5,_0xf00366=_0x52ee5e[0x0],_0x2c23f4=resolveLimit(_0xb95695[_0x38b4a7(0x18a)],DEFAULT_LLM_LIMIT),_0x52a6ce=await withSpinner(_0x38b4a7(0x141),()=>_0x1628dc['engage'][_0x38b4a7(0x123)]({'limit':_0x2c23f4}),{'verbose':_0xb95695['verbose']});let _0x445e81=_0x52a6ce[_0x38b4a7(0x121)];return _0xf00366&&(_0x445e81=_0x52a6ce[_0x38b4a7(0x121)][_0x38b4a7(0x16d)](_0x58185c=>matchGlobPattern(_0x58185c[_0x38b4a7(0x114)],_0xf00366))),await handleSDKOutput(_0x445e81,_0xb95695),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{['name']=a20_0x5043dd(0x15d);[a20_0x5043dd(0x18c)]='Show\x20workspace\x20details';async[a20_0x5043dd(0x11b)](_0x138fe8){const _0x349fec=a20_0x5043dd,{options:_0x198010,args:_0x118c99,tdx:_0x3b38a6}=_0x138fe8;if(_0x118c99[_0x349fec(0x109)]===0x0)return console[_0x349fec(0x11d)](_0x349fec(0x130)),console['error'](_0x349fec(0x122)),0x1;const _0x3f521c=_0x118c99[0x0],_0x51efe0=_0x198010,_0x410f6c=_0x51efe0[_0x349fec(0x138)];if(_0x410f6c){const _0x253d01=await withSpinner(_0x349fec(0xfe)+_0x3f521c+_0x349fec(0x129),()=>_0x3b38a6['engage'][_0x349fec(0x190)](_0x3f521c),{'verbose':_0x198010[_0x349fec(0x154)]});await handleSDKOutput([_0x253d01],_0x198010);}else{const _0x3d45c9=await withSpinner(_0x349fec(0xfe)+_0x3f521c+'\x27...',()=>_0x3b38a6[_0x349fec(0x183)]['getWorkspace'](_0x3f521c),{'verbose':_0x198010[_0x349fec(0x154)]});await handleSDKOutput([_0x3d45c9],_0x198010);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']='engage:workspace:create';[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x11c);async[a20_0x5043dd(0x11b)](_0x309a12){const _0x3172f3=a20_0x5043dd,{options:_0x1ec46c,tdx:_0x1750e7}=_0x309a12,_0x4307c0=_0x1ec46c,_0x2b921f=_0x4307c0['name'];if(!_0x2b921f)return console[_0x3172f3(0x11d)](_0x3172f3(0x175)),console[_0x3172f3(0x11d)]('Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]'),0x1;const _0x175f79={'name':_0x2b921f,'description':_0x4307c0['description']},_0x48b48c=await withSpinner(_0x3172f3(0x13e)+_0x2b921f+_0x3172f3(0x129),()=>_0x1750e7['engage']['createWorkspace'](_0x175f79));return await handleSDKOutput([_0x48b48c[_0x3172f3(0x121)]],_0x1ec46c),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a20_0x5043dd(0x114)]=a20_0x5043dd(0x11f);[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x11a);async[a20_0x5043dd(0x11b)](_0x5c524f){const _0x229bfd=a20_0x5043dd,{options:_0x3d6bd9,args:_0x25d33b,tdx:_0x1eccc5}=_0x5c524f;if(_0x25d33b[_0x229bfd(0x109)]===0x0)return console[_0x229bfd(0x11d)](_0x229bfd(0x130)),console['error'](_0x229bfd(0x15a)),0x1;const _0x45dc81=_0x25d33b[0x0],_0x348941=_0x3d6bd9,_0x342946={'name':_0x348941[_0x229bfd(0x114)],'description':_0x348941['description']},_0x1ad1d0=Object[_0x229bfd(0x18e)](Object[_0x229bfd(0x177)](_0x342946)[_0x229bfd(0x16d)](([,_0x3495cc])=>_0x3495cc!==undefined));if(Object[_0x229bfd(0x100)](_0x1ad1d0)[_0x229bfd(0x109)]===0x0)return console[_0x229bfd(0x11d)](_0x229bfd(0x105)),console[_0x229bfd(0x11d)](_0x229bfd(0x14c)),0x1;const _0x397550=await withSpinner(_0x229bfd(0x134)+_0x45dc81+_0x229bfd(0x129),()=>_0x1eccc5[_0x229bfd(0x183)][_0x229bfd(0x13c)](_0x45dc81,_0x1ad1d0),{'verbose':_0x3d6bd9['verbose']});return await handleSDKOutput([_0x397550[_0x229bfd(0x121)]],_0x3d6bd9),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a20_0x5043dd(0x114)]='engage:workspace:delete';[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x163);async[a20_0x5043dd(0x11b)](_0x4aa108){const _0x46c87d=a20_0x5043dd,{options:_0x114eff,args:_0x1fb36b,tdx:_0x2e5a6b}=_0x4aa108;if(_0x1fb36b[_0x46c87d(0x109)]===0x0)return console[_0x46c87d(0x11d)](_0x46c87d(0x130)),console[_0x46c87d(0x11d)](_0x46c87d(0x127)),0x1;const _0x1f00df=_0x1fb36b[0x0];if(!_0x114eff[_0x46c87d(0x16a)]){const _0x25c199=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27'+_0x1f00df+_0x46c87d(0x12d));if(!_0x25c199)return console['log'](_0x46c87d(0x17f)),0x0;}return await withSpinner('Deleting\x20workspace\x20\x27'+_0x1f00df+'\x27...',()=>_0x2e5a6b[_0x46c87d(0x183)][_0x46c87d(0x144)](_0x1f00df),{'verbose':_0x114eff[_0x46c87d(0x154)]}),console[_0x46c87d(0x142)](_0x46c87d(0x191)+_0x1f00df+_0x46c87d(0x150)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a20_0x5043dd(0x114)]=a20_0x5043dd(0x17a);[a20_0x5043dd(0x18c)]=a20_0x5043dd(0x137);async[a20_0x5043dd(0x11b)](_0x52d46e){const _0x312d3c=a20_0x5043dd,{options:_0x2336ef,args:_0x32310c,tdx:_0xb846b2}=_0x52d46e;if(_0x32310c[_0x312d3c(0x109)]===0x0)return console[_0x312d3c(0x11d)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0x312d3c(0x11d)](_0x312d3c(0x18d)),0x1;const _0x1621f7=_0x32310c[0x0];await withSpinner(_0x312d3c(0x145)+_0x1621f7+'\x27...',()=>_0xb846b2['engage'][_0x312d3c(0x133)](_0x1621f7));const _0x2fb08c=_0x2336ef[_0x312d3c(0x17e)]||undefined;return saveSessionContext({'engage_workspace':_0x1621f7},_0x2fb08c),console[_0x312d3c(0x142)]('Engage\x20workspace\x20set\x20to:\x20'+_0x1621f7),console[_0x312d3c(0x142)](_0x312d3c(0x15c)),0x0;}}
@@ -1 +1 @@
1
- function a21_0x3152(){const _0x154f05=['Submitting\x20job...','Submitting\x20kill\x20request...','Job\x20type:\x20','file','9147bCThVR','type','βœ”\x20Retrieved\x20','1037060yQgnLq','created_at','database','10870TtkTtk','getTime','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','execute','job:submit','Submit\x20a\x20job','length','information_schema','trino','query','yes','\x20jobs','job_id','INVALID_ARGUMENT','user_name','Cancelled','hive','Show\x20job\x20details','limit','job:result','4147641qaWMVK','Listing\x20jobs...','Getting\x20job\x20details...','12RbairG','priority','verbose','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','268CcYLmm','job:kill','start_at','3096528IqrWBs','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','status','debug','Status\x20filter:\x20','...','end_at','data','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','510902THKIyE','jobType','jobs','description','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','map','\x20job','args','Query:\x20','error','name','round','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','βœ”\x20Found\x20','validate','kill','Kill\x20a\x20job','Database:\x20','2tpETOn','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','\x27\x20to\x20verify\x20the\x20job\x20status','\x20row','url','Get\x20job\x20results','3377qVCYAj','1044652UkdaPD','Limit:\x20','submit'];a21_0x3152=function(){return _0x154f05;};return a21_0x3152();}const a21_0x595ddb=a21_0x26ca;(function(_0x184cd6,_0x4ea136){const _0x6137b1=a21_0x26ca,_0x15b832=_0x184cd6();while(!![]){try{const _0x1efd10=-parseInt(_0x6137b1(0x19a))/0x1*(-parseInt(_0x6137b1(0x188))/0x2)+parseInt(_0x6137b1(0x1a8))/0x3*(-parseInt(_0x6137b1(0x17c))/0x4)+parseInt(_0x6137b1(0x1ab))/0x5*(-parseInt(_0x6137b1(0x178))/0x6)+-parseInt(_0x6137b1(0x1a1))/0x7+parseInt(_0x6137b1(0x17f))/0x8+parseInt(_0x6137b1(0x175))/0x9+parseInt(_0x6137b1(0x1ae))/0xa*(-parseInt(_0x6137b1(0x1a0))/0xb);if(_0x1efd10===_0x4ea136)break;else _0x15b832['push'](_0x15b832['shift']());}catch(_0x556e05){_0x15b832['push'](_0x15b832['shift']());}}}(a21_0x3152,0x3eafd));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{['name']=a21_0x595ddb(0x18a);[a21_0x595ddb(0x18b)]='List\x20jobs';async[a21_0x595ddb(0x1b1)](_0x1da782){const _0x1d1362=a21_0x595ddb,{options:_0x5d6451,tdx:_0x4f0b35}=_0x1da782,_0x3b0220=resolveLimit(_0x5d6451[_0x1d1362(0x173)],DEFAULT_DISPLAY_LIMIT),_0xfc1c25=_0x5d6451[_0x1d1362(0x181)];_0x5d6451[_0x1d1362(0x17a)]&&(console[_0x1d1362(0x191)](_0x1d1362(0x1a2)+_0x3b0220+_0x1d1362(0x16c)),_0xfc1c25&&console[_0x1d1362(0x191)](_0x1d1362(0x183)+_0xfc1c25));const _0x5333b8=await withSpinner(_0x1d1362(0x176),()=>_0x4f0b35[_0x1d1362(0x18a)]['list']({'from':0x0,'to':_0x3b0220-0x1,'status':_0xfc1c25}),{'verbose':_0x5d6451[_0x1d1362(0x17a)]}),_0x3ba58a=_0x5333b8[_0x1d1362(0x186)];console[_0x1d1362(0x191)](_0x1d1362(0x195)+_0x3ba58a[_0x1d1362(0x1b4)]+_0x1d1362(0x18e)+(_0x3ba58a[_0x1d1362(0x1b4)]!==0x1?'s':''));const _0x7dbbc9=_0x3ba58a[_0x1d1362(0x18d)](_0x75f800=>{const _0x1cb4ab=_0x1d1362;let _0x5e207b;if(_0x75f800[_0x1cb4ab(0x17e)]&&_0x75f800[_0x1cb4ab(0x185)]){const _0x420446=new Date(_0x75f800[_0x1cb4ab(0x17e)])[_0x1cb4ab(0x1af)](),_0x31a738=new Date(_0x75f800[_0x1cb4ab(0x185)])[_0x1cb4ab(0x1af)]();_0x5e207b=Math[_0x1cb4ab(0x193)]((_0x31a738-_0x420446)/0x3e8);}return{'job_id':_0x75f800['job_id'],'type':_0x75f800['type'],'status':_0x75f800['status'],'user_name':_0x75f800[_0x1cb4ab(0x16f)],'duration_sec':_0x5e207b,'created_at':_0x75f800[_0x1cb4ab(0x1ac)],'started_at':_0x75f800[_0x1cb4ab(0x17e)],'end_at':_0x75f800['end_at']};});return await handleSDKOutput(_0x7dbbc9,_0x5d6451),0x0;}}export class JobShowCommand extends BaseCommand{[a21_0x595ddb(0x192)]='job:show';[a21_0x595ddb(0x18b)]=a21_0x595ddb(0x172);[a21_0x595ddb(0x196)](_0xc9e8d){const _0x5cce1a=a21_0x595ddb,_0x5c4848=_0xc9e8d[_0x5cce1a(0x18f)][0x0];if(!_0x5c4848)return _0x5cce1a(0x1b0);return undefined;}async[a21_0x595ddb(0x1b1)](_0x42a90e){const _0x248911=a21_0x595ddb,{options:_0x3b66ed,args:_0x1f7cc7,tdx:_0x52119a}=_0x42a90e,_0x1ce5f9=_0x1f7cc7[0x0],_0x5be31a=await withSpinner(_0x248911(0x177),()=>_0x52119a[_0x248911(0x18a)]['show'](_0x1ce5f9),{'verbose':_0x3b66ed[_0x248911(0x17a)]}),_0x482943=_0x5be31a[_0x248911(0x186)];let _0x54e1ca;if(_0x482943['start_at']&&_0x482943['end_at']){const _0x49b42f=new Date(_0x482943[_0x248911(0x17e)])[_0x248911(0x1af)](),_0x41528b=new Date(_0x482943['end_at'])[_0x248911(0x1af)]();_0x54e1ca=Math[_0x248911(0x193)]((_0x41528b-_0x49b42f)/0x3e8);}const _0x4a4b17={'job_id':_0x482943['job_id'],'type':_0x482943[_0x248911(0x1a9)],'status':_0x482943['status'],..._0x482943[_0x248911(0x16f)]&&{'user_name':_0x482943['user_name']},..._0x54e1ca!==undefined&&{'duration_sec':_0x54e1ca},..._0x482943[_0x248911(0x1ac)]&&{'created_at':_0x482943['created_at']},..._0x482943[_0x248911(0x17e)]&&{'started_at':_0x482943['start_at']},..._0x482943[_0x248911(0x185)]&&{'end_at':_0x482943[_0x248911(0x185)]},..._0x482943[_0x248911(0x1ad)]&&{'database':_0x482943[_0x248911(0x1ad)]},..._0x482943[_0x248911(0x179)]!==undefined&&{'priority':_0x482943[_0x248911(0x179)]},..._0x482943[_0x248911(0x19e)]&&{'url':_0x482943[_0x248911(0x19e)]},..._0x482943[_0x248911(0x16a)]&&{'query':_0x482943[_0x248911(0x16a)]},..._0x482943['debug']&&{'debug':_0x482943[_0x248911(0x182)]}};return await handleSingleObjectOutput(_0x4a4b17,_0x3b66ed),0x0;}}export class JobKillCommand extends BaseCommand{[a21_0x595ddb(0x192)]=a21_0x595ddb(0x17d);[a21_0x595ddb(0x18b)]=a21_0x595ddb(0x198);['validate'](_0x131f35){const _0x42e52e=a21_0x595ddb,_0x251333=_0x131f35[_0x42e52e(0x18f)][0x0];if(!_0x251333)return _0x42e52e(0x19b);return undefined;}async['execute'](_0x452dbd){const _0x4c751c=a21_0x595ddb,{options:_0xe089db,args:_0x37fa5a,tdx:_0x3c35f6}=_0x452dbd,_0x67cb63=_0x37fa5a[0x0];if(!_0xe089db[_0x4c751c(0x16b)]){const _0x25fedc=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x67cb63+'?');if(!_0x25fedc)return console[_0x4c751c(0x191)](_0x4c751c(0x170)),0x0;}return await withSpinner(_0x4c751c(0x1a5),()=>_0x3c35f6[_0x4c751c(0x18a)][_0x4c751c(0x197)](_0x67cb63),{'verbose':_0xe089db[_0x4c751c(0x17a)]}),console[_0x4c751c(0x191)]('βœ”\x20Kill\x20request\x20submitted\x20for\x20job\x20'+_0x67cb63),console['error'](_0x4c751c(0x18c)+_0x67cb63+_0x4c751c(0x19c)),0x0;}}function a21_0x26ca(_0x407b15,_0x1bf40d){_0x407b15=_0x407b15-0x169;const _0x3152df=a21_0x3152();let _0x26ca09=_0x3152df[_0x407b15];return _0x26ca09;}export class JobSubmitCommand extends BaseCommand{[a21_0x595ddb(0x192)]=a21_0x595ddb(0x1b2);['description']=a21_0x595ddb(0x1b3);async['execute'](_0x30ec33){const _0x14f7fd=a21_0x595ddb,{options:_0x32804f,args:_0x28d6c5,tdx:_0x37459e}=_0x30ec33,_0x90b103=_0x32804f[_0x14f7fd(0x189)]||'trino',_0x2a678b=_0x32804f[_0x14f7fd(0x1a7)],_0x2c19ae=_0x32804f[_0x14f7fd(0x1ad)]||_0x14f7fd(0x1b5),_0x19654b=_0x32804f['result'];if(_0x90b103!==_0x14f7fd(0x169)&&_0x90b103!==_0x14f7fd(0x171))throw new SDKError(ErrorCode[_0x14f7fd(0x16e)],'--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22');let _0x1478f5;if(_0x2a678b){if(_0x28d6c5[0x0])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x14f7fd(0x17b));const _0x5120ab=readSqlStatementsFromFile(_0x2a678b);if(_0x5120ab['length']===0x0)throw new SDKError(ErrorCode[_0x14f7fd(0x16e)],'No\x20SQL\x20statements\x20found\x20in\x20file');if(_0x5120ab[_0x14f7fd(0x1b4)]>0x1)throw new SDKError(ErrorCode[_0x14f7fd(0x16e)],_0x14f7fd(0x187));_0x1478f5=_0x5120ab[0x0];}else{if(!_0x28d6c5[0x0])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x14f7fd(0x180));_0x1478f5=_0x28d6c5[0x0];}_0x32804f[_0x14f7fd(0x17a)]&&(console[_0x14f7fd(0x191)](_0x14f7fd(0x1a6)+_0x90b103),console[_0x14f7fd(0x191)](_0x14f7fd(0x199)+_0x2c19ae),console[_0x14f7fd(0x191)](_0x14f7fd(0x190)+_0x1478f5['substring'](0x0,0x64)+(_0x1478f5['length']>0x64?_0x14f7fd(0x184):'')));const _0x12b503=await withSpinner(_0x14f7fd(0x1a4),()=>_0x37459e[_0x14f7fd(0x18a)][_0x14f7fd(0x1a3)](_0x2c19ae,_0x1478f5,_0x90b103,_0x19654b),{'verbose':_0x32804f[_0x14f7fd(0x17a)]}),_0xc5e3a3=_0x12b503[_0x14f7fd(0x186)];return console[_0x14f7fd(0x191)]('βœ”\x20Job\x20submitted'),console[_0x14f7fd(0x191)]('\x20\x20Job\x20ID:\x20'+_0xc5e3a3[_0x14f7fd(0x16d)]),await handleSDKOutput([_0xc5e3a3],_0x32804f),0x0;}}export class JobResultCommand extends BaseCommand{[a21_0x595ddb(0x192)]=a21_0x595ddb(0x174);['description']=a21_0x595ddb(0x19f);[a21_0x595ddb(0x196)](_0x31713c){const _0x5baaad=a21_0x595ddb,_0x3b3725=_0x31713c[_0x5baaad(0x18f)][0x0];if(!_0x3b3725)return _0x5baaad(0x194);return undefined;}async[a21_0x595ddb(0x1b1)](_0x5b92c9){const _0x9ff44=a21_0x595ddb,{options:_0x18de21,args:_0x4eb1e8,tdx:_0x47fd0d}=_0x5b92c9,_0x385df8=_0x4eb1e8[0x0],_0x32fda8=await withSpinner('Getting\x20job\x20results...',()=>_0x47fd0d['jobs']['result'](_0x385df8),{'verbose':_0x18de21['verbose']}),_0x5f2498=_0x32fda8[_0x9ff44(0x186)];return console[_0x9ff44(0x191)](_0x9ff44(0x1aa)+_0x5f2498['length']+_0x9ff44(0x19d)+(_0x5f2498[_0x9ff44(0x1b4)]!==0x1?'s':'')),await handleSDKOutput(_0x5f2498,_0x18de21),0x0;}}
1
+ function a21_0x49c5(){const _0x7dbc97=['data','yes','\x20row','Get\x20job\x20results','βœ”\x20Retrieved\x20','priority','Status\x20filter:\x20','query','map','βœ”\x20Kill\x20request\x20submitted\x20for\x20job\x20','submit','length','result','\x20jobs','2823304hnivKO','type','debug','trino','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','Submit\x20a\x20job','args','\x20\x20Job\x20ID:\x20','verbose','3VupXWU','execute','No\x20SQL\x20statements\x20found\x20in\x20file','279EajBfr','Submitting\x20kill\x20request...','limit','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','jobType','538474yBRgpb','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','INVALID_ARGUMENT','job_id','user_name','file','3664338MRvQQh','job:kill','βœ”\x20Found\x20','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','\x20job','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','created_at','Query:\x20','jobs','start_at','description','\x27\x20to\x20verify\x20the\x20job\x20status','status','Listing\x20jobs...','3178145tAmZVh','getTime','name','Getting\x20job\x20results...','information_schema','database','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','Cancelled','error','183016JrzaUM','end_at','Show\x20job\x20details','Kill\x20a\x20job','kill','Job\x20type:\x20','hive','...','validate','1975074vMuXiC','url','3756557NFdsOT'];a21_0x49c5=function(){return _0x7dbc97;};return a21_0x49c5();}const a21_0x4e8061=a21_0x54a5;(function(_0x4b6cbb,_0x3e2682){const _0x5d234d=a21_0x54a5,_0x1e217f=_0x4b6cbb();while(!![]){try{const _0x1da775=parseInt(_0x5d234d(0xaa))/0x1*(-parseInt(_0x5d234d(0xb2))/0x2)+parseInt(_0x5d234d(0xb8))/0x3+parseInt(_0x5d234d(0xa1))/0x4+-parseInt(_0x5d234d(0xc7))/0x5+parseInt(_0x5d234d(0xd9))/0x6+parseInt(_0x5d234d(0xdb))/0x7+parseInt(_0x5d234d(0xd0))/0x8*(-parseInt(_0x5d234d(0xad))/0x9);if(_0x1da775===_0x3e2682)break;else _0x1e217f['push'](_0x1e217f['shift']());}catch(_0x76a606){_0x1e217f['push'](_0x1e217f['shift']());}}}(a21_0x49c5,0x9c63f));function a21_0x54a5(_0x5a24c5,_0x53c534){_0x5a24c5=_0x5a24c5-0xa0;const _0x49c55b=a21_0x49c5();let _0x54a536=_0x49c55b[_0x5a24c5];return _0x54a536;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a21_0x4e8061(0xc9)]=a21_0x4e8061(0xc1);[a21_0x4e8061(0xc3)]='List\x20jobs';async['execute'](_0x509c6b){const _0x5b5773=a21_0x4e8061,{options:_0x97e520,tdx:_0x32fef7}=_0x509c6b,_0x4bdecd=resolveLimit(_0x97e520[_0x5b5773(0xaf)],DEFAULT_DISPLAY_LIMIT),_0x194dbb=_0x97e520[_0x5b5773(0xc5)];_0x97e520[_0x5b5773(0xa9)]&&(console['error']('Limit:\x20'+_0x4bdecd+_0x5b5773(0xa0)),_0x194dbb&&console['error'](_0x5b5773(0xe2)+_0x194dbb));const _0x10a847=await withSpinner(_0x5b5773(0xc6),()=>_0x32fef7['jobs']['list']({'from':0x0,'to':_0x4bdecd-0x1,'status':_0x194dbb}),{'verbose':_0x97e520[_0x5b5773(0xa9)]}),_0x193257=_0x10a847[_0x5b5773(0xdc)];console[_0x5b5773(0xcf)](_0x5b5773(0xba)+_0x193257['length']+_0x5b5773(0xbc)+(_0x193257[_0x5b5773(0xe7)]!==0x1?'s':''));const _0xd811fc=_0x193257[_0x5b5773(0xe4)](_0x3f89bb=>{const _0x2c3242=_0x5b5773;let _0x38dfc7;if(_0x3f89bb[_0x2c3242(0xc2)]&&_0x3f89bb['end_at']){const _0x5f36c8=new Date(_0x3f89bb[_0x2c3242(0xc2)])[_0x2c3242(0xc8)](),_0x3375a9=new Date(_0x3f89bb[_0x2c3242(0xd1)])[_0x2c3242(0xc8)]();_0x38dfc7=Math['round']((_0x3375a9-_0x5f36c8)/0x3e8);}return{'job_id':_0x3f89bb[_0x2c3242(0xb5)],'type':_0x3f89bb['type'],'status':_0x3f89bb[_0x2c3242(0xc5)],'user_name':_0x3f89bb[_0x2c3242(0xb6)],'duration_sec':_0x38dfc7,'created_at':_0x3f89bb[_0x2c3242(0xbf)],'started_at':_0x3f89bb['start_at'],'end_at':_0x3f89bb[_0x2c3242(0xd1)]};});return await handleSDKOutput(_0xd811fc,_0x97e520),0x0;}}export class JobShowCommand extends BaseCommand{[a21_0x4e8061(0xc9)]='job:show';[a21_0x4e8061(0xc3)]=a21_0x4e8061(0xd2);[a21_0x4e8061(0xd8)](_0x32e6b0){const _0x239157=a21_0x4e8061,_0x530d58=_0x32e6b0[_0x239157(0xa7)][0x0];if(!_0x530d58)return _0x239157(0xb3);return undefined;}async[a21_0x4e8061(0xab)](_0x504dfe){const _0x4a8712=a21_0x4e8061,{options:_0x267fc1,args:_0x26caae,tdx:_0x561688}=_0x504dfe,_0x27f271=_0x26caae[0x0],_0x2fbdad=await withSpinner('Getting\x20job\x20details...',()=>_0x561688['jobs']['show'](_0x27f271),{'verbose':_0x267fc1[_0x4a8712(0xa9)]}),_0x436fd7=_0x2fbdad[_0x4a8712(0xdc)];let _0x58324f;if(_0x436fd7[_0x4a8712(0xc2)]&&_0x436fd7[_0x4a8712(0xd1)]){const _0x5aa818=new Date(_0x436fd7[_0x4a8712(0xc2)])[_0x4a8712(0xc8)](),_0x473c4f=new Date(_0x436fd7[_0x4a8712(0xd1)])['getTime']();_0x58324f=Math['round']((_0x473c4f-_0x5aa818)/0x3e8);}const _0x236d31={'job_id':_0x436fd7['job_id'],'type':_0x436fd7[_0x4a8712(0xa2)],'status':_0x436fd7['status'],..._0x436fd7[_0x4a8712(0xb6)]&&{'user_name':_0x436fd7['user_name']},..._0x58324f!==undefined&&{'duration_sec':_0x58324f},..._0x436fd7[_0x4a8712(0xbf)]&&{'created_at':_0x436fd7[_0x4a8712(0xbf)]},..._0x436fd7['start_at']&&{'started_at':_0x436fd7[_0x4a8712(0xc2)]},..._0x436fd7['end_at']&&{'end_at':_0x436fd7['end_at']},..._0x436fd7['database']&&{'database':_0x436fd7[_0x4a8712(0xcc)]},..._0x436fd7[_0x4a8712(0xe1)]!==undefined&&{'priority':_0x436fd7[_0x4a8712(0xe1)]},..._0x436fd7[_0x4a8712(0xda)]&&{'url':_0x436fd7['url']},..._0x436fd7['query']&&{'query':_0x436fd7[_0x4a8712(0xe3)]},..._0x436fd7[_0x4a8712(0xa3)]&&{'debug':_0x436fd7[_0x4a8712(0xa3)]}};return await handleSingleObjectOutput(_0x236d31,_0x267fc1),0x0;}}export class JobKillCommand extends BaseCommand{[a21_0x4e8061(0xc9)]=a21_0x4e8061(0xb9);[a21_0x4e8061(0xc3)]=a21_0x4e8061(0xd3);[a21_0x4e8061(0xd8)](_0x561983){const _0x46aa68=a21_0x4e8061,_0x4e7e4e=_0x561983[_0x46aa68(0xa7)][0x0];if(!_0x4e7e4e)return _0x46aa68(0xbb);return undefined;}async[a21_0x4e8061(0xab)](_0x35508e){const _0x38d450=a21_0x4e8061,{options:_0x236af2,args:_0xb0182,tdx:_0x202f66}=_0x35508e,_0xcdf64a=_0xb0182[0x0];if(!_0x236af2[_0x38d450(0xdd)]){const _0x44e878=await confirm(_0x38d450(0xa5)+_0xcdf64a+'?');if(!_0x44e878)return console[_0x38d450(0xcf)](_0x38d450(0xce)),0x0;}return await withSpinner(_0x38d450(0xae),()=>_0x202f66[_0x38d450(0xc1)][_0x38d450(0xd4)](_0xcdf64a),{'verbose':_0x236af2[_0x38d450(0xa9)]}),console[_0x38d450(0xcf)](_0x38d450(0xe5)+_0xcdf64a),console[_0x38d450(0xcf)](_0x38d450(0xcd)+_0xcdf64a+_0x38d450(0xc4)),0x0;}}export class JobSubmitCommand extends BaseCommand{[a21_0x4e8061(0xc9)]='job:submit';['description']=a21_0x4e8061(0xa6);async[a21_0x4e8061(0xab)](_0xcd0d71){const _0x18f30f=a21_0x4e8061,{options:_0x27d7c7,args:_0x314ccd,tdx:_0xcab54c}=_0xcd0d71,_0x207fbd=_0x27d7c7[_0x18f30f(0xb1)]||'trino',_0x1991c1=_0x27d7c7[_0x18f30f(0xb7)],_0x32e7e4=_0x27d7c7[_0x18f30f(0xcc)]||_0x18f30f(0xcb),_0x3d1f08=_0x27d7c7[_0x18f30f(0xe8)];if(_0x207fbd!==_0x18f30f(0xa4)&&_0x207fbd!==_0x18f30f(0xd6))throw new SDKError(ErrorCode[_0x18f30f(0xb4)],'--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22');let _0x16730e;if(_0x1991c1){if(_0x314ccd[0x0])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x18f30f(0xbe));const _0x57ca49=readSqlStatementsFromFile(_0x1991c1);if(_0x57ca49[_0x18f30f(0xe7)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x18f30f(0xac));if(_0x57ca49['length']>0x1)throw new SDKError(ErrorCode[_0x18f30f(0xb4)],'Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.');_0x16730e=_0x57ca49[0x0];}else{if(!_0x314ccd[0x0])throw new SDKError(ErrorCode[_0x18f30f(0xb4)],_0x18f30f(0xb0));_0x16730e=_0x314ccd[0x0];}_0x27d7c7[_0x18f30f(0xa9)]&&(console[_0x18f30f(0xcf)](_0x18f30f(0xd5)+_0x207fbd),console['error']('Database:\x20'+_0x32e7e4),console['error'](_0x18f30f(0xc0)+_0x16730e['substring'](0x0,0x64)+(_0x16730e['length']>0x64?_0x18f30f(0xd7):'')));const _0x376043=await withSpinner('Submitting\x20job...',()=>_0xcab54c[_0x18f30f(0xc1)][_0x18f30f(0xe6)](_0x32e7e4,_0x16730e,_0x207fbd,_0x3d1f08),{'verbose':_0x27d7c7[_0x18f30f(0xa9)]}),_0x540628=_0x376043['data'];return console[_0x18f30f(0xcf)]('βœ”\x20Job\x20submitted'),console[_0x18f30f(0xcf)](_0x18f30f(0xa8)+_0x540628['job_id']),await handleSDKOutput([_0x540628],_0x27d7c7),0x0;}}export class JobResultCommand extends BaseCommand{[a21_0x4e8061(0xc9)]='job:result';[a21_0x4e8061(0xc3)]=a21_0x4e8061(0xdf);['validate'](_0x412990){const _0x50a82a=a21_0x4e8061,_0x146730=_0x412990['args'][0x0];if(!_0x146730)return _0x50a82a(0xbd);return undefined;}async[a21_0x4e8061(0xab)](_0x351510){const _0xf10ab4=a21_0x4e8061,{options:_0x55d6c6,args:_0x1cd63e,tdx:_0x357902}=_0x351510,_0x44d9a8=_0x1cd63e[0x0],_0x2d75b3=await withSpinner(_0xf10ab4(0xca),()=>_0x357902['jobs'][_0xf10ab4(0xe8)](_0x44d9a8),{'verbose':_0x55d6c6['verbose']}),_0xa1870a=_0x2d75b3[_0xf10ab4(0xdc)];return console[_0xf10ab4(0xcf)](_0xf10ab4(0xe0)+_0xa1870a[_0xf10ab4(0xe7)]+_0xf10ab4(0xde)+(_0xa1870a[_0xf10ab4(0xe7)]!==0x1?'s':'')),await handleSDKOutput(_0xa1870a,_0x55d6c6),0x0;}}
@@ -1 +1 @@
1
- const a22_0x5a8bdc=a22_0x1b6d;(function(_0x327030,_0x4ebf42){const _0xff8212=a22_0x1b6d,_0x12c116=_0x327030();while(!![]){try{const _0x44fbdb=parseInt(_0xff8212(0xf7))/0x1*(-parseInt(_0xff8212(0x144))/0x2)+parseInt(_0xff8212(0x108))/0x3*(-parseInt(_0xff8212(0x178))/0x4)+-parseInt(_0xff8212(0xbb))/0x5*(-parseInt(_0xff8212(0x17b))/0x6)+-parseInt(_0xff8212(0x175))/0x7*(parseInt(_0xff8212(0x121))/0x8)+-parseInt(_0xff8212(0xdd))/0x9*(-parseInt(_0xff8212(0xda))/0xa)+-parseInt(_0xff8212(0x110))/0xb+parseInt(_0xff8212(0x132))/0xc*(parseInt(_0xff8212(0xae))/0xd);if(_0x44fbdb===_0x4ebf42)break;else _0x12c116['push'](_0x12c116['shift']());}catch(_0x1d9d34){_0x12c116['push'](_0x12c116['shift']());}}}(a22_0x1181,0x54d3a));import a22_0x56bc5a from'chalk';import a22_0x271ee7 from'path';function a22_0x1b6d(_0xf30f8b,_0x50380a){_0xf30f8b=_0xf30f8b-0x9a;const _0x118110=a22_0x1181();let _0x1b6d1f=_0x118110[_0xf30f8b];return _0x1b6d1f;}import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{aggregateStageHistory,assembleJourneyStats,buildStageNameMap}from'../sdk/journey.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{createTdxConfigContent}from'../sdk/segment/tdx-config.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function requireNameOrPath(_0x4bc469){const _0x509d45=a22_0x1b6d;return!_0x4bc469&&(console[_0x509d45(0xcb)](_0x509d45(0xcc)),console['error'](_0x509d45(0xf0))),!!_0x4bc469;}function withJsonFormat(_0x149d82){const _0x5a813d=a22_0x1b6d;if(!_0x149d82[_0x5a813d(0x11f)]&&!_0x149d82['json']&&!_0x149d82[_0x5a813d(0xf6)]&&!_0x149d82[_0x5a813d(0xff)])return{..._0x149d82,'format':_0x5a813d(0xcd),'json':!![]};return _0x149d82;}function formatJourneyState(_0x5e114e){const _0x6b719a=a22_0x1b6d;switch(_0x5e114e){case'launched':return a22_0x56bc5a[_0x6b719a(0xbd)](_0x6b719a(0x16c));case _0x6b719a(0xb8):return a22_0x56bc5a[_0x6b719a(0x151)](_0x6b719a(0x128));case _0x6b719a(0xc7):return a22_0x56bc5a['yellow'](_0x6b719a(0x14c));case'completed':return a22_0x56bc5a[_0x6b719a(0x181)](_0x6b719a(0xa3));case _0x6b719a(0x15e):return a22_0x56bc5a['dim'](_0x6b719a(0xf9));default:return'('+_0x5e114e+')';}}function formatJourneyItem(_0x52047a,_0x3cd3cf='',_0x5e33a1){const _0x489461=a22_0x1b6d,_0x3ff794=formatJourneyState(_0x52047a[_0x489461(0x135)]),_0x27445a=_0x5e33a1?hyperlink(_0x52047a[_0x489461(0x19d)],_0x5e33a1):_0x52047a[_0x489461(0x19d)];return _0x3cd3cf+_0x489461(0x172)+_0x27445a+'\x20'+_0x3ff794;}function escapeRegex(_0x3eb926){return _0x3eb926['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&');}function globToRegex(_0x28235e){const _0x4582e0=a22_0x1b6d,_0x1f23ec=_0x28235e['split']('*')[_0x4582e0(0xe9)](escapeRegex);return new RegExp(_0x1f23ec[_0x4582e0(0x15f)]('.*'),'i');}function buildRuleToNameMapping(_0x48c1a3){const _0x3103b3=a22_0x1b6d,_0x542e53=new Map();if(_0x48c1a3['segments'])for(const [_0x40c5ba,_0x3a8054]of Object[_0x3103b3(0x188)](_0x48c1a3[_0x3103b3(0x18e)])){if(_0x3a8054[_0x3103b3(0x199)]){const _0x4a5d46=serializeRule(_0x3a8054[_0x3103b3(0x199)]),_0x450e7f=_0x542e53['get'](_0x4a5d46);_0x450e7f?_0x450e7f[_0x3103b3(0xf1)](_0x40c5ba):_0x542e53[_0x3103b3(0xec)](_0x4a5d46,[_0x40c5ba]);}}return _0x542e53;}async function resolveJourneyIdFromInput(_0x59b388,_0x52dcb0,_0x31a668){const _0x4ecc9d=a22_0x1b6d,_0x3fd703=await resolveJourneyTarget(_0x59b388,_0x52dcb0['parentSegment'],_0x52dcb0[_0x4ecc9d(0xa0)]),_0x2b16b0=_0x3fd703[_0x4ecc9d(0xce)];if(!_0x2b16b0)throw new SDKError(ErrorCode[_0x4ecc9d(0xe8)],_0x4ecc9d(0x18b));const _0x1cf6f3=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x31a668[_0x4ecc9d(0x100)]['resolveParentId'](_0x2b16b0),{'verbose':_0x52dcb0[_0x4ecc9d(0xa0)]}),_0x561e17=_0x1cf6f3[_0x4ecc9d(0xfd)],_0x57e3ad=await withSpinner('Resolving\x20journey...',()=>_0x31a668['journey']['resolveJourneyId'](_0x561e17,_0x3fd703[_0x4ecc9d(0xa1)]),{'verbose':_0x52dcb0[_0x4ecc9d(0xa0)]});return{'journeyId':_0x57e3ad[_0x4ecc9d(0xfd)],'journeyName':_0x3fd703[_0x4ecc9d(0xa1)],'parentSegmentId':_0x561e17};}async function resolveJourneyTarget(_0x5c317b,_0x26b1a7,_0x14a3b1){const _0xf16c88=a22_0x1b6d;if(isYamlFilePath(_0x5c317b))try{const _0x2d7796=await resolveYamlFilePath(_0x5c317b);return _0x14a3b1&&(console['error'](_0xf16c88(0x180)+_0x5c317b),console[_0xf16c88(0xcb)]('\x20\x20Parent\x20segment:\x20'+_0x2d7796[_0xf16c88(0xce)]),console[_0xf16c88(0xcb)]('\x20\x20Name:\x20'+_0x2d7796[_0xf16c88(0x19f)]),console[_0xf16c88(0xcb)](_0xf16c88(0x125)+(_0x2d7796[_0xf16c88(0x142)]||_0xf16c88(0xaa)))),{'journeyName':_0x2d7796[_0xf16c88(0x19f)],'parentSegment':_0x2d7796['parentSegment'],'resolved':_0x2d7796};}catch(_0xbfb1b3){throw new SDKError(ErrorCode[_0xf16c88(0xe8)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0xbfb1b3['message']);}if(!_0x26b1a7)throw new SDKError(ErrorCode[_0xf16c88(0xe8)],_0xf16c88(0x11c));return{'journeyName':_0x5c317b,'parentSegment':_0x26b1a7};}export class JourneyListCommand extends BaseCommand{['name']='journey:list';[a22_0x5a8bdc(0x1a1)]=a22_0x5a8bdc(0xe0);async[a22_0x5a8bdc(0x179)](_0x401ee1){const _0x50906e=a22_0x5a8bdc,{options:_0x57c012,args:_0xc35e0d,tdx:_0x11ed9c}=_0x401ee1,_0x40d7dc=_0xc35e0d[0x0],_0x4276ea=_0x57c012[_0x50906e(0xce)];if(!_0x4276ea)return console['error'](_0x50906e(0x17a)),console[_0x50906e(0xcb)](_0x50906e(0xd0)),0x1;const _0x4764eb=await withSpinner(_0x50906e(0x133),()=>_0x11ed9c['segment']['resolveParentId'](_0x4276ea),{'verbose':_0x57c012[_0x50906e(0xa0)]}),_0x596211=_0x4764eb[_0x50906e(0xfd)];_0x57c012[_0x50906e(0xa0)]&&(console['error'](_0x50906e(0x149)+_0x4276ea+_0x50906e(0x194)+_0x596211+')'),_0x40d7dc&&console['error'](_0x50906e(0x192)+_0x40d7dc));const _0x35f1a1=await withSpinner(_0x50906e(0xb9),()=>_0x11ed9c[_0x50906e(0x100)][_0x50906e(0x18a)](_0x596211),{'verbose':_0x57c012[_0x50906e(0xa0)]}),_0x1d609c=_0x35f1a1['data'],_0x41803d=_0x1d609c['rootFolderId'],_0x48713e=await withSpinner('Listing\x20journeys...',()=>_0x11ed9c[_0x50906e(0x18f)]['listJourneysWithFolders'](_0x596211,_0x41803d),{'verbose':_0x57c012['verbose']});let _0x4d9ee8=_0x48713e[_0x50906e(0xfd)][_0x50906e(0x122)];const _0x49563c=_0x48713e[_0x50906e(0xfd)]['folders'],_0x33cc4d=new Map();for(const _0x176c4e of _0x49563c){_0x33cc4d[_0x50906e(0xec)](_0x176c4e['id'],_0x176c4e[_0x50906e(0x154)]);}if(_0x40d7dc){const _0x34e55c=globToRegex(_0x40d7dc);_0x4d9ee8=_0x4d9ee8[_0x50906e(0x16f)](_0x5c15da=>_0x34e55c['test'](_0x5c15da[_0x50906e(0x19d)]));}console[_0x50906e(0xcb)](_0x50906e(0x15c)+_0x4d9ee8[_0x50906e(0x19a)]+_0x50906e(0x143)+(_0x4d9ee8[_0x50906e(0x19a)]!==0x1?'s':''));const _0xac6aaf=_0x58980=>{const _0x63ef1f=_0x50906e;return getConsoleNextUrl(_0x57c012[_0x63ef1f(0x13b)],_0x63ef1f(0x186)+_0x596211+'/e/'+_0x58980+_0x63ef1f(0x15d));};if(_0x57c012[_0x50906e(0x11f)]===_0x50906e(0xa7))await handleSDKOutput(_0x4d9ee8,_0x57c012);else{if(_0x57c012[_0x50906e(0x11f)]==='json'){const _0x2619c2=_0x4d9ee8[_0x50906e(0xe9)](_0x26ca67=>({..._0x26ca67,'url':_0xac6aaf(_0x26ca67['id'])}));await handleSDKOutput(_0x2619c2,_0x57c012);}else{console['log']('['+_0x4276ea+']');const _0x283aaa=new Map(),_0x18bc06=[];for(const _0x144faa of _0x4d9ee8){if(!_0x144faa[_0x50906e(0x10b)]||_0x144faa[_0x50906e(0x10b)]===_0x41803d)_0x18bc06[_0x50906e(0xf1)](_0x144faa);else{const _0x463e94=_0x283aaa['get'](_0x144faa['folderId'])||[];_0x463e94['push'](_0x144faa),_0x283aaa[_0x50906e(0xec)](_0x144faa['folderId'],_0x463e94);}}const _0x41edac=(_0x5debf2,_0xab9c63)=>_0x5debf2[_0x50906e(0x19d)][_0x50906e(0x171)](_0xab9c63[_0x50906e(0x19d)],undefined,{'sensitivity':_0x50906e(0xfb)});_0x18bc06[_0x50906e(0x104)](_0x41edac);for(const _0x37bba4 of _0x18bc06){console[_0x50906e(0x118)](formatJourneyItem(_0x37bba4,'',_0xac6aaf(_0x37bba4['id'])));}const _0x39c132=[..._0x283aaa[_0x50906e(0x188)]()][_0x50906e(0x104)]((_0x12ef11,_0x456a55)=>{const _0x18de56=_0x50906e,_0x1d089a=_0x33cc4d['get'](_0x12ef11[0x0])||_0x12ef11[0x0],_0x5db9eb=_0x33cc4d['get'](_0x456a55[0x0])||_0x456a55[0x0];return _0x1d089a[_0x18de56(0x171)](_0x5db9eb,undefined,{'sensitivity':_0x18de56(0xfb)});});for(const [_0x245d2f,_0x2d434c]of _0x39c132){const _0x476fff=_0x33cc4d['get'](_0x245d2f)||_0x245d2f;console[_0x50906e(0x118)](_0x50906e(0x197)+_0x476fff),_0x2d434c['sort'](_0x41edac);for(const _0x4c020e of _0x2d434c){console[_0x50906e(0x118)](formatJourneyItem(_0x4c020e,'\x20\x20',_0xac6aaf(_0x4c020e['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{['name']='journey:view';[a22_0x5a8bdc(0x1a1)]=a22_0x5a8bdc(0xee);async[a22_0x5a8bdc(0x179)](_0x20dc66){const _0x257bc9=a22_0x5a8bdc,{options:_0x4d1b72,args:_0x1edd55,tdx:_0xc9f14b}=_0x20dc66,_0x5e9d22=_0x1edd55[0x0];if(!_0x5e9d22)return console[_0x257bc9(0xcb)](_0x257bc9(0xcc)),console[_0x257bc9(0xcb)](_0x257bc9(0x145)),console[_0x257bc9(0xcb)](_0x257bc9(0x185)),console[_0x257bc9(0xcb)](_0x257bc9(0x189)),0x1;_0x4d1b72[_0x257bc9(0xa0)]&&console[_0x257bc9(0xcb)](_0x257bc9(0x11d)+_0x5e9d22);const {journeyId:_0x25adf9,parentSegmentId:_0x479ce6}=await resolveJourneyIdFromInput(_0x5e9d22,_0x4d1b72,_0xc9f14b);if(_0x4d1b72[_0x257bc9(0xea)]){const _0x5c055d=getConsoleNextUrl(_0x4d1b72[_0x257bc9(0x13b)],'/app/ps/'+_0x479ce6+'/e/'+_0x25adf9+_0x257bc9(0xe6));return console[_0x257bc9(0xcb)](a22_0x56bc5a[_0x257bc9(0xbd)]('βœ”')+_0x257bc9(0x174)+a22_0x56bc5a[_0x257bc9(0xe3)](_0x5c055d)),openBrowser(_0x5c055d),0x0;}const _0x4b02f3=await withSpinner(_0x257bc9(0x196),()=>_0xc9f14b[_0x257bc9(0x18f)][_0x257bc9(0xdc)](_0x25adf9),{'verbose':_0x4d1b72['verbose']}),_0x9f1f0d=_0x4b02f3[_0x257bc9(0xfd)],_0x1973fc=_0x4d1b72[_0x257bc9(0x152)];let _0x5326d7;if(_0x1973fc)try{const _0x20cfa8=await withSpinner(_0x257bc9(0x12d),()=>_0xc9f14b[_0x257bc9(0x18f)][_0x257bc9(0xaf)](_0x25adf9),{'verbose':_0x4d1b72[_0x257bc9(0xa0)]});_0x5326d7=_0x20cfa8[_0x257bc9(0xfd)];}catch{_0x4d1b72[_0x257bc9(0xa0)]&&console[_0x257bc9(0xcb)](_0x257bc9(0xdf));}const _0xbcb89e=getConsoleNextUrl(_0x4d1b72[_0x257bc9(0x13b)],_0x257bc9(0x186)+_0x479ce6+_0x257bc9(0x106)+_0x25adf9+'/j/da/je'),_0x3ffb16={'id':_0x9f1f0d['id'],'name':_0x9f1f0d[_0x257bc9(0x159)][_0x257bc9(0x154)],'description':_0x9f1f0d[_0x257bc9(0x159)][_0x257bc9(0x1a1)],'state':_0x9f1f0d[_0x257bc9(0x159)]['state'],'paused':_0x9f1f0d[_0x257bc9(0x159)]['paused'],'reentry_mode':_0x9f1f0d[_0x257bc9(0x159)][_0x257bc9(0x16e)],'stages':_0x9f1f0d['attributes']['journeyStages']?.[_0x257bc9(0x19a)]||0x0,..._0x9f1f0d[_0x257bc9(0x159)][_0x257bc9(0xdb)]&&{'goal':_0x9f1f0d['attributes'][_0x257bc9(0xdb)][_0x257bc9(0x154)]},..._0x5326d7&&{'statistics':{'size':_0x5326d7['size'],'entered':_0x5326d7[_0x257bc9(0xd3)],'goal_achieved':_0x5326d7[_0x257bc9(0xc4)],'completion_rate':_0x5326d7[_0x257bc9(0xfe)],'exit_or_jump':_0x5326d7[_0x257bc9(0xc6)],'exit_or_jump_rate':_0x5326d7['exitOrJumpRate'],'stages':_0x5326d7[_0x257bc9(0xb6)]}},'url':_0xbcb89e};return await handleSingleObjectOutput(_0x3ffb16,_0x4d1b72),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a22_0x5a8bdc(0x154)]=a22_0x5a8bdc(0x190);[a22_0x5a8bdc(0x1a1)]=a22_0x5a8bdc(0x187);async[a22_0x5a8bdc(0x179)](_0x120103){const _0x451089=a22_0x5a8bdc,{options:_0x923837,args:_0x38c6c5,tdx:_0x5596a5}=_0x120103,_0x3042c0=_0x38c6c5[0x0];if(!requireNameOrPath(_0x3042c0))return 0x1;_0x923837[_0x451089(0xa0)]&&console[_0x451089(0xcb)](_0x451089(0x11d)+_0x3042c0);const _0x49b5d1=_0x923837,_0x2a173a=_0x49b5d1[_0x451089(0xfc)],_0x24a6e1=_0x49b5d1['to'],_0xd58928=_0x49b5d1[_0x451089(0x9d)],_0x384390=_0x49b5d1[_0x451089(0xb0)];_0xd58928&&!_0x2a173a&&!_0x24a6e1&&console[_0x451089(0xcb)]('Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history');const _0x4e8ad1=_0xd58928?withJsonFormat(_0x923837):_0x923837,{journeyId:_0xa469ff,journeyName:_0x4f1cba}=await resolveJourneyIdFromInput(_0x3042c0,_0x4e8ad1,_0x5596a5),_0x55a2bb=_0x2a173a||_0x24a6e1?{'from':_0x2a173a,'to':_0x24a6e1}:undefined,_0x73c609=await withSpinner(_0x451089(0x12d),()=>Promise[_0x451089(0x150)]([_0x5596a5['journey'][_0x451089(0xdc)](_0xa469ff),_0x5596a5[_0x451089(0x18f)]['getStatistics'](_0xa469ff,_0x55a2bb)]),{'verbose':_0x4e8ad1[_0x451089(0xa0)]}),[_0x562308,_0x2be0fd]=_0x73c609[_0x451089(0xfd)];if(!_0x2be0fd||_0x2be0fd[_0x451089(0x168)]===null)return console[_0x451089(0xcb)](_0x451089(0xb1)+_0x4f1cba),console[_0x451089(0xcb)]('Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),0x0;const _0xbf40ce=buildStageNameMap(_0x562308),_0x179c6e=!!(_0x55a2bb&&_0x2be0fd['history']?.[_0x451089(0x19a)]),_0x1d420c={'stageNameMap':_0xbf40ce,'hasPeriod':_0x179c6e,'includeHistory':!!_0xd58928};if(_0x384390&&_0x2be0fd[_0x451089(0xb6)]){const _0xdee72e=_0x2be0fd[_0x451089(0xb6)][_0x451089(0x10c)](_0x5b51fa=>{const _0x290761=_0x451089,_0x6e1016=_0xbf40ce[_0x290761(0x11a)](_0x5b51fa['id'])??'';return _0x6e1016[_0x290761(0xbe)]()===_0x384390[_0x290761(0xbe)]();});if(_0xdee72e)return await handleSingleObjectOutput(formatStageStats(_0xdee72e,_0x1d420c),_0x4e8ad1),0x0;const _0xd5b5b2=_0x2be0fd[_0x451089(0xb6)][_0x451089(0xe9)](_0x22a1d0=>_0xbf40ce['get'](_0x22a1d0['id'])??_0x22a1d0['id']);return console['error'](_0x451089(0x120)+_0x384390+'\x22\x20not\x20found'),console['error'](_0x451089(0x124)+_0xd5b5b2[_0x451089(0x15f)](',\x20')),0x1;}const _0x13ea44=_0x2be0fd[_0x451089(0xb6)]?.[_0x451089(0xe9)](_0x4a0da8=>formatStageStats(_0x4a0da8,_0x1d420c)),_0x31da70=assembleJourneyStats(_0x2be0fd,{'from':_0x2a173a,'to':_0x24a6e1,'includeHistory':_0xd58928});return await this[_0x451089(0x11e)](_0x31da70,_0x13ea44??[],_0x4e8ad1),0x0;}async['renderStats'](_0x16e40e,_0x38cf7d,_0xbde6f0){const _0x158873=a22_0x5a8bdc,_0x4aa7ab=_0xbde6f0[_0x158873(0x11f)]===_0x158873(0xcd)||_0xbde6f0[_0x158873(0x11f)]===_0x158873(0xf6)||_0xbde6f0[_0x158873(0xcd)]||_0xbde6f0['jsonl'];if(_0x4aa7ab){_0x16e40e[_0x158873(0xb6)]=_0x38cf7d,await handleSingleObjectOutput(_0x16e40e,_0xbde6f0);return;}await handleSingleObjectOutput(_0x16e40e,_0xbde6f0);for(const _0x2ac7e0 of _0x38cf7d){console['log'](''),console[_0x158873(0x118)](String(a22_0x56bc5a[_0x158873(0xe3)][_0x158873(0x10d)]('['+_0x2ac7e0[_0x158873(0x154)]+']'))+a22_0x56bc5a['dim']('\x20'+_0x2ac7e0['id']));const {id:_0x4197f3,name:_0x262f4a,..._0x3aa042}=_0x2ac7e0;await handleSingleObjectOutput(_0x3aa042,_0xbde6f0);}}}export class JourneyTrafficCommand extends BaseCommand{[a22_0x5a8bdc(0x154)]=a22_0x5a8bdc(0x101);[a22_0x5a8bdc(0x1a1)]=a22_0x5a8bdc(0x116);async[a22_0x5a8bdc(0x179)](_0x57faa8){const _0x83018=a22_0x5a8bdc,{options:_0x4059e3,args:_0x286a93,tdx:_0x5d1fd0}=_0x57faa8,_0x37d5cd=_0x286a93[0x0];if(!requireNameOrPath(_0x37d5cd))return 0x1;_0x4059e3['verbose']&&console[_0x83018(0xcb)](_0x83018(0x11d)+_0x37d5cd);const _0x2529f4=_0x4059e3,_0xaedfc0=_0x2529f4[_0x83018(0x173)],_0x716ce3=_0x2529f4[_0x83018(0xfc)],_0x3b1fda=_0x2529f4['to'],_0x4a6143=_0x2529f4['limit'];if(_0xaedfc0&&_0xaedfc0!==_0x83018(0xe7)&&_0xaedfc0!==_0x83018(0x146))return console[_0x83018(0xcb)](_0x83018(0xd1)+_0xaedfc0+_0x83018(0x9b)),0x1;const _0x23264b=withJsonFormat(_0x4059e3),{journeyId:_0x1b39b5,journeyName:_0x4044b4}=await resolveJourneyIdFromInput(_0x37d5cd,_0x23264b,_0x5d1fd0),_0x562b6f={'type':_0xaedfc0,'from':_0x716ce3,'to':_0x3b1fda,'limit':_0x4a6143},_0x47dc8e=await withSpinner('Getting\x20journey\x20traffic\x20data...',()=>_0x5d1fd0['journey']['getTrafficData'](_0x1b39b5,_0x562b6f),{'verbose':_0x23264b[_0x83018(0xa0)]}),_0x20b5c6=_0x47dc8e['data'],_0x833af4=_0x20b5c6[_0x83018(0xe7)]&&(_0x20b5c6[_0x83018(0xe7)][_0x83018(0xc3)]['length']>0x0||_0x20b5c6[_0x83018(0xe7)][_0x83018(0xbf)]['length']>0x0),_0x7c26bf=_0x20b5c6[_0x83018(0x146)]&&_0x20b5c6[_0x83018(0x146)]['length']>0x0;if(!_0x833af4&&!_0x7c26bf)return console['error'](_0x83018(0xcf)+_0x4044b4),console['error']('Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),_0x716ce3&&_0x3b1fda&&console['error'](_0x83018(0x16b)),0x0;return await handleSingleObjectOutput(_0x20b5c6,_0x23264b),0x0;}}function formatStageStats(_0x3a83c8,_0x29ce21){const _0x5e8446=a22_0x5a8bdc,_0x1a405b=_0x29ce21[_0x5e8446(0xd5)]&&_0x3a83c8[_0x5e8446(0x15a)]?.[_0x5e8446(0x19a)]?aggregateStageHistory(_0x3a83c8[_0x5e8446(0x15a)]):{'size':_0x3a83c8[_0x5e8446(0x126)],'entered':_0x3a83c8[_0x5e8446(0xd3)],'milestone':_0x3a83c8[_0x5e8446(0x176)],'milestone_rate':_0x3a83c8[_0x5e8446(0x111)],'exit_or_jump':_0x3a83c8[_0x5e8446(0xc6)],'exit_or_jump_rate':_0x3a83c8[_0x5e8446(0x137)]},_0x598c46={'id':_0x3a83c8['id'],'name':_0x29ce21['stageNameMap']['get'](_0x3a83c8['id'])??_0x3a83c8['id'],..._0x1a405b};return _0x29ce21[_0x5e8446(0xd5)]&&_0x29ce21[_0x5e8446(0x9d)]&&_0x3a83c8[_0x5e8446(0x15a)]&&(_0x598c46[_0x5e8446(0x15a)]=_0x3a83c8[_0x5e8446(0x15a)]),_0x598c46;}export class JourneyPauseCommand extends BaseCommand{[a22_0x5a8bdc(0x154)]='journey:pause';[a22_0x5a8bdc(0x1a1)]=a22_0x5a8bdc(0x15b);async[a22_0x5a8bdc(0x179)](_0x5e49f1){const _0x16de30=a22_0x5a8bdc,{options:_0x65d337,args:_0x3850fc,tdx:_0x15440e}=_0x5e49f1,_0x56ef92=_0x3850fc[0x0];if(!requireNameOrPath(_0x56ef92))return 0x1;_0x65d337[_0x16de30(0xa0)]&&console[_0x16de30(0xcb)](_0x16de30(0x11d)+_0x56ef92);const {journeyId:_0x54a490,journeyName:_0x3f73f7}=await resolveJourneyIdFromInput(_0x56ef92,_0x65d337,_0x15440e);if(!_0x65d337['yes']){const _0x2dfefc=await confirm(_0x16de30(0x177)+_0x3f73f7+'\x22?');if(!_0x2dfefc)return console['error']('Cancelled'),0x0;}const _0x630c23=await withSpinner(_0x16de30(0xd7),()=>_0x15440e[_0x16de30(0x18f)][_0x16de30(0x156)](_0x54a490),{'verbose':_0x65d337['verbose']}),_0x4f02d9=_0x630c23[_0x16de30(0xfd)];return console[_0x16de30(0xcb)](_0x16de30(0x198)+_0x4f02d9['attributes'][_0x16de30(0x154)]+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{['name']=a22_0x5a8bdc(0x155);[a22_0x5a8bdc(0x1a1)]=a22_0x5a8bdc(0xca);async['execute'](_0xc7fbec){const _0x29c3aa=a22_0x5a8bdc,{options:_0x5835ec,args:_0x34fb24,tdx:_0x3bd3bc}=_0xc7fbec,_0x9d7a47=_0x34fb24[0x0];if(!requireNameOrPath(_0x9d7a47))return 0x1;_0x5835ec[_0x29c3aa(0xa0)]&&console['error'](_0x29c3aa(0x11d)+_0x9d7a47);const {journeyId:_0x36cdab,journeyName:_0x23568a}=await resolveJourneyIdFromInput(_0x9d7a47,_0x5835ec,_0x3bd3bc);if(!_0x5835ec[_0x29c3aa(0xa6)]){const _0x2451e4=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x23568a+'\x22?');if(!_0x2451e4)return console[_0x29c3aa(0xcb)](_0x29c3aa(0xeb)),0x0;}const _0x50574b=await withSpinner(_0x29c3aa(0x166),()=>_0x3bd3bc[_0x29c3aa(0x18f)]['resume'](_0x36cdab),{'verbose':_0x5835ec[_0x29c3aa(0xa0)]}),_0x5e7ac4=_0x50574b[_0x29c3aa(0xfd)];return console[_0x29c3aa(0xcb)]('βœ”\x20Journey\x20\x22'+_0x5e7ac4[_0x29c3aa(0x159)][_0x29c3aa(0x154)]+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{[a22_0x5a8bdc(0x154)]=a22_0x5a8bdc(0x103);['description']='Export\x20journey(s)\x20as\x20YAML\x20files';async['execute'](_0x15da40){const _0x2ba6cb=a22_0x5a8bdc,{options:_0x2f24f0,args:_0x433962,tdx:_0x2af8cf}=_0x15da40,_0x13fb93=_0x2f24f0,_0x5a595f=_0x433962[0x0],_0x59bf18=_0x5a595f&&isYamlFilePath(_0x5a595f),_0x3cd3f7=await resolveTarget({'arg':_0x59bf18?_0x5a595f:undefined,'contextParent':_0x2f24f0[_0x2ba6cb(0xce)],'cwd':process[_0x2ba6cb(0x12e)]()});if(!isSuccessfulResolution(_0x3cd3f7))return _0x3cd3f7['errorCode']===_0x2ba6cb(0x19b)?(console[_0x2ba6cb(0xcb)](a22_0x56bc5a[_0x2ba6cb(0x102)](_0x2ba6cb(0x14b))),console['error'](_0x2ba6cb(0x16a)),console['error'](_0x2ba6cb(0xf2)),console[_0x2ba6cb(0xcb)](_0x2ba6cb(0x161)),console[_0x2ba6cb(0xcb)](_0x2ba6cb(0x195))):(console['error'](a22_0x56bc5a[_0x2ba6cb(0x115)]('Error:\x20'+_0x3cd3f7[_0x2ba6cb(0x167)]+'\x0a')),_0x3cd3f7[_0x2ba6cb(0x158)]&&console[_0x2ba6cb(0xcb)](a22_0x56bc5a[_0x2ba6cb(0xe3)](_0x3cd3f7[_0x2ba6cb(0x158)]))),0x1;let _0x22567b=_0x59bf18?undefined:_0x5a595f,_0xc6f43a,_0x2596dc;_0x3cd3f7[_0x2ba6cb(0x173)]==='file'&&(_0x22567b=_0x3cd3f7[_0x2ba6cb(0xf8)],_0xc6f43a=_0x3cd3f7[_0x2ba6cb(0x17f)],_0x2596dc=_0x3cd3f7[_0x2ba6cb(0x142)]);const _0x192981=_0x3cd3f7[_0x2ba6cb(0xe4)],_0x45791a=_0x3cd3f7[_0x2ba6cb(0x13a)];_0x13fb93['verbose']&&(console[_0x2ba6cb(0xcb)](_0x2ba6cb(0x149)+_0x192981),console['error'](_0x2ba6cb(0x191)+_0x45791a),_0x22567b&&console[_0x2ba6cb(0xcb)]('Journey\x20name:\x20'+_0x22567b),_0xc6f43a&&console['error']('Target\x20file:\x20'+_0xc6f43a),_0x2596dc&&console['error']('Folder\x20path:\x20'+_0x2596dc));const _0x44d07a=await withSpinner(_0x2ba6cb(0x133),()=>_0x2af8cf[_0x2ba6cb(0x100)]['resolveParentId'](_0x192981),{'verbose':_0x2f24f0['verbose']}),_0x4196d3=_0x44d07a[_0x2ba6cb(0xfd)],{journeys:_0x4bc217,folders:_0x57ef86}=await withSpinner(_0x2ba6cb(0x18d),async()=>{const _0x7e0904=_0x2ba6cb,[_0x81a8fd,_0x1652d0]=await Promise[_0x7e0904(0x150)]([_0x2af8cf[_0x7e0904(0x18f)]['listJourneysFromParentSegment'](_0x4196d3,undefined,{'includeAllVersions':!![]}),_0x2af8cf[_0x7e0904(0x100)][_0x7e0904(0x134)](_0x4196d3)]);return{'journeys':_0x81a8fd,'folders':_0x1652d0};},{'verbose':_0x2f24f0[_0x2ba6cb(0xa0)]})[_0x2ba6cb(0xd4)](_0x43c079=>_0x43c079[_0x2ba6cb(0xfd)]);let _0x161f63=_0x4bc217;const _0xca5e32=buildFolderIdToPathMap(_0x57ef86);if(_0x22567b){const _0x4156dc=_0x161f63[_0x2ba6cb(0x16f)](_0x1c628a=>_0x1c628a[_0x2ba6cb(0x19d)][_0x2ba6cb(0xbe)]()===_0x22567b[_0x2ba6cb(0xbe)]());if(_0x4156dc[_0x2ba6cb(0x19a)]===0x0)return console[_0x2ba6cb(0xcb)](_0x2ba6cb(0x147)+_0x22567b),console['error'](_0x2ba6cb(0xc1)),0x1;_0x161f63=_0x4156dc;}if(_0x2596dc!==undefined){const _0xaec0a9=_0x161f63[_0x2ba6cb(0x16f)](_0x1f1cf5=>{const _0x43de16=_0x2ba6cb,_0x363983=_0x1f1cf5['folderId']?_0xca5e32[_0x43de16(0x11a)](_0x1f1cf5[_0x43de16(0x10b)])||'':'';return _0x363983===_0x2596dc;});if(_0xaec0a9[_0x2ba6cb(0x19a)]===0x0&&_0x161f63[_0x2ba6cb(0x19a)]>0x0){console['error'](_0x2ba6cb(0x136)+_0x22567b+_0x2ba6cb(0x19c)+(_0x2596dc||_0x2ba6cb(0xa5))),console[_0x2ba6cb(0xcb)](_0x2ba6cb(0x10e));for(const _0x33c9da of _0x161f63){const _0xa9acbf=_0x33c9da[_0x2ba6cb(0x10b)]?_0xca5e32[_0x2ba6cb(0x11a)](_0x33c9da['folderId'])||'':'';console[_0x2ba6cb(0xcb)](_0x2ba6cb(0x17d)+(_0xa9acbf||_0x2ba6cb(0xaa))+'/'+_0x33c9da['journeyBundleName']);}return 0x1;}_0x161f63=_0xaec0a9;}if(_0x161f63['length']===0x0)return console['error']('No\x20journeys\x20found'),0x0;const _0xc6f654=new Map();for(const _0x2a8081 of _0x161f63){const _0x135306=_0x2a8081['journeyBundleId'];!_0xc6f654[_0x2ba6cb(0x14a)](_0x135306)&&_0xc6f654[_0x2ba6cb(0xec)](_0x135306,[]),_0xc6f654['get'](_0x135306)[_0x2ba6cb(0xf1)](_0x2a8081);}for(const _0x265e6c of _0xc6f654['values']()){_0x265e6c['sort']((_0x4f7f80,_0x40ea25)=>(_0x4f7f80['versionNumber']||0x0)-(_0x40ea25[_0x2ba6cb(0x140)]||0x0));}const _0x302e67=[],{idToEmailMap:_0x35d1c1,connectionIdToNameMap:_0xf7c42f}=await withSpinner(_0x2ba6cb(0xd6),async()=>{const _0x28725a=_0x2ba6cb,[_0x273f52,_0x418ccf]=await Promise['all']([_0x2af8cf[_0x28725a(0x123)]['buildIdToEmailMap'](),_0x2af8cf['connection']['buildIdToNameMap']()]);return{'idToEmailMap':_0x273f52,'connectionIdToNameMap':_0x418ccf};},{'verbose':_0x2f24f0[_0x2ba6cb(0xa0)]})[_0x2ba6cb(0xd4)](_0x41eef8=>_0x41eef8[_0x2ba6cb(0xfd)]);for(const _0x4ab605 of _0xc6f654[_0x2ba6cb(0x112)]()){const _0x4d79b1=_0x4ab605[0x0][_0x2ba6cb(0x19d)],_0x94925a=_0x4ab605[0x0]['folderId'],_0x294f71=_0x94925a?_0xca5e32['get'](_0x94925a)||'':'',_0x1e7f4a=_0x294f71?a22_0x271ee7['join'](_0x45791a,_0x294f71):_0x45791a,_0x2a42a8=_0xc6f43a||a22_0x271ee7[_0x2ba6cb(0x15f)](_0x1e7f4a,sanitizeFileName(_0x4d79b1)+_0x2ba6cb(0x141));let _0x59b50a,_0x28d74e;if(existsSync(_0x2a42a8))try{const _0x2754bf=readFileSync(_0x2a42a8,'utf-8'),_0x26b8ec=parseYamlString(_0x2754bf);_0x28d74e=_0x26b8ec,_0x59b50a=buildRuleToNameMapping(_0x26b8ec),_0x13fb93[_0x2ba6cb(0xa0)]&&_0x59b50a[_0x2ba6cb(0x126)]>0x0&&console[_0x2ba6cb(0xcb)]('Found\x20'+_0x59b50a['size']+_0x2ba6cb(0x13d)+_0x4d79b1);}catch(_0x280deb){_0x13fb93[_0x2ba6cb(0xa0)]&&console['error']('Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20'+_0x280deb[_0x2ba6cb(0x167)]);}const _0x7780e5=[],_0x2f16bd=new Set(),_0xa06c06=new Map(),_0xab43cc=new Map(),_0x4b2aff=new Set(),_0x5d3e83=new Map(),_0x5c319f=new Map(),_0x3ac6c5=createJumpTargetCache();await withProgressSpinner(_0x2ba6cb(0xe5)+_0x4d79b1+_0x2ba6cb(0x1a0),async _0x53a73c=>{const _0x4ed6f5=_0x2ba6cb;for(const _0x2f5a5e of _0x4ab605){const _0x4ce811=_0x4ab605[_0x4ed6f5(0x19a)]>0x1?_0x2f5a5e['journeyBundleName']+'\x20v'+(_0x2f5a5e['versionNumber']||0x1):_0x2f5a5e['journeyBundleName'];_0x53a73c[_0x4ed6f5(0x114)](_0x4ed6f5(0xe5)+_0x4ce811);const _0x150fae=await _0x2af8cf[_0x4ed6f5(0x18f)][_0x4ed6f5(0xdc)](_0x2f5a5e['id']),_0x36ac14=_0x150fae[_0x4ed6f5(0x159)]?.[_0x4ed6f5(0xc9)],_0xf488c2={'resolveSegment':async _0x294b73=>{const _0x26b168=_0x4ed6f5;if(!_0x36ac14)return{'name':_0x294b73,'isJourneyLocal':![]};const _0x57301a=_0xa06c06[_0x26b168(0x11a)](_0x294b73);if(_0x57301a)return _0x57301a;try{const _0xc55fa0=await _0x2af8cf[_0x26b168(0x100)][_0x26b168(0x17e)](_0x36ac14,_0x294b73),_0x3b88a9=_0xc55fa0['kind']===SEGMENT_KIND_JOURNEY;let _0x155484,_0xd7e69e=_0xc55fa0[_0x26b168(0x154)];if(_0x3b88a9&&_0xc55fa0[_0x26b168(0x199)]){const _0x4ad6bf=await segmentResponseToDef(_0xc55fa0,{'resolveSegmentName':async _0x5771af=>{const _0x16b50f=_0x26b168,_0x1f6c6b=_0xa06c06[_0x16b50f(0x11a)](_0x5771af);if(_0x1f6c6b)return _0x1f6c6b[_0x16b50f(0x154)];const _0x377ea9=await _0xf488c2[_0x16b50f(0x12c)](_0x5771af);return _0x377ea9[_0x16b50f(0x154)];}}),_0xab8125=_0x4ad6bf['rule'];_0x155484={'description':_0xc55fa0[_0x26b168(0x1a1)],'rule':_0xab8125};const _0x2ac497=serializeRule(_0xab8125),_0x4ed540=_0xab43cc[_0x26b168(0x11a)](_0x2ac497);if(_0x4ed540)_0xd7e69e=_0x4ed540,_0x155484=undefined,_0x13fb93['verbose']&&console['error'](_0x26b168(0xa2)+_0xc55fa0[_0x26b168(0x154)]+_0x26b168(0x193)+_0x4ed540);else{let _0x28abd5=![];if(_0x59b50a){const _0xebf012=_0x59b50a[_0x26b168(0x11a)](_0x2ac497);if(_0xebf012){const _0x133bbd=_0xebf012['find'](_0x3a3712=>!_0x2f16bd[_0x26b168(0x14a)](_0x3a3712));_0x133bbd&&(_0xd7e69e=_0x133bbd,_0x2f16bd[_0x26b168(0x131)](_0x133bbd),_0xab43cc[_0x26b168(0xec)](_0x2ac497,_0x133bbd),_0x28abd5=!![],_0x13fb93['verbose']&&console[_0x26b168(0xcb)]('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x133bbd+'\x20(rule\x20match)'));}}if(!_0x28abd5){const _0x139070=generateJourneyLocalName(_0xc55fa0[_0x26b168(0x154)]);_0x139070&&(_0xd7e69e=_0x139070);let _0x268d5a=_0xd7e69e,_0x30213a=0x2;while(_0x2f16bd['has'](_0x268d5a)){_0x268d5a=_0xd7e69e+'_'+_0x30213a,_0x30213a++;}_0x2f16bd[_0x26b168(0x131)](_0x268d5a),_0xab43cc[_0x26b168(0xec)](_0x2ac497,_0x268d5a),_0xd7e69e=_0x268d5a;}}}const _0x52b92f={'name':_0xd7e69e,'isJourneyLocal':_0x3b88a9,'definition':_0x155484};return _0xa06c06['set'](_0x294b73,_0x52b92f),_0x52b92f;}catch(_0x22bbf5){return _0x2f24f0[_0x26b168(0xa0)]&&console['error'](_0x26b168(0xd8)+_0x294b73+':\x20'+_0x22bbf5['message']),{'name':_0x294b73,'isJourneyLocal':![]};}},'resolveActivation':async _0x5b8b69=>{const _0x1830df=_0x4ed6f5,_0x42e74c=_0x5d3e83[_0x1830df(0x11a)](_0x5b8b69);if(_0x42e74c)return _0x42e74c;try{const _0x2fff67=await _0x2af8cf['journey'][_0x1830df(0x183)](_0x2f5a5e['id'],_0x5b8b69),_0x9dce5a=journeyActivationStepToYaml(_0x2fff67,_0x35d1c1,_0xf7c42f),_0x1ec756=JSON['stringify']({'name':_0x9dce5a[_0x1830df(0x154)],'connection':_0x9dce5a[_0x1830df(0x162)],'connector_config':_0x9dce5a[_0x1830df(0x138)]}),_0x5ee087=_0x5c319f['get'](_0x1ec756);if(_0x5ee087){const _0x54b0b2={'name':_0x5ee087,'isJourneyLocal':!![],'definition':_0x9dce5a};return _0x5d3e83[_0x1830df(0xec)](_0x5b8b69,_0x54b0b2),_0x54b0b2;}const _0xdfa68d=_0x2fff67[_0x1830df(0x159)][_0x1830df(0xc8)][_0x1830df(0x154)]||_0x5b8b69,_0x157c0c=sanitizeYamlKey(_0xdfa68d)||_0x1830df(0x9e)+_0x5b8b69;let _0x2c0f9b=_0x157c0c,_0x362ecd=0x2;while(_0x4b2aff[_0x1830df(0x14a)](_0x2c0f9b)){_0x2c0f9b=_0x157c0c+'_'+_0x362ecd,_0x362ecd++;}_0x4b2aff['add'](_0x2c0f9b),_0x5c319f['set'](_0x1ec756,_0x2c0f9b);const _0x2ba639={'name':_0x2c0f9b,'isJourneyLocal':!![],'definition':_0x9dce5a};return _0x5d3e83['set'](_0x5b8b69,_0x2ba639),_0x2ba639;}catch(_0x35cc9e){return _0x2f24f0['verbose']&&console['error'](_0x1830df(0xad)+_0x5b8b69+':\x20'+_0x35cc9e['message']),{'name':_0x5b8b69,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x1217ef,_0x59f065)=>{const _0x161453=_0x4ed6f5;return resolveJumpTarget(_0x1217ef,_0x59f065,_0x3ac6c5,_0x605f8b=>_0x2af8cf[_0x161453(0x18f)][_0x161453(0xdc)](_0x605f8b));}},_0x1d9d67=await journeyResponseToDef(_0x150fae,_0xf488c2);_0x7780e5[_0x4ed6f5(0xf1)]({'item':_0x2f5a5e,'yaml':_0x1d9d67});}},{'verbose':_0x2f24f0[_0x2ba6cb(0xa0)]});const _0x1dde6c=await _0x2af8cf[_0x2ba6cb(0x18f)][_0x2ba6cb(0x18c)](_0x4ab605[0x0][_0x2ba6cb(0x1a3)]),_0x4f3bf4=buildMergedJourneyDef(_0x7780e5,_0x59b50a,_0x1dde6c),_0x264b0c=normalizeJourneyDef(_0x4f3bf4,_0x28d74e),_0x37d1b6=toYamlString(_0x264b0c),_0x5c2c3a=_0xc6f43a||a22_0x271ee7[_0x2ba6cb(0x15f)](_0x1e7f4a,sanitizeFileName(_0x4d79b1)+_0x2ba6cb(0x141));!_0xc6f43a&&_0x294f71&&!existsSync(_0x1e7f4a)&&mkdirSync(_0x1e7f4a,{'recursive':!![]});const _0x5ea943=a22_0x271ee7[_0x2ba6cb(0xa4)](process[_0x2ba6cb(0x12e)](),_0x5c2c3a);if(existsSync(_0x5c2c3a)){const _0x256bfe=readFileSync(_0x5c2c3a,_0x2ba6cb(0x164)),_0x3a7a94=generateDiff(_0x256bfe,_0x37d1b6),_0x2bbf64=hasChanges(_0x3a7a94);_0x302e67[_0x2ba6cb(0xf1)]({'relativePath':_0x5ea943,'absolutePath':_0x5c2c3a,'content':_0x37d1b6,'isNew':![],'hasChanges':_0x2bbf64,'diff':_0x2bbf64?formatDiffWithColors(_0x3a7a94):undefined});}else _0x302e67[_0x2ba6cb(0xf1)]({'relativePath':_0x5ea943,'absolutePath':_0x5c2c3a,'content':_0x37d1b6,'isNew':!![],'hasChanges':![]});}const _0x2c1395=_0x302e67[_0x2ba6cb(0x16f)](_0x3a0a1a=>_0x3a0a1a[_0x2ba6cb(0xde)]),_0x401cea=_0x302e67[_0x2ba6cb(0x16f)](_0x5b1a4f=>!_0x5b1a4f[_0x2ba6cb(0xde)]&&_0x5b1a4f[_0x2ba6cb(0xe2)]),_0x24b236=_0x302e67[_0x2ba6cb(0x16f)](_0x47a7f2=>!_0x47a7f2['isNew']&&!_0x47a7f2[_0x2ba6cb(0xe2)]),_0x111dcc=_0x161f63[_0x2ba6cb(0x19a)],_0x2006cc=_0xc6f654[_0x2ba6cb(0x126)],_0x2b68e2=_0x111dcc>_0x2006cc?'\x20('+_0x111dcc+_0x2ba6cb(0x148):'';console['error'](_0x2ba6cb(0x119)),console['error']('\x20\x20'+a22_0x56bc5a[_0x2ba6cb(0xe3)](_0x2006cc+_0x2ba6cb(0xc2))+a22_0x56bc5a[_0x2ba6cb(0x151)](_0x2b68e2)),console[_0x2ba6cb(0xcb)]('\x20\x20'+a22_0x56bc5a[_0x2ba6cb(0xbd)]('+\x20'+_0x2c1395['length']+_0x2ba6cb(0xc5))),console[_0x2ba6cb(0xcb)]('\x20\x20'+a22_0x56bc5a[_0x2ba6cb(0x102)]('~\x20'+_0x401cea['length']+_0x2ba6cb(0x157))),console['error']('\x20\x20'+a22_0x56bc5a['dim']('=\x20'+_0x24b236['length']+'\x20unchanged\x20files')),console[_0x2ba6cb(0xcb)](_0x2ba6cb(0x14e)+a22_0x56bc5a[_0x2ba6cb(0xe3)](_0x45791a)+'\x0a');if(_0x401cea[_0x2ba6cb(0x19a)]>0x0)for(const _0x22eaa8 of _0x401cea){console['error'](_0x2ba6cb(0x169)+_0x22eaa8[_0x2ba6cb(0xf5)]+'\x27:'),console[_0x2ba6cb(0xcb)]('─'[_0x2ba6cb(0x153)](0x3c)),console['error'](_0x22eaa8[_0x2ba6cb(0x11b)]),console[_0x2ba6cb(0xcb)]('─'[_0x2ba6cb(0x153)](0x3c));}if(_0x13fb93['dryRun'])return console[_0x2ba6cb(0xcb)](a22_0x56bc5a[_0x2ba6cb(0x102)](_0x2ba6cb(0xef))),0x0;if(_0x2c1395['length']===0x0&&_0x401cea[_0x2ba6cb(0x19a)]===0x0)return console[_0x2ba6cb(0xcb)](a22_0x56bc5a['green'](_0x2ba6cb(0x14d))),saveSessionContext({'parent_segment':_0x192981},_0x13fb93[_0x2ba6cb(0xe1)]),console[_0x2ba6cb(0xcb)](a22_0x56bc5a['green']('βœ”\x20Context\x20set:\x20'+a22_0x56bc5a['dim'](_0x2ba6cb(0x10a))+'\x20=\x20'+a22_0x56bc5a[_0x2ba6cb(0xe3)](_0x192981))),0x0;if(!_0x13fb93[_0x2ba6cb(0xa6)]&&(_0x2c1395['length']>0x0||_0x401cea['length']>0x0)){if(!isInteractive())return console[_0x2ba6cb(0xcb)](a22_0x56bc5a[_0x2ba6cb(0x115)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x2ba6cb(0xcb)](a22_0x56bc5a[_0x2ba6cb(0x151)](_0x2ba6cb(0x170))),0x1;const _0x48577b=await confirmKey('Write\x20'+(_0x2c1395[_0x2ba6cb(0x19a)]+_0x401cea[_0x2ba6cb(0x19a)])+'\x20files?');if(!_0x48577b)return console[_0x2ba6cb(0xcb)](a22_0x56bc5a[_0x2ba6cb(0x102)](_0x2ba6cb(0xb5)),_0x2ba6cb(0xb2)),0x1;}!existsSync(_0x45791a)&&mkdirSync(_0x45791a,{'recursive':!![]});const _0x2483f4=a22_0x271ee7['join'](_0x45791a,'tdx.json');writeFileSync(_0x2483f4,createTdxConfigContent(_0x192981),'utf-8');for(const _0x5d87d2 of _0x302e67){(_0x5d87d2[_0x2ba6cb(0xde)]||_0x5d87d2[_0x2ba6cb(0xe2)])&&writeFileSync(_0x5d87d2[_0x2ba6cb(0x163)],_0x5d87d2[_0x2ba6cb(0xbc)],_0x2ba6cb(0x164));}return console[_0x2ba6cb(0xcb)](a22_0x56bc5a[_0x2ba6cb(0xbd)](_0x2ba6cb(0x12f)+(_0x2c1395[_0x2ba6cb(0x19a)]+_0x401cea[_0x2ba6cb(0x19a)])+_0x2ba6cb(0xc0)+_0x45791a)),saveSessionContext({'parent_segment':_0x192981},_0x13fb93[_0x2ba6cb(0xe1)]),console[_0x2ba6cb(0xcb)](a22_0x56bc5a[_0x2ba6cb(0xbd)]('βœ”\x20Context\x20set:\x20'+a22_0x56bc5a[_0x2ba6cb(0x151)](_0x2ba6cb(0x10a))+'\x20=\x20'+a22_0x56bc5a[_0x2ba6cb(0xe3)](_0x192981))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{[a22_0x5a8bdc(0x154)]=a22_0x5a8bdc(0x1a2);[a22_0x5a8bdc(0x1a1)]=a22_0x5a8bdc(0xb3);async[a22_0x5a8bdc(0x179)](_0x1511c3){const _0x13e792=a22_0x5a8bdc,{options:_0x5b6edc,args:_0xb1ec21,tdx:_0x209290}=_0x1511c3,_0x363d2c=_0xb1ec21[0x0];if(!requireNameOrPath(_0x363d2c))return 0x1;_0x5b6edc[_0x13e792(0xa0)]&&console['error'](_0x13e792(0x11d)+_0x363d2c);const {journeyId:_0x4a4efa}=await resolveJourneyIdFromInput(_0x363d2c,_0x5b6edc,_0x209290),_0x5d8811=await withSpinner(_0x13e792(0x184),()=>_0x209290[_0x13e792(0x18f)]['getColumnMapping'](_0x4a4efa),{'verbose':_0x5b6edc[_0x13e792(0xa0)]}),_0x18e327=_0x5d8811[_0x13e792(0xfd)];return console['log']('Database:\x20'+_0x18e327[_0x13e792(0x105)]),console[_0x13e792(0x118)](_0x13e792(0x127)+_0x18e327[_0x13e792(0xa7)]),await handleSDKOutput(_0x18e327[_0x13e792(0x1a4)],_0x5b6edc),0x0;}}export class JourneyActivationsCommand extends BaseCommand{[a22_0x5a8bdc(0x154)]=a22_0x5a8bdc(0x165);[a22_0x5a8bdc(0x1a1)]=a22_0x5a8bdc(0x117);async[a22_0x5a8bdc(0x179)](_0x4bc8be){const _0x4761d6=a22_0x5a8bdc,{options:_0x3b71c2,args:_0x7dbc07,tdx:_0x2b1ee8}=_0x4bc8be,_0x3a5dab=_0x7dbc07[0x0];if(!requireNameOrPath(_0x3a5dab))return 0x1;_0x3b71c2[_0x4761d6(0xa0)]&&console[_0x4761d6(0xcb)](_0x4761d6(0x11d)+_0x3a5dab);const {journeyId:_0x247472}=await resolveJourneyIdFromInput(_0x3a5dab,_0x3b71c2,_0x2b1ee8),_0x7b6899=await withSpinner('Listing\x20journey\x20activations...',()=>_0x2b1ee8[_0x4761d6(0x18f)][_0x4761d6(0xab)](_0x247472),{'verbose':_0x3b71c2[_0x4761d6(0xa0)]}),_0x40a7ca=_0x7b6899[_0x4761d6(0xfd)];return console['error']('Found\x20'+_0x40a7ca[_0x4761d6(0x19a)]+_0x4761d6(0x19e)+(_0x40a7ca[_0x4761d6(0x19a)]!==0x1?'s':'')),await handleSDKOutput(_0x40a7ca,_0x3b71c2),0x0;}}function a22_0x1181(){const _0x47f982=['\x20\x20Journey\x20ID:\x20','relativePath','jsonl','284731PzhWPM','resourceName','(archived)','createdAt','base','from','data','completionRate','tsv','segment','journey:traffic','yellow','journey:pull','sort','database','/e/','\x20Created\x20v','6xSvOpg','options','parent_segment','folderId','find','bold','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','List\x20all\x20versions\x20of\x20a\x20journey','1990175gTginR','completeMilestoneRate','values','Error:\x20Invalid\x20version\x20number:\x20','setPhase','red','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','List\x20activations\x20for\x20a\x20journey','log','\x0aPull\x20summary:','get','diff','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Input:\x20','renderStats','format','Error:\x20Stage\x20\x22','7032VfRjkS','journeys','user','Available\x20stages:\x20','\x20\x20Folder\x20path:\x20','size','Table:\x20','(draft)','createVersion','\x20not\x20found.\x20Available:\x20','\x20(draft)\x20β€”\x20\x22','resolveSegment','Getting\x20journey\x20statistics...','cwd','βœ”\x20Pulled\x20','Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22','add','34572Rfgexg','Resolving\x20parent\x20segment...','listFolders','state','Error:\x20Journey\x20\x27','exitOrJumpRate','connector_config','journeyStages','targetDir','site','journey:version:create','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','View\x20a\x20specific\x20version\x20of\x20a\x20journey','Error:\x20Version\x20','versionNumber','.yml','folderPath','\x20journey','2xmpDII','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','activation','Error:\x20Journey\x20not\x20found:\x20','\x20versions)','Parent\x20segment:\x20','has','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','(paused)','βœ”\x20All\x20files\x20are\x20up\x20to\x20date','\x20\x20Target:\x20','Error:\x20--version\x20option\x20is\x20required','all','dim','includeStats','repeat','name','journey:resume','pause','\x20changed\x20files','helpText','attributes','history','Pause\x20a\x20running\x20journey','βœ”\x20Found\x20','/j/da','archived','join','Listing\x20journey\x20versions...','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','connection','absolutePath','utf-8','journey:activations','Resuming\x20journey...','message','journeyId','\x0aChanges\x20to\x20\x27','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)','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','(running)','updatedAt','reentryMode','filter','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','localeCompare','πŸ—ΊοΈ\x20','type','\x20Opening\x20','2926dVoevC','milestoneSize','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','945380fVlYtG','execute','Error:\x20Parent\x20segment\x20context\x20required','24lCDFwb','file','\x20\x20-\x20','getSegment','filePath','Resolved\x20YAML\x20file:\x20','blue','listVersions','getActivation','Getting\x20column\x20mapping...','Options:','/app/ps/','Show\x20journey\x20statistics','entries','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','getParentFull','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','getLatestJourneyId','Fetching\x20journeys\x20and\x20folders...','segments','journey','journey:stats','Target\x20directory:\x20','Pattern:\x20','\x20->\x20','\x20(ID:\x20','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Getting\x20journey\x20details...','πŸ“\x20','βœ”\x20Journey\x20\x22','rule','length','no_parent','\x27\x20not\x20found\x20in\x20','journeyBundleName','\x20activation','segmentName','...','description','journey:columns','journeyBundleId','columns','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','version','includeHistory','activation_','journey:push','verbose','journeyName','\x20\x20Consolidating\x20duplicate\x20segment:\x20','(completed)','relative','root\x20folder','yes','table','args','Getting\x20version\x20','(root)','listActivationsFlat','segmentPushCommand','Warning:\x20Could\x20not\x20resolve\x20activation\x20','4199GMSBqf','getStatistics','stage','No\x20statistics\x20available\x20for\x20journey:\x20','-\x20no\x20files\x20written','Show\x20journey\x20table\x20column\x20mapping','\x20details...','Aborted.','stages','Creating\x20new\x20version...','draft','Fetching\x20parent\x20segment...','journey:version:view','379345RGPFBj','content','green','toLowerCase','links','\x20journey\x20files\x20to\x20','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','\x20journeys','nodes','goalSize','\x20new\x20files','exitOrJumpSize','paused','activationParams','audienceId','Resume\x20a\x20paused\x20journey','error','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','json','parentSegment','No\x20traffic\x20data\x20available\x20for\x20journey:\x20','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Error:\x20Invalid\x20--type\x20\x22','Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey','enteredSize','then','hasPeriod','Fetching\x20users\x20and\x20connections...','Pausing\x20journey...','Warning:\x20Could\x20not\x20resolve\x20segment\x20','journey:versions','1730paghtF','goal','getJourney','21807CSjFwf','isNew','\x20\x20Statistics\x20not\x20available','List\x20journeys\x20in\x20current\x20context','session','hasChanges','cyan','parentName','Fetching\x20','/j/da/je','conversion','INVALID_ARGUMENT','map','web','Cancelled','set','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','Show\x20journey\x20details','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','push','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','Resolving\x20version...'];a22_0x1181=function(){return _0x47f982;};return a22_0x1181();}export class JourneyPushCommand extends BaseCommand{['name']=a22_0x5a8bdc(0x9f);['description']=a22_0x5a8bdc(0x9a);[a22_0x5a8bdc(0xac)]=new SegmentPushCommand();async[a22_0x5a8bdc(0x179)](_0x106468){const _0x4fecff=a22_0x5a8bdc,_0x157b81=_0x106468[_0x4fecff(0xa8)][0x0];let _0x46ea25;if(_0x157b81){const _0x5ae280=await resolveTarget({'arg':_0x157b81,'contextParent':_0x106468[_0x4fecff(0x109)][_0x4fecff(0xce)],'cwd':process[_0x4fecff(0x12e)]()});isSuccessfulResolution(_0x5ae280)&&_0x5ae280[_0x4fecff(0x173)]===_0x4fecff(0x17c)&&(_0x46ea25=_0x5ae280[_0x4fecff(0x17f)]);}const _0x28fbd4={..._0x106468,'options':{..._0x106468[_0x4fecff(0x109)],'journeysOnly':!![],..._0x46ea25&&{'singleFilePath':_0x46ea25}}};return this[_0x4fecff(0xac)][_0x4fecff(0x179)](_0x28fbd4);}}export class JourneyVersionsCommand extends BaseCommand{[a22_0x5a8bdc(0x154)]=a22_0x5a8bdc(0xd9);[a22_0x5a8bdc(0x1a1)]=a22_0x5a8bdc(0x10f);async[a22_0x5a8bdc(0x179)](_0xf54002){const _0x140b05=a22_0x5a8bdc,{options:_0x2dda59,args:_0x91f16d,tdx:_0x5c7fb2}=_0xf54002,_0x883aeb=_0x91f16d[0x0];if(!requireNameOrPath(_0x883aeb))return 0x1;if(_0x2dda59['verbose'])console[_0x140b05(0xcb)](_0x140b05(0x11d)+_0x883aeb);const {journeyId:_0x4e8e68}=await resolveJourneyIdFromInput(_0x883aeb,_0x2dda59,_0x5c7fb2),_0x1573e0=await withSpinner(_0x140b05(0x160),()=>_0x5c7fb2[_0x140b05(0x18f)][_0x140b05(0x182)](_0x4e8e68),{'verbose':_0x2dda59[_0x140b05(0xa0)]}),{bundleName:_0x1e8d83,versions:_0x576c8d,latestJourneyId:_0x697b5d}=_0x1573e0[_0x140b05(0xfd)];console['error'](_0x1e8d83+':\x20'+_0x576c8d[_0x140b05(0x19a)]+'\x20version'+(_0x576c8d[_0x140b05(0x19a)]!==0x1?'s':''));const _0x5c6339=_0x576c8d[_0x140b05(0xe9)](_0x3cb705=>({'version':_0x3cb705[_0x140b05(0x140)],'journey_id':_0x3cb705[_0x140b05(0x168)],'name':_0x3cb705['name'],'state':_0x3cb705[_0x140b05(0x135)],'paused':_0x3cb705['paused'],'latest':_0x3cb705['journeyId']===_0x697b5d,'created_at':_0x3cb705['createdAt']}));return await handleSDKOutput(_0x5c6339,_0x2dda59),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{[a22_0x5a8bdc(0x154)]=a22_0x5a8bdc(0x13c);['description']=a22_0x5a8bdc(0xd2);async[a22_0x5a8bdc(0x179)](_0x1c13df){const _0x205bef=a22_0x5a8bdc,{options:_0x3f6e05,args:_0x407c0d,tdx:_0x1802a9}=_0x1c13df,_0xdcdb8f=_0x407c0d[0x0];if(!requireNameOrPath(_0xdcdb8f))return 0x1;if(_0x3f6e05[_0x205bef(0xa0)])console[_0x205bef(0xcb)](_0x205bef(0x11d)+_0xdcdb8f);const {journeyId:_0x4211a5,journeyName:_0x520ab3}=await resolveJourneyIdFromInput(_0xdcdb8f,_0x3f6e05,_0x1802a9);if(!_0x3f6e05[_0x205bef(0xa6)]){const _0x307a90=await confirm(_0x205bef(0x130)+_0x520ab3+'\x22?');if(!_0x307a90)return console['error'](_0x205bef(0xeb)),0x0;}const _0x449d3b=await withSpinner(_0x205bef(0xb7),()=>_0x1802a9[_0x205bef(0x18f)][_0x205bef(0x129)](_0x4211a5),{'verbose':_0x3f6e05['verbose']}),_0xbfd5f7=_0x449d3b[_0x205bef(0xfd)];return console[_0x205bef(0xcb)](a22_0x56bc5a[_0x205bef(0xbd)]('βœ”')+_0x205bef(0x107)+_0xbfd5f7['attributes'][_0x205bef(0x140)]+_0x205bef(0x12b)+_0xbfd5f7[_0x205bef(0x159)][_0x205bef(0x154)]+'\x22'),console['error'](_0x205bef(0xf4)+_0xbfd5f7['id']),await handleSingleObjectOutput({'id':_0xbfd5f7['id'],'name':_0xbfd5f7[_0x205bef(0x159)]['name'],'version':_0xbfd5f7['attributes'][_0x205bef(0x140)],'state':_0xbfd5f7['attributes']['state'],'bundle_id':_0xbfd5f7['attributes'][_0x205bef(0x1a3)],'created_at':_0xbfd5f7[_0x205bef(0x159)][_0x205bef(0xfa)]},_0x3f6e05),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a22_0x5a8bdc(0x154)]=a22_0x5a8bdc(0xba);[a22_0x5a8bdc(0x1a1)]=a22_0x5a8bdc(0x13e);async[a22_0x5a8bdc(0x179)](_0x39a6f1){const _0xf65781=a22_0x5a8bdc,{options:_0x4c4756,args:_0x33ac4f,tdx:_0x58cf72}=_0x39a6f1,_0x55b806=_0x33ac4f[0x0];if(!requireNameOrPath(_0x55b806))return 0x1;const _0x152d17=_0x4c4756[_0xf65781(0x9c)];if(!_0x152d17)return console[_0xf65781(0xcb)](_0xf65781(0x14f)),console[_0xf65781(0xcb)](_0xf65781(0xed)),0x1;const _0x40a3b6=parseInt(_0x152d17,0xa);if(isNaN(_0x40a3b6)||_0x40a3b6<0x1)return console['error'](_0xf65781(0x113)+_0x152d17),0x1;if(_0x4c4756['verbose'])console[_0xf65781(0xcb)](_0xf65781(0x11d)+_0x55b806+',\x20version:\x20'+_0x40a3b6);const {journeyId:_0x174345,parentSegmentId:_0x9f0312}=await resolveJourneyIdFromInput(_0x55b806,_0x4c4756,_0x58cf72),_0x325841=await withSpinner(_0xf65781(0xf3),()=>_0x58cf72[_0xf65781(0x18f)][_0xf65781(0x182)](_0x174345),{'verbose':_0x4c4756[_0xf65781(0xa0)]}),{versions:_0x18bbde,latestJourneyId:_0x5dc20c}=_0x325841['data'],_0x643177=_0x18bbde[_0xf65781(0x10c)](_0x5ab312=>_0x5ab312[_0xf65781(0x140)]===_0x40a3b6);if(!_0x643177){const _0x2ac206=_0x18bbde[_0xf65781(0xe9)](_0x1f21dd=>'v'+_0x1f21dd['versionNumber'])[_0xf65781(0x15f)](',\x20');return console[_0xf65781(0xcb)](_0xf65781(0x13f)+_0x40a3b6+_0xf65781(0x12a)+_0x2ac206),0x1;}const _0x262b72=await withSpinner(_0xf65781(0xa9)+_0x40a3b6+_0xf65781(0xb4),()=>_0x58cf72[_0xf65781(0x18f)][_0xf65781(0xdc)](_0x643177[_0xf65781(0x168)]),{'verbose':_0x4c4756[_0xf65781(0xa0)]}),_0x3d51be=_0x262b72[_0xf65781(0xfd)],_0x2c02e2=getConsoleNextUrl(_0x4c4756['site'],_0xf65781(0x186)+_0x9f0312+_0xf65781(0x106)+_0x643177[_0xf65781(0x168)]+'/j/da/je');return await handleSingleObjectOutput({'id':_0x3d51be['id'],'name':_0x3d51be[_0xf65781(0x159)]['name'],'version':_0x3d51be[_0xf65781(0x159)][_0xf65781(0x140)],'description':_0x3d51be[_0xf65781(0x159)]['description'],'state':_0x3d51be[_0xf65781(0x159)][_0xf65781(0x135)],'paused':_0x3d51be[_0xf65781(0x159)]['paused'],'reentry_mode':_0x3d51be[_0xf65781(0x159)]['reentryMode'],'stages':_0x3d51be[_0xf65781(0x159)][_0xf65781(0x139)]?.['length']||0x0,..._0x3d51be[_0xf65781(0x159)]['goal']&&{'goal':_0x3d51be[_0xf65781(0x159)][_0xf65781(0xdb)][_0xf65781(0x154)]},'latest':_0x643177[_0xf65781(0x168)]===_0x5dc20c,'created_at':_0x3d51be['attributes'][_0xf65781(0xfa)],'updated_at':_0x3d51be[_0xf65781(0x159)][_0xf65781(0x16d)],'url':_0x2c02e2},_0x4c4756),0x0;}}
1
+ const a22_0x5e4339=a22_0x4e19;(function(_0x5a0c10,_0x3dc87d){const _0x2a0d42=a22_0x4e19,_0xebec22=_0x5a0c10();while(!![]){try{const _0x5d69e5=parseInt(_0x2a0d42(0x81))/0x1+parseInt(_0x2a0d42(0x144))/0x2+-parseInt(_0x2a0d42(0x160))/0x3+-parseInt(_0x2a0d42(0xb0))/0x4*(-parseInt(_0x2a0d42(0xb5))/0x5)+parseInt(_0x2a0d42(0x12f))/0x6+-parseInt(_0x2a0d42(0x165))/0x7+-parseInt(_0x2a0d42(0x13d))/0x8;if(_0x5d69e5===_0x3dc87d)break;else _0xebec22['push'](_0xebec22['shift']());}catch(_0x25f048){_0xebec22['push'](_0xebec22['shift']());}}}(a22_0x3026,0x2ffb3));import a22_0x117952 from'chalk';import a22_0x373cff from'path';function a22_0x4e19(_0x457a2f,_0x5734c1){_0x457a2f=_0x457a2f-0x72;const _0x302644=a22_0x3026();let _0x4e1997=_0x302644[_0x457a2f];return _0x4e1997;}import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{aggregateStageHistory,assembleJourneyStats,buildStageNameMap}from'../sdk/journey.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{createTdxConfigContent}from'../sdk/segment/tdx-config.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function requireNameOrPath(_0x4b0e3a){const _0xe7dc52=a22_0x4e19;return!_0x4b0e3a&&(console[_0xe7dc52(0xaa)](_0xe7dc52(0x13c)),console[_0xe7dc52(0xaa)]('Usage:\x20journey\x20<subcommand>\x20<name-or-path>')),!!_0x4b0e3a;}function withJsonFormat(_0xf440d3){const _0x342f41=a22_0x4e19;if(!_0xf440d3[_0x342f41(0xab)]&&!_0xf440d3[_0x342f41(0x12d)]&&!_0xf440d3[_0x342f41(0x150)]&&!_0xf440d3['tsv'])return{..._0xf440d3,'format':_0x342f41(0x12d),'json':!![]};return _0xf440d3;}function formatJourneyState(_0x4c1f9b){const _0xa3a1c5=a22_0x4e19;switch(_0x4c1f9b){case _0xa3a1c5(0xf4):return a22_0x117952[_0xa3a1c5(0xe2)](_0xa3a1c5(0x83));case'draft':return a22_0x117952[_0xa3a1c5(0x100)](_0xa3a1c5(0x10a));case _0xa3a1c5(0x169):return a22_0x117952[_0xa3a1c5(0x166)](_0xa3a1c5(0xb4));case _0xa3a1c5(0x102):return a22_0x117952[_0xa3a1c5(0x156)](_0xa3a1c5(0x93));case _0xa3a1c5(0x13a):return a22_0x117952[_0xa3a1c5(0x100)]('(archived)');default:return'('+_0x4c1f9b+')';}}function a22_0x3026(){const _0x5d1a43=['Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey','versionNumber','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Getting\x20column\x20mapping...','\x20new\x20files','parentSegment','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','file','set','description','\x0aChanges\x20to\x20\x27','absolutePath','push','\x20\x20Statistics\x20not\x20available','\x20details...','localeCompare','cyan','links','\x20\x20Preserving\x20local\x20segment\x20name:\x20','Export\x20journey(s)\x20as\x20YAML\x20files','Resolving\x20parent\x20segment...','/e/','getTrafficData','\x20\x20-\x20','hasChanges','\x0aPull\x20summary:','test','journeyStages','Input:\x20','\x20\x20Consolidating\x20duplicate\x20segment:\x20','nodes','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','isNew','session','green','.yml','execute','\x22\x20not\x20found','table','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','name','setPhase','stageNameMap','enteredSize','No\x20statistics\x20available\x20for\x20journey:\x20','all','journey:activations','map','πŸ“\x20','βœ”\x20Pulled\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','journeyId','launched','\x20versions)','site','folderPath','Listing\x20journey\x20versions...','journey:version:create','journeys','\x20Created\x20v','\x20\x20Journey\x20ID:\x20','Cancelled','args','entries','dim','rule','completed','Target\x20file:\x20','\x20Opening\x20','hasPeriod','resourceName','journey:pull','utf-8','resolveParentId','(draft)','activation_','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','journey:view','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22','segmentName','pause','Found\x20','type','folders','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','diff','sort','No\x20journeys\x20found','Resolving\x20version...','\x20version','\x20journey','join','data','length','INVALID_ARGUMENT','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','journeyBundleId','dryRun','Show\x20journey\x20details','βœ”\x20Journey\x20\x22','filter','Getting\x20version\x20','Show\x20journey\x20table\x20column\x20mapping','getSegment','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','verbose','json','createdAt','1971192dvSkCk','base','segment','then','Fetching\x20users\x20and\x20connections...','red','journeyName','Fetching\x20journeys\x20and\x20folders...','history','Fetching\x20parent\x20segment...','yes','archived','get','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','3280184bsuunm',',\x20version:\x20','conversion','listFolders','buildIdToEmailMap','toLowerCase','from','378292JaMhpV','no_parent','getJourney','resolveSegment','List\x20journeys\x20in\x20current\x20context','options','πŸ—ΊοΈ\x20','journey:resume','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','segmentPushCommand','Resolving\x20journey...','\x20\x20Folder\x20path:\x20','jsonl','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','Fetching\x20','journeyBundleName','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','segments','blue','folderId','No\x20traffic\x20data\x20available\x20for\x20journey:\x20','relativePath','filePath','helpText','\x20(rule\x20match)','View\x20a\x20specific\x20version\x20of\x20a\x20journey','getParentFull','targetDir','661830eBdbJS','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','journey:stats','\x5c$&','...','338877TrrhST','yellow','stages','values','paused','βœ”\x20Context\x20set:\x20','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','Error:\x20Invalid\x20--type\x20\x22','repeat','Show\x20journey\x20statistics','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','buildIdToNameMap','goal','completionRate','replace','/j/da/je','cwd','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Pause\x20a\x20running\x20journey','state','add','content','has','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x22\x20paused','/app/ps/','Error:\x20--version\x20option\x20is\x20required','resolveJourneyId','journey:push','\x20(draft)\x20β€”\x20\x22','exitOrJumpSize','log','103030KOCPGH','\x20files?','(running)','Write\x20','Resume\x20a\x20paused\x20journey','\x20(ID:\x20','(root)','Error:\x20Version\x20','attributes','reentryMode','connector_config','includeHistory','\x20\x20Name:\x20','activation','find','parent_segment','connection','journey:version:view','(completed)','Error:\x20Journey\x20\x27','parentName','-\x20no\x20files\x20written','Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history','List\x20all\x20versions\x20of\x20a\x20journey','Options:','database','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','Journey\x20name:\x20','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','listActivationsFlat','Getting\x20journey\x20statistics...','Listing\x20journeys...','size','Table:\x20','renderStats','message','getStatistics','journey:columns','listVersions','milestoneSize','root\x20folder','error','format','\x20\x20Parent\x20segment:\x20','errorCode','βœ”\x20Found\x20','version','1019468oKgJiQ','listJourneysWithFolders','journey','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)','(paused)','5mmDUqm','/j/da','Aborted.','stage','\x20=\x20','\x0aError:','bold','updatedAt','listJourneysFromParentSegment','tdx.json','Pattern:\x20'];a22_0x3026=function(){return _0x5d1a43;};return a22_0x3026();}function formatJourneyItem(_0x1b2c0f,_0x1d1f88='',_0x132af1){const _0x345217=a22_0x4e19,_0x2e6dfa=formatJourneyState(_0x1b2c0f[_0x345217(0x74)]),_0x206a96=_0x132af1?hyperlink(_0x1b2c0f[_0x345217(0x153)],_0x132af1):_0x1b2c0f[_0x345217(0x153)];return _0x1d1f88+_0x345217(0x14a)+_0x206a96+'\x20'+_0x2e6dfa;}function escapeRegex(_0x2d1f1e){const _0x487e9b=a22_0x4e19;return _0x2d1f1e[_0x487e9b(0x173)](/[.*+?^${}()|[\]\\]/g,_0x487e9b(0x163));}function globToRegex(_0x138ea6){const _0x499912=a22_0x4e19,_0x15c178=_0x138ea6['split']('*')[_0x499912(0xef)](escapeRegex);return new RegExp(_0x15c178[_0x499912(0x11e)]('.*'),'i');}function buildRuleToNameMapping(_0x5c271f){const _0x5decf4=a22_0x4e19,_0xc2a91f=new Map();if(_0x5c271f['segments'])for(const [_0x15a3cc,_0x691d83]of Object[_0x5decf4(0xff)](_0x5c271f[_0x5decf4(0x155)])){if(_0x691d83[_0x5decf4(0x101)]){const _0x409dc8=serializeRule(_0x691d83[_0x5decf4(0x101)]),_0x144e8d=_0xc2a91f[_0x5decf4(0x13b)](_0x409dc8);_0x144e8d?_0x144e8d[_0x5decf4(0xcc)](_0x15a3cc):_0xc2a91f[_0x5decf4(0xc8)](_0x409dc8,[_0x15a3cc]);}}return _0xc2a91f;}async function resolveJourneyIdFromInput(_0x5c1146,_0x2d4686,_0x1867f8){const _0x8d9ea6=a22_0x4e19,_0x2a0513=await resolveJourneyTarget(_0x5c1146,_0x2d4686[_0x8d9ea6(0xc5)],_0x2d4686[_0x8d9ea6(0x12c)]),_0x2fa15e=_0x2a0513[_0x8d9ea6(0xc5)];if(!_0x2fa15e)throw new SDKError(ErrorCode[_0x8d9ea6(0x121)],_0x8d9ea6(0xc6));const _0xadf781=await withSpinner(_0x8d9ea6(0xd4),()=>_0x1867f8[_0x8d9ea6(0x131)][_0x8d9ea6(0x109)](_0x2fa15e),{'verbose':_0x2d4686['verbose']}),_0xcd0c59=_0xadf781[_0x8d9ea6(0x11f)],_0x193ee8=await withSpinner(_0x8d9ea6(0x14e),()=>_0x1867f8[_0x8d9ea6(0xb2)][_0x8d9ea6(0x7c)](_0xcd0c59,_0x2a0513[_0x8d9ea6(0x135)]),{'verbose':_0x2d4686[_0x8d9ea6(0x12c)]});return{'journeyId':_0x193ee8[_0x8d9ea6(0x11f)],'journeyName':_0x2a0513[_0x8d9ea6(0x135)],'parentSegmentId':_0xcd0c59};}async function resolveJourneyTarget(_0x21eb46,_0x523cc6,_0x557767){const _0x297fe6=a22_0x4e19;if(isYamlFilePath(_0x21eb46))try{const _0x910214=await resolveYamlFilePath(_0x21eb46);return _0x557767&&(console[_0x297fe6(0xaa)]('Resolved\x20YAML\x20file:\x20'+_0x21eb46),console[_0x297fe6(0xaa)](_0x297fe6(0xac)+_0x910214[_0x297fe6(0xc5)]),console[_0x297fe6(0xaa)](_0x297fe6(0x8d)+_0x910214[_0x297fe6(0x112)]),console[_0x297fe6(0xaa)](_0x297fe6(0x14f)+(_0x910214[_0x297fe6(0xf7)]||_0x297fe6(0x87)))),{'journeyName':_0x910214[_0x297fe6(0x112)],'parentSegment':_0x910214[_0x297fe6(0xc5)],'resolved':_0x910214};}catch(_0x4fddb6){throw new SDKError(ErrorCode[_0x297fe6(0x121)],_0x297fe6(0x10c)+_0x4fddb6[_0x297fe6(0xa4)]);}if(!_0x523cc6)throw new SDKError(ErrorCode[_0x297fe6(0x121)],_0x297fe6(0xc2));return{'journeyName':_0x21eb46,'parentSegment':_0x523cc6};}export class JourneyListCommand extends BaseCommand{[a22_0x5e4339(0xe8)]='journey:list';[a22_0x5e4339(0xc9)]=a22_0x5e4339(0x148);async[a22_0x5e4339(0xe4)](_0x371efa){const _0x318b02=a22_0x5e4339,{options:_0x2c5f5e,args:_0x19724b,tdx:_0x13d2d0}=_0x371efa,_0x36f342=_0x19724b[0x0],_0x21c254=_0x2c5f5e['parentSegment'];if(!_0x21c254)return console['error']('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x318b02(0xaa)](_0x318b02(0x72)),0x1;const _0x50dea6=await withSpinner(_0x318b02(0xd4),()=>_0x13d2d0[_0x318b02(0x131)]['resolveParentId'](_0x21c254),{'verbose':_0x2c5f5e[_0x318b02(0x12c)]}),_0x530683=_0x50dea6[_0x318b02(0x11f)];_0x2c5f5e['verbose']&&(console[_0x318b02(0xaa)]('Parent\x20segment:\x20'+_0x21c254+_0x318b02(0x86)+_0x530683+')'),_0x36f342&&console[_0x318b02(0xaa)](_0x318b02(0xbf)+_0x36f342));const _0x36ee7d=await withSpinner(_0x318b02(0x138),()=>_0x13d2d0[_0x318b02(0x131)][_0x318b02(0x15e)](_0x530683),{'verbose':_0x2c5f5e['verbose']}),_0x5416cd=_0x36ee7d[_0x318b02(0x11f)],_0x3d43b6=_0x5416cd['rootFolderId'],_0x41b2eb=await withSpinner(_0x318b02(0xa0),()=>_0x13d2d0[_0x318b02(0xb2)][_0x318b02(0xb1)](_0x530683,_0x3d43b6),{'verbose':_0x2c5f5e[_0x318b02(0x12c)]});let _0x405182=_0x41b2eb[_0x318b02(0x11f)][_0x318b02(0xfa)];const _0x199d7b=_0x41b2eb[_0x318b02(0x11f)][_0x318b02(0x116)],_0x2e1f24=new Map();for(const _0x4aa996 of _0x199d7b){_0x2e1f24[_0x318b02(0xc8)](_0x4aa996['id'],_0x4aa996[_0x318b02(0xe8)]);}if(_0x36f342){const _0x2d6f4b=globToRegex(_0x36f342);_0x405182=_0x405182[_0x318b02(0x127)](_0x287ec9=>_0x2d6f4b[_0x318b02(0xda)](_0x287ec9[_0x318b02(0x153)]));}console[_0x318b02(0xaa)](_0x318b02(0xae)+_0x405182[_0x318b02(0x120)]+_0x318b02(0x11d)+(_0x405182[_0x318b02(0x120)]!==0x1?'s':''));const _0x23898f=_0x2eb052=>{const _0xac74c4=_0x318b02;return getConsoleNextUrl(_0x2c5f5e[_0xac74c4(0xf6)],_0xac74c4(0x7a)+_0x530683+_0xac74c4(0xd5)+_0x2eb052+_0xac74c4(0xb6));};if(_0x2c5f5e[_0x318b02(0xab)]===_0x318b02(0xe6))await handleSDKOutput(_0x405182,_0x2c5f5e);else{if(_0x2c5f5e[_0x318b02(0xab)]===_0x318b02(0x12d)){const _0x5bb29f=_0x405182[_0x318b02(0xef)](_0x1e47a3=>({..._0x1e47a3,'url':_0x23898f(_0x1e47a3['id'])}));await handleSDKOutput(_0x5bb29f,_0x2c5f5e);}else{console[_0x318b02(0x80)]('['+_0x21c254+']');const _0x4242b7=new Map(),_0x225afd=[];for(const _0x4fc0fa of _0x405182){if(!_0x4fc0fa[_0x318b02(0x157)]||_0x4fc0fa['folderId']===_0x3d43b6)_0x225afd[_0x318b02(0xcc)](_0x4fc0fa);else{const _0x63ca0a=_0x4242b7['get'](_0x4fc0fa['folderId'])||[];_0x63ca0a[_0x318b02(0xcc)](_0x4fc0fa),_0x4242b7[_0x318b02(0xc8)](_0x4fc0fa[_0x318b02(0x157)],_0x63ca0a);}}const _0x366dd8=(_0x1f67c3,_0x5acd14)=>_0x1f67c3[_0x318b02(0x153)][_0x318b02(0xcf)](_0x5acd14['journeyBundleName'],undefined,{'sensitivity':_0x318b02(0x130)});_0x225afd['sort'](_0x366dd8);for(const _0x6bd078 of _0x225afd){console[_0x318b02(0x80)](formatJourneyItem(_0x6bd078,'',_0x23898f(_0x6bd078['id'])));}const _0x2837f0=[..._0x4242b7[_0x318b02(0xff)]()][_0x318b02(0x119)]((_0x5b97f8,_0x1ad0a8)=>{const _0x5c6788=_0x318b02,_0x59005c=_0x2e1f24[_0x5c6788(0x13b)](_0x5b97f8[0x0])||_0x5b97f8[0x0],_0x56926f=_0x2e1f24[_0x5c6788(0x13b)](_0x1ad0a8[0x0])||_0x1ad0a8[0x0];return _0x59005c['localeCompare'](_0x56926f,undefined,{'sensitivity':_0x5c6788(0x130)});});for(const [_0x8746c3,_0x460a3a]of _0x2837f0){const _0x3a43c9=_0x2e1f24[_0x318b02(0x13b)](_0x8746c3)||_0x8746c3;console['log'](_0x318b02(0xf0)+_0x3a43c9),_0x460a3a[_0x318b02(0x119)](_0x366dd8);for(const _0x45be64 of _0x460a3a){console[_0x318b02(0x80)](formatJourneyItem(_0x45be64,'\x20\x20',_0x23898f(_0x45be64['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a22_0x5e4339(0xe8)]=a22_0x5e4339(0x10f);[a22_0x5e4339(0xc9)]=a22_0x5e4339(0x125);async[a22_0x5e4339(0xe4)](_0x3c1423){const _0x2ecc00=a22_0x5e4339,{options:_0x56fae7,args:_0x1fab3a,tdx:_0x9113ba}=_0x3c1423,_0x5777b1=_0x1fab3a[0x0];if(!_0x5777b1)return console[_0x2ecc00(0xaa)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x2ecc00(0xaa)](_0x2ecc00(0x16f)),console[_0x2ecc00(0xaa)](_0x2ecc00(0x99)),console['error'](_0x2ecc00(0x14c)),0x1;_0x56fae7[_0x2ecc00(0x12c)]&&console['error'](_0x2ecc00(0xdc)+_0x5777b1);const {journeyId:_0xbcfea6,parentSegmentId:_0x54e0b1}=await resolveJourneyIdFromInput(_0x5777b1,_0x56fae7,_0x9113ba);if(_0x56fae7['web']){const _0x357155=getConsoleNextUrl(_0x56fae7[_0x2ecc00(0xf6)],'/app/ps/'+_0x54e0b1+_0x2ecc00(0xd5)+_0xbcfea6+_0x2ecc00(0x174));return console[_0x2ecc00(0xaa)](a22_0x117952[_0x2ecc00(0xe2)]('βœ”')+_0x2ecc00(0x104)+a22_0x117952[_0x2ecc00(0xd0)](_0x357155)),openBrowser(_0x357155),0x0;}const _0x2f3603=await withSpinner('Getting\x20journey\x20details...',()=>_0x9113ba['journey'][_0x2ecc00(0x146)](_0xbcfea6),{'verbose':_0x56fae7[_0x2ecc00(0x12c)]}),_0x4c2613=_0x2f3603[_0x2ecc00(0x11f)],_0x4ea5a5=_0x56fae7['includeStats'];let _0x275269;if(_0x4ea5a5)try{const _0x606ae3=await withSpinner(_0x2ecc00(0x9f),()=>_0x9113ba[_0x2ecc00(0xb2)][_0x2ecc00(0xa5)](_0xbcfea6),{'verbose':_0x56fae7[_0x2ecc00(0x12c)]});_0x275269=_0x606ae3[_0x2ecc00(0x11f)];}catch{_0x56fae7['verbose']&&console['error'](_0x2ecc00(0xcd));}const _0x2e0f5a=getConsoleNextUrl(_0x56fae7[_0x2ecc00(0xf6)],'/app/ps/'+_0x54e0b1+'/e/'+_0xbcfea6+_0x2ecc00(0x174)),_0xcaecdd={'id':_0x4c2613['id'],'name':_0x4c2613[_0x2ecc00(0x89)][_0x2ecc00(0xe8)],'description':_0x4c2613['attributes']['description'],'state':_0x4c2613[_0x2ecc00(0x89)][_0x2ecc00(0x74)],'paused':_0x4c2613['attributes']['paused'],'reentry_mode':_0x4c2613[_0x2ecc00(0x89)]['reentryMode'],'stages':_0x4c2613[_0x2ecc00(0x89)][_0x2ecc00(0xdb)]?.[_0x2ecc00(0x120)]||0x0,..._0x4c2613[_0x2ecc00(0x89)]['goal']&&{'goal':_0x4c2613[_0x2ecc00(0x89)][_0x2ecc00(0x171)][_0x2ecc00(0xe8)]},..._0x275269&&{'statistics':{'size':_0x275269[_0x2ecc00(0xa1)],'entered':_0x275269[_0x2ecc00(0xeb)],'goal_achieved':_0x275269['goalSize'],'completion_rate':_0x275269[_0x2ecc00(0x172)],'exit_or_jump':_0x275269[_0x2ecc00(0x7f)],'exit_or_jump_rate':_0x275269['exitOrJumpRate'],'stages':_0x275269[_0x2ecc00(0x167)]}},'url':_0x2e0f5a};return await handleSingleObjectOutput(_0xcaecdd,_0x56fae7),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a22_0x5e4339(0xe8)]=a22_0x5e4339(0x162);[a22_0x5e4339(0xc9)]=a22_0x5e4339(0x16e);async[a22_0x5e4339(0xe4)](_0x249b05){const _0xf52008=a22_0x5e4339,{options:_0x563c10,args:_0x12d504,tdx:_0x436219}=_0x249b05,_0x314cc1=_0x12d504[0x0];if(!requireNameOrPath(_0x314cc1))return 0x1;_0x563c10['verbose']&&console[_0xf52008(0xaa)](_0xf52008(0xdc)+_0x314cc1);const _0x4e4b5e=_0x563c10,_0x5e586a=_0x4e4b5e[_0xf52008(0x143)],_0x1f3b15=_0x4e4b5e['to'],_0x21a148=_0x4e4b5e[_0xf52008(0x8c)],_0xa3f258=_0x4e4b5e[_0xf52008(0xb8)];_0x21a148&&!_0x5e586a&&!_0x1f3b15&&console[_0xf52008(0xaa)](_0xf52008(0x97));const _0x33589f=_0x21a148?withJsonFormat(_0x563c10):_0x563c10,{journeyId:_0x31ce14,journeyName:_0x3f00f0}=await resolveJourneyIdFromInput(_0x314cc1,_0x33589f,_0x436219),_0x2e8f5f=_0x5e586a||_0x1f3b15?{'from':_0x5e586a,'to':_0x1f3b15}:undefined,_0xb8be0d=await withSpinner('Getting\x20journey\x20statistics...',()=>Promise[_0xf52008(0xed)]([_0x436219[_0xf52008(0xb2)][_0xf52008(0x146)](_0x31ce14),_0x436219['journey'][_0xf52008(0xa5)](_0x31ce14,_0x2e8f5f)]),{'verbose':_0x33589f[_0xf52008(0x12c)]}),[_0x20ba8e,_0x510019]=_0xb8be0d[_0xf52008(0x11f)];if(!_0x510019||_0x510019[_0xf52008(0xf3)]===null)return console['error'](_0xf52008(0xec)+_0x3f00f0),console['error'](_0xf52008(0x9d)),0x0;const _0x493b90=buildStageNameMap(_0x20ba8e),_0x5b3d2c=!!(_0x2e8f5f&&_0x510019[_0xf52008(0x137)]?.[_0xf52008(0x120)]),_0xa737ad={'stageNameMap':_0x493b90,'hasPeriod':_0x5b3d2c,'includeHistory':!!_0x21a148};if(_0xa3f258&&_0x510019[_0xf52008(0x167)]){const _0x49587a=_0x510019['stages'][_0xf52008(0x8f)](_0x1c9a63=>{const _0x13fd6a=_0xf52008,_0x3c2757=_0x493b90[_0x13fd6a(0x13b)](_0x1c9a63['id'])??'';return _0x3c2757[_0x13fd6a(0x142)]()===_0xa3f258['toLowerCase']();});if(_0x49587a)return await handleSingleObjectOutput(formatStageStats(_0x49587a,_0xa737ad),_0x33589f),0x0;const _0x3f8ab3=_0x510019[_0xf52008(0x167)][_0xf52008(0xef)](_0x1508c4=>_0x493b90[_0xf52008(0x13b)](_0x1508c4['id'])??_0x1508c4['id']);return console['error']('Error:\x20Stage\x20\x22'+_0xa3f258+_0xf52008(0xe5)),console['error']('Available\x20stages:\x20'+_0x3f8ab3[_0xf52008(0x11e)](',\x20')),0x1;}const _0x2c51a2=_0x510019[_0xf52008(0x167)]?.['map'](_0x2bea9d=>formatStageStats(_0x2bea9d,_0xa737ad)),_0x142017=assembleJourneyStats(_0x510019,{'from':_0x5e586a,'to':_0x1f3b15,'includeHistory':_0x21a148});return await this[_0xf52008(0xa3)](_0x142017,_0x2c51a2??[],_0x33589f),0x0;}async['renderStats'](_0x596ae1,_0x7938ce,_0x5002c9){const _0x2f463c=a22_0x5e4339,_0x34726d=_0x5002c9[_0x2f463c(0xab)]===_0x2f463c(0x12d)||_0x5002c9[_0x2f463c(0xab)]===_0x2f463c(0x150)||_0x5002c9[_0x2f463c(0x12d)]||_0x5002c9[_0x2f463c(0x150)];if(_0x34726d){_0x596ae1['stages']=_0x7938ce,await handleSingleObjectOutput(_0x596ae1,_0x5002c9);return;}await handleSingleObjectOutput(_0x596ae1,_0x5002c9);for(const _0x297d2e of _0x7938ce){console[_0x2f463c(0x80)](''),console[_0x2f463c(0x80)](String(a22_0x117952[_0x2f463c(0xd0)][_0x2f463c(0xbb)]('['+_0x297d2e['name']+']'))+a22_0x117952[_0x2f463c(0x100)]('\x20'+_0x297d2e['id']));const {id:_0x14b09d,name:_0x297b1b,..._0x119710}=_0x297d2e;await handleSingleObjectOutput(_0x119710,_0x5002c9);}}}export class JourneyTrafficCommand extends BaseCommand{['name']='journey:traffic';[a22_0x5e4339(0xc9)]=a22_0x5e4339(0x16b);async[a22_0x5e4339(0xe4)](_0x5103d1){const _0x2c0bf9=a22_0x5e4339,{options:_0x457140,args:_0x2f50ee,tdx:_0x41b325}=_0x5103d1,_0x184b6d=_0x2f50ee[0x0];if(!requireNameOrPath(_0x184b6d))return 0x1;_0x457140[_0x2c0bf9(0x12c)]&&console[_0x2c0bf9(0xaa)](_0x2c0bf9(0xdc)+_0x184b6d);const _0x3bab7f=_0x457140,_0x2991ac=_0x3bab7f[_0x2c0bf9(0x115)],_0xc5eabd=_0x3bab7f[_0x2c0bf9(0x143)],_0x1b3bea=_0x3bab7f['to'],_0x136a35=_0x3bab7f['limit'];if(_0x2991ac&&_0x2991ac!==_0x2c0bf9(0x13f)&&_0x2991ac!=='activation')return console['error'](_0x2c0bf9(0x16c)+_0x2991ac+'\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.'),0x1;const _0x413744=withJsonFormat(_0x457140),{journeyId:_0x1cf264,journeyName:_0x4db2f4}=await resolveJourneyIdFromInput(_0x184b6d,_0x413744,_0x41b325),_0x28980e={'type':_0x2991ac,'from':_0xc5eabd,'to':_0x1b3bea,'limit':_0x136a35},_0x49a23f=await withSpinner('Getting\x20journey\x20traffic\x20data...',()=>_0x41b325['journey'][_0x2c0bf9(0xd6)](_0x1cf264,_0x28980e),{'verbose':_0x413744['verbose']}),_0x30bc69=_0x49a23f[_0x2c0bf9(0x11f)],_0x4dfef8=_0x30bc69['conversion']&&(_0x30bc69[_0x2c0bf9(0x13f)][_0x2c0bf9(0xde)][_0x2c0bf9(0x120)]>0x0||_0x30bc69[_0x2c0bf9(0x13f)][_0x2c0bf9(0xd1)]['length']>0x0),_0x31c549=_0x30bc69[_0x2c0bf9(0x8e)]&&_0x30bc69[_0x2c0bf9(0x8e)][_0x2c0bf9(0x120)]>0x0;if(!_0x4dfef8&&!_0x31c549)return console[_0x2c0bf9(0xaa)](_0x2c0bf9(0x158)+_0x4db2f4),console['error'](_0x2c0bf9(0x10e)),_0xc5eabd&&_0x1b3bea&&console[_0x2c0bf9(0xaa)](_0x2c0bf9(0x10d)),0x0;return await handleSingleObjectOutput(_0x30bc69,_0x413744),0x0;}}function formatStageStats(_0x46ece5,_0x522aec){const _0x934911=a22_0x5e4339,_0x47a384=_0x522aec[_0x934911(0x105)]&&_0x46ece5[_0x934911(0x137)]?.[_0x934911(0x120)]?aggregateStageHistory(_0x46ece5[_0x934911(0x137)]):{'size':_0x46ece5[_0x934911(0xa1)],'entered':_0x46ece5[_0x934911(0xeb)],'milestone':_0x46ece5[_0x934911(0xa8)],'milestone_rate':_0x46ece5['completeMilestoneRate'],'exit_or_jump':_0x46ece5['exitOrJumpSize'],'exit_or_jump_rate':_0x46ece5['exitOrJumpRate']},_0x173220={'id':_0x46ece5['id'],'name':_0x522aec[_0x934911(0xea)][_0x934911(0x13b)](_0x46ece5['id'])??_0x46ece5['id'],..._0x47a384};return _0x522aec[_0x934911(0x105)]&&_0x522aec[_0x934911(0x8c)]&&_0x46ece5[_0x934911(0x137)]&&(_0x173220['history']=_0x46ece5[_0x934911(0x137)]),_0x173220;}export class JourneyPauseCommand extends BaseCommand{[a22_0x5e4339(0xe8)]='journey:pause';[a22_0x5e4339(0xc9)]=a22_0x5e4339(0x73);async[a22_0x5e4339(0xe4)](_0x5e5081){const _0x2776c9=a22_0x5e4339,{options:_0x12cbcf,args:_0x57b9c6,tdx:_0x386f90}=_0x5e5081,_0x5bfd72=_0x57b9c6[0x0];if(!requireNameOrPath(_0x5bfd72))return 0x1;_0x12cbcf['verbose']&&console[_0x2776c9(0xaa)]('Input:\x20'+_0x5bfd72);const {journeyId:_0x2a87fd,journeyName:_0x3f95e1}=await resolveJourneyIdFromInput(_0x5bfd72,_0x12cbcf,_0x386f90);if(!_0x12cbcf['yes']){const _0x126632=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0x3f95e1+'\x22?');if(!_0x126632)return console['error'](_0x2776c9(0xfd)),0x0;}const _0x1b7b00=await withSpinner('Pausing\x20journey...',()=>_0x386f90[_0x2776c9(0xb2)][_0x2776c9(0x113)](_0x2a87fd),{'verbose':_0x12cbcf['verbose']}),_0x388be7=_0x1b7b00['data'];return console[_0x2776c9(0xaa)]('βœ”\x20Journey\x20\x22'+_0x388be7[_0x2776c9(0x89)]['name']+_0x2776c9(0x79)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a22_0x5e4339(0xe8)]=a22_0x5e4339(0x14b);[a22_0x5e4339(0xc9)]=a22_0x5e4339(0x85);async[a22_0x5e4339(0xe4)](_0xc1f095){const _0x5c0dbe=a22_0x5e4339,{options:_0x2fcb41,args:_0x13eb5f,tdx:_0x47e48a}=_0xc1f095,_0x3281b7=_0x13eb5f[0x0];if(!requireNameOrPath(_0x3281b7))return 0x1;_0x2fcb41[_0x5c0dbe(0x12c)]&&console[_0x5c0dbe(0xaa)]('Input:\x20'+_0x3281b7);const {journeyId:_0x52f4bf,journeyName:_0x58775d}=await resolveJourneyIdFromInput(_0x3281b7,_0x2fcb41,_0x47e48a);if(!_0x2fcb41[_0x5c0dbe(0x139)]){const _0x10b9a2=await confirm(_0x5c0dbe(0x117)+_0x58775d+'\x22?');if(!_0x10b9a2)return console[_0x5c0dbe(0xaa)](_0x5c0dbe(0xfd)),0x0;}const _0x3caaea=await withSpinner('Resuming\x20journey...',()=>_0x47e48a[_0x5c0dbe(0xb2)]['resume'](_0x52f4bf),{'verbose':_0x2fcb41['verbose']}),_0x3e44ec=_0x3caaea[_0x5c0dbe(0x11f)];return console[_0x5c0dbe(0xaa)](_0x5c0dbe(0x126)+_0x3e44ec[_0x5c0dbe(0x89)]['name']+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{[a22_0x5e4339(0xe8)]=a22_0x5e4339(0x107);[a22_0x5e4339(0xc9)]=a22_0x5e4339(0xd3);async[a22_0x5e4339(0xe4)](_0x2b505b){const _0x460eac=a22_0x5e4339,{options:_0x8657fb,args:_0x3f0e63,tdx:_0x25b027}=_0x2b505b,_0x3b46f1=_0x8657fb,_0x46a8ea=_0x3f0e63[0x0],_0xa183b3=_0x46a8ea&&isYamlFilePath(_0x46a8ea),_0x3a40fd=await resolveTarget({'arg':_0xa183b3?_0x46a8ea:undefined,'contextParent':_0x8657fb[_0x460eac(0xc5)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x3a40fd))return _0x3a40fd[_0x460eac(0xad)]===_0x460eac(0x145)?(console[_0x460eac(0xaa)](a22_0x117952['yellow'](_0x460eac(0x12b))),console[_0x460eac(0xaa)](_0x460eac(0xb3)),console['error'](_0x460eac(0x151)),console[_0x460eac(0xaa)](_0x460eac(0xf2)),console['error'](_0x460eac(0x78))):(console[_0x460eac(0xaa)](a22_0x117952['red']('Error:\x20'+_0x3a40fd[_0x460eac(0xa4)]+'\x0a')),_0x3a40fd[_0x460eac(0x15b)]&&console[_0x460eac(0xaa)](a22_0x117952['cyan'](_0x3a40fd[_0x460eac(0x15b)]))),0x1;let _0x4ffefc=_0xa183b3?undefined:_0x46a8ea,_0x497127,_0x3796be;_0x3a40fd[_0x460eac(0x115)]==='file'&&(_0x4ffefc=_0x3a40fd[_0x460eac(0x106)],_0x497127=_0x3a40fd[_0x460eac(0x15a)],_0x3796be=_0x3a40fd[_0x460eac(0xf7)]);const _0x4a798d=_0x3a40fd[_0x460eac(0x95)],_0x592a5b=_0x3a40fd[_0x460eac(0x15f)];_0x3b46f1[_0x460eac(0x12c)]&&(console[_0x460eac(0xaa)]('Parent\x20segment:\x20'+_0x4a798d),console[_0x460eac(0xaa)]('Target\x20directory:\x20'+_0x592a5b),_0x4ffefc&&console[_0x460eac(0xaa)](_0x460eac(0x9c)+_0x4ffefc),_0x497127&&console['error'](_0x460eac(0x103)+_0x497127),_0x3796be&&console['error']('Folder\x20path:\x20'+_0x3796be));const _0x1cdd0f=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x25b027[_0x460eac(0x131)][_0x460eac(0x109)](_0x4a798d),{'verbose':_0x8657fb[_0x460eac(0x12c)]}),_0xfbca71=_0x1cdd0f[_0x460eac(0x11f)],{journeys:_0xf70a2e,folders:_0x34fe25}=await withSpinner(_0x460eac(0x136),async()=>{const _0x518592=_0x460eac,[_0xd4ea1d,_0x344c54]=await Promise[_0x518592(0xed)]([_0x25b027['journey'][_0x518592(0xbd)](_0xfbca71,undefined,{'includeAllVersions':!![]}),_0x25b027[_0x518592(0x131)][_0x518592(0x140)](_0xfbca71)]);return{'journeys':_0xd4ea1d,'folders':_0x344c54};},{'verbose':_0x8657fb['verbose']})['then'](_0x438ead=>_0x438ead['data']);let _0x4271bf=_0xf70a2e;const _0x316fd5=buildFolderIdToPathMap(_0x34fe25);if(_0x4ffefc){const _0x289559=_0x4271bf[_0x460eac(0x127)](_0x284c90=>_0x284c90['journeyBundleName'][_0x460eac(0x142)]()===_0x4ffefc[_0x460eac(0x142)]());if(_0x289559[_0x460eac(0x120)]===0x0)return console[_0x460eac(0xaa)]('Error:\x20Journey\x20not\x20found:\x20'+_0x4ffefc),console[_0x460eac(0xaa)](_0x460eac(0x154)),0x1;_0x4271bf=_0x289559;}if(_0x3796be!==undefined){const _0x26ccc0=_0x4271bf[_0x460eac(0x127)](_0x4cac1b=>{const _0x5d359d=_0x460eac,_0x23d37a=_0x4cac1b[_0x5d359d(0x157)]?_0x316fd5[_0x5d359d(0x13b)](_0x4cac1b[_0x5d359d(0x157)])||'':'';return _0x23d37a===_0x3796be;});if(_0x26ccc0['length']===0x0&&_0x4271bf[_0x460eac(0x120)]>0x0){console['error'](_0x460eac(0x94)+_0x4ffefc+'\x27\x20not\x20found\x20in\x20'+(_0x3796be||_0x460eac(0xa9))),console[_0x460eac(0xaa)](_0x460eac(0x122));for(const _0x523d35 of _0x4271bf){const _0x20e233=_0x523d35[_0x460eac(0x157)]?_0x316fd5[_0x460eac(0x13b)](_0x523d35[_0x460eac(0x157)])||'':'';console['error'](_0x460eac(0xd7)+(_0x20e233||'(root)')+'/'+_0x523d35['journeyBundleName']);}return 0x1;}_0x4271bf=_0x26ccc0;}if(_0x4271bf[_0x460eac(0x120)]===0x0)return console[_0x460eac(0xaa)](_0x460eac(0x11a)),0x0;const _0x3c959e=new Map();for(const _0xc23e78 of _0x4271bf){const _0x11fe72=_0xc23e78[_0x460eac(0x123)];!_0x3c959e[_0x460eac(0x77)](_0x11fe72)&&_0x3c959e[_0x460eac(0xc8)](_0x11fe72,[]),_0x3c959e[_0x460eac(0x13b)](_0x11fe72)[_0x460eac(0xcc)](_0xc23e78);}for(const _0xac81c5 of _0x3c959e[_0x460eac(0x168)]()){_0xac81c5[_0x460eac(0x119)]((_0x5c13de,_0xccc908)=>(_0x5c13de[_0x460eac(0xc1)]||0x0)-(_0xccc908['versionNumber']||0x0));}const _0x1cc049=[],{idToEmailMap:_0x438dcb,connectionIdToNameMap:_0xcbc904}=await withSpinner(_0x460eac(0x133),async()=>{const _0x304451=_0x460eac,[_0x2a1fe6,_0x77558f]=await Promise[_0x304451(0xed)]([_0x25b027['user'][_0x304451(0x141)](),_0x25b027['connection'][_0x304451(0x170)]()]);return{'idToEmailMap':_0x2a1fe6,'connectionIdToNameMap':_0x77558f};},{'verbose':_0x8657fb['verbose']})[_0x460eac(0x132)](_0x11f05a=>_0x11f05a['data']);for(const _0x216ebe of _0x3c959e[_0x460eac(0x168)]()){const _0x1f79b1=_0x216ebe[0x0][_0x460eac(0x153)],_0x3beb37=_0x216ebe[0x0][_0x460eac(0x157)],_0x3911ea=_0x3beb37?_0x316fd5[_0x460eac(0x13b)](_0x3beb37)||'':'',_0x16a085=_0x3911ea?a22_0x373cff[_0x460eac(0x11e)](_0x592a5b,_0x3911ea):_0x592a5b,_0x3e6e98=_0x497127||a22_0x373cff[_0x460eac(0x11e)](_0x16a085,sanitizeFileName(_0x1f79b1)+_0x460eac(0xe3));let _0x3cca4b,_0x4300c5;if(existsSync(_0x3e6e98))try{const _0x26dcf3=readFileSync(_0x3e6e98,_0x460eac(0x108)),_0x5e73c0=parseYamlString(_0x26dcf3);_0x4300c5=_0x5e73c0,_0x3cca4b=buildRuleToNameMapping(_0x5e73c0),_0x3b46f1[_0x460eac(0x12c)]&&_0x3cca4b['size']>0x0&&console[_0x460eac(0xaa)]('Found\x20'+_0x3cca4b[_0x460eac(0xa1)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x1f79b1);}catch(_0x35d74d){_0x3b46f1[_0x460eac(0x12c)]&&console[_0x460eac(0xaa)](_0x460eac(0x9b)+_0x35d74d['message']);}const _0x12e1e1=[],_0x40171f=new Set(),_0x3e0a72=new Map(),_0x25d9ea=new Map(),_0x3a9f7a=new Set(),_0x47909c=new Map(),_0x122205=new Map(),_0x368c48=createJumpTargetCache();await withProgressSpinner(_0x460eac(0x152)+_0x1f79b1+_0x460eac(0x164),async _0x181a73=>{const _0x51813e=_0x460eac;for(const _0x21e0a3 of _0x216ebe){const _0x3aa7a7=_0x216ebe[_0x51813e(0x120)]>0x1?_0x21e0a3[_0x51813e(0x153)]+'\x20v'+(_0x21e0a3[_0x51813e(0xc1)]||0x1):_0x21e0a3[_0x51813e(0x153)];_0x181a73[_0x51813e(0xe9)](_0x51813e(0x152)+_0x3aa7a7);const _0x5a12f5=await _0x25b027[_0x51813e(0xb2)]['getJourney'](_0x21e0a3['id']),_0x1f1e02=_0x5a12f5[_0x51813e(0x89)]?.['audienceId'],_0x7303a={'resolveSegment':async _0x144b13=>{const _0x3fb0d1=_0x51813e;if(!_0x1f1e02)return{'name':_0x144b13,'isJourneyLocal':![]};const _0x16cb07=_0x3e0a72[_0x3fb0d1(0x13b)](_0x144b13);if(_0x16cb07)return _0x16cb07;try{const _0x37b3ef=await _0x25b027[_0x3fb0d1(0x131)][_0x3fb0d1(0x12a)](_0x1f1e02,_0x144b13),_0xc7e775=_0x37b3ef['kind']===SEGMENT_KIND_JOURNEY;let _0x4437a7,_0x49fcf3=_0x37b3ef[_0x3fb0d1(0xe8)];if(_0xc7e775&&_0x37b3ef[_0x3fb0d1(0x101)]){const _0x104f62=await segmentResponseToDef(_0x37b3ef,{'resolveSegmentName':async _0x54aae4=>{const _0x57794f=_0x3fb0d1,_0x88a49d=_0x3e0a72[_0x57794f(0x13b)](_0x54aae4);if(_0x88a49d)return _0x88a49d['name'];const _0x5def5d=await _0x7303a[_0x57794f(0x147)](_0x54aae4);return _0x5def5d[_0x57794f(0xe8)];}}),_0x400e05=_0x104f62['rule'];_0x4437a7={'description':_0x37b3ef['description'],'rule':_0x400e05};const _0x26774e=serializeRule(_0x400e05),_0x3d2c54=_0x25d9ea[_0x3fb0d1(0x13b)](_0x26774e);if(_0x3d2c54)_0x49fcf3=_0x3d2c54,_0x4437a7=undefined,_0x3b46f1[_0x3fb0d1(0x12c)]&&console[_0x3fb0d1(0xaa)](_0x3fb0d1(0xdd)+_0x37b3ef[_0x3fb0d1(0xe8)]+'\x20->\x20'+_0x3d2c54);else{let _0x2eb8b7=![];if(_0x3cca4b){const _0x49292e=_0x3cca4b[_0x3fb0d1(0x13b)](_0x26774e);if(_0x49292e){const _0x364242=_0x49292e['find'](_0x4d6632=>!_0x40171f[_0x3fb0d1(0x77)](_0x4d6632));_0x364242&&(_0x49fcf3=_0x364242,_0x40171f['add'](_0x364242),_0x25d9ea['set'](_0x26774e,_0x364242),_0x2eb8b7=!![],_0x3b46f1[_0x3fb0d1(0x12c)]&&console['error'](_0x3fb0d1(0xd2)+_0x364242+_0x3fb0d1(0x15c)));}}if(!_0x2eb8b7){const _0x4abc58=generateJourneyLocalName(_0x37b3ef[_0x3fb0d1(0xe8)]);_0x4abc58&&(_0x49fcf3=_0x4abc58);let _0xe09022=_0x49fcf3,_0x2bc544=0x2;while(_0x40171f['has'](_0xe09022)){_0xe09022=_0x49fcf3+'_'+_0x2bc544,_0x2bc544++;}_0x40171f[_0x3fb0d1(0x75)](_0xe09022),_0x25d9ea[_0x3fb0d1(0xc8)](_0x26774e,_0xe09022),_0x49fcf3=_0xe09022;}}}const _0x1a02fc={'name':_0x49fcf3,'isJourneyLocal':_0xc7e775,'definition':_0x4437a7};return _0x3e0a72[_0x3fb0d1(0xc8)](_0x144b13,_0x1a02fc),_0x1a02fc;}catch(_0x20bd93){return _0x8657fb[_0x3fb0d1(0x12c)]&&console[_0x3fb0d1(0xaa)]('Warning:\x20Could\x20not\x20resolve\x20segment\x20'+_0x144b13+':\x20'+_0x20bd93[_0x3fb0d1(0xa4)]),{'name':_0x144b13,'isJourneyLocal':![]};}},'resolveActivation':async _0x1b8e12=>{const _0xec6d0d=_0x51813e,_0x349a31=_0x47909c[_0xec6d0d(0x13b)](_0x1b8e12);if(_0x349a31)return _0x349a31;try{const _0x2d58ae=await _0x25b027['journey']['getActivation'](_0x21e0a3['id'],_0x1b8e12),_0x47906f=journeyActivationStepToYaml(_0x2d58ae,_0x438dcb,_0xcbc904),_0x157b8f=JSON['stringify']({'name':_0x47906f['name'],'connection':_0x47906f[_0xec6d0d(0x91)],'connector_config':_0x47906f[_0xec6d0d(0x8b)]}),_0x38ca99=_0x122205['get'](_0x157b8f);if(_0x38ca99){const _0x43a11d={'name':_0x38ca99,'isJourneyLocal':!![],'definition':_0x47906f};return _0x47909c[_0xec6d0d(0xc8)](_0x1b8e12,_0x43a11d),_0x43a11d;}const _0x2c72e2=_0x2d58ae[_0xec6d0d(0x89)]['activationParams'][_0xec6d0d(0xe8)]||_0x1b8e12,_0x19bd91=sanitizeYamlKey(_0x2c72e2)||_0xec6d0d(0x10b)+_0x1b8e12;let _0x558622=_0x19bd91,_0x25b81b=0x2;while(_0x3a9f7a[_0xec6d0d(0x77)](_0x558622)){_0x558622=_0x19bd91+'_'+_0x25b81b,_0x25b81b++;}_0x3a9f7a[_0xec6d0d(0x75)](_0x558622),_0x122205[_0xec6d0d(0xc8)](_0x157b8f,_0x558622);const _0x4dd87e={'name':_0x558622,'isJourneyLocal':!![],'definition':_0x47906f};return _0x47909c[_0xec6d0d(0xc8)](_0x1b8e12,_0x4dd87e),_0x4dd87e;}catch(_0x1440e7){return _0x8657fb[_0xec6d0d(0x12c)]&&console[_0xec6d0d(0xaa)]('Warning:\x20Could\x20not\x20resolve\x20activation\x20'+_0x1b8e12+':\x20'+_0x1440e7[_0xec6d0d(0xa4)]),{'name':_0x1b8e12,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x2ca48a,_0x491507)=>{const _0x5787a4=_0x51813e;return resolveJumpTarget(_0x2ca48a,_0x491507,_0x368c48,_0x15958d=>_0x25b027['journey'][_0x5787a4(0x146)](_0x15958d));}},_0x20f064=await journeyResponseToDef(_0x5a12f5,_0x7303a);_0x12e1e1[_0x51813e(0xcc)]({'item':_0x21e0a3,'yaml':_0x20f064});}},{'verbose':_0x8657fb[_0x460eac(0x12c)]});const _0x16bd3c=await _0x25b027['journey']['getLatestJourneyId'](_0x216ebe[0x0][_0x460eac(0x123)]),_0x1ce367=buildMergedJourneyDef(_0x12e1e1,_0x3cca4b,_0x16bd3c),_0x3e5ef8=normalizeJourneyDef(_0x1ce367,_0x4300c5),_0x56c442=toYamlString(_0x3e5ef8),_0x191912=_0x497127||a22_0x373cff[_0x460eac(0x11e)](_0x16a085,sanitizeFileName(_0x1f79b1)+_0x460eac(0xe3));!_0x497127&&_0x3911ea&&!existsSync(_0x16a085)&&mkdirSync(_0x16a085,{'recursive':!![]});const _0x42c149=a22_0x373cff['relative'](process[_0x460eac(0x175)](),_0x191912);if(existsSync(_0x191912)){const _0x116a10=readFileSync(_0x191912,_0x460eac(0x108)),_0x508c8d=generateDiff(_0x116a10,_0x56c442),_0x3640c0=hasChanges(_0x508c8d);_0x1cc049['push']({'relativePath':_0x42c149,'absolutePath':_0x191912,'content':_0x56c442,'isNew':![],'hasChanges':_0x3640c0,'diff':_0x3640c0?formatDiffWithColors(_0x508c8d):undefined});}else _0x1cc049[_0x460eac(0xcc)]({'relativePath':_0x42c149,'absolutePath':_0x191912,'content':_0x56c442,'isNew':!![],'hasChanges':![]});}const _0x50dadd=_0x1cc049[_0x460eac(0x127)](_0x1041b3=>_0x1041b3['isNew']),_0x4c2faf=_0x1cc049[_0x460eac(0x127)](_0x4ee2b0=>!_0x4ee2b0[_0x460eac(0xe0)]&&_0x4ee2b0['hasChanges']),_0x419973=_0x1cc049[_0x460eac(0x127)](_0x3e7c5c=>!_0x3e7c5c[_0x460eac(0xe0)]&&!_0x3e7c5c[_0x460eac(0xd8)]),_0x72693a=_0x4271bf[_0x460eac(0x120)],_0x99ff7f=_0x3c959e[_0x460eac(0xa1)],_0xf65c2f=_0x72693a>_0x99ff7f?'\x20('+_0x72693a+_0x460eac(0xf5):'';console[_0x460eac(0xaa)](_0x460eac(0xd9)),console[_0x460eac(0xaa)]('\x20\x20'+a22_0x117952[_0x460eac(0xd0)](_0x99ff7f+'\x20journeys')+a22_0x117952[_0x460eac(0x100)](_0xf65c2f)),console['error']('\x20\x20'+a22_0x117952[_0x460eac(0xe2)]('+\x20'+_0x50dadd[_0x460eac(0x120)]+_0x460eac(0xc4))),console[_0x460eac(0xaa)]('\x20\x20'+a22_0x117952[_0x460eac(0x166)]('~\x20'+_0x4c2faf[_0x460eac(0x120)]+'\x20changed\x20files')),console[_0x460eac(0xaa)]('\x20\x20'+a22_0x117952[_0x460eac(0x100)]('=\x20'+_0x419973[_0x460eac(0x120)]+'\x20unchanged\x20files')),console['error']('\x20\x20Target:\x20'+a22_0x117952[_0x460eac(0xd0)](_0x592a5b)+'\x0a');if(_0x4c2faf['length']>0x0)for(const _0x242297 of _0x4c2faf){console[_0x460eac(0xaa)](_0x460eac(0xca)+_0x242297[_0x460eac(0x159)]+'\x27:'),console[_0x460eac(0xaa)]('─'[_0x460eac(0x16d)](0x3c)),console[_0x460eac(0xaa)](_0x242297[_0x460eac(0x118)]),console[_0x460eac(0xaa)]('─'['repeat'](0x3c));}if(_0x3b46f1[_0x460eac(0x124)])return console[_0x460eac(0xaa)](a22_0x117952[_0x460eac(0x166)](_0x460eac(0x161))),0x0;if(_0x50dadd[_0x460eac(0x120)]===0x0&&_0x4c2faf[_0x460eac(0x120)]===0x0)return console['error'](a22_0x117952[_0x460eac(0xe2)]('βœ”\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x4a798d},_0x3b46f1[_0x460eac(0xe1)]),console[_0x460eac(0xaa)](a22_0x117952['green'](_0x460eac(0x16a)+a22_0x117952['dim'](_0x460eac(0x90))+_0x460eac(0xb9)+a22_0x117952['cyan'](_0x4a798d))),0x0;if(!_0x3b46f1[_0x460eac(0x139)]&&(_0x50dadd[_0x460eac(0x120)]>0x0||_0x4c2faf[_0x460eac(0x120)]>0x0)){if(!isInteractive())return console[_0x460eac(0xaa)](a22_0x117952[_0x460eac(0x134)](_0x460eac(0xba)),_0x460eac(0x110)),console[_0x460eac(0xaa)](a22_0x117952[_0x460eac(0x100)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x4571fb=await confirmKey(_0x460eac(0x84)+(_0x50dadd[_0x460eac(0x120)]+_0x4c2faf['length'])+_0x460eac(0x82));if(!_0x4571fb)return console['error'](a22_0x117952[_0x460eac(0x166)](_0x460eac(0xb7)),_0x460eac(0x96)),0x1;}!existsSync(_0x592a5b)&&mkdirSync(_0x592a5b,{'recursive':!![]});const _0x27cb04=a22_0x373cff[_0x460eac(0x11e)](_0x592a5b,_0x460eac(0xbe));writeFileSync(_0x27cb04,createTdxConfigContent(_0x4a798d),'utf-8');for(const _0x1447d8 of _0x1cc049){(_0x1447d8[_0x460eac(0xe0)]||_0x1447d8['hasChanges'])&&writeFileSync(_0x1447d8[_0x460eac(0xcb)],_0x1447d8[_0x460eac(0x76)],_0x460eac(0x108));}return console[_0x460eac(0xaa)](a22_0x117952[_0x460eac(0xe2)](_0x460eac(0xf1)+(_0x50dadd['length']+_0x4c2faf[_0x460eac(0x120)])+'\x20journey\x20files\x20to\x20'+_0x592a5b)),saveSessionContext({'parent_segment':_0x4a798d},_0x3b46f1[_0x460eac(0xe1)]),console[_0x460eac(0xaa)](a22_0x117952[_0x460eac(0xe2)](_0x460eac(0x16a)+a22_0x117952['dim'](_0x460eac(0x90))+_0x460eac(0xb9)+a22_0x117952[_0x460eac(0xd0)](_0x4a798d))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{['name']=a22_0x5e4339(0xa6);[a22_0x5e4339(0xc9)]=a22_0x5e4339(0x129);async[a22_0x5e4339(0xe4)](_0x1bda8d){const _0x3180ba=a22_0x5e4339,{options:_0x24cc69,args:_0x5c16a0,tdx:_0xff241d}=_0x1bda8d,_0x172c97=_0x5c16a0[0x0];if(!requireNameOrPath(_0x172c97))return 0x1;_0x24cc69['verbose']&&console['error'](_0x3180ba(0xdc)+_0x172c97);const {journeyId:_0x546282}=await resolveJourneyIdFromInput(_0x172c97,_0x24cc69,_0xff241d),_0x33468d=await withSpinner(_0x3180ba(0xc3),()=>_0xff241d[_0x3180ba(0xb2)]['getColumnMapping'](_0x546282),{'verbose':_0x24cc69[_0x3180ba(0x12c)]}),_0x4ce165=_0x33468d[_0x3180ba(0x11f)];return console['log']('Database:\x20'+_0x4ce165[_0x3180ba(0x9a)]),console[_0x3180ba(0x80)](_0x3180ba(0xa2)+_0x4ce165['table']),await handleSDKOutput(_0x4ce165['columns'],_0x24cc69),0x0;}}export class JourneyActivationsCommand extends BaseCommand{['name']=a22_0x5e4339(0xee);[a22_0x5e4339(0xc9)]='List\x20activations\x20for\x20a\x20journey';async[a22_0x5e4339(0xe4)](_0x2fe633){const _0x19221e=a22_0x5e4339,{options:_0x129f94,args:_0x462c86,tdx:_0x293735}=_0x2fe633,_0x9e6bff=_0x462c86[0x0];if(!requireNameOrPath(_0x9e6bff))return 0x1;_0x129f94[_0x19221e(0x12c)]&&console[_0x19221e(0xaa)]('Input:\x20'+_0x9e6bff);const {journeyId:_0x7dddd}=await resolveJourneyIdFromInput(_0x9e6bff,_0x129f94,_0x293735),_0x588781=await withSpinner('Listing\x20journey\x20activations...',()=>_0x293735['journey'][_0x19221e(0x9e)](_0x7dddd),{'verbose':_0x129f94['verbose']}),_0x8fbef9=_0x588781[_0x19221e(0x11f)];return console['error'](_0x19221e(0x114)+_0x8fbef9[_0x19221e(0x120)]+'\x20activation'+(_0x8fbef9[_0x19221e(0x120)]!==0x1?'s':'')),await handleSDKOutput(_0x8fbef9,_0x129f94),0x0;}}export class JourneyPushCommand extends BaseCommand{[a22_0x5e4339(0xe8)]=a22_0x5e4339(0x7d);['description']=a22_0x5e4339(0xdf);[a22_0x5e4339(0x14d)]=new SegmentPushCommand();async[a22_0x5e4339(0xe4)](_0x2cc92b){const _0x99543c=a22_0x5e4339,_0x3c2986=_0x2cc92b[_0x99543c(0xfe)][0x0];let _0x2d1044;if(_0x3c2986){const _0x3c6ed1=await resolveTarget({'arg':_0x3c2986,'contextParent':_0x2cc92b[_0x99543c(0x149)][_0x99543c(0xc5)],'cwd':process[_0x99543c(0x175)]()});isSuccessfulResolution(_0x3c6ed1)&&_0x3c6ed1[_0x99543c(0x115)]===_0x99543c(0xc7)&&(_0x2d1044=_0x3c6ed1[_0x99543c(0x15a)]);}const _0x2fbf70={..._0x2cc92b,'options':{..._0x2cc92b[_0x99543c(0x149)],'journeysOnly':!![],..._0x2d1044&&{'singleFilePath':_0x2d1044}}};return this[_0x99543c(0x14d)][_0x99543c(0xe4)](_0x2fbf70);}}export class JourneyVersionsCommand extends BaseCommand{['name']='journey:versions';[a22_0x5e4339(0xc9)]=a22_0x5e4339(0x98);async['execute'](_0x54fb97){const _0x9b9b34=a22_0x5e4339,{options:_0x5e4252,args:_0x3e26ce,tdx:_0x3df65b}=_0x54fb97,_0x230e07=_0x3e26ce[0x0];if(!requireNameOrPath(_0x230e07))return 0x1;if(_0x5e4252[_0x9b9b34(0x12c)])console[_0x9b9b34(0xaa)](_0x9b9b34(0xdc)+_0x230e07);const {journeyId:_0x57c956}=await resolveJourneyIdFromInput(_0x230e07,_0x5e4252,_0x3df65b),_0x48eed7=await withSpinner(_0x9b9b34(0xf8),()=>_0x3df65b['journey'][_0x9b9b34(0xa7)](_0x57c956),{'verbose':_0x5e4252[_0x9b9b34(0x12c)]}),{bundleName:_0x28f89d,versions:_0x2aa45e,latestJourneyId:_0x23d569}=_0x48eed7[_0x9b9b34(0x11f)];console[_0x9b9b34(0xaa)](_0x28f89d+':\x20'+_0x2aa45e[_0x9b9b34(0x120)]+_0x9b9b34(0x11c)+(_0x2aa45e['length']!==0x1?'s':''));const _0x396fe0=_0x2aa45e[_0x9b9b34(0xef)](_0x47bf56=>({'version':_0x47bf56[_0x9b9b34(0xc1)],'journey_id':_0x47bf56['journeyId'],'name':_0x47bf56[_0x9b9b34(0xe8)],'state':_0x47bf56[_0x9b9b34(0x74)],'paused':_0x47bf56[_0x9b9b34(0x169)],'latest':_0x47bf56[_0x9b9b34(0xf3)]===_0x23d569,'created_at':_0x47bf56[_0x9b9b34(0x12e)]}));return await handleSDKOutput(_0x396fe0,_0x5e4252),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{['name']=a22_0x5e4339(0xf9);[a22_0x5e4339(0xc9)]=a22_0x5e4339(0xc0);async[a22_0x5e4339(0xe4)](_0x1a78a0){const _0x404180=a22_0x5e4339,{options:_0xd9bc15,args:_0x184a3f,tdx:_0x331b47}=_0x1a78a0,_0x514245=_0x184a3f[0x0];if(!requireNameOrPath(_0x514245))return 0x1;if(_0xd9bc15['verbose'])console['error'](_0x404180(0xdc)+_0x514245);const {journeyId:_0x554330,journeyName:_0xc2ab9f}=await resolveJourneyIdFromInput(_0x514245,_0xd9bc15,_0x331b47);if(!_0xd9bc15['yes']){const _0x194cac=await confirm(_0x404180(0x111)+_0xc2ab9f+'\x22?');if(!_0x194cac)return console['error']('Cancelled'),0x0;}const _0x2b36f4=await withSpinner('Creating\x20new\x20version...',()=>_0x331b47[_0x404180(0xb2)]['createVersion'](_0x554330),{'verbose':_0xd9bc15[_0x404180(0x12c)]}),_0x4e09e4=_0x2b36f4['data'];return console['error'](a22_0x117952[_0x404180(0xe2)]('βœ”')+_0x404180(0xfb)+_0x4e09e4[_0x404180(0x89)][_0x404180(0xc1)]+_0x404180(0x7e)+_0x4e09e4[_0x404180(0x89)][_0x404180(0xe8)]+'\x22'),console[_0x404180(0xaa)](_0x404180(0xfc)+_0x4e09e4['id']),await handleSingleObjectOutput({'id':_0x4e09e4['id'],'name':_0x4e09e4['attributes'][_0x404180(0xe8)],'version':_0x4e09e4[_0x404180(0x89)][_0x404180(0xc1)],'state':_0x4e09e4[_0x404180(0x89)][_0x404180(0x74)],'bundle_id':_0x4e09e4[_0x404180(0x89)][_0x404180(0x123)],'created_at':_0x4e09e4[_0x404180(0x89)][_0x404180(0x12e)]},_0xd9bc15),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{['name']=a22_0x5e4339(0x92);['description']=a22_0x5e4339(0x15d);async[a22_0x5e4339(0xe4)](_0x106f8d){const _0x26ecbe=a22_0x5e4339,{options:_0x2db321,args:_0x30d871,tdx:_0x20c649}=_0x106f8d,_0x21caf8=_0x30d871[0x0];if(!requireNameOrPath(_0x21caf8))return 0x1;const _0x388be6=_0x2db321[_0x26ecbe(0xaf)];if(!_0x388be6)return console[_0x26ecbe(0xaa)](_0x26ecbe(0x7b)),console[_0x26ecbe(0xaa)](_0x26ecbe(0xe7)),0x1;const _0x1155a0=parseInt(_0x388be6,0xa);if(isNaN(_0x1155a0)||_0x1155a0<0x1)return console['error']('Error:\x20Invalid\x20version\x20number:\x20'+_0x388be6),0x1;if(_0x2db321[_0x26ecbe(0x12c)])console[_0x26ecbe(0xaa)](_0x26ecbe(0xdc)+_0x21caf8+_0x26ecbe(0x13e)+_0x1155a0);const {journeyId:_0x321e60,parentSegmentId:_0xc18c51}=await resolveJourneyIdFromInput(_0x21caf8,_0x2db321,_0x20c649),_0x10a978=await withSpinner(_0x26ecbe(0x11b),()=>_0x20c649[_0x26ecbe(0xb2)][_0x26ecbe(0xa7)](_0x321e60),{'verbose':_0x2db321['verbose']}),{versions:_0x311729,latestJourneyId:_0x269592}=_0x10a978[_0x26ecbe(0x11f)],_0x2afded=_0x311729[_0x26ecbe(0x8f)](_0x5aea2e=>_0x5aea2e[_0x26ecbe(0xc1)]===_0x1155a0);if(!_0x2afded){const _0x65d3ba=_0x311729[_0x26ecbe(0xef)](_0xefee8a=>'v'+_0xefee8a[_0x26ecbe(0xc1)])[_0x26ecbe(0x11e)](',\x20');return console[_0x26ecbe(0xaa)](_0x26ecbe(0x88)+_0x1155a0+'\x20not\x20found.\x20Available:\x20'+_0x65d3ba),0x1;}const _0x3b6164=await withSpinner(_0x26ecbe(0x128)+_0x1155a0+_0x26ecbe(0xce),()=>_0x20c649[_0x26ecbe(0xb2)][_0x26ecbe(0x146)](_0x2afded[_0x26ecbe(0xf3)]),{'verbose':_0x2db321['verbose']}),_0x165bba=_0x3b6164[_0x26ecbe(0x11f)],_0x54839c=getConsoleNextUrl(_0x2db321['site'],'/app/ps/'+_0xc18c51+_0x26ecbe(0xd5)+_0x2afded[_0x26ecbe(0xf3)]+_0x26ecbe(0x174));return await handleSingleObjectOutput({'id':_0x165bba['id'],'name':_0x165bba['attributes'][_0x26ecbe(0xe8)],'version':_0x165bba[_0x26ecbe(0x89)][_0x26ecbe(0xc1)],'description':_0x165bba[_0x26ecbe(0x89)]['description'],'state':_0x165bba[_0x26ecbe(0x89)][_0x26ecbe(0x74)],'paused':_0x165bba[_0x26ecbe(0x89)][_0x26ecbe(0x169)],'reentry_mode':_0x165bba[_0x26ecbe(0x89)][_0x26ecbe(0x8a)],'stages':_0x165bba[_0x26ecbe(0x89)]['journeyStages']?.[_0x26ecbe(0x120)]||0x0,..._0x165bba[_0x26ecbe(0x89)][_0x26ecbe(0x171)]&&{'goal':_0x165bba[_0x26ecbe(0x89)][_0x26ecbe(0x171)]['name']},'latest':_0x2afded['journeyId']===_0x269592,'created_at':_0x165bba[_0x26ecbe(0x89)]['createdAt'],'updated_at':_0x165bba[_0x26ecbe(0x89)][_0x26ecbe(0xbc)],'url':_0x54839c},_0x2db321),0x0;}}