@treasuredata/tdx 0.9.1 → 0.9.3

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 (131) 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.d.ts +35 -1
  9. package/dist/client/llm-api-client.d.ts.map +1 -1
  10. package/dist/client/llm-api-client.js +1 -1
  11. package/dist/client/llm-api-client.js.map +1 -1
  12. package/dist/client/rate-limiter.js +1 -1
  13. package/dist/client/td-api-client.js +1 -1
  14. package/dist/client/trino-api-client.js +1 -1
  15. package/dist/client/workflow-client.js +1 -1
  16. package/dist/commands/activations.js +1 -1
  17. package/dist/commands/agent-command.d.ts.map +1 -1
  18. package/dist/commands/agent-command.js +1 -1
  19. package/dist/commands/agent-command.js.map +1 -1
  20. package/dist/commands/api-command.js +1 -1
  21. package/dist/commands/auth-command.js +1 -1
  22. package/dist/commands/chat-command.js +1 -1
  23. package/dist/commands/claude-command.js +1 -1
  24. package/dist/commands/claude-statusline-command.js +1 -1
  25. package/dist/commands/claude-usage-command.js +1 -1
  26. package/dist/commands/command.js +1 -1
  27. package/dist/commands/connection-command.js +1 -1
  28. package/dist/commands/context-command.js +1 -1
  29. package/dist/commands/databases.js +1 -1
  30. package/dist/commands/describe.js +1 -1
  31. package/dist/commands/engage-command.js +1 -1
  32. package/dist/commands/job-command.js +1 -1
  33. package/dist/commands/journey-command.js +1 -1
  34. package/dist/commands/llm-command.js +1 -1
  35. package/dist/commands/llm-proxy.js +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/tables.js +1 -1
  49. package/dist/commands/use-command.js +1 -1
  50. package/dist/commands/user-command.js +1 -1
  51. package/dist/commands/workflow-command.js +1 -1
  52. package/dist/core/auth.js +1 -1
  53. package/dist/core/config.js +1 -1
  54. package/dist/core/connection-cache.js +1 -1
  55. package/dist/core/credential-cache.js +1 -1
  56. package/dist/core/global-context.js +1 -1
  57. package/dist/core/keychain.js +1 -1
  58. package/dist/core/profile.js +1 -1
  59. package/dist/core/project-config.js +1 -1
  60. package/dist/core/session.js +1 -1
  61. package/dist/core/user-cache.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/proxy/anthropic-adapter.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/context-signature.js +1 -1
  66. package/dist/proxy/conversation-utils.js +1 -1
  67. package/dist/proxy/server.js +1 -1
  68. package/dist/proxy/session-cache.js +1 -1
  69. package/dist/sdk/agent/agent-yaml.d.ts +45 -1
  70. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  71. package/dist/sdk/agent/agent-yaml.js +1 -1
  72. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  73. package/dist/sdk/api.js +1 -1
  74. package/dist/sdk/connection.js +1 -1
  75. package/dist/sdk/engage.js +1 -1
  76. package/dist/sdk/errors.js +1 -1
  77. package/dist/sdk/index.js +1 -1
  78. package/dist/sdk/job.js +1 -1
  79. package/dist/sdk/journey.js +1 -1
  80. package/dist/sdk/llm.d.ts +27 -20
  81. package/dist/sdk/llm.d.ts.map +1 -1
  82. package/dist/sdk/llm.js +1 -1
  83. package/dist/sdk/llm.js.map +1 -1
  84. package/dist/sdk/query.js +1 -1
  85. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  86. package/dist/sdk/segment/journey-yaml.js +1 -1
  87. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  88. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  89. package/dist/sdk/segment.js +1 -1
  90. package/dist/sdk/user.js +1 -1
  91. package/dist/sdk/workflow.js +1 -1
  92. package/dist/types/endpoints.js +1 -1
  93. package/dist/types/index.d.ts +1 -1
  94. package/dist/types/index.d.ts.map +1 -1
  95. package/dist/types/index.js +1 -1
  96. package/dist/types/llm.d.ts +80 -4
  97. package/dist/types/llm.d.ts.map +1 -1
  98. package/dist/utils/agent-config.js +1 -1
  99. package/dist/utils/agent-ref-parser.js +1 -1
  100. package/dist/utils/async.js +1 -1
  101. package/dist/utils/chat-cache.js +1 -1
  102. package/dist/utils/colors.js +1 -1
  103. package/dist/utils/command-output.js +1 -1
  104. package/dist/utils/constants.js +1 -1
  105. package/dist/utils/diff.js +1 -1
  106. package/dist/utils/fields-display.js +1 -1
  107. package/dist/utils/file-permissions.js +1 -1
  108. package/dist/utils/format-detector.js +1 -1
  109. package/dist/utils/formatters.js +1 -1
  110. package/dist/utils/journey-utils.js +1 -1
  111. package/dist/utils/json-loader.js +1 -1
  112. package/dist/utils/llm-backup-utils.js +1 -1
  113. package/dist/utils/model-aliases.js +1 -1
  114. package/dist/utils/model-factors.js +1 -1
  115. package/dist/utils/option-validation.js +1 -1
  116. package/dist/utils/port.js +1 -1
  117. package/dist/utils/process.js +1 -1
  118. package/dist/utils/prompt.js +1 -1
  119. package/dist/utils/segment-path-parser.js +1 -1
  120. package/dist/utils/segment-ref-parser.js +1 -1
  121. package/dist/utils/spinner.js +1 -1
  122. package/dist/utils/sql-parser.js +1 -1
  123. package/dist/utils/sse-parser.js +1 -1
  124. package/dist/utils/string-utils.js +1 -1
  125. package/dist/utils/table-ref-parser.js +1 -1
  126. package/dist/utils/tdx-config.js +1 -1
  127. package/dist/utils/tdx-logger.js +1 -1
  128. package/dist/utils/tree-formatter.js +1 -1
  129. package/dist/utils/version-check.js +1 -1
  130. package/dist/utils/workflow-utils.js +1 -1
  131. package/package.json +1 -1
@@ -1 +1 @@
1
- function a34_0x6a34(_0xb40cb8,_0x1bfcf3){_0xb40cb8=_0xb40cb8-0xf4;const _0x17c6d8=a34_0x17c6();let _0x6a34af=_0x17c6d8[_0xb40cb8];return _0x6a34af;}const a34_0x3df74d=a34_0x6a34;(function(_0x4a5012,_0x3da16d){const _0x41ec94=a34_0x6a34,_0x2e9457=_0x4a5012();while(!![]){try{const _0x810f1f=parseInt(_0x41ec94(0xf5))/0x1+parseInt(_0x41ec94(0x108))/0x2*(-parseInt(_0x41ec94(0x111))/0x3)+-parseInt(_0x41ec94(0xfb))/0x4+-parseInt(_0x41ec94(0xfe))/0x5+-parseInt(_0x41ec94(0xf6))/0x6*(parseInt(_0x41ec94(0xfa))/0x7)+-parseInt(_0x41ec94(0x110))/0x8*(parseInt(_0x41ec94(0xfd))/0x9)+-parseInt(_0x41ec94(0xf9))/0xa*(-parseInt(_0x41ec94(0x105))/0xb);if(_0x810f1f===_0x3da16d)break;else _0x2e9457['push'](_0x2e9457['shift']());}catch(_0xc49294){_0x2e9457['push'](_0x2e9457['shift']());}}}(a34_0x17c6,0x1d06c));function a34_0x17c6(){const _0x1f6b3e=['parentSegment','Parent\x20segment:\x20','3048NBMazO','103713IPAGbk','Listing\x20fields\x20for\x20\x27','description','95065PaRwMW','78ssSHhF','\x20field','name','4870okPflm','20664dCyPnS','620064bHivtZ','site','819SkUDGk','323390IpxkZl','\x27...','verbose','✔\x20Found\x20','segment','List\x20available\x20fields\x20for\x20segmentation','error','9493cNEaVY','Site:\x20','segment:fields','6rmiWco','listFields','execute','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','data','Error:\x20Parent\x20segment\x20name\x20is\x20required'];a34_0x17c6=function(){return _0x1f6b3e;};return a34_0x17c6();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../utils/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a34_0x3df74d(0xf8)]=a34_0x3df74d(0x107);[a34_0x3df74d(0xf4)]=a34_0x3df74d(0x103);async[a34_0x3df74d(0x10a)](_0x5070f1){const _0x51db81=a34_0x3df74d,{options:_0x41f47d,args:_0x170a98,tdx:_0x2ee5f4}=_0x5070f1,_0x3d33a8=_0x170a98[0x0]||_0x41f47d[_0x51db81(0x10e)];if(!_0x3d33a8)return console[_0x51db81(0x104)](_0x51db81(0x10d)),console['error']('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x51db81(0x104)](_0x51db81(0x10b)),0x1;_0x41f47d[_0x51db81(0x100)]&&(console[_0x51db81(0x104)](_0x51db81(0x106)+_0x41f47d[_0x51db81(0xfc)]),console[_0x51db81(0x104)](_0x51db81(0x10f)+_0x3d33a8));const _0x90dd86=await withSpinner(_0x51db81(0x112)+_0x3d33a8+_0x51db81(0xff),()=>_0x2ee5f4[_0x51db81(0x102)][_0x51db81(0x109)](_0x3d33a8),{'verbose':_0x41f47d[_0x51db81(0x100)]}),_0x53eace=_0x90dd86[_0x51db81(0x10c)];console['error'](_0x51db81(0x101)+_0x53eace['length']+_0x51db81(0xf7)+(_0x53eace['length']!==0x1?'s':''));if(_0x41f47d['json']||_0x41f47d['jsonl'])return await handleSDKOutput(_0x53eace,_0x41f47d),0x0;return displayFieldsHumanReadable(_0x53eace,_0x3d33a8),0x0;}}
1
+ const a34_0x35bd85=a34_0x3fd7;function a34_0x3fd7(_0x7ee4ba,_0x4c3077){_0x7ee4ba=_0x7ee4ba-0x137;const _0xf00148=a34_0xf001();let _0x3fd7ba=_0xf00148[_0x7ee4ba];return _0x3fd7ba;}(function(_0x560c37,_0x1755a5){const _0x4e5280=a34_0x3fd7,_0x134bcc=_0x560c37();while(!![]){try{const _0x16ceb2=-parseInt(_0x4e5280(0x153))/0x1*(-parseInt(_0x4e5280(0x13e))/0x2)+parseInt(_0x4e5280(0x145))/0x3*(parseInt(_0x4e5280(0x154))/0x4)+parseInt(_0x4e5280(0x151))/0x5*(-parseInt(_0x4e5280(0x14d))/0x6)+parseInt(_0x4e5280(0x146))/0x7*(parseInt(_0x4e5280(0x144))/0x8)+parseInt(_0x4e5280(0x13a))/0x9+-parseInt(_0x4e5280(0x148))/0xa*(parseInt(_0x4e5280(0x137))/0xb)+parseInt(_0x4e5280(0x14a))/0xc;if(_0x16ceb2===_0x1755a5)break;else _0x134bcc['push'](_0x134bcc['shift']());}catch(_0x8a339f){_0x134bcc['push'](_0x134bcc['shift']());}}}(a34_0xf001,0xd1434));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../utils/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a34_0x35bd85(0x14f)]=a34_0x35bd85(0x150);[a34_0x35bd85(0x138)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x289b2c){const _0x4dbc56=a34_0x35bd85,{options:_0x522fd6,args:_0x359e53,tdx:_0x1f0176}=_0x289b2c,_0x187071=_0x359e53[0x0]||_0x522fd6[_0x4dbc56(0x14c)];if(!_0x187071)return console[_0x4dbc56(0x152)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x4dbc56(0x152)](_0x4dbc56(0x147)),console[_0x4dbc56(0x152)](_0x4dbc56(0x139)),0x1;_0x522fd6[_0x4dbc56(0x140)]&&(console[_0x4dbc56(0x152)](_0x4dbc56(0x142)+_0x522fd6[_0x4dbc56(0x13b)]),console['error'](_0x4dbc56(0x149)+_0x187071));const _0x403112=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x187071+_0x4dbc56(0x13c),()=>_0x1f0176[_0x4dbc56(0x143)]['listFields'](_0x187071),{'verbose':_0x522fd6[_0x4dbc56(0x140)]}),_0x1f51c4=_0x403112[_0x4dbc56(0x13f)];console[_0x4dbc56(0x152)](_0x4dbc56(0x14b)+_0x1f51c4[_0x4dbc56(0x141)]+'\x20field'+(_0x1f51c4[_0x4dbc56(0x141)]!==0x1?'s':''));if(_0x522fd6[_0x4dbc56(0x13d)]||_0x522fd6[_0x4dbc56(0x14e)])return await handleSDKOutput(_0x1f51c4,_0x522fd6),0x0;return displayFieldsHumanReadable(_0x1f51c4,_0x187071),0x0;}}function a34_0xf001(){const _0x5a46c8=['\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','2035593PjECst','site','\x27...','json','285434QeujiM','data','verbose','length','Site:\x20','segment','629416zlJkDv','12tNcObi','35OolgfM','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','5746260NVWyWe','Parent\x20segment:\x20','6613140kzADKW','✔\x20Found\x20','parentSegment','7362leHgQZ','jsonl','name','segment:fields','415zRhsed','error','2TfPaWB','77516xaBWPq','11DjCiDe','description'];a34_0xf001=function(){return _0x5a46c8;};return a34_0xf001();}
@@ -1 +1 @@
1
- const a35_0x57ca53=a35_0x4c9b;(function(_0x12a98a,_0x242cf7){const _0x28271b=a35_0x4c9b,_0x869a1c=_0x12a98a();while(!![]){try{const _0x48a5df=-parseInt(_0x28271b(0x18b))/0x1+-parseInt(_0x28271b(0x1d5))/0x2*(-parseInt(_0x28271b(0x193))/0x3)+parseInt(_0x28271b(0x17c))/0x4*(parseInt(_0x28271b(0x170))/0x5)+parseInt(_0x28271b(0x196))/0x6+parseInt(_0x28271b(0x17f))/0x7+parseInt(_0x28271b(0x1e6))/0x8+-parseInt(_0x28271b(0x185))/0x9;if(_0x48a5df===_0x242cf7)break;else _0x869a1c['push'](_0x869a1c['shift']());}catch(_0x198fb2){_0x869a1c['push'](_0x869a1c['shift']());}}}(a35_0x3087,0xbf4b0));import{BaseCommand}from'./command.js';import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';import{segmentWithActivationsToYaml,segmentToYamlString,apiRuleToYaml,journeyActivationStepToYaml}from'../sdk/segment/child-segment-yaml.js';import{apiToYamlAsync,toYamlString as a35_0x251cba}from'../sdk/segment/journey-yaml.js';import a35_0x5d08b3 from'chalk';function a35_0x3087(){const _0x3c0e00=['segment','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','reduce','message','Write\x20','✔\x20Pulled\x20','parentSegment','journeyBundleId','then','\x20=\x20','parentFolderId','708MwGjlA','\x20new\x20files','Found\x20tdx.json\x20at:\x20','\x20files?','✔\x20Context\x20set:\x20','versionNumber','slice','setExtra','yaml','site','segmentFolderId','\x20\x20Target:\x20','Fetching\x20folders...','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','set','relativePath','folderId','9792672jLgHUQ','795dQZBhf','dirname','\x0aPull\x20summary\x20for\x20\x27','utf-8','segment:pull','absolutePath','tdx.json','getJourney','hasChanges','cyan','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','size','2908CuJVkh','\x20unchanged\x20files','\x20with\x20','5665534tvqhKR','getActivation','get','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Resolved\x20parent\x20name:\x20','activationParams','21195333PLhKCd','user','push','diff','length','join','474842YwpoFB','has','values','✔\x20All\x20files\x20are\x20up\x20to\x20date','isNew','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','journey','3912tJcmiM','error','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','6016560yeDHbi','Fetching\x20connections\x20for\x20name\x20resolution...','name','yes','setPhase','Fetching\x20activations...','relative','\x20\x20🗺️\x20\x20','\x20journeys','attributes','.yml','resolveParentId','Fetching\x20segments...','Using\x20parent\x20segment:\x20','session','listFolders','Fetching\x20parent\x20segment\x20info...','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','red','\x0aChanges\x20to\x20\x27','journeyBundleName','description','\x20segments','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Found\x20existing\x20tdx.json\x20at:\x20','isDirectory','green','yellow','Warning:\x20Could\x20not\x20resolve\x20activation\x20','rule','Fetching\x20journeys...','add','data','Parent\x20segment:\x20','from','listSegments','dim','activation_','\x20changed\x20files','filter','parent_segment','Fetching\x20users\x20for\x20email\x20resolution...','getParent','content','verbose','repeat','\x27...','\x20versions)','dryRun','kind','Processing\x20journeys...'];a35_0x3087=function(){return _0x3c0e00;};return a35_0x3087();}import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';function a35_0x4c9b(_0x16712a,_0x239fe9){_0x16712a=_0x16712a-0x170;const _0x3087aa=a35_0x3087();let _0x4c9b9b=_0x3087aa[_0x16712a];return _0x4c9b9b;}import a35_0x441f24 from'path';import{sanitizeFileName}from'../utils/string-utils.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';export class SegmentPullCommand extends BaseCommand{['name']=a35_0x57ca53(0x174);[a35_0x57ca53(0x1ac)]=a35_0x57ca53(0x1a8);async['execute'](_0x57c052){const _0x6b95cb=a35_0x57ca53,{options:_0x55642b,args:_0x115a89,tdx:_0xeaa8a6}=_0x57c052,_0x477e5a=_0x55642b,_0x44a0f8=_0x55642b[_0x6b95cb(0x1d0)],_0x206c38=_0x115a89[0x0],_0x816fa=findTdxConfigPath();let _0x296baa,_0x1a995;if(!_0x206c38&&_0x816fa){const _0x5df5e4=loadTdxConfig(_0x816fa);_0x296baa=_0x5df5e4['parent_segment'],_0x1a995=a35_0x441f24[_0x6b95cb(0x171)](_0x816fa),_0x477e5a[_0x6b95cb(0x1c3)]&&(console['error'](_0x6b95cb(0x1af)+_0x816fa),console[_0x6b95cb(0x194)]('Using\x20parent\x20segment:\x20'+_0x296baa));}else{if(_0x206c38){if(existsSync(_0x206c38)&&statSync(_0x206c38)[_0x6b95cb(0x1b0)]()){const _0x46a393=findTdxConfigPath(_0x206c38);if(_0x46a393){const _0x36e321=loadTdxConfig(_0x46a393);_0x296baa=_0x36e321['parent_segment'],_0x1a995=a35_0x441f24['dirname'](_0x46a393),_0x477e5a['verbose']&&(console['error'](_0x6b95cb(0x1d7)+_0x46a393),console[_0x6b95cb(0x194)](_0x6b95cb(0x1a3)+_0x296baa));}else return console[_0x6b95cb(0x194)](a35_0x5d08b3[_0x6b95cb(0x1a9)](_0x6b95cb(0x1cb)+_0x206c38+'\x0a')),console[_0x6b95cb(0x194)](a35_0x5d08b3['cyan'](_0x6b95cb(0x17a))),0x1;}else _0x296baa=_0x206c38;}else _0x296baa=_0x44a0f8;}if(!_0x296baa)return console[_0x6b95cb(0x194)](a35_0x5d08b3[_0x6b95cb(0x1b2)](_0x6b95cb(0x182))),console[_0x6b95cb(0x194)](_0x6b95cb(0x1e2)),console[_0x6b95cb(0x194)](_0x6b95cb(0x191)),console['error'](_0x6b95cb(0x195)),0x1;_0x477e5a['verbose']&&(console[_0x6b95cb(0x194)]('Site:\x20'+_0x477e5a[_0x6b95cb(0x1de)]),console['error'](_0x6b95cb(0x1b8)+_0x296baa));const _0xf63d82=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x296baa+_0x6b95cb(0x1c5),()=>_0xeaa8a6[_0x6b95cb(0x1ca)][_0x6b95cb(0x1a1)](_0x296baa),{'verbose':_0x477e5a['verbose']}),_0x10c60a=_0xf63d82[_0x6b95cb(0x1b7)],_0x19b758=await withSpinner(_0x6b95cb(0x1a6),()=>_0xeaa8a6[_0x6b95cb(0x1ca)][_0x6b95cb(0x1c1)](_0x10c60a),{'verbose':_0x477e5a[_0x6b95cb(0x1c3)]}),_0x569af6=_0x19b758[_0x6b95cb(0x1b7)][_0x6b95cb(0x19f)]['name'];_0x477e5a[_0x6b95cb(0x1c3)]&&console['error'](_0x6b95cb(0x183)+_0x569af6);const [_0x43f25e,_0x26f0ef,_0xca5e88]=await Promise['all']([withSpinner(_0x6b95cb(0x1a2),()=>_0xeaa8a6[_0x6b95cb(0x1ca)][_0x6b95cb(0x1ba)](_0x10c60a),{'verbose':_0x477e5a[_0x6b95cb(0x1c3)]}),withSpinner(_0x6b95cb(0x1e1),()=>_0xeaa8a6[_0x6b95cb(0x1ca)][_0x6b95cb(0x1a5)](_0x10c60a),{'verbose':_0x477e5a[_0x6b95cb(0x1c3)]}),withSpinner(_0x6b95cb(0x1b5),()=>_0xeaa8a6['journey']['listJourneysFromParentSegment'](_0x10c60a),{'verbose':_0x477e5a[_0x6b95cb(0x1c3)]})]),_0x28e134=_0x43f25e['data'],_0x3f0a11=_0x26f0ef[_0x6b95cb(0x1b7)],_0x3d6eea=_0xca5e88[_0x6b95cb(0x1b7)];if(_0x28e134[_0x6b95cb(0x189)]===0x0&&_0x3d6eea[_0x6b95cb(0x189)]===0x0)return console[_0x6b95cb(0x194)](a35_0x5d08b3[_0x6b95cb(0x1b2)](_0x6b95cb(0x190)+_0x569af6+'\x27')),0x0;const _0x10189c=buildFolderPathMap(_0x3f0a11),_0x349f65=_0x1a995||getSegmentRootDir(sanitizeFileName(_0x296baa)),_0x51c8a6=new Map();await withSpinner(_0x6b95cb(0x19b),async()=>{await batchAsync(_0x28e134,async _0x310c06=>{const _0x47df01=a35_0x4c9b,_0x43f1aa=await _0xeaa8a6[_0x47df01(0x1ca)]['listActivations'](_0x10c60a,_0x310c06['id']);_0x51c8a6['set'](_0x310c06['id'],_0x43f1aa);});},{'verbose':_0x477e5a[_0x6b95cb(0x1c3)]});const _0x5577a9=await withSpinner(_0x6b95cb(0x1c0),()=>_0xeaa8a6[_0x6b95cb(0x186)]['buildIdToEmailMap'](),{'verbose':_0x477e5a['verbose']})[_0x6b95cb(0x1d2)](_0x4d5e86=>_0x4d5e86['data']),_0x31c3b2=await withSpinner(_0x6b95cb(0x197),()=>_0xeaa8a6['connection']['buildIdToNameMap'](),{'verbose':_0x477e5a[_0x6b95cb(0x1c3)]})['then'](_0x5e7020=>_0x5e7020[_0x6b95cb(0x1b7)]),_0x418cd=[],_0x573b89=a35_0x441f24['join'](_0x349f65,_0x6b95cb(0x176)),_0x411f86=createTdxConfigContent(_0x569af6);_0x418cd[_0x6b95cb(0x187)](prepareFile(_0x573b89,_0x411f86,_0x349f65));const _0x2cc359=new Map();for(const _0x209869 of _0x28e134){if(_0x209869['kind']===SEGMENT_KIND_JOURNEY)continue;const _0x46ae15=_0x209869['segmentFolderId']?_0x10189c['get'](_0x209869[_0x6b95cb(0x1df)])||'':'',_0x19b262=_0x51c8a6[_0x6b95cb(0x181)](_0x209869['id'])||[],_0x33f7d2=segmentWithActivationsToYaml(_0x209869,_0x19b262,undefined,_0x5577a9,_0x31c3b2),_0x1fa1d9=_0x46ae15?a35_0x441f24[_0x6b95cb(0x18a)](_0x349f65,_0x46ae15):_0x349f65,_0x5c5ecc=sanitizeFileName(_0x209869[_0x6b95cb(0x198)]),_0x38ecb7=getUniqueFileName(_0x1fa1d9,_0x5c5ecc,_0x2cc359),_0x300c64=a35_0x441f24[_0x6b95cb(0x18a)](_0x1fa1d9,_0x38ecb7+_0x6b95cb(0x1a0)),_0x14cc86=segmentToYamlString(_0x33f7d2);_0x418cd['push'](prepareFile(_0x300c64,_0x14cc86,_0x349f65));}const _0x47df8b=new Map();for(const _0x496cea of _0x28e134){_0x47df8b[_0x6b95cb(0x1e3)](_0x496cea['id'],_0x496cea);}const _0x370c4c=new Map();for(const _0x231395 of _0x3d6eea){const _0xfe6abe=_0x231395[_0x6b95cb(0x1d1)];!_0x370c4c[_0x6b95cb(0x18c)](_0xfe6abe)&&_0x370c4c[_0x6b95cb(0x1e3)](_0xfe6abe,[]),_0x370c4c[_0x6b95cb(0x181)](_0xfe6abe)[_0x6b95cb(0x187)](_0x231395);}for(const _0x7b07e1 of _0x370c4c['values']()){_0x7b07e1['sort']((_0x43e694,_0x5d3468)=>(_0x43e694[_0x6b95cb(0x1da)]||0x0)-(_0x5d3468[_0x6b95cb(0x1da)]||0x0));}const _0x5960a4=()=>{const _0x5d126c=_0x6b95cb,_0x4f4140=new Set(),_0xca2e40=new Set(),_0x470c8d=new Map(),_0x253805=new Map(),_0x40e4b0=createJumpTargetCache(),_0x5f4579=(_0x474160,_0xcc7e9a)=>({'resolveSegment':async _0x3011de=>{const _0x448c8f=a35_0x4c9b,_0x52c810=_0x470c8d[_0x448c8f(0x181)](_0x3011de);if(_0x52c810!==undefined)return{'name':_0x52c810,'isJourneyLocal':!![]};if(!_0xcc7e9a)return{'name':_0x3011de,'isJourneyLocal':![]};try{let _0x1c2ad3=_0x47df8b[_0x448c8f(0x181)](_0x3011de);!_0x1c2ad3&&(_0x1c2ad3=await _0xeaa8a6[_0x448c8f(0x1ca)]['getSegment'](_0xcc7e9a,_0x3011de));const _0xf5a340=generateJourneyLocalName(_0x1c2ad3[_0x448c8f(0x198)]),_0x44a356=_0x1c2ad3[_0x448c8f(0x1c8)]===SEGMENT_KIND_JOURNEY&&_0xf5a340!==undefined;let _0x6dcfa7=_0x1c2ad3[_0x448c8f(0x198)];if(_0x44a356&&_0xf5a340){let _0x555890=_0xf5a340,_0x1583e1=0x2;while(_0x4f4140[_0x448c8f(0x18c)](_0x555890)){_0x555890=_0xf5a340+'_'+_0x1583e1,_0x1583e1++;}_0x4f4140[_0x448c8f(0x1b6)](_0x555890),_0x6dcfa7=_0x555890,_0x470c8d['set'](_0x3011de,_0x6dcfa7);}let _0x33e395;return _0x44a356&&_0x1c2ad3[_0x448c8f(0x1b4)]&&(_0x33e395={'description':_0x1c2ad3[_0x448c8f(0x1ac)],'rule':apiRuleToYaml(_0x1c2ad3[_0x448c8f(0x1b4)])}),{'name':_0x6dcfa7,'isJourneyLocal':_0x44a356,'definition':_0x33e395};}catch(_0x311e98){return _0x477e5a[_0x448c8f(0x1c3)]&&console['error'](_0x448c8f(0x1a7)+_0x3011de+':\x20'+_0x311e98[_0x448c8f(0x1cd)]),{'name':_0x3011de,'isJourneyLocal':![]};}},'resolveActivation':async _0x5e6843=>{const _0x18461=a35_0x4c9b,_0x5d33de=_0x253805[_0x18461(0x181)](_0x5e6843);if(_0x5d33de!==undefined)return{'name':_0x5d33de,'isJourneyLocal':!![]};try{const _0x17fbcd=await _0xeaa8a6['journey'][_0x18461(0x180)](_0x474160,_0x5e6843),_0x1ab719=_0x17fbcd[_0x18461(0x19f)][_0x18461(0x184)][_0x18461(0x198)]||_0x5e6843,_0x39b89c=sanitizeYamlKey(_0x1ab719)||_0x18461(0x1bc)+_0x5e6843;let _0x56a1c6=_0x39b89c,_0xe539db=0x2;while(_0xca2e40[_0x18461(0x18c)](_0x56a1c6)){_0x56a1c6=_0x39b89c+'_'+_0xe539db,_0xe539db++;}_0xca2e40[_0x18461(0x1b6)](_0x56a1c6),_0x253805[_0x18461(0x1e3)](_0x5e6843,_0x56a1c6);const _0x2ca8d2=journeyActivationStepToYaml(_0x17fbcd,_0x5577a9,_0x31c3b2);return{'name':_0x56a1c6,'isJourneyLocal':!![],'definition':_0x2ca8d2};}catch(_0x546ae4){return _0x477e5a['verbose']&&console[_0x18461(0x194)](_0x18461(0x1b3)+_0x5e6843+':\x20'+_0x546ae4[_0x18461(0x1cd)]),{'name':_0x5e6843,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x48d773,_0x41cdf7)=>resolveJumpTarget(_0x48d773,_0x41cdf7,_0x40e4b0,_0x1d8f4f=>_0xeaa8a6[_0x5d126c(0x192)][_0x5d126c(0x177)](_0x1d8f4f))});return{'createYamlContext':_0x5f4579};};if(_0x370c4c[_0x6b95cb(0x17b)]>0x0){const _0x3c68c7=Array['from'](_0x370c4c[_0x6b95cb(0x18d)]()),_0x46e6e6=await withQuerySpinner(_0x6b95cb(0x1c9),async _0x5d51c5=>{const _0x23470f=_0x6b95cb,_0x405aa6=[];let _0x532b05=0x0;const _0x175de6=0x5;for(let _0x45c68b=0x0;_0x45c68b<_0x3c68c7[_0x23470f(0x189)];_0x45c68b+=_0x175de6){const _0x183d6f=_0x3c68c7[_0x23470f(0x1db)](_0x45c68b,_0x45c68b+_0x175de6),_0x136391=await Promise['all'](_0x183d6f['map'](async _0x789b7d=>{const _0x47f87a=_0x23470f,_0x2b0f17=_0x789b7d[0x0],_0x347f00=_0x2b0f17[_0x47f87a(0x1ab)];_0x5d51c5[_0x47f87a(0x19a)]('Fetching\x20journey\x20\x27'+_0x347f00+'\x27');const _0x474dea=_0x2b0f17[_0x47f87a(0x1e5)]?_0x10189c[_0x47f87a(0x181)](_0x2b0f17[_0x47f87a(0x1e5)])||'':'',{createYamlContext:_0xa3c5e0}=_0x5960a4(),_0x1021e1=[];for(const _0x5eae41 of _0x789b7d){const _0x4768d6=await _0xeaa8a6[_0x47f87a(0x192)][_0x47f87a(0x177)](_0x5eae41['id']),_0xc02c8c=_0x4768d6[_0x47f87a(0x19f)]?.['audienceId'],_0x59cce9=_0xa3c5e0(_0x5eae41['id'],_0xc02c8c),_0x3358f0=await apiToYamlAsync(_0x4768d6,_0x59cce9);_0x1021e1[_0x47f87a(0x187)]({'item':_0x5eae41,'yaml':_0x3358f0});}let _0x1478db;return _0x1021e1[_0x47f87a(0x189)]===0x1?_0x1478db=_0x1021e1[0x0][_0x47f87a(0x1dd)]:_0x1478db=buildMergedJourneyYaml(_0x1021e1),{'bundleName':_0x347f00,'folderPath':_0x474dea,'finalYaml':_0x1478db};}));_0x405aa6[_0x23470f(0x187)](..._0x136391),_0x532b05+=_0x183d6f[_0x23470f(0x189)],_0x5d51c5[_0x23470f(0x1dc)]('('+_0x532b05+'/'+_0x3c68c7[_0x23470f(0x189)]+')');}return _0x405aa6;},{'verbose':_0x477e5a[_0x6b95cb(0x1c3)]});for(const {bundleName:_0x34b32a,folderPath:_0x4dd62f,finalYaml:_0x15baaf}of _0x46e6e6['data']){const _0xde358f=a35_0x251cba(_0x15baaf),_0x51d4a5=_0x4dd62f?a35_0x441f24[_0x6b95cb(0x18a)](_0x349f65,_0x4dd62f):_0x349f65,_0x9e3572=sanitizeFileName(_0x34b32a),_0x3cc3a6=getUniqueFileName(_0x51d4a5,_0x9e3572,_0x2cc359),_0x44a48f=a35_0x441f24[_0x6b95cb(0x18a)](_0x51d4a5,_0x3cc3a6+_0x6b95cb(0x1a0));_0x418cd[_0x6b95cb(0x187)](prepareFile(_0x44a48f,_0xde358f,_0x349f65));}}const _0x5409b1=Array[_0x6b95cb(0x1b9)](_0x51c8a6[_0x6b95cb(0x18d)]())[_0x6b95cb(0x1cc)]((_0x2f79d4,_0x9c1393)=>_0x2f79d4+_0x9c1393['length'],0x0),_0x2a2cca=_0x418cd['filter'](_0x505027=>_0x505027['isNew']),_0x3a8613=_0x418cd[_0x6b95cb(0x1be)](_0xf036fc=>!_0xf036fc[_0x6b95cb(0x18f)]&&_0xf036fc[_0x6b95cb(0x178)]),_0x4478b7=_0x418cd['filter'](_0xcab230=>!_0xcab230['isNew']&&!_0xcab230[_0x6b95cb(0x178)]),_0x2d6fc2=_0x28e134[_0x6b95cb(0x1be)](_0x8e0f15=>_0x8e0f15['kind']!==SEGMENT_KIND_JOURNEY);console[_0x6b95cb(0x194)](_0x6b95cb(0x172)+_0x569af6+'\x27:'),console[_0x6b95cb(0x194)]('\x20\x20🎯\x20'+a35_0x5d08b3[_0x6b95cb(0x179)](_0x2d6fc2[_0x6b95cb(0x189)]+_0x6b95cb(0x1ad))+_0x6b95cb(0x17e)+a35_0x5d08b3[_0x6b95cb(0x179)](_0x5409b1+'\x20activations'));if(_0x370c4c[_0x6b95cb(0x17b)]>0x0){const _0x3ff0be=_0x3d6eea[_0x6b95cb(0x189)],_0x328def=_0x370c4c[_0x6b95cb(0x17b)],_0x19aa23=_0x3ff0be>_0x328def?'\x20('+_0x3ff0be+_0x6b95cb(0x1c6):'';console[_0x6b95cb(0x194)](_0x6b95cb(0x19d)+a35_0x5d08b3[_0x6b95cb(0x179)](_0x328def+_0x6b95cb(0x19e))+a35_0x5d08b3[_0x6b95cb(0x1bb)](_0x19aa23));}console[_0x6b95cb(0x194)]('\x20\x20'+a35_0x5d08b3['green']('+\x20'+_0x2a2cca[_0x6b95cb(0x189)]+_0x6b95cb(0x1d6))),console[_0x6b95cb(0x194)]('\x20\x20'+a35_0x5d08b3[_0x6b95cb(0x1b2)]('~\x20'+_0x3a8613[_0x6b95cb(0x189)]+_0x6b95cb(0x1bd))),console[_0x6b95cb(0x194)]('\x20\x20'+a35_0x5d08b3[_0x6b95cb(0x1bb)]('=\x20'+_0x4478b7[_0x6b95cb(0x189)]+_0x6b95cb(0x17d))),console[_0x6b95cb(0x194)](_0x6b95cb(0x1e0)+a35_0x5d08b3[_0x6b95cb(0x179)](_0x349f65)+'\x0a');if(_0x3a8613[_0x6b95cb(0x189)]>0x0)for(const _0x2b86f0 of _0x3a8613){console['error'](_0x6b95cb(0x1aa)+_0x2b86f0[_0x6b95cb(0x1e4)]+'\x27:'),console[_0x6b95cb(0x194)]('─'[_0x6b95cb(0x1c4)](0x3c)),console[_0x6b95cb(0x194)](_0x2b86f0[_0x6b95cb(0x188)]),console['error']('─'[_0x6b95cb(0x1c4)](0x3c));}if(_0x477e5a[_0x6b95cb(0x1c7)])return console['error'](a35_0x5d08b3[_0x6b95cb(0x1b2)](_0x6b95cb(0x1ae))),0x0;if(_0x2a2cca['length']===0x0&&_0x3a8613['length']===0x0)return console[_0x6b95cb(0x194)](a35_0x5d08b3['green'](_0x6b95cb(0x18e))),saveSessionContext({'parent_segment':_0x569af6},_0x477e5a[_0x6b95cb(0x1a4)]),console[_0x6b95cb(0x194)](a35_0x5d08b3['green'](_0x6b95cb(0x1d9)+a35_0x5d08b3[_0x6b95cb(0x1bb)](_0x6b95cb(0x1bf))+_0x6b95cb(0x1d3)+a35_0x5d08b3[_0x6b95cb(0x179)](_0x569af6))),0x0;if(!_0x477e5a[_0x6b95cb(0x199)]&&(_0x2a2cca['length']>0x0||_0x3a8613[_0x6b95cb(0x189)]>0x0)){const _0x48e62b=await confirmKey(_0x6b95cb(0x1ce)+(_0x2a2cca[_0x6b95cb(0x189)]+_0x3a8613[_0x6b95cb(0x189)])+_0x6b95cb(0x1d8));if(!_0x48e62b)return console[_0x6b95cb(0x194)]('Aborted.'),0x1;}for(const _0x2b7327 of _0x418cd){if(_0x2b7327[_0x6b95cb(0x18f)]||_0x2b7327[_0x6b95cb(0x178)]){const _0x3d9b7b=a35_0x441f24[_0x6b95cb(0x171)](_0x2b7327[_0x6b95cb(0x175)]);!existsSync(_0x3d9b7b)&&mkdirSync(_0x3d9b7b,{'recursive':!![]}),writeFileSync(_0x2b7327[_0x6b95cb(0x175)],_0x2b7327[_0x6b95cb(0x1c2)],'utf-8');}}return console[_0x6b95cb(0x194)](a35_0x5d08b3['green'](_0x6b95cb(0x1cf)+(_0x2a2cca[_0x6b95cb(0x189)]+_0x3a8613[_0x6b95cb(0x189)])+'\x20files\x20to\x20'+_0x349f65)),saveSessionContext({'parent_segment':_0x569af6},_0x477e5a[_0x6b95cb(0x1a4)]),console[_0x6b95cb(0x194)](a35_0x5d08b3[_0x6b95cb(0x1b1)]('✔\x20Context\x20set:\x20'+a35_0x5d08b3[_0x6b95cb(0x1bb)](_0x6b95cb(0x1bf))+_0x6b95cb(0x1d3)+a35_0x5d08b3['cyan'](_0x569af6))),0x0;}}function buildFolderPathMap(_0x4591b2){const _0x5249e5=a35_0x57ca53,_0x5a3e73=new Map(),_0x1b97b6=new Map();for(const _0x478eb9 of _0x4591b2){_0x1b97b6['set'](_0x478eb9['id'],_0x478eb9);}const _0x3604e4=new Set();for(const _0x23f0c2 of _0x4591b2){!_0x23f0c2[_0x5249e5(0x1d4)]&&_0x3604e4[_0x5249e5(0x1b6)](_0x23f0c2['id']);}function _0x219eb3(_0x173315){const _0x372df=_0x5249e5;if(_0x5a3e73['has'](_0x173315['id']))return _0x5a3e73[_0x372df(0x181)](_0x173315['id']);if(_0x3604e4['has'](_0x173315['id']))return _0x5a3e73[_0x372df(0x1e3)](_0x173315['id'],''),'';if(_0x173315[_0x372df(0x1d4)]){const _0x5d2198=_0x1b97b6[_0x372df(0x181)](_0x173315[_0x372df(0x1d4)]);if(_0x5d2198){const _0x38bea1=_0x219eb3(_0x5d2198),_0x15a4cd=_0x38bea1?_0x38bea1+'/'+_0x173315[_0x372df(0x198)]:_0x173315[_0x372df(0x198)];return _0x5a3e73['set'](_0x173315['id'],_0x15a4cd),_0x15a4cd;}}const _0x570af2=_0x173315[_0x372df(0x198)];return _0x5a3e73[_0x372df(0x1e3)](_0x173315['id'],_0x570af2),_0x570af2;}for(const _0x26399a of _0x4591b2){_0x219eb3(_0x26399a);}return _0x5a3e73;}function getUniqueFileName(_0x4d4dc6,_0x3ca851,_0x22e4d2){const _0x177eaa=a35_0x57ca53,_0x44eedc=_0x4d4dc6+':'+_0x3ca851,_0x4257cf=_0x22e4d2[_0x177eaa(0x181)](_0x44eedc)||0x0;_0x22e4d2[_0x177eaa(0x1e3)](_0x44eedc,_0x4257cf+0x1);if(_0x4257cf===0x0)return _0x3ca851;return _0x3ca851+'-'+_0x4257cf;}function prepareFile(_0x4e37f8,_0x4846d9,_0x1ed564){const _0x11ca61=a35_0x57ca53,_0x44bae0=a35_0x441f24[_0x11ca61(0x19c)](_0x1ed564,_0x4e37f8);if(existsSync(_0x4e37f8)){const _0x5ca8de=readFileSync(_0x4e37f8,_0x11ca61(0x173)),_0xdfc9b9=generateDiff(_0x5ca8de,_0x4846d9),_0x3c152a=hasChanges(_0xdfc9b9);return{'relativePath':_0x44bae0,'absolutePath':_0x4e37f8,'content':_0x4846d9,'isNew':![],'hasChanges':_0x3c152a,'diff':_0x3c152a?formatDiffWithColors(_0xdfc9b9):undefined};}return{'relativePath':_0x44bae0,'absolutePath':_0x4e37f8,'content':_0x4846d9,'isNew':!![],'hasChanges':![]};}
1
+ const a35_0x1f1380=a35_0x4de8;(function(_0x2ac9ed,_0x42904f){const _0x3efded=a35_0x4de8,_0x20af0b=_0x2ac9ed();while(!![]){try{const _0x129ab8=parseInt(_0x3efded(0x14c))/0x1*(parseInt(_0x3efded(0x141))/0x2)+-parseInt(_0x3efded(0x142))/0x3+-parseInt(_0x3efded(0x11e))/0x4*(parseInt(_0x3efded(0x125))/0x5)+-parseInt(_0x3efded(0x149))/0x6*(-parseInt(_0x3efded(0xef))/0x7)+-parseInt(_0x3efded(0x123))/0x8+-parseInt(_0x3efded(0xda))/0x9*(parseInt(_0x3efded(0x13b))/0xa)+parseInt(_0x3efded(0xd6))/0xb;if(_0x129ab8===_0x42904f)break;else _0x20af0b['push'](_0x20af0b['shift']());}catch(_0x4a6261){_0x20af0b['push'](_0x20af0b['shift']());}}}(a35_0x17ee,0x67d0e));function a35_0x4de8(_0x281870,_0x5982af){_0x281870=_0x281870-0xd6;const _0x17eebb=a35_0x17ee();let _0x4de8ab=_0x17eebb[_0x281870];return _0x4de8ab;}import{BaseCommand}from'./command.js';import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';import{segmentWithActivationsToYaml,segmentToYamlString,apiRuleToYaml,journeyActivationStepToYaml}from'../sdk/segment/child-segment-yaml.js';import{apiToYamlAsync,toYamlString as a35_0x203f48}from'../sdk/segment/journey-yaml.js';import a35_0x4d614c from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a35_0x4fcda9 from'path';import{sanitizeFileName}from'../utils/string-utils.js';function a35_0x17ee(){const _0xaf0c77=['relative','1qEGrqN','rule','11156728EPmbBW','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','listSegments','segment','666cvpWxG','diff','segmentFolderId','listFolders','✔\x20Context\x20set:\x20','dirname','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','listJourneysFromParentSegment','isNew','getParent','has','user','\x20=\x20','site','setExtra','Resolving\x20parent\x20segment\x20\x27','activationParams','Using\x20parent\x20segment:\x20','folderId','absolutePath','repeat','14qnTYRB','name','isDirectory','description','\x20activations','getActivation','all','\x0aChanges\x20to\x20\x27','length','journeyBundleName','\x0aPull\x20summary\x20for\x20\x27','parentFolderId','from','yes','tdx.json','getJourney','buildIdToEmailMap','size','utf-8','data','\x20\x20Target:\x20','kind','session','activation_','message','add','journey','cyan','\x20with\x20','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20unchanged\x20files','\x20\x20🗺️\x20\x20','Fetching\x20users\x20for\x20email\x20resolution...','\x20segments','connection','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','setPhase','error','journeyBundleId','dim','filter','slice','✔\x20Pulled\x20','execute','parent_segment','\x20new\x20files','parentSegment','16GzDoqj','\x20versions)','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','set','resolveParentId','4735328aTIHba','buildIdToNameMap','660745caWfNb','yellow','Fetching\x20parent\x20segment\x20info...','content','Parent\x20segment:\x20','attributes','relativePath','hasChanges','values','\x20changed\x20files','Fetching\x20segments...','Fetching\x20journeys...','audienceId','Fetching\x20folders...','green','get','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','\x20journeys','dryRun','\x20\x20🎯\x20','listActivations','.yml','1250mTqkIV','Write\x20','then','verbose','join','\x20files?','1485788DnxUpp','1144500pmwzzV','versionNumber','push','\x20files\x20to\x20','segment:pull','Fetching\x20connections\x20for\x20name\x20resolution...','Warning:\x20Could\x20not\x20resolve\x20segment\x20','538050xelpVN','Site:\x20'];a35_0x17ee=function(){return _0xaf0c77;};return a35_0x17ee();}import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';export class SegmentPullCommand extends BaseCommand{[a35_0x1f1380(0xf0)]=a35_0x1f1380(0x146);[a35_0x1f1380(0xf2)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a35_0x1f1380(0x11a)](_0x1e07b7){const _0xfd4fe8=a35_0x1f1380,{options:_0x3bea28,args:_0x35af5f,tdx:_0x58ca61}=_0x1e07b7,_0x41a285=_0x3bea28,_0x447fbd=_0x3bea28[_0xfd4fe8(0x11d)],_0x48d689=_0x35af5f[0x0],_0x5285be=findTdxConfigPath();let _0x1e7bcc,_0x3af50b;if(!_0x48d689&&_0x5285be){const _0x45558c=loadTdxConfig(_0x5285be);_0x1e7bcc=_0x45558c[_0xfd4fe8(0x11b)],_0x3af50b=a35_0x4fcda9[_0xfd4fe8(0xdf)](_0x5285be),_0x41a285['verbose']&&(console['error']('Found\x20existing\x20tdx.json\x20at:\x20'+_0x5285be),console['error'](_0xfd4fe8(0xeb)+_0x1e7bcc));}else{if(_0x48d689){if(existsSync(_0x48d689)&&statSync(_0x48d689)[_0xfd4fe8(0xf1)]()){const _0x1bba3a=findTdxConfigPath(_0x48d689);if(_0x1bba3a){const _0x130b82=loadTdxConfig(_0x1bba3a);_0x1e7bcc=_0x130b82[_0xfd4fe8(0x11b)],_0x3af50b=a35_0x4fcda9['dirname'](_0x1bba3a),_0x41a285[_0xfd4fe8(0x13e)]&&(console[_0xfd4fe8(0x114)]('Found\x20tdx.json\x20at:\x20'+_0x1bba3a),console[_0xfd4fe8(0x114)](_0xfd4fe8(0xeb)+_0x1e7bcc));}else return console[_0xfd4fe8(0x114)](a35_0x4d614c['red'](_0xfd4fe8(0xd7)+_0x48d689+'\x0a')),console[_0xfd4fe8(0x114)](a35_0x4d614c['cyan'](_0xfd4fe8(0xe0))),0x1;}else _0x1e7bcc=_0x48d689;}else _0x1e7bcc=_0x447fbd;}if(!_0x1e7bcc)return console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x126)](_0xfd4fe8(0x120))),console[_0xfd4fe8(0x114)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0xfd4fe8(0x114)](_0xfd4fe8(0x112)),console['error'](_0xfd4fe8(0x135)),0x1;_0x41a285['verbose']&&(console['error'](_0xfd4fe8(0x14a)+_0x41a285[_0xfd4fe8(0xe7)]),console[_0xfd4fe8(0x114)](_0xfd4fe8(0x129)+_0x1e7bcc));const _0x1f835c=await withSpinner(_0xfd4fe8(0xe9)+_0x1e7bcc+'\x27...',()=>_0x58ca61['segment'][_0xfd4fe8(0x122)](_0x1e7bcc),{'verbose':_0x41a285[_0xfd4fe8(0x13e)]}),_0x493406=_0x1f835c['data'],_0x222bc9=await withSpinner(_0xfd4fe8(0x127),()=>_0x58ca61[_0xfd4fe8(0xd9)][_0xfd4fe8(0xe3)](_0x493406),{'verbose':_0x41a285['verbose']}),_0x38aec=_0x222bc9['data'][_0xfd4fe8(0x12a)]['name'];_0x41a285[_0xfd4fe8(0x13e)]&&console['error']('Resolved\x20parent\x20name:\x20'+_0x38aec);const [_0x412bb4,_0x370934,_0x2cccfc]=await Promise[_0xfd4fe8(0xf5)]([withSpinner(_0xfd4fe8(0x12f),()=>_0x58ca61[_0xfd4fe8(0xd9)][_0xfd4fe8(0xd8)](_0x493406),{'verbose':_0x41a285['verbose']}),withSpinner(_0xfd4fe8(0x132),()=>_0x58ca61[_0xfd4fe8(0xd9)][_0xfd4fe8(0xdd)](_0x493406),{'verbose':_0x41a285[_0xfd4fe8(0x13e)]}),withSpinner(_0xfd4fe8(0x130),()=>_0x58ca61[_0xfd4fe8(0x109)][_0xfd4fe8(0xe1)](_0x493406),{'verbose':_0x41a285[_0xfd4fe8(0x13e)]})]),_0x5d0bc5=_0x412bb4[_0xfd4fe8(0x102)],_0x5f4868=_0x370934[_0xfd4fe8(0x102)],_0x4b1439=_0x2cccfc[_0xfd4fe8(0x102)];if(_0x5d0bc5['length']===0x0&&_0x4b1439[_0xfd4fe8(0xf7)]===0x0)return console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x126)](_0xfd4fe8(0x10c)+_0x38aec+'\x27')),0x0;const _0x253909=buildFolderPathMap(_0x5f4868),_0x193eba=_0x3af50b||getSegmentRootDir(sanitizeFileName(_0x1e7bcc)),_0x1329cf=new Map();await withSpinner('Fetching\x20activations...',async()=>{await batchAsync(_0x5d0bc5,async _0x2c18de=>{const _0x1f202f=a35_0x4de8,_0x5d760e=await _0x58ca61[_0x1f202f(0xd9)][_0x1f202f(0x139)](_0x493406,_0x2c18de['id']);_0x1329cf['set'](_0x2c18de['id'],_0x5d760e);});},{'verbose':_0x41a285[_0xfd4fe8(0x13e)]});const _0xb83e52=await withSpinner(_0xfd4fe8(0x10f),()=>_0x58ca61[_0xfd4fe8(0xe5)][_0xfd4fe8(0xff)](),{'verbose':_0x41a285[_0xfd4fe8(0x13e)]})['then'](_0x56b9b4=>_0x56b9b4[_0xfd4fe8(0x102)]),_0x179bef=await withSpinner(_0xfd4fe8(0x147),()=>_0x58ca61[_0xfd4fe8(0x111)][_0xfd4fe8(0x124)](),{'verbose':_0x41a285[_0xfd4fe8(0x13e)]})[_0xfd4fe8(0x13d)](_0x2ccbb9=>_0x2ccbb9['data']),_0x4511b0=[],_0x8bb785=a35_0x4fcda9['join'](_0x193eba,_0xfd4fe8(0xfd)),_0x38345a=createTdxConfigContent(_0x38aec);_0x4511b0[_0xfd4fe8(0x144)](prepareFile(_0x8bb785,_0x38345a,_0x193eba));const _0x2dc352=new Map();for(const _0x2f22bd of _0x5d0bc5){if(_0x2f22bd[_0xfd4fe8(0x104)]===SEGMENT_KIND_JOURNEY)continue;const _0x296bfc=_0x2f22bd[_0xfd4fe8(0xdc)]?_0x253909[_0xfd4fe8(0x134)](_0x2f22bd[_0xfd4fe8(0xdc)])||'':'',_0x44bb38=_0x1329cf[_0xfd4fe8(0x134)](_0x2f22bd['id'])||[],_0x18c495=segmentWithActivationsToYaml(_0x2f22bd,_0x44bb38,undefined,_0xb83e52,_0x179bef),_0x2fc644=_0x296bfc?a35_0x4fcda9[_0xfd4fe8(0x13f)](_0x193eba,_0x296bfc):_0x193eba,_0x2b7bd1=sanitizeFileName(_0x2f22bd['name']),_0x15da04=getUniqueFileName(_0x2fc644,_0x2b7bd1,_0x2dc352),_0x3fc484=a35_0x4fcda9['join'](_0x2fc644,_0x15da04+_0xfd4fe8(0x13a)),_0x149ba5=segmentToYamlString(_0x18c495);_0x4511b0[_0xfd4fe8(0x144)](prepareFile(_0x3fc484,_0x149ba5,_0x193eba));}const _0x5cc5a4=new Map();for(const _0x20e031 of _0x5d0bc5){_0x5cc5a4[_0xfd4fe8(0x121)](_0x20e031['id'],_0x20e031);}const _0x4d4b1a=new Map();for(const _0x45300f of _0x4b1439){const _0x2b8ddf=_0x45300f[_0xfd4fe8(0x115)];!_0x4d4b1a['has'](_0x2b8ddf)&&_0x4d4b1a[_0xfd4fe8(0x121)](_0x2b8ddf,[]),_0x4d4b1a[_0xfd4fe8(0x134)](_0x2b8ddf)[_0xfd4fe8(0x144)](_0x45300f);}for(const _0x3e37d1 of _0x4d4b1a[_0xfd4fe8(0x12d)]()){_0x3e37d1['sort']((_0x2d292f,_0x257481)=>(_0x2d292f[_0xfd4fe8(0x143)]||0x0)-(_0x257481[_0xfd4fe8(0x143)]||0x0));}const _0x1681e6=()=>{const _0x3e95c7=_0xfd4fe8,_0x410cf6=new Set(),_0x55ac46=new Set(),_0x2f3053=new Map(),_0x424342=new Map(),_0x253a27=createJumpTargetCache(),_0x516033=(_0x34c8ce,_0x54734a)=>({'resolveSegment':async _0x1f836d=>{const _0xa5afda=a35_0x4de8,_0x11c579=_0x2f3053[_0xa5afda(0x134)](_0x1f836d);if(_0x11c579!==undefined)return{'name':_0x11c579,'isJourneyLocal':!![]};if(!_0x54734a)return{'name':_0x1f836d,'isJourneyLocal':![]};try{let _0x3d6009=_0x5cc5a4[_0xa5afda(0x134)](_0x1f836d);!_0x3d6009&&(_0x3d6009=await _0x58ca61[_0xa5afda(0xd9)]['getSegment'](_0x54734a,_0x1f836d));const _0x247747=generateJourneyLocalName(_0x3d6009[_0xa5afda(0xf0)]),_0x458d20=_0x3d6009[_0xa5afda(0x104)]===SEGMENT_KIND_JOURNEY&&_0x247747!==undefined;let _0x242bb7=_0x3d6009['name'];if(_0x458d20&&_0x247747){let _0x104941=_0x247747,_0x384317=0x2;while(_0x410cf6[_0xa5afda(0xe4)](_0x104941)){_0x104941=_0x247747+'_'+_0x384317,_0x384317++;}_0x410cf6[_0xa5afda(0x108)](_0x104941),_0x242bb7=_0x104941,_0x2f3053[_0xa5afda(0x121)](_0x1f836d,_0x242bb7);}let _0x1cbb39;return _0x458d20&&_0x3d6009[_0xa5afda(0x14d)]&&(_0x1cbb39={'description':_0x3d6009[_0xa5afda(0xf2)],'rule':apiRuleToYaml(_0x3d6009['rule'])}),{'name':_0x242bb7,'isJourneyLocal':_0x458d20,'definition':_0x1cbb39};}catch(_0x556c1c){return _0x41a285[_0xa5afda(0x13e)]&&console['error'](_0xa5afda(0x148)+_0x1f836d+':\x20'+_0x556c1c[_0xa5afda(0x107)]),{'name':_0x1f836d,'isJourneyLocal':![]};}},'resolveActivation':async _0x9c93ca=>{const _0x4e4e4d=a35_0x4de8,_0x401b6a=_0x424342[_0x4e4e4d(0x134)](_0x9c93ca);if(_0x401b6a!==undefined)return{'name':_0x401b6a,'isJourneyLocal':!![]};try{const _0x3b843a=await _0x58ca61[_0x4e4e4d(0x109)][_0x4e4e4d(0xf4)](_0x34c8ce,_0x9c93ca),_0x314fe6=_0x3b843a['attributes'][_0x4e4e4d(0xea)][_0x4e4e4d(0xf0)]||_0x9c93ca,_0x1e3326=sanitizeYamlKey(_0x314fe6)||_0x4e4e4d(0x106)+_0x9c93ca;let _0x36f057=_0x1e3326,_0x1eac58=0x2;while(_0x55ac46[_0x4e4e4d(0xe4)](_0x36f057)){_0x36f057=_0x1e3326+'_'+_0x1eac58,_0x1eac58++;}_0x55ac46[_0x4e4e4d(0x108)](_0x36f057),_0x424342[_0x4e4e4d(0x121)](_0x9c93ca,_0x36f057);const _0x385250=journeyActivationStepToYaml(_0x3b843a,_0xb83e52,_0x179bef);return{'name':_0x36f057,'isJourneyLocal':!![],'definition':_0x385250};}catch(_0xfdcc35){return _0x41a285[_0x4e4e4d(0x13e)]&&console['error']('Warning:\x20Could\x20not\x20resolve\x20activation\x20'+_0x9c93ca+':\x20'+_0xfdcc35['message']),{'name':_0x9c93ca,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x4f5b99,_0x376a39)=>resolveJumpTarget(_0x4f5b99,_0x376a39,_0x253a27,_0xaa4ac3=>_0x58ca61[_0x3e95c7(0x109)]['getJourney'](_0xaa4ac3))});return{'createYamlContext':_0x516033};};if(_0x4d4b1a[_0xfd4fe8(0x100)]>0x0){const _0x265564=Array['from'](_0x4d4b1a[_0xfd4fe8(0x12d)]()),_0x4de80e=await withQuerySpinner('Processing\x20journeys...',async _0x5ea33a=>{const _0x450c3a=_0xfd4fe8,_0x2cd414=[];let _0x4c05bd=0x0;const _0x5b43b8=0x5;for(let _0x368ac2=0x0;_0x368ac2<_0x265564['length'];_0x368ac2+=_0x5b43b8){const _0xc0cb9c=_0x265564[_0x450c3a(0x118)](_0x368ac2,_0x368ac2+_0x5b43b8),_0x311c56=await Promise['all'](_0xc0cb9c['map'](async _0x35fe3a=>{const _0x275738=_0x450c3a,_0x130991=_0x35fe3a[0x0],_0x2ea952=_0x130991[_0x275738(0xf8)];_0x5ea33a[_0x275738(0x113)]('Fetching\x20journey\x20\x27'+_0x2ea952+'\x27');const _0xc9f7cf=_0x130991[_0x275738(0xec)]?_0x253909[_0x275738(0x134)](_0x130991[_0x275738(0xec)])||'':'',{createYamlContext:_0x3c4da9}=_0x1681e6(),_0x9d4b0=[];for(const _0x2bed9f of _0x35fe3a){const _0x252d42=await _0x58ca61[_0x275738(0x109)][_0x275738(0xfe)](_0x2bed9f['id']),_0x57fcca=_0x252d42[_0x275738(0x12a)]?.[_0x275738(0x131)],_0x1dbd9f=_0x3c4da9(_0x2bed9f['id'],_0x57fcca),_0x2f51c6=await apiToYamlAsync(_0x252d42,_0x1dbd9f);_0x9d4b0[_0x275738(0x144)]({'item':_0x2bed9f,'yaml':_0x2f51c6});}let _0x28b557;return _0x9d4b0[_0x275738(0xf7)]===0x1?_0x28b557=_0x9d4b0[0x0]['yaml']:_0x28b557=buildMergedJourneyYaml(_0x9d4b0),{'bundleName':_0x2ea952,'folderPath':_0xc9f7cf,'finalYaml':_0x28b557};}));_0x2cd414[_0x450c3a(0x144)](..._0x311c56),_0x4c05bd+=_0xc0cb9c[_0x450c3a(0xf7)],_0x5ea33a[_0x450c3a(0xe8)]('('+_0x4c05bd+'/'+_0x265564[_0x450c3a(0xf7)]+')');}return _0x2cd414;},{'verbose':_0x41a285['verbose']});for(const {bundleName:_0x5ed2e5,folderPath:_0x214002,finalYaml:_0xc115b}of _0x4de80e[_0xfd4fe8(0x102)]){const _0x1ee18f=a35_0x203f48(_0xc115b),_0x3109e5=_0x214002?a35_0x4fcda9[_0xfd4fe8(0x13f)](_0x193eba,_0x214002):_0x193eba,_0x123f5e=sanitizeFileName(_0x5ed2e5),_0x10ca31=getUniqueFileName(_0x3109e5,_0x123f5e,_0x2dc352),_0x3e7308=a35_0x4fcda9[_0xfd4fe8(0x13f)](_0x3109e5,_0x10ca31+_0xfd4fe8(0x13a));_0x4511b0['push'](prepareFile(_0x3e7308,_0x1ee18f,_0x193eba));}}const _0x3f993e=Array[_0xfd4fe8(0xfb)](_0x1329cf[_0xfd4fe8(0x12d)]())['reduce']((_0x184db8,_0x29129b)=>_0x184db8+_0x29129b[_0xfd4fe8(0xf7)],0x0),_0x44eb2b=_0x4511b0[_0xfd4fe8(0x117)](_0xf616c8=>_0xf616c8[_0xfd4fe8(0xe2)]),_0x3c7000=_0x4511b0[_0xfd4fe8(0x117)](_0x307a76=>!_0x307a76[_0xfd4fe8(0xe2)]&&_0x307a76[_0xfd4fe8(0x12c)]),_0x5f1704=_0x4511b0[_0xfd4fe8(0x117)](_0x100b94=>!_0x100b94[_0xfd4fe8(0xe2)]&&!_0x100b94[_0xfd4fe8(0x12c)]),_0x374460=_0x5d0bc5[_0xfd4fe8(0x117)](_0x467c8a=>_0x467c8a['kind']!==SEGMENT_KIND_JOURNEY);console[_0xfd4fe8(0x114)](_0xfd4fe8(0xf9)+_0x38aec+'\x27:'),console[_0xfd4fe8(0x114)](_0xfd4fe8(0x138)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x374460[_0xfd4fe8(0xf7)]+_0xfd4fe8(0x110))+_0xfd4fe8(0x10b)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x3f993e+_0xfd4fe8(0xf3)));if(_0x4d4b1a['size']>0x0){const _0x3cba5d=_0x4b1439[_0xfd4fe8(0xf7)],_0x58ac45=_0x4d4b1a[_0xfd4fe8(0x100)],_0x3255c8=_0x3cba5d>_0x58ac45?'\x20('+_0x3cba5d+_0xfd4fe8(0x11f):'';console['error'](_0xfd4fe8(0x10e)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x58ac45+_0xfd4fe8(0x136))+a35_0x4d614c[_0xfd4fe8(0x116)](_0x3255c8));}console[_0xfd4fe8(0x114)]('\x20\x20'+a35_0x4d614c[_0xfd4fe8(0x133)]('+\x20'+_0x44eb2b[_0xfd4fe8(0xf7)]+_0xfd4fe8(0x11c))),console[_0xfd4fe8(0x114)]('\x20\x20'+a35_0x4d614c[_0xfd4fe8(0x126)]('~\x20'+_0x3c7000[_0xfd4fe8(0xf7)]+_0xfd4fe8(0x12e))),console[_0xfd4fe8(0x114)]('\x20\x20'+a35_0x4d614c[_0xfd4fe8(0x116)]('=\x20'+_0x5f1704[_0xfd4fe8(0xf7)]+_0xfd4fe8(0x10d))),console[_0xfd4fe8(0x114)](_0xfd4fe8(0x103)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x193eba)+'\x0a');if(_0x3c7000[_0xfd4fe8(0xf7)]>0x0)for(const _0x502622 of _0x3c7000){console['error'](_0xfd4fe8(0xf6)+_0x502622[_0xfd4fe8(0x12b)]+'\x27:'),console[_0xfd4fe8(0x114)]('─'[_0xfd4fe8(0xee)](0x3c)),console['error'](_0x502622[_0xfd4fe8(0xdb)]),console[_0xfd4fe8(0x114)]('─'[_0xfd4fe8(0xee)](0x3c));}if(_0x41a285[_0xfd4fe8(0x137)])return console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x126)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x44eb2b[_0xfd4fe8(0xf7)]===0x0&&_0x3c7000[_0xfd4fe8(0xf7)]===0x0)return console['error'](a35_0x4d614c[_0xfd4fe8(0x133)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x38aec},_0x41a285[_0xfd4fe8(0x105)]),console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x133)](_0xfd4fe8(0xde)+a35_0x4d614c[_0xfd4fe8(0x116)](_0xfd4fe8(0x11b))+_0xfd4fe8(0xe6)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x38aec))),0x0;if(!_0x41a285[_0xfd4fe8(0xfc)]&&(_0x44eb2b['length']>0x0||_0x3c7000[_0xfd4fe8(0xf7)]>0x0)){const _0x150461=await confirmKey(_0xfd4fe8(0x13c)+(_0x44eb2b[_0xfd4fe8(0xf7)]+_0x3c7000['length'])+_0xfd4fe8(0x140));if(!_0x150461)return console[_0xfd4fe8(0x114)]('Aborted.'),0x1;}for(const _0x2caf9d of _0x4511b0){if(_0x2caf9d[_0xfd4fe8(0xe2)]||_0x2caf9d[_0xfd4fe8(0x12c)]){const _0x487483=a35_0x4fcda9[_0xfd4fe8(0xdf)](_0x2caf9d[_0xfd4fe8(0xed)]);!existsSync(_0x487483)&&mkdirSync(_0x487483,{'recursive':!![]}),writeFileSync(_0x2caf9d['absolutePath'],_0x2caf9d[_0xfd4fe8(0x128)],_0xfd4fe8(0x101));}}return console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x133)](_0xfd4fe8(0x119)+(_0x44eb2b[_0xfd4fe8(0xf7)]+_0x3c7000[_0xfd4fe8(0xf7)])+_0xfd4fe8(0x145)+_0x193eba)),saveSessionContext({'parent_segment':_0x38aec},_0x41a285[_0xfd4fe8(0x105)]),console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x133)](_0xfd4fe8(0xde)+a35_0x4d614c[_0xfd4fe8(0x116)]('parent_segment')+_0xfd4fe8(0xe6)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x38aec))),0x0;}}function buildFolderPathMap(_0x1d3ceb){const _0xe9f79d=a35_0x1f1380,_0x459743=new Map(),_0x4a102a=new Map();for(const _0x291b7b of _0x1d3ceb){_0x4a102a['set'](_0x291b7b['id'],_0x291b7b);}const _0x498712=new Set();for(const _0x81c741 of _0x1d3ceb){!_0x81c741[_0xe9f79d(0xfa)]&&_0x498712['add'](_0x81c741['id']);}function _0x1a93d7(_0x1146b0){const _0xf2b86a=_0xe9f79d;if(_0x459743[_0xf2b86a(0xe4)](_0x1146b0['id']))return _0x459743[_0xf2b86a(0x134)](_0x1146b0['id']);if(_0x498712[_0xf2b86a(0xe4)](_0x1146b0['id']))return _0x459743[_0xf2b86a(0x121)](_0x1146b0['id'],''),'';if(_0x1146b0[_0xf2b86a(0xfa)]){const _0xf78ddd=_0x4a102a[_0xf2b86a(0x134)](_0x1146b0['parentFolderId']);if(_0xf78ddd){const _0x5aac4e=_0x1a93d7(_0xf78ddd),_0x581d6e=_0x5aac4e?_0x5aac4e+'/'+_0x1146b0[_0xf2b86a(0xf0)]:_0x1146b0[_0xf2b86a(0xf0)];return _0x459743[_0xf2b86a(0x121)](_0x1146b0['id'],_0x581d6e),_0x581d6e;}}const _0x415c95=_0x1146b0['name'];return _0x459743[_0xf2b86a(0x121)](_0x1146b0['id'],_0x415c95),_0x415c95;}for(const _0x33a194 of _0x1d3ceb){_0x1a93d7(_0x33a194);}return _0x459743;}function getUniqueFileName(_0x4c5608,_0x31669c,_0x2ade6e){const _0x54778e=a35_0x1f1380,_0xbfc769=_0x4c5608+':'+_0x31669c,_0x4e68dd=_0x2ade6e['get'](_0xbfc769)||0x0;_0x2ade6e[_0x54778e(0x121)](_0xbfc769,_0x4e68dd+0x1);if(_0x4e68dd===0x0)return _0x31669c;return _0x31669c+'-'+_0x4e68dd;}function prepareFile(_0x5d9d4f,_0x4138ea,_0x246a64){const _0x368994=a35_0x1f1380,_0x6f6d29=a35_0x4fcda9[_0x368994(0x14b)](_0x246a64,_0x5d9d4f);if(existsSync(_0x5d9d4f)){const _0x16f4e5=readFileSync(_0x5d9d4f,_0x368994(0x101)),_0x10de48=generateDiff(_0x16f4e5,_0x4138ea),_0x494c3b=hasChanges(_0x10de48);return{'relativePath':_0x6f6d29,'absolutePath':_0x5d9d4f,'content':_0x4138ea,'isNew':![],'hasChanges':_0x494c3b,'diff':_0x494c3b?formatDiffWithColors(_0x10de48):undefined};}return{'relativePath':_0x6f6d29,'absolutePath':_0x5d9d4f,'content':_0x4138ea,'isNew':!![],'hasChanges':![]};}
@@ -1 +1 @@
1
- const a36_0x22d99d=a36_0x6dbb;(function(_0x1cfc3f,_0x57bfa5){const _0x3c1e84=a36_0x6dbb,_0x34f2f6=_0x1cfc3f();while(!![]){try{const _0x37d78c=-parseInt(_0x3c1e84(0x154))/0x1*(parseInt(_0x3c1e84(0x14c))/0x2)+parseInt(_0x3c1e84(0xe8))/0x3*(-parseInt(_0x3c1e84(0x100))/0x4)+-parseInt(_0x3c1e84(0x175))/0x5+parseInt(_0x3c1e84(0x144))/0x6+parseInt(_0x3c1e84(0x107))/0x7*(parseInt(_0x3c1e84(0x1da))/0x8)+parseInt(_0x3c1e84(0x199))/0x9+parseInt(_0x3c1e84(0x137))/0xa;if(_0x37d78c===_0x57bfa5)break;else _0x34f2f6['push'](_0x34f2f6['shift']());}catch(_0x4017cf){_0x34f2f6['push'](_0x34f2f6['shift']());}}}(a36_0x3765,0x47653));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../sdk/errors.js';import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,journeyActivationStepToYaml,activationToYaml,apiRuleToYaml,yamlRuleToApi}from'../sdk/segment/child-segment-yaml.js';import{isJourneyYaml,parseYamlString as a36_0x50afac,yamlToApi as a36_0x16c25f,toYamlString as a36_0x9eee8b,apiToYamlAsync,hasMultipleVersions,normalizeJourneyYaml}from'../sdk/segment/journey-yaml.js';import a36_0x572dba from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a36_0x1f36c2 from'path';import{getConsoleNextUrl}from'../types/endpoints.js';import*as a36_0x34bb63 from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';const PENDING_SEGMENT_PREFIX=a36_0x22d99d(0x162);function createPendingSegmentId(_0xc5c63e){return''+PENDING_SEGMENT_PREFIX+_0xc5c63e+'__';}function isPendingSegmentId(_0x103207){const _0x4df96f=a36_0x22d99d;return _0x103207[_0x4df96f(0x16f)](PENDING_SEGMENT_PREFIX);}function extractPendingSegmentName(_0x541735){const _0x115258=a36_0x22d99d;return _0x541735[_0x115258(0x131)](/^__pending_(.+)__$/,'$1');}function a36_0x6dbb(_0x11cc66,_0x4a7acc){_0x11cc66=_0x11cc66-0xdf;const _0x376540=a36_0x3765();let _0x6dbb91=_0x376540[_0x11cc66];return _0x6dbb91;}function a36_0x3765(){const _0x369238=['setPhase','red','folderPath','Pushing\x20journeys...','then','flatMap','SEGMENT_UPDATE_ERROR','map','getActivation',')\x20with\x20journeyId:\x20','hasChanges','updated','resolveJourneyId','journey','stages','\x27\x20(internal:\x20','\x20\x20Journeys:\x20','all','\x20\x20Source:\x20','parent_segment','endsWith','parentFolderId','deleteSegment','\x20changed','rule','unchanged','buildNameToIdMap','Failed\x20to\x20','No\x20','journeyActivationStepId','269532GCvqMO','has','isNew','journey_entry_criteria_','yellow','kind','✔\x20Created\x20journey\x20\x27','filter','\x27\x20with\x20ID:\x20','dryRun','entries','existingSegment','INTERNAL','absolutePath','\x27\x20not\x20found\x20in\x20journey\x20\x27','delete','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','\x20\x20🗺️\x20\x20Journeys:','find','\x20\x20Created\x20embedded\x20segment\x20\x27','ACTIVATION_UPDATE_ERROR','Creating\x20segment\x20\x27','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20folders\x20to\x20create','diff','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','isDirectory','Site:\x20','\x27\x20from\x20file:\x20','.yml','\x20updated','Delete\x20segment:','segmentFolderId','journeyBundleName','join','\x20\x20✔\x20Updated\x20activation\x20\x27','config','buildIdToNameMap','\x20unchanged','activationActions','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','.yaml','resolveParentId','max','\x20\x20Step\x202:\x20Creating\x20embedded\x20segment\x20\x27','\x0a\x20\x20','\x20to\x20update','JOURNEY_UPDATE_ERROR','get','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Fetching\x20existing\x20folders...','action','add','listJourneysFromParentSegment','Parent\x20segment:\x20','\x20\x20Journey\x20API\x20request:\x20','journeys','\x27\x20v','getSegment','activations','\x20\x20Created\x20embedded\x20activation\x20\x27','execute','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','/app/ps/','Failed\x20to\x20create\x20embedded\x20segment\x20\x27','16664AqnJcp','toString','Updating\x20segment\x20\x27','buildUserMaps','Failed\x20to\x20create\x20embedded\x20activation\x20\x27','entry_criteria','push','\x20(referenced\x20in\x20journey\x20','Creating\x20folder\x20\x27','Entry\x20criteria:\x20','randomUUID','create','1599dyRhVC','\x0a✔\x20Push\x20complete','\x27:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','description','NOT_FOUND','Fetching\x20journey\x20\x27','keys','steps','\x20\x20✔\x20Created\x20activation\x20\x27','...','existingJourney','Push\x20','versionNumber','\x20journey\x20\x27','cyan','split','segment\x20or\x20journey','createFolder','\x20new','stringify','user','utf-8','created','4332eAyUSO','JOURNEY_SYNTAX_ERROR','getParent','\x20to\x20create','segmentId','size','state','217auUrLF','__pending_act_','SEGMENT_SYNTAX_ERROR','activationParams','toLowerCase','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','Resolving\x20parent\x20segment\x20\x27','type','\x20\x20✔\x20Deleted\x20activation\x20\x27','green','Scoped\x20to\x20folder:\x20','configDir','createJourneySegment','yamlActivation','createSegment','Changes\x20to\x20journey:','✔\x20Updated\x20journey\x20\x27','Updating\x20activation\x20\x27','set','✔\x20Created\x20folder\x20\x27','\x20activations]','getJourney','Updating','dim','segment:push','resolve','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','Deleting\x20segment\x20\x27','\x20\x20Step\x202b:\x20Creating\x20embedded\x20activation\x20\x27','entry','folderId','blue','✔\x20Deleted\x20segment\x20\x27','journeyId','Activation\x20not\x20found:\x20','sort','Journey\x20\x27','length','\x20deleted','repeat','\x27...','Stage\x20\x27','replace','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','site','\x20segment\x20from\x20file:\x20','verbose','Delete\x20journey:','10263140SfsZEo','existingActivation',').\x20','New\x20segment:','Fetching\x20existing\x20journeys...','data','relationships','yes','/e/','Deleting\x20activation\x20\x27','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','DecisionPoint','\x20created','1470522ScihWO','\x20\x20Activations:','branches','\x20to\x20delete','ACTIVATION_SYNTAX_ERROR','entryCriteria','parentFolder','parentSegmentFolder','860578kUVjRR','listFolders','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','error','Changes\x20to:','\x20\x20📊\x20Segments:','attributes','\x20journey\x20from\x20file:\x20','1DpkZIg','connection','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20\x20Activations:\x20','listActivations','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','cwd','values','yamlConfig','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','dirname','journeyStages','update','Segment\x20not\x20found:\x20','__pending_','relative','deleteActivation','\x27\x20details...','Activation','listSegments','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','\x20\x20\x20\x20','createActivation','parentSegment','\x20\x20Segments:\x20','segment','\x0aPush\x20summary\x20for\x20\x27','startsWith','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','slice','name','Fetching\x20parent\x20segment\x20details...','Aborted.','329795iJlQDO','journeysOnly','Error\x20parsing\x20','isFile','\x27\x20with\x20journeyId:\x20','Creating'];a36_0x3765=function(){return _0x369238;};return a36_0x3765();}const PENDING_ACTIVATION_PREFIX=a36_0x22d99d(0x108);function createPendingActivationId(_0x47ee45){return''+PENDING_ACTIVATION_PREFIX+_0x47ee45+'__';}function isPendingActivationId(_0x17a4bd){const _0x3e42f4=a36_0x22d99d;return _0x17a4bd[_0x3e42f4(0x16f)](PENDING_ACTIVATION_PREFIX);}function extractPendingActivationName(_0x466111){return _0x466111['replace'](/^__pending_act_(.+)__$/,'$1');}function ensureJourneyDefaults(_0x327274){const _0x1b5a90=a36_0x22d99d;!_0x327274[_0x1b5a90(0xec)]&&(_0x327274['description']=''),!_0x327274[_0x1b5a90(0x106)]&&(_0x327274[_0x1b5a90(0x106)]='draft');}function tryFindTdxConfig(_0x213c0c){try{return findTdxConfig(_0x213c0c);}catch{return null;}}function resolveTDFolderPath(_0x4ec352,_0x460488,_0x5d41e5){if(!_0x460488)return _0x4ec352;return _0x4ec352?_0x5d41e5+'/'+_0x4ec352:_0x5d41e5;}export class SegmentPushCommand extends BaseCommand{[a36_0x22d99d(0x172)]=a36_0x22d99d(0x11f);[a36_0x22d99d(0xec)]=a36_0x22d99d(0x1af);async[a36_0x22d99d(0x1d6)](_0x51ef13){const _0x6547e4=a36_0x22d99d,{options:_0x4cebcb,args:_0x35ff6a,tdx:_0x474725}=_0x51ef13,_0x2fc5ee=_0x4cebcb,_0x480765=_0x4cebcb[_0x6547e4(0x16b)],_0x1e34d3=_0x35ff6a[0x0];let _0x335fe7,_0x3ad140,_0x51f055,_0x3fa3a4;if(_0x1e34d3){if(existsSync(_0x1e34d3)&&statSync(_0x1e34d3)[_0x6547e4(0x1b3)]()){const _0x10339b=tryFindTdxConfig(_0x1e34d3);if(_0x10339b)_0x335fe7=_0x10339b[_0x6547e4(0x1bd)][_0x6547e4(0x18e)],_0x3ad140=_0x1e34d3,_0x51f055=_0x10339b['configDir'];else return console[_0x6547e4(0x14f)](a36_0x572dba['red'](_0x6547e4(0x14e)+_0x1e34d3+'\x0a')),console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0xf7)](_0x6547e4(0xeb))),0x1;}else{if(existsSync(_0x1e34d3)&&statSync(_0x1e34d3)[_0x6547e4(0x178)]()){const _0x377c22=a36_0x1f36c2[_0x6547e4(0x15e)](_0x1e34d3),_0x9a9b84=tryFindTdxConfig(_0x377c22);if(_0x9a9b84)_0x335fe7=_0x9a9b84[_0x6547e4(0x1bd)]['parent_segment'],_0x51f055=_0x9a9b84['configDir'],_0x3ad140=_0x9a9b84[_0x6547e4(0x112)],_0x3fa3a4=a36_0x1f36c2[_0x6547e4(0x120)](_0x1e34d3);else return console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x17c)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x377c22+'\x0a')),console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0xf7)](_0x6547e4(0xeb))),0x1;}else _0x335fe7=_0x1e34d3;}}else{const _0x4c04f3=tryFindTdxConfig(process['cwd']());_0x4c04f3?(_0x335fe7=_0x4c04f3[_0x6547e4(0x1bd)][_0x6547e4(0x18e)],_0x3ad140=process[_0x6547e4(0x15a)](),_0x51f055=_0x4c04f3[_0x6547e4(0x112)]):_0x335fe7=_0x480765;}if(!_0x335fe7)return console['error'](a36_0x572dba['yellow'](_0x6547e4(0x1c1))),console[_0x6547e4(0x14f)](_0x6547e4(0x1b2)),console[_0x6547e4(0x14f)](_0x6547e4(0x156)),console[_0x6547e4(0x14f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file'),0x1;const _0x12beee=_0x3ad140||getSegmentRootDir(sanitizeFileName(_0x335fe7)),_0x26aff5=_0x51f055||_0x12beee,_0x2eff3c=a36_0x1f36c2[_0x6547e4(0x163)](_0x26aff5,_0x12beee),_0x23a0b6=_0x2eff3c!==''&&_0x2eff3c!=='.';if(!existsSync(_0x12beee))return console['error'](a36_0x572dba['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x12beee+'\x0a')),console[_0x6547e4(0x14f)](a36_0x572dba['cyan'](_0x6547e4(0xeb))),0x1;_0x2fc5ee[_0x6547e4(0x135)]&&(console['error'](_0x6547e4(0x1b4)+_0x2fc5ee[_0x6547e4(0x133)]),console[_0x6547e4(0x14f)](_0x6547e4(0x1cf)+_0x335fe7),console['error']('Source\x20directory:\x20'+_0x12beee),_0x23a0b6&&console['error'](_0x6547e4(0x111)+_0x2eff3c));const _0x13403d=await withSpinner(_0x6547e4(0x10d)+_0x335fe7+_0x6547e4(0x12f),()=>_0x474725[_0x6547e4(0x16d)][_0x6547e4(0x1c3)](_0x335fe7),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]}),_0x47019c=_0x13403d['data'],[_0x5cdcd6,_0x3c7f5b,_0xc3b205,_0x4b4e01,_0x134df6]=await Promise[_0x6547e4(0x18c)]([withSpinner(_0x6547e4(0x173),()=>_0x474725[_0x6547e4(0x16d)][_0x6547e4(0x102)](_0x47019c),{'verbose':_0x2fc5ee['verbose']}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x474725['segment'][_0x6547e4(0x167)](_0x47019c),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]}),withSpinner(_0x6547e4(0x1cb),()=>_0x474725[_0x6547e4(0x16d)][_0x6547e4(0x14d)](_0x47019c),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]}),withSpinner(_0x6547e4(0x13b),()=>_0x474725[_0x6547e4(0x188)][_0x6547e4(0x1ce)](_0x47019c),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x474725[_0x6547e4(0xfd)][_0x6547e4(0xdf)](),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]})[_0x6547e4(0x17f)](_0xb27053=>_0xb27053[_0x6547e4(0x13c)])]),_0x39dceb=_0x5cdcd6[_0x6547e4(0x13c)],_0x571556=_0x39dceb['relationships']?.[_0x6547e4(0x14b)]?.[_0x6547e4(0x13c)]?.['id']||_0x39dceb[_0x6547e4(0x13d)]?.[_0x6547e4(0x14a)]?.[_0x6547e4(0x13c)]?.['id'],_0x479e9a=_0x3c7f5b[_0x6547e4(0x13c)],_0x5747d5=_0xc3b205[_0x6547e4(0x13c)],_0x1d5441=_0x4b4e01[_0x6547e4(0x13c)],{emailToId:_0xbac001,idToEmail:_0x57ddbe}=_0x134df6,[_0x3f6048,_0x4d220e]=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0xf255ea=_0x6547e4,[_0x375be3,_0x19bbe6]=await Promise['all']([_0x474725[_0xf255ea(0x155)][_0xf255ea(0x195)](),_0x474725[_0xf255ea(0x155)][_0xf255ea(0x1be)]()]);return[_0x375be3,_0x19bbe6];},{'verbose':_0x2fc5ee['verbose']})['then'](_0xe6b395=>_0xe6b395[_0x6547e4(0x13c)]),_0x2a65df=buildFolderPathToIdMap(_0x5747d5),_0x1447b7=new Map();for(const [_0x15f0b5,_0x3facd0]of _0x2a65df[_0x6547e4(0x1a3)]()){_0x1447b7[_0x6547e4(0x119)](_0x3facd0,_0x15f0b5);}const _0x31e355=new Map();for(const _0x1390a8 of _0x479e9a){const _0x30aa9b=_0x1390a8[_0x6547e4(0x1b9)]?_0x1447b7[_0x6547e4(0x1c9)](_0x1390a8[_0x6547e4(0x1b9)][_0x6547e4(0x1db)]())||'':'',_0x99f1f7=_0x30aa9b+':'+_0x1390a8[_0x6547e4(0x172)];_0x31e355[_0x6547e4(0x119)](_0x99f1f7,_0x1390a8);}const _0x14d80c=new Map();for(const _0x4b907e of _0x479e9a){_0x14d80c['set'](_0x4b907e['name'],_0x4b907e['id']);}const _0x2369c0=new Map();for(const _0x1ff661 of _0x1d5441){const _0x449d35=_0x1ff661['folderId']?_0x1447b7[_0x6547e4(0x1c9)](_0x1ff661[_0x6547e4(0x125)])||'':'',_0x2bf117=_0x449d35+':'+_0x1ff661[_0x6547e4(0x1ba)];!_0x2369c0['has'](_0x2bf117)&&_0x2369c0['set'](_0x2bf117,[]),_0x2369c0['get'](_0x2bf117)[_0x6547e4(0xe2)](_0x1ff661);}for(const _0x106eb6 of _0x2369c0[_0x6547e4(0x15b)]()){_0x106eb6[_0x6547e4(0x12a)]((_0x54ab41,_0x45967f)=>(_0x54ab41[_0x6547e4(0xf5)]||0x0)-(_0x45967f['versionNumber']||0x0));}let _0x34a5e7;if(_0x3fa3a4){if(!_0x3fa3a4[_0x6547e4(0x18f)]('.yml')&&!_0x3fa3a4[_0x6547e4(0x18f)](_0x6547e4(0x1c2)))return console['error'](a36_0x572dba[_0x6547e4(0x17c)](_0x6547e4(0x141)+_0x3fa3a4+'\x0a')),0x1;_0x34a5e7=[_0x3fa3a4];}else _0x34a5e7=findYamlFiles(_0x12beee);if(_0x34a5e7['length']===0x0)return console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x17c)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x12beee+'\x0a')),console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0xf7)](_0x6547e4(0x1d7))),0x1;const _0xe2cf23=[],_0x3007de=[];for(const _0x1d703c of _0x34a5e7){const _0x5a1601=a36_0x1f36c2[_0x6547e4(0x163)](_0x12beee,a36_0x1f36c2[_0x6547e4(0x15e)](_0x1d703c)),_0x4fac6e=_0x5a1601==='.'?'':_0x5a1601,_0x1ce5ef=readFileSync(_0x1d703c,_0x6547e4(0xfe));try{const _0x39b328=a36_0x34bb63['parse'](_0x1ce5ef);if(isJourneyYaml(_0x39b328)){const _0x1b4746=a36_0x50afac(_0x1ce5ef);_0x3007de[_0x6547e4(0xe2)]({'yamlConfig':_0x1b4746,'folderPath':_0x4fac6e,'sourcePath':_0x1d703c});}else{if(!_0x2fc5ee[_0x6547e4(0x176)]){const _0x5ed6c2=parseSegmentYamlFile(_0x1ce5ef),_0x3e05fe=normalizeChildSegmentYaml(_0x5ed6c2);_0xe2cf23[_0x6547e4(0xe2)]({'yamlConfig':_0x3e05fe,'folderPath':_0x4fac6e,'sourcePath':_0x1d703c});}}}catch(_0x44e088){return console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x17c)](_0x6547e4(0x177)+_0x1d703c+':\x20'+(_0x44e088 instanceof Error?_0x44e088['message']:_0x44e088))),0x1;}}if(_0xe2cf23[_0x6547e4(0x12c)]===0x0&&_0x3007de[_0x6547e4(0x12c)]===0x0){const _0x58e753=_0x2fc5ee['journeysOnly']?_0x6547e4(0x188):_0x6547e4(0xf9);return console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x19d)](_0x6547e4(0x197)+_0x58e753+'\x20YAML\x20files\x20found')),0x0;}const _0x36b052=new Map();_0x479e9a[_0x6547e4(0x12c)]>0x0&&!_0x2fc5ee[_0x6547e4(0x176)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x479e9a,async _0x46f89b=>{const _0x9aec13=a36_0x6dbb,_0x2c5189=await _0x474725['segment'][_0x9aec13(0x158)](_0x47019c,_0x46f89b['id']);_0x36b052[_0x9aec13(0x119)](_0x46f89b['id'],_0x2c5189);});},{'verbose':_0x2fc5ee[_0x6547e4(0x135)]});const _0x3db5f1=[],_0x57b92b=new Set();for(const {yamlConfig:_0x18df9f,folderPath:_0x5b70d8,sourcePath:_0xeea04d}of _0xe2cf23){const _0x460b2d=resolveTDFolderPath(_0x5b70d8,_0x23a0b6,_0x2eff3c),_0x59e967=_0x460b2d+':'+_0x18df9f['name'],_0x26e213=_0x31e355[_0x6547e4(0x1c9)](_0x59e967),_0x16007a=_0x26e213?_0x36b052[_0x6547e4(0x1c9)](_0x26e213['id'])||[]:[];if(_0x460b2d&&!_0x2a65df[_0x6547e4(0x19a)](_0x460b2d)){const _0x999d=_0x460b2d[_0x6547e4(0xf8)]('/');let _0x21431f='';for(const _0x252a42 of _0x999d){_0x21431f=_0x21431f?_0x21431f+'/'+_0x252a42:_0x252a42,!_0x2a65df['has'](_0x21431f)&&_0x57b92b[_0x6547e4(0x1cd)](_0x21431f);}}const _0x7faad4=calculateActivationActions(_0x18df9f[_0x6547e4(0x1d4)]||[],_0x16007a,_0x57ddbe,_0x4d220e),_0x59b215=segmentToYamlString(_0x18df9f);let _0x41edfc,_0x3f2995=![],_0x5cb653;if(_0x26e213){const _0x23fad7=segmentWithActivationsToYaml(_0x26e213,_0x16007a,undefined,_0x57ddbe,_0x4d220e),_0x584cfa=segmentToYamlString(_0x23fad7);_0x41edfc=generateDiff(_0x584cfa,_0x59b215),_0x3f2995=hasChanges(_0x41edfc),_0x3f2995&&(_0x5cb653=formatDiffWithColors(_0x41edfc));}else _0x41edfc=generateDiff('',_0x59b215),_0x5cb653=formatDiffWithColors(_0x41edfc);_0x3db5f1[_0x6547e4(0xe2)]({'relativePath':_0x18df9f['name'],'absolutePath':_0xeea04d,'yamlConfig':_0x18df9f,'folderPath':_0x460b2d,'existingSegment':_0x26e213,'existingActivations':_0x16007a,'isNew':!_0x26e213,'hasChanges':_0x3f2995,'diff':_0x5cb653,'activationActions':_0x7faad4});}let _0x3f5146=[];if(!_0x3fa3a4){const _0x436bba=new Set();for(const {yamlConfig:_0x346fe3,folderPath:_0x4d12cb}of _0xe2cf23){const _0x510551=resolveTDFolderPath(_0x4d12cb,_0x23a0b6,_0x2eff3c);_0x436bba['add'](_0x510551+':'+_0x346fe3['name']);}_0x3f5146=_0x479e9a['filter'](_0x329a79=>{const _0x3df210=_0x6547e4,_0xa52f1d=_0x329a79[_0x3df210(0x1b9)]?_0x1447b7['get'](_0x329a79[_0x3df210(0x1b9)][_0x3df210(0x1db)]())||'':'',_0x1e2828=_0xa52f1d+':'+_0x329a79[_0x3df210(0x172)];if(_0x436bba['has'](_0x1e2828))return![];if(_0x23a0b6)return _0xa52f1d===_0x2eff3c||_0xa52f1d[_0x3df210(0x16f)](_0x2eff3c+'/');return!![];});}const _0x616dc1=[];for(const {yamlConfig:_0x11b025,folderPath:_0x4e2100,sourcePath:_0x2a8910}of _0x3007de){const _0x24151a=resolveTDFolderPath(_0x4e2100,_0x23a0b6,_0x2eff3c),_0x256564=_0x24151a+':'+_0x11b025[_0x6547e4(0x172)],_0x4f2305=_0x2369c0[_0x6547e4(0x1c9)](_0x256564);let _0x341064,_0xebc707;if(_0x4f2305&&_0x4f2305[_0x6547e4(0x12c)]>0x0){const _0x22188e=new Set(),_0x29a61f=new Set(),_0xf1a6b3=new Map(),_0x499290=new Map(),_0x4ca24e=createJumpTargetCache(),_0x156b74=_0x52e7f2=>({'resolveSegment':async _0x1fec4f=>{const _0x3db1de=_0x6547e4,_0x4137f8=_0x499290[_0x3db1de(0x1c9)](_0x1fec4f);if(_0x4137f8!==undefined)return{'name':_0x4137f8,'isJourneyLocal':!![]};try{let _0x276575=_0x479e9a[_0x3db1de(0x1ab)](_0x57d79e=>_0x57d79e['id']===_0x1fec4f);!_0x276575&&(_0x276575=await _0x474725[_0x3db1de(0x16d)][_0x3db1de(0x1d3)](_0x47019c,_0x1fec4f));const _0x426e0e=generateJourneyLocalName(_0x276575[_0x3db1de(0x172)]),_0x383d96=_0x276575[_0x3db1de(0x19e)]===SEGMENT_KIND_JOURNEY&&_0x426e0e!==undefined;let _0x56c9c8=_0x276575['name'];if(_0x383d96&&_0x426e0e){let _0x19c12f=_0x426e0e,_0x2fb323=0x2;while(_0x22188e[_0x3db1de(0x19a)](_0x19c12f)){_0x19c12f=_0x426e0e+'_'+_0x2fb323,_0x2fb323++;}_0x22188e[_0x3db1de(0x1cd)](_0x19c12f),_0x56c9c8=_0x19c12f,_0x499290['set'](_0x1fec4f,_0x56c9c8);}let _0x1a7425;return _0x383d96&&_0x276575['rule']&&(_0x1a7425={'description':_0x276575[_0x3db1de(0xec)],'rule':apiRuleToYaml(_0x276575[_0x3db1de(0x193)])}),{'name':_0x56c9c8,'isJourneyLocal':_0x383d96,'definition':_0x1a7425};}catch{return{'name':_0x1fec4f,'isJourneyLocal':![]};}},'resolveActivation':async _0x106c87=>{const _0x443079=_0x6547e4,_0x5099bc=_0xf1a6b3['get'](_0x106c87);if(_0x5099bc!==undefined)return{'name':_0x5099bc,'isJourneyLocal':!![]};try{const _0x232c72=await _0x474725['journey'][_0x443079(0x183)](_0x52e7f2,_0x106c87),_0x18df1e=_0x232c72[_0x443079(0x152)][_0x443079(0x10a)][_0x443079(0x172)]||_0x106c87,_0x3d3867=sanitizeYamlKey(_0x18df1e)||'activation_'+_0x106c87;let _0x528d01=_0x3d3867,_0x55383a=0x2;while(_0x29a61f[_0x443079(0x19a)](_0x528d01)){_0x528d01=_0x3d3867+'_'+_0x55383a,_0x55383a++;}_0x29a61f[_0x443079(0x1cd)](_0x528d01),_0xf1a6b3[_0x443079(0x119)](_0x106c87,_0x528d01);const _0xdcb26f=journeyActivationStepToYaml(_0x232c72,_0x57ddbe,_0x4d220e);return{'name':_0x528d01,'isJourneyLocal':!![],'definition':_0xdcb26f};}catch{return{'name':_0x106c87,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0xc33057,_0x1005b9)=>resolveJumpTarget(_0xc33057,_0x1005b9,_0x4ca24e,_0x4c4e67=>_0x474725[_0x6547e4(0x188)][_0x6547e4(0x11c)](_0x4c4e67))}),_0x3806bc=hasMultipleVersions(_0x11b025);if(_0x3806bc&&_0x4f2305[_0x6547e4(0x12c)]>0x1){const _0x2c8969=[];for(const _0x1b01a0 of _0x4f2305){const _0x429515=await withSpinner(_0x6547e4(0xee)+_0x11b025[_0x6547e4(0x172)]+_0x6547e4(0x1d2)+(_0x1b01a0['versionNumber']||0x1)+_0x6547e4(0xf2),()=>_0x474725[_0x6547e4(0x188)]['getJourney'](_0x1b01a0['id']),{'verbose':_0x2fc5ee['verbose']}),_0x48010e=_0x156b74(_0x1b01a0['id']),_0x45ac4c=await apiToYamlAsync(_0x429515[_0x6547e4(0x13c)],_0x48010e);_0x2c8969['push']({'item':_0x1b01a0,'yaml':_0x45ac4c});}_0xebc707=buildMergedJourneyYaml(_0x2c8969);const _0x55f5e4=Math[_0x6547e4(0x1c4)](..._0x2c8969[_0x6547e4(0x182)](_0x2ffc5=>_0x2ffc5['item'][_0x6547e4(0xf5)]||0x0)),_0x3ffa21=_0x4f2305[_0x6547e4(0x1ab)](_0x70b469=>(_0x70b469[_0x6547e4(0xf5)]||0x0)===_0x55f5e4);_0x3ffa21&&(_0x341064=await _0x474725[_0x6547e4(0x188)][_0x6547e4(0x11c)](_0x3ffa21['id']));}else{const _0xb839ac=_0x4f2305[_0x4f2305[_0x6547e4(0x12c)]-0x1],_0x330b25=await withSpinner(_0x6547e4(0xee)+_0x11b025[_0x6547e4(0x172)]+_0x6547e4(0x165),()=>_0x474725[_0x6547e4(0x188)][_0x6547e4(0x11c)](_0xb839ac['id']),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]});_0x341064=_0x330b25[_0x6547e4(0x13c)];const _0x238d59=_0x156b74(_0xb839ac['id']);_0xebc707=await apiToYamlAsync(_0x341064,_0x238d59);}}if(_0x24151a&&!_0x2a65df[_0x6547e4(0x19a)](_0x24151a)){const _0x4bb5ac=_0x24151a[_0x6547e4(0xf8)]('/');let _0x5aac31='';for(const _0x278f79 of _0x4bb5ac){_0x5aac31=_0x5aac31?_0x5aac31+'/'+_0x278f79:_0x278f79,!_0x2a65df['has'](_0x5aac31)&&_0x57b92b['add'](_0x5aac31);}}const _0x586c91=normalizeJourneyYaml(_0x11b025),_0x533114=a36_0x9eee8b(_0x586c91);let _0x53558a=![],_0x485ee2;if(_0xebc707){const _0x297760=normalizeJourneyYaml(_0xebc707),_0x278011=a36_0x9eee8b(_0x297760),_0x6165f0=generateDiff(_0x278011,_0x533114);_0x53558a=hasChanges(_0x6165f0),_0x53558a&&(_0x485ee2=formatDiffWithColors(_0x6165f0));}else{const _0x5a3c4f=generateDiff('',_0x533114);_0x485ee2=formatDiffWithColors(_0x5a3c4f);}_0x616dc1[_0x6547e4(0xe2)]({'relativePath':_0x11b025[_0x6547e4(0x172)],'absolutePath':_0x2a8910,'yamlConfig':_0x11b025,'folderPath':_0x24151a,'existingJourney':_0x341064,'isNew':!_0x341064,'hasChanges':_0x53558a,'diff':_0x485ee2});}let _0x34b20a=[];if(!_0x3fa3a4){const _0x3f6071=new Set();for(const {yamlConfig:_0x281cc2,folderPath:_0x210ceb}of _0x3007de){const _0x4374dd=resolveTDFolderPath(_0x210ceb,_0x23a0b6,_0x2eff3c);_0x3f6071[_0x6547e4(0x1cd)](_0x4374dd+':'+_0x281cc2[_0x6547e4(0x172)]);}_0x34b20a=_0x1d5441[_0x6547e4(0x1a0)](_0x4c4496=>{const _0x1694b4=_0x6547e4,_0x447931=_0x4c4496[_0x1694b4(0x125)]?_0x1447b7[_0x1694b4(0x1c9)](_0x4c4496[_0x1694b4(0x125)])||'':'',_0xb0d8f3=_0x447931+':'+_0x4c4496[_0x1694b4(0x1ba)];if(_0x3f6071[_0x1694b4(0x19a)](_0xb0d8f3))return![];if(_0x23a0b6)return _0x447931===_0x2eff3c||_0x447931['startsWith'](_0x2eff3c+'/');return!![];});}const _0x134bae=_0x3db5f1[_0x6547e4(0x1a0)](_0x502047=>_0x502047['isNew']),_0x232e6d=_0x3db5f1[_0x6547e4(0x1a0)](_0x502ac8=>!_0x502ac8[_0x6547e4(0x19b)]&&_0x502ac8[_0x6547e4(0x185)]),_0x2581ea=_0x3db5f1[_0x6547e4(0x1a0)](_0x389720=>!_0x389720['isNew']&&!_0x389720[_0x6547e4(0x185)]),_0x29a9dc=Array['from'](_0x57b92b)[_0x6547e4(0x12a)](),_0x52e9fa=_0x2fc5ee[_0x6547e4(0x1a8)]?_0x3f5146:[],_0x596d13=_0x2fc5ee[_0x6547e4(0x1a8)]?_0x34b20a:[],_0x9af884=_0x3db5f1[_0x6547e4(0x180)](_0x4f9b4c=>_0x4f9b4c[_0x6547e4(0x1c0)]),_0x294beb=_0x9af884['filter'](_0x1e2dac=>_0x1e2dac[_0x6547e4(0x10e)]===_0x6547e4(0xe7)),_0x52c504=_0x9af884[_0x6547e4(0x1a0)](_0x5316f7=>_0x5316f7['type']===_0x6547e4(0x160)),_0x1c8bb1=_0x9af884[_0x6547e4(0x1a0)](_0x17c5b3=>_0x17c5b3[_0x6547e4(0x10e)]==='delete'),_0x12a91c=_0x616dc1[_0x6547e4(0x1a0)](_0x2e3e54=>_0x2e3e54[_0x6547e4(0x19b)]),_0x576ac7=_0x616dc1[_0x6547e4(0x1a0)](_0x10286b=>!_0x10286b['isNew']&&_0x10286b['hasChanges']),_0x5d3dcc=_0x616dc1[_0x6547e4(0x1a0)](_0x184e72=>!_0x184e72[_0x6547e4(0x19b)]&&!_0x184e72[_0x6547e4(0x185)]);console[_0x6547e4(0x14f)](_0x6547e4(0x16e)+_0x335fe7+'\x27:');_0x29a9dc[_0x6547e4(0x12c)]>0x0&&console[_0x6547e4(0x14f)]('\x20\x20'+a36_0x572dba[_0x6547e4(0x126)]('📁\x20'+_0x29a9dc[_0x6547e4(0x12c)]+_0x6547e4(0x1b0)));if(!_0x2fc5ee[_0x6547e4(0x176)]){console[_0x6547e4(0x14f)](_0x6547e4(0x151)),console[_0x6547e4(0x14f)](_0x6547e4(0x169)+a36_0x572dba[_0x6547e4(0x110)]('+\x20'+_0x134bae[_0x6547e4(0x12c)]+_0x6547e4(0xfb))),console['error'](_0x6547e4(0x169)+a36_0x572dba[_0x6547e4(0x19d)]('~\x20'+_0x232e6d[_0x6547e4(0x12c)]+_0x6547e4(0x192)));if(_0x52e9fa['length']>0x0)console[_0x6547e4(0x14f)](_0x6547e4(0x169)+a36_0x572dba[_0x6547e4(0x17c)]('-\x20'+_0x52e9fa[_0x6547e4(0x12c)]+_0x6547e4(0x147)));else _0x3f5146[_0x6547e4(0x12c)]>0x0&&!_0x2fc5ee[_0x6547e4(0x1a8)]&&console[_0x6547e4(0x14f)]('\x20\x20\x20\x20'+a36_0x572dba[_0x6547e4(0x11e)](_0x3f5146[_0x6547e4(0x12c)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x6547e4(0x14f)]('\x20\x20\x20\x20'+a36_0x572dba[_0x6547e4(0x11e)]('=\x20'+_0x2581ea[_0x6547e4(0x12c)]+_0x6547e4(0x1bf)));}if(_0x616dc1[_0x6547e4(0x12c)]>0x0||_0x34b20a[_0x6547e4(0x12c)]>0x0){console['error'](_0x6547e4(0x1aa)),console[_0x6547e4(0x14f)]('\x20\x20\x20\x20'+a36_0x572dba[_0x6547e4(0x110)]('+\x20'+_0x12a91c[_0x6547e4(0x12c)]+_0x6547e4(0xfb))),console[_0x6547e4(0x14f)](_0x6547e4(0x169)+a36_0x572dba[_0x6547e4(0x19d)]('~\x20'+_0x576ac7[_0x6547e4(0x12c)]+'\x20changed'));if(_0x596d13[_0x6547e4(0x12c)]>0x0)console['error'](_0x6547e4(0x169)+a36_0x572dba[_0x6547e4(0x17c)]('-\x20'+_0x596d13[_0x6547e4(0x12c)]+_0x6547e4(0x147)));else _0x34b20a[_0x6547e4(0x12c)]>0x0&&!_0x2fc5ee[_0x6547e4(0x1a8)]&&console[_0x6547e4(0x14f)]('\x20\x20\x20\x20'+a36_0x572dba['dim'](_0x34b20a['length']+_0x6547e4(0x10c)));console[_0x6547e4(0x14f)](_0x6547e4(0x169)+a36_0x572dba[_0x6547e4(0x11e)]('=\x20'+_0x5d3dcc['length']+_0x6547e4(0x1bf)));}_0x9af884[_0x6547e4(0x12c)]>0x0&&!_0x2fc5ee['journeysOnly']&&(console[_0x6547e4(0x14f)](''),console[_0x6547e4(0x14f)](_0x6547e4(0x145)),_0x294beb['length']>0x0&&console[_0x6547e4(0x14f)](_0x6547e4(0x169)+a36_0x572dba[_0x6547e4(0x110)]('+\x20'+_0x294beb['length']+_0x6547e4(0x103))),_0x52c504[_0x6547e4(0x12c)]>0x0&&console['error'](_0x6547e4(0x169)+a36_0x572dba['yellow']('~\x20'+_0x52c504[_0x6547e4(0x12c)]+_0x6547e4(0x1c7))),_0x1c8bb1[_0x6547e4(0x12c)]>0x0&&console[_0x6547e4(0x14f)](_0x6547e4(0x169)+a36_0x572dba['red']('-\x20'+_0x1c8bb1[_0x6547e4(0x12c)]+'\x20to\x20delete')));console[_0x6547e4(0x14f)](_0x6547e4(0x18d)+a36_0x572dba[_0x6547e4(0xf7)](_0x12beee)+'\x0a');if(_0x29a9dc['length']>0x0){console[_0x6547e4(0x14f)]('Folders\x20to\x20create:');for(const _0x44c6a7 of _0x29a9dc){console[_0x6547e4(0x14f)]('\x20\x20'+a36_0x572dba['blue']('+')+'\x20'+_0x44c6a7);}console[_0x6547e4(0x14f)]('');}if(_0x134bae['length']>0x0&&!_0x2fc5ee['journeysOnly'])for(const _0x4f0aa0 of _0x134bae){const _0xc24baf=_0x4f0aa0['folderPath']?_0x4f0aa0[_0x6547e4(0x17d)]+'/'+_0x4f0aa0['yamlConfig'][_0x6547e4(0x172)]:_0x4f0aa0[_0x6547e4(0x15c)]['name'],_0x747426=_0x4f0aa0[_0x6547e4(0x15c)][_0x6547e4(0x1d4)]?.[_0x6547e4(0x12c)]||0x0,_0x519186=_0x747426>0x0?a36_0x572dba[_0x6547e4(0x11e)]('\x20['+_0x747426+_0x6547e4(0x11b)):'';console[_0x6547e4(0x14f)]('\x0a'+a36_0x572dba[_0x6547e4(0x110)](_0x6547e4(0x13a))+'\x20'+_0xc24baf+_0x519186),console[_0x6547e4(0x14f)]('─'['repeat'](0x3c)),_0x4f0aa0[_0x6547e4(0x1b1)]&&console[_0x6547e4(0x14f)](_0x4f0aa0[_0x6547e4(0x1b1)]),console[_0x6547e4(0x14f)]('─'[_0x6547e4(0x12e)](0x3c));}if(_0x52e9fa[_0x6547e4(0x12c)]>0x0&&!_0x2fc5ee[_0x6547e4(0x176)])for(const _0x3fb874 of _0x52e9fa){const _0x5f2c58=_0x3fb874[_0x6547e4(0x1b9)]?_0x1447b7['get'](_0x3fb874[_0x6547e4(0x1b9)][_0x6547e4(0x1db)]())||'':'',_0x32656d=_0x5f2c58?_0x5f2c58+'/'+_0x3fb874[_0x6547e4(0x172)]:_0x3fb874[_0x6547e4(0x172)],_0x310d79=_0x36b052[_0x6547e4(0x1c9)](_0x3fb874['id'])||[],_0x22d1b1=_0x310d79['length']>0x0?a36_0x572dba[_0x6547e4(0x11e)]('\x20['+_0x310d79[_0x6547e4(0x12c)]+_0x6547e4(0x11b)):'';console[_0x6547e4(0x14f)]('\x0a'+a36_0x572dba[_0x6547e4(0x17c)](_0x6547e4(0x1b8))+'\x20'+_0x32656d+_0x22d1b1),console[_0x6547e4(0x14f)]('─'[_0x6547e4(0x12e)](0x3c));const _0x2624f0=segmentWithActivationsToYaml(_0x3fb874,_0x310d79,undefined,_0x57ddbe,_0x4d220e),_0x145913=segmentToYamlString(_0x2624f0),_0x34f3ee=generateDiff(_0x145913,'');console[_0x6547e4(0x14f)](formatDiffWithColors(_0x34f3ee)),console[_0x6547e4(0x14f)]('─'[_0x6547e4(0x12e)](0x3c));}const _0x25ee43=_0x3db5f1[_0x6547e4(0x1a0)](_0x54259d=>!_0x54259d['isNew']&&_0x54259d['diff']);if(_0x25ee43[_0x6547e4(0x12c)]>0x0&&!_0x2fc5ee[_0x6547e4(0x176)])for(const _0x4088f2 of _0x25ee43){const _0xd95f8=_0x4088f2[_0x6547e4(0x17d)]?_0x4088f2['folderPath']+'/'+_0x4088f2[_0x6547e4(0x15c)]['name']:_0x4088f2[_0x6547e4(0x15c)][_0x6547e4(0x172)];console['error']('\x0a'+a36_0x572dba[_0x6547e4(0x19d)](_0x6547e4(0x150))+'\x20'+_0xd95f8),console[_0x6547e4(0x14f)]('─'[_0x6547e4(0x12e)](0x3c)),console[_0x6547e4(0x14f)](_0x4088f2[_0x6547e4(0x1b1)]),console[_0x6547e4(0x14f)]('─'['repeat'](0x3c));}if(_0x12a91c[_0x6547e4(0x12c)]>0x0)for(const _0x115a4f of _0x12a91c){const _0x395687=_0x115a4f[_0x6547e4(0x17d)]?_0x115a4f[_0x6547e4(0x17d)]+'/'+_0x115a4f['yamlConfig'][_0x6547e4(0x172)]:_0x115a4f[_0x6547e4(0x15c)][_0x6547e4(0x172)];console['error']('\x0a'+a36_0x572dba[_0x6547e4(0x110)]('New\x20journey:')+'\x20'+_0x395687),console[_0x6547e4(0x14f)]('─'[_0x6547e4(0x12e)](0x3c)),_0x115a4f[_0x6547e4(0x1b1)]&&console[_0x6547e4(0x14f)](_0x115a4f[_0x6547e4(0x1b1)]),console[_0x6547e4(0x14f)]('─'['repeat'](0x3c));}const _0x429e0c=_0x616dc1['filter'](_0x46b498=>!_0x46b498[_0x6547e4(0x19b)]&&_0x46b498[_0x6547e4(0x1b1)]);if(_0x429e0c[_0x6547e4(0x12c)]>0x0)for(const _0xf8f547 of _0x429e0c){const _0x377121=_0xf8f547[_0x6547e4(0x17d)]?_0xf8f547[_0x6547e4(0x17d)]+'/'+_0xf8f547['yamlConfig'][_0x6547e4(0x172)]:_0xf8f547[_0x6547e4(0x15c)][_0x6547e4(0x172)];console[_0x6547e4(0x14f)]('\x0a'+a36_0x572dba[_0x6547e4(0x19d)](_0x6547e4(0x116))+'\x20'+_0x377121),console['error']('─'[_0x6547e4(0x12e)](0x3c)),console['error'](_0xf8f547[_0x6547e4(0x1b1)]),console[_0x6547e4(0x14f)]('─'[_0x6547e4(0x12e)](0x3c));}if(_0x596d13[_0x6547e4(0x12c)]>0x0)for(const _0x214b99 of _0x596d13){const _0x2548df=_0x214b99[_0x6547e4(0x125)]?_0x1447b7['get'](_0x214b99[_0x6547e4(0x125)])||'':'',_0xa83225=_0x2548df?_0x2548df+'/'+_0x214b99['journeyBundleName']:_0x214b99[_0x6547e4(0x1ba)];console[_0x6547e4(0x14f)]('\x0a'+a36_0x572dba[_0x6547e4(0x17c)](_0x6547e4(0x136))+'\x20'+_0xa83225),console['error']('─'[_0x6547e4(0x12e)](0x3c)),console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x17c)]('(Journey\x20will\x20be\x20deleted)')),console[_0x6547e4(0x14f)]('─'[_0x6547e4(0x12e)](0x3c));}if(_0x2fc5ee[_0x6547e4(0x1a2)])return console[_0x6547e4(0x14f)](a36_0x572dba['yellow'](_0x6547e4(0x1ca))),0x0;const _0x16b3cd=_0x2fc5ee[_0x6547e4(0x176)]?![]:_0x134bae[_0x6547e4(0x12c)]>0x0||_0x232e6d[_0x6547e4(0x12c)]>0x0||_0x52e9fa[_0x6547e4(0x12c)]>0x0,_0x57962d=_0x12a91c[_0x6547e4(0x12c)]>0x0||_0x576ac7['length']>0x0||_0x596d13[_0x6547e4(0x12c)]>0x0,_0x119526=_0x2fc5ee[_0x6547e4(0x176)]?![]:_0x9af884[_0x6547e4(0x12c)]>0x0,_0x545919=_0x29a9dc['length']>0x0;if(!_0x16b3cd&&!_0x57962d&&!_0x119526&&!_0x545919){const _0x5f22ce=_0x2fc5ee[_0x6547e4(0x176)]?_0x6547e4(0x121):_0x6547e4(0x170);console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x110)](_0x5f22ce));if(_0x3fa3a4&&_0x5d3dcc[_0x6547e4(0x12c)]===0x1){const _0x1acc21=_0x5d3dcc[0x0];if(_0x1acc21['existingJourney']?.['id']){const _0x91f15f=getConsoleNextUrl(_0x2fc5ee[_0x6547e4(0x133)],'/app/ps/'+_0x47019c+'/e/'+_0x1acc21[_0x6547e4(0xf3)]['id']+'/j/da/je');console[_0x6547e4(0x14f)]('\x20\x20'+a36_0x572dba[_0x6547e4(0xf7)](_0x91f15f));}}return 0x0;}const _0x9842e4=_0x2fc5ee['journeysOnly']?_0x12a91c['length']+_0x576ac7[_0x6547e4(0x12c)]+_0x596d13[_0x6547e4(0x12c)]+_0x29a9dc[_0x6547e4(0x12c)]:_0x134bae[_0x6547e4(0x12c)]+_0x232e6d[_0x6547e4(0x12c)]+_0x52e9fa[_0x6547e4(0x12c)]+_0x12a91c[_0x6547e4(0x12c)]+_0x576ac7[_0x6547e4(0x12c)]+_0x596d13['length']+_0x29a9dc[_0x6547e4(0x12c)]+_0x9af884[_0x6547e4(0x12c)];if(!_0x2fc5ee[_0x6547e4(0x13e)]&&_0x9842e4>0x0){const _0x41128f=await confirmKey(_0x6547e4(0xf4)+_0x9842e4+'\x20changes?');if(!_0x41128f)return console[_0x6547e4(0x14f)](_0x6547e4(0x174)),0x1;}for(const _0x472841 of _0x29a9dc){const _0x1c729d=_0x472841[_0x6547e4(0xf8)]('/'),_0x59c2d8=_0x1c729d[_0x1c729d[_0x6547e4(0x12c)]-0x1],_0x34db01=_0x1c729d[_0x6547e4(0x171)](0x0,-0x1)[_0x6547e4(0x1bb)]('/'),_0x5c83f4=_0x2a65df[_0x6547e4(0x1c9)](_0x34db01),_0x2c9581={'name':_0x59c2d8,'parentFolderId':_0x5c83f4},_0x29a4ff=await withSpinner(_0x6547e4(0xe4)+_0x472841+_0x6547e4(0x12f),()=>_0x474725['segment'][_0x6547e4(0xfa)](_0x47019c,_0x2c9581),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]});_0x2a65df[_0x6547e4(0x119)](_0x472841,_0x29a4ff['data']['id']),console['error'](a36_0x572dba[_0x6547e4(0x126)](_0x6547e4(0x11a)+_0x472841+'\x27'));}let _0x3e27cc=0x0,_0x3f9c86=0x0,_0x4fd6cc=0x0,_0x1651ec=0x0,_0x50e902=0x0,_0x467573=0x0;const _0x1a6bef=new Map();for(const _0x3b3eb8 of _0x2fc5ee['journeysOnly']?[]:_0x3db5f1){const _0x52139c=_0x3b3eb8[_0x6547e4(0x17d)]?_0x2a65df[_0x6547e4(0x1c9)](_0x3b3eb8[_0x6547e4(0x17d)]):undefined;let _0x31fc68;try{if(_0x3b3eb8[_0x6547e4(0x19b)]){const _0x6396fc=yamlToCreateRequest(_0x3b3eb8[_0x6547e4(0x15c)],_0x52139c),_0x4f0543=await withSpinner(_0x6547e4(0x1ae)+_0x3b3eb8['yamlConfig'][_0x6547e4(0x172)]+_0x6547e4(0x12f),()=>_0x474725[_0x6547e4(0x16d)][_0x6547e4(0x115)](_0x47019c,_0x6396fc),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]});_0x31fc68=_0x4f0543[_0x6547e4(0x13c)]['id'],_0x1a6bef[_0x6547e4(0x119)](_0x3b3eb8[_0x6547e4(0x15c)][_0x6547e4(0x172)],_0x31fc68),console['error'](a36_0x572dba[_0x6547e4(0x110)]('✔\x20Created\x20segment\x20\x27'+_0x3b3eb8['yamlConfig'][_0x6547e4(0x172)]+'\x27')),_0x3e27cc++;}else{if(_0x3b3eb8['hasChanges']){const _0x275187=yamlToUpdateRequest(_0x3b3eb8[_0x6547e4(0x15c)]);_0x52139c!==_0x3b3eb8[_0x6547e4(0x1a4)]?.[_0x6547e4(0x1b9)]&&(_0x275187[_0x6547e4(0x1b9)]=_0x52139c?parseInt(_0x52139c,0xa):undefined),await withSpinner(_0x6547e4(0x1dc)+_0x3b3eb8[_0x6547e4(0x15c)][_0x6547e4(0x172)]+_0x6547e4(0x12f),()=>_0x474725[_0x6547e4(0x16d)]['updateSegmentById'](_0x47019c,_0x3b3eb8[_0x6547e4(0x1a4)]['id'],_0x275187),{'verbose':_0x2fc5ee['verbose']}),_0x31fc68=_0x3b3eb8[_0x6547e4(0x1a4)]['id'],console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x19d)]('✔\x20Updated\x20segment\x20\x27'+_0x3b3eb8['yamlConfig']['name']+'\x27')),_0x3f9c86++;}else _0x31fc68=_0x3b3eb8['existingSegment']['id'];}}catch(_0x913c49){const _0x23705e=isHttp400Error(_0x913c49),_0x5811b9=_0x23705e?ErrorCode[_0x6547e4(0x109)]:ErrorCode[_0x6547e4(0x181)],_0x29ec9d=getErrorMessage(_0x913c49);throw new SDKError(_0x5811b9,_0x6547e4(0x196)+(_0x3b3eb8['isNew']?'create':_0x6547e4(0x160))+_0x6547e4(0x134)+_0x3b3eb8[_0x6547e4(0x1a6)]+_0x6547e4(0x1c6)+_0x29ec9d,_0x913c49);}for(const _0x25b5f5 of _0x3b3eb8[_0x6547e4(0x1c0)]){try{if(_0x25b5f5['type']==='create'&&_0x25b5f5[_0x6547e4(0x114)]){const _0x4dcf1b=yamlActivationToCreateRequest(_0x25b5f5['yamlActivation'],_0xbac001,_0x3f6048);await withSpinner('Creating\x20activation\x20\x27'+_0x25b5f5[_0x6547e4(0x172)]+_0x6547e4(0x12f),()=>_0x474725[_0x6547e4(0x16d)][_0x6547e4(0x16a)](_0x47019c,_0x31fc68,_0x4dcf1b),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]}),console['error'](a36_0x572dba[_0x6547e4(0x110)](_0x6547e4(0xf1)+_0x25b5f5[_0x6547e4(0x172)]+'\x27')),_0x1651ec++;}else{if(_0x25b5f5[_0x6547e4(0x10e)]===_0x6547e4(0x160)&&_0x25b5f5[_0x6547e4(0x114)]&&_0x25b5f5[_0x6547e4(0x138)]){const _0x1fe48f=yamlActivationToUpdateRequest(_0x25b5f5['yamlActivation'],_0xbac001,_0x3f6048);await withSpinner(_0x6547e4(0x118)+_0x25b5f5[_0x6547e4(0x172)]+_0x6547e4(0x12f),()=>_0x474725[_0x6547e4(0x16d)]['updateActivation'](_0x47019c,_0x31fc68,_0x25b5f5['existingActivation']['id'],_0x1fe48f),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]}),console['error'](a36_0x572dba['yellow'](_0x6547e4(0x1bc)+_0x25b5f5[_0x6547e4(0x172)]+'\x27')),_0x50e902++;}else _0x25b5f5[_0x6547e4(0x10e)]===_0x6547e4(0x1a8)&&_0x25b5f5['existingActivation']&&(await withSpinner(_0x6547e4(0x140)+_0x25b5f5[_0x6547e4(0x172)]+_0x6547e4(0x12f),()=>_0x474725['segment'][_0x6547e4(0x164)](_0x47019c,_0x31fc68,_0x25b5f5[_0x6547e4(0x138)]['id']),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]}),console['error'](a36_0x572dba[_0x6547e4(0x17c)](_0x6547e4(0x10f)+_0x25b5f5[_0x6547e4(0x172)]+'\x27')),_0x467573++);}}catch(_0x433553){const _0x1612fb=isHttp400Error(_0x433553),_0x5e9ef7=_0x1612fb?ErrorCode[_0x6547e4(0x148)]:ErrorCode[_0x6547e4(0x1ad)],_0x4651e0=getErrorMessage(_0x433553);throw new SDKError(_0x5e9ef7,_0x6547e4(0x196)+_0x25b5f5[_0x6547e4(0x10e)]+'\x20activation\x20\x27'+_0x25b5f5[_0x6547e4(0x172)]+_0x6547e4(0x1b5)+_0x3b3eb8[_0x6547e4(0x1a6)]+_0x6547e4(0x1c6)+_0x4651e0,_0x433553);}}}for(const _0x3f3566 of _0x2fc5ee['journeysOnly']?[]:_0x52e9fa){await withSpinner(_0x6547e4(0x122)+_0x3f3566['name']+_0x6547e4(0x12f),()=>_0x474725[_0x6547e4(0x16d)][_0x6547e4(0x191)](_0x3f3566['id']),{'verbose':_0x2fc5ee[_0x6547e4(0x135)]}),console[_0x6547e4(0x14f)](a36_0x572dba['red'](_0x6547e4(0x127)+_0x3f3566['name']+'\x27')),_0x4fd6cc++;}let _0x5803e4=0x0,_0x151043=0x0,_0x3731a6=0x0;const _0x242b51=new Map(_0x14d80c);for(const _0x5ceb1 of _0x3db5f1){_0x5ceb1[_0x6547e4(0x19b)]&&_0x1a6bef['has'](_0x5ceb1[_0x6547e4(0x15c)][_0x6547e4(0x172)])&&_0x242b51[_0x6547e4(0x119)](_0x5ceb1[_0x6547e4(0x15c)][_0x6547e4(0x172)],_0x1a6bef[_0x6547e4(0x1c9)](_0x5ceb1['yamlConfig'][_0x6547e4(0x172)]));}if(_0x616dc1[_0x6547e4(0x12c)]>0x0){const _0x372889=await withQuerySpinner(_0x6547e4(0x17e),async _0x282b86=>{const _0x9888d=_0x6547e4,_0x58bc7e=[];let _0x4ab869=0x0;const _0x1984dd=0x5;for(let _0x120119=0x0;_0x120119<_0x616dc1[_0x9888d(0x12c)];_0x120119+=_0x1984dd){const _0x3af869=_0x616dc1[_0x9888d(0x171)](_0x120119,_0x120119+_0x1984dd),_0x118fe4=await Promise[_0x9888d(0x18c)](_0x3af869[_0x9888d(0x182)](async _0x328278=>{const _0x1d344f=_0x9888d;if(!_0x328278['isNew']&&!_0x328278[_0x1d344f(0x185)])return{'action':'unchanged','name':_0x328278[_0x1d344f(0x15c)][_0x1d344f(0x172)],'journeyId':_0x328278['existingJourney']?.['id']};const _0xc70838=_0x328278[_0x1d344f(0x17d)]?_0x2a65df[_0x1d344f(0x1c9)](_0x328278[_0x1d344f(0x17d)]):undefined,_0x2177e2=_0x328278[_0x1d344f(0x19b)]?_0x1d344f(0x17a):_0x1d344f(0x11d);_0x282b86[_0x1d344f(0x17b)](_0x2177e2+_0x1d344f(0xf6)+_0x328278[_0x1d344f(0x15c)]['name']+'\x27');const _0x567b49=new Map(),_0x1feca6=new Map(),_0x51d33c=new Map(),_0x42e6ff={'resolveSegmentId':async _0x57302c=>{const _0x1f3637=_0x1d344f,_0x1bee9e=_0x242b51['get'](_0x57302c);if(!_0x1bee9e)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1f3637(0x161)+_0x57302c+_0x1f3637(0xe3)+_0x328278['yamlConfig']['name']+')');return _0x1bee9e;},'resolveEmbeddedSegmentId':async(_0x330cc,_0x924aa1)=>{const _0x2acba3=_0x1d344f,_0x2fe9ad=_0x242b51[_0x2acba3(0x1c9)](_0x330cc);if(_0x2fe9ad)return _0x2fe9ad;const _0x429e7a=_0x479e9a[_0x2acba3(0x1ab)](_0x26dbb6=>_0x26dbb6[_0x2acba3(0x172)]===_0x330cc);if(_0x429e7a)return _0x242b51['set'](_0x330cc,_0x429e7a['id']),_0x429e7a['id'];if(_0x328278[_0x2acba3(0x19b)]){const _0x130888=_0x328278[_0x2acba3(0x15c)]['stages']||_0x328278[_0x2acba3(0x15c)][_0x2acba3(0x1d1)]?.[0x0]?.[_0x2acba3(0x189)]||[];let _0x30ac9d=_0x2acba3(0x124),_0xeeb676=_0x330cc;for(const _0x43353b of _0x130888){if(_0x43353b[_0x2acba3(0xe1)]?.['segment']===_0x330cc){_0x30ac9d=_0x43353b[_0x2acba3(0x172)],_0xeeb676=_0x43353b[_0x2acba3(0xe1)][_0x2acba3(0x172)]||_0x330cc;break;}}return _0x1feca6[_0x2acba3(0x119)](_0x330cc,{'definition':_0x924aa1,'stageName':_0x30ac9d,'criteriaName':_0xeeb676}),createPendingSegmentId(_0x330cc);}const _0x118738=_0x328278[_0x2acba3(0xf3)]?.['id'];if(!_0x118738)throw new SDKError(ErrorCode['INTERNAL'],_0x2acba3(0x168));const _0xd973ed=_0x2acba3(0x19c)+crypto[_0x2acba3(0xe6)]();try{const _0x10b653=await _0x474725[_0x2acba3(0x16d)][_0x2acba3(0x113)]({'name':_0xd973ed,'description':_0x924aa1[_0x2acba3(0xec)]||_0x2acba3(0xe5)+_0x330cc,'journeyId':_0x118738,'rule':yamlRuleToApi(_0x924aa1[_0x2acba3(0x193)],!![]),'countPopulation':!![],'parentFolderId':_0x571556||'','audienceId':_0x47019c});return _0x2fc5ee[_0x2acba3(0x135)]&&console[_0x2acba3(0x14f)]('\x20\x20Created\x20embedded\x20segment\x20\x27'+_0x330cc+'\x27\x20(internal:\x20'+_0xd973ed+')\x20with\x20ID:\x20'+_0x10b653),_0x242b51[_0x2acba3(0x119)](_0x330cc,_0x10b653),_0x10b653;}catch(_0x273c2f){throw new SDKError(ErrorCode[_0x2acba3(0x181)],_0x2acba3(0x1d9)+_0x330cc+_0x2acba3(0xea)+getErrorMessage(_0x273c2f),_0x273c2f);}},'resolveActivationId':async _0x4c784d=>{const _0x1a3111=_0x1d344f,_0x3397f2=_0x567b49[_0x1a3111(0x1c9)](_0x4c784d);if(_0x3397f2)return _0x3397f2;if(_0x328278[_0x1a3111(0xf3)]){const _0x2ad5ab=await _0x474725['journey'][_0x1a3111(0x158)](_0x328278['existingJourney']['id']),_0x5ca175=_0x2ad5ab[_0x1a3111(0x1ab)](_0x2de817=>_0x2de817[_0x1a3111(0x152)][_0x1a3111(0x10a)]?.['name']===_0x4c784d);if(_0x5ca175)return _0x567b49[_0x1a3111(0x119)](_0x4c784d,_0x5ca175['id']),_0x5ca175['id'];}throw new SDKError(ErrorCode[_0x1a3111(0xed)],_0x1a3111(0x129)+_0x4c784d+_0x1a3111(0xe3)+_0x328278[_0x1a3111(0x15c)][_0x1a3111(0x172)]+_0x1a3111(0x139)+_0x1a3111(0x159));},'resolveEmbeddedActivationId':async(_0x4bb13c,_0x2455c5)=>{const _0x233fcb=_0x1d344f,_0x3c0f65=_0x567b49['get'](_0x4bb13c);if(_0x3c0f65)return _0x3c0f65;if(_0x328278[_0x233fcb(0x19b)])return _0x51d33c[_0x233fcb(0x119)](_0x4bb13c,_0x2455c5),createPendingActivationId(_0x4bb13c);if(_0x328278['existingJourney']){const _0x236727=await _0x474725['journey'][_0x233fcb(0x158)](_0x328278['existingJourney']['id']),_0x1aec67=_0x236727[_0x233fcb(0x1ab)](_0x5b4475=>_0x5b4475[_0x233fcb(0x152)][_0x233fcb(0x10a)]?.[_0x233fcb(0x172)]===_0x2455c5[_0x233fcb(0x172)]);if(_0x1aec67)return _0x567b49[_0x233fcb(0x119)](_0x4bb13c,_0x1aec67['id']),_0x1aec67['id'];try{const _0x2216b1=yamlActivationToCreateRequest(_0x2455c5,_0xbac001,_0x3f6048),_0x286b68=await _0x474725[_0x233fcb(0x188)][_0x233fcb(0x16a)](_0x328278[_0x233fcb(0xf3)]['id'],_0x2216b1);return _0x2fc5ee[_0x233fcb(0x135)]&&console[_0x233fcb(0x14f)]('\x20\x20Created\x20embedded\x20activation\x20\x27'+_0x4bb13c+_0x233fcb(0x1a1)+_0x286b68['id']),_0x567b49[_0x233fcb(0x119)](_0x4bb13c,_0x286b68['id']),_0x286b68['id'];}catch(_0x3d2f24){throw new SDKError(ErrorCode[_0x233fcb(0x1c8)],_0x233fcb(0xe0)+_0x4bb13c+_0x233fcb(0xea)+getErrorMessage(_0x3d2f24),_0x3d2f24);}}throw new SDKError(ErrorCode[_0x233fcb(0x1a5)],_0x233fcb(0x15d));},'resolveJourneyId':async _0xa1b602=>{const _0x48c644=_0x1d344f;try{return await _0x474725[_0x48c644(0x188)][_0x48c644(0x187)](_0x47019c,_0xa1b602);}catch(_0x5384b4){throw new SDKError(ErrorCode['NOT_FOUND'],_0x48c644(0x12b)+_0xa1b602+_0x48c644(0x132)+_0x328278['yamlConfig'][_0x48c644(0x172)]+'\x27)',_0x5384b4);}},'resolveStageId':async(_0x5cd80d,_0x16e2f7)=>{const _0x141c36=_0x1d344f,_0x4e1638=await _0x474725['journey']['getJourney'](_0x5cd80d),_0x448282=_0x4e1638[_0x141c36(0x152)][_0x141c36(0x15f)][_0x141c36(0x1ab)](_0x2c9291=>_0x2c9291['name'][_0x141c36(0x10b)]()===_0x16e2f7[_0x141c36(0x10b)]());if(!_0x448282?.['id'])throw new SDKError(ErrorCode[_0x141c36(0xed)],_0x141c36(0x130)+_0x16e2f7+_0x141c36(0x1a7)+(_0x4e1638['attributes'][_0x141c36(0x1ba)]||_0x4e1638['attributes'][_0x141c36(0x172)])+'\x27');return _0x448282['id'];}};try{const _0x39a361=await a36_0x16c25f(_0x328278['yamlConfig'],_0x47019c,_0x42e6ff),_0x29d1d4=_0xc70838||_0x571556;_0x29d1d4&&(_0x39a361['relationships']={'parentFolder':{'data':{'id':_0x29d1d4,'type':'folder'}}});if(_0x328278[_0x1d344f(0x19b)]){if(_0x1feca6[_0x1d344f(0x105)]>0x0||_0x51d33c[_0x1d344f(0x105)]>0x0){const _0x26102f=JSON['parse'](JSON[_0x1d344f(0xfc)](_0x39a361));ensureJourneyDefaults(_0x26102f[_0x1d344f(0x152)]);for(const _0x4d7836 of _0x26102f[_0x1d344f(0x152)][_0x1d344f(0x15f)]){_0x4d7836['entryCriteria']?.[_0x1d344f(0x104)]&&isPendingSegmentId(_0x4d7836[_0x1d344f(0x149)][_0x1d344f(0x104)])&&delete _0x4d7836[_0x1d344f(0x149)];if(_0x4d7836[_0x1d344f(0xf0)])for(const _0x31f615 of Object[_0x1d344f(0xef)](_0x4d7836['steps'])){const _0x2b6161=_0x4d7836['steps'][_0x31f615];_0x2b6161[_0x1d344f(0x10e)]===_0x1d344f(0x166)&&_0x2b6161[_0x1d344f(0x198)]&&isPendingActivationId(_0x2b6161['journeyActivationStepId'])&&(_0x2b6161['journeyActivationStepId']='');if(_0x2b6161[_0x1d344f(0x10e)]===_0x1d344f(0x142)&&_0x2b6161[_0x1d344f(0x146)])for(const _0x4db3cc of _0x2b6161['branches']){_0x4db3cc[_0x1d344f(0x104)]&&isPendingSegmentId(_0x4db3cc[_0x1d344f(0x104)])&&(_0x4db3cc[_0x1d344f(0x104)]='');}}}_0x2fc5ee[_0x1d344f(0x135)]&&console[_0x1d344f(0x14f)]('\x20\x20Step\x201:\x20Creating\x20journey\x20without\x20entry\x20criteria:\x20'+JSON[_0x1d344f(0xfc)](_0x26102f,null,0x2));const _0x24eb7a=await _0x474725['journey'][_0x1d344f(0xe7)](_0x26102f),_0x396b37=_0x24eb7a['id'],_0x14ad67=new Map();for(const _0x202f03 of _0x24eb7a[_0x1d344f(0x152)][_0x1d344f(0x15f)]){_0x14ad67[_0x1d344f(0x119)](_0x202f03[_0x1d344f(0x172)][_0x1d344f(0x10b)](),_0x202f03['id']);}const _0x4dadaf=new Map();for(const [_0x24bb8c,{definition:_0xbaf868,criteriaName:_0x2315d0}]of _0x1feca6){const _0x4b37bb=generateJourneyLocalName(_0x2315d0)||'journey_entry_criteria_'+crypto[_0x1d344f(0xe6)]();_0x2fc5ee['verbose']&&console['error'](_0x1d344f(0x1c5)+_0x24bb8c+_0x1d344f(0x18a)+_0x4b37bb+_0x1d344f(0x184)+_0x396b37);const _0x36c346=await _0x474725[_0x1d344f(0x16d)][_0x1d344f(0x113)]({'name':_0x4b37bb,'description':_0xbaf868[_0x1d344f(0xec)]||_0x1d344f(0xe5)+_0x24bb8c,'journeyId':_0x396b37,'rule':yamlRuleToApi(_0xbaf868[_0x1d344f(0x193)],!![]),'countPopulation':!![],'parentFolderId':_0x29d1d4||'','audienceId':_0x47019c});_0x4dadaf[_0x1d344f(0x119)](_0x24bb8c,_0x36c346),_0x242b51[_0x1d344f(0x119)](_0x24bb8c,_0x36c346),_0x2fc5ee[_0x1d344f(0x135)]&&console[_0x1d344f(0x14f)](_0x1d344f(0x1ac)+_0x24bb8c+_0x1d344f(0x1a1)+_0x36c346);}const _0x27ef75=new Map();for(const [_0x24815a,_0x1f6ae9]of _0x51d33c){_0x2fc5ee[_0x1d344f(0x135)]&&console[_0x1d344f(0x14f)](_0x1d344f(0x123)+_0x24815a+_0x1d344f(0x179)+_0x396b37);try{const _0x132f34=yamlActivationToCreateRequest(_0x1f6ae9,_0xbac001,_0x3f6048),_0x26b4b7=await _0x474725[_0x1d344f(0x188)][_0x1d344f(0x16a)](_0x396b37,_0x132f34);_0x27ef75[_0x1d344f(0x119)](_0x24815a,_0x26b4b7['id']),_0x567b49[_0x1d344f(0x119)](_0x24815a,_0x26b4b7['id']),_0x2fc5ee[_0x1d344f(0x135)]&&console[_0x1d344f(0x14f)](_0x1d344f(0x1d5)+_0x24815a+'\x27\x20with\x20ID:\x20'+_0x26b4b7['id']);}catch(_0x1f1e10){throw new SDKError(ErrorCode[_0x1d344f(0x1c8)],_0x1d344f(0xe0)+_0x24815a+_0x1d344f(0xea)+getErrorMessage(_0x1f1e10),_0x1f1e10);}}const _0x13355c=JSON['parse'](JSON[_0x1d344f(0xfc)](_0x39a361));_0x13355c['id']=_0x396b37,ensureJourneyDefaults(_0x13355c['attributes']);for(const _0x3b6e00 of _0x13355c[_0x1d344f(0x152)][_0x1d344f(0x15f)]){const _0x22e4c4=_0x14ad67[_0x1d344f(0x1c9)](_0x3b6e00[_0x1d344f(0x172)][_0x1d344f(0x10b)]());_0x22e4c4&&(_0x3b6e00['id']=_0x22e4c4);if(_0x3b6e00[_0x1d344f(0x149)]?.[_0x1d344f(0x104)]&&isPendingSegmentId(_0x3b6e00[_0x1d344f(0x149)][_0x1d344f(0x104)])){const _0x7c2865=extractPendingSegmentName(_0x3b6e00[_0x1d344f(0x149)][_0x1d344f(0x104)]),_0x1455b5=_0x4dadaf[_0x1d344f(0x1c9)](_0x7c2865);_0x1455b5&&(_0x3b6e00['entryCriteria'][_0x1d344f(0x104)]=_0x1455b5);}if(_0x3b6e00[_0x1d344f(0xf0)]){const _0xdf939f=_0x38f0d7=>_0x39a361['attributes'][_0x1d344f(0x15f)][_0x1d344f(0x1ab)](_0x4c6b73=>_0x4c6b73['name'][_0x1d344f(0x10b)]()===_0x3b6e00[_0x1d344f(0x172)][_0x1d344f(0x10b)]())?.[_0x1d344f(0xf0)]?.[_0x38f0d7];for(const _0x219db0 of Object[_0x1d344f(0xef)](_0x3b6e00[_0x1d344f(0xf0)])){const _0x2acc1c=_0x3b6e00[_0x1d344f(0xf0)][_0x219db0],_0x42cc5d=_0xdf939f(_0x219db0);if(_0x2acc1c[_0x1d344f(0x10e)]===_0x1d344f(0x166)&&_0x2acc1c['journeyActivationStepId']&&(isPendingActivationId(_0x2acc1c[_0x1d344f(0x198)])||_0x2acc1c['journeyActivationStepId']==='')){if(_0x42cc5d?.[_0x1d344f(0x198)]&&isPendingActivationId(_0x42cc5d[_0x1d344f(0x198)])){const _0x29b92d=extractPendingActivationName(_0x42cc5d[_0x1d344f(0x198)]),_0x326b29=_0x27ef75[_0x1d344f(0x1c9)](_0x29b92d);_0x326b29&&(_0x2acc1c[_0x1d344f(0x198)]=_0x326b29);}}if(_0x2acc1c[_0x1d344f(0x10e)]===_0x1d344f(0x142)&&_0x2acc1c[_0x1d344f(0x146)]&&_0x42cc5d?.[_0x1d344f(0x146)])for(let _0x3ea557=0x0;_0x3ea557<_0x2acc1c['branches'][_0x1d344f(0x12c)];_0x3ea557++){const _0x41428f=_0x2acc1c['branches'][_0x3ea557],_0x57ee62=_0x42cc5d[_0x1d344f(0x146)][_0x3ea557];if(_0x57ee62?.[_0x1d344f(0x104)]&&isPendingSegmentId(_0x57ee62['segmentId'])){const _0xd657fb=extractPendingSegmentName(_0x57ee62[_0x1d344f(0x104)]),_0x20efde=_0x4dadaf[_0x1d344f(0x1c9)](_0xd657fb);_0x20efde&&(_0x41428f[_0x1d344f(0x104)]=_0x20efde);}}}}}return _0x2fc5ee[_0x1d344f(0x135)]&&console[_0x1d344f(0x14f)]('\x20\x20Step\x203:\x20Updating\x20journey\x20with\x20entry\x20criteria\x20and\x20activation\x20IDs:\x20'+JSON[_0x1d344f(0xfc)](_0x13355c,null,0x2)),await _0x474725[_0x1d344f(0x188)][_0x1d344f(0x160)](_0x396b37,_0x13355c),{'action':_0x1d344f(0xff),'name':_0x328278[_0x1d344f(0x15c)][_0x1d344f(0x172)],'journeyId':_0x396b37};}else{ensureJourneyDefaults(_0x39a361[_0x1d344f(0x152)]);_0x2fc5ee[_0x1d344f(0x135)]&&console['error'](_0x1d344f(0x1d0)+JSON[_0x1d344f(0xfc)](_0x39a361,null,0x2));const _0x20e7ec=await _0x474725[_0x1d344f(0x188)][_0x1d344f(0xe7)](_0x39a361);return{'action':'created','name':_0x328278[_0x1d344f(0x15c)][_0x1d344f(0x172)],'journeyId':_0x20e7ec['id']};}}else{if(_0x328278[_0x1d344f(0x185)]&&_0x328278[_0x1d344f(0xf3)])return ensureJourneyDefaults(_0x39a361[_0x1d344f(0x152)]),await _0x474725['journey'][_0x1d344f(0x160)](_0x328278[_0x1d344f(0xf3)]['id'],_0x39a361),{'action':_0x1d344f(0x186),'name':_0x328278[_0x1d344f(0x15c)][_0x1d344f(0x172)],'journeyId':_0x328278[_0x1d344f(0xf3)]['id']};}return{'action':_0x1d344f(0x194),'name':_0x328278['yamlConfig'][_0x1d344f(0x172)],'journeyId':_0x328278[_0x1d344f(0xf3)]?.['id']};}catch(_0x92b1a6){const _0x3a0315=isHttp400Error(_0x92b1a6),_0x690e92=_0x3a0315?ErrorCode[_0x1d344f(0x101)]:ErrorCode[_0x1d344f(0x1c8)],_0x58d1a3=getErrorMessage(_0x92b1a6);throw new SDKError(_0x690e92,'Failed\x20to\x20'+(_0x328278[_0x1d344f(0x19b)]?'create':_0x1d344f(0x160))+_0x1d344f(0x153)+_0x328278[_0x1d344f(0x1a6)]+_0x1d344f(0x1c6)+_0x58d1a3,_0x92b1a6);}}));_0x58bc7e[_0x9888d(0xe2)](..._0x118fe4),_0x4ab869+=_0x3af869[_0x9888d(0x12c)],_0x282b86['setExtra']('('+_0x4ab869+'/'+_0x616dc1['length']+')');}return _0x58bc7e;},{'verbose':_0x2fc5ee[_0x6547e4(0x135)]});for(const _0x1230e1 of _0x372889[_0x6547e4(0x13c)]){if(_0x1230e1[_0x6547e4(0x1cc)]===_0x6547e4(0xff))console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x110)](_0x6547e4(0x19f)+_0x1230e1['name']+'\x27')),_0x5803e4++;else _0x1230e1[_0x6547e4(0x1cc)]===_0x6547e4(0x186)&&(console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x19d)](_0x6547e4(0x117)+_0x1230e1[_0x6547e4(0x172)]+'\x27')),_0x151043++);}if(_0x3fa3a4&&_0x372889[_0x6547e4(0x13c)]['length']===0x1){const _0x37bfcf=_0x372889[_0x6547e4(0x13c)][0x0];if(_0x37bfcf[_0x6547e4(0x128)]){const _0x379f5f=getConsoleNextUrl(_0x2fc5ee['site'],_0x6547e4(0x1d8)+_0x47019c+_0x6547e4(0x13f)+_0x37bfcf[_0x6547e4(0x128)]+'/j/da/je');console[_0x6547e4(0x14f)]('\x20\x20'+a36_0x572dba['cyan'](_0x379f5f));}}}for(const _0x2a8287 of _0x596d13){console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x19d)](_0x6547e4(0x1a9)+_0x2a8287[_0x6547e4(0x1ba)])),_0x3731a6++;}const _0x16e3a1=[];if(_0x3e27cc>0x0)_0x16e3a1[_0x6547e4(0xe2)](_0x3e27cc+_0x6547e4(0x143));if(_0x3f9c86>0x0)_0x16e3a1['push'](_0x3f9c86+_0x6547e4(0x1b7));if(_0x4fd6cc>0x0)_0x16e3a1[_0x6547e4(0xe2)](_0x4fd6cc+_0x6547e4(0x12d));const _0x114ead=[];if(_0x5803e4>0x0)_0x114ead[_0x6547e4(0xe2)](_0x5803e4+_0x6547e4(0x143));if(_0x151043>0x0)_0x114ead[_0x6547e4(0xe2)](_0x151043+_0x6547e4(0x1b7));if(_0x3731a6>0x0)_0x114ead[_0x6547e4(0xe2)](_0x3731a6+_0x6547e4(0x12d));const _0x23fd4a=[];if(_0x1651ec>0x0)_0x23fd4a[_0x6547e4(0xe2)](_0x1651ec+_0x6547e4(0x143));if(_0x50e902>0x0)_0x23fd4a['push'](_0x50e902+_0x6547e4(0x1b7));if(_0x467573>0x0)_0x23fd4a[_0x6547e4(0xe2)](_0x467573+_0x6547e4(0x12d));return console[_0x6547e4(0x14f)](a36_0x572dba[_0x6547e4(0x110)](_0x6547e4(0xe9))),_0x16e3a1[_0x6547e4(0x12c)]>0x0&&!_0x2fc5ee[_0x6547e4(0x176)]&&console[_0x6547e4(0x14f)](_0x6547e4(0x16c)+_0x16e3a1[_0x6547e4(0x1bb)](',\x20')),_0x114ead[_0x6547e4(0x12c)]>0x0&&console[_0x6547e4(0x14f)](_0x6547e4(0x18b)+_0x114ead[_0x6547e4(0x1bb)](',\x20')),_0x23fd4a[_0x6547e4(0x12c)]>0x0&&!_0x2fc5ee[_0x6547e4(0x176)]&&console[_0x6547e4(0x14f)](_0x6547e4(0x157)+_0x23fd4a['join'](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x1ea565){const _0x295756=a36_0x22d99d,_0x40d0b7=new Map(),_0x4f5926=new Map();for(const _0xce5c48 of _0x1ea565){_0x4f5926['set'](_0xce5c48['id'],_0xce5c48);}const _0x20757e=new Set();for(const _0x185fb0 of _0x1ea565){!_0x185fb0[_0x295756(0x190)]&&_0x20757e[_0x295756(0x1cd)](_0x185fb0['id']);}function _0x2d6d4f(_0x2e8b96){const _0x48c34d=_0x295756;if(_0x20757e['has'](_0x2e8b96['id']))return'';if(_0x2e8b96['parentFolderId']){const _0x59b152=_0x4f5926[_0x48c34d(0x1c9)](_0x2e8b96[_0x48c34d(0x190)]);if(_0x59b152){const _0x36d9c2=_0x2d6d4f(_0x59b152);return _0x36d9c2?_0x36d9c2+'/'+_0x2e8b96[_0x48c34d(0x172)]:_0x2e8b96['name'];}}return _0x2e8b96[_0x48c34d(0x172)];}for(const _0x18028a of _0x1ea565){const _0x40120b=_0x2d6d4f(_0x18028a);_0x40d0b7[_0x295756(0x119)](_0x40120b,_0x18028a['id']);}return _0x40d0b7;}function findYamlFiles(_0x50db7b){const _0x307ce9=[];function _0x31f2ba(_0x460db7){const _0x108a15=a36_0x6dbb,_0x4312e9=readdirSync(_0x460db7,{'withFileTypes':!![]});for(const _0x13c706 of _0x4312e9){const _0x4e159e=a36_0x1f36c2[_0x108a15(0x1bb)](_0x460db7,_0x13c706[_0x108a15(0x172)]);if(_0x13c706[_0x108a15(0x1b3)]())_0x31f2ba(_0x4e159e);else(_0x13c706[_0x108a15(0x172)]['endsWith'](_0x108a15(0x1b6))||_0x13c706[_0x108a15(0x172)]['endsWith'](_0x108a15(0x1c2)))&&_0x307ce9[_0x108a15(0xe2)](_0x4e159e);}}return _0x31f2ba(_0x50db7b),_0x307ce9;}function calculateActivationActions(_0x4e56ac,_0x2a8eac,_0x1da4e0,_0x1b8cef){const _0x1775a6=a36_0x22d99d,_0x3ed280=[],_0x5dabc6=new Map();for(const _0xb3208b of _0x2a8eac){_0x5dabc6[_0x1775a6(0x119)](_0xb3208b[_0x1775a6(0x172)],_0xb3208b);}const _0x1ec30b=new Map();for(const _0x584498 of _0x4e56ac){_0x1ec30b[_0x1775a6(0x119)](_0x584498[_0x1775a6(0x172)],_0x584498);}for(const _0x564b8a of _0x4e56ac){const _0x4d11cd=_0x5dabc6[_0x1775a6(0x1c9)](_0x564b8a[_0x1775a6(0x172)]);if(!_0x4d11cd)_0x3ed280[_0x1775a6(0xe2)]({'type':_0x1775a6(0xe7),'name':_0x564b8a[_0x1775a6(0x172)],'yamlActivation':_0x564b8a});else{const _0x323bb0=activationToYaml(_0x4d11cd,_0x1da4e0,_0x1b8cef),_0x55bfa7=a36_0x34bb63[_0x1775a6(0xfc)](_0x323bb0),_0x4f0a1a=a36_0x34bb63[_0x1775a6(0xfc)](_0x564b8a);_0x55bfa7!==_0x4f0a1a&&_0x3ed280[_0x1775a6(0xe2)]({'type':_0x1775a6(0x160),'name':_0x564b8a[_0x1775a6(0x172)],'yamlActivation':_0x564b8a,'existingActivation':_0x4d11cd});}}for(const _0x39a540 of _0x2a8eac){!_0x1ec30b[_0x1775a6(0x19a)](_0x39a540[_0x1775a6(0x172)])&&_0x3ed280[_0x1775a6(0xe2)]({'type':_0x1775a6(0x1a8),'name':_0x39a540[_0x1775a6(0x172)],'existingActivation':_0x39a540});}return _0x3ed280;}
1
+ const a36_0x1b85d6=a36_0x2e07;(function(_0x4ca45f,_0x43d4b4){const _0x6d12d3=a36_0x2e07,_0x433367=_0x4ca45f();while(!![]){try{const _0x4211bf=-parseInt(_0x6d12d3(0x94))/0x1+parseInt(_0x6d12d3(0xc9))/0x2*(parseInt(_0x6d12d3(0xde))/0x3)+-parseInt(_0x6d12d3(0xe8))/0x4*(-parseInt(_0x6d12d3(0xd3))/0x5)+parseInt(_0x6d12d3(0x169))/0x6*(parseInt(_0x6d12d3(0xf8))/0x7)+parseInt(_0x6d12d3(0x117))/0x8*(parseInt(_0x6d12d3(0x11b))/0x9)+parseInt(_0x6d12d3(0x12f))/0xa+-parseInt(_0x6d12d3(0xd5))/0xb*(parseInt(_0x6d12d3(0x166))/0xc);if(_0x4211bf===_0x43d4b4)break;else _0x433367['push'](_0x433367['shift']());}catch(_0x23daaf){_0x433367['push'](_0x433367['shift']());}}}(a36_0x46eb,0xbb7e5));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../sdk/errors.js';function a36_0x2e07(_0x10df94,_0x38ee2f){_0x10df94=_0x10df94-0x82;const _0x46eb1d=a36_0x46eb();let _0x2e07de=_0x46eb1d[_0x10df94];return _0x2e07de;}import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,journeyActivationStepToYaml,activationToYaml,apiRuleToYaml,yamlRuleToApi}from'../sdk/segment/child-segment-yaml.js';import{isJourneyYaml,parseYamlString as a36_0x166334,yamlToApi as a36_0x5c8cd4,toYamlString as a36_0x28cad5,apiToYamlAsync,hasMultipleVersions,normalizeJourneyYaml}from'../sdk/segment/journey-yaml.js';import a36_0x14aa77 from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a36_0x2ae80a from'path';import{getConsoleNextUrl}from'../types/endpoints.js';import*as a36_0x54a4c8 from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';const PENDING_SEGMENT_PREFIX=a36_0x1b85d6(0xf2);function createPendingSegmentId(_0x2fdfe0){return''+PENDING_SEGMENT_PREFIX+_0x2fdfe0+'__';}function isPendingSegmentId(_0x4bf0f3){const _0x41b60d=a36_0x1b85d6;return _0x4bf0f3[_0x41b60d(0x16a)](PENDING_SEGMENT_PREFIX);}function extractPendingSegmentName(_0x4e159d){return _0x4e159d['replace'](/^__pending_(.+)__$/,'$1');}const PENDING_ACTIVATION_PREFIX=a36_0x1b85d6(0x111);function createPendingActivationId(_0x407480){return''+PENDING_ACTIVATION_PREFIX+_0x407480+'__';}function isPendingActivationId(_0xa3e52a){const _0x8d2d3=a36_0x1b85d6;return _0xa3e52a[_0x8d2d3(0x16a)](PENDING_ACTIVATION_PREFIX);}function extractPendingActivationName(_0x29bb67){const _0x14f5fc=a36_0x1b85d6;return _0x29bb67[_0x14f5fc(0x157)](/^__pending_act_(.+)__$/,'$1');}function ensureJourneyDefaults(_0x4574c1){const _0x19fdd7=a36_0x1b85d6;!_0x4574c1[_0x19fdd7(0x15a)]&&(_0x4574c1[_0x19fdd7(0x15a)]=''),!_0x4574c1[_0x19fdd7(0x8f)]&&(_0x4574c1[_0x19fdd7(0x8f)]=_0x19fdd7(0x15e));}function tryFindTdxConfig(_0x2adc1e){try{return findTdxConfig(_0x2adc1e);}catch{return null;}}function resolveTDFolderPath(_0x12ae0c,_0x3b6896,_0x187a40){if(!_0x3b6896)return _0x12ae0c;return _0x12ae0c?_0x187a40+'/'+_0x12ae0c:_0x187a40;}export class SegmentPushCommand extends BaseCommand{[a36_0x1b85d6(0x8b)]='segment:push';['description']=a36_0x1b85d6(0xd4);async[a36_0x1b85d6(0xdd)](_0x4d51a4){const _0x5236b6=a36_0x1b85d6,{options:_0x4bbe6e,args:_0x20bbf7,tdx:_0x2d2cc1}=_0x4d51a4,_0x31d781=_0x4bbe6e,_0x4a863f=_0x4bbe6e['parentSegment'],_0x2d6c7b=_0x20bbf7[0x0];let _0x330ad6,_0x3c052a,_0x25cd83,_0x4f4db2;if(_0x2d6c7b){if(existsSync(_0x2d6c7b)&&statSync(_0x2d6c7b)[_0x5236b6(0x11e)]()){const _0x88ea8a=tryFindTdxConfig(_0x2d6c7b);if(_0x88ea8a)_0x330ad6=_0x88ea8a[_0x5236b6(0x10f)][_0x5236b6(0x96)],_0x3c052a=_0x2d6c7b,_0x25cd83=_0x88ea8a['configDir'];else return console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0xe9)+_0x2d6c7b+'\x0a')),console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xdb)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}else{if(existsSync(_0x2d6c7b)&&statSync(_0x2d6c7b)[_0x5236b6(0xf0)]()){const _0x2bcea3=a36_0x2ae80a['dirname'](_0x2d6c7b),_0x2ca6cf=tryFindTdxConfig(_0x2bcea3);if(_0x2ca6cf)_0x330ad6=_0x2ca6cf[_0x5236b6(0x10f)][_0x5236b6(0x96)],_0x25cd83=_0x2ca6cf[_0x5236b6(0x168)],_0x3c052a=_0x2ca6cf[_0x5236b6(0x168)],_0x4f4db2=a36_0x2ae80a[_0x5236b6(0x14f)](_0x2d6c7b);else return console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0xe9)+_0x2bcea3+'\x0a')),console[_0x5236b6(0x17a)](a36_0x14aa77['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}else _0x330ad6=_0x2d6c7b;}}else{const _0x59d039=tryFindTdxConfig(process[_0x5236b6(0x160)]());_0x59d039?(_0x330ad6=_0x59d039['config'][_0x5236b6(0x96)],_0x3c052a=process[_0x5236b6(0x160)](),_0x25cd83=_0x59d039['configDir']):_0x330ad6=_0x4a863f;}if(!_0x330ad6)return console['error'](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0x144))),console[_0x5236b6(0x17a)](_0x5236b6(0xfc)),console['error'](_0x5236b6(0x134)),console['error'](_0x5236b6(0x106)),0x1;const _0x3c9721=_0x3c052a||getSegmentRootDir(sanitizeFileName(_0x330ad6)),_0x5ce395=_0x25cd83||_0x3c9721,_0x9bc565=a36_0x2ae80a[_0x5236b6(0xb7)](_0x5ce395,_0x3c9721),_0x15b2a3=_0x9bc565!==''&&_0x9bc565!=='.';if(!existsSync(_0x3c9721))return console[_0x5236b6(0x17a)](a36_0x14aa77['red'](_0x5236b6(0xe4)+_0x3c9721+'\x0a')),console['error'](a36_0x14aa77[_0x5236b6(0xdb)](_0x5236b6(0xdf))),0x1;_0x31d781[_0x5236b6(0xd1)]&&(console[_0x5236b6(0x17a)](_0x5236b6(0x155)+_0x31d781['site']),console[_0x5236b6(0x17a)]('Parent\x20segment:\x20'+_0x330ad6),console[_0x5236b6(0x17a)](_0x5236b6(0x12a)+_0x3c9721),_0x15b2a3&&console['error'](_0x5236b6(0xe1)+_0x9bc565));const _0x13745f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x330ad6+'\x27...',()=>_0x2d2cc1[_0x5236b6(0xc3)][_0x5236b6(0x127)](_0x330ad6),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),_0x259939=_0x13745f[_0x5236b6(0xd2)],[_0x5c98d8,_0x1bee6f,_0x261501,_0x460d2f,_0x38e2a6]=await Promise[_0x5236b6(0xfd)]([withSpinner(_0x5236b6(0x140),()=>_0x2d2cc1[_0x5236b6(0xc3)][_0x5236b6(0x16b)](_0x259939),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),withSpinner(_0x5236b6(0xf9),()=>_0x2d2cc1[_0x5236b6(0xc3)]['listSegments'](_0x259939),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),withSpinner(_0x5236b6(0xa6),()=>_0x2d2cc1[_0x5236b6(0xc3)]['listFolders'](_0x259939),{'verbose':_0x31d781['verbose']}),withSpinner(_0x5236b6(0x109),()=>_0x2d2cc1[_0x5236b6(0xf4)][_0x5236b6(0x162)](_0x259939),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),withSpinner(_0x5236b6(0x116),()=>_0x2d2cc1[_0x5236b6(0xd9)]['buildUserMaps'](),{'verbose':_0x31d781[_0x5236b6(0xd1)]})[_0x5236b6(0x15c)](_0x525d51=>_0x525d51['data'])]),_0x9a7c84=_0x5c98d8['data'],_0x305bba=_0x9a7c84[_0x5236b6(0xb3)]?.[_0x5236b6(0xbf)]?.['data']?.['id']||_0x9a7c84[_0x5236b6(0xb3)]?.[_0x5236b6(0x130)]?.[_0x5236b6(0xd2)]?.['id'],_0x4719fe=_0x1bee6f[_0x5236b6(0xd2)],_0x532163=_0x261501[_0x5236b6(0xd2)],_0x2985d2=_0x460d2f[_0x5236b6(0xd2)],{emailToId:_0x3de427,idToEmail:_0x5304fc}=_0x38e2a6,[_0x1af15f,_0x57f4a8]=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x27bea8=_0x5236b6,[_0x3d121f,_0x2cb0bd]=await Promise[_0x27bea8(0xfd)]([_0x2d2cc1[_0x27bea8(0xac)]['buildNameToIdMap'](),_0x2d2cc1[_0x27bea8(0xac)]['buildIdToNameMap']()]);return[_0x3d121f,_0x2cb0bd];},{'verbose':_0x31d781['verbose']})['then'](_0x1928ca=>_0x1928ca[_0x5236b6(0xd2)]),_0x35ed4e=buildFolderPathToIdMap(_0x532163),_0x82c039=new Map();for(const [_0x2b0990,_0x5815e5]of _0x35ed4e['entries']()){_0x82c039[_0x5236b6(0x129)](_0x5815e5,_0x2b0990);}const _0x4938f4=new Map();for(const _0x1f3f58 of _0x4719fe){const _0xc10ebd=_0x1f3f58[_0x5236b6(0x137)]?_0x82c039[_0x5236b6(0xe3)](_0x1f3f58[_0x5236b6(0x137)][_0x5236b6(0xa7)]())||'':'',_0x5bf5c1=_0xc10ebd+':'+_0x1f3f58['name'];_0x4938f4[_0x5236b6(0x129)](_0x5bf5c1,_0x1f3f58);}const _0x59114f=new Map();for(const _0x4cecc4 of _0x4719fe){_0x59114f[_0x5236b6(0x129)](_0x4cecc4[_0x5236b6(0x8b)],_0x4cecc4['id']);}const _0x3aeaf2=new Map();for(const _0x25e19c of _0x2985d2){const _0x29f12b=_0x25e19c['folderId']?_0x82c039[_0x5236b6(0xe3)](_0x25e19c[_0x5236b6(0x10a)])||'':'',_0x549d0e=_0x29f12b+':'+_0x25e19c['journeyBundleName'];!_0x3aeaf2[_0x5236b6(0xa4)](_0x549d0e)&&_0x3aeaf2[_0x5236b6(0x129)](_0x549d0e,[]),_0x3aeaf2[_0x5236b6(0xe3)](_0x549d0e)[_0x5236b6(0x177)](_0x25e19c);}for(const _0x39fbcc of _0x3aeaf2[_0x5236b6(0x149)]()){_0x39fbcc[_0x5236b6(0x89)]((_0x30d05a,_0x486efb)=>(_0x30d05a[_0x5236b6(0xeb)]||0x0)-(_0x486efb[_0x5236b6(0xeb)]||0x0));}let _0x3dcd62;if(_0x4f4db2){if(!_0x4f4db2[_0x5236b6(0xb6)](_0x5236b6(0xf1))&&!_0x4f4db2[_0x5236b6(0xb6)](_0x5236b6(0x121)))return console['error'](a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0xed)+_0x4f4db2+'\x0a')),0x1;_0x3dcd62=[_0x4f4db2];}else _0x3dcd62=findYamlFiles(_0x3c9721);if(_0x3dcd62['length']===0x0)return console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0x170)+_0x3c9721+'\x0a')),console[_0x5236b6(0x17a)](a36_0x14aa77['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;const _0x43f315=[],_0x515ead=[];for(const _0x1ee5e1 of _0x3dcd62){const _0x58a22d=a36_0x2ae80a[_0x5236b6(0xb7)](_0x3c9721,a36_0x2ae80a[_0x5236b6(0xb2)](_0x1ee5e1)),_0x59346d=_0x58a22d==='.'?'':_0x58a22d,_0x4797a8=readFileSync(_0x1ee5e1,_0x5236b6(0x135));try{const _0x2f6da=a36_0x54a4c8['parse'](_0x4797a8);if(isJourneyYaml(_0x2f6da)){const _0x14a17a=a36_0x166334(_0x4797a8);_0x515ead[_0x5236b6(0x177)]({'yamlConfig':_0x14a17a,'folderPath':_0x59346d,'sourcePath':_0x1ee5e1});}else{if(!_0x31d781[_0x5236b6(0x92)]){const _0xe6e65=parseSegmentYamlFile(_0x4797a8),_0x33253f=normalizeChildSegmentYaml(_0xe6e65);_0x43f315[_0x5236b6(0x177)]({'yamlConfig':_0x33253f,'folderPath':_0x59346d,'sourcePath':_0x1ee5e1});}}}catch(_0xac61df){return console[_0x5236b6(0x17a)](a36_0x14aa77['red'](_0x5236b6(0xb8)+_0x1ee5e1+':\x20'+(_0xac61df instanceof Error?_0xac61df[_0x5236b6(0x161)]:_0xac61df))),0x1;}}if(_0x43f315['length']===0x0&&_0x515ead['length']===0x0){const _0x64305f=_0x31d781[_0x5236b6(0x92)]?_0x5236b6(0xf4):_0x5236b6(0x146);return console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0x148)+_0x64305f+'\x20YAML\x20files\x20found')),0x0;}const _0x1b9ef7=new Map();_0x4719fe['length']>0x0&&!_0x31d781['journeysOnly']&&await withSpinner(_0x5236b6(0xae),async()=>{await batchAsync(_0x4719fe,async _0x2b4d1f=>{const _0x46f49e=a36_0x2e07,_0x55e5ae=await _0x2d2cc1[_0x46f49e(0xc3)][_0x46f49e(0x141)](_0x259939,_0x2b4d1f['id']);_0x1b9ef7[_0x46f49e(0x129)](_0x2b4d1f['id'],_0x55e5ae);});},{'verbose':_0x31d781[_0x5236b6(0xd1)]});const _0x1a8248=[],_0x520d50=new Set();for(const {yamlConfig:_0x629ce8,folderPath:_0x2fe62f,sourcePath:_0x836fa7}of _0x43f315){const _0x4ec3c6=resolveTDFolderPath(_0x2fe62f,_0x15b2a3,_0x9bc565),_0x4a0472=_0x4ec3c6+':'+_0x629ce8[_0x5236b6(0x8b)],_0x245d2e=_0x4938f4[_0x5236b6(0xe3)](_0x4a0472),_0x9f17ce=_0x245d2e?_0x1b9ef7[_0x5236b6(0xe3)](_0x245d2e['id'])||[]:[];if(_0x4ec3c6&&!_0x35ed4e[_0x5236b6(0xa4)](_0x4ec3c6)){const _0x5b8916=_0x4ec3c6[_0x5236b6(0x108)]('/');let _0x243c37='';for(const _0x2116e6 of _0x5b8916){_0x243c37=_0x243c37?_0x243c37+'/'+_0x2116e6:_0x2116e6,!_0x35ed4e[_0x5236b6(0xa4)](_0x243c37)&&_0x520d50[_0x5236b6(0xb1)](_0x243c37);}}const _0x1ff7ce=calculateActivationActions(_0x629ce8['activations']||[],_0x9f17ce,_0x5304fc,_0x57f4a8),_0x4102b3=segmentToYamlString(_0x629ce8);let _0xc1dc11,_0x68bb25=![],_0x5cbbbd;if(_0x245d2e){const _0x12ddb9=segmentWithActivationsToYaml(_0x245d2e,_0x9f17ce,undefined,_0x5304fc,_0x57f4a8),_0x370e8=segmentToYamlString(_0x12ddb9);_0xc1dc11=generateDiff(_0x370e8,_0x4102b3),_0x68bb25=hasChanges(_0xc1dc11),_0x68bb25&&(_0x5cbbbd=formatDiffWithColors(_0xc1dc11));}else _0xc1dc11=generateDiff('',_0x4102b3),_0x5cbbbd=formatDiffWithColors(_0xc1dc11);_0x1a8248[_0x5236b6(0x177)]({'relativePath':_0x629ce8[_0x5236b6(0x8b)],'absolutePath':_0x836fa7,'yamlConfig':_0x629ce8,'folderPath':_0x4ec3c6,'existingSegment':_0x245d2e,'existingActivations':_0x9f17ce,'isNew':!_0x245d2e,'hasChanges':_0x68bb25,'diff':_0x5cbbbd,'activationActions':_0x1ff7ce});}let _0x5834d5=[];if(!_0x4f4db2){const _0x36e44c=new Set();for(const {yamlConfig:_0x14b8c3,folderPath:_0x3cca83}of _0x43f315){const _0x1b4c4b=resolveTDFolderPath(_0x3cca83,_0x15b2a3,_0x9bc565);_0x36e44c[_0x5236b6(0xb1)](_0x1b4c4b+':'+_0x14b8c3['name']);}_0x5834d5=_0x4719fe[_0x5236b6(0xf3)](_0x3ab117=>{const _0x33623a=_0x5236b6,_0x565446=_0x3ab117[_0x33623a(0x137)]?_0x82c039[_0x33623a(0xe3)](_0x3ab117[_0x33623a(0x137)][_0x33623a(0xa7)]())||'':'',_0x272959=_0x565446+':'+_0x3ab117[_0x33623a(0x8b)];if(_0x36e44c[_0x33623a(0xa4)](_0x272959))return![];if(_0x15b2a3)return _0x565446===_0x9bc565||_0x565446[_0x33623a(0x16a)](_0x9bc565+'/');return!![];});}const _0x1e2451=[];for(const {yamlConfig:_0x228363,folderPath:_0x4e9266,sourcePath:_0x317350}of _0x515ead){const _0x5b1609=resolveTDFolderPath(_0x4e9266,_0x15b2a3,_0x9bc565),_0x311a47=_0x5b1609+':'+_0x228363['name'],_0x4ced7f=_0x3aeaf2[_0x5236b6(0xe3)](_0x311a47);let _0x599644,_0x4974c4;if(_0x4ced7f&&_0x4ced7f[_0x5236b6(0x110)]>0x0){const _0x4a5561=new Set(),_0xe69ee5=new Set(),_0x3bc3aa=new Map(),_0x2dfdb7=new Map(),_0x3845e=createJumpTargetCache(),_0x5c0d30=_0x147533=>({'resolveSegment':async _0x14938f=>{const _0x89923=_0x5236b6,_0x4bef28=_0x2dfdb7[_0x89923(0xe3)](_0x14938f);if(_0x4bef28!==undefined)return{'name':_0x4bef28,'isJourneyLocal':!![]};try{let _0x334b26=_0x4719fe[_0x89923(0xc1)](_0x465336=>_0x465336['id']===_0x14938f);!_0x334b26&&(_0x334b26=await _0x2d2cc1[_0x89923(0xc3)][_0x89923(0x172)](_0x259939,_0x14938f));const _0x285be9=generateJourneyLocalName(_0x334b26[_0x89923(0x8b)]),_0x4e89e9=_0x334b26[_0x89923(0x112)]===SEGMENT_KIND_JOURNEY&&_0x285be9!==undefined;let _0x259c16=_0x334b26[_0x89923(0x8b)];if(_0x4e89e9&&_0x285be9){let _0x320f97=_0x285be9,_0x3b815b=0x2;while(_0x4a5561[_0x89923(0xa4)](_0x320f97)){_0x320f97=_0x285be9+'_'+_0x3b815b,_0x3b815b++;}_0x4a5561[_0x89923(0xb1)](_0x320f97),_0x259c16=_0x320f97,_0x2dfdb7[_0x89923(0x129)](_0x14938f,_0x259c16);}let _0x467d87;return _0x4e89e9&&_0x334b26['rule']&&(_0x467d87={'description':_0x334b26[_0x89923(0x15a)],'rule':apiRuleToYaml(_0x334b26[_0x89923(0xf5)])}),{'name':_0x259c16,'isJourneyLocal':_0x4e89e9,'definition':_0x467d87};}catch{return{'name':_0x14938f,'isJourneyLocal':![]};}},'resolveActivation':async _0x58ed50=>{const _0x5538a2=_0x5236b6,_0x1ee52b=_0x3bc3aa['get'](_0x58ed50);if(_0x1ee52b!==undefined)return{'name':_0x1ee52b,'isJourneyLocal':!![]};try{const _0x197e97=await _0x2d2cc1[_0x5538a2(0xf4)][_0x5538a2(0x125)](_0x147533,_0x58ed50),_0x3b0792=_0x197e97[_0x5538a2(0xc6)]['activationParams'][_0x5538a2(0x8b)]||_0x58ed50,_0x1dc0e5=sanitizeYamlKey(_0x3b0792)||_0x5538a2(0xcc)+_0x58ed50;let _0x388ec9=_0x1dc0e5,_0x44d479=0x2;while(_0xe69ee5[_0x5538a2(0xa4)](_0x388ec9)){_0x388ec9=_0x1dc0e5+'_'+_0x44d479,_0x44d479++;}_0xe69ee5[_0x5538a2(0xb1)](_0x388ec9),_0x3bc3aa['set'](_0x58ed50,_0x388ec9);const _0x2d8281=journeyActivationStepToYaml(_0x197e97,_0x5304fc,_0x57f4a8);return{'name':_0x388ec9,'isJourneyLocal':!![],'definition':_0x2d8281};}catch{return{'name':_0x58ed50,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x1ea8ae,_0x12ebd0)=>resolveJumpTarget(_0x1ea8ae,_0x12ebd0,_0x3845e,_0x595641=>_0x2d2cc1['journey'][_0x5236b6(0x179)](_0x595641))}),_0x14b39a=hasMultipleVersions(_0x228363);if(_0x14b39a&&_0x4ced7f[_0x5236b6(0x110)]>0x1){const _0x3c5abc=[];for(const _0x514e42 of _0x4ced7f){const _0x93752e=await withSpinner(_0x5236b6(0x84)+_0x228363[_0x5236b6(0x8b)]+_0x5236b6(0x153)+(_0x514e42[_0x5236b6(0xeb)]||0x1)+_0x5236b6(0x154),()=>_0x2d2cc1['journey'][_0x5236b6(0x179)](_0x514e42['id']),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),_0x100985=_0x5c0d30(_0x514e42['id']),_0x31c7c2=await apiToYamlAsync(_0x93752e[_0x5236b6(0xd2)],_0x100985);_0x3c5abc[_0x5236b6(0x177)]({'item':_0x514e42,'yaml':_0x31c7c2});}_0x4974c4=buildMergedJourneyYaml(_0x3c5abc);const _0x4832c0=Math[_0x5236b6(0x171)](..._0x3c5abc['map'](_0x3f56b5=>_0x3f56b5['item'][_0x5236b6(0xeb)]||0x0)),_0x576ca0=_0x4ced7f[_0x5236b6(0xc1)](_0x45f00f=>(_0x45f00f[_0x5236b6(0xeb)]||0x0)===_0x4832c0);_0x576ca0&&(_0x599644=await _0x2d2cc1[_0x5236b6(0xf4)]['getJourney'](_0x576ca0['id']));}else{const _0x8ec4da=_0x4ced7f[_0x4ced7f[_0x5236b6(0x110)]-0x1],_0x27b091=await withSpinner(_0x5236b6(0x84)+_0x228363['name']+_0x5236b6(0x10b),()=>_0x2d2cc1[_0x5236b6(0xf4)][_0x5236b6(0x179)](_0x8ec4da['id']),{'verbose':_0x31d781['verbose']});_0x599644=_0x27b091[_0x5236b6(0xd2)];const _0x3e33e3=_0x5c0d30(_0x8ec4da['id']);_0x4974c4=await apiToYamlAsync(_0x599644,_0x3e33e3);}}if(_0x5b1609&&!_0x35ed4e[_0x5236b6(0xa4)](_0x5b1609)){const _0x3e7a4b=_0x5b1609[_0x5236b6(0x108)]('/');let _0x5f0974='';for(const _0x9f0c4d of _0x3e7a4b){_0x5f0974=_0x5f0974?_0x5f0974+'/'+_0x9f0c4d:_0x9f0c4d,!_0x35ed4e[_0x5236b6(0xa4)](_0x5f0974)&&_0x520d50[_0x5236b6(0xb1)](_0x5f0974);}}const _0x531816=normalizeJourneyYaml(_0x228363),_0x12a0d7=a36_0x28cad5(_0x531816);let _0xe8681a=![],_0x558820;if(_0x4974c4){const _0x1e4ba8=normalizeJourneyYaml(_0x4974c4),_0x353630=a36_0x28cad5(_0x1e4ba8),_0x2debea=generateDiff(_0x353630,_0x12a0d7);_0xe8681a=hasChanges(_0x2debea),_0xe8681a&&(_0x558820=formatDiffWithColors(_0x2debea));}else{const _0x5b5bce=generateDiff('',_0x12a0d7);_0x558820=formatDiffWithColors(_0x5b5bce);}_0x1e2451['push']({'relativePath':_0x228363[_0x5236b6(0x8b)],'absolutePath':_0x317350,'yamlConfig':_0x228363,'folderPath':_0x5b1609,'existingJourney':_0x599644,'isNew':!_0x599644,'hasChanges':_0xe8681a,'diff':_0x558820});}let _0x412f0b=[];if(!_0x4f4db2){const _0x3810d4=new Set();for(const {yamlConfig:_0x4091c5,folderPath:_0x2b4eec}of _0x515ead){const _0x319bdb=resolveTDFolderPath(_0x2b4eec,_0x15b2a3,_0x9bc565);_0x3810d4['add'](_0x319bdb+':'+_0x4091c5[_0x5236b6(0x8b)]);}_0x412f0b=_0x2985d2[_0x5236b6(0xf3)](_0x1c7cc9=>{const _0x47d19b=_0x5236b6,_0x3381e7=_0x1c7cc9[_0x47d19b(0x10a)]?_0x82c039[_0x47d19b(0xe3)](_0x1c7cc9[_0x47d19b(0x10a)])||'':'',_0x3df948=_0x3381e7+':'+_0x1c7cc9[_0x47d19b(0x13e)];if(_0x3810d4[_0x47d19b(0xa4)](_0x3df948))return![];if(_0x15b2a3)return _0x3381e7===_0x9bc565||_0x3381e7[_0x47d19b(0x16a)](_0x9bc565+'/');return!![];});}const _0x240648=_0x1a8248['filter'](_0x4586a4=>_0x4586a4[_0x5236b6(0xca)]),_0x17ad4b=_0x1a8248[_0x5236b6(0xf3)](_0x289128=>!_0x289128['isNew']&&_0x289128['hasChanges']),_0x2375da=_0x1a8248['filter'](_0x3a4c7a=>!_0x3a4c7a['isNew']&&!_0x3a4c7a[_0x5236b6(0x93)]),_0x4bf9c5=Array[_0x5236b6(0xa0)](_0x520d50)[_0x5236b6(0x89)](),_0x39c4c6=_0x31d781[_0x5236b6(0x174)]?_0x5834d5:[],_0x295b53=_0x31d781[_0x5236b6(0x174)]?_0x412f0b:[],_0x41c30b=_0x1a8248[_0x5236b6(0x14c)](_0x31ec06=>_0x31ec06[_0x5236b6(0x11c)]),_0x3258e9=_0x41c30b[_0x5236b6(0xf3)](_0x25fd51=>_0x25fd51[_0x5236b6(0x142)]===_0x5236b6(0x15b)),_0x592f65=_0x41c30b[_0x5236b6(0xf3)](_0x2707e7=>_0x2707e7[_0x5236b6(0x142)]===_0x5236b6(0xb5)),_0x2c6bc5=_0x41c30b[_0x5236b6(0xf3)](_0x1161b0=>_0x1161b0[_0x5236b6(0x142)]===_0x5236b6(0x174)),_0x115291=_0x1e2451[_0x5236b6(0xf3)](_0x27ee53=>_0x27ee53[_0x5236b6(0xca)]),_0x39066e=_0x1e2451['filter'](_0x4c89ff=>!_0x4c89ff[_0x5236b6(0xca)]&&_0x4c89ff['hasChanges']),_0x1e6bba=_0x1e2451[_0x5236b6(0xf3)](_0x35ab30=>!_0x35ab30[_0x5236b6(0xca)]&&!_0x35ab30['hasChanges']);console[_0x5236b6(0x17a)]('\x0aPush\x20summary\x20for\x20\x27'+_0x330ad6+'\x27:');_0x4bf9c5[_0x5236b6(0x110)]>0x0&&console[_0x5236b6(0x17a)]('\x20\x20'+a36_0x14aa77['blue'](_0x5236b6(0x158)+_0x4bf9c5['length']+_0x5236b6(0x14e)));if(!_0x31d781[_0x5236b6(0x92)]){console[_0x5236b6(0x17a)]('\x20\x20📊\x20Segments:'),console['error'](_0x5236b6(0x151)+a36_0x14aa77['green']('+\x20'+_0x240648[_0x5236b6(0x110)]+_0x5236b6(0xd0))),console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77['yellow']('~\x20'+_0x17ad4b['length']+_0x5236b6(0x107)));if(_0x39c4c6['length']>0x0)console['error']('\x20\x20\x20\x20'+a36_0x14aa77[_0x5236b6(0xff)]('-\x20'+_0x39c4c6[_0x5236b6(0x110)]+'\x20to\x20delete'));else _0x5834d5[_0x5236b6(0x110)]>0x0&&!_0x31d781[_0x5236b6(0x174)]&&console[_0x5236b6(0x17a)]('\x20\x20\x20\x20'+a36_0x14aa77[_0x5236b6(0xef)](_0x5834d5[_0x5236b6(0x110)]+_0x5236b6(0x9b)));console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xef)]('=\x20'+_0x2375da[_0x5236b6(0x110)]+_0x5236b6(0xba)));}if(_0x1e2451[_0x5236b6(0x110)]>0x0||_0x412f0b[_0x5236b6(0x110)]>0x0){console[_0x5236b6(0x17a)](_0x5236b6(0xbd)),console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0x114)]('+\x20'+_0x115291[_0x5236b6(0x110)]+_0x5236b6(0xd0))),console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xe0)]('~\x20'+_0x39066e[_0x5236b6(0x110)]+_0x5236b6(0x107)));if(_0x295b53[_0x5236b6(0x110)]>0x0)console['error'](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xff)]('-\x20'+_0x295b53[_0x5236b6(0x110)]+_0x5236b6(0x105)));else _0x412f0b[_0x5236b6(0x110)]>0x0&&!_0x31d781[_0x5236b6(0x174)]&&console['error'](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xef)](_0x412f0b[_0x5236b6(0x110)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xef)]('=\x20'+_0x1e6bba[_0x5236b6(0x110)]+_0x5236b6(0xba)));}_0x41c30b['length']>0x0&&!_0x31d781[_0x5236b6(0x92)]&&(console[_0x5236b6(0x17a)](''),console['error'](_0x5236b6(0x98)),_0x3258e9[_0x5236b6(0x110)]>0x0&&console['error'](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0x114)]('+\x20'+_0x3258e9['length']+_0x5236b6(0xd8))),_0x592f65['length']>0x0&&console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xe0)]('~\x20'+_0x592f65[_0x5236b6(0x110)]+_0x5236b6(0x118))),_0x2c6bc5[_0x5236b6(0x110)]>0x0&&console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77['red']('-\x20'+_0x2c6bc5[_0x5236b6(0x110)]+_0x5236b6(0x105))));console[_0x5236b6(0x17a)](_0x5236b6(0x165)+a36_0x14aa77['cyan'](_0x3c9721)+'\x0a');if(_0x4bf9c5[_0x5236b6(0x110)]>0x0){console['error'](_0x5236b6(0x102));for(const _0x4a00e9 of _0x4bf9c5){console[_0x5236b6(0x17a)]('\x20\x20'+a36_0x14aa77[_0x5236b6(0x16e)]('+')+'\x20'+_0x4a00e9);}console[_0x5236b6(0x17a)]('');}if(_0x240648[_0x5236b6(0x110)]>0x0&&!_0x31d781['journeysOnly'])for(const _0xd7eb71 of _0x240648){const _0x2c327e=_0xd7eb71[_0x5236b6(0xc4)]?_0xd7eb71['folderPath']+'/'+_0xd7eb71[_0x5236b6(0x131)]['name']:_0xd7eb71['yamlConfig']['name'],_0x5a1372=_0xd7eb71[_0x5236b6(0x131)][_0x5236b6(0x99)]?.[_0x5236b6(0x110)]||0x0,_0x57bde4=_0x5a1372>0x0?a36_0x14aa77[_0x5236b6(0xef)]('\x20['+_0x5a1372+_0x5236b6(0x8d)):'';console[_0x5236b6(0x17a)]('\x0a'+a36_0x14aa77[_0x5236b6(0x114)](_0x5236b6(0x16d))+'\x20'+_0x2c327e+_0x57bde4),console[_0x5236b6(0x17a)]('─'['repeat'](0x3c)),_0xd7eb71[_0x5236b6(0xfe)]&&console['error'](_0xd7eb71['diff']),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c));}if(_0x39c4c6[_0x5236b6(0x110)]>0x0&&!_0x31d781[_0x5236b6(0x92)])for(const _0x2d1ba0 of _0x39c4c6){const _0x93c82b=_0x2d1ba0['segmentFolderId']?_0x82c039[_0x5236b6(0xe3)](_0x2d1ba0[_0x5236b6(0x137)]['toString']())||'':'',_0x3d972c=_0x93c82b?_0x93c82b+'/'+_0x2d1ba0['name']:_0x2d1ba0[_0x5236b6(0x8b)],_0x54f838=_0x1b9ef7[_0x5236b6(0xe3)](_0x2d1ba0['id'])||[],_0x47df2c=_0x54f838[_0x5236b6(0x110)]>0x0?a36_0x14aa77[_0x5236b6(0xef)]('\x20['+_0x54f838[_0x5236b6(0x110)]+_0x5236b6(0x8d)):'';console[_0x5236b6(0x17a)]('\x0a'+a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0x13c))+'\x20'+_0x3d972c+_0x47df2c),console['error']('─'[_0x5236b6(0x14d)](0x3c));const _0x7a0217=segmentWithActivationsToYaml(_0x2d1ba0,_0x54f838,undefined,_0x5304fc,_0x57f4a8),_0x5f258d=segmentToYamlString(_0x7a0217),_0x26ec6b=generateDiff(_0x5f258d,'');console['error'](formatDiffWithColors(_0x26ec6b)),console['error']('─'[_0x5236b6(0x14d)](0x3c));}const _0x185406=_0x1a8248[_0x5236b6(0xf3)](_0x27a70b=>!_0x27a70b[_0x5236b6(0xca)]&&_0x27a70b[_0x5236b6(0xfe)]);if(_0x185406[_0x5236b6(0x110)]>0x0&&!_0x31d781['journeysOnly'])for(const _0x1abacb of _0x185406){const _0x432522=_0x1abacb[_0x5236b6(0xc4)]?_0x1abacb[_0x5236b6(0xc4)]+'/'+_0x1abacb[_0x5236b6(0x131)][_0x5236b6(0x8b)]:_0x1abacb[_0x5236b6(0x131)][_0x5236b6(0x8b)];console[_0x5236b6(0x17a)]('\x0a'+a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0x143))+'\x20'+_0x432522),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c)),console['error'](_0x1abacb[_0x5236b6(0xfe)]),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c));}if(_0x115291[_0x5236b6(0x110)]>0x0)for(const _0x23f238 of _0x115291){const _0x5f291b=_0x23f238[_0x5236b6(0xc4)]?_0x23f238['folderPath']+'/'+_0x23f238[_0x5236b6(0x131)][_0x5236b6(0x8b)]:_0x23f238[_0x5236b6(0x131)]['name'];console[_0x5236b6(0x17a)]('\x0a'+a36_0x14aa77[_0x5236b6(0x114)]('New\x20journey:')+'\x20'+_0x5f291b),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c)),_0x23f238[_0x5236b6(0xfe)]&&console[_0x5236b6(0x17a)](_0x23f238[_0x5236b6(0xfe)]),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c));}const _0x246a47=_0x1e2451[_0x5236b6(0xf3)](_0x272188=>!_0x272188[_0x5236b6(0xca)]&&_0x272188['diff']);if(_0x246a47[_0x5236b6(0x110)]>0x0)for(const _0x48c107 of _0x246a47){const _0x3aae54=_0x48c107[_0x5236b6(0xc4)]?_0x48c107['folderPath']+'/'+_0x48c107['yamlConfig'][_0x5236b6(0x8b)]:_0x48c107[_0x5236b6(0x131)]['name'];console[_0x5236b6(0x17a)]('\x0a'+a36_0x14aa77[_0x5236b6(0xe0)]('Changes\x20to\x20journey:')+'\x20'+_0x3aae54),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c)),console[_0x5236b6(0x17a)](_0x48c107[_0x5236b6(0xfe)]),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c));}if(_0x295b53['length']>0x0)for(const _0x412b70 of _0x295b53){const _0xb11da3=_0x412b70[_0x5236b6(0x10a)]?_0x82c039['get'](_0x412b70['folderId'])||'':'',_0x274270=_0xb11da3?_0xb11da3+'/'+_0x412b70[_0x5236b6(0x13e)]:_0x412b70[_0x5236b6(0x13e)];console['error']('\x0a'+a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0xc7))+'\x20'+_0x274270),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c)),console[_0x5236b6(0x17a)](a36_0x14aa77['red'](_0x5236b6(0x86))),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c));}if(_0x31d781[_0x5236b6(0x101)])return console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0x167))),0x0;const _0x1ef9c5=_0x31d781[_0x5236b6(0x92)]?![]:_0x240648[_0x5236b6(0x110)]>0x0||_0x17ad4b[_0x5236b6(0x110)]>0x0||_0x39c4c6[_0x5236b6(0x110)]>0x0,_0x3d54b0=_0x115291['length']>0x0||_0x39066e['length']>0x0||_0x295b53[_0x5236b6(0x110)]>0x0,_0x768976=_0x31d781['journeysOnly']?![]:_0x41c30b[_0x5236b6(0x110)]>0x0,_0x4fceb8=_0x4bf9c5[_0x5236b6(0x110)]>0x0;if(!_0x1ef9c5&&!_0x3d54b0&&!_0x768976&&!_0x4fceb8){const _0x2064e1=_0x31d781['journeysOnly']?_0x5236b6(0xa9):'✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0x114)](_0x2064e1));if(_0x4f4db2&&_0x1e6bba[_0x5236b6(0x110)]===0x1){const _0x5bd274=_0x1e6bba[0x0];if(_0x5bd274['existingJourney']?.['id']){const _0x337fc8=getConsoleNextUrl(_0x31d781[_0x5236b6(0x115)],_0x5236b6(0x175)+_0x259939+_0x5236b6(0x138)+_0x5bd274[_0x5236b6(0x9e)]['id']+'/j/da/je');console[_0x5236b6(0x17a)]('\x20\x20'+a36_0x14aa77[_0x5236b6(0xdb)](_0x337fc8));}}return 0x0;}const _0x5db71e=_0x31d781[_0x5236b6(0x92)]?_0x115291[_0x5236b6(0x110)]+_0x39066e[_0x5236b6(0x110)]+_0x295b53['length']+_0x4bf9c5[_0x5236b6(0x110)]:_0x240648[_0x5236b6(0x110)]+_0x17ad4b[_0x5236b6(0x110)]+_0x39c4c6['length']+_0x115291[_0x5236b6(0x110)]+_0x39066e[_0x5236b6(0x110)]+_0x295b53['length']+_0x4bf9c5['length']+_0x41c30b['length'];if(!_0x31d781[_0x5236b6(0x16f)]&&_0x5db71e>0x0){const _0x4743b3=await confirmKey(_0x5236b6(0x100)+_0x5db71e+_0x5236b6(0xe7));if(!_0x4743b3)return console[_0x5236b6(0x17a)](_0x5236b6(0xce)),0x1;}for(const _0x888d46 of _0x4bf9c5){const _0x478b4c=_0x888d46[_0x5236b6(0x108)]('/'),_0xd72fbc=_0x478b4c[_0x478b4c[_0x5236b6(0x110)]-0x1],_0x156293=_0x478b4c[_0x5236b6(0x159)](0x0,-0x1)[_0x5236b6(0xcf)]('/'),_0x6c92a8=_0x35ed4e[_0x5236b6(0xe3)](_0x156293),_0x4425fb={'name':_0xd72fbc,'parentFolderId':_0x6c92a8},_0x48d639=await withSpinner(_0x5236b6(0x88)+_0x888d46+_0x5236b6(0xe6),()=>_0x2d2cc1['segment'][_0x5236b6(0xda)](_0x259939,_0x4425fb),{'verbose':_0x31d781['verbose']});_0x35ed4e[_0x5236b6(0x129)](_0x888d46,_0x48d639[_0x5236b6(0xd2)]['id']),console['error'](a36_0x14aa77[_0x5236b6(0x16e)](_0x5236b6(0x15f)+_0x888d46+'\x27'));}let _0x4758e=0x0,_0xdf1352=0x0,_0x5bcc2d=0x0,_0x322b00=0x0,_0x46e7ef=0x0,_0x57e467=0x0;const _0x3c1c96=new Map();for(const _0x5f4d11 of _0x31d781[_0x5236b6(0x92)]?[]:_0x1a8248){const _0x351925=_0x5f4d11[_0x5236b6(0xc4)]?_0x35ed4e[_0x5236b6(0xe3)](_0x5f4d11[_0x5236b6(0xc4)]):undefined;let _0x902148;try{if(_0x5f4d11[_0x5236b6(0xca)]){const _0x286a86=yamlToCreateRequest(_0x5f4d11[_0x5236b6(0x131)],_0x351925),_0x4a8f42=await withSpinner(_0x5236b6(0x136)+_0x5f4d11[_0x5236b6(0x131)][_0x5236b6(0x8b)]+_0x5236b6(0xe6),()=>_0x2d2cc1[_0x5236b6(0xc3)]['createSegment'](_0x259939,_0x286a86),{'verbose':_0x31d781[_0x5236b6(0xd1)]});_0x902148=_0x4a8f42[_0x5236b6(0xd2)]['id'],_0x3c1c96[_0x5236b6(0x129)](_0x5f4d11[_0x5236b6(0x131)]['name'],_0x902148),console['error'](a36_0x14aa77[_0x5236b6(0x114)]('✔\x20Created\x20segment\x20\x27'+_0x5f4d11[_0x5236b6(0x131)][_0x5236b6(0x8b)]+'\x27')),_0x4758e++;}else{if(_0x5f4d11[_0x5236b6(0x93)]){const _0x476135=yamlToUpdateRequest(_0x5f4d11[_0x5236b6(0x131)]);_0x351925!==_0x5f4d11[_0x5236b6(0x128)]?.[_0x5236b6(0x137)]&&(_0x476135['segmentFolderId']=_0x351925?parseInt(_0x351925,0xa):undefined),await withSpinner('Updating\x20segment\x20\x27'+_0x5f4d11[_0x5236b6(0x131)]['name']+_0x5236b6(0xe6),()=>_0x2d2cc1[_0x5236b6(0xc3)][_0x5236b6(0xa1)](_0x259939,_0x5f4d11[_0x5236b6(0x128)]['id'],_0x476135),{'verbose':_0x31d781['verbose']}),_0x902148=_0x5f4d11[_0x5236b6(0x128)]['id'],console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0xbe)+_0x5f4d11[_0x5236b6(0x131)][_0x5236b6(0x8b)]+'\x27')),_0xdf1352++;}else _0x902148=_0x5f4d11[_0x5236b6(0x128)]['id'];}}catch(_0xe64047){const _0x3a85cc=isHttp400Error(_0xe64047),_0x51364e=_0x3a85cc?ErrorCode[_0x5236b6(0x119)]:ErrorCode[_0x5236b6(0xb9)],_0x2178e6=getErrorMessage(_0xe64047);throw new SDKError(_0x51364e,_0x5236b6(0xab)+(_0x5f4d11[_0x5236b6(0xca)]?_0x5236b6(0x15b):_0x5236b6(0xb5))+'\x20segment\x20from\x20file:\x20'+_0x5f4d11[_0x5236b6(0xc8)]+'\x0a\x20\x20'+_0x2178e6,_0xe64047);}for(const _0x1d924c of _0x5f4d11['activationActions']){try{if(_0x1d924c[_0x5236b6(0x142)]===_0x5236b6(0x15b)&&_0x1d924c[_0x5236b6(0xa5)]){const _0x4b1132=yamlActivationToCreateRequest(_0x1d924c[_0x5236b6(0xa5)],_0x3de427,_0x1af15f);await withSpinner(_0x5236b6(0x176)+_0x1d924c[_0x5236b6(0x8b)]+'\x27...',()=>_0x2d2cc1['segment']['createActivation'](_0x259939,_0x902148,_0x4b1132),{'verbose':_0x31d781['verbose']}),console['error'](a36_0x14aa77[_0x5236b6(0x114)]('\x20\x20✔\x20Created\x20activation\x20\x27'+_0x1d924c[_0x5236b6(0x8b)]+'\x27')),_0x322b00++;}else{if(_0x1d924c[_0x5236b6(0x142)]===_0x5236b6(0xb5)&&_0x1d924c[_0x5236b6(0xa5)]&&_0x1d924c[_0x5236b6(0x9c)]){const _0x3f65db=yamlActivationToUpdateRequest(_0x1d924c[_0x5236b6(0xa5)],_0x3de427,_0x1af15f);await withSpinner(_0x5236b6(0x9a)+_0x1d924c[_0x5236b6(0x8b)]+_0x5236b6(0xe6),()=>_0x2d2cc1[_0x5236b6(0xc3)]['updateActivation'](_0x259939,_0x902148,_0x1d924c[_0x5236b6(0x9c)]['id'],_0x3f65db),{'verbose':_0x31d781['verbose']}),console['error'](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0xc0)+_0x1d924c['name']+'\x27')),_0x46e7ef++;}else _0x1d924c[_0x5236b6(0x142)]===_0x5236b6(0x174)&&_0x1d924c[_0x5236b6(0x9c)]&&(await withSpinner(_0x5236b6(0x16c)+_0x1d924c[_0x5236b6(0x8b)]+_0x5236b6(0xe6),()=>_0x2d2cc1[_0x5236b6(0xc3)][_0x5236b6(0x15d)](_0x259939,_0x902148,_0x1d924c[_0x5236b6(0x9c)]['id']),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0x9f)+_0x1d924c[_0x5236b6(0x8b)]+'\x27')),_0x57e467++);}}catch(_0xd9f6fa){const _0x7cca5e=isHttp400Error(_0xd9f6fa),_0x26531b=_0x7cca5e?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x45acbd=getErrorMessage(_0xd9f6fa);throw new SDKError(_0x26531b,'Failed\x20to\x20'+_0x1d924c['type']+_0x5236b6(0x14b)+_0x1d924c[_0x5236b6(0x8b)]+'\x27\x20from\x20file:\x20'+_0x5f4d11[_0x5236b6(0xc8)]+_0x5236b6(0x12d)+_0x45acbd,_0xd9f6fa);}}}for(const _0x38b49a of _0x31d781[_0x5236b6(0x92)]?[]:_0x39c4c6){await withSpinner(_0x5236b6(0x8c)+_0x38b49a[_0x5236b6(0x8b)]+'\x27...',()=>_0x2d2cc1[_0x5236b6(0xc3)]['deleteSegment'](_0x38b49a['id']),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),console[_0x5236b6(0x17a)](a36_0x14aa77['red'](_0x5236b6(0x13f)+_0x38b49a[_0x5236b6(0x8b)]+'\x27')),_0x5bcc2d++;}let _0x34d4fd=0x0,_0x14eef1=0x0,_0x2747ca=0x0;const _0x3a1fb8=new Map(_0x59114f);for(const _0xf2f11a of _0x1a8248){_0xf2f11a[_0x5236b6(0xca)]&&_0x3c1c96[_0x5236b6(0xa4)](_0xf2f11a[_0x5236b6(0x131)]['name'])&&_0x3a1fb8['set'](_0xf2f11a[_0x5236b6(0x131)]['name'],_0x3c1c96[_0x5236b6(0xe3)](_0xf2f11a[_0x5236b6(0x131)][_0x5236b6(0x8b)]));}if(_0x1e2451['length']>0x0){const _0x5adce5=await withQuerySpinner(_0x5236b6(0x13b),async _0x53c66c=>{const _0x4f1d02=_0x5236b6,_0x47e881=[];let _0x45274c=0x0;const _0x3637b2=0x5;for(let _0x53808c=0x0;_0x53808c<_0x1e2451[_0x4f1d02(0x110)];_0x53808c+=_0x3637b2){const _0x26b226=_0x1e2451[_0x4f1d02(0x159)](_0x53808c,_0x53808c+_0x3637b2),_0x416f44=await Promise[_0x4f1d02(0xfd)](_0x26b226[_0x4f1d02(0xf6)](async _0xab5155=>{const _0x463fe4=_0x4f1d02;if(!_0xab5155[_0x463fe4(0xca)]&&!_0xab5155[_0x463fe4(0x93)])return{'action':_0x463fe4(0xf7),'name':_0xab5155['yamlConfig'][_0x463fe4(0x8b)],'journeyId':_0xab5155['existingJourney']?.['id']};const _0x2f3065=_0xab5155[_0x463fe4(0xc4)]?_0x35ed4e[_0x463fe4(0xe3)](_0xab5155[_0x463fe4(0xc4)]):undefined,_0xa92f69=_0xab5155[_0x463fe4(0xca)]?_0x463fe4(0x103):_0x463fe4(0x13a);_0x53c66c[_0x463fe4(0xfa)](_0xa92f69+_0x463fe4(0xec)+_0xab5155[_0x463fe4(0x131)][_0x463fe4(0x8b)]+'\x27');const _0x407e74=new Map(),_0x31677c=new Map(),_0x2a2f04=new Map(),_0x52adb2={'resolveSegmentId':async _0x54fe3e=>{const _0x2700f7=_0x463fe4,_0x41facd=_0x3a1fb8[_0x2700f7(0xe3)](_0x54fe3e);if(!_0x41facd)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x54fe3e+_0x2700f7(0x90)+_0xab5155[_0x2700f7(0x131)][_0x2700f7(0x8b)]+')');return _0x41facd;},'resolveEmbeddedSegmentId':async(_0x570534,_0x486e16)=>{const _0x291c4a=_0x463fe4,_0x5b0f57=_0x3a1fb8['get'](_0x570534);if(_0x5b0f57)return _0x5b0f57;const _0x4556b4=_0x4719fe[_0x291c4a(0xc1)](_0x3fddf9=>_0x3fddf9['name']===_0x570534);if(_0x4556b4)return _0x3a1fb8[_0x291c4a(0x129)](_0x570534,_0x4556b4['id']),_0x4556b4['id'];if(_0xab5155[_0x291c4a(0xca)]){const _0x59f8f2=_0xab5155['yamlConfig']['stages']||_0xab5155[_0x291c4a(0x131)]['journeys']?.[0x0]?.[_0x291c4a(0xea)]||[];let _0x397cbc=_0x291c4a(0x150),_0x15bb79=_0x570534;for(const _0x3d99d5 of _0x59f8f2){if(_0x3d99d5[_0x291c4a(0x8a)]?.[_0x291c4a(0xc3)]===_0x570534){_0x397cbc=_0x3d99d5[_0x291c4a(0x8b)],_0x15bb79=_0x3d99d5['entry_criteria'][_0x291c4a(0x8b)]||_0x570534;break;}}return _0x31677c['set'](_0x570534,{'definition':_0x486e16,'stageName':_0x397cbc,'criteriaName':_0x15bb79}),createPendingSegmentId(_0x570534);}const _0x300861=_0xab5155['existingJourney']?.['id'];if(!_0x300861)throw new SDKError(ErrorCode[_0x291c4a(0x95)],_0x291c4a(0xc2));const _0x2f88f4=_0x291c4a(0x8e)+crypto[_0x291c4a(0x124)]();try{const _0x2a5a74=await _0x2d2cc1[_0x291c4a(0xc3)]['createJourneySegment']({'name':_0x2f88f4,'description':_0x486e16['description']||_0x291c4a(0x97)+_0x570534,'journeyId':_0x300861,'rule':yamlRuleToApi(_0x486e16[_0x291c4a(0xf5)],!![]),'countPopulation':!![],'parentFolderId':_0x305bba||'','audienceId':_0x259939});return _0x31d781[_0x291c4a(0xd1)]&&console['error'](_0x291c4a(0x85)+_0x570534+_0x291c4a(0x12e)+_0x2f88f4+_0x291c4a(0xbc)+_0x2a5a74),_0x3a1fb8[_0x291c4a(0x129)](_0x570534,_0x2a5a74),_0x2a5a74;}catch(_0x173831){throw new SDKError(ErrorCode[_0x291c4a(0xb9)],_0x291c4a(0xe2)+_0x570534+_0x291c4a(0x83)+getErrorMessage(_0x173831),_0x173831);}},'resolveActivationId':async _0x181d22=>{const _0x428f61=_0x463fe4,_0x192c82=_0x407e74[_0x428f61(0xe3)](_0x181d22);if(_0x192c82)return _0x192c82;if(_0xab5155[_0x428f61(0x9e)]){const _0x3541c8=await _0x2d2cc1['journey'][_0x428f61(0x141)](_0xab5155[_0x428f61(0x9e)]['id']),_0x1310c6=_0x3541c8[_0x428f61(0xc1)](_0x35037f=>_0x35037f[_0x428f61(0xc6)]['activationParams']?.[_0x428f61(0x8b)]===_0x181d22);if(_0x1310c6)return _0x407e74[_0x428f61(0x129)](_0x181d22,_0x1310c6['id']),_0x1310c6['id'];}throw new SDKError(ErrorCode[_0x428f61(0x113)],_0x428f61(0x120)+_0x181d22+_0x428f61(0x90)+_0xab5155[_0x428f61(0x131)]['name']+').\x20'+_0x428f61(0x132));},'resolveEmbeddedActivationId':async(_0x3eecce,_0x514936)=>{const _0x4b3e62=_0x463fe4,_0x36f27e=_0x407e74['get'](_0x3eecce);if(_0x36f27e)return _0x36f27e;if(_0xab5155[_0x4b3e62(0xca)])return _0x2a2f04[_0x4b3e62(0x129)](_0x3eecce,_0x514936),createPendingActivationId(_0x3eecce);if(_0xab5155[_0x4b3e62(0x9e)]){const _0x39a263=await _0x2d2cc1[_0x4b3e62(0xf4)][_0x4b3e62(0x141)](_0xab5155['existingJourney']['id']),_0x1474f8=_0x39a263[_0x4b3e62(0xc1)](_0x385ad4=>_0x385ad4[_0x4b3e62(0xc6)][_0x4b3e62(0xaa)]?.['name']===_0x514936['name']);if(_0x1474f8)return _0x407e74[_0x4b3e62(0x129)](_0x3eecce,_0x1474f8['id']),_0x1474f8['id'];try{const _0x2ab39a=yamlActivationToCreateRequest(_0x514936,_0x3de427,_0x1af15f),_0xd9790e=await _0x2d2cc1[_0x4b3e62(0xf4)][_0x4b3e62(0x133)](_0xab5155['existingJourney']['id'],_0x2ab39a);return _0x31d781['verbose']&&console[_0x4b3e62(0x17a)](_0x4b3e62(0xfb)+_0x3eecce+_0x4b3e62(0xc5)+_0xd9790e['id']),_0x407e74['set'](_0x3eecce,_0xd9790e['id']),_0xd9790e['id'];}catch(_0x105f67){throw new SDKError(ErrorCode[_0x4b3e62(0xcd)],_0x4b3e62(0xb0)+_0x3eecce+_0x4b3e62(0x83)+getErrorMessage(_0x105f67),_0x105f67);}}throw new SDKError(ErrorCode[_0x4b3e62(0x95)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x3a5ace=>{const _0x306b1a=_0x463fe4;try{return await _0x2d2cc1[_0x306b1a(0xf4)][_0x306b1a(0x173)](_0x259939,_0x3a5ace);}catch(_0x30e09a){throw new SDKError(ErrorCode[_0x306b1a(0x113)],_0x306b1a(0x14a)+_0x3a5ace+_0x306b1a(0x123)+_0xab5155[_0x306b1a(0x131)][_0x306b1a(0x8b)]+'\x27)',_0x30e09a);}},'resolveStageId':async(_0x523977,_0x40acc)=>{const _0x40fc07=_0x463fe4,_0x154838=await _0x2d2cc1[_0x40fc07(0xf4)][_0x40fc07(0x179)](_0x523977),_0x2d617b=_0x154838[_0x40fc07(0xc6)]['journeyStages']['find'](_0x2a717d=>_0x2a717d[_0x40fc07(0x8b)][_0x40fc07(0xa8)]()===_0x40acc[_0x40fc07(0xa8)]());if(!_0x2d617b?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x40fc07(0xb4)+_0x40acc+_0x40fc07(0xa2)+(_0x154838[_0x40fc07(0xc6)][_0x40fc07(0x13e)]||_0x154838['attributes'][_0x40fc07(0x8b)])+'\x27');return _0x2d617b['id'];}};try{const _0x4a24b7=await a36_0x5c8cd4(_0xab5155[_0x463fe4(0x131)],_0x259939,_0x52adb2),_0x3df15a=_0x2f3065||_0x305bba;_0x3df15a&&(_0x4a24b7[_0x463fe4(0xb3)]={'parentFolder':{'data':{'id':_0x3df15a,'type':_0x463fe4(0x10c)}}});if(_0xab5155[_0x463fe4(0xca)]){if(_0x31677c['size']>0x0||_0x2a2f04['size']>0x0){const _0x4ea910=JSON[_0x463fe4(0x122)](JSON[_0x463fe4(0x12b)](_0x4a24b7));ensureJourneyDefaults(_0x4ea910[_0x463fe4(0xc6)]);for(const _0x2450d5 of _0x4ea910['attributes'][_0x463fe4(0xcb)]){_0x2450d5[_0x463fe4(0x87)]?.['segmentId']&&isPendingSegmentId(_0x2450d5[_0x463fe4(0x87)][_0x463fe4(0x163)])&&delete _0x2450d5[_0x463fe4(0x87)];if(_0x2450d5[_0x463fe4(0xe5)])for(const _0x46d2e6 of Object[_0x463fe4(0x91)](_0x2450d5['steps'])){const _0x739856=_0x2450d5[_0x463fe4(0xe5)][_0x46d2e6];_0x739856[_0x463fe4(0x142)]===_0x463fe4(0x9d)&&_0x739856[_0x463fe4(0xdc)]&&isPendingActivationId(_0x739856['journeyActivationStepId'])&&(_0x739856[_0x463fe4(0xdc)]='');if(_0x739856['type']===_0x463fe4(0x145)&&_0x739856[_0x463fe4(0x11a)])for(const _0x360e27 of _0x739856[_0x463fe4(0x11a)]){_0x360e27[_0x463fe4(0x163)]&&isPendingSegmentId(_0x360e27[_0x463fe4(0x163)])&&(_0x360e27[_0x463fe4(0x163)]='');}}}_0x31d781['verbose']&&console[_0x463fe4(0x17a)](_0x463fe4(0x152)+JSON[_0x463fe4(0x12b)](_0x4ea910,null,0x2));const _0x23180e=await _0x2d2cc1['journey']['create'](_0x4ea910),_0x38b9b2=_0x23180e['id'],_0x5656a3=new Map();for(const _0x3d4e9f of _0x23180e['attributes'][_0x463fe4(0xcb)]){_0x5656a3['set'](_0x3d4e9f[_0x463fe4(0x8b)][_0x463fe4(0xa8)](),_0x3d4e9f['id']);}const _0x55dfbf=new Map();for(const [_0x30e34d,{definition:_0x2e8ad2,criteriaName:_0x9181ba}]of _0x31677c){const _0x336911=generateJourneyLocalName(_0x9181ba)||_0x463fe4(0x8e)+crypto[_0x463fe4(0x124)]();_0x31d781[_0x463fe4(0xd1)]&&console['error']('\x20\x20Step\x202:\x20Creating\x20embedded\x20segment\x20\x27'+_0x30e34d+_0x463fe4(0x12e)+_0x336911+_0x463fe4(0x126)+_0x38b9b2);const _0x12073a=await _0x2d2cc1[_0x463fe4(0xc3)]['createJourneySegment']({'name':_0x336911,'description':_0x2e8ad2[_0x463fe4(0x15a)]||_0x463fe4(0x97)+_0x30e34d,'journeyId':_0x38b9b2,'rule':yamlRuleToApi(_0x2e8ad2['rule'],!![]),'countPopulation':!![],'parentFolderId':_0x3df15a||'','audienceId':_0x259939});_0x55dfbf['set'](_0x30e34d,_0x12073a),_0x3a1fb8[_0x463fe4(0x129)](_0x30e34d,_0x12073a),_0x31d781[_0x463fe4(0xd1)]&&console[_0x463fe4(0x17a)](_0x463fe4(0x85)+_0x30e34d+_0x463fe4(0xc5)+_0x12073a);}const _0x11c5ac=new Map();for(const [_0x44e398,_0x4d00ca]of _0x2a2f04){_0x31d781[_0x463fe4(0xd1)]&&console[_0x463fe4(0x17a)](_0x463fe4(0x82)+_0x44e398+_0x463fe4(0x11d)+_0x38b9b2);try{const _0x5c93cc=yamlActivationToCreateRequest(_0x4d00ca,_0x3de427,_0x1af15f),_0x5c3241=await _0x2d2cc1[_0x463fe4(0xf4)]['createActivation'](_0x38b9b2,_0x5c93cc);_0x11c5ac[_0x463fe4(0x129)](_0x44e398,_0x5c3241['id']),_0x407e74[_0x463fe4(0x129)](_0x44e398,_0x5c3241['id']),_0x31d781[_0x463fe4(0xd1)]&&console[_0x463fe4(0x17a)](_0x463fe4(0xfb)+_0x44e398+_0x463fe4(0xc5)+_0x5c3241['id']);}catch(_0x2bcdb7){throw new SDKError(ErrorCode['JOURNEY_UPDATE_ERROR'],'Failed\x20to\x20create\x20embedded\x20activation\x20\x27'+_0x44e398+'\x27:\x20'+getErrorMessage(_0x2bcdb7),_0x2bcdb7);}}const _0x50ef66=JSON[_0x463fe4(0x122)](JSON['stringify'](_0x4a24b7));_0x50ef66['id']=_0x38b9b2,ensureJourneyDefaults(_0x50ef66[_0x463fe4(0xc6)]);for(const _0x283fee of _0x50ef66['attributes'][_0x463fe4(0xcb)]){const _0x660fa9=_0x5656a3[_0x463fe4(0xe3)](_0x283fee[_0x463fe4(0x8b)][_0x463fe4(0xa8)]());_0x660fa9&&(_0x283fee['id']=_0x660fa9);if(_0x283fee['entryCriteria']?.[_0x463fe4(0x163)]&&isPendingSegmentId(_0x283fee[_0x463fe4(0x87)]['segmentId'])){const _0x1a4d2b=extractPendingSegmentName(_0x283fee['entryCriteria'][_0x463fe4(0x163)]),_0x1949a7=_0x55dfbf[_0x463fe4(0xe3)](_0x1a4d2b);_0x1949a7&&(_0x283fee[_0x463fe4(0x87)][_0x463fe4(0x163)]=_0x1949a7);}if(_0x283fee['steps']){const _0x2ea5f2=_0x1ddf0b=>_0x4a24b7[_0x463fe4(0xc6)][_0x463fe4(0xcb)][_0x463fe4(0xc1)](_0x514f80=>_0x514f80[_0x463fe4(0x8b)][_0x463fe4(0xa8)]()===_0x283fee[_0x463fe4(0x8b)][_0x463fe4(0xa8)]())?.['steps']?.[_0x1ddf0b];for(const _0x41f048 of Object[_0x463fe4(0x91)](_0x283fee[_0x463fe4(0xe5)])){const _0x2c4a4b=_0x283fee[_0x463fe4(0xe5)][_0x41f048],_0x2b9e73=_0x2ea5f2(_0x41f048);if(_0x2c4a4b[_0x463fe4(0x142)]===_0x463fe4(0x9d)&&_0x2c4a4b[_0x463fe4(0xdc)]&&(isPendingActivationId(_0x2c4a4b[_0x463fe4(0xdc)])||_0x2c4a4b[_0x463fe4(0xdc)]==='')){if(_0x2b9e73?.[_0x463fe4(0xdc)]&&isPendingActivationId(_0x2b9e73[_0x463fe4(0xdc)])){const _0x47a096=extractPendingActivationName(_0x2b9e73[_0x463fe4(0xdc)]),_0x5e49fc=_0x11c5ac[_0x463fe4(0xe3)](_0x47a096);_0x5e49fc&&(_0x2c4a4b[_0x463fe4(0xdc)]=_0x5e49fc);}}if(_0x2c4a4b[_0x463fe4(0x142)]===_0x463fe4(0x145)&&_0x2c4a4b[_0x463fe4(0x11a)]&&_0x2b9e73?.[_0x463fe4(0x11a)])for(let _0x168e7e=0x0;_0x168e7e<_0x2c4a4b[_0x463fe4(0x11a)][_0x463fe4(0x110)];_0x168e7e++){const _0x9a3e22=_0x2c4a4b[_0x463fe4(0x11a)][_0x168e7e],_0x4210cc=_0x2b9e73[_0x463fe4(0x11a)][_0x168e7e];if(_0x4210cc?.['segmentId']&&isPendingSegmentId(_0x4210cc[_0x463fe4(0x163)])){const _0x4942da=extractPendingSegmentName(_0x4210cc[_0x463fe4(0x163)]),_0x184fc4=_0x55dfbf['get'](_0x4942da);_0x184fc4&&(_0x9a3e22[_0x463fe4(0x163)]=_0x184fc4);}}}}}return _0x31d781[_0x463fe4(0xd1)]&&console['error'](_0x463fe4(0xbb)+JSON['stringify'](_0x50ef66,null,0x2)),await _0x2d2cc1['journey'][_0x463fe4(0xb5)](_0x38b9b2,_0x50ef66),{'action':_0x463fe4(0x164),'name':_0xab5155[_0x463fe4(0x131)][_0x463fe4(0x8b)],'journeyId':_0x38b9b2};}else{ensureJourneyDefaults(_0x4a24b7[_0x463fe4(0xc6)]);_0x31d781['verbose']&&console['error'](_0x463fe4(0x178)+JSON[_0x463fe4(0x12b)](_0x4a24b7,null,0x2));const _0x4a896e=await _0x2d2cc1[_0x463fe4(0xf4)][_0x463fe4(0x15b)](_0x4a24b7);return{'action':_0x463fe4(0x164),'name':_0xab5155[_0x463fe4(0x131)][_0x463fe4(0x8b)],'journeyId':_0x4a896e['id']};}}else{if(_0xab5155[_0x463fe4(0x93)]&&_0xab5155[_0x463fe4(0x9e)])return ensureJourneyDefaults(_0x4a24b7[_0x463fe4(0xc6)]),await _0x2d2cc1[_0x463fe4(0xf4)][_0x463fe4(0xb5)](_0xab5155['existingJourney']['id'],_0x4a24b7),{'action':'updated','name':_0xab5155['yamlConfig'][_0x463fe4(0x8b)],'journeyId':_0xab5155[_0x463fe4(0x9e)]['id']};}return{'action':'unchanged','name':_0xab5155[_0x463fe4(0x131)][_0x463fe4(0x8b)],'journeyId':_0xab5155[_0x463fe4(0x9e)]?.['id']};}catch(_0x58622a){const _0x4b6d2=isHttp400Error(_0x58622a),_0x128066=_0x4b6d2?ErrorCode[_0x463fe4(0xad)]:ErrorCode[_0x463fe4(0xcd)],_0x184ebe=getErrorMessage(_0x58622a);throw new SDKError(_0x128066,'Failed\x20to\x20'+(_0xab5155[_0x463fe4(0xca)]?_0x463fe4(0x15b):_0x463fe4(0xb5))+_0x463fe4(0x11f)+_0xab5155[_0x463fe4(0xc8)]+_0x463fe4(0x12d)+_0x184ebe,_0x58622a);}}));_0x47e881[_0x4f1d02(0x177)](..._0x416f44),_0x45274c+=_0x26b226[_0x4f1d02(0x110)],_0x53c66c[_0x4f1d02(0x139)]('('+_0x45274c+'/'+_0x1e2451[_0x4f1d02(0x110)]+')');}return _0x47e881;},{'verbose':_0x31d781[_0x5236b6(0xd1)]});for(const _0x4c770a of _0x5adce5['data']){if(_0x4c770a[_0x5236b6(0x147)]===_0x5236b6(0x164))console[_0x5236b6(0x17a)](a36_0x14aa77['green'](_0x5236b6(0xd6)+_0x4c770a[_0x5236b6(0x8b)]+'\x27')),_0x34d4fd++;else _0x4c770a['action']==='updated'&&(console['error'](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0xd7)+_0x4c770a[_0x5236b6(0x8b)]+'\x27')),_0x14eef1++);}if(_0x4f4db2&&_0x5adce5[_0x5236b6(0xd2)]['length']===0x1){const _0x5af31c=_0x5adce5[_0x5236b6(0xd2)][0x0];if(_0x5af31c[_0x5236b6(0x10d)]){const _0x4a528c=getConsoleNextUrl(_0x31d781[_0x5236b6(0x115)],'/app/ps/'+_0x259939+'/e/'+_0x5af31c['journeyId']+_0x5236b6(0xee));console['error']('\x20\x20'+a36_0x14aa77['cyan'](_0x4a528c));}}}for(const _0x472a21 of _0x295b53){console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0x12c)+_0x472a21[_0x5236b6(0x13e)])),_0x2747ca++;}const _0x1ff027=[];if(_0x4758e>0x0)_0x1ff027[_0x5236b6(0x177)](_0x4758e+_0x5236b6(0x10e));if(_0xdf1352>0x0)_0x1ff027[_0x5236b6(0x177)](_0xdf1352+_0x5236b6(0xaf));if(_0x5bcc2d>0x0)_0x1ff027[_0x5236b6(0x177)](_0x5bcc2d+_0x5236b6(0x156));const _0x3e2bc2=[];if(_0x34d4fd>0x0)_0x3e2bc2[_0x5236b6(0x177)](_0x34d4fd+_0x5236b6(0x10e));if(_0x14eef1>0x0)_0x3e2bc2[_0x5236b6(0x177)](_0x14eef1+_0x5236b6(0xaf));if(_0x2747ca>0x0)_0x3e2bc2[_0x5236b6(0x177)](_0x2747ca+_0x5236b6(0x156));const _0x4be22a=[];if(_0x322b00>0x0)_0x4be22a[_0x5236b6(0x177)](_0x322b00+'\x20created');if(_0x46e7ef>0x0)_0x4be22a['push'](_0x46e7ef+_0x5236b6(0xaf));if(_0x57e467>0x0)_0x4be22a['push'](_0x57e467+_0x5236b6(0x156));return console[_0x5236b6(0x17a)](a36_0x14aa77['green'](_0x5236b6(0x104))),_0x1ff027['length']>0x0&&!_0x31d781[_0x5236b6(0x92)]&&console[_0x5236b6(0x17a)]('\x20\x20Segments:\x20'+_0x1ff027[_0x5236b6(0xcf)](',\x20')),_0x3e2bc2[_0x5236b6(0x110)]>0x0&&console[_0x5236b6(0x17a)]('\x20\x20Journeys:\x20'+_0x3e2bc2[_0x5236b6(0xcf)](',\x20')),_0x4be22a[_0x5236b6(0x110)]>0x0&&!_0x31d781['journeysOnly']&&console['error'](_0x5236b6(0x13d)+_0x4be22a[_0x5236b6(0xcf)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x4d6e94){const _0x53e7ea=a36_0x1b85d6,_0x465799=new Map(),_0x68a4b5=new Map();for(const _0x4d9f68 of _0x4d6e94){_0x68a4b5['set'](_0x4d9f68['id'],_0x4d9f68);}const _0x1f5351=new Set();for(const _0x5ad7cd of _0x4d6e94){!_0x5ad7cd[_0x53e7ea(0xa3)]&&_0x1f5351[_0x53e7ea(0xb1)](_0x5ad7cd['id']);}function _0xc977c4(_0x230e12){const _0x61447e=_0x53e7ea;if(_0x1f5351['has'](_0x230e12['id']))return'';if(_0x230e12[_0x61447e(0xa3)]){const _0x1c2f4b=_0x68a4b5[_0x61447e(0xe3)](_0x230e12['parentFolderId']);if(_0x1c2f4b){const _0x54da29=_0xc977c4(_0x1c2f4b);return _0x54da29?_0x54da29+'/'+_0x230e12[_0x61447e(0x8b)]:_0x230e12[_0x61447e(0x8b)];}}return _0x230e12[_0x61447e(0x8b)];}for(const _0x115d69 of _0x4d6e94){const _0x7c5fdd=_0xc977c4(_0x115d69);_0x465799[_0x53e7ea(0x129)](_0x7c5fdd,_0x115d69['id']);}return _0x465799;}function a36_0x46eb(){const _0x4b92ad=['journey_entry_criteria_','state','\x20(referenced\x20in\x20journey\x20','keys','journeysOnly','hasChanges','332565DkVQtA','INTERNAL','parent_segment','Entry\x20criteria:\x20','\x20\x20Activations:','activations','Updating\x20activation\x20\x27','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','existingActivation','Activation','existingJourney','\x20\x20✔\x20Deleted\x20activation\x20\x27','from','updateSegmentById','\x27\x20not\x20found\x20in\x20journey\x20\x27','parentFolderId','has','yamlActivation','Fetching\x20existing\x20folders...','toString','toLowerCase','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','activationParams','Failed\x20to\x20','connection','JOURNEY_SYNTAX_ERROR','Fetching\x20existing\x20activations...','\x20updated','Failed\x20to\x20create\x20embedded\x20activation\x20\x27','add','dirname','relationships','Stage\x20\x27','update','endsWith','relative','Error\x20parsing\x20','SEGMENT_UPDATE_ERROR','\x20unchanged','\x20\x20Step\x203:\x20Updating\x20journey\x20with\x20entry\x20criteria\x20and\x20activation\x20IDs:\x20',')\x20with\x20ID:\x20','\x20\x20🗺️\x20\x20Journeys:','✔\x20Updated\x20segment\x20\x27','parentSegmentFolder','\x20\x20✔\x20Updated\x20activation\x20\x27','find','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','segment','folderPath','\x27\x20with\x20ID:\x20','attributes','Delete\x20journey:','absolutePath','2BwtAQC','isNew','journeyStages','activation_','JOURNEY_UPDATE_ERROR','Aborted.','join','\x20new','verbose','data','5HBGOIY','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','187uoTGeZ','✔\x20Created\x20journey\x20\x27','✔\x20Updated\x20journey\x20\x27','\x20to\x20create','user','createFolder','cyan','journeyActivationStepId','execute','2086566YviyNJ','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','yellow','Scoped\x20to\x20folder:\x20','Failed\x20to\x20create\x20embedded\x20segment\x20\x27','get','Error:\x20Directory\x20not\x20found:\x20','steps','\x27...','\x20changes?','5227764wZPOUk','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','stages','versionNumber','\x20journey\x20\x27','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','/j/da/je','dim','isFile','.yml','__pending_','filter','journey','rule','map','unchanged','7NKEKFO','Fetching\x20existing\x20segments...','setPhase','\x20\x20Created\x20embedded\x20activation\x20\x27','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','all','diff','red','Push\x20','dryRun','Folders\x20to\x20create:','Creating','\x0a✔\x20Push\x20complete','\x20to\x20delete','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','\x20changed','split','Fetching\x20existing\x20journeys...','folderId','\x27\x20details...','folder','journeyId','\x20created','config','length','__pending_act_','kind','NOT_FOUND','green','site','Fetching\x20users\x20for\x20email\x20resolution...','29872gLzAGe','\x20to\x20update','SEGMENT_SYNTAX_ERROR','branches','2799hbTwXU','activationActions','\x27\x20with\x20journeyId:\x20','isDirectory','\x20journey\x20from\x20file:\x20','Activation\x20not\x20found:\x20','.yaml','parse','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','randomUUID','getActivation',')\x20with\x20journeyId:\x20','resolveParentId','existingSegment','set','Source\x20directory:\x20','stringify','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','\x0a\x20\x20','\x27\x20(internal:\x20','13565960TeHiPU','parentFolder','yamlConfig','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','createActivation','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','utf-8','Creating\x20segment\x20\x27','segmentFolderId','/e/','setExtra','Updating','Pushing\x20journeys...','Delete\x20segment:','\x20\x20Activations:\x20','journeyBundleName','✔\x20Deleted\x20segment\x20\x27','Fetching\x20parent\x20segment\x20details...','listActivations','type','Changes\x20to:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','DecisionPoint','segment\x20or\x20journey','action','No\x20','values','Journey\x20\x27','\x20activation\x20\x27','flatMap','repeat','\x20folders\x20to\x20create','resolve','entry','\x20\x20\x20\x20','\x20\x20Step\x201:\x20Creating\x20journey\x20without\x20entry\x20criteria:\x20','\x27\x20v','...','Site:\x20','\x20deleted','replace','📁\x20','slice','description','create','then','deleteActivation','draft','✔\x20Created\x20folder\x20\x27','cwd','message','listJourneysFromParentSegment','segmentId','created','\x20\x20Source:\x20','3154908FxPDUR','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','configDir','6297948SljImO','startsWith','getParent','Deleting\x20activation\x20\x27','New\x20segment:','blue','yes','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','max','getSegment','resolveJourneyId','delete','/app/ps/','Creating\x20activation\x20\x27','push','\x20\x20Journey\x20API\x20request:\x20','getJourney','error','\x20\x20Step\x202b:\x20Creating\x20embedded\x20activation\x20\x27','\x27:\x20','Fetching\x20journey\x20\x27','\x20\x20Created\x20embedded\x20segment\x20\x27','(Journey\x20will\x20be\x20deleted)','entryCriteria','Creating\x20folder\x20\x27','sort','entry_criteria','name','Deleting\x20segment\x20\x27','\x20activations]'];a36_0x46eb=function(){return _0x4b92ad;};return a36_0x46eb();}function findYamlFiles(_0x3ff7f3){const _0x10c508=[];function _0x56f43e(_0x46a1cd){const _0x5e0085=a36_0x2e07,_0x1646ee=readdirSync(_0x46a1cd,{'withFileTypes':!![]});for(const _0x316d41 of _0x1646ee){const _0x2aa92d=a36_0x2ae80a[_0x5e0085(0xcf)](_0x46a1cd,_0x316d41[_0x5e0085(0x8b)]);if(_0x316d41[_0x5e0085(0x11e)]())_0x56f43e(_0x2aa92d);else(_0x316d41[_0x5e0085(0x8b)][_0x5e0085(0xb6)](_0x5e0085(0xf1))||_0x316d41[_0x5e0085(0x8b)][_0x5e0085(0xb6)](_0x5e0085(0x121)))&&_0x10c508[_0x5e0085(0x177)](_0x2aa92d);}}return _0x56f43e(_0x3ff7f3),_0x10c508;}function calculateActivationActions(_0x2ac511,_0x49cfac,_0x1e8fe7,_0x19a469){const _0x5acb4a=a36_0x1b85d6,_0xa410e1=[],_0x4e39e0=new Map();for(const _0x5c927a of _0x49cfac){_0x4e39e0[_0x5acb4a(0x129)](_0x5c927a[_0x5acb4a(0x8b)],_0x5c927a);}const _0x352f05=new Map();for(const _0x47298a of _0x2ac511){_0x352f05[_0x5acb4a(0x129)](_0x47298a['name'],_0x47298a);}for(const _0x4778e5 of _0x2ac511){const _0x256fb9=_0x4e39e0[_0x5acb4a(0xe3)](_0x4778e5[_0x5acb4a(0x8b)]);if(!_0x256fb9)_0xa410e1[_0x5acb4a(0x177)]({'type':'create','name':_0x4778e5[_0x5acb4a(0x8b)],'yamlActivation':_0x4778e5});else{const _0x51cab7=activationToYaml(_0x256fb9,_0x1e8fe7,_0x19a469),_0x246a94=a36_0x54a4c8[_0x5acb4a(0x12b)](_0x51cab7),_0xfc5bff=a36_0x54a4c8['stringify'](_0x4778e5);_0x246a94!==_0xfc5bff&&_0xa410e1[_0x5acb4a(0x177)]({'type':_0x5acb4a(0xb5),'name':_0x4778e5[_0x5acb4a(0x8b)],'yamlActivation':_0x4778e5,'existingActivation':_0x256fb9});}}for(const _0x5302b5 of _0x49cfac){!_0x352f05[_0x5acb4a(0xa4)](_0x5302b5[_0x5acb4a(0x8b)])&&_0xa410e1['push']({'type':_0x5acb4a(0x174),'name':_0x5302b5['name'],'existingActivation':_0x5302b5});}return _0xa410e1;}
@@ -1 +1 @@
1
- function a37_0xf4ec(_0x56d04c,_0x468b06){_0x56d04c=_0x56d04c-0xd9;const _0x461714=a37_0x4617();let _0xf4eca1=_0x461714[_0x56d04c];return _0xf4eca1;}const a37_0x1e12a5=a37_0xf4ec;(function(_0x5c5b3b,_0x543a80){const _0x3bae6e=a37_0xf4ec,_0x4185d5=_0x5c5b3b();while(!![]){try{const _0x11777f=-parseInt(_0x3bae6e(0xe2))/0x1+parseInt(_0x3bae6e(0xfc))/0x2+-parseInt(_0x3bae6e(0xdb))/0x3+parseInt(_0x3bae6e(0xf6))/0x4*(-parseInt(_0x3bae6e(0xf4))/0x5)+-parseInt(_0x3bae6e(0xee))/0x6*(parseInt(_0x3bae6e(0xe9))/0x7)+parseInt(_0x3bae6e(0xe3))/0x8*(parseInt(_0x3bae6e(0xf5))/0x9)+parseInt(_0x3bae6e(0xdd))/0xa;if(_0x11777f===_0x543a80)break;else _0x4185d5['push'](_0x4185d5['shift']());}catch(_0x531a20){_0x4185d5['push'](_0x4185d5['shift']());}}}(a37_0x4617,0x4f16a));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';function a37_0x4617(){const _0x1ac9be=['7OIqcZG','Segment\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Updating\x20segment\x20\x27','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','2554008swgiHT','Resolved\x20folder\x20ID:\x20','data','updateSegmentById','description','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','50GHRZbU','36xGpdwG','9036mBCJpk','yellow','segment:update','kind','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','segment','1131510koFTne','resolvePathToResource','name','\x27...','rule','segmentPath','INTERNAL','segmentName','\x20\x20\x20Path:\x20','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','folder','verbose','366156vWqaSG','segmentId','5350700ePISlt','error','Examples:','Resolving\x20folder\x20\x27','length','504677IcNSnG','596216Mlkcfo','resolveFolderId','execute','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','ruleFile','type'];a37_0x4617=function(){return _0x1ac9be;};return a37_0x4617();}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a37_0x170c95 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a37_0x1e12a5(0xfe)]=a37_0x1e12a5(0xf8);[a37_0x1e12a5(0xf2)]='Update\x20existing\x20child\x20segment';async[a37_0x1e12a5(0xe5)](_0x38ce83){const _0x185092=a37_0x1e12a5;console['error'](a37_0x170c95[_0x185092(0xf7)]('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console[_0x185092(0xde)](a37_0x170c95[_0x185092(0xf7)](_0x185092(0xeb)));const {options:_0x55c2be,args:_0x5f9987,tdx:_0x59bc18}=_0x38ce83,_0x3f7786=_0x55c2be;if(_0x5f9987[_0x185092(0xe1)]===0x0)return console[_0x185092(0xde)](_0x185092(0xe6)),console[_0x185092(0xde)](_0x185092(0xfa)),console['error'](_0x185092(0xdf)),console[_0x185092(0xde)](_0x185092(0x105)),console[_0x185092(0xde)](_0x185092(0xed)),0x1;const _0xf2ef77=_0x5f9987[0x0],_0x9cfd1c=_0x55c2be[_0x185092(0x101)];let _0x5c6211=_0xf2ef77;_0x9cfd1c&&!_0xf2ef77['includes']('/')&&(_0x5c6211=_0x9cfd1c+'/'+_0xf2ef77,_0x3f7786[_0x185092(0xda)]&&console[_0x185092(0xde)]('Resolved\x20relative\x20path\x20to:\x20'+_0x5c6211));const _0x3f937d=await withSpinner('Resolving\x20path\x20\x27'+_0x5c6211+_0x185092(0xff),()=>_0x59bc18[_0x185092(0xfb)][_0x185092(0xfd)](_0x5c6211),{'verbose':_0x3f7786['verbose']}),_0x10b8b9=_0x3f937d[_0x185092(0xf0)];_0x3f7786[_0x185092(0xda)]&&console[_0x185092(0xde)]('Resolved\x20type:\x20'+_0x10b8b9[_0x185092(0xe8)]);if(_0x10b8b9['type']!==_0x185092(0xfb))return console[_0x185092(0xde)]('Error:\x20Cannot\x20update\x20'+_0x10b8b9[_0x185092(0xe8)]+_0x185092(0xf3)),console[_0x185092(0xde)]('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x10b8b9[_0x185092(0xdc)])throw new SDKError(ErrorCode[_0x185092(0x102)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2b29b4=_0x10b8b9['parentId'],_0x4538e5=_0x10b8b9[_0x185092(0xdc)];_0x3f7786[_0x185092(0xda)]&&(console['error']('Parent\x20ID:\x20'+_0x2b29b4),console[_0x185092(0xde)](_0x185092(0xea)+_0x4538e5));let _0x18dfb9;if(_0x3f7786['folder']){const _0x5417e4=_0x3f7786[_0x185092(0xd9)],_0x18c53e=await withSpinner(_0x185092(0xe0)+_0x5417e4+_0x185092(0xff),()=>_0x59bc18[_0x185092(0xfb)][_0x185092(0xe4)](_0x2b29b4,_0x5417e4),{'verbose':_0x3f7786[_0x185092(0xda)]});_0x18dfb9=parseInt(_0x18c53e[_0x185092(0xf0)],0xa),_0x3f7786[_0x185092(0xda)]&&console[_0x185092(0xde)](_0x185092(0xef)+_0x18dfb9);}const _0x10c681=await loadJSONFromOptions(_0x3f7786[_0x185092(0x100)],_0x3f7786[_0x185092(0xe7)]),_0x290c2d={'name':_0x3f7786['name'],'description':_0x3f7786[_0x185092(0xf2)],'rule':_0x10c681,'kind':_0x3f7786[_0x185092(0xf9)]!==undefined?parseInt(_0x3f7786[_0x185092(0xf9)],0xa):undefined,'segmentFolderId':_0x18dfb9},_0x43f5ed=await withSpinner(_0x185092(0xec)+_0x10b8b9[_0x185092(0x103)]+'\x27...',()=>_0x59bc18[_0x185092(0xfb)][_0x185092(0xf1)](_0x2b29b4,_0x4538e5,_0x290c2d),{'verbose':_0x3f7786[_0x185092(0xda)]}),_0x2c3a37=_0x43f5ed[_0x185092(0xf0)];return console[_0x185092(0xde)]('✔\x20Updated\x20segment\x20\x27'+_0x2c3a37['name']+'\x27'),_0x5c6211!==_0xf2ef77&&console[_0x185092(0xde)](_0x185092(0x104)+_0x5c6211),await handleSDKOutput([_0x2c3a37],_0x3f7786),0x0;}}
1
+ const a37_0x58c2bd=a37_0x1106;(function(_0x429e4c,_0x3c3bf1){const _0x2ea57c=a37_0x1106,_0x331aeb=_0x429e4c();while(!![]){try{const _0x1ed8c1=parseInt(_0x2ea57c(0x1c3))/0x1*(-parseInt(_0x2ea57c(0x1ee))/0x2)+-parseInt(_0x2ea57c(0x1e5))/0x3+parseInt(_0x2ea57c(0x1c7))/0x4+parseInt(_0x2ea57c(0x1c0))/0x5+parseInt(_0x2ea57c(0x1d1))/0x6+-parseInt(_0x2ea57c(0x1e9))/0x7+parseInt(_0x2ea57c(0x1e4))/0x8*(parseInt(_0x2ea57c(0x1bd))/0x9);if(_0x1ed8c1===_0x3c3bf1)break;else _0x331aeb['push'](_0x331aeb['shift']());}catch(_0x1ac7a5){_0x331aeb['push'](_0x331aeb['shift']());}}}(a37_0x34ab,0xe05b1));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';function a37_0x34ab(){const _0x43abfc=['name','Resolved\x20folder\x20ID:\x20','verbose','segmentId','resolveFolderId','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Update\x20existing\x20child\x20segment','folder','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','segmentName','error','Examples:','Resolved\x20type:\x20','8403416RuxAGO','700992JuhCii','Error:\x20Cannot\x20update\x20','\x27...','description','4519074zZNaIA','rule','yellow','type','Segment\x20ID\x20missing\x20from\x20resolved\x20path','2241308sMNUpH','9vmizxK','includes','data','848945fXdqTD','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','1hOYtfb','resolvePathToResource','Resolving\x20folder\x20\x27','\x20\x20\x20Path:\x20','584152qMMEVJ','Updating\x20segment\x20\x27','kind','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','Parent\x20ID:\x20','execute','Resolved\x20relative\x20path\x20to:\x20','segment','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','9315642NdFmtk','✔\x20Updated\x20segment\x20\x27','parentId','Resolving\x20path\x20\x27','segment:update','updateSegmentById'];a37_0x34ab=function(){return _0x43abfc;};return a37_0x34ab();}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a37_0x1106(_0x369fa3,_0x2f6e6d){_0x369fa3=_0x369fa3-0x1bd;const _0x34ab0e=a37_0x34ab();let _0x1106e9=_0x34ab0e[_0x369fa3];return _0x1106e9;}import a37_0x201f50 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a37_0x58c2bd(0x1d7)]=a37_0x58c2bd(0x1d5);['description']=a37_0x58c2bd(0x1dd);async[a37_0x58c2bd(0x1cd)](_0x25d787){const _0x10bffb=a37_0x58c2bd;console[_0x10bffb(0x1e1)](a37_0x201f50[_0x10bffb(0x1eb)](_0x10bffb(0x1d0))),console[_0x10bffb(0x1e1)](a37_0x201f50[_0x10bffb(0x1eb)](_0x10bffb(0x1ca)));const {options:_0x64ebd0,args:_0x4c4204,tdx:_0x569b26}=_0x25d787,_0x5ac780=_0x64ebd0;if(_0x4c4204['length']===0x0)return console['error'](_0x10bffb(0x1c2)),console[_0x10bffb(0x1e1)](_0x10bffb(0x1c1)),console[_0x10bffb(0x1e1)](_0x10bffb(0x1e2)),console[_0x10bffb(0x1e1)]('\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22'),console[_0x10bffb(0x1e1)](_0x10bffb(0x1df)),0x1;const _0x40d3bb=_0x4c4204[0x0],_0x46b30a=_0x64ebd0['segmentPath'];let _0x379df4=_0x40d3bb;_0x46b30a&&!_0x40d3bb[_0x10bffb(0x1be)]('/')&&(_0x379df4=_0x46b30a+'/'+_0x40d3bb,_0x5ac780[_0x10bffb(0x1d9)]&&console['error'](_0x10bffb(0x1ce)+_0x379df4));const _0x2aef19=await withSpinner(_0x10bffb(0x1d4)+_0x379df4+_0x10bffb(0x1e7),()=>_0x569b26[_0x10bffb(0x1cf)][_0x10bffb(0x1c4)](_0x379df4),{'verbose':_0x5ac780[_0x10bffb(0x1d9)]}),_0x32ba00=_0x2aef19[_0x10bffb(0x1bf)];_0x5ac780[_0x10bffb(0x1d9)]&&console[_0x10bffb(0x1e1)](_0x10bffb(0x1e3)+_0x32ba00['type']);if(_0x32ba00[_0x10bffb(0x1ec)]!==_0x10bffb(0x1cf))return console['error'](_0x10bffb(0x1e6)+_0x32ba00[_0x10bffb(0x1ec)]+_0x10bffb(0x1cb)),console[_0x10bffb(0x1e1)](_0x10bffb(0x1dc)),0x1;if(!_0x32ba00[_0x10bffb(0x1da)])throw new SDKError(ErrorCode['INTERNAL'],_0x10bffb(0x1ed));const _0x2f7034=_0x32ba00[_0x10bffb(0x1d3)],_0x454aaf=_0x32ba00[_0x10bffb(0x1da)];_0x5ac780[_0x10bffb(0x1d9)]&&(console['error'](_0x10bffb(0x1cc)+_0x2f7034),console[_0x10bffb(0x1e1)]('Segment\x20ID:\x20'+_0x454aaf));let _0x4ff2f2;if(_0x5ac780[_0x10bffb(0x1de)]){const _0x432e49=_0x5ac780['folder'],_0x94ba56=await withSpinner(_0x10bffb(0x1c5)+_0x432e49+_0x10bffb(0x1e7),()=>_0x569b26[_0x10bffb(0x1cf)][_0x10bffb(0x1db)](_0x2f7034,_0x432e49),{'verbose':_0x5ac780[_0x10bffb(0x1d9)]});_0x4ff2f2=parseInt(_0x94ba56['data'],0xa),_0x5ac780[_0x10bffb(0x1d9)]&&console['error'](_0x10bffb(0x1d8)+_0x4ff2f2);}const _0x380b07=await loadJSONFromOptions(_0x5ac780[_0x10bffb(0x1ea)],_0x5ac780['ruleFile']),_0x1e8aac={'name':_0x5ac780['name'],'description':_0x5ac780[_0x10bffb(0x1e8)],'rule':_0x380b07,'kind':_0x5ac780[_0x10bffb(0x1c9)]!==undefined?parseInt(_0x5ac780[_0x10bffb(0x1c9)],0xa):undefined,'segmentFolderId':_0x4ff2f2},_0x322c70=await withSpinner(_0x10bffb(0x1c8)+_0x32ba00[_0x10bffb(0x1e0)]+_0x10bffb(0x1e7),()=>_0x569b26[_0x10bffb(0x1cf)][_0x10bffb(0x1d6)](_0x2f7034,_0x454aaf,_0x1e8aac),{'verbose':_0x5ac780[_0x10bffb(0x1d9)]}),_0xe13f49=_0x322c70[_0x10bffb(0x1bf)];return console['error'](_0x10bffb(0x1d2)+_0xe13f49['name']+'\x27'),_0x379df4!==_0x40d3bb&&console[_0x10bffb(0x1e1)](_0x10bffb(0x1c6)+_0x379df4),await handleSDKOutput([_0xe13f49],_0x5ac780),0x0;}}
@@ -1 +1 @@
1
- const a38_0x265aef=a38_0x5ea9;function a38_0x5ea9(_0xdfe84b,_0x526eb1){_0xdfe84b=_0xdfe84b-0x113;const _0x1fb4f7=a38_0x1fb4();let _0x5ea908=_0x1fb4f7[_0xdfe84b];return _0x5ea908;}(function(_0x2b789b,_0x4a2b24){const _0x52ba79=a38_0x5ea9,_0x5d6bcb=_0x2b789b();while(!![]){try{const _0xbe2f67=parseInt(_0x52ba79(0x119))/0x1*(parseInt(_0x52ba79(0x13f))/0x2)+parseInt(_0x52ba79(0x141))/0x3*(parseInt(_0x52ba79(0x11b))/0x4)+-parseInt(_0x52ba79(0x133))/0x5+parseInt(_0x52ba79(0x127))/0x6*(parseInt(_0x52ba79(0x12d))/0x7)+-parseInt(_0x52ba79(0x12f))/0x8*(parseInt(_0x52ba79(0x121))/0x9)+parseInt(_0x52ba79(0x12e))/0xa+-parseInt(_0x52ba79(0x118))/0xb;if(_0xbe2f67===_0x4a2b24)break;else _0x5d6bcb['push'](_0x5d6bcb['shift']());}catch(_0x443473){_0x5d6bcb['push'](_0x5d6bcb['shift']());}}}(a38_0x1fb4,0xb8d17));import{existsSync,statSync}from'fs';import a38_0x4a6e1b from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';function a38_0x1fb4(){const _0x1d0f1d=['Parent\x20ID:\x20','folderPath','parent_segment','site','42oSEXpv','6871500AWQIiZ','9904OIYKhJ','Site:\x20','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','resolvePathToResource','854340IVOXrs','error','verbose','config','red','segment','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','log','data','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','fullPath','15012XkKvqL','Folder\x20ID:\x20','956169CRgZSR','dim','execute','Examples:','type','slice','Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','parentName','segmentPath','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','9530345FKcIKO','113rlSpMc','✔\x20Context\x20set\x20to:\x20','8gbnxGM','join','folderId','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','Resolved\x20path\x20type:\x20','cyan','9117IQYpJN','length','green','name','isDirectory','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','875598pyGdav','segment:use'];a38_0x1fb4=function(){return _0x1d0f1d;};return a38_0x1fb4();}import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../utils/segment-path-parser.js';import{findTdxConfig}from'../utils/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a38_0x265aef(0x124)]=a38_0x265aef(0x128);['description']=a38_0x265aef(0x114);async[a38_0x265aef(0x143)](_0x51a938){const _0x5728de=a38_0x265aef,{options:_0x5094d7,args:_0x4864f3,tdx:_0x5e533d}=_0x51a938;if(_0x4864f3['length']===0x0)return console[_0x5728de(0x134)](a38_0x4a6e1b[_0x5728de(0x137)]('Error:\x20Path\x20is\x20required\x0a')),console[_0x5728de(0x134)]('Usage:\x20tdx\x20segment\x20use\x20<path>'),console[_0x5728de(0x134)](_0x5728de(0x144)),console[_0x5728de(0x134)](_0x5728de(0x139)),console[_0x5728de(0x134)](_0x5728de(0x13d)),console[_0x5728de(0x134)](_0x5728de(0x13c)),console[_0x5728de(0x134)](_0x5728de(0x117)),0x1;const _0x5ccfc2=_0x4864f3[0x0],_0x283525=_0x5094d7['session'];try{if(_0x5ccfc2==='/')return saveSessionContext({'segment_path':undefined},_0x283525),console[_0x5728de(0x13a)](a38_0x4a6e1b[_0x5728de(0x123)](_0x5728de(0x126))),0x0;if(existsSync(_0x5ccfc2)&&statSync(_0x5ccfc2)[_0x5728de(0x125)]()){let _0x52060b;try{_0x52060b=findTdxConfig(_0x5ccfc2);}catch{return console[_0x5728de(0x134)](a38_0x4a6e1b[_0x5728de(0x137)](_0x5728de(0x113)+_0x5ccfc2)),console[_0x5728de(0x134)](a38_0x4a6e1b['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x370bca=_0x52060b[_0x5728de(0x136)][_0x5728de(0x12b)];return saveSessionContext({'segment_path':_0x370bca,'parent_segment':_0x370bca},_0x283525),console[_0x5728de(0x13a)](a38_0x4a6e1b[_0x5728de(0x123)](_0x5728de(0x11a)+a38_0x4a6e1b['cyan'](_0x370bca))),0x0;}const _0x5dd9a3=_0x5094d7[_0x5728de(0x116)];let _0x22c306=_0x5ccfc2;const _0xc1ef4f=parsePath(_0x5ccfc2);if(!_0xc1ef4f['isAbsolute']){if(!_0x5dd9a3)return console['error'](a38_0x4a6e1b[_0x5728de(0x137)](_0x5728de(0x131))),console[_0x5728de(0x134)](a38_0x4a6e1b['cyan'](_0x5728de(0x11e))),0x1;if(_0x5ccfc2==='..'){const _0x15bfcf=_0x5dd9a3['split']('/')[_0x5728de(0x146)](0x0,-0x1)['join']('/');_0x22c306=_0x15bfcf||'/';}else _0x5ccfc2==='.'?_0x22c306=_0x5dd9a3:_0x22c306=_0x5dd9a3+'/'+_0x5ccfc2;_0x5094d7[_0x5728de(0x135)]&&console[_0x5728de(0x134)]('Resolved\x20relative\x20path\x20to:\x20'+_0x22c306);}if(_0x22c306==='/'||_0x22c306==='')return saveSessionContext({'segment_path':undefined},_0x283525),console[_0x5728de(0x13a)](a38_0x4a6e1b['green']('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x22c306=normalizePath(_0x22c306);const _0x41a00b=parsePath(_0x22c306)['segments'];if(_0x41a00b[_0x5728de(0x122)]===0x0)return saveSessionContext({'segment_path':undefined},_0x283525),console[_0x5728de(0x13a)](a38_0x4a6e1b[_0x5728de(0x123)](_0x5728de(0x126))),0x0;_0x5094d7[_0x5728de(0x135)]&&(console[_0x5728de(0x134)](_0x5728de(0x130)+_0x5094d7[_0x5728de(0x12c)]),console[_0x5728de(0x134)]('Target\x20path:\x20'+_0x22c306));const _0x107840=await withSpinner('Resolving\x20path\x20\x27'+_0x22c306+'\x27...',()=>_0x5e533d[_0x5728de(0x138)][_0x5728de(0x132)](_0x22c306),{'verbose':_0x5094d7[_0x5728de(0x135)]}),_0x3e83f7=_0x107840[_0x5728de(0x13b)];_0x5094d7['verbose']&&(console[_0x5728de(0x134)](_0x5728de(0x11f)+_0x3e83f7['type']),console['error'](_0x5728de(0x129)+_0x3e83f7['parentId']),_0x3e83f7[_0x5728de(0x11d)]&&console[_0x5728de(0x134)](_0x5728de(0x140)+_0x3e83f7['folderId']));if(_0x3e83f7[_0x5728de(0x145)]==='segment')return console[_0x5728de(0x134)](a38_0x4a6e1b[_0x5728de(0x137)]('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console[_0x5728de(0x134)]('Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.'),console[_0x5728de(0x134)](a38_0x4a6e1b[_0x5728de(0x120)]('Use:\x20tdx\x20segment\x20use\x20'+_0x3e83f7[_0x5728de(0x115)]+(_0x3e83f7[_0x5728de(0x12a)]?'/'+_0x3e83f7[_0x5728de(0x12a)][_0x5728de(0x11c)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x3e83f7[_0x5728de(0x13e)],'parent_segment':_0x3e83f7[_0x5728de(0x115)]},_0x283525),console[_0x5728de(0x13a)](a38_0x4a6e1b[_0x5728de(0x123)](_0x5728de(0x11a)+a38_0x4a6e1b[_0x5728de(0x120)](_0x3e83f7['fullPath']))),_0x5094d7[_0x5728de(0x135)]&&(console[_0x5728de(0x134)](a38_0x4a6e1b['dim']('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0x5728de(0x134)](a38_0x4a6e1b[_0x5728de(0x142)](_0x5728de(0x147)))),0x0;}catch(_0x1d6459){throw _0x1d6459;}}}
1
+ const a38_0x1758f1=a38_0x5b84;function a38_0x5b84(_0x5ea9c7,_0x3da3bb){_0x5ea9c7=_0x5ea9c7-0x185;const _0xdf4391=a38_0xdf43();let _0x5b842c=_0xdf4391[_0x5ea9c7];return _0x5b842c;}(function(_0x24f805,_0x3e3219){const _0x20748b=a38_0x5b84,_0x46f4d6=_0x24f805();while(!![]){try{const _0x210b06=parseInt(_0x20748b(0x1b4))/0x1+parseInt(_0x20748b(0x18b))/0x2+parseInt(_0x20748b(0x198))/0x3*(parseInt(_0x20748b(0x1b9))/0x4)+-parseInt(_0x20748b(0x1ab))/0x5*(-parseInt(_0x20748b(0x193))/0x6)+-parseInt(_0x20748b(0x1a1))/0x7*(-parseInt(_0x20748b(0x18f))/0x8)+-parseInt(_0x20748b(0x187))/0x9+-parseInt(_0x20748b(0x191))/0xa;if(_0x210b06===_0x3e3219)break;else _0x46f4d6['push'](_0x46f4d6['shift']());}catch(_0x39a6c0){_0x46f4d6['push'](_0x46f4d6['shift']());}}}(a38_0xdf43,0x1e01a));import{existsSync,statSync}from'fs';import a38_0x1e2e5a from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../utils/segment-path-parser.js';function a38_0xdf43(){const _0x366671=['Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','resolvePathToResource','1520253PVwTtH','parentId','isAbsolute','config','393806YpLgcv','segment:use','Resolved\x20path\x20type:\x20','Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters','1439384qTJeVn','parentName','4451250JkIuLh','Use:\x20tdx\x20segment\x20use\x20','4404LaYBVy','length','slice','join','site','417tlAoSP','type','segment','Resolved\x20relative\x20path\x20to:\x20','session','description','Resolving\x20path\x20\x27','segments','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','7RAQxjr','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','\x27...','isDirectory','green','fullPath','split','data','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','20SCKMED','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','folderId','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','verbose','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','dim','202757boqByZ','error','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Site:\x20','log','4444uAAUFh','Error:\x20Path\x20is\x20required\x0a','red','Parent\x20ID:\x20','execute','✔\x20Context\x20set\x20to:\x20','Usage:\x20tdx\x20segment\x20use\x20<path>','cyan'];a38_0xdf43=function(){return _0x366671;};return a38_0xdf43();}import{findTdxConfig}from'../utils/tdx-config.js';export class SegmentUseCommand extends BaseCommand{['name']=a38_0x1758f1(0x18c);[a38_0x1758f1(0x19d)]=a38_0x1758f1(0x1af);async[a38_0x1758f1(0x1bd)](_0x8b0d3b){const _0x4b8bb4=a38_0x1758f1,{options:_0x40755c,args:_0x3bb4fd,tdx:_0x23f7b8}=_0x8b0d3b;if(_0x3bb4fd[_0x4b8bb4(0x194)]===0x0)return console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a[_0x4b8bb4(0x1bb)](_0x4b8bb4(0x1ba))),console['error'](_0x4b8bb4(0x1bf)),console[_0x4b8bb4(0x1b5)]('Examples:'),console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1b1)),console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1a0)),console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1b6)),console[_0x4b8bb4(0x1b5)]('\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent'),0x1;const _0x3c1397=_0x3bb4fd[0x0],_0x5dd524=_0x40755c[_0x4b8bb4(0x19c)];try{if(_0x3c1397==='/')return saveSessionContext({'segment_path':undefined},_0x5dd524),console['log'](a38_0x1e2e5a[_0x4b8bb4(0x1a5)](_0x4b8bb4(0x1ae))),0x0;if(existsSync(_0x3c1397)&&statSync(_0x3c1397)[_0x4b8bb4(0x1a4)]()){let _0x596139;try{_0x596139=findTdxConfig(_0x3c1397);}catch{return console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a[_0x4b8bb4(0x1bb)](_0x4b8bb4(0x1aa)+_0x3c1397)),console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x149d1d=_0x596139[_0x4b8bb4(0x18a)]['parent_segment'];return saveSessionContext({'segment_path':_0x149d1d,'parent_segment':_0x149d1d},_0x5dd524),console['log'](a38_0x1e2e5a[_0x4b8bb4(0x1a5)](_0x4b8bb4(0x1be)+a38_0x1e2e5a[_0x4b8bb4(0x1c0)](_0x149d1d))),0x0;}const _0x2c65d5=_0x40755c['segmentPath'];let _0x24b8ee=_0x3c1397;const _0x36a341=parsePath(_0x3c1397);if(!_0x36a341[_0x4b8bb4(0x189)]){if(!_0x2c65d5)return console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a[_0x4b8bb4(0x1bb)](_0x4b8bb4(0x1a9))),console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a['cyan'](_0x4b8bb4(0x1b2))),0x1;if(_0x3c1397==='..'){const _0x596edb=_0x2c65d5[_0x4b8bb4(0x1a7)]('/')[_0x4b8bb4(0x195)](0x0,-0x1)[_0x4b8bb4(0x196)]('/');_0x24b8ee=_0x596edb||'/';}else _0x3c1397==='.'?_0x24b8ee=_0x2c65d5:_0x24b8ee=_0x2c65d5+'/'+_0x3c1397;_0x40755c[_0x4b8bb4(0x1b0)]&&console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x19b)+_0x24b8ee);}if(_0x24b8ee==='/'||_0x24b8ee==='')return saveSessionContext({'segment_path':undefined},_0x5dd524),console['log'](a38_0x1e2e5a['green']('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x24b8ee=normalizePath(_0x24b8ee);const _0x45ff12=parsePath(_0x24b8ee)[_0x4b8bb4(0x19f)];if(_0x45ff12[_0x4b8bb4(0x194)]===0x0)return saveSessionContext({'segment_path':undefined},_0x5dd524),console[_0x4b8bb4(0x1b8)](a38_0x1e2e5a['green'](_0x4b8bb4(0x1ae))),0x0;_0x40755c[_0x4b8bb4(0x1b0)]&&(console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1b7)+_0x40755c[_0x4b8bb4(0x197)]),console[_0x4b8bb4(0x1b5)]('Target\x20path:\x20'+_0x24b8ee));const _0x19280b=await withSpinner(_0x4b8bb4(0x19e)+_0x24b8ee+_0x4b8bb4(0x1a3),()=>_0x23f7b8[_0x4b8bb4(0x19a)][_0x4b8bb4(0x186)](_0x24b8ee),{'verbose':_0x40755c[_0x4b8bb4(0x1b0)]}),_0x5beb49=_0x19280b[_0x4b8bb4(0x1a8)];_0x40755c[_0x4b8bb4(0x1b0)]&&(console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x18d)+_0x5beb49[_0x4b8bb4(0x199)]),console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1bc)+_0x5beb49[_0x4b8bb4(0x188)]),_0x5beb49[_0x4b8bb4(0x1ad)]&&console[_0x4b8bb4(0x1b5)]('Folder\x20ID:\x20'+_0x5beb49[_0x4b8bb4(0x1ad)]));if(_0x5beb49[_0x4b8bb4(0x199)]===_0x4b8bb4(0x19a))return console['error'](a38_0x1e2e5a[_0x4b8bb4(0x1bb)](_0x4b8bb4(0x185))),console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1a2)),console['error'](a38_0x1e2e5a[_0x4b8bb4(0x1c0)](_0x4b8bb4(0x192)+_0x5beb49[_0x4b8bb4(0x190)]+(_0x5beb49['folderPath']?'/'+_0x5beb49['folderPath']['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x5beb49[_0x4b8bb4(0x1a6)],'parent_segment':_0x5beb49['parentName']},_0x5dd524),console[_0x4b8bb4(0x1b8)](a38_0x1e2e5a[_0x4b8bb4(0x1a5)]('✔\x20Context\x20set\x20to:\x20'+a38_0x1e2e5a[_0x4b8bb4(0x1c0)](_0x5beb49['fullPath']))),_0x40755c[_0x4b8bb4(0x1b0)]&&(console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a[_0x4b8bb4(0x1b3)](_0x4b8bb4(0x1ac))),console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a['dim'](_0x4b8bb4(0x18e)))),0x0;}catch(_0x119223){throw _0x119223;}}}