@treasuredata/tdx 0.8.5 → 0.8.6

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 (115) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/api-command.js +1 -1
  15. package/dist/commands/auth-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.d.ts +1 -0
  18. package/dist/commands/claude-command.d.ts.map +1 -1
  19. package/dist/commands/claude-command.js +1 -1
  20. package/dist/commands/claude-command.js.map +1 -1
  21. package/dist/commands/claude-statusline-command.js +1 -1
  22. package/dist/commands/claude-usage-command.js +1 -1
  23. package/dist/commands/command.js +1 -1
  24. package/dist/commands/connection-command.js +1 -1
  25. package/dist/commands/context-command.js +1 -1
  26. package/dist/commands/databases.js +1 -1
  27. package/dist/commands/describe.js +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/llm-proxy.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profiles-command.js +1 -1
  35. package/dist/commands/query-command.js +1 -1
  36. package/dist/commands/segment-command.js +1 -1
  37. package/dist/commands/segment-create-command.js +1 -1
  38. package/dist/commands/segment-fields-command.js +1 -1
  39. package/dist/commands/segment-pull-command.js +1 -1
  40. package/dist/commands/segment-push-command.js +1 -1
  41. package/dist/commands/segment-update-command.js +1 -1
  42. package/dist/commands/segment-use-command.js +1 -1
  43. package/dist/commands/segments.js +1 -1
  44. package/dist/commands/show.js +1 -1
  45. package/dist/commands/tables.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/config.js +1 -1
  51. package/dist/core/connection-cache.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/proxy/anthropic-adapter.js +1 -1
  61. package/dist/proxy/claude-usage-tracker.js +1 -1
  62. package/dist/proxy/context-signature.js +1 -1
  63. package/dist/proxy/conversation-utils.js +1 -1
  64. package/dist/proxy/server.js +1 -1
  65. package/dist/proxy/session-cache.js +1 -1
  66. package/dist/sdk/api.js +1 -1
  67. package/dist/sdk/connection.js +1 -1
  68. package/dist/sdk/engage.js +1 -1
  69. package/dist/sdk/errors.js +1 -1
  70. package/dist/sdk/index.js +1 -1
  71. package/dist/sdk/job.js +1 -1
  72. package/dist/sdk/journey.js +1 -1
  73. package/dist/sdk/llm.js +1 -1
  74. package/dist/sdk/query.js +1 -1
  75. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  76. package/dist/sdk/segment/journey-yaml.js +1 -1
  77. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  78. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  79. package/dist/sdk/segment.js +1 -1
  80. package/dist/sdk/user.js +1 -1
  81. package/dist/sdk/workflow.js +1 -1
  82. package/dist/types/endpoints.js +1 -1
  83. package/dist/types/index.js +1 -1
  84. package/dist/utils/agent-ref-parser.js +1 -1
  85. package/dist/utils/async.js +1 -1
  86. package/dist/utils/chat-cache.js +1 -1
  87. package/dist/utils/colors.js +1 -1
  88. package/dist/utils/command-output.js +1 -1
  89. package/dist/utils/constants.js +1 -1
  90. package/dist/utils/diff.js +1 -1
  91. package/dist/utils/fields-display.js +1 -1
  92. package/dist/utils/file-permissions.js +1 -1
  93. package/dist/utils/format-detector.js +1 -1
  94. package/dist/utils/formatters.js +1 -1
  95. package/dist/utils/json-loader.js +1 -1
  96. package/dist/utils/llm-backup-utils.js +1 -1
  97. package/dist/utils/model-aliases.js +1 -1
  98. package/dist/utils/model-factors.js +1 -1
  99. package/dist/utils/option-validation.js +1 -1
  100. package/dist/utils/port.js +1 -1
  101. package/dist/utils/process.js +1 -1
  102. package/dist/utils/prompt.js +1 -1
  103. package/dist/utils/segment-path-parser.js +1 -1
  104. package/dist/utils/segment-ref-parser.js +1 -1
  105. package/dist/utils/spinner.js +1 -1
  106. package/dist/utils/sql-parser.js +1 -1
  107. package/dist/utils/sse-parser.js +1 -1
  108. package/dist/utils/string-utils.js +1 -1
  109. package/dist/utils/table-ref-parser.js +1 -1
  110. package/dist/utils/tdx-config.js +1 -1
  111. package/dist/utils/tdx-logger.js +1 -1
  112. package/dist/utils/tree-formatter.js +1 -1
  113. package/dist/utils/version-check.js +1 -1
  114. package/dist/utils/workflow-utils.js +1 -1
  115. package/package.json +1 -1
@@ -1 +1 @@
1
- const a21_0x12887d=a21_0x4e34;function a21_0x2de5(){const _0x3523db=['error','name','1095983AeyDbd','site','List\x20all\x20databases','6FEeGHy','databases','cause','20230SYWfDm','\x20database','limit','Listing\x20databases...','data','192632GMvZcx','89366fzZhwY','description','execute','1184725QPEAAo','1962XWuvqo','18ZKSjyB','length','message','70473QaTFDX','2248864eUfaVB','query','Pattern:\x20','verbose'];a21_0x2de5=function(){return _0x3523db;};return a21_0x2de5();}(function(_0x210dfb,_0x1fb028){const _0x2d6b5f=a21_0x4e34,_0x3320ae=_0x210dfb();while(!![]){try{const _0x21f34b=parseInt(_0x2d6b5f(0x1cf))/0x1+parseInt(_0x2d6b5f(0x1e2))/0x2*(parseInt(_0x2d6b5f(0x1cc))/0x3)+parseInt(_0x2d6b5f(0x1e1))/0x4+parseInt(_0x2d6b5f(0x1ca))/0x5*(-parseInt(_0x2d6b5f(0x1d9))/0x6)+parseInt(_0x2d6b5f(0x1d6))/0x7+parseInt(_0x2d6b5f(0x1d0))/0x8+-parseInt(_0x2d6b5f(0x1cb))/0x9*(parseInt(_0x2d6b5f(0x1dc))/0xa);if(_0x21f34b===_0x1fb028)break;else _0x3320ae['push'](_0x3320ae['shift']());}catch(_0x3193d7){_0x3320ae['push'](_0x3320ae['shift']());}}}(a21_0x2de5,0x23c0f));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';function a21_0x4e34(_0x15d61b,_0x5beabb){_0x15d61b=_0x15d61b-0x1ca;const _0x2de50d=a21_0x2de5();let _0x4e34eb=_0x2de50d[_0x15d61b];return _0x4e34eb;}export class DatabasesCommand extends BaseCommand{[a21_0x12887d(0x1d5)]=a21_0x12887d(0x1da);[a21_0x12887d(0x1e3)]=a21_0x12887d(0x1d8);async[a21_0x12887d(0x1e4)](_0x1253dd){const _0x3f59e3=a21_0x12887d,{options:_0x25b4d4,args:_0x14f430,tdx:_0x124791}=_0x1253dd,_0x4b2aac=_0x14f430[0x0];try{_0x25b4d4[_0x3f59e3(0x1d3)]&&(console[_0x3f59e3(0x1d4)]('Site:\x20'+_0x25b4d4[_0x3f59e3(0x1d7)]),_0x4b2aac&&console[_0x3f59e3(0x1d4)](_0x3f59e3(0x1d2)+_0x4b2aac));const _0x292aef=resolveLimit(_0x25b4d4[_0x3f59e3(0x1de)],DEFAULT_LISTING_LIMIT),_0x30eef6=await withSpinner(_0x3f59e3(0x1df),()=>_0x124791[_0x3f59e3(0x1d1)]['listDatabases'](_0x4b2aac,_0x292aef),{'verbose':_0x25b4d4[_0x3f59e3(0x1d3)]}),_0x388925=_0x30eef6[_0x3f59e3(0x1e0)];return console[_0x3f59e3(0x1d4)]('✔\x20Found\x20'+_0x388925['length']+_0x3f59e3(0x1dd)+(_0x388925[_0x3f59e3(0x1cd)]!==0x1?'s':'')),await handleSDKOutput(_0x388925,{..._0x25b4d4,'limit':_0x292aef}),0x0;}catch(_0x3c7c6f){if(_0x3c7c6f instanceof SDKError)return console[_0x3f59e3(0x1d4)]('Error:\x20'+_0x3c7c6f[_0x3f59e3(0x1ce)]),_0x3c7c6f['cause']&&console[_0x3f59e3(0x1d4)]('\x20\x20Cause:\x20'+_0x3c7c6f[_0x3f59e3(0x1db)]),0x1;throw _0x3c7c6f;}}}
1
+ const a21_0x35779a=a21_0x3e5c;(function(_0xf192ae,_0x36a33f){const _0x23acb1=a21_0x3e5c,_0x50b9b0=_0xf192ae();while(!![]){try{const _0x578326=parseInt(_0x23acb1(0x1a2))/0x1+parseInt(_0x23acb1(0x1af))/0x2*(-parseInt(_0x23acb1(0x1a9))/0x3)+-parseInt(_0x23acb1(0x1a0))/0x4*(parseInt(_0x23acb1(0x1a8))/0x5)+-parseInt(_0x23acb1(0x19b))/0x6+-parseInt(_0x23acb1(0x1b1))/0x7*(-parseInt(_0x23acb1(0x19d))/0x8)+parseInt(_0x23acb1(0x1a1))/0x9+parseInt(_0x23acb1(0x19a))/0xa;if(_0x578326===_0x36a33f)break;else _0x50b9b0['push'](_0x50b9b0['shift']());}catch(_0x36b89d){_0x50b9b0['push'](_0x50b9b0['shift']());}}}(a21_0x3fc8,0x36341));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a21_0x3fc8(){const _0x5e68b2=['961429mZvBKT','description','site','1258790YGODjr','430260tlXtDc','Pattern:\x20','8ThMAaB','databases','data','4CXrEBp','1054035zlKdiG','295295JxIxLZ','error','cause','message','length','execute','923060gmsdtr','591891hqMgJQ','Error:\x20','✔\x20Found\x20','\x20\x20Cause:\x20','verbose','List\x20all\x20databases','2birEPk','Site:\x20'];a21_0x3fc8=function(){return _0x5e68b2;};return a21_0x3fc8();}import{withSpinner}from'../utils/spinner.js';function a21_0x3e5c(_0x2819dc,_0x5a5012){_0x2819dc=_0x2819dc-0x19a;const _0x3fc89e=a21_0x3fc8();let _0x3e5c94=_0x3fc89e[_0x2819dc];return _0x3e5c94;}import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';export class DatabasesCommand extends BaseCommand{['name']=a21_0x35779a(0x19e);[a21_0x35779a(0x1b2)]=a21_0x35779a(0x1ae);async[a21_0x35779a(0x1a7)](_0x432611){const _0x5a93f9=a21_0x35779a,{options:_0x5b56bb,args:_0x44cc57,tdx:_0x39b71b}=_0x432611,_0x57946d=_0x44cc57[0x0];try{_0x5b56bb[_0x5a93f9(0x1ad)]&&(console[_0x5a93f9(0x1a3)](_0x5a93f9(0x1b0)+_0x5b56bb[_0x5a93f9(0x1b3)]),_0x57946d&&console[_0x5a93f9(0x1a3)](_0x5a93f9(0x19c)+_0x57946d));const _0x25541b=resolveLimit(_0x5b56bb['limit'],DEFAULT_LISTING_LIMIT),_0x293c0a=await withSpinner('Listing\x20databases...',()=>_0x39b71b['query']['listDatabases'](_0x57946d,_0x25541b),{'verbose':_0x5b56bb[_0x5a93f9(0x1ad)]}),_0x3ca71c=_0x293c0a[_0x5a93f9(0x19f)];return console[_0x5a93f9(0x1a3)](_0x5a93f9(0x1ab)+_0x3ca71c[_0x5a93f9(0x1a6)]+'\x20database'+(_0x3ca71c[_0x5a93f9(0x1a6)]!==0x1?'s':'')),await handleSDKOutput(_0x3ca71c,{..._0x5b56bb,'limit':_0x25541b}),0x0;}catch(_0x45e0b3){if(_0x45e0b3 instanceof SDKError)return console[_0x5a93f9(0x1a3)](_0x5a93f9(0x1aa)+_0x45e0b3[_0x5a93f9(0x1a5)]),_0x45e0b3[_0x5a93f9(0x1a4)]&&console[_0x5a93f9(0x1a3)](_0x5a93f9(0x1ac)+_0x45e0b3[_0x5a93f9(0x1a4)]),0x1;throw _0x45e0b3;}}}
@@ -1 +1 @@
1
- const a22_0x325a81=a22_0x45dd;(function(_0xa38cd5,_0x3feff2){const _0x7f4e13=a22_0x45dd,_0x109a1a=_0xa38cd5();while(!![]){try{const _0x350b11=parseInt(_0x7f4e13(0xe0))/0x1*(-parseInt(_0x7f4e13(0xe2))/0x2)+parseInt(_0x7f4e13(0xe1))/0x3+-parseInt(_0x7f4e13(0xf7))/0x4*(parseInt(_0x7f4e13(0xf2))/0x5)+-parseInt(_0x7f4e13(0xdc))/0x6*(-parseInt(_0x7f4e13(0xdb))/0x7)+parseInt(_0x7f4e13(0xf4))/0x8*(parseInt(_0x7f4e13(0xf8))/0x9)+-parseInt(_0x7f4e13(0xf5))/0xa+-parseInt(_0x7f4e13(0xee))/0xb*(-parseInt(_0x7f4e13(0xff))/0xc);if(_0x350b11===_0x3feff2)break;else _0x109a1a['push'](_0x109a1a['shift']());}catch(_0x12f9e2){_0x109a1a['push'](_0x109a1a['shift']());}}}(a22_0x5211,0x1f612));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a22_0x45dd(_0x279e1a,_0x432070){_0x279e1a=_0x279e1a-0xdb;const _0x52114b=a22_0x5211();let _0x45dd47=_0x52114b[_0x279e1a];return _0x45dd47;}function a22_0x5211(){const _0x467311=['Error:\x20','error','cause','\x20in\x20','Table:\x20','12wMlfbH','describeTable','\x20\x20Cause:\x20','\x27\x20does\x20not\x20exist','verbose','388269gKfPxK','6MhsTZp','describe','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','6ztfwtE','263103dEeAbM','46462CTSxNz','✔\x20Found\x20','✖\x20Table\x20not\x20found','args','validate','execute','length','\x20column','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','database','table','Site:\x20','778547LDCnta','Describe\x20table\x20schema','site','...','60355DvDWGG','data','8PQMwtJ','991080uGTWLB','query','32rHbgRn','2246823slogaF','name'];a22_0x5211=function(){return _0x467311;};return a22_0x5211();}import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a22_0x325a81(0xf9)]=a22_0x325a81(0xdd);['description']=a22_0x325a81(0xef);async[a22_0x325a81(0xe7)](_0x485fcf){const _0x387949=a22_0x325a81;return this[_0x387949(0x100)](_0x485fcf);}async[a22_0x325a81(0x100)](_0x33018b){const _0x445c27=a22_0x325a81,{options:_0x4fc3f8,args:_0x3236e2,tdx:_0x44deff}=_0x33018b;let _0x4b551c;try{_0x4b551c=parseTableReference(_0x3236e2[0x0]);const _0x35f3d6=_0x4fc3f8[_0x445c27(0xeb)];!_0x4b551c['database']&&_0x35f3d6&&(_0x4b551c[_0x445c27(0xeb)]=_0x35f3d6);const _0x1055b2=validateTableDescribeReference(_0x4b551c);if(_0x1055b2)return console['error']('Error:\x20'+_0x1055b2),0x1;}catch(_0x3e9550){return console[_0x445c27(0xfb)](_0x445c27(0xfa)+_0x3e9550[_0x445c27(0xde)]),0x1;}const _0x297a87=_0x4b551c[_0x445c27(0xeb)],_0x1c34bb=_0x4b551c[_0x445c27(0xec)];try{_0x4fc3f8[_0x445c27(0x103)]&&(console['error'](_0x445c27(0xed)+_0x4fc3f8[_0x445c27(0xf0)]),console['error']('Database:\x20'+_0x297a87),console[_0x445c27(0xfb)](_0x445c27(0xfe)+_0x1c34bb));const _0x41bb78=await withSpinner('Describing\x20table\x20'+_0x297a87+'.'+_0x1c34bb+_0x445c27(0xf1),()=>_0x44deff[_0x445c27(0xf6)][_0x445c27(0x100)](_0x297a87,_0x1c34bb),{'verbose':_0x4fc3f8['verbose']}),_0x392d63=_0x41bb78[_0x445c27(0xf3)];if(_0x392d63[_0x445c27(0xe8)]===0x0)return console['error'](_0x445c27(0xe4)),console[_0x445c27(0xfb)]('Table\x20\x27'+_0x297a87+'.'+_0x1c34bb+_0x445c27(0x102)),0x1;return console['error'](_0x445c27(0xe3)+_0x392d63[_0x445c27(0xe8)]+_0x445c27(0xe9)+(_0x392d63[_0x445c27(0xe8)]!==0x1?'s':'')+_0x445c27(0xfd)+_0x297a87+'.'+_0x1c34bb),await handleSDKOutput(_0x392d63,_0x4fc3f8),0x0;}catch(_0xa6d56a){if(_0xa6d56a instanceof SDKError)return console[_0x445c27(0xfb)]('Error:\x20'+_0xa6d56a[_0x445c27(0xde)]),_0xa6d56a[_0x445c27(0xfc)]&&console[_0x445c27(0xfb)](_0x445c27(0x101)+_0xa6d56a[_0x445c27(0xfc)]),0x1;throw _0xa6d56a;}}[a22_0x325a81(0xe6)](_0x4393ee){const _0x5d5f2b=a22_0x325a81;if(_0x4393ee[_0x5d5f2b(0xe5)][_0x5d5f2b(0xe8)]===0x0)return _0x5d5f2b(0xea);if(_0x4393ee[_0x5d5f2b(0xe5)][_0x5d5f2b(0xe8)]>0x1)return _0x5d5f2b(0xdf);return undefined;}}
1
+ const a22_0x9f6c42=a22_0x2e77;(function(_0xf714e9,_0x232484){const _0x21d297=a22_0x2e77,_0x233a27=_0xf714e9();while(!![]){try{const _0x42fa55=-parseInt(_0x21d297(0x143))/0x1*(parseInt(_0x21d297(0x150))/0x2)+parseInt(_0x21d297(0x141))/0x3+-parseInt(_0x21d297(0x142))/0x4+-parseInt(_0x21d297(0x133))/0x5+-parseInt(_0x21d297(0x13b))/0x6*(-parseInt(_0x21d297(0x153))/0x7)+parseInt(_0x21d297(0x138))/0x8+-parseInt(_0x21d297(0x13a))/0x9*(parseInt(_0x21d297(0x14a))/0xa);if(_0x42fa55===_0x232484)break;else _0x233a27['push'](_0x233a27['shift']());}catch(_0x4ce8b1){_0x233a27['push'](_0x233a27['shift']());}}}(a22_0x4b6d,0x4ad2b));import{BaseCommand}from'./command.js';function a22_0x2e77(_0x5b10df,_0x1c8c2c){_0x5b10df=_0x5b10df-0x133;const _0x4b6d0b=a22_0x4b6d();let _0x2e7780=_0x4b6d0b[_0x5b10df];return _0x2e7780;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';function a22_0x4b6d(){const _0x492db7=['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','\x27\x20does\x20not\x20exist','816789SqOoRV','375880opOMAN','152seJXfK','Table:\x20','data','site','length','describeTable','\x20\x20Cause:\x20','20RoyquG','Error:\x20','✖\x20Table\x20not\x20found','error','\x20in\x20','Describe\x20table\x20schema','2512MbLeCv','Table\x20\x27','database','2965928yurKwC','verbose','cause','378935rFinTP','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','message','...','execute','4744248oUdWtd','Database:\x20','2798343Dgplbm','6kejbXH','table','args','name'];a22_0x4b6d=function(){return _0x492db7;};return a22_0x4b6d();}import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a22_0x9f6c42(0x13e)]='describe';['description']=a22_0x9f6c42(0x14f);async[a22_0x9f6c42(0x137)](_0x3c9542){return this['describeTable'](_0x3c9542);}async[a22_0x9f6c42(0x148)](_0x19927e){const _0x441de7=a22_0x9f6c42,{options:_0x43368b,args:_0x39edff,tdx:_0x3cfe42}=_0x19927e;let _0x126a32;try{_0x126a32=parseTableReference(_0x39edff[0x0]);const _0x1f670a=_0x43368b[_0x441de7(0x152)];!_0x126a32[_0x441de7(0x152)]&&_0x1f670a&&(_0x126a32[_0x441de7(0x152)]=_0x1f670a);const _0x3e6db1=validateTableDescribeReference(_0x126a32);if(_0x3e6db1)return console[_0x441de7(0x14d)](_0x441de7(0x14b)+_0x3e6db1),0x1;}catch(_0x4c78f9){return console[_0x441de7(0x14d)](_0x441de7(0x14b)+_0x4c78f9['message']),0x1;}const _0x27ba7e=_0x126a32[_0x441de7(0x152)],_0x205021=_0x126a32[_0x441de7(0x13c)];try{_0x43368b['verbose']&&(console[_0x441de7(0x14d)]('Site:\x20'+_0x43368b[_0x441de7(0x146)]),console[_0x441de7(0x14d)](_0x441de7(0x139)+_0x27ba7e),console[_0x441de7(0x14d)](_0x441de7(0x144)+_0x205021));const _0x3062a6=await withSpinner('Describing\x20table\x20'+_0x27ba7e+'.'+_0x205021+_0x441de7(0x136),()=>_0x3cfe42['query']['describeTable'](_0x27ba7e,_0x205021),{'verbose':_0x43368b[_0x441de7(0x154)]}),_0x556d1b=_0x3062a6[_0x441de7(0x145)];if(_0x556d1b[_0x441de7(0x147)]===0x0)return console[_0x441de7(0x14d)](_0x441de7(0x14c)),console[_0x441de7(0x14d)](_0x441de7(0x151)+_0x27ba7e+'.'+_0x205021+_0x441de7(0x140)),0x1;return console['error']('✔\x20Found\x20'+_0x556d1b[_0x441de7(0x147)]+'\x20column'+(_0x556d1b[_0x441de7(0x147)]!==0x1?'s':'')+_0x441de7(0x14e)+_0x27ba7e+'.'+_0x205021),await handleSDKOutput(_0x556d1b,_0x43368b),0x0;}catch(_0x46f0b6){if(_0x46f0b6 instanceof SDKError)return console[_0x441de7(0x14d)](_0x441de7(0x14b)+_0x46f0b6[_0x441de7(0x135)]),_0x46f0b6[_0x441de7(0x155)]&&console[_0x441de7(0x14d)](_0x441de7(0x149)+_0x46f0b6[_0x441de7(0x155)]),0x1;throw _0x46f0b6;}}['validate'](_0x3171e9){const _0x23c5dc=a22_0x9f6c42;if(_0x3171e9[_0x23c5dc(0x13d)]['length']===0x0)return _0x23c5dc(0x13f);if(_0x3171e9[_0x23c5dc(0x13d)][_0x23c5dc(0x147)]>0x1)return _0x23c5dc(0x134);return undefined;}}
@@ -1 +1 @@
1
- const a23_0x5b6bf3=a23_0x472a;(function(_0x4d88a5,_0x7f21df){const _0x258c68=a23_0x472a,_0x24a12d=_0x4d88a5();while(!![]){try{const _0x29c0da=-parseInt(_0x258c68(0x159))/0x1+-parseInt(_0x258c68(0x1a7))/0x2*(parseInt(_0x258c68(0x1e1))/0x3)+-parseInt(_0x258c68(0x194))/0x4*(parseInt(_0x258c68(0x1b1))/0x5)+parseInt(_0x258c68(0x1c1))/0x6+-parseInt(_0x258c68(0x190))/0x7*(parseInt(_0x258c68(0x1df))/0x8)+-parseInt(_0x258c68(0x1e0))/0x9*(parseInt(_0x258c68(0x173))/0xa)+parseInt(_0x258c68(0x19d))/0xb;if(_0x29c0da===_0x7f21df)break;else _0x24a12d['push'](_0x24a12d['shift']());}catch(_0xd96e77){_0x24a12d['push'](_0x24a12d['shift']());}}}(a23_0x558b,0xee34c));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/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'../utils/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x4a0e2d,_0x300047,_0x414173=![]){const _0xa51595=a23_0x472a;if(_0x4a0e2d[_0xa51595(0x16d)])return await _0x300047[_0xa51595(0x170)][_0xa51595(0x1c4)](_0x4a0e2d[_0xa51595(0x16d)]);const _0x5585a7=loadSessionContext(_0x4a0e2d['session']);if(_0x5585a7?.[_0xa51595(0x183)])return await _0x300047['engage'][_0xa51595(0x1c4)](_0x5585a7['engage_workspace']);if(_0x414173)throw new SDKError(ErrorCode[_0xa51595(0x18d)],'Workspace\x20is\x20required\x20for\x20this\x20operation',undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x31a619,_0xa77f2b){const _0x36c32c=a23_0x472a;if(!_0x31a619[_0x36c32c(0x17c)])return{};const _0x42b431=_0x31a619[_0x36c32c(0x17c)],_0x312835=await _0xa77f2b[_0x36c32c(0x17c)][_0x36c32c(0x1ad)](_0x42b431);return{'audienceId':_0x312835[_0x36c32c(0x1ba)],'audienceName':_0x312835[_0x36c32c(0x160)],..._0x312835[_0x36c32c(0x177)]&&{'segmentId':_0x312835[_0x36c32c(0x177)],'segmentName':_0x312835[_0x36c32c(0x1aa)]}};}function buildConnectorConfig(_0x1a2497){const _0x120e0a=a23_0x472a,_0x568242=_0x1a2497[_0x120e0a(0x15a)],_0x158c3=_0x1a2497[_0x120e0a(0x1cf)];if(!_0x568242&&!_0x158c3)return undefined;return{..._0x568242&&{'emailSenderId':_0x568242},..._0x158c3&&{'jsonColumns':_0x158c3}};}export class EngageCampaignsCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1cb);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1c7);async[a23_0x5b6bf3(0x1ae)](_0x2bd45d){const _0x1a4cc4=a23_0x5b6bf3,{options:_0x4ef0fd,args:_0x194ec4,tdx:_0x51c974}=_0x2bd45d,_0x5a3f6d=_0x194ec4[0x0],_0x5d6395=resolveLimit(_0x4ef0fd[_0x1a4cc4(0x1d3)],DEFAULT_LLM_LIMIT),_0x31d3a9=_0x4ef0fd,_0x6a9653=_0x31d3a9[_0x1a4cc4(0x1c9)],_0x33e26c=_0x31d3a9[_0x1a4cc4(0x1c8)],_0x5908c3=await resolveWorkspaceIdFromOptions(_0x31d3a9,_0x51c974),_0x47d707=await withSpinner(_0x1a4cc4(0x157),()=>_0x51c974['engage'][_0x1a4cc4(0x1be)]({'type':_0x6a9653,'status':_0x33e26c,'workspaceId':_0x5908c3,'limit':_0x5d6395}),{'verbose':_0x4ef0fd['verbose']});let _0x4efd03=_0x47d707[_0x1a4cc4(0x1de)];return _0x5a3f6d&&(_0x4efd03=_0x47d707[_0x1a4cc4(0x1de)][_0x1a4cc4(0x17e)](_0xeedb6f=>matchGlobPattern(_0xeedb6f['name'],_0x5a3f6d))),await handleSDKOutput(_0x4efd03,_0x4ef0fd),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x179);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x17f);async[a23_0x5b6bf3(0x1ae)](_0x1e1f2d){const _0x587cf9=a23_0x5b6bf3,{options:_0x4769cf,args:_0x306d95,tdx:_0x924180}=_0x1e1f2d;if(_0x306d95[_0x587cf9(0x1b9)]===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x587cf9(0x1da)),0x1;const _0x2c7ead=_0x306d95[0x0],_0x1887ea=_0x4769cf,_0x3953f0=await resolveWorkspaceIdFromOptions(_0x1887ea,_0x924180),_0x37e2bd=_0x1887ea[_0x587cf9(0x1c3)];if(_0x37e2bd){const _0x3499cd=await withSpinner(_0x587cf9(0x1b8)+_0x2c7ead+_0x587cf9(0x1ce),()=>_0x924180['engage'][_0x587cf9(0x1af)](_0x2c7ead,_0x3953f0),{'verbose':_0x4769cf[_0x587cf9(0x198)]});await handleSDKOutput([_0x3499cd],_0x4769cf);}else{const _0x2b62a0=await withSpinner(_0x587cf9(0x1b8)+_0x2c7ead+'\x27...',()=>_0x924180[_0x587cf9(0x170)][_0x587cf9(0x1bd)](_0x2c7ead,_0x3953f0),{'verbose':_0x4769cf[_0x587cf9(0x198)]});await handleSDKOutput([_0x2b62a0],_0x4769cf);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:campaign:create';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1b7);async[a23_0x5b6bf3(0x1ae)](_0x59ef38){const _0x1748d5=a23_0x5b6bf3,{options:_0x4bae5b,tdx:_0x378874}=_0x59ef38,_0x4e432b=_0x4bae5b,_0x4d41ea=_0x4e432b[_0x1748d5(0x1e4)],_0x47a644=_0x4e432b[_0x1748d5(0x1c9)];if(!_0x4d41ea)return console['error'](_0x1748d5(0x182)),console[_0x1748d5(0x15d)](_0x1748d5(0x166)),0x1;if(!_0x47a644)return console[_0x1748d5(0x15d)](_0x1748d5(0x1b6)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;const _0x1214bb=await resolveWorkspaceIdFromOptions(_0x4e432b,_0x378874,!![]),_0x1e4134=await resolveSegmentFromOptions(_0x4e432b,_0x378874),_0x3d2a96=buildConnectorConfig(_0x4e432b),_0x5d6430={'name':_0x4d41ea,'campaignType':_0x47a644,'workspaceId':_0x1214bb,'description':_0x4e432b['description'],..._0x1e4134,'connectorConfig':_0x3d2a96,'startAt':_0x4e432b[_0x1748d5(0x165)],'timezone':_0x4e432b[_0x1748d5(0x176)]},_0x322edd=await withSpinner(_0x1748d5(0x164)+_0x4d41ea+'\x27...',()=>_0x378874[_0x1748d5(0x170)][_0x1748d5(0x167)](_0x5d6430));return await handleSDKOutput([_0x322edd[_0x1748d5(0x1de)]],_0x4bae5b),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1b0);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x163);async[a23_0x5b6bf3(0x1ae)](_0xe266c7){const _0xc92958=a23_0x5b6bf3,{options:_0x2b15f8,args:_0x82968e,tdx:_0x29ca9a}=_0xe266c7;if(_0x82968e['length']===0x0)return console['error'](_0xc92958(0x1d5)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x28158a=_0x82968e[0x0],_0x2e9d4e=_0x2b15f8,_0x405039=await resolveWorkspaceIdFromOptions(_0x2e9d4e,_0x29ca9a),_0x5cfa6c=await resolveSegmentFromOptions(_0x2e9d4e,_0x29ca9a),_0x428db8=buildConnectorConfig(_0x2e9d4e),_0x5d8198={'name':_0x2e9d4e[_0xc92958(0x1e4)],'description':_0x2e9d4e[_0xc92958(0x1db)],..._0x5cfa6c,'connectorConfig':_0x428db8,'startAt':_0x2e9d4e['startAt'],'timezone':_0x2e9d4e[_0xc92958(0x176)]},_0x18c224=Object['fromEntries'](Object['entries'](_0x5d8198)['filter'](([,_0x36e96a])=>_0x36e96a!==undefined));if(Object[_0xc92958(0x161)](_0x18c224)[_0xc92958(0x1b9)]===0x0)return console[_0xc92958(0x15d)](_0xc92958(0x169)),console[_0xc92958(0x15d)](_0xc92958(0x1e3)),0x1;const _0x2baede=await withSpinner(_0xc92958(0x17b)+_0x28158a+_0xc92958(0x1ce),()=>_0x29ca9a['engage'][_0xc92958(0x195)](_0x28158a,_0x18c224,_0x405039),{'verbose':_0x2b15f8['verbose']});return await handleSDKOutput([_0x2baede[_0xc92958(0x1de)]],_0x2b15f8),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{['name']=a23_0x5b6bf3(0x17d);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x197);async[a23_0x5b6bf3(0x1ae)](_0x48b78f){const _0x263661=a23_0x5b6bf3,{options:_0x23b049,args:_0x244b0b,tdx:_0x5df414}=_0x48b78f;if(_0x244b0b[_0x263661(0x1b9)]===0x0)return console[_0x263661(0x15d)](_0x263661(0x1d5)),console[_0x263661(0x15d)]('Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>'),0x1;const _0x3cb68c=_0x244b0b[0x0],_0x25df96=_0x23b049,_0x3a8b6d=await resolveWorkspaceIdFromOptions(_0x25df96,_0x5df414);if(!_0x23b049[_0x263661(0x1a5)]){const _0x589a57=await confirm(_0x263661(0x185)+_0x3cb68c+_0x263661(0x1dc));if(!_0x589a57)return console[_0x263661(0x1a1)](_0x263661(0x1a4)),0x0;}return await withSpinner('Deleting\x20campaign\x20\x27'+_0x3cb68c+_0x263661(0x1ce),()=>_0x5df414[_0x263661(0x170)][_0x263661(0x16a)](_0x3cb68c,_0x3a8b6d),{'verbose':_0x23b049[_0x263661(0x198)]}),console[_0x263661(0x1a1)](_0x263661(0x1a3)+_0x3cb68c+_0x263661(0x18a)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1ab);[a23_0x5b6bf3(0x1db)]='Launch\x20a\x20campaign';async[a23_0x5b6bf3(0x1ae)](_0xe6b0c8){const _0x198414=a23_0x5b6bf3,{options:_0x4a402,args:_0x2304e3,tdx:_0x2930e5}=_0xe6b0c8;if(_0x2304e3[_0x198414(0x1b9)]===0x0)return console['error'](_0x198414(0x1d5)),console[_0x198414(0x15d)]('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x4bf734=_0x2304e3[0x0],_0x409b1a=_0x4a402,_0x2e5667=await resolveWorkspaceIdFromOptions(_0x409b1a,_0x2930e5);return await withSpinner('Launching\x20campaign\x20\x27'+_0x4bf734+'\x27...',()=>_0x2930e5[_0x198414(0x170)]['launchCampaign'](_0x4bf734,_0x2e5667),{'verbose':_0x4a402[_0x198414(0x198)]}),console['log'](_0x198414(0x1a3)+_0x4bf734+_0x198414(0x1bc)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:campaign:pause';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1d4);async[a23_0x5b6bf3(0x1ae)](_0x42d9ee){const _0x17e3a8=a23_0x5b6bf3,{options:_0x8af5c1,args:_0xab351b,tdx:_0xf4058e}=_0x42d9ee;if(_0xab351b[_0x17e3a8(0x1b9)]===0x0)return console[_0x17e3a8(0x15d)](_0x17e3a8(0x1d5)),console[_0x17e3a8(0x15d)](_0x17e3a8(0x1c6)),0x1;const _0x302a53=_0xab351b[0x0],_0x18b70c=_0x8af5c1,_0xf76eda=await resolveWorkspaceIdFromOptions(_0x18b70c,_0xf4058e);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x302a53+_0x17e3a8(0x1ce),()=>_0xf4058e[_0x17e3a8(0x170)][_0x17e3a8(0x1ac)](_0x302a53,_0xf76eda),{'verbose':_0x8af5c1[_0x17e3a8(0x198)]}),console['log'](_0x17e3a8(0x1a3)+_0x302a53+_0x17e3a8(0x16c)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:campaign:resume';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x18c);async[a23_0x5b6bf3(0x1ae)](_0x4387bb){const _0x407d06=a23_0x5b6bf3,{options:_0x45a603,args:_0x2b8d2d,tdx:_0x12648a}=_0x4387bb;if(_0x2b8d2d[_0x407d06(0x1b9)]===0x0)return console['error'](_0x407d06(0x1d5)),console[_0x407d06(0x15d)](_0x407d06(0x158)),0x1;const _0x12ef9b=_0x2b8d2d[0x0],_0x5dfc46=_0x45a603,_0x1733a5=await resolveWorkspaceIdFromOptions(_0x5dfc46,_0x12648a);return await withSpinner('Resuming\x20campaign\x20\x27'+_0x12ef9b+_0x407d06(0x1ce),()=>_0x12648a[_0x407d06(0x170)]['resumeCampaign'](_0x12ef9b,_0x1733a5),{'verbose':_0x45a603['verbose']}),console[_0x407d06(0x1a1)](_0x407d06(0x1a3)+_0x12ef9b+_0x407d06(0x193)),0x0;}}function a23_0x558b(){const _0x993c24=['status','type','Deleting\x20template\x20\x27','engage:campaigns','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','Show\x20email\x20template\x20details','\x27...','jsonColumns','updateTemplate','Verifying\x20workspace\x20\x27','Create\x20a\x20workspace','limit','Pause\x20a\x20campaign','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Workspace\x20\x27','Fetching\x20workspace\x20\x27','getWorkspaceFull','deleteTemplate','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','description','\x27?\x20This\x20cannot\x20be\x20undone.','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','data','669192SDQUsn','120915QGnFVQ','1755564dcEzCX','engage:template:update','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','name','engage:template:create','fromEntries','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Fetching\x20campaigns...','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','404957llHCkF','emailSenderId','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','error','subject','Fetching\x20workspaces...','parentName','keys','engage:template:show','Update\x20a\x20campaign','Creating\x20campaign\x20\x27','startAt','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','createCampaign','Set\x20workspace\x20context\x20for\x20Engage\x20commands','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','deleteCampaign','Duplicating\x20campaign\x20\x27','\x27\x20paused\x20successfully','workspace','editorType','updateWorkspace','engage','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','1400idubmA','session','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','timezone','segmentId','listWorkspaces','engage:campaign:show','Fetching\x20templates...','Updating\x20campaign\x20\x27','segment','engage:campaign:delete','filter','Show\x20campaign\x20details','deleteWorkspace','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Error:\x20--name\x20is\x20required','engage_workspace','Template\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Error:\x20--html\x20is\x20required','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','engage:template:delete','Error:\x20--subject\x20is\x20required','\x27\x20deleted\x20successfully','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','Resume\x20a\x20paused\x20campaign','MISSING_ARGUMENT','plaintext','engage:workspace:use','7WKWWYn','createTemplate','Creating\x20template\x20\x27','\x27\x20resumed\x20successfully','73516tmpvaW','updateCampaign','getTemplate','Delete\x20a\x20campaign','verbose','html','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','getWorkspace','48014164XYWmkh','Creating\x20workspace\x20\x27','Show\x20workspace\x20details','engage:campaign:duplicate','log','Fetching\x20template\x20\x27','Campaign\x20\x27','Operation\x20cancelled','yes','Update\x20a\x20workspace','2omlhKG','Deleting\x20workspace\x20\x27','entries','segmentName','engage:campaign:launch','pauseCampaign','resolvePathToResource','execute','getCampaignFull','engage:campaign:update','365cHWnyq','listTemplates','Delete\x20an\x20email\x20template','engage:templates','List\x20workspaces','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Create\x20a\x20new\x20campaign','Fetching\x20campaign\x20\x27','length','parentId','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','\x27\x20launched\x20successfully','getCampaign','listCampaigns','engage:workspaces','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','5442774WMDlPM','Error:\x20Workspace\x20name\x20is\x20required','full','resolveWorkspaceId','Updating\x20template\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','List\x20campaigns'];a23_0x558b=function(){return _0x993c24;};return a23_0x558b();}export class EngageCampaignDuplicateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1a0);[a23_0x5b6bf3(0x1db)]='Duplicate\x20a\x20campaign';async[a23_0x5b6bf3(0x1ae)](_0x5cfd0e){const _0x3e1238=a23_0x5b6bf3,{options:_0x5e9b87,args:_0x1f0c93,tdx:_0x596b11}=_0x5cfd0e;if(_0x1f0c93[_0x3e1238(0x1b9)]===0x0)return console['error'](_0x3e1238(0x1d5)),console[_0x3e1238(0x15d)](_0x3e1238(0x171)),0x1;const _0x772a91=_0x1f0c93[0x0],_0x41574=_0x5e9b87,_0x190423=await resolveWorkspaceIdFromOptions(_0x41574,_0x596b11),_0x20c3d0=await withSpinner(_0x3e1238(0x16b)+_0x772a91+_0x3e1238(0x1ce),()=>_0x596b11[_0x3e1238(0x170)]['duplicateCampaign'](_0x772a91,_0x190423),{'verbose':_0x5e9b87['verbose']});return await handleSDKOutput([_0x20c3d0[_0x3e1238(0x1de)]],_0x5e9b87),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1b4);[a23_0x5b6bf3(0x1db)]='List\x20email\x20templates';async[a23_0x5b6bf3(0x1ae)](_0x442375){const _0x48d2c5=a23_0x5b6bf3,{options:_0x1522eb,args:_0x1bd210,tdx:_0x4f7cfb}=_0x442375,_0xc8e05f=_0x1bd210[0x0],_0x44ae15=resolveLimit(_0x1522eb[_0x48d2c5(0x1d3)],DEFAULT_LLM_LIMIT),_0x448a75=_0x1522eb,_0x301ebd=await resolveWorkspaceIdFromOptions(_0x448a75,_0x4f7cfb),_0x4488ff=await withSpinner(_0x48d2c5(0x17a),()=>_0x4f7cfb[_0x48d2c5(0x170)][_0x48d2c5(0x1b2)]({'workspaceId':_0x301ebd,'limit':_0x44ae15}),{'verbose':_0x1522eb['verbose']});let _0x34726c=_0x4488ff[_0x48d2c5(0x1de)];return _0xc8e05f&&(_0x34726c=_0x4488ff[_0x48d2c5(0x1de)][_0x48d2c5(0x17e)](_0x95cc1e=>matchGlobPattern(_0x95cc1e['name'],_0xc8e05f))),await handleSDKOutput(_0x34726c,_0x1522eb),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x162);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1cd);async[a23_0x5b6bf3(0x1ae)](_0x5e9111){const _0x235bde=a23_0x5b6bf3,{options:_0x17bdc9,args:_0x264fec,tdx:_0xa302ec}=_0x5e9111;if(_0x264fec[_0x235bde(0x1b9)]===0x0)return console[_0x235bde(0x15d)](_0x235bde(0x175)),console[_0x235bde(0x15d)](_0x235bde(0x1cc)),0x1;const _0x39185f=_0x264fec[0x0],_0x235ff8=_0x17bdc9,_0x475e12=await resolveWorkspaceIdFromOptions(_0x235ff8,_0xa302ec),_0x2aee81=_0x235ff8[_0x235bde(0x1c3)];if(_0x2aee81){const _0xb569ec=await withSpinner('Fetching\x20template\x20\x27'+_0x39185f+'\x27...',()=>_0xa302ec['engage']['getTemplateFull'](_0x39185f,_0x475e12),{'verbose':_0x17bdc9[_0x235bde(0x198)]});await handleSDKOutput([_0xb569ec],_0x17bdc9);}else{const _0x57aee7=await withSpinner(_0x235bde(0x1a2)+_0x39185f+_0x235bde(0x1ce),()=>_0xa302ec['engage'][_0x235bde(0x196)](_0x39185f,_0x475e12),{'verbose':_0x17bdc9[_0x235bde(0x198)]});await handleSDKOutput([_0x57aee7],_0x17bdc9);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1e5);['description']='Create\x20an\x20email\x20template';async[a23_0x5b6bf3(0x1ae)](_0x5af95f){const _0xa06598=a23_0x5b6bf3,{options:_0x19da71,tdx:_0x9f440e}=_0x5af95f,_0x3dfd65=_0x19da71,_0x45fad5=_0x3dfd65[_0xa06598(0x1e4)],_0x31336f=_0x3dfd65[_0xa06598(0x15e)],_0x4a1f98=_0x3dfd65[_0xa06598(0x199)];if(!_0x45fad5)return console['error'](_0xa06598(0x182)),console['error']('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x31336f)return console[_0xa06598(0x15d)](_0xa06598(0x189)),0x1;if(!_0x4a1f98)return console[_0xa06598(0x15d)](_0xa06598(0x186)),0x1;const _0x5d5aef=await resolveWorkspaceIdFromOptions(_0x3dfd65,_0x9f440e,!![]),_0x1f18e0={'name':_0x45fad5,'subjectTemplate':_0x31336f,'htmlTemplate':_0x4a1f98,'workspaceId':_0x5d5aef,'plaintextTemplate':_0x3dfd65[_0xa06598(0x18e)],'editorType':_0x3dfd65[_0xa06598(0x16e)]},_0x1fa20b=await withSpinner(_0xa06598(0x192)+_0x45fad5+'\x27...',()=>_0x9f440e[_0xa06598(0x170)][_0xa06598(0x191)](_0x1f18e0));return await handleSDKOutput([_0x1fa20b[_0xa06598(0x1de)]],_0x19da71),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1e2);['description']='Update\x20an\x20email\x20template';async[a23_0x5b6bf3(0x1ae)](_0x320eeb){const _0xf521e6=a23_0x5b6bf3,{options:_0x2ddf04,args:_0x50d51b,tdx:_0x49490a}=_0x320eeb;if(_0x50d51b['length']===0x0)return console[_0xf521e6(0x15d)](_0xf521e6(0x175)),console['error'](_0xf521e6(0x1bb)),0x1;const _0x1e5761=_0x50d51b[0x0],_0x2d2945=_0x2ddf04,_0x4717b5=await resolveWorkspaceIdFromOptions(_0x2d2945,_0x49490a),_0x2dec91={'name':_0x2d2945['name'],'subjectTemplate':_0x2d2945[_0xf521e6(0x15e)],'htmlTemplate':_0x2d2945[_0xf521e6(0x199)],'plaintextTemplate':_0x2d2945[_0xf521e6(0x18e)]},_0x466155=Object[_0xf521e6(0x1e6)](Object['entries'](_0x2dec91)[_0xf521e6(0x17e)](([,_0x577584])=>_0x577584!==undefined));if(Object[_0xf521e6(0x161)](_0x466155)[_0xf521e6(0x1b9)]===0x0)return console['error']('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0xf521e6(0x15d)](_0xf521e6(0x1c0)),0x1;const _0x5e6436=await withSpinner(_0xf521e6(0x1c5)+_0x1e5761+'\x27...',()=>_0x49490a[_0xf521e6(0x170)][_0xf521e6(0x1d0)](_0x1e5761,_0x466155,_0x4717b5),{'verbose':_0x2ddf04['verbose']});return await handleSDKOutput([_0x5e6436[_0xf521e6(0x1de)]],_0x2ddf04),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x188);['description']=a23_0x5b6bf3(0x1b3);async['execute'](_0x22f60e){const _0x9e5ffb=a23_0x5b6bf3,{options:_0x99789c,args:_0x5ae4f7,tdx:_0x351f91}=_0x22f60e;if(_0x5ae4f7['length']===0x0)return console[_0x9e5ffb(0x15d)](_0x9e5ffb(0x175)),console[_0x9e5ffb(0x15d)](_0x9e5ffb(0x187)),0x1;const _0x356483=_0x5ae4f7[0x0],_0x2a87dd=_0x99789c,_0x1e87fb=await resolveWorkspaceIdFromOptions(_0x2a87dd,_0x351f91);if(!_0x99789c['yes']){const _0x1596bf=await confirm(_0x9e5ffb(0x19a)+_0x356483+_0x9e5ffb(0x1dc));if(!_0x1596bf)return console[_0x9e5ffb(0x1a1)](_0x9e5ffb(0x1a4)),0x0;}return await withSpinner(_0x9e5ffb(0x1ca)+_0x356483+_0x9e5ffb(0x1ce),()=>_0x351f91['engage'][_0x9e5ffb(0x1d9)](_0x356483,_0x1e87fb),{'verbose':_0x99789c[_0x9e5ffb(0x198)]}),console[_0x9e5ffb(0x1a1)](_0x9e5ffb(0x184)+_0x356483+_0x9e5ffb(0x18a)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x1bf);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1b5);async['execute'](_0x285f3d){const _0x4f0ef5=a23_0x5b6bf3,{options:_0x1221c0,args:_0x51ffc9,tdx:_0x1d3255}=_0x285f3d,_0x15b006=_0x51ffc9[0x0],_0x2e363a=resolveLimit(_0x1221c0[_0x4f0ef5(0x1d3)],DEFAULT_LLM_LIMIT),_0x45cefc=await withSpinner(_0x4f0ef5(0x15f),()=>_0x1d3255[_0x4f0ef5(0x170)][_0x4f0ef5(0x178)]({'limit':_0x2e363a}),{'verbose':_0x1221c0['verbose']});let _0x385f14=_0x45cefc[_0x4f0ef5(0x1de)];return _0x15b006&&(_0x385f14=_0x45cefc['data'][_0x4f0ef5(0x17e)](_0x97ca89=>matchGlobPattern(_0x97ca89[_0x4f0ef5(0x1e4)],_0x15b006))),await handleSDKOutput(_0x385f14,_0x1221c0),0x0;}}function a23_0x472a(_0x25c90d,_0x1500eb){_0x25c90d=_0x25c90d-0x156;const _0x558bfb=a23_0x558b();let _0x472a4a=_0x558bfb[_0x25c90d];return _0x472a4a;}export class EngageWorkspaceShowCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:workspace:show';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x19f);async[a23_0x5b6bf3(0x1ae)](_0x149710){const _0x49ce8e=a23_0x5b6bf3,{options:_0x40e4ec,args:_0xa64315,tdx:_0x439ed3}=_0x149710;if(_0xa64315[_0x49ce8e(0x1b9)]===0x0)return console[_0x49ce8e(0x15d)](_0x49ce8e(0x15b)),console[_0x49ce8e(0x15d)](_0x49ce8e(0x18b)),0x1;const _0x369ca5=_0xa64315[0x0],_0x2681a8=_0x40e4ec,_0x219201=_0x2681a8[_0x49ce8e(0x1c3)];if(_0x219201){const _0x3eef80=await withSpinner(_0x49ce8e(0x1d7)+_0x369ca5+_0x49ce8e(0x1ce),()=>_0x439ed3[_0x49ce8e(0x170)][_0x49ce8e(0x1d8)](_0x369ca5),{'verbose':_0x40e4ec[_0x49ce8e(0x198)]});await handleSDKOutput([_0x3eef80],_0x40e4ec);}else{const _0x2aaf03=await withSpinner(_0x49ce8e(0x1d7)+_0x369ca5+'\x27...',()=>_0x439ed3[_0x49ce8e(0x170)][_0x49ce8e(0x19c)](_0x369ca5),{'verbose':_0x40e4ec['verbose']});await handleSDKOutput([_0x2aaf03],_0x40e4ec);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:workspace:create';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1d2);async[a23_0x5b6bf3(0x1ae)](_0x2f4118){const _0x329f4c=a23_0x5b6bf3,{options:_0x458a4b,tdx:_0x229410}=_0x2f4118,_0x5a7f4e=_0x458a4b,_0x2f6959=_0x5a7f4e[_0x329f4c(0x1e4)];if(!_0x2f6959)return console['error'](_0x329f4c(0x182)),console['error'](_0x329f4c(0x172)),0x1;const _0x51ed60={'name':_0x2f6959,'description':_0x5a7f4e[_0x329f4c(0x1db)]},_0x894b70=await withSpinner(_0x329f4c(0x19e)+_0x2f6959+'\x27...',()=>_0x229410[_0x329f4c(0x170)]['createWorkspace'](_0x51ed60));return await handleSDKOutput([_0x894b70['data']],_0x458a4b),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]='engage:workspace:update';[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x1a6);async['execute'](_0x538051){const _0x3cf12f=a23_0x5b6bf3,{options:_0x50b9fd,args:_0x5d6482,tdx:_0x67d3e6}=_0x538051;if(_0x5d6482[_0x3cf12f(0x1b9)]===0x0)return console[_0x3cf12f(0x15d)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x3cf12f(0x15c)),0x1;const _0x17a610=_0x5d6482[0x0],_0x4335df=_0x50b9fd,_0x544d34={'name':_0x4335df['name'],'description':_0x4335df[_0x3cf12f(0x1db)]},_0x1629f6=Object[_0x3cf12f(0x1e6)](Object[_0x3cf12f(0x1a9)](_0x544d34)[_0x3cf12f(0x17e)](([,_0x478842])=>_0x478842!==undefined));if(Object[_0x3cf12f(0x161)](_0x1629f6)[_0x3cf12f(0x1b9)]===0x0)return console[_0x3cf12f(0x15d)](_0x3cf12f(0x169)),console['error']('Options:\x20--name,\x20--description'),0x1;const _0x4e1539=await withSpinner('Updating\x20workspace\x20\x27'+_0x17a610+_0x3cf12f(0x1ce),()=>_0x67d3e6[_0x3cf12f(0x170)][_0x3cf12f(0x16f)](_0x17a610,_0x1629f6),{'verbose':_0x50b9fd[_0x3cf12f(0x198)]});return await handleSDKOutput([_0x4e1539['data']],_0x50b9fd),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{['name']='engage:workspace:delete';[a23_0x5b6bf3(0x1db)]='Delete\x20a\x20workspace';async[a23_0x5b6bf3(0x1ae)](_0x2b2baa){const _0x544a48=a23_0x5b6bf3,{options:_0x5e33ac,args:_0x2e44fa,tdx:_0x2c4aa2}=_0x2b2baa;if(_0x2e44fa[_0x544a48(0x1b9)]===0x0)return console[_0x544a48(0x15d)](_0x544a48(0x15b)),console[_0x544a48(0x15d)](_0x544a48(0x181)),0x1;const _0x188994=_0x2e44fa[0x0];if(!_0x5e33ac[_0x544a48(0x1a5)]){const _0x591104=await confirm(_0x544a48(0x1dd)+_0x188994+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x591104)return console[_0x544a48(0x1a1)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x544a48(0x1a8)+_0x188994+_0x544a48(0x1ce),()=>_0x2c4aa2[_0x544a48(0x170)][_0x544a48(0x180)](_0x188994),{'verbose':_0x5e33ac['verbose']}),console['log'](_0x544a48(0x1d6)+_0x188994+_0x544a48(0x18a)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a23_0x5b6bf3(0x1e4)]=a23_0x5b6bf3(0x18f);[a23_0x5b6bf3(0x1db)]=a23_0x5b6bf3(0x168);async[a23_0x5b6bf3(0x1ae)](_0x16f652){const _0x1b97f=a23_0x5b6bf3,{options:_0x24e25a,args:_0x35c768,tdx:_0x4f1084}=_0x16f652;if(_0x35c768[_0x1b97f(0x1b9)]===0x0)return console[_0x1b97f(0x15d)](_0x1b97f(0x1c2)),console[_0x1b97f(0x15d)](_0x1b97f(0x156)),0x1;const _0x548972=_0x35c768[0x0];await withSpinner(_0x1b97f(0x1d1)+_0x548972+_0x1b97f(0x1ce),()=>_0x4f1084['engage'][_0x1b97f(0x1c4)](_0x548972));const _0x45ad0b=_0x24e25a[_0x1b97f(0x174)]||undefined;return saveSessionContext({'engage_workspace':_0x548972},_0x45ad0b),console[_0x1b97f(0x1a1)]('Engage\x20workspace\x20set\x20to:\x20'+_0x548972),console[_0x1b97f(0x1a1)](_0x1b97f(0x19b)),0x0;}}
1
+ const a23_0xfe851f=a23_0x4a10;(function(_0x474033,_0x43a87c){const _0x38e345=a23_0x4a10,_0x348356=_0x474033();while(!![]){try{const _0x30ef87=parseInt(_0x38e345(0x1ff))/0x1+-parseInt(_0x38e345(0x1ea))/0x2+parseInt(_0x38e345(0x1f2))/0x3*(-parseInt(_0x38e345(0x1fc))/0x4)+parseInt(_0x38e345(0x1e5))/0x5*(parseInt(_0x38e345(0x1a9))/0x6)+parseInt(_0x38e345(0x20c))/0x7*(-parseInt(_0x38e345(0x1c2))/0x8)+parseInt(_0x38e345(0x183))/0x9+-parseInt(_0x38e345(0x1a7))/0xa*(-parseInt(_0x38e345(0x18f))/0xb);if(_0x30ef87===_0x43a87c)break;else _0x348356['push'](_0x348356['shift']());}catch(_0x4bcc94){_0x348356['push'](_0x348356['shift']());}}}(a23_0x30a6,0xbf831));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/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'../utils/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x1e05cf,_0x29b856,_0x3c01d8=![]){const _0x174e5d=a23_0x4a10;if(_0x1e05cf[_0x174e5d(0x184)])return await _0x29b856[_0x174e5d(0x208)][_0x174e5d(0x1c9)](_0x1e05cf[_0x174e5d(0x184)]);const _0x18959a=loadSessionContext(_0x1e05cf[_0x174e5d(0x175)]);if(_0x18959a?.[_0x174e5d(0x1f7)])return await _0x29b856[_0x174e5d(0x208)][_0x174e5d(0x1c9)](_0x18959a['engage_workspace']);if(_0x3c01d8)throw new SDKError(ErrorCode[_0x174e5d(0x193)],_0x174e5d(0x1f4),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x149fc7,_0x51ad0c){const _0x21d9f4=a23_0x4a10;if(!_0x149fc7[_0x21d9f4(0x1de)])return{};const _0x1631dd=_0x149fc7[_0x21d9f4(0x1de)],_0x2f4fa1=await _0x51ad0c[_0x21d9f4(0x1de)][_0x21d9f4(0x1cb)](_0x1631dd);return{'audienceId':_0x2f4fa1[_0x21d9f4(0x1d0)],'audienceName':_0x2f4fa1[_0x21d9f4(0x1ce)],..._0x2f4fa1['segmentId']&&{'segmentId':_0x2f4fa1[_0x21d9f4(0x1d6)],'segmentName':_0x2f4fa1[_0x21d9f4(0x1c8)]}};}function buildConnectorConfig(_0xf4d11){const _0x5db7d3=a23_0x4a10,_0x4c76d4=_0xf4d11[_0x5db7d3(0x1bd)],_0x38a279=_0xf4d11[_0x5db7d3(0x1d4)];if(!_0x4c76d4&&!_0x38a279)return undefined;return{..._0x4c76d4&&{'emailSenderId':_0x4c76d4},..._0x38a279&&{'jsonColumns':_0x38a279}};}export class EngageCampaignsCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x198);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ae);async[a23_0xfe851f(0x181)](_0x3c1f92){const _0x4d0d7e=a23_0xfe851f,{options:_0x123beb,args:_0x41f9e6,tdx:_0x1c4042}=_0x3c1f92,_0x596af2=_0x41f9e6[0x0],_0x40812c=resolveLimit(_0x123beb[_0x4d0d7e(0x186)],DEFAULT_LLM_LIMIT),_0x13ec93=_0x123beb,_0x29eaf8=_0x13ec93[_0x4d0d7e(0x1b1)],_0x35febb=_0x13ec93[_0x4d0d7e(0x1a0)],_0x1f1de5=await resolveWorkspaceIdFromOptions(_0x13ec93,_0x1c4042),_0x463432=await withSpinner(_0x4d0d7e(0x187),()=>_0x1c4042[_0x4d0d7e(0x208)][_0x4d0d7e(0x1f9)]({'type':_0x29eaf8,'status':_0x35febb,'workspaceId':_0x1f1de5,'limit':_0x40812c}),{'verbose':_0x123beb[_0x4d0d7e(0x1e9)]});let _0x1c6e09=_0x463432[_0x4d0d7e(0x1bb)];return _0x596af2&&(_0x1c6e09=_0x463432[_0x4d0d7e(0x1bb)]['filter'](_0x64ebc2=>matchGlobPattern(_0x64ebc2[_0x4d0d7e(0x1e3)],_0x596af2))),await handleSDKOutput(_0x1c6e09,_0x123beb),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{['name']='engage:campaign:show';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x189);async[a23_0xfe851f(0x181)](_0x1c7c50){const _0x30a382=a23_0xfe851f,{options:_0x48927c,args:_0x7cf4d4,tdx:_0x200a33}=_0x1c7c50;if(_0x7cf4d4[_0x30a382(0x1ad)]===0x0)return console[_0x30a382(0x17f)](_0x30a382(0x1a1)),console[_0x30a382(0x17f)](_0x30a382(0x202)),0x1;const _0x4406ba=_0x7cf4d4[0x0],_0x3dae08=_0x48927c,_0x10d6b9=await resolveWorkspaceIdFromOptions(_0x3dae08,_0x200a33),_0x5be8e1=_0x3dae08[_0x30a382(0x1d2)];if(_0x5be8e1){const _0x4c1394=await withSpinner(_0x30a382(0x17d)+_0x4406ba+_0x30a382(0x177),()=>_0x200a33[_0x30a382(0x208)][_0x30a382(0x17e)](_0x4406ba,_0x10d6b9),{'verbose':_0x48927c['verbose']});await handleSDKOutput([_0x4c1394],_0x48927c);}else{const _0x44ffde=await withSpinner(_0x30a382(0x17d)+_0x4406ba+_0x30a382(0x177),()=>_0x200a33['engage'][_0x30a382(0x207)](_0x4406ba,_0x10d6b9),{'verbose':_0x48927c[_0x30a382(0x1e9)]});await handleSDKOutput([_0x44ffde],_0x48927c);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x205);['description']=a23_0xfe851f(0x1b2);async['execute'](_0x5c26fe){const _0x17b13a=a23_0xfe851f,{options:_0x23fe74,tdx:_0x48d3e5}=_0x5c26fe,_0x5b0166=_0x23fe74,_0x995946=_0x5b0166[_0x17b13a(0x1e3)],_0x4c90e2=_0x5b0166[_0x17b13a(0x1b1)];if(!_0x995946)return console[_0x17b13a(0x17f)](_0x17b13a(0x1d9)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;if(!_0x4c90e2)return console[_0x17b13a(0x17f)]('Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)'),console[_0x17b13a(0x17f)](_0x17b13a(0x179)),0x1;const _0x3c3e80=await resolveWorkspaceIdFromOptions(_0x5b0166,_0x48d3e5,!![]),_0x1f3757=await resolveSegmentFromOptions(_0x5b0166,_0x48d3e5),_0x56b3a7=buildConnectorConfig(_0x5b0166),_0x22f3bb={'name':_0x995946,'campaignType':_0x4c90e2,'workspaceId':_0x3c3e80,'description':_0x5b0166[_0x17b13a(0x1e0)],..._0x1f3757,'connectorConfig':_0x56b3a7,'startAt':_0x5b0166[_0x17b13a(0x19a)],'timezone':_0x5b0166[_0x17b13a(0x197)]},_0x327015=await withSpinner(_0x17b13a(0x192)+_0x995946+_0x17b13a(0x177),()=>_0x48d3e5[_0x17b13a(0x208)][_0x17b13a(0x1b6)](_0x22f3bb));return await handleSDKOutput([_0x327015[_0x17b13a(0x1bb)]],_0x23fe74),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1db);['description']=a23_0xfe851f(0x1e2);async[a23_0xfe851f(0x181)](_0x4b8c0c){const _0x1d060c=a23_0xfe851f,{options:_0x501f36,args:_0x5cf2ab,tdx:_0x158e9d}=_0x4b8c0c;if(_0x5cf2ab[_0x1d060c(0x1ad)]===0x0)return console['error'](_0x1d060c(0x1a1)),console[_0x1d060c(0x17f)](_0x1d060c(0x1fd)),0x1;const _0x7bcee1=_0x5cf2ab[0x0],_0x257c24=_0x501f36,_0xff331f=await resolveWorkspaceIdFromOptions(_0x257c24,_0x158e9d),_0x844fbd=await resolveSegmentFromOptions(_0x257c24,_0x158e9d),_0x316c80=buildConnectorConfig(_0x257c24),_0x3bd4d0={'name':_0x257c24['name'],'description':_0x257c24[_0x1d060c(0x1e0)],..._0x844fbd,'connectorConfig':_0x316c80,'startAt':_0x257c24[_0x1d060c(0x19a)],'timezone':_0x257c24[_0x1d060c(0x197)]},_0x8c15da=Object['fromEntries'](Object[_0x1d060c(0x1c1)](_0x3bd4d0)[_0x1d060c(0x209)](([,_0x4747c3])=>_0x4747c3!==undefined));if(Object[_0x1d060c(0x188)](_0x8c15da)['length']===0x0)return console[_0x1d060c(0x17f)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x1d060c(0x17f)](_0x1d060c(0x1be)),0x1;const _0x332169=await withSpinner(_0x1d060c(0x18d)+_0x7bcee1+_0x1d060c(0x177),()=>_0x158e9d[_0x1d060c(0x208)][_0x1d060c(0x1b4)](_0x7bcee1,_0x8c15da,_0xff331f),{'verbose':_0x501f36[_0x1d060c(0x1e9)]});return await handleSDKOutput([_0x332169['data']],_0x501f36),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1dc);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1b3);async[a23_0xfe851f(0x181)](_0x4c4de4){const _0x3e0d0d=a23_0xfe851f,{options:_0x3a4db3,args:_0xd83545,tdx:_0x372e07}=_0x4c4de4;if(_0xd83545['length']===0x0)return console[_0x3e0d0d(0x17f)](_0x3e0d0d(0x1a1)),console['error'](_0x3e0d0d(0x1f8)),0x1;const _0x161b32=_0xd83545[0x0],_0x4e5207=_0x3a4db3,_0x4c8105=await resolveWorkspaceIdFromOptions(_0x4e5207,_0x372e07);if(!_0x3a4db3[_0x3e0d0d(0x19f)]){const _0x38da00=await confirm(_0x3e0d0d(0x18e)+_0x161b32+_0x3e0d0d(0x200));if(!_0x38da00)return console[_0x3e0d0d(0x1a2)](_0x3e0d0d(0x17a)),0x0;}return await withSpinner(_0x3e0d0d(0x18b)+_0x161b32+_0x3e0d0d(0x177),()=>_0x372e07[_0x3e0d0d(0x208)][_0x3e0d0d(0x1d5)](_0x161b32,_0x4c8105),{'verbose':_0x3a4db3['verbose']}),console[_0x3e0d0d(0x1a2)]('Campaign\x20\x27'+_0x161b32+_0x3e0d0d(0x1fb)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1ee);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x195);async[a23_0xfe851f(0x181)](_0x324c87){const _0x43a8bc=a23_0xfe851f,{options:_0xec244e,args:_0x9a54b3,tdx:_0x4aeeb4}=_0x324c87;if(_0x9a54b3[_0x43a8bc(0x1ad)]===0x0)return console['error'](_0x43a8bc(0x1a1)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x5c138a=_0x9a54b3[0x0],_0x567911=_0xec244e,_0x592931=await resolveWorkspaceIdFromOptions(_0x567911,_0x4aeeb4);return await withSpinner(_0x43a8bc(0x1d3)+_0x5c138a+_0x43a8bc(0x177),()=>_0x4aeeb4[_0x43a8bc(0x208)][_0x43a8bc(0x17b)](_0x5c138a,_0x592931),{'verbose':_0xec244e[_0x43a8bc(0x1e9)]}),console['log'](_0x43a8bc(0x19b)+_0x5c138a+_0x43a8bc(0x1fa)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1e6);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1e8);async[a23_0xfe851f(0x181)](_0xd71379){const _0x3fe876=a23_0xfe851f,{options:_0x5e920d,args:_0x114e8a,tdx:_0x82199d}=_0xd71379;if(_0x114e8a[_0x3fe876(0x1ad)]===0x0)return console['error'](_0x3fe876(0x1a1)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x76bc9c=_0x114e8a[0x0],_0x39f24d=_0x5e920d,_0x369c66=await resolveWorkspaceIdFromOptions(_0x39f24d,_0x82199d);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x76bc9c+'\x27...',()=>_0x82199d['engage']['pauseCampaign'](_0x76bc9c,_0x369c66),{'verbose':_0x5e920d[_0x3fe876(0x1e9)]}),console[_0x3fe876(0x1a2)](_0x3fe876(0x19b)+_0x76bc9c+_0x3fe876(0x190)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x201);[a23_0xfe851f(0x1e0)]='Resume\x20a\x20paused\x20campaign';async['execute'](_0x1dc459){const _0x11b039=a23_0xfe851f,{options:_0x20aee9,args:_0x33a887,tdx:_0x149863}=_0x1dc459;if(_0x33a887[_0x11b039(0x1ad)]===0x0)return console[_0x11b039(0x17f)](_0x11b039(0x1a1)),console[_0x11b039(0x17f)](_0x11b039(0x1b7)),0x1;const _0x42df34=_0x33a887[0x0],_0x1bc725=_0x20aee9,_0x1e01d0=await resolveWorkspaceIdFromOptions(_0x1bc725,_0x149863);return await withSpinner(_0x11b039(0x206)+_0x42df34+_0x11b039(0x177),()=>_0x149863[_0x11b039(0x208)][_0x11b039(0x19e)](_0x42df34,_0x1e01d0),{'verbose':_0x20aee9[_0x11b039(0x1e9)]}),console['log'](_0x11b039(0x19b)+_0x42df34+_0x11b039(0x18a)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']='engage:campaign:duplicate';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1f0);async[a23_0xfe851f(0x181)](_0x1448cf){const _0x273d31=a23_0xfe851f,{options:_0x1f7a6e,args:_0x3e42f7,tdx:_0x427bc7}=_0x1448cf;if(_0x3e42f7[_0x273d31(0x1ad)]===0x0)return console[_0x273d31(0x17f)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x273d31(0x17f)](_0x273d31(0x1a6)),0x1;const _0x58d630=_0x3e42f7[0x0],_0x23e073=_0x1f7a6e,_0x2fcb12=await resolveWorkspaceIdFromOptions(_0x23e073,_0x427bc7),_0x2a405f=await withSpinner(_0x273d31(0x1fe)+_0x58d630+_0x273d31(0x177),()=>_0x427bc7[_0x273d31(0x208)][_0x273d31(0x182)](_0x58d630,_0x2fcb12),{'verbose':_0x1f7a6e[_0x273d31(0x1e9)]});return await handleSDKOutput([_0x2a405f[_0x273d31(0x1bb)]],_0x1f7a6e),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1f5);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x20a);async[a23_0xfe851f(0x181)](_0x464082){const _0x10e1f2=a23_0xfe851f,{options:_0x1a7469,args:_0x1ef6e0,tdx:_0x49de5c}=_0x464082,_0x6d5e7e=_0x1ef6e0[0x0],_0x14a001=resolveLimit(_0x1a7469[_0x10e1f2(0x186)],DEFAULT_LLM_LIMIT),_0x570422=_0x1a7469,_0x509d0d=await resolveWorkspaceIdFromOptions(_0x570422,_0x49de5c),_0x100a1b=await withSpinner(_0x10e1f2(0x1ca),()=>_0x49de5c[_0x10e1f2(0x208)]['listTemplates']({'workspaceId':_0x509d0d,'limit':_0x14a001}),{'verbose':_0x1a7469[_0x10e1f2(0x1e9)]});let _0x54479d=_0x100a1b[_0x10e1f2(0x1bb)];return _0x6d5e7e&&(_0x54479d=_0x100a1b[_0x10e1f2(0x1bb)][_0x10e1f2(0x209)](_0x242157=>matchGlobPattern(_0x242157['name'],_0x6d5e7e))),await handleSDKOutput(_0x54479d,_0x1a7469),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1f6);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ba);async[a23_0xfe851f(0x181)](_0x170f58){const _0x38de76=a23_0xfe851f,{options:_0x56bc3e,args:_0x166f48,tdx:_0x33b128}=_0x170f58;if(_0x166f48[_0x38de76(0x1ad)]===0x0)return console[_0x38de76(0x17f)](_0x38de76(0x1c7)),console['error'](_0x38de76(0x1b0)),0x1;const _0x37ae96=_0x166f48[0x0],_0x385d47=_0x56bc3e,_0x298f0a=await resolveWorkspaceIdFromOptions(_0x385d47,_0x33b128),_0x2306bf=_0x385d47[_0x38de76(0x1d2)];if(_0x2306bf){const _0x1b7791=await withSpinner('Fetching\x20template\x20\x27'+_0x37ae96+_0x38de76(0x177),()=>_0x33b128['engage'][_0x38de76(0x1df)](_0x37ae96,_0x298f0a),{'verbose':_0x56bc3e['verbose']});await handleSDKOutput([_0x1b7791],_0x56bc3e);}else{const _0x301dcd=await withSpinner('Fetching\x20template\x20\x27'+_0x37ae96+_0x38de76(0x177),()=>_0x33b128[_0x38de76(0x208)][_0x38de76(0x1ef)](_0x37ae96,_0x298f0a),{'verbose':_0x56bc3e[_0x38de76(0x1e9)]});await handleSDKOutput([_0x301dcd],_0x56bc3e);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1eb);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1cd);async['execute'](_0x2a9ee6){const _0x5c40d5=a23_0xfe851f,{options:_0x2a77dc,tdx:_0x2e8953}=_0x2a9ee6,_0x3c13b2=_0x2a77dc,_0x6b474d=_0x3c13b2[_0x5c40d5(0x1e3)],_0x342f30=_0x3c13b2[_0x5c40d5(0x1cc)],_0x4a0799=_0x3c13b2['html'];if(!_0x6b474d)return console[_0x5c40d5(0x17f)](_0x5c40d5(0x1d9)),console[_0x5c40d5(0x17f)](_0x5c40d5(0x1e4)),0x1;if(!_0x342f30)return console[_0x5c40d5(0x17f)](_0x5c40d5(0x1bc)),0x1;if(!_0x4a0799)return console[_0x5c40d5(0x17f)]('Error:\x20--html\x20is\x20required'),0x1;const _0x21c465=await resolveWorkspaceIdFromOptions(_0x3c13b2,_0x2e8953,!![]),_0x52ca8f={'name':_0x6b474d,'subjectTemplate':_0x342f30,'htmlTemplate':_0x4a0799,'workspaceId':_0x21c465,'plaintextTemplate':_0x3c13b2[_0x5c40d5(0x1c0)],'editorType':_0x3c13b2[_0x5c40d5(0x1c4)]},_0x3cee6f=await withSpinner(_0x5c40d5(0x1cf)+_0x6b474d+_0x5c40d5(0x177),()=>_0x2e8953[_0x5c40d5(0x208)][_0x5c40d5(0x199)](_0x52ca8f));return await handleSDKOutput([_0x3cee6f[_0x5c40d5(0x1bb)]],_0x2a77dc),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]='engage:template:update';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1d1);async[a23_0xfe851f(0x181)](_0x5dde6a){const _0x444025=a23_0xfe851f,{options:_0x2e9a13,args:_0x3c001e,tdx:_0x5d80be}=_0x5dde6a;if(_0x3c001e[_0x444025(0x1ad)]===0x0)return console[_0x444025(0x17f)](_0x444025(0x1c7)),console['error'](_0x444025(0x1dd)),0x1;const _0x4af31c=_0x3c001e[0x0],_0x48c5f0=_0x2e9a13,_0x4176fe=await resolveWorkspaceIdFromOptions(_0x48c5f0,_0x5d80be),_0x1f7ad0={'name':_0x48c5f0[_0x444025(0x1e3)],'subjectTemplate':_0x48c5f0[_0x444025(0x1cc)],'htmlTemplate':_0x48c5f0['html'],'plaintextTemplate':_0x48c5f0[_0x444025(0x1c0)]},_0x13b7b9=Object[_0x444025(0x1a5)](Object[_0x444025(0x1c1)](_0x1f7ad0)[_0x444025(0x209)](([,_0xf8ab72])=>_0xf8ab72!==undefined));if(Object['keys'](_0x13b7b9)[_0x444025(0x1ad)]===0x0)return console[_0x444025(0x17f)](_0x444025(0x19c)),console[_0x444025(0x17f)](_0x444025(0x1af)),0x1;const _0x52b9b9=await withSpinner('Updating\x20template\x20\x27'+_0x4af31c+_0x444025(0x177),()=>_0x5d80be[_0x444025(0x208)]['updateTemplate'](_0x4af31c,_0x13b7b9,_0x4176fe),{'verbose':_0x2e9a13[_0x444025(0x1e9)]});return await handleSDKOutput([_0x52b9b9[_0x444025(0x1bb)]],_0x2e9a13),0x0;}}function a23_0x4a10(_0x10aa82,_0x2e547c){_0x10aa82=_0x10aa82-0x175;const _0x30a6ea=a23_0x30a6();let _0x4a10e5=_0x30a6ea[_0x10aa82];return _0x4a10e5;}export class EngageTemplateDeleteCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]='engage:template:delete';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ab);async[a23_0xfe851f(0x181)](_0x5aa347){const _0x1fe0a2=a23_0xfe851f,{options:_0x52e542,args:_0x4e9818,tdx:_0x951570}=_0x5aa347;if(_0x4e9818[_0x1fe0a2(0x1ad)]===0x0)return console[_0x1fe0a2(0x17f)](_0x1fe0a2(0x1c7)),console[_0x1fe0a2(0x17f)](_0x1fe0a2(0x20b)),0x1;const _0x3f95e3=_0x4e9818[0x0],_0x4474b0=_0x52e542,_0x5de7d3=await resolveWorkspaceIdFromOptions(_0x4474b0,_0x951570);if(!_0x52e542[_0x1fe0a2(0x19f)]){const _0x4b2dd3=await confirm(_0x1fe0a2(0x1f3)+_0x3f95e3+_0x1fe0a2(0x200));if(!_0x4b2dd3)return console[_0x1fe0a2(0x1a2)](_0x1fe0a2(0x17a)),0x0;}return await withSpinner(_0x1fe0a2(0x203)+_0x3f95e3+_0x1fe0a2(0x177),()=>_0x951570[_0x1fe0a2(0x208)][_0x1fe0a2(0x1d7)](_0x3f95e3,_0x5de7d3),{'verbose':_0x52e542[_0x1fe0a2(0x1e9)]}),console['log'](_0x1fe0a2(0x1e1)+_0x3f95e3+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']=a23_0xfe851f(0x19d);[a23_0xfe851f(0x1e0)]='List\x20workspaces';async[a23_0xfe851f(0x181)](_0x20656a){const _0x1ac69c=a23_0xfe851f,{options:_0x345fe4,args:_0x581086,tdx:_0x59a8c0}=_0x20656a,_0x2a753d=_0x581086[0x0],_0x3077ad=resolveLimit(_0x345fe4[_0x1ac69c(0x186)],DEFAULT_LLM_LIMIT),_0x5775b1=await withSpinner('Fetching\x20workspaces...',()=>_0x59a8c0['engage'][_0x1ac69c(0x1ed)]({'limit':_0x3077ad}),{'verbose':_0x345fe4[_0x1ac69c(0x1e9)]});let _0x140236=_0x5775b1[_0x1ac69c(0x1bb)];return _0x2a753d&&(_0x140236=_0x5775b1[_0x1ac69c(0x1bb)][_0x1ac69c(0x209)](_0x42ece4=>matchGlobPattern(_0x42ece4[_0x1ac69c(0x1e3)],_0x2a753d))),await handleSDKOutput(_0x140236,_0x345fe4),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]='engage:workspace:show';[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1a8);async[a23_0xfe851f(0x181)](_0x183a4f){const _0x2d59d9=a23_0xfe851f,{options:_0x13afa0,args:_0x1ed951,tdx:_0x5c0950}=_0x183a4f;if(_0x1ed951['length']===0x0)return console[_0x2d59d9(0x17f)](_0x2d59d9(0x1c5)),console[_0x2d59d9(0x17f)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x14d6c=_0x1ed951[0x0],_0x5d89f6=_0x13afa0,_0xd0cbc0=_0x5d89f6['full'];if(_0xd0cbc0){const _0x5f1182=await withSpinner(_0x2d59d9(0x1f1)+_0x14d6c+'\x27...',()=>_0x5c0950[_0x2d59d9(0x208)]['getWorkspaceFull'](_0x14d6c),{'verbose':_0x13afa0['verbose']});await handleSDKOutput([_0x5f1182],_0x13afa0);}else{const _0x2ca07e=await withSpinner('Fetching\x20workspace\x20\x27'+_0x14d6c+'\x27...',()=>_0x5c0950[_0x2d59d9(0x208)][_0x2d59d9(0x185)](_0x14d6c),{'verbose':_0x13afa0['verbose']});await handleSDKOutput([_0x2ca07e],_0x13afa0);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x1ac);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1a4);async['execute'](_0x3c3136){const _0x13f8bb=a23_0xfe851f,{options:_0x39d5cf,tdx:_0x50d073}=_0x3c3136,_0x260195=_0x39d5cf,_0x2db5d0=_0x260195[_0x13f8bb(0x1e3)];if(!_0x2db5d0)return console[_0x13f8bb(0x17f)]('Error:\x20--name\x20is\x20required'),console[_0x13f8bb(0x17f)]('Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]'),0x1;const _0x5341bb={'name':_0x2db5d0,'description':_0x260195[_0x13f8bb(0x1e0)]},_0x1ba220=await withSpinner(_0x13f8bb(0x1c6)+_0x2db5d0+_0x13f8bb(0x177),()=>_0x50d073[_0x13f8bb(0x208)][_0x13f8bb(0x1aa)](_0x5341bb));return await handleSDKOutput([_0x1ba220[_0x13f8bb(0x1bb)]],_0x39d5cf),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{['name']=a23_0xfe851f(0x18c);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1a3);async[a23_0xfe851f(0x181)](_0x5d6815){const _0x3cd220=a23_0xfe851f,{options:_0x4c4864,args:_0x29a4f4,tdx:_0x246783}=_0x5d6815;if(_0x29a4f4[_0x3cd220(0x1ad)]===0x0)return console[_0x3cd220(0x17f)](_0x3cd220(0x1c5)),console[_0x3cd220(0x17f)](_0x3cd220(0x1c3)),0x1;const _0x27346c=_0x29a4f4[0x0],_0x470a7a=_0x4c4864,_0x2d61b2={'name':_0x470a7a['name'],'description':_0x470a7a[_0x3cd220(0x1e0)]},_0x2b4fe2=Object[_0x3cd220(0x1a5)](Object[_0x3cd220(0x1c1)](_0x2d61b2)[_0x3cd220(0x209)](([,_0x223899])=>_0x223899!==undefined));if(Object[_0x3cd220(0x188)](_0x2b4fe2)[_0x3cd220(0x1ad)]===0x0)return console[_0x3cd220(0x17f)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x3cd220(0x17f)](_0x3cd220(0x178)),0x1;const _0x2ec8a3=await withSpinner(_0x3cd220(0x1b8)+_0x27346c+_0x3cd220(0x177),()=>_0x246783['engage'][_0x3cd220(0x196)](_0x27346c,_0x2b4fe2),{'verbose':_0x4c4864[_0x3cd220(0x1e9)]});return await handleSDKOutput([_0x2ec8a3[_0x3cd220(0x1bb)]],_0x4c4864),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{['name']=a23_0xfe851f(0x204);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1e7);async['execute'](_0xa8a20c){const _0x86764c=a23_0xfe851f,{options:_0xfa08f4,args:_0x2f3095,tdx:_0x1744bc}=_0xa8a20c;if(_0x2f3095['length']===0x0)return console['error']('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x86764c(0x1b5)),0x1;const _0x214c03=_0x2f3095[0x0];if(!_0xfa08f4[_0x86764c(0x19f)]){const _0x10265e=await confirm(_0x86764c(0x191)+_0x214c03+_0x86764c(0x200));if(!_0x10265e)return console[_0x86764c(0x1a2)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x86764c(0x1da)+_0x214c03+_0x86764c(0x177),()=>_0x1744bc[_0x86764c(0x208)][_0x86764c(0x176)](_0x214c03),{'verbose':_0xfa08f4[_0x86764c(0x1e9)]}),console[_0x86764c(0x1a2)](_0x86764c(0x1b9)+_0x214c03+_0x86764c(0x1fb)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a23_0xfe851f(0x1e3)]=a23_0xfe851f(0x194);[a23_0xfe851f(0x1e0)]=a23_0xfe851f(0x1ec);async[a23_0xfe851f(0x181)](_0x3df204){const _0xc04702=a23_0xfe851f,{options:_0x3cb49b,args:_0x361d7c,tdx:_0x2fcdf6}=_0x3df204;if(_0x361d7c[_0xc04702(0x1ad)]===0x0)return console[_0xc04702(0x17f)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0xc04702(0x17f)](_0xc04702(0x1d8)),0x1;const _0x14a1e1=_0x361d7c[0x0];await withSpinner(_0xc04702(0x17c)+_0x14a1e1+_0xc04702(0x177),()=>_0x2fcdf6[_0xc04702(0x208)][_0xc04702(0x1c9)](_0x14a1e1));const _0x1547ba=_0x3cb49b['session']||undefined;return saveSessionContext({'engage_workspace':_0x14a1e1},_0x1547ba),console['log'](_0xc04702(0x1bf)+_0x14a1e1),console[_0xc04702(0x1a2)](_0xc04702(0x180)),0x0;}}function a23_0x30a6(){const _0x181fa2=['createTemplate','startAt','Campaign\x20\x27','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','engage:workspaces','resumeCampaign','yes','status','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','log','Update\x20a\x20workspace','Create\x20a\x20workspace','fromEntries','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','20pAlxxa','Show\x20workspace\x20details','3138438yeSCVi','createWorkspace','Delete\x20an\x20email\x20template','engage:workspace:create','length','List\x20campaigns','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','type','Create\x20a\x20new\x20campaign','Delete\x20a\x20campaign','updateCampaign','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','createCampaign','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','Updating\x20workspace\x20\x27','Workspace\x20\x27','Show\x20email\x20template\x20details','data','Error:\x20--subject\x20is\x20required','emailSenderId','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','Engage\x20workspace\x20set\x20to:\x20','plaintext','entries','6438984EgZGcr','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','editorType','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Creating\x20workspace\x20\x27','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','segmentName','resolveWorkspaceId','Fetching\x20templates...','resolvePathToResource','subject','Create\x20an\x20email\x20template','parentName','Creating\x20template\x20\x27','parentId','Update\x20an\x20email\x20template','full','Launching\x20campaign\x20\x27','jsonColumns','deleteCampaign','segmentId','deleteTemplate','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Error:\x20--name\x20is\x20required','Deleting\x20workspace\x20\x27','engage:campaign:update','engage:campaign:delete','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','segment','getTemplateFull','description','Template\x20\x27','Update\x20a\x20campaign','name','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','5fjYkCa','engage:campaign:pause','Delete\x20a\x20workspace','Pause\x20a\x20campaign','verbose','2174194nebNrp','engage:template:create','Set\x20workspace\x20context\x20for\x20Engage\x20commands','listWorkspaces','engage:campaign:launch','getTemplate','Duplicate\x20a\x20campaign','Fetching\x20workspace\x20\x27','4305174jmzEZT','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Workspace\x20is\x20required\x20for\x20this\x20operation','engage:templates','engage:template:show','engage_workspace','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','listCampaigns','\x27\x20launched\x20successfully','\x27\x20deleted\x20successfully','4zRluBu','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Duplicating\x20campaign\x20\x27','222321sslZtv','\x27?\x20This\x20cannot\x20be\x20undone.','engage:campaign:resume','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Deleting\x20template\x20\x27','engage:workspace:delete','engage:campaign:create','Resuming\x20campaign\x20\x27','getCampaign','engage','filter','List\x20email\x20templates','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','7Eextem','session','deleteWorkspace','\x27...','Options:\x20--name,\x20--description','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Operation\x20cancelled','launchCampaign','Verifying\x20workspace\x20\x27','Fetching\x20campaign\x20\x27','getCampaignFull','error','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','execute','duplicateCampaign','11601873lRdqte','workspace','getWorkspace','limit','Fetching\x20campaigns...','keys','Show\x20campaign\x20details','\x27\x20resumed\x20successfully','Deleting\x20campaign\x20\x27','engage:workspace:update','Updating\x20campaign\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','11423335uuceHk','\x27\x20paused\x20successfully','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','Creating\x20campaign\x20\x27','MISSING_ARGUMENT','engage:workspace:use','Launch\x20a\x20campaign','updateWorkspace','timezone','engage:campaigns'];a23_0x30a6=function(){return _0x181fa2;};return a23_0x30a6();}
@@ -1 +1 @@
1
- const a24_0x2acb52=a24_0x1782;(function(_0x250183,_0x3b2a47){const _0x5cc38e=a24_0x1782,_0x43ed52=_0x250183();while(!![]){try{const _0x1a49e3=parseInt(_0x5cc38e(0xba))/0x1*(parseInt(_0x5cc38e(0x94))/0x2)+parseInt(_0x5cc38e(0x85))/0x3*(-parseInt(_0x5cc38e(0x84))/0x4)+-parseInt(_0x5cc38e(0x91))/0x5*(-parseInt(_0x5cc38e(0xc1))/0x6)+-parseInt(_0x5cc38e(0x88))/0x7+-parseInt(_0x5cc38e(0xa7))/0x8+-parseInt(_0x5cc38e(0x96))/0x9+-parseInt(_0x5cc38e(0x9d))/0xa*(-parseInt(_0x5cc38e(0xb1))/0xb);if(_0x1a49e3===_0x3b2a47)break;else _0x43ed52['push'](_0x43ed52['shift']());}catch(_0x168c7b){_0x43ed52['push'](_0x43ed52['shift']());}}}(a24_0x37f2,0xd3992));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a24_0x1782(_0x5c1625,_0xf36b0c){_0x5c1625=_0x5c1625-0x82;const _0x37f254=a24_0x37f2();let _0x178251=_0x37f254[_0x5c1625];return _0x178251;}import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a24_0x2acb52(0xcb)]=a24_0x2acb52(0xac);[a24_0x2acb52(0xc6)]=a24_0x2acb52(0xb7);async[a24_0x2acb52(0xb5)](_0x47d46b){const _0xb96b89=a24_0x2acb52,{options:_0x2f8257,tdx:_0x4ca3e1}=_0x47d46b;try{const _0x4a8341=resolveLimit(_0x2f8257['limit'],DEFAULT_DISPLAY_LIMIT),_0x132b0c=_0x2f8257[_0xb96b89(0xa2)];_0x2f8257[_0xb96b89(0x9b)]&&(console['error'](_0xb96b89(0x8b)+_0x4a8341+_0xb96b89(0xb2)),_0x132b0c&&console[_0xb96b89(0xc3)](_0xb96b89(0xd4)+_0x132b0c));const _0x3d62bf=await withSpinner(_0xb96b89(0xa8),()=>_0x4ca3e1[_0xb96b89(0xac)][_0xb96b89(0xc8)]({'from':0x0,'to':_0x4a8341-0x1,'status':_0x132b0c}),{'verbose':_0x2f8257[_0xb96b89(0x9b)]}),_0xbfc4b5=_0x3d62bf[_0xb96b89(0xc4)];console[_0xb96b89(0xc3)](_0xb96b89(0xce)+_0xbfc4b5[_0xb96b89(0xd0)]+'\x20job'+(_0xbfc4b5[_0xb96b89(0xd0)]!==0x1?'s':''));const _0x567225=_0xbfc4b5[_0xb96b89(0x9e)](_0x5b6e9c=>{const _0x53c842=_0xb96b89;let _0x31dc0a;if(_0x5b6e9c[_0x53c842(0x9c)]&&_0x5b6e9c[_0x53c842(0x8e)]){const _0x49e19b=new Date(_0x5b6e9c[_0x53c842(0x9c)])[_0x53c842(0xcf)](),_0x191c97=new Date(_0x5b6e9c[_0x53c842(0x8e)])[_0x53c842(0xcf)]();_0x31dc0a=Math[_0x53c842(0x92)]((_0x191c97-_0x49e19b)/0x3e8);}return{'job_id':_0x5b6e9c[_0x53c842(0xae)],'type':_0x5b6e9c[_0x53c842(0x90)],'status':_0x5b6e9c[_0x53c842(0xa2)],'user_name':_0x5b6e9c['user_name'],'duration_sec':_0x31dc0a,'created_at':_0x5b6e9c['created_at'],'started_at':_0x5b6e9c['start_at'],'end_at':_0x5b6e9c[_0x53c842(0x8e)]};});return await handleSDKOutput(_0x567225,_0x2f8257),0x0;}catch(_0x1a55a3){if(_0x1a55a3 instanceof SDKError)return console[_0xb96b89(0xc3)]('Error:\x20'+_0x1a55a3[_0xb96b89(0xb9)]),_0x1a55a3[_0xb96b89(0xa4)]&&console[_0xb96b89(0xc3)](_0xb96b89(0xc0)+_0x1a55a3[_0xb96b89(0xa4)]),0x1;throw _0x1a55a3;}}}export class JobShowCommand extends BaseCommand{['name']=a24_0x2acb52(0xd1);[a24_0x2acb52(0xc6)]=a24_0x2acb52(0xb4);async[a24_0x2acb52(0xb5)](_0x5d8537){const _0x5d4d9=a24_0x2acb52,{options:_0x268052,args:_0x107bab,tdx:_0x50b8cb}=_0x5d8537,_0xf53655=_0x107bab[0x0];if(!_0xf53655)return console[_0x5d4d9(0xc3)](_0x5d4d9(0xbc)),console[_0x5d4d9(0xc3)](_0x5d4d9(0xcd)),0x1;try{const _0x26f05f=await withSpinner(_0x5d4d9(0xaf),()=>_0x50b8cb[_0x5d4d9(0xac)]['show'](_0xf53655),{'verbose':_0x268052[_0x5d4d9(0x9b)]}),_0x1738c9=_0x26f05f[_0x5d4d9(0xc4)];let _0x512ade;if(_0x1738c9['start_at']&&_0x1738c9[_0x5d4d9(0x8e)]){const _0x17b8df=new Date(_0x1738c9[_0x5d4d9(0x9c)])[_0x5d4d9(0xcf)](),_0x4b9a8f=new Date(_0x1738c9['end_at'])[_0x5d4d9(0xcf)]();_0x512ade=Math[_0x5d4d9(0x92)]((_0x4b9a8f-_0x17b8df)/0x3e8);}const _0x343b8e={'job_id':_0x1738c9[_0x5d4d9(0xae)],'type':_0x1738c9[_0x5d4d9(0x90)],'status':_0x1738c9['status'],..._0x1738c9[_0x5d4d9(0xbb)]&&{'user_name':_0x1738c9[_0x5d4d9(0xbb)]},..._0x512ade!==undefined&&{'duration_sec':_0x512ade},..._0x1738c9[_0x5d4d9(0x97)]&&{'created_at':_0x1738c9[_0x5d4d9(0x97)]},..._0x1738c9[_0x5d4d9(0x9c)]&&{'started_at':_0x1738c9[_0x5d4d9(0x9c)]},..._0x1738c9[_0x5d4d9(0x8e)]&&{'end_at':_0x1738c9['end_at']},..._0x1738c9['database']&&{'database':_0x1738c9[_0x5d4d9(0x8a)]},..._0x1738c9['priority']!==undefined&&{'priority':_0x1738c9[_0x5d4d9(0x86)]},..._0x1738c9[_0x5d4d9(0xb8)]&&{'url':_0x1738c9['url']},..._0x1738c9['query']&&{'query':_0x1738c9[_0x5d4d9(0xab)]},..._0x1738c9[_0x5d4d9(0x83)]&&{'debug':_0x1738c9['debug']}};return await handleSingleObjectOutput(_0x343b8e,_0x268052),0x0;}catch(_0x110355){if(_0x110355 instanceof SDKError)return console[_0x5d4d9(0xc3)](_0x5d4d9(0xa5)+_0x110355[_0x5d4d9(0xb9)]),_0x110355[_0x5d4d9(0xa4)]&&console['error'](_0x5d4d9(0xc0)+_0x110355[_0x5d4d9(0xa4)]),0x1;throw _0x110355;}}}export class JobKillCommand extends BaseCommand{['name']=a24_0x2acb52(0xb6);[a24_0x2acb52(0xc6)]=a24_0x2acb52(0xbe);async[a24_0x2acb52(0xb5)](_0x55ceea){const _0x24ff95=a24_0x2acb52,{options:_0x2bc5b4,args:_0x380dd2,tdx:_0x241b40}=_0x55ceea,_0x4871fd=_0x380dd2[0x0];if(!_0x4871fd)return console[_0x24ff95(0xc3)](_0x24ff95(0xbc)),console['error'](_0x24ff95(0x93)),0x1;try{if(!_0x2bc5b4[_0x24ff95(0xd3)]){const _0x2f985a=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x4871fd+'?');if(!_0x2f985a)return console[_0x24ff95(0xc3)](_0x24ff95(0xcc)),0x0;}return await withSpinner(_0x24ff95(0x95),()=>_0x241b40[_0x24ff95(0xac)][_0x24ff95(0x9a)](_0x4871fd),{'verbose':_0x2bc5b4[_0x24ff95(0x9b)]}),console[_0x24ff95(0xc3)](_0x24ff95(0xa1)+_0x4871fd),console[_0x24ff95(0xc3)]('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x4871fd+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0x2d6087){if(_0x2d6087 instanceof SDKError)return console[_0x24ff95(0xc3)](_0x24ff95(0xa5)+_0x2d6087[_0x24ff95(0xb9)]),_0x2d6087['cause']&&console[_0x24ff95(0xc3)](_0x24ff95(0xc0)+_0x2d6087[_0x24ff95(0xa4)]),0x1;throw _0x2d6087;}}}function a24_0x37f2(){const _0x5d9020=['Getting\x20job\x20details...','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','10329litLXz','\x20jobs','Get\x20job\x20results','Show\x20job\x20details','execute','job:kill','List\x20jobs','url','message','2OeBdoi','user_name','Error:\x20Job\x20ID\x20is\x20required','jobType','Kill\x20a\x20job','Getting\x20job\x20results...','\x20\x20Cause:\x20','6wLPLDT','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','error','data','Submit\x20a\x20job','description','Job\x20type:\x20','list','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','trino','name','Cancelled','Usage:\x20job\x20show\x20<job-id>','✔\x20Found\x20','getTime','length','job:show','information_schema','yes','Status\x20filter:\x20','file','debug','6264jdQqjp','1518AFVlfM','priority','Query:\x20','11446057EUmueC','\x20row','database','Limit:\x20','✔\x20Job\x20submitted','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','end_at','job:submit','type','1165855eiMseT','round','Usage:\x20job\x20kill\x20<job-id>','561518wJzvgh','Submitting\x20kill\x20request...','13746609IgMvoP','created_at','hive','✔\x20Retrieved\x20','kill','verbose','start_at','50090znXGJS','map','result','...','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','status','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','cause','Error:\x20','Error:\x20Query\x20is\x20required','5411888QWRlGc','Listing\x20jobs...','job:result','\x20\x20Job\x20ID:\x20','query','jobs','Submitting\x20job...','job_id'];a24_0x37f2=function(){return _0x5d9020;};return a24_0x37f2();}export class JobSubmitCommand extends BaseCommand{[a24_0x2acb52(0xcb)]=a24_0x2acb52(0x8f);[a24_0x2acb52(0xc6)]=a24_0x2acb52(0xc5);async[a24_0x2acb52(0xb5)](_0x422557){const _0x456450=a24_0x2acb52,{options:_0x15c779,args:_0x3cd1d0,tdx:_0x477b7c}=_0x422557;try{const _0x5ce7c8=_0x15c779[_0x456450(0xbd)]||'trino',_0x5d9280=_0x15c779[_0x456450(0x82)],_0x3a71f5=_0x15c779[_0x456450(0x8a)]||_0x456450(0xd2);if(_0x5ce7c8!==_0x456450(0xca)&&_0x5ce7c8!==_0x456450(0x98))return console[_0x456450(0xc3)](_0x456450(0xb0)),0x1;let _0x180af3;if(_0x5d9280){if(_0x3cd1d0[0x0])return console['error'](_0x456450(0xc9)),0x1;const _0x550766=readSqlStatementsFromFile(_0x5d9280);if(_0x550766[_0x456450(0xd0)]===0x0)return console[_0x456450(0xc3)](_0x456450(0xa3)),0x1;if(_0x550766[_0x456450(0xd0)]>0x1)return console[_0x456450(0xc3)](_0x456450(0x8d)),0x1;_0x180af3=_0x550766[0x0];}else{if(!_0x3cd1d0[0x0])return console[_0x456450(0xc3)](_0x456450(0xa6)),console['error'](_0x456450(0xc2)),0x1;_0x180af3=_0x3cd1d0[0x0];}_0x15c779[_0x456450(0x9b)]&&(console[_0x456450(0xc3)](_0x456450(0xc7)+_0x5ce7c8),console['error']('Database:\x20'+_0x3a71f5),console[_0x456450(0xc3)](_0x456450(0x87)+_0x180af3['substring'](0x0,0x64)+(_0x180af3[_0x456450(0xd0)]>0x64?_0x456450(0xa0):'')));const _0x242059=await withSpinner(_0x456450(0xad),()=>_0x477b7c[_0x456450(0xac)]['submit'](_0x3a71f5,_0x180af3,_0x5ce7c8),{'verbose':_0x15c779['verbose']}),_0x30ad60=_0x242059['data'];return console['error'](_0x456450(0x8c)),console[_0x456450(0xc3)](_0x456450(0xaa)+_0x30ad60['job_id']),await handleSDKOutput([_0x30ad60],_0x15c779),0x0;}catch(_0x5cc021){if(_0x5cc021 instanceof SDKError)return console[_0x456450(0xc3)](_0x456450(0xa5)+_0x5cc021['message']),_0x5cc021[_0x456450(0xa4)]&&console[_0x456450(0xc3)](_0x456450(0xc0)+_0x5cc021[_0x456450(0xa4)]),0x1;throw _0x5cc021;}}}export class JobResultCommand extends BaseCommand{[a24_0x2acb52(0xcb)]=a24_0x2acb52(0xa9);[a24_0x2acb52(0xc6)]=a24_0x2acb52(0xb3);async[a24_0x2acb52(0xb5)](_0x2af9b0){const _0x45fb7b=a24_0x2acb52,{options:_0x5ed403,args:_0x45a6ca,tdx:_0x2b8cda}=_0x2af9b0,_0x581a25=_0x45a6ca[0x0];if(!_0x581a25)return console[_0x45fb7b(0xc3)](_0x45fb7b(0xbc)),console[_0x45fb7b(0xc3)]('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x2e5e27=await withSpinner(_0x45fb7b(0xbf),()=>_0x2b8cda['jobs'][_0x45fb7b(0x9f)](_0x581a25),{'verbose':_0x5ed403[_0x45fb7b(0x9b)]}),_0x55e703=_0x2e5e27[_0x45fb7b(0xc4)];return console[_0x45fb7b(0xc3)](_0x45fb7b(0x99)+_0x55e703[_0x45fb7b(0xd0)]+_0x45fb7b(0x89)+(_0x55e703[_0x45fb7b(0xd0)]!==0x1?'s':'')),await handleSDKOutput(_0x55e703,_0x5ed403),0x0;}catch(_0x7557c3){if(_0x7557c3 instanceof SDKError)return console[_0x45fb7b(0xc3)](_0x45fb7b(0xa5)+_0x7557c3['message']),_0x7557c3[_0x45fb7b(0xa4)]&&console['error']('\x20\x20Cause:\x20'+_0x7557c3[_0x45fb7b(0xa4)]),0x1;throw _0x7557c3;}}}
1
+ const a24_0x118125=a24_0x29b0;(function(_0x23bd42,_0x715e86){const _0x25f636=a24_0x29b0,_0x105e89=_0x23bd42();while(!![]){try{const _0x339801=-parseInt(_0x25f636(0x1bc))/0x1*(-parseInt(_0x25f636(0x1cb))/0x2)+parseInt(_0x25f636(0x1c1))/0x3+-parseInt(_0x25f636(0x1de))/0x4+parseInt(_0x25f636(0x1a9))/0x5*(-parseInt(_0x25f636(0x1b8))/0x6)+-parseInt(_0x25f636(0x1a5))/0x7*(parseInt(_0x25f636(0x1dd))/0x8)+-parseInt(_0x25f636(0x1da))/0x9+parseInt(_0x25f636(0x1cc))/0xa;if(_0x339801===_0x715e86)break;else _0x105e89['push'](_0x105e89['shift']());}catch(_0x47a030){_0x105e89['push'](_0x105e89['shift']());}}}(a24_0x3d55,0xbec57));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a24_0x3d55(){const _0xcb41=['Submitting\x20kill\x20request...','round','verbose','debug','✔\x20Retrieved\x20','Usage:\x20job\x20show\x20<job-id>','50KDERWe','18781870dWylNm','job_id','trino','show','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','limit','Get\x20job\x20results','Database:\x20','Usage:\x20job\x20kill\x20<job-id>','\x20\x20Job\x20ID:\x20','description','file','name','database','8642889tKvBcA','Kill\x20a\x20job','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','1416GFyCuy','2134100tzufut','start_at','\x20jobs','type','information_schema','length','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','hive','...','submit','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','Submitting\x20job...','user_name','job:kill','kill','list','cause','jobType','message','Error:\x20','List\x20jobs','created_at','10402XZYGwN','job:submit','\x20job','job:result','5OWnAWQ','query','error','priority','execute','jobs','url','Submit\x20a\x20job','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','\x20\x20Cause:\x20','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','Job\x20type:\x20','Listing\x20jobs...','getTime','end_at','1319250TZzxar','✔\x20Job\x20submitted','\x20row','Limit:\x20','397UUOFZo','status','result','Error:\x20Query\x20is\x20required','Getting\x20job\x20details...','2610090vkGvHZ','Show\x20job\x20details','Error:\x20Job\x20ID\x20is\x20required','data'];a24_0x3d55=function(){return _0xcb41;};return a24_0x3d55();}import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a24_0x118125(0x1d8)]='jobs';[a24_0x118125(0x1d6)]=a24_0x118125(0x1a3);async[a24_0x118125(0x1ad)](_0x2e01c3){const _0x361732=a24_0x118125,{options:_0x3c572c,tdx:_0x106659}=_0x2e01c3;try{const _0x4dc6dc=resolveLimit(_0x3c572c[_0x361732(0x1d1)],DEFAULT_DISPLAY_LIMIT),_0x5f01c7=_0x3c572c['status'];_0x3c572c[_0x361732(0x1c7)]&&(console['error'](_0x361732(0x1bb)+_0x4dc6dc+_0x361732(0x1e0)),_0x5f01c7&&console[_0x361732(0x1ab)]('Status\x20filter:\x20'+_0x5f01c7));const _0x1c5f77=await withSpinner(_0x361732(0x1b5),()=>_0x106659[_0x361732(0x1ae)][_0x361732(0x1ed)]({'from':0x0,'to':_0x4dc6dc-0x1,'status':_0x5f01c7}),{'verbose':_0x3c572c[_0x361732(0x1c7)]}),_0x2b723a=_0x1c5f77['data'];console[_0x361732(0x1ab)]('✔\x20Found\x20'+_0x2b723a[_0x361732(0x1e3)]+_0x361732(0x1a7)+(_0x2b723a[_0x361732(0x1e3)]!==0x1?'s':''));const _0x5f5c96=_0x2b723a['map'](_0x2dafaf=>{const _0x31c207=_0x361732;let _0x240e9c;if(_0x2dafaf[_0x31c207(0x1df)]&&_0x2dafaf[_0x31c207(0x1b7)]){const _0x4a6f77=new Date(_0x2dafaf[_0x31c207(0x1df)])[_0x31c207(0x1b6)](),_0x38e0e3=new Date(_0x2dafaf['end_at'])[_0x31c207(0x1b6)]();_0x240e9c=Math[_0x31c207(0x1c6)]((_0x38e0e3-_0x4a6f77)/0x3e8);}return{'job_id':_0x2dafaf[_0x31c207(0x1cd)],'type':_0x2dafaf[_0x31c207(0x1e1)],'status':_0x2dafaf['status'],'user_name':_0x2dafaf[_0x31c207(0x1ea)],'duration_sec':_0x240e9c,'created_at':_0x2dafaf[_0x31c207(0x1a4)],'started_at':_0x2dafaf[_0x31c207(0x1df)],'end_at':_0x2dafaf[_0x31c207(0x1b7)]};});return await handleSDKOutput(_0x5f5c96,_0x3c572c),0x0;}catch(_0x29fa93){if(_0x29fa93 instanceof SDKError)return console[_0x361732(0x1ab)](_0x361732(0x1a2)+_0x29fa93[_0x361732(0x1a1)]),_0x29fa93[_0x361732(0x1ee)]&&console['error'](_0x361732(0x1b2)+_0x29fa93['cause']),0x1;throw _0x29fa93;}}}export class JobShowCommand extends BaseCommand{[a24_0x118125(0x1d8)]='job:show';[a24_0x118125(0x1d6)]=a24_0x118125(0x1c2);async[a24_0x118125(0x1ad)](_0x5304f2){const _0x554497=a24_0x118125,{options:_0x1eaf3f,args:_0x2d332c,tdx:_0x1b794d}=_0x5304f2,_0x4e320b=_0x2d332c[0x0];if(!_0x4e320b)return console[_0x554497(0x1ab)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x554497(0x1ab)](_0x554497(0x1ca)),0x1;try{const _0x5f23ac=await withSpinner(_0x554497(0x1c0),()=>_0x1b794d[_0x554497(0x1ae)][_0x554497(0x1cf)](_0x4e320b),{'verbose':_0x1eaf3f[_0x554497(0x1c7)]}),_0x17c09c=_0x5f23ac[_0x554497(0x1c4)];let _0x4df7c4;if(_0x17c09c['start_at']&&_0x17c09c[_0x554497(0x1b7)]){const _0x2d8210=new Date(_0x17c09c[_0x554497(0x1df)])[_0x554497(0x1b6)](),_0x331630=new Date(_0x17c09c[_0x554497(0x1b7)])['getTime']();_0x4df7c4=Math[_0x554497(0x1c6)]((_0x331630-_0x2d8210)/0x3e8);}const _0x30cc47={'job_id':_0x17c09c[_0x554497(0x1cd)],'type':_0x17c09c[_0x554497(0x1e1)],'status':_0x17c09c[_0x554497(0x1bd)],..._0x17c09c[_0x554497(0x1ea)]&&{'user_name':_0x17c09c['user_name']},..._0x4df7c4!==undefined&&{'duration_sec':_0x4df7c4},..._0x17c09c[_0x554497(0x1a4)]&&{'created_at':_0x17c09c[_0x554497(0x1a4)]},..._0x17c09c[_0x554497(0x1df)]&&{'started_at':_0x17c09c[_0x554497(0x1df)]},..._0x17c09c[_0x554497(0x1b7)]&&{'end_at':_0x17c09c[_0x554497(0x1b7)]},..._0x17c09c['database']&&{'database':_0x17c09c[_0x554497(0x1d9)]},..._0x17c09c['priority']!==undefined&&{'priority':_0x17c09c[_0x554497(0x1ac)]},..._0x17c09c[_0x554497(0x1af)]&&{'url':_0x17c09c['url']},..._0x17c09c[_0x554497(0x1aa)]&&{'query':_0x17c09c['query']},..._0x17c09c[_0x554497(0x1c8)]&&{'debug':_0x17c09c[_0x554497(0x1c8)]}};return await handleSingleObjectOutput(_0x30cc47,_0x1eaf3f),0x0;}catch(_0x5e10e5){if(_0x5e10e5 instanceof SDKError)return console[_0x554497(0x1ab)](_0x554497(0x1a2)+_0x5e10e5[_0x554497(0x1a1)]),_0x5e10e5[_0x554497(0x1ee)]&&console['error'](_0x554497(0x1b2)+_0x5e10e5['cause']),0x1;throw _0x5e10e5;}}}function a24_0x29b0(_0x596ff3,_0x578877){_0x596ff3=_0x596ff3-0x1a1;const _0x3d5533=a24_0x3d55();let _0x29b02e=_0x3d5533[_0x596ff3];return _0x29b02e;}export class JobKillCommand extends BaseCommand{[a24_0x118125(0x1d8)]=a24_0x118125(0x1eb);[a24_0x118125(0x1d6)]=a24_0x118125(0x1db);async[a24_0x118125(0x1ad)](_0x500f91){const _0x18d14f=a24_0x118125,{options:_0x16b28f,args:_0x431be5,tdx:_0x489248}=_0x500f91,_0x25137a=_0x431be5[0x0];if(!_0x25137a)return console[_0x18d14f(0x1ab)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x18d14f(0x1ab)](_0x18d14f(0x1d4)),0x1;try{if(!_0x16b28f['yes']){const _0x2e7ea6=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x25137a+'?');if(!_0x2e7ea6)return console[_0x18d14f(0x1ab)]('Cancelled'),0x0;}return await withSpinner(_0x18d14f(0x1c5),()=>_0x489248[_0x18d14f(0x1ae)][_0x18d14f(0x1ec)](_0x25137a),{'verbose':_0x16b28f['verbose']}),console['error'](_0x18d14f(0x1dc)+_0x25137a),console['error']('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x25137a+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0x4242cf){if(_0x4242cf instanceof SDKError)return console[_0x18d14f(0x1ab)]('Error:\x20'+_0x4242cf[_0x18d14f(0x1a1)]),_0x4242cf[_0x18d14f(0x1ee)]&&console[_0x18d14f(0x1ab)](_0x18d14f(0x1b2)+_0x4242cf[_0x18d14f(0x1ee)]),0x1;throw _0x4242cf;}}}export class JobSubmitCommand extends BaseCommand{[a24_0x118125(0x1d8)]=a24_0x118125(0x1a6);[a24_0x118125(0x1d6)]=a24_0x118125(0x1b0);async[a24_0x118125(0x1ad)](_0x350bbb){const _0x2149d9=a24_0x118125,{options:_0x353db8,args:_0x498853,tdx:_0x25fd46}=_0x350bbb;try{const _0x2f32a2=_0x353db8[_0x2149d9(0x1ef)]||'trino',_0x31f515=_0x353db8[_0x2149d9(0x1d7)],_0x389648=_0x353db8[_0x2149d9(0x1d9)]||_0x2149d9(0x1e2);if(_0x2f32a2!==_0x2149d9(0x1ce)&&_0x2f32a2!==_0x2149d9(0x1e5))return console[_0x2149d9(0x1ab)](_0x2149d9(0x1b1)),0x1;let _0x7d5b69;if(_0x31f515){if(_0x498853[0x0])return console[_0x2149d9(0x1ab)](_0x2149d9(0x1d0)),0x1;const _0x2449ba=readSqlStatementsFromFile(_0x31f515);if(_0x2449ba[_0x2149d9(0x1e3)]===0x0)return console[_0x2149d9(0x1ab)](_0x2149d9(0x1b3)),0x1;if(_0x2449ba[_0x2149d9(0x1e3)]>0x1)return console['error'](_0x2149d9(0x1e8)),0x1;_0x7d5b69=_0x2449ba[0x0];}else{if(!_0x498853[0x0])return console[_0x2149d9(0x1ab)](_0x2149d9(0x1bf)),console[_0x2149d9(0x1ab)](_0x2149d9(0x1e4)),0x1;_0x7d5b69=_0x498853[0x0];}_0x353db8[_0x2149d9(0x1c7)]&&(console[_0x2149d9(0x1ab)](_0x2149d9(0x1b4)+_0x2f32a2),console['error'](_0x2149d9(0x1d3)+_0x389648),console[_0x2149d9(0x1ab)]('Query:\x20'+_0x7d5b69['substring'](0x0,0x64)+(_0x7d5b69[_0x2149d9(0x1e3)]>0x64?_0x2149d9(0x1e6):'')));const _0x7cff2b=await withSpinner(_0x2149d9(0x1e9),()=>_0x25fd46[_0x2149d9(0x1ae)][_0x2149d9(0x1e7)](_0x389648,_0x7d5b69,_0x2f32a2),{'verbose':_0x353db8[_0x2149d9(0x1c7)]}),_0x37153d=_0x7cff2b['data'];return console[_0x2149d9(0x1ab)](_0x2149d9(0x1b9)),console[_0x2149d9(0x1ab)](_0x2149d9(0x1d5)+_0x37153d[_0x2149d9(0x1cd)]),await handleSDKOutput([_0x37153d],_0x353db8),0x0;}catch(_0x257da3){if(_0x257da3 instanceof SDKError)return console[_0x2149d9(0x1ab)](_0x2149d9(0x1a2)+_0x257da3[_0x2149d9(0x1a1)]),_0x257da3[_0x2149d9(0x1ee)]&&console[_0x2149d9(0x1ab)](_0x2149d9(0x1b2)+_0x257da3[_0x2149d9(0x1ee)]),0x1;throw _0x257da3;}}}export class JobResultCommand extends BaseCommand{[a24_0x118125(0x1d8)]=a24_0x118125(0x1a8);[a24_0x118125(0x1d6)]=a24_0x118125(0x1d2);async[a24_0x118125(0x1ad)](_0x49fff4){const _0x397a0b=a24_0x118125,{options:_0x34e72e,args:_0x244bee,tdx:_0x116999}=_0x49fff4,_0x4c3ff8=_0x244bee[0x0];if(!_0x4c3ff8)return console[_0x397a0b(0x1ab)](_0x397a0b(0x1c3)),console['error']('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x16b1b6=await withSpinner('Getting\x20job\x20results...',()=>_0x116999[_0x397a0b(0x1ae)][_0x397a0b(0x1be)](_0x4c3ff8),{'verbose':_0x34e72e[_0x397a0b(0x1c7)]}),_0xa25138=_0x16b1b6[_0x397a0b(0x1c4)];return console[_0x397a0b(0x1ab)](_0x397a0b(0x1c9)+_0xa25138[_0x397a0b(0x1e3)]+_0x397a0b(0x1ba)+(_0xa25138[_0x397a0b(0x1e3)]!==0x1?'s':'')),await handleSDKOutput(_0xa25138,_0x34e72e),0x0;}catch(_0x4b6fa2){if(_0x4b6fa2 instanceof SDKError)return console[_0x397a0b(0x1ab)](_0x397a0b(0x1a2)+_0x4b6fa2[_0x397a0b(0x1a1)]),_0x4b6fa2['cause']&&console[_0x397a0b(0x1ab)]('\x20\x20Cause:\x20'+_0x4b6fa2[_0x397a0b(0x1ee)]),0x1;throw _0x4b6fa2;}}}
@@ -1 +1 @@
1
- const a25_0x443b0d=a25_0x1ad5;(function(_0x20186b,_0x1cb070){const _0x2e404f=a25_0x1ad5,_0x17f1a0=_0x20186b();while(!![]){try{const _0x1c6a7e=parseInt(_0x2e404f(0x1d8))/0x1+-parseInt(_0x2e404f(0x195))/0x2+-parseInt(_0x2e404f(0x1f8))/0x3*(parseInt(_0x2e404f(0x204))/0x4)+parseInt(_0x2e404f(0x1e9))/0x5+-parseInt(_0x2e404f(0x1f2))/0x6+-parseInt(_0x2e404f(0x1b6))/0x7+parseInt(_0x2e404f(0x1be))/0x8*(parseInt(_0x2e404f(0x191))/0x9);if(_0x1c6a7e===_0x1cb070)break;else _0x17f1a0['push'](_0x17f1a0['shift']());}catch(_0x3e62fe){_0x17f1a0['push'](_0x17f1a0['shift']());}}}(a25_0x3fc9,0x25927));import a25_0x13c49d from'chalk';function a25_0x3fc9(){const _0x29a5ba=['Pausing\x20journey...','Cancelled','rule','journey:stats','error','message','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Input:\x20','388bpUzpe','launched','format','population','goal','journey:pull','\x20\x20Folder\x20path:\x20','totalGoalAchieved','getSegment','segment','Resolving\x20parent\x20segment...','Parent\x20segment:\x20','hasChanges','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Getting\x20journey\x20details...','yellow','data','Resume\x20a\x20paused\x20journey','includeStats','goalRate','paused','content','resolveJourneyId','cyan','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)','journey','\x20(paused)','Resolved\x20YAML\x20file:\x20','\x0aPull\x20summary:','📁\x20','Fetching\x20parent\x20segment...','\x20journeys','3474sNQMQd','execute','journeyName','parentSegment','317470xVgwjW','diff','totalEntered','✔\x20Pulled\x20','state','description','\x20journey','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','journeyStages','.yml','map','\x20\x20Target:\x20','log','draft','Using\x20parent\x20segment:\x20','repeat','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','name','No\x20journeys\x20found','resolveParentId','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','\x20\x20Statistics\x20not\x20available','push','archived','journey:pause','join','table','Found\x20existing\x20tdx.json\x20at:\x20','No\x20statistics\x20available\x20for\x20journey:\x20','\x20(ID:\x20','gray','folderId','stages','1231853spADIM','conversionRate','entered','\x5c$&','Pause\x20a\x20running\x20journey','Aborted.','(root)','filter','8248LBNYdd','journey:view','stageName','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','segmentName','listFolders','getStatistics','Export\x20journey(s)\x20as\x20YAML\x20files','absolutePath','verbose','split','Pattern:\x20','Getting\x20journey\x20statistics...','toLowerCase','length','Usage:\x20journey\x20resume\x20<name-or-path>','journeyBundleName','utf-8','\x20new\x20files','json','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','resume','Resuming\x20journey...','Listing\x20journeys...','\x22\x20paused','101815SwKrzK','reentryMode','listJourneysFromParentSegment','journeys','Resolving\x20journey...','green','getParentFull','🗺️\x20','exited','\x20\x20Parent\x20segment:\x20','get','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','pause','dirname','Write\x20','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Usage:\x20journey\x20stats\x20<name-or-path>','1262550pyTiGN','Usage:\x20journey\x20view\x20<name-or-path>','getJourney','set','attributes','✔\x20Journey\x20\x22','yes','Parent\x20segment\x20context\x20not\x20set.\x0a','journeyId','43866cIfDKW','relative','isNew','replace','relativePath','folderPath','7929soibLf','INVALID_ARGUMENT','parent_segment','...'];a25_0x3fc9=function(){return _0x29a5ba;};return a25_0x3fc9();}import a25_0x8e576b 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'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';function a25_0x1ad5(_0x483d2f,_0x46232c){_0x483d2f=_0x483d2f-0x18e;const _0x3fc9ee=a25_0x3fc9();let _0x1ad5dc=_0x3fc9ee[_0x483d2f];return _0x1ad5dc;}import{apiToYamlAsync,toYamlString}from'../sdk/segment/journey-yaml.js';import{apiRuleToYaml}from'../sdk/segment/child-segment-yaml.js';import{getSegmentRootDir,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{sanitizeFileName}from'../utils/string-utils.js';const SEGMENT_KIND_JOURNEY=0x3;function formatJourneyState(_0x15dc27){const _0x134be9=a25_0x1ad5;switch(_0x15dc27){case _0x134be9(0x205):return a25_0x13c49d[_0x134be9(0x1dd)](_0x15dc27);case _0x134be9(0x1a2):return a25_0x13c49d[_0x134be9(0x1b3)](_0x15dc27);case _0x134be9(0x1ac):return a25_0x13c49d['dim'](_0x15dc27);default:return _0x15dc27;}}function formatJourneyItem(_0x9e16dc,_0x50a41b=''){const _0x2d6ec4=a25_0x1ad5,_0x3013ea=formatJourneyState(_0x9e16dc['state']),_0x5312d2=_0x9e16dc[_0x2d6ec4(0x218)]?a25_0x13c49d[_0x2d6ec4(0x213)](_0x2d6ec4(0x21e)):'';return _0x50a41b+_0x2d6ec4(0x1df)+_0x9e16dc[_0x2d6ec4(0x1ce)]+'\x20('+_0x3013ea+')'+_0x5312d2;}function escapeRegex(_0x4e6e5f){const _0x43a084=a25_0x1ad5;return _0x4e6e5f[_0x43a084(0x1f5)](/[.*+?^${}()|[\]\\]/g,_0x43a084(0x1b9));}function globToRegex(_0xe13667){const _0x419d07=a25_0x1ad5,_0x52ab48=_0xe13667[_0x419d07(0x1c8)]('*')[_0x419d07(0x19f)](escapeRegex);return new RegExp(_0x52ab48[_0x419d07(0x1ae)]('.*'),'i');}function resolveJourneyTarget(_0x4fc425,_0x18a093,_0x2ae99d){const _0x8c07b8=a25_0x1ad5;if(isYamlFilePath(_0x4fc425))try{const _0x4bd523=resolveYamlFilePath(_0x4fc425);return _0x2ae99d&&(console[_0x8c07b8(0x200)](_0x8c07b8(0x21f)+_0x4fc425),console[_0x8c07b8(0x200)](_0x8c07b8(0x1e1)+_0x4bd523['parentSegment']),console['error']('\x20\x20Name:\x20'+_0x4bd523[_0x8c07b8(0x1c2)]),console[_0x8c07b8(0x200)](_0x8c07b8(0x20a)+(_0x4bd523[_0x8c07b8(0x1f7)]||_0x8c07b8(0x1bc)))),{'journeyName':_0x4bd523[_0x8c07b8(0x1c2)],'parentSegment':_0x4bd523[_0x8c07b8(0x194)],'resolved':_0x4bd523};}catch(_0xa9ded5){throw new SDKError(ErrorCode[_0x8c07b8(0x1f9)],_0x8c07b8(0x1d3)+_0xa9ded5[_0x8c07b8(0x201)]);}if(!_0x18a093)throw new SDKError(ErrorCode[_0x8c07b8(0x1f9)],_0x8c07b8(0x1e3));return{'journeyName':_0x4fc425,'parentSegment':_0x18a093};}export class JourneyListCommand extends BaseCommand{[a25_0x443b0d(0x1a6)]='journey:list';[a25_0x443b0d(0x19a)]='List\x20journeys\x20in\x20current\x20context';async['execute'](_0x338a36){const _0x104fda=a25_0x443b0d,{options:_0x5b8e91,args:_0x524021,tdx:_0x3dfdda}=_0x338a36,_0xfbee63=_0x524021[0x0],_0x2e53ef=_0x5b8e91[_0x104fda(0x194)];if(!_0x2e53ef)return console[_0x104fda(0x200)]('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x104fda(0x200)](_0x104fda(0x1a9)),0x1;const _0x14a687=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x3dfdda[_0x104fda(0x20d)]['resolveParentId'](_0x2e53ef),{'verbose':_0x5b8e91['verbose']}),_0x86773e=_0x14a687[_0x104fda(0x214)];_0x5b8e91['verbose']&&(console[_0x104fda(0x200)](_0x104fda(0x20f)+_0x2e53ef+_0x104fda(0x1b2)+_0x86773e+')'),_0xfbee63&&console[_0x104fda(0x200)](_0x104fda(0x1c9)+_0xfbee63));const [_0x441b91,_0x171651,_0x402d97]=await Promise['all']([withSpinner(_0x104fda(0x18f),()=>_0x3dfdda[_0x104fda(0x20d)][_0x104fda(0x1de)](_0x86773e),{'verbose':_0x5b8e91[_0x104fda(0x1c7)]}),withSpinner('Fetching\x20folders...',()=>_0x3dfdda[_0x104fda(0x20d)][_0x104fda(0x1c3)](_0x86773e),{'verbose':_0x5b8e91[_0x104fda(0x1c7)]}),withSpinner(_0x104fda(0x1d6),()=>_0x3dfdda[_0x104fda(0x21d)][_0x104fda(0x1da)](_0x86773e),{'verbose':_0x5b8e91[_0x104fda(0x1c7)]})]),_0x538ba1=_0x441b91[_0x104fda(0x214)],_0x227709=_0x171651[_0x104fda(0x214)];let _0x20e6d2=_0x402d97['data'];const _0xb6a302=_0x538ba1['rootFolderId'],_0x106bad=new Map();for(const _0x3a6860 of _0x227709){_0x106bad[_0x104fda(0x1ec)](_0x3a6860['id'],_0x3a6860[_0x104fda(0x1a6)]);}if(_0xfbee63){const _0x564f10=globToRegex(_0xfbee63);_0x20e6d2=_0x20e6d2[_0x104fda(0x1bd)](_0x238fec=>_0x564f10['test'](_0x238fec[_0x104fda(0x1ce)]));}console[_0x104fda(0x200)]('✔\x20Found\x20'+_0x20e6d2[_0x104fda(0x1cc)]+_0x104fda(0x19b)+(_0x20e6d2[_0x104fda(0x1cc)]!==0x1?'s':''));if(_0x5b8e91[_0x104fda(0x206)]===_0x104fda(0x1af))await handleSDKOutput(_0x20e6d2,_0x5b8e91);else{if(_0x5b8e91[_0x104fda(0x206)]===_0x104fda(0x1d1))await handleSDKOutput(_0x20e6d2,_0x5b8e91);else{console[_0x104fda(0x1a1)]('['+_0x2e53ef+']');const _0x2104e5=new Map(),_0x2fcb58=[];for(const _0x1dc229 of _0x20e6d2){if(!_0x1dc229['folderId']||_0x1dc229[_0x104fda(0x1b4)]===_0xb6a302)_0x2fcb58['push'](_0x1dc229);else{const _0x30890f=_0x2104e5[_0x104fda(0x1e2)](_0x1dc229['folderId'])||[];_0x30890f[_0x104fda(0x1ab)](_0x1dc229),_0x2104e5[_0x104fda(0x1ec)](_0x1dc229['folderId'],_0x30890f);}}for(const _0x38d04c of _0x2fcb58){console[_0x104fda(0x1a1)](formatJourneyItem(_0x38d04c));}for(const [_0x5743f8,_0x43c4bd]of _0x2104e5){const _0x554240=_0x106bad['get'](_0x5743f8)||_0x5743f8;console['log'](_0x104fda(0x18e)+_0x554240);for(const _0x5170b1 of _0x43c4bd){console['log'](formatJourneyItem(_0x5170b1,'\x20\x20'));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a25_0x443b0d(0x1a6)]=a25_0x443b0d(0x1bf);['description']='Show\x20journey\x20details';async[a25_0x443b0d(0x192)](_0x1f1e4e){const _0x5d8495=a25_0x443b0d,{options:_0x153604,args:_0x3e2776,tdx:_0x4cf8c8}=_0x1f1e4e,_0x2dda44=_0x3e2776[0x0];if(!_0x2dda44)return console[_0x5d8495(0x200)](_0x5d8495(0x1e7)),console[_0x5d8495(0x200)](_0x5d8495(0x1ea)),0x1;_0x153604[_0x5d8495(0x1c7)]&&console['error'](_0x5d8495(0x203)+_0x2dda44);const _0x3919e4=resolveJourneyTarget(_0x2dda44,_0x153604['parentSegment'],_0x153604[_0x5d8495(0x1c7)]),_0x72f62a=await withSpinner(_0x5d8495(0x20e),()=>_0x4cf8c8[_0x5d8495(0x20d)][_0x5d8495(0x1a8)](_0x3919e4[_0x5d8495(0x194)]),{'verbose':_0x153604['verbose']}),_0x34b030=_0x72f62a['data'],_0x27ec84=await withSpinner(_0x5d8495(0x1dc),()=>_0x4cf8c8[_0x5d8495(0x21d)][_0x5d8495(0x21a)](_0x34b030,_0x3919e4[_0x5d8495(0x193)]),{'verbose':_0x153604[_0x5d8495(0x1c7)]}),_0x1be90e=_0x27ec84[_0x5d8495(0x214)],_0x5536f0=await withSpinner(_0x5d8495(0x212),()=>_0x4cf8c8['journey'][_0x5d8495(0x1eb)](_0x1be90e),{'verbose':_0x153604[_0x5d8495(0x1c7)]}),_0x52714e=_0x5536f0[_0x5d8495(0x214)],_0x40a6a1=_0x153604[_0x5d8495(0x216)];let _0x2f5f5d;if(_0x40a6a1)try{const _0x54649c=await withSpinner(_0x5d8495(0x1ca),()=>_0x4cf8c8[_0x5d8495(0x21d)][_0x5d8495(0x1c4)](_0x1be90e),{'verbose':_0x153604[_0x5d8495(0x1c7)]});_0x2f5f5d=_0x54649c['data'];}catch{_0x153604[_0x5d8495(0x1c7)]&&console['error'](_0x5d8495(0x1aa));}const _0x5dfdb3={'id':_0x52714e['id'],'name':_0x52714e[_0x5d8495(0x1ed)]['name'],'description':_0x52714e[_0x5d8495(0x1ed)][_0x5d8495(0x19a)],'state':_0x52714e[_0x5d8495(0x1ed)][_0x5d8495(0x199)],'paused':_0x52714e[_0x5d8495(0x1ed)]['paused'],'reentry_mode':_0x52714e[_0x5d8495(0x1ed)][_0x5d8495(0x1d9)],'stages':_0x52714e[_0x5d8495(0x1ed)][_0x5d8495(0x19d)]?.[_0x5d8495(0x1cc)]||0x0,..._0x52714e[_0x5d8495(0x1ed)]['goal']&&{'goal':_0x52714e['attributes'][_0x5d8495(0x208)]['name']},..._0x2f5f5d&&{'statistics':{'total_entered':_0x2f5f5d[_0x5d8495(0x197)],'goal_achieved':_0x2f5f5d['totalGoalAchieved'],'goal_rate':_0x2f5f5d[_0x5d8495(0x217)],'stages':_0x2f5f5d['stages']}}};return await handleSingleObjectOutput(_0x5dfdb3,_0x153604),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a25_0x443b0d(0x1a6)]=a25_0x443b0d(0x1ff);['description']='Show\x20journey\x20statistics';async[a25_0x443b0d(0x192)](_0x50cd1c){const _0x4bce68=a25_0x443b0d,{options:_0xceb60c,args:_0x417958,tdx:_0xee28dd}=_0x50cd1c,_0x5793de=_0x417958[0x0];if(!_0x5793de)return console['error'](_0x4bce68(0x1e7)),console[_0x4bce68(0x200)](_0x4bce68(0x1e8)),0x1;_0xceb60c[_0x4bce68(0x1c7)]&&console[_0x4bce68(0x200)]('Input:\x20'+_0x5793de);const _0x3f8578=resolveJourneyTarget(_0x5793de,_0xceb60c[_0x4bce68(0x194)],_0xceb60c['verbose']),_0x2270bc=await withSpinner(_0x4bce68(0x20e),()=>_0xee28dd[_0x4bce68(0x20d)][_0x4bce68(0x1a8)](_0x3f8578[_0x4bce68(0x194)]),{'verbose':_0xceb60c['verbose']}),_0x46c9f5=_0x2270bc[_0x4bce68(0x214)],_0x3a4aee=await withSpinner(_0x4bce68(0x1dc),()=>_0xee28dd['journey'][_0x4bce68(0x21a)](_0x46c9f5,_0x3f8578[_0x4bce68(0x193)]),{'verbose':_0xceb60c[_0x4bce68(0x1c7)]}),_0x1433c2=_0x3a4aee['data'],_0x3ae839=await withSpinner(_0x4bce68(0x1ca),()=>_0xee28dd[_0x4bce68(0x21d)][_0x4bce68(0x1c4)](_0x1433c2),{'verbose':_0xceb60c[_0x4bce68(0x1c7)]}),_0x3267b8=_0x3ae839[_0x4bce68(0x214)];if(!_0x3267b8||_0x3267b8[_0x4bce68(0x1f1)]===null)return console['error'](_0x4bce68(0x1b1)+_0x3f8578[_0x4bce68(0x193)]),console[_0x4bce68(0x200)](_0x4bce68(0x1d2)),0x0;const _0x13f905={'journey_id':_0x3267b8[_0x4bce68(0x1f1)],'total_entered':_0x3267b8[_0x4bce68(0x197)],'goal_achieved':_0x3267b8[_0x4bce68(0x20b)],'goal_rate':_0x3267b8[_0x4bce68(0x217)],'stages':_0x3267b8[_0x4bce68(0x1b5)]?.['map'](_0xbee399=>({'name':_0xbee399['stageName'],'population':_0xbee399[_0x4bce68(0x207)],'entered':_0xbee399['entered'],'exited':_0xbee399[_0x4bce68(0x1e0)],'conversion_rate':_0xbee399['conversionRate']}))},_0x3fc983=_0xceb60c['stage'];if(_0x3fc983&&_0x3267b8[_0x4bce68(0x1b5)]){const _0x541d7b=_0x3267b8[_0x4bce68(0x1b5)]['find'](_0x161b66=>_0x161b66[_0x4bce68(0x1c0)][_0x4bce68(0x1cb)]()===_0x3fc983[_0x4bce68(0x1cb)]());if(_0x541d7b)return await handleSingleObjectOutput({'stage_name':_0x541d7b[_0x4bce68(0x1c0)],'population':_0x541d7b[_0x4bce68(0x207)],'entered':_0x541d7b[_0x4bce68(0x1b8)],'exited':_0x541d7b[_0x4bce68(0x1e0)],'conversion_rate':_0x541d7b[_0x4bce68(0x1b7)]},_0xceb60c),0x0;console[_0x4bce68(0x200)]('Warning:\x20Stage\x20\x22'+_0x3fc983+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0x13f905,_0xceb60c),0x0;}}export class JourneyPauseCommand extends BaseCommand{['name']=a25_0x443b0d(0x1ad);[a25_0x443b0d(0x19a)]=a25_0x443b0d(0x1ba);async[a25_0x443b0d(0x192)](_0x479b3d){const _0x33dabc=a25_0x443b0d,{options:_0x4b079f,args:_0x299437,tdx:_0x1126d7}=_0x479b3d,_0x3fe3d9=_0x299437[0x0];if(!_0x3fe3d9)return console[_0x33dabc(0x200)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x33dabc(0x200)]('Usage:\x20journey\x20pause\x20<name-or-path>'),0x1;_0x4b079f[_0x33dabc(0x1c7)]&&console[_0x33dabc(0x200)](_0x33dabc(0x203)+_0x3fe3d9);const _0x34fea6=resolveJourneyTarget(_0x3fe3d9,_0x4b079f[_0x33dabc(0x194)],_0x4b079f[_0x33dabc(0x1c7)]),_0x4fb0a0=await withSpinner(_0x33dabc(0x20e),()=>_0x1126d7[_0x33dabc(0x20d)][_0x33dabc(0x1a8)](_0x34fea6['parentSegment']),{'verbose':_0x4b079f['verbose']}),_0x5b81f1=_0x4fb0a0[_0x33dabc(0x214)],_0x4459e2=await withSpinner('Resolving\x20journey...',()=>_0x1126d7[_0x33dabc(0x21d)][_0x33dabc(0x21a)](_0x5b81f1,_0x34fea6[_0x33dabc(0x193)]),{'verbose':_0x4b079f[_0x33dabc(0x1c7)]}),_0x1483d5=_0x4459e2['data'];if(!_0x4b079f[_0x33dabc(0x1ef)]){const _0x567d8f=await confirm(_0x33dabc(0x1a5)+_0x34fea6['journeyName']+'\x22?');if(!_0x567d8f)return console[_0x33dabc(0x200)](_0x33dabc(0x1fd)),0x0;}const _0x4063a4=await withSpinner(_0x33dabc(0x1fc),()=>_0x1126d7[_0x33dabc(0x21d)][_0x33dabc(0x1e4)](_0x1483d5),{'verbose':_0x4b079f[_0x33dabc(0x1c7)]}),_0xe6ea2d=_0x4063a4['data'];return console[_0x33dabc(0x200)](_0x33dabc(0x1ee)+_0xe6ea2d['attributes']['name']+_0x33dabc(0x1d7)),0x0;}}export class JourneyResumeCommand extends BaseCommand{['name']='journey:resume';[a25_0x443b0d(0x19a)]=a25_0x443b0d(0x215);async['execute'](_0x190310){const _0x141a75=a25_0x443b0d,{options:_0x292357,args:_0x46001e,tdx:_0x2cc1b2}=_0x190310,_0x30a1fc=_0x46001e[0x0];if(!_0x30a1fc)return console[_0x141a75(0x200)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x141a75(0x200)](_0x141a75(0x1cd)),0x1;_0x292357[_0x141a75(0x1c7)]&&console[_0x141a75(0x200)](_0x141a75(0x203)+_0x30a1fc);const _0x1dd3f3=resolveJourneyTarget(_0x30a1fc,_0x292357[_0x141a75(0x194)],_0x292357[_0x141a75(0x1c7)]),_0x5015c3=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x2cc1b2[_0x141a75(0x20d)]['resolveParentId'](_0x1dd3f3['parentSegment']),{'verbose':_0x292357[_0x141a75(0x1c7)]}),_0x5b83d8=_0x5015c3[_0x141a75(0x214)],_0x475923=await withSpinner('Resolving\x20journey...',()=>_0x2cc1b2[_0x141a75(0x21d)][_0x141a75(0x21a)](_0x5b83d8,_0x1dd3f3[_0x141a75(0x193)]),{'verbose':_0x292357[_0x141a75(0x1c7)]}),_0x2c89bb=_0x475923[_0x141a75(0x214)];if(!_0x292357[_0x141a75(0x1ef)]){const _0x47c2b7=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x1dd3f3[_0x141a75(0x193)]+'\x22?');if(!_0x47c2b7)return console[_0x141a75(0x200)](_0x141a75(0x1fd)),0x0;}const _0x14c995=await withSpinner(_0x141a75(0x1d5),()=>_0x2cc1b2['journey'][_0x141a75(0x1d4)](_0x2c89bb),{'verbose':_0x292357[_0x141a75(0x1c7)]}),_0x4f4d77=_0x14c995[_0x141a75(0x214)];return console['error'](_0x141a75(0x1ee)+_0x4f4d77[_0x141a75(0x1ed)][_0x141a75(0x1a6)]+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']=a25_0x443b0d(0x209);[a25_0x443b0d(0x19a)]=a25_0x443b0d(0x1c5);async[a25_0x443b0d(0x192)](_0x1fd1a7){const _0x325c72=a25_0x443b0d,{options:_0x5b77f7,args:_0x529904,tdx:_0x3b8f7c}=_0x1fd1a7,_0xb06612=_0x5b77f7,_0x4e46db=_0x529904[0x0],_0x29cc73=findTdxConfigPath();let _0x10bf95,_0x108278;if(_0x29cc73){const _0x25fb7c=loadTdxConfig(_0x29cc73);_0x10bf95=_0x25fb7c[_0x325c72(0x1fa)],_0x108278=a25_0x8e576b[_0x325c72(0x1ae)](a25_0x8e576b[_0x325c72(0x1e5)](_0x29cc73),_0x325c72(0x1db)),_0xb06612[_0x325c72(0x1c7)]&&(console[_0x325c72(0x200)](_0x325c72(0x1b0)+_0x29cc73),console[_0x325c72(0x200)](_0x325c72(0x1a3)+_0x10bf95));}else{_0x10bf95=_0x5b77f7[_0x325c72(0x194)];if(!_0x10bf95)return console[_0x325c72(0x200)](a25_0x13c49d[_0x325c72(0x213)](_0x325c72(0x1f0))),console['error'](_0x325c72(0x21c)),console[_0x325c72(0x200)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x325c72(0x200)](_0x325c72(0x202)),0x1;_0x108278=a25_0x8e576b['join'](getSegmentRootDir(sanitizeFileName(_0x10bf95)),_0x325c72(0x1db));}const _0x133385=await withSpinner(_0x325c72(0x20e),()=>_0x3b8f7c[_0x325c72(0x20d)][_0x325c72(0x1a8)](_0x10bf95),{'verbose':_0x5b77f7[_0x325c72(0x1c7)]}),_0xe194aa=_0x133385[_0x325c72(0x214)],_0x254542=await withSpinner(_0x325c72(0x1d6),()=>_0x3b8f7c[_0x325c72(0x21d)][_0x325c72(0x1da)](_0xe194aa),{'verbose':_0x5b77f7[_0x325c72(0x1c7)]});let _0x2c5246=_0x254542['data'];if(_0x4e46db){const _0x122940=_0x2c5246[_0x325c72(0x1bd)](_0x415462=>_0x415462[_0x325c72(0x1ce)][_0x325c72(0x1cb)]()===_0x4e46db[_0x325c72(0x1cb)]());if(_0x122940[_0x325c72(0x1cc)]===0x0)return console[_0x325c72(0x200)]('Error:\x20Journey\x20not\x20found:\x20'+_0x4e46db),console[_0x325c72(0x200)](_0x325c72(0x1c1)),0x1;_0x2c5246=_0x122940;}if(_0x2c5246[_0x325c72(0x1cc)]===0x0)return console[_0x325c72(0x200)](_0x325c72(0x1a7)),0x0;const _0x5cf770=[];for(const _0xc3168 of _0x2c5246){const _0x14db4f=await withSpinner('Fetching\x20'+_0xc3168['journeyBundleName']+_0x325c72(0x1fb),()=>_0x3b8f7c[_0x325c72(0x21d)]['getJourney'](_0xc3168['id']),{'verbose':_0x5b77f7[_0x325c72(0x1c7)]}),_0x582732=_0x14db4f['data'],_0x208815=_0x582732[_0x325c72(0x1ed)]?.['audienceId'],_0xf44e13={'resolveSegment':async _0x1583aa=>{const _0x26f9b2=_0x325c72;if(!_0x208815)return{'name':_0x1583aa,'isJourneyLocal':![]};try{const _0x4c5aaf=await _0x3b8f7c['segment'][_0x26f9b2(0x20c)](_0x208815,_0x1583aa),_0x5be2d6=_0x4c5aaf['kind']===SEGMENT_KIND_JOURNEY;let _0x18df39;return _0x5be2d6&&_0x4c5aaf['rule']&&(_0x18df39={'description':_0x4c5aaf['description'],'rule':apiRuleToYaml(_0x4c5aaf[_0x26f9b2(0x1fe)])}),{'name':_0x4c5aaf['name'],'isJourneyLocal':_0x5be2d6,'definition':_0x18df39};}catch(_0x590858){return _0x5b77f7[_0x26f9b2(0x1c7)]&&console[_0x26f9b2(0x200)](_0x26f9b2(0x211)+_0x1583aa+':\x20'+_0x590858[_0x26f9b2(0x201)]),{'name':_0x1583aa,'isJourneyLocal':![]};}}},_0x50bac7=await apiToYamlAsync(_0x582732,_0xf44e13),_0x15f157=toYamlString(_0x50bac7),_0x539c84=sanitizeFileName(_0xc3168[_0x325c72(0x1ce)]),_0x4b280a=a25_0x8e576b[_0x325c72(0x1ae)](_0x108278,_0x539c84+_0x325c72(0x19e)),_0x51b70e=a25_0x8e576b[_0x325c72(0x1f3)](process['cwd'](),_0x4b280a);if(existsSync(_0x4b280a)){const _0xc79a1f=readFileSync(_0x4b280a,_0x325c72(0x1cf)),_0x454d41=generateDiff(_0xc79a1f,_0x15f157),_0x4dbb34=hasChanges(_0x454d41);_0x5cf770['push']({'relativePath':_0x51b70e,'absolutePath':_0x4b280a,'content':_0x15f157,'isNew':![],'hasChanges':_0x4dbb34,'diff':_0x4dbb34?formatDiffWithColors(_0x454d41):undefined});}else _0x5cf770[_0x325c72(0x1ab)]({'relativePath':_0x51b70e,'absolutePath':_0x4b280a,'content':_0x15f157,'isNew':!![],'hasChanges':![]});}const _0xa7dad6=_0x5cf770[_0x325c72(0x1bd)](_0x2fef8d=>_0x2fef8d[_0x325c72(0x1f4)]),_0x5883bb=_0x5cf770[_0x325c72(0x1bd)](_0x4db112=>!_0x4db112[_0x325c72(0x1f4)]&&_0x4db112[_0x325c72(0x210)]),_0x59abd8=_0x5cf770[_0x325c72(0x1bd)](_0x52e407=>!_0x52e407[_0x325c72(0x1f4)]&&!_0x52e407['hasChanges']);console['error'](_0x325c72(0x220)),console[_0x325c72(0x200)]('\x20\x20'+a25_0x13c49d[_0x325c72(0x21b)](_0x2c5246[_0x325c72(0x1cc)]+_0x325c72(0x190))),console['error']('\x20\x20'+a25_0x13c49d[_0x325c72(0x1dd)]('+\x20'+_0xa7dad6['length']+_0x325c72(0x1d0))),console[_0x325c72(0x200)]('\x20\x20'+a25_0x13c49d[_0x325c72(0x213)]('~\x20'+_0x5883bb[_0x325c72(0x1cc)]+'\x20changed\x20files')),console[_0x325c72(0x200)]('\x20\x20'+a25_0x13c49d['dim']('=\x20'+_0x59abd8[_0x325c72(0x1cc)]+'\x20unchanged\x20files')),console[_0x325c72(0x200)](_0x325c72(0x1a0)+a25_0x13c49d[_0x325c72(0x21b)](_0x108278)+'\x0a');if(_0x5883bb['length']>0x0)for(const _0x32afc5 of _0x5883bb){console[_0x325c72(0x200)]('\x0aChanges\x20to\x20\x27'+_0x32afc5[_0x325c72(0x1f6)]+'\x27:'),console['error']('─'[_0x325c72(0x1a4)](0x3c)),console['error'](_0x32afc5[_0x325c72(0x196)]),console['error']('─'[_0x325c72(0x1a4)](0x3c));}if(_0xb06612['dryRun'])return console[_0x325c72(0x200)](a25_0x13c49d['yellow'](_0x325c72(0x19c))),0x0;if(_0xa7dad6[_0x325c72(0x1cc)]===0x0&&_0x5883bb['length']===0x0)return console[_0x325c72(0x200)](a25_0x13c49d['green']('✔\x20All\x20files\x20are\x20up\x20to\x20date')),0x0;if(!_0xb06612[_0x325c72(0x1ef)]&&(_0xa7dad6[_0x325c72(0x1cc)]>0x0||_0x5883bb[_0x325c72(0x1cc)]>0x0)){const _0x4e782a=await confirmKey(_0x325c72(0x1e6)+(_0xa7dad6[_0x325c72(0x1cc)]+_0x5883bb['length'])+'\x20files?');if(!_0x4e782a)return console[_0x325c72(0x200)](_0x325c72(0x1bb)),0x1;}!existsSync(_0x108278)&&mkdirSync(_0x108278,{'recursive':!![]});for(const _0x5882bc of _0x5cf770){(_0x5882bc[_0x325c72(0x1f4)]||_0x5882bc[_0x325c72(0x210)])&&writeFileSync(_0x5882bc[_0x325c72(0x1c6)],_0x5882bc[_0x325c72(0x219)],_0x325c72(0x1cf));}return console[_0x325c72(0x200)](a25_0x13c49d[_0x325c72(0x1dd)](_0x325c72(0x198)+(_0xa7dad6[_0x325c72(0x1cc)]+_0x5883bb[_0x325c72(0x1cc)])+'\x20journey\x20files\x20to\x20'+_0x108278)),0x0;}}
1
+ const a25_0x2ab184=a25_0x5274;(function(_0x47ff44,_0x516ece){const _0x3f71fb=a25_0x5274,_0x58520d=_0x47ff44();while(!![]){try{const _0x44ac6f=-parseInt(_0x3f71fb(0x1a5))/0x1+-parseInt(_0x3f71fb(0x1dd))/0x2*(-parseInt(_0x3f71fb(0x1c6))/0x3)+-parseInt(_0x3f71fb(0x184))/0x4+-parseInt(_0x3f71fb(0x174))/0x5*(parseInt(_0x3f71fb(0x178))/0x6)+parseInt(_0x3f71fb(0x1ee))/0x7*(-parseInt(_0x3f71fb(0x17e))/0x8)+-parseInt(_0x3f71fb(0x1a2))/0x9*(parseInt(_0x3f71fb(0x18d))/0xa)+parseInt(_0x3f71fb(0x1e2))/0xb*(parseInt(_0x3f71fb(0x193))/0xc);if(_0x44ac6f===_0x516ece)break;else _0x58520d['push'](_0x58520d['shift']());}catch(_0x77fccc){_0x58520d['push'](_0x58520d['shift']());}}}(a25_0x2633,0x780a9));import a25_0x3cb7c7 from'chalk';import a25_0x534d5e 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'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';function a25_0x2633(){const _0x158c04=['...','Getting\x20journey\x20details...','Warning:\x20Stage\x20\x22','✔\x20Journey\x20\x22','yes','all','\x22\x20not\x20found','cyan','name','includeStats','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','journey','json','✔\x20Pulled\x20','isNew','40702ayLfrS','relative','Usage:\x20journey\x20resume\x20<name-or-path>','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','entered','11gkPrxs','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','\x20(ID:\x20','Usage:\x20journey\x20view\x20<name-or-path>','INVALID_ARGUMENT','listFolders','log','state','yellow','join','✔\x20Found\x20','Usage:\x20journey\x20stats\x20<name-or-path>','1981OJaJnF','stageName','\x20\x20Name:\x20','stage','replace','kind','(root)','No\x20journeys\x20found','Input:\x20','map','\x5c$&','description','Parent\x20segment\x20context\x20not\x20set.\x0a','data','goal','dryRun','getStatistics','segment','launched','🗺️\x20','Getting\x20journey\x20statistics...','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Resolving\x20journey...','resolveParentId','journey:pause','journey:resume','Show\x20journey\x20statistics','97315HkvdBU','Fetching\x20','\x22\x20resumed','Listing\x20journeys...','150NbUmol','gray','exited','paused','journeyName','getJourney','26440fePwNW','segmentName','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','draft','toLowerCase','test','902820WFAfoo','journeyId','dim','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','folderId','parent_segment','journeyBundleName','journeys','199620BFyNqh','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)','Resume\x20a\x20paused\x20journey','journey:list','journey:view','\x20\x20Statistics\x20not\x20available','36184764enjvAa','📁\x20','content','resolveJourneyId','totalGoalAchieved','totalEntered','\x20\x20Parent\x20segment:\x20','\x20unchanged\x20files','Export\x20journey(s)\x20as\x20YAML\x20files','Resolving\x20parent\x20segment...','\x20\x20Folder\x20path:\x20','parentSegment','\x20journey\x20files\x20to\x20','message','\x20\x20Target:\x20','333nbbuBK','getParentFull','attributes','279976hKskow','resume','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','stages','rootFolderId','format','set','rule','execute','Error:\x20Journey\x20not\x20found:\x20','Error:\x20Parent\x20segment\x20context\x20required','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','cwd','Pausing\x20journey...','archived','Show\x20journey\x20details','Warning:\x20Could\x20not\x20resolve\x20segment\x20','green','utf-8','\x22\x20paused','Cancelled','Aborted.','goalRate','get','conversionRate','verbose','folderPath','Resolved\x20YAML\x20file:\x20','\x20files?','population','\x20journeys','filter','listJourneysFromParentSegment','21EhhcMF','No\x20statistics\x20available\x20for\x20journey:\x20','push','error','repeat','length','hasChanges','Usage:\x20journey\x20pause\x20<name-or-path>'];a25_0x2633=function(){return _0x158c04;};return a25_0x2633();}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{apiToYamlAsync,toYamlString}from'../sdk/segment/journey-yaml.js';function a25_0x5274(_0x152d1f,_0x268a16){_0x152d1f=_0x152d1f-0x15a;const _0x26339e=a25_0x2633();let _0x52740a=_0x26339e[_0x152d1f];return _0x52740a;}import{apiRuleToYaml}from'../sdk/segment/child-segment-yaml.js';import{getSegmentRootDir,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{sanitizeFileName}from'../utils/string-utils.js';const SEGMENT_KIND_JOURNEY=0x3;function formatJourneyState(_0x5553e5){const _0x51a553=a25_0x5274;switch(_0x5553e5){case _0x51a553(0x16b):return a25_0x3cb7c7['green'](_0x5553e5);case _0x51a553(0x181):return a25_0x3cb7c7[_0x51a553(0x179)](_0x5553e5);case _0x51a553(0x1b3):return a25_0x3cb7c7[_0x51a553(0x186)](_0x5553e5);default:return _0x5553e5;}}function formatJourneyItem(_0x5bc6c3,_0x4c846f=''){const _0xd530bc=a25_0x5274,_0x55171b=formatJourneyState(_0x5bc6c3[_0xd530bc(0x1e9)]),_0x15e948=_0x5bc6c3['paused']?a25_0x3cb7c7[_0xd530bc(0x1ea)]('\x20(paused)'):'';return _0x4c846f+_0xd530bc(0x16c)+_0x5bc6c3[_0xd530bc(0x18b)]+'\x20('+_0x55171b+')'+_0x15e948;}function escapeRegex(_0x3adf3a){const _0x5a031f=a25_0x5274;return _0x3adf3a[_0x5a031f(0x15d)](/[.*+?^${}()|[\]\\]/g,_0x5a031f(0x163));}function globToRegex(_0x4031ff){const _0xc94ba7=a25_0x5274,_0x283354=_0x4031ff['split']('*')[_0xc94ba7(0x162)](escapeRegex);return new RegExp(_0x283354[_0xc94ba7(0x1eb)]('.*'),'i');}function resolveJourneyTarget(_0x57fd8e,_0x4cf8d5,_0x4feafd){const _0x1ac0c2=a25_0x5274;if(isYamlFilePath(_0x57fd8e))try{const _0x3fd522=resolveYamlFilePath(_0x57fd8e);return _0x4feafd&&(console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x1c0)+_0x57fd8e),console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x199)+_0x3fd522[_0x1ac0c2(0x19e)]),console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x15b)+_0x3fd522[_0x1ac0c2(0x17f)]),console[_0x1ac0c2(0x1c9)](_0x1ac0c2(0x19d)+(_0x3fd522[_0x1ac0c2(0x1bf)]||_0x1ac0c2(0x15f)))),{'journeyName':_0x3fd522[_0x1ac0c2(0x17f)],'parentSegment':_0x3fd522[_0x1ac0c2(0x19e)],'resolved':_0x3fd522};}catch(_0x48f40f){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ac0c2(0x1a7)+_0x48f40f[_0x1ac0c2(0x1a0)]);}if(!_0x4cf8d5)throw new SDKError(ErrorCode[_0x1ac0c2(0x1e6)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x57fd8e,'parentSegment':_0x4cf8d5};}export class JourneyListCommand extends BaseCommand{['name']=a25_0x2ab184(0x190);[a25_0x2ab184(0x164)]='List\x20journeys\x20in\x20current\x20context';async['execute'](_0x2e06c6){const _0x102a09=a25_0x2ab184,{options:_0x494b2b,args:_0x7d05b4,tdx:_0x5e31e6}=_0x2e06c6,_0x41553f=_0x7d05b4[0x0],_0x88028e=_0x494b2b[_0x102a09(0x19e)];if(!_0x88028e)return console[_0x102a09(0x1c9)](_0x102a09(0x1af)),console[_0x102a09(0x1c9)](_0x102a09(0x1b0)),0x1;const _0x21b1f3=await withSpinner(_0x102a09(0x19c),()=>_0x5e31e6[_0x102a09(0x16a)][_0x102a09(0x170)](_0x88028e),{'verbose':_0x494b2b[_0x102a09(0x1be)]}),_0x83f51d=_0x21b1f3[_0x102a09(0x166)];_0x494b2b[_0x102a09(0x1be)]&&(console[_0x102a09(0x1c9)]('Parent\x20segment:\x20'+_0x88028e+_0x102a09(0x1e4)+_0x83f51d+')'),_0x41553f&&console[_0x102a09(0x1c9)]('Pattern:\x20'+_0x41553f));const [_0x52327a,_0x20199b,_0x5a1842]=await Promise[_0x102a09(0x1d3)]([withSpinner('Fetching\x20parent\x20segment...',()=>_0x5e31e6['segment'][_0x102a09(0x1a3)](_0x83f51d),{'verbose':_0x494b2b[_0x102a09(0x1be)]}),withSpinner('Fetching\x20folders...',()=>_0x5e31e6['segment'][_0x102a09(0x1e7)](_0x83f51d),{'verbose':_0x494b2b[_0x102a09(0x1be)]}),withSpinner(_0x102a09(0x177),()=>_0x5e31e6['journey'][_0x102a09(0x1c5)](_0x83f51d),{'verbose':_0x494b2b[_0x102a09(0x1be)]})]),_0x2760cb=_0x52327a[_0x102a09(0x166)],_0x3867f9=_0x20199b[_0x102a09(0x166)];let _0x467b83=_0x5a1842[_0x102a09(0x166)];const _0x269d82=_0x2760cb[_0x102a09(0x1a9)],_0x59237d=new Map();for(const _0x570e52 of _0x3867f9){_0x59237d[_0x102a09(0x1ab)](_0x570e52['id'],_0x570e52[_0x102a09(0x1d6)]);}if(_0x41553f){const _0x1c05b1=globToRegex(_0x41553f);_0x467b83=_0x467b83[_0x102a09(0x1c4)](_0x23ad5c=>_0x1c05b1[_0x102a09(0x183)](_0x23ad5c[_0x102a09(0x18b)]));}console[_0x102a09(0x1c9)](_0x102a09(0x1ec)+_0x467b83[_0x102a09(0x1cb)]+'\x20journey'+(_0x467b83['length']!==0x1?'s':''));if(_0x494b2b[_0x102a09(0x1aa)]==='table')await handleSDKOutput(_0x467b83,_0x494b2b);else{if(_0x494b2b['format']===_0x102a09(0x1da))await handleSDKOutput(_0x467b83,_0x494b2b);else{console[_0x102a09(0x1e8)]('['+_0x88028e+']');const _0x14a018=new Map(),_0x11e14a=[];for(const _0x24ef86 of _0x467b83){if(!_0x24ef86[_0x102a09(0x189)]||_0x24ef86[_0x102a09(0x189)]===_0x269d82)_0x11e14a[_0x102a09(0x1c8)](_0x24ef86);else{const _0x55658d=_0x14a018['get'](_0x24ef86['folderId'])||[];_0x55658d['push'](_0x24ef86),_0x14a018[_0x102a09(0x1ab)](_0x24ef86[_0x102a09(0x189)],_0x55658d);}}for(const _0x36c472 of _0x11e14a){console['log'](formatJourneyItem(_0x36c472));}for(const [_0x45e4ea,_0x1eacd0]of _0x14a018){const _0x460d52=_0x59237d[_0x102a09(0x1bc)](_0x45e4ea)||_0x45e4ea;console[_0x102a09(0x1e8)](_0x102a09(0x194)+_0x460d52);for(const _0x534d2e of _0x1eacd0){console['log'](formatJourneyItem(_0x534d2e,'\x20\x20'));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]=a25_0x2ab184(0x191);[a25_0x2ab184(0x164)]=a25_0x2ab184(0x1b4);async[a25_0x2ab184(0x1ad)](_0x472a64){const _0x4cc179=a25_0x2ab184,{options:_0x36514a,args:_0x4ec0da,tdx:_0x2b1b94}=_0x472a64,_0x3e44a2=_0x4ec0da[0x0];if(!_0x3e44a2)return console[_0x4cc179(0x1c9)](_0x4cc179(0x1d8)),console['error'](_0x4cc179(0x1e5)),0x1;_0x36514a['verbose']&&console[_0x4cc179(0x1c9)](_0x4cc179(0x161)+_0x3e44a2);const _0x208e80=resolveJourneyTarget(_0x3e44a2,_0x36514a[_0x4cc179(0x19e)],_0x36514a[_0x4cc179(0x1be)]),_0x3c7fab=await withSpinner(_0x4cc179(0x19c),()=>_0x2b1b94[_0x4cc179(0x16a)][_0x4cc179(0x170)](_0x208e80[_0x4cc179(0x19e)]),{'verbose':_0x36514a[_0x4cc179(0x1be)]}),_0x254fef=_0x3c7fab[_0x4cc179(0x166)],_0x4e6318=await withSpinner(_0x4cc179(0x16f),()=>_0x2b1b94[_0x4cc179(0x1d9)][_0x4cc179(0x196)](_0x254fef,_0x208e80[_0x4cc179(0x17c)]),{'verbose':_0x36514a['verbose']}),_0x270a70=_0x4e6318[_0x4cc179(0x166)],_0x3540b1=await withSpinner(_0x4cc179(0x1cf),()=>_0x2b1b94[_0x4cc179(0x1d9)][_0x4cc179(0x17d)](_0x270a70),{'verbose':_0x36514a[_0x4cc179(0x1be)]}),_0x2f588f=_0x3540b1[_0x4cc179(0x166)],_0x5d6d93=_0x36514a[_0x4cc179(0x1d7)];let _0x230be2;if(_0x5d6d93)try{const _0x2a4423=await withSpinner(_0x4cc179(0x16d),()=>_0x2b1b94[_0x4cc179(0x1d9)][_0x4cc179(0x169)](_0x270a70),{'verbose':_0x36514a['verbose']});_0x230be2=_0x2a4423['data'];}catch{_0x36514a['verbose']&&console[_0x4cc179(0x1c9)](_0x4cc179(0x192));}const _0x256098={'id':_0x2f588f['id'],'name':_0x2f588f[_0x4cc179(0x1a4)]['name'],'description':_0x2f588f[_0x4cc179(0x1a4)][_0x4cc179(0x164)],'state':_0x2f588f['attributes'][_0x4cc179(0x1e9)],'paused':_0x2f588f[_0x4cc179(0x1a4)][_0x4cc179(0x17b)],'reentry_mode':_0x2f588f['attributes']['reentryMode'],'stages':_0x2f588f[_0x4cc179(0x1a4)]['journeyStages']?.['length']||0x0,..._0x2f588f[_0x4cc179(0x1a4)][_0x4cc179(0x167)]&&{'goal':_0x2f588f[_0x4cc179(0x1a4)]['goal']['name']},..._0x230be2&&{'statistics':{'total_entered':_0x230be2['totalEntered'],'goal_achieved':_0x230be2[_0x4cc179(0x197)],'goal_rate':_0x230be2['goalRate'],'stages':_0x230be2[_0x4cc179(0x1a8)]}}};return await handleSingleObjectOutput(_0x256098,_0x36514a),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]='journey:stats';[a25_0x2ab184(0x164)]=a25_0x2ab184(0x173);async[a25_0x2ab184(0x1ad)](_0x3131ae){const _0x4dc009=a25_0x2ab184,{options:_0x4444e1,args:_0x442b3e,tdx:_0x2ffe1a}=_0x3131ae,_0x5643eb=_0x442b3e[0x0];if(!_0x5643eb)return console[_0x4dc009(0x1c9)](_0x4dc009(0x1d8)),console[_0x4dc009(0x1c9)](_0x4dc009(0x1ed)),0x1;_0x4444e1[_0x4dc009(0x1be)]&&console['error'](_0x4dc009(0x161)+_0x5643eb);const _0x2ceab8=resolveJourneyTarget(_0x5643eb,_0x4444e1['parentSegment'],_0x4444e1[_0x4dc009(0x1be)]),_0x9b1ed7=await withSpinner(_0x4dc009(0x19c),()=>_0x2ffe1a[_0x4dc009(0x16a)][_0x4dc009(0x170)](_0x2ceab8[_0x4dc009(0x19e)]),{'verbose':_0x4444e1[_0x4dc009(0x1be)]}),_0x36f9e2=_0x9b1ed7[_0x4dc009(0x166)],_0x5561c5=await withSpinner(_0x4dc009(0x16f),()=>_0x2ffe1a['journey']['resolveJourneyId'](_0x36f9e2,_0x2ceab8[_0x4dc009(0x17c)]),{'verbose':_0x4444e1[_0x4dc009(0x1be)]}),_0x1fda1f=_0x5561c5[_0x4dc009(0x166)],_0x3081fc=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x2ffe1a[_0x4dc009(0x1d9)]['getStatistics'](_0x1fda1f),{'verbose':_0x4444e1[_0x4dc009(0x1be)]}),_0x7d7f5b=_0x3081fc[_0x4dc009(0x166)];if(!_0x7d7f5b||_0x7d7f5b[_0x4dc009(0x185)]===null)return console[_0x4dc009(0x1c9)](_0x4dc009(0x1c7)+_0x2ceab8[_0x4dc009(0x17c)]),console['error'](_0x4dc009(0x1e0)),0x0;const _0x2a74aa={'journey_id':_0x7d7f5b[_0x4dc009(0x185)],'total_entered':_0x7d7f5b[_0x4dc009(0x198)],'goal_achieved':_0x7d7f5b[_0x4dc009(0x197)],'goal_rate':_0x7d7f5b[_0x4dc009(0x1bb)],'stages':_0x7d7f5b['stages']?.[_0x4dc009(0x162)](_0x97f974=>({'name':_0x97f974[_0x4dc009(0x15a)],'population':_0x97f974[_0x4dc009(0x1c2)],'entered':_0x97f974[_0x4dc009(0x1e1)],'exited':_0x97f974['exited'],'conversion_rate':_0x97f974[_0x4dc009(0x1bd)]}))},_0x2b7bd9=_0x4444e1[_0x4dc009(0x15c)];if(_0x2b7bd9&&_0x7d7f5b[_0x4dc009(0x1a8)]){const _0x2e6d1c=_0x7d7f5b['stages']['find'](_0x22e199=>_0x22e199[_0x4dc009(0x15a)][_0x4dc009(0x182)]()===_0x2b7bd9[_0x4dc009(0x182)]());if(_0x2e6d1c)return await handleSingleObjectOutput({'stage_name':_0x2e6d1c[_0x4dc009(0x15a)],'population':_0x2e6d1c[_0x4dc009(0x1c2)],'entered':_0x2e6d1c['entered'],'exited':_0x2e6d1c[_0x4dc009(0x17a)],'conversion_rate':_0x2e6d1c[_0x4dc009(0x1bd)]},_0x4444e1),0x0;console[_0x4dc009(0x1c9)](_0x4dc009(0x1d0)+_0x2b7bd9+_0x4dc009(0x1d4));}return await handleSingleObjectOutput(_0x2a74aa,_0x4444e1),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]=a25_0x2ab184(0x171);[a25_0x2ab184(0x164)]='Pause\x20a\x20running\x20journey';async['execute'](_0x37110c){const _0x16e5d1=a25_0x2ab184,{options:_0x501e20,args:_0x52c8b4,tdx:_0x3f5f5d}=_0x37110c,_0x16c8a5=_0x52c8b4[0x0];if(!_0x16c8a5)return console[_0x16e5d1(0x1c9)](_0x16e5d1(0x1d8)),console[_0x16e5d1(0x1c9)](_0x16e5d1(0x1cd)),0x1;_0x501e20[_0x16e5d1(0x1be)]&&console[_0x16e5d1(0x1c9)](_0x16e5d1(0x161)+_0x16c8a5);const _0xd0b865=resolveJourneyTarget(_0x16c8a5,_0x501e20['parentSegment'],_0x501e20[_0x16e5d1(0x1be)]),_0x10f231=await withSpinner(_0x16e5d1(0x19c),()=>_0x3f5f5d['segment'][_0x16e5d1(0x170)](_0xd0b865['parentSegment']),{'verbose':_0x501e20[_0x16e5d1(0x1be)]}),_0x1b1630=_0x10f231[_0x16e5d1(0x166)],_0x46445b=await withSpinner(_0x16e5d1(0x16f),()=>_0x3f5f5d[_0x16e5d1(0x1d9)][_0x16e5d1(0x196)](_0x1b1630,_0xd0b865[_0x16e5d1(0x17c)]),{'verbose':_0x501e20[_0x16e5d1(0x1be)]}),_0x1c674c=_0x46445b[_0x16e5d1(0x166)];if(!_0x501e20[_0x16e5d1(0x1d2)]){const _0x58e030=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0xd0b865['journeyName']+'\x22?');if(!_0x58e030)return console[_0x16e5d1(0x1c9)](_0x16e5d1(0x1b9)),0x0;}const _0x10cfa0=await withSpinner(_0x16e5d1(0x1b2),()=>_0x3f5f5d['journey']['pause'](_0x1c674c),{'verbose':_0x501e20[_0x16e5d1(0x1be)]}),_0x15fbd5=_0x10cfa0[_0x16e5d1(0x166)];return console['error'](_0x16e5d1(0x1d1)+_0x15fbd5['attributes'][_0x16e5d1(0x1d6)]+_0x16e5d1(0x1b8)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]=a25_0x2ab184(0x172);[a25_0x2ab184(0x164)]=a25_0x2ab184(0x18f);async[a25_0x2ab184(0x1ad)](_0x394d89){const _0x2bc67d=a25_0x2ab184,{options:_0x7ba997,args:_0x464980,tdx:_0x529142}=_0x394d89,_0x31b4a2=_0x464980[0x0];if(!_0x31b4a2)return console[_0x2bc67d(0x1c9)](_0x2bc67d(0x1d8)),console[_0x2bc67d(0x1c9)](_0x2bc67d(0x1df)),0x1;_0x7ba997[_0x2bc67d(0x1be)]&&console[_0x2bc67d(0x1c9)](_0x2bc67d(0x161)+_0x31b4a2);const _0x1f1dca=resolveJourneyTarget(_0x31b4a2,_0x7ba997[_0x2bc67d(0x19e)],_0x7ba997['verbose']),_0x4ea90d=await withSpinner(_0x2bc67d(0x19c),()=>_0x529142[_0x2bc67d(0x16a)][_0x2bc67d(0x170)](_0x1f1dca[_0x2bc67d(0x19e)]),{'verbose':_0x7ba997['verbose']}),_0x1ef221=_0x4ea90d[_0x2bc67d(0x166)],_0x109811=await withSpinner('Resolving\x20journey...',()=>_0x529142[_0x2bc67d(0x1d9)]['resolveJourneyId'](_0x1ef221,_0x1f1dca['journeyName']),{'verbose':_0x7ba997[_0x2bc67d(0x1be)]}),_0x3c9182=_0x109811[_0x2bc67d(0x166)];if(!_0x7ba997['yes']){const _0x186c3f=await confirm(_0x2bc67d(0x188)+_0x1f1dca[_0x2bc67d(0x17c)]+'\x22?');if(!_0x186c3f)return console[_0x2bc67d(0x1c9)](_0x2bc67d(0x1b9)),0x0;}const _0x14c3ca=await withSpinner('Resuming\x20journey...',()=>_0x529142['journey'][_0x2bc67d(0x1a6)](_0x3c9182),{'verbose':_0x7ba997[_0x2bc67d(0x1be)]}),_0x372802=_0x14c3ca[_0x2bc67d(0x166)];return console[_0x2bc67d(0x1c9)]('✔\x20Journey\x20\x22'+_0x372802['attributes'][_0x2bc67d(0x1d6)]+_0x2bc67d(0x176)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a25_0x2ab184(0x1d6)]='journey:pull';['description']=a25_0x2ab184(0x19b);async['execute'](_0x489d92){const _0x1ddc51=a25_0x2ab184,{options:_0xa56297,args:_0x28d363,tdx:_0x92fb29}=_0x489d92,_0x4e6b12=_0xa56297,_0x14e769=_0x28d363[0x0],_0x5ea764=findTdxConfigPath();let _0xb4f0b9,_0x73b31a;if(_0x5ea764){const _0x51a331=loadTdxConfig(_0x5ea764);_0xb4f0b9=_0x51a331[_0x1ddc51(0x18a)],_0x73b31a=a25_0x534d5e[_0x1ddc51(0x1eb)](a25_0x534d5e['dirname'](_0x5ea764),'journeys'),_0x4e6b12[_0x1ddc51(0x1be)]&&(console['error']('Found\x20existing\x20tdx.json\x20at:\x20'+_0x5ea764),console[_0x1ddc51(0x1c9)]('Using\x20parent\x20segment:\x20'+_0xb4f0b9));}else{_0xb4f0b9=_0xa56297['parentSegment'];if(!_0xb4f0b9)return console[_0x1ddc51(0x1c9)](a25_0x3cb7c7[_0x1ddc51(0x1ea)](_0x1ddc51(0x165))),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x18e)),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x180)),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x187)),0x1;_0x73b31a=a25_0x534d5e[_0x1ddc51(0x1eb)](getSegmentRootDir(sanitizeFileName(_0xb4f0b9)),_0x1ddc51(0x18c));}const _0x5277a3=await withSpinner(_0x1ddc51(0x19c),()=>_0x92fb29[_0x1ddc51(0x16a)][_0x1ddc51(0x170)](_0xb4f0b9),{'verbose':_0xa56297[_0x1ddc51(0x1be)]}),_0x3c2591=_0x5277a3[_0x1ddc51(0x166)],_0x4fd281=await withSpinner(_0x1ddc51(0x177),()=>_0x92fb29[_0x1ddc51(0x1d9)][_0x1ddc51(0x1c5)](_0x3c2591),{'verbose':_0xa56297[_0x1ddc51(0x1be)]});let _0x400628=_0x4fd281['data'];if(_0x14e769){const _0x42dcfc=_0x400628[_0x1ddc51(0x1c4)](_0x59f529=>_0x59f529[_0x1ddc51(0x18b)]['toLowerCase']()===_0x14e769[_0x1ddc51(0x182)]());if(_0x42dcfc[_0x1ddc51(0x1cb)]===0x0)return console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1ae)+_0x14e769),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1e3)),0x1;_0x400628=_0x42dcfc;}if(_0x400628[_0x1ddc51(0x1cb)]===0x0)return console[_0x1ddc51(0x1c9)](_0x1ddc51(0x160)),0x0;const _0x53d29b=[];for(const _0x11246a of _0x400628){const _0x3b87b7=await withSpinner(_0x1ddc51(0x175)+_0x11246a['journeyBundleName']+_0x1ddc51(0x1ce),()=>_0x92fb29['journey'][_0x1ddc51(0x17d)](_0x11246a['id']),{'verbose':_0xa56297['verbose']}),_0x336d89=_0x3b87b7[_0x1ddc51(0x166)],_0x51c0f0=_0x336d89[_0x1ddc51(0x1a4)]?.['audienceId'],_0xc7346f={'resolveSegment':async _0x49656e=>{const _0xcc6d1a=_0x1ddc51;if(!_0x51c0f0)return{'name':_0x49656e,'isJourneyLocal':![]};try{const _0x42f582=await _0x92fb29[_0xcc6d1a(0x16a)]['getSegment'](_0x51c0f0,_0x49656e),_0x3b9937=_0x42f582[_0xcc6d1a(0x15e)]===SEGMENT_KIND_JOURNEY;let _0x322d91;return _0x3b9937&&_0x42f582[_0xcc6d1a(0x1ac)]&&(_0x322d91={'description':_0x42f582[_0xcc6d1a(0x164)],'rule':apiRuleToYaml(_0x42f582[_0xcc6d1a(0x1ac)])}),{'name':_0x42f582['name'],'isJourneyLocal':_0x3b9937,'definition':_0x322d91};}catch(_0x1b873f){return _0xa56297['verbose']&&console[_0xcc6d1a(0x1c9)](_0xcc6d1a(0x1b5)+_0x49656e+':\x20'+_0x1b873f['message']),{'name':_0x49656e,'isJourneyLocal':![]};}}},_0xb20a1=await apiToYamlAsync(_0x336d89,_0xc7346f),_0x4661df=toYamlString(_0xb20a1),_0x106502=sanitizeFileName(_0x11246a[_0x1ddc51(0x18b)]),_0x5b0e69=a25_0x534d5e[_0x1ddc51(0x1eb)](_0x73b31a,_0x106502+'.yml'),_0x356ce3=a25_0x534d5e[_0x1ddc51(0x1de)](process[_0x1ddc51(0x1b1)](),_0x5b0e69);if(existsSync(_0x5b0e69)){const _0x5408f6=readFileSync(_0x5b0e69,_0x1ddc51(0x1b7)),_0x8f1a93=generateDiff(_0x5408f6,_0x4661df),_0x36c5de=hasChanges(_0x8f1a93);_0x53d29b[_0x1ddc51(0x1c8)]({'relativePath':_0x356ce3,'absolutePath':_0x5b0e69,'content':_0x4661df,'isNew':![],'hasChanges':_0x36c5de,'diff':_0x36c5de?formatDiffWithColors(_0x8f1a93):undefined});}else _0x53d29b[_0x1ddc51(0x1c8)]({'relativePath':_0x356ce3,'absolutePath':_0x5b0e69,'content':_0x4661df,'isNew':!![],'hasChanges':![]});}const _0x11a33d=_0x53d29b[_0x1ddc51(0x1c4)](_0x1ef6d5=>_0x1ef6d5[_0x1ddc51(0x1dc)]),_0xaa0b1=_0x53d29b['filter'](_0x5715ef=>!_0x5715ef[_0x1ddc51(0x1dc)]&&_0x5715ef[_0x1ddc51(0x1cc)]),_0x48390f=_0x53d29b[_0x1ddc51(0x1c4)](_0x48d430=>!_0x48d430[_0x1ddc51(0x1dc)]&&!_0x48d430[_0x1ddc51(0x1cc)]);console[_0x1ddc51(0x1c9)]('\x0aPull\x20summary:'),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x1d5)](_0x400628['length']+_0x1ddc51(0x1c3))),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x1b6)]('+\x20'+_0x11a33d[_0x1ddc51(0x1cb)]+'\x20new\x20files')),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x1ea)]('~\x20'+_0xaa0b1[_0x1ddc51(0x1cb)]+'\x20changed\x20files')),console[_0x1ddc51(0x1c9)]('\x20\x20'+a25_0x3cb7c7[_0x1ddc51(0x186)]('=\x20'+_0x48390f['length']+_0x1ddc51(0x19a))),console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1a1)+a25_0x3cb7c7[_0x1ddc51(0x1d5)](_0x73b31a)+'\x0a');if(_0xaa0b1['length']>0x0)for(const _0x51460b of _0xaa0b1){console[_0x1ddc51(0x1c9)]('\x0aChanges\x20to\x20\x27'+_0x51460b['relativePath']+'\x27:'),console[_0x1ddc51(0x1c9)]('─'[_0x1ddc51(0x1ca)](0x3c)),console[_0x1ddc51(0x1c9)](_0x51460b['diff']),console[_0x1ddc51(0x1c9)]('─'[_0x1ddc51(0x1ca)](0x3c));}if(_0x4e6b12[_0x1ddc51(0x168)])return console['error'](a25_0x3cb7c7[_0x1ddc51(0x1ea)](_0x1ddc51(0x16e))),0x0;if(_0x11a33d[_0x1ddc51(0x1cb)]===0x0&&_0xaa0b1[_0x1ddc51(0x1cb)]===0x0)return console[_0x1ddc51(0x1c9)](a25_0x3cb7c7[_0x1ddc51(0x1b6)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),0x0;if(!_0x4e6b12[_0x1ddc51(0x1d2)]&&(_0x11a33d[_0x1ddc51(0x1cb)]>0x0||_0xaa0b1[_0x1ddc51(0x1cb)]>0x0)){const _0x11f06b=await confirmKey('Write\x20'+(_0x11a33d['length']+_0xaa0b1[_0x1ddc51(0x1cb)])+_0x1ddc51(0x1c1));if(!_0x11f06b)return console[_0x1ddc51(0x1c9)](_0x1ddc51(0x1ba)),0x1;}!existsSync(_0x73b31a)&&mkdirSync(_0x73b31a,{'recursive':!![]});for(const _0xc022db of _0x53d29b){(_0xc022db[_0x1ddc51(0x1dc)]||_0xc022db['hasChanges'])&&writeFileSync(_0xc022db['absolutePath'],_0xc022db[_0x1ddc51(0x195)],_0x1ddc51(0x1b7));}return console[_0x1ddc51(0x1c9)](a25_0x3cb7c7[_0x1ddc51(0x1b6)](_0x1ddc51(0x1db)+(_0x11a33d[_0x1ddc51(0x1cb)]+_0xaa0b1[_0x1ddc51(0x1cb)])+_0x1ddc51(0x19f)+_0x73b31a)),0x0;}}
@@ -1 +1 @@
1
- const a26_0x9b0f89=a26_0x2097;(function(_0x274965,_0x244c03){const _0x5c8bc4=a26_0x2097,_0x5ed137=_0x274965();while(!![]){try{const _0x5a96ea=parseInt(_0x5c8bc4(0x1a4))/0x1*(-parseInt(_0x5c8bc4(0x22b))/0x2)+-parseInt(_0x5c8bc4(0x228))/0x3*(parseInt(_0x5c8bc4(0x246))/0x4)+parseInt(_0x5c8bc4(0x1e1))/0x5+-parseInt(_0x5c8bc4(0x1a6))/0x6+parseInt(_0x5c8bc4(0x1c0))/0x7*(-parseInt(_0x5c8bc4(0x1da))/0x8)+parseInt(_0x5c8bc4(0x1ab))/0x9*(-parseInt(_0x5c8bc4(0x1cf))/0xa)+parseInt(_0x5c8bc4(0x1fd))/0xb*(parseInt(_0x5c8bc4(0x234))/0xc);if(_0x5a96ea===_0x244c03)break;else _0x5ed137['push'](_0x5ed137['shift']());}catch(_0x3514a7){_0x5ed137['push'](_0x5ed137['shift']());}}}(a26_0x108b,0x97db6));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';function a26_0x108b(){const _0x1082dd=['attributes','Resolving\x20project\x20\x27','stack','[input]\x20\x20','input','getCurrentProject','[output]\x20','resolveProjectId','Fetching\x20chat\x20sessions...','Fetching\x20available\x20models...','integrations','Project\x20backed\x20up\x20to:\x20','projectId','floor','llm:agent:delete','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','Fetching\x20agents...','Invalid\x20path\x20syntax:\x20','rmSync','Create\x20a\x20new\x20LLM\x20project','targetImageGenerator','llm','Updating\x20agent...','Project\x20created:\x20','No\x20messages\x20found\x20in\x20chat\x20history.','[image]\x20\x20','853558AiMbdF','Load\x20more...','655506mwfuBL','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','createdAt','join','tool_call','9INrCxd','(no\x20message)','tdx\x20llm\x20history','llm:agents','includes','magenta','sourceSite','setCurrentProject','json','llmProject','targetAgent','Error:\x20Backup\x20folder\x20path\x20is\x20required','\x20->\x20KB:','log','deleteAgent','all','targetWebSearchTool','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','lastConversationAt','\x20→\x20chat:\x20','get','96236NhHDmY','llm:agent:update','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','deleteProject','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','llm:models','model','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','Validating\x20backup\x20from\x20\x27','...','[tool_call]','INVALID_ARGUMENT','List\x20agents\x20in\x20current\x20project','error','10997280dHIoEp','Analyzing\x20project\x20\x27','data','agent','map','set','agentId','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','createProject','prompt','Checking\x20for\x20existing\x20projects...','136pqDUHK','agents','Creating\x20agent\x20\x27','keys','maxToolIterations','stringify','\x20\x20Knowledge\x20Bases:\x20','6159300SHxymK','[error]\x20\x20','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','Usage:\x20tdx\x20llm\x20use\x20<project-name>','getBackupMetadata','yes','List\x20available\x20LLM\x20models','history','bold','Resolving\x20agent\x20\x27','prompts','\x20--last','h\x20ago','Project\x20not\x20found:\x20','blue','Error:\x20Project\x20name\x20is\x20required','jsonl','restoreProject','\x20->\x20WebSearch:','Delete\x20an\x20LLM\x20project','just\x20now','Backup\x20cancelled.','output','Agent\x20deleted:\x20','Deleting\x20project\x20\x27','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','\x20\x20Cause:\x20','11JRQBZB','chats','llm:use','Error:\x20Agent\x20name\x20is\x20required','Use\x20format:\x20project-name/agent-name','split','filter','length','tool','tdx\x20chats','name','Deleting\x20agent...','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','\x20\x20Agents:\x20','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','chatId','execute','dryRun','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','projectName','Backing\x20up\x20project\x20\x27','substring','Getting\x20default\x20project...','exportedFrom','targetKnowledgeBase','cyan','image','llm:project:restore','Set\x20current\x20project\x20context','Fetching\x20agent...','push','(no\x20agent)','dim','projects','default','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','verbose','format','table','\x20\x20Integrations:\x20','select','List\x20all\x20LLM\x20projects','numeric','42hwSAWx','last','starterMessage','2tkqpMl','getOrCreateDefaultProject','systemPrompt','llm:history','\x27...','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','\x20->\x20Agent:','Fetching\x20chat\x20history\x20for\x20\x27','26466732uaVPqD','\x20-\x20','claude-4.5-haiku','Fetching\x20most\x20recent\x20chat...','Delete\x20an\x20agent','counts','string','getTime','Restore\x20cancelled.','existsSync','toLocaleDateString','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','__load_more__','[tool]\x20\x20\x20','content','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','updatedAt','d\x20ago','148332pNGNGC','toLowerCase','entries','find','createAgent','\x20\x20Prompts:\x20','cause','[unknown]','Show\x20agent\x20details','knowledgeBases','red','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','models','Creating\x20project\x20\x27','Agent\x20created:\x20','slice','description','limit','\x0aCancelled','Setting\x20project\x20context\x20to\x20\x27','\x27\x20already\x20exists.\x20Overwrite?','llm:agent:create','LLM_PROJECT_NOT_FOUND','Output\x20directory\x20\x27','Create\x20a\x20new\x20agent\x20in\x20current\x20project','message'];a26_0x108b=function(){return _0x1082dd;};return a26_0x108b();}import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a26_0x39a6c7 from'node:fs';function handleSDKError(_0x498c3f,_0x275b4b){const _0x1907c8=a26_0x2097;if(_0x498c3f instanceof SDKError)console['error']('Error:\x20'+_0x498c3f[_0x1907c8(0x25f)]),_0x275b4b[_0x1907c8(0x221)]&&(_0x498c3f[_0x1907c8(0x24c)]&&console[_0x1907c8(0x1ce)](_0x1907c8(0x1fc)+_0x498c3f[_0x1907c8(0x24c)]),_0x498c3f[_0x1907c8(0x262)]&&(console[_0x1907c8(0x1ce)]('\x0aStack\x20trace:'),console[_0x1907c8(0x1ce)](_0x498c3f[_0x1907c8(0x262)])));else throw _0x498c3f;}function formatChatHistoryEntry(_0x427c29,_0x176349){const _0x32b1ff=a26_0x2097,_0x4e7d50=getChalk(_0x176349),_0x4131a4=_0x4e7d50['dim'](_0x427c29['at']);if(_0x32b1ff(0x264)in _0x427c29){const _0x3cc125=_0x4e7d50['cyan'](_0x32b1ff(0x263));return _0x4131a4+'\x20'+_0x3cc125+':\x20'+_0x427c29[_0x32b1ff(0x264)];}if(_0x32b1ff(0x242)in _0x427c29){const _0x562d65=_0x4e7d50['green']('[content]');return _0x4131a4+'\x20'+_0x562d65+':\x20'+_0x427c29[_0x32b1ff(0x242)];}if(_0x32b1ff(0x1aa)in _0x427c29){const _0x9c44e3=_0x4e7d50['yellow'](_0x32b1ff(0x1cb)),{functionName:_0x37e699,functionArguments:_0x3da80a,targetFunction:_0x2ba966}=_0x427c29[_0x32b1ff(0x1aa)];let _0x45b9ca=_0x4131a4+'\x20'+_0x9c44e3+':\x20'+_0x4e7d50[_0x32b1ff(0x1e9)](_0x37e699);if(_0x3da80a&&Object[_0x32b1ff(0x1dd)](_0x3da80a)[_0x32b1ff(0x204)]>0x0){const _0x332d54=Object[_0x32b1ff(0x248)](_0x3da80a)[_0x32b1ff(0x1d3)](([_0x40b45e,_0x3ea9ab])=>_0x40b45e+'='+JSON[_0x32b1ff(0x1df)](_0x3ea9ab))[_0x32b1ff(0x1a9)](',\x20');_0x45b9ca+='('+_0x332d54+')';}_0x2ba966&&(_0x45b9ca+=_0x4e7d50[_0x32b1ff(0x21d)]('\x20['+_0x2ba966+']'));let _0x3b23db='';if(_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x215)])_0x3b23db=_0x32b1ff(0x1b7)+_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x215)]['name'];else{if(_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x1b5)])_0x3b23db=_0x32b1ff(0x232)+_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x1b5)][_0x32b1ff(0x207)];else{if(_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x1bb)])_0x3b23db=_0x32b1ff(0x1f3)+_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x1bb)][_0x32b1ff(0x207)];else _0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x19e)]&&(_0x3b23db='\x20->\x20ImageGen:'+_0x427c29[_0x32b1ff(0x1aa)][_0x32b1ff(0x19e)][_0x32b1ff(0x207)]);}}return _0x45b9ca+_0x3b23db;}if(_0x32b1ff(0x205)in _0x427c29){const _0x193002=_0x4e7d50[_0x32b1ff(0x1b0)](_0x32b1ff(0x241)),{functionName:_0x37b0fd,functionArguments:_0x5f4a64,content:_0x37e270,newChat:_0x131be9}=_0x427c29['tool'];let _0x2a5fc4=_0x4131a4+'\x20'+_0x193002+':\x20'+_0x4e7d50[_0x32b1ff(0x1e9)](_0x37b0fd);if(_0x5f4a64){const _0x498b20=typeof _0x5f4a64===_0x32b1ff(0x23a)?_0x5f4a64:JSON[_0x32b1ff(0x1df)](_0x5f4a64);_0x2a5fc4+='('+_0x498b20+')';}return _0x37e270&&(_0x2a5fc4+='\x0a'+_0x4e7d50[_0x32b1ff(0x21d)](_0x37e270)),_0x131be9&&(_0x2a5fc4+=_0x4e7d50['dim'](_0x32b1ff(0x1be)+_0x131be9['id'])),_0x2a5fc4;}if(_0x32b1ff(0x1f7)in _0x427c29){const _0x255968=_0x4e7d50[_0x32b1ff(0x1ef)](_0x32b1ff(0x266));return _0x4131a4+'\x20'+_0x255968+':\x20'+_0x427c29[_0x32b1ff(0x1f7)][_0x32b1ff(0x207)]+'\x20('+_0x427c29[_0x32b1ff(0x1f7)][_0x32b1ff(0x242)][_0x32b1ff(0x204)]+'\x20bytes)';}if(_0x32b1ff(0x217)in _0x427c29){const _0x45d1d6=_0x4e7d50[_0x32b1ff(0x1ef)](_0x32b1ff(0x1a3)),{width:_0x2f586f,height:_0x592af2,headerText:_0x37fbc3}=_0x427c29[_0x32b1ff(0x217)],_0x5ce4a0=_0x37fbc3?_0x32b1ff(0x235)+_0x37fbc3:'';return _0x4131a4+'\x20'+_0x45d1d6+':\x20'+_0x2f586f+'x'+_0x592af2+_0x5ce4a0;}if('error'in _0x427c29){const _0x591d22=_0x4e7d50[_0x32b1ff(0x250)](_0x32b1ff(0x1e2));return _0x4131a4+'\x20'+_0x591d22+':\x20'+_0x427c29[_0x32b1ff(0x1ce)];}return _0x4131a4+'\x20'+_0x4e7d50['dim'](_0x32b1ff(0x24d))+':\x20'+JSON[_0x32b1ff(0x1df)](_0x427c29);}async function executeChatHistoryCommand(_0x1d5ca9,_0x14d4f0){const _0x9b6853=a26_0x2097,{options:_0xcac2e4,args:_0x1e6e02,tdx:_0x4710a9}=_0x1d5ca9,_0x2780da=_0x1e6e02[0x0],_0x436541=_0xcac2e4,_0x37703e=_0x436541[_0x9b6853(0x229)];try{if(_0x37703e&&_0x2780da)return console['error'](_0x9b6853(0x1c2)),console['error']('Usage:\x20'+_0x14d4f0+_0x9b6853(0x1ec)),0x1;if(!_0x2780da&&!_0x37703e&&_0xcac2e4[_0x9b6853(0x222)]!==undefined){const _0x59ebd9=resolveLimit(_0xcac2e4[_0x9b6853(0x257)],DEFAULT_LLM_LIMIT),_0x4a87ba=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x4710a9[_0x9b6853(0x19f)][_0x9b6853(0x1fe)](_0x59ebd9),{'verbose':_0xcac2e4[_0x9b6853(0x221)]});return await handleSDKOutput(_0x4a87ba[_0x9b6853(0x1d1)],_0xcac2e4),0x0;}const _0x244128=await getChatIdOrSelect(_0x4710a9,_0xcac2e4,_0x37703e,_0x2780da);if(!_0x244128)return 0x0;return await displayChatHistory(_0x244128,_0x4710a9,_0xcac2e4),0x0;}catch(_0x11c85a){return handleSDKError(_0x11c85a,_0xcac2e4),0x1;}}async function displayChatHistory(_0x28599f,_0x2c43ab,_0x47a381){const _0x518968=a26_0x2097,_0xb8ef41=await withSpinner(_0x518968(0x233)+_0x28599f+_0x518968(0x22f),()=>_0x2c43ab[_0x518968(0x19f)][_0x518968(0x1e8)](_0x28599f),{'verbose':_0x47a381['verbose']}),_0x55b4f7=_0xb8ef41['data'][_0x518968(0x1d1)]??[];if(_0x55b4f7['length']===0x0){console['log'](_0x518968(0x1a2));return;}if(_0x47a381[_0x518968(0x222)]!==undefined)await handleSDKOutput(_0x55b4f7,_0x47a381);else{const _0x57c798=_0x55b4f7[_0x518968(0x1d3)](_0x565ff5=>formatChatHistoryEntry(_0x565ff5,_0x47a381)),_0x599d2c=_0x57c798[_0x518968(0x1a9)]('\x0a');await writeOutput(_0x599d2c,_0x47a381[_0x518968(0x1f7)],_0x518968(0x223));}}async function getChatIdOrSelect(_0x2bb937,_0x314834,_0x3555b2,_0x3ee70b){const _0x42b967=a26_0x2097;if(_0x3ee70b)return _0x3ee70b;if(_0x3555b2){const _0x336d85=await withSpinner(_0x42b967(0x237),()=>_0x2bb937[_0x42b967(0x19f)]['chats'](0x1),{'verbose':_0x314834[_0x42b967(0x221)]});if(_0x336d85[_0x42b967(0x1d1)][_0x42b967(0x204)]===0x0)return console[_0x42b967(0x1b8)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x336d85[_0x42b967(0x1d1)][0x0]['id'];}const _0xa86154=await selectChatInteractively(_0x2bb937,_0x314834);if(!_0xa86154)return console[_0x42b967(0x1b8)](_0x42b967(0x258)),undefined;return _0xa86154;}async function getProjectIdOrDefault(_0x4c9c37){const _0x3f8f59=a26_0x2097,{tdx:_0x528057,options:_0x1ea581}=_0x4c9c37,_0x5a27ce=_0x1ea581[_0x3f8f59(0x1b4)];if(_0x5a27ce){const _0x4715c9=await withSpinner(_0x3f8f59(0x261)+_0x5a27ce+'\x27...',()=>_0x528057['llm'][_0x3f8f59(0x267)](_0x5a27ce),{'verbose':_0x1ea581[_0x3f8f59(0x221)]});return _0x4715c9[_0x3f8f59(0x1d1)];}let _0x56a650=_0x528057[_0x3f8f59(0x19f)][_0x3f8f59(0x265)]();if(_0x56a650)return _0x56a650;const _0x4f9a5e=await withSpinner(_0x3f8f59(0x213),()=>_0x528057[_0x3f8f59(0x19f)][_0x3f8f59(0x22c)](),{'verbose':_0x1ea581[_0x3f8f59(0x221)]});return _0x4f9a5e[_0x3f8f59(0x1d1)]['id'];}function toLLMProjectInfo(_0x4539d3){const _0xfdad0f=a26_0x2097;return{'name':_0x4539d3[_0xfdad0f(0x260)]['name'],'description':_0x4539d3['attributes']['description'],'createdAt':_0x4539d3[_0xfdad0f(0x260)][_0xfdad0f(0x1a8)],'updatedAt':_0x4539d3[_0xfdad0f(0x260)][_0xfdad0f(0x244)]};}function a26_0x2097(_0x504375,_0x583617){_0x504375=_0x504375-0x198;const _0x108b34=a26_0x108b();let _0x20978b=_0x108b34[_0x504375];return _0x20978b;}function toAgentInfo(_0x3bc51c){const _0x26a331=a26_0x2097;return{'name':_0x3bc51c[_0x26a331(0x260)][_0x26a331(0x207)],'description':_0x3bc51c[_0x26a331(0x260)][_0x26a331(0x256)],'prompt':truncatePrompt(_0x3bc51c[_0x26a331(0x260)][_0x26a331(0x1d8)]),'createdAt':_0x3bc51c[_0x26a331(0x260)][_0x26a331(0x1a8)],'updatedAt':_0x3bc51c[_0x26a331(0x260)]['updatedAt']};}function truncatePrompt(_0x22a045){const _0x5a40bb=a26_0x2097;if(!_0x22a045)return undefined;const _0x46c056=0x64;if(_0x22a045['length']<=_0x46c056)return _0x22a045;return _0x22a045[_0x5a40bb(0x255)](0x0,_0x46c056)+_0x5a40bb(0x1ca);}export class LLMModelsCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x1c5);['description']=a26_0x9b0f89(0x1e7);async[a26_0x9b0f89(0x20d)](_0x55aac4){const _0x5be829=a26_0x9b0f89,{options:_0x28d638,tdx:_0x192fde}=_0x55aac4;try{const _0x45d553=await withSpinner(_0x5be829(0x269),()=>_0x192fde[_0x5be829(0x19f)][_0x5be829(0x252)](),{'verbose':_0x28d638[_0x5be829(0x221)]});return await handleSDKOutput(_0x45d553[_0x5be829(0x1d1)],_0x28d638),0x0;}catch(_0x877a6b){return handleSDKError(_0x877a6b,_0x28d638),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a26_0x9b0f89(0x207)]='llm:projects';[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x226);async[a26_0x9b0f89(0x20d)](_0x25b60e){const _0xa78238=a26_0x9b0f89,{options:_0x3679e2,args:_0x1e250a,tdx:_0x20c840}=_0x25b60e;try{const _0x1c8b35=_0x1e250a[0x0],_0x520b4c=resolveLimit(_0x3679e2[_0xa78238(0x257)],DEFAULT_LLM_LIMIT),_0x52cb71=await withSpinner('Fetching\x20projects...',()=>_0x20c840[_0xa78238(0x19f)]['projects'](_0x520b4c),{'verbose':_0x3679e2[_0xa78238(0x221)]});let _0x28b46a=_0x52cb71['data'];_0x1c8b35&&(_0x28b46a=_0x52cb71[_0xa78238(0x1d1)][_0xa78238(0x203)](_0x3633e1=>matchGlobPattern(_0x3633e1[_0xa78238(0x260)][_0xa78238(0x207)],_0x1c8b35)));const _0x18dc93=_0x28b46a[_0xa78238(0x1d3)](toLLMProjectInfo);return await handleSDKOutput(_0x18dc93,_0x3679e2),0x0;}catch(_0x2b37ac){return handleSDKError(_0x2b37ac,_0x3679e2),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x1ae);[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x1cd);async[a26_0x9b0f89(0x20d)](_0x9097db){const _0x214b63=a26_0x9b0f89,{options:_0x1f9b99,args:_0x3b6b57,tdx:_0x1a0756}=_0x9097db;try{const _0x2fc2bf=_0x3b6b57[0x0];let _0x2cec4b,_0x4578f9=_0x2fc2bf;if(_0x2fc2bf&&_0x2fc2bf[_0x214b63(0x1af)]('/')){const _0x5cbe46=_0x2fc2bf[_0x214b63(0x202)]('/');if(_0x5cbe46[_0x214b63(0x204)]===0x2){const [_0x59bc1f,_0x52c02a]=_0x5cbe46,_0x302fe8=await _0x1a0756[_0x214b63(0x19f)][_0x214b63(0x21e)](),_0x14ff2a=_0x302fe8['find'](_0x54c99a=>_0x54c99a['attributes'][_0x214b63(0x207)][_0x214b63(0x247)]()===_0x59bc1f[_0x214b63(0x247)]());if(!_0x14ff2a)throw new SDKError(ErrorCode[_0x214b63(0x25c)],_0x214b63(0x1ee)+_0x59bc1f,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});_0x2cec4b=_0x14ff2a['id'],_0x4578f9=_0x52c02a;}else throw new SDKError(ErrorCode[_0x214b63(0x1cc)],_0x214b63(0x19b)+_0x2fc2bf,undefined,{'helpText':_0x214b63(0x201)});}else _0x2cec4b=await getProjectIdOrDefault(_0x9097db);const _0x1d725a=await withSpinner(_0x214b63(0x19a),()=>_0x1a0756[_0x214b63(0x19f)]['agents'](_0x2cec4b),{'verbose':_0x1f9b99[_0x214b63(0x221)]});let _0x108fbb=_0x1d725a[_0x214b63(0x1d1)];_0x4578f9&&(_0x108fbb=_0x1d725a['data'][_0x214b63(0x203)](_0x541ef8=>matchGlobPattern(_0x541ef8[_0x214b63(0x260)][_0x214b63(0x207)],_0x4578f9)));const _0x332001=_0x108fbb[_0x214b63(0x1d3)](toAgentInfo);return await handleSDKOutput(_0x332001,_0x1f9b99),0x0;}catch(_0x58b30e){return handleSDKError(_0x58b30e,_0x1f9b99),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a26_0x9b0f89(0x207)]='llm:agent:show';[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x24e);async[a26_0x9b0f89(0x20d)](_0x1b88c5){const _0x52c4f8=a26_0x9b0f89,{options:_0x2c1b0a,args:_0x58d59d,tdx:_0x4a3f66}=_0x1b88c5;if(_0x58d59d[_0x52c4f8(0x204)]===0x0)return console[_0x52c4f8(0x1ce)]('Error:\x20Agent\x20name\x20is\x20required'),console['error'](_0x52c4f8(0x20f)),0x1;const _0x5a5aa6=_0x58d59d[0x0];try{const _0x7e3363=await getProjectIdOrDefault(_0x1b88c5),_0x3fd6d7=await withSpinner('Resolving\x20agent\x20\x27'+_0x5a5aa6+_0x52c4f8(0x22f),()=>_0x4a3f66[_0x52c4f8(0x19f)]['resolveAgentId'](_0x5a5aa6,_0x7e3363),{'verbose':_0x2c1b0a[_0x52c4f8(0x221)]}),_0x137d3d=await withSpinner(_0x52c4f8(0x21a),()=>_0x4a3f66[_0x52c4f8(0x19f)][_0x52c4f8(0x1d2)](_0x3fd6d7[_0x52c4f8(0x1d1)]),{'verbose':_0x2c1b0a[_0x52c4f8(0x221)]});return await handleSDKOutput([_0x137d3d[_0x52c4f8(0x1d1)]],_0x2c1b0a),0x0;}catch(_0x393989){return handleSDKError(_0x393989,_0x2c1b0a),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x25b);['description']=a26_0x9b0f89(0x25e);async['execute'](_0x564e2b){const _0x18365e=a26_0x9b0f89,{options:_0x52ace0,args:_0x1e4da3,tdx:_0x398db7}=_0x564e2b;if(_0x1e4da3[_0x18365e(0x204)]===0x0)return console[_0x18365e(0x1ce)](_0x18365e(0x200)),console[_0x18365e(0x1ce)](_0x18365e(0x1e3)),console[_0x18365e(0x1ce)](_0x18365e(0x209)),0x1;const _0xcbc307=_0x1e4da3[0x0],_0x2b2283=_0x52ace0,_0x2381ba=_0x2b2283[_0x18365e(0x22d)],_0x36181c=_0x2b2283[_0x18365e(0x1c6)]||_0x18365e(0x236),_0x34a17b=_0x2b2283[_0x18365e(0x22a)],_0x57bb91=_0x2b2283[_0x18365e(0x1de)]?Number(_0x2b2283['maxToolIterations']):undefined,_0x34534c=_0x2b2283['temperature']?Number(_0x2b2283['temperature']):undefined;try{let _0x3d801a,_0x59b191;if(_0xcbc307['includes']('/')){const _0x1fd0cf=_0xcbc307[_0x18365e(0x202)]('/');if(_0x1fd0cf[_0x18365e(0x204)]===0x2){const [_0x2e3484,_0x528f3c]=_0x1fd0cf,_0x3e625b=await withSpinner('Resolving\x20project\x20\x27'+_0x2e3484+_0x18365e(0x22f),()=>_0x398db7['llm'][_0x18365e(0x267)](_0x2e3484),{'verbose':_0x52ace0[_0x18365e(0x221)]});_0x3d801a=_0x3e625b[_0x18365e(0x1d1)],_0x59b191=_0x528f3c;}else throw new SDKError(ErrorCode[_0x18365e(0x1cc)],_0x18365e(0x19b)+_0xcbc307,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x3d801a=await getProjectIdOrDefault(_0x564e2b),_0x59b191=_0xcbc307;const _0x3678b2=await withSpinner(_0x18365e(0x1dc)+_0x59b191+'\x27...',()=>_0x398db7[_0x18365e(0x19f)][_0x18365e(0x24a)]({'name':_0x59b191,'projectId':_0x3d801a,'modelType':_0x36181c,'systemPrompt':_0x2381ba,'starterMessage':_0x34a17b,'maxToolIterations':_0x57bb91,'temperature':_0x34534c}),{'verbose':_0x52ace0['verbose']});return console[_0x18365e(0x1b8)](_0x18365e(0x254)+_0x3678b2['data']['id']),await handleSDKOutput([_0x3678b2[_0x18365e(0x1d1)]],_0x52ace0),0x0;}catch(_0x2680b9){return handleSDKError(_0x2680b9,_0x52ace0),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x1c1);[a26_0x9b0f89(0x256)]='Update\x20an\x20existing\x20agent';async[a26_0x9b0f89(0x20d)](_0x5eabd8){const _0x567f5e=a26_0x9b0f89,{options:_0x22bd64,args:_0x177625,tdx:_0x2baae6}=_0x5eabd8;if(_0x177625[_0x567f5e(0x204)]===0x0)return console[_0x567f5e(0x1ce)](_0x567f5e(0x200)),console[_0x567f5e(0x1ce)](_0x567f5e(0x1fb)),0x1;const _0x5cbde2=_0x177625[0x0],_0x5cb428=_0x22bd64,_0x2f1512=_0x5cb428[_0x567f5e(0x207)],_0x3ad1d2=_0x5cb428[_0x567f5e(0x1d8)],_0x25f179=_0x5cb428[_0x567f5e(0x256)],_0x5f4a44=_0x5cb428[_0x567f5e(0x22a)];if(!_0x2f1512&&!_0x3ad1d2&&!_0x25f179&&!_0x5f4a44)return console[_0x567f5e(0x1ce)](_0x567f5e(0x1c4)),console['error'](_0x567f5e(0x230)),0x1;try{const _0x14ae73=await getProjectIdOrDefault(_0x5eabd8),_0x4366de=await withSpinner(_0x567f5e(0x1ea)+_0x5cbde2+_0x567f5e(0x22f),()=>_0x2baae6[_0x567f5e(0x19f)]['resolveAgentId'](_0x5cbde2,_0x14ae73),{'verbose':_0x22bd64['verbose']}),_0x69b93d=_0x4366de['data'],_0x5bd0a4=await withSpinner(_0x567f5e(0x1a0),()=>_0x2baae6['llm']['updateAgent'](_0x69b93d,{'name':_0x2f1512,'prompt':_0x3ad1d2,'description':_0x25f179,'starterMessage':_0x5f4a44}),{'verbose':_0x22bd64[_0x567f5e(0x221)]});return console['log']('Agent\x20updated:\x20'+_0x5bd0a4[_0x567f5e(0x1d1)]['id']),await handleSDKOutput([_0x5bd0a4[_0x567f5e(0x1d1)]],_0x22bd64),0x0;}catch(_0x815491){return handleSDKError(_0x815491,_0x22bd64),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x198);[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x238);async['execute'](_0x247701){const _0x535245=a26_0x9b0f89,{options:_0x3595fa,args:_0x4c5164,tdx:_0x487241}=_0x247701;if(_0x4c5164[_0x535245(0x204)]===0x0)return console[_0x535245(0x1ce)](_0x535245(0x200)),console[_0x535245(0x1ce)](_0x535245(0x251)),0x1;const _0x1cb932=_0x4c5164[0x0];try{const _0x5a0100=await getProjectIdOrDefault(_0x247701),_0x505b9b=await withSpinner(_0x535245(0x1ea)+_0x1cb932+_0x535245(0x22f),()=>_0x487241['llm']['resolveAgentId'](_0x1cb932,_0x5a0100),{'verbose':_0x3595fa[_0x535245(0x221)]}),_0x314e24=_0x505b9b[_0x535245(0x1d1)];return await withSpinner(_0x535245(0x208),()=>_0x487241[_0x535245(0x19f)][_0x535245(0x1b9)](_0x314e24),{'verbose':_0x3595fa[_0x535245(0x221)]}),console['log'](_0x535245(0x1f8)+_0x314e24),0x0;}catch(_0x4ce96d){return handleSDKError(_0x4ce96d,_0x3595fa),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x22e);[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x20b);async[a26_0x9b0f89(0x20d)](_0x142077){const _0x524ba9=a26_0x9b0f89;return executeChatHistoryCommand(_0x142077,_0x524ba9(0x1ad));}}export class LLMUseCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x1ff);[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x219);async[a26_0x9b0f89(0x20d)](_0x545c9d){const _0x227a49=a26_0x9b0f89,{options:_0x288027,args:_0x710ccb,tdx:_0x56b586}=_0x545c9d;if(_0x710ccb['length']===0x0)return console['error'](_0x227a49(0x1f0)),console[_0x227a49(0x1ce)](_0x227a49(0x1e4)),0x1;const _0x5ea3b2=_0x710ccb[0x0];try{return await withSpinner(_0x227a49(0x259)+_0x5ea3b2+'\x27...',()=>_0x56b586[_0x227a49(0x19f)][_0x227a49(0x1b2)](_0x5ea3b2),{'verbose':_0x288027[_0x227a49(0x221)]}),console[_0x227a49(0x1b8)]('Project\x20context\x20set\x20to:\x20'+_0x5ea3b2),0x0;}catch(_0x572b35){return handleSDKError(_0x572b35,_0x288027),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a26_0x9b0f89(0x207)]='llm:project:create';['description']=a26_0x9b0f89(0x19d);async[a26_0x9b0f89(0x20d)](_0x3c6fe9){const _0x2c4aaa=a26_0x9b0f89,{options:_0x46f698,args:_0x4491dd,tdx:_0x390b5e}=_0x3c6fe9;if(_0x4491dd[_0x2c4aaa(0x204)]===0x0)return console[_0x2c4aaa(0x1ce)](_0x2c4aaa(0x1f0)),console[_0x2c4aaa(0x1ce)](_0x2c4aaa(0x1bc)),0x1;const _0x549bf9=_0x4491dd[0x0],_0x5d95c4=_0x46f698,_0x2638ae=_0x5d95c4[_0x2c4aaa(0x256)];try{const _0x2e319c=await withSpinner(_0x2c4aaa(0x253)+_0x549bf9+'\x27...',()=>_0x390b5e[_0x2c4aaa(0x19f)][_0x2c4aaa(0x1d7)]({'name':_0x549bf9,'description':_0x2638ae}),{'verbose':_0x46f698[_0x2c4aaa(0x221)]});console['log'](_0x2c4aaa(0x1a1)+_0x2e319c[_0x2c4aaa(0x1d1)]['id']);const _0x4be3c8=toLLMProjectInfo(_0x2e319c[_0x2c4aaa(0x1d1)]);return await handleSDKOutput([_0x4be3c8],_0x46f698),0x0;}catch(_0x40cb11){return handleSDKError(_0x40cb11,_0x46f698),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a26_0x9b0f89(0x207)]='llm:project:delete';['description']=a26_0x9b0f89(0x1f4);async[a26_0x9b0f89(0x20d)](_0x5b3596){const _0x10d6ca=a26_0x9b0f89,{options:_0x3253e6,args:_0x536397,tdx:_0x21276b}=_0x5b3596;if(_0x536397[_0x10d6ca(0x204)]===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x10d6ca(0x1ce)](_0x10d6ca(0x1d6)),0x1;const _0x45037d=_0x536397[0x0];try{return await withSpinner(_0x10d6ca(0x1f9)+_0x45037d+_0x10d6ca(0x22f),()=>_0x21276b['llm'][_0x10d6ca(0x1c3)](_0x45037d),{'verbose':_0x3253e6[_0x10d6ca(0x221)]}),console['log']('Project\x20deleted:\x20'+_0x45037d),0x0;}catch(_0x3965e5){return handleSDKError(_0x3965e5,_0x3253e6),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a26_0x9b0f89(0x207)]='llm:project:backup';[a26_0x9b0f89(0x256)]=a26_0x9b0f89(0x231);async[a26_0x9b0f89(0x20d)](_0x1bcd81){const _0x586de0=a26_0x9b0f89,{options:_0x276050,args:_0x255737,tdx:_0x2beb1f}=_0x1bcd81;if(_0x255737[_0x586de0(0x204)]===0x0)return console[_0x586de0(0x1ce)](_0x586de0(0x1f0)),console[_0x586de0(0x1ce)](_0x586de0(0x1c7)),0x1;const _0xa93412=_0x255737[0x0],_0x10d930=_0x276050,_0x468df0=_0x10d930[_0x586de0(0x1f7)],_0x4f860d=_0x10d930[_0x586de0(0x20e)];try{const _0x47b7e8=_0x468df0||_0xa93412+'.llm';if(a26_0x39a6c7[_0x586de0(0x23d)](_0x47b7e8)&&!_0x4f860d){if(!_0x276050[_0x586de0(0x1e6)]){const _0x1a993a=await confirm(_0x586de0(0x25d)+_0x47b7e8+_0x586de0(0x25a));if(!_0x1a993a)return console[_0x586de0(0x1b8)](_0x586de0(0x1f6)),0x0;}a26_0x39a6c7[_0x586de0(0x19c)](_0x47b7e8,{'recursive':!![]});}const _0x478fd9=await withSpinner(_0x4f860d?_0x586de0(0x1d0)+_0xa93412+_0x586de0(0x22f):_0x586de0(0x211)+_0xa93412+_0x586de0(0x22f),()=>_0x2beb1f[_0x586de0(0x19f)]['backupProject'](_0xa93412,_0x468df0,{'dryRun':_0x4f860d}),{'verbose':_0x276050[_0x586de0(0x221)]}),_0x4fda17=_0x478fd9[_0x586de0(0x1d1)];return _0x4f860d?console['log']('[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20'+_0x4fda17['outputDir']):console[_0x586de0(0x1b8)](_0x586de0(0x26b)+_0x4fda17['outputDir']),console[_0x586de0(0x1b8)](_0x586de0(0x20a)+_0x4fda17['counts'][_0x586de0(0x1db)]),console[_0x586de0(0x1b8)](_0x586de0(0x1e0)+_0x4fda17[_0x586de0(0x239)][_0x586de0(0x24f)]),console[_0x586de0(0x1b8)](_0x586de0(0x24b)+_0x4fda17[_0x586de0(0x239)][_0x586de0(0x1eb)]),console['log'](_0x586de0(0x224)+_0x4fda17[_0x586de0(0x239)][_0x586de0(0x26a)]),(_0x276050[_0x586de0(0x222)]===_0x586de0(0x1b3)||_0x276050[_0x586de0(0x222)]===_0x586de0(0x1f1))&&await handleSDKOutput([_0x4fda17],_0x276050),0x0;}catch(_0x31627a){return handleSDKError(_0x31627a,_0x276050),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x218);['description']=a26_0x9b0f89(0x1a7);async[a26_0x9b0f89(0x20d)](_0x3f69c5){const _0xe12a5f=a26_0x9b0f89,{options:_0x2484fd,args:_0x17e845,tdx:_0xb3e2ae}=_0x3f69c5;if(_0x17e845[_0xe12a5f(0x204)]===0x0)return console[_0xe12a5f(0x1ce)](_0xe12a5f(0x1b6)),console['error'](_0xe12a5f(0x199)),0x1;const _0x56bb88=_0x17e845[0x0],_0x429ea6=_0x2484fd,_0x339b3c=_0x429ea6['name'],_0x2efca8=_0x429ea6[_0xe12a5f(0x20e)];try{if(!_0x2efca8){const _0xe1b1ec=_0xb3e2ae[_0xe12a5f(0x19f)][_0xe12a5f(0x1e5)](_0x56bb88),_0x26c972=_0x339b3c||_0xe1b1ec[_0xe12a5f(0x214)]['projectName'],_0x2ef925=await withSpinner(_0xe12a5f(0x1d9),()=>_0xb3e2ae[_0xe12a5f(0x19f)][_0xe12a5f(0x21e)](),{'verbose':_0x2484fd[_0xe12a5f(0x221)]}),_0x29b798=_0x2ef925['data'][_0xe12a5f(0x249)](_0x5a323a=>_0x5a323a[_0xe12a5f(0x260)]['name']===_0x26c972);if(_0x29b798&&!_0x2484fd[_0xe12a5f(0x1e6)]){const _0x553ef5=await confirm('A\x20project\x20named\x20\x27'+_0x26c972+_0xe12a5f(0x1c8));if(!_0x553ef5)return console['log'](_0xe12a5f(0x23c)),0x0;}}const _0x493282=await withSpinner(_0x2efca8?_0xe12a5f(0x1c9)+_0x56bb88+_0xe12a5f(0x22f):'Restoring\x20project\x20from\x20\x27'+_0x56bb88+_0xe12a5f(0x22f),()=>_0xb3e2ae[_0xe12a5f(0x19f)][_0xe12a5f(0x1f2)](_0x56bb88,{'name':_0x339b3c,'dryRun':_0x2efca8}),{'verbose':_0x2484fd['verbose']}),_0x1da2f9=_0x493282[_0xe12a5f(0x1d1)];return _0x1da2f9[_0xe12a5f(0x1b1)]&&console[_0xe12a5f(0x1b8)](_0xe12a5f(0x23f)+_0x1da2f9['sourceSite']+'\x27'),_0x2efca8?console[_0xe12a5f(0x1b8)](_0xe12a5f(0x220)+_0x1da2f9[_0xe12a5f(0x210)]):console[_0xe12a5f(0x1b8)]('Project\x20restored:\x20'+_0x1da2f9[_0xe12a5f(0x210)]+'\x20('+_0x1da2f9[_0xe12a5f(0x26c)]+')'),console[_0xe12a5f(0x1b8)](_0xe12a5f(0x20a)+_0x1da2f9[_0xe12a5f(0x239)]['agents']),console[_0xe12a5f(0x1b8)](_0xe12a5f(0x1e0)+_0x1da2f9['counts'][_0xe12a5f(0x24f)]),console[_0xe12a5f(0x1b8)]('\x20\x20Prompts:\x20'+_0x1da2f9[_0xe12a5f(0x239)]['prompts']),console[_0xe12a5f(0x1b8)]('\x20\x20Integrations:\x20'+_0x1da2f9[_0xe12a5f(0x239)][_0xe12a5f(0x26a)]),(_0x2484fd[_0xe12a5f(0x222)]==='json'||_0x2484fd[_0xe12a5f(0x222)]===_0xe12a5f(0x1f1))&&await handleSDKOutput([_0x1da2f9],_0x2484fd),0x0;}catch(_0x18709e){return handleSDKError(_0x18709e,_0x2484fd),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x1826bf,_0x46b34a){const _0x35d73c=a26_0x9b0f89,_0x54f37b=_0x46b34a[_0x35d73c(0x257)]||CHAT_SELECTOR_PAGE_SIZE;let _0x41a715=0x0,_0x2711c3=[];const _0x1e6404=(await import(_0x35d73c(0x1eb)))[_0x35d73c(0x21f)],_0x4218f3=getChalk(_0x46b34a);while(!![]){const _0x39195e=await withSpinner(_0x35d73c(0x268),()=>_0x1826bf[_0x35d73c(0x19f)][_0x35d73c(0x1fe)](_0x54f37b+_0x41a715),{'verbose':_0x46b34a[_0x35d73c(0x221)]});_0x2711c3=_0x39195e[_0x35d73c(0x1d1)];const _0x2ad916=_0x2711c3[_0x35d73c(0x255)](_0x41a715,_0x41a715+_0x54f37b),_0x3f83ea=_0x2711c3[_0x35d73c(0x204)]>_0x41a715+_0x54f37b,_0x33fd53=[...new Set(_0x2ad916[_0x35d73c(0x1d3)](_0x5ee36c=>_0x5ee36c[_0x35d73c(0x260)][_0x35d73c(0x1d5)])[_0x35d73c(0x203)](_0x151b58=>_0x151b58!==undefined))],_0x8c3e82=new Map();await Promise[_0x35d73c(0x1ba)](_0x33fd53[_0x35d73c(0x1d3)](async _0x3e6d28=>{const _0x917151=_0x35d73c;try{const _0x47f99f=await _0x1826bf['llm']['agent'](_0x3e6d28);_0x8c3e82[_0x917151(0x1d4)](_0x3e6d28,_0x47f99f[_0x917151(0x260)][_0x917151(0x207)]);}catch{_0x8c3e82['set'](_0x3e6d28,_0x3e6d28);}}));const _0x1f9183=_0x2ad916[_0x35d73c(0x1d3)](_0x3a0a8a=>{const _0x3a6d5a=_0x35d73c,_0x4518fa=_0x3a0a8a[_0x3a6d5a(0x260)]['firstInputContent']||_0x3a6d5a(0x1ac),_0x373476=_0x4518fa['split']('\x0a')[0x0],_0x4fbe52=_0x373476[_0x3a6d5a(0x204)]>0x50?_0x373476[_0x3a6d5a(0x212)](0x0,0x4d)+_0x3a6d5a(0x1ca):_0x373476,_0x1b4472=_0x3a0a8a['attributes'][_0x3a6d5a(0x1d5)]?_0x8c3e82[_0x3a6d5a(0x1bf)](_0x3a0a8a[_0x3a6d5a(0x260)]['agentId'])||_0x3a0a8a[_0x3a6d5a(0x260)][_0x3a6d5a(0x1d5)]:_0x3a6d5a(0x21c),_0x2cd2dc=_0x3a0a8a['attributes'][_0x3a6d5a(0x1bd)]||_0x3a0a8a[_0x3a6d5a(0x260)][_0x3a6d5a(0x244)],_0x21e7ac=new Date(_0x2cd2dc),_0x5ca2a4=new Date(),_0x2ba23d=_0x5ca2a4[_0x3a6d5a(0x23b)]()-_0x21e7ac['getTime'](),_0x56d73a=Math[_0x3a6d5a(0x26d)](_0x2ba23d/0xea60),_0x436263=Math['floor'](_0x2ba23d/0x36ee80),_0x1071b9=Math[_0x3a6d5a(0x26d)](_0x2ba23d/0x5265c00);let _0x16aa7c;if(_0x56d73a<0x1)_0x16aa7c=_0x3a6d5a(0x1f5);else{if(_0x56d73a<0x3c)_0x16aa7c=_0x56d73a+'m\x20ago';else{if(_0x436263<0x18)_0x16aa7c=_0x436263+_0x3a6d5a(0x1ed);else _0x1071b9<0x7?_0x16aa7c=_0x1071b9+_0x3a6d5a(0x245):_0x16aa7c=_0x21e7ac[_0x3a6d5a(0x23e)]('en-US',{'month':'short','day':_0x3a6d5a(0x227)});}}return{'title':_0x4fbe52+'\x20'+_0x4218f3[_0x3a6d5a(0x21d)]('['+_0x1b4472+']\x20'+_0x16aa7c),'value':_0x3a0a8a['id']};});_0x3f83ea&&_0x1f9183[_0x35d73c(0x21b)]({'title':_0x4218f3[_0x35d73c(0x216)](_0x35d73c(0x1a5)),'value':_0x35d73c(0x240)});const _0x2776af=await _0x1e6404({'type':_0x35d73c(0x225),'name':'chatId','message':'Select\x20a\x20chat\x20session:','choices':_0x1f9183,'hint':_0x35d73c(0x1fa)});if(!_0x2776af[_0x35d73c(0x20c)])return undefined;if(_0x2776af[_0x35d73c(0x20c)]===_0x35d73c(0x240)){_0x41a715+=_0x54f37b;continue;}return _0x2776af[_0x35d73c(0x20c)];}}export class ChatsCommand extends BaseCommand{[a26_0x9b0f89(0x207)]=a26_0x9b0f89(0x1fe);['description']=a26_0x9b0f89(0x243);async[a26_0x9b0f89(0x20d)](_0x1e00ba){const _0x2d5920=a26_0x9b0f89;return executeChatHistoryCommand(_0x1e00ba,_0x2d5920(0x206));}}
1
+ const a26_0x5cc08c=a26_0x5881;(function(_0x49a606,_0x5167b9){const _0x1f8011=a26_0x5881,_0x221786=_0x49a606();while(!![]){try{const _0x37dab7=-parseInt(_0x1f8011(0x169))/0x1*(-parseInt(_0x1f8011(0x167))/0x2)+-parseInt(_0x1f8011(0x134))/0x3+-parseInt(_0x1f8011(0xde))/0x4+-parseInt(_0x1f8011(0xfe))/0x5+parseInt(_0x1f8011(0x143))/0x6*(-parseInt(_0x1f8011(0x141))/0x7)+-parseInt(_0x1f8011(0x15b))/0x8+parseInt(_0x1f8011(0x184))/0x9*(parseInt(_0x1f8011(0x106))/0xa);if(_0x37dab7===_0x5167b9)break;else _0x221786['push'](_0x221786['shift']());}catch(_0x3340ad){_0x221786['push'](_0x221786['shift']());}}}(a26_0x43f9,0xa328f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a26_0x35856c from'node:fs';function handleSDKError(_0x2dadef,_0x269e53){const _0x2b69e9=a26_0x5881;if(_0x2dadef instanceof SDKError)console[_0x2b69e9(0x16c)]('Error:\x20'+_0x2dadef['message']),_0x269e53[_0x2b69e9(0x10d)]&&(_0x2dadef[_0x2b69e9(0x135)]&&console[_0x2b69e9(0x16c)](_0x2b69e9(0x191)+_0x2dadef[_0x2b69e9(0x135)]),_0x2dadef[_0x2b69e9(0xee)]&&(console['error'](_0x2b69e9(0x181)),console[_0x2b69e9(0x16c)](_0x2dadef[_0x2b69e9(0xee)])));else throw _0x2dadef;}function formatChatHistoryEntry(_0x232f83,_0x4f2ea5){const _0x312611=a26_0x5881,_0x1968ba=getChalk(_0x4f2ea5),_0x55f3b4=_0x1968ba[_0x312611(0x115)](_0x232f83['at']);if(_0x312611(0xd8)in _0x232f83){const _0xee436b=_0x1968ba[_0x312611(0x154)]('[input]\x20\x20');return _0x55f3b4+'\x20'+_0xee436b+':\x20'+_0x232f83['input'];}if(_0x312611(0x121)in _0x232f83){const _0x237609=_0x1968ba['green'](_0x312611(0x130));return _0x55f3b4+'\x20'+_0x237609+':\x20'+_0x232f83[_0x312611(0x121)];}if(_0x312611(0x12e)in _0x232f83){const _0xbd9cfd=_0x1968ba[_0x312611(0xe2)](_0x312611(0x17f)),{functionName:_0x20953f,functionArguments:_0x27ae28,targetFunction:_0x5169fc}=_0x232f83[_0x312611(0x12e)];let _0x394494=_0x55f3b4+'\x20'+_0xbd9cfd+':\x20'+_0x1968ba['bold'](_0x20953f);if(_0x27ae28&&Object['keys'](_0x27ae28)[_0x312611(0xe3)]>0x0){const _0x89ee88=Object['entries'](_0x27ae28)['map'](([_0x345cfa,_0x8408d4])=>_0x345cfa+'='+JSON[_0x312611(0x133)](_0x8408d4))[_0x312611(0x153)](',\x20');_0x394494+='('+_0x89ee88+')';}_0x5169fc&&(_0x394494+=_0x1968ba['dim']('\x20['+_0x5169fc+']'));let _0x2f267e='';if(_0x232f83['tool_call'][_0x312611(0x187)])_0x2f267e='\x20->\x20KB:'+_0x232f83[_0x312611(0x12e)]['targetKnowledgeBase'][_0x312611(0x155)];else{if(_0x232f83[_0x312611(0x12e)]['targetAgent'])_0x2f267e=_0x312611(0x16f)+_0x232f83[_0x312611(0x12e)][_0x312611(0x114)][_0x312611(0x155)];else{if(_0x232f83[_0x312611(0x12e)][_0x312611(0x16b)])_0x2f267e=_0x312611(0x14f)+_0x232f83[_0x312611(0x12e)][_0x312611(0x16b)]['name'];else _0x232f83['tool_call']['targetImageGenerator']&&(_0x2f267e='\x20->\x20ImageGen:'+_0x232f83[_0x312611(0x12e)][_0x312611(0x15c)][_0x312611(0x155)]);}}return _0x394494+_0x2f267e;}if(_0x312611(0x12c)in _0x232f83){const _0x130b82=_0x1968ba[_0x312611(0x111)](_0x312611(0x145)),{functionName:_0x29f359,functionArguments:_0x186af6,content:_0x58e127,newChat:_0x51cf00}=_0x232f83[_0x312611(0x12c)];let _0x1155e7=_0x55f3b4+'\x20'+_0x130b82+':\x20'+_0x1968ba[_0x312611(0x10a)](_0x29f359);if(_0x186af6){const _0x7b4c60=typeof _0x186af6==='string'?_0x186af6:JSON[_0x312611(0x133)](_0x186af6);_0x1155e7+='('+_0x7b4c60+')';}return _0x58e127&&(_0x1155e7+='\x0a'+_0x1968ba[_0x312611(0x115)](_0x58e127)),_0x51cf00&&(_0x1155e7+=_0x1968ba[_0x312611(0x115)]('\x20→\x20chat:\x20'+_0x51cf00['id'])),_0x1155e7;}if(_0x312611(0x13d)in _0x232f83){const _0x49cea2=_0x1968ba['blue'](_0x312611(0x18f));return _0x55f3b4+'\x20'+_0x49cea2+':\x20'+_0x232f83[_0x312611(0x13d)][_0x312611(0x155)]+'\x20('+_0x232f83['output']['content']['length']+_0x312611(0x11b);}if(_0x312611(0x12f)in _0x232f83){const _0x8d892c=_0x1968ba[_0x312611(0x109)](_0x312611(0x131)),{width:_0x4b549b,height:_0x182370,headerText:_0x6437e6}=_0x232f83[_0x312611(0x12f)],_0x591188=_0x6437e6?_0x312611(0xe6)+_0x6437e6:'';return _0x55f3b4+'\x20'+_0x8d892c+':\x20'+_0x4b549b+'x'+_0x182370+_0x591188;}if(_0x312611(0x16c)in _0x232f83){const _0x4d1897=_0x1968ba[_0x312611(0x124)]('[error]\x20\x20');return _0x55f3b4+'\x20'+_0x4d1897+':\x20'+_0x232f83[_0x312611(0x16c)];}return _0x55f3b4+'\x20'+_0x1968ba['dim'](_0x312611(0xff))+':\x20'+JSON['stringify'](_0x232f83);}async function executeChatHistoryCommand(_0x479315,_0x1daaf4){const _0x2b6580=a26_0x5881,{options:_0x512d57,args:_0x17aafb,tdx:_0xb36746}=_0x479315,_0x38d95b=_0x17aafb[0x0],_0x3c5916=_0x512d57,_0x174193=_0x3c5916[_0x2b6580(0x128)];try{if(_0x174193&&_0x38d95b)return console[_0x2b6580(0x16c)](_0x2b6580(0x189)),console[_0x2b6580(0x16c)](_0x2b6580(0x172)+_0x1daaf4+_0x2b6580(0x164)),0x1;if(!_0x38d95b&&!_0x174193&&_0x512d57['format']!==undefined){const _0x14b232=resolveLimit(_0x512d57[_0x2b6580(0x159)],DEFAULT_LLM_LIMIT),_0x43d1c5=await withSpinner(_0x2b6580(0x199),()=>_0xb36746[_0x2b6580(0x186)][_0x2b6580(0xf7)](_0x14b232),{'verbose':_0x512d57[_0x2b6580(0x10d)]});return await handleSDKOutput(_0x43d1c5[_0x2b6580(0x17b)],_0x512d57),0x0;}const _0x9db2b5=await getChatIdOrSelect(_0xb36746,_0x512d57,_0x174193,_0x38d95b);if(!_0x9db2b5)return 0x0;return await displayChatHistory(_0x9db2b5,_0xb36746,_0x512d57),0x0;}catch(_0x21474a){return handleSDKError(_0x21474a,_0x512d57),0x1;}}async function displayChatHistory(_0x43a523,_0x5b0a37,_0x407acd){const _0x5baa35=a26_0x5881,_0x2d0b76=await withSpinner(_0x5baa35(0x138)+_0x43a523+_0x5baa35(0xe9),()=>_0x5b0a37['llm'][_0x5baa35(0x168)](_0x43a523),{'verbose':_0x407acd['verbose']}),_0x36d24f=_0x2d0b76['data'][_0x5baa35(0x17b)]??[];if(_0x36d24f[_0x5baa35(0xe3)]===0x0){console[_0x5baa35(0x196)](_0x5baa35(0x190));return;}if(_0x407acd['format']!==undefined)await handleSDKOutput(_0x36d24f,_0x407acd);else{const _0x2cb583=_0x36d24f[_0x5baa35(0x16a)](_0x259331=>formatChatHistoryEntry(_0x259331,_0x407acd)),_0x425acc=_0x2cb583[_0x5baa35(0x153)]('\x0a');await writeOutput(_0x425acc,_0x407acd[_0x5baa35(0x13d)],_0x5baa35(0x13a));}}async function getChatIdOrSelect(_0x48a2be,_0x2a728a,_0x396e73,_0x10b5d8){const _0x14dc12=a26_0x5881;if(_0x10b5d8)return _0x10b5d8;if(_0x396e73){const _0x5bd87e=await withSpinner(_0x14dc12(0x10f),()=>_0x48a2be[_0x14dc12(0x186)][_0x14dc12(0xf7)](0x1),{'verbose':_0x2a728a['verbose']});if(_0x5bd87e['data'][_0x14dc12(0xe3)]===0x0)return console[_0x14dc12(0x196)](_0x14dc12(0xd6)),undefined;return _0x5bd87e[_0x14dc12(0x17b)][0x0]['id'];}const _0x46f81e=await selectChatInteractively(_0x48a2be,_0x2a728a);if(!_0x46f81e)return console[_0x14dc12(0x196)](_0x14dc12(0x12a)),undefined;return _0x46f81e;}async function getProjectIdOrDefault(_0x177226){const _0x14ab6d=a26_0x5881,{tdx:_0xd135c2,options:_0x1a3775}=_0x177226,_0x471404=_0x1a3775[_0x14ab6d(0xe4)];if(_0x471404){const _0x3b0eb2=await withSpinner(_0x14ab6d(0x101)+_0x471404+_0x14ab6d(0xe9),()=>_0xd135c2[_0x14ab6d(0x186)][_0x14ab6d(0x163)](_0x471404),{'verbose':_0x1a3775['verbose']});return _0x3b0eb2['data'];}let _0x20a46c=_0xd135c2['llm'][_0x14ab6d(0x198)]();if(_0x20a46c)return _0x20a46c;const _0x1448ae=await withSpinner('Getting\x20default\x20project...',()=>_0xd135c2[_0x14ab6d(0x186)]['getOrCreateDefaultProject'](),{'verbose':_0x1a3775[_0x14ab6d(0x10d)]});return _0x1448ae[_0x14ab6d(0x17b)]['id'];}function toLLMProjectInfo(_0x282e97){const _0x4558fe=a26_0x5881;return{'name':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x155)],'description':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x146)],'createdAt':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x176)],'updatedAt':_0x282e97[_0x4558fe(0xda)][_0x4558fe(0x19a)]};}function a26_0x43f9(){const _0x39cacf=['last','outputDir','\x0aCancelled','Fetching\x20agent...','tool','format','tool_call','image','[content]','[image]\x20\x20','.llm','stringify','1414248dmjczT','cause','\x20\x20Agents:\x20','Deleting\x20project\x20\x27','Fetching\x20chat\x20history\x20for\x20\x27','Delete\x20an\x20agent','table','yes','Error:\x20Agent\x20name\x20is\x20required','output','llm:project:backup','h\x20ago','find','14JtkeIg','agent','1903194AjEWsV','model','[tool]\x20\x20\x20','description','claude-4.5-haiku','A\x20project\x20named\x20\x27','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','llm:project:restore','d\x20ago','Use\x20format:\x20project-name/agent-name','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','getTime','\x20->\x20WebSearch:','getBackupMetadata','Output\x20directory\x20\x27','updateAgent','join','cyan','name','llm:history','Analyzing\x20project\x20\x27','execute','limit','Project\x20restored:\x20','1284144yMxvxq','targetImageGenerator','jsonl','floor','\x20\x20Knowledge\x20Bases:\x20','Creating\x20project\x20\x27','agentId','chatId','resolveProjectId','\x20--last','Project\x20backed\x20up\x20to:\x20','Validating\x20backup\x20from\x20\x27','148zodbkN','history','12622XMpLfs','map','targetWebSearchTool','error','llm:agent:create','includes','\x20->\x20Agent:','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','Usage:\x20','(no\x20message)','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','Error:\x20Project\x20name\x20is\x20required','createdAt','Agent\x20created:\x20','Project\x20created:\x20','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','push','data','Project\x20context\x20set\x20to:\x20','resolveAgentId','select','[tool_call]','Set\x20current\x20project\x20context','\x0aStack\x20trace:','Fetching\x20projects...','\x27\x20already\x20exists.\x20Overwrite?','9PVWXos','just\x20now','llm','targetKnowledgeBase','agents','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','all','projects','set','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','createAgent','[output]\x20','No\x20messages\x20found\x20in\x20chat\x20history.','\x20\x20Cause:\x20','Fetching\x20agents...','Agent\x20updated:\x20','llm:project:delete','Resolving\x20agent\x20\x27','log','llm:agent:update','getCurrentProject','Fetching\x20chat\x20sessions...','updatedAt','Setting\x20project\x20context\x20to\x20\x27','llm:agent:show','No\x20chat\x20sessions\x20found.','Backup\x20cancelled.','input','knowledgeBases','attributes','\x20\x20Prompts:\x20','Backing\x20up\x20project\x20\x27','default','5146064gPQqIK','exportedFrom','Load\x20more...','temperature','yellow','length','llmProject','INVALID_ARGUMENT','\x20-\x20','integrations','systemPrompt','\x27...','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','Invalid\x20path\x20syntax:\x20','Update\x20an\x20existing\x20agent','get','stack','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','llm:agents','llm:models','dryRun','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Usage:\x20tdx\x20llm\x20use\x20<project-name>','deleteProject','llm:agent:delete','chats','numeric','projectId','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','Checking\x20for\x20existing\x20projects...','prompts','maxToolIterations','153530sCtITB','[unknown]','llm:use','Resolving\x20project\x20\x27','projectName','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','__load_more__','deleteAgent','23178290pTPtBh','List\x20agents\x20in\x20current\x20project','filter','blue','bold','starterMessage','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','verbose','toLowerCase','Fetching\x20most\x20recent\x20chat...','List\x20available\x20LLM\x20models','magenta','\x20\x20Integrations:\x20','llm:projects','targetAgent','dim','sourceSite','json','setCurrentProject','createProject','existsSync','\x20bytes)','rmSync','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','toLocaleDateString','m\x20ago','split','content','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','Agent\x20deleted:\x20','red','counts','(no\x20agent)','slice'];a26_0x43f9=function(){return _0x39cacf;};return a26_0x43f9();}function toAgentInfo(_0x750b3c){const _0x3792a9=a26_0x5881;return{'name':_0x750b3c[_0x3792a9(0xda)][_0x3792a9(0x155)],'description':_0x750b3c[_0x3792a9(0xda)]['description'],'prompt':truncatePrompt(_0x750b3c['attributes']['prompt']),'createdAt':_0x750b3c['attributes'][_0x3792a9(0x176)],'updatedAt':_0x750b3c[_0x3792a9(0xda)]['updatedAt']};}function truncatePrompt(_0x512c40){const _0x28d36e=a26_0x5881;if(!_0x512c40)return undefined;const _0x1922e8=0x64;if(_0x512c40[_0x28d36e(0xe3)]<=_0x1922e8)return _0x512c40;return _0x512c40[_0x28d36e(0x127)](0x0,_0x1922e8)+'...';}export class LLMModelsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xf1);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x110);async[a26_0x5cc08c(0x158)](_0x194ee9){const _0x3e1f22=a26_0x5cc08c,{options:_0x2c94da,tdx:_0x53c9d2}=_0x194ee9;try{const _0x8fb14d=await withSpinner('Fetching\x20available\x20models...',()=>_0x53c9d2[_0x3e1f22(0x186)]['models'](),{'verbose':_0x2c94da[_0x3e1f22(0x10d)]});return await handleSDKOutput(_0x8fb14d[_0x3e1f22(0x17b)],_0x2c94da),0x0;}catch(_0x3f26ea){return handleSDKError(_0x3f26ea,_0x2c94da),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x113);['description']='List\x20all\x20LLM\x20projects';async[a26_0x5cc08c(0x158)](_0x20e617){const _0x2eac68=a26_0x5cc08c,{options:_0x337934,args:_0x561f54,tdx:_0x33522e}=_0x20e617;try{const _0x341fd4=_0x561f54[0x0],_0x173f91=resolveLimit(_0x337934[_0x2eac68(0x159)],DEFAULT_LLM_LIMIT),_0x148fa6=await withSpinner(_0x2eac68(0x182),()=>_0x33522e[_0x2eac68(0x186)][_0x2eac68(0x18b)](_0x173f91),{'verbose':_0x337934[_0x2eac68(0x10d)]});let _0x545872=_0x148fa6[_0x2eac68(0x17b)];_0x341fd4&&(_0x545872=_0x148fa6[_0x2eac68(0x17b)][_0x2eac68(0x108)](_0x973e2a=>matchGlobPattern(_0x973e2a[_0x2eac68(0xda)][_0x2eac68(0x155)],_0x341fd4)));const _0x42603d=_0x545872[_0x2eac68(0x16a)](toLLMProjectInfo);return await handleSDKOutput(_0x42603d,_0x337934),0x0;}catch(_0x4c2dd5){return handleSDKError(_0x4c2dd5,_0x337934),0x1;}}}function a26_0x5881(_0x2e8201,_0x34545d){_0x2e8201=_0x2e8201-0xd5;const _0x43f952=a26_0x43f9();let _0x5881f2=_0x43f952[_0x2e8201];return _0x5881f2;}export class LLMAgentsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xf0);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x107);async['execute'](_0x33884e){const _0x193c5a=a26_0x5cc08c,{options:_0x4a13ac,args:_0x1ebb44,tdx:_0x2f3140}=_0x33884e;try{const _0x3a9563=_0x1ebb44[0x0];let _0x19ff6d,_0x59222a=_0x3a9563;if(_0x3a9563&&_0x3a9563[_0x193c5a(0x16e)]('/')){const _0x14fea7=_0x3a9563[_0x193c5a(0x120)]('/');if(_0x14fea7['length']===0x2){const [_0xc7a9a0,_0x253999]=_0x14fea7,_0x1c7553=await _0x2f3140['llm'][_0x193c5a(0x18b)](),_0x3e0b63=_0x1c7553[_0x193c5a(0x140)](_0x2a8df5=>_0x2a8df5[_0x193c5a(0xda)][_0x193c5a(0x155)][_0x193c5a(0x10e)]()===_0xc7a9a0[_0x193c5a(0x10e)]());if(!_0x3e0b63)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0xc7a9a0,undefined,{'helpText':_0x193c5a(0xf3)});_0x19ff6d=_0x3e0b63['id'],_0x59222a=_0x253999;}else throw new SDKError(ErrorCode[_0x193c5a(0xe5)],'Invalid\x20path\x20syntax:\x20'+_0x3a9563,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x19ff6d=await getProjectIdOrDefault(_0x33884e);const _0x5e56b6=await withSpinner(_0x193c5a(0x192),()=>_0x2f3140['llm'][_0x193c5a(0x188)](_0x19ff6d),{'verbose':_0x4a13ac[_0x193c5a(0x10d)]});let _0x1eadf7=_0x5e56b6['data'];_0x59222a&&(_0x1eadf7=_0x5e56b6[_0x193c5a(0x17b)][_0x193c5a(0x108)](_0x5dff47=>matchGlobPattern(_0x5dff47[_0x193c5a(0xda)][_0x193c5a(0x155)],_0x59222a)));const _0x337d09=_0x1eadf7['map'](toAgentInfo);return await handleSDKOutput(_0x337d09,_0x4a13ac),0x0;}catch(_0x421e26){return handleSDKError(_0x421e26,_0x4a13ac),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xd5);[a26_0x5cc08c(0x146)]='Show\x20agent\x20details';async['execute'](_0x5a0550){const _0x45ee93=a26_0x5cc08c,{options:_0x2b5bc9,args:_0x5998c6,tdx:_0x5d99ed}=_0x5a0550;if(_0x5998c6[_0x45ee93(0xe3)]===0x0)return console[_0x45ee93(0x16c)](_0x45ee93(0x13c)),console['error'](_0x45ee93(0x11d)),0x1;const _0x163a4c=_0x5998c6[0x0];try{const _0x2522a9=await getProjectIdOrDefault(_0x5a0550),_0x123855=await withSpinner('Resolving\x20agent\x20\x27'+_0x163a4c+_0x45ee93(0xe9),()=>_0x5d99ed[_0x45ee93(0x186)][_0x45ee93(0x17d)](_0x163a4c,_0x2522a9),{'verbose':_0x2b5bc9['verbose']}),_0x1e6267=await withSpinner(_0x45ee93(0x12b),()=>_0x5d99ed[_0x45ee93(0x186)][_0x45ee93(0x142)](_0x123855[_0x45ee93(0x17b)]),{'verbose':_0x2b5bc9[_0x45ee93(0x10d)]});return await handleSDKOutput([_0x1e6267[_0x45ee93(0x17b)]],_0x2b5bc9),0x0;}catch(_0x16b805){return handleSDKError(_0x16b805,_0x2b5bc9),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x16d);[a26_0x5cc08c(0x146)]='Create\x20a\x20new\x20agent\x20in\x20current\x20project';async[a26_0x5cc08c(0x158)](_0x3ddb25){const _0x255338=a26_0x5cc08c,{options:_0x177db4,args:_0x3e3c08,tdx:_0x5b6a1b}=_0x3ddb25;if(_0x3e3c08[_0x255338(0xe3)]===0x0)return console[_0x255338(0x16c)](_0x255338(0x13c)),console[_0x255338(0x16c)](_0x255338(0xef)),console[_0x255338(0x16c)](_0x255338(0x14d)),0x1;const _0x18b97d=_0x3e3c08[0x0],_0x18b2b8=_0x177db4,_0x232357=_0x18b2b8[_0x255338(0xe8)],_0x2f592b=_0x18b2b8[_0x255338(0x144)]||_0x255338(0x147),_0x28f3c5=_0x18b2b8[_0x255338(0x10b)],_0x529c5d=_0x18b2b8[_0x255338(0xfd)]?Number(_0x18b2b8['maxToolIterations']):undefined,_0x64755d=_0x18b2b8[_0x255338(0xe1)]?Number(_0x18b2b8[_0x255338(0xe1)]):undefined;try{let _0x8b0123,_0xbde4e1;if(_0x18b97d['includes']('/')){const _0x22fa1a=_0x18b97d[_0x255338(0x120)]('/');if(_0x22fa1a[_0x255338(0xe3)]===0x2){const [_0x37d139,_0x5618e1]=_0x22fa1a,_0x3b8f7b=await withSpinner('Resolving\x20project\x20\x27'+_0x37d139+'\x27...',()=>_0x5b6a1b[_0x255338(0x186)][_0x255338(0x163)](_0x37d139),{'verbose':_0x177db4[_0x255338(0x10d)]});_0x8b0123=_0x3b8f7b[_0x255338(0x17b)],_0xbde4e1=_0x5618e1;}else throw new SDKError(ErrorCode[_0x255338(0xe5)],_0x255338(0xeb)+_0x18b97d,undefined,{'helpText':_0x255338(0x14c)});}else _0x8b0123=await getProjectIdOrDefault(_0x3ddb25),_0xbde4e1=_0x18b97d;const _0x5d0aa7=await withSpinner('Creating\x20agent\x20\x27'+_0xbde4e1+_0x255338(0xe9),()=>_0x5b6a1b[_0x255338(0x186)][_0x255338(0x18e)]({'name':_0xbde4e1,'projectId':_0x8b0123,'modelType':_0x2f592b,'systemPrompt':_0x232357,'starterMessage':_0x28f3c5,'maxToolIterations':_0x529c5d,'temperature':_0x64755d}),{'verbose':_0x177db4[_0x255338(0x10d)]});return console['log'](_0x255338(0x177)+_0x5d0aa7[_0x255338(0x17b)]['id']),await handleSDKOutput([_0x5d0aa7[_0x255338(0x17b)]],_0x177db4),0x0;}catch(_0x5c9029){return handleSDKError(_0x5c9029,_0x177db4),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x197);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0xec);async[a26_0x5cc08c(0x158)](_0x3b8ed2){const _0x590dd3=a26_0x5cc08c,{options:_0xa077ac,args:_0x4e5830,tdx:_0x29d124}=_0x3b8ed2;if(_0x4e5830[_0x590dd3(0xe3)]===0x0)return console[_0x590dd3(0x16c)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x590dd3(0x16c)](_0x590dd3(0x171)),0x1;const _0x2306bf=_0x4e5830[0x0],_0x1f0504=_0xa077ac,_0x46804b=_0x1f0504[_0x590dd3(0x155)],_0x2a02a=_0x1f0504['prompt'],_0x1f7373=_0x1f0504[_0x590dd3(0x146)],_0x54dc39=_0x1f0504[_0x590dd3(0x10b)];if(!_0x46804b&&!_0x2a02a&&!_0x1f7373&&!_0x54dc39)return console['error'](_0x590dd3(0x170)),console[_0x590dd3(0x16c)](_0x590dd3(0x122)),0x1;try{const _0x25e3cb=await getProjectIdOrDefault(_0x3b8ed2),_0x41ecd9=await withSpinner(_0x590dd3(0x195)+_0x2306bf+_0x590dd3(0xe9),()=>_0x29d124[_0x590dd3(0x186)]['resolveAgentId'](_0x2306bf,_0x25e3cb),{'verbose':_0xa077ac[_0x590dd3(0x10d)]}),_0x393b71=_0x41ecd9['data'],_0x4aa4ce=await withSpinner('Updating\x20agent...',()=>_0x29d124[_0x590dd3(0x186)][_0x590dd3(0x152)](_0x393b71,{'name':_0x46804b,'prompt':_0x2a02a,'description':_0x1f7373,'starterMessage':_0x54dc39}),{'verbose':_0xa077ac[_0x590dd3(0x10d)]});return console['log'](_0x590dd3(0x193)+_0x4aa4ce[_0x590dd3(0x17b)]['id']),await handleSDKOutput([_0x4aa4ce[_0x590dd3(0x17b)]],_0xa077ac),0x0;}catch(_0x30d2ac){return handleSDKError(_0x30d2ac,_0xa077ac),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']=a26_0x5cc08c(0xf6);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x139);async[a26_0x5cc08c(0x158)](_0x45e25f){const _0x484160=a26_0x5cc08c,{options:_0x22c4bd,args:_0x19dae0,tdx:_0x3dbf56}=_0x45e25f;if(_0x19dae0[_0x484160(0xe3)]===0x0)return console[_0x484160(0x16c)](_0x484160(0x13c)),console[_0x484160(0x16c)](_0x484160(0x174)),0x1;const _0x5d27a7=_0x19dae0[0x0];try{const _0x19cf28=await getProjectIdOrDefault(_0x45e25f),_0x338747=await withSpinner(_0x484160(0x195)+_0x5d27a7+'\x27...',()=>_0x3dbf56['llm'][_0x484160(0x17d)](_0x5d27a7,_0x19cf28),{'verbose':_0x22c4bd[_0x484160(0x10d)]}),_0x47ccd7=_0x338747[_0x484160(0x17b)];return await withSpinner('Deleting\x20agent...',()=>_0x3dbf56[_0x484160(0x186)][_0x484160(0x105)](_0x47ccd7),{'verbose':_0x22c4bd[_0x484160(0x10d)]}),console[_0x484160(0x196)](_0x484160(0x123)+_0x47ccd7),0x0;}catch(_0x1ef89e){return handleSDKError(_0x1ef89e,_0x22c4bd),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a26_0x5cc08c(0x156);['description']=a26_0x5cc08c(0xfa);async['execute'](_0x4ed13a){return executeChatHistoryCommand(_0x4ed13a,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x100);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x180);async['execute'](_0x4bbe37){const _0x1a43d9=a26_0x5cc08c,{options:_0x5c0367,args:_0x2ccc92,tdx:_0x4f38be}=_0x4bbe37;if(_0x2ccc92[_0x1a43d9(0xe3)]===0x0)return console[_0x1a43d9(0x16c)](_0x1a43d9(0x175)),console[_0x1a43d9(0x16c)](_0x1a43d9(0xf4)),0x1;const _0x39578c=_0x2ccc92[0x0];try{return await withSpinner(_0x1a43d9(0x19b)+_0x39578c+_0x1a43d9(0xe9),()=>_0x4f38be[_0x1a43d9(0x186)][_0x1a43d9(0x118)](_0x39578c),{'verbose':_0x5c0367[_0x1a43d9(0x10d)]}),console['log'](_0x1a43d9(0x17c)+_0x39578c),0x0;}catch(_0x36aaac){return handleSDKError(_0x36aaac,_0x5c0367),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a26_0x5cc08c(0x155)]='llm:project:create';['description']='Create\x20a\x20new\x20LLM\x20project';async['execute'](_0x155a6d){const _0x14c14e=a26_0x5cc08c,{options:_0x48e5e6,args:_0x4a3b0d,tdx:_0x308e64}=_0x155a6d;if(_0x4a3b0d['length']===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x14c14e(0x16c)]('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0x4b5105=_0x4a3b0d[0x0],_0x3c00ce=_0x48e5e6,_0x4c2ecf=_0x3c00ce[_0x14c14e(0x146)];try{const _0x2d8b3d=await withSpinner(_0x14c14e(0x160)+_0x4b5105+_0x14c14e(0xe9),()=>_0x308e64[_0x14c14e(0x186)][_0x14c14e(0x119)]({'name':_0x4b5105,'description':_0x4c2ecf}),{'verbose':_0x48e5e6[_0x14c14e(0x10d)]});console['log'](_0x14c14e(0x178)+_0x2d8b3d[_0x14c14e(0x17b)]['id']);const _0x1b64c5=toLLMProjectInfo(_0x2d8b3d['data']);return await handleSDKOutput([_0x1b64c5],_0x48e5e6),0x0;}catch(_0x1189c0){return handleSDKError(_0x1189c0,_0x48e5e6),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x194);['description']='Delete\x20an\x20LLM\x20project';async[a26_0x5cc08c(0x158)](_0x462a79){const _0xa7b0ae=a26_0x5cc08c,{options:_0x1da628,args:_0x3b6000,tdx:_0x20c4c5}=_0x462a79;if(_0x3b6000[_0xa7b0ae(0xe3)]===0x0)return console['error'](_0xa7b0ae(0x175)),console['error']('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x25bb5f=_0x3b6000[0x0];try{return await withSpinner(_0xa7b0ae(0x137)+_0x25bb5f+_0xa7b0ae(0xe9),()=>_0x20c4c5[_0xa7b0ae(0x186)][_0xa7b0ae(0xf5)](_0x25bb5f),{'verbose':_0x1da628[_0xa7b0ae(0x10d)]}),console[_0xa7b0ae(0x196)]('Project\x20deleted:\x20'+_0x25bb5f),0x0;}catch(_0x54dfc4){return handleSDKError(_0x54dfc4,_0x1da628),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a26_0x5cc08c(0x13e);[a26_0x5cc08c(0x146)]=a26_0x5cc08c(0x149);async[a26_0x5cc08c(0x158)](_0x5b3ee7){const _0x3f13ac=a26_0x5cc08c,{options:_0xc6367b,args:_0x3a8596,tdx:_0x582bd5}=_0x5b3ee7;if(_0x3a8596[_0x3f13ac(0xe3)]===0x0)return console['error'](_0x3f13ac(0x175)),console[_0x3f13ac(0x16c)](_0x3f13ac(0x103)),0x1;const _0x7b796e=_0x3a8596[0x0],_0x31aa7e=_0xc6367b,_0x4f6442=_0x31aa7e['output'],_0x2419d0=_0x31aa7e['dryRun'];try{const _0x1072ae=_0x4f6442||_0x7b796e+_0x3f13ac(0x132);if(a26_0x35856c[_0x3f13ac(0x11a)](_0x1072ae)&&!_0x2419d0){if(!_0xc6367b[_0x3f13ac(0x13b)]){const _0x2f63b1=await confirm(_0x3f13ac(0x151)+_0x1072ae+_0x3f13ac(0x183));if(!_0x2f63b1)return console['log'](_0x3f13ac(0xd7)),0x0;}a26_0x35856c[_0x3f13ac(0x11c)](_0x1072ae,{'recursive':!![]});}const _0x13344c=await withSpinner(_0x2419d0?_0x3f13ac(0x157)+_0x7b796e+_0x3f13ac(0xe9):_0x3f13ac(0xdc)+_0x7b796e+_0x3f13ac(0xe9),()=>_0x582bd5[_0x3f13ac(0x186)]['backupProject'](_0x7b796e,_0x4f6442,{'dryRun':_0x2419d0}),{'verbose':_0xc6367b['verbose']}),_0x2b4d78=_0x13344c[_0x3f13ac(0x17b)];return _0x2419d0?console[_0x3f13ac(0x196)](_0x3f13ac(0x179)+_0x2b4d78['outputDir']):console[_0x3f13ac(0x196)](_0x3f13ac(0x165)+_0x2b4d78[_0x3f13ac(0x129)]),console[_0x3f13ac(0x196)](_0x3f13ac(0x136)+_0x2b4d78[_0x3f13ac(0x125)]['agents']),console[_0x3f13ac(0x196)](_0x3f13ac(0x15f)+_0x2b4d78[_0x3f13ac(0x125)][_0x3f13ac(0xd9)]),console['log'](_0x3f13ac(0xdb)+_0x2b4d78[_0x3f13ac(0x125)][_0x3f13ac(0xfc)]),console['log']('\x20\x20Integrations:\x20'+_0x2b4d78['counts'][_0x3f13ac(0xe7)]),(_0xc6367b['format']===_0x3f13ac(0x117)||_0xc6367b[_0x3f13ac(0x12d)]===_0x3f13ac(0x15d))&&await handleSDKOutput([_0x2b4d78],_0xc6367b),0x0;}catch(_0xc6bf94){return handleSDKError(_0xc6bf94,_0xc6367b),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0x14a);[a26_0x5cc08c(0x146)]='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder';async[a26_0x5cc08c(0x158)](_0x6e5b46){const _0x49e3cf=a26_0x5cc08c,{options:_0x46ba90,args:_0x3c6c7c,tdx:_0x5aaa19}=_0x6e5b46;if(_0x3c6c7c['length']===0x0)return console[_0x49e3cf(0x16c)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x49e3cf(0x16c)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x2ab7a8=_0x3c6c7c[0x0],_0x8f2ace=_0x46ba90,_0x294845=_0x8f2ace[_0x49e3cf(0x155)],_0x312fbf=_0x8f2ace[_0x49e3cf(0xf2)];try{if(!_0x312fbf){const _0x4fe728=_0x5aaa19['llm'][_0x49e3cf(0x150)](_0x2ab7a8),_0x1a38e7=_0x294845||_0x4fe728[_0x49e3cf(0xdf)][_0x49e3cf(0x102)],_0x41698a=await withSpinner(_0x49e3cf(0xfb),()=>_0x5aaa19['llm']['projects'](),{'verbose':_0x46ba90[_0x49e3cf(0x10d)]}),_0x142b4f=_0x41698a[_0x49e3cf(0x17b)]['find'](_0x5f2ccd=>_0x5f2ccd[_0x49e3cf(0xda)][_0x49e3cf(0x155)]===_0x1a38e7);if(_0x142b4f&&!_0x46ba90[_0x49e3cf(0x13b)]){const _0x284f44=await confirm(_0x49e3cf(0x148)+_0x1a38e7+_0x49e3cf(0x10c));if(!_0x284f44)return console['log']('Restore\x20cancelled.'),0x0;}}const _0x11fb4d=await withSpinner(_0x312fbf?_0x49e3cf(0x166)+_0x2ab7a8+_0x49e3cf(0xe9):'Restoring\x20project\x20from\x20\x27'+_0x2ab7a8+_0x49e3cf(0xe9),()=>_0x5aaa19[_0x49e3cf(0x186)]['restoreProject'](_0x2ab7a8,{'name':_0x294845,'dryRun':_0x312fbf}),{'verbose':_0x46ba90[_0x49e3cf(0x10d)]}),_0x56ff68=_0x11fb4d['data'];return _0x56ff68['sourceSite']&&console[_0x49e3cf(0x196)](_0x49e3cf(0x18d)+_0x56ff68[_0x49e3cf(0x116)]+'\x27'),_0x312fbf?console[_0x49e3cf(0x196)]('[DRY\x20RUN]\x20Would\x20restore\x20project:\x20'+_0x56ff68[_0x49e3cf(0x102)]):console[_0x49e3cf(0x196)](_0x49e3cf(0x15a)+_0x56ff68[_0x49e3cf(0x102)]+'\x20('+_0x56ff68[_0x49e3cf(0xf9)]+')'),console[_0x49e3cf(0x196)](_0x49e3cf(0x136)+_0x56ff68['counts'][_0x49e3cf(0x188)]),console[_0x49e3cf(0x196)](_0x49e3cf(0x15f)+_0x56ff68[_0x49e3cf(0x125)][_0x49e3cf(0xd9)]),console[_0x49e3cf(0x196)]('\x20\x20Prompts:\x20'+_0x56ff68[_0x49e3cf(0x125)][_0x49e3cf(0xfc)]),console[_0x49e3cf(0x196)](_0x49e3cf(0x112)+_0x56ff68[_0x49e3cf(0x125)]['integrations']),(_0x46ba90[_0x49e3cf(0x12d)]===_0x49e3cf(0x117)||_0x46ba90[_0x49e3cf(0x12d)]===_0x49e3cf(0x15d))&&await handleSDKOutput([_0x56ff68],_0x46ba90),0x0;}catch(_0x534874){return handleSDKError(_0x534874,_0x46ba90),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x237c87,_0x3c220f){const _0x3f5e7b=a26_0x5cc08c,_0x2a56f5=_0x3c220f[_0x3f5e7b(0x159)]||CHAT_SELECTOR_PAGE_SIZE;let _0x399f1a=0x0,_0x558ac6=[];const _0x2a761c=(await import('prompts'))[_0x3f5e7b(0xdd)],_0x536c98=getChalk(_0x3c220f);while(!![]){const _0x2880f8=await withSpinner(_0x3f5e7b(0x199),()=>_0x237c87[_0x3f5e7b(0x186)][_0x3f5e7b(0xf7)](_0x2a56f5+_0x399f1a),{'verbose':_0x3c220f[_0x3f5e7b(0x10d)]});_0x558ac6=_0x2880f8['data'];const _0x38c00e=_0x558ac6[_0x3f5e7b(0x127)](_0x399f1a,_0x399f1a+_0x2a56f5),_0x559163=_0x558ac6[_0x3f5e7b(0xe3)]>_0x399f1a+_0x2a56f5,_0x355dbd=[...new Set(_0x38c00e[_0x3f5e7b(0x16a)](_0x19525b=>_0x19525b[_0x3f5e7b(0xda)][_0x3f5e7b(0x161)])[_0x3f5e7b(0x108)](_0x4fb62e=>_0x4fb62e!==undefined))],_0x38b285=new Map();await Promise[_0x3f5e7b(0x18a)](_0x355dbd[_0x3f5e7b(0x16a)](async _0x2570e4=>{const _0x210c9c=_0x3f5e7b;try{const _0x39ecc0=await _0x237c87[_0x210c9c(0x186)][_0x210c9c(0x142)](_0x2570e4);_0x38b285[_0x210c9c(0x18c)](_0x2570e4,_0x39ecc0[_0x210c9c(0xda)][_0x210c9c(0x155)]);}catch{_0x38b285['set'](_0x2570e4,_0x2570e4);}}));const _0x57866f=_0x38c00e[_0x3f5e7b(0x16a)](_0x55f8af=>{const _0x306261=_0x3f5e7b,_0x50e577=_0x55f8af[_0x306261(0xda)]['firstInputContent']||_0x306261(0x173),_0x2aaf0f=_0x50e577[_0x306261(0x120)]('\x0a')[0x0],_0x223587=_0x2aaf0f[_0x306261(0xe3)]>0x50?_0x2aaf0f['substring'](0x0,0x4d)+'...':_0x2aaf0f,_0x49c87d=_0x55f8af['attributes'][_0x306261(0x161)]?_0x38b285[_0x306261(0xed)](_0x55f8af[_0x306261(0xda)][_0x306261(0x161)])||_0x55f8af['attributes'][_0x306261(0x161)]:_0x306261(0x126),_0x17eace=_0x55f8af[_0x306261(0xda)]['lastConversationAt']||_0x55f8af[_0x306261(0xda)][_0x306261(0x19a)],_0x1628d5=new Date(_0x17eace),_0x473e56=new Date(),_0x36295a=_0x473e56[_0x306261(0x14e)]()-_0x1628d5[_0x306261(0x14e)](),_0x5e51=Math[_0x306261(0x15e)](_0x36295a/0xea60),_0x2ef555=Math[_0x306261(0x15e)](_0x36295a/0x36ee80),_0x2c81c2=Math['floor'](_0x36295a/0x5265c00);let _0x588b18;if(_0x5e51<0x1)_0x588b18=_0x306261(0x185);else{if(_0x5e51<0x3c)_0x588b18=_0x5e51+_0x306261(0x11f);else{if(_0x2ef555<0x18)_0x588b18=_0x2ef555+_0x306261(0x13f);else _0x2c81c2<0x7?_0x588b18=_0x2c81c2+_0x306261(0x14b):_0x588b18=_0x1628d5[_0x306261(0x11e)]('en-US',{'month':'short','day':_0x306261(0xf8)});}}return{'title':_0x223587+'\x20'+_0x536c98['dim']('['+_0x49c87d+']\x20'+_0x588b18),'value':_0x55f8af['id']};});_0x559163&&_0x57866f[_0x3f5e7b(0x17a)]({'title':_0x536c98[_0x3f5e7b(0x154)](_0x3f5e7b(0xe0)),'value':'__load_more__'});const _0x3215be=await _0x2a761c({'type':_0x3f5e7b(0x17e),'name':_0x3f5e7b(0x162),'message':'Select\x20a\x20chat\x20session:','choices':_0x57866f,'hint':_0x3f5e7b(0xea)});if(!_0x3215be[_0x3f5e7b(0x162)])return undefined;if(_0x3215be[_0x3f5e7b(0x162)]===_0x3f5e7b(0x104)){_0x399f1a+=_0x2a56f5;continue;}return _0x3215be[_0x3f5e7b(0x162)];}}export class ChatsCommand extends BaseCommand{[a26_0x5cc08c(0x155)]=a26_0x5cc08c(0xf7);[a26_0x5cc08c(0x146)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a26_0x5cc08c(0x158)](_0x375340){return executeChatHistoryCommand(_0x375340,'tdx\x20chats');}}