@treasuredata/tdx 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts +17 -11
- package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-config.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/journey-utils.d.ts +30 -0
- package/dist/utils/journey-utils.d.ts.map +1 -1
- package/dist/utils/journey-utils.js +1 -1
- package/dist/utils/journey-utils.js.map +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a35_0x4be2f7=a35_0x3b98;(function(_0x216973,_0x38c5cb){const _0x4a6cde=a35_0x3b98,_0xcf54f7=_0x216973();while(!![]){try{const _0x152e0e=-parseInt(_0x4a6cde(0xe4))/0x1+-parseInt(_0x4a6cde(0xcb))/0x2+-parseInt(_0x4a6cde(0xca))/0x3+-parseInt(_0x4a6cde(0xc4))/0x4*(parseInt(_0x4a6cde(0xa3))/0x5)+-parseInt(_0x4a6cde(0xc2))/0x6*(parseInt(_0x4a6cde(0x83))/0x7)+-parseInt(_0x4a6cde(0xa2))/0x8*(parseInt(_0x4a6cde(0xde))/0x9)+parseInt(_0x4a6cde(0xba))/0xa;if(_0x152e0e===_0x38c5cb)break;else _0xcf54f7['push'](_0xcf54f7['shift']());}catch(_0x5958b3){_0xcf54f7['push'](_0xcf54f7['shift']());}}}(a35_0x53e0,0xec10b));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';function a35_0x3b98(_0x57a695,_0x46a50b){_0x57a695=_0x57a695-0x6e;const _0x53e065=a35_0x53e0();let _0x3b987c=_0x53e065[_0x57a695];return _0x3b987c;}import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';import{segmentWithActivationsToYaml,segmentToYamlString,apiRuleToYaml,resolveRuleSegmentRefs,journeyActivationStepToYaml}from'../sdk/segment/child-segment-yaml.js';import{apiToYamlAsync,toYamlString as a35_0x317b92,normalizeJourneyYaml}from'../sdk/segment/journey-yaml.js';import a35_0x41de43 from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a35_0xd20431 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{[a35_0x4be2f7(0xc1)]=a35_0x4be2f7(0x7c);[a35_0x4be2f7(0x96)]=a35_0x4be2f7(0xa9);async[a35_0x4be2f7(0x85)](_0x554600){const _0x16da9a=a35_0x4be2f7,{options:_0x4584a7,args:_0x539bef,tdx:_0x3b89d0}=_0x554600,_0x552999=_0x4584a7,_0x3b7de3=_0x4584a7[_0x16da9a(0xaa)],_0x38262d=_0x539bef[0x0],_0x5728bd=findTdxConfigPath();let _0xa9726d,_0x14468a;if(!_0x38262d&&_0x5728bd){const _0x4c6f09=loadTdxConfig(_0x5728bd);_0xa9726d=_0x4c6f09['parent_segment'],_0x14468a=a35_0xd20431[_0x16da9a(0xd1)](_0x5728bd),_0x552999[_0x16da9a(0xa7)]&&(console['error'](_0x16da9a(0xc0)+_0x5728bd),console[_0x16da9a(0xae)]('Using\x20parent\x20segment:\x20'+_0xa9726d));}else{if(_0x38262d){if(existsSync(_0x38262d)&&statSync(_0x38262d)[_0x16da9a(0x73)]()){const _0x33e1ac=findTdxConfigPath(_0x38262d);if(_0x33e1ac){const _0x3f22db=loadTdxConfig(_0x33e1ac);_0xa9726d=_0x3f22db['parent_segment'],_0x14468a=a35_0xd20431[_0x16da9a(0xd1)](_0x33e1ac),_0x552999[_0x16da9a(0xa7)]&&(console[_0x16da9a(0xae)]('Found\x20tdx.json\x20at:\x20'+_0x33e1ac),console[_0x16da9a(0xae)](_0x16da9a(0x7a)+_0xa9726d));}else return console[_0x16da9a(0xae)](a35_0x41de43[_0x16da9a(0x74)](_0x16da9a(0x78)+_0x38262d+'\x0a')),console['error'](a35_0x41de43[_0x16da9a(0xbf)](_0x16da9a(0xd3))),0x1;}else _0xa9726d=_0x38262d;}else _0xa9726d=_0x3b7de3;}if(!_0xa9726d)return console[_0x16da9a(0xae)](a35_0x41de43[_0x16da9a(0x87)](_0x16da9a(0xa6))),console[_0x16da9a(0xae)](_0x16da9a(0xe5)),console['error'](_0x16da9a(0xdf)),console[_0x16da9a(0xae)](_0x16da9a(0x9a)),0x1;_0x552999['verbose']&&(console[_0x16da9a(0xae)](_0x16da9a(0xd5)+_0x552999[_0x16da9a(0xe0)]),console[_0x16da9a(0xae)]('Parent\x20segment:\x20'+_0xa9726d));const _0x56bf68=await withSpinner(_0x16da9a(0xbb)+_0xa9726d+_0x16da9a(0x92),()=>_0x3b89d0[_0x16da9a(0xc3)]['resolveParentId'](_0xa9726d),{'verbose':_0x552999[_0x16da9a(0xa7)]}),_0x85acdb=_0x56bf68[_0x16da9a(0xbc)],_0x35aa7f=await withSpinner(_0x16da9a(0xdc),()=>_0x3b89d0[_0x16da9a(0xc3)][_0x16da9a(0x79)](_0x85acdb),{'verbose':_0x552999['verbose']}),_0x4d321b=_0x35aa7f[_0x16da9a(0xbc)]['attributes']['name'];_0x552999[_0x16da9a(0xa7)]&&console[_0x16da9a(0xae)](_0x16da9a(0x70)+_0x4d321b);const [_0x4f8cb7,_0x56909b,_0x43c28a]=await Promise['all']([withSpinner(_0x16da9a(0x86),()=>_0x3b89d0[_0x16da9a(0xc3)]['listSegments'](_0x85acdb),{'verbose':_0x552999[_0x16da9a(0xa7)]}),withSpinner('Fetching\x20folders...',()=>_0x3b89d0['segment'][_0x16da9a(0x88)](_0x85acdb),{'verbose':_0x552999[_0x16da9a(0xa7)]}),withSpinner(_0x16da9a(0xbe),()=>_0x3b89d0[_0x16da9a(0x8c)]['listJourneysFromParentSegment'](_0x85acdb),{'verbose':_0x552999[_0x16da9a(0xa7)]})]),_0x1a0221=_0x4f8cb7[_0x16da9a(0xbc)],_0x9748fc=_0x56909b[_0x16da9a(0xbc)],_0x11c073=_0x43c28a[_0x16da9a(0xbc)];if(_0x1a0221[_0x16da9a(0xb9)]===0x0&&_0x11c073[_0x16da9a(0xb9)]===0x0)return console[_0x16da9a(0xae)](a35_0x41de43['yellow']('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x4d321b+'\x27')),0x0;const _0x153add=buildFolderPathMap(_0x9748fc),_0x38fe64=_0x14468a||getSegmentRootDir(sanitizeFileName(_0xa9726d)),_0x3d453c=new Map();await withSpinner('Fetching\x20activations...',async()=>{await batchAsync(_0x1a0221,async _0x4ab440=>{const _0xfff7ab=a35_0x3b98,_0x21a1eb=await _0x3b89d0[_0xfff7ab(0xc3)][_0xfff7ab(0xbd)](_0x85acdb,_0x4ab440['id']);_0x3d453c['set'](_0x4ab440['id'],_0x21a1eb);});},{'verbose':_0x552999['verbose']});const _0x13404c=await withSpinner(_0x16da9a(0x76),()=>_0x3b89d0[_0x16da9a(0x98)][_0x16da9a(0xce)](),{'verbose':_0x552999[_0x16da9a(0xa7)]})[_0x16da9a(0xd8)](_0x48a1a5=>_0x48a1a5[_0x16da9a(0xbc)]),_0x1220cf=await withSpinner(_0x16da9a(0xd7),()=>_0x3b89d0[_0x16da9a(0x9b)][_0x16da9a(0xa5)](),{'verbose':_0x552999[_0x16da9a(0xa7)]})['then'](_0x337be2=>_0x337be2['data']),_0x4aa563=[],_0x209ea9=a35_0xd20431[_0x16da9a(0xb7)](_0x38fe64,_0x16da9a(0xda)),_0x16de99=createTdxConfigContent(_0x4d321b);_0x4aa563[_0x16da9a(0x93)](prepareFile(_0x209ea9,_0x16de99,_0x38fe64));const _0x57c394=new Map();for(const _0x751228 of _0x1a0221){if(_0x751228[_0x16da9a(0xb1)]===SEGMENT_KIND_JOURNEY)continue;const _0x5c696d=_0x751228[_0x16da9a(0x9f)]?_0x153add[_0x16da9a(0xd9)](_0x751228['segmentFolderId'])||'':'',_0x5e37ba=_0x3d453c[_0x16da9a(0xd9)](_0x751228['id'])||[],_0x2da644=segmentWithActivationsToYaml(_0x751228,_0x5e37ba,undefined,_0x13404c,_0x1220cf),_0xe3ef4d=_0x5c696d?a35_0xd20431[_0x16da9a(0xb7)](_0x38fe64,_0x5c696d):_0x38fe64,_0xe9fa23=sanitizeFileName(_0x751228[_0x16da9a(0xc1)]),_0x345211=getUniqueFileName(_0xe3ef4d,_0xe9fa23,_0x57c394),_0x442691=a35_0xd20431[_0x16da9a(0xb7)](_0xe3ef4d,_0x345211+'.yml'),_0x209832=segmentToYamlString(_0x2da644);_0x4aa563[_0x16da9a(0x93)](prepareFile(_0x442691,_0x209832,_0x38fe64));}const _0x19926d=new Map();for(const _0x36fb27 of _0x1a0221){_0x19926d[_0x16da9a(0x7d)](_0x36fb27['id'],_0x36fb27);}const _0xae686a=new Map();for(const _0x189eda of _0x11c073){const _0x3d5184=_0x189eda[_0x16da9a(0x99)];!_0xae686a[_0x16da9a(0xcd)](_0x3d5184)&&_0xae686a[_0x16da9a(0x7d)](_0x3d5184,[]),_0xae686a[_0x16da9a(0xd9)](_0x3d5184)[_0x16da9a(0x93)](_0x189eda);}for(const _0x5d6b8b of _0xae686a[_0x16da9a(0xcc)]()){_0x5d6b8b[_0x16da9a(0xc5)]((_0x187dfe,_0x1beba3)=>(_0x187dfe[_0x16da9a(0x94)]||0x0)-(_0x1beba3[_0x16da9a(0x94)]||0x0));}const _0x49a2ff=()=>{const _0x3839f4=_0x16da9a,_0x4f4bf3=new Set(),_0x18314e=new Set(),_0x45ea94=new Map(),_0x41824b=new Map(),_0x15982f=createJumpTargetCache(),_0x4afc6a=(_0xe3dfde,_0x44e566)=>({'resolveSegment':async _0x49bc76=>{const _0x595678=a35_0x3b98,_0x36117c=_0x45ea94[_0x595678(0xd9)](_0x49bc76);if(_0x36117c!==undefined)return{'name':_0x36117c,'isJourneyLocal':!![]};if(!_0x44e566)return{'name':_0x49bc76,'isJourneyLocal':![]};try{let _0x5657be=_0x19926d['get'](_0x49bc76);!_0x5657be&&(_0x5657be=await _0x3b89d0[_0x595678(0xc3)][_0x595678(0xc9)](_0x44e566,_0x49bc76));const _0x49a1f1=generateJourneyLocalName(_0x5657be['name']),_0x35d442=_0x5657be['kind']===SEGMENT_KIND_JOURNEY&&_0x49a1f1!==undefined;let _0x326b94=_0x5657be[_0x595678(0xc1)];if(_0x35d442&&_0x49a1f1){let _0x11af9f=_0x49a1f1,_0x549ee3=0x2;while(_0x4f4bf3[_0x595678(0xcd)](_0x11af9f)){_0x11af9f=_0x49a1f1+'_'+_0x549ee3,_0x549ee3++;}_0x4f4bf3[_0x595678(0xd0)](_0x11af9f),_0x326b94=_0x11af9f,_0x45ea94[_0x595678(0x7d)](_0x49bc76,_0x326b94);}let _0x2ec6ae;if(_0x35d442&&_0x5657be['rule']){let _0x2ab99c=apiRuleToYaml(_0x5657be[_0x595678(0xb5)]);_0x2ab99c=await resolveRuleSegmentRefs(_0x2ab99c,async _0x5ae8ff=>{const _0x431377=_0x595678,_0x5b5604=await _0x3b89d0[_0x431377(0xc3)][_0x431377(0xc9)](_0x44e566,_0x5ae8ff);return _0x5b5604[_0x431377(0xc1)];}),_0x2ec6ae={'description':_0x5657be[_0x595678(0x96)],'rule':_0x2ab99c};}return{'name':_0x326b94,'isJourneyLocal':_0x35d442,'definition':_0x2ec6ae};}catch(_0x4f4f38){return _0x552999[_0x595678(0xa7)]&&console[_0x595678(0xae)](_0x595678(0x75)+_0x49bc76+':\x20'+_0x4f4f38[_0x595678(0xb6)]),{'name':_0x49bc76,'isJourneyLocal':![]};}},'resolveActivation':async _0x485354=>{const _0x39bac9=a35_0x3b98,_0x3eb1b3=_0x41824b[_0x39bac9(0xd9)](_0x485354);if(_0x3eb1b3!==undefined)return{'name':_0x3eb1b3,'isJourneyLocal':!![]};try{const _0x3753d7=await _0x3b89d0[_0x39bac9(0x8c)][_0x39bac9(0x91)](_0xe3dfde,_0x485354),_0x55e779=_0x3753d7[_0x39bac9(0x97)][_0x39bac9(0xac)]['name']||_0x485354,_0x4b22c3=sanitizeYamlKey(_0x55e779)||'activation_'+_0x485354;let _0x4b4666=_0x4b22c3,_0x5d962a=0x2;while(_0x18314e['has'](_0x4b4666)){_0x4b4666=_0x4b22c3+'_'+_0x5d962a,_0x5d962a++;}_0x18314e[_0x39bac9(0xd0)](_0x4b4666),_0x41824b[_0x39bac9(0x7d)](_0x485354,_0x4b4666);const _0xee4457=journeyActivationStepToYaml(_0x3753d7,_0x13404c,_0x1220cf);return{'name':_0x4b4666,'isJourneyLocal':!![],'definition':_0xee4457};}catch(_0x57c95f){return _0x552999[_0x39bac9(0xa7)]&&console[_0x39bac9(0xae)]('Warning:\x20Could\x20not\x20resolve\x20activation\x20'+_0x485354+':\x20'+_0x57c95f[_0x39bac9(0xb6)]),{'name':_0x485354,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x1e13a5,_0xf2001c)=>resolveJumpTarget(_0x1e13a5,_0xf2001c,_0x15982f,_0x50a889=>_0x3b89d0[_0x3839f4(0x8c)][_0x3839f4(0x8a)](_0x50a889))});return{'createYamlContext':_0x4afc6a};};if(_0xae686a[_0x16da9a(0xd6)]>0x0){const _0x524701=Array['from'](_0xae686a[_0x16da9a(0xcc)]()),_0x1a25f1=await withQuerySpinner(_0x16da9a(0xcf),async _0x1e5fdf=>{const _0x3752cb=_0x16da9a,_0x3c8938=[];let _0x42e056=0x0;const _0x6868e8=0x5;for(let _0x1a744f=0x0;_0x1a744f<_0x524701['length'];_0x1a744f+=_0x6868e8){const _0x5880af=_0x524701['slice'](_0x1a744f,_0x1a744f+_0x6868e8),_0x2e18e9=await Promise[_0x3752cb(0x82)](_0x5880af[_0x3752cb(0x90)](async _0x1629d9=>{const _0x3e45c9=_0x3752cb,_0x170e21=_0x1629d9[0x0],_0x52689c=_0x170e21[_0x3e45c9(0x6e)];_0x1e5fdf[_0x3e45c9(0xb8)](_0x3e45c9(0xa0)+_0x52689c+'\x27');const _0x22c4d2=_0x170e21[_0x3e45c9(0xc7)]?_0x153add[_0x3e45c9(0xd9)](_0x170e21[_0x3e45c9(0xc7)])||'':'',{createYamlContext:_0x1e30bf}=_0x49a2ff(),_0x52ec7a=[];for(const _0xfeafe3 of _0x1629d9){const _0x43f9f1=await _0x3b89d0['journey']['getJourney'](_0xfeafe3['id']),_0x5278b7=_0x43f9f1[_0x3e45c9(0x97)]?.['audienceId'],_0xb4b68=_0x1e30bf(_0xfeafe3['id'],_0x5278b7),_0x6bdbdc=await apiToYamlAsync(_0x43f9f1,_0xb4b68);_0x52ec7a['push']({'item':_0xfeafe3,'yaml':_0x6bdbdc});}let _0x1a22cb;return _0x52ec7a[_0x3e45c9(0xb9)]===0x1?_0x1a22cb=_0x52ec7a[0x0][_0x3e45c9(0x8d)]:_0x1a22cb=buildMergedJourneyYaml(_0x52ec7a),{'bundleName':_0x52689c,'folderPath':_0x22c4d2,'finalYaml':_0x1a22cb};}));_0x3c8938['push'](..._0x2e18e9),_0x42e056+=_0x5880af[_0x3752cb(0xb9)],_0x1e5fdf[_0x3752cb(0xc8)]('('+_0x42e056+'/'+_0x524701[_0x3752cb(0xb9)]+')');}return _0x3c8938;},{'verbose':_0x552999[_0x16da9a(0xa7)]});for(const {bundleName:_0x478628,folderPath:_0x1527f7,finalYaml:_0x18060b}of _0x1a25f1[_0x16da9a(0xbc)]){const _0x13b351=normalizeJourneyYaml(_0x18060b),_0x3a1ae7=a35_0x317b92(_0x13b351),_0x2aef6d=_0x1527f7?a35_0xd20431[_0x16da9a(0xb7)](_0x38fe64,_0x1527f7):_0x38fe64,_0x4d0739=sanitizeFileName(_0x478628),_0x457a97=getUniqueFileName(_0x2aef6d,_0x4d0739,_0x57c394),_0x59f522=a35_0xd20431[_0x16da9a(0xb7)](_0x2aef6d,_0x457a97+_0x16da9a(0x81));_0x4aa563['push'](prepareFile(_0x59f522,_0x3a1ae7,_0x38fe64));}}const _0x212ec5=Array[_0x16da9a(0x8e)](_0x3d453c['values']())[_0x16da9a(0x71)]((_0x2b9614,_0x17775d)=>_0x2b9614+_0x17775d[_0x16da9a(0xb9)],0x0),_0x2f1282=_0x4aa563[_0x16da9a(0xb4)](_0x18a2d1=>_0x18a2d1[_0x16da9a(0xd2)]),_0x19dab1=_0x4aa563[_0x16da9a(0xb4)](_0x570d3a=>!_0x570d3a['isNew']&&_0x570d3a['hasChanges']),_0x145dc9=_0x4aa563[_0x16da9a(0xb4)](_0x5e994b=>!_0x5e994b['isNew']&&!_0x5e994b[_0x16da9a(0x9e)]),_0x46e2ca=_0x1a0221[_0x16da9a(0xb4)](_0x3ed2f4=>_0x3ed2f4['kind']!==SEGMENT_KIND_JOURNEY);console[_0x16da9a(0xae)](_0x16da9a(0xe1)+_0x4d321b+'\x27:'),console[_0x16da9a(0xae)](_0x16da9a(0x72)+a35_0x41de43['cyan'](_0x46e2ca['length']+'\x20segments')+_0x16da9a(0xb2)+a35_0x41de43[_0x16da9a(0xbf)](_0x212ec5+_0x16da9a(0xdb)));if(_0xae686a[_0x16da9a(0xd6)]>0x0){const _0x1e8053=_0x11c073['length'],_0x3d8341=_0xae686a[_0x16da9a(0xd6)],_0x1fe093=_0x1e8053>_0x3d8341?'\x20('+_0x1e8053+_0x16da9a(0x84):'';console['error'](_0x16da9a(0xb3)+a35_0x41de43[_0x16da9a(0xbf)](_0x3d8341+_0x16da9a(0xc6))+a35_0x41de43['dim'](_0x1fe093));}console['error']('\x20\x20'+a35_0x41de43['green']('+\x20'+_0x2f1282[_0x16da9a(0xb9)]+_0x16da9a(0xe3))),console[_0x16da9a(0xae)]('\x20\x20'+a35_0x41de43[_0x16da9a(0x87)]('~\x20'+_0x19dab1[_0x16da9a(0xb9)]+_0x16da9a(0xa8))),console[_0x16da9a(0xae)]('\x20\x20'+a35_0x41de43['dim']('=\x20'+_0x145dc9[_0x16da9a(0xb9)]+_0x16da9a(0x7f))),console[_0x16da9a(0xae)]('\x20\x20Target:\x20'+a35_0x41de43['cyan'](_0x38fe64)+'\x0a');if(_0x19dab1[_0x16da9a(0xb9)]>0x0)for(const _0x45f949 of _0x19dab1){console[_0x16da9a(0xae)](_0x16da9a(0x7e)+_0x45f949['relativePath']+'\x27:'),console[_0x16da9a(0xae)]('─'[_0x16da9a(0xaf)](0x3c)),console[_0x16da9a(0xae)](_0x45f949[_0x16da9a(0xd4)]),console[_0x16da9a(0xae)]('─'[_0x16da9a(0xaf)](0x3c));}if(_0x552999[_0x16da9a(0x8b)])return console[_0x16da9a(0xae)](a35_0x41de43[_0x16da9a(0x87)](_0x16da9a(0xb0))),0x0;if(_0x2f1282['length']===0x0&&_0x19dab1[_0x16da9a(0xb9)]===0x0)return console['error'](a35_0x41de43[_0x16da9a(0xa4)](_0x16da9a(0x9d))),saveSessionContext({'parent_segment':_0x4d321b},_0x552999[_0x16da9a(0x89)]),console[_0x16da9a(0xae)](a35_0x41de43[_0x16da9a(0xa4)](_0x16da9a(0xa1)+a35_0x41de43[_0x16da9a(0xab)]('parent_segment')+_0x16da9a(0x7b)+a35_0x41de43[_0x16da9a(0xbf)](_0x4d321b))),0x0;if(!_0x552999['yes']&&(_0x2f1282['length']>0x0||_0x19dab1[_0x16da9a(0xb9)]>0x0)){const _0x7c47ec=await confirmKey(_0x16da9a(0x9c)+(_0x2f1282['length']+_0x19dab1[_0x16da9a(0xb9)])+'\x20files?');if(!_0x7c47ec)return console[_0x16da9a(0xae)]('Aborted.'),0x1;}for(const _0x764612 of _0x4aa563){if(_0x764612['isNew']||_0x764612[_0x16da9a(0x9e)]){const _0x3a375d=a35_0xd20431[_0x16da9a(0xd1)](_0x764612[_0x16da9a(0x8f)]);!existsSync(_0x3a375d)&&mkdirSync(_0x3a375d,{'recursive':!![]}),writeFileSync(_0x764612[_0x16da9a(0x8f)],_0x764612[_0x16da9a(0xad)],_0x16da9a(0x77));}}return console['error'](a35_0x41de43[_0x16da9a(0xa4)](_0x16da9a(0x80)+(_0x2f1282[_0x16da9a(0xb9)]+_0x19dab1[_0x16da9a(0xb9)])+_0x16da9a(0x95)+_0x38fe64)),saveSessionContext({'parent_segment':_0x4d321b},_0x552999['session']),console[_0x16da9a(0xae)](a35_0x41de43[_0x16da9a(0xa4)](_0x16da9a(0xa1)+a35_0x41de43[_0x16da9a(0xab)](_0x16da9a(0x6f))+_0x16da9a(0x7b)+a35_0x41de43[_0x16da9a(0xbf)](_0x4d321b))),0x0;}}function a35_0x53e0(){const _0x2d8ce7=['dryRun','journey','yaml','from','absolutePath','map','getActivation','\x27...','push','versionNumber','\x20files\x20to\x20','description','attributes','user','journeyBundleId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','connection','Write\x20','✔\x20All\x20files\x20are\x20up\x20to\x20date','hasChanges','segmentFolderId','Fetching\x20journey\x20\x27','✔\x20Context\x20set:\x20','2704GcQMuu','2774120lwIIou','green','buildIdToNameMap','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','verbose','\x20changed\x20files','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','parentSegment','dim','activationParams','content','error','repeat','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','kind','\x20with\x20','\x20\x20🗺️\x20\x20','filter','rule','message','join','setPhase','length','78083710TDvCHn','Resolving\x20parent\x20segment\x20\x27','data','listActivations','Fetching\x20journeys...','cyan','Found\x20existing\x20tdx.json\x20at:\x20','name','258FyCgYf','segment','8rsMPgh','sort','\x20journeys','folderId','setExtra','getSegment','5144634vVusDB','3328550wcTDPV','values','has','buildIdToEmailMap','Processing\x20journeys...','add','dirname','isNew','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','diff','Site:\x20','size','Fetching\x20connections\x20for\x20name\x20resolution...','then','get','tdx.json','\x20activations','Fetching\x20parent\x20segment\x20info...','parentFolderId','43857axwiko','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','site','\x0aPull\x20summary\x20for\x20\x27','relative','\x20new\x20files','348802vjMXWz','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)','journeyBundleName','parent_segment','Resolved\x20parent\x20name:\x20','reduce','\x20\x20🎯\x20','isDirectory','red','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Fetching\x20users\x20for\x20email\x20resolution...','utf-8','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','getParent','Using\x20parent\x20segment:\x20','\x20=\x20','segment:pull','set','\x0aChanges\x20to\x20\x27','\x20unchanged\x20files','✔\x20Pulled\x20','.yml','all','58079OKgQuN','\x20versions)','execute','Fetching\x20segments...','yellow','listFolders','session','getJourney'];a35_0x53e0=function(){return _0x2d8ce7;};return a35_0x53e0();}export function buildFolderPathMap(_0x3688ff){const _0x1b7d88=a35_0x4be2f7,_0x52fd1a=new Map(),_0x548c9a=new Map();for(const _0x4410d3 of _0x3688ff){_0x548c9a[_0x1b7d88(0x7d)](_0x4410d3['id'],_0x4410d3);}const _0x5a0837=new Set();for(const _0x50e0d5 of _0x3688ff){!_0x50e0d5['parentFolderId']&&_0x5a0837[_0x1b7d88(0xd0)](_0x50e0d5['id']);}function _0x1ec3ab(_0x56d4b6){const _0xfd652d=_0x1b7d88;if(_0x52fd1a['has'](_0x56d4b6['id']))return _0x52fd1a[_0xfd652d(0xd9)](_0x56d4b6['id']);if(_0x5a0837[_0xfd652d(0xcd)](_0x56d4b6['id']))return _0x52fd1a[_0xfd652d(0x7d)](_0x56d4b6['id'],''),'';if(_0x56d4b6[_0xfd652d(0xdd)]){const _0x5876bb=_0x548c9a[_0xfd652d(0xd9)](_0x56d4b6[_0xfd652d(0xdd)]);if(_0x5876bb){const _0x15d128=_0x1ec3ab(_0x5876bb),_0x385a86=_0x15d128?_0x15d128+'/'+_0x56d4b6[_0xfd652d(0xc1)]:_0x56d4b6[_0xfd652d(0xc1)];return _0x52fd1a[_0xfd652d(0x7d)](_0x56d4b6['id'],_0x385a86),_0x385a86;}}const _0xe01eae=_0x56d4b6['name'];return _0x52fd1a[_0xfd652d(0x7d)](_0x56d4b6['id'],_0xe01eae),_0xe01eae;}for(const _0x421080 of _0x3688ff){_0x1ec3ab(_0x421080);}return _0x52fd1a;}function getUniqueFileName(_0x26ebe6,_0x52f3d3,_0xd71287){const _0x337ac9=a35_0x4be2f7,_0x3caab3=_0x26ebe6+':'+_0x52f3d3,_0x27d9f1=_0xd71287[_0x337ac9(0xd9)](_0x3caab3)||0x0;_0xd71287['set'](_0x3caab3,_0x27d9f1+0x1);if(_0x27d9f1===0x0)return _0x52f3d3;return _0x52f3d3+'-'+_0x27d9f1;}function prepareFile(_0x26e196,_0x4eff55,_0x448d74){const _0x4efde6=a35_0x4be2f7,_0x2d16c1=a35_0xd20431[_0x4efde6(0xe2)](_0x448d74,_0x26e196);if(existsSync(_0x26e196)){const _0x1a5021=readFileSync(_0x26e196,_0x4efde6(0x77)),_0x49bcdf=generateDiff(_0x1a5021,_0x4eff55),_0x543253=hasChanges(_0x49bcdf);return{'relativePath':_0x2d16c1,'absolutePath':_0x26e196,'content':_0x4eff55,'isNew':![],'hasChanges':_0x543253,'diff':_0x543253?formatDiffWithColors(_0x49bcdf):undefined};}return{'relativePath':_0x2d16c1,'absolutePath':_0x26e196,'content':_0x4eff55,'isNew':!![],'hasChanges':![]};}
|
|
1
|
+
const a35_0xcfcc47=a35_0x5a42;(function(_0x53212e,_0x416f99){const _0x2c5ed5=a35_0x5a42,_0x59a4a8=_0x53212e();while(!![]){try{const _0xe4376e=parseInt(_0x2c5ed5(0xbb))/0x1*(parseInt(_0x2c5ed5(0x100))/0x2)+-parseInt(_0x2c5ed5(0xdb))/0x3*(-parseInt(_0x2c5ed5(0xcb))/0x4)+-parseInt(_0x2c5ed5(0xff))/0x5*(-parseInt(_0x2c5ed5(0x118))/0x6)+-parseInt(_0x2c5ed5(0xe9))/0x7*(-parseInt(_0x2c5ed5(0xc4))/0x8)+-parseInt(_0x2c5ed5(0x11e))/0x9*(-parseInt(_0x2c5ed5(0x10c))/0xa)+-parseInt(_0x2c5ed5(0x105))/0xb*(parseInt(_0x2c5ed5(0xcd))/0xc)+-parseInt(_0x2c5ed5(0xaf))/0xd*(parseInt(_0x2c5ed5(0xda))/0xe);if(_0xe4376e===_0x416f99)break;else _0x59a4a8['push'](_0x59a4a8['shift']());}catch(_0x241f30){_0x59a4a8['push'](_0x59a4a8['shift']());}}}(a35_0x34ea,0xba865));function a35_0x34ea(){const _0x2402b3=['green','segment','Found\x20existing\x20tdx.json\x20at:\x20','Fetching\x20journeys...','760793Gotquh','journey','reduce','set','parentSegment','map','relative','1249890BREZgX','Resolving\x20parent\x20segment\x20\x27','Fetching\x20journey\x20\x27','dirname','\x20with\x20','versionNumber','relativePath','length','Parent\x20segment:\x20','absolutePath','Fetching\x20users\x20for\x20email\x20resolution...','user','120SZrExn','Warning:\x20Could\x20not\x20resolve\x20activation\x20','buildIdToNameMap','yellow','Site:\x20','listFolders','18xPIncU','push','get','\x20journeys','dim','Using\x20parent\x20segment:\x20','getActivation','\x20unchanged\x20files','sort','143hIVbPw','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','isDirectory','segmentFolderId','\x20=\x20','slice','audienceId','session','filter','parent_segment','✔\x20Context\x20set:\x20','message','22NIbFgQ','data','has','\x20activations','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','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)','dryRun','then','segment:pull','40XOGOXb','from','Resolved\x20parent\x20name:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20files\x20to\x20','name','attributes','68296vwVUri','\x0aPull\x20summary\x20for\x20\x27','36XtcXdT','Fetching\x20activations...','getSegment','size','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Found\x20tdx.json\x20at:\x20','cyan','hasChanges','folderId','journeyBundleName','activation_','Processing\x20journeys...','getParent','4960662tmDGMl','252ghzpvL','content','\x0aChanges\x20to\x20\x27','buildIdToEmailMap','listActivations','red','rule','\x20segments','\x20versions)','error','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Fetching\x20folders...','✔\x20Pulled\x20','execute','1437639VddIKX','setExtra','values','setPhase','\x20\x20Target:\x20','site','add','isNew','Fetching\x20connections\x20for\x20name\x20resolution...','getJourney','kind','description','yes','listJourneysFromParentSegment','utf-8','join','repeat','parentFolderId','.yml','verbose','all','\x27...','319745YjAkKp','79918oQGFne'];a35_0x34ea=function(){return _0x2402b3;};return a35_0x34ea();}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,resolveRuleSegmentRefs,journeyActivationStepToYaml}from'../sdk/segment/child-segment-yaml.js';import{apiToYamlAsync,toYamlString as a35_0x2fefb2,normalizeJourneyYaml}from'../sdk/segment/journey-yaml.js';import a35_0x352a8d from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a35_0x54fe0a 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{[a35_0xcfcc47(0xc9)]=a35_0xcfcc47(0xc3);[a35_0xcfcc47(0xf4)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a35_0xcfcc47(0xe8)](_0x4cba7d){const _0x349746=a35_0xcfcc47,{options:_0x10dc96,args:_0x37340d,tdx:_0x3f2f4b}=_0x4cba7d,_0x50385b=_0x10dc96,_0x3a943d=_0x10dc96[_0x349746(0x109)],_0x46ab93=_0x37340d[0x0],_0x308573=findTdxConfigPath();let _0x151b22,_0x417b40;if(!_0x46ab93&&_0x308573){const _0x354d7d=loadTdxConfig(_0x308573);_0x151b22=_0x354d7d[_0x349746(0xb8)],_0x417b40=a35_0x54fe0a[_0x349746(0x10f)](_0x308573),_0x50385b[_0x349746(0xfc)]&&(console[_0x349746(0xe4)](_0x349746(0x103)+_0x308573),console[_0x349746(0xe4)](_0x349746(0xab)+_0x151b22));}else{if(_0x46ab93){if(existsSync(_0x46ab93)&&statSync(_0x46ab93)[_0x349746(0xb1)]()){const _0x2079ce=findTdxConfigPath(_0x46ab93);if(_0x2079ce){const _0x975e39=loadTdxConfig(_0x2079ce);_0x151b22=_0x975e39[_0x349746(0xb8)],_0x417b40=a35_0x54fe0a['dirname'](_0x2079ce),_0x50385b[_0x349746(0xfc)]&&(console[_0x349746(0xe4)](_0x349746(0xd2)+_0x2079ce),console[_0x349746(0xe4)]('Using\x20parent\x20segment:\x20'+_0x151b22));}else return console[_0x349746(0xe4)](a35_0x352a8d[_0x349746(0xe0)](_0x349746(0xd1)+_0x46ab93+'\x0a')),console[_0x349746(0xe4)](a35_0x352a8d[_0x349746(0xd3)](_0x349746(0xc7))),0x1;}else _0x151b22=_0x46ab93;}else _0x151b22=_0x3a943d;}if(!_0x151b22)return console[_0x349746(0xe4)](a35_0x352a8d[_0x349746(0x11b)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x349746(0xe4)](_0x349746(0xc0)),console[_0x349746(0xe4)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console['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'),0x1;_0x50385b[_0x349746(0xfc)]&&(console[_0x349746(0xe4)](_0x349746(0x11c)+_0x50385b[_0x349746(0xee)]),console['error'](_0x349746(0x114)+_0x151b22));const _0x2f7994=await withSpinner(_0x349746(0x10d)+_0x151b22+_0x349746(0xfe),()=>_0x3f2f4b[_0x349746(0x102)]['resolveParentId'](_0x151b22),{'verbose':_0x50385b['verbose']}),_0x26e9a9=_0x2f7994[_0x349746(0xbc)],_0x56941c=await withSpinner('Fetching\x20parent\x20segment\x20info...',()=>_0x3f2f4b['segment'][_0x349746(0xd9)](_0x26e9a9),{'verbose':_0x50385b[_0x349746(0xfc)]}),_0x49e9f9=_0x56941c[_0x349746(0xbc)][_0x349746(0xca)][_0x349746(0xc9)];_0x50385b['verbose']&&console['error'](_0x349746(0xc6)+_0x49e9f9);const [_0x4f602e,_0x426dc9,_0xf37ed5]=await Promise[_0x349746(0xfd)]([withSpinner('Fetching\x20segments...',()=>_0x3f2f4b['segment']['listSegments'](_0x26e9a9),{'verbose':_0x50385b[_0x349746(0xfc)]}),withSpinner(_0x349746(0xe6),()=>_0x3f2f4b[_0x349746(0x102)][_0x349746(0x11d)](_0x26e9a9),{'verbose':_0x50385b[_0x349746(0xfc)]}),withSpinner(_0x349746(0x104),()=>_0x3f2f4b['journey'][_0x349746(0xf6)](_0x26e9a9),{'verbose':_0x50385b['verbose']})]),_0x2bea74=_0x4f602e['data'],_0x46636e=_0x426dc9[_0x349746(0xbc)],_0x2cc2fe=_0xf37ed5[_0x349746(0xbc)];if(_0x2bea74[_0x349746(0x113)]===0x0&&_0x2cc2fe[_0x349746(0x113)]===0x0)return console['error'](a35_0x352a8d[_0x349746(0x11b)](_0x349746(0xbf)+_0x49e9f9+'\x27')),0x0;const _0x3d7f04=buildFolderPathMap(_0x46636e),_0x532774=_0x417b40||getSegmentRootDir(sanitizeFileName(_0x151b22)),_0x4363fb=new Map();await withSpinner(_0x349746(0xce),async()=>{await batchAsync(_0x2bea74,async _0x4cac4f=>{const _0x59d6f7=a35_0x5a42,_0x37afaa=await _0x3f2f4b[_0x59d6f7(0x102)][_0x59d6f7(0xdf)](_0x26e9a9,_0x4cac4f['id']);_0x4363fb['set'](_0x4cac4f['id'],_0x37afaa);});},{'verbose':_0x50385b[_0x349746(0xfc)]});const _0x29a7cd=await withSpinner(_0x349746(0x116),()=>_0x3f2f4b[_0x349746(0x117)][_0x349746(0xde)](),{'verbose':_0x50385b['verbose']})[_0x349746(0xc2)](_0x3357d3=>_0x3357d3[_0x349746(0xbc)]),_0x14bb15=await withSpinner(_0x349746(0xf1),()=>_0x3f2f4b['connection'][_0x349746(0x11a)](),{'verbose':_0x50385b[_0x349746(0xfc)]})[_0x349746(0xc2)](_0x36f88c=>_0x36f88c[_0x349746(0xbc)]),_0x5283ed=[],_0x3c04f1=a35_0x54fe0a[_0x349746(0xf8)](_0x532774,'tdx.json'),_0x4ddbd4=createTdxConfigContent(_0x49e9f9);_0x5283ed['push'](prepareFile(_0x3c04f1,_0x4ddbd4,_0x532774));const _0x27eddf=new Map();for(const _0x608405 of _0x2bea74){if(_0x608405[_0x349746(0xf3)]===SEGMENT_KIND_JOURNEY)continue;const _0x44ac67=_0x608405[_0x349746(0xb2)]?_0x3d7f04[_0x349746(0x120)](_0x608405[_0x349746(0xb2)])||'':'',_0x11b71f=_0x4363fb[_0x349746(0x120)](_0x608405['id'])||[],_0x25c845=segmentWithActivationsToYaml(_0x608405,_0x11b71f,undefined,_0x29a7cd,_0x14bb15),_0x47abda=_0x44ac67?a35_0x54fe0a[_0x349746(0xf8)](_0x532774,_0x44ac67):_0x532774,_0x12fd3a=sanitizeFileName(_0x608405['name']),_0xd69f7=getUniqueFileName(_0x47abda,_0x12fd3a,_0x27eddf),_0x2933ed=a35_0x54fe0a[_0x349746(0xf8)](_0x47abda,_0xd69f7+_0x349746(0xfb)),_0x593677=segmentToYamlString(_0x25c845);_0x5283ed[_0x349746(0x11f)](prepareFile(_0x2933ed,_0x593677,_0x532774));}const _0x5e3a31=new Map();for(const _0x37d6d0 of _0x2bea74){_0x5e3a31[_0x349746(0x108)](_0x37d6d0['id'],_0x37d6d0);}const _0xa62319=new Map();for(const _0x2b7d35 of _0x2cc2fe){const _0x52a548=_0x2b7d35['journeyBundleId'];!_0xa62319[_0x349746(0xbd)](_0x52a548)&&_0xa62319[_0x349746(0x108)](_0x52a548,[]),_0xa62319[_0x349746(0x120)](_0x52a548)[_0x349746(0x11f)](_0x2b7d35);}for(const _0x2052e2 of _0xa62319[_0x349746(0xeb)]()){_0x2052e2[_0x349746(0xae)]((_0x3350be,_0x330f54)=>(_0x3350be[_0x349746(0x111)]||0x0)-(_0x330f54[_0x349746(0x111)]||0x0));}const _0x269409=()=>{const _0x2b3d1a=_0x349746,_0x313bbf=new Set(),_0x469425=new Set(),_0x56dc0a=new Map(),_0x1c7a19=new Map(),_0x5da176=createJumpTargetCache(),_0xca1636=(_0x543315,_0x482fb6)=>({'resolveSegment':async _0x559eda=>{const _0x257f80=a35_0x5a42,_0x561907=_0x56dc0a[_0x257f80(0x120)](_0x559eda);if(_0x561907!==undefined)return{'name':_0x561907,'isJourneyLocal':!![]};if(!_0x482fb6)return{'name':_0x559eda,'isJourneyLocal':![]};try{let _0x9d95f9=_0x5e3a31[_0x257f80(0x120)](_0x559eda);!_0x9d95f9&&(_0x9d95f9=await _0x3f2f4b[_0x257f80(0x102)]['getSegment'](_0x482fb6,_0x559eda));const _0x5d806f=generateJourneyLocalName(_0x9d95f9[_0x257f80(0xc9)]),_0x41924a=_0x9d95f9['kind']===SEGMENT_KIND_JOURNEY&&_0x5d806f!==undefined;let _0x26a79b=_0x9d95f9['name'];if(_0x41924a&&_0x5d806f){let _0x29bf47=_0x5d806f,_0x107b7d=0x2;while(_0x313bbf[_0x257f80(0xbd)](_0x29bf47)){_0x29bf47=_0x5d806f+'_'+_0x107b7d,_0x107b7d++;}_0x313bbf[_0x257f80(0xef)](_0x29bf47),_0x26a79b=_0x29bf47,_0x56dc0a[_0x257f80(0x108)](_0x559eda,_0x26a79b);}let _0x857063;if(_0x41924a&&_0x9d95f9[_0x257f80(0xe1)]){let _0x494ccc=apiRuleToYaml(_0x9d95f9[_0x257f80(0xe1)]);_0x494ccc=await resolveRuleSegmentRefs(_0x494ccc,async _0x42ca0a=>{const _0x27b5b3=_0x257f80,_0x129ab3=await _0x3f2f4b[_0x27b5b3(0x102)][_0x27b5b3(0xcf)](_0x482fb6,_0x42ca0a);return _0x129ab3[_0x27b5b3(0xc9)];}),_0x857063={'description':_0x9d95f9['description'],'rule':_0x494ccc};}return{'name':_0x26a79b,'isJourneyLocal':_0x41924a,'definition':_0x857063};}catch(_0x461d22){return _0x50385b[_0x257f80(0xfc)]&&console[_0x257f80(0xe4)](_0x257f80(0xe5)+_0x559eda+':\x20'+_0x461d22[_0x257f80(0xba)]),{'name':_0x559eda,'isJourneyLocal':![]};}},'resolveActivation':async _0x1d06de=>{const _0x53f766=a35_0x5a42,_0x26ecb0=_0x1c7a19[_0x53f766(0x120)](_0x1d06de);if(_0x26ecb0!==undefined)return{'name':_0x26ecb0,'isJourneyLocal':!![]};try{const _0x5b8c3c=await _0x3f2f4b[_0x53f766(0x106)][_0x53f766(0xac)](_0x543315,_0x1d06de),_0x57eeb9=_0x5b8c3c['attributes']['activationParams']['name']||_0x1d06de,_0x460bab=sanitizeYamlKey(_0x57eeb9)||_0x53f766(0xd7)+_0x1d06de;let _0x232ec9=_0x460bab,_0x6a2f89=0x2;while(_0x469425['has'](_0x232ec9)){_0x232ec9=_0x460bab+'_'+_0x6a2f89,_0x6a2f89++;}_0x469425[_0x53f766(0xef)](_0x232ec9),_0x1c7a19[_0x53f766(0x108)](_0x1d06de,_0x232ec9);const _0x10b293=journeyActivationStepToYaml(_0x5b8c3c,_0x29a7cd,_0x14bb15);return{'name':_0x232ec9,'isJourneyLocal':!![],'definition':_0x10b293};}catch(_0x4afb1a){return _0x50385b[_0x53f766(0xfc)]&&console[_0x53f766(0xe4)](_0x53f766(0x119)+_0x1d06de+':\x20'+_0x4afb1a[_0x53f766(0xba)]),{'name':_0x1d06de,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x49bd96,_0x3d1347)=>resolveJumpTarget(_0x49bd96,_0x3d1347,_0x5da176,_0x58e079=>_0x3f2f4b[_0x2b3d1a(0x106)][_0x2b3d1a(0xf2)](_0x58e079))});return{'createYamlContext':_0xca1636};};if(_0xa62319[_0x349746(0xd0)]>0x0){const _0x1e91dd=Array[_0x349746(0xc5)](_0xa62319[_0x349746(0xeb)]()),_0x2177a0=await withQuerySpinner(_0x349746(0xd8),async _0x2f5251=>{const _0x30d1e9=_0x349746,_0x4c3e4c=[];let _0x2a9657=0x0;const _0x4063e4=0x5;for(let _0x59679b=0x0;_0x59679b<_0x1e91dd[_0x30d1e9(0x113)];_0x59679b+=_0x4063e4){const _0x5da26d=_0x1e91dd[_0x30d1e9(0xb4)](_0x59679b,_0x59679b+_0x4063e4),_0x55cb09=await Promise[_0x30d1e9(0xfd)](_0x5da26d[_0x30d1e9(0x10a)](async _0x2d137d=>{const _0x3c624e=_0x30d1e9,_0x52d0d3=_0x2d137d[0x0],_0x56755c=_0x52d0d3[_0x3c624e(0xd6)];_0x2f5251[_0x3c624e(0xec)](_0x3c624e(0x10e)+_0x56755c+'\x27');const _0x2c9efb=_0x52d0d3[_0x3c624e(0xd5)]?_0x3d7f04['get'](_0x52d0d3[_0x3c624e(0xd5)])||'':'',{createYamlContext:_0x472168}=_0x269409(),_0x35e058=[];for(const _0xfbfc65 of _0x2d137d){const _0x391dec=await _0x3f2f4b[_0x3c624e(0x106)][_0x3c624e(0xf2)](_0xfbfc65['id']),_0x12a7d2=_0x391dec[_0x3c624e(0xca)]?.[_0x3c624e(0xb5)],_0x1bd6e9=_0x472168(_0xfbfc65['id'],_0x12a7d2),_0x55ff92=await apiToYamlAsync(_0x391dec,_0x1bd6e9);_0x35e058['push']({'item':_0xfbfc65,'yaml':_0x55ff92});}let _0x2e4e87;return _0x35e058['length']===0x1?_0x2e4e87=_0x35e058[0x0]['yaml']:_0x2e4e87=buildMergedJourneyYaml(_0x35e058),{'bundleName':_0x56755c,'folderPath':_0x2c9efb,'finalYaml':_0x2e4e87};}));_0x4c3e4c['push'](..._0x55cb09),_0x2a9657+=_0x5da26d[_0x30d1e9(0x113)],_0x2f5251[_0x30d1e9(0xea)]('('+_0x2a9657+'/'+_0x1e91dd[_0x30d1e9(0x113)]+')');}return _0x4c3e4c;},{'verbose':_0x50385b['verbose']});for(const {bundleName:_0x1c1886,folderPath:_0x3010a3,finalYaml:_0x2753ae}of _0x2177a0[_0x349746(0xbc)]){const _0x407077=normalizeJourneyYaml(_0x2753ae),_0x307c5e=a35_0x2fefb2(_0x407077),_0x1b6ae6=_0x3010a3?a35_0x54fe0a['join'](_0x532774,_0x3010a3):_0x532774,_0x4983b7=sanitizeFileName(_0x1c1886),_0x2049d9=getUniqueFileName(_0x1b6ae6,_0x4983b7,_0x27eddf),_0x11524d=a35_0x54fe0a[_0x349746(0xf8)](_0x1b6ae6,_0x2049d9+_0x349746(0xfb));_0x5283ed[_0x349746(0x11f)](prepareFile(_0x11524d,_0x307c5e,_0x532774));}}const _0x2f069a=Array[_0x349746(0xc5)](_0x4363fb[_0x349746(0xeb)]())[_0x349746(0x107)]((_0x1214c9,_0x41d96a)=>_0x1214c9+_0x41d96a[_0x349746(0x113)],0x0),_0x15f62d=_0x5283ed['filter'](_0x185446=>_0x185446[_0x349746(0xf0)]),_0x4623a0=_0x5283ed[_0x349746(0xb7)](_0x2c739e=>!_0x2c739e[_0x349746(0xf0)]&&_0x2c739e['hasChanges']),_0x395290=_0x5283ed[_0x349746(0xb7)](_0x1ac1d4=>!_0x1ac1d4[_0x349746(0xf0)]&&!_0x1ac1d4[_0x349746(0xd4)]),_0x52facf=_0x2bea74[_0x349746(0xb7)](_0xed61a5=>_0xed61a5[_0x349746(0xf3)]!==SEGMENT_KIND_JOURNEY);console[_0x349746(0xe4)](_0x349746(0xcc)+_0x49e9f9+'\x27:'),console[_0x349746(0xe4)]('\x20\x20🎯\x20'+a35_0x352a8d[_0x349746(0xd3)](_0x52facf[_0x349746(0x113)]+_0x349746(0xe2))+_0x349746(0x110)+a35_0x352a8d['cyan'](_0x2f069a+_0x349746(0xbe)));if(_0xa62319[_0x349746(0xd0)]>0x0){const _0x48d546=_0x2cc2fe[_0x349746(0x113)],_0x2c2750=_0xa62319[_0x349746(0xd0)],_0x3a4838=_0x48d546>_0x2c2750?'\x20('+_0x48d546+_0x349746(0xe3):'';console[_0x349746(0xe4)]('\x20\x20🗺️\x20\x20'+a35_0x352a8d[_0x349746(0xd3)](_0x2c2750+_0x349746(0x121))+a35_0x352a8d['dim'](_0x3a4838));}console[_0x349746(0xe4)]('\x20\x20'+a35_0x352a8d[_0x349746(0x101)]('+\x20'+_0x15f62d[_0x349746(0x113)]+'\x20new\x20files')),console[_0x349746(0xe4)]('\x20\x20'+a35_0x352a8d['yellow']('~\x20'+_0x4623a0[_0x349746(0x113)]+'\x20changed\x20files')),console[_0x349746(0xe4)]('\x20\x20'+a35_0x352a8d['dim']('=\x20'+_0x395290[_0x349746(0x113)]+_0x349746(0xad))),console['error'](_0x349746(0xed)+a35_0x352a8d['cyan'](_0x532774)+'\x0a');if(_0x4623a0[_0x349746(0x113)]>0x0)for(const _0x190b04 of _0x4623a0){console['error'](_0x349746(0xdd)+_0x190b04[_0x349746(0x112)]+'\x27:'),console['error']('─'[_0x349746(0xf9)](0x3c)),console['error'](_0x190b04['diff']),console[_0x349746(0xe4)]('─'[_0x349746(0xf9)](0x3c));}if(_0x50385b[_0x349746(0xc1)])return console[_0x349746(0xe4)](a35_0x352a8d[_0x349746(0x11b)](_0x349746(0xb0))),0x0;if(_0x15f62d[_0x349746(0x113)]===0x0&&_0x4623a0[_0x349746(0x113)]===0x0)return console[_0x349746(0xe4)](a35_0x352a8d[_0x349746(0x101)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x49e9f9},_0x50385b[_0x349746(0xb6)]),console[_0x349746(0xe4)](a35_0x352a8d[_0x349746(0x101)](_0x349746(0xb9)+a35_0x352a8d['dim']('parent_segment')+_0x349746(0xb3)+a35_0x352a8d['cyan'](_0x49e9f9))),0x0;if(!_0x50385b[_0x349746(0xf5)]&&(_0x15f62d[_0x349746(0x113)]>0x0||_0x4623a0[_0x349746(0x113)]>0x0)){const _0x4e8e7a=await confirmKey('Write\x20'+(_0x15f62d[_0x349746(0x113)]+_0x4623a0[_0x349746(0x113)])+'\x20files?');if(!_0x4e8e7a)return console[_0x349746(0xe4)]('Aborted.'),0x1;}for(const _0x46e97d of _0x5283ed){if(_0x46e97d[_0x349746(0xf0)]||_0x46e97d['hasChanges']){const _0x34eaf3=a35_0x54fe0a[_0x349746(0x10f)](_0x46e97d['absolutePath']);!existsSync(_0x34eaf3)&&mkdirSync(_0x34eaf3,{'recursive':!![]}),writeFileSync(_0x46e97d[_0x349746(0x115)],_0x46e97d[_0x349746(0xdc)],_0x349746(0xf7));}}return console[_0x349746(0xe4)](a35_0x352a8d[_0x349746(0x101)](_0x349746(0xe7)+(_0x15f62d['length']+_0x4623a0[_0x349746(0x113)])+_0x349746(0xc8)+_0x532774)),saveSessionContext({'parent_segment':_0x49e9f9},_0x50385b[_0x349746(0xb6)]),console[_0x349746(0xe4)](a35_0x352a8d[_0x349746(0x101)](_0x349746(0xb9)+a35_0x352a8d[_0x349746(0x122)]('parent_segment')+'\x20=\x20'+a35_0x352a8d['cyan'](_0x49e9f9))),0x0;}}export function buildFolderPathMap(_0x293c2a){const _0x11310d=a35_0xcfcc47,_0xf3f07a=new Map(),_0x3816ea=new Map();for(const _0x3f1ff3 of _0x293c2a){_0x3816ea['set'](_0x3f1ff3['id'],_0x3f1ff3);}const _0x430d42=new Set();for(const _0x18e979 of _0x293c2a){!_0x18e979[_0x11310d(0xfa)]&&_0x430d42['add'](_0x18e979['id']);}function _0x383c8e(_0x3ef1b4){const _0xfc6102=_0x11310d;if(_0xf3f07a[_0xfc6102(0xbd)](_0x3ef1b4['id']))return _0xf3f07a[_0xfc6102(0x120)](_0x3ef1b4['id']);if(_0x430d42[_0xfc6102(0xbd)](_0x3ef1b4['id']))return _0xf3f07a[_0xfc6102(0x108)](_0x3ef1b4['id'],''),'';if(_0x3ef1b4[_0xfc6102(0xfa)]){const _0x200ce1=_0x3816ea[_0xfc6102(0x120)](_0x3ef1b4[_0xfc6102(0xfa)]);if(_0x200ce1){const _0x36a938=_0x383c8e(_0x200ce1),_0x3bce75=_0x36a938?_0x36a938+'/'+_0x3ef1b4[_0xfc6102(0xc9)]:_0x3ef1b4['name'];return _0xf3f07a[_0xfc6102(0x108)](_0x3ef1b4['id'],_0x3bce75),_0x3bce75;}}const _0x1045c4=_0x3ef1b4['name'];return _0xf3f07a[_0xfc6102(0x108)](_0x3ef1b4['id'],_0x1045c4),_0x1045c4;}for(const _0x2ea720 of _0x293c2a){_0x383c8e(_0x2ea720);}return _0xf3f07a;}function getUniqueFileName(_0x4dcbbc,_0x999572,_0x4b5a8b){const _0x527085=a35_0xcfcc47,_0x1faa08=_0x4dcbbc+':'+_0x999572,_0x458f67=_0x4b5a8b[_0x527085(0x120)](_0x1faa08)||0x0;_0x4b5a8b[_0x527085(0x108)](_0x1faa08,_0x458f67+0x1);if(_0x458f67===0x0)return _0x999572;return _0x999572+'-'+_0x458f67;}function a35_0x5a42(_0x2bf1d3,_0x3feee9){_0x2bf1d3=_0x2bf1d3-0xab;const _0x34ea1a=a35_0x34ea();let _0x5a4235=_0x34ea1a[_0x2bf1d3];return _0x5a4235;}function prepareFile(_0x48a806,_0x57c0b0,_0x1c9de8){const _0x50cf56=a35_0xcfcc47,_0x1d778a=a35_0x54fe0a[_0x50cf56(0x10b)](_0x1c9de8,_0x48a806);if(existsSync(_0x48a806)){const _0x11ada1=readFileSync(_0x48a806,'utf-8'),_0x124f6d=generateDiff(_0x11ada1,_0x57c0b0),_0x47db37=hasChanges(_0x124f6d);return{'relativePath':_0x1d778a,'absolutePath':_0x48a806,'content':_0x57c0b0,'isNew':![],'hasChanges':_0x47db37,'diff':_0x47db37?formatDiffWithColors(_0x124f6d):undefined};}return{'relativePath':_0x1d778a,'absolutePath':_0x48a806,'content':_0x57c0b0,'isNew':!![],'hasChanges':![]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a36_0x678b6b=a36_0x4aa3;(function(_0x1f9dbd,_0x48f377){const _0x13629e=a36_0x4aa3,_0x541aff=_0x1f9dbd();while(!![]){try{const _0x1222fc=parseInt(_0x13629e(0x23b))/0x1*(-parseInt(_0x13629e(0x25d))/0x2)+parseInt(_0x13629e(0x221))/0x3+-parseInt(_0x13629e(0x205))/0x4+parseInt(_0x13629e(0x1f3))/0x5*(-parseInt(_0x13629e(0x201))/0x6)+parseInt(_0x13629e(0x2cc))/0x7+-parseInt(_0x13629e(0x1fa))/0x8+parseInt(_0x13629e(0x1f0))/0x9*(parseInt(_0x13629e(0x2ac))/0xa);if(_0x1222fc===_0x48f377)break;else _0x541aff['push'](_0x541aff['shift']());}catch(_0x25942a){_0x541aff['push'](_0x541aff['shift']());}}}(a36_0x5d0b,0x93b83));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,journeyActivationStepToYaml,activationToYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,resolveRuleSegmentRefs}from'../sdk/segment/child-segment-yaml.js';import{isJourneyYaml,parseYamlString as a36_0x143775,yamlToApi as a36_0x211d32,toYamlString as a36_0x58d156,apiToYamlAsync,hasMultipleVersions,normalizeJourneyYaml}from'../sdk/segment/journey-yaml.js';function a36_0x4aa3(_0x567463,_0x284c94){_0x567463=_0x567463-0x1c4;const _0x5d0be1=a36_0x5d0b();let _0x4aa37c=_0x5d0be1[_0x567463];return _0x4aa37c;}function a36_0x5d0b(){const _0x461b7f=['\x20journey\x20from\x20file:\x20','isDirectory','stages','exitCriterias','40275PBGhgK','get','max','\x20activations]','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','config','\x20YAML\x20files\x20found','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Pushing\x20journeys...','/app/ps/','add','Fetching\x20parent\x20segment\x20details...','stringify','\x20folders\x20to\x20create','error','toLowerCase','journeysOnly','createJourneySegment','\x27\x20details...','✔\x20Created\x20folder\x20\x27','dirname','createActivation','Creating\x20folder\x20\x27','getOutputSchemaWithCache','entryCriteria','✔\x20Created\x20segment\x20\x27','3341KPuDVt','Error:\x20Directory\x20not\x20found:\x20','segment:push','Activation','\x20to\x20delete','unchanged','\x27\x20(internal:\x20','folderId','\x20\x20Step\x201:\x20Creating\x20journey\x20without\x20entry\x20criteria:\x20','replace','parentSegmentFolder','Deleting\x20activation\x20\x27','randomUUID','yamlConfig','goal\x20criteria','repeat','journey_entry_criteria_','red','journeyId','parent_segment','\x27\x20v','yes','Fetching\x20existing\x20folders...','folderPath','cyan','Creating','\x20\x20Activations:','\x20\x20Step\x203:\x20Updating\x20journey\x20with\x20entry\x20criteria\x20and\x20activation\x20IDs:\x20','list','\x20\x20Created\x20embedded\x20segment\x20\x27','updated','endsWith',')\x20with\x20ID:\x20','journeys','716GrjPbH','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)','📁\x20','segments','DecisionPoint','stage\x20\x27','Deleting\x20segment\x20\x27','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20\x20Created\x20embedded\x20activation\x20\x27','Scoped\x20to\x20folder:\x20','\x20\x20Activations:\x20','JOURNEY_SYNTAX_ERROR','NOT_FOUND','with','INTERNAL','conditions[','join','journeyActivationStepId','Segment\x20not\x20found:\x20','existingActivation','Push\x20','\x27\x20with\x20ID:\x20','\x20deleted','Fetching\x20users\x20for\x20email\x20resolution...','decision_point','string','activations','journeyBundleName','toString','SEGMENT_UPDATE_ERROR','isArray','absolutePath','\x20\x20✔\x20Deleted\x20activation\x20\x27','exitCriteria','push','\x27\x20from\x20file:\x20','ACTIVATION_SYNTAX_ERROR','include','slice','\x20segment\x20from\x20file:\x20','name','getSegment','parse','Activation\x20not\x20found:\x20','has','description','.yml','\x27\x20decision\x20point\x20branch\x20\x27','Site:\x20','\x20to\x20update','split','\x20\x20\x20\x20','versionNumber','Failed\x20to\x20','buildUserMaps','No\x20','entry','dim','attribute','startsWith','Please\x20specify\x20a\x20valid\x20attribute\x20name.','\x20activation\x20\x27','New\x20segment:','data','size','(Journey\x20will\x20be\x20deleted)','resolveSegment','sort','existingSegment','Fetching\x20existing\x20activations...',').\x20','update','map','parentFolderId','relationships','resolve','Source\x20directory:\x20','JOURNEY_UPDATE_ERROR','Fetching\x20connections\x20for\x20name\x20resolution...','124130gmzgvA','steps','values','listSegments','parentFolder','\x0a✔\x20Push\x20complete','verbose','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','resolveJourneyId','segmentId','segmentFolderId','Failed\x20to\x20create\x20embedded\x20activation\x20\x27','attributes','connection','waitCondition','\x20updated','created','listActivations','segment\x20or\x20journey','dryRun','Error\x20parsing\x20','__pending_','Changes\x20to:','execute','Failed\x20to\x20create\x20embedded\x20segment\x20\x27','listJourneysFromParentSegment','yamlActivation','\x20unchanged','\x20\x20Journeys:\x20','Delete\x20segment:','/j/da/je','delete','2452464nKlRZY','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','state','journey','Creating\x20segment\x20\x27','\x20\x20✔\x20Updated\x20activation\x20\x27','existingJourney','\x20changed','setExtra','\x20\x20Step\x202:\x20Creating\x20embedded\x20segment\x20\x27','site','item','green','configDir','rule','Changes\x20to\x20journey:','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','find','\x20\x20Or\x20set\x20context:\x20`tdx\x20sg\x20use\x20<parent_name>`','activationActions','createSegment','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','\x20new','getJourney','\x20\x20Source:\x20','forEach','...','createFolder','\x20\x20✔\x20Created\x20activation\x20\x27','conditions','segment','New\x20journey:','\x27\x20with\x20journeyId:\x20','\x27\x20entry\x20criteria','\x0a\x20\x20','SEGMENT_SYNTAX_ERROR','getActivation','goal','listFolders',')\x20with\x20journeyId:\x20','Fetching\x20existing\x20journeys...','\x20\x20Segments:\x20','entries','SEGMENT_NOT_FOUND','create','branches','\x20(referenced\x20in\x20journey\x20','✔\x20Updated\x20segment\x20\x27','set','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','Fetching\x20journey\x20\x27','\x20created','2637sJiFDH','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x27\x20not\x20found\x20in\x20journey\x20\x27','1775zGSFEp','entry_criteria','resolveParentId','journeyStages','exclude','action','milestone','5231632kGCOJr','activationParams','✔\x20Created\x20journey\x20\x27','Fetching\x20existing\x20segments...','Updating\x20segment\x20\x27','updateActivation','length','6792cddmgD','all','yellow','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','4575340pVQdZZ','filter','isFile','\x27...','\x20\x20⚠\x20Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','hasChanges','validatedRequest','cwd','Invalid\x20condition\x20in\x20embedded\x20segment\x20\x27','isNew','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Journey\x20\x27','Entry\x20criteria:\x20','type','relative','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','diff','Parent\x20segment:\x20','getParent','blue','/e/','\x20\x20Journey\x20API\x20request:\x20','ACTIVATION_UPDATE_ERROR','\x27:\x20'];a36_0x5d0b=function(){return _0x461b7f;};return a36_0x5d0b();}import a36_0x3a84f9 from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a36_0x14a858 from'path';import{getConsoleNextUrl}from'../types/endpoints.js';import*as a36_0x1dad46 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_0x678b6b(0x2c1);function collectSegmentRefsFromRule(_0xa84b1d){const _0x449c5c=[],_0x2b803b=_0x5dc189=>{const _0x59951c=a36_0x4aa3;if(!_0x5dc189||typeof _0x5dc189!=='object')return;if(Array[_0x59951c(0x27b)](_0x5dc189)){_0x5dc189[_0x59951c(0x1d5)](_0x2b803b);return;}const _0x2ea107=_0x5dc189;(_0x2ea107[_0x59951c(0x212)]===_0x59951c(0x282)||_0x2ea107[_0x59951c(0x212)]===_0x59951c(0x1f7))&&typeof _0x2ea107[_0x59951c(0x1da)]===_0x59951c(0x276)&&_0x449c5c[_0x59951c(0x27f)](_0x2ea107[_0x59951c(0x1da)]);for(const _0x2bcdb8 of Object['values'](_0x2ea107)){_0x2b803b(_0x2bcdb8);}};return _0x2b803b(_0xa84b1d),_0x449c5c;}function collectSegmentIdsFromJourneyApi(_0x182dfb){const _0x145316=a36_0x678b6b,_0x47f89f=new Set();_0x182dfb[_0x145316(0x2b8)]['goal']?.['segmentId']&&_0x47f89f[_0x145316(0x22b)](_0x182dfb['attributes'][_0x145316(0x1e1)]['segmentId']);const _0x321471=_0x182dfb[_0x145316(0x2b8)][_0x145316(0x1f6)];if(Array[_0x145316(0x27b)](_0x321471))for(const _0x4bc54f of _0x321471){_0x4bc54f[_0x145316(0x239)]?.[_0x145316(0x2b5)]&&_0x47f89f[_0x145316(0x22b)](_0x4bc54f['entryCriteria']['segmentId']);if(Array[_0x145316(0x27b)](_0x4bc54f[_0x145316(0x27e)]))for(const _0x143044 of _0x4bc54f['exitCriteria']){_0x143044[_0x145316(0x2b5)]&&_0x47f89f['add'](_0x143044['segmentId']);}_0x4bc54f[_0x145316(0x1f9)]?.['segmentId']&&_0x47f89f[_0x145316(0x22b)](_0x4bc54f[_0x145316(0x1f9)][_0x145316(0x2b5)]);if(Array[_0x145316(0x27b)](_0x4bc54f['steps']))for(const _0xdfbeb0 of _0x4bc54f['steps']){_0xdfbeb0[_0x145316(0x2ba)]?.[_0x145316(0x2b5)]&&_0x47f89f[_0x145316(0x22b)](_0xdfbeb0[_0x145316(0x2ba)][_0x145316(0x2b5)]);if(Array[_0x145316(0x27b)](_0xdfbeb0[_0x145316(0x1e9)]))for(const _0x15e055 of _0xdfbeb0[_0x145316(0x1e9)]){_0x15e055['segmentId']&&_0x47f89f[_0x145316(0x22b)](_0x15e055[_0x145316(0x2b5)]);}}}return _0x47f89f;}function validateSegmentRule(_0x1ce3ab,_0x842c5d){const _0x223ffc=a36_0x678b6b;if(!_0x842c5d||!_0x842c5d['conditions'])return;for(let _0x404444=0x0;_0x404444<_0x842c5d[_0x223ffc(0x1d9)][_0x223ffc(0x200)];_0x404444++){const _0x83960a=_0x842c5d[_0x223ffc(0x1d9)][_0x404444];if('type'in _0x83960a&&_0x83960a[_0x223ffc(0x212)]==='Value'){const _0x11215d=_0x83960a;if(!_0x11215d['attribute']||_0x11215d[_0x223ffc(0x297)]==='')throw new SDKError(ErrorCode[_0x223ffc(0x268)],_0x223ffc(0x20d)+_0x1ce3ab+'\x27:\x20'+(_0x223ffc(0x26c)+_0x404444+'].attribute\x20cannot\x20be\x20empty.\x0a')+_0x223ffc(0x299));}}}function createPendingSegmentId(_0x4b6d53){return''+PENDING_SEGMENT_PREFIX+_0x4b6d53+'__';}function isPendingSegmentId(_0x1528b0){const _0x45bbb2=a36_0x678b6b;return _0x1528b0[_0x45bbb2(0x298)](PENDING_SEGMENT_PREFIX);}function extractPendingSegmentName(_0x390301){const _0x353c46=a36_0x678b6b;return _0x390301[_0x353c46(0x244)](/^__pending_(.+)__$/,'$1');}const PENDING_ACTIVATION_PREFIX='__pending_act_';function createPendingActivationId(_0x1f821a){return''+PENDING_ACTIVATION_PREFIX+_0x1f821a+'__';}function isPendingActivationId(_0x3c6421){const _0x4d748a=a36_0x678b6b;return _0x3c6421[_0x4d748a(0x298)](PENDING_ACTIVATION_PREFIX);}function extractPendingActivationName(_0x4944d0){const _0x415e33=a36_0x678b6b;return _0x4944d0[_0x415e33(0x244)](/^__pending_act_(.+)__$/,'$1');}function ensureJourneyDefaults(_0x4e728c){const _0xa5b66f=a36_0x678b6b;!_0x4e728c['description']&&(_0x4e728c[_0xa5b66f(0x28a)]=''),!_0x4e728c['state']&&(_0x4e728c[_0xa5b66f(0x2ce)]='draft');}function tryFindTdxConfig(_0x5a32a3){try{return findTdxConfig(_0x5a32a3);}catch{return null;}}function resolveTDFolderPath(_0x32a45e,_0x581959,_0x297400){if(!_0x581959)return _0x32a45e;return _0x32a45e?_0x297400+'/'+_0x32a45e:_0x297400;}export class SegmentPushCommand extends BaseCommand{[a36_0x678b6b(0x285)]=a36_0x678b6b(0x23d);[a36_0x678b6b(0x28a)]=a36_0x678b6b(0x264);async[a36_0x678b6b(0x2c3)](_0x45a164){const _0x56e0b9=a36_0x678b6b,{options:_0x5c9633,args:_0x51a75c,tdx:_0x461780}=_0x45a164,_0x2adbbb=_0x5c9633,_0x3dbc67=_0x5c9633['parentSegment'],_0x3a6be4=_0x51a75c[0x0];let _0x33bb53,_0x46dc08,_0xa531b,_0x48fc76;if(_0x3a6be4){if(existsSync(_0x3a6be4)&&statSync(_0x3a6be4)['isDirectory']()){const _0x4417a7=tryFindTdxConfig(_0x3a6be4);if(_0x4417a7)_0x33bb53=_0x4417a7[_0x56e0b9(0x226)]['parent_segment'],_0x46dc08=_0x3a6be4,_0xa531b=_0x4417a7[_0x56e0b9(0x1c9)];else{if(_0x3dbc67)_0x33bb53=_0x3dbc67,_0x46dc08=_0x3a6be4;else return console['error'](a36_0x3a84f9[_0x56e0b9(0x24c)](_0x56e0b9(0x228)+_0x3a6be4+'\x0a')),console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x253)](_0x56e0b9(0x1f1))),console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x253)](_0x56e0b9(0x1ce))),0x1;}}else{if(existsSync(_0x3a6be4)&&statSync(_0x3a6be4)[_0x56e0b9(0x207)]()){const _0x58b0e9=a36_0x14a858['dirname'](_0x3a6be4),_0x28bacc=tryFindTdxConfig(_0x58b0e9);if(_0x28bacc)_0x33bb53=_0x28bacc[_0x56e0b9(0x226)][_0x56e0b9(0x24e)],_0xa531b=_0x28bacc['configDir'],_0x46dc08=_0x28bacc['configDir'],_0x48fc76=a36_0x14a858[_0x56e0b9(0x2a8)](_0x3a6be4);else{if(_0x3dbc67)_0x33bb53=_0x3dbc67,_0x46dc08=_0x58b0e9,_0x48fc76=a36_0x14a858[_0x56e0b9(0x2a8)](_0x3a6be4);else return console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x24c)](_0x56e0b9(0x228)+_0x58b0e9+'\x0a')),console['error'](a36_0x3a84f9[_0x56e0b9(0x253)](_0x56e0b9(0x1f1))),console[_0x56e0b9(0x22f)](a36_0x3a84f9['cyan']('\x20\x20Or\x20set\x20context:\x20`tdx\x20sg\x20use\x20<parent_name>`')),0x1;}}else _0x33bb53=_0x3a6be4;}}else{const _0x18f7de=tryFindTdxConfig(process[_0x56e0b9(0x20c)]());_0x18f7de?(_0x33bb53=_0x18f7de[_0x56e0b9(0x226)][_0x56e0b9(0x24e)],_0x46dc08=process[_0x56e0b9(0x20c)](),_0xa531b=_0x18f7de[_0x56e0b9(0x1c9)]):_0x33bb53=_0x3dbc67;}if(!_0x33bb53)return console['error'](a36_0x3a84f9[_0x56e0b9(0x203)](_0x56e0b9(0x2b3))),console['error'](_0x56e0b9(0x25e)),console[_0x56e0b9(0x22f)](_0x56e0b9(0x214)),console[_0x56e0b9(0x22f)](_0x56e0b9(0x2cd)),0x1;const _0x355e6a=_0x46dc08||getSegmentRootDir(sanitizeFileName(_0x33bb53)),_0x134c5b=_0xa531b||_0x355e6a,_0x272c17=a36_0x14a858[_0x56e0b9(0x213)](_0x134c5b,_0x355e6a),_0x5b6a11=_0x272c17!==''&&_0x272c17!=='.';if(!existsSync(_0x355e6a))return console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x24c)](_0x56e0b9(0x23c)+_0x355e6a+'\x0a')),console[_0x56e0b9(0x22f)](a36_0x3a84f9['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x2adbbb['verbose']&&(console[_0x56e0b9(0x22f)](_0x56e0b9(0x28d)+_0x2adbbb[_0x56e0b9(0x1c6)]),console['error'](_0x56e0b9(0x216)+_0x33bb53),console[_0x56e0b9(0x22f)](_0x56e0b9(0x2a9)+_0x355e6a),_0x5b6a11&&console[_0x56e0b9(0x22f)](_0x56e0b9(0x266)+_0x272c17));const _0xe4ec98=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x33bb53+_0x56e0b9(0x208),()=>_0x461780[_0x56e0b9(0x1da)][_0x56e0b9(0x1f5)](_0x33bb53),{'verbose':_0x2adbbb['verbose']}),_0x1e7a88=_0xe4ec98[_0x56e0b9(0x29c)],[_0x27b131,_0x1ea181,_0x3352c1,_0x24d737,_0xd1badd]=await Promise[_0x56e0b9(0x202)]([withSpinner(_0x56e0b9(0x22c),()=>_0x461780[_0x56e0b9(0x1da)][_0x56e0b9(0x217)](_0x1e7a88),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]}),withSpinner(_0x56e0b9(0x1fd),()=>_0x461780[_0x56e0b9(0x1da)][_0x56e0b9(0x2af)](_0x1e7a88),{'verbose':_0x2adbbb['verbose']}),withSpinner(_0x56e0b9(0x251),()=>_0x461780['segment'][_0x56e0b9(0x1e2)](_0x1e7a88),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]}),withSpinner(_0x56e0b9(0x1e4),()=>_0x461780[_0x56e0b9(0x2cf)][_0x56e0b9(0x2c5)](_0x1e7a88),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]}),withSpinner(_0x56e0b9(0x274),()=>_0x461780['user'][_0x56e0b9(0x293)](),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]})['then'](_0x390c97=>_0x390c97[_0x56e0b9(0x29c)])]),_0x557728=_0x27b131[_0x56e0b9(0x29c)],_0x26c0fc=_0x557728['relationships']?.[_0x56e0b9(0x245)]?.[_0x56e0b9(0x29c)]?.['id']||_0x557728[_0x56e0b9(0x2a7)]?.[_0x56e0b9(0x2b0)]?.[_0x56e0b9(0x29c)]?.['id'],_0x371a62=_0x1ea181[_0x56e0b9(0x29c)],_0x35729f=_0x3352c1['data'],_0x5bb86c=_0x24d737[_0x56e0b9(0x29c)],{emailToId:_0x2db77a,idToEmail:_0x43925a}=_0xd1badd,[_0x163af2,_0x4da911,_0x38b690]=await withSpinner(_0x56e0b9(0x2ab),async()=>{const _0x2acb44=_0x56e0b9,_0x195375=await _0x461780[_0x2acb44(0x2b9)][_0x2acb44(0x257)](),_0x23f06d=new Map(),_0x16eccf=new Map(),_0x2d3bc7=new Map();for(const _0x2b453a of _0x195375){_0x23f06d[_0x2acb44(0x1ec)](_0x2b453a[_0x2acb44(0x285)],parseInt(_0x2b453a['id'],0xa)),_0x16eccf[_0x2acb44(0x1ec)](_0x2b453a['id'],_0x2b453a['name']),_0x2d3bc7['set'](_0x2b453a[_0x2acb44(0x285)],_0x2b453a[_0x2acb44(0x212)]);}return[_0x23f06d,_0x16eccf,_0x2d3bc7];},{'verbose':_0x2adbbb['verbose']})['then'](_0x538609=>_0x538609[_0x56e0b9(0x29c)]),_0x14bd57={'emailToIdMap':_0x2db77a,'connectionNameToIdMap':_0x163af2,'connectionNameToTypeMap':_0x38b690,'getSchema':_0x3552ab=>_0x461780[_0x56e0b9(0x2b9)][_0x56e0b9(0x238)](_0x3552ab)},_0x41d642=buildFolderPathToIdMap(_0x35729f),_0x548002=new Map();for(const [_0x2981bf,_0x193f98]of _0x41d642[_0x56e0b9(0x1e6)]()){_0x548002[_0x56e0b9(0x1ec)](_0x193f98,_0x2981bf);}const _0x4fb855=new Map();for(const _0x4b835a of _0x371a62){const _0x6eda43=_0x4b835a[_0x56e0b9(0x2b6)]?_0x548002['get'](_0x4b835a[_0x56e0b9(0x2b6)][_0x56e0b9(0x279)]())||'':'',_0x2df190=_0x6eda43+':'+_0x4b835a['name'];_0x4fb855['set'](_0x2df190,_0x4b835a);}const _0x101016=new Map();for(const _0x49d676 of _0x371a62){_0x101016[_0x56e0b9(0x1ec)](_0x49d676[_0x56e0b9(0x285)],_0x49d676['id']);}const _0xff68e2=new Map();for(const _0x28220e of _0x5bb86c){const _0x2d3b5f=_0x28220e[_0x56e0b9(0x242)]?_0x548002[_0x56e0b9(0x222)](_0x28220e[_0x56e0b9(0x242)])||'':'',_0x37e2cd=_0x2d3b5f+':'+_0x28220e[_0x56e0b9(0x278)];!_0xff68e2[_0x56e0b9(0x289)](_0x37e2cd)&&_0xff68e2[_0x56e0b9(0x1ec)](_0x37e2cd,[]),_0xff68e2[_0x56e0b9(0x222)](_0x37e2cd)['push'](_0x28220e);}for(const _0x2b22df of _0xff68e2[_0x56e0b9(0x2ae)]()){_0x2b22df[_0x56e0b9(0x2a0)]((_0x273d9d,_0x2c64da)=>(_0x273d9d[_0x56e0b9(0x291)]||0x0)-(_0x2c64da[_0x56e0b9(0x291)]||0x0));}let _0x4173b1;if(_0x48fc76){if(!_0x48fc76['endsWith'](_0x56e0b9(0x28b))&&!_0x48fc76[_0x56e0b9(0x25a)]('.yaml'))return console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x24c)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x48fc76+'\x0a')),0x1;_0x4173b1=[_0x48fc76];}else _0x4173b1=findYamlFiles(_0x355e6a);if(_0x4173b1[_0x56e0b9(0x200)]===0x0)return console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x24c)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x355e6a+'\x0a')),console[_0x56e0b9(0x22f)](a36_0x3a84f9['cyan'](_0x56e0b9(0x1cc))),0x1;const _0x31863a=[],_0x51148f=[];for(const _0x369bb7 of _0x4173b1){const _0x576140=a36_0x14a858[_0x56e0b9(0x213)](_0x355e6a,a36_0x14a858[_0x56e0b9(0x235)](_0x369bb7)),_0x56dc9c=_0x576140==='.'?'':_0x576140,_0x1f795f=readFileSync(_0x369bb7,'utf-8');try{const _0x42886b=a36_0x1dad46[_0x56e0b9(0x287)](_0x1f795f);if(isJourneyYaml(_0x42886b)){const _0x48348c=a36_0x143775(_0x1f795f);_0x51148f[_0x56e0b9(0x27f)]({'yamlConfig':_0x48348c,'folderPath':_0x56dc9c,'sourcePath':_0x369bb7});}else{if(!_0x2adbbb[_0x56e0b9(0x231)]){const _0x55c8d8=parseSegmentYamlFile(_0x1f795f),_0x24aa94=normalizeChildSegmentYaml(_0x55c8d8);_0x31863a[_0x56e0b9(0x27f)]({'yamlConfig':_0x24aa94,'folderPath':_0x56dc9c,'sourcePath':_0x369bb7});}}}catch(_0x2d7338){return console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x24c)](_0x56e0b9(0x2c0)+_0x369bb7+':\x20'+(_0x2d7338 instanceof Error?_0x2d7338['message']:_0x2d7338))),0x1;}}if(_0x31863a[_0x56e0b9(0x200)]===0x0&&_0x51148f[_0x56e0b9(0x200)]===0x0){const _0xe828a3=_0x2adbbb[_0x56e0b9(0x231)]?_0x56e0b9(0x2cf):_0x56e0b9(0x2be);return console['error'](a36_0x3a84f9[_0x56e0b9(0x203)](_0x56e0b9(0x294)+_0xe828a3+_0x56e0b9(0x227))),0x0;}const _0x4cdc1f=new Map();_0x371a62[_0x56e0b9(0x200)]>0x0&&!_0x2adbbb[_0x56e0b9(0x231)]&&await withSpinner(_0x56e0b9(0x2a2),async()=>{await batchAsync(_0x371a62,async _0x5231a6=>{const _0x2642cf=a36_0x4aa3,_0x4975f7=await _0x461780[_0x2642cf(0x1da)][_0x2642cf(0x2bd)](_0x1e7a88,_0x5231a6['id']);_0x4cdc1f[_0x2642cf(0x1ec)](_0x5231a6['id'],_0x4975f7);});},{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]});const _0x796f39=[],_0x59396=new Set();for(const {yamlConfig:_0xe6518,folderPath:_0x16c495,sourcePath:_0x6e3b13}of _0x31863a){const _0x340258=resolveTDFolderPath(_0x16c495,_0x5b6a11,_0x272c17),_0x176a6f=_0x340258+':'+_0xe6518[_0x56e0b9(0x285)],_0x931918=_0x4fb855[_0x56e0b9(0x222)](_0x176a6f),_0x10b1fd=_0x931918?_0x4cdc1f['get'](_0x931918['id'])||[]:[];if(_0x340258&&!_0x41d642['has'](_0x340258)){const _0xe111b5=_0x340258[_0x56e0b9(0x28f)]('/');let _0x5a24a1='';for(const _0x2dca5e of _0xe111b5){_0x5a24a1=_0x5a24a1?_0x5a24a1+'/'+_0x2dca5e:_0x2dca5e,!_0x41d642[_0x56e0b9(0x289)](_0x5a24a1)&&_0x59396[_0x56e0b9(0x22b)](_0x5a24a1);}}const _0x2be797=calculateActivationActions(_0xe6518['activations']||[],_0x10b1fd,_0x43925a,_0x4da911);for(const _0x5019ee of _0x2be797){(_0x5019ee['type']===_0x56e0b9(0x1e8)||_0x5019ee[_0x56e0b9(0x212)]===_0x56e0b9(0x2a4))&&_0x5019ee['yamlActivation']&&(_0x5019ee['validatedRequest']=await yamlActivationToCreateRequest(_0x5019ee[_0x56e0b9(0x2c6)],_0x14bd57));}const _0x231e77=segmentToYamlString(_0xe6518);let _0x56a5d5,_0x1eff5f=![],_0x3e5a8b;if(_0x931918){const _0x44475b=segmentWithActivationsToYaml(_0x931918,_0x10b1fd,undefined,_0x43925a,_0x4da911),_0x27246d=segmentToYamlString(_0x44475b);_0x56a5d5=generateDiff(_0x27246d,_0x231e77),_0x1eff5f=hasChanges(_0x56a5d5),_0x1eff5f&&(_0x3e5a8b=formatDiffWithColors(_0x56a5d5));}else _0x56a5d5=generateDiff('',_0x231e77),_0x3e5a8b=formatDiffWithColors(_0x56a5d5);_0x796f39['push']({'relativePath':_0xe6518['name'],'absolutePath':_0x6e3b13,'yamlConfig':_0xe6518,'folderPath':_0x340258,'existingSegment':_0x931918,'existingActivations':_0x10b1fd,'isNew':!_0x931918,'hasChanges':_0x1eff5f,'diff':_0x3e5a8b,'activationActions':_0x2be797});}let _0x34fc69=[];if(!_0x48fc76){const _0x473a75=new Set();for(const {yamlConfig:_0x3d06e8,folderPath:_0x36a1f6}of _0x31863a){const _0x1085e4=resolveTDFolderPath(_0x36a1f6,_0x5b6a11,_0x272c17);_0x473a75['add'](_0x1085e4+':'+_0x3d06e8[_0x56e0b9(0x285)]);}_0x34fc69=_0x371a62[_0x56e0b9(0x206)](_0xf5f564=>{const _0x1087fa=_0x56e0b9,_0x22207a=_0xf5f564['segmentFolderId']?_0x548002[_0x1087fa(0x222)](_0xf5f564[_0x1087fa(0x2b6)]['toString']())||'':'',_0x317d8a=_0x22207a+':'+_0xf5f564[_0x1087fa(0x285)];if(_0x473a75[_0x1087fa(0x289)](_0x317d8a))return![];if(_0x5b6a11)return _0x22207a===_0x272c17||_0x22207a[_0x1087fa(0x298)](_0x272c17+'/');return!![];});}const _0x2bb2a7=[];for(const {yamlConfig:_0x15e5aa,folderPath:_0x7efb2e,sourcePath:_0x3009a4}of _0x51148f){const _0x1a4d2d=resolveTDFolderPath(_0x7efb2e,_0x5b6a11,_0x272c17),_0x531b01=_0x1a4d2d+':'+_0x15e5aa[_0x56e0b9(0x285)],_0x2d87f2=_0xff68e2[_0x56e0b9(0x222)](_0x531b01);let _0x3a36ad,_0x20a5f2;if(_0x2d87f2&&_0x2d87f2[_0x56e0b9(0x200)]>0x0){const _0x396f2c=new Set(),_0x59836e=new Set(),_0x56e768=new Map(),_0x55acef=new Map(),_0x4cd5ce=createJumpTargetCache(),_0x161540=new Set(),_0x355a67=new Map();if(_0x15e5aa[_0x56e0b9(0x260)])for(const [_0x52580b,_0x5c1dd7]of Object[_0x56e0b9(0x1e6)](_0x15e5aa[_0x56e0b9(0x260)])){_0x161540[_0x56e0b9(0x22b)](_0x52580b);if(_0x5c1dd7[_0x56e0b9(0x1ca)]){const _0x2b644d=yamlRuleToApi(_0x5c1dd7[_0x56e0b9(0x1ca)]),_0x1dcbf3=apiRuleToYaml(_0x2b644d);_0x355a67[_0x56e0b9(0x1ec)](_0x52580b,_0x1dcbf3);}}const _0x58203f=new Map();for(const [_0x19f82c,_0x4ea931]of _0x355a67){const _0x220d45=serializeExpandedRule(_0x4ea931,_0x355a67);!_0x58203f['has'](_0x220d45)&&_0x58203f[_0x56e0b9(0x1ec)](_0x220d45,_0x19f82c);}const _0x45e7f5=new Map(),_0x3159d1=new Map(),_0x59d0ef=new Set(),_0x280c61=async _0x38d8f5=>{const _0x554f5e=_0x56e0b9;if(_0x59d0ef[_0x554f5e(0x289)](_0x38d8f5))return;_0x59d0ef['add'](_0x38d8f5);let _0x4f94f7=_0x371a62[_0x554f5e(0x1cd)](_0x1183d6=>_0x1183d6['id']===_0x38d8f5);if(!_0x4f94f7)try{_0x4f94f7=await _0x461780[_0x554f5e(0x1da)]['getSegment'](_0x1e7a88,_0x38d8f5);}catch{return;}if(_0x4f94f7?.[_0x554f5e(0x1ca)]){const _0x53c06b=apiRuleToYaml(_0x4f94f7['rule']);_0x3159d1[_0x554f5e(0x1ec)](_0x38d8f5,_0x53c06b);const _0x469fd4=collectSegmentRefsFromRule(_0x53c06b);for(const _0x227c1b of _0x469fd4){await _0x280c61(_0x227c1b);}}};for(const _0x3ca687 of _0x2d87f2){const _0x196aa7=await _0x461780[_0x56e0b9(0x2cf)][_0x56e0b9(0x1d3)](_0x3ca687['id']),_0x49a3c6=collectSegmentIdsFromJourneyApi(_0x196aa7);for(const _0x23714d of _0x49a3c6){await _0x280c61(_0x23714d);}}let _0x3c22ca;const _0x3e6b54=_0x5aa6c7=>({'resolveSegment':async _0x14e344=>{const _0x1b1a16=_0x56e0b9,_0x2e5101=_0x55acef['get'](_0x14e344);if(_0x2e5101!==undefined)return{'name':_0x2e5101,'isJourneyLocal':!![]};try{let _0x3b2a18=_0x371a62['find'](_0x497bb5=>_0x497bb5['id']===_0x14e344);!_0x3b2a18&&(_0x3b2a18=await _0x461780['segment'][_0x1b1a16(0x286)](_0x1e7a88,_0x14e344));const _0x5a0878=generateJourneyLocalName(_0x3b2a18[_0x1b1a16(0x285)]),_0x21f8b4=_0x3b2a18['kind']===SEGMENT_KIND_JOURNEY&&_0x5a0878!==undefined;let _0x2629e7=_0x3b2a18[_0x1b1a16(0x285)],_0x14cebc;if(_0x21f8b4&&_0x3b2a18[_0x1b1a16(0x1ca)]){const _0xbb0e65=apiRuleToYaml(_0x3b2a18['rule']);_0x3159d1[_0x1b1a16(0x1ec)](_0x14e344,_0xbb0e65);const _0x2b1532=async _0x2ef9a2=>{const _0x18c4ab=_0x1b1a16,_0x389d84=collectSegmentRefsFromRule(_0x2ef9a2);for(const _0x62f50c of _0x389d84){if(!_0x3159d1['has'](_0x62f50c))try{const _0x3bdb03=await _0x461780[_0x18c4ab(0x1da)]['getSegment'](_0x1e7a88,_0x62f50c);if(_0x3bdb03?.[_0x18c4ab(0x1ca)]){const _0x21b25d=apiRuleToYaml(_0x3bdb03[_0x18c4ab(0x1ca)]);_0x3159d1[_0x18c4ab(0x1ec)](_0x62f50c,_0x21b25d),await _0x2b1532(_0x21b25d);}}catch{}}};await _0x2b1532(_0xbb0e65);const _0x3695a8=serializeExpandedRule(_0xbb0e65,_0x3159d1),_0x22ec7e=_0x58203f['get'](_0x3695a8);if(_0x22ec7e&&!_0x396f2c[_0x1b1a16(0x289)](_0x22ec7e)){_0x2629e7=_0x22ec7e,_0x396f2c[_0x1b1a16(0x22b)](_0x2629e7),_0x55acef[_0x1b1a16(0x1ec)](_0x14e344,_0x2629e7);const _0x444ded=await resolveRuleSegmentRefs(_0xbb0e65,async _0x715dc2=>{const _0x50ea3d=_0x1b1a16,_0x56921c=_0x55acef[_0x50ea3d(0x222)](_0x715dc2);if(_0x56921c)return _0x56921c;const _0x40084a=await _0x3c22ca['resolveSegment'](_0x715dc2);return _0x40084a[_0x50ea3d(0x285)];});_0x14cebc={'description':_0x3b2a18[_0x1b1a16(0x28a)],'rule':_0x444ded};}else{if(_0x22ec7e&&_0x396f2c[_0x1b1a16(0x289)](_0x22ec7e))_0x2629e7=_0x22ec7e,_0x55acef[_0x1b1a16(0x1ec)](_0x14e344,_0x2629e7);else{const _0x4e7458=_0x45e7f5[_0x1b1a16(0x222)](_0x3695a8);if(_0x4e7458)_0x2629e7=_0x4e7458,_0x55acef[_0x1b1a16(0x1ec)](_0x14e344,_0x2629e7);else{if(_0x5a0878){let _0x4a9557=_0x5a0878,_0x531e46=0x2;while(_0x396f2c[_0x1b1a16(0x289)](_0x4a9557)||_0x161540[_0x1b1a16(0x289)](_0x4a9557)){_0x4a9557=_0x5a0878+'_'+_0x531e46,_0x531e46++;}_0x396f2c['add'](_0x4a9557),_0x2629e7=_0x4a9557;}_0x55acef[_0x1b1a16(0x1ec)](_0x14e344,_0x2629e7),_0x45e7f5['set'](_0x3695a8,_0x2629e7);const _0x17210f=await resolveRuleSegmentRefs(_0xbb0e65,async _0x21c372=>{const _0x384546=_0x1b1a16,_0x11d1c4=_0x55acef[_0x384546(0x222)](_0x21c372);if(_0x11d1c4)return _0x11d1c4;const _0x13d4fd=await _0x3c22ca[_0x384546(0x29f)](_0x21c372);return _0x13d4fd['name'];});_0x14cebc={'description':_0x3b2a18['description'],'rule':_0x17210f};}}}}return{'name':_0x2629e7,'isJourneyLocal':_0x21f8b4,'definition':_0x14cebc};}catch{return{'name':_0x14e344,'isJourneyLocal':![]};}},'resolveActivation':async _0x585d34=>{const _0x1c1855=_0x56e0b9,_0x147a4b=_0x56e768['get'](_0x585d34);if(_0x147a4b!==undefined)return{'name':_0x147a4b,'isJourneyLocal':!![]};try{const _0x57895f=await _0x461780[_0x1c1855(0x2cf)][_0x1c1855(0x1e0)](_0x5aa6c7,_0x585d34),_0x17dbb4=_0x57895f[_0x1c1855(0x2b8)][_0x1c1855(0x1fb)][_0x1c1855(0x285)]||_0x585d34,_0x193c68=sanitizeYamlKey(_0x17dbb4)||'activation_'+_0x585d34;let _0x106ce6=_0x193c68,_0x22597a=0x2;while(_0x59836e[_0x1c1855(0x289)](_0x106ce6)){_0x106ce6=_0x193c68+'_'+_0x22597a,_0x22597a++;}_0x59836e['add'](_0x106ce6),_0x56e768[_0x1c1855(0x1ec)](_0x585d34,_0x106ce6);const _0x4b1535=journeyActivationStepToYaml(_0x57895f,_0x43925a,_0x4da911);return{'name':_0x106ce6,'isJourneyLocal':!![],'definition':_0x4b1535};}catch{return{'name':_0x585d34,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x2ae8b9,_0x1781bd)=>resolveJumpTarget(_0x2ae8b9,_0x1781bd,_0x4cd5ce,_0x9ce88=>_0x461780[_0x56e0b9(0x2cf)][_0x56e0b9(0x1d3)](_0x9ce88))}),_0x351e5d=hasMultipleVersions(_0x15e5aa);if(_0x351e5d&&_0x2d87f2[_0x56e0b9(0x200)]>0x1){const _0x4b7bc5=[];for(const _0x1c908e of _0x2d87f2){const _0x2d2970=await withSpinner(_0x56e0b9(0x1ee)+_0x15e5aa[_0x56e0b9(0x285)]+_0x56e0b9(0x24f)+(_0x1c908e[_0x56e0b9(0x291)]||0x1)+_0x56e0b9(0x1d6),()=>_0x461780[_0x56e0b9(0x2cf)][_0x56e0b9(0x1d3)](_0x1c908e['id']),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]}),_0xa0f905=_0x3e6b54(_0x1c908e['id']);_0x3c22ca=_0xa0f905;const _0x14b149=await apiToYamlAsync(_0x2d2970[_0x56e0b9(0x29c)],_0xa0f905);_0x4b7bc5[_0x56e0b9(0x27f)]({'item':_0x1c908e,'yaml':_0x14b149});}_0x20a5f2=buildMergedJourneyYaml(_0x4b7bc5);const _0x185fa4=Math[_0x56e0b9(0x223)](..._0x4b7bc5[_0x56e0b9(0x2a5)](_0x357a1d=>_0x357a1d[_0x56e0b9(0x1c7)][_0x56e0b9(0x291)]||0x0)),_0x275548=_0x2d87f2[_0x56e0b9(0x1cd)](_0x1febc7=>(_0x1febc7[_0x56e0b9(0x291)]||0x0)===_0x185fa4);_0x275548&&(_0x3a36ad=await _0x461780[_0x56e0b9(0x2cf)][_0x56e0b9(0x1d3)](_0x275548['id']));}else{const _0x44bc90=_0x2d87f2[_0x2d87f2[_0x56e0b9(0x200)]-0x1],_0x1f1357=await withSpinner(_0x56e0b9(0x1ee)+_0x15e5aa[_0x56e0b9(0x285)]+_0x56e0b9(0x233),()=>_0x461780[_0x56e0b9(0x2cf)]['getJourney'](_0x44bc90['id']),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]});_0x3a36ad=_0x1f1357[_0x56e0b9(0x29c)];const _0x225f81=_0x3e6b54(_0x44bc90['id']);_0x3c22ca=_0x225f81,_0x20a5f2=await apiToYamlAsync(_0x3a36ad,_0x225f81);}}if(_0x1a4d2d&&!_0x41d642['has'](_0x1a4d2d)){const _0x4f044f=_0x1a4d2d['split']('/');let _0x3ed1b0='';for(const _0x7fb829 of _0x4f044f){_0x3ed1b0=_0x3ed1b0?_0x3ed1b0+'/'+_0x7fb829:_0x7fb829,!_0x41d642['has'](_0x3ed1b0)&&_0x59396[_0x56e0b9(0x22b)](_0x3ed1b0);}}const _0xa97a95=normalizeJourneyYaml(_0x15e5aa,_0x15e5aa),_0x55534e=a36_0x58d156(_0xa97a95);let _0x141c1a=![],_0x39a31b;if(_0x20a5f2){const _0x149d69=normalizeJourneyYaml(_0x20a5f2,_0x15e5aa),_0x5d0e59=a36_0x58d156(_0x149d69),_0x15b90d=generateDiff(_0x5d0e59,_0x55534e);_0x141c1a=hasChanges(_0x15b90d),_0x141c1a&&(_0x39a31b=formatDiffWithColors(_0x15b90d));}else{const _0x200bad=generateDiff('',_0x55534e);_0x39a31b=formatDiffWithColors(_0x200bad);}_0x2bb2a7[_0x56e0b9(0x27f)]({'relativePath':_0x15e5aa[_0x56e0b9(0x285)],'absolutePath':_0x3009a4,'yamlConfig':_0x15e5aa,'folderPath':_0x1a4d2d,'existingJourney':_0x3a36ad,'isNew':!_0x3a36ad,'hasChanges':_0x141c1a,'diff':_0x39a31b});}let _0x2aee98=[];if(!_0x48fc76){const _0x4937d5=new Set();for(const {yamlConfig:_0x7f345a,folderPath:_0x4d8b4f}of _0x51148f){const _0x5f1f2a=resolveTDFolderPath(_0x4d8b4f,_0x5b6a11,_0x272c17);_0x4937d5[_0x56e0b9(0x22b)](_0x5f1f2a+':'+_0x7f345a[_0x56e0b9(0x285)]);}_0x2aee98=_0x5bb86c[_0x56e0b9(0x206)](_0x542ca3=>{const _0x58420c=_0x56e0b9,_0x57870a=_0x542ca3[_0x58420c(0x242)]?_0x548002['get'](_0x542ca3['folderId'])||'':'',_0x33f86e=_0x57870a+':'+_0x542ca3[_0x58420c(0x278)];if(_0x4937d5[_0x58420c(0x289)](_0x33f86e))return![];if(_0x5b6a11)return _0x57870a===_0x272c17||_0x57870a[_0x58420c(0x298)](_0x272c17+'/');return!![];});}const _0x120d9e=_0x796f39[_0x56e0b9(0x206)](_0x4803dc=>_0x4803dc[_0x56e0b9(0x20e)]),_0x1ad64e=_0x796f39[_0x56e0b9(0x206)](_0x4ecd9c=>!_0x4ecd9c[_0x56e0b9(0x20e)]&&_0x4ecd9c[_0x56e0b9(0x20a)]),_0x5ec1cc=_0x796f39[_0x56e0b9(0x206)](_0xabbe0=>!_0xabbe0['isNew']&&!_0xabbe0[_0x56e0b9(0x20a)]),_0x578d9d=Array['from'](_0x59396)[_0x56e0b9(0x2a0)](),_0x54f30a=_0x2adbbb[_0x56e0b9(0x2cb)]?_0x34fc69:[],_0x36f21c=_0x2adbbb['delete']?_0x2aee98:[],_0x4201a4=_0x796f39['flatMap'](_0x4bf794=>_0x4bf794['activationActions']),_0x51b611=_0x4201a4[_0x56e0b9(0x206)](_0x2fb708=>_0x2fb708[_0x56e0b9(0x212)]===_0x56e0b9(0x1e8)),_0x3ca5c1=_0x4201a4[_0x56e0b9(0x206)](_0x4f39df=>_0x4f39df['type']==='update'),_0x4e0156=_0x4201a4[_0x56e0b9(0x206)](_0xaacd5b=>_0xaacd5b[_0x56e0b9(0x212)]==='delete'),_0x2e6684=_0x2bb2a7[_0x56e0b9(0x206)](_0x4e1cab=>_0x4e1cab[_0x56e0b9(0x20e)]),_0x2eea73=_0x2bb2a7[_0x56e0b9(0x206)](_0x11d2ec=>!_0x11d2ec[_0x56e0b9(0x20e)]&&_0x11d2ec['hasChanges']),_0x5e127c=_0x2bb2a7['filter'](_0x19f88b=>!_0x19f88b[_0x56e0b9(0x20e)]&&!_0x19f88b['hasChanges']);console[_0x56e0b9(0x22f)]('\x0aPush\x20summary\x20for\x20\x27'+_0x33bb53+'\x27:');_0x578d9d[_0x56e0b9(0x200)]>0x0&&console['error']('\x20\x20'+a36_0x3a84f9[_0x56e0b9(0x218)](_0x56e0b9(0x25f)+_0x578d9d[_0x56e0b9(0x200)]+_0x56e0b9(0x22e)));if(!_0x2adbbb[_0x56e0b9(0x231)]){console[_0x56e0b9(0x22f)]('\x20\x20📊\x20Segments:'),console[_0x56e0b9(0x22f)](_0x56e0b9(0x290)+a36_0x3a84f9[_0x56e0b9(0x1c8)]('+\x20'+_0x120d9e[_0x56e0b9(0x200)]+_0x56e0b9(0x1d2))),console[_0x56e0b9(0x22f)](_0x56e0b9(0x290)+a36_0x3a84f9[_0x56e0b9(0x203)]('~\x20'+_0x1ad64e[_0x56e0b9(0x200)]+_0x56e0b9(0x2d3)));if(_0x54f30a[_0x56e0b9(0x200)]>0x0)console['error'](_0x56e0b9(0x290)+a36_0x3a84f9[_0x56e0b9(0x24c)]('-\x20'+_0x54f30a[_0x56e0b9(0x200)]+'\x20to\x20delete'));else _0x34fc69[_0x56e0b9(0x200)]>0x0&&!_0x2adbbb[_0x56e0b9(0x2cb)]&&console[_0x56e0b9(0x22f)]('\x20\x20\x20\x20'+a36_0x3a84f9[_0x56e0b9(0x296)](_0x34fc69[_0x56e0b9(0x200)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console['error'](_0x56e0b9(0x290)+a36_0x3a84f9[_0x56e0b9(0x296)]('=\x20'+_0x5ec1cc['length']+_0x56e0b9(0x2c7)));}if(_0x2bb2a7[_0x56e0b9(0x200)]>0x0||_0x2aee98[_0x56e0b9(0x200)]>0x0){console[_0x56e0b9(0x22f)]('\x20\x20🗺️\x20\x20Journeys:'),console[_0x56e0b9(0x22f)](_0x56e0b9(0x290)+a36_0x3a84f9[_0x56e0b9(0x1c8)]('+\x20'+_0x2e6684[_0x56e0b9(0x200)]+_0x56e0b9(0x1d2))),console[_0x56e0b9(0x22f)](_0x56e0b9(0x290)+a36_0x3a84f9[_0x56e0b9(0x203)]('~\x20'+_0x2eea73[_0x56e0b9(0x200)]+_0x56e0b9(0x2d3)));if(_0x36f21c[_0x56e0b9(0x200)]>0x0)console[_0x56e0b9(0x22f)]('\x20\x20\x20\x20'+a36_0x3a84f9[_0x56e0b9(0x24c)]('-\x20'+_0x36f21c[_0x56e0b9(0x200)]+_0x56e0b9(0x23f)));else _0x2aee98[_0x56e0b9(0x200)]>0x0&&!_0x2adbbb['delete']&&console[_0x56e0b9(0x22f)](_0x56e0b9(0x290)+a36_0x3a84f9[_0x56e0b9(0x296)](_0x2aee98[_0x56e0b9(0x200)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console['error'](_0x56e0b9(0x290)+a36_0x3a84f9[_0x56e0b9(0x296)]('=\x20'+_0x5e127c[_0x56e0b9(0x200)]+'\x20unchanged'));}_0x4201a4[_0x56e0b9(0x200)]>0x0&&!_0x2adbbb['journeysOnly']&&(console[_0x56e0b9(0x22f)](''),console[_0x56e0b9(0x22f)](_0x56e0b9(0x255)),_0x51b611[_0x56e0b9(0x200)]>0x0&&console[_0x56e0b9(0x22f)](_0x56e0b9(0x290)+a36_0x3a84f9[_0x56e0b9(0x1c8)]('+\x20'+_0x51b611[_0x56e0b9(0x200)]+'\x20to\x20create')),_0x3ca5c1['length']>0x0&&console[_0x56e0b9(0x22f)](_0x56e0b9(0x290)+a36_0x3a84f9[_0x56e0b9(0x203)]('~\x20'+_0x3ca5c1[_0x56e0b9(0x200)]+_0x56e0b9(0x28e))),_0x4e0156[_0x56e0b9(0x200)]>0x0&&console[_0x56e0b9(0x22f)](_0x56e0b9(0x290)+a36_0x3a84f9['red']('-\x20'+_0x4e0156[_0x56e0b9(0x200)]+_0x56e0b9(0x23f))));console[_0x56e0b9(0x22f)](_0x56e0b9(0x1d4)+a36_0x3a84f9[_0x56e0b9(0x253)](_0x355e6a)+'\x0a');if(_0x578d9d['length']>0x0){console[_0x56e0b9(0x22f)]('Folders\x20to\x20create:');for(const _0x184255 of _0x578d9d){console[_0x56e0b9(0x22f)]('\x20\x20'+a36_0x3a84f9['blue']('+')+'\x20'+_0x184255);}console[_0x56e0b9(0x22f)]('');}if(_0x120d9e[_0x56e0b9(0x200)]>0x0&&!_0x2adbbb[_0x56e0b9(0x231)])for(const _0x3efb80 of _0x120d9e){const _0x3c37df=_0x3efb80[_0x56e0b9(0x252)]?_0x3efb80[_0x56e0b9(0x252)]+'/'+_0x3efb80[_0x56e0b9(0x248)][_0x56e0b9(0x285)]:_0x3efb80[_0x56e0b9(0x248)][_0x56e0b9(0x285)],_0x366c8d=_0x3efb80[_0x56e0b9(0x248)][_0x56e0b9(0x277)]?.['length']||0x0,_0xaf1023=_0x366c8d>0x0?a36_0x3a84f9['dim']('\x20['+_0x366c8d+'\x20activations]'):'';console[_0x56e0b9(0x22f)]('\x0a'+a36_0x3a84f9['green'](_0x56e0b9(0x29b))+'\x20'+_0x3c37df+_0xaf1023),console[_0x56e0b9(0x22f)]('─'[_0x56e0b9(0x24a)](0x3c)),_0x3efb80[_0x56e0b9(0x215)]&&console[_0x56e0b9(0x22f)](_0x3efb80[_0x56e0b9(0x215)]),console[_0x56e0b9(0x22f)]('─'[_0x56e0b9(0x24a)](0x3c));}if(_0x54f30a['length']>0x0&&!_0x2adbbb[_0x56e0b9(0x231)])for(const _0x1ca235 of _0x54f30a){const _0x2709cf=_0x1ca235[_0x56e0b9(0x2b6)]?_0x548002[_0x56e0b9(0x222)](_0x1ca235[_0x56e0b9(0x2b6)][_0x56e0b9(0x279)]())||'':'',_0x445595=_0x2709cf?_0x2709cf+'/'+_0x1ca235[_0x56e0b9(0x285)]:_0x1ca235[_0x56e0b9(0x285)],_0xfb8d4a=_0x4cdc1f['get'](_0x1ca235['id'])||[],_0x618160=_0xfb8d4a[_0x56e0b9(0x200)]>0x0?a36_0x3a84f9[_0x56e0b9(0x296)]('\x20['+_0xfb8d4a[_0x56e0b9(0x200)]+_0x56e0b9(0x224)):'';console[_0x56e0b9(0x22f)]('\x0a'+a36_0x3a84f9[_0x56e0b9(0x24c)](_0x56e0b9(0x2c9))+'\x20'+_0x445595+_0x618160),console[_0x56e0b9(0x22f)]('─'[_0x56e0b9(0x24a)](0x3c));const _0x551224=segmentWithActivationsToYaml(_0x1ca235,_0xfb8d4a,undefined,_0x43925a,_0x4da911),_0x426731=segmentToYamlString(_0x551224),_0x522dff=generateDiff(_0x426731,'');console[_0x56e0b9(0x22f)](formatDiffWithColors(_0x522dff)),console[_0x56e0b9(0x22f)]('─'['repeat'](0x3c));}const _0x3c79ed=_0x796f39[_0x56e0b9(0x206)](_0x14ed72=>!_0x14ed72[_0x56e0b9(0x20e)]&&_0x14ed72[_0x56e0b9(0x215)]);if(_0x3c79ed[_0x56e0b9(0x200)]>0x0&&!_0x2adbbb['journeysOnly'])for(const _0x41fa43 of _0x3c79ed){const _0x52af0f=_0x41fa43[_0x56e0b9(0x252)]?_0x41fa43['folderPath']+'/'+_0x41fa43[_0x56e0b9(0x248)][_0x56e0b9(0x285)]:_0x41fa43[_0x56e0b9(0x248)]['name'];console[_0x56e0b9(0x22f)]('\x0a'+a36_0x3a84f9[_0x56e0b9(0x203)](_0x56e0b9(0x2c2))+'\x20'+_0x52af0f),console[_0x56e0b9(0x22f)]('─'['repeat'](0x3c)),console[_0x56e0b9(0x22f)](_0x41fa43['diff']),console[_0x56e0b9(0x22f)]('─'[_0x56e0b9(0x24a)](0x3c));}if(_0x2e6684[_0x56e0b9(0x200)]>0x0)for(const _0x19ae5f of _0x2e6684){const _0x2d2186=_0x19ae5f[_0x56e0b9(0x252)]?_0x19ae5f[_0x56e0b9(0x252)]+'/'+_0x19ae5f[_0x56e0b9(0x248)][_0x56e0b9(0x285)]:_0x19ae5f[_0x56e0b9(0x248)][_0x56e0b9(0x285)];console[_0x56e0b9(0x22f)]('\x0a'+a36_0x3a84f9[_0x56e0b9(0x1c8)](_0x56e0b9(0x1db))+'\x20'+_0x2d2186),console[_0x56e0b9(0x22f)]('─'[_0x56e0b9(0x24a)](0x3c)),_0x19ae5f['diff']&&console[_0x56e0b9(0x22f)](_0x19ae5f[_0x56e0b9(0x215)]),console['error']('─'[_0x56e0b9(0x24a)](0x3c));}const _0x21f4f4=_0x2bb2a7[_0x56e0b9(0x206)](_0x4dc8ba=>!_0x4dc8ba['isNew']&&_0x4dc8ba[_0x56e0b9(0x215)]);if(_0x21f4f4[_0x56e0b9(0x200)]>0x0)for(const _0xc2f900 of _0x21f4f4){const _0x3b89ab=_0xc2f900[_0x56e0b9(0x252)]?_0xc2f900[_0x56e0b9(0x252)]+'/'+_0xc2f900[_0x56e0b9(0x248)]['name']:_0xc2f900[_0x56e0b9(0x248)][_0x56e0b9(0x285)];console[_0x56e0b9(0x22f)]('\x0a'+a36_0x3a84f9[_0x56e0b9(0x203)](_0x56e0b9(0x1cb))+'\x20'+_0x3b89ab),console[_0x56e0b9(0x22f)]('─'[_0x56e0b9(0x24a)](0x3c)),console[_0x56e0b9(0x22f)](_0xc2f900[_0x56e0b9(0x215)]),console['error']('─'['repeat'](0x3c));}if(_0x36f21c[_0x56e0b9(0x200)]>0x0)for(const _0xa4f24c of _0x36f21c){const _0x2de6f0=_0xa4f24c[_0x56e0b9(0x242)]?_0x548002[_0x56e0b9(0x222)](_0xa4f24c[_0x56e0b9(0x242)])||'':'',_0x5e663e=_0x2de6f0?_0x2de6f0+'/'+_0xa4f24c[_0x56e0b9(0x278)]:_0xa4f24c[_0x56e0b9(0x278)];console[_0x56e0b9(0x22f)]('\x0a'+a36_0x3a84f9[_0x56e0b9(0x24c)]('Delete\x20journey:')+'\x20'+_0x5e663e),console[_0x56e0b9(0x22f)]('─'['repeat'](0x3c)),console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x24c)](_0x56e0b9(0x29e))),console['error']('─'['repeat'](0x3c));}if(_0x2adbbb[_0x56e0b9(0x2bf)])return console[_0x56e0b9(0x22f)](a36_0x3a84f9['yellow'](_0x56e0b9(0x20f))),0x0;const _0x290b37=_0x2adbbb[_0x56e0b9(0x231)]?![]:_0x120d9e[_0x56e0b9(0x200)]>0x0||_0x1ad64e['length']>0x0||_0x54f30a['length']>0x0,_0x3720ed=_0x2e6684[_0x56e0b9(0x200)]>0x0||_0x2eea73[_0x56e0b9(0x200)]>0x0||_0x36f21c[_0x56e0b9(0x200)]>0x0,_0x11187c=_0x2adbbb['journeysOnly']?![]:_0x4201a4[_0x56e0b9(0x200)]>0x0,_0x4de0e1=_0x578d9d[_0x56e0b9(0x200)]>0x0;if(!_0x290b37&&!_0x3720ed&&!_0x11187c&&!_0x4de0e1){const _0x33590a=_0x2adbbb['journeysOnly']?'✔\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x56e0b9(0x1ed);console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x1c8)](_0x33590a));if(_0x48fc76&&_0x5e127c['length']===0x1){const _0x13e061=_0x5e127c[0x0];if(_0x13e061[_0x56e0b9(0x2d2)]?.['id']){const _0x563189=getConsoleNextUrl(_0x2adbbb[_0x56e0b9(0x1c6)],_0x56e0b9(0x22a)+_0x1e7a88+_0x56e0b9(0x219)+_0x13e061[_0x56e0b9(0x2d2)]['id']+_0x56e0b9(0x2ca));console[_0x56e0b9(0x22f)]('\x20\x20'+a36_0x3a84f9[_0x56e0b9(0x253)](_0x563189));}}return 0x0;}const _0x3f15b7=_0x2adbbb[_0x56e0b9(0x231)]?_0x2e6684[_0x56e0b9(0x200)]+_0x2eea73[_0x56e0b9(0x200)]+_0x36f21c[_0x56e0b9(0x200)]+_0x578d9d[_0x56e0b9(0x200)]:_0x120d9e[_0x56e0b9(0x200)]+_0x1ad64e[_0x56e0b9(0x200)]+_0x54f30a['length']+_0x2e6684['length']+_0x2eea73[_0x56e0b9(0x200)]+_0x36f21c['length']+_0x578d9d[_0x56e0b9(0x200)]+_0x4201a4[_0x56e0b9(0x200)];if(!_0x2adbbb[_0x56e0b9(0x250)]&&_0x3f15b7>0x0){const _0x2768b5=await confirmKey(_0x56e0b9(0x271)+_0x3f15b7+'\x20changes?');if(!_0x2768b5)return console[_0x56e0b9(0x22f)]('Aborted.'),0x1;}for(const _0x3ef5b0 of _0x578d9d){const _0xb30d9d=_0x3ef5b0[_0x56e0b9(0x28f)]('/'),_0x27d312=_0xb30d9d[_0xb30d9d[_0x56e0b9(0x200)]-0x1],_0x1e6b98=_0xb30d9d['slice'](0x0,-0x1)[_0x56e0b9(0x26d)]('/'),_0x3ec385=_0x41d642[_0x56e0b9(0x222)](_0x1e6b98),_0x33e65={'name':_0x27d312,'parentFolderId':_0x3ec385},_0x42f62e=await withSpinner(_0x56e0b9(0x237)+_0x3ef5b0+_0x56e0b9(0x208),()=>_0x461780[_0x56e0b9(0x1da)][_0x56e0b9(0x1d7)](_0x1e7a88,_0x33e65),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]});_0x41d642[_0x56e0b9(0x1ec)](_0x3ef5b0,_0x42f62e[_0x56e0b9(0x29c)]['id']),console[_0x56e0b9(0x22f)](a36_0x3a84f9['blue'](_0x56e0b9(0x234)+_0x3ef5b0+'\x27'));}let _0x2e618e=0x0,_0x119e4c=0x0,_0x312293=0x0,_0x272208=0x0,_0x4a3d53=0x0,_0xfd11f1=0x0;const _0x1ca8be=new Map();for(const _0x504747 of _0x2adbbb[_0x56e0b9(0x231)]?[]:_0x796f39){const _0x14a638=_0x504747['folderPath']?_0x41d642[_0x56e0b9(0x222)](_0x504747['folderPath']):undefined;let _0x45344c;try{if(_0x504747[_0x56e0b9(0x20e)]){const _0x4f8c54=yamlToCreateRequest(_0x504747[_0x56e0b9(0x248)],_0x14a638),_0x4e4ba2=await withSpinner(_0x56e0b9(0x2d0)+_0x504747[_0x56e0b9(0x248)][_0x56e0b9(0x285)]+'\x27...',()=>_0x461780[_0x56e0b9(0x1da)][_0x56e0b9(0x1d0)](_0x1e7a88,_0x4f8c54),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]});_0x45344c=_0x4e4ba2[_0x56e0b9(0x29c)]['id'],_0x1ca8be['set'](_0x504747[_0x56e0b9(0x248)][_0x56e0b9(0x285)],_0x45344c),console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x1c8)](_0x56e0b9(0x23a)+_0x504747[_0x56e0b9(0x248)][_0x56e0b9(0x285)]+'\x27')),_0x2e618e++;}else{if(_0x504747[_0x56e0b9(0x20a)]){const _0x1c85b8=yamlToUpdateRequest(_0x504747[_0x56e0b9(0x248)]);_0x14a638!==_0x504747[_0x56e0b9(0x2a1)]?.[_0x56e0b9(0x2b6)]&&(_0x1c85b8[_0x56e0b9(0x2b6)]=_0x14a638?parseInt(_0x14a638,0xa):undefined),await withSpinner(_0x56e0b9(0x1fe)+_0x504747[_0x56e0b9(0x248)][_0x56e0b9(0x285)]+_0x56e0b9(0x208),()=>_0x461780[_0x56e0b9(0x1da)]['updateSegmentById'](_0x1e7a88,_0x504747[_0x56e0b9(0x2a1)]['id'],_0x1c85b8),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]}),_0x45344c=_0x504747[_0x56e0b9(0x2a1)]['id'],console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x203)](_0x56e0b9(0x1eb)+_0x504747[_0x56e0b9(0x248)][_0x56e0b9(0x285)]+'\x27')),_0x119e4c++;}else _0x45344c=_0x504747['existingSegment']['id'];}}catch(_0x2605dd){const _0x32513e=isHttp400Error(_0x2605dd),_0x2ed593=_0x32513e?ErrorCode[_0x56e0b9(0x1df)]:ErrorCode[_0x56e0b9(0x27a)],_0xdb0fae=getErrorMessage(_0x2605dd);throw new SDKError(_0x2ed593,_0x56e0b9(0x292)+(_0x504747[_0x56e0b9(0x20e)]?_0x56e0b9(0x1e8):'update')+_0x56e0b9(0x284)+_0x504747[_0x56e0b9(0x27c)]+'\x0a\x20\x20'+_0xdb0fae,_0x2605dd);}for(const _0x53ab47 of _0x504747[_0x56e0b9(0x1cf)]){try{if(_0x53ab47[_0x56e0b9(0x212)]===_0x56e0b9(0x1e8)&&_0x53ab47[_0x56e0b9(0x20b)])await withSpinner('Creating\x20activation\x20\x27'+_0x53ab47[_0x56e0b9(0x285)]+_0x56e0b9(0x208),()=>_0x461780['segment'][_0x56e0b9(0x236)](_0x1e7a88,_0x45344c,_0x53ab47[_0x56e0b9(0x20b)]),{'verbose':_0x2adbbb['verbose']}),console['error'](a36_0x3a84f9[_0x56e0b9(0x1c8)](_0x56e0b9(0x1d8)+_0x53ab47[_0x56e0b9(0x285)]+'\x27')),_0x272208++;else{if(_0x53ab47['type']==='update'&&_0x53ab47[_0x56e0b9(0x20b)]&&_0x53ab47[_0x56e0b9(0x270)])await withSpinner('Updating\x20activation\x20\x27'+_0x53ab47[_0x56e0b9(0x285)]+'\x27...',()=>_0x461780['segment'][_0x56e0b9(0x1ff)](_0x1e7a88,_0x45344c,_0x53ab47[_0x56e0b9(0x270)]['id'],_0x53ab47[_0x56e0b9(0x20b)]),{'verbose':_0x2adbbb['verbose']}),console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x203)](_0x56e0b9(0x2d1)+_0x53ab47[_0x56e0b9(0x285)]+'\x27')),_0x4a3d53++;else _0x53ab47['type']===_0x56e0b9(0x2cb)&&_0x53ab47[_0x56e0b9(0x270)]&&(await withSpinner(_0x56e0b9(0x246)+_0x53ab47[_0x56e0b9(0x285)]+_0x56e0b9(0x208),()=>_0x461780[_0x56e0b9(0x1da)]['deleteActivation'](_0x1e7a88,_0x45344c,_0x53ab47['existingActivation']['id']),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]}),console['error'](a36_0x3a84f9[_0x56e0b9(0x24c)](_0x56e0b9(0x27d)+_0x53ab47['name']+'\x27')),_0xfd11f1++);}}catch(_0x46241f){const _0x3a9f1f=isHttp400Error(_0x46241f),_0xfe817c=_0x3a9f1f?ErrorCode[_0x56e0b9(0x281)]:ErrorCode[_0x56e0b9(0x21b)],_0x2b538b=getErrorMessage(_0x46241f);throw new SDKError(_0xfe817c,_0x56e0b9(0x292)+_0x53ab47[_0x56e0b9(0x212)]+_0x56e0b9(0x29a)+_0x53ab47['name']+_0x56e0b9(0x280)+_0x504747[_0x56e0b9(0x27c)]+_0x56e0b9(0x1de)+_0x2b538b,_0x46241f);}}}for(const _0x14ac06 of _0x2adbbb[_0x56e0b9(0x231)]?[]:_0x54f30a){await withSpinner(_0x56e0b9(0x263)+_0x14ac06['name']+_0x56e0b9(0x208),()=>_0x461780['segment']['deleteSegment'](_0x14ac06['id']),{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]}),console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x24c)]('✔\x20Deleted\x20segment\x20\x27'+_0x14ac06[_0x56e0b9(0x285)]+'\x27')),_0x312293++;}let _0x17072f=0x0,_0xc213e7=0x0,_0xf8c5dc=0x0;const _0x3d1ef7=new Map(_0x101016);for(const _0x1c016d of _0x796f39){_0x1c016d[_0x56e0b9(0x20e)]&&_0x1ca8be[_0x56e0b9(0x289)](_0x1c016d[_0x56e0b9(0x248)][_0x56e0b9(0x285)])&&_0x3d1ef7['set'](_0x1c016d[_0x56e0b9(0x248)]['name'],_0x1ca8be[_0x56e0b9(0x222)](_0x1c016d[_0x56e0b9(0x248)]['name']));}if(_0x2bb2a7['length']>0x0){const _0x4a4b84=await withQuerySpinner(_0x56e0b9(0x229),async _0x30cca5=>{const _0x1b472d=_0x56e0b9,_0x5dd062=[];let _0x25ff7a=0x0;const _0x2ba043=0x5;for(let _0x317758=0x0;_0x317758<_0x2bb2a7[_0x1b472d(0x200)];_0x317758+=_0x2ba043){const _0x207302=_0x2bb2a7[_0x1b472d(0x283)](_0x317758,_0x317758+_0x2ba043),_0x39450d=await Promise[_0x1b472d(0x202)](_0x207302[_0x1b472d(0x2a5)](async _0x5876ec=>{const _0x321908=_0x1b472d;if(!_0x5876ec[_0x321908(0x20e)]&&!_0x5876ec[_0x321908(0x20a)])return{'action':_0x321908(0x240),'name':_0x5876ec['yamlConfig'][_0x321908(0x285)],'journeyId':_0x5876ec[_0x321908(0x2d2)]?.['id']};const _0x20a019=_0x5876ec[_0x321908(0x252)]?_0x41d642[_0x321908(0x222)](_0x5876ec['folderPath']):undefined,_0x15ec8d=_0x5876ec[_0x321908(0x20e)]?_0x321908(0x254):'Updating';_0x30cca5['setPhase'](_0x15ec8d+'\x20journey\x20\x27'+_0x5876ec[_0x321908(0x248)]['name']+'\x27');const _0x2dd6d4=new Map(),_0x1f0cd7=new Map(),_0x1e4e39=new Map(),_0x491b76={'resolveSegmentId':async _0x3848f2=>{const _0x5a08c3=_0x321908,_0x420a07=_0x3d1ef7[_0x5a08c3(0x222)](_0x3848f2);if(!_0x420a07)throw new SDKError(ErrorCode[_0x5a08c3(0x1e7)],_0x5a08c3(0x26f)+_0x3848f2+'\x20(referenced\x20in\x20journey\x20'+_0x5876ec[_0x5a08c3(0x248)]['name']+')');return _0x420a07;},'resolveEmbeddedSegmentId':async(_0x376953,_0x13a1d9)=>{const _0x19a834=_0x321908,_0x2e4e97=_0x3d1ef7['get'](_0x376953);if(_0x2e4e97)return _0x2e4e97;const _0x497c69=_0x371a62[_0x19a834(0x1cd)](_0x3bb504=>_0x3bb504['name']===_0x376953);if(_0x497c69)return _0x3d1ef7[_0x19a834(0x1ec)](_0x376953,_0x497c69['id']),_0x497c69['id'];if(_0x5876ec[_0x19a834(0x20e)]){const _0x1c04d6=_0x5876ec[_0x19a834(0x248)][_0x19a834(0x21f)]||_0x5876ec[_0x19a834(0x248)][_0x19a834(0x25c)]?.[0x0]?.[_0x19a834(0x21f)]||[];let _0x5dc22e=_0x19a834(0x295),_0x38ed26=_0x376953;const _0x1d7366=_0x5876ec[_0x19a834(0x248)][_0x19a834(0x1e1)]||_0x5876ec[_0x19a834(0x248)][_0x19a834(0x25c)]?.[0x0]?.[_0x19a834(0x1e1)];if(_0x1d7366?.['segment']===_0x376953)_0x5dc22e=_0x19a834(0x1e1),_0x38ed26=_0x1d7366['name']||_0x376953;else{_0x59713d:for(const _0x4e7185 of _0x1c04d6){if(_0x4e7185['entry_criteria']?.[_0x19a834(0x1da)]===_0x376953){_0x5dc22e=_0x4e7185['name'],_0x38ed26=_0x4e7185[_0x19a834(0x1f4)][_0x19a834(0x285)]||_0x376953;break;}if(_0x4e7185['steps'])for(const _0x3055cc of _0x4e7185[_0x19a834(0x2ad)]){if(_0x3055cc[_0x19a834(0x212)]===_0x19a834(0x275)&&_0x3055cc[_0x19a834(0x26a)]?.['branches'])for(const _0x1f1292 of _0x3055cc[_0x19a834(0x26a)][_0x19a834(0x1e9)]){if(_0x1f1292[_0x19a834(0x1da)]===_0x376953){_0x5dc22e=_0x4e7185['name'],_0x38ed26=_0x1f1292[_0x19a834(0x285)]||_0x376953;break _0x59713d;}}}}}return validateSegmentRule(_0x376953,_0x13a1d9[_0x19a834(0x1ca)]),_0x1f0cd7['set'](_0x376953,{'definition':_0x13a1d9,'stageName':_0x5dc22e,'criteriaName':_0x38ed26}),createPendingSegmentId(_0x376953);}const _0x58488f=_0x5876ec[_0x19a834(0x2d2)]?.['id'];if(!_0x58488f)throw new SDKError(ErrorCode[_0x19a834(0x26b)],_0x19a834(0x1d1));validateSegmentRule(_0x376953,_0x13a1d9[_0x19a834(0x1ca)]);const _0x2e2963=_0x19a834(0x24b)+crypto[_0x19a834(0x247)]();try{const _0x4e1f85=await _0x461780[_0x19a834(0x1da)]['createJourneySegment']({'name':_0x2e2963,'description':_0x13a1d9['description']||'Entry\x20criteria:\x20'+_0x376953,'journeyId':_0x58488f,'rule':yamlRuleToApi(_0x13a1d9[_0x19a834(0x1ca)],!![]),'countPopulation':!![],'parentFolderId':_0x26c0fc||'','audienceId':_0x1e7a88});return _0x2adbbb[_0x19a834(0x2b2)]&&console[_0x19a834(0x22f)](_0x19a834(0x258)+_0x376953+_0x19a834(0x241)+_0x2e2963+_0x19a834(0x25b)+_0x4e1f85),_0x3d1ef7[_0x19a834(0x1ec)](_0x376953,_0x4e1f85),_0x4e1f85;}catch(_0x408207){throw new SDKError(ErrorCode[_0x19a834(0x27a)],_0x19a834(0x2c4)+_0x376953+_0x19a834(0x21c)+getErrorMessage(_0x408207),_0x408207);}},'resolveActivationId':async _0x1aa0c2=>{const _0x1048a1=_0x321908,_0x242e7e=_0x2dd6d4[_0x1048a1(0x222)](_0x1aa0c2);if(_0x242e7e)return _0x242e7e;if(_0x5876ec[_0x1048a1(0x2d2)]){const _0x3f42c3=await _0x461780[_0x1048a1(0x2cf)]['listActivations'](_0x5876ec[_0x1048a1(0x2d2)]['id']),_0x1d9a68=_0x3f42c3[_0x1048a1(0x1cd)](_0x349a9e=>_0x349a9e['attributes'][_0x1048a1(0x1fb)]?.[_0x1048a1(0x285)]===_0x1aa0c2);if(_0x1d9a68)return _0x2dd6d4[_0x1048a1(0x1ec)](_0x1aa0c2,_0x1d9a68['id']),_0x1d9a68['id'];}throw new SDKError(ErrorCode[_0x1048a1(0x269)],_0x1048a1(0x288)+_0x1aa0c2+_0x1048a1(0x1ea)+_0x5876ec['yamlConfig'][_0x1048a1(0x285)]+_0x1048a1(0x2a3)+_0x1048a1(0x204));},'resolveEmbeddedActivationId':async(_0x4bcfe9,_0x52ee54)=>{const _0x17f31c=_0x321908,_0x52a63d=_0x2dd6d4[_0x17f31c(0x222)](_0x4bcfe9);if(_0x52a63d)return _0x52a63d;if(_0x5876ec[_0x17f31c(0x20e)])return _0x1e4e39['set'](_0x4bcfe9,_0x52ee54),createPendingActivationId(_0x4bcfe9);if(_0x5876ec[_0x17f31c(0x2d2)]){const _0x3e1028=await _0x461780['journey']['listActivations'](_0x5876ec[_0x17f31c(0x2d2)]['id']),_0x163dfb=_0x3e1028[_0x17f31c(0x1cd)](_0x809a26=>_0x809a26[_0x17f31c(0x2b8)][_0x17f31c(0x1fb)]?.[_0x17f31c(0x285)]===_0x52ee54[_0x17f31c(0x285)]);if(_0x163dfb)return _0x2dd6d4[_0x17f31c(0x1ec)](_0x4bcfe9,_0x163dfb['id']),_0x163dfb['id'];try{const _0xbc5780=await yamlActivationToCreateRequest(_0x52ee54,_0x14bd57),_0xb26a8b=await _0x461780['journey'][_0x17f31c(0x236)](_0x5876ec[_0x17f31c(0x2d2)]['id'],_0xbc5780);return _0x2adbbb['verbose']&&console['error']('\x20\x20Created\x20embedded\x20activation\x20\x27'+_0x4bcfe9+_0x17f31c(0x272)+_0xb26a8b['id']),_0x2dd6d4[_0x17f31c(0x1ec)](_0x4bcfe9,_0xb26a8b['id']),_0xb26a8b['id'];}catch(_0xef98bc){throw new SDKError(ErrorCode[_0x17f31c(0x2aa)],_0x17f31c(0x2b7)+_0x4bcfe9+_0x17f31c(0x21c)+getErrorMessage(_0xef98bc),_0xef98bc);}}throw new SDKError(ErrorCode[_0x17f31c(0x26b)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x32f6bd=>{const _0x466aff=_0x321908;try{return await _0x461780[_0x466aff(0x2cf)][_0x466aff(0x2b4)](_0x1e7a88,_0x32f6bd);}catch(_0x367eea){throw new SDKError(ErrorCode['NOT_FOUND'],_0x466aff(0x210)+_0x32f6bd+_0x466aff(0x225)+_0x5876ec[_0x466aff(0x248)][_0x466aff(0x285)]+'\x27)',_0x367eea);}},'resolveStageId':async(_0x5c2e3c,_0x1dcc8f)=>{const _0x25c44d=_0x321908,_0x13786f=await _0x461780['journey'][_0x25c44d(0x1d3)](_0x5c2e3c),_0x3cdb43=_0x13786f['attributes'][_0x25c44d(0x1f6)]['find'](_0x330bfb=>_0x330bfb[_0x25c44d(0x285)][_0x25c44d(0x230)]()===_0x1dcc8f[_0x25c44d(0x230)]());if(!_0x3cdb43?.['id'])throw new SDKError(ErrorCode[_0x25c44d(0x269)],'Stage\x20\x27'+_0x1dcc8f+_0x25c44d(0x1f2)+(_0x13786f[_0x25c44d(0x2b8)][_0x25c44d(0x278)]||_0x13786f['attributes'][_0x25c44d(0x285)])+'\x27');return _0x3cdb43['id'];}};try{const _0x36ce00=await a36_0x211d32(_0x5876ec['yamlConfig'],_0x1e7a88,_0x491b76),_0x294fd3=_0x20a019||_0x26c0fc;_0x294fd3&&(_0x36ce00[_0x321908(0x2a7)]={'parentFolder':{'data':{'id':_0x294fd3,'type':'folder'}}});if(_0x5876ec[_0x321908(0x20e)]){if(_0x1f0cd7[_0x321908(0x29d)]>0x0||_0x1e4e39['size']>0x0){const _0x24f319=JSON[_0x321908(0x287)](JSON[_0x321908(0x22d)](_0x36ce00));ensureJourneyDefaults(_0x24f319['attributes']);for(const _0x82998e of _0x24f319['attributes'][_0x321908(0x1f6)]){_0x82998e[_0x321908(0x239)]?.[_0x321908(0x2b5)]&&isPendingSegmentId(_0x82998e['entryCriteria'][_0x321908(0x2b5)])&&delete _0x82998e[_0x321908(0x239)];if(_0x82998e[_0x321908(0x2ad)])for(const _0xf36d20 of Object['keys'](_0x82998e[_0x321908(0x2ad)])){const _0x14fd9c=_0x82998e[_0x321908(0x2ad)][_0xf36d20];_0x14fd9c[_0x321908(0x212)]==='Activation'&&_0x14fd9c[_0x321908(0x26e)]&&isPendingActivationId(_0x14fd9c[_0x321908(0x26e)])&&(_0x14fd9c['journeyActivationStepId']='');if(_0x14fd9c[_0x321908(0x212)]===_0x321908(0x261)&&_0x14fd9c['branches'])for(const _0x2795a6 of _0x14fd9c[_0x321908(0x1e9)]){_0x2795a6[_0x321908(0x2b5)]&&isPendingSegmentId(_0x2795a6['segmentId'])&&(_0x2795a6['segmentId']='');}}}_0x2adbbb[_0x321908(0x2b2)]&&console[_0x321908(0x22f)](_0x321908(0x243)+JSON[_0x321908(0x22d)](_0x24f319,null,0x2));const _0x48fd51=await _0x461780[_0x321908(0x2cf)][_0x321908(0x1e8)](_0x24f319),_0x28e6d3=_0x48fd51['id'],_0x2a07c8=new Map();for(const _0x1d7cc3 of _0x48fd51[_0x321908(0x2b8)][_0x321908(0x1f6)]){_0x2a07c8[_0x321908(0x1ec)](_0x1d7cc3[_0x321908(0x285)][_0x321908(0x230)](),_0x1d7cc3['id']);}const _0x505b57=new Map();for(const [_0x40984f,{definition:_0x334137,criteriaName:_0x46ecaf}]of _0x1f0cd7){const _0x86b60a=generateJourneyLocalName(_0x46ecaf)||_0x321908(0x24b)+crypto[_0x321908(0x247)]();_0x2adbbb['verbose']&&console['error'](_0x321908(0x1c5)+_0x40984f+_0x321908(0x241)+_0x86b60a+_0x321908(0x1e3)+_0x28e6d3);const _0x573628=await _0x461780[_0x321908(0x1da)][_0x321908(0x232)]({'name':_0x86b60a,'description':_0x334137[_0x321908(0x28a)]||_0x321908(0x211)+_0x40984f,'journeyId':_0x28e6d3,'rule':yamlRuleToApi(_0x334137[_0x321908(0x1ca)],!![]),'countPopulation':!![],'parentFolderId':_0x294fd3||'','audienceId':_0x1e7a88});_0x505b57[_0x321908(0x1ec)](_0x40984f,_0x573628),_0x3d1ef7['set'](_0x40984f,_0x573628),_0x2adbbb[_0x321908(0x2b2)]&&console['error']('\x20\x20Created\x20embedded\x20segment\x20\x27'+_0x40984f+'\x27\x20with\x20ID:\x20'+_0x573628);}const _0x2071cd=new Map();for(const [_0x1404f4,_0x463653]of _0x1e4e39){_0x2adbbb['verbose']&&console[_0x321908(0x22f)]('\x20\x20Step\x202b:\x20Creating\x20embedded\x20activation\x20\x27'+_0x1404f4+_0x321908(0x1dc)+_0x28e6d3);try{const _0x3ceab3=await yamlActivationToCreateRequest(_0x463653,_0x14bd57),_0x3aa23a=await _0x461780[_0x321908(0x2cf)][_0x321908(0x236)](_0x28e6d3,_0x3ceab3);_0x2071cd[_0x321908(0x1ec)](_0x1404f4,_0x3aa23a['id']),_0x2dd6d4['set'](_0x1404f4,_0x3aa23a['id']),_0x2adbbb[_0x321908(0x2b2)]&&console[_0x321908(0x22f)](_0x321908(0x265)+_0x1404f4+_0x321908(0x272)+_0x3aa23a['id']);}catch(_0x7eb9b4){throw new SDKError(ErrorCode[_0x321908(0x2aa)],_0x321908(0x2b7)+_0x1404f4+_0x321908(0x21c)+getErrorMessage(_0x7eb9b4),_0x7eb9b4);}}const _0x1eb999=JSON[_0x321908(0x287)](JSON[_0x321908(0x22d)](_0x36ce00));_0x1eb999['id']=_0x28e6d3,ensureJourneyDefaults(_0x1eb999[_0x321908(0x2b8)]);const _0x54153c=(_0x1205bf,_0x324e66)=>{const _0x4ee096=_0x321908;if(!isPendingSegmentId(_0x1205bf))return _0x1205bf;const _0xbb6a1a=extractPendingSegmentName(_0x1205bf),_0x3513ed=_0x505b57[_0x4ee096(0x222)](_0xbb6a1a);return!_0x3513ed&&console[_0x4ee096(0x22f)](a36_0x3a84f9['yellow'](_0x4ee096(0x209)+_0xbb6a1a+'\x27\x20for\x20'+_0x324e66)),_0x3513ed;};if(_0x1eb999[_0x321908(0x2b8)][_0x321908(0x1e1)]?.[_0x321908(0x2b5)]&&isPendingSegmentId(_0x1eb999['attributes'][_0x321908(0x1e1)]['segmentId'])){const _0x33abce=_0x54153c(_0x1eb999[_0x321908(0x2b8)][_0x321908(0x1e1)]['segmentId'],_0x321908(0x249));_0x33abce&&(_0x1eb999[_0x321908(0x2b8)][_0x321908(0x1e1)][_0x321908(0x2b5)]=_0x33abce);}for(const _0x12bba1 of _0x1eb999[_0x321908(0x2b8)][_0x321908(0x1f6)]){const _0x2708c2=_0x2a07c8[_0x321908(0x222)](_0x12bba1[_0x321908(0x285)]['toLowerCase']());_0x2708c2&&(_0x12bba1['id']=_0x2708c2);if(_0x12bba1['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x12bba1[_0x321908(0x239)][_0x321908(0x2b5)])){const _0x25e542=_0x54153c(_0x12bba1['entryCriteria']['segmentId'],_0x321908(0x262)+_0x12bba1[_0x321908(0x285)]+_0x321908(0x1dd));_0x25e542&&(_0x12bba1[_0x321908(0x239)]['segmentId']=_0x25e542);}if(_0x12bba1[_0x321908(0x220)])for(const _0x2a8c07 of _0x12bba1[_0x321908(0x220)]){if(_0x2a8c07['segmentId']&&isPendingSegmentId(_0x2a8c07[_0x321908(0x2b5)])){const _0xa426d8=_0x54153c(_0x2a8c07[_0x321908(0x2b5)],_0x321908(0x262)+_0x12bba1[_0x321908(0x285)]+'\x27\x20exit\x20criteria');_0xa426d8&&(_0x2a8c07[_0x321908(0x2b5)]=_0xa426d8);}}if(_0x12bba1[_0x321908(0x1f9)]?.[_0x321908(0x2b5)]&&isPendingSegmentId(_0x12bba1[_0x321908(0x1f9)][_0x321908(0x2b5)])){const _0x2e3d76=_0x54153c(_0x12bba1[_0x321908(0x1f9)][_0x321908(0x2b5)],'stage\x20\x27'+_0x12bba1[_0x321908(0x285)]+'\x27\x20milestone');_0x2e3d76&&(_0x12bba1['milestone'][_0x321908(0x2b5)]=_0x2e3d76);}if(_0x12bba1[_0x321908(0x2ad)]){const _0x518da5=_0xcdd8e8=>_0x36ce00[_0x321908(0x2b8)]['journeyStages']['find'](_0x311d88=>_0x311d88[_0x321908(0x285)][_0x321908(0x230)]()===_0x12bba1[_0x321908(0x285)]['toLowerCase']())?.[_0x321908(0x2ad)]?.[_0xcdd8e8];for(const _0x264561 of Object['keys'](_0x12bba1['steps'])){const _0x136fc3=_0x12bba1[_0x321908(0x2ad)][_0x264561],_0x33dd2f=_0x518da5(_0x264561);if(_0x136fc3[_0x321908(0x212)]===_0x321908(0x23e)&&_0x136fc3[_0x321908(0x26e)]&&(isPendingActivationId(_0x136fc3[_0x321908(0x26e)])||_0x136fc3[_0x321908(0x26e)]==='')){if(_0x33dd2f?.[_0x321908(0x26e)]&&isPendingActivationId(_0x33dd2f['journeyActivationStepId'])){const _0x45ca03=extractPendingActivationName(_0x33dd2f[_0x321908(0x26e)]),_0x544c27=_0x2071cd[_0x321908(0x222)](_0x45ca03);_0x544c27&&(_0x136fc3[_0x321908(0x26e)]=_0x544c27);}}if(_0x136fc3['type']===_0x321908(0x261)&&_0x136fc3[_0x321908(0x1e9)]&&_0x33dd2f?.['branches'])for(let _0x55eab6=0x0;_0x55eab6<_0x136fc3['branches'][_0x321908(0x200)];_0x55eab6++){const _0x13aedd=_0x136fc3[_0x321908(0x1e9)][_0x55eab6],_0x1f3027=_0x33dd2f['branches'][_0x55eab6];if(_0x1f3027?.[_0x321908(0x2b5)]&&isPendingSegmentId(_0x1f3027['segmentId'])){const _0xb3add9=_0x54153c(_0x1f3027[_0x321908(0x2b5)],'stage\x20\x27'+_0x12bba1['name']+_0x321908(0x28c)+(_0x13aedd['name']||_0x55eab6)+'\x27');_0xb3add9&&(_0x13aedd[_0x321908(0x2b5)]=_0xb3add9);}}}}}return _0x2adbbb[_0x321908(0x2b2)]&&console[_0x321908(0x22f)](_0x321908(0x256)+JSON['stringify'](_0x1eb999,null,0x2)),await _0x461780['journey'][_0x321908(0x2a4)](_0x28e6d3,_0x1eb999),{'action':'created','name':_0x5876ec[_0x321908(0x248)][_0x321908(0x285)],'journeyId':_0x28e6d3};}else{ensureJourneyDefaults(_0x36ce00[_0x321908(0x2b8)]);_0x2adbbb[_0x321908(0x2b2)]&&console[_0x321908(0x22f)](_0x321908(0x21a)+JSON[_0x321908(0x22d)](_0x36ce00,null,0x2));const _0x1f0a39=await _0x461780[_0x321908(0x2cf)][_0x321908(0x1e8)](_0x36ce00);return{'action':_0x321908(0x2bc),'name':_0x5876ec['yamlConfig'][_0x321908(0x285)],'journeyId':_0x1f0a39['id']};}}else{if(_0x5876ec['hasChanges']&&_0x5876ec[_0x321908(0x2d2)])return ensureJourneyDefaults(_0x36ce00[_0x321908(0x2b8)]),await _0x461780['journey'][_0x321908(0x2a4)](_0x5876ec[_0x321908(0x2d2)]['id'],_0x36ce00),{'action':_0x321908(0x259),'name':_0x5876ec[_0x321908(0x248)][_0x321908(0x285)],'journeyId':_0x5876ec[_0x321908(0x2d2)]['id']};}return{'action':_0x321908(0x240),'name':_0x5876ec[_0x321908(0x248)][_0x321908(0x285)],'journeyId':_0x5876ec['existingJourney']?.['id']};}catch(_0x3ae367){const _0x3c8cc8=isHttp400Error(_0x3ae367),_0x2db244=_0x3c8cc8?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x4dc1b0=getErrorMessage(_0x3ae367);throw new SDKError(_0x2db244,'Failed\x20to\x20'+(_0x5876ec[_0x321908(0x20e)]?_0x321908(0x1e8):_0x321908(0x2a4))+_0x321908(0x21d)+_0x5876ec['absolutePath']+_0x321908(0x1de)+_0x4dc1b0,_0x3ae367);}}));_0x5dd062[_0x1b472d(0x27f)](..._0x39450d),_0x25ff7a+=_0x207302[_0x1b472d(0x200)],_0x30cca5[_0x1b472d(0x1c4)]('('+_0x25ff7a+'/'+_0x2bb2a7[_0x1b472d(0x200)]+')');}return _0x5dd062;},{'verbose':_0x2adbbb[_0x56e0b9(0x2b2)]});for(const _0x3857e5 of _0x4a4b84[_0x56e0b9(0x29c)]){if(_0x3857e5['action']===_0x56e0b9(0x2bc))console[_0x56e0b9(0x22f)](a36_0x3a84f9['green'](_0x56e0b9(0x1fc)+_0x3857e5[_0x56e0b9(0x285)]+'\x27')),_0x17072f++;else _0x3857e5[_0x56e0b9(0x1f8)]===_0x56e0b9(0x259)&&(console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x203)]('✔\x20Updated\x20journey\x20\x27'+_0x3857e5[_0x56e0b9(0x285)]+'\x27')),_0xc213e7++);}if(_0x48fc76&&_0x4a4b84[_0x56e0b9(0x29c)][_0x56e0b9(0x200)]===0x1){const _0x2d49ce=_0x4a4b84['data'][0x0];if(_0x2d49ce[_0x56e0b9(0x24d)]){const _0xc17ba8=getConsoleNextUrl(_0x2adbbb['site'],'/app/ps/'+_0x1e7a88+_0x56e0b9(0x219)+_0x2d49ce[_0x56e0b9(0x24d)]+'/j/da/je');console[_0x56e0b9(0x22f)]('\x20\x20'+a36_0x3a84f9[_0x56e0b9(0x253)](_0xc17ba8));}}}for(const _0x49bbc9 of _0x36f21c){console[_0x56e0b9(0x22f)](a36_0x3a84f9['yellow']('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x49bbc9[_0x56e0b9(0x278)])),_0xf8c5dc++;}const _0x5b85d4=[];if(_0x2e618e>0x0)_0x5b85d4['push'](_0x2e618e+'\x20created');if(_0x119e4c>0x0)_0x5b85d4[_0x56e0b9(0x27f)](_0x119e4c+'\x20updated');if(_0x312293>0x0)_0x5b85d4[_0x56e0b9(0x27f)](_0x312293+_0x56e0b9(0x273));const _0xaffcb9=[];if(_0x17072f>0x0)_0xaffcb9[_0x56e0b9(0x27f)](_0x17072f+_0x56e0b9(0x1ef));if(_0xc213e7>0x0)_0xaffcb9[_0x56e0b9(0x27f)](_0xc213e7+_0x56e0b9(0x2bb));if(_0xf8c5dc>0x0)_0xaffcb9[_0x56e0b9(0x27f)](_0xf8c5dc+_0x56e0b9(0x273));const _0x438730=[];if(_0x272208>0x0)_0x438730[_0x56e0b9(0x27f)](_0x272208+_0x56e0b9(0x1ef));if(_0x4a3d53>0x0)_0x438730['push'](_0x4a3d53+_0x56e0b9(0x2bb));if(_0xfd11f1>0x0)_0x438730[_0x56e0b9(0x27f)](_0xfd11f1+_0x56e0b9(0x273));return console[_0x56e0b9(0x22f)](a36_0x3a84f9[_0x56e0b9(0x1c8)](_0x56e0b9(0x2b1))),_0x5b85d4[_0x56e0b9(0x200)]>0x0&&!_0x2adbbb[_0x56e0b9(0x231)]&&console[_0x56e0b9(0x22f)](_0x56e0b9(0x1e5)+_0x5b85d4[_0x56e0b9(0x26d)](',\x20')),_0xaffcb9[_0x56e0b9(0x200)]>0x0&&console[_0x56e0b9(0x22f)](_0x56e0b9(0x2c8)+_0xaffcb9['join'](',\x20')),_0x438730['length']>0x0&&!_0x2adbbb[_0x56e0b9(0x231)]&&console[_0x56e0b9(0x22f)](_0x56e0b9(0x267)+_0x438730[_0x56e0b9(0x26d)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x2792af){const _0x244e51=a36_0x678b6b,_0x4502d6=new Map(),_0x549f88=new Map();for(const _0x5dc83e of _0x2792af){_0x549f88[_0x244e51(0x1ec)](_0x5dc83e['id'],_0x5dc83e);}const _0x290be6=new Set();for(const _0x516154 of _0x2792af){!_0x516154['parentFolderId']&&_0x290be6[_0x244e51(0x22b)](_0x516154['id']);}function _0x566268(_0xa2fdac){const _0x1f737c=_0x244e51;if(_0x290be6['has'](_0xa2fdac['id']))return'';if(_0xa2fdac['parentFolderId']){const _0x543da2=_0x549f88[_0x1f737c(0x222)](_0xa2fdac[_0x1f737c(0x2a6)]);if(_0x543da2){const _0x44b7af=_0x566268(_0x543da2);return _0x44b7af?_0x44b7af+'/'+_0xa2fdac['name']:_0xa2fdac[_0x1f737c(0x285)];}}return _0xa2fdac[_0x1f737c(0x285)];}for(const _0x4dbb4e of _0x2792af){const _0x354105=_0x566268(_0x4dbb4e);_0x4502d6[_0x244e51(0x1ec)](_0x354105,_0x4dbb4e['id']);}return _0x4502d6;}function findYamlFiles(_0xeb4a87){const _0xb57c39=[];function _0x1304ca(_0x5c236f){const _0x4600ed=a36_0x4aa3,_0x3c4af6=readdirSync(_0x5c236f,{'withFileTypes':!![]});for(const _0x2a17d of _0x3c4af6){const _0x348fc7=a36_0x14a858[_0x4600ed(0x26d)](_0x5c236f,_0x2a17d[_0x4600ed(0x285)]);if(_0x2a17d[_0x4600ed(0x21e)]())_0x1304ca(_0x348fc7);else(_0x2a17d[_0x4600ed(0x285)][_0x4600ed(0x25a)](_0x4600ed(0x28b))||_0x2a17d[_0x4600ed(0x285)][_0x4600ed(0x25a)]('.yaml'))&&_0xb57c39['push'](_0x348fc7);}}return _0x1304ca(_0xeb4a87),_0xb57c39;}function calculateActivationActions(_0x2bf28c,_0x4788ca,_0x5d30ef,_0x274d41){const _0x2cb8c=a36_0x678b6b,_0x5d603d=[],_0x3a4926=new Map();for(const _0x2abd36 of _0x4788ca){_0x3a4926[_0x2cb8c(0x1ec)](_0x2abd36[_0x2cb8c(0x285)],_0x2abd36);}const _0x365dcf=new Map();for(const _0x3e1520 of _0x2bf28c){_0x365dcf['set'](_0x3e1520['name'],_0x3e1520);}for(const _0x417ed3 of _0x2bf28c){const _0x57419b=_0x3a4926[_0x2cb8c(0x222)](_0x417ed3['name']);if(!_0x57419b)_0x5d603d[_0x2cb8c(0x27f)]({'type':_0x2cb8c(0x1e8),'name':_0x417ed3[_0x2cb8c(0x285)],'yamlActivation':_0x417ed3});else{const _0x1f1d57=activationToYaml(_0x57419b,_0x5d30ef,_0x274d41),_0x1024a6=a36_0x1dad46[_0x2cb8c(0x22d)](_0x1f1d57),_0x4944ee=a36_0x1dad46['stringify'](_0x417ed3);_0x1024a6!==_0x4944ee&&_0x5d603d[_0x2cb8c(0x27f)]({'type':'update','name':_0x417ed3[_0x2cb8c(0x285)],'yamlActivation':_0x417ed3,'existingActivation':_0x57419b});}}for(const _0x2f3021 of _0x4788ca){!_0x365dcf[_0x2cb8c(0x289)](_0x2f3021['name'])&&_0x5d603d[_0x2cb8c(0x27f)]({'type':'delete','name':_0x2f3021[_0x2cb8c(0x285)],'existingActivation':_0x2f3021});}return _0x5d603d;}
|
|
1
|
+
const a36_0x3da80c=a36_0x2861;(function(_0x3e5b06,_0xef285d){const _0x546e5b=a36_0x2861,_0x28412a=_0x3e5b06();while(!![]){try{const _0x3abc0a=-parseInt(_0x546e5b(0x2bc))/0x1*(parseInt(_0x546e5b(0x217))/0x2)+-parseInt(_0x546e5b(0x22c))/0x3*(parseInt(_0x546e5b(0x260))/0x4)+-parseInt(_0x546e5b(0x20a))/0x5*(-parseInt(_0x546e5b(0x2b9))/0x6)+-parseInt(_0x546e5b(0x1f3))/0x7*(-parseInt(_0x546e5b(0x239))/0x8)+parseInt(_0x546e5b(0x1da))/0x9+-parseInt(_0x546e5b(0x2b0))/0xa*(-parseInt(_0x546e5b(0x2d4))/0xb)+parseInt(_0x546e5b(0x1de))/0xc*(parseInt(_0x546e5b(0x272))/0xd);if(_0x3abc0a===_0xef285d)break;else _0x28412a['push'](_0x28412a['shift']());}catch(_0x223e3f){_0x28412a['push'](_0x28412a['shift']());}}}(a36_0x5d24,0x4cd82));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,journeyActivationStepToYaml,activationToYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,resolveRuleSegmentRefs}from'../sdk/segment/child-segment-yaml.js';import{isJourneyYaml,parseYamlString as a36_0x2583b8,yamlToApi as a36_0x3fb9ed,toYamlString as a36_0x50e334,apiToYamlAsync,hasMultipleVersions,normalizeJourneyYaml}from'../sdk/segment/journey-yaml.js';function a36_0x2861(_0x31ac2f,_0xf27f4f){_0x31ac2f=_0x31ac2f-0x1c7;const _0x5d242b=a36_0x5d24();let _0x2861d2=_0x5d242b[_0x31ac2f];return _0x2861d2;}import a36_0x2bb026 from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a36_0x5ec126 from'path';import{getConsoleNextUrl}from'../types/endpoints.js';import*as a36_0x4d9ca2 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_0x3da80c(0x202);function collectSegmentRefsFromRule(_0x5fe8e8){const _0x1a997f=[],_0x4adf4=_0x5e79e1=>{const _0x53b354=a36_0x2861;if(!_0x5e79e1||typeof _0x5e79e1!=='object')return;if(Array['isArray'](_0x5e79e1)){_0x5e79e1[_0x53b354(0x24d)](_0x4adf4);return;}const _0x55ab8d=_0x5e79e1;(_0x55ab8d[_0x53b354(0x2cb)]===_0x53b354(0x2a0)||_0x55ab8d[_0x53b354(0x2cb)]===_0x53b354(0x2d1))&&typeof _0x55ab8d[_0x53b354(0x1f0)]===_0x53b354(0x226)&&_0x1a997f['push'](_0x55ab8d[_0x53b354(0x1f0)]);for(const _0x1cc314 of Object[_0x53b354(0x2ca)](_0x55ab8d)){_0x4adf4(_0x1cc314);}};return _0x4adf4(_0x5fe8e8),_0x1a997f;}function collectSegmentIdsFromJourneyApi(_0x30934d){const _0x16ea3a=a36_0x3da80c,_0x144274=new Set();_0x30934d['attributes'][_0x16ea3a(0x208)]?.[_0x16ea3a(0x279)]&&_0x144274[_0x16ea3a(0x225)](_0x30934d[_0x16ea3a(0x2ad)][_0x16ea3a(0x208)][_0x16ea3a(0x279)]);const _0x5be337=_0x30934d[_0x16ea3a(0x2ad)]['journeyStages'];if(Array[_0x16ea3a(0x273)](_0x5be337))for(const _0x54446a of _0x5be337){_0x54446a[_0x16ea3a(0x1d7)]?.[_0x16ea3a(0x279)]&&_0x144274[_0x16ea3a(0x225)](_0x54446a['entryCriteria'][_0x16ea3a(0x279)]);if(Array[_0x16ea3a(0x273)](_0x54446a[_0x16ea3a(0x289)]))for(const _0x397772 of _0x54446a['exitCriteria']){_0x397772[_0x16ea3a(0x279)]&&_0x144274[_0x16ea3a(0x225)](_0x397772['segmentId']);}_0x54446a[_0x16ea3a(0x26e)]?.[_0x16ea3a(0x279)]&&_0x144274[_0x16ea3a(0x225)](_0x54446a['milestone'][_0x16ea3a(0x279)]);if(Array[_0x16ea3a(0x273)](_0x54446a[_0x16ea3a(0x2a6)]))for(const _0x4a8d40 of _0x54446a[_0x16ea3a(0x2a6)]){_0x4a8d40[_0x16ea3a(0x2c0)]?.['segmentId']&&_0x144274['add'](_0x4a8d40[_0x16ea3a(0x2c0)][_0x16ea3a(0x279)]);if(Array[_0x16ea3a(0x273)](_0x4a8d40[_0x16ea3a(0x2c3)]))for(const _0x5e1bc6 of _0x4a8d40['branches']){_0x5e1bc6['segmentId']&&_0x144274[_0x16ea3a(0x225)](_0x5e1bc6[_0x16ea3a(0x279)]);}}}return _0x144274;}function validateSegmentRule(_0x2c20d1,_0x5c80ea){const _0x28e2c3=a36_0x3da80c;if(!_0x5c80ea||!_0x5c80ea[_0x28e2c3(0x29c)])return;for(let _0x38d138=0x0;_0x38d138<_0x5c80ea[_0x28e2c3(0x29c)]['length'];_0x38d138++){const _0x1992d6=_0x5c80ea[_0x28e2c3(0x29c)][_0x38d138];if(_0x28e2c3(0x2cb)in _0x1992d6&&_0x1992d6['type']==='Value'){const _0x563d24=_0x1992d6;if(!_0x563d24[_0x28e2c3(0x245)]||_0x563d24[_0x28e2c3(0x245)]==='')throw new SDKError(ErrorCode[_0x28e2c3(0x2c9)],_0x28e2c3(0x28b)+_0x2c20d1+'\x27:\x20'+(_0x28e2c3(0x21e)+_0x38d138+'].attribute\x20cannot\x20be\x20empty.\x0a')+_0x28e2c3(0x20e));}}}function createPendingSegmentId(_0xe0541e){return''+PENDING_SEGMENT_PREFIX+_0xe0541e+'__';}function isPendingSegmentId(_0x548852){const _0x30cf19=a36_0x3da80c;return _0x548852[_0x30cf19(0x299)](PENDING_SEGMENT_PREFIX);}function extractPendingSegmentName(_0x2ad5d6){return _0x2ad5d6['replace'](/^__pending_(.+)__$/,'$1');}function a36_0x5d24(){const _0x43878a=['diff','milestone','SEGMENT_UPDATE_ERROR','\x20\x20Source:\x20','parentFolder','156793PRaOFV','isArray','yes','activationParams','Creating\x20segment\x20\x27','Fetching\x20existing\x20journeys...','\x27\x20with\x20journeyId:\x20','segmentId','existingJourney','Activation','join','\x27\x20for\x20','parentSegmentFolder','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','Failed\x20to\x20create\x20embedded\x20activation\x20\x27','deleteActivation','unchanged','hasChanges','createSegment','Fetching\x20users\x20for\x20email\x20resolution...','journeyBundleName','journeyStages','journey','exitCriteria','then','Invalid\x20condition\x20in\x20embedded\x20segment\x20\x27','parent_segment','INTERNAL','Push\x20','ACTIVATION_SYNTAX_ERROR','isNew','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','\x20changed','connection','site','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','...',').\x20','\x20\x20🗺️\x20\x20Journeys:','startsWith','find','goal\x20criteria','conditions','\x27\x20exit\x20criteria','createJourneySegment','__pending_act_','include','relative','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','\x20\x20✔\x20Created\x20activation\x20\x27','user','yamlActivation','steps','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','journeys','✔\x20Deleted\x20segment\x20\x27','stages','\x20\x20Journey\x20API\x20request:\x20','getJourney','attributes','filter','randomUUID','20YKwNSy','segment:push','slice','📁\x20','\x20updated','Deleting\x20activation\x20\x27','endsWith','DecisionPoint','Creating\x20activation\x20\x27','6LQnCbK','parse','isDirectory','19487npVLmZ','\x20changes?','red','Error:\x20Directory\x20not\x20found:\x20','waitCondition','\x27\x20entry\x20criteria','config','branches','\x20\x20Segments:\x20','configDir','versionNumber','listFolders','data','JOURNEY_SYNTAX_ERROR','values','type','Fetching\x20parent\x20segment\x20details...','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','\x27...','delete','\x20folders\x20to\x20create','exclude','\x27\x20(internal:\x20','rule','489841IkAgbJ','segments','resolveJourneyId','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','\x20\x20⚠\x20Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','New\x20segment:','has','\x20activations]','dryRun','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','utf-8','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','journey_entry_criteria_','\x20journey\x20from\x20file:\x20','\x27\x20not\x20found\x20in\x20journey\x20\x27','\x0a\x20\x20','Updating','entryCriteria','SEGMENT_NOT_FOUND','Entry\x20criteria:\x20','2856663QEOePI','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','\x20\x20Created\x20embedded\x20segment\x20\x27','\x20YAML\x20files\x20found','180RqqHME','max','/e/','update','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)','\x20to\x20delete','\x27\x20decision\x20point\x20branch\x20\x27','\x27:\x20','folderId','activationActions','description','Fetching\x20journey\x20\x27','\x20unchanged','(Journey\x20will\x20be\x20deleted)','existingActivation','\x27\x20with\x20ID:\x20','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','parentFolderId','segment','.yaml','Delete\x20segment:','129703IzqGbV','Creating\x20folder\x20\x27','relationships','split','setExtra','updateActivation','dirname','map','\x27\x20v','\x0a✔\x20Push\x20complete','replace','✔\x20Updated\x20segment\x20\x27','\x20deleted','Source\x20directory:\x20','\x20(referenced\x20in\x20journey\x20','__pending_','green','getParent','Error\x20parsing\x20','toString','toLowerCase','goal','deleteSegment','1635505ggmsdT','\x20\x20\x20\x20','JOURNEY_UPDATE_ERROR','segment\x20or\x20journey','Please\x20specify\x20a\x20valid\x20attribute\x20name.','listJourneysFromParentSegment','execute','listActivations','repeat','folderPath','keys','dim','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','22FpZcbe','existingSegment','yellow','validatedRequest','/app/ps/','absolutePath','Fetching\x20existing\x20folders...','conditions[','journeysOnly','error','No\x20','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Folders\x20to\x20create:','verbose','add','string','getActivation','activation_','decision_point','updated','\x20to\x20create','51cDakie','get','Fetching\x20existing\x20activations...','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','entries','.yml','✔\x20Created\x20journey\x20\x27','isFile','\x20\x20Or\x20set\x20context:\x20`tdx\x20sg\x20use\x20<parent_name>`','created','Activation\x20not\x20found:\x20','all','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','8QmHpPF','blue','Failed\x20to\x20','journeyActivationStepId','getOutputSchemaWithCache','Changes\x20to\x20journey:','sort','state','\x20\x20✔\x20Deleted\x20activation\x20\x27','resolveParentId','with','getSegment','attribute','\x20\x20Activations:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','NOT_FOUND','createActivation','size','push','stage\x20\x27','forEach','Fetching\x20connections\x20for\x20name\x20resolution...','/j/da/je','resolve','ACTIVATION_UPDATE_ERROR','activations','segmentFolderId','length','Resolving\x20parent\x20segment\x20\x27','\x20\x20Step\x202:\x20Creating\x20embedded\x20segment\x20\x27','Fetching\x20existing\x20segments...','Updating\x20segment\x20\x27','stringify','Changes\x20to:','✔\x20Created\x20folder\x20\x27','\x0aPush\x20summary\x20for\x20\x27','yamlConfig','\x20\x20Created\x20embedded\x20activation\x20\x27','set','95036DSpBFF','journeyId','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Creating','Segment\x20not\x20found:\x20','\x20created','cyan','\x20new','Updating\x20activation\x20\x27','cwd','name','action','create'];a36_0x5d24=function(){return _0x43878a;};return a36_0x5d24();}const PENDING_ACTIVATION_PREFIX=a36_0x3da80c(0x29f);function createPendingActivationId(_0x7d872e){return''+PENDING_ACTIVATION_PREFIX+_0x7d872e+'__';}function isPendingActivationId(_0x531962){return _0x531962['startsWith'](PENDING_ACTIVATION_PREFIX);}function extractPendingActivationName(_0x4d9657){const _0x31a0ad=a36_0x3da80c;return _0x4d9657[_0x31a0ad(0x1fd)](/^__pending_act_(.+)__$/,'$1');}function ensureJourneyDefaults(_0x22b619){const _0x341602=a36_0x3da80c;!_0x22b619[_0x341602(0x1e8)]&&(_0x22b619['description']=''),!_0x22b619[_0x341602(0x240)]&&(_0x22b619[_0x341602(0x240)]='draft');}function tryFindTdxConfig(_0x5b4841){try{return findTdxConfig(_0x5b4841);}catch{return null;}}function resolveTDFolderPath(_0x9de9c2,_0x3b82ac,_0x2d4bff){if(!_0x3b82ac)return _0x9de9c2;return _0x9de9c2?_0x2d4bff+'/'+_0x9de9c2:_0x2d4bff;}export class SegmentPushCommand extends BaseCommand{['name']=a36_0x3da80c(0x2b1);[a36_0x3da80c(0x1e8)]=a36_0x3da80c(0x1d1);async[a36_0x3da80c(0x210)](_0x30c9c1){const _0x3ceb12=a36_0x3da80c,{options:_0x4dfd61,args:_0x5304de,tdx:_0x442297}=_0x30c9c1,_0x1f4aea=_0x4dfd61,_0x3ff749=_0x4dfd61['parentSegment'],_0x3b50ac=_0x5304de[0x0];let _0x46c0ce,_0x15d562,_0x48226a,_0x215404;if(_0x3b50ac){if(existsSync(_0x3b50ac)&&statSync(_0x3b50ac)[_0x3ceb12(0x2bb)]()){const _0x24cf50=tryFindTdxConfig(_0x3b50ac);if(_0x24cf50)_0x46c0ce=_0x24cf50[_0x3ceb12(0x2c2)][_0x3ceb12(0x28c)],_0x15d562=_0x3b50ac,_0x48226a=_0x24cf50[_0x3ceb12(0x2c5)];else{if(_0x3ff749)_0x46c0ce=_0x3ff749,_0x15d562=_0x3b50ac;else return console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x2be)](_0x3ceb12(0x2a2)+_0x3b50ac+'\x0a')),console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x266)](_0x3ceb12(0x238))),console['error'](a36_0x2bb026['cyan'](_0x3ceb12(0x234))),0x1;}}else{if(existsSync(_0x3b50ac)&&statSync(_0x3b50ac)[_0x3ceb12(0x233)]()){const _0x33d4dd=a36_0x5ec126[_0x3ceb12(0x1f9)](_0x3b50ac),_0x2d6a78=tryFindTdxConfig(_0x33d4dd);if(_0x2d6a78)_0x46c0ce=_0x2d6a78[_0x3ceb12(0x2c2)]['parent_segment'],_0x48226a=_0x2d6a78[_0x3ceb12(0x2c5)],_0x15d562=_0x2d6a78[_0x3ceb12(0x2c5)],_0x215404=a36_0x5ec126['resolve'](_0x3b50ac);else{if(_0x3ff749)_0x46c0ce=_0x3ff749,_0x15d562=_0x33d4dd,_0x215404=a36_0x5ec126[_0x3ceb12(0x250)](_0x3b50ac);else return console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x2be)](_0x3ceb12(0x2a2)+_0x33d4dd+'\x0a')),console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x266)](_0x3ceb12(0x238))),console[_0x3ceb12(0x220)](a36_0x2bb026['cyan'](_0x3ceb12(0x234))),0x1;}}else _0x46c0ce=_0x3b50ac;}}else{const _0x2f2da1=tryFindTdxConfig(process['cwd']());_0x2f2da1?(_0x46c0ce=_0x2f2da1[_0x3ceb12(0x2c2)]['parent_segment'],_0x15d562=process[_0x3ceb12(0x269)](),_0x48226a=_0x2f2da1[_0x3ceb12(0x2c5)]):_0x46c0ce=_0x3ff749;}if(!_0x46c0ce)return console['error'](a36_0x2bb026[_0x3ceb12(0x219)](_0x3ceb12(0x295))),console['error'](_0x3ceb12(0x1e2)),console[_0x3ceb12(0x220)](_0x3ceb12(0x27f)),console['error'](_0x3ceb12(0x216)),0x1;const _0x3748cb=_0x15d562||getSegmentRootDir(sanitizeFileName(_0x46c0ce)),_0x470dd0=_0x48226a||_0x3748cb,_0x2c4709=a36_0x5ec126[_0x3ceb12(0x2a1)](_0x470dd0,_0x3748cb),_0x54a36c=_0x2c4709!==''&&_0x2c4709!=='.';if(!existsSync(_0x3748cb))return console['error'](a36_0x2bb026['red'](_0x3ceb12(0x2bf)+_0x3748cb+'\x0a')),console[_0x3ceb12(0x220)](a36_0x2bb026['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x1f4aea[_0x3ceb12(0x224)]&&(console[_0x3ceb12(0x220)]('Site:\x20'+_0x1f4aea[_0x3ceb12(0x294)]),console[_0x3ceb12(0x220)]('Parent\x20segment:\x20'+_0x46c0ce),console[_0x3ceb12(0x220)](_0x3ceb12(0x200)+_0x3748cb),_0x54a36c&&console[_0x3ceb12(0x220)]('Scoped\x20to\x20folder:\x20'+_0x2c4709));const _0xba7fa5=await withSpinner(_0x3ceb12(0x255)+_0x46c0ce+'\x27...',()=>_0x442297[_0x3ceb12(0x1f0)][_0x3ceb12(0x242)](_0x46c0ce),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]}),_0x33fe8a=_0xba7fa5[_0x3ceb12(0x2c8)],[_0x221587,_0x5f13a9,_0x4d2b41,_0x3af254,_0x1dd975]=await Promise['all']([withSpinner(_0x3ceb12(0x2cc),()=>_0x442297[_0x3ceb12(0x1f0)][_0x3ceb12(0x204)](_0x33fe8a),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]}),withSpinner(_0x3ceb12(0x257),()=>_0x442297[_0x3ceb12(0x1f0)]['listSegments'](_0x33fe8a),{'verbose':_0x1f4aea['verbose']}),withSpinner(_0x3ceb12(0x21d),()=>_0x442297['segment'][_0x3ceb12(0x2c7)](_0x33fe8a),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]}),withSpinner(_0x3ceb12(0x277),()=>_0x442297[_0x3ceb12(0x288)][_0x3ceb12(0x20f)](_0x33fe8a),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]}),withSpinner(_0x3ceb12(0x285),()=>_0x442297[_0x3ceb12(0x2a4)]['buildUserMaps'](),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]})[_0x3ceb12(0x28a)](_0x5cfb5b=>_0x5cfb5b['data'])]),_0x1b3b4c=_0x221587[_0x3ceb12(0x2c8)],_0x1b9fd9=_0x1b3b4c[_0x3ceb12(0x1f5)]?.[_0x3ceb12(0x27e)]?.[_0x3ceb12(0x2c8)]?.['id']||_0x1b3b4c[_0x3ceb12(0x1f5)]?.[_0x3ceb12(0x271)]?.[_0x3ceb12(0x2c8)]?.['id'],_0x133c39=_0x5f13a9[_0x3ceb12(0x2c8)],_0x5cf0fa=_0x4d2b41[_0x3ceb12(0x2c8)],_0x442f11=_0x3af254[_0x3ceb12(0x2c8)],{emailToId:_0x2763a5,idToEmail:_0x4dd521}=_0x1dd975,[_0x517261,_0x1db211,_0x586db0]=await withSpinner(_0x3ceb12(0x24e),async()=>{const _0xb5e2e6=_0x3ceb12,_0x2a69b3=await _0x442297[_0xb5e2e6(0x293)]['list'](),_0x48d6c6=new Map(),_0x37b584=new Map(),_0x3033b8=new Map();for(const _0x337096 of _0x2a69b3){_0x48d6c6[_0xb5e2e6(0x25f)](_0x337096[_0xb5e2e6(0x26a)],parseInt(_0x337096['id'],0xa)),_0x37b584[_0xb5e2e6(0x25f)](_0x337096['id'],_0x337096[_0xb5e2e6(0x26a)]),_0x3033b8[_0xb5e2e6(0x25f)](_0x337096['name'],_0x337096['type']);}return[_0x48d6c6,_0x37b584,_0x3033b8];},{'verbose':_0x1f4aea[_0x3ceb12(0x224)]})[_0x3ceb12(0x28a)](_0x13e263=>_0x13e263['data']),_0x1aae1d={'emailToIdMap':_0x2763a5,'connectionNameToIdMap':_0x517261,'connectionNameToTypeMap':_0x586db0,'getSchema':_0x7d53e9=>_0x442297[_0x3ceb12(0x293)][_0x3ceb12(0x23d)](_0x7d53e9)},_0x1794e3=buildFolderPathToIdMap(_0x5cf0fa),_0x359459=new Map();for(const [_0x1f20a1,_0xd874de]of _0x1794e3[_0x3ceb12(0x230)]()){_0x359459[_0x3ceb12(0x25f)](_0xd874de,_0x1f20a1);}const _0x3fdd8a=new Map();for(const _0x57866b of _0x133c39){const _0x287961=_0x57866b[_0x3ceb12(0x253)]?_0x359459['get'](_0x57866b['segmentFolderId'][_0x3ceb12(0x206)]())||'':'',_0x3b4216=_0x287961+':'+_0x57866b[_0x3ceb12(0x26a)];_0x3fdd8a[_0x3ceb12(0x25f)](_0x3b4216,_0x57866b);}const _0x1c9145=new Map();for(const _0x242ebb of _0x133c39){_0x1c9145[_0x3ceb12(0x25f)](_0x242ebb[_0x3ceb12(0x26a)],_0x242ebb['id']);}const _0x5a1499=new Map();for(const _0x282968 of _0x442f11){const _0x35041b=_0x282968['folderId']?_0x359459[_0x3ceb12(0x22d)](_0x282968[_0x3ceb12(0x1e6)])||'':'',_0x29cdc8=_0x35041b+':'+_0x282968[_0x3ceb12(0x286)];!_0x5a1499[_0x3ceb12(0x1cc)](_0x29cdc8)&&_0x5a1499[_0x3ceb12(0x25f)](_0x29cdc8,[]),_0x5a1499['get'](_0x29cdc8)[_0x3ceb12(0x24b)](_0x282968);}for(const _0xd6a3c6 of _0x5a1499[_0x3ceb12(0x2ca)]()){_0xd6a3c6[_0x3ceb12(0x23f)]((_0x260550,_0x7c22e0)=>(_0x260550['versionNumber']||0x0)-(_0x7c22e0[_0x3ceb12(0x2c6)]||0x0));}let _0x27918b;if(_0x215404){if(!_0x215404['endsWith']('.yml')&&!_0x215404[_0x3ceb12(0x2b6)](_0x3ceb12(0x1f1)))return console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x2be)](_0x3ceb12(0x1ee)+_0x215404+'\x0a')),0x1;_0x27918b=[_0x215404];}else _0x27918b=findYamlFiles(_0x3748cb);if(_0x27918b['length']===0x0)return console['error'](a36_0x2bb026[_0x3ceb12(0x2be)](_0x3ceb12(0x1c9)+_0x3748cb+'\x0a')),console[_0x3ceb12(0x220)](a36_0x2bb026['cyan'](_0x3ceb12(0x247))),0x1;const _0x28c434=[],_0x2e9264=[];for(const _0x95d0df of _0x27918b){const _0x3c9e3a=a36_0x5ec126[_0x3ceb12(0x2a1)](_0x3748cb,a36_0x5ec126[_0x3ceb12(0x1f9)](_0x95d0df)),_0x4438b2=_0x3c9e3a==='.'?'':_0x3c9e3a,_0x104474=readFileSync(_0x95d0df,_0x3ceb12(0x1d0));try{const _0x298e3d=a36_0x4d9ca2['parse'](_0x104474);if(isJourneyYaml(_0x298e3d)){const _0x22e673=a36_0x2583b8(_0x104474);_0x2e9264[_0x3ceb12(0x24b)]({'yamlConfig':_0x22e673,'folderPath':_0x4438b2,'sourcePath':_0x95d0df});}else{if(!_0x1f4aea['journeysOnly']){const _0x2d4f9a=parseSegmentYamlFile(_0x104474),_0x2c0509=normalizeChildSegmentYaml(_0x2d4f9a);_0x28c434[_0x3ceb12(0x24b)]({'yamlConfig':_0x2c0509,'folderPath':_0x4438b2,'sourcePath':_0x95d0df});}}}catch(_0x20ca0d){return console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x2be)](_0x3ceb12(0x205)+_0x95d0df+':\x20'+(_0x20ca0d instanceof Error?_0x20ca0d['message']:_0x20ca0d))),0x1;}}if(_0x28c434['length']===0x0&&_0x2e9264['length']===0x0){const _0xf064fd=_0x1f4aea[_0x3ceb12(0x21f)]?_0x3ceb12(0x288):_0x3ceb12(0x20d);return console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x219)](_0x3ceb12(0x221)+_0xf064fd+_0x3ceb12(0x1dd))),0x0;}const _0x5d0434=new Map();_0x133c39[_0x3ceb12(0x254)]>0x0&&!_0x1f4aea[_0x3ceb12(0x21f)]&&await withSpinner(_0x3ceb12(0x22e),async()=>{await batchAsync(_0x133c39,async _0x5cd48a=>{const _0x465456=a36_0x2861,_0x2394b3=await _0x442297[_0x465456(0x1f0)][_0x465456(0x211)](_0x33fe8a,_0x5cd48a['id']);_0x5d0434['set'](_0x5cd48a['id'],_0x2394b3);});},{'verbose':_0x1f4aea['verbose']});const _0x16b4b3=[],_0x1842ef=new Set();for(const {yamlConfig:_0x411cb3,folderPath:_0x2a236f,sourcePath:_0x52ab8c}of _0x28c434){const _0x304684=resolveTDFolderPath(_0x2a236f,_0x54a36c,_0x2c4709),_0x3e5629=_0x304684+':'+_0x411cb3['name'],_0x1e4525=_0x3fdd8a[_0x3ceb12(0x22d)](_0x3e5629),_0x11ce94=_0x1e4525?_0x5d0434['get'](_0x1e4525['id'])||[]:[];if(_0x304684&&!_0x1794e3[_0x3ceb12(0x1cc)](_0x304684)){const _0x5d34ae=_0x304684[_0x3ceb12(0x1f6)]('/');let _0xcb3202='';for(const _0x161b9e of _0x5d34ae){_0xcb3202=_0xcb3202?_0xcb3202+'/'+_0x161b9e:_0x161b9e,!_0x1794e3[_0x3ceb12(0x1cc)](_0xcb3202)&&_0x1842ef[_0x3ceb12(0x225)](_0xcb3202);}}const _0x18acf7=calculateActivationActions(_0x411cb3[_0x3ceb12(0x252)]||[],_0x11ce94,_0x4dd521,_0x1db211);for(const _0x465aae of _0x18acf7){(_0x465aae['type']===_0x3ceb12(0x26c)||_0x465aae['type']===_0x3ceb12(0x1e1))&&_0x465aae[_0x3ceb12(0x2a5)]&&(_0x465aae[_0x3ceb12(0x21a)]=await yamlActivationToCreateRequest(_0x465aae[_0x3ceb12(0x2a5)],_0x1aae1d));}const _0x1ae22b=segmentToYamlString(_0x411cb3);let _0x5fb8b,_0x4296a4=![],_0x3c58fc;if(_0x1e4525){const _0x413612=segmentWithActivationsToYaml(_0x1e4525,_0x11ce94,undefined,_0x4dd521,_0x1db211),_0x578f5d=segmentToYamlString(_0x413612);_0x5fb8b=generateDiff(_0x578f5d,_0x1ae22b),_0x4296a4=hasChanges(_0x5fb8b),_0x4296a4&&(_0x3c58fc=formatDiffWithColors(_0x5fb8b));}else _0x5fb8b=generateDiff('',_0x1ae22b),_0x3c58fc=formatDiffWithColors(_0x5fb8b);_0x16b4b3[_0x3ceb12(0x24b)]({'relativePath':_0x411cb3[_0x3ceb12(0x26a)],'absolutePath':_0x52ab8c,'yamlConfig':_0x411cb3,'folderPath':_0x304684,'existingSegment':_0x1e4525,'existingActivations':_0x11ce94,'isNew':!_0x1e4525,'hasChanges':_0x4296a4,'diff':_0x3c58fc,'activationActions':_0x18acf7});}let _0x5dd1b3=[];if(!_0x215404){const _0x506128=new Set();for(const {yamlConfig:_0x517a50,folderPath:_0x564425}of _0x28c434){const _0x559e0b=resolveTDFolderPath(_0x564425,_0x54a36c,_0x2c4709);_0x506128[_0x3ceb12(0x225)](_0x559e0b+':'+_0x517a50[_0x3ceb12(0x26a)]);}_0x5dd1b3=_0x133c39[_0x3ceb12(0x2ae)](_0x5326aa=>{const _0x28c8e8=_0x3ceb12,_0x28bd90=_0x5326aa[_0x28c8e8(0x253)]?_0x359459[_0x28c8e8(0x22d)](_0x5326aa[_0x28c8e8(0x253)]['toString']())||'':'',_0x2bbb35=_0x28bd90+':'+_0x5326aa[_0x28c8e8(0x26a)];if(_0x506128[_0x28c8e8(0x1cc)](_0x2bbb35))return![];if(_0x54a36c)return _0x28bd90===_0x2c4709||_0x28bd90[_0x28c8e8(0x299)](_0x2c4709+'/');return!![];});}const _0x373f03=[];for(const {yamlConfig:_0x2a1613,folderPath:_0x980aa5,sourcePath:_0x2b49ab}of _0x2e9264){const _0x246536=resolveTDFolderPath(_0x980aa5,_0x54a36c,_0x2c4709),_0x543762=_0x246536+':'+_0x2a1613[_0x3ceb12(0x26a)],_0x13228c=_0x5a1499[_0x3ceb12(0x22d)](_0x543762);let _0x28dc74,_0x2b6f3b;if(_0x13228c&&_0x13228c[_0x3ceb12(0x254)]>0x0){const _0x1147d1=new Set(),_0x4ca0c2=new Set(),_0x2fb5a8=new Map(),_0x37b7ea=new Map(),_0x75c74b=createJumpTargetCache(),_0x3f68de=new Set(),_0xdecca5=new Map();if(_0x2a1613['segments'])for(const [_0x3b084b,_0x4c2357]of Object[_0x3ceb12(0x230)](_0x2a1613[_0x3ceb12(0x1c7)])){_0x3f68de[_0x3ceb12(0x225)](_0x3b084b);if(_0x4c2357[_0x3ceb12(0x2d3)]){const _0x1307ae=yamlRuleToApi(_0x4c2357[_0x3ceb12(0x2d3)]),_0x1e607c=apiRuleToYaml(_0x1307ae);_0xdecca5[_0x3ceb12(0x25f)](_0x3b084b,_0x1e607c);}}const _0x53263f=new Map();for(const [_0x3f11cf,_0x35842c]of _0xdecca5){const _0x3cbb79=serializeExpandedRule(_0x35842c,_0xdecca5);!_0x53263f[_0x3ceb12(0x1cc)](_0x3cbb79)&&_0x53263f[_0x3ceb12(0x25f)](_0x3cbb79,_0x3f11cf);}const _0x235ba5=new Map(),_0x1ee3b6=new Map(),_0x35a98d=new Set(),_0x16df2f=async _0x50cbe7=>{const _0x13eeac=_0x3ceb12;if(_0x35a98d['has'](_0x50cbe7))return;_0x35a98d['add'](_0x50cbe7);let _0xe55716=_0x133c39[_0x13eeac(0x29a)](_0x5589a2=>_0x5589a2['id']===_0x50cbe7);if(!_0xe55716)try{_0xe55716=await _0x442297['segment'][_0x13eeac(0x244)](_0x33fe8a,_0x50cbe7);}catch{return;}if(_0xe55716?.[_0x13eeac(0x2d3)]){const _0x58ce52=apiRuleToYaml(_0xe55716[_0x13eeac(0x2d3)]);_0x1ee3b6[_0x13eeac(0x25f)](_0x50cbe7,_0x58ce52);const _0x396382=collectSegmentRefsFromRule(_0x58ce52);for(const _0x26c575 of _0x396382){await _0x16df2f(_0x26c575);}}};for(const _0x30e670 of _0x13228c){const _0x4391da=await _0x442297['journey'][_0x3ceb12(0x2ac)](_0x30e670['id']),_0x31b8c0=collectSegmentIdsFromJourneyApi(_0x4391da);for(const _0x47ffe6 of _0x31b8c0){await _0x16df2f(_0x47ffe6);}}let _0x4c3dc5;const _0x3b1430=_0x53dc1d=>({'resolveSegment':async _0x116c6f=>{const _0x2eedb4=_0x3ceb12,_0x4fc332=_0x37b7ea['get'](_0x116c6f);if(_0x4fc332!==undefined)return{'name':_0x4fc332,'isJourneyLocal':!![]};try{let _0x418f24=_0x133c39[_0x2eedb4(0x29a)](_0x47c720=>_0x47c720['id']===_0x116c6f);!_0x418f24&&(_0x418f24=await _0x442297['segment'][_0x2eedb4(0x244)](_0x33fe8a,_0x116c6f));const _0x5f3fe6=generateJourneyLocalName(_0x418f24['name']),_0x500209=_0x418f24['kind']===SEGMENT_KIND_JOURNEY&&_0x5f3fe6!==undefined;let _0x37f5bb=_0x418f24[_0x2eedb4(0x26a)],_0x24d191;if(_0x500209&&_0x418f24[_0x2eedb4(0x2d3)]){const _0x44bf64=apiRuleToYaml(_0x418f24['rule']);_0x1ee3b6[_0x2eedb4(0x25f)](_0x116c6f,_0x44bf64);const _0x5c931d=async _0x176d73=>{const _0x7190da=_0x2eedb4,_0x4f98e0=collectSegmentRefsFromRule(_0x176d73);for(const _0x56b832 of _0x4f98e0){if(!_0x1ee3b6[_0x7190da(0x1cc)](_0x56b832))try{const _0x331eeb=await _0x442297[_0x7190da(0x1f0)][_0x7190da(0x244)](_0x33fe8a,_0x56b832);if(_0x331eeb?.[_0x7190da(0x2d3)]){const _0x122c9c=apiRuleToYaml(_0x331eeb[_0x7190da(0x2d3)]);_0x1ee3b6[_0x7190da(0x25f)](_0x56b832,_0x122c9c),await _0x5c931d(_0x122c9c);}}catch{}}};await _0x5c931d(_0x44bf64);const _0x145502=serializeExpandedRule(_0x44bf64,_0x1ee3b6),_0x32ca83=_0x53263f[_0x2eedb4(0x22d)](_0x145502);if(_0x32ca83&&!_0x1147d1[_0x2eedb4(0x1cc)](_0x32ca83)){_0x37f5bb=_0x32ca83,_0x1147d1[_0x2eedb4(0x225)](_0x37f5bb),_0x37b7ea['set'](_0x116c6f,_0x37f5bb);const _0x2533c5=await resolveRuleSegmentRefs(_0x44bf64,async _0x5e18bf=>{const _0x1613a3=_0x2eedb4,_0x148571=_0x37b7ea[_0x1613a3(0x22d)](_0x5e18bf);if(_0x148571)return _0x148571;const _0x4aa0c2=await _0x4c3dc5['resolveSegment'](_0x5e18bf);return _0x4aa0c2[_0x1613a3(0x26a)];});_0x24d191={'description':_0x418f24[_0x2eedb4(0x1e8)],'rule':_0x2533c5};}else{if(_0x32ca83&&_0x1147d1[_0x2eedb4(0x1cc)](_0x32ca83))_0x37f5bb=_0x32ca83,_0x37b7ea[_0x2eedb4(0x25f)](_0x116c6f,_0x37f5bb);else{const _0x3f90d1=_0x235ba5[_0x2eedb4(0x22d)](_0x145502);if(_0x3f90d1)_0x37f5bb=_0x3f90d1,_0x37b7ea[_0x2eedb4(0x25f)](_0x116c6f,_0x37f5bb);else{if(_0x5f3fe6){let _0x45a31b=_0x5f3fe6,_0x4e1e61=0x2;while(_0x1147d1['has'](_0x45a31b)||_0x3f68de[_0x2eedb4(0x1cc)](_0x45a31b)){_0x45a31b=_0x5f3fe6+'_'+_0x4e1e61,_0x4e1e61++;}_0x1147d1[_0x2eedb4(0x225)](_0x45a31b),_0x37f5bb=_0x45a31b;}_0x37b7ea['set'](_0x116c6f,_0x37f5bb),_0x235ba5['set'](_0x145502,_0x37f5bb);const _0x281af8=await resolveRuleSegmentRefs(_0x44bf64,async _0x3b9e81=>{const _0x2cd3a2=_0x2eedb4,_0x43813c=_0x37b7ea[_0x2cd3a2(0x22d)](_0x3b9e81);if(_0x43813c)return _0x43813c;const _0x368693=await _0x4c3dc5['resolveSegment'](_0x3b9e81);return _0x368693[_0x2cd3a2(0x26a)];});_0x24d191={'description':_0x418f24[_0x2eedb4(0x1e8)],'rule':_0x281af8};}}}}return{'name':_0x37f5bb,'isJourneyLocal':_0x500209,'definition':_0x24d191};}catch{return{'name':_0x116c6f,'isJourneyLocal':![]};}},'resolveActivation':async _0x133cc=>{const _0x3dfbd2=_0x3ceb12,_0xfc7005=_0x2fb5a8[_0x3dfbd2(0x22d)](_0x133cc);if(_0xfc7005!==undefined)return{'name':_0xfc7005,'isJourneyLocal':!![]};try{const _0x1bfebf=await _0x442297[_0x3dfbd2(0x288)][_0x3dfbd2(0x227)](_0x53dc1d,_0x133cc),_0x42a70b=_0x1bfebf[_0x3dfbd2(0x2ad)][_0x3dfbd2(0x275)][_0x3dfbd2(0x26a)]||_0x133cc,_0x12b64b=sanitizeYamlKey(_0x42a70b)||_0x3dfbd2(0x228)+_0x133cc;let _0x5857b7=_0x12b64b,_0x2f175b=0x2;while(_0x4ca0c2['has'](_0x5857b7)){_0x5857b7=_0x12b64b+'_'+_0x2f175b,_0x2f175b++;}_0x4ca0c2[_0x3dfbd2(0x225)](_0x5857b7),_0x2fb5a8['set'](_0x133cc,_0x5857b7);const _0x2f3b68=journeyActivationStepToYaml(_0x1bfebf,_0x4dd521,_0x1db211);return{'name':_0x5857b7,'isJourneyLocal':!![],'definition':_0x2f3b68};}catch{return{'name':_0x133cc,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x3d5743,_0x2dae87)=>resolveJumpTarget(_0x3d5743,_0x2dae87,_0x75c74b,_0x3d2f87=>_0x442297[_0x3ceb12(0x288)][_0x3ceb12(0x2ac)](_0x3d2f87))}),_0x501bf0=hasMultipleVersions(_0x2a1613);if(_0x501bf0&&_0x13228c[_0x3ceb12(0x254)]>0x1){const _0x364338=[];for(const _0x3d44d9 of _0x13228c){const _0x3ff8cc=await withSpinner(_0x3ceb12(0x1e9)+_0x2a1613[_0x3ceb12(0x26a)]+_0x3ceb12(0x1fb)+(_0x3d44d9[_0x3ceb12(0x2c6)]||0x1)+_0x3ceb12(0x296),()=>_0x442297['journey'][_0x3ceb12(0x2ac)](_0x3d44d9['id']),{'verbose':_0x1f4aea['verbose']}),_0x17e7f0=_0x3b1430(_0x3d44d9['id']);_0x4c3dc5=_0x17e7f0;const _0x576458=await apiToYamlAsync(_0x3ff8cc[_0x3ceb12(0x2c8)],_0x17e7f0);_0x364338[_0x3ceb12(0x24b)]({'item':_0x3d44d9,'yaml':_0x576458});}_0x2b6f3b=buildMergedJourneyYaml(_0x364338);const _0x99c524=Math[_0x3ceb12(0x1df)](..._0x364338['map'](_0xf0afcb=>_0xf0afcb['item'][_0x3ceb12(0x2c6)]||0x0)),_0x5d73fe=_0x13228c[_0x3ceb12(0x29a)](_0x33527b=>(_0x33527b[_0x3ceb12(0x2c6)]||0x0)===_0x99c524);_0x5d73fe&&(_0x28dc74=await _0x442297[_0x3ceb12(0x288)][_0x3ceb12(0x2ac)](_0x5d73fe['id']));}else{const _0x4982c6=_0x13228c[_0x13228c[_0x3ceb12(0x254)]-0x1],_0x218aee=await withSpinner(_0x3ceb12(0x1e9)+_0x2a1613[_0x3ceb12(0x26a)]+'\x27\x20details...',()=>_0x442297[_0x3ceb12(0x288)][_0x3ceb12(0x2ac)](_0x4982c6['id']),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]});_0x28dc74=_0x218aee['data'];const _0x201a89=_0x3b1430(_0x4982c6['id']);_0x4c3dc5=_0x201a89,_0x2b6f3b=await apiToYamlAsync(_0x28dc74,_0x201a89);}}if(_0x246536&&!_0x1794e3[_0x3ceb12(0x1cc)](_0x246536)){const _0x554028=_0x246536[_0x3ceb12(0x1f6)]('/');let _0x328233='';for(const _0x18a645 of _0x554028){_0x328233=_0x328233?_0x328233+'/'+_0x18a645:_0x18a645,!_0x1794e3['has'](_0x328233)&&_0x1842ef['add'](_0x328233);}}const _0x4de9c9=normalizeJourneyYaml(_0x2a1613,_0x2a1613),_0x44f243=a36_0x50e334(_0x4de9c9);let _0x49c756=![],_0x1fb04b;if(_0x2b6f3b){const _0x9d4797=normalizeJourneyYaml(_0x2b6f3b,_0x2a1613),_0x26c30c=a36_0x50e334(_0x9d4797),_0x3d5265=generateDiff(_0x26c30c,_0x44f243);_0x49c756=hasChanges(_0x3d5265),_0x49c756&&(_0x1fb04b=formatDiffWithColors(_0x3d5265));}else{const _0x45899a=generateDiff('',_0x44f243);_0x1fb04b=formatDiffWithColors(_0x45899a);}_0x373f03[_0x3ceb12(0x24b)]({'relativePath':_0x2a1613[_0x3ceb12(0x26a)],'absolutePath':_0x2b49ab,'yamlConfig':_0x2a1613,'folderPath':_0x246536,'existingJourney':_0x28dc74,'isNew':!_0x28dc74,'hasChanges':_0x49c756,'diff':_0x1fb04b});}let _0x161a37=[];if(!_0x215404){const _0x53b3ca=new Set();for(const {yamlConfig:_0x52ae4c,folderPath:_0x4cbc64}of _0x2e9264){const _0x17de46=resolveTDFolderPath(_0x4cbc64,_0x54a36c,_0x2c4709);_0x53b3ca['add'](_0x17de46+':'+_0x52ae4c[_0x3ceb12(0x26a)]);}_0x161a37=_0x442f11[_0x3ceb12(0x2ae)](_0x3fe90b=>{const _0x11c2ce=_0x3ceb12,_0x55af1b=_0x3fe90b[_0x11c2ce(0x1e6)]?_0x359459['get'](_0x3fe90b[_0x11c2ce(0x1e6)])||'':'',_0x12ff71=_0x55af1b+':'+_0x3fe90b['journeyBundleName'];if(_0x53b3ca['has'](_0x12ff71))return![];if(_0x54a36c)return _0x55af1b===_0x2c4709||_0x55af1b[_0x11c2ce(0x299)](_0x2c4709+'/');return!![];});}const _0x4b59fe=_0x16b4b3[_0x3ceb12(0x2ae)](_0x37bab2=>_0x37bab2[_0x3ceb12(0x290)]),_0x333403=_0x16b4b3['filter'](_0x49b08a=>!_0x49b08a[_0x3ceb12(0x290)]&&_0x49b08a[_0x3ceb12(0x283)]),_0x53fac7=_0x16b4b3[_0x3ceb12(0x2ae)](_0x522434=>!_0x522434['isNew']&&!_0x522434[_0x3ceb12(0x283)]),_0x36aaa5=Array['from'](_0x1842ef)[_0x3ceb12(0x23f)](),_0x1f5acf=_0x1f4aea[_0x3ceb12(0x2cf)]?_0x5dd1b3:[],_0x4bcdb1=_0x1f4aea[_0x3ceb12(0x2cf)]?_0x161a37:[],_0x276ec1=_0x16b4b3['flatMap'](_0x1ec64c=>_0x1ec64c[_0x3ceb12(0x1e7)]),_0x30dd3e=_0x276ec1[_0x3ceb12(0x2ae)](_0x1381ec=>_0x1381ec['type']===_0x3ceb12(0x26c)),_0x33b72d=_0x276ec1[_0x3ceb12(0x2ae)](_0x589b65=>_0x589b65[_0x3ceb12(0x2cb)]==='update'),_0x2bbfcd=_0x276ec1['filter'](_0x3f9d66=>_0x3f9d66[_0x3ceb12(0x2cb)]==='delete'),_0x523b56=_0x373f03[_0x3ceb12(0x2ae)](_0x3e9f47=>_0x3e9f47['isNew']),_0xe74fa1=_0x373f03['filter'](_0x7ffa20=>!_0x7ffa20[_0x3ceb12(0x290)]&&_0x7ffa20[_0x3ceb12(0x283)]),_0x33def1=_0x373f03['filter'](_0x6922d3=>!_0x6922d3[_0x3ceb12(0x290)]&&!_0x6922d3['hasChanges']);console['error'](_0x3ceb12(0x25c)+_0x46c0ce+'\x27:');_0x36aaa5[_0x3ceb12(0x254)]>0x0&&console['error']('\x20\x20'+a36_0x2bb026[_0x3ceb12(0x23a)](_0x3ceb12(0x2b3)+_0x36aaa5[_0x3ceb12(0x254)]+_0x3ceb12(0x2d0)));if(!_0x1f4aea['journeysOnly']){console[_0x3ceb12(0x220)]('\x20\x20📊\x20Segments:'),console['error'](_0x3ceb12(0x20b)+a36_0x2bb026[_0x3ceb12(0x203)]('+\x20'+_0x4b59fe[_0x3ceb12(0x254)]+_0x3ceb12(0x267))),console[_0x3ceb12(0x220)]('\x20\x20\x20\x20'+a36_0x2bb026['yellow']('~\x20'+_0x333403[_0x3ceb12(0x254)]+_0x3ceb12(0x292)));if(_0x1f5acf[_0x3ceb12(0x254)]>0x0)console[_0x3ceb12(0x220)](_0x3ceb12(0x20b)+a36_0x2bb026[_0x3ceb12(0x2be)]('-\x20'+_0x1f5acf['length']+_0x3ceb12(0x1e3)));else _0x5dd1b3['length']>0x0&&!_0x1f4aea[_0x3ceb12(0x2cf)]&&console[_0x3ceb12(0x220)](_0x3ceb12(0x20b)+a36_0x2bb026['dim'](_0x5dd1b3[_0x3ceb12(0x254)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x3ceb12(0x220)](_0x3ceb12(0x20b)+a36_0x2bb026['dim']('=\x20'+_0x53fac7['length']+_0x3ceb12(0x1ea)));}if(_0x373f03['length']>0x0||_0x161a37[_0x3ceb12(0x254)]>0x0){console[_0x3ceb12(0x220)](_0x3ceb12(0x298)),console[_0x3ceb12(0x220)](_0x3ceb12(0x20b)+a36_0x2bb026[_0x3ceb12(0x203)]('+\x20'+_0x523b56[_0x3ceb12(0x254)]+'\x20new')),console['error'](_0x3ceb12(0x20b)+a36_0x2bb026[_0x3ceb12(0x219)]('~\x20'+_0xe74fa1[_0x3ceb12(0x254)]+_0x3ceb12(0x292)));if(_0x4bcdb1[_0x3ceb12(0x254)]>0x0)console['error'](_0x3ceb12(0x20b)+a36_0x2bb026[_0x3ceb12(0x2be)]('-\x20'+_0x4bcdb1['length']+_0x3ceb12(0x1e3)));else _0x161a37[_0x3ceb12(0x254)]>0x0&&!_0x1f4aea['delete']&&console[_0x3ceb12(0x220)](_0x3ceb12(0x20b)+a36_0x2bb026[_0x3ceb12(0x215)](_0x161a37[_0x3ceb12(0x254)]+_0x3ceb12(0x1db)));console[_0x3ceb12(0x220)]('\x20\x20\x20\x20'+a36_0x2bb026[_0x3ceb12(0x215)]('=\x20'+_0x33def1['length']+_0x3ceb12(0x1ea)));}_0x276ec1[_0x3ceb12(0x254)]>0x0&&!_0x1f4aea[_0x3ceb12(0x21f)]&&(console['error'](''),console[_0x3ceb12(0x220)]('\x20\x20Activations:'),_0x30dd3e[_0x3ceb12(0x254)]>0x0&&console[_0x3ceb12(0x220)](_0x3ceb12(0x20b)+a36_0x2bb026[_0x3ceb12(0x203)]('+\x20'+_0x30dd3e[_0x3ceb12(0x254)]+_0x3ceb12(0x22b))),_0x33b72d[_0x3ceb12(0x254)]>0x0&&console['error']('\x20\x20\x20\x20'+a36_0x2bb026[_0x3ceb12(0x219)]('~\x20'+_0x33b72d[_0x3ceb12(0x254)]+'\x20to\x20update')),_0x2bbfcd[_0x3ceb12(0x254)]>0x0&&console[_0x3ceb12(0x220)](_0x3ceb12(0x20b)+a36_0x2bb026[_0x3ceb12(0x2be)]('-\x20'+_0x2bbfcd[_0x3ceb12(0x254)]+_0x3ceb12(0x1e3))));console[_0x3ceb12(0x220)](_0x3ceb12(0x270)+a36_0x2bb026[_0x3ceb12(0x266)](_0x3748cb)+'\x0a');if(_0x36aaa5[_0x3ceb12(0x254)]>0x0){console[_0x3ceb12(0x220)](_0x3ceb12(0x223));for(const _0x49e996 of _0x36aaa5){console[_0x3ceb12(0x220)]('\x20\x20'+a36_0x2bb026[_0x3ceb12(0x23a)]('+')+'\x20'+_0x49e996);}console[_0x3ceb12(0x220)]('');}if(_0x4b59fe[_0x3ceb12(0x254)]>0x0&&!_0x1f4aea[_0x3ceb12(0x21f)])for(const _0x2017a4 of _0x4b59fe){const _0x1cff0f=_0x2017a4['folderPath']?_0x2017a4[_0x3ceb12(0x213)]+'/'+_0x2017a4[_0x3ceb12(0x25d)]['name']:_0x2017a4['yamlConfig'][_0x3ceb12(0x26a)],_0x3efdbe=_0x2017a4[_0x3ceb12(0x25d)]['activations']?.[_0x3ceb12(0x254)]||0x0,_0xd47e83=_0x3efdbe>0x0?a36_0x2bb026[_0x3ceb12(0x215)]('\x20['+_0x3efdbe+_0x3ceb12(0x1cd)):'';console[_0x3ceb12(0x220)]('\x0a'+a36_0x2bb026['green'](_0x3ceb12(0x1cb))+'\x20'+_0x1cff0f+_0xd47e83),console['error']('─'[_0x3ceb12(0x212)](0x3c)),_0x2017a4[_0x3ceb12(0x26d)]&&console[_0x3ceb12(0x220)](_0x2017a4[_0x3ceb12(0x26d)]),console[_0x3ceb12(0x220)]('─'[_0x3ceb12(0x212)](0x3c));}if(_0x1f5acf[_0x3ceb12(0x254)]>0x0&&!_0x1f4aea[_0x3ceb12(0x21f)])for(const _0x4d6986 of _0x1f5acf){const _0x1c8e31=_0x4d6986[_0x3ceb12(0x253)]?_0x359459[_0x3ceb12(0x22d)](_0x4d6986['segmentFolderId']['toString']())||'':'',_0x14d01f=_0x1c8e31?_0x1c8e31+'/'+_0x4d6986['name']:_0x4d6986[_0x3ceb12(0x26a)],_0xdb159b=_0x5d0434['get'](_0x4d6986['id'])||[],_0x496221=_0xdb159b[_0x3ceb12(0x254)]>0x0?a36_0x2bb026[_0x3ceb12(0x215)]('\x20['+_0xdb159b['length']+_0x3ceb12(0x1cd)):'';console[_0x3ceb12(0x220)]('\x0a'+a36_0x2bb026[_0x3ceb12(0x2be)](_0x3ceb12(0x1f2))+'\x20'+_0x14d01f+_0x496221),console[_0x3ceb12(0x220)]('─'['repeat'](0x3c));const _0x3457cd=segmentWithActivationsToYaml(_0x4d6986,_0xdb159b,undefined,_0x4dd521,_0x1db211),_0x35704b=segmentToYamlString(_0x3457cd),_0x62e0b3=generateDiff(_0x35704b,'');console['error'](formatDiffWithColors(_0x62e0b3)),console['error']('─'[_0x3ceb12(0x212)](0x3c));}const _0x27bc68=_0x16b4b3[_0x3ceb12(0x2ae)](_0x195531=>!_0x195531['isNew']&&_0x195531['diff']);if(_0x27bc68[_0x3ceb12(0x254)]>0x0&&!_0x1f4aea[_0x3ceb12(0x21f)])for(const _0x16bcc5 of _0x27bc68){const _0x3ba3cd=_0x16bcc5[_0x3ceb12(0x213)]?_0x16bcc5[_0x3ceb12(0x213)]+'/'+_0x16bcc5['yamlConfig'][_0x3ceb12(0x26a)]:_0x16bcc5[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)];console[_0x3ceb12(0x220)]('\x0a'+a36_0x2bb026[_0x3ceb12(0x219)](_0x3ceb12(0x25a))+'\x20'+_0x3ba3cd),console[_0x3ceb12(0x220)]('─'[_0x3ceb12(0x212)](0x3c)),console['error'](_0x16bcc5[_0x3ceb12(0x26d)]),console['error']('─'[_0x3ceb12(0x212)](0x3c));}if(_0x523b56[_0x3ceb12(0x254)]>0x0)for(const _0x193ef6 of _0x523b56){const _0x5edc44=_0x193ef6[_0x3ceb12(0x213)]?_0x193ef6[_0x3ceb12(0x213)]+'/'+_0x193ef6[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)]:_0x193ef6['yamlConfig'][_0x3ceb12(0x26a)];console['error']('\x0a'+a36_0x2bb026[_0x3ceb12(0x203)]('New\x20journey:')+'\x20'+_0x5edc44),console['error']('─'[_0x3ceb12(0x212)](0x3c)),_0x193ef6['diff']&&console['error'](_0x193ef6['diff']),console['error']('─'['repeat'](0x3c));}const _0x237ba7=_0x373f03[_0x3ceb12(0x2ae)](_0x5e6d8d=>!_0x5e6d8d[_0x3ceb12(0x290)]&&_0x5e6d8d[_0x3ceb12(0x26d)]);if(_0x237ba7[_0x3ceb12(0x254)]>0x0)for(const _0xd26247 of _0x237ba7){const _0x55f56d=_0xd26247[_0x3ceb12(0x213)]?_0xd26247[_0x3ceb12(0x213)]+'/'+_0xd26247[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)]:_0xd26247[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)];console['error']('\x0a'+a36_0x2bb026['yellow'](_0x3ceb12(0x23e))+'\x20'+_0x55f56d),console[_0x3ceb12(0x220)]('─'[_0x3ceb12(0x212)](0x3c)),console[_0x3ceb12(0x220)](_0xd26247[_0x3ceb12(0x26d)]),console[_0x3ceb12(0x220)]('─'[_0x3ceb12(0x212)](0x3c));}if(_0x4bcdb1[_0x3ceb12(0x254)]>0x0)for(const _0x49d17c of _0x4bcdb1){const _0x16cb8b=_0x49d17c[_0x3ceb12(0x1e6)]?_0x359459[_0x3ceb12(0x22d)](_0x49d17c[_0x3ceb12(0x1e6)])||'':'',_0x5c58d2=_0x16cb8b?_0x16cb8b+'/'+_0x49d17c[_0x3ceb12(0x286)]:_0x49d17c['journeyBundleName'];console['error']('\x0a'+a36_0x2bb026[_0x3ceb12(0x2be)]('Delete\x20journey:')+'\x20'+_0x5c58d2),console[_0x3ceb12(0x220)]('─'[_0x3ceb12(0x212)](0x3c)),console[_0x3ceb12(0x220)](a36_0x2bb026['red'](_0x3ceb12(0x1eb))),console['error']('─'[_0x3ceb12(0x212)](0x3c));}if(_0x1f4aea[_0x3ceb12(0x1ce)])return console[_0x3ceb12(0x220)](a36_0x2bb026['yellow'](_0x3ceb12(0x22f))),0x0;const _0x13686=_0x1f4aea['journeysOnly']?![]:_0x4b59fe[_0x3ceb12(0x254)]>0x0||_0x333403[_0x3ceb12(0x254)]>0x0||_0x1f5acf[_0x3ceb12(0x254)]>0x0,_0x2c869a=_0x523b56['length']>0x0||_0xe74fa1[_0x3ceb12(0x254)]>0x0||_0x4bcdb1[_0x3ceb12(0x254)]>0x0,_0x4667ee=_0x1f4aea[_0x3ceb12(0x21f)]?![]:_0x276ec1[_0x3ceb12(0x254)]>0x0,_0x5ea50f=_0x36aaa5[_0x3ceb12(0x254)]>0x0;if(!_0x13686&&!_0x2c869a&&!_0x4667ee&&!_0x5ea50f){const _0x209062=_0x1f4aea[_0x3ceb12(0x21f)]?_0x3ceb12(0x291):'✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console['error'](a36_0x2bb026['green'](_0x209062));if(_0x215404&&_0x33def1[_0x3ceb12(0x254)]===0x1){const _0x5f3332=_0x33def1[0x0];if(_0x5f3332[_0x3ceb12(0x27a)]?.['id']){const _0x4b7f46=getConsoleNextUrl(_0x1f4aea['site'],_0x3ceb12(0x21b)+_0x33fe8a+_0x3ceb12(0x1e0)+_0x5f3332[_0x3ceb12(0x27a)]['id']+_0x3ceb12(0x24f));console['error']('\x20\x20'+a36_0x2bb026['cyan'](_0x4b7f46));}}return 0x0;}const _0x85c84f=_0x1f4aea[_0x3ceb12(0x21f)]?_0x523b56[_0x3ceb12(0x254)]+_0xe74fa1['length']+_0x4bcdb1[_0x3ceb12(0x254)]+_0x36aaa5[_0x3ceb12(0x254)]:_0x4b59fe['length']+_0x333403[_0x3ceb12(0x254)]+_0x1f5acf[_0x3ceb12(0x254)]+_0x523b56[_0x3ceb12(0x254)]+_0xe74fa1[_0x3ceb12(0x254)]+_0x4bcdb1['length']+_0x36aaa5[_0x3ceb12(0x254)]+_0x276ec1[_0x3ceb12(0x254)];if(!_0x1f4aea[_0x3ceb12(0x274)]&&_0x85c84f>0x0){const _0x320373=await confirmKey(_0x3ceb12(0x28e)+_0x85c84f+_0x3ceb12(0x2bd));if(!_0x320373)return console[_0x3ceb12(0x220)]('Aborted.'),0x1;}for(const _0xcecc27 of _0x36aaa5){const _0x55b940=_0xcecc27[_0x3ceb12(0x1f6)]('/'),_0x5acb34=_0x55b940[_0x55b940[_0x3ceb12(0x254)]-0x1],_0x7a69a4=_0x55b940[_0x3ceb12(0x2b2)](0x0,-0x1)[_0x3ceb12(0x27c)]('/'),_0x561471=_0x1794e3[_0x3ceb12(0x22d)](_0x7a69a4),_0x47f99a={'name':_0x5acb34,'parentFolderId':_0x561471},_0x36e91f=await withSpinner(_0x3ceb12(0x1f4)+_0xcecc27+'\x27...',()=>_0x442297[_0x3ceb12(0x1f0)]['createFolder'](_0x33fe8a,_0x47f99a),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]});_0x1794e3[_0x3ceb12(0x25f)](_0xcecc27,_0x36e91f[_0x3ceb12(0x2c8)]['id']),console['error'](a36_0x2bb026[_0x3ceb12(0x23a)](_0x3ceb12(0x25b)+_0xcecc27+'\x27'));}let _0x562490=0x0,_0x33ea71=0x0,_0x2b3878=0x0,_0x2775ab=0x0,_0x3c072a=0x0,_0x465bc7=0x0;const _0x349a94=new Map();for(const _0x1b9a7d of _0x1f4aea[_0x3ceb12(0x21f)]?[]:_0x16b4b3){const _0x24fc6b=_0x1b9a7d[_0x3ceb12(0x213)]?_0x1794e3[_0x3ceb12(0x22d)](_0x1b9a7d['folderPath']):undefined;let _0x3cf444;try{if(_0x1b9a7d['isNew']){const _0x2f8df1=yamlToCreateRequest(_0x1b9a7d['yamlConfig'],_0x24fc6b),_0x4bb39f=await withSpinner(_0x3ceb12(0x276)+_0x1b9a7d['yamlConfig'][_0x3ceb12(0x26a)]+_0x3ceb12(0x2ce),()=>_0x442297['segment'][_0x3ceb12(0x284)](_0x33fe8a,_0x2f8df1),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]});_0x3cf444=_0x4bb39f[_0x3ceb12(0x2c8)]['id'],_0x349a94[_0x3ceb12(0x25f)](_0x1b9a7d[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)],_0x3cf444),console[_0x3ceb12(0x220)](a36_0x2bb026['green']('✔\x20Created\x20segment\x20\x27'+_0x1b9a7d[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)]+'\x27')),_0x562490++;}else{if(_0x1b9a7d[_0x3ceb12(0x283)]){const _0x10882a=yamlToUpdateRequest(_0x1b9a7d[_0x3ceb12(0x25d)]);_0x24fc6b!==_0x1b9a7d[_0x3ceb12(0x218)]?.[_0x3ceb12(0x253)]&&(_0x10882a[_0x3ceb12(0x253)]=_0x24fc6b?parseInt(_0x24fc6b,0xa):undefined),await withSpinner(_0x3ceb12(0x258)+_0x1b9a7d[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)]+_0x3ceb12(0x2ce),()=>_0x442297[_0x3ceb12(0x1f0)]['updateSegmentById'](_0x33fe8a,_0x1b9a7d[_0x3ceb12(0x218)]['id'],_0x10882a),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]}),_0x3cf444=_0x1b9a7d['existingSegment']['id'],console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x219)](_0x3ceb12(0x1fe)+_0x1b9a7d[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)]+'\x27')),_0x33ea71++;}else _0x3cf444=_0x1b9a7d[_0x3ceb12(0x218)]['id'];}}catch(_0x3b814f){const _0xa72271=isHttp400Error(_0x3b814f),_0x110c9f=_0xa72271?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x45f1f3=getErrorMessage(_0x3b814f);throw new SDKError(_0x110c9f,_0x3ceb12(0x23b)+(_0x1b9a7d[_0x3ceb12(0x290)]?_0x3ceb12(0x26c):_0x3ceb12(0x1e1))+'\x20segment\x20from\x20file:\x20'+_0x1b9a7d[_0x3ceb12(0x21c)]+_0x3ceb12(0x1d5)+_0x45f1f3,_0x3b814f);}for(const _0x49f8c0 of _0x1b9a7d[_0x3ceb12(0x1e7)]){try{if(_0x49f8c0['type']==='create'&&_0x49f8c0[_0x3ceb12(0x21a)])await withSpinner(_0x3ceb12(0x2b8)+_0x49f8c0[_0x3ceb12(0x26a)]+'\x27...',()=>_0x442297[_0x3ceb12(0x1f0)]['createActivation'](_0x33fe8a,_0x3cf444,_0x49f8c0[_0x3ceb12(0x21a)]),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]}),console[_0x3ceb12(0x220)](a36_0x2bb026['green'](_0x3ceb12(0x2a3)+_0x49f8c0[_0x3ceb12(0x26a)]+'\x27')),_0x2775ab++;else{if(_0x49f8c0[_0x3ceb12(0x2cb)]==='update'&&_0x49f8c0[_0x3ceb12(0x21a)]&&_0x49f8c0[_0x3ceb12(0x1ec)])await withSpinner(_0x3ceb12(0x268)+_0x49f8c0[_0x3ceb12(0x26a)]+_0x3ceb12(0x2ce),()=>_0x442297[_0x3ceb12(0x1f0)][_0x3ceb12(0x1f8)](_0x33fe8a,_0x3cf444,_0x49f8c0[_0x3ceb12(0x1ec)]['id'],_0x49f8c0[_0x3ceb12(0x21a)]),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]}),console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x219)]('\x20\x20✔\x20Updated\x20activation\x20\x27'+_0x49f8c0[_0x3ceb12(0x26a)]+'\x27')),_0x3c072a++;else _0x49f8c0[_0x3ceb12(0x2cb)]===_0x3ceb12(0x2cf)&&_0x49f8c0[_0x3ceb12(0x1ec)]&&(await withSpinner(_0x3ceb12(0x2b5)+_0x49f8c0[_0x3ceb12(0x26a)]+_0x3ceb12(0x2ce),()=>_0x442297[_0x3ceb12(0x1f0)][_0x3ceb12(0x281)](_0x33fe8a,_0x3cf444,_0x49f8c0['existingActivation']['id']),{'verbose':_0x1f4aea['verbose']}),console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x2be)](_0x3ceb12(0x241)+_0x49f8c0[_0x3ceb12(0x26a)]+'\x27')),_0x465bc7++);}}catch(_0x59bfd3){const _0x1cfd35=isHttp400Error(_0x59bfd3),_0x35b16d=_0x1cfd35?ErrorCode[_0x3ceb12(0x28f)]:ErrorCode[_0x3ceb12(0x251)],_0x1be9c8=getErrorMessage(_0x59bfd3);throw new SDKError(_0x35b16d,'Failed\x20to\x20'+_0x49f8c0[_0x3ceb12(0x2cb)]+'\x20activation\x20\x27'+_0x49f8c0[_0x3ceb12(0x26a)]+'\x27\x20from\x20file:\x20'+_0x1b9a7d['absolutePath']+_0x3ceb12(0x1d5)+_0x1be9c8,_0x59bfd3);}}}for(const _0x4a3297 of _0x1f4aea[_0x3ceb12(0x21f)]?[]:_0x1f5acf){await withSpinner('Deleting\x20segment\x20\x27'+_0x4a3297[_0x3ceb12(0x26a)]+_0x3ceb12(0x2ce),()=>_0x442297[_0x3ceb12(0x1f0)][_0x3ceb12(0x209)](_0x4a3297['id']),{'verbose':_0x1f4aea[_0x3ceb12(0x224)]}),console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x2be)](_0x3ceb12(0x2a9)+_0x4a3297[_0x3ceb12(0x26a)]+'\x27')),_0x2b3878++;}let _0x38bc75=0x0,_0x15c66a=0x0,_0x479dc8=0x0;const _0x5370f=new Map(_0x1c9145);for(const _0x1b613e of _0x16b4b3){_0x1b613e[_0x3ceb12(0x290)]&&_0x349a94[_0x3ceb12(0x1cc)](_0x1b613e[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)])&&_0x5370f[_0x3ceb12(0x25f)](_0x1b613e[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)],_0x349a94[_0x3ceb12(0x22d)](_0x1b613e[_0x3ceb12(0x25d)][_0x3ceb12(0x26a)]));}if(_0x373f03[_0x3ceb12(0x254)]>0x0){const _0x337cc7=await withQuerySpinner('Pushing\x20journeys...',async _0x296fd6=>{const _0x1c4a7e=_0x3ceb12,_0x5b9b84=[];let _0x50f61f=0x0;const _0x1b0147=0x5;for(let _0x24dd21=0x0;_0x24dd21<_0x373f03[_0x1c4a7e(0x254)];_0x24dd21+=_0x1b0147){const _0x24e69a=_0x373f03[_0x1c4a7e(0x2b2)](_0x24dd21,_0x24dd21+_0x1b0147),_0x1a9520=await Promise[_0x1c4a7e(0x237)](_0x24e69a[_0x1c4a7e(0x1fa)](async _0x5147e7=>{const _0x3060ac=_0x1c4a7e;if(!_0x5147e7['isNew']&&!_0x5147e7[_0x3060ac(0x283)])return{'action':_0x3060ac(0x282),'name':_0x5147e7[_0x3060ac(0x25d)][_0x3060ac(0x26a)],'journeyId':_0x5147e7['existingJourney']?.['id']};const _0x1ef234=_0x5147e7[_0x3060ac(0x213)]?_0x1794e3['get'](_0x5147e7['folderPath']):undefined,_0x36af7c=_0x5147e7[_0x3060ac(0x290)]?_0x3060ac(0x263):_0x3060ac(0x1d6);_0x296fd6['setPhase'](_0x36af7c+'\x20journey\x20\x27'+_0x5147e7[_0x3060ac(0x25d)][_0x3060ac(0x26a)]+'\x27');const _0x401a3b=new Map(),_0x480bed=new Map(),_0x529896=new Map(),_0x365c0b={'resolveSegmentId':async _0x232d3a=>{const _0x5b4b49=_0x3060ac,_0x264c0b=_0x5370f[_0x5b4b49(0x22d)](_0x232d3a);if(!_0x264c0b)throw new SDKError(ErrorCode[_0x5b4b49(0x1d8)],_0x5b4b49(0x264)+_0x232d3a+_0x5b4b49(0x201)+_0x5147e7[_0x5b4b49(0x25d)][_0x5b4b49(0x26a)]+')');return _0x264c0b;},'resolveEmbeddedSegmentId':async(_0x23809e,_0x4ce4e6)=>{const _0x42bb28=_0x3060ac,_0x41ca2b=_0x5370f[_0x42bb28(0x22d)](_0x23809e);if(_0x41ca2b)return _0x41ca2b;const _0xefe46=_0x133c39['find'](_0x2c48ab=>_0x2c48ab[_0x42bb28(0x26a)]===_0x23809e);if(_0xefe46)return _0x5370f['set'](_0x23809e,_0xefe46['id']),_0xefe46['id'];if(_0x5147e7[_0x42bb28(0x290)]){const _0xa2bc9a=_0x5147e7[_0x42bb28(0x25d)][_0x42bb28(0x2aa)]||_0x5147e7[_0x42bb28(0x25d)][_0x42bb28(0x2a8)]?.[0x0]?.[_0x42bb28(0x2aa)]||[];let _0x5bcef8='entry',_0x273286=_0x23809e;const _0x313bea=_0x5147e7[_0x42bb28(0x25d)][_0x42bb28(0x208)]||_0x5147e7[_0x42bb28(0x25d)][_0x42bb28(0x2a8)]?.[0x0]?.[_0x42bb28(0x208)];if(_0x313bea?.[_0x42bb28(0x1f0)]===_0x23809e)_0x5bcef8=_0x42bb28(0x208),_0x273286=_0x313bea[_0x42bb28(0x26a)]||_0x23809e;else{_0x2df69c:for(const _0x4bef6b of _0xa2bc9a){if(_0x4bef6b['entry_criteria']?.['segment']===_0x23809e){_0x5bcef8=_0x4bef6b[_0x42bb28(0x26a)],_0x273286=_0x4bef6b['entry_criteria'][_0x42bb28(0x26a)]||_0x23809e;break;}if(_0x4bef6b['steps'])for(const _0xbc9f41 of _0x4bef6b[_0x42bb28(0x2a6)]){if(_0xbc9f41[_0x42bb28(0x2cb)]===_0x42bb28(0x229)&&_0xbc9f41[_0x42bb28(0x243)]?.['branches'])for(const _0x341636 of _0xbc9f41[_0x42bb28(0x243)]['branches']){if(_0x341636[_0x42bb28(0x1f0)]===_0x23809e){_0x5bcef8=_0x4bef6b[_0x42bb28(0x26a)],_0x273286=_0x341636[_0x42bb28(0x26a)]||_0x23809e;break _0x2df69c;}}}}}return validateSegmentRule(_0x23809e,_0x4ce4e6[_0x42bb28(0x2d3)]),_0x480bed[_0x42bb28(0x25f)](_0x23809e,{'definition':_0x4ce4e6,'stageName':_0x5bcef8,'criteriaName':_0x273286}),createPendingSegmentId(_0x23809e);}const _0x447aff=_0x5147e7[_0x42bb28(0x27a)]?.['id'];if(!_0x447aff)throw new SDKError(ErrorCode[_0x42bb28(0x28d)],_0x42bb28(0x2cd));validateSegmentRule(_0x23809e,_0x4ce4e6[_0x42bb28(0x2d3)]);const _0x3ad8e4=_0x42bb28(0x1d2)+crypto[_0x42bb28(0x2af)]();try{const _0x4189ec=await _0x442297[_0x42bb28(0x1f0)][_0x42bb28(0x29e)]({'name':_0x3ad8e4,'description':_0x4ce4e6['description']||_0x42bb28(0x1d9)+_0x23809e,'journeyId':_0x447aff,'rule':yamlRuleToApi(_0x4ce4e6[_0x42bb28(0x2d3)],!![]),'countPopulation':!![],'parentFolderId':_0x1b9fd9||'','audienceId':_0x33fe8a});return _0x1f4aea[_0x42bb28(0x224)]&&console[_0x42bb28(0x220)](_0x42bb28(0x1dc)+_0x23809e+'\x27\x20(internal:\x20'+_0x3ad8e4+')\x20with\x20ID:\x20'+_0x4189ec),_0x5370f[_0x42bb28(0x25f)](_0x23809e,_0x4189ec),_0x4189ec;}catch(_0xec1745){throw new SDKError(ErrorCode[_0x42bb28(0x26f)],'Failed\x20to\x20create\x20embedded\x20segment\x20\x27'+_0x23809e+_0x42bb28(0x1e5)+getErrorMessage(_0xec1745),_0xec1745);}},'resolveActivationId':async _0x5e425b=>{const _0x1d8abf=_0x3060ac,_0x1ff8f2=_0x401a3b[_0x1d8abf(0x22d)](_0x5e425b);if(_0x1ff8f2)return _0x1ff8f2;if(_0x5147e7['existingJourney']){const _0x2cee41=await _0x442297[_0x1d8abf(0x288)]['listActivations'](_0x5147e7[_0x1d8abf(0x27a)]['id']),_0x24db2b=_0x2cee41[_0x1d8abf(0x29a)](_0x51c96f=>_0x51c96f[_0x1d8abf(0x2ad)]['activationParams']?.[_0x1d8abf(0x26a)]===_0x5e425b);if(_0x24db2b)return _0x401a3b[_0x1d8abf(0x25f)](_0x5e425b,_0x24db2b['id']),_0x24db2b['id'];}throw new SDKError(ErrorCode['NOT_FOUND'],_0x1d8abf(0x236)+_0x5e425b+_0x1d8abf(0x201)+_0x5147e7[_0x1d8abf(0x25d)][_0x1d8abf(0x26a)]+_0x1d8abf(0x297)+_0x1d8abf(0x222));},'resolveEmbeddedActivationId':async(_0x5200ee,_0x4dd067)=>{const _0x3894c7=_0x3060ac,_0x157aa3=_0x401a3b[_0x3894c7(0x22d)](_0x5200ee);if(_0x157aa3)return _0x157aa3;if(_0x5147e7['isNew'])return _0x529896['set'](_0x5200ee,_0x4dd067),createPendingActivationId(_0x5200ee);if(_0x5147e7['existingJourney']){const _0x2e4297=await _0x442297['journey']['listActivations'](_0x5147e7[_0x3894c7(0x27a)]['id']),_0x516193=_0x2e4297['find'](_0x2de9a6=>_0x2de9a6[_0x3894c7(0x2ad)]['activationParams']?.[_0x3894c7(0x26a)]===_0x4dd067[_0x3894c7(0x26a)]);if(_0x516193)return _0x401a3b[_0x3894c7(0x25f)](_0x5200ee,_0x516193['id']),_0x516193['id'];try{const _0xeb6620=await yamlActivationToCreateRequest(_0x4dd067,_0x1aae1d),_0x65a476=await _0x442297[_0x3894c7(0x288)][_0x3894c7(0x249)](_0x5147e7['existingJourney']['id'],_0xeb6620);return _0x1f4aea['verbose']&&console[_0x3894c7(0x220)](_0x3894c7(0x25e)+_0x5200ee+_0x3894c7(0x1ed)+_0x65a476['id']),_0x401a3b[_0x3894c7(0x25f)](_0x5200ee,_0x65a476['id']),_0x65a476['id'];}catch(_0x2dbcc0){throw new SDKError(ErrorCode['JOURNEY_UPDATE_ERROR'],_0x3894c7(0x280)+_0x5200ee+_0x3894c7(0x1e5)+getErrorMessage(_0x2dbcc0),_0x2dbcc0);}}throw new SDKError(ErrorCode[_0x3894c7(0x28d)],_0x3894c7(0x1cf));},'resolveJourneyId':async _0x5301b7=>{const _0x247fca=_0x3060ac;try{return await _0x442297[_0x247fca(0x288)][_0x247fca(0x1c8)](_0x33fe8a,_0x5301b7);}catch(_0x105941){throw new SDKError(ErrorCode[_0x247fca(0x248)],'Journey\x20\x27'+_0x5301b7+_0x247fca(0x262)+_0x5147e7[_0x247fca(0x25d)][_0x247fca(0x26a)]+'\x27)',_0x105941);}},'resolveStageId':async(_0x3884b8,_0x2608d4)=>{const _0x4ee64f=_0x3060ac,_0x41f464=await _0x442297[_0x4ee64f(0x288)][_0x4ee64f(0x2ac)](_0x3884b8),_0x4a139d=_0x41f464[_0x4ee64f(0x2ad)][_0x4ee64f(0x287)][_0x4ee64f(0x29a)](_0x46ab8d=>_0x46ab8d[_0x4ee64f(0x26a)][_0x4ee64f(0x207)]()===_0x2608d4[_0x4ee64f(0x207)]());if(!_0x4a139d?.['id'])throw new SDKError(ErrorCode[_0x4ee64f(0x248)],'Stage\x20\x27'+_0x2608d4+_0x4ee64f(0x1d4)+(_0x41f464['attributes'][_0x4ee64f(0x286)]||_0x41f464[_0x4ee64f(0x2ad)][_0x4ee64f(0x26a)])+'\x27');return _0x4a139d['id'];}};try{const _0x4a864a=await a36_0x3fb9ed(_0x5147e7['yamlConfig'],_0x33fe8a,_0x365c0b),_0x5b77af=_0x1ef234||_0x1b9fd9;_0x5b77af&&(_0x4a864a[_0x3060ac(0x1f5)]={'parentFolder':{'data':{'id':_0x5b77af,'type':'folder'}}});if(_0x5147e7[_0x3060ac(0x290)]){if(_0x480bed[_0x3060ac(0x24a)]>0x0||_0x529896[_0x3060ac(0x24a)]>0x0){const _0x87041=JSON[_0x3060ac(0x2ba)](JSON[_0x3060ac(0x259)](_0x4a864a));ensureJourneyDefaults(_0x87041[_0x3060ac(0x2ad)]);for(const _0x235890 of _0x87041[_0x3060ac(0x2ad)][_0x3060ac(0x287)]){_0x235890[_0x3060ac(0x1d7)]?.[_0x3060ac(0x279)]&&isPendingSegmentId(_0x235890[_0x3060ac(0x1d7)][_0x3060ac(0x279)])&&delete _0x235890[_0x3060ac(0x1d7)];if(_0x235890['steps'])for(const _0x1b3553 of Object[_0x3060ac(0x214)](_0x235890[_0x3060ac(0x2a6)])){const _0xa79ca1=_0x235890[_0x3060ac(0x2a6)][_0x1b3553];_0xa79ca1[_0x3060ac(0x2cb)]===_0x3060ac(0x27b)&&_0xa79ca1['journeyActivationStepId']&&isPendingActivationId(_0xa79ca1[_0x3060ac(0x23c)])&&(_0xa79ca1[_0x3060ac(0x23c)]='');if(_0xa79ca1[_0x3060ac(0x2cb)]===_0x3060ac(0x2b7)&&_0xa79ca1[_0x3060ac(0x2c3)])for(const _0x34aa17 of _0xa79ca1[_0x3060ac(0x2c3)]){_0x34aa17[_0x3060ac(0x279)]&&isPendingSegmentId(_0x34aa17[_0x3060ac(0x279)])&&(_0x34aa17[_0x3060ac(0x279)]='');}}}_0x1f4aea['verbose']&&console['error']('\x20\x20Step\x201:\x20Creating\x20journey\x20without\x20entry\x20criteria:\x20'+JSON[_0x3060ac(0x259)](_0x87041,null,0x2));const _0x528799=await _0x442297[_0x3060ac(0x288)][_0x3060ac(0x26c)](_0x87041),_0x4e09cc=_0x528799['id'],_0x3d3220=new Map();for(const _0x560046 of _0x528799[_0x3060ac(0x2ad)][_0x3060ac(0x287)]){_0x3d3220[_0x3060ac(0x25f)](_0x560046['name'][_0x3060ac(0x207)](),_0x560046['id']);}const _0x908a2f=new Map();for(const [_0x33caae,{definition:_0x5d6b4d,criteriaName:_0x5b4add}]of _0x480bed){const _0x20fed6=generateJourneyLocalName(_0x5b4add)||_0x3060ac(0x1d2)+crypto[_0x3060ac(0x2af)]();_0x1f4aea[_0x3060ac(0x224)]&&console[_0x3060ac(0x220)](_0x3060ac(0x256)+_0x33caae+_0x3060ac(0x2d2)+_0x20fed6+')\x20with\x20journeyId:\x20'+_0x4e09cc);const _0x226674=await _0x442297['segment'][_0x3060ac(0x29e)]({'name':_0x20fed6,'description':_0x5d6b4d['description']||_0x3060ac(0x1d9)+_0x33caae,'journeyId':_0x4e09cc,'rule':yamlRuleToApi(_0x5d6b4d[_0x3060ac(0x2d3)],!![]),'countPopulation':!![],'parentFolderId':_0x5b77af||'','audienceId':_0x33fe8a});_0x908a2f[_0x3060ac(0x25f)](_0x33caae,_0x226674),_0x5370f['set'](_0x33caae,_0x226674),_0x1f4aea[_0x3060ac(0x224)]&&console[_0x3060ac(0x220)](_0x3060ac(0x1dc)+_0x33caae+'\x27\x20with\x20ID:\x20'+_0x226674);}const _0x54f8cb=new Map();for(const [_0x2da551,_0x2479bc]of _0x529896){_0x1f4aea[_0x3060ac(0x224)]&&console['error']('\x20\x20Step\x202b:\x20Creating\x20embedded\x20activation\x20\x27'+_0x2da551+_0x3060ac(0x278)+_0x4e09cc);try{const _0x3ba094=await yamlActivationToCreateRequest(_0x2479bc,_0x1aae1d),_0x1fbc0e=await _0x442297[_0x3060ac(0x288)][_0x3060ac(0x249)](_0x4e09cc,_0x3ba094);_0x54f8cb[_0x3060ac(0x25f)](_0x2da551,_0x1fbc0e['id']),_0x401a3b['set'](_0x2da551,_0x1fbc0e['id']),_0x1f4aea[_0x3060ac(0x224)]&&console[_0x3060ac(0x220)](_0x3060ac(0x25e)+_0x2da551+_0x3060ac(0x1ed)+_0x1fbc0e['id']);}catch(_0x59dc36){throw new SDKError(ErrorCode[_0x3060ac(0x20c)],_0x3060ac(0x280)+_0x2da551+_0x3060ac(0x1e5)+getErrorMessage(_0x59dc36),_0x59dc36);}}const _0x3a7d71=JSON[_0x3060ac(0x2ba)](JSON[_0x3060ac(0x259)](_0x4a864a));_0x3a7d71['id']=_0x4e09cc,ensureJourneyDefaults(_0x3a7d71[_0x3060ac(0x2ad)]);const _0x339b27=(_0x514acf,_0x191e93)=>{const _0x177850=_0x3060ac;if(!isPendingSegmentId(_0x514acf))return _0x514acf;const _0x554421=extractPendingSegmentName(_0x514acf),_0x187f94=_0x908a2f[_0x177850(0x22d)](_0x554421);return!_0x187f94&&console[_0x177850(0x220)](a36_0x2bb026[_0x177850(0x219)](_0x177850(0x1ca)+_0x554421+_0x177850(0x27d)+_0x191e93)),_0x187f94;};if(_0x3a7d71['attributes'][_0x3060ac(0x208)]?.[_0x3060ac(0x279)]&&isPendingSegmentId(_0x3a7d71[_0x3060ac(0x2ad)][_0x3060ac(0x208)]['segmentId'])){const _0x22c0fd=_0x339b27(_0x3a7d71['attributes'][_0x3060ac(0x208)][_0x3060ac(0x279)],_0x3060ac(0x29b));_0x22c0fd&&(_0x3a7d71['attributes']['goal'][_0x3060ac(0x279)]=_0x22c0fd);}for(const _0x3249fd of _0x3a7d71['attributes'][_0x3060ac(0x287)]){const _0xc6539=_0x3d3220[_0x3060ac(0x22d)](_0x3249fd[_0x3060ac(0x26a)][_0x3060ac(0x207)]());_0xc6539&&(_0x3249fd['id']=_0xc6539);if(_0x3249fd[_0x3060ac(0x1d7)]?.[_0x3060ac(0x279)]&&isPendingSegmentId(_0x3249fd['entryCriteria'][_0x3060ac(0x279)])){const _0x5899bb=_0x339b27(_0x3249fd[_0x3060ac(0x1d7)][_0x3060ac(0x279)],_0x3060ac(0x24c)+_0x3249fd[_0x3060ac(0x26a)]+_0x3060ac(0x2c1));_0x5899bb&&(_0x3249fd[_0x3060ac(0x1d7)][_0x3060ac(0x279)]=_0x5899bb);}if(_0x3249fd['exitCriterias'])for(const _0x41d5c3 of _0x3249fd['exitCriterias']){if(_0x41d5c3[_0x3060ac(0x279)]&&isPendingSegmentId(_0x41d5c3[_0x3060ac(0x279)])){const _0x34d6f=_0x339b27(_0x41d5c3[_0x3060ac(0x279)],_0x3060ac(0x24c)+_0x3249fd[_0x3060ac(0x26a)]+_0x3060ac(0x29d));_0x34d6f&&(_0x41d5c3['segmentId']=_0x34d6f);}}if(_0x3249fd['milestone']?.[_0x3060ac(0x279)]&&isPendingSegmentId(_0x3249fd[_0x3060ac(0x26e)][_0x3060ac(0x279)])){const _0x32c6d3=_0x339b27(_0x3249fd[_0x3060ac(0x26e)][_0x3060ac(0x279)],_0x3060ac(0x24c)+_0x3249fd[_0x3060ac(0x26a)]+'\x27\x20milestone');_0x32c6d3&&(_0x3249fd[_0x3060ac(0x26e)][_0x3060ac(0x279)]=_0x32c6d3);}if(_0x3249fd['steps']){const _0x341c45=_0x5e45ec=>_0x4a864a[_0x3060ac(0x2ad)][_0x3060ac(0x287)][_0x3060ac(0x29a)](_0x45b721=>_0x45b721[_0x3060ac(0x26a)][_0x3060ac(0x207)]()===_0x3249fd[_0x3060ac(0x26a)]['toLowerCase']())?.[_0x3060ac(0x2a6)]?.[_0x5e45ec];for(const _0x274b3e of Object[_0x3060ac(0x214)](_0x3249fd['steps'])){const _0x54edda=_0x3249fd[_0x3060ac(0x2a6)][_0x274b3e],_0x310fdf=_0x341c45(_0x274b3e);if(_0x54edda[_0x3060ac(0x2cb)]===_0x3060ac(0x27b)&&_0x54edda[_0x3060ac(0x23c)]&&(isPendingActivationId(_0x54edda[_0x3060ac(0x23c)])||_0x54edda['journeyActivationStepId']==='')){if(_0x310fdf?.[_0x3060ac(0x23c)]&&isPendingActivationId(_0x310fdf[_0x3060ac(0x23c)])){const _0x1f9f6c=extractPendingActivationName(_0x310fdf[_0x3060ac(0x23c)]),_0x1eb4dc=_0x54f8cb[_0x3060ac(0x22d)](_0x1f9f6c);_0x1eb4dc&&(_0x54edda['journeyActivationStepId']=_0x1eb4dc);}}if(_0x54edda[_0x3060ac(0x2cb)]===_0x3060ac(0x2b7)&&_0x54edda['branches']&&_0x310fdf?.[_0x3060ac(0x2c3)])for(let _0x52029a=0x0;_0x52029a<_0x54edda[_0x3060ac(0x2c3)][_0x3060ac(0x254)];_0x52029a++){const _0x31d197=_0x54edda[_0x3060ac(0x2c3)][_0x52029a],_0x289178=_0x310fdf[_0x3060ac(0x2c3)][_0x52029a];if(_0x289178?.[_0x3060ac(0x279)]&&isPendingSegmentId(_0x289178['segmentId'])){const _0x586bf4=_0x339b27(_0x289178[_0x3060ac(0x279)],_0x3060ac(0x24c)+_0x3249fd[_0x3060ac(0x26a)]+_0x3060ac(0x1e4)+(_0x31d197[_0x3060ac(0x26a)]||_0x52029a)+'\x27');_0x586bf4&&(_0x31d197[_0x3060ac(0x279)]=_0x586bf4);}}}}}return _0x1f4aea[_0x3060ac(0x224)]&&console[_0x3060ac(0x220)]('\x20\x20Step\x203:\x20Updating\x20journey\x20with\x20entry\x20criteria\x20and\x20activation\x20IDs:\x20'+JSON[_0x3060ac(0x259)](_0x3a7d71,null,0x2)),await _0x442297[_0x3060ac(0x288)][_0x3060ac(0x1e1)](_0x4e09cc,_0x3a7d71),{'action':_0x3060ac(0x235),'name':_0x5147e7[_0x3060ac(0x25d)][_0x3060ac(0x26a)],'journeyId':_0x4e09cc};}else{ensureJourneyDefaults(_0x4a864a['attributes']);_0x1f4aea['verbose']&&console[_0x3060ac(0x220)](_0x3060ac(0x2ab)+JSON[_0x3060ac(0x259)](_0x4a864a,null,0x2));const _0x3d1b37=await _0x442297[_0x3060ac(0x288)]['create'](_0x4a864a);return{'action':_0x3060ac(0x235),'name':_0x5147e7['yamlConfig']['name'],'journeyId':_0x3d1b37['id']};}}else{if(_0x5147e7[_0x3060ac(0x283)]&&_0x5147e7[_0x3060ac(0x27a)])return ensureJourneyDefaults(_0x4a864a[_0x3060ac(0x2ad)]),await _0x442297[_0x3060ac(0x288)]['update'](_0x5147e7['existingJourney']['id'],_0x4a864a),{'action':_0x3060ac(0x22a),'name':_0x5147e7[_0x3060ac(0x25d)][_0x3060ac(0x26a)],'journeyId':_0x5147e7[_0x3060ac(0x27a)]['id']};}return{'action':_0x3060ac(0x282),'name':_0x5147e7[_0x3060ac(0x25d)][_0x3060ac(0x26a)],'journeyId':_0x5147e7['existingJourney']?.['id']};}catch(_0x1d7e91){const _0x43ff8e=isHttp400Error(_0x1d7e91),_0x1518df=_0x43ff8e?ErrorCode[_0x3060ac(0x2c9)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x4baca7=getErrorMessage(_0x1d7e91);throw new SDKError(_0x1518df,_0x3060ac(0x23b)+(_0x5147e7[_0x3060ac(0x290)]?_0x3060ac(0x26c):_0x3060ac(0x1e1))+_0x3060ac(0x1d3)+_0x5147e7['absolutePath']+_0x3060ac(0x1d5)+_0x4baca7,_0x1d7e91);}}));_0x5b9b84[_0x1c4a7e(0x24b)](..._0x1a9520),_0x50f61f+=_0x24e69a[_0x1c4a7e(0x254)],_0x296fd6[_0x1c4a7e(0x1f7)]('('+_0x50f61f+'/'+_0x373f03[_0x1c4a7e(0x254)]+')');}return _0x5b9b84;},{'verbose':_0x1f4aea[_0x3ceb12(0x224)]});for(const _0x1ce944 of _0x337cc7[_0x3ceb12(0x2c8)]){if(_0x1ce944['action']===_0x3ceb12(0x235))console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x203)](_0x3ceb12(0x232)+_0x1ce944[_0x3ceb12(0x26a)]+'\x27')),_0x38bc75++;else _0x1ce944[_0x3ceb12(0x26b)]===_0x3ceb12(0x22a)&&(console[_0x3ceb12(0x220)](a36_0x2bb026[_0x3ceb12(0x219)]('✔\x20Updated\x20journey\x20\x27'+_0x1ce944[_0x3ceb12(0x26a)]+'\x27')),_0x15c66a++);}if(_0x215404&&_0x337cc7[_0x3ceb12(0x2c8)][_0x3ceb12(0x254)]===0x1){const _0x263fcc=_0x337cc7[_0x3ceb12(0x2c8)][0x0];if(_0x263fcc[_0x3ceb12(0x261)]){const _0x1995b0=getConsoleNextUrl(_0x1f4aea['site'],_0x3ceb12(0x21b)+_0x33fe8a+_0x3ceb12(0x1e0)+_0x263fcc['journeyId']+_0x3ceb12(0x24f));console['error']('\x20\x20'+a36_0x2bb026[_0x3ceb12(0x266)](_0x1995b0));}}}for(const _0x29f456 of _0x4bcdb1){console['error'](a36_0x2bb026[_0x3ceb12(0x219)](_0x3ceb12(0x2a7)+_0x29f456[_0x3ceb12(0x286)])),_0x479dc8++;}const _0x20826e=[];if(_0x562490>0x0)_0x20826e[_0x3ceb12(0x24b)](_0x562490+_0x3ceb12(0x265));if(_0x33ea71>0x0)_0x20826e[_0x3ceb12(0x24b)](_0x33ea71+'\x20updated');if(_0x2b3878>0x0)_0x20826e[_0x3ceb12(0x24b)](_0x2b3878+_0x3ceb12(0x1ff));const _0x519f7c=[];if(_0x38bc75>0x0)_0x519f7c['push'](_0x38bc75+_0x3ceb12(0x265));if(_0x15c66a>0x0)_0x519f7c[_0x3ceb12(0x24b)](_0x15c66a+'\x20updated');if(_0x479dc8>0x0)_0x519f7c[_0x3ceb12(0x24b)](_0x479dc8+'\x20deleted');const _0x2d0060=[];if(_0x2775ab>0x0)_0x2d0060[_0x3ceb12(0x24b)](_0x2775ab+'\x20created');if(_0x3c072a>0x0)_0x2d0060['push'](_0x3c072a+_0x3ceb12(0x2b4));if(_0x465bc7>0x0)_0x2d0060[_0x3ceb12(0x24b)](_0x465bc7+'\x20deleted');return console[_0x3ceb12(0x220)](a36_0x2bb026['green'](_0x3ceb12(0x1fc))),_0x20826e[_0x3ceb12(0x254)]>0x0&&!_0x1f4aea[_0x3ceb12(0x21f)]&&console[_0x3ceb12(0x220)](_0x3ceb12(0x2c4)+_0x20826e['join'](',\x20')),_0x519f7c[_0x3ceb12(0x254)]>0x0&&console[_0x3ceb12(0x220)]('\x20\x20Journeys:\x20'+_0x519f7c[_0x3ceb12(0x27c)](',\x20')),_0x2d0060['length']>0x0&&!_0x1f4aea[_0x3ceb12(0x21f)]&&console['error'](_0x3ceb12(0x246)+_0x2d0060[_0x3ceb12(0x27c)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x46f5d2){const _0x20c5fa=a36_0x3da80c,_0x34080c=new Map(),_0xb699fe=new Map();for(const _0x509a0b of _0x46f5d2){_0xb699fe['set'](_0x509a0b['id'],_0x509a0b);}const _0x25948a=new Set();for(const _0x2a0a78 of _0x46f5d2){!_0x2a0a78[_0x20c5fa(0x1ef)]&&_0x25948a[_0x20c5fa(0x225)](_0x2a0a78['id']);}function _0x419aba(_0xe06f82){const _0x5e712b=_0x20c5fa;if(_0x25948a['has'](_0xe06f82['id']))return'';if(_0xe06f82['parentFolderId']){const _0x20940b=_0xb699fe[_0x5e712b(0x22d)](_0xe06f82['parentFolderId']);if(_0x20940b){const _0x19275f=_0x419aba(_0x20940b);return _0x19275f?_0x19275f+'/'+_0xe06f82[_0x5e712b(0x26a)]:_0xe06f82[_0x5e712b(0x26a)];}}return _0xe06f82[_0x5e712b(0x26a)];}for(const _0x930a6b of _0x46f5d2){const _0x562724=_0x419aba(_0x930a6b);_0x34080c[_0x20c5fa(0x25f)](_0x562724,_0x930a6b['id']);}return _0x34080c;}function findYamlFiles(_0x46d112){const _0x1c32b4=[];function _0x14e40b(_0x5272da){const _0x1c6c23=a36_0x2861,_0x13cce7=readdirSync(_0x5272da,{'withFileTypes':!![]});for(const _0x1a9571 of _0x13cce7){const _0x4fa221=a36_0x5ec126[_0x1c6c23(0x27c)](_0x5272da,_0x1a9571[_0x1c6c23(0x26a)]);if(_0x1a9571['isDirectory']())_0x14e40b(_0x4fa221);else(_0x1a9571[_0x1c6c23(0x26a)][_0x1c6c23(0x2b6)](_0x1c6c23(0x231))||_0x1a9571[_0x1c6c23(0x26a)]['endsWith'](_0x1c6c23(0x1f1)))&&_0x1c32b4[_0x1c6c23(0x24b)](_0x4fa221);}}return _0x14e40b(_0x46d112),_0x1c32b4;}function calculateActivationActions(_0x2a1553,_0x125062,_0x225106,_0x156cf7){const _0x4864ff=a36_0x3da80c,_0x16c872=[],_0x5d98af=new Map();for(const _0x5887cd of _0x125062){_0x5d98af['set'](_0x5887cd[_0x4864ff(0x26a)],_0x5887cd);}const _0x1cd653=new Map();for(const _0x4d0730 of _0x2a1553){_0x1cd653['set'](_0x4d0730['name'],_0x4d0730);}for(const _0x4ac601 of _0x2a1553){const _0x49af77=_0x5d98af[_0x4864ff(0x22d)](_0x4ac601[_0x4864ff(0x26a)]);if(!_0x49af77)_0x16c872[_0x4864ff(0x24b)]({'type':'create','name':_0x4ac601[_0x4864ff(0x26a)],'yamlActivation':_0x4ac601});else{const _0x275dcb=activationToYaml(_0x49af77,_0x225106,_0x156cf7),_0x2d7700=a36_0x4d9ca2[_0x4864ff(0x259)](_0x275dcb),_0x30c41a=a36_0x4d9ca2[_0x4864ff(0x259)](_0x4ac601);_0x2d7700!==_0x30c41a&&_0x16c872[_0x4864ff(0x24b)]({'type':'update','name':_0x4ac601[_0x4864ff(0x26a)],'yamlActivation':_0x4ac601,'existingActivation':_0x49af77});}}for(const _0xaa9b6e of _0x125062){!_0x1cd653[_0x4864ff(0x1cc)](_0xaa9b6e[_0x4864ff(0x26a)])&&_0x16c872[_0x4864ff(0x24b)]({'type':_0x4864ff(0x2cf),'name':_0xaa9b6e[_0x4864ff(0x26a)],'existingActivation':_0xaa9b6e});}return _0x16c872;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a37_0x447bcd=a37_0x3068;(function(_0x156b87,_0xcd376){const _0x4e6e20=a37_0x3068,_0x26b3b6=_0x156b87();while(!![]){try{const _0x2fcb6d=-parseInt(_0x4e6e20(0x18e))/0x1+parseInt(_0x4e6e20(0x189))/0x2+-parseInt(_0x4e6e20(0x183))/0x3+-parseInt(_0x4e6e20(0x195))/0x4*(-parseInt(_0x4e6e20(0x185))/0x5)+-parseInt(_0x4e6e20(0x1a8))/0x6+parseInt(_0x4e6e20(0x1a7))/0x7+parseInt(_0x4e6e20(0x18f))/0x8*(parseInt(_0x4e6e20(0x19d))/0x9);if(_0x2fcb6d===_0xcd376)break;else _0x26b3b6['push'](_0x26b3b6['shift']());}catch(_0x251efc){_0x26b3b6['push'](_0x26b3b6['shift']());}}}(a37_0x377f,0x8bb93));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a37_0x3068(_0x2c6430,_0x535908){_0x2c6430=_0x2c6430-0x183;const _0x377fa8=a37_0x377f();let _0x3068ec=_0x377fa8[_0x2c6430];return _0x3068ec;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a37_0x107555 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a37_0x447bcd(0x1af)]=a37_0x447bcd(0x19a);[a37_0x447bcd(0x1a6)]=a37_0x447bcd(0x1a3);async[a37_0x447bcd(0x1ae)](_0x465264){const _0x239d33=a37_0x447bcd;console[_0x239d33(0x1ad)](a37_0x107555[_0x239d33(0x1b0)](_0x239d33(0x18b))),console[_0x239d33(0x1ad)](a37_0x107555[_0x239d33(0x1b0)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x3f7f7f,args:_0x45bcac,tdx:_0xc72d26}=_0x465264,_0xba4c02=_0x3f7f7f;if(_0x45bcac['length']===0x0)return console[_0x239d33(0x1ad)](_0x239d33(0x19b)),console[_0x239d33(0x1ad)]('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console['error']('Examples:'),console['error'](_0x239d33(0x19c)),console['error']('\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x4dcd74=_0x45bcac[0x0],_0x2b7da9=_0x3f7f7f[_0x239d33(0x187)];let _0x1ffb9c=_0x4dcd74;_0x2b7da9&&!_0x4dcd74[_0x239d33(0x18d)]('/')&&(_0x1ffb9c=_0x2b7da9+'/'+_0x4dcd74,_0xba4c02[_0x239d33(0x199)]&&console[_0x239d33(0x1ad)](_0x239d33(0x1ac)+_0x1ffb9c));const _0x1fe17d=await withSpinner('Resolving\x20path\x20\x27'+_0x1ffb9c+_0x239d33(0x19f),()=>_0xc72d26[_0x239d33(0x197)][_0x239d33(0x18c)](_0x1ffb9c),{'verbose':_0xba4c02[_0x239d33(0x199)]}),_0x4c28b5=_0x1fe17d['data'];_0xba4c02['verbose']&&console['error'](_0x239d33(0x1ab)+_0x4c28b5[_0x239d33(0x1a9)]);if(_0x4c28b5['type']!==_0x239d33(0x197))return console['error'](_0x239d33(0x1a1)+_0x4c28b5[_0x239d33(0x1a9)]+_0x239d33(0x1a5)),console[_0x239d33(0x1ad)](_0x239d33(0x191)),0x1;if(!_0x4c28b5['segmentId'])throw new SDKError(ErrorCode['INTERNAL'],_0x239d33(0x19e));const _0x1e6536=_0x4c28b5[_0x239d33(0x194)],_0x345590=_0x4c28b5[_0x239d33(0x186)];_0xba4c02[_0x239d33(0x199)]&&(console[_0x239d33(0x1ad)](_0x239d33(0x18a)+_0x1e6536),console[_0x239d33(0x1ad)]('Segment\x20ID:\x20'+_0x345590));let _0x493418;if(_0xba4c02[_0x239d33(0x198)]){const _0x50f4e6=_0xba4c02[_0x239d33(0x198)],_0x171231=await withSpinner(_0x239d33(0x192)+_0x50f4e6+_0x239d33(0x19f),()=>_0xc72d26[_0x239d33(0x197)][_0x239d33(0x193)](_0x1e6536,_0x50f4e6),{'verbose':_0xba4c02[_0x239d33(0x199)]});_0x493418=parseInt(_0x171231[_0x239d33(0x1aa)],0xa),_0xba4c02[_0x239d33(0x199)]&&console['error'](_0x239d33(0x1a2)+_0x493418);}const _0x3df2c2=await loadJSONFromOptions(_0xba4c02[_0x239d33(0x196)],_0xba4c02[_0x239d33(0x184)]),_0x3815c9={'name':_0xba4c02[_0x239d33(0x1af)],'description':_0xba4c02[_0x239d33(0x1a6)],'rule':_0x3df2c2,'kind':_0xba4c02[_0x239d33(0x188)]!==undefined?parseInt(_0xba4c02['kind'],0xa):undefined,'segmentFolderId':_0x493418},_0xbb54e=await withSpinner(_0x239d33(0x1a0)+_0x4c28b5['segmentName']+_0x239d33(0x19f),()=>_0xc72d26[_0x239d33(0x197)][_0x239d33(0x190)](_0x1e6536,_0x345590,_0x3815c9),{'verbose':_0xba4c02[_0x239d33(0x199)]}),_0x158cd4=_0xbb54e['data'];return console['error']('✔\x20Updated\x20segment\x20\x27'+_0x158cd4[_0x239d33(0x1af)]+'\x27'),_0x1ffb9c!==_0x4dcd74&&console['error'](_0x239d33(0x1a4)+_0x1ffb9c),await handleSDKOutput([_0x158cd4],_0xba4c02),0x0;}}function a37_0x377f(){const _0x276e33=['Resolving\x20folder\x20\x27','resolveFolderId','parentId','28XohMGZ','rule','segment','folder','verbose','segment:update','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','153wqVazK','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x27...','Updating\x20segment\x20\x27','Error:\x20Cannot\x20update\x20','Resolved\x20folder\x20ID:\x20','Update\x20existing\x20child\x20segment','\x20\x20\x20Path:\x20','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','description','5503533QjqIJr','6518700MYkBpO','type','data','Resolved\x20type:\x20','Resolved\x20relative\x20path\x20to:\x20','error','execute','name','yellow','3063537fWZkTY','ruleFile','707295LtxhNy','segmentId','segmentPath','kind','1352470HWoXsd','Parent\x20ID:\x20','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','resolvePathToResource','includes','844530dYLjnj','504376zhSMiv','updateSegmentById','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'];a37_0x377f=function(){return _0x276e33;};return a37_0x377f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a38_0x515e(_0x11f644,_0x2d5723){_0x11f644=_0x11f644-0x137;const _0xfd9e64=a38_0xfd9e();let _0x515e3f=_0xfd9e64[_0x11f644];return _0x515e3f;}const a38_0x2b21f8=a38_0x515e;(function(_0x1ceb6f,_0x1ecdf5){const _0x123066=a38_0x515e,_0x388bd5=_0x1ceb6f();while(!![]){try{const _0x1804cc=-parseInt(_0x123066(0x14b))/0x1*(-parseInt(_0x123066(0x137))/0x2)+-parseInt(_0x123066(0x144))/0x3+-parseInt(_0x123066(0x147))/0x4*(parseInt(_0x123066(0x167))/0x5)+parseInt(_0x123066(0x13c))/0x6*(parseInt(_0x123066(0x161))/0x7)+-parseInt(_0x123066(0x15a))/0x8*(parseInt(_0x123066(0x13f))/0x9)+-parseInt(_0x123066(0x168))/0xa*(parseInt(_0x123066(0x166))/0xb)+parseInt(_0x123066(0x14d))/0xc;if(_0x1804cc===_0x1ecdf5)break;else _0x388bd5['push'](_0x388bd5['shift']());}catch(_0x35ed14){_0x388bd5['push'](_0x388bd5['shift']());}}}(a38_0xfd9e,0x609b5));import{existsSync,statSync}from'fs';function a38_0xfd9e(){const _0x2f6221=['308qFFsBb','red','parent_segment','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','143DIBzJx','20TBwxXs','90330ItlCBI','split','Error:\x20Path\x20is\x20required\x0a','folderId','folderPath','segments','length','name','72434YAIJqs','parentName','verbose','cyan','Parent\x20ID:\x20','94974wYupRL','slice','Resolved\x20path\x20type:\x20','5524407BicacT','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','Usage:\x20tdx\x20segment\x20use\x20<path>','✔\x20Context\x20set\x20to:\x20','\x27...','42630UHKOQC','Folder\x20ID:\x20','Resolving\x20path\x20\x27','735736AqedaF','config','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','join','4NGfnBX','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','12426660kFxwXX','execute','fullPath','Site:\x20','segment','isDirectory','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','description','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','green','error','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','8fcVRKt','session','site','log','dim','isAbsolute','segmentPath'];a38_0xfd9e=function(){return _0x2f6221;};return a38_0xfd9e();}import a38_0x14e9e5 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';import{findTdxConfig}from'../utils/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a38_0x2b21f8(0x16f)]='segment:use';[a38_0x2b21f8(0x155)]='Set\x20current\x20segment/folder\x20context\x20for\x20navigation';async[a38_0x2b21f8(0x14e)](_0x574ee6){const _0x52824d=a38_0x2b21f8,{options:_0x3b393c,args:_0x29d6de,tdx:_0x38ea1b}=_0x574ee6;if(_0x29d6de['length']===0x0)return console['error'](a38_0x14e9e5[_0x52824d(0x162)](_0x52824d(0x16a))),console[_0x52824d(0x158)](_0x52824d(0x141)),console['error']('Examples:'),console[_0x52824d(0x158)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22'),console['error'](_0x52824d(0x165)),console[_0x52824d(0x158)](_0x52824d(0x149)),console['error'](_0x52824d(0x156)),0x1;const _0x43cf1f=_0x29d6de[0x0],_0xdeb4c1=_0x3b393c[_0x52824d(0x15b)];try{if(_0x43cf1f==='/')return saveSessionContext({'segment_path':undefined},_0xdeb4c1),console[_0x52824d(0x15d)](a38_0x14e9e5['green'](_0x52824d(0x14c))),0x0;if(existsSync(_0x43cf1f)&&statSync(_0x43cf1f)[_0x52824d(0x152)]()){let _0x48e59f;try{_0x48e59f=findTdxConfig(_0x43cf1f);}catch{return console[_0x52824d(0x158)](a38_0x14e9e5[_0x52824d(0x162)](_0x52824d(0x159)+_0x43cf1f)),console[_0x52824d(0x158)](a38_0x14e9e5[_0x52824d(0x13a)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x4266ab=_0x48e59f[_0x52824d(0x148)][_0x52824d(0x163)];return saveSessionContext({'segment_path':_0x4266ab,'parent_segment':_0x4266ab},_0xdeb4c1),console['log'](a38_0x14e9e5['green']('✔\x20Context\x20set\x20to:\x20'+a38_0x14e9e5[_0x52824d(0x13a)](_0x4266ab))),0x0;}const _0x392fea=_0x3b393c[_0x52824d(0x160)];let _0x29a3f3=_0x43cf1f;const _0x85a807=parsePath(_0x43cf1f);if(!_0x85a807[_0x52824d(0x15f)]){if(!_0x392fea)return console[_0x52824d(0x158)](a38_0x14e9e5[_0x52824d(0x162)](_0x52824d(0x153))),console[_0x52824d(0x158)](a38_0x14e9e5[_0x52824d(0x13a)](_0x52824d(0x140))),0x1;if(_0x43cf1f==='..'){const _0x52eca3=_0x392fea[_0x52824d(0x169)]('/')[_0x52824d(0x13d)](0x0,-0x1)[_0x52824d(0x14a)]('/');_0x29a3f3=_0x52eca3||'/';}else _0x43cf1f==='.'?_0x29a3f3=_0x392fea:_0x29a3f3=_0x392fea+'/'+_0x43cf1f;_0x3b393c['verbose']&&console[_0x52824d(0x158)]('Resolved\x20relative\x20path\x20to:\x20'+_0x29a3f3);}if(_0x29a3f3==='/'||_0x29a3f3==='')return saveSessionContext({'segment_path':undefined},_0xdeb4c1),console[_0x52824d(0x15d)](a38_0x14e9e5['green'](_0x52824d(0x14c))),0x0;_0x29a3f3=normalizePath(_0x29a3f3);const _0x7cbcfa=parsePath(_0x29a3f3)[_0x52824d(0x16d)];if(_0x7cbcfa[_0x52824d(0x16e)]===0x0)return saveSessionContext({'segment_path':undefined},_0xdeb4c1),console[_0x52824d(0x15d)](a38_0x14e9e5[_0x52824d(0x157)](_0x52824d(0x14c))),0x0;_0x3b393c[_0x52824d(0x139)]&&(console[_0x52824d(0x158)](_0x52824d(0x150)+_0x3b393c[_0x52824d(0x15c)]),console['error']('Target\x20path:\x20'+_0x29a3f3));const _0x2d3db=await withSpinner(_0x52824d(0x146)+_0x29a3f3+_0x52824d(0x143),()=>_0x38ea1b['segment']['resolvePathToResource'](_0x29a3f3),{'verbose':_0x3b393c[_0x52824d(0x139)]}),_0x2fe6db=_0x2d3db['data'];_0x3b393c[_0x52824d(0x139)]&&(console['error'](_0x52824d(0x13e)+_0x2fe6db['type']),console[_0x52824d(0x158)](_0x52824d(0x13b)+_0x2fe6db['parentId']),_0x2fe6db[_0x52824d(0x16b)]&&console[_0x52824d(0x158)](_0x52824d(0x145)+_0x2fe6db['folderId']));if(_0x2fe6db['type']===_0x52824d(0x151))return console[_0x52824d(0x158)](a38_0x14e9e5[_0x52824d(0x162)]('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console[_0x52824d(0x158)](_0x52824d(0x164)),console[_0x52824d(0x158)](a38_0x14e9e5[_0x52824d(0x13a)]('Use:\x20tdx\x20segment\x20use\x20'+_0x2fe6db['parentName']+(_0x2fe6db[_0x52824d(0x16c)]?'/'+_0x2fe6db[_0x52824d(0x16c)][_0x52824d(0x14a)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x2fe6db['fullPath'],'parent_segment':_0x2fe6db[_0x52824d(0x138)]},_0xdeb4c1),console[_0x52824d(0x15d)](a38_0x14e9e5['green'](_0x52824d(0x142)+a38_0x14e9e5[_0x52824d(0x13a)](_0x2fe6db[_0x52824d(0x14f)]))),_0x3b393c[_0x52824d(0x139)]&&(console[_0x52824d(0x158)](a38_0x14e9e5['dim'](_0x52824d(0x154))),console[_0x52824d(0x158)](a38_0x14e9e5[_0x52824d(0x15e)]('Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters'))),0x0;}catch(_0x5705f6){throw _0x5705f6;}}}
|