@treasuredata/tdx 0.11.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/context-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-command.js +1 -1
  21. package/dist/commands/job-command.js +1 -1
  22. package/dist/commands/journey-command.js +1 -1
  23. package/dist/commands/journey-validate-command.js +1 -1
  24. package/dist/commands/llm-command.js +1 -1
  25. package/dist/commands/llm-proxy.js +1 -1
  26. package/dist/commands/parent-segment-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/tables.js +1 -1
  40. package/dist/commands/use-command.js +1 -1
  41. package/dist/commands/user-command.js +1 -1
  42. package/dist/commands/workflow-command.d.ts +39 -5
  43. package/dist/commands/workflow-command.d.ts.map +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/commands/workflow-command.js.map +1 -1
  46. package/dist/core/auth.d.ts +2 -4
  47. package/dist/core/auth.d.ts.map +1 -1
  48. package/dist/core/auth.js +1 -1
  49. package/dist/core/auth.js.map +1 -1
  50. package/dist/core/command-output.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/connection-cache.js +1 -1
  53. package/dist/core/constants.js +1 -1
  54. package/dist/core/credential-cache.js +1 -1
  55. package/dist/core/global-context.d.ts.map +1 -1
  56. package/dist/core/global-context.js +1 -1
  57. package/dist/core/global-context.js.map +1 -1
  58. package/dist/core/keychain.js +1 -1
  59. package/dist/core/profile.d.ts +2 -1
  60. package/dist/core/profile.d.ts.map +1 -1
  61. package/dist/core/profile.js +1 -1
  62. package/dist/core/profile.js.map +1 -1
  63. package/dist/core/project-config.js +1 -1
  64. package/dist/core/session.js +1 -1
  65. package/dist/core/user-cache.js +1 -1
  66. package/dist/core/version.d.ts +45 -0
  67. package/dist/core/version.d.ts.map +1 -0
  68. package/dist/core/version.js +1 -0
  69. package/dist/core/version.js.map +1 -0
  70. package/dist/index.js +1 -1
  71. package/dist/proxy/anthropic-adapter.js +1 -1
  72. package/dist/proxy/claude-usage-tracker.js +1 -1
  73. package/dist/proxy/context-signature.js +1 -1
  74. package/dist/proxy/conversation-utils.js +1 -1
  75. package/dist/proxy/server.js +1 -1
  76. package/dist/proxy/session-cache.js +1 -1
  77. package/dist/sdk/agent/agent-config.js +1 -1
  78. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  79. package/dist/sdk/agent/agent-yaml.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/endpoints.d.ts +8 -0
  83. package/dist/sdk/client/endpoints.d.ts.map +1 -1
  84. package/dist/sdk/client/endpoints.js +1 -1
  85. package/dist/sdk/client/endpoints.js.map +1 -1
  86. package/dist/sdk/client/engage-api-client.js +1 -1
  87. package/dist/sdk/client/http-client.js +1 -1
  88. package/dist/sdk/client/llm-api-client.js +1 -1
  89. package/dist/sdk/client/rate-limiter.js +1 -1
  90. package/dist/sdk/client/td-api-client.js +1 -1
  91. package/dist/sdk/client/trino-api-client.js +1 -1
  92. package/dist/sdk/client/workflow-client.js +1 -1
  93. package/dist/sdk/connection-validator.js +1 -1
  94. package/dist/sdk/connection.js +1 -1
  95. package/dist/sdk/engage.js +1 -1
  96. package/dist/sdk/errors.d.ts +2 -0
  97. package/dist/sdk/errors.d.ts.map +1 -1
  98. package/dist/sdk/errors.js +1 -1
  99. package/dist/sdk/errors.js.map +1 -1
  100. package/dist/sdk/index.js +1 -1
  101. package/dist/sdk/io/index.js +1 -1
  102. package/dist/sdk/io/node-filesystem.js +1 -1
  103. package/dist/sdk/job.js +1 -1
  104. package/dist/sdk/journey.js +1 -1
  105. package/dist/sdk/llm/chat-cache.js +1 -1
  106. package/dist/sdk/llm/index.js +1 -1
  107. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  108. package/dist/sdk/llm/model-aliases.js +1 -1
  109. package/dist/sdk/llm/model-factors.js +1 -1
  110. package/dist/sdk/query/index.js +1 -1
  111. package/dist/sdk/query/sql-parser.js +1 -1
  112. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  113. package/dist/sdk/segment/fields-display.js +1 -1
  114. package/dist/sdk/segment/file-discovery.js +1 -1
  115. package/dist/sdk/segment/journey-utils.js +1 -1
  116. package/dist/sdk/segment/journey-yaml.js +1 -1
  117. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  118. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  119. package/dist/sdk/segment/pull-workflow.js +1 -1
  120. package/dist/sdk/segment/push-workflow.js +1 -1
  121. package/dist/sdk/segment/resolution-context.js +1 -1
  122. package/dist/sdk/segment/segment-path-parser.js +1 -1
  123. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  124. package/dist/sdk/segment/target-resolution.js +1 -1
  125. package/dist/sdk/segment/tdx-config.js +1 -1
  126. package/dist/sdk/segment/validate-files.js +1 -1
  127. package/dist/sdk/segment/yaml-validator.js +1 -1
  128. package/dist/sdk/segment.js +1 -1
  129. package/dist/sdk/types/index.js +1 -1
  130. package/dist/sdk/types/progress.js +1 -1
  131. package/dist/sdk/user.js +1 -1
  132. package/dist/sdk/util/format-detector.js +1 -1
  133. package/dist/sdk/util/formatters.js +1 -1
  134. package/dist/sdk/util/index.js +1 -1
  135. package/dist/sdk/util/tree-formatter.js +1 -1
  136. package/dist/sdk/workflow/clone-workflow.d.ts +80 -0
  137. package/dist/sdk/workflow/clone-workflow.d.ts.map +1 -0
  138. package/dist/sdk/workflow/clone-workflow.js +1 -0
  139. package/dist/sdk/workflow/clone-workflow.js.map +1 -0
  140. package/dist/sdk/workflow/index.d.ts +94 -0
  141. package/dist/sdk/workflow/index.d.ts.map +1 -1
  142. package/dist/sdk/workflow/index.js +1 -1
  143. package/dist/sdk/workflow/index.js.map +1 -1
  144. package/dist/sdk/workflow/pull-workflow.d.ts +77 -0
  145. package/dist/sdk/workflow/pull-workflow.d.ts.map +1 -0
  146. package/dist/sdk/workflow/pull-workflow.js +1 -0
  147. package/dist/sdk/workflow/pull-workflow.js.map +1 -0
  148. package/dist/sdk/workflow/push-workflow.d.ts +66 -0
  149. package/dist/sdk/workflow/push-workflow.d.ts.map +1 -0
  150. package/dist/sdk/workflow/push-workflow.js +1 -0
  151. package/dist/sdk/workflow/push-workflow.js.map +1 -0
  152. package/dist/sdk/workflow/tdx-config.d.ts +110 -0
  153. package/dist/sdk/workflow/tdx-config.d.ts.map +1 -0
  154. package/dist/sdk/workflow/tdx-config.js +1 -0
  155. package/dist/sdk/workflow/tdx-config.js.map +1 -0
  156. package/dist/sdk/workflow/workflow-utils.d.ts +10 -7
  157. package/dist/sdk/workflow/workflow-utils.d.ts.map +1 -1
  158. package/dist/sdk/workflow/workflow-utils.js +1 -1
  159. package/dist/sdk/workflow/workflow-utils.js.map +1 -1
  160. package/dist/utils/async.js +1 -1
  161. package/dist/utils/colors.js +1 -1
  162. package/dist/utils/diff.js +1 -1
  163. package/dist/utils/file-permissions.js +1 -1
  164. package/dist/utils/json-loader.js +1 -1
  165. package/dist/utils/option-validation.js +1 -1
  166. package/dist/utils/port.js +1 -1
  167. package/dist/utils/process.js +1 -1
  168. package/dist/utils/prompt.js +1 -1
  169. package/dist/utils/spinner.js +1 -1
  170. package/dist/utils/sse-parser.js +1 -1
  171. package/dist/utils/string-utils.js +1 -1
  172. package/dist/utils/table-ref-parser.js +1 -1
  173. package/dist/utils/tdx-logger.js +1 -1
  174. package/dist/utils/version-check.js +1 -1
  175. package/package.json +1 -1
@@ -1 +1 @@
1
- const a15_0x3b6605=a15_0x2875;(function(_0x2ca161,_0x2143f3){const _0x128f84=a15_0x2875,_0x58b998=_0x2ca161();while(!![]){try{const _0x3282d6=-parseInt(_0x128f84(0x7f))/0x1+-parseInt(_0x128f84(0x76))/0x2*(parseInt(_0x128f84(0x80))/0x3)+parseInt(_0x128f84(0x82))/0x4+parseInt(_0x128f84(0x70))/0x5*(parseInt(_0x128f84(0x67))/0x6)+parseInt(_0x128f84(0x89))/0x7+-parseInt(_0x128f84(0x88))/0x8*(-parseInt(_0x128f84(0x86))/0x9)+parseInt(_0x128f84(0x68))/0xa;if(_0x3282d6===_0x2143f3)break;else _0x58b998['push'](_0x58b998['shift']());}catch(_0x4975f4){_0x58b998['push'](_0x58b998['shift']());}}}(a15_0x2b43,0x53dc7));import{BaseCommand}from'./command.js';function a15_0x2875(_0x3d1af2,_0x4b2942){_0x3d1af2=_0x3d1af2-0x66;const _0x2b4375=a15_0x2b43();let _0x28754c=_0x2b4375[_0x3d1af2];return _0x28754c;}import{SDKError}from'../sdk/index.js';function a15_0x2b43(){const _0x7dfd07=['10hvMNWC','Describe\x20table\x20schema','Table\x20\x27','cause','name','Error:\x20','912196NPFJVR','data','Usage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','site','table','\x27\x20does\x20not\x20exist','verbose','error','length','631846QJFLYU','3JlzMUz','validate','359316hbDKuX','Describing\x20table\x20','...','database','1015407MNJyMw','description','48ydWMxd','1113140noXJeb','execute','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','\x20\x20Cause:\x20','431310leocPN','3618820tzHVwh','✔\x20Found\x20','✖\x20Table\x20not\x20found','\x20in\x20','describeTable','args','message','Database:\x20'];a15_0x2b43=function(){return _0x7dfd07;};return a15_0x2b43();}import{handleSDKOutput}from'../core/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a15_0x3b6605(0x74)]='describe';[a15_0x3b6605(0x87)]=a15_0x3b6605(0x71);async[a15_0x3b6605(0x8a)](_0x531ba6){return this['describeTable'](_0x531ba6);}async['describeTable'](_0x3faeb9){const _0x184a6f=a15_0x3b6605,{options:_0x10abc3,args:_0xadddd3,tdx:_0x41c183}=_0x3faeb9;let _0x201f00;try{_0x201f00=parseTableReference(_0xadddd3[0x0]);const _0x31c7c6=_0x10abc3[_0x184a6f(0x85)];!_0x201f00[_0x184a6f(0x85)]&&_0x31c7c6&&(_0x201f00['database']=_0x31c7c6);const _0x13bad4=validateTableDescribeReference(_0x201f00);if(_0x13bad4)return console[_0x184a6f(0x7d)](_0x184a6f(0x75)+_0x13bad4),0x1;}catch(_0x2f04c6){return console['error'](_0x184a6f(0x75)+_0x2f04c6[_0x184a6f(0x6e)]),0x1;}const _0x165a5a=_0x201f00['database'],_0xb4b7ca=_0x201f00[_0x184a6f(0x7a)];try{_0x10abc3[_0x184a6f(0x7c)]&&(console[_0x184a6f(0x7d)]('Site:\x20'+_0x10abc3[_0x184a6f(0x79)]),console[_0x184a6f(0x7d)](_0x184a6f(0x6f)+_0x165a5a),console[_0x184a6f(0x7d)]('Table:\x20'+_0xb4b7ca));const _0x379700=await withSpinner(_0x184a6f(0x83)+_0x165a5a+'.'+_0xb4b7ca+_0x184a6f(0x84),()=>_0x41c183['query'][_0x184a6f(0x6c)](_0x165a5a,_0xb4b7ca),{'verbose':_0x10abc3[_0x184a6f(0x7c)]}),_0x46d052=_0x379700[_0x184a6f(0x77)];if(_0x46d052['length']===0x0)return console[_0x184a6f(0x7d)](_0x184a6f(0x6a)),console[_0x184a6f(0x7d)](_0x184a6f(0x72)+_0x165a5a+'.'+_0xb4b7ca+_0x184a6f(0x7b)),0x1;return console[_0x184a6f(0x7d)](_0x184a6f(0x69)+_0x46d052[_0x184a6f(0x7e)]+'\x20column'+(_0x46d052[_0x184a6f(0x7e)]!==0x1?'s':'')+_0x184a6f(0x6b)+_0x165a5a+'.'+_0xb4b7ca),await handleSDKOutput(_0x46d052,_0x10abc3),0x0;}catch(_0x3fc3e9){if(_0x3fc3e9 instanceof SDKError)return console['error'](_0x184a6f(0x75)+_0x3fc3e9['message']),_0x3fc3e9[_0x184a6f(0x73)]&&console[_0x184a6f(0x7d)](_0x184a6f(0x66)+_0x3fc3e9[_0x184a6f(0x73)]),0x1;throw _0x3fc3e9;}}[a15_0x3b6605(0x81)](_0x4cad39){const _0x54f7d0=a15_0x3b6605;if(_0x4cad39[_0x54f7d0(0x6d)][_0x54f7d0(0x7e)]===0x0)return _0x54f7d0(0x78);if(_0x4cad39[_0x54f7d0(0x6d)]['length']>0x1)return _0x54f7d0(0x8b);return undefined;}}
1
+ const a15_0x265c39=a15_0x3a6b;(function(_0x4d2705,_0x1b9605){const _0x98e27=a15_0x3a6b,_0x7678fa=_0x4d2705();while(!![]){try{const _0x4e9646=-parseInt(_0x98e27(0x18c))/0x1+parseInt(_0x98e27(0x187))/0x2+parseInt(_0x98e27(0x185))/0x3+-parseInt(_0x98e27(0x189))/0x4+-parseInt(_0x98e27(0x180))/0x5+parseInt(_0x98e27(0x176))/0x6+-parseInt(_0x98e27(0x172))/0x7;if(_0x4e9646===_0x1b9605)break;else _0x7678fa['push'](_0x7678fa['shift']());}catch(_0x532d25){_0x7678fa['push'](_0x7678fa['shift']());}}}(a15_0x2584,0x919f0));function a15_0x2584(){const _0x4c764c=['cause','verbose','Describing\x20table\x20','2482101UybUMV','error','1915928pRDUms','describe','3899496TOMMdI','database','\x20\x20Cause:\x20','505251WvkPHc','message','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','Table:\x20','Usage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','name','110439ieAYFX','...','query','Error:\x20','4461102gyuNjd','describeTable','\x27\x20does\x20not\x20exist','args','data','execute','validate','\x20in\x20','Table\x20\x27','length','2182410yqXebi','Describe\x20table\x20schema'];a15_0x2584=function(){return _0x4c764c;};return a15_0x2584();}import{BaseCommand}from'./command.js';function a15_0x3a6b(_0x197f65,_0x331c61){_0x197f65=_0x197f65-0x170;const _0x2584aa=a15_0x2584();let _0x3a6b0b=_0x2584aa[_0x197f65];return _0x3a6b0b;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a15_0x265c39(0x171)]=a15_0x265c39(0x188);['description']=a15_0x265c39(0x181);async[a15_0x265c39(0x17b)](_0x53c37c){const _0x423aa1=a15_0x265c39;return this[_0x423aa1(0x177)](_0x53c37c);}async[a15_0x265c39(0x177)](_0x1209f9){const _0x31a2ca=a15_0x265c39,{options:_0x48a576,args:_0x2f161d,tdx:_0x39d0c2}=_0x1209f9;let _0x114fa0;try{_0x114fa0=parseTableReference(_0x2f161d[0x0]);const _0x1cfc34=_0x48a576[_0x31a2ca(0x18a)];!_0x114fa0['database']&&_0x1cfc34&&(_0x114fa0['database']=_0x1cfc34);const _0x282b16=validateTableDescribeReference(_0x114fa0);if(_0x282b16)return console['error'](_0x31a2ca(0x175)+_0x282b16),0x1;}catch(_0x2c8fe0){return console[_0x31a2ca(0x186)](_0x31a2ca(0x175)+_0x2c8fe0[_0x31a2ca(0x18d)]),0x1;}const _0xaa63ba=_0x114fa0[_0x31a2ca(0x18a)],_0x398871=_0x114fa0['table'];try{_0x48a576['verbose']&&(console['error']('Site:\x20'+_0x48a576['site']),console[_0x31a2ca(0x186)]('Database:\x20'+_0xaa63ba),console[_0x31a2ca(0x186)](_0x31a2ca(0x18f)+_0x398871));const _0x4eb2f0=await withSpinner(_0x31a2ca(0x184)+_0xaa63ba+'.'+_0x398871+_0x31a2ca(0x173),()=>_0x39d0c2[_0x31a2ca(0x174)][_0x31a2ca(0x177)](_0xaa63ba,_0x398871),{'verbose':_0x48a576[_0x31a2ca(0x183)]}),_0x44dc2d=_0x4eb2f0[_0x31a2ca(0x17a)];if(_0x44dc2d[_0x31a2ca(0x17f)]===0x0)return console['error']('✖\x20Table\x20not\x20found'),console[_0x31a2ca(0x186)](_0x31a2ca(0x17e)+_0xaa63ba+'.'+_0x398871+_0x31a2ca(0x178)),0x1;return console['error']('✔\x20Found\x20'+_0x44dc2d[_0x31a2ca(0x17f)]+'\x20column'+(_0x44dc2d['length']!==0x1?'s':'')+_0x31a2ca(0x17d)+_0xaa63ba+'.'+_0x398871),await handleSDKOutput(_0x44dc2d,_0x48a576),0x0;}catch(_0x106922){if(_0x106922 instanceof SDKError)return console[_0x31a2ca(0x186)](_0x31a2ca(0x175)+_0x106922[_0x31a2ca(0x18d)]),_0x106922[_0x31a2ca(0x182)]&&console[_0x31a2ca(0x186)](_0x31a2ca(0x18b)+_0x106922[_0x31a2ca(0x182)]),0x1;throw _0x106922;}}[a15_0x265c39(0x17c)](_0x245f19){const _0x569d1f=a15_0x265c39;if(_0x245f19[_0x569d1f(0x179)]['length']===0x0)return _0x569d1f(0x170);if(_0x245f19[_0x569d1f(0x179)][_0x569d1f(0x17f)]>0x1)return _0x569d1f(0x18e);return undefined;}}
@@ -1 +1 @@
1
- const a16_0x12ae71=a16_0x2d19;(function(_0x170820,_0x3490ca){const _0x12fa28=a16_0x2d19,_0x35d13a=_0x170820();while(!![]){try{const _0x509982=parseInt(_0x12fa28(0x11f))/0x1+-parseInt(_0x12fa28(0x12b))/0x2*(-parseInt(_0x12fa28(0x116))/0x3)+-parseInt(_0x12fa28(0xc0))/0x4*(parseInt(_0x12fa28(0x129))/0x5)+-parseInt(_0x12fa28(0x139))/0x6+parseInt(_0x12fa28(0x11b))/0x7+parseInt(_0x12fa28(0x13d))/0x8*(parseInt(_0x12fa28(0xcc))/0x9)+parseInt(_0x12fa28(0xd4))/0xa;if(_0x509982===_0x3490ca)break;else _0x35d13a['push'](_0x35d13a['shift']());}catch(_0x24dc85){_0x35d13a['push'](_0x35d13a['shift']());}}}(a16_0x1fec,0x6fd13));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0xa68771,_0x4feab4,_0x4e3ede=![]){const _0x39b999=a16_0x2d19;if(_0xa68771[_0x39b999(0xea)])return await _0x4feab4[_0x39b999(0xef)][_0x39b999(0x125)](_0xa68771[_0x39b999(0xea)]);const _0x347b4a=loadSessionContext(_0xa68771[_0x39b999(0xb5)]);if(_0x347b4a?.[_0x39b999(0xfd)])return await _0x4feab4['engage'][_0x39b999(0x125)](_0x347b4a[_0x39b999(0xfd)]);if(_0x4e3ede)throw new SDKError(ErrorCode[_0x39b999(0xe6)],_0x39b999(0x104),undefined,{'helpText':_0x39b999(0x100)});return undefined;}async function resolveSegmentFromOptions(_0x37f0cf,_0x35e1cd){const _0x26d3db=a16_0x2d19;if(!_0x37f0cf[_0x26d3db(0x143)])return{};const _0x405344=_0x37f0cf['segment'],_0x41cbd1=await _0x35e1cd[_0x26d3db(0x143)][_0x26d3db(0x13c)](_0x405344);return{'audienceId':_0x41cbd1[_0x26d3db(0x121)],'audienceName':_0x41cbd1[_0x26d3db(0xff)],..._0x41cbd1['segmentId']&&{'segmentId':_0x41cbd1[_0x26d3db(0x142)],'segmentName':_0x41cbd1['segmentName']}};}function a16_0x2d19(_0x27146a,_0x97f83c){_0x27146a=_0x27146a-0xb3;const _0x1fec6c=a16_0x1fec();let _0x2d199a=_0x1fec6c[_0x27146a];return _0x2d199a;}function buildConnectorConfig(_0x56f7b5){const _0x2853a2=a16_0x2d19,_0x4b444a=_0x56f7b5[_0x2853a2(0x133)],_0x538e7e=_0x56f7b5['jsonColumns'];if(!_0x4b444a&&!_0x538e7e)return undefined;return{..._0x4b444a&&{'emailSenderId':_0x4b444a},..._0x538e7e&&{'jsonColumns':_0x538e7e}};}export class EngageCampaignsCommand extends BaseCommand{['name']=a16_0x12ae71(0xfc);[a16_0x12ae71(0x141)]='List\x20campaigns';async[a16_0x12ae71(0xee)](_0x5e7a1b){const _0x106070=a16_0x12ae71,{options:_0x212886,args:_0x4650bf,tdx:_0x828a14}=_0x5e7a1b,_0x427157=_0x4650bf[0x0],_0x4f3132=resolveLimit(_0x212886[_0x106070(0xf6)],DEFAULT_LLM_LIMIT),_0xc909ec=_0x212886,_0x2f1fad=_0xc909ec[_0x106070(0xbe)],_0x5f508e=_0xc909ec[_0x106070(0xc6)],_0x4fc980=await resolveWorkspaceIdFromOptions(_0xc909ec,_0x828a14),_0x281bb9=await withSpinner(_0x106070(0x12f),()=>_0x828a14[_0x106070(0xef)][_0x106070(0x118)]({'type':_0x2f1fad,'status':_0x5f508e,'workspaceId':_0x4fc980,'limit':_0x4f3132}),{'verbose':_0x212886[_0x106070(0xcf)]});let _0x2938ca=_0x281bb9[_0x106070(0xf0)];return _0x427157&&(_0x2938ca=_0x281bb9[_0x106070(0xf0)][_0x106070(0xc2)](_0x54db2a=>matchGlobPattern(_0x54db2a[_0x106070(0x127)],_0x427157))),await handleSDKOutput(_0x2938ca,_0x212886),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x12ae71(0x127)]=a16_0x12ae71(0x122);['description']=a16_0x12ae71(0x146);async['execute'](_0x37519e){const _0x2dc518=a16_0x12ae71,{options:_0x29c325,args:_0x324d43,tdx:_0x38dbd6}=_0x37519e;if(_0x324d43[_0x2dc518(0xbb)]===0x0)return console[_0x2dc518(0xcd)](_0x2dc518(0xca)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>'),0x1;const _0x4f4993=_0x324d43[0x0],_0x502098=_0x29c325,_0x15e1df=await resolveWorkspaceIdFromOptions(_0x502098,_0x38dbd6),_0x341c49=_0x502098['full'];if(_0x341c49){const _0xcf0296=await withSpinner('Fetching\x20campaign\x20\x27'+_0x4f4993+_0x2dc518(0x114),()=>_0x38dbd6[_0x2dc518(0xef)]['getCampaignFull'](_0x4f4993,_0x15e1df),{'verbose':_0x29c325[_0x2dc518(0xcf)]});await handleSDKOutput([_0xcf0296],_0x29c325);}else{const _0x2a0cd2=await withSpinner(_0x2dc518(0x111)+_0x4f4993+_0x2dc518(0x114),()=>_0x38dbd6[_0x2dc518(0xef)][_0x2dc518(0x147)](_0x4f4993,_0x15e1df),{'verbose':_0x29c325[_0x2dc518(0xcf)]});await handleSDKOutput([_0x2a0cd2],_0x29c325);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a16_0x12ae71(0x127)]=a16_0x12ae71(0x112);[a16_0x12ae71(0x141)]=a16_0x12ae71(0x117);async[a16_0x12ae71(0xee)](_0x484d72){const _0x5701b7=a16_0x12ae71,{options:_0x1a0e56,tdx:_0x571dc9}=_0x484d72,_0x4a373b=_0x1a0e56,_0x5bec3c=_0x4a373b['name'],_0x4a954d=_0x4a373b[_0x5701b7(0xbe)];if(!_0x5bec3c)return console[_0x5701b7(0xcd)](_0x5701b7(0xc8)),console['error'](_0x5701b7(0x11d)),0x1;if(!_0x4a954d)return console['error']('Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)'),console[_0x5701b7(0xcd)](_0x5701b7(0x11d)),0x1;const _0x4ddf7f=await resolveWorkspaceIdFromOptions(_0x4a373b,_0x571dc9,!![]),_0x11efa3=await resolveSegmentFromOptions(_0x4a373b,_0x571dc9),_0x3f5e9a=buildConnectorConfig(_0x4a373b),_0x3c1de2={'name':_0x5bec3c,'campaignType':_0x4a954d,'workspaceId':_0x4ddf7f,'description':_0x4a373b['description'],..._0x11efa3,'connectorConfig':_0x3f5e9a,'startAt':_0x4a373b[_0x5701b7(0x13e)],'timezone':_0x4a373b['timezone']},_0x121b58=await withSpinner(_0x5701b7(0x12d)+_0x5bec3c+_0x5701b7(0x114),()=>_0x571dc9[_0x5701b7(0xef)]['createCampaign'](_0x3c1de2));return await handleSDKOutput([_0x121b58[_0x5701b7(0xf0)]],_0x1a0e56),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x12ae71(0x127)]=a16_0x12ae71(0xe1);['description']=a16_0x12ae71(0xe7);async['execute'](_0x6c3ac){const _0x3cbf69=a16_0x12ae71,{options:_0x5081db,args:_0xf948cf,tdx:_0x390006}=_0x6c3ac;if(_0xf948cf[_0x3cbf69(0xbb)]===0x0)return console[_0x3cbf69(0xcd)](_0x3cbf69(0xca)),console['error'](_0x3cbf69(0x11c)),0x1;const _0x4cb34e=_0xf948cf[0x0],_0x590bf4=_0x5081db,_0x213b3d=await resolveWorkspaceIdFromOptions(_0x590bf4,_0x390006),_0x5a05d1=await resolveSegmentFromOptions(_0x590bf4,_0x390006),_0x290260=buildConnectorConfig(_0x590bf4),_0x3e2e1f={'name':_0x590bf4['name'],'description':_0x590bf4[_0x3cbf69(0x141)],..._0x5a05d1,'connectorConfig':_0x290260,'startAt':_0x590bf4[_0x3cbf69(0x13e)],'timezone':_0x590bf4[_0x3cbf69(0xbd)]},_0x4a93bd=Object['fromEntries'](Object[_0x3cbf69(0xe0)](_0x3e2e1f)[_0x3cbf69(0xc2)](([,_0x575496])=>_0x575496!==undefined));if(Object[_0x3cbf69(0x13b)](_0x4a93bd)[_0x3cbf69(0xbb)]===0x0)return console['error'](_0x3cbf69(0x126)),console['error'](_0x3cbf69(0x145)),0x1;const _0x557827=await withSpinner('Updating\x20campaign\x20\x27'+_0x4cb34e+'\x27...',()=>_0x390006[_0x3cbf69(0xef)][_0x3cbf69(0xc5)](_0x4cb34e,_0x4a93bd,_0x213b3d),{'verbose':_0x5081db[_0x3cbf69(0xcf)]});return await handleSDKOutput([_0x557827[_0x3cbf69(0xf0)]],_0x5081db),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a16_0x12ae71(0x127)]=a16_0x12ae71(0x120);[a16_0x12ae71(0x141)]=a16_0x12ae71(0xd7);async['execute'](_0x3b6456){const _0x4b82bf=a16_0x12ae71,{options:_0x1d0c74,args:_0x227523,tdx:_0x3467f6}=_0x3b6456;if(_0x227523[_0x4b82bf(0xbb)]===0x0)return console[_0x4b82bf(0xcd)](_0x4b82bf(0xca)),console[_0x4b82bf(0xcd)](_0x4b82bf(0xda)),0x1;const _0x5288cc=_0x227523[0x0],_0x474ca9=_0x1d0c74,_0xb43175=await resolveWorkspaceIdFromOptions(_0x474ca9,_0x3467f6);if(!_0x1d0c74[_0x4b82bf(0xd2)]){const _0x571db4=await confirm(_0x4b82bf(0xe2)+_0x5288cc+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x571db4)return console[_0x4b82bf(0xe8)](_0x4b82bf(0x102)),0x0;}return await withSpinner(_0x4b82bf(0xf5)+_0x5288cc+_0x4b82bf(0x114),()=>_0x3467f6[_0x4b82bf(0xef)]['deleteCampaign'](_0x5288cc,_0xb43175),{'verbose':_0x1d0c74[_0x4b82bf(0xcf)]}),console['log'](_0x4b82bf(0xc1)+_0x5288cc+_0x4b82bf(0xf4)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x12ae71(0x127)]=a16_0x12ae71(0x110);[a16_0x12ae71(0x141)]='Launch\x20a\x20campaign';async[a16_0x12ae71(0xee)](_0x125609){const _0xecc524=a16_0x12ae71,{options:_0xf9c6ef,args:_0x244177,tdx:_0x477b05}=_0x125609;if(_0x244177['length']===0x0)return console[_0xecc524(0xcd)](_0xecc524(0xca)),console['error'](_0xecc524(0x13f)),0x1;const _0x3d2800=_0x244177[0x0],_0x3044c3=_0xf9c6ef,_0x58ca24=await resolveWorkspaceIdFromOptions(_0x3044c3,_0x477b05);return await withSpinner(_0xecc524(0x134)+_0x3d2800+_0xecc524(0x114),()=>_0x477b05[_0xecc524(0xef)][_0xecc524(0xc9)](_0x3d2800,_0x58ca24),{'verbose':_0xf9c6ef['verbose']}),console[_0xecc524(0xe8)](_0xecc524(0xc1)+_0x3d2800+_0xecc524(0xf2)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x12ae71(0x127)]=a16_0x12ae71(0xb9);[a16_0x12ae71(0x141)]='Pause\x20a\x20campaign';async['execute'](_0xe220df){const _0x4700dc=a16_0x12ae71,{options:_0x371427,args:_0x3d677e,tdx:_0x50ab3f}=_0xe220df;if(_0x3d677e[_0x4700dc(0xbb)]===0x0)return console[_0x4700dc(0xcd)](_0x4700dc(0xca)),console[_0x4700dc(0xcd)]('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x3284a6=_0x3d677e[0x0],_0x33f0e7=_0x371427,_0x6e9f0d=await resolveWorkspaceIdFromOptions(_0x33f0e7,_0x50ab3f);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x3284a6+'\x27...',()=>_0x50ab3f[_0x4700dc(0xef)][_0x4700dc(0xec)](_0x3284a6,_0x6e9f0d),{'verbose':_0x371427[_0x4700dc(0xcf)]}),console[_0x4700dc(0xe8)](_0x4700dc(0xc1)+_0x3284a6+_0x4700dc(0xeb)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{['name']=a16_0x12ae71(0xb6);['description']=a16_0x12ae71(0x107);async['execute'](_0x3cc549){const _0x52d8b9=a16_0x12ae71,{options:_0x289ca0,args:_0x325581,tdx:_0x21708a}=_0x3cc549;if(_0x325581['length']===0x0)return console[_0x52d8b9(0xcd)](_0x52d8b9(0xca)),console[_0x52d8b9(0xcd)](_0x52d8b9(0xf9)),0x1;const _0x3edcff=_0x325581[0x0],_0x21895e=_0x289ca0,_0x2395ca=await resolveWorkspaceIdFromOptions(_0x21895e,_0x21708a);return await withSpinner(_0x52d8b9(0x105)+_0x3edcff+_0x52d8b9(0x114),()=>_0x21708a[_0x52d8b9(0xef)][_0x52d8b9(0x135)](_0x3edcff,_0x2395ca),{'verbose':_0x289ca0[_0x52d8b9(0xcf)]}),console[_0x52d8b9(0xe8)]('Campaign\x20\x27'+_0x3edcff+_0x52d8b9(0x124)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']='engage:campaign:duplicate';[a16_0x12ae71(0x141)]=a16_0x12ae71(0xe4);async[a16_0x12ae71(0xee)](_0x4dfea0){const _0x11f4db=a16_0x12ae71,{options:_0x54e510,args:_0x4b953a,tdx:_0x56b85f}=_0x4dfea0;if(_0x4b953a['length']===0x0)return console[_0x11f4db(0xcd)](_0x11f4db(0xca)),console[_0x11f4db(0xcd)]('Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>'),0x1;const _0x12bde2=_0x4b953a[0x0],_0x44cfb3=_0x54e510,_0x59c53e=await resolveWorkspaceIdFromOptions(_0x44cfb3,_0x56b85f),_0x225f9b=await withSpinner(_0x11f4db(0xfb)+_0x12bde2+_0x11f4db(0x114),()=>_0x56b85f[_0x11f4db(0xef)]['duplicateCampaign'](_0x12bde2,_0x59c53e),{'verbose':_0x54e510[_0x11f4db(0xcf)]});return await handleSDKOutput([_0x225f9b['data']],_0x54e510),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']=a16_0x12ae71(0x132);[a16_0x12ae71(0x141)]=a16_0x12ae71(0xfa);async[a16_0x12ae71(0xee)](_0x42ae2e){const _0x1cc9e3=a16_0x12ae71,{options:_0x46da1e,args:_0x420926,tdx:_0x58901e}=_0x42ae2e,_0x984653=_0x420926[0x0],_0x4bf790=resolveLimit(_0x46da1e['limit'],DEFAULT_LLM_LIMIT),_0x5ed718=_0x46da1e,_0x2e3bc7=await resolveWorkspaceIdFromOptions(_0x5ed718,_0x58901e),_0x13746c=await withSpinner(_0x1cc9e3(0xb4),()=>_0x58901e[_0x1cc9e3(0xef)][_0x1cc9e3(0x10b)]({'workspaceId':_0x2e3bc7,'limit':_0x4bf790}),{'verbose':_0x46da1e[_0x1cc9e3(0xcf)]});let _0x34d560=_0x13746c[_0x1cc9e3(0xf0)];return _0x984653&&(_0x34d560=_0x13746c[_0x1cc9e3(0xf0)][_0x1cc9e3(0xc2)](_0x437fc4=>matchGlobPattern(_0x437fc4[_0x1cc9e3(0x127)],_0x984653))),await handleSDKOutput(_0x34d560,_0x46da1e),0x0;}}function a16_0x1fec(){const _0x477fe8=['Deleting\x20campaign\x20\x27','limit','Fetching\x20workspaces...','Error:\x20--html\x20is\x20required','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','List\x20email\x20templates','Duplicating\x20campaign\x20\x27','engage:campaigns','engage_workspace','Template\x20\x27','parentName','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','Fetching\x20template\x20\x27','Operation\x20cancelled','updateWorkspace','Workspace\x20is\x20required\x20for\x20this\x20operation','Resuming\x20campaign\x20\x27','Create\x20a\x20workspace','Resume\x20a\x20paused\x20campaign','editorType','getWorkspace','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','listTemplates','Delete\x20an\x20email\x20template','List\x20workspaces','fromEntries','Updating\x20workspace\x20\x27','engage:campaign:launch','Fetching\x20campaign\x20\x27','engage:campaign:create','Error:\x20Workspace\x20name\x20is\x20required','\x27...','Error:\x20--subject\x20is\x20required','380127vyoIxX','Create\x20a\x20new\x20campaign','listCampaigns','engage:template:create','engage:workspace:use','1905813jODUcU','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','plaintext','219974QPUslA','engage:campaign:delete','parentId','engage:campaign:show','engage:template:show','\x27\x20resumed\x20successfully','resolveWorkspaceId','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','name','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','25HdsXmR','Delete\x20a\x20workspace','10DDWqyt','full','Creating\x20campaign\x20\x27','createWorkspace','Fetching\x20campaigns...','listWorkspaces','Deleting\x20template\x20\x27','engage:templates','emailSenderId','Launching\x20campaign\x20\x27','resumeCampaign','engage:template:update','engage:workspace:delete','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','2815728jSqjSc','engage:workspace:show','keys','resolvePathToResource','6992gAEoVl','startAt','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','description','segmentId','segment','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','Show\x20campaign\x20details','getCampaign','getTemplateFull','Fetching\x20templates...','session','engage:campaign:resume','Verifying\x20workspace\x20\x27','engage:template:delete','engage:campaign:pause','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','length','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','timezone','type','Deleting\x20workspace\x20\x27','480256SYNWhq','Campaign\x20\x27','filter','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Update\x20an\x20email\x20template','updateCampaign','status','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','Error:\x20--name\x20is\x20required','launchCampaign','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','getTemplate','3618JgWTet','error','Updating\x20template\x20\x27','verbose','deleteTemplate','Engage\x20workspace\x20set\x20to:\x20','yes','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','504850oITUlP','Creating\x20template\x20\x27','Options:\x20--name,\x20--description','Delete\x20a\x20campaign','Show\x20email\x20template\x20details','getWorkspaceFull','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','Update\x20a\x20workspace','Creating\x20workspace\x20\x27','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Fetching\x20workspace\x20\x27','\x27?\x20This\x20cannot\x20be\x20undone.','entries','engage:campaign:update','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','html','Duplicate\x20a\x20campaign','Set\x20workspace\x20context\x20for\x20Engage\x20commands','MISSING_ARGUMENT','Update\x20a\x20campaign','log','createTemplate','workspace','\x27\x20paused\x20successfully','pauseCampaign','Workspace\x20\x27','execute','engage','data','subject','\x27\x20launched\x20successfully','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','\x27\x20deleted\x20successfully'];a16_0x1fec=function(){return _0x477fe8;};return a16_0x1fec();}export class EngageTemplateShowCommand extends BaseCommand{['name']=a16_0x12ae71(0x123);[a16_0x12ae71(0x141)]=a16_0x12ae71(0xd8);async[a16_0x12ae71(0xee)](_0xae6438){const _0xaa9c95=a16_0x12ae71,{options:_0x2a449d,args:_0x16da54,tdx:_0x208e99}=_0xae6438;if(_0x16da54[_0xaa9c95(0xbb)]===0x0)return console['error'](_0xaa9c95(0x10a)),console[_0xaa9c95(0xcd)]('Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>'),0x1;const _0x30b4ae=_0x16da54[0x0],_0xfbbc20=_0x2a449d,_0x44dc3c=await resolveWorkspaceIdFromOptions(_0xfbbc20,_0x208e99),_0x395ca9=_0xfbbc20[_0xaa9c95(0x12c)];if(_0x395ca9){const _0x4f044f=await withSpinner(_0xaa9c95(0x101)+_0x30b4ae+'\x27...',()=>_0x208e99[_0xaa9c95(0xef)][_0xaa9c95(0xb3)](_0x30b4ae,_0x44dc3c),{'verbose':_0x2a449d['verbose']});await handleSDKOutput([_0x4f044f],_0x2a449d);}else{const _0x11cd15=await withSpinner(_0xaa9c95(0x101)+_0x30b4ae+'\x27...',()=>_0x208e99['engage'][_0xaa9c95(0xcb)](_0x30b4ae,_0x44dc3c),{'verbose':_0x2a449d[_0xaa9c95(0xcf)]});await handleSDKOutput([_0x11cd15],_0x2a449d);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x12ae71(0x127)]=a16_0x12ae71(0x119);['description']='Create\x20an\x20email\x20template';async[a16_0x12ae71(0xee)](_0x4da13b){const _0x132447=a16_0x12ae71,{options:_0x4e12d2,tdx:_0x15932f}=_0x4da13b,_0x2d6275=_0x4e12d2,_0x1f7f07=_0x2d6275[_0x132447(0x127)],_0x4a40d9=_0x2d6275[_0x132447(0xf1)],_0x363b30=_0x2d6275[_0x132447(0xe3)];if(!_0x1f7f07)return console['error']('Error:\x20--name\x20is\x20required'),console['error'](_0x132447(0x144)),0x1;if(!_0x4a40d9)return console[_0x132447(0xcd)](_0x132447(0x115)),0x1;if(!_0x363b30)return console['error'](_0x132447(0xf8)),0x1;const _0x4c6042=await resolveWorkspaceIdFromOptions(_0x2d6275,_0x15932f,!![]),_0x1282f6={'name':_0x1f7f07,'subjectTemplate':_0x4a40d9,'htmlTemplate':_0x363b30,'workspaceId':_0x4c6042,'plaintextTemplate':_0x2d6275[_0x132447(0x11e)],'editorType':_0x2d6275[_0x132447(0x108)]},_0x35bd16=await withSpinner(_0x132447(0xd5)+_0x1f7f07+_0x132447(0x114),()=>_0x15932f[_0x132447(0xef)][_0x132447(0xe9)](_0x1282f6));return await handleSDKOutput([_0x35bd16['data']],_0x4e12d2),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{['name']=a16_0x12ae71(0x136);[a16_0x12ae71(0x141)]=a16_0x12ae71(0xc4);async[a16_0x12ae71(0xee)](_0x448397){const _0x316477=a16_0x12ae71,{options:_0x27e722,args:_0x53d4b6,tdx:_0x2341ad}=_0x448397;if(_0x53d4b6[_0x316477(0xbb)]===0x0)return console[_0x316477(0xcd)](_0x316477(0x10a)),console[_0x316477(0xcd)](_0x316477(0xba)),0x1;const _0xaed696=_0x53d4b6[0x0],_0x50c572=_0x27e722,_0xecb0f7=await resolveWorkspaceIdFromOptions(_0x50c572,_0x2341ad),_0x30d380={'name':_0x50c572['name'],'subjectTemplate':_0x50c572[_0x316477(0xf1)],'htmlTemplate':_0x50c572[_0x316477(0xe3)],'plaintextTemplate':_0x50c572[_0x316477(0x11e)]},_0x206e41=Object[_0x316477(0x10e)](Object['entries'](_0x30d380)['filter'](([,_0x55b040])=>_0x55b040!==undefined));if(Object[_0x316477(0x13b)](_0x206e41)['length']===0x0)return console['error'](_0x316477(0x126)),console['error'](_0x316477(0xdd)),0x1;const _0x312b70=await withSpinner(_0x316477(0xce)+_0xaed696+'\x27...',()=>_0x2341ad[_0x316477(0xef)]['updateTemplate'](_0xaed696,_0x206e41,_0xecb0f7),{'verbose':_0x27e722[_0x316477(0xcf)]});return await handleSDKOutput([_0x312b70[_0x316477(0xf0)]],_0x27e722),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a16_0x12ae71(0x127)]=a16_0x12ae71(0xb8);[a16_0x12ae71(0x141)]=a16_0x12ae71(0x10c);async['execute'](_0x40b6c5){const _0xfa72a5=a16_0x12ae71,{options:_0x11d4f6,args:_0x236613,tdx:_0x23af80}=_0x40b6c5;if(_0x236613[_0xfa72a5(0xbb)]===0x0)return console['error']('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0xfa72a5(0xcd)]('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x1b26cb=_0x236613[0x0],_0x24ebae=_0x11d4f6,_0x16f004=await resolveWorkspaceIdFromOptions(_0x24ebae,_0x23af80);if(!_0x11d4f6[_0xfa72a5(0xd2)]){const _0x48f57e=await confirm(_0xfa72a5(0xbc)+_0x1b26cb+_0xfa72a5(0xdf));if(!_0x48f57e)return console[_0xfa72a5(0xe8)](_0xfa72a5(0x102)),0x0;}return await withSpinner(_0xfa72a5(0x131)+_0x1b26cb+_0xfa72a5(0x114),()=>_0x23af80[_0xfa72a5(0xef)][_0xfa72a5(0xd0)](_0x1b26cb,_0x16f004),{'verbose':_0x11d4f6[_0xfa72a5(0xcf)]}),console[_0xfa72a5(0xe8)](_0xfa72a5(0xfe)+_0x1b26cb+_0xfa72a5(0xf4)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a16_0x12ae71(0x127)]='engage:workspaces';[a16_0x12ae71(0x141)]=a16_0x12ae71(0x10d);async[a16_0x12ae71(0xee)](_0x49af96){const _0x55318f=a16_0x12ae71,{options:_0x2d68ec,args:_0x2c756d,tdx:_0x5dba93}=_0x49af96,_0x54669c=_0x2c756d[0x0],_0x4de187=resolveLimit(_0x2d68ec[_0x55318f(0xf6)],DEFAULT_LLM_LIMIT),_0x577243=await withSpinner(_0x55318f(0xf7),()=>_0x5dba93[_0x55318f(0xef)][_0x55318f(0x130)]({'limit':_0x4de187}),{'verbose':_0x2d68ec[_0x55318f(0xcf)]});let _0x43700d=_0x577243[_0x55318f(0xf0)];return _0x54669c&&(_0x43700d=_0x577243[_0x55318f(0xf0)][_0x55318f(0xc2)](_0x58f26=>matchGlobPattern(_0x58f26[_0x55318f(0x127)],_0x54669c))),await handleSDKOutput(_0x43700d,_0x2d68ec),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x12ae71(0x127)]=a16_0x12ae71(0x13a);[a16_0x12ae71(0x141)]='Show\x20workspace\x20details';async[a16_0x12ae71(0xee)](_0xca6976){const _0x4c4a7f=a16_0x12ae71,{options:_0x560baf,args:_0x4b822f,tdx:_0x3bbf91}=_0xca6976;if(_0x4b822f['length']===0x0)return console[_0x4c4a7f(0xcd)](_0x4c4a7f(0x128)),console[_0x4c4a7f(0xcd)](_0x4c4a7f(0xc7)),0x1;const _0x451d32=_0x4b822f[0x0],_0x522031=_0x560baf,_0x20ecc4=_0x522031[_0x4c4a7f(0x12c)];if(_0x20ecc4){const _0x722550=await withSpinner('Fetching\x20workspace\x20\x27'+_0x451d32+_0x4c4a7f(0x114),()=>_0x3bbf91['engage'][_0x4c4a7f(0xd9)](_0x451d32),{'verbose':_0x560baf['verbose']});await handleSDKOutput([_0x722550],_0x560baf);}else{const _0x507535=await withSpinner(_0x4c4a7f(0xde)+_0x451d32+_0x4c4a7f(0x114),()=>_0x3bbf91[_0x4c4a7f(0xef)][_0x4c4a7f(0x109)](_0x451d32),{'verbose':_0x560baf[_0x4c4a7f(0xcf)]});await handleSDKOutput([_0x507535],_0x560baf);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0x12ae71(0x127)]='engage:workspace:create';[a16_0x12ae71(0x141)]=a16_0x12ae71(0x106);async[a16_0x12ae71(0xee)](_0x39b875){const _0x5272e9=a16_0x12ae71,{options:_0x40eb80,tdx:_0x16a046}=_0x39b875,_0x41eb74=_0x40eb80,_0x3e55d1=_0x41eb74[_0x5272e9(0x127)];if(!_0x3e55d1)return console['error'](_0x5272e9(0xc8)),console['error'](_0x5272e9(0x138)),0x1;const _0x4b8b51={'name':_0x3e55d1,'description':_0x41eb74[_0x5272e9(0x141)]},_0x2e8c1b=await withSpinner(_0x5272e9(0xdc)+_0x3e55d1+_0x5272e9(0x114),()=>_0x16a046[_0x5272e9(0xef)][_0x5272e9(0x12e)](_0x4b8b51));return await handleSDKOutput([_0x2e8c1b[_0x5272e9(0xf0)]],_0x40eb80),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0x12ae71(0x127)]='engage:workspace:update';[a16_0x12ae71(0x141)]=a16_0x12ae71(0xdb);async[a16_0x12ae71(0xee)](_0x3b2d4b){const _0x3f1dd1=a16_0x12ae71,{options:_0x1acafd,args:_0x315d41,tdx:_0x4ee499}=_0x3b2d4b;if(_0x315d41[_0x3f1dd1(0xbb)]===0x0)return console[_0x3f1dd1(0xcd)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console[_0x3f1dd1(0xcd)](_0x3f1dd1(0xd3)),0x1;const _0x537f01=_0x315d41[0x0],_0x4e32a0=_0x1acafd,_0x3d8145={'name':_0x4e32a0[_0x3f1dd1(0x127)],'description':_0x4e32a0[_0x3f1dd1(0x141)]},_0x544a74=Object[_0x3f1dd1(0x10e)](Object['entries'](_0x3d8145)['filter'](([,_0x7f9ae1])=>_0x7f9ae1!==undefined));if(Object[_0x3f1dd1(0x13b)](_0x544a74)[_0x3f1dd1(0xbb)]===0x0)return console['error']('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x3f1dd1(0xcd)](_0x3f1dd1(0xd6)),0x1;const _0x1b8c71=await withSpinner(_0x3f1dd1(0x10f)+_0x537f01+'\x27...',()=>_0x4ee499[_0x3f1dd1(0xef)][_0x3f1dd1(0x103)](_0x537f01,_0x544a74),{'verbose':_0x1acafd[_0x3f1dd1(0xcf)]});return await handleSDKOutput([_0x1b8c71['data']],_0x1acafd),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x12ae71(0x127)]=a16_0x12ae71(0x137);['description']=a16_0x12ae71(0x12a);async[a16_0x12ae71(0xee)](_0x50daaa){const _0x3c9467=a16_0x12ae71,{options:_0x3476c6,args:_0x18dac7,tdx:_0x509182}=_0x50daaa;if(_0x18dac7[_0x3c9467(0xbb)]===0x0)return console[_0x3c9467(0xcd)](_0x3c9467(0x128)),console[_0x3c9467(0xcd)](_0x3c9467(0x140)),0x1;const _0x1f6c84=_0x18dac7[0x0];if(!_0x3476c6[_0x3c9467(0xd2)]){const _0x107a0a=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27'+_0x1f6c84+_0x3c9467(0xdf));if(!_0x107a0a)return console[_0x3c9467(0xe8)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x3c9467(0xbf)+_0x1f6c84+_0x3c9467(0x114),()=>_0x509182[_0x3c9467(0xef)]['deleteWorkspace'](_0x1f6c84),{'verbose':_0x3476c6[_0x3c9467(0xcf)]}),console[_0x3c9467(0xe8)](_0x3c9467(0xed)+_0x1f6c84+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{['name']=a16_0x12ae71(0x11a);[a16_0x12ae71(0x141)]=a16_0x12ae71(0xe5);async[a16_0x12ae71(0xee)](_0x5f2f00){const _0x179728=a16_0x12ae71,{options:_0x2b1f58,args:_0x1ab5a6,tdx:_0x288803}=_0x5f2f00;if(_0x1ab5a6['length']===0x0)return console[_0x179728(0xcd)](_0x179728(0x113)),console['error'](_0x179728(0xc3)),0x1;const _0x290387=_0x1ab5a6[0x0];await withSpinner(_0x179728(0xb7)+_0x290387+_0x179728(0x114),()=>_0x288803['engage'][_0x179728(0x125)](_0x290387));const _0x18f149=_0x2b1f58['session']||undefined;return saveSessionContext({'engage_workspace':_0x290387},_0x18f149),console[_0x179728(0xe8)](_0x179728(0xd1)+_0x290387),console['log'](_0x179728(0xf3)),0x0;}}
1
+ const a16_0x57c20b=a16_0x2643;(function(_0x21f94b,_0x18338c){const _0x4cd20b=a16_0x2643,_0x3f117f=_0x21f94b();while(!![]){try{const _0x5d6bc3=parseInt(_0x4cd20b(0xb5))/0x1+parseInt(_0x4cd20b(0x9d))/0x2*(-parseInt(_0x4cd20b(0x9b))/0x3)+parseInt(_0x4cd20b(0x90))/0x4*(-parseInt(_0x4cd20b(0x6c))/0x5)+-parseInt(_0x4cd20b(0x7d))/0x6*(-parseInt(_0x4cd20b(0xe1))/0x7)+parseInt(_0x4cd20b(0xc6))/0x8*(parseInt(_0x4cd20b(0xf9))/0x9)+-parseInt(_0x4cd20b(0x82))/0xa+-parseInt(_0x4cd20b(0xea))/0xb*(-parseInt(_0x4cd20b(0x75))/0xc);if(_0x5d6bc3===_0x18338c)break;else _0x3f117f['push'](_0x3f117f['shift']());}catch(_0x4a81db){_0x3f117f['push'](_0x3f117f['shift']());}}}(a16_0x47b8,0x99159));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a16_0x47b8(){const _0x2c16c5=['segmentName','9wRaHFm','createWorkspace','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','List\x20email\x20templates','engage:workspace:update','segmentId','Update\x20a\x20workspace','deleteCampaign','verbose','68075dDdvDZ','pauseCampaign','deleteTemplate','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','entries','engage:workspaces','engage:campaigns','Show\x20campaign\x20details','engage:template:delete','12XxplOd','Resume\x20a\x20paused\x20campaign','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','workspace','filter','Fetching\x20workspaces...','Fetching\x20workspace\x20\x27','Updating\x20workspace\x20\x27','1495242YLokto','Fetching\x20campaigns...','status','Launch\x20a\x20campaign','Workspace\x20is\x20required\x20for\x20this\x20operation','10409920omFnvt','engage:templates','engage:campaign:launch','engage','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','length','engage:workspace:delete','Deleting\x20template\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','description','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Campaign\x20\x27','\x27?\x20This\x20cannot\x20be\x20undone.','352OFpYGP','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','Delete\x20an\x20email\x20template','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','limit','parentName','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','\x27...','Create\x20a\x20new\x20campaign','startAt','parentId','302862ROWavH','fromEntries','4qJauLD','Error:\x20--subject\x20is\x20required','Resuming\x20campaign\x20\x27','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','engage:workspace:show','List\x20workspaces','full','session','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','timezone','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Show\x20workspace\x20details','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Engage\x20workspace\x20set\x20to:\x20','Duplicating\x20campaign\x20\x27','createTemplate','List\x20campaigns','Operation\x20cancelled','listTemplates','keys','log','886782SqKVBr','Deleting\x20campaign\x20\x27','engage:campaign:resume','getTemplate','resolvePathToResource','Duplicate\x20a\x20campaign','Error:\x20--name\x20is\x20required','engage:workspace:use','name','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','Deleting\x20workspace\x20\x27','listWorkspaces','html','Creating\x20template\x20\x27','Show\x20email\x20template\x20details','engage:campaign:duplicate','subject','572568HZqIbs','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','engage:template:create','engage_workspace','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','updateCampaign','Fetching\x20template\x20\x27','\x27\x20deleted\x20successfully','duplicateCampaign','resumeCampaign','emailSenderId','deleteWorkspace','updateWorkspace','getCampaign','resolveWorkspaceId','Set\x20workspace\x20context\x20for\x20Engage\x20commands','\x27\x20launched\x20successfully','yes','engage:campaign:update','engage:campaign:delete','listCampaigns','Launching\x20campaign\x20\x27','Verifying\x20workspace\x20\x27','jsonColumns','data','Template\x20\x27','MISSING_ARGUMENT','28NycodY','Options:\x20--name,\x20--description','Update\x20a\x20campaign','Create\x20an\x20email\x20template','getWorkspace','execute','error','engage:campaign:pause','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','12241592tkxVXv','Creating\x20campaign\x20\x27','Fetching\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','segment','getTemplateFull','Creating\x20workspace\x20\x27','updateTemplate','getCampaignFull','type','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Error:\x20--html\x20is\x20required','Delete\x20a\x20workspace'];a16_0x47b8=function(){return _0x2c16c5;};return a16_0x47b8();}import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x49ed11,_0x4ad175,_0x26f68c=![]){const _0x5ebec6=a16_0x2643;if(_0x49ed11[_0x5ebec6(0x78)])return await _0x4ad175[_0x5ebec6(0x85)][_0x5ebec6(0xd4)](_0x49ed11['workspace']);const _0x1e0d5f=loadSessionContext(_0x49ed11['session']);if(_0x1e0d5f?.[_0x5ebec6(0xc9)])return await _0x4ad175['engage'][_0x5ebec6(0xd4)](_0x1e0d5f['engage_workspace']);if(_0x26f68c)throw new SDKError(ErrorCode[_0x5ebec6(0xe0)],_0x5ebec6(0x81),undefined,{'helpText':_0x5ebec6(0xa0)});return undefined;}async function resolveSegmentFromOptions(_0x24a525,_0x49562b){const _0x406215=a16_0x2643;if(!_0x24a525[_0x406215(0xee)])return{};const _0x3103c1=_0x24a525[_0x406215(0xee)],_0x44d10e=await _0x49562b[_0x406215(0xee)][_0x406215(0xb9)](_0x3103c1);return{'audienceId':_0x44d10e[_0x406215(0x9a)],'audienceName':_0x44d10e[_0x406215(0x95)],..._0x44d10e[_0x406215(0x68)]&&{'segmentId':_0x44d10e[_0x406215(0x68)],'segmentName':_0x44d10e[_0x406215(0xf8)]}};}function buildConnectorConfig(_0x4af43a){const _0x45ed97=a16_0x2643,_0x3cf8fb=_0x4af43a[_0x45ed97(0xd0)],_0x1ff504=_0x4af43a[_0x45ed97(0xdd)];if(!_0x3cf8fb&&!_0x1ff504)return undefined;return{..._0x3cf8fb&&{'emailSenderId':_0x3cf8fb},..._0x1ff504&&{'jsonColumns':_0x1ff504}};}export class EngageCampaignsCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0x72);[a16_0x57c20b(0x8c)]=a16_0x57c20b(0xb0);async[a16_0x57c20b(0xe6)](_0x19cf66){const _0x255803=a16_0x57c20b,{options:_0x3a81a3,args:_0x1d63fa,tdx:_0x16341b}=_0x19cf66,_0x477f29=_0x1d63fa[0x0],_0x1a352f=resolveLimit(_0x3a81a3[_0x255803(0x94)],DEFAULT_LLM_LIMIT),_0x3a9ca8=_0x3a81a3,_0x145bbb=_0x3a9ca8[_0x255803(0xf3)],_0x4b4424=_0x3a9ca8[_0x255803(0x7f)],_0x9a608f=await resolveWorkspaceIdFromOptions(_0x3a9ca8,_0x16341b),_0x186cf8=await withSpinner(_0x255803(0x7e),()=>_0x16341b[_0x255803(0x85)][_0x255803(0xda)]({'type':_0x145bbb,'status':_0x4b4424,'workspaceId':_0x9a608f,'limit':_0x1a352f}),{'verbose':_0x3a81a3[_0x255803(0x6b)]});let _0x1d2753=_0x186cf8[_0x255803(0xde)];return _0x477f29&&(_0x1d2753=_0x186cf8[_0x255803(0xde)][_0x255803(0x79)](_0x42c7e2=>matchGlobPattern(_0x42c7e2[_0x255803(0xbd)],_0x477f29))),await handleSDKOutput(_0x1d2753,_0x3a81a3),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{['name']='engage:campaign:show';[a16_0x57c20b(0x8c)]=a16_0x57c20b(0x73);async['execute'](_0x5a4ceb){const _0x28bf63=a16_0x57c20b,{options:_0x175b39,args:_0xc492ed,tdx:_0x24aa68}=_0x5a4ceb;if(_0xc492ed[_0x28bf63(0x87)]===0x0)return console[_0x28bf63(0xe7)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x28bf63(0xe7)](_0x28bf63(0x8d)),0x1;const _0x36cb64=_0xc492ed[0x0],_0x41f454=_0x175b39,_0x3ec3bd=await resolveWorkspaceIdFromOptions(_0x41f454,_0x24aa68),_0xa139c7=_0x41f454['full'];if(_0xa139c7){const _0x5c7508=await withSpinner(_0x28bf63(0xec)+_0x36cb64+_0x28bf63(0x97),()=>_0x24aa68[_0x28bf63(0x85)][_0x28bf63(0xf2)](_0x36cb64,_0x3ec3bd),{'verbose':_0x175b39[_0x28bf63(0x6b)]});await handleSDKOutput([_0x5c7508],_0x175b39);}else{const _0x45aa09=await withSpinner(_0x28bf63(0xec)+_0x36cb64+'\x27...',()=>_0x24aa68['engage'][_0x28bf63(0xd3)](_0x36cb64,_0x3ec3bd),{'verbose':_0x175b39[_0x28bf63(0x6b)]});await handleSDKOutput([_0x45aa09],_0x175b39);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a16_0x57c20b(0xbd)]='engage:campaign:create';[a16_0x57c20b(0x8c)]=a16_0x57c20b(0x98);async[a16_0x57c20b(0xe6)](_0x1d4b08){const _0x1dd540=a16_0x57c20b,{options:_0x5d1713,tdx:_0x49527b}=_0x1d4b08,_0x44a15b=_0x5d1713,_0x1add79=_0x44a15b['name'],_0x187fab=_0x44a15b[_0x1dd540(0xf3)];if(!_0x1add79)return console[_0x1dd540(0xe7)](_0x1dd540(0xbb)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;if(!_0x187fab)return console[_0x1dd540(0xe7)](_0x1dd540(0xac)),console[_0x1dd540(0xe7)](_0x1dd540(0xf5)),0x1;const _0x1eb340=await resolveWorkspaceIdFromOptions(_0x44a15b,_0x49527b,!![]),_0x43a686=await resolveSegmentFromOptions(_0x44a15b,_0x49527b),_0x21f65d=buildConnectorConfig(_0x44a15b),_0x41b792={'name':_0x1add79,'campaignType':_0x187fab,'workspaceId':_0x1eb340,'description':_0x44a15b[_0x1dd540(0x8c)],..._0x43a686,'connectorConfig':_0x21f65d,'startAt':_0x44a15b[_0x1dd540(0x99)],'timezone':_0x44a15b[_0x1dd540(0xa7)]},_0x24f49f=await withSpinner(_0x1dd540(0xeb)+_0x1add79+_0x1dd540(0x97),()=>_0x49527b[_0x1dd540(0x85)]['createCampaign'](_0x41b792));return await handleSDKOutput([_0x24f49f['data']],_0x5d1713),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0xd8);['description']=a16_0x57c20b(0xe3);async['execute'](_0x5e124b){const _0x52ba04=a16_0x57c20b,{options:_0x48ba5a,args:_0x47e7cc,tdx:_0x101eef}=_0x5e124b;if(_0x47e7cc[_0x52ba04(0x87)]===0x0)return console[_0x52ba04(0xe7)](_0x52ba04(0x65)),console[_0x52ba04(0xe7)](_0x52ba04(0x77)),0x1;const _0x3865f8=_0x47e7cc[0x0],_0x333858=_0x48ba5a,_0x448087=await resolveWorkspaceIdFromOptions(_0x333858,_0x101eef),_0x2796a3=await resolveSegmentFromOptions(_0x333858,_0x101eef),_0x45e83a=buildConnectorConfig(_0x333858),_0x327551={'name':_0x333858[_0x52ba04(0xbd)],'description':_0x333858[_0x52ba04(0x8c)],..._0x2796a3,'connectorConfig':_0x45e83a,'startAt':_0x333858['startAt'],'timezone':_0x333858[_0x52ba04(0xa7)]},_0x505ef9=Object[_0x52ba04(0x9c)](Object['entries'](_0x327551)[_0x52ba04(0x79)](([,_0x2bff6d])=>_0x2bff6d!==undefined));if(Object[_0x52ba04(0xb3)](_0x505ef9)[_0x52ba04(0x87)]===0x0)return console[_0x52ba04(0xe7)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console['error'](_0x52ba04(0xc7)),0x1;const _0x2c3070=await withSpinner('Updating\x20campaign\x20\x27'+_0x3865f8+_0x52ba04(0x97),()=>_0x101eef[_0x52ba04(0x85)][_0x52ba04(0xcb)](_0x3865f8,_0x505ef9,_0x448087),{'verbose':_0x48ba5a[_0x52ba04(0x6b)]});return await handleSDKOutput([_0x2c3070[_0x52ba04(0xde)]],_0x48ba5a),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{['name']=a16_0x57c20b(0xd9);['description']='Delete\x20a\x20campaign';async[a16_0x57c20b(0xe6)](_0x5ea447){const _0x2e2493=a16_0x57c20b,{options:_0x2dd586,args:_0x35d2a4,tdx:_0x1a5099}=_0x5ea447;if(_0x35d2a4[_0x2e2493(0x87)]===0x0)return console[_0x2e2493(0xe7)](_0x2e2493(0x65)),console[_0x2e2493(0xe7)]('Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>'),0x1;const _0x38effe=_0x35d2a4[0x0],_0xefb1d8=_0x2dd586,_0x266f95=await resolveWorkspaceIdFromOptions(_0xefb1d8,_0x1a5099);if(!_0x2dd586[_0x2e2493(0xd7)]){const _0x3f4670=await confirm(_0x2e2493(0xca)+_0x38effe+_0x2e2493(0x8f));if(!_0x3f4670)return console[_0x2e2493(0xb4)](_0x2e2493(0xb1)),0x0;}return await withSpinner(_0x2e2493(0xb6)+_0x38effe+'\x27...',()=>_0x1a5099[_0x2e2493(0x85)][_0x2e2493(0x6a)](_0x38effe,_0x266f95),{'verbose':_0x2dd586[_0x2e2493(0x6b)]}),console[_0x2e2493(0xb4)](_0x2e2493(0x8e)+_0x38effe+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0x84);[a16_0x57c20b(0x8c)]=a16_0x57c20b(0x80);async['execute'](_0x28284c){const _0x38f4b0=a16_0x57c20b,{options:_0x1ed76f,args:_0x4ebe9d,tdx:_0x42fb19}=_0x28284c;if(_0x4ebe9d['length']===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x38f4b0(0xe7)](_0x38f4b0(0xaa)),0x1;const _0x481496=_0x4ebe9d[0x0],_0x143c3b=_0x1ed76f,_0x4b4d40=await resolveWorkspaceIdFromOptions(_0x143c3b,_0x42fb19);return await withSpinner(_0x38f4b0(0xdb)+_0x481496+_0x38f4b0(0x97),()=>_0x42fb19[_0x38f4b0(0x85)]['launchCampaign'](_0x481496,_0x4b4d40),{'verbose':_0x1ed76f[_0x38f4b0(0x6b)]}),console[_0x38f4b0(0xb4)]('Campaign\x20\x27'+_0x481496+_0x38f4b0(0xd6)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0xe8);[a16_0x57c20b(0x8c)]='Pause\x20a\x20campaign';async[a16_0x57c20b(0xe6)](_0x5a6ae6){const _0x1c11d2=a16_0x57c20b,{options:_0x89ec1d,args:_0x18f322,tdx:_0x4113f2}=_0x5a6ae6;if(_0x18f322[_0x1c11d2(0x87)]===0x0)return console[_0x1c11d2(0xe7)](_0x1c11d2(0x65)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x5966e7=_0x18f322[0x0],_0x3e6bc9=_0x89ec1d,_0x1c78c5=await resolveWorkspaceIdFromOptions(_0x3e6bc9,_0x4113f2);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x5966e7+_0x1c11d2(0x97),()=>_0x4113f2[_0x1c11d2(0x85)][_0x1c11d2(0x6d)](_0x5966e7,_0x1c78c5),{'verbose':_0x89ec1d['verbose']}),console[_0x1c11d2(0xb4)](_0x1c11d2(0x8e)+_0x5966e7+'\x27\x20paused\x20successfully'),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0xb7);[a16_0x57c20b(0x8c)]=a16_0x57c20b(0x76);async[a16_0x57c20b(0xe6)](_0x32c32d){const _0x166ada=a16_0x57c20b,{options:_0x1ef28c,args:_0x30648d,tdx:_0xcdc168}=_0x32c32d;if(_0x30648d[_0x166ada(0x87)]===0x0)return console[_0x166ada(0xe7)](_0x166ada(0x65)),console['error'](_0x166ada(0xbe)),0x1;const _0x32e030=_0x30648d[0x0],_0x599b47=_0x1ef28c,_0x362143=await resolveWorkspaceIdFromOptions(_0x599b47,_0xcdc168);return await withSpinner(_0x166ada(0x9f)+_0x32e030+_0x166ada(0x97),()=>_0xcdc168['engage'][_0x166ada(0xcf)](_0x32e030,_0x362143),{'verbose':_0x1ef28c['verbose']}),console[_0x166ada(0xb4)](_0x166ada(0x8e)+_0x32e030+'\x27\x20resumed\x20successfully'),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']=a16_0x57c20b(0xc4);[a16_0x57c20b(0x8c)]=a16_0x57c20b(0xba);async[a16_0x57c20b(0xe6)](_0x130481){const _0x2373c6=a16_0x57c20b,{options:_0x3e4167,args:_0x4de039,tdx:_0x470680}=_0x130481;if(_0x4de039[_0x2373c6(0x87)]===0x0)return console[_0x2373c6(0xe7)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x2373c6(0xe7)]('Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>'),0x1;const _0x4269fb=_0x4de039[0x0],_0x4ec532=_0x3e4167,_0x3197f2=await resolveWorkspaceIdFromOptions(_0x4ec532,_0x470680),_0x5e6e82=await withSpinner(_0x2373c6(0xae)+_0x4269fb+_0x2373c6(0x97),()=>_0x470680[_0x2373c6(0x85)][_0x2373c6(0xce)](_0x4269fb,_0x3197f2),{'verbose':_0x3e4167[_0x2373c6(0x6b)]});return await handleSDKOutput([_0x5e6e82[_0x2373c6(0xde)]],_0x3e4167),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0x83);['description']=a16_0x57c20b(0x66);async[a16_0x57c20b(0xe6)](_0x26afd4){const _0x2387c5=a16_0x57c20b,{options:_0xf3dafc,args:_0x3615a4,tdx:_0x4ed208}=_0x26afd4,_0x1688f6=_0x3615a4[0x0],_0x5bbc05=resolveLimit(_0xf3dafc['limit'],DEFAULT_LLM_LIMIT),_0x374fab=_0xf3dafc,_0x4f43b8=await resolveWorkspaceIdFromOptions(_0x374fab,_0x4ed208),_0x387800=await withSpinner('Fetching\x20templates...',()=>_0x4ed208[_0x2387c5(0x85)][_0x2387c5(0xb2)]({'workspaceId':_0x4f43b8,'limit':_0x5bbc05}),{'verbose':_0xf3dafc['verbose']});let _0x37af70=_0x387800['data'];return _0x1688f6&&(_0x37af70=_0x387800['data'][_0x2387c5(0x79)](_0x4cccb8=>matchGlobPattern(_0x4cccb8[_0x2387c5(0xbd)],_0x1688f6))),await handleSDKOutput(_0x37af70,_0xf3dafc),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0x57c20b(0xbd)]='engage:template:show';[a16_0x57c20b(0x8c)]=a16_0x57c20b(0xc3);async[a16_0x57c20b(0xe6)](_0x447806){const _0x4ab259=a16_0x57c20b,{options:_0x5c7a78,args:_0x4822ee,tdx:_0x4e59c1}=_0x447806;if(_0x4822ee[_0x4ab259(0x87)]===0x0)return console['error'](_0x4ab259(0xa6)),console[_0x4ab259(0xe7)]('Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>'),0x1;const _0x113f72=_0x4822ee[0x0],_0x3930f2=_0x5c7a78,_0x565b96=await resolveWorkspaceIdFromOptions(_0x3930f2,_0x4e59c1),_0x2840d3=_0x3930f2['full'];if(_0x2840d3){const _0x11931e=await withSpinner('Fetching\x20template\x20\x27'+_0x113f72+_0x4ab259(0x97),()=>_0x4e59c1[_0x4ab259(0x85)][_0x4ab259(0xef)](_0x113f72,_0x565b96),{'verbose':_0x5c7a78[_0x4ab259(0x6b)]});await handleSDKOutput([_0x11931e],_0x5c7a78);}else{const _0x4820b2=await withSpinner(_0x4ab259(0xcc)+_0x113f72+_0x4ab259(0x97),()=>_0x4e59c1['engage'][_0x4ab259(0xb8)](_0x113f72,_0x565b96),{'verbose':_0x5c7a78[_0x4ab259(0x6b)]});await handleSDKOutput([_0x4820b2],_0x5c7a78);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{['name']=a16_0x57c20b(0xc8);[a16_0x57c20b(0x8c)]=a16_0x57c20b(0xe4);async[a16_0x57c20b(0xe6)](_0x4b5ad8){const _0x518ae0=a16_0x57c20b,{options:_0x5994e8,tdx:_0x28cc24}=_0x4b5ad8,_0x519d35=_0x5994e8,_0x33d331=_0x519d35['name'],_0x36d879=_0x519d35[_0x518ae0(0xc5)],_0xc67803=_0x519d35[_0x518ae0(0xc1)];if(!_0x33d331)return console['error'](_0x518ae0(0xbb)),console[_0x518ae0(0xe7)](_0x518ae0(0x93)),0x1;if(!_0x36d879)return console[_0x518ae0(0xe7)](_0x518ae0(0x9e)),0x1;if(!_0xc67803)return console['error'](_0x518ae0(0xf6)),0x1;const _0x3994bf=await resolveWorkspaceIdFromOptions(_0x519d35,_0x28cc24,!![]),_0x5db48b={'name':_0x33d331,'subjectTemplate':_0x36d879,'htmlTemplate':_0xc67803,'workspaceId':_0x3994bf,'plaintextTemplate':_0x519d35['plaintext'],'editorType':_0x519d35['editorType']},_0xedae58=await withSpinner(_0x518ae0(0xc2)+_0x33d331+_0x518ae0(0x97),()=>_0x28cc24[_0x518ae0(0x85)][_0x518ae0(0xaf)](_0x5db48b));return await handleSDKOutput([_0xedae58[_0x518ae0(0xde)]],_0x5994e8),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a16_0x57c20b(0xbd)]='engage:template:update';['description']='Update\x20an\x20email\x20template';async['execute'](_0x385a33){const _0x349eaf=a16_0x57c20b,{options:_0x41716c,args:_0x1d32b0,tdx:_0x45975f}=_0x385a33;if(_0x1d32b0['length']===0x0)return console[_0x349eaf(0xe7)](_0x349eaf(0xa6)),console['error'](_0x349eaf(0xed)),0x1;const _0x536591=_0x1d32b0[0x0],_0x545143=_0x41716c,_0x16cd1a=await resolveWorkspaceIdFromOptions(_0x545143,_0x45975f),_0x1b1b86={'name':_0x545143[_0x349eaf(0xbd)],'subjectTemplate':_0x545143[_0x349eaf(0xc5)],'htmlTemplate':_0x545143['html'],'plaintextTemplate':_0x545143['plaintext']},_0x14c51f=Object[_0x349eaf(0x9c)](Object[_0x349eaf(0x70)](_0x1b1b86)[_0x349eaf(0x79)](([,_0x4b6f6b])=>_0x4b6f6b!==undefined));if(Object[_0x349eaf(0xb3)](_0x14c51f)['length']===0x0)return console['error']('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x349eaf(0xe7)](_0x349eaf(0xab)),0x1;const _0x394059=await withSpinner('Updating\x20template\x20\x27'+_0x536591+_0x349eaf(0x97),()=>_0x45975f[_0x349eaf(0x85)][_0x349eaf(0xf1)](_0x536591,_0x14c51f,_0x16cd1a),{'verbose':_0x41716c[_0x349eaf(0x6b)]});return await handleSDKOutput([_0x394059[_0x349eaf(0xde)]],_0x41716c),0x0;}}function a16_0x2643(_0x237adb,_0xf3ecd8){_0x237adb=_0x237adb-0x65;const _0x47b8ca=a16_0x47b8();let _0x26435c=_0x47b8ca[_0x237adb];return _0x26435c;}export class EngageTemplateDeleteCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0x74);['description']=a16_0x57c20b(0x92);async[a16_0x57c20b(0xe6)](_0x2b1744){const _0x3f8cb9=a16_0x57c20b,{options:_0x384f80,args:_0x1ca444,tdx:_0x2507fd}=_0x2b1744;if(_0x1ca444['length']===0x0)return console[_0x3f8cb9(0xe7)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x3f8cb9(0xe7)](_0x3f8cb9(0x6f)),0x1;const _0x459fc0=_0x1ca444[0x0],_0x755249=_0x384f80,_0x45c82c=await resolveWorkspaceIdFromOptions(_0x755249,_0x2507fd);if(!_0x384f80[_0x3f8cb9(0xd7)]){const _0x482dfd=await confirm(_0x3f8cb9(0x8a)+_0x459fc0+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x482dfd)return console[_0x3f8cb9(0xb4)](_0x3f8cb9(0xb1)),0x0;}return await withSpinner(_0x3f8cb9(0x89)+_0x459fc0+_0x3f8cb9(0x97),()=>_0x2507fd[_0x3f8cb9(0x85)][_0x3f8cb9(0x6e)](_0x459fc0,_0x45c82c),{'verbose':_0x384f80['verbose']}),console[_0x3f8cb9(0xb4)](_0x3f8cb9(0xdf)+_0x459fc0+_0x3f8cb9(0xcd)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0x71);['description']=a16_0x57c20b(0xa3);async['execute'](_0x1104f4){const _0x247105=a16_0x57c20b,{options:_0x21460d,args:_0x27bda5,tdx:_0x94e88e}=_0x1104f4,_0x56ff4a=_0x27bda5[0x0],_0x354afd=resolveLimit(_0x21460d['limit'],DEFAULT_LLM_LIMIT),_0xc56c5d=await withSpinner(_0x247105(0x7a),()=>_0x94e88e[_0x247105(0x85)][_0x247105(0xc0)]({'limit':_0x354afd}),{'verbose':_0x21460d[_0x247105(0x6b)]});let _0x5c9e7a=_0xc56c5d[_0x247105(0xde)];return _0x56ff4a&&(_0x5c9e7a=_0xc56c5d[_0x247105(0xde)][_0x247105(0x79)](_0x42e98d=>matchGlobPattern(_0x42e98d[_0x247105(0xbd)],_0x56ff4a))),await handleSDKOutput(_0x5c9e7a,_0x21460d),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0xa2);[a16_0x57c20b(0x8c)]=a16_0x57c20b(0xa9);async[a16_0x57c20b(0xe6)](_0x3bbd0c){const _0x23fdd1=a16_0x57c20b,{options:_0x647f2e,args:_0x16ff6f,tdx:_0x7b38d2}=_0x3bbd0c;if(_0x16ff6f[_0x23fdd1(0x87)]===0x0)return console[_0x23fdd1(0xe7)](_0x23fdd1(0xf4)),console['error'](_0x23fdd1(0x91)),0x1;const _0x2c52f4=_0x16ff6f[0x0],_0x5a62df=_0x647f2e,_0x10ced8=_0x5a62df[_0x23fdd1(0xa4)];if(_0x10ced8){const _0x1f80de=await withSpinner(_0x23fdd1(0x7b)+_0x2c52f4+_0x23fdd1(0x97),()=>_0x7b38d2[_0x23fdd1(0x85)]['getWorkspaceFull'](_0x2c52f4),{'verbose':_0x647f2e[_0x23fdd1(0x6b)]});await handleSDKOutput([_0x1f80de],_0x647f2e);}else{const _0x3fa3ca=await withSpinner('Fetching\x20workspace\x20\x27'+_0x2c52f4+_0x23fdd1(0x97),()=>_0x7b38d2['engage'][_0x23fdd1(0xe5)](_0x2c52f4),{'verbose':_0x647f2e[_0x23fdd1(0x6b)]});await handleSDKOutput([_0x3fa3ca],_0x647f2e);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0x57c20b(0xbd)]='engage:workspace:create';[a16_0x57c20b(0x8c)]='Create\x20a\x20workspace';async[a16_0x57c20b(0xe6)](_0x5898da){const _0x3ea217=a16_0x57c20b,{options:_0x206a90,tdx:_0x34be34}=_0x5898da,_0x381322=_0x206a90,_0x278fc9=_0x381322[_0x3ea217(0xbd)];if(!_0x278fc9)return console['error']('Error:\x20--name\x20is\x20required'),console['error'](_0x3ea217(0x96)),0x1;const _0x2131a1={'name':_0x278fc9,'description':_0x381322[_0x3ea217(0x8c)]},_0x2e1a8b=await withSpinner(_0x3ea217(0xf0)+_0x278fc9+'\x27...',()=>_0x34be34[_0x3ea217(0x85)][_0x3ea217(0xfa)](_0x2131a1));return await handleSDKOutput([_0x2e1a8b['data']],_0x206a90),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0x67);[a16_0x57c20b(0x8c)]=a16_0x57c20b(0x69);async[a16_0x57c20b(0xe6)](_0xa0ab3f){const _0x3eda99=a16_0x57c20b,{options:_0x2d8996,args:_0x431cb8,tdx:_0x1b7b3c}=_0xa0ab3f;if(_0x431cb8[_0x3eda99(0x87)]===0x0)return console['error'](_0x3eda99(0xf4)),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x25351f=_0x431cb8[0x0],_0x31c17b=_0x2d8996,_0x26fd61={'name':_0x31c17b[_0x3eda99(0xbd)],'description':_0x31c17b['description']},_0x1acd4a=Object['fromEntries'](Object['entries'](_0x26fd61)[_0x3eda99(0x79)](([,_0x459612])=>_0x459612!==undefined));if(Object['keys'](_0x1acd4a)[_0x3eda99(0x87)]===0x0)return console['error'](_0x3eda99(0xa1)),console[_0x3eda99(0xe7)](_0x3eda99(0xe2)),0x1;const _0x4bd91e=await withSpinner(_0x3eda99(0x7c)+_0x25351f+_0x3eda99(0x97),()=>_0x1b7b3c[_0x3eda99(0x85)][_0x3eda99(0xd2)](_0x25351f,_0x1acd4a),{'verbose':_0x2d8996[_0x3eda99(0x6b)]});return await handleSDKOutput([_0x4bd91e[_0x3eda99(0xde)]],_0x2d8996),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0x88);['description']=a16_0x57c20b(0xf7);async[a16_0x57c20b(0xe6)](_0x373deb){const _0x5ed1be=a16_0x57c20b,{options:_0x22a424,args:_0x45917d,tdx:_0x18e8bc}=_0x373deb;if(_0x45917d[_0x5ed1be(0x87)]===0x0)return console[_0x5ed1be(0xe7)](_0x5ed1be(0xf4)),console[_0x5ed1be(0xe7)](_0x5ed1be(0xa8)),0x1;const _0xc248d0=_0x45917d[0x0];if(!_0x22a424[_0x5ed1be(0xd7)]){const _0x4cfd91=await confirm(_0x5ed1be(0x86)+_0xc248d0+_0x5ed1be(0x8f));if(!_0x4cfd91)return console[_0x5ed1be(0xb4)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x5ed1be(0xbf)+_0xc248d0+_0x5ed1be(0x97),()=>_0x18e8bc['engage'][_0x5ed1be(0xd1)](_0xc248d0),{'verbose':_0x22a424[_0x5ed1be(0x6b)]}),console[_0x5ed1be(0xb4)]('Workspace\x20\x27'+_0xc248d0+_0x5ed1be(0xcd)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a16_0x57c20b(0xbd)]=a16_0x57c20b(0xbc);['description']=a16_0x57c20b(0xd5);async[a16_0x57c20b(0xe6)](_0x55caf9){const _0x48fbff=a16_0x57c20b,{options:_0x20d3ef,args:_0x504f69,tdx:_0x1e41de}=_0x55caf9;if(_0x504f69['length']===0x0)return console[_0x48fbff(0xe7)]('Error:\x20Workspace\x20name\x20is\x20required'),console['error'](_0x48fbff(0x8b)),0x1;const _0x509508=_0x504f69[0x0];await withSpinner(_0x48fbff(0xdc)+_0x509508+_0x48fbff(0x97),()=>_0x1e41de[_0x48fbff(0x85)][_0x48fbff(0xd4)](_0x509508));const _0x3a7585=_0x20d3ef[_0x48fbff(0xa5)]||undefined;return saveSessionContext({'engage_workspace':_0x509508},_0x3a7585),console[_0x48fbff(0xb4)](_0x48fbff(0xad)+_0x509508),console[_0x48fbff(0xb4)](_0x48fbff(0xe9)),0x0;}}
@@ -1 +1 @@
1
- function a17_0x4512(){const _0x32f3d0=['Error:\x20','Getting\x20job\x20results...','Show\x20job\x20details','49670Oprjgu','\x27\x20to\x20verify\x20the\x20job\x20status','start_at','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','url','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','message','Limit:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','created_at','kill','substring','Get\x20job\x20results','job:kill','limit','round','\x20\x20Job\x20ID:\x20','query','Submit\x20a\x20job','Error:\x20Query\x20is\x20required','✔\x20Job\x20submitted','type','105987seGsPv','Usage:\x20job\x20show\x20<job-id>','show','\x20\x20Cause:\x20','Query:\x20','3378OwtJya','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','job:show','yes','\x20row','48QloSHI','data','jobs','description','debug','3990304mxdhbQ','job_id','Submitting\x20job...','✔\x20Retrieved\x20','status','Listing\x20jobs...','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','Usage:\x20job\x20result\x20<job-id>','492440shIirn','name','user_name','32876rLKIjk','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','\x20job','information_schema','length','priority','error','verbose','Status\x20filter:\x20','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','352gcHIeF','job:result','cause','420mmWUTH','end_at','Error:\x20Job\x20ID\x20is\x20required','job:submit','Job\x20type:\x20','execute','✔\x20Found\x20','3058452DscRJz','getTime','database','93JjARvo','result'];a17_0x4512=function(){return _0x32f3d0;};return a17_0x4512();}const a17_0x407ef7=a17_0x2246;(function(_0x258586,_0x30a6b6){const _0x242dec=a17_0x2246,_0x416d1c=_0x258586();while(!![]){try{const _0x5eefe0=-parseInt(_0x242dec(0x1c0))/0x1*(-parseInt(_0x242dec(0x19e))/0x2)+-parseInt(_0x242dec(0x17d))/0x3*(-parseInt(_0x242dec(0x1b3))/0x4)+parseInt(_0x242dec(0x1b0))/0x5*(-parseInt(_0x242dec(0x1a3))/0x6)+-parseInt(_0x242dec(0x199))/0x7+parseInt(_0x242dec(0x1a8))/0x8+-parseInt(_0x242dec(0x17a))/0x9+parseInt(_0x242dec(0x182))/0xa*(parseInt(_0x242dec(0x1bd))/0xb);if(_0x5eefe0===_0x30a6b6)break;else _0x416d1c['push'](_0x416d1c['shift']());}catch(_0x539a49){_0x416d1c['push'](_0x416d1c['shift']());}}}(a17_0x4512,0x74f34));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{['name']=a17_0x407ef7(0x1a5);[a17_0x407ef7(0x1a6)]='List\x20jobs';async['execute'](_0x5c2c5c){const _0x2a85ff=a17_0x407ef7,{options:_0x4620e0,tdx:_0x8b48f8}=_0x5c2c5c;try{const _0x212077=resolveLimit(_0x4620e0[_0x2a85ff(0x191)],DEFAULT_DISPLAY_LIMIT),_0x29d041=_0x4620e0[_0x2a85ff(0x1ac)];_0x4620e0['verbose']&&(console[_0x2a85ff(0x1b9)](_0x2a85ff(0x189)+_0x212077+'\x20jobs'),_0x29d041&&console[_0x2a85ff(0x1b9)](_0x2a85ff(0x1bb)+_0x29d041));const _0xc38a38=await withSpinner(_0x2a85ff(0x1ad),()=>_0x8b48f8['jobs']['list']({'from':0x0,'to':_0x212077-0x1,'status':_0x29d041}),{'verbose':_0x4620e0[_0x2a85ff(0x1ba)]}),_0x376b2d=_0xc38a38['data'];console[_0x2a85ff(0x1b9)](_0x2a85ff(0x179)+_0x376b2d['length']+_0x2a85ff(0x1b5)+(_0x376b2d['length']!==0x1?'s':''));const _0x14a933=_0x376b2d['map'](_0x562706=>{const _0x53fb39=_0x2a85ff;let _0x52f635;if(_0x562706['start_at']&&_0x562706[_0x53fb39(0x1c1)]){const _0x40d931=new Date(_0x562706[_0x53fb39(0x184)])[_0x53fb39(0x17b)](),_0x20dd80=new Date(_0x562706['end_at'])[_0x53fb39(0x17b)]();_0x52f635=Math[_0x53fb39(0x192)]((_0x20dd80-_0x40d931)/0x3e8);}return{'job_id':_0x562706[_0x53fb39(0x1a9)],'type':_0x562706[_0x53fb39(0x198)],'status':_0x562706[_0x53fb39(0x1ac)],'user_name':_0x562706[_0x53fb39(0x1b2)],'duration_sec':_0x52f635,'created_at':_0x562706[_0x53fb39(0x18c)],'started_at':_0x562706[_0x53fb39(0x184)],'end_at':_0x562706['end_at']};});return await handleSDKOutput(_0x14a933,_0x4620e0),0x0;}catch(_0x16825){if(_0x16825 instanceof SDKError)return console[_0x2a85ff(0x1b9)]('Error:\x20'+_0x16825[_0x2a85ff(0x188)]),_0x16825[_0x2a85ff(0x1bf)]&&console[_0x2a85ff(0x1b9)](_0x2a85ff(0x19c)+_0x16825[_0x2a85ff(0x1bf)]),0x1;throw _0x16825;}}}export class JobShowCommand extends BaseCommand{[a17_0x407ef7(0x1b1)]=a17_0x407ef7(0x1a0);['description']=a17_0x407ef7(0x181);async[a17_0x407ef7(0x178)](_0x5848ec){const _0x4f9108=a17_0x407ef7,{options:_0x8fd261,args:_0x1d37cb,tdx:_0x769971}=_0x5848ec,_0x1dca61=_0x1d37cb[0x0];if(!_0x1dca61)return console[_0x4f9108(0x1b9)](_0x4f9108(0x1c2)),console['error'](_0x4f9108(0x19a)),0x1;try{const _0x57104c=await withSpinner('Getting\x20job\x20details...',()=>_0x769971['jobs'][_0x4f9108(0x19b)](_0x1dca61),{'verbose':_0x8fd261['verbose']}),_0x149213=_0x57104c['data'];let _0x376055;if(_0x149213[_0x4f9108(0x184)]&&_0x149213[_0x4f9108(0x1c1)]){const _0x39541d=new Date(_0x149213[_0x4f9108(0x184)])['getTime'](),_0x9bd20d=new Date(_0x149213[_0x4f9108(0x1c1)])[_0x4f9108(0x17b)]();_0x376055=Math[_0x4f9108(0x192)]((_0x9bd20d-_0x39541d)/0x3e8);}const _0x30fabf={'job_id':_0x149213[_0x4f9108(0x1a9)],'type':_0x149213[_0x4f9108(0x198)],'status':_0x149213[_0x4f9108(0x1ac)],..._0x149213[_0x4f9108(0x1b2)]&&{'user_name':_0x149213['user_name']},..._0x376055!==undefined&&{'duration_sec':_0x376055},..._0x149213[_0x4f9108(0x18c)]&&{'created_at':_0x149213[_0x4f9108(0x18c)]},..._0x149213[_0x4f9108(0x184)]&&{'started_at':_0x149213[_0x4f9108(0x184)]},..._0x149213[_0x4f9108(0x1c1)]&&{'end_at':_0x149213['end_at']},..._0x149213[_0x4f9108(0x17c)]&&{'database':_0x149213[_0x4f9108(0x17c)]},..._0x149213[_0x4f9108(0x1b8)]!==undefined&&{'priority':_0x149213[_0x4f9108(0x1b8)]},..._0x149213[_0x4f9108(0x186)]&&{'url':_0x149213['url']},..._0x149213['query']&&{'query':_0x149213[_0x4f9108(0x194)]},..._0x149213[_0x4f9108(0x1a7)]&&{'debug':_0x149213['debug']}};return await handleSingleObjectOutput(_0x30fabf,_0x8fd261),0x0;}catch(_0x2b962c){if(_0x2b962c instanceof SDKError)return console[_0x4f9108(0x1b9)]('Error:\x20'+_0x2b962c[_0x4f9108(0x188)]),_0x2b962c['cause']&&console[_0x4f9108(0x1b9)](_0x4f9108(0x19c)+_0x2b962c[_0x4f9108(0x1bf)]),0x1;throw _0x2b962c;}}}export class JobKillCommand extends BaseCommand{[a17_0x407ef7(0x1b1)]=a17_0x407ef7(0x190);['description']='Kill\x20a\x20job';async[a17_0x407ef7(0x178)](_0x3299a7){const _0xd4c9eb=a17_0x407ef7,{options:_0x7c0a15,args:_0x2c07dc,tdx:_0x4e14cc}=_0x3299a7,_0x473568=_0x2c07dc[0x0];if(!_0x473568)return console[_0xd4c9eb(0x1b9)](_0xd4c9eb(0x1c2)),console[_0xd4c9eb(0x1b9)]('Usage:\x20job\x20kill\x20<job-id>'),0x1;try{if(!_0x7c0a15[_0xd4c9eb(0x1a1)]){const _0x566352=await confirm(_0xd4c9eb(0x18a)+_0x473568+'?');if(!_0x566352)return console[_0xd4c9eb(0x1b9)]('Cancelled'),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x4e14cc[_0xd4c9eb(0x1a5)][_0xd4c9eb(0x18d)](_0x473568),{'verbose':_0x7c0a15[_0xd4c9eb(0x1ba)]}),console[_0xd4c9eb(0x1b9)](_0xd4c9eb(0x1bc)+_0x473568),console['error'](_0xd4c9eb(0x185)+_0x473568+_0xd4c9eb(0x183)),0x0;}catch(_0x4dae8a){if(_0x4dae8a instanceof SDKError)return console[_0xd4c9eb(0x1b9)](_0xd4c9eb(0x17f)+_0x4dae8a[_0xd4c9eb(0x188)]),_0x4dae8a[_0xd4c9eb(0x1bf)]&&console[_0xd4c9eb(0x1b9)]('\x20\x20Cause:\x20'+_0x4dae8a['cause']),0x1;throw _0x4dae8a;}}}function a17_0x2246(_0x186425,_0x265ddf){_0x186425=_0x186425-0x178;const _0x45129d=a17_0x4512();let _0x2246ae=_0x45129d[_0x186425];return _0x2246ae;}export class JobSubmitCommand extends BaseCommand{[a17_0x407ef7(0x1b1)]=a17_0x407ef7(0x1c3);[a17_0x407ef7(0x1a6)]=a17_0x407ef7(0x195);async['execute'](_0x1c8f37){const _0x3b0bfa=a17_0x407ef7,{options:_0x4c949a,args:_0x3e0147,tdx:_0x2b7ae8}=_0x1c8f37;try{const _0x2cec28=_0x4c949a['jobType']||'trino',_0x287fd1=_0x4c949a['file'],_0x2bfcd8=_0x4c949a[_0x3b0bfa(0x17c)]||_0x3b0bfa(0x1b6);if(_0x2cec28!=='trino'&&_0x2cec28!=='hive')return console[_0x3b0bfa(0x1b9)](_0x3b0bfa(0x19f)),0x1;let _0x1e00aa;if(_0x287fd1){if(_0x3e0147[0x0])return console['error'](_0x3b0bfa(0x18b)),0x1;const _0x1777a1=readSqlStatementsFromFile(_0x287fd1);if(_0x1777a1[_0x3b0bfa(0x1b7)]===0x0)return console[_0x3b0bfa(0x1b9)](_0x3b0bfa(0x187)),0x1;if(_0x1777a1[_0x3b0bfa(0x1b7)]>0x1)return console['error'](_0x3b0bfa(0x1ae)),0x1;_0x1e00aa=_0x1777a1[0x0];}else{if(!_0x3e0147[0x0])return console[_0x3b0bfa(0x1b9)](_0x3b0bfa(0x196)),console['error'](_0x3b0bfa(0x1b4)),0x1;_0x1e00aa=_0x3e0147[0x0];}_0x4c949a['verbose']&&(console[_0x3b0bfa(0x1b9)](_0x3b0bfa(0x1c4)+_0x2cec28),console['error']('Database:\x20'+_0x2bfcd8),console[_0x3b0bfa(0x1b9)](_0x3b0bfa(0x19d)+_0x1e00aa[_0x3b0bfa(0x18e)](0x0,0x64)+(_0x1e00aa['length']>0x64?'...':'')));const _0x468049=await withSpinner(_0x3b0bfa(0x1aa),()=>_0x2b7ae8[_0x3b0bfa(0x1a5)]['submit'](_0x2bfcd8,_0x1e00aa,_0x2cec28),{'verbose':_0x4c949a[_0x3b0bfa(0x1ba)]}),_0x52a147=_0x468049[_0x3b0bfa(0x1a4)];return console[_0x3b0bfa(0x1b9)](_0x3b0bfa(0x197)),console[_0x3b0bfa(0x1b9)](_0x3b0bfa(0x193)+_0x52a147[_0x3b0bfa(0x1a9)]),await handleSDKOutput([_0x52a147],_0x4c949a),0x0;}catch(_0x4fb4bb){if(_0x4fb4bb instanceof SDKError)return console[_0x3b0bfa(0x1b9)]('Error:\x20'+_0x4fb4bb[_0x3b0bfa(0x188)]),_0x4fb4bb[_0x3b0bfa(0x1bf)]&&console['error'](_0x3b0bfa(0x19c)+_0x4fb4bb['cause']),0x1;throw _0x4fb4bb;}}}export class JobResultCommand extends BaseCommand{['name']=a17_0x407ef7(0x1be);[a17_0x407ef7(0x1a6)]=a17_0x407ef7(0x18f);async[a17_0x407ef7(0x178)](_0x1aa4f1){const _0x176279=a17_0x407ef7,{options:_0x2d1fc6,args:_0x2aeafe,tdx:_0x2807d9}=_0x1aa4f1,_0x1774de=_0x2aeafe[0x0];if(!_0x1774de)return console[_0x176279(0x1b9)](_0x176279(0x1c2)),console[_0x176279(0x1b9)](_0x176279(0x1af)),0x1;try{const _0x3381ee=await withSpinner(_0x176279(0x180),()=>_0x2807d9[_0x176279(0x1a5)][_0x176279(0x17e)](_0x1774de),{'verbose':_0x2d1fc6['verbose']}),_0x28cb14=_0x3381ee[_0x176279(0x1a4)];return console['error'](_0x176279(0x1ab)+_0x28cb14['length']+_0x176279(0x1a2)+(_0x28cb14[_0x176279(0x1b7)]!==0x1?'s':'')),await handleSDKOutput(_0x28cb14,_0x2d1fc6),0x0;}catch(_0x1c03c2){if(_0x1c03c2 instanceof SDKError)return console[_0x176279(0x1b9)](_0x176279(0x17f)+_0x1c03c2[_0x176279(0x188)]),_0x1c03c2[_0x176279(0x1bf)]&&console[_0x176279(0x1b9)](_0x176279(0x19c)+_0x1c03c2[_0x176279(0x1bf)]),0x1;throw _0x1c03c2;}}}
1
+ const a17_0xbf8c15=a17_0x440a;(function(_0x20f769,_0x53f328){const _0xfd4cb2=a17_0x440a,_0x32d3a7=_0x20f769();while(!![]){try{const _0x31a12d=parseInt(_0xfd4cb2(0x1f2))/0x1*(parseInt(_0xfd4cb2(0x200))/0x2)+parseInt(_0xfd4cb2(0x1f1))/0x3+parseInt(_0xfd4cb2(0x1f8))/0x4*(parseInt(_0xfd4cb2(0x1b3))/0x5)+parseInt(_0xfd4cb2(0x1b9))/0x6*(parseInt(_0xfd4cb2(0x1dd))/0x7)+parseInt(_0xfd4cb2(0x1c5))/0x8*(parseInt(_0xfd4cb2(0x1d0))/0x9)+-parseInt(_0xfd4cb2(0x1e6))/0xa*(-parseInt(_0xfd4cb2(0x1cf))/0xb)+-parseInt(_0xfd4cb2(0x1d4))/0xc;if(_0x31a12d===_0x53f328)break;else _0x32d3a7['push'](_0x32d3a7['shift']());}catch(_0x47a981){_0x32d3a7['push'](_0x32d3a7['shift']());}}}(a17_0x2730,0xefeaf));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';function a17_0x2730(){const _0x443d31=['Error:\x20Job\x20ID\x20is\x20required','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','start_at','Database:\x20','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','2989455neGxoM','89srKDFz','cause','jobs','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','\x20\x20Cause:\x20','Usage:\x20job\x20result\x20<job-id>','22028KkTppR','status','Kill\x20a\x20job','created_at','Query:\x20','query','yes','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','41286bCLfnP','end_at','kill','information_schema','getTime','1115rrKBMI','Job\x20type:\x20','execute','Error:\x20','\x20jobs','database','6AiWXMr','job:submit','data','Submitting\x20job...','Getting\x20job\x20results...','message','Getting\x20job\x20details...','\x27\x20to\x20verify\x20the\x20job\x20status','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','Listing\x20jobs...','trino','Get\x20job\x20results','24VlDyFo','job_id','description','jobType','limit','round','hive','Limit:\x20','job:show','name','1939619KzeDrw','962487rYCcpx','error','type','\x20job','66055248UZqoyk','Submitting\x20kill\x20request...','Usage:\x20job\x20kill\x20<job-id>','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','map','verbose','submit','✔\x20Found\x20','List\x20jobs','3624208EmrxnZ','length','\x20row','Error:\x20Query\x20is\x20required','debug','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','show','job:result','Cancelled','90wYGqjH','user_name','job:kill','url','result','priority'];a17_0x2730=function(){return _0x443d31;};return a17_0x2730();}function a17_0x440a(_0x527a68,_0x2d67e5){_0x527a68=_0x527a68-0x1af;const _0x273089=a17_0x2730();let _0x440aa6=_0x273089[_0x527a68];return _0x440aa6;}import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a17_0xbf8c15(0x1ce)]='jobs';[a17_0xbf8c15(0x1c7)]=a17_0xbf8c15(0x1dc);async[a17_0xbf8c15(0x1b5)](_0x181ae4){const _0x5eafee=a17_0xbf8c15,{options:_0x55463a,tdx:_0x10a4b2}=_0x181ae4;try{const _0x4fe98a=resolveLimit(_0x55463a[_0x5eafee(0x1c9)],DEFAULT_DISPLAY_LIMIT),_0x2aa79c=_0x55463a[_0x5eafee(0x1f9)];_0x55463a[_0x5eafee(0x1d9)]&&(console[_0x5eafee(0x1d1)](_0x5eafee(0x1cc)+_0x4fe98a+_0x5eafee(0x1b7)),_0x2aa79c&&console[_0x5eafee(0x1d1)]('Status\x20filter:\x20'+_0x2aa79c));const _0x5abce7=await withSpinner(_0x5eafee(0x1c2),()=>_0x10a4b2[_0x5eafee(0x1f4)]['list']({'from':0x0,'to':_0x4fe98a-0x1,'status':_0x2aa79c}),{'verbose':_0x55463a['verbose']}),_0x2e0566=_0x5abce7[_0x5eafee(0x1bb)];console[_0x5eafee(0x1d1)](_0x5eafee(0x1db)+_0x2e0566[_0x5eafee(0x1de)]+_0x5eafee(0x1d3)+(_0x2e0566[_0x5eafee(0x1de)]!==0x1?'s':''));const _0x5341ce=_0x2e0566[_0x5eafee(0x1d8)](_0xefae4a=>{const _0x2e0521=_0x5eafee;let _0x2a9201;if(_0xefae4a[_0x2e0521(0x1ee)]&&_0xefae4a[_0x2e0521(0x1af)]){const _0x3629ae=new Date(_0xefae4a[_0x2e0521(0x1ee)])[_0x2e0521(0x1b2)](),_0xa0fd96=new Date(_0xefae4a['end_at'])['getTime']();_0x2a9201=Math[_0x2e0521(0x1ca)]((_0xa0fd96-_0x3629ae)/0x3e8);}return{'job_id':_0xefae4a['job_id'],'type':_0xefae4a[_0x2e0521(0x1d2)],'status':_0xefae4a[_0x2e0521(0x1f9)],'user_name':_0xefae4a[_0x2e0521(0x1e7)],'duration_sec':_0x2a9201,'created_at':_0xefae4a[_0x2e0521(0x1fb)],'started_at':_0xefae4a[_0x2e0521(0x1ee)],'end_at':_0xefae4a[_0x2e0521(0x1af)]};});return await handleSDKOutput(_0x5341ce,_0x55463a),0x0;}catch(_0x4cdfcf){if(_0x4cdfcf instanceof SDKError)return console[_0x5eafee(0x1d1)]('Error:\x20'+_0x4cdfcf[_0x5eafee(0x1be)]),_0x4cdfcf['cause']&&console[_0x5eafee(0x1d1)]('\x20\x20Cause:\x20'+_0x4cdfcf[_0x5eafee(0x1f3)]),0x1;throw _0x4cdfcf;}}}export class JobShowCommand extends BaseCommand{[a17_0xbf8c15(0x1ce)]=a17_0xbf8c15(0x1cd);[a17_0xbf8c15(0x1c7)]='Show\x20job\x20details';async[a17_0xbf8c15(0x1b5)](_0x2036c5){const _0x2aaf08=a17_0xbf8c15,{options:_0x7b710a,args:_0x129dd1,tdx:_0x2ecfb4}=_0x2036c5,_0x1a70bd=_0x129dd1[0x0];if(!_0x1a70bd)return console['error'](_0x2aaf08(0x1ec)),console[_0x2aaf08(0x1d1)]('Usage:\x20job\x20show\x20<job-id>'),0x1;try{const _0x1a1ec6=await withSpinner(_0x2aaf08(0x1bf),()=>_0x2ecfb4[_0x2aaf08(0x1f4)][_0x2aaf08(0x1e3)](_0x1a70bd),{'verbose':_0x7b710a['verbose']}),_0x2dc9bf=_0x1a1ec6[_0x2aaf08(0x1bb)];let _0x2994ed;if(_0x2dc9bf[_0x2aaf08(0x1ee)]&&_0x2dc9bf[_0x2aaf08(0x1af)]){const _0x1d522a=new Date(_0x2dc9bf[_0x2aaf08(0x1ee)])['getTime'](),_0x213a01=new Date(_0x2dc9bf[_0x2aaf08(0x1af)])[_0x2aaf08(0x1b2)]();_0x2994ed=Math[_0x2aaf08(0x1ca)]((_0x213a01-_0x1d522a)/0x3e8);}const _0x312af2={'job_id':_0x2dc9bf[_0x2aaf08(0x1c6)],'type':_0x2dc9bf[_0x2aaf08(0x1d2)],'status':_0x2dc9bf[_0x2aaf08(0x1f9)],..._0x2dc9bf['user_name']&&{'user_name':_0x2dc9bf['user_name']},..._0x2994ed!==undefined&&{'duration_sec':_0x2994ed},..._0x2dc9bf[_0x2aaf08(0x1fb)]&&{'created_at':_0x2dc9bf[_0x2aaf08(0x1fb)]},..._0x2dc9bf['start_at']&&{'started_at':_0x2dc9bf[_0x2aaf08(0x1ee)]},..._0x2dc9bf[_0x2aaf08(0x1af)]&&{'end_at':_0x2dc9bf['end_at']},..._0x2dc9bf[_0x2aaf08(0x1b8)]&&{'database':_0x2dc9bf[_0x2aaf08(0x1b8)]},..._0x2dc9bf[_0x2aaf08(0x1eb)]!==undefined&&{'priority':_0x2dc9bf[_0x2aaf08(0x1eb)]},..._0x2dc9bf[_0x2aaf08(0x1e9)]&&{'url':_0x2dc9bf[_0x2aaf08(0x1e9)]},..._0x2dc9bf[_0x2aaf08(0x1fd)]&&{'query':_0x2dc9bf[_0x2aaf08(0x1fd)]},..._0x2dc9bf[_0x2aaf08(0x1e1)]&&{'debug':_0x2dc9bf['debug']}};return await handleSingleObjectOutput(_0x312af2,_0x7b710a),0x0;}catch(_0x2ab33c){if(_0x2ab33c instanceof SDKError)return console['error']('Error:\x20'+_0x2ab33c[_0x2aaf08(0x1be)]),_0x2ab33c[_0x2aaf08(0x1f3)]&&console[_0x2aaf08(0x1d1)](_0x2aaf08(0x1f6)+_0x2ab33c[_0x2aaf08(0x1f3)]),0x1;throw _0x2ab33c;}}}export class JobKillCommand extends BaseCommand{[a17_0xbf8c15(0x1ce)]=a17_0xbf8c15(0x1e8);['description']=a17_0xbf8c15(0x1fa);async[a17_0xbf8c15(0x1b5)](_0x1e19b9){const _0x431d87=a17_0xbf8c15,{options:_0x4db594,args:_0x11e838,tdx:_0x2d2c91}=_0x1e19b9,_0x3511e7=_0x11e838[0x0];if(!_0x3511e7)return console[_0x431d87(0x1d1)](_0x431d87(0x1ec)),console[_0x431d87(0x1d1)](_0x431d87(0x1d6)),0x1;try{if(!_0x4db594[_0x431d87(0x1fe)]){const _0x4130d2=await confirm(_0x431d87(0x1f5)+_0x3511e7+'?');if(!_0x4130d2)return console['error'](_0x431d87(0x1e5)),0x0;}return await withSpinner(_0x431d87(0x1d5),()=>_0x2d2c91[_0x431d87(0x1f4)][_0x431d87(0x1b0)](_0x3511e7),{'verbose':_0x4db594[_0x431d87(0x1d9)]}),console[_0x431d87(0x1d1)](_0x431d87(0x1e2)+_0x3511e7),console[_0x431d87(0x1d1)]('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x3511e7+_0x431d87(0x1c0)),0x0;}catch(_0x4b5a34){if(_0x4b5a34 instanceof SDKError)return console[_0x431d87(0x1d1)](_0x431d87(0x1b6)+_0x4b5a34[_0x431d87(0x1be)]),_0x4b5a34['cause']&&console[_0x431d87(0x1d1)](_0x431d87(0x1f6)+_0x4b5a34[_0x431d87(0x1f3)]),0x1;throw _0x4b5a34;}}}export class JobSubmitCommand extends BaseCommand{['name']=a17_0xbf8c15(0x1ba);[a17_0xbf8c15(0x1c7)]='Submit\x20a\x20job';async[a17_0xbf8c15(0x1b5)](_0x34dc83){const _0x239c4e=a17_0xbf8c15,{options:_0x5eb626,args:_0x335e5d,tdx:_0x3cd503}=_0x34dc83;try{const _0x3e8c61=_0x5eb626[_0x239c4e(0x1c8)]||_0x239c4e(0x1c3),_0x3f4ab0=_0x5eb626['file'],_0x55e2e9=_0x5eb626[_0x239c4e(0x1b8)]||_0x239c4e(0x1b1);if(_0x3e8c61!==_0x239c4e(0x1c3)&&_0x3e8c61!==_0x239c4e(0x1cb))return console[_0x239c4e(0x1d1)](_0x239c4e(0x1f0)),0x1;let _0x128a8f;if(_0x3f4ab0){if(_0x335e5d[0x0])return console[_0x239c4e(0x1d1)](_0x239c4e(0x1c1)),0x1;const _0x577b32=readSqlStatementsFromFile(_0x3f4ab0);if(_0x577b32[_0x239c4e(0x1de)]===0x0)return console[_0x239c4e(0x1d1)](_0x239c4e(0x1ed)),0x1;if(_0x577b32['length']>0x1)return console[_0x239c4e(0x1d1)](_0x239c4e(0x1ff)),0x1;_0x128a8f=_0x577b32[0x0];}else{if(!_0x335e5d[0x0])return console['error'](_0x239c4e(0x1e0)),console['error'](_0x239c4e(0x1d7)),0x1;_0x128a8f=_0x335e5d[0x0];}_0x5eb626[_0x239c4e(0x1d9)]&&(console['error'](_0x239c4e(0x1b4)+_0x3e8c61),console[_0x239c4e(0x1d1)](_0x239c4e(0x1ef)+_0x55e2e9),console[_0x239c4e(0x1d1)](_0x239c4e(0x1fc)+_0x128a8f['substring'](0x0,0x64)+(_0x128a8f[_0x239c4e(0x1de)]>0x64?'...':'')));const _0x129ac9=await withSpinner(_0x239c4e(0x1bc),()=>_0x3cd503[_0x239c4e(0x1f4)][_0x239c4e(0x1da)](_0x55e2e9,_0x128a8f,_0x3e8c61),{'verbose':_0x5eb626[_0x239c4e(0x1d9)]}),_0x1e61ff=_0x129ac9[_0x239c4e(0x1bb)];return console[_0x239c4e(0x1d1)]('✔\x20Job\x20submitted'),console['error']('\x20\x20Job\x20ID:\x20'+_0x1e61ff[_0x239c4e(0x1c6)]),await handleSDKOutput([_0x1e61ff],_0x5eb626),0x0;}catch(_0x331c86){if(_0x331c86 instanceof SDKError)return console['error']('Error:\x20'+_0x331c86[_0x239c4e(0x1be)]),_0x331c86[_0x239c4e(0x1f3)]&&console[_0x239c4e(0x1d1)](_0x239c4e(0x1f6)+_0x331c86[_0x239c4e(0x1f3)]),0x1;throw _0x331c86;}}}export class JobResultCommand extends BaseCommand{[a17_0xbf8c15(0x1ce)]=a17_0xbf8c15(0x1e4);['description']=a17_0xbf8c15(0x1c4);async[a17_0xbf8c15(0x1b5)](_0x58603f){const _0x241132=a17_0xbf8c15,{options:_0x3e5577,args:_0x3511b8,tdx:_0x358696}=_0x58603f,_0x50f568=_0x3511b8[0x0];if(!_0x50f568)return console['error']('Error:\x20Job\x20ID\x20is\x20required'),console[_0x241132(0x1d1)](_0x241132(0x1f7)),0x1;try{const _0x521b6f=await withSpinner(_0x241132(0x1bd),()=>_0x358696[_0x241132(0x1f4)][_0x241132(0x1ea)](_0x50f568),{'verbose':_0x3e5577[_0x241132(0x1d9)]}),_0x323432=_0x521b6f[_0x241132(0x1bb)];return console['error']('✔\x20Retrieved\x20'+_0x323432[_0x241132(0x1de)]+_0x241132(0x1df)+(_0x323432[_0x241132(0x1de)]!==0x1?'s':'')),await handleSDKOutput(_0x323432,_0x3e5577),0x0;}catch(_0x4491f8){if(_0x4491f8 instanceof SDKError)return console[_0x241132(0x1d1)](_0x241132(0x1b6)+_0x4491f8[_0x241132(0x1be)]),_0x4491f8[_0x241132(0x1f3)]&&console[_0x241132(0x1d1)]('\x20\x20Cause:\x20'+_0x4491f8[_0x241132(0x1f3)]),0x1;throw _0x4491f8;}}}
@@ -1 +1 @@
1
- const a18_0x1f87e3=a18_0x61b5;(function(_0x1e6c7d,_0x1419c4){const _0x27cc0d=a18_0x61b5,_0x5d7756=_0x1e6c7d();while(!![]){try{const _0x3e4bfe=-parseInt(_0x27cc0d(0x7b))/0x1*(parseInt(_0x27cc0d(0x79))/0x2)+parseInt(_0x27cc0d(0x82))/0x3+parseInt(_0x27cc0d(0x9d))/0x4+-parseInt(_0x27cc0d(0x90))/0x5+parseInt(_0x27cc0d(0x8f))/0x6+-parseInt(_0x27cc0d(0x143))/0x7*(-parseInt(_0x27cc0d(0xa3))/0x8)+-parseInt(_0x27cc0d(0x8d))/0x9;if(_0x3e4bfe===_0x1419c4)break;else _0x5d7756['push'](_0x5d7756['shift']());}catch(_0x4ba414){_0x5d7756['push'](_0x5d7756['shift']());}}}(a18_0x2663,0x38884));import a18_0x45756c from'chalk';import a18_0x965be4 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';function a18_0x61b5(_0x179129,_0x456d78){_0x179129=_0x179129-0x75;const _0x26638e=a18_0x2663();let _0x61b52=_0x26638e[_0x179129];return _0x61b52;}function a18_0x2663(){const _0x23987f=['helpText','launched','segmentPushCommand','24jCcSfG','Getting\x20journey\x20statistics...','25303bEMlck','\x20\x20Statistics\x20not\x20available','parentSegment','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Aborted.','type','getSegment','1030419fIHOou','versionNumber','dryRun','segments','get','includeStats','Cancelled','journeyBundleName','(root)','resolveParentId','red','1917162bkHmBP','\x20(rule\x20match)','376836ndOAlk','1484425DAPYhJ','✔\x20Context\x20set:\x20','\x20\x20Target:\x20','journey:stats','✔\x20All\x20files\x20are\x20up\x20to\x20date','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','\x20files?','dim','resourceName','Folder\x20path:\x20','totalGoalAchieved','Found\x20','journey','1006968OCFiMG','Warning:\x20Stage\x20\x22','\x20Opening\x20','Show\x20journey\x20details','session','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','16CFvJvH','\x20new\x20files','✔\x20Found\x20','Error:\x20Parent\x20segment\x20context\x20required','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','Write\x20','draft','listJourneysFromParentSegment','map','/e/','Options:','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','audienceId','resolveJourneyId','Usage:\x20journey\x20resume\x20<name-or-path>','description','file','\x20journey','all','\x20(paused)','stringify','sort','\x20=\x20','pause','Error:\x20','yellow','\x20\x20Folder\x20path:\x20','state','log','Resolving\x20parent\x20segment...','\x20journeys','absolutePath','table','Resolved\x20YAML\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','getActivation','json','Parent\x20segment:\x20','Resuming\x20journey...','INVALID_ARGUMENT','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','listFolders','archived','error','join','values','\x20versions)','activationParams','Usage:\x20journey\x20stats\x20<name-or-path>','activation_','stages','Journey\x20name:\x20','\x20unchanged\x20files','site','hasChanges','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','Fetching\x20folders...','message','\x27\x20not\x20found\x20in\x20','paused','journey:list','name','\x20\x20Parent\x20segment:\x20','getJourney','connector_config','Pausing\x20journey...','journeyBundleId','size','population','attributes','...','relativePath','cyan','/app/ps/','Error:\x20Journey\x20\x27','split','resolveSegment','Export\x20journey(s)\x20as\x20YAML\x20files','stage','journeyName','No\x20journeys\x20found','/j/da','\x20(ID:\x20','yes','verbose','No\x20statistics\x20available\x20for\x20journey:\x20','errorCode','test','setPhase','connection','\x20\x20Name:\x20','execute','Input:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','folderId','format','content','add','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','resume','has','options','Resolving\x20journey...','toLowerCase','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','set','segmentName','then','buildIdToEmailMap','getStatistics','Target\x20directory:\x20','no_parent','relative','parent_segment','entered','goalRate','journey:resume','📁\x20','Listing\x20journeys...','user','conversionRate','push','segment','\x0aPull\x20summary:','journey:pull','.yml','web','List\x20journeys\x20in\x20current\x20context','totalEntered','isNew','Pause\x20a\x20running\x20journey','stageName','/j/da/je','\x20\x20-\x20','\x22\x20not\x20found','green','kind','filePath','Error:\x20Journey\x20not\x20found:\x20','Fetching\x20connections\x20for\x20name\x20resolution...','\x22\x20paused','utf-8','rule','Resume\x20a\x20paused\x20journey','journeyId','Fetching\x20parent\x20segment...','Fetching\x20','exited','Warning:\x20Could\x20not\x20resolve\x20activation\x20','journey:push','folderPath','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','reentryMode','filter','✔\x20Journey\x20\x22','data','repeat','cwd','1354759tzRIat','goal','length','find','\x0aChanges\x20to\x20\x27','Usage:\x20journey\x20pause\x20<name-or-path>','rootFolderId','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','root\x20folder','\x5c$&'];a18_0x2663=function(){return _0x23987f;};return a18_0x2663();}import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function formatJourneyState(_0x2525d6){const _0x541b78=a18_0x61b5;switch(_0x2525d6){case _0x541b78(0x77):return a18_0x45756c['green'](_0x2525d6);case _0x541b78(0xa9):return a18_0x45756c['gray'](_0x2525d6);case _0x541b78(0xce):return a18_0x45756c[_0x541b78(0x97)](_0x2525d6);default:return _0x2525d6;}}function formatJourneyItem(_0x5af528,_0x3df9c6='',_0x428844){const _0xc1c9e5=a18_0x61b5,_0x330961=formatJourneyState(_0x5af528[_0xc1c9e5(0xbe)]),_0x1ab85d=_0x5af528[_0xc1c9e5(0xdf)]?a18_0x45756c[_0xc1c9e5(0xbc)](_0xc1c9e5(0xb6)):'',_0x55303f=_0x428844?'\x20'+a18_0x45756c[_0xc1c9e5(0xec)](_0x428844):'';return _0x3df9c6+'🗺️\x20'+_0x5af528[_0xc1c9e5(0x89)]+'\x20('+_0x330961+')'+_0x1ab85d+_0x55303f;}function escapeRegex(_0x586439){const _0x24248f=a18_0x61b5;return _0x586439['replace'](/[.*+?^${}()|[\]\\]/g,_0x24248f(0x75));}function globToRegex(_0x35371d){const _0x123c32=a18_0x61b5,_0x5c088c=_0x35371d[_0x123c32(0xef)]('*')[_0x123c32(0xab)](escapeRegex);return new RegExp(_0x5c088c['join']('.*'),'i');}function buildRuleToNameMapping(_0x2e18c6){const _0xde567c=a18_0x61b5,_0x1e5476=new Map();if(_0x2e18c6[_0xde567c(0x85)])for(const [_0x4ffc31,_0x3ec567]of Object['entries'](_0x2e18c6[_0xde567c(0x85)])){if(_0x3ec567[_0xde567c(0x133)]){const _0x53c1ab=serializeRule(_0x3ec567[_0xde567c(0x133)]),_0x4fd28b=_0x1e5476['get'](_0x53c1ab);_0x4fd28b?_0x4fd28b[_0xde567c(0x11e)](_0x4ffc31):_0x1e5476[_0xde567c(0x10e)](_0x53c1ab,[_0x4ffc31]);}}return _0x1e5476;}async function resolveJourneyTarget(_0x363b68,_0x1085a3,_0x15aee7){const _0x41823e=a18_0x61b5;if(isYamlFilePath(_0x363b68))try{const _0x24eccd=await resolveYamlFilePath(_0x363b68);return _0x15aee7&&(console[_0x41823e(0xcf)](_0x41823e(0xc4)+_0x363b68),console[_0x41823e(0xcf)](_0x41823e(0xe2)+_0x24eccd[_0x41823e(0x7d)]),console['error'](_0x41823e(0xfe)+_0x24eccd[_0x41823e(0x10f)]),console[_0x41823e(0xcf)](_0x41823e(0xbd)+(_0x24eccd[_0x41823e(0x13b)]||_0x41823e(0x8a)))),{'journeyName':_0x24eccd[_0x41823e(0x10f)],'parentSegment':_0x24eccd[_0x41823e(0x7d)],'resolved':_0x24eccd};}catch(_0x4d38c0){throw new SDKError(ErrorCode[_0x41823e(0xcb)],_0x41823e(0xcc)+_0x4d38c0[_0x41823e(0xdd)]);}if(!_0x1085a3)throw new SDKError(ErrorCode[_0x41823e(0xcb)],_0x41823e(0x10d));return{'journeyName':_0x363b68,'parentSegment':_0x1085a3};}export class JourneyListCommand extends BaseCommand{[a18_0x1f87e3(0xe1)]=a18_0x1f87e3(0xe0);[a18_0x1f87e3(0xb2)]=a18_0x1f87e3(0x124);async[a18_0x1f87e3(0xff)](_0x2f8dbc){const _0x1adbfc=a18_0x1f87e3,{options:_0x32a62d,args:_0x2657c1,tdx:_0x5d6ce6}=_0x2f8dbc,_0x3bc7aa=_0x2657c1[0x0],_0x563c77=_0x32a62d[_0x1adbfc(0x123)],_0xf2084f=_0x32a62d[_0x1adbfc(0x7d)];if(!_0xf2084f)return console['error'](_0x1adbfc(0xa6)),console[_0x1adbfc(0xcf)](_0x1adbfc(0xae)),0x1;const _0x29decd=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x5d6ce6[_0x1adbfc(0x11f)][_0x1adbfc(0x8b)](_0xf2084f),{'verbose':_0x32a62d[_0x1adbfc(0xf8)]}),_0x1ea759=_0x29decd[_0x1adbfc(0x140)];_0x32a62d[_0x1adbfc(0xf8)]&&(console[_0x1adbfc(0xcf)](_0x1adbfc(0xc9)+_0xf2084f+_0x1adbfc(0xf6)+_0x1ea759+')'),_0x3bc7aa&&console['error']('Pattern:\x20'+_0x3bc7aa));const [_0x1fa2be,_0x53b79a,_0x1c4468]=await Promise[_0x1adbfc(0xb5)]([withSpinner(_0x1adbfc(0x136),()=>_0x5d6ce6['segment']['getParentFull'](_0x1ea759),{'verbose':_0x32a62d[_0x1adbfc(0xf8)]}),withSpinner(_0x1adbfc(0xdc),()=>_0x5d6ce6['segment']['listFolders'](_0x1ea759),{'verbose':_0x32a62d[_0x1adbfc(0xf8)]}),withSpinner('Listing\x20journeys...',()=>_0x5d6ce6['journey'][_0x1adbfc(0xaa)](_0x1ea759),{'verbose':_0x32a62d[_0x1adbfc(0xf8)]})]),_0x22ee36=_0x1fa2be[_0x1adbfc(0x140)],_0x15c101=_0x53b79a[_0x1adbfc(0x140)];let _0x49abf3=_0x1c4468['data'];const _0x1a8819=_0x22ee36[_0x1adbfc(0x149)],_0x5d10e3=new Map();for(const _0x310792 of _0x15c101){_0x5d10e3[_0x1adbfc(0x10e)](_0x310792['id'],_0x310792[_0x1adbfc(0xe1)]);}if(_0x3bc7aa){const _0x1d2105=globToRegex(_0x3bc7aa);_0x49abf3=_0x49abf3[_0x1adbfc(0x13e)](_0x53b445=>_0x1d2105[_0x1adbfc(0xfb)](_0x53b445[_0x1adbfc(0x89)]));}console[_0x1adbfc(0xcf)](_0x1adbfc(0xa5)+_0x49abf3[_0x1adbfc(0x145)]+_0x1adbfc(0xb4)+(_0x49abf3[_0x1adbfc(0x145)]!==0x1?'s':''));const _0x25a719=_0x51a8ba=>{const _0x52268f=_0x1adbfc;return getConsoleNextUrl(_0x32a62d[_0x52268f(0xd9)],'/app/ps/'+_0x1ea759+_0x52268f(0xac)+_0x51a8ba+_0x52268f(0xf5));};if(_0x32a62d['format']===_0x1adbfc(0xc3))await handleSDKOutput(_0x49abf3,_0x32a62d);else{if(_0x32a62d[_0x1adbfc(0x104)]===_0x1adbfc(0xc8)){const _0x24d11f=_0x49abf3[_0x1adbfc(0xab)](_0x43c46c=>({..._0x43c46c,'url':_0x25a719(_0x43c46c['id'])}));await handleSDKOutput(_0x24d11f,_0x32a62d);}else{console[_0x1adbfc(0xbf)]('['+_0xf2084f+']');const _0x1c723a=new Map(),_0x7be434=[];for(const _0x318259 of _0x49abf3){if(!_0x318259[_0x1adbfc(0x103)]||_0x318259[_0x1adbfc(0x103)]===_0x1a8819)_0x7be434[_0x1adbfc(0x11e)](_0x318259);else{const _0x23189e=_0x1c723a[_0x1adbfc(0x86)](_0x318259[_0x1adbfc(0x103)])||[];_0x23189e[_0x1adbfc(0x11e)](_0x318259),_0x1c723a[_0x1adbfc(0x10e)](_0x318259['folderId'],_0x23189e);}}for(const _0x583b27 of _0x7be434){const _0x1ff6fe=_0x563c77?_0x25a719(_0x583b27['id']):undefined;console[_0x1adbfc(0xbf)](formatJourneyItem(_0x583b27,'',_0x1ff6fe));}for(const [_0x4a735e,_0x216f49]of _0x1c723a){const _0x464241=_0x5d10e3['get'](_0x4a735e)||_0x4a735e;console[_0x1adbfc(0xbf)](_0x1adbfc(0x11a)+_0x464241);for(const _0x209176 of _0x216f49){const _0x3935dd=_0x563c77?_0x25a719(_0x209176['id']):undefined;console[_0x1adbfc(0xbf)](formatJourneyItem(_0x209176,'\x20\x20',_0x3935dd));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{['name']='journey:view';[a18_0x1f87e3(0xb2)]=a18_0x1f87e3(0xa0);async[a18_0x1f87e3(0xff)](_0x1000f2){const _0x5a64bb=a18_0x1f87e3,{options:_0x5bd7f4,args:_0x5ca38f,tdx:_0x2c05c5}=_0x1000f2,_0x232ba6=_0x5ca38f[0x0];if(!_0x232ba6)return console[_0x5a64bb(0xcf)](_0x5a64bb(0x102)),console[_0x5a64bb(0xcf)]('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x5a64bb(0xcf)](_0x5a64bb(0xad)),console[_0x5a64bb(0xcf)](_0x5a64bb(0xc6)),0x1;_0x5bd7f4[_0x5a64bb(0xf8)]&&console['error'](_0x5a64bb(0x100)+_0x232ba6);const _0x15de1e=await resolveJourneyTarget(_0x232ba6,_0x5bd7f4['parentSegment'],_0x5bd7f4['verbose']),_0x34c0ed=await withSpinner(_0x5a64bb(0xc0),()=>_0x2c05c5[_0x5a64bb(0x11f)]['resolveParentId'](_0x15de1e[_0x5a64bb(0x7d)]),{'verbose':_0x5bd7f4[_0x5a64bb(0xf8)]}),_0x50821a=_0x34c0ed[_0x5a64bb(0x140)],_0x443d48=await withSpinner(_0x5a64bb(0x10b),()=>_0x2c05c5[_0x5a64bb(0x9c)][_0x5a64bb(0xb0)](_0x50821a,_0x15de1e[_0x5a64bb(0xf3)]),{'verbose':_0x5bd7f4[_0x5a64bb(0xf8)]}),_0x51c75a=_0x443d48[_0x5a64bb(0x140)];if(_0x5bd7f4[_0x5a64bb(0x123)]){const _0x159fc7=getConsoleNextUrl(_0x5bd7f4[_0x5a64bb(0xd9)],_0x5a64bb(0xed)+_0x50821a+'/e/'+_0x51c75a+'/j/da/je');return console['error'](a18_0x45756c['green']('✔')+_0x5a64bb(0x9f)+a18_0x45756c[_0x5a64bb(0xec)](_0x159fc7)),openBrowser(_0x159fc7),0x0;}const _0x25cc86=await withSpinner('Getting\x20journey\x20details...',()=>_0x2c05c5[_0x5a64bb(0x9c)][_0x5a64bb(0xe3)](_0x51c75a),{'verbose':_0x5bd7f4[_0x5a64bb(0xf8)]}),_0x5b8b67=_0x25cc86[_0x5a64bb(0x140)],_0x56814c=_0x5bd7f4[_0x5a64bb(0x87)];let _0x5f5602;if(_0x56814c)try{const _0x570f36=await withSpinner(_0x5a64bb(0x7a),()=>_0x2c05c5[_0x5a64bb(0x9c)][_0x5a64bb(0x112)](_0x51c75a),{'verbose':_0x5bd7f4['verbose']});_0x5f5602=_0x570f36[_0x5a64bb(0x140)];}catch{_0x5bd7f4[_0x5a64bb(0xf8)]&&console[_0x5a64bb(0xcf)](_0x5a64bb(0x7c));}const _0x46315a=getConsoleNextUrl(_0x5bd7f4[_0x5a64bb(0xd9)],_0x5a64bb(0xed)+_0x50821a+_0x5a64bb(0xac)+_0x51c75a+_0x5a64bb(0x129)),_0x53b4f5={'id':_0x5b8b67['id'],'name':_0x5b8b67[_0x5a64bb(0xe9)][_0x5a64bb(0xe1)],'description':_0x5b8b67['attributes'][_0x5a64bb(0xb2)],'state':_0x5b8b67['attributes'][_0x5a64bb(0xbe)],'paused':_0x5b8b67[_0x5a64bb(0xe9)][_0x5a64bb(0xdf)],'reentry_mode':_0x5b8b67[_0x5a64bb(0xe9)][_0x5a64bb(0x13d)],'stages':_0x5b8b67[_0x5a64bb(0xe9)]['journeyStages']?.[_0x5a64bb(0x145)]||0x0,..._0x5b8b67[_0x5a64bb(0xe9)][_0x5a64bb(0x144)]&&{'goal':_0x5b8b67['attributes'][_0x5a64bb(0x144)][_0x5a64bb(0xe1)]},..._0x5f5602&&{'statistics':{'total_entered':_0x5f5602[_0x5a64bb(0x125)],'goal_achieved':_0x5f5602[_0x5a64bb(0x9a)],'goal_rate':_0x5f5602['goalRate'],'stages':_0x5f5602['stages']}},'url':_0x46315a};return await handleSingleObjectOutput(_0x53b4f5,_0x5bd7f4),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x1f87e3(0xe1)]=a18_0x1f87e3(0x93);[a18_0x1f87e3(0xb2)]='Show\x20journey\x20statistics';async[a18_0x1f87e3(0xff)](_0x53dec0){const _0x197cda=a18_0x1f87e3,{options:_0x1b8173,args:_0x12274b,tdx:_0x3aa8a8}=_0x53dec0,_0x58ff06=_0x12274b[0x0];if(!_0x58ff06)return console['error']('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x197cda(0xcf)](_0x197cda(0xd4)),0x1;_0x1b8173[_0x197cda(0xf8)]&&console[_0x197cda(0xcf)](_0x197cda(0x100)+_0x58ff06);const _0x596c9b=await resolveJourneyTarget(_0x58ff06,_0x1b8173[_0x197cda(0x7d)],_0x1b8173[_0x197cda(0xf8)]),_0x2d1c76=await withSpinner(_0x197cda(0xc0),()=>_0x3aa8a8[_0x197cda(0x11f)][_0x197cda(0x8b)](_0x596c9b['parentSegment']),{'verbose':_0x1b8173[_0x197cda(0xf8)]}),_0x5233a9=_0x2d1c76[_0x197cda(0x140)],_0x443c80=await withSpinner(_0x197cda(0x10b),()=>_0x3aa8a8[_0x197cda(0x9c)][_0x197cda(0xb0)](_0x5233a9,_0x596c9b[_0x197cda(0xf3)]),{'verbose':_0x1b8173['verbose']}),_0xd559e6=_0x443c80[_0x197cda(0x140)],_0x479255=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x3aa8a8[_0x197cda(0x9c)][_0x197cda(0x112)](_0xd559e6),{'verbose':_0x1b8173[_0x197cda(0xf8)]}),_0x1380f8=_0x479255[_0x197cda(0x140)];if(!_0x1380f8||_0x1380f8['journeyId']===null)return console['error'](_0x197cda(0xf9)+_0x596c9b['journeyName']),console[_0x197cda(0xcf)]('Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),0x0;const _0x1002c3={'journey_id':_0x1380f8[_0x197cda(0x135)],'total_entered':_0x1380f8['totalEntered'],'goal_achieved':_0x1380f8[_0x197cda(0x9a)],'goal_rate':_0x1380f8[_0x197cda(0x118)],'stages':_0x1380f8[_0x197cda(0xd6)]?.[_0x197cda(0xab)](_0x27d38f=>({'name':_0x27d38f[_0x197cda(0x128)],'population':_0x27d38f[_0x197cda(0xe8)],'entered':_0x27d38f[_0x197cda(0x117)],'exited':_0x27d38f['exited'],'conversion_rate':_0x27d38f[_0x197cda(0x11d)]}))},_0x4d3afd=_0x1b8173[_0x197cda(0xf2)];if(_0x4d3afd&&_0x1380f8[_0x197cda(0xd6)]){const _0x5c9572=_0x1380f8[_0x197cda(0xd6)][_0x197cda(0x146)](_0x16439c=>_0x16439c[_0x197cda(0x128)]['toLowerCase']()===_0x4d3afd['toLowerCase']());if(_0x5c9572)return await handleSingleObjectOutput({'stage_name':_0x5c9572[_0x197cda(0x128)],'population':_0x5c9572[_0x197cda(0xe8)],'entered':_0x5c9572[_0x197cda(0x117)],'exited':_0x5c9572[_0x197cda(0x138)],'conversion_rate':_0x5c9572[_0x197cda(0x11d)]},_0x1b8173),0x0;console[_0x197cda(0xcf)](_0x197cda(0x9e)+_0x4d3afd+_0x197cda(0x12b));}return await handleSingleObjectOutput(_0x1002c3,_0x1b8173),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0x1f87e3(0xe1)]='journey:pause';[a18_0x1f87e3(0xb2)]=a18_0x1f87e3(0x127);async[a18_0x1f87e3(0xff)](_0x479312){const _0x5e82d5=a18_0x1f87e3,{options:_0x3bd92b,args:_0x4270b9,tdx:_0x2f4fe3}=_0x479312,_0x29b7ac=_0x4270b9[0x0];if(!_0x29b7ac)return console['error']('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x5e82d5(0xcf)](_0x5e82d5(0x148)),0x1;_0x3bd92b[_0x5e82d5(0xf8)]&&console[_0x5e82d5(0xcf)]('Input:\x20'+_0x29b7ac);const _0x5bad5d=await resolveJourneyTarget(_0x29b7ac,_0x3bd92b[_0x5e82d5(0x7d)],_0x3bd92b[_0x5e82d5(0xf8)]),_0x837b20=await withSpinner(_0x5e82d5(0xc0),()=>_0x2f4fe3['segment'][_0x5e82d5(0x8b)](_0x5bad5d['parentSegment']),{'verbose':_0x3bd92b[_0x5e82d5(0xf8)]}),_0x3ac5af=_0x837b20[_0x5e82d5(0x140)],_0x49ad0e=await withSpinner(_0x5e82d5(0x10b),()=>_0x2f4fe3[_0x5e82d5(0x9c)][_0x5e82d5(0xb0)](_0x3ac5af,_0x5bad5d[_0x5e82d5(0xf3)]),{'verbose':_0x3bd92b[_0x5e82d5(0xf8)]}),_0x50b3a5=_0x49ad0e[_0x5e82d5(0x140)];if(!_0x3bd92b[_0x5e82d5(0xf7)]){const _0x28fbc6=await confirm(_0x5e82d5(0xa2)+_0x5bad5d['journeyName']+'\x22?');if(!_0x28fbc6)return console['error'](_0x5e82d5(0x88)),0x0;}const _0x4cdc86=await withSpinner(_0x5e82d5(0xe5),()=>_0x2f4fe3[_0x5e82d5(0x9c)][_0x5e82d5(0xba)](_0x50b3a5),{'verbose':_0x3bd92b[_0x5e82d5(0xf8)]}),_0x34654b=_0x4cdc86[_0x5e82d5(0x140)];return console['error'](_0x5e82d5(0x13f)+_0x34654b[_0x5e82d5(0xe9)][_0x5e82d5(0xe1)]+_0x5e82d5(0x131)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x1f87e3(0xe1)]=a18_0x1f87e3(0x119);[a18_0x1f87e3(0xb2)]=a18_0x1f87e3(0x134);async[a18_0x1f87e3(0xff)](_0x1c323a){const _0x116f87=a18_0x1f87e3,{options:_0x15f1bd,args:_0x18962c,tdx:_0x2bea63}=_0x1c323a,_0x32a409=_0x18962c[0x0];if(!_0x32a409)return console[_0x116f87(0xcf)](_0x116f87(0x102)),console['error'](_0x116f87(0xb1)),0x1;_0x15f1bd['verbose']&&console[_0x116f87(0xcf)]('Input:\x20'+_0x32a409);const _0x437cf3=await resolveJourneyTarget(_0x32a409,_0x15f1bd[_0x116f87(0x7d)],_0x15f1bd[_0x116f87(0xf8)]),_0x16347e=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x2bea63[_0x116f87(0x11f)][_0x116f87(0x8b)](_0x437cf3[_0x116f87(0x7d)]),{'verbose':_0x15f1bd[_0x116f87(0xf8)]}),_0x395b58=_0x16347e[_0x116f87(0x140)],_0x242e0f=await withSpinner('Resolving\x20journey...',()=>_0x2bea63[_0x116f87(0x9c)][_0x116f87(0xb0)](_0x395b58,_0x437cf3[_0x116f87(0xf3)]),{'verbose':_0x15f1bd['verbose']}),_0x5b4ee1=_0x242e0f[_0x116f87(0x140)];if(!_0x15f1bd[_0x116f87(0xf7)]){const _0xfebb79=await confirm(_0x116f87(0xdb)+_0x437cf3['journeyName']+'\x22?');if(!_0xfebb79)return console[_0x116f87(0xcf)]('Cancelled'),0x0;}const _0x244000=await withSpinner(_0x116f87(0xca),()=>_0x2bea63['journey'][_0x116f87(0x108)](_0x5b4ee1),{'verbose':_0x15f1bd[_0x116f87(0xf8)]}),_0x53188c=_0x244000['data'];return console['error'](_0x116f87(0x13f)+_0x53188c[_0x116f87(0xe9)]['name']+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x1f87e3(0xe1)]=a18_0x1f87e3(0x121);[a18_0x1f87e3(0xb2)]=a18_0x1f87e3(0xf1);async['execute'](_0x2f9cd6){const _0x42bfc7=a18_0x1f87e3,{options:_0x24518c,args:_0x1c2bb4,tdx:_0x474f27}=_0x2f9cd6,_0x49bccf=_0x24518c,_0x31c94b=_0x1c2bb4[0x0],_0x1a6975=_0x31c94b&&isYamlFilePath(_0x31c94b),_0x4a8f5=await resolveTarget({'arg':_0x1a6975?_0x31c94b:undefined,'contextParent':_0x24518c[_0x42bfc7(0x7d)],'cwd':process[_0x42bfc7(0x142)]()});if(!isSuccessfulResolution(_0x4a8f5))return _0x4a8f5[_0x42bfc7(0xfa)]===_0x42bfc7(0x114)?(console[_0x42bfc7(0xcf)](a18_0x45756c[_0x42bfc7(0xbc)](_0x42bfc7(0x14a))),console['error']('Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)'),console['error'](_0x42bfc7(0x101)),console[_0x42bfc7(0xcf)](_0x42bfc7(0xc5)),console[_0x42bfc7(0xcf)](_0x42bfc7(0x107))):(console[_0x42bfc7(0xcf)](a18_0x45756c[_0x42bfc7(0x8c)](_0x42bfc7(0xbb)+_0x4a8f5[_0x42bfc7(0xdd)]+'\x0a')),_0x4a8f5['helpText']&&console['error'](a18_0x45756c[_0x42bfc7(0xec)](_0x4a8f5[_0x42bfc7(0x76)]))),0x1;let _0xc3890c=_0x1a6975?undefined:_0x31c94b,_0x1f767a,_0x5b52ba;_0x4a8f5[_0x42bfc7(0x80)]===_0x42bfc7(0xb3)&&(_0xc3890c=_0x4a8f5[_0x42bfc7(0x98)],_0x1f767a=_0x4a8f5[_0x42bfc7(0x12e)],_0x5b52ba=_0x4a8f5[_0x42bfc7(0x13b)]);const _0x20ed24=_0x4a8f5['parentName'],_0x4d3e01=_0x4a8f5['targetDir'];_0x49bccf[_0x42bfc7(0xf8)]&&(console[_0x42bfc7(0xcf)](_0x42bfc7(0xc9)+_0x20ed24),console[_0x42bfc7(0xcf)](_0x42bfc7(0x113)+_0x4d3e01),_0xc3890c&&console[_0x42bfc7(0xcf)](_0x42bfc7(0xd7)+_0xc3890c),_0x1f767a&&console[_0x42bfc7(0xcf)]('Target\x20file:\x20'+_0x1f767a),_0x5b52ba&&console[_0x42bfc7(0xcf)](_0x42bfc7(0x99)+_0x5b52ba));const _0x4c92f5=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x474f27[_0x42bfc7(0x11f)][_0x42bfc7(0x8b)](_0x20ed24),{'verbose':_0x24518c['verbose']}),_0x33b95a=_0x4c92f5[_0x42bfc7(0x140)],[_0x1ff55b,_0x1e347a]=await Promise[_0x42bfc7(0xb5)]([withSpinner(_0x42bfc7(0x11b),()=>_0x474f27['journey']['listJourneysFromParentSegment'](_0x33b95a),{'verbose':_0x24518c[_0x42bfc7(0xf8)]}),withSpinner('Listing\x20folders...',()=>_0x474f27[_0x42bfc7(0x11f)][_0x42bfc7(0xcd)](_0x33b95a),{'verbose':_0x24518c[_0x42bfc7(0xf8)]})]);let _0x5ebe9b=_0x1ff55b['data'];const _0x3e7d57=_0x1e347a[_0x42bfc7(0x140)],_0x67d05f=buildFolderIdToPathMap(_0x3e7d57);if(_0xc3890c){const _0x5309bf=_0x5ebe9b[_0x42bfc7(0x13e)](_0xc80cb1=>_0xc80cb1['journeyBundleName'][_0x42bfc7(0x10c)]()===_0xc3890c[_0x42bfc7(0x10c)]());if(_0x5309bf[_0x42bfc7(0x145)]===0x0)return console[_0x42bfc7(0xcf)](_0x42bfc7(0x12f)+_0xc3890c),console['error'](_0x42bfc7(0x13c)),0x1;_0x5ebe9b=_0x5309bf;}if(_0x5b52ba!==undefined){const _0x2dcc37=_0x5ebe9b[_0x42bfc7(0x13e)](_0x163490=>{const _0x52dd4f=_0x42bfc7,_0xca11ce=_0x163490[_0x52dd4f(0x103)]?_0x67d05f['get'](_0x163490[_0x52dd4f(0x103)])||'':'';return _0xca11ce===_0x5b52ba;});if(_0x2dcc37[_0x42bfc7(0x145)]===0x0&&_0x5ebe9b[_0x42bfc7(0x145)]>0x0){console['error'](_0x42bfc7(0xee)+_0xc3890c+_0x42bfc7(0xde)+(_0x5b52ba||_0x42bfc7(0x14b))),console[_0x42bfc7(0xcf)]('Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:');for(const _0x3d05b7 of _0x5ebe9b){const _0x26b252=_0x3d05b7[_0x42bfc7(0x103)]?_0x67d05f[_0x42bfc7(0x86)](_0x3d05b7[_0x42bfc7(0x103)])||'':'';console[_0x42bfc7(0xcf)](_0x42bfc7(0x12a)+(_0x26b252||'(root)')+'/'+_0x3d05b7[_0x42bfc7(0x89)]);}return 0x1;}_0x5ebe9b=_0x2dcc37;}if(_0x5ebe9b[_0x42bfc7(0x145)]===0x0)return console[_0x42bfc7(0xcf)](_0x42bfc7(0xf4)),0x0;const _0x474791=new Map();for(const _0x965cc0 of _0x5ebe9b){const _0x20a109=_0x965cc0[_0x42bfc7(0xe6)];!_0x474791['has'](_0x20a109)&&_0x474791[_0x42bfc7(0x10e)](_0x20a109,[]),_0x474791[_0x42bfc7(0x86)](_0x20a109)[_0x42bfc7(0x11e)](_0x965cc0);}for(const _0x383f69 of _0x474791[_0x42bfc7(0xd1)]()){_0x383f69[_0x42bfc7(0xb8)]((_0x57f6e5,_0x3a655c)=>(_0x57f6e5[_0x42bfc7(0x83)]||0x0)-(_0x3a655c[_0x42bfc7(0x83)]||0x0));}const _0x3fb4a2=[],[_0x4c971d,_0x542319]=await Promise[_0x42bfc7(0xb5)]([withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x474f27[_0x42bfc7(0x11c)][_0x42bfc7(0x111)](),{'verbose':_0x24518c[_0x42bfc7(0xf8)]})[_0x42bfc7(0x110)](_0x2c7e81=>_0x2c7e81[_0x42bfc7(0x140)]),withSpinner(_0x42bfc7(0x130),()=>_0x474f27[_0x42bfc7(0xfd)]['buildIdToNameMap'](),{'verbose':_0x24518c[_0x42bfc7(0xf8)]})[_0x42bfc7(0x110)](_0x2f43cb=>_0x2f43cb['data'])]);for(const _0x120292 of _0x474791[_0x42bfc7(0xd1)]()){const _0x3d303b=_0x120292[0x0][_0x42bfc7(0x89)],_0x4a8fbc=_0x120292[0x0]['folderId'],_0x552b3b=_0x4a8fbc?_0x67d05f[_0x42bfc7(0x86)](_0x4a8fbc)||'':'',_0x42951c=_0x552b3b?a18_0x965be4[_0x42bfc7(0xd0)](_0x4d3e01,_0x552b3b):_0x4d3e01,_0x27abb7=_0x1f767a||a18_0x965be4[_0x42bfc7(0xd0)](_0x42951c,sanitizeFileName(_0x3d303b)+_0x42bfc7(0x122));let _0x7aaae0,_0x4bf12e;if(existsSync(_0x27abb7))try{const _0x13d2c3=readFileSync(_0x27abb7,_0x42bfc7(0x132)),_0x52bb82=parseYamlString(_0x13d2c3);_0x4bf12e=_0x52bb82,_0x7aaae0=buildRuleToNameMapping(_0x52bb82),_0x49bccf[_0x42bfc7(0xf8)]&&_0x7aaae0[_0x42bfc7(0xe7)]>0x0&&console[_0x42bfc7(0xcf)](_0x42bfc7(0x9b)+_0x7aaae0[_0x42bfc7(0xe7)]+_0x42bfc7(0x95)+_0x3d303b);}catch(_0x114309){_0x49bccf[_0x42bfc7(0xf8)]&&console[_0x42bfc7(0xcf)]('Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20'+_0x114309['message']);}const _0x5e7e6a=[],_0xf22768=new Set(),_0xb008c6=new Map(),_0x10a4ff=new Map(),_0x5ee211=new Set(),_0x5e57a8=new Map(),_0x1436b1=new Map(),_0x3ff96e=createJumpTargetCache();await withProgressSpinner(_0x42bfc7(0x137)+_0x3d303b+_0x42bfc7(0xea),async _0x53e97e=>{const _0x3e8b8e=_0x42bfc7;for(const _0x38c28d of _0x120292){const _0x18e35a=_0x120292[_0x3e8b8e(0x145)]>0x1?_0x38c28d['journeyBundleName']+'\x20v'+(_0x38c28d[_0x3e8b8e(0x83)]||0x1):_0x38c28d[_0x3e8b8e(0x89)];_0x53e97e[_0x3e8b8e(0xfc)](_0x3e8b8e(0x137)+_0x18e35a);const _0x956d1e=await _0x474f27[_0x3e8b8e(0x9c)][_0x3e8b8e(0xe3)](_0x38c28d['id']),_0x37c89f=_0x956d1e[_0x3e8b8e(0xe9)]?.[_0x3e8b8e(0xaf)],_0x42107={'resolveSegment':async _0xcfc0dd=>{const _0x3dec1e=_0x3e8b8e;if(!_0x37c89f)return{'name':_0xcfc0dd,'isJourneyLocal':![]};const _0x1303da=_0xb008c6[_0x3dec1e(0x86)](_0xcfc0dd);if(_0x1303da)return _0x1303da;try{const _0x3a1930=await _0x474f27[_0x3dec1e(0x11f)][_0x3dec1e(0x81)](_0x37c89f,_0xcfc0dd),_0x6b76bc=_0x3a1930[_0x3dec1e(0x12d)]===SEGMENT_KIND_JOURNEY;let _0x30533a,_0x1122a0=_0x3a1930['name'];if(_0x6b76bc&&_0x3a1930['rule']){const _0x48ad55=await segmentResponseToDef(_0x3a1930,{'resolveSegmentName':async _0x3611c6=>{const _0x18d144=_0x3dec1e,_0x3a82c9=_0xb008c6['get'](_0x3611c6);if(_0x3a82c9)return _0x3a82c9[_0x18d144(0xe1)];const _0x455e1e=await _0x42107[_0x18d144(0xf0)](_0x3611c6);return _0x455e1e['name'];}}),_0x4c4239=_0x48ad55['rule'];_0x30533a={'description':_0x3a1930[_0x3dec1e(0xb2)],'rule':_0x4c4239};const _0x371352=serializeRule(_0x4c4239),_0x17a818=_0x10a4ff[_0x3dec1e(0x86)](_0x371352);if(_0x17a818)_0x1122a0=_0x17a818,_0x30533a=undefined,_0x49bccf[_0x3dec1e(0xf8)]&&console[_0x3dec1e(0xcf)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x3a1930[_0x3dec1e(0xe1)]+'\x20->\x20'+_0x17a818);else{let _0x4d52cf=![];if(_0x7aaae0){const _0xc93998=_0x7aaae0[_0x3dec1e(0x86)](_0x371352);if(_0xc93998){const _0x21778d=_0xc93998[_0x3dec1e(0x146)](_0x2d71be=>!_0xf22768[_0x3dec1e(0x109)](_0x2d71be));_0x21778d&&(_0x1122a0=_0x21778d,_0xf22768[_0x3dec1e(0x106)](_0x21778d),_0x10a4ff[_0x3dec1e(0x10e)](_0x371352,_0x21778d),_0x4d52cf=!![],_0x49bccf[_0x3dec1e(0xf8)]&&console[_0x3dec1e(0xcf)]('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x21778d+_0x3dec1e(0x8e)));}}if(!_0x4d52cf){const _0x1f9f27=generateJourneyLocalName(_0x3a1930[_0x3dec1e(0xe1)]);_0x1f9f27&&(_0x1122a0=_0x1f9f27);let _0x1238b0=_0x1122a0,_0x33414a=0x2;while(_0xf22768[_0x3dec1e(0x109)](_0x1238b0)){_0x1238b0=_0x1122a0+'_'+_0x33414a,_0x33414a++;}_0xf22768[_0x3dec1e(0x106)](_0x1238b0),_0x10a4ff[_0x3dec1e(0x10e)](_0x371352,_0x1238b0),_0x1122a0=_0x1238b0;}}}const _0x4b9748={'name':_0x1122a0,'isJourneyLocal':_0x6b76bc,'definition':_0x30533a};return _0xb008c6[_0x3dec1e(0x10e)](_0xcfc0dd,_0x4b9748),_0x4b9748;}catch(_0x9db73e){return _0x24518c[_0x3dec1e(0xf8)]&&console[_0x3dec1e(0xcf)]('Warning:\x20Could\x20not\x20resolve\x20segment\x20'+_0xcfc0dd+':\x20'+_0x9db73e[_0x3dec1e(0xdd)]),{'name':_0xcfc0dd,'isJourneyLocal':![]};}},'resolveActivation':async _0x58dc0b=>{const _0x187177=_0x3e8b8e,_0x4769f6=_0x5e57a8[_0x187177(0x86)](_0x58dc0b);if(_0x4769f6)return _0x4769f6;try{const _0x7574a4=await _0x474f27[_0x187177(0x9c)][_0x187177(0xc7)](_0x38c28d['id'],_0x58dc0b),_0x50c40d=journeyActivationStepToYaml(_0x7574a4,_0x4c971d,_0x542319),_0x450f94=JSON[_0x187177(0xb7)]({'name':_0x50c40d[_0x187177(0xe1)],'connection':_0x50c40d['connection'],'connector_config':_0x50c40d[_0x187177(0xe4)]}),_0x2f9297=_0x1436b1[_0x187177(0x86)](_0x450f94);if(_0x2f9297){const _0x1e6167={'name':_0x2f9297,'isJourneyLocal':!![],'definition':_0x50c40d};return _0x5e57a8[_0x187177(0x10e)](_0x58dc0b,_0x1e6167),_0x1e6167;}const _0x3269d6=_0x7574a4[_0x187177(0xe9)][_0x187177(0xd3)][_0x187177(0xe1)]||_0x58dc0b,_0x33887a=sanitizeYamlKey(_0x3269d6)||_0x187177(0xd5)+_0x58dc0b;let _0x38a385=_0x33887a,_0x9745cd=0x2;while(_0x5ee211[_0x187177(0x109)](_0x38a385)){_0x38a385=_0x33887a+'_'+_0x9745cd,_0x9745cd++;}_0x5ee211[_0x187177(0x106)](_0x38a385),_0x1436b1[_0x187177(0x10e)](_0x450f94,_0x38a385);const _0x49f103={'name':_0x38a385,'isJourneyLocal':!![],'definition':_0x50c40d};return _0x5e57a8['set'](_0x58dc0b,_0x49f103),_0x49f103;}catch(_0x4d1143){return _0x24518c[_0x187177(0xf8)]&&console[_0x187177(0xcf)](_0x187177(0x139)+_0x58dc0b+':\x20'+_0x4d1143['message']),{'name':_0x58dc0b,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x361c48,_0x3c9683)=>{const _0x5b1e51=_0x3e8b8e;return resolveJumpTarget(_0x361c48,_0x3c9683,_0x3ff96e,_0xdc73fd=>_0x474f27[_0x5b1e51(0x9c)]['getJourney'](_0xdc73fd));}},_0x4a6074=await journeyResponseToDef(_0x956d1e,_0x42107);_0x5e7e6a['push']({'item':_0x38c28d,'yaml':_0x4a6074});}},{'verbose':_0x24518c[_0x42bfc7(0xf8)]});const _0x5260e3=buildMergedJourneyDef(_0x5e7e6a,_0x7aaae0),_0x5997c4=normalizeJourneyDef(_0x5260e3,_0x4bf12e),_0x193ddd=toYamlString(_0x5997c4),_0x34503a=_0x1f767a||a18_0x965be4['join'](_0x42951c,sanitizeFileName(_0x3d303b)+_0x42bfc7(0x122));!_0x1f767a&&_0x552b3b&&!existsSync(_0x42951c)&&mkdirSync(_0x42951c,{'recursive':!![]});const _0x581b7b=a18_0x965be4[_0x42bfc7(0x115)](process[_0x42bfc7(0x142)](),_0x34503a);if(existsSync(_0x34503a)){const _0x15ce0e=readFileSync(_0x34503a,_0x42bfc7(0x132)),_0x8f72a1=generateDiff(_0x15ce0e,_0x193ddd),_0x3112af=hasChanges(_0x8f72a1);_0x3fb4a2[_0x42bfc7(0x11e)]({'relativePath':_0x581b7b,'absolutePath':_0x34503a,'content':_0x193ddd,'isNew':![],'hasChanges':_0x3112af,'diff':_0x3112af?formatDiffWithColors(_0x8f72a1):undefined});}else _0x3fb4a2['push']({'relativePath':_0x581b7b,'absolutePath':_0x34503a,'content':_0x193ddd,'isNew':!![],'hasChanges':![]});}const _0x4d35ce=_0x3fb4a2['filter'](_0x3d8413=>_0x3d8413[_0x42bfc7(0x126)]),_0x58d2d7=_0x3fb4a2[_0x42bfc7(0x13e)](_0x274e8b=>!_0x274e8b['isNew']&&_0x274e8b[_0x42bfc7(0xda)]),_0x262e02=_0x3fb4a2['filter'](_0x582647=>!_0x582647[_0x42bfc7(0x126)]&&!_0x582647[_0x42bfc7(0xda)]),_0x55d973=_0x5ebe9b['length'],_0x31f3a8=_0x474791[_0x42bfc7(0xe7)],_0x163af6=_0x55d973>_0x31f3a8?'\x20('+_0x55d973+_0x42bfc7(0xd2):'';console[_0x42bfc7(0xcf)](_0x42bfc7(0x120)),console[_0x42bfc7(0xcf)]('\x20\x20'+a18_0x45756c['cyan'](_0x31f3a8+_0x42bfc7(0xc1))+a18_0x45756c[_0x42bfc7(0x97)](_0x163af6)),console['error']('\x20\x20'+a18_0x45756c[_0x42bfc7(0x12c)]('+\x20'+_0x4d35ce[_0x42bfc7(0x145)]+_0x42bfc7(0xa4))),console[_0x42bfc7(0xcf)]('\x20\x20'+a18_0x45756c[_0x42bfc7(0xbc)]('~\x20'+_0x58d2d7[_0x42bfc7(0x145)]+'\x20changed\x20files')),console[_0x42bfc7(0xcf)]('\x20\x20'+a18_0x45756c[_0x42bfc7(0x97)]('=\x20'+_0x262e02[_0x42bfc7(0x145)]+_0x42bfc7(0xd8))),console['error'](_0x42bfc7(0x92)+a18_0x45756c[_0x42bfc7(0xec)](_0x4d3e01)+'\x0a');if(_0x58d2d7[_0x42bfc7(0x145)]>0x0)for(const _0x24c641 of _0x58d2d7){console['error'](_0x42bfc7(0x147)+_0x24c641[_0x42bfc7(0xeb)]+'\x27:'),console[_0x42bfc7(0xcf)]('─'['repeat'](0x3c)),console[_0x42bfc7(0xcf)](_0x24c641['diff']),console[_0x42bfc7(0xcf)]('─'[_0x42bfc7(0x141)](0x3c));}if(_0x49bccf[_0x42bfc7(0x84)])return console[_0x42bfc7(0xcf)](a18_0x45756c['yellow'](_0x42bfc7(0x7e))),0x0;if(_0x4d35ce[_0x42bfc7(0x145)]===0x0&&_0x58d2d7['length']===0x0)return console[_0x42bfc7(0xcf)](a18_0x45756c[_0x42bfc7(0x12c)](_0x42bfc7(0x94))),saveSessionContext({'parent_segment':_0x20ed24},_0x49bccf[_0x42bfc7(0xa1)]),console[_0x42bfc7(0xcf)](a18_0x45756c[_0x42bfc7(0x12c)](_0x42bfc7(0x91)+a18_0x45756c[_0x42bfc7(0x97)]('parent_segment')+'\x20=\x20'+a18_0x45756c[_0x42bfc7(0xec)](_0x20ed24))),0x0;if(!_0x49bccf[_0x42bfc7(0xf7)]&&(_0x4d35ce[_0x42bfc7(0x145)]>0x0||_0x58d2d7['length']>0x0)){const _0x1685dd=await confirmKey(_0x42bfc7(0xa8)+(_0x4d35ce[_0x42bfc7(0x145)]+_0x58d2d7[_0x42bfc7(0x145)])+_0x42bfc7(0x96));if(!_0x1685dd)return console['error'](_0x42bfc7(0x7f)),0x1;}!existsSync(_0x4d3e01)&&mkdirSync(_0x4d3e01,{'recursive':!![]});for(const _0x84ec30 of _0x3fb4a2){(_0x84ec30[_0x42bfc7(0x126)]||_0x84ec30[_0x42bfc7(0xda)])&&writeFileSync(_0x84ec30[_0x42bfc7(0xc2)],_0x84ec30[_0x42bfc7(0x105)],'utf-8');}return console['error'](a18_0x45756c[_0x42bfc7(0x12c)]('✔\x20Pulled\x20'+(_0x4d35ce[_0x42bfc7(0x145)]+_0x58d2d7[_0x42bfc7(0x145)])+'\x20journey\x20files\x20to\x20'+_0x4d3e01)),saveSessionContext({'parent_segment':_0x20ed24},_0x49bccf[_0x42bfc7(0xa1)]),console[_0x42bfc7(0xcf)](a18_0x45756c[_0x42bfc7(0x12c)](_0x42bfc7(0x91)+a18_0x45756c[_0x42bfc7(0x97)](_0x42bfc7(0x116))+_0x42bfc7(0xb9)+a18_0x45756c[_0x42bfc7(0xec)](_0x20ed24))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x1f87e3(0xe1)]=a18_0x1f87e3(0x13a);['description']=a18_0x1f87e3(0xa7);[a18_0x1f87e3(0x78)]=new SegmentPushCommand();async[a18_0x1f87e3(0xff)](_0x147512){const _0xe6cffb=a18_0x1f87e3,_0x2d2e33={..._0x147512,'options':{..._0x147512[_0xe6cffb(0x10a)],'journeysOnly':!![]}};return this[_0xe6cffb(0x78)]['execute'](_0x2d2e33);}}
1
+ const a18_0xc8fd7f=a18_0x2148;(function(_0x589bfb,_0x17a8a6){const _0x315c02=a18_0x2148,_0x2d34e3=_0x589bfb();while(!![]){try{const _0x5d6075=parseInt(_0x315c02(0x1c5))/0x1+parseInt(_0x315c02(0x190))/0x2*(parseInt(_0x315c02(0x12b))/0x3)+parseInt(_0x315c02(0x171))/0x4*(parseInt(_0x315c02(0x1ae))/0x5)+parseInt(_0x315c02(0x1b4))/0x6+-parseInt(_0x315c02(0x174))/0x7+-parseInt(_0x315c02(0x1e8))/0x8+-parseInt(_0x315c02(0x15b))/0x9*(parseInt(_0x315c02(0x120))/0xa);if(_0x5d6075===_0x17a8a6)break;else _0x2d34e3['push'](_0x2d34e3['shift']());}catch(_0x4156eb){_0x2d34e3['push'](_0x2d34e3['shift']());}}}(a18_0x30cf,0x2877a));import a18_0x4f3c23 from'chalk';import a18_0xd5d9ec from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';function a18_0x30cf(){const _0x37e49c=['parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Folder\x20path:\x20','population','dim','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','root\x20folder','web','parentSegment','toLowerCase','rule','map','journey:pause','file','errorCode','setPhase','Getting\x20journey\x20details...','segmentName','/j/da/je','parentName','274xSpMYe','find','journey:pull','Warning:\x20Could\x20not\x20resolve\x20activation\x20','verbose','helpText','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','add','red','Fetching\x20folders...','Fetching\x20connections\x20for\x20name\x20resolution...','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','replace','Fetching\x20','Write\x20','green','Target\x20directory:\x20','\x20unchanged\x20files','archived','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','Resolving\x20parent\x20segment...','content','execute','utf-8','\x27\x20not\x20found\x20in\x20','versionNumber','journeyName','includeStats','push','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','507865kQksve','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','Export\x20journey(s)\x20as\x20YAML\x20files','(root)','activation_','\x0aPull\x20summary:','1722930KPLxxq','Journey\x20name:\x20','test','segments','journey:resume','no_parent','journeyBundleName','repeat','listFolders','Resuming\x20journey...','connection','Found\x20','\x20\x20Statistics\x20not\x20available','folderId','attributes','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','size','187287IImlZS','Warning:\x20Could\x20not\x20resolve\x20segment\x20','paused','✔\x20Found\x20','\x20journeys','cyan','activationParams','relative','sort','Usage:\x20journey\x20pause\x20<name-or-path>','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','set','all','targetDir','conversionRate','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','\x20(paused)','Error:\x20Journey\x20\x27','No\x20journeys\x20found','Error:\x20Parent\x20segment\x20context\x20required','Cancelled','state','Show\x20journey\x20statistics','user','yes','totalEntered','INVALID_ARGUMENT','site','hasChanges','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','Options:','\x5c$&','session','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','256960FtVtir','Aborted.','absolutePath','goal','1404680iDnqYE','\x20\x20Preserving\x20local\x20segment\x20name:\x20','goalRate','journeyStages','✔\x20Context\x20set:\x20','getSegment','join','\x22\x20resumed','Resolved\x20YAML\x20file:\x20','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Pausing\x20journey...','6927QeSnbI','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','buildIdToEmailMap','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','\x20new\x20files','resume','Pause\x20a\x20running\x20journey','segmentPushCommand','getStatistics','Pattern:\x20','Resolving\x20journey...','\x22\x20not\x20found','isNew','resolveJourneyId','Listing\x20journeys...','✔\x20Journey\x20\x22','Listing\x20folders...','journeyBundleId','\x20files?','draft','🗺️\x20','journey:list','\x20\x20Parent\x20segment:\x20','get','entered','then','\x20versions)','getJourney','journey','stage','yellow','getActivation','Show\x20journey\x20details','Fetching\x20parent\x20segment...','/e/','diff','parent_segment','\x20\x20Folder\x20path:\x20','filePath','\x22\x20paused','entries','resolveSegment','values','Parent\x20segment:\x20','Fetching\x20users\x20for\x20email\x20resolution...','totalGoalAchieved','resolveParentId','name','27fpSElK','Usage:\x20journey\x20resume\x20<name-or-path>','Getting\x20journey\x20statistics...','filter','message','/app/ps/','Warning:\x20Stage\x20\x22','\x20=\x20','journeyId','relativePath','format','listJourneysFromParentSegment','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)','folderPath','segment','journey:view','\x20->\x20','description','journey:stats','stages','stageName','data','4AZaSbE','log','Usage:\x20journey\x20stats\x20<name-or-path>','1911490PoIQGr','length','\x20Opening\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','error','has','exited','\x20journey\x20files\x20to\x20','Input:\x20'];a18_0x30cf=function(){return _0x37e49c;};return a18_0x30cf();}function a18_0x2148(_0x1216f1,_0x5d53fe){_0x1216f1=_0x1216f1-0x11e;const _0x30cf5a=a18_0x30cf();let _0x2148d9=_0x30cf5a[_0x1216f1];return _0x2148d9;}import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function formatJourneyState(_0x228ddf){const _0x4c8d46=a18_0x2148;switch(_0x228ddf){case'launched':return a18_0x4f3c23[_0x4c8d46(0x19f)](_0x228ddf);case _0x4c8d46(0x13e):return a18_0x4f3c23['gray'](_0x228ddf);case _0x4c8d46(0x1a2):return a18_0x4f3c23[_0x4c8d46(0x180)](_0x228ddf);default:return _0x228ddf;}}function formatJourneyItem(_0x3e472d,_0x5880b4='',_0x1a1a6a){const _0x215551=a18_0x2148,_0x38399e=formatJourneyState(_0x3e472d[_0x215551(0x1db)]),_0x1c4c94=_0x3e472d[_0x215551(0x1c7)]?a18_0x4f3c23['yellow'](_0x215551(0x1d6)):'',_0x1edc11=_0x1a1a6a?'\x20'+a18_0x4f3c23['cyan'](_0x1a1a6a):'';return _0x5880b4+_0x215551(0x13f)+_0x3e472d['journeyBundleName']+'\x20('+_0x38399e+')'+_0x1c4c94+_0x1edc11;}function escapeRegex(_0x9d1a90){const _0x556278=a18_0x2148;return _0x9d1a90[_0x556278(0x19c)](/[.*+?^${}()|[\]\\]/g,_0x556278(0x1e5));}function globToRegex(_0x2f6956){const _0x730fa0=a18_0x2148,_0x1b4382=_0x2f6956['split']('*')[_0x730fa0(0x187)](escapeRegex);return new RegExp(_0x1b4382['join']('.*'),'i');}function buildRuleToNameMapping(_0x3c4421){const _0x54f939=a18_0x2148,_0x23a511=new Map();if(_0x3c4421[_0x54f939(0x1b7)])for(const [_0xe8a18e,_0x26446d]of Object[_0x54f939(0x153)](_0x3c4421[_0x54f939(0x1b7)])){if(_0x26446d[_0x54f939(0x186)]){const _0x1a0d88=serializeRule(_0x26446d[_0x54f939(0x186)]),_0x12d7b6=_0x23a511['get'](_0x1a0d88);_0x12d7b6?_0x12d7b6[_0x54f939(0x1ac)](_0xe8a18e):_0x23a511['set'](_0x1a0d88,[_0xe8a18e]);}}return _0x23a511;}async function resolveJourneyTarget(_0x3f66ee,_0xe03783,_0x1dcf11){const _0x3b1657=a18_0x2148;if(isYamlFilePath(_0x3f66ee))try{const _0x1a0951=await resolveYamlFilePath(_0x3f66ee);return _0x1dcf11&&(console[_0x3b1657(0x178)](_0x3b1657(0x128)+_0x3f66ee),console[_0x3b1657(0x178)](_0x3b1657(0x141)+_0x1a0951['parentSegment']),console[_0x3b1657(0x178)]('\x20\x20Name:\x20'+_0x1a0951[_0x3b1657(0x18d)]),console[_0x3b1657(0x178)](_0x3b1657(0x150)+(_0x1a0951[_0x3b1657(0x168)]||'(root)'))),{'journeyName':_0x1a0951[_0x3b1657(0x18d)],'parentSegment':_0x1a0951[_0x3b1657(0x184)],'resolved':_0x1a0951};}catch(_0x685399){throw new SDKError(ErrorCode[_0x3b1657(0x1e0)],_0x3b1657(0x1ad)+_0x685399[_0x3b1657(0x15f)]);}if(!_0xe03783)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3b1657(0x196));return{'journeyName':_0x3f66ee,'parentSegment':_0xe03783};}export class JourneyListCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]=a18_0xc8fd7f(0x140);[a18_0xc8fd7f(0x16c)]='List\x20journeys\x20in\x20current\x20context';async[a18_0xc8fd7f(0x1a6)](_0x2eac97){const _0x4c0864=a18_0xc8fd7f,{options:_0x3f793e,args:_0x4b79b1,tdx:_0x3c5ac7}=_0x2eac97,_0x1a6d8a=_0x4b79b1[0x0],_0x53d0c8=_0x3f793e[_0x4c0864(0x183)],_0xe70c5e=_0x3f793e[_0x4c0864(0x184)];if(!_0xe70c5e)return console[_0x4c0864(0x178)](_0x4c0864(0x1d9)),console[_0x4c0864(0x178)](_0x4c0864(0x181)),0x1;const _0x1f17f3=await withSpinner(_0x4c0864(0x1a4),()=>_0x3c5ac7['segment']['resolveParentId'](_0xe70c5e),{'verbose':_0x3f793e['verbose']}),_0x5ab118=_0x1f17f3[_0x4c0864(0x170)];_0x3f793e['verbose']&&(console[_0x4c0864(0x178)]('Parent\x20segment:\x20'+_0xe70c5e+'\x20(ID:\x20'+_0x5ab118+')'),_0x1a6d8a&&console['error'](_0x4c0864(0x134)+_0x1a6d8a));const [_0x13b6a4,_0xa25a3c,_0x2a8e2b]=await Promise[_0x4c0864(0x1d1)]([withSpinner(_0x4c0864(0x14c),()=>_0x3c5ac7[_0x4c0864(0x169)]['getParentFull'](_0x5ab118),{'verbose':_0x3f793e[_0x4c0864(0x194)]}),withSpinner(_0x4c0864(0x199),()=>_0x3c5ac7[_0x4c0864(0x169)][_0x4c0864(0x1bc)](_0x5ab118),{'verbose':_0x3f793e[_0x4c0864(0x194)]}),withSpinner(_0x4c0864(0x139),()=>_0x3c5ac7[_0x4c0864(0x147)][_0x4c0864(0x166)](_0x5ab118),{'verbose':_0x3f793e['verbose']})]),_0x22e0fe=_0x13b6a4['data'],_0x5364cf=_0xa25a3c[_0x4c0864(0x170)];let _0x401b79=_0x2a8e2b[_0x4c0864(0x170)];const _0x4308e2=_0x22e0fe['rootFolderId'],_0xa43716=new Map();for(const _0x225833 of _0x5364cf){_0xa43716['set'](_0x225833['id'],_0x225833[_0x4c0864(0x15a)]);}if(_0x1a6d8a){const _0x382005=globToRegex(_0x1a6d8a);_0x401b79=_0x401b79[_0x4c0864(0x15e)](_0x232f6d=>_0x382005[_0x4c0864(0x1b6)](_0x232f6d[_0x4c0864(0x1ba)]));}console['error'](_0x4c0864(0x1c8)+_0x401b79[_0x4c0864(0x175)]+'\x20journey'+(_0x401b79[_0x4c0864(0x175)]!==0x1?'s':''));const _0x3aa532=_0x4a8915=>{const _0x39f1d5=_0x4c0864;return getConsoleNextUrl(_0x3f793e[_0x39f1d5(0x1e1)],'/app/ps/'+_0x5ab118+'/e/'+_0x4a8915+'/j/da');};if(_0x3f793e['format']==='table')await handleSDKOutput(_0x401b79,_0x3f793e);else{if(_0x3f793e[_0x4c0864(0x165)]==='json'){const _0x1844d7=_0x401b79['map'](_0x4ead5b=>({..._0x4ead5b,'url':_0x3aa532(_0x4ead5b['id'])}));await handleSDKOutput(_0x1844d7,_0x3f793e);}else{console[_0x4c0864(0x172)]('['+_0xe70c5e+']');const _0x249214=new Map(),_0x1adcb7=[];for(const _0x1d8e4b of _0x401b79){if(!_0x1d8e4b[_0x4c0864(0x1c1)]||_0x1d8e4b[_0x4c0864(0x1c1)]===_0x4308e2)_0x1adcb7[_0x4c0864(0x1ac)](_0x1d8e4b);else{const _0x2980ef=_0x249214[_0x4c0864(0x142)](_0x1d8e4b[_0x4c0864(0x1c1)])||[];_0x2980ef[_0x4c0864(0x1ac)](_0x1d8e4b),_0x249214[_0x4c0864(0x1d0)](_0x1d8e4b[_0x4c0864(0x1c1)],_0x2980ef);}}for(const _0x2246d2 of _0x1adcb7){const _0x232ece=_0x53d0c8?_0x3aa532(_0x2246d2['id']):undefined;console['log'](formatJourneyItem(_0x2246d2,'',_0x232ece));}for(const [_0x333b4e,_0x965b5]of _0x249214){const _0x50d4eb=_0xa43716['get'](_0x333b4e)||_0x333b4e;console['log']('📁\x20'+_0x50d4eb);for(const _0x128047 of _0x965b5){const _0xef9b0d=_0x53d0c8?_0x3aa532(_0x128047['id']):undefined;console['log'](formatJourneyItem(_0x128047,'\x20\x20',_0xef9b0d));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]=a18_0xc8fd7f(0x16a);[a18_0xc8fd7f(0x16c)]=a18_0xc8fd7f(0x14b);async['execute'](_0x81d6ba){const _0x2e5495=a18_0xc8fd7f,{options:_0x1eb990,args:_0xeba669,tdx:_0x4b2bcf}=_0x81d6ba,_0x41661e=_0xeba669[0x0];if(!_0x41661e)return console[_0x2e5495(0x178)](_0x2e5495(0x129)),console[_0x2e5495(0x178)]('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x2e5495(0x178)](_0x2e5495(0x1e4)),console[_0x2e5495(0x178)](_0x2e5495(0x12c)),0x1;_0x1eb990[_0x2e5495(0x194)]&&console[_0x2e5495(0x178)](_0x2e5495(0x17c)+_0x41661e);const _0x50f7ba=await resolveJourneyTarget(_0x41661e,_0x1eb990[_0x2e5495(0x184)],_0x1eb990[_0x2e5495(0x194)]),_0x98c4c3=await withSpinner(_0x2e5495(0x1a4),()=>_0x4b2bcf[_0x2e5495(0x169)][_0x2e5495(0x159)](_0x50f7ba[_0x2e5495(0x184)]),{'verbose':_0x1eb990[_0x2e5495(0x194)]}),_0x5ef47a=_0x98c4c3[_0x2e5495(0x170)],_0xb4ba52=await withSpinner(_0x2e5495(0x135),()=>_0x4b2bcf['journey']['resolveJourneyId'](_0x5ef47a,_0x50f7ba[_0x2e5495(0x1aa)]),{'verbose':_0x1eb990[_0x2e5495(0x194)]}),_0x5b051f=_0xb4ba52[_0x2e5495(0x170)];if(_0x1eb990[_0x2e5495(0x183)]){const _0x1afdda=getConsoleNextUrl(_0x1eb990[_0x2e5495(0x1e1)],_0x2e5495(0x160)+_0x5ef47a+_0x2e5495(0x14d)+_0x5b051f+_0x2e5495(0x18e));return console['error'](a18_0x4f3c23[_0x2e5495(0x19f)]('✔')+_0x2e5495(0x176)+a18_0x4f3c23[_0x2e5495(0x1ca)](_0x1afdda)),openBrowser(_0x1afdda),0x0;}const _0x3721a6=await withSpinner(_0x2e5495(0x18c),()=>_0x4b2bcf[_0x2e5495(0x147)][_0x2e5495(0x146)](_0x5b051f),{'verbose':_0x1eb990[_0x2e5495(0x194)]}),_0x40b9fb=_0x3721a6['data'],_0x595bc6=_0x1eb990[_0x2e5495(0x1ab)];let _0x5aeb62;if(_0x595bc6)try{const _0x3cc0fe=await withSpinner(_0x2e5495(0x15d),()=>_0x4b2bcf[_0x2e5495(0x147)]['getStatistics'](_0x5b051f),{'verbose':_0x1eb990[_0x2e5495(0x194)]});_0x5aeb62=_0x3cc0fe[_0x2e5495(0x170)];}catch{_0x1eb990[_0x2e5495(0x194)]&&console[_0x2e5495(0x178)](_0x2e5495(0x1c0));}const _0x4c699f=getConsoleNextUrl(_0x1eb990['site'],'/app/ps/'+_0x5ef47a+_0x2e5495(0x14d)+_0x5b051f+_0x2e5495(0x18e)),_0x20c151={'id':_0x40b9fb['id'],'name':_0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x15a)],'description':_0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x16c)],'state':_0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x1db)],'paused':_0x40b9fb['attributes']['paused'],'reentry_mode':_0x40b9fb['attributes']['reentryMode'],'stages':_0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x123)]?.[_0x2e5495(0x175)]||0x0,..._0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x11f)]&&{'goal':_0x40b9fb[_0x2e5495(0x1c2)][_0x2e5495(0x11f)][_0x2e5495(0x15a)]},..._0x5aeb62&&{'statistics':{'total_entered':_0x5aeb62[_0x2e5495(0x1df)],'goal_achieved':_0x5aeb62[_0x2e5495(0x158)],'goal_rate':_0x5aeb62[_0x2e5495(0x122)],'stages':_0x5aeb62[_0x2e5495(0x16e)]}},'url':_0x4c699f};return await handleSingleObjectOutput(_0x20c151,_0x1eb990),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]=a18_0xc8fd7f(0x16d);[a18_0xc8fd7f(0x16c)]=a18_0xc8fd7f(0x1dc);async['execute'](_0x1ab3f0){const _0x1fe5f5=a18_0xc8fd7f,{options:_0x2c2807,args:_0x525b76,tdx:_0x350ef1}=_0x1ab3f0,_0x2cf099=_0x525b76[0x0];if(!_0x2cf099)return console['error'](_0x1fe5f5(0x129)),console[_0x1fe5f5(0x178)](_0x1fe5f5(0x173)),0x1;_0x2c2807[_0x1fe5f5(0x194)]&&console[_0x1fe5f5(0x178)]('Input:\x20'+_0x2cf099);const _0x1f5008=await resolveJourneyTarget(_0x2cf099,_0x2c2807[_0x1fe5f5(0x184)],_0x2c2807[_0x1fe5f5(0x194)]),_0x5cadb8=await withSpinner(_0x1fe5f5(0x1a4),()=>_0x350ef1[_0x1fe5f5(0x169)][_0x1fe5f5(0x159)](_0x1f5008[_0x1fe5f5(0x184)]),{'verbose':_0x2c2807['verbose']}),_0x12af01=_0x5cadb8['data'],_0x5421cf=await withSpinner(_0x1fe5f5(0x135),()=>_0x350ef1[_0x1fe5f5(0x147)][_0x1fe5f5(0x138)](_0x12af01,_0x1f5008[_0x1fe5f5(0x1aa)]),{'verbose':_0x2c2807['verbose']}),_0xdee2c7=_0x5421cf[_0x1fe5f5(0x170)],_0x26db98=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x350ef1[_0x1fe5f5(0x147)][_0x1fe5f5(0x133)](_0xdee2c7),{'verbose':_0x2c2807['verbose']}),_0x3a4aa1=_0x26db98[_0x1fe5f5(0x170)];if(!_0x3a4aa1||_0x3a4aa1[_0x1fe5f5(0x163)]===null)return console[_0x1fe5f5(0x178)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x1f5008[_0x1fe5f5(0x1aa)]),console[_0x1fe5f5(0x178)](_0x1fe5f5(0x1e7)),0x0;const _0x33ecc5={'journey_id':_0x3a4aa1[_0x1fe5f5(0x163)],'total_entered':_0x3a4aa1[_0x1fe5f5(0x1df)],'goal_achieved':_0x3a4aa1[_0x1fe5f5(0x158)],'goal_rate':_0x3a4aa1[_0x1fe5f5(0x122)],'stages':_0x3a4aa1[_0x1fe5f5(0x16e)]?.[_0x1fe5f5(0x187)](_0x3ec386=>({'name':_0x3ec386['stageName'],'population':_0x3ec386[_0x1fe5f5(0x17f)],'entered':_0x3ec386[_0x1fe5f5(0x143)],'exited':_0x3ec386[_0x1fe5f5(0x17a)],'conversion_rate':_0x3ec386[_0x1fe5f5(0x1d3)]}))},_0x826661=_0x2c2807[_0x1fe5f5(0x148)];if(_0x826661&&_0x3a4aa1[_0x1fe5f5(0x16e)]){const _0x200180=_0x3a4aa1[_0x1fe5f5(0x16e)]['find'](_0x5a6cad=>_0x5a6cad['stageName'][_0x1fe5f5(0x185)]()===_0x826661[_0x1fe5f5(0x185)]());if(_0x200180)return await handleSingleObjectOutput({'stage_name':_0x200180[_0x1fe5f5(0x16f)],'population':_0x200180['population'],'entered':_0x200180[_0x1fe5f5(0x143)],'exited':_0x200180[_0x1fe5f5(0x17a)],'conversion_rate':_0x200180[_0x1fe5f5(0x1d3)]},_0x2c2807),0x0;console[_0x1fe5f5(0x178)](_0x1fe5f5(0x161)+_0x826661+_0x1fe5f5(0x136));}return await handleSingleObjectOutput(_0x33ecc5,_0x2c2807),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]=a18_0xc8fd7f(0x188);[a18_0xc8fd7f(0x16c)]=a18_0xc8fd7f(0x131);async[a18_0xc8fd7f(0x1a6)](_0x491032){const _0xccf05c=a18_0xc8fd7f,{options:_0x36d2f1,args:_0x5b74ec,tdx:_0x460eec}=_0x491032,_0x2438f1=_0x5b74ec[0x0];if(!_0x2438f1)return console[_0xccf05c(0x178)](_0xccf05c(0x129)),console[_0xccf05c(0x178)](_0xccf05c(0x1ce)),0x1;_0x36d2f1[_0xccf05c(0x194)]&&console[_0xccf05c(0x178)](_0xccf05c(0x17c)+_0x2438f1);const _0x376614=await resolveJourneyTarget(_0x2438f1,_0x36d2f1[_0xccf05c(0x184)],_0x36d2f1[_0xccf05c(0x194)]),_0x49105b=await withSpinner(_0xccf05c(0x1a4),()=>_0x460eec[_0xccf05c(0x169)]['resolveParentId'](_0x376614[_0xccf05c(0x184)]),{'verbose':_0x36d2f1[_0xccf05c(0x194)]}),_0x34628f=_0x49105b[_0xccf05c(0x170)],_0x35081d=await withSpinner('Resolving\x20journey...',()=>_0x460eec['journey']['resolveJourneyId'](_0x34628f,_0x376614[_0xccf05c(0x1aa)]),{'verbose':_0x36d2f1['verbose']}),_0x110ffd=_0x35081d[_0xccf05c(0x170)];if(!_0x36d2f1[_0xccf05c(0x1de)]){const _0x5b4414=await confirm(_0xccf05c(0x1d5)+_0x376614[_0xccf05c(0x1aa)]+'\x22?');if(!_0x5b4414)return console['error'](_0xccf05c(0x1da)),0x0;}const _0x20077b=await withSpinner(_0xccf05c(0x12a),()=>_0x460eec[_0xccf05c(0x147)]['pause'](_0x110ffd),{'verbose':_0x36d2f1['verbose']}),_0x47df70=_0x20077b[_0xccf05c(0x170)];return console[_0xccf05c(0x178)](_0xccf05c(0x13a)+_0x47df70[_0xccf05c(0x1c2)][_0xccf05c(0x15a)]+_0xccf05c(0x152)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]=a18_0xc8fd7f(0x1b8);[a18_0xc8fd7f(0x16c)]='Resume\x20a\x20paused\x20journey';async[a18_0xc8fd7f(0x1a6)](_0x50a7d3){const _0x5cf2a1=a18_0xc8fd7f,{options:_0x8e1cbe,args:_0x1b4629,tdx:_0x137d82}=_0x50a7d3,_0xcf92fb=_0x1b4629[0x0];if(!_0xcf92fb)return console['error'](_0x5cf2a1(0x129)),console['error'](_0x5cf2a1(0x15c)),0x1;_0x8e1cbe[_0x5cf2a1(0x194)]&&console[_0x5cf2a1(0x178)](_0x5cf2a1(0x17c)+_0xcf92fb);const _0x2a4b89=await resolveJourneyTarget(_0xcf92fb,_0x8e1cbe['parentSegment'],_0x8e1cbe['verbose']),_0x12c4e6=await withSpinner(_0x5cf2a1(0x1a4),()=>_0x137d82['segment'][_0x5cf2a1(0x159)](_0x2a4b89['parentSegment']),{'verbose':_0x8e1cbe['verbose']}),_0x5b4eeb=_0x12c4e6[_0x5cf2a1(0x170)],_0x515f09=await withSpinner(_0x5cf2a1(0x135),()=>_0x137d82[_0x5cf2a1(0x147)]['resolveJourneyId'](_0x5b4eeb,_0x2a4b89['journeyName']),{'verbose':_0x8e1cbe['verbose']}),_0xc9cff0=_0x515f09['data'];if(!_0x8e1cbe[_0x5cf2a1(0x1de)]){const _0x199ff9=await confirm(_0x5cf2a1(0x1d4)+_0x2a4b89[_0x5cf2a1(0x1aa)]+'\x22?');if(!_0x199ff9)return console['error']('Cancelled'),0x0;}const _0x247b36=await withSpinner(_0x5cf2a1(0x1bd),()=>_0x137d82[_0x5cf2a1(0x147)][_0x5cf2a1(0x130)](_0xc9cff0),{'verbose':_0x8e1cbe[_0x5cf2a1(0x194)]}),_0x51cd56=_0x247b36[_0x5cf2a1(0x170)];return console[_0x5cf2a1(0x178)](_0x5cf2a1(0x13a)+_0x51cd56[_0x5cf2a1(0x1c2)]['name']+_0x5cf2a1(0x127)),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']=a18_0xc8fd7f(0x192);['description']=a18_0xc8fd7f(0x1b0);async['execute'](_0x1adf71){const _0x49c479=a18_0xc8fd7f,{options:_0x3d0954,args:_0x112a28,tdx:_0x32cc23}=_0x1adf71,_0x2f0d5b=_0x3d0954,_0x3af8d7=_0x112a28[0x0],_0x1715d9=_0x3af8d7&&isYamlFilePath(_0x3af8d7),_0x16891e=await resolveTarget({'arg':_0x1715d9?_0x3af8d7:undefined,'contextParent':_0x3d0954['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x16891e))return _0x16891e[_0x49c479(0x18a)]===_0x49c479(0x1b9)?(console[_0x49c479(0x178)](a18_0x4f3c23[_0x49c479(0x149)](_0x49c479(0x17d))),console['error'](_0x49c479(0x167)),console[_0x49c479(0x178)](_0x49c479(0x177)),console[_0x49c479(0x178)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0x49c479(0x178)](_0x49c479(0x1cf))):(console[_0x49c479(0x178)](a18_0x4f3c23[_0x49c479(0x198)]('Error:\x20'+_0x16891e[_0x49c479(0x15f)]+'\x0a')),_0x16891e[_0x49c479(0x195)]&&console[_0x49c479(0x178)](a18_0x4f3c23['cyan'](_0x16891e[_0x49c479(0x195)]))),0x1;let _0x46caea=_0x1715d9?undefined:_0x3af8d7,_0x443a22,_0x16ac22;_0x16891e['type']===_0x49c479(0x189)&&(_0x46caea=_0x16891e['resourceName'],_0x443a22=_0x16891e[_0x49c479(0x151)],_0x16ac22=_0x16891e[_0x49c479(0x168)]);const _0x5a581a=_0x16891e[_0x49c479(0x18f)],_0x337ad1=_0x16891e[_0x49c479(0x1d2)];_0x2f0d5b[_0x49c479(0x194)]&&(console['error'](_0x49c479(0x156)+_0x5a581a),console[_0x49c479(0x178)](_0x49c479(0x1a0)+_0x337ad1),_0x46caea&&console[_0x49c479(0x178)](_0x49c479(0x1b5)+_0x46caea),_0x443a22&&console[_0x49c479(0x178)]('Target\x20file:\x20'+_0x443a22),_0x16ac22&&console[_0x49c479(0x178)](_0x49c479(0x17e)+_0x16ac22));const _0x3c6003=await withSpinner(_0x49c479(0x1a4),()=>_0x32cc23[_0x49c479(0x169)][_0x49c479(0x159)](_0x5a581a),{'verbose':_0x3d0954[_0x49c479(0x194)]}),_0x2390de=_0x3c6003[_0x49c479(0x170)],[_0xc56658,_0x3ff410]=await Promise[_0x49c479(0x1d1)]([withSpinner(_0x49c479(0x139),()=>_0x32cc23[_0x49c479(0x147)][_0x49c479(0x166)](_0x2390de),{'verbose':_0x3d0954[_0x49c479(0x194)]}),withSpinner(_0x49c479(0x13b),()=>_0x32cc23['segment'][_0x49c479(0x1bc)](_0x2390de),{'verbose':_0x3d0954[_0x49c479(0x194)]})]);let _0x8fcf3=_0xc56658[_0x49c479(0x170)];const _0x1274d=_0x3ff410[_0x49c479(0x170)],_0x23d5b6=buildFolderIdToPathMap(_0x1274d);if(_0x46caea){const _0x4ec089=_0x8fcf3['filter'](_0xe347ba=>_0xe347ba[_0x49c479(0x1ba)][_0x49c479(0x185)]()===_0x46caea[_0x49c479(0x185)]());if(_0x4ec089[_0x49c479(0x175)]===0x0)return console[_0x49c479(0x178)]('Error:\x20Journey\x20not\x20found:\x20'+_0x46caea),console[_0x49c479(0x178)](_0x49c479(0x1af)),0x1;_0x8fcf3=_0x4ec089;}if(_0x16ac22!==undefined){const _0x2d1520=_0x8fcf3[_0x49c479(0x15e)](_0x131b02=>{const _0x1f7b85=_0x49c479,_0x535d19=_0x131b02[_0x1f7b85(0x1c1)]?_0x23d5b6[_0x1f7b85(0x142)](_0x131b02[_0x1f7b85(0x1c1)])||'':'';return _0x535d19===_0x16ac22;});if(_0x2d1520[_0x49c479(0x175)]===0x0&&_0x8fcf3[_0x49c479(0x175)]>0x0){console[_0x49c479(0x178)](_0x49c479(0x1d7)+_0x46caea+_0x49c479(0x1a8)+(_0x16ac22||_0x49c479(0x182))),console[_0x49c479(0x178)](_0x49c479(0x1c3));for(const _0x4e7ff0 of _0x8fcf3){const _0x57c240=_0x4e7ff0[_0x49c479(0x1c1)]?_0x23d5b6[_0x49c479(0x142)](_0x4e7ff0[_0x49c479(0x1c1)])||'':'';console[_0x49c479(0x178)]('\x20\x20-\x20'+(_0x57c240||_0x49c479(0x1b1))+'/'+_0x4e7ff0['journeyBundleName']);}return 0x1;}_0x8fcf3=_0x2d1520;}if(_0x8fcf3[_0x49c479(0x175)]===0x0)return console[_0x49c479(0x178)](_0x49c479(0x1d8)),0x0;const _0xdc833d=new Map();for(const _0x481ae7 of _0x8fcf3){const _0x5ecbf7=_0x481ae7[_0x49c479(0x13c)];!_0xdc833d['has'](_0x5ecbf7)&&_0xdc833d[_0x49c479(0x1d0)](_0x5ecbf7,[]),_0xdc833d['get'](_0x5ecbf7)[_0x49c479(0x1ac)](_0x481ae7);}for(const _0x231444 of _0xdc833d[_0x49c479(0x155)]()){_0x231444[_0x49c479(0x1cd)]((_0x2c3042,_0x31f888)=>(_0x2c3042['versionNumber']||0x0)-(_0x31f888[_0x49c479(0x1a9)]||0x0));}const _0x4f0579=[],[_0x5aac61,_0x1edca9]=await Promise['all']([withSpinner(_0x49c479(0x157),()=>_0x32cc23[_0x49c479(0x1dd)][_0x49c479(0x12d)](),{'verbose':_0x3d0954[_0x49c479(0x194)]})[_0x49c479(0x144)](_0xe10073=>_0xe10073['data']),withSpinner(_0x49c479(0x19a),()=>_0x32cc23[_0x49c479(0x1be)]['buildIdToNameMap'](),{'verbose':_0x3d0954[_0x49c479(0x194)]})[_0x49c479(0x144)](_0x188084=>_0x188084[_0x49c479(0x170)])]);for(const _0x1b14a7 of _0xdc833d['values']()){const _0x27ca0a=_0x1b14a7[0x0][_0x49c479(0x1ba)],_0x5b15a0=_0x1b14a7[0x0][_0x49c479(0x1c1)],_0x41511c=_0x5b15a0?_0x23d5b6['get'](_0x5b15a0)||'':'',_0x53fa54=_0x41511c?a18_0xd5d9ec['join'](_0x337ad1,_0x41511c):_0x337ad1,_0x3abd03=_0x443a22||a18_0xd5d9ec['join'](_0x53fa54,sanitizeFileName(_0x27ca0a)+'.yml');let _0x508d7e,_0x2dd577;if(existsSync(_0x3abd03))try{const _0x43d182=readFileSync(_0x3abd03,_0x49c479(0x1a7)),_0x249e7b=parseYamlString(_0x43d182);_0x2dd577=_0x249e7b,_0x508d7e=buildRuleToNameMapping(_0x249e7b),_0x2f0d5b['verbose']&&_0x508d7e[_0x49c479(0x1c4)]>0x0&&console[_0x49c479(0x178)](_0x49c479(0x1bf)+_0x508d7e[_0x49c479(0x1c4)]+_0x49c479(0x1e3)+_0x27ca0a);}catch(_0x30e33c){_0x2f0d5b[_0x49c479(0x194)]&&console[_0x49c479(0x178)](_0x49c479(0x12e)+_0x30e33c[_0x49c479(0x15f)]);}const _0x3927e2=[],_0x1d78e4=new Set(),_0x29745f=new Map(),_0x1380c8=new Map(),_0x2f825c=new Set(),_0x3f6cab=new Map(),_0x29d700=new Map(),_0x5e019c=createJumpTargetCache();await withProgressSpinner(_0x49c479(0x19d)+_0x27ca0a+'...',async _0x349743=>{const _0x3e6bf1=_0x49c479;for(const _0x20c0f5 of _0x1b14a7){const _0x4894fa=_0x1b14a7[_0x3e6bf1(0x175)]>0x1?_0x20c0f5['journeyBundleName']+'\x20v'+(_0x20c0f5[_0x3e6bf1(0x1a9)]||0x1):_0x20c0f5[_0x3e6bf1(0x1ba)];_0x349743[_0x3e6bf1(0x18b)](_0x3e6bf1(0x19d)+_0x4894fa);const _0x4d8b2b=await _0x32cc23[_0x3e6bf1(0x147)][_0x3e6bf1(0x146)](_0x20c0f5['id']),_0x1624a0=_0x4d8b2b[_0x3e6bf1(0x1c2)]?.['audienceId'],_0x105d44={'resolveSegment':async _0x3c534d=>{const _0x3425ca=_0x3e6bf1;if(!_0x1624a0)return{'name':_0x3c534d,'isJourneyLocal':![]};const _0x2937e4=_0x29745f[_0x3425ca(0x142)](_0x3c534d);if(_0x2937e4)return _0x2937e4;try{const _0x42c2cf=await _0x32cc23[_0x3425ca(0x169)][_0x3425ca(0x125)](_0x1624a0,_0x3c534d),_0x41b948=_0x42c2cf['kind']===SEGMENT_KIND_JOURNEY;let _0x29e0ab,_0x429619=_0x42c2cf['name'];if(_0x41b948&&_0x42c2cf['rule']){const _0xe770ea=await segmentResponseToDef(_0x42c2cf,{'resolveSegmentName':async _0x2d9196=>{const _0x4a43e3=_0x3425ca,_0x52c4de=_0x29745f['get'](_0x2d9196);if(_0x52c4de)return _0x52c4de[_0x4a43e3(0x15a)];const _0x260779=await _0x105d44[_0x4a43e3(0x154)](_0x2d9196);return _0x260779[_0x4a43e3(0x15a)];}}),_0x55d93c=_0xe770ea[_0x3425ca(0x186)];_0x29e0ab={'description':_0x42c2cf['description'],'rule':_0x55d93c};const _0x2056ac=serializeRule(_0x55d93c),_0x1720f4=_0x1380c8[_0x3425ca(0x142)](_0x2056ac);if(_0x1720f4)_0x429619=_0x1720f4,_0x29e0ab=undefined,_0x2f0d5b[_0x3425ca(0x194)]&&console[_0x3425ca(0x178)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x42c2cf[_0x3425ca(0x15a)]+_0x3425ca(0x16b)+_0x1720f4);else{let _0x265520=![];if(_0x508d7e){const _0x1723aa=_0x508d7e[_0x3425ca(0x142)](_0x2056ac);if(_0x1723aa){const _0x4bd9f8=_0x1723aa[_0x3425ca(0x191)](_0x1ff80a=>!_0x1d78e4[_0x3425ca(0x179)](_0x1ff80a));_0x4bd9f8&&(_0x429619=_0x4bd9f8,_0x1d78e4[_0x3425ca(0x197)](_0x4bd9f8),_0x1380c8[_0x3425ca(0x1d0)](_0x2056ac,_0x4bd9f8),_0x265520=!![],_0x2f0d5b['verbose']&&console[_0x3425ca(0x178)](_0x3425ca(0x121)+_0x4bd9f8+'\x20(rule\x20match)'));}}if(!_0x265520){const _0x2b8c6a=generateJourneyLocalName(_0x42c2cf['name']);_0x2b8c6a&&(_0x429619=_0x2b8c6a);let _0x17243c=_0x429619,_0x55e542=0x2;while(_0x1d78e4[_0x3425ca(0x179)](_0x17243c)){_0x17243c=_0x429619+'_'+_0x55e542,_0x55e542++;}_0x1d78e4[_0x3425ca(0x197)](_0x17243c),_0x1380c8[_0x3425ca(0x1d0)](_0x2056ac,_0x17243c),_0x429619=_0x17243c;}}}const _0x5b584f={'name':_0x429619,'isJourneyLocal':_0x41b948,'definition':_0x29e0ab};return _0x29745f[_0x3425ca(0x1d0)](_0x3c534d,_0x5b584f),_0x5b584f;}catch(_0x2d053b){return _0x3d0954[_0x3425ca(0x194)]&&console[_0x3425ca(0x178)](_0x3425ca(0x1c6)+_0x3c534d+':\x20'+_0x2d053b[_0x3425ca(0x15f)]),{'name':_0x3c534d,'isJourneyLocal':![]};}},'resolveActivation':async _0x3a3137=>{const _0x52886e=_0x3e6bf1,_0x34592a=_0x3f6cab[_0x52886e(0x142)](_0x3a3137);if(_0x34592a)return _0x34592a;try{const _0x295f76=await _0x32cc23['journey'][_0x52886e(0x14a)](_0x20c0f5['id'],_0x3a3137),_0x4d3aba=journeyActivationStepToYaml(_0x295f76,_0x5aac61,_0x1edca9),_0x416659=JSON['stringify']({'name':_0x4d3aba[_0x52886e(0x15a)],'connection':_0x4d3aba[_0x52886e(0x1be)],'connector_config':_0x4d3aba['connector_config']}),_0x7e6c64=_0x29d700[_0x52886e(0x142)](_0x416659);if(_0x7e6c64){const _0x2626fd={'name':_0x7e6c64,'isJourneyLocal':!![],'definition':_0x4d3aba};return _0x3f6cab[_0x52886e(0x1d0)](_0x3a3137,_0x2626fd),_0x2626fd;}const _0x1be31e=_0x295f76[_0x52886e(0x1c2)][_0x52886e(0x1cb)][_0x52886e(0x15a)]||_0x3a3137,_0x4ce10b=sanitizeYamlKey(_0x1be31e)||_0x52886e(0x1b2)+_0x3a3137;let _0x1785a7=_0x4ce10b,_0x5540c8=0x2;while(_0x2f825c[_0x52886e(0x179)](_0x1785a7)){_0x1785a7=_0x4ce10b+'_'+_0x5540c8,_0x5540c8++;}_0x2f825c[_0x52886e(0x197)](_0x1785a7),_0x29d700[_0x52886e(0x1d0)](_0x416659,_0x1785a7);const _0x3226c9={'name':_0x1785a7,'isJourneyLocal':!![],'definition':_0x4d3aba};return _0x3f6cab[_0x52886e(0x1d0)](_0x3a3137,_0x3226c9),_0x3226c9;}catch(_0x1d4a5e){return _0x3d0954[_0x52886e(0x194)]&&console[_0x52886e(0x178)](_0x52886e(0x193)+_0x3a3137+':\x20'+_0x1d4a5e[_0x52886e(0x15f)]),{'name':_0x3a3137,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x46371f,_0x43fa91)=>{const _0x5be12d=_0x3e6bf1;return resolveJumpTarget(_0x46371f,_0x43fa91,_0x5e019c,_0x20ff8c=>_0x32cc23[_0x5be12d(0x147)]['getJourney'](_0x20ff8c));}},_0x22e07f=await journeyResponseToDef(_0x4d8b2b,_0x105d44);_0x3927e2[_0x3e6bf1(0x1ac)]({'item':_0x20c0f5,'yaml':_0x22e07f});}},{'verbose':_0x3d0954['verbose']});const _0x11beb7=buildMergedJourneyDef(_0x3927e2,_0x508d7e),_0x5c6f45=normalizeJourneyDef(_0x11beb7,_0x2dd577),_0xe044fd=toYamlString(_0x5c6f45),_0x256f28=_0x443a22||a18_0xd5d9ec[_0x49c479(0x126)](_0x53fa54,sanitizeFileName(_0x27ca0a)+'.yml');!_0x443a22&&_0x41511c&&!existsSync(_0x53fa54)&&mkdirSync(_0x53fa54,{'recursive':!![]});const _0x41ea90=a18_0xd5d9ec[_0x49c479(0x1cc)](process['cwd'](),_0x256f28);if(existsSync(_0x256f28)){const _0x24a68d=readFileSync(_0x256f28,_0x49c479(0x1a7)),_0x5b4cec=generateDiff(_0x24a68d,_0xe044fd),_0x6d0ec6=hasChanges(_0x5b4cec);_0x4f0579['push']({'relativePath':_0x41ea90,'absolutePath':_0x256f28,'content':_0xe044fd,'isNew':![],'hasChanges':_0x6d0ec6,'diff':_0x6d0ec6?formatDiffWithColors(_0x5b4cec):undefined});}else _0x4f0579[_0x49c479(0x1ac)]({'relativePath':_0x41ea90,'absolutePath':_0x256f28,'content':_0xe044fd,'isNew':!![],'hasChanges':![]});}const _0x249d31=_0x4f0579['filter'](_0x18a5f9=>_0x18a5f9['isNew']),_0x504ef7=_0x4f0579[_0x49c479(0x15e)](_0x47a5f6=>!_0x47a5f6[_0x49c479(0x137)]&&_0x47a5f6[_0x49c479(0x1e2)]),_0xed7be7=_0x4f0579[_0x49c479(0x15e)](_0x487b03=>!_0x487b03[_0x49c479(0x137)]&&!_0x487b03[_0x49c479(0x1e2)]),_0x34320c=_0x8fcf3[_0x49c479(0x175)],_0x275d9e=_0xdc833d[_0x49c479(0x1c4)],_0xac81f6=_0x34320c>_0x275d9e?'\x20('+_0x34320c+_0x49c479(0x145):'';console[_0x49c479(0x178)](_0x49c479(0x1b3)),console['error']('\x20\x20'+a18_0x4f3c23['cyan'](_0x275d9e+_0x49c479(0x1c9))+a18_0x4f3c23[_0x49c479(0x180)](_0xac81f6)),console['error']('\x20\x20'+a18_0x4f3c23[_0x49c479(0x19f)]('+\x20'+_0x249d31[_0x49c479(0x175)]+_0x49c479(0x12f))),console[_0x49c479(0x178)]('\x20\x20'+a18_0x4f3c23[_0x49c479(0x149)]('~\x20'+_0x504ef7[_0x49c479(0x175)]+'\x20changed\x20files')),console[_0x49c479(0x178)]('\x20\x20'+a18_0x4f3c23[_0x49c479(0x180)]('=\x20'+_0xed7be7[_0x49c479(0x175)]+_0x49c479(0x1a1))),console[_0x49c479(0x178)]('\x20\x20Target:\x20'+a18_0x4f3c23[_0x49c479(0x1ca)](_0x337ad1)+'\x0a');if(_0x504ef7[_0x49c479(0x175)]>0x0)for(const _0x4c726c of _0x504ef7){console[_0x49c479(0x178)]('\x0aChanges\x20to\x20\x27'+_0x4c726c[_0x49c479(0x164)]+'\x27:'),console[_0x49c479(0x178)]('─'[_0x49c479(0x1bb)](0x3c)),console[_0x49c479(0x178)](_0x4c726c[_0x49c479(0x14e)]),console[_0x49c479(0x178)]('─'['repeat'](0x3c));}if(_0x2f0d5b['dryRun'])return console[_0x49c479(0x178)](a18_0x4f3c23['yellow'](_0x49c479(0x19b))),0x0;if(_0x249d31[_0x49c479(0x175)]===0x0&&_0x504ef7['length']===0x0)return console[_0x49c479(0x178)](a18_0x4f3c23[_0x49c479(0x19f)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x5a581a},_0x2f0d5b[_0x49c479(0x1e6)]),console['error'](a18_0x4f3c23[_0x49c479(0x19f)](_0x49c479(0x124)+a18_0x4f3c23[_0x49c479(0x180)](_0x49c479(0x14f))+_0x49c479(0x162)+a18_0x4f3c23[_0x49c479(0x1ca)](_0x5a581a))),0x0;if(!_0x2f0d5b['yes']&&(_0x249d31[_0x49c479(0x175)]>0x0||_0x504ef7[_0x49c479(0x175)]>0x0)){const _0x1e639d=await confirmKey(_0x49c479(0x19e)+(_0x249d31[_0x49c479(0x175)]+_0x504ef7[_0x49c479(0x175)])+_0x49c479(0x13d));if(!_0x1e639d)return console[_0x49c479(0x178)](_0x49c479(0x1e9)),0x1;}!existsSync(_0x337ad1)&&mkdirSync(_0x337ad1,{'recursive':!![]});for(const _0x3cd34f of _0x4f0579){(_0x3cd34f[_0x49c479(0x137)]||_0x3cd34f['hasChanges'])&&writeFileSync(_0x3cd34f[_0x49c479(0x11e)],_0x3cd34f[_0x49c479(0x1a5)],_0x49c479(0x1a7));}return console[_0x49c479(0x178)](a18_0x4f3c23[_0x49c479(0x19f)]('✔\x20Pulled\x20'+(_0x249d31[_0x49c479(0x175)]+_0x504ef7[_0x49c479(0x175)])+_0x49c479(0x17b)+_0x337ad1)),saveSessionContext({'parent_segment':_0x5a581a},_0x2f0d5b[_0x49c479(0x1e6)]),console['error'](a18_0x4f3c23[_0x49c479(0x19f)](_0x49c479(0x124)+a18_0x4f3c23['dim'](_0x49c479(0x14f))+'\x20=\x20'+a18_0x4f3c23['cyan'](_0x5a581a))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0xc8fd7f(0x15a)]='journey:push';[a18_0xc8fd7f(0x16c)]=a18_0xc8fd7f(0x1a3);[a18_0xc8fd7f(0x132)]=new SegmentPushCommand();async[a18_0xc8fd7f(0x1a6)](_0x5cfd35){const _0x1dae49=a18_0xc8fd7f,_0x295eb4={..._0x5cfd35,'options':{..._0x5cfd35['options'],'journeysOnly':!![]}};return this[_0x1dae49(0x132)][_0x1dae49(0x1a6)](_0x295eb4);}}
@@ -1 +1 @@
1
- function a19_0x309f(_0x1a0003,_0x42f7fa){_0x1a0003=_0x1a0003-0xb5;const _0x51a278=a19_0x51a2();let _0x309f9e=_0x51a278[_0x1a0003];return _0x309f9e;}const a19_0x1b1698=a19_0x309f;(function(_0x27efce,_0x4abee6){const _0x48d19f=a19_0x309f,_0x43e667=_0x27efce();while(!![]){try{const _0x949b92=-parseInt(_0x48d19f(0xdb))/0x1*(parseInt(_0x48d19f(0xd0))/0x2)+-parseInt(_0x48d19f(0xca))/0x3+-parseInt(_0x48d19f(0xb8))/0x4*(-parseInt(_0x48d19f(0xc8))/0x5)+parseInt(_0x48d19f(0xc9))/0x6*(-parseInt(_0x48d19f(0xd9))/0x7)+-parseInt(_0x48d19f(0xdd))/0x8+-parseInt(_0x48d19f(0xf0))/0x9*(parseInt(_0x48d19f(0xe7))/0xa)+parseInt(_0x48d19f(0xeb))/0xb;if(_0x949b92===_0x4abee6)break;else _0x43e667['push'](_0x43e667['shift']());}catch(_0x11ef35){_0x43e667['push'](_0x43e667['shift']());}}}(a19_0x51a2,0x77218));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a19_0x23f054 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a19_0x1b1698(0xd3)]='journey:validate';[a19_0x1b1698(0xe8)]=a19_0x1b1698(0xb9);async[a19_0x1b1698(0xbd)](_0x58b46e){const _0x289916=a19_0x1b1698,{options:_0xf3b3e0,args:_0x20b6e2}=_0x58b46e,_0x564122=_0xf3b3e0,_0x1a8ab5=await resolveTarget({'arg':_0x20b6e2[0x0],'contextParent':_0xf3b3e0[_0x289916(0xb5)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x1a8ab5))return _0x1a8ab5[_0x289916(0xf1)]===_0x289916(0xc5)?(console[_0x289916(0xcd)](a19_0x23f054[_0x289916(0xe2)](_0x289916(0xe5))),console[_0x289916(0xcd)](_0x289916(0xc1)),console[_0x289916(0xcd)](_0x289916(0xba)),console[_0x289916(0xcd)](_0x289916(0xd4))):(console['error'](a19_0x23f054[_0x289916(0xbf)](_0x289916(0xee)+_0x1a8ab5[_0x289916(0xc2)]+'\x0a')),_0x1a8ab5[_0x289916(0xd6)]&&console[_0x289916(0xcd)](a19_0x23f054[_0x289916(0xd1)](_0x1a8ab5[_0x289916(0xd6)]))),0x1;const _0x4524b8=_0x1a8ab5[_0x289916(0xdf)],_0x434a27=_0x1a8ab5[_0x289916(0xc3)]==='file'?_0x1a8ab5[_0x289916(0xbe)]:undefined;if(!_0x434a27&&!existsSync(_0x4524b8))return console[_0x289916(0xcd)](a19_0x23f054[_0x289916(0xbf)]('Error:\x20Directory\x20not\x20found:\x20'+_0x4524b8+'\x0a')),0x1;let _0x4371a0;if(_0x434a27){if(!_0x434a27[_0x289916(0xbc)](_0x289916(0xc4))&&!_0x434a27[_0x289916(0xbc)](_0x289916(0xe9)))return console[_0x289916(0xcd)](a19_0x23f054[_0x289916(0xbf)](_0x289916(0xdc)+_0x434a27+'\x0a')),0x1;_0x4371a0=[_0x434a27];}else _0x4371a0=findYamlFiles(_0x4524b8);if(_0x4371a0[_0x289916(0xcb)]===0x0)return console[_0x289916(0xcd)](a19_0x23f054['red'](_0x289916(0xe3)+_0x4524b8+'\x0a')),0x1;const _0x4fccf8=validateYamlFiles(_0x4371a0,_0x4524b8,{'filterType':_0x289916(0xed)}),_0x3ae963=calculateSummary(_0x4fccf8),_0x46ca61=_0x4fccf8[_0x289916(0xec)](isValidationResult);if(_0x46ca61['length']===0x0)return console[_0x289916(0xcd)](a19_0x23f054[_0x289916(0xe2)]('No\x20journey\x20YAML\x20files\x20found\x20in\x20'+_0x4524b8+'\x0a')),_0x3ae963[_0x289916(0xc6)]>0x0&&console[_0x289916(0xcd)](a19_0x23f054['dim']('('+_0x3ae963[_0x289916(0xc6)]+_0x289916(0xb6))),0x0;for(const _0x1c172a of _0x4fccf8){if(!isValidationResult(_0x1c172a)){_0x564122['verbose']&&console[_0x289916(0xce)](a19_0x23f054[_0x289916(0xda)]('-\x20'+_0x1c172a[_0x289916(0xcc)]+_0x289916(0xd2)+_0x1c172a['reason']+')'));continue;}const {relativePath:_0x5ed872,source:_0xa35def,result:_0x331e53}=_0x1c172a;if(_0x331e53['valid']&&_0x331e53['warnings'][_0x289916(0xcb)]===0x0)_0x564122[_0x289916(0xd7)]&&console[_0x289916(0xce)](a19_0x23f054[_0x289916(0xe4)]('✔\x20'+_0x5ed872));else _0x331e53[_0x289916(0xcf)]?(console[_0x289916(0xce)](a19_0x23f054[_0x289916(0xe2)]('⚠\x20'+_0x5ed872+':\x20'+_0x331e53[_0x289916(0xd8)]['length']+_0x289916(0xe1))),console[_0x289916(0xce)](formatValidationResult(_0x331e53,_0xa35def,_0x5ed872))):(console[_0x289916(0xce)](a19_0x23f054[_0x289916(0xbf)]('✖\x20'+_0x5ed872+':\x20'+_0x331e53[_0x289916(0xc0)][_0x289916(0xcb)]+'\x20error(s)')),console[_0x289916(0xce)](formatValidationResult(_0x331e53,_0xa35def,_0x5ed872)));}return console[_0x289916(0xce)](''),_0x3ae963[_0x289916(0xbb)]?(console['log'](a19_0x23f054[_0x289916(0xbf)]('Validation\x20failed:\x20'+_0x3ae963[_0x289916(0xd5)]+_0x289916(0xde)+_0x3ae963[_0x289916(0xe0)]+_0x289916(0xb7))),_0x3ae963['warningCount']>0x0&&console['log'](a19_0x23f054[_0x289916(0xe2)](_0x3ae963[_0x289916(0xe6)]+_0x289916(0xc7))),_0x3ae963[_0x289916(0xc6)]>0x0&&console[_0x289916(0xce)](a19_0x23f054[_0x289916(0xda)](_0x3ae963[_0x289916(0xc6)]+_0x289916(0xea))),0x1):(console['log'](a19_0x23f054['green']('✔\x20All\x20'+_0x3ae963['validCount']+_0x289916(0xef))),_0x3ae963['warningCount']>0x0&&console[_0x289916(0xce)](a19_0x23f054[_0x289916(0xe2)](_0x3ae963[_0x289916(0xe6)]+_0x289916(0xc7))),_0x3ae963[_0x289916(0xc6)]>0x0&&console[_0x289916(0xce)](a19_0x23f054[_0x289916(0xda)](_0x3ae963[_0x289916(0xc6)]+_0x289916(0xea))),0x0);}}function a19_0x51a2(){const _0x262a16=['targetDir','validCount','\x20warning(s)','yellow','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','green','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','warningCount','2154940KzmLNM','description','.yaml','\x20segment\x20file(s)\x20skipped','22753588ivJIab','filter','journey','Error:\x20','\x20journey(s)\x20valid','36hKyLfH','errorCode','parentSegment','\x20segment\x20file(s)\x20skipped)','\x20valid','8236eNTfjm','Validate\x20journey\x20YAML\x20files','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','hasErrors','endsWith','execute','filePath','red','errors','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','message','type','.yml','no_parent','skippedCount','\x20warning(s)\x20found','1265ykUUhQ','3306ninnTB','386049eRmBVv','length','relativePath','error','log','valid','30auQbTO','cyan','\x20(skipped:\x20','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','invalidCount','helpText','verbose','warnings','5768LQNIJe','dim','8081GrfaXe','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','4284616mUpYJS','\x20journey(s)\x20with\x20errors,\x20'];a19_0x51a2=function(){return _0x262a16;};return a19_0x51a2();}
1
+ function a19_0x4808(){const _0x336b58=['execute','file','errorCode','filePath','message','✔\x20All\x20','no_parent','4YdFmWD','yellow','Validate\x20journey\x20YAML\x20files','invalidCount','journey:validate','Error:\x20','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','warnings','helpText','\x20warning(s)','dim','green','\x20segment\x20file(s)\x20skipped','\x20(skipped:\x20','.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','2506110IoCxKB','red','journey','description','skippedCount','verbose','8pfUGri','15870GIAJVk','length','6142122SNkTMS','Validation\x20failed:\x20','name','error','parentSegment','32916JtpBnJ','type','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','3828785VmUTda','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','targetDir','587134TOjwuN','warningCount','No\x20journey\x20YAML\x20files\x20found\x20in\x20','validCount','relativePath','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20journey(s)\x20valid','4950IIOjBF','4429145wLbpRi','cyan','\x20error(s)','log','endsWith','\x20segment\x20file(s)\x20skipped)'];a19_0x4808=function(){return _0x336b58;};return a19_0x4808();}const a19_0x36e7af=a19_0x200c;function a19_0x200c(_0x2848ab,_0x4549fa){_0x2848ab=_0x2848ab-0xb8;const _0x480850=a19_0x4808();let _0x200c54=_0x480850[_0x2848ab];return _0x200c54;}(function(_0x473111,_0x351e11){const _0x41d4e2=a19_0x200c,_0x13b1b4=_0x473111();while(!![]){try{const _0x57f30e=-parseInt(_0x41d4e2(0xe5))/0x1+parseInt(_0x41d4e2(0xdf))/0x2+-parseInt(_0x41d4e2(0xd1))/0x3*(parseInt(_0x41d4e2(0xc1))/0x4)+parseInt(_0x41d4e2(0xe2))/0x5+parseInt(_0x41d4e2(0xda))/0x6+parseInt(_0x41d4e2(0xed))/0x7*(-parseInt(_0x41d4e2(0xd7))/0x8)+-parseInt(_0x41d4e2(0xec))/0x9*(-parseInt(_0x41d4e2(0xd8))/0xa);if(_0x57f30e===_0x351e11)break;else _0x13b1b4['push'](_0x13b1b4['shift']());}catch(_0x57a04a){_0x13b1b4['push'](_0x13b1b4['shift']());}}}(a19_0x4808,0x98399));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a19_0x16c9fb from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a19_0x36e7af(0xdc)]=a19_0x36e7af(0xc5);[a19_0x36e7af(0xd4)]=a19_0x36e7af(0xc3);async[a19_0x36e7af(0xba)](_0x27cc78){const _0x148db1=a19_0x36e7af,{options:_0x21f91e,args:_0x1ed3ae}=_0x27cc78,_0x33cfb0=_0x21f91e,_0x37b5e3=await resolveTarget({'arg':_0x1ed3ae[0x0],'contextParent':_0x21f91e[_0x148db1(0xde)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x37b5e3))return _0x37b5e3[_0x148db1(0xbc)]===_0x148db1(0xc0)?(console[_0x148db1(0xdd)](a19_0x16c9fb[_0x148db1(0xc2)](_0x148db1(0xe3))),console['error'](_0x148db1(0xe1)),console[_0x148db1(0xdd)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory'),console[_0x148db1(0xdd)](_0x148db1(0xd0))):(console['error'](a19_0x16c9fb[_0x148db1(0xd2)](_0x148db1(0xc6)+_0x37b5e3[_0x148db1(0xbe)]+'\x0a')),_0x37b5e3[_0x148db1(0xc9)]&&console['error'](a19_0x16c9fb[_0x148db1(0xee)](_0x37b5e3[_0x148db1(0xc9)]))),0x1;const _0x9e847c=_0x37b5e3[_0x148db1(0xe4)],_0x12134a=_0x37b5e3[_0x148db1(0xe0)]===_0x148db1(0xbb)?_0x37b5e3[_0x148db1(0xbd)]:undefined;if(!_0x12134a&&!existsSync(_0x9e847c))return console[_0x148db1(0xdd)](a19_0x16c9fb['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x9e847c+'\x0a')),0x1;let _0xe6eddb;if(_0x12134a){if(!_0x12134a[_0x148db1(0xb8)](_0x148db1(0xcf))&&!_0x12134a[_0x148db1(0xb8)]('.yaml'))return console[_0x148db1(0xdd)](a19_0x16c9fb[_0x148db1(0xd2)](_0x148db1(0xea)+_0x12134a+'\x0a')),0x1;_0xe6eddb=[_0x12134a];}else _0xe6eddb=findYamlFiles(_0x9e847c);if(_0xe6eddb['length']===0x0)return console[_0x148db1(0xdd)](a19_0x16c9fb[_0x148db1(0xd2)](_0x148db1(0xc7)+_0x9e847c+'\x0a')),0x1;const _0xb7a0bb=validateYamlFiles(_0xe6eddb,_0x9e847c,{'filterType':_0x148db1(0xd3)}),_0x5b6341=calculateSummary(_0xb7a0bb),_0x1b2369=_0xb7a0bb['filter'](isValidationResult);if(_0x1b2369[_0x148db1(0xd9)]===0x0)return console[_0x148db1(0xdd)](a19_0x16c9fb[_0x148db1(0xc2)](_0x148db1(0xe7)+_0x9e847c+'\x0a')),_0x5b6341['skippedCount']>0x0&&console['error'](a19_0x16c9fb[_0x148db1(0xcb)]('('+_0x5b6341[_0x148db1(0xd5)]+_0x148db1(0xb9))),0x0;for(const _0x202bbe of _0xb7a0bb){if(!isValidationResult(_0x202bbe)){_0x33cfb0[_0x148db1(0xd6)]&&console['log'](a19_0x16c9fb['dim']('-\x20'+_0x202bbe[_0x148db1(0xe9)]+_0x148db1(0xce)+_0x202bbe['reason']+')'));continue;}const {relativePath:_0xafa21a,source:_0x278475,result:_0x5019ff}=_0x202bbe;if(_0x5019ff['valid']&&_0x5019ff[_0x148db1(0xc8)][_0x148db1(0xd9)]===0x0)_0x33cfb0[_0x148db1(0xd6)]&&console[_0x148db1(0xf0)](a19_0x16c9fb[_0x148db1(0xcc)]('✔\x20'+_0xafa21a));else _0x5019ff['valid']?(console[_0x148db1(0xf0)](a19_0x16c9fb[_0x148db1(0xc2)]('⚠\x20'+_0xafa21a+':\x20'+_0x5019ff[_0x148db1(0xc8)]['length']+_0x148db1(0xca))),console[_0x148db1(0xf0)](formatValidationResult(_0x5019ff,_0x278475,_0xafa21a))):(console[_0x148db1(0xf0)](a19_0x16c9fb[_0x148db1(0xd2)]('✖\x20'+_0xafa21a+':\x20'+_0x5019ff['errors'][_0x148db1(0xd9)]+_0x148db1(0xef))),console[_0x148db1(0xf0)](formatValidationResult(_0x5019ff,_0x278475,_0xafa21a)));}return console['log'](''),_0x5b6341['hasErrors']?(console[_0x148db1(0xf0)](a19_0x16c9fb[_0x148db1(0xd2)](_0x148db1(0xdb)+_0x5b6341[_0x148db1(0xc4)]+'\x20journey(s)\x20with\x20errors,\x20'+_0x5b6341[_0x148db1(0xe8)]+'\x20valid')),_0x5b6341[_0x148db1(0xe6)]>0x0&&console[_0x148db1(0xf0)](a19_0x16c9fb[_0x148db1(0xc2)](_0x5b6341[_0x148db1(0xe6)]+'\x20warning(s)\x20found')),_0x5b6341[_0x148db1(0xd5)]>0x0&&console[_0x148db1(0xf0)](a19_0x16c9fb[_0x148db1(0xcb)](_0x5b6341[_0x148db1(0xd5)]+_0x148db1(0xcd))),0x1):(console[_0x148db1(0xf0)](a19_0x16c9fb[_0x148db1(0xcc)](_0x148db1(0xbf)+_0x5b6341[_0x148db1(0xe8)]+_0x148db1(0xeb))),_0x5b6341[_0x148db1(0xe6)]>0x0&&console[_0x148db1(0xf0)](a19_0x16c9fb[_0x148db1(0xc2)](_0x5b6341['warningCount']+'\x20warning(s)\x20found')),_0x5b6341[_0x148db1(0xd5)]>0x0&&console['log'](a19_0x16c9fb['dim'](_0x5b6341[_0x148db1(0xd5)]+'\x20segment\x20file(s)\x20skipped')),0x0);}}