@treasuredata/tdx 0.29.2 → 0.29.4
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 +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-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.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +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/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.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/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-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/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.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/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.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/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.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/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +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/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.d.ts +17 -0
- package/dist/utils/github-releases.d.ts.map +1 -0
- package/dist/utils/github-releases.js +1 -0
- package/dist/utils/github-releases.js.map +1 -0
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.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-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a127_0x40d0fa=a127_0x2cb2;(function(_0x16edcb,_0x50ca32){const _0x378030=a127_0x2cb2,_0x5855c4=_0x16edcb();while(!![]){try{const _0x1e236c=-parseInt(_0x378030(0x1c0))/0x1+parseInt(_0x378030(0x1c7))/0x2*(-parseInt(_0x378030(0x1c8))/0x3)+-parseInt(_0x378030(0x1d2))/0x4*(-parseInt(_0x378030(0x1d4))/0x5)+-parseInt(_0x378030(0x1c6))/0x6*(-parseInt(_0x378030(0x1bf))/0x7)+parseInt(_0x378030(0x1d1))/0x8+-parseInt(_0x378030(0x1cb))/0x9*(parseInt(_0x378030(0x1d5))/0xa)+-parseInt(_0x378030(0x1c5))/0xb*(-parseInt(_0x378030(0x1c9))/0xc);if(_0x1e236c===_0x50ca32)break;else _0x5855c4['push'](_0x5855c4['shift']());}catch(_0x3d2ca4){_0x5855c4['push'](_0x5855c4['shift']());}}}(a127_0x1a15,0x440b3));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a127_0x54f4bc from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a127_0x40d0fa(0x1d6));export function getPushRecoveryPath(_0x17b4f0){const _0x133f4b=a127_0x40d0fa,_0x207878=a127_0x54f4bc[_0x133f4b(0x1cf)](_0x17b4f0),_0x571bd1=a127_0x54f4bc[_0x133f4b(0x1c1)](_0x17b4f0);return a127_0x54f4bc[_0x133f4b(0x1be)](_0x207878,'.'+_0x571bd1+_0x133f4b(0x1c3));}export function readPushRecovery(_0x4e6367){const _0x553693=a127_0x40d0fa,_0x226329=getPushRecoveryPath(_0x4e6367);if(!existsSync(_0x226329))return undefined;try{const _0x561ca5=readFileSync(_0x226329,_0x553693(0x1d8)),_0x1d3a02=JSON[_0x553693(0x1bd)](_0x561ca5);if(_0x1d3a02?.[_0x553693(0x1cc)]!==0x1||typeof _0x1d3a02[_0x553693(0x1ca)]!=='string')return undefined;return _0x1d3a02;}catch(_0x377bcc){return _0x377bcc instanceof SyntaxError?logger[_0x553693(0x1bb)](_0x553693(0x1c4)+_0x377bcc):logger[_0x553693(0x1d0)](_0x553693(0x1bc)+_0x377bcc),undefined;}}export function writePushRecovery(_0x255675,_0x1c097d){const _0xeabeea=a127_0x40d0fa,_0x4711c7=getPushRecoveryPath(_0x255675),_0x300ce9=_0x4711c7+_0xeabeea(0x1c2);writeFileSync(_0x300ce9,JSON[_0xeabeea(0x1d9)](_0x1c097d,null,0x2)+'\x0a',_0xeabeea(0x1d8)),renameSync(_0x300ce9,_0x4711c7);}function a127_0x2cb2(_0x376640,_0x54a323){_0x376640=_0x376640-0x1ba;const _0x1a15e9=a127_0x1a15();let _0x2cb260=_0x1a15e9[_0x376640];return _0x2cb260;}export function deletePushRecovery(_0x3e93b5){const _0x5770b0=a127_0x40d0fa,_0x16b98d=getPushRecoveryPath(_0x3e93b5);try{unlinkSync(_0x16b98d);}catch(_0x7750aa){_0x7750aa[_0x5770b0(0x1cd)]!==_0x5770b0(0x1ce)&&logger[_0x5770b0(0x1bb)](_0x5770b0(0x1d7)+_0x7750aa);}}function a127_0x1a15(){const _0x46b79b=['toISOString','debug','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','parse','join','3787ysFhrs','435958SwfnwM','basename','.tmp','.push-recovery.json','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','934417DRHqow','1446OnEjTq','14kHWSvK','131658tqASUU','132UDvoIU','journeyName','118863LCguUz','version','code','ENOENT','dirname','warn','1910688KlXqav','101236VazrmI','segments','20KPkPbW','290KwZKIU','tdx.sdk.push-recovery','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','utf-8','stringify'];a127_0x1a15=function(){return _0x46b79b;};return a127_0x1a15();}export function saveSegmentToPushRecovery(_0x4eae9f,_0x295a11,_0x2b3e24,_0x225ed3){const _0x363230=a127_0x40d0fa,_0x568f20=readPushRecovery(_0x4eae9f),_0x5e5e9=_0x568f20?.[_0x363230(0x1ca)]===_0x295a11?{..._0x568f20,'updatedAt':new Date()[_0x363230(0x1ba)]()}:{'version':0x1,'journeyName':_0x295a11,'updatedAt':new Date()[_0x363230(0x1ba)](),'segments':{}};_0x5e5e9[_0x363230(0x1d3)][_0x2b3e24]=_0x225ed3,writePushRecovery(_0x4eae9f,_0x5e5e9);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a128_0x54e8ba=a128_0x16b6;(function(_0x4b3f81,_0x51e721){const _0x2e42ff=a128_0x16b6,_0x32e94d=_0x4b3f81();while(!![]){try{const _0x46b275=parseInt(_0x2e42ff(0x171))/0x1+-parseInt(_0x2e42ff(0x1dc))/0x2+parseInt(_0x2e42ff(0x190))/0x3*(-parseInt(_0x2e42ff(0x170))/0x4)+-parseInt(_0x2e42ff(0x18a))/0x5*(-parseInt(_0x2e42ff(0x1b6))/0x6)+-parseInt(_0x2e42ff(0x219))/0x7*(parseInt(_0x2e42ff(0x176))/0x8)+-parseInt(_0x2e42ff(0x15a))/0x9*(parseInt(_0x2e42ff(0x193))/0xa)+parseInt(_0x2e42ff(0x183))/0xb;if(_0x46b275===_0x51e721)break;else _0x32e94d['push'](_0x32e94d['shift']());}catch(_0x17bc7d){_0x32e94d['push'](_0x32e94d['shift']());}}}(a128_0xa9a2,0xb9b73));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a128_0x54e8ba(0x12b));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x383ee0){return''+PENDING_SEGMENT_PREFIX+_0x383ee0+'__';}export function isPendingSegmentId(_0xa3573f){const _0x50ab78=a128_0x54e8ba;return _0xa3573f[_0x50ab78(0x1ea)](PENDING_SEGMENT_PREFIX)&&!_0xa3573f[_0x50ab78(0x1ea)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x96c5a6){const _0x278b75=a128_0x54e8ba;return _0x96c5a6[_0x278b75(0x20b)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x57f7bd){return''+PENDING_ACTIVATION_PREFIX+_0x57f7bd+'__';}export function isPendingActivationId(_0x338f6e){const _0x3b1e7=a128_0x54e8ba;return _0x338f6e[_0x3b1e7(0x1ea)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1704b1){const _0x257f4c=a128_0x54e8ba;return _0x1704b1[_0x257f4c(0x20b)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x5a7001,_0x19bc06){const _0x175009=a128_0x54e8ba,_0x43aa94=_0x5a7001+'::'+(_0x19bc06[_0x175009(0x189)]()||'segment'),_0x2fb0eb=createHash(_0x175009(0x139))[_0x175009(0x12e)](_0x43aa94)[_0x175009(0x119)](_0x175009(0x1c0))['slice'](0x0,0xc);return _0x175009(0x1f5)+_0x2fb0eb;}export function ensureJourneyDefaults(_0x27b982){const _0x14b43e=a128_0x54e8ba;!_0x27b982[_0x14b43e(0x1ba)]&&(_0x27b982[_0x14b43e(0x1ba)]=''),!_0x27b982[_0x14b43e(0x21c)]&&(_0x27b982[_0x14b43e(0x21c)]='draft');}export function injectExistingStageIds(_0x223ce8,_0x2893e8){const _0x369753=a128_0x54e8ba,_0x45440e=new Map(_0x2893e8[_0x369753(0x143)](_0x423c5c=>[_0x423c5c[_0x369753(0x13a)],_0x423c5c['id']]));for(const _0x1c1934 of _0x223ce8){if(!_0x1c1934['id']){const _0x4512b7=_0x45440e[_0x369753(0x17e)](_0x1c1934[_0x369753(0x13a)]);_0x4512b7&&(_0x1c1934['id']=_0x4512b7);}}}export function resolveTDFolderPath(_0x5192f5,_0x18d690,_0x48ce02){const _0x588719=a128_0x54e8ba;if(!_0x18d690)return _0x5192f5;if(_0x5192f5===_0x48ce02||_0x5192f5[_0x588719(0x1ea)](_0x48ce02+'/'))return _0x5192f5;return _0x5192f5?_0x48ce02+'/'+_0x5192f5:_0x48ce02;}export function addFoldersToCreate(_0x344939,_0x51fbd8,_0x2a091a){const _0x107ae7=a128_0x54e8ba;if(!_0x344939)return;if(_0x51fbd8[_0x107ae7(0x1b8)](_0x344939))return;const _0x47cc42=_0x344939[_0x107ae7(0x1bb)]('/');let _0x27441c='';for(const _0x5db7be of _0x47cc42){_0x27441c=_0x27441c?_0x27441c+'/'+_0x5db7be:_0x5db7be,!_0x51fbd8[_0x107ae7(0x1b8)](_0x27441c)&&_0x2a091a[_0x107ae7(0x201)](_0x27441c);}}export function sortFoldersByDepth(_0x4923d9){const _0xec3bed=a128_0x54e8ba;return[..._0x4923d9][_0xec3bed(0x147)]((_0x4c18f1,_0xc34a99)=>{const _0x32dbfb=_0xec3bed,_0x45747e=(_0x4c18f1[_0x32dbfb(0x17f)](/\//g)||[])['length'],_0x411618=(_0xc34a99[_0x32dbfb(0x17f)](/\//g)||[])[_0x32dbfb(0x19a)];return _0x45747e-_0x411618;});}import*as a128_0x4d4b57 from'yaml';import{readFileSync}from'fs';import a128_0x3f431a from'path';import{isJourneyDef,parseYamlString as a128_0x56cf40,toYamlString as a128_0x49f1bc,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{batchAsync}from'../../utils/async.js';function a128_0xa9a2(){const _0x6d3b2e=['relative','Created\x20journey\x20\x27','activationParams','with','join','\x20journey\x20from\x20file:\x20','validatedRequest','Matched\x20server\x20segment\x20\x27','parentSegmentFolder','Deleting\x20activation\x20\x27','updateSegmentById','updated','createFolder','\x27\x20decision\x20point\x20branch\x20\x27','message','all','journeyBundleId','Activation','1955572TASLZG','839780WfFVQe','reduce','\x20activation\x20\x27','\x0a\x20\x20','segment_created','277528FSDwEO','connector_config','slice','listActivations','values','stage\x20\x27','\x27...','waitStepUnit','get','match','Updated\x20journey\x20\x27','journey_creating','logInfo','24372128KOJrAw','isNew','action','withProgress','debug','find','trim','5kDcyzj','existingSegments','deleted','existingJourney','filter',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','9CSyWfZ','Segment\x20not\x20found:\x20','folderPath','56410BPhheF','journeyById','Entry\x20criteria:\x20','activationStepsById','push','data','getSegment\x20failed\x20for\x20','length','journeys','unchanged','stages','fetchJourney','attributes','includes','results','Deleted\x20segment\x20\x27','segment_deleted','verbose','createdSegmentId','resolvedRule','waitStepType','toString','size','segment_updating','Stage\x20\x27','entries','Created\x20segment\x20\x27','../../utils/async.js','createSegment','activations','logWarning','segment_deleting','Segment\x20not\x20found','notification','\x27\x20to\x20local\x20\x27','8679306yPcxIC','goal\x20criteria','has','absolutePath','description','split','steps','Failed\x20to\x20fetch\x20referenced\x20segment\x20','Updated\x20segment\x20\x27','\x27\x20from\x20file:\x20','hex','\x27\x20not\x20found\x20in\x20journey\x20\x27','WaitStep','Duration','columns','rule','segmentFolderId','\x20segment\x20from\x20file:\x20','connectionIdToNameMap','):\x20','activation_created','folder','conditionSegmentId','activationsBySegmentId','folderId','journeyActivationNameToId','journey_updated','embedded_segment_creating','activation_template_id','./child-segment-yaml.js','utf-8','conditionTimeoutUnit','connection','activation_updating','createJourneySegment','idToName','Creating\x20segment\x20\x27','INTERNAL','2784750eeUCyB','activationContext','valid','activation_creating','relationships','toISOString','journeyId','createActivation','segments','\x27\x20exit\x20criteria','hasChanges','conditions','localName','Updating\x20segment\x20\x27','startsWith','Creating\x20folder\x20\x27','segmentByFolderAndName','./journey-yaml.js','waitStep','created','existingActivation','getSegmentEntity\x20also\x20failed\x20for\x20','Fetching\x20','effectiveFolderId','some','journey_entry_criteria_','segment_creating','journeyBundleName','day','activation_','onProgress','Name\x20has\x20already\x20been\x20taken','DecisionPoint','.$1.push-recovery.json','embeddedSegmentNameToId','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','diff','add','segmentId','yamlActivation','buildUserMaps','versionNumber','journeyName','ACTIVATION_UPDATE_ERROR','activation_updated','stringify','flatMap','replace','embedded_segment_created','JOURNEY_SYNTAX_ERROR','item','dirname','getJourney','nameToId','all_columns','object','logSuccess','existingSegment','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','Created\x20folder\x20\x27','\x27\x20wait\x20condition','112dZmLSu','parentId','idToEmailMap','state','null',').\x20','Updating\x20activation\x20\x27','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','getActivation','getSegmentEntity','uniqueSegmentName','SEGMENT_UPDATE_ERROR','uniqueServerName','conditionTimeoutDuration','digest','Condition','user','Created\x20activation\x20\x27','segment_updated','SEGMENT_NOT_FOUND','journeyBundlesByFolderAndName','activationActions','folderPathToId','progress','getLatestJourneyId','journeyActivationStepId','journey_created','index','\x20(referenced\x20in\x20journey\x20','behavior','skipSegments','Failed\x20to\x20resolve\x20activation\x20','tdx.sdk.push-workflow','journeyStages','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','update','set','create','delete','segment','Delete\x20the\x20push\x20recovery\x20file\x20(','schedule','yamlConfig','entry_criteria','run_after_journey_refresh','entryCriteria','sha1','name','branches','journey','rootFolderId','exitCriterias','goal','milestone','NOT_FOUND','type','map','resolveSegment','Deleted\x20activation\x20\x27','ACTIVATION_SYNTAX_ERROR','sort','Failed\x20to\x20','isArray','from','keys','Embedded\x20segment\x20\x27','Failed\x20to\x20resolve\x20segment\x20','resolveJourneyId','activation_deleting','toLowerCase','parseDocument','segmentNameToId','kind','\x27\x20entry\x20criteria','deps','parentFolder','and\x20the\x20server\x20segment,\x20then\x20retry.','JOURNEY_UPDATE_ERROR','parse','522QWWPKA','max','deleteActivation','deleteSegment'];a128_0xa9a2=function(){return _0x6d3b2e;};return a128_0xa9a2();}import{buildFolderMaps}from'./resolution-context.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../errors.js';import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x2e7965){const _0xf4f6bf=a128_0x54e8ba;if(Array[_0xf4f6bf(0x149)](_0x2e7965))return'['+_0x2e7965[_0xf4f6bf(0x143)](_0x186177=>stableStringify(_0x186177))[_0xf4f6bf(0x162)](',')+']';if(_0x2e7965&&typeof _0x2e7965===_0xf4f6bf(0x213)){const _0x2883fc=_0x2e7965,_0x4ff144=Object[_0xf4f6bf(0x14b)](_0x2883fc)['sort'](),_0x4bb5f1=_0x4ff144['map'](_0x7d4b05=>'\x22'+_0x7d4b05+'\x22:'+stableStringify(_0x2883fc[_0x7d4b05]));return'{'+_0x4bb5f1[_0xf4f6bf(0x162)](',')+'}';}const _0x2a7c08=JSON[_0xf4f6bf(0x209)](_0x2e7965);return _0x2a7c08===undefined?_0xf4f6bf(0x21d):_0x2a7c08;}function activationSignature(_0x2cd901){const _0x42b182=a128_0x54e8ba,_0x5f2c3a={'connection':_0x2cd901['connection'],..._0x2cd901[_0x42b182(0x212)]!==undefined&&{'all_columns':_0x2cd901[_0x42b182(0x212)]},..._0x2cd901[_0x42b182(0x1c4)]!==undefined&&{'columns':_0x2cd901[_0x42b182(0x1c4)]},..._0x2cd901[_0x42b182(0x128)]!==undefined&&{'behavior':_0x2cd901[_0x42b182(0x128)]},..._0x2cd901[_0x42b182(0x134)]!==undefined&&{'schedule':_0x2cd901[_0x42b182(0x134)]},..._0x2cd901[_0x42b182(0x1b4)]!==undefined&&{'notification':_0x2cd901[_0x42b182(0x1b4)]},..._0x2cd901['connector_config']!==undefined&&{'connector_config':_0x2cd901[_0x42b182(0x177)]},..._0x2cd901[_0x42b182(0x1d2)]!==undefined&&{'activation_template_id':_0x2cd901[_0x42b182(0x1d2)]}};return stableStringify(_0x5f2c3a);}async function fetchSegment(_0xe56f0a,_0x601a01,_0x149359,_0x2d52e1){const _0x444876=a128_0x54e8ba,_0x7e1e0c=_0x2d52e1?.[_0x444876(0x188)](_0x452cd7=>_0x452cd7['id']===_0x149359);if(_0x7e1e0c)return _0x7e1e0c;try{return await _0xe56f0a[_0x444876(0x132)]['getSegment'](_0x601a01,_0x149359);}catch(_0x7fdfbb){logger[_0x444876(0x187)](_0x444876(0x199)+_0x149359+_0x444876(0x18f)+_0x7fdfbb);try{return await _0xe56f0a[_0x444876(0x132)][_0x444876(0x222)](_0x149359);}catch(_0x19aa2f){return logger[_0x444876(0x187)](_0x444876(0x1f1)+_0x149359+':\x20'+_0x19aa2f),null;}}}function recoverSegmentIdsFromPushRecovery(_0x53aaa2,_0x4cb5ad,_0x1120a8){const _0x2b553b=a128_0x54e8ba,_0x25cf31=readPushRecovery(_0x53aaa2[_0x2b553b(0x1b9)]);if(_0x25cf31?.[_0x2b553b(0x206)]===_0x53aaa2[_0x2b553b(0x135)][_0x2b553b(0x13a)])for(const [_0x4c4e7c,_0x36c6ea]of Object['entries'](_0x25cf31[_0x2b553b(0x1e4)])){const _0x582214=generateDeterministicJourneySegmentName(_0x53aaa2[_0x2b553b(0x135)][_0x2b553b(0x13a)],_0x4c4e7c);_0x36c6ea[_0x2b553b(0x117)]===_0x582214&&(_0x4cb5ad['set'](_0x4c4e7c,_0x36c6ea[_0x2b553b(0x202)]),_0x1120a8[_0x2b553b(0x12f)](_0x4c4e7c,_0x36c6ea[_0x2b553b(0x202)]));}}async function createOrRecoverEmbeddedSegment(_0x12b7ea,_0x4748da,_0x1a80af,_0x37e8a5){const _0x3385a9=a128_0x54e8ba;let _0x924ce1;try{_0x924ce1=await _0x12b7ea['segment'][_0x3385a9(0x1d8)]({'name':_0x1a80af['uniqueSegmentName'],'description':_0x1a80af[_0x3385a9(0x1ba)],'journeyId':_0x1a80af[_0x3385a9(0x1e2)],'rule':_0x37e8a5(_0x1a80af[_0x3385a9(0x1a6)],!![]),'countPopulation':!![],'parentFolderId':_0x1a80af[_0x3385a9(0x1ce)],'audienceId':_0x1a80af[_0x3385a9(0x21a)]});}catch(_0x527d9c){const _0x23f650=_0x527d9c instanceof Error&&_0x527d9c[_0x3385a9(0x16c)][_0x3385a9(0x1a0)](_0x3385a9(0x1fb));if(_0x23f650){const _0x593fbc=readPushRecovery(_0x4748da[_0x3385a9(0x1b9)]),_0x1ff508=_0x593fbc?.[_0x3385a9(0x206)]===_0x4748da[_0x3385a9(0x135)][_0x3385a9(0x13a)]?_0x593fbc['segments'][_0x1a80af[_0x3385a9(0x1e8)]]:undefined;if(_0x1ff508?.[_0x3385a9(0x117)]===_0x1a80af[_0x3385a9(0x223)])await _0x12b7ea[_0x3385a9(0x132)][_0x3385a9(0x168)](_0x1a80af[_0x3385a9(0x21a)],_0x1ff508[_0x3385a9(0x202)],{'description':_0x1a80af[_0x3385a9(0x1ba)],'rule':_0x37e8a5(_0x1a80af[_0x3385a9(0x1a6)],!![]),'countPopulation':!![]}),_0x924ce1=_0x1ff508[_0x3385a9(0x202)];else throw new SDKError(ErrorCode[_0x3385a9(0x224)],_0x3385a9(0x14c)+_0x1a80af[_0x3385a9(0x1e8)]+_0x3385a9(0x1ff)+(_0x3385a9(0x133)+_0x4748da[_0x3385a9(0x1b9)][_0x3385a9(0x20b)](/([^/]+)$/,_0x3385a9(0x1fd))+')\x20')+_0x3385a9(0x157),_0x527d9c);}else throw _0x527d9c;}return saveSegmentToPushRecovery(_0x4748da[_0x3385a9(0x1b9)],_0x4748da[_0x3385a9(0x135)][_0x3385a9(0x13a)],_0x1a80af[_0x3385a9(0x1e8)],{'segmentId':_0x924ce1,'uniqueServerName':_0x1a80af[_0x3385a9(0x223)],'createdAt':new Date()[_0x3385a9(0x1e1)]()}),_0x924ce1;}export async function prepareSegmentFiles(_0x3a26d8,_0x3ab69e,_0x24d836,_0x435399,_0x506e12){const _0x483643=a128_0x54e8ba,{activationDefToCreateRequest:_0x19a60f}=await import(_0x483643(0x1d3)),_0x120d93=[],_0x29d7e4=new Set();for(const {yamlConfig:_0x4f152c,folderPath:_0x73f64,sourcePath:_0x352aee}of _0x3a26d8){const _0x31f75c=resolveTDFolderPath(_0x73f64,_0x435399,_0x506e12),_0x24e66e=_0x31f75c+':'+_0x4f152c[_0x483643(0x13a)],_0x469cf4=_0x3ab69e[_0x483643(0x1ec)][_0x483643(0x17e)](_0x24e66e),_0x5b7304=_0x469cf4?_0x3ab69e[_0x483643(0x1cd)][_0x483643(0x17e)](_0x469cf4['id'])||[]:[];addFoldersToCreate(_0x31f75c,_0x3ab69e['folderPathToId'],_0x29d7e4);const _0x4fc3e9=calculateActivationActions(_0x4f152c[_0x483643(0x1b0)]||[],_0x5b7304,_0x3ab69e[_0x483643(0x21b)],_0x3ab69e['connectionIdToNameMap']);for(const _0x46dff2 of _0x4fc3e9){(_0x46dff2['type']==='create'||_0x46dff2['type']===_0x483643(0x12e))&&_0x46dff2[_0x483643(0x203)]&&(_0x46dff2[_0x483643(0x164)]=await _0x19a60f(_0x46dff2[_0x483643(0x203)],_0x24d836));}const _0x462cc9=calculateSegmentDiff(_0x4f152c,_0x469cf4,_0x5b7304,_0x3ab69e[_0x483643(0x21b)],_0x3ab69e[_0x483643(0x1c8)]);_0x120d93[_0x483643(0x197)]({'relativePath':_0x4f152c[_0x483643(0x13a)],'absolutePath':_0x352aee,'yamlConfig':_0x4f152c,'folderPath':_0x31f75c,'existingSegment':_0x469cf4,'existingActivations':_0x5b7304,'isNew':_0x462cc9[_0x483643(0x184)],'hasChanges':_0x462cc9[_0x483643(0x1e6)],'diff':_0x462cc9[_0x483643(0x200)],'activationActions':_0x4fc3e9});}return{'segmentFiles':_0x120d93,'foldersToCreate':_0x29d7e4};}export async function prepareJourneyFiles(_0x1f1806,_0x852f1e,_0x3f7f4f,_0x24f269){const _0x44b208=a128_0x54e8ba,_0x1080d9=[],_0x3fbf4a=new Set();for(const {yamlConfig:_0x79e863,folderPath:_0x4ea889,sourcePath:_0x13eaaf}of _0x1f1806){const _0x4dff51=resolveTDFolderPath(_0x4ea889,_0x3f7f4f,_0x24f269),_0x1db124=_0x4dff51+':'+_0x79e863['name'],_0x21ba95=_0x852f1e[_0x44b208(0x11f)][_0x44b208(0x17e)](_0x1db124);let _0x3d5ce0,_0x16f995;if(_0x21ba95&&_0x21ba95['length']>0x0){const _0x2af964=buildLocalExpandedRuleMappings(_0x79e863),{createYamlContext:_0x1d5708,prefetchJourneySegments:_0x4a6ec9}=createPushYamlContextForBundle(_0x852f1e[_0x44b208(0x155)],_0x852f1e[_0x44b208(0x21a)],_0x852f1e['existingSegments'],_0x2af964,_0x852f1e['idToEmailMap'],_0x852f1e[_0x44b208(0x1c8)],_0x852f1e[_0x44b208(0x196)],_0x852f1e[_0x44b208(0x194)]);await _0x4a6ec9(_0x21ba95[_0x44b208(0x143)](_0x1db366=>_0x1db366['id']));const _0x28ece9=await _0x852f1e['deps'][_0x44b208(0x13c)][_0x44b208(0x123)](_0x21ba95[0x0][_0x44b208(0x16e)]),_0x5a9af8=hasMultipleVersions(_0x79e863),_0x2314d7=async _0x32ae3c=>{const _0x3b4c51=_0x44b208,_0x166394=_0x852f1e['journeyById']?.['get'](_0x32ae3c);if(_0x166394)return _0x166394;return _0x852f1e[_0x3b4c51(0x19e)]({'journeyId':_0x32ae3c,'journeyName':_0x79e863['name'],'isMultiVersion':_0x21ba95['length']>0x1});};if(_0x5a9af8&&_0x21ba95['length']>0x1){const _0x1eef75=[];for(const _0x5af08b of _0x21ba95){const _0x2ddf53=_0x5af08b[_0x44b208(0x205)]||0x1;_0x852f1e[_0x44b208(0x122)]?.[_0x44b208(0x12e)](_0x44b208(0x1f2)+_0x79e863['name']+'\x20v'+_0x2ddf53);const _0x5194ae=await _0x2314d7(_0x5af08b['id']),_0x4aa3f7=_0x1d5708(_0x5af08b['id']),_0x923126=await journeyResponseToDef(_0x5194ae,_0x4aa3f7);_0x1eef75['push']({'item':_0x5af08b,'yaml':_0x923126});}const _0x51dd88=buildLocalRuleToNameMappingFromJourney(_0x79e863);_0x16f995=buildMergedJourneyDef(_0x1eef75,_0x51dd88,_0x28ece9);const _0xd44f3f=Math[_0x44b208(0x15b)](..._0x1eef75['map'](_0x21ead0=>_0x21ead0[_0x44b208(0x20e)]['versionNumber']||0x0)),_0x5a2cec=_0x21ba95['find'](_0x1f15ad=>(_0x1f15ad[_0x44b208(0x205)]||0x0)===_0xd44f3f);_0x5a2cec&&(_0x852f1e[_0x44b208(0x122)]?.['update'](_0x44b208(0x1f2)+_0x79e863[_0x44b208(0x13a)]+'\x20v'+_0xd44f3f),_0x3d5ce0=await _0x2314d7(_0x5a2cec['id']));}else{const _0x5dffdb=_0x21ba95[_0x21ba95[_0x44b208(0x19a)]-0x1];_0x852f1e[_0x44b208(0x122)]?.[_0x44b208(0x12e)](_0x44b208(0x1f2)+_0x79e863['name']),_0x3d5ce0=await _0x2314d7(_0x5dffdb['id']);const _0x37dd7e=_0x1d5708(_0x5dffdb['id']),_0x247241=await journeyResponseToDef(_0x3d5ce0,_0x37dd7e),_0x24ea38=buildLocalRuleToNameMappingFromJourney(_0x79e863);_0x16f995=buildMergedJourneyDef([{'item':_0x5dffdb,'yaml':_0x247241}],_0x24ea38,_0x28ece9);}}addFoldersToCreate(_0x4dff51,_0x852f1e[_0x44b208(0x121)],_0x3fbf4a);const _0x5191c2=calculateJourneyDiff(_0x79e863,_0x16f995);_0x1080d9[_0x44b208(0x197)]({'relativePath':_0x79e863['name'],'absolutePath':_0x13eaaf,'yamlConfig':_0x79e863,'folderPath':_0x4dff51,'existingJourney':_0x3d5ce0,'isNew':_0x5191c2[_0x44b208(0x184)],'hasChanges':_0x5191c2[_0x44b208(0x1e6)],'diff':_0x5191c2['diff']});}return{'journeyFiles':_0x1080d9,'foldersToCreate':_0x3fbf4a};}export function calculateActivationActions(_0x1d408f,_0x11461b,_0x307217,_0x44027c){const _0x2b8aa5=a128_0x54e8ba,_0x344abd=[],_0x548613=new Map();for(const _0x19e03c of _0x11461b){_0x548613[_0x2b8aa5(0x12f)](_0x19e03c[_0x2b8aa5(0x13a)],_0x19e03c);}const _0x222ed4=new Map();for(const _0x5d01aa of _0x1d408f){_0x222ed4[_0x2b8aa5(0x12f)](_0x5d01aa[_0x2b8aa5(0x13a)],_0x5d01aa);}for(const _0x5ef83c of _0x1d408f){const _0x14d251=_0x548613[_0x2b8aa5(0x17e)](_0x5ef83c[_0x2b8aa5(0x13a)]);if(!_0x14d251)_0x344abd[_0x2b8aa5(0x197)]({'type':_0x2b8aa5(0x130),'name':_0x5ef83c[_0x2b8aa5(0x13a)],'yamlActivation':_0x5ef83c});else{const _0x560855=activationResponseToDef(_0x14d251,_0x307217,_0x44027c),_0x38d196=a128_0x4d4b57[_0x2b8aa5(0x209)](_0x560855),_0x575a4c=a128_0x4d4b57[_0x2b8aa5(0x209)](_0x5ef83c);_0x38d196!==_0x575a4c&&_0x344abd[_0x2b8aa5(0x197)]({'type':_0x2b8aa5(0x12e),'name':_0x5ef83c[_0x2b8aa5(0x13a)],'yamlActivation':_0x5ef83c,'existingActivation':_0x14d251});}}for(const _0x2f9a56 of _0x11461b){!_0x222ed4[_0x2b8aa5(0x1b8)](_0x2f9a56['name'])&&_0x344abd[_0x2b8aa5(0x197)]({'type':_0x2b8aa5(0x131),'name':_0x2f9a56[_0x2b8aa5(0x13a)],'existingActivation':_0x2f9a56});}return _0x344abd;}function calculateYamlDiff(_0x2a7aba,_0x3ad0fa){if(_0x3ad0fa){const _0x31f40b=generateDiff(_0x3ad0fa,_0x2a7aba),_0x3f0c54=hasChanges(_0x31f40b);return{'isNew':![],'hasChanges':_0x3f0c54,'diff':_0x3f0c54?formatDiffWithColors(_0x31f40b):undefined};}const _0x29c6db=generateDiff('',_0x2a7aba);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x29c6db)};}export function calculateSegmentDiff(_0x117c8b,_0x22a46a,_0x3a838c,_0x3d17af,_0x4d8793){const _0x1c1689=segmentToYamlString(_0x117c8b),_0x2a44e3=_0x22a46a?segmentToYamlString(segmentWithActivationsToYaml(_0x22a46a,_0x3a838c,undefined,_0x3d17af,_0x4d8793)):undefined;return calculateYamlDiff(_0x1c1689,_0x2a44e3);}export function calculateJourneyDiff(_0x5f2b0f,_0xdf8d98){const _0x176d29=normalizeJourneyDef(_0x5f2b0f,_0x5f2b0f),_0x46cfd0=a128_0x49f1bc(_0x176d29),_0x537c3d=_0xdf8d98?a128_0x49f1bc(normalizeJourneyDef(_0xdf8d98,_0x5f2b0f)):undefined;return calculateYamlDiff(_0x46cfd0,_0x537c3d);}export function findSegmentsToDelete(_0x53a479,_0x8189e1,_0x2bdf69,_0xe43435,_0x472c8c){const _0x3f628d=a128_0x54e8ba,_0x3dc637=new Set();for(const {yamlConfig:_0x11cb77,folderPath:_0x3021ee}of _0x8189e1){_0x3dc637[_0x3f628d(0x201)](_0x3021ee+':'+_0x11cb77[_0x3f628d(0x13a)]);}return _0x53a479[_0x3f628d(0x18e)](_0x534308=>{const _0x4cc14b=_0x3f628d,_0x41f1ce=_0x534308[_0x4cc14b(0x1c6)]?_0x2bdf69[_0x4cc14b(0x17e)](_0x534308[_0x4cc14b(0x1c6)][_0x4cc14b(0x1a8)]())||'':'',_0x54da04=_0x41f1ce+':'+_0x534308['name'];if(_0x3dc637[_0x4cc14b(0x1b8)](_0x54da04))return![];if(_0x472c8c)return _0x41f1ce===_0xe43435||_0x41f1ce[_0x4cc14b(0x1ea)](_0xe43435+'/');return!![];});}export function findJourneysToDelete(_0x28b972,_0x28acd3,_0x3e75c7,_0x52abb0,_0x37d5dc){const _0x5970fe=a128_0x54e8ba,_0x3329c8=new Set();for(const {yamlConfig:_0x108c28,folderPath:_0x4489ad}of _0x28acd3){_0x3329c8[_0x5970fe(0x201)](_0x4489ad+':'+_0x108c28[_0x5970fe(0x13a)]);}return _0x28b972[_0x5970fe(0x18e)](_0x14a1d1=>{const _0x1e0ccc=_0x5970fe,_0x2cd254=_0x14a1d1[_0x1e0ccc(0x1ce)]?_0x3e75c7['get'](_0x14a1d1[_0x1e0ccc(0x1ce)])||'':'',_0x2bac13=_0x2cd254+':'+_0x14a1d1[_0x1e0ccc(0x1f7)];if(_0x3329c8['has'](_0x2bac13))return![];if(_0x37d5dc)return _0x2cd254===_0x52abb0||_0x2cd254[_0x1e0ccc(0x1ea)](_0x52abb0+'/');return!![];});}export function buildSegmentLookupMap(_0xe5b8b2,_0x192cdd){const _0x51b3e9=a128_0x54e8ba,_0x4cb7e9=new Map();for(const _0x379453 of _0xe5b8b2){const _0x35a8a8=_0x379453[_0x51b3e9(0x1c6)]?_0x192cdd[_0x51b3e9(0x17e)](_0x379453[_0x51b3e9(0x1c6)]['toString']())||'':'',_0x942492=_0x35a8a8+':'+_0x379453[_0x51b3e9(0x13a)];_0x4cb7e9['set'](_0x942492,_0x379453);}return _0x4cb7e9;}export function buildSegmentNameToIdMap(_0x408d27){const _0x5d8c4b=a128_0x54e8ba,_0x46fe27=new Map();for(const _0x158706 of _0x408d27){_0x46fe27[_0x5d8c4b(0x12f)](_0x158706[_0x5d8c4b(0x13a)],_0x158706['id']);}return _0x46fe27;}export function buildJourneyBundleLookupMap(_0x302098,_0x2b9993){const _0x448234=a128_0x54e8ba,_0x2a5968=new Map();for(const _0x12c99c of _0x302098){const _0x498890=_0x12c99c[_0x448234(0x1ce)]?_0x2b9993['get'](_0x12c99c[_0x448234(0x1ce)])||'':'',_0xda82c0=_0x498890+':'+_0x12c99c[_0x448234(0x1f7)];!_0x2a5968[_0x448234(0x1b8)](_0xda82c0)&&_0x2a5968['set'](_0xda82c0,[]),_0x2a5968['get'](_0xda82c0)[_0x448234(0x197)](_0x12c99c);}for(const _0x39c081 of _0x2a5968[_0x448234(0x17a)]()){_0x39c081[_0x448234(0x147)]((_0x1ce8b1,_0x39f630)=>(_0x1ce8b1['versionNumber']||0x0)-(_0x39f630[_0x448234(0x205)]||0x0));}return _0x2a5968;}export function collectFoldersToCreate(_0x403a85,_0x1c853f){const _0xa9995f=a128_0x54e8ba,_0x31ce0d=new Set();for(const _0x4f78a3 of _0x403a85){if(!_0x4f78a3)continue;if(_0x1c853f[_0xa9995f(0x1b8)](_0x4f78a3))continue;const _0x2aceb8=_0x4f78a3[_0xa9995f(0x1bb)]('/');let _0x5e63d1='';for(const _0x53fc46 of _0x2aceb8){_0x5e63d1=_0x5e63d1?_0x5e63d1+'/'+_0x53fc46:_0x53fc46,!_0x1c853f['has'](_0x5e63d1)&&_0x31ce0d['add'](_0x5e63d1);}}return _0x31ce0d;}export function parseAndClassifyYamlFiles(_0x4d954c,_0x1cf61e,_0x3c206b){const _0x29070f=a128_0x54e8ba,_0x5d8bcc=[],_0x29bf95=[];for(const _0x4b49dd of _0x4d954c){const _0x1075a9=a128_0x3f431a[_0x29070f(0x15e)](_0x1cf61e,a128_0x3f431a[_0x29070f(0x20f)](_0x4b49dd)),_0x503e33=_0x1075a9==='.'?'':_0x1075a9,_0x437498=readFileSync(_0x4b49dd,_0x29070f(0x1d4)),_0x288dee=a128_0x4d4b57['parse'](_0x437498);if(isJourneyDef(_0x288dee)){const _0x299fb=a128_0x56cf40(_0x437498);_0x29bf95['push']({'yamlConfig':_0x299fb,'folderPath':_0x503e33,'sourcePath':_0x4b49dd});}else{if(!_0x3c206b?.[_0x29070f(0x129)]){const _0x5eb5fe=parseSegmentYamlFile(_0x437498),_0x30c436=normalizeChildSegmentYaml(_0x5eb5fe);_0x5d8bcc[_0x29070f(0x197)]({'yamlConfig':_0x30c436,'folderPath':_0x503e33,'sourcePath':_0x4b49dd});}}}return{'segments':_0x5d8bcc,'journeys':_0x29bf95};}export function validateParsedFiles(_0x5c94aa,_0x36b0e2){const _0x1e8bce=a128_0x54e8ba,_0x1ddd04=[];for(const {yamlConfig:_0x5e48ce,sourcePath:_0x5c2a41}of _0x5c94aa[_0x1e8bce(0x1e4)]){const _0x445294=readFileSync(_0x5c2a41,_0x1e8bce(0x1d4)),_0x386493=a128_0x4d4b57['parseDocument'](_0x445294),_0x20c0e6=validateSegmentDef(_0x5e48ce,{'source':_0x445294,'document':_0x386493},{'skipSchema':!![]});if(!_0x20c0e6[_0x1e8bce(0x1de)]){const _0x5f0307=a128_0x3f431a[_0x1e8bce(0x15e)](_0x36b0e2,_0x5c2a41);_0x1ddd04[_0x1e8bce(0x197)]({'filePath':_0x5f0307,'source':_0x445294,'result':_0x20c0e6,'isJourney':![]});}}for(const {yamlConfig:_0x69753a,sourcePath:_0xc87df4}of _0x5c94aa[_0x1e8bce(0x19b)]){const _0x5871f3=readFileSync(_0xc87df4,'utf-8'),_0x323ad3=a128_0x4d4b57[_0x1e8bce(0x151)](_0x5871f3),_0x558c9d=validateJourneyDef(_0x69753a,{'source':_0x5871f3,'document':_0x323ad3},{'skipSchema':!![]});if(!_0x558c9d['valid']){const _0x5c201c=a128_0x3f431a[_0x1e8bce(0x15e)](_0x36b0e2,_0xc87df4);_0x1ddd04[_0x1e8bce(0x197)]({'filePath':_0x5c201c,'source':_0x5871f3,'result':_0x558c9d,'isJourney':!![]});}}return _0x1ddd04;}export function formatValidationErrors(_0x3d1ac4){const _0x461008=a128_0x54e8ba,_0x487c54=[];for(const {filePath:_0x2917fc,source:_0x330ca4,result:_0x29f922,isJourney:_0x5f408b}of _0x3d1ac4){const _0x373d4a=_0x5f408b?_0x461008(0x13c):'segment';_0x487c54[_0x461008(0x197)]('\x0a'+_0x2917fc+'\x20('+_0x373d4a+_0x461008(0x1c9)+_0x29f922['errors'][_0x461008(0x19a)]+'\x20error(s)'),_0x487c54['push'](formatValidationResult(_0x29f922,_0x330ca4,_0x2917fc));}return _0x487c54['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x421f7b){const _0x126ec4=a128_0x54e8ba,_0x33e684=new Set(),_0x1384c6=new Map(),_0x5326b5=collectSegmentUsageCounts(_0x421f7b);if(_0x421f7b['segments'])for(const [_0x4978e8,_0x3a5f01]of Object[_0x126ec4(0x1ac)](_0x421f7b[_0x126ec4(0x1e4)])){_0x33e684['add'](_0x4978e8);if(_0x3a5f01['rule']){const _0x484c93=yamlRuleToApi(_0x3a5f01[_0x126ec4(0x1c5)]),_0x13428a=apiRuleToYaml(_0x484c93);_0x1384c6[_0x126ec4(0x12f)](_0x4978e8,_0x13428a);}}const _0xb54f11=new Map();let _0x3df719=0x0;for(const [_0x2a92a5,_0x15c8d5]of _0x1384c6){const _0x2ab2ce=serializeExpandedRule(_0x15c8d5,_0x1384c6),_0x412f21=_0xb54f11['get'](_0x2ab2ce)||[];_0x412f21[_0x126ec4(0x197)]({'name':_0x2a92a5,'index':_0x3df719}),_0xb54f11[_0x126ec4(0x12f)](_0x2ab2ce,_0x412f21),_0x3df719++;}const _0x51228d=new Map();for(const [_0x3a67ef,_0x8ce8c4]of _0xb54f11){const _0x2ec38c=_0x8ce8c4[_0x126ec4(0x178)]()[_0x126ec4(0x147)]((_0x316347,_0x104646)=>{const _0x2e80ee=_0x126ec4,_0x1d2ac8=_0x5326b5[_0x2e80ee(0x17e)](_0x316347[_0x2e80ee(0x13a)])||0x0,_0x5a2d25=_0x5326b5[_0x2e80ee(0x17e)](_0x104646['name'])||0x0;if(_0x1d2ac8!==_0x5a2d25)return _0x5a2d25-_0x1d2ac8;return _0x316347[_0x2e80ee(0x126)]-_0x104646[_0x2e80ee(0x126)];})[_0x126ec4(0x143)](_0x2c03ca=>_0x2c03ca[_0x126ec4(0x13a)]),_0xafca56=[];for(const _0x4b6ff9 of _0x2ec38c){const _0xf97575=_0x5326b5[_0x126ec4(0x17e)](_0x4b6ff9)||0x0,_0xc0bacb=Math[_0x126ec4(0x15b)](_0xf97575,0x1);for(let _0x2ad463=0x0;_0x2ad463<_0xc0bacb;_0x2ad463++){_0xafca56['push'](_0x4b6ff9);}}_0x51228d[_0x126ec4(0x12f)](_0x3a67ef,_0xafca56);}return{'existingLocalSegmentNames':_0x33e684,'localSegmentRules':_0x1384c6,'localExpandedRuleToNames':_0x51228d};}export function createSegmentIdResolver(_0x27a777,_0x40d193){return async _0x50e5e9=>{const _0x1db140=a128_0x16b6,_0xb9bfa6=_0x27a777[_0x1db140(0x17e)](_0x50e5e9);if(!_0xb9bfa6)throw new SDKError(ErrorCode[_0x1db140(0x11e)],_0x1db140(0x191)+_0x50e5e9+_0x1db140(0x216)+_0x40d193+'\x27)');return _0xb9bfa6;};}export function extractRootFolderId(_0x50f2a1){const _0x101d36=a128_0x54e8ba;return _0x50f2a1['relationships']?.[_0x101d36(0x166)]?.[_0x101d36(0x198)]?.['id']||_0x50f2a1[_0x101d36(0x1e0)]?.[_0x101d36(0x156)]?.[_0x101d36(0x198)]?.['id'];}export function buildConnectionMaps(_0x9f6813){const _0x33327d=a128_0x54e8ba,_0x317571=new Map(),_0x2780f5=new Map(),_0x24ebec=new Map();for(const _0xfa5e9f of _0x9f6813){_0x317571['set'](_0xfa5e9f[_0x33327d(0x13a)],parseInt(_0xfa5e9f['id'],0xa)),_0x2780f5[_0x33327d(0x12f)](_0xfa5e9f['id'],_0xfa5e9f[_0x33327d(0x13a)]),_0x24ebec[_0x33327d(0x12f)](_0xfa5e9f[_0x33327d(0x13a)],_0xfa5e9f[_0x33327d(0x142)]);}return{'nameToId':_0x317571,'idToName':_0x2780f5,'nameToType':_0x24ebec};}export function calculatePushStats(_0x1965e8,_0x2a67ad,_0xdf6873,_0x1a08de,_0x5420b4,_0x46bf4a,_0x11fa97){const _0x5e46f3=a128_0x54e8ba,_0x543192=_0x1965e8[_0x5e46f3(0x18e)](_0x232263=>_0x232263[_0x5e46f3(0x184)]),_0x115d41=_0x1965e8[_0x5e46f3(0x18e)](_0x2ad011=>!_0x2ad011[_0x5e46f3(0x184)]&&_0x2ad011[_0x5e46f3(0x1e6)]),_0x1c59b8=_0x1965e8[_0x5e46f3(0x18e)](_0x5b16fd=>!_0x5b16fd[_0x5e46f3(0x184)]&&!_0x5b16fd['hasChanges']),_0x10a50e=_0x46bf4a?_0x1a08de:[],_0x433b8c=_0x2a67ad[_0x5e46f3(0x18e)](_0x117fec=>_0x117fec['isNew']),_0x255681=_0x2a67ad[_0x5e46f3(0x18e)](_0x16ab31=>!_0x16ab31[_0x5e46f3(0x184)]&&_0x16ab31[_0x5e46f3(0x1e6)]),_0xa76e79=_0x2a67ad[_0x5e46f3(0x18e)](_0x15417b=>!_0x15417b['isNew']&&!_0x15417b['hasChanges']),_0x81ec05=_0x46bf4a?_0x5420b4:[],_0x494694=_0x1965e8[_0x5e46f3(0x20a)](_0x518baf=>_0x518baf[_0x5e46f3(0x120)]),_0x1dfaa8=_0x494694['filter'](_0x2aacaa=>_0x2aacaa['type']===_0x5e46f3(0x130)),_0x3c93cd=_0x494694[_0x5e46f3(0x18e)](_0x185f43=>_0x185f43['type']===_0x5e46f3(0x12e)),_0x9c49ba=_0x494694[_0x5e46f3(0x18e)](_0x19739f=>_0x19739f[_0x5e46f3(0x142)]==='delete'),_0x192da8=Array[_0x5e46f3(0x14a)](_0xdf6873)['sort'](),_0x50be4b=_0x11fa97?![]:_0x543192[_0x5e46f3(0x19a)]>0x0||_0x115d41[_0x5e46f3(0x19a)]>0x0||_0x10a50e[_0x5e46f3(0x19a)]>0x0,_0x51e72b=_0x433b8c[_0x5e46f3(0x19a)]>0x0||_0x255681[_0x5e46f3(0x19a)]>0x0||_0x81ec05[_0x5e46f3(0x19a)]>0x0,_0x41acc2=_0x11fa97?![]:_0x494694[_0x5e46f3(0x19a)]>0x0,_0x44d594=_0x192da8[_0x5e46f3(0x19a)]>0x0;return{'segments':{'new':_0x543192,'changed':_0x115d41,'unchanged':_0x1c59b8,'toDelete':_0x10a50e},'journeys':{'new':_0x433b8c,'changed':_0x255681,'unchanged':_0xa76e79,'toDelete':_0x81ec05},'activations':{'all':_0x494694,'toCreate':_0x1dfaa8,'toUpdate':_0x3c93cd,'toDelete':_0x9c49ba},'folders':{'toCreate':_0x192da8},'counts':{'segments':{'new':_0x543192['length'],'changed':_0x115d41[_0x5e46f3(0x19a)],'unchanged':_0x1c59b8[_0x5e46f3(0x19a)],'toDelete':_0x10a50e['length']},'journeys':{'new':_0x433b8c['length'],'changed':_0x255681[_0x5e46f3(0x19a)],'unchanged':_0xa76e79[_0x5e46f3(0x19a)],'toDelete':_0x81ec05[_0x5e46f3(0x19a)]},'activations':{'create':_0x1dfaa8[_0x5e46f3(0x19a)],'update':_0x3c93cd[_0x5e46f3(0x19a)],'delete':_0x9c49ba[_0x5e46f3(0x19a)]},'folders':_0x192da8[_0x5e46f3(0x19a)]},'hasChanges':_0x50be4b||_0x51e72b||_0x41acc2||_0x44d594};}export async function buildPushExecutionContext(_0x5c0591,_0x10356d,_0x7731f4,_0x40504c,_0x2d5f09,_0x3e369a){const _0x18da52=a128_0x54e8ba,_0x3fff10=extractRootFolderId(_0x7731f4),{pathToId:_0x2e0462,idToPath:_0x371ae0}=buildFolderMaps(_0x2d5f09),_0x1ad36e=buildSegmentNameToIdMap(_0x40504c),_0x515be7=new Map(),{batchAsync:_0x5eacfb}=await import(_0x18da52(0x1ae)),[_0x3aed06,_0x209ac5]=await Promise['all']([_0x5c0591[_0x18da52(0x11b)][_0x18da52(0x204)](),_0x5c0591[_0x18da52(0x1d6)]['list'](),((async()=>{!_0x3e369a&&_0x40504c['length']>0x0&&await _0x5eacfb(_0x40504c,async _0x391c3f=>{const _0x1af119=a128_0x16b6,_0x166ad9=await _0x5c0591[_0x1af119(0x132)][_0x1af119(0x179)](_0x10356d,_0x391c3f['id']);_0x515be7[_0x1af119(0x12f)](_0x391c3f['id'],_0x166ad9);});})())]),{emailToId:_0x527f2b,idToEmail:_0x36ccfb}=_0x3aed06,_0x20b56c=buildConnectionMaps(_0x209ac5);return{'rootFolderId':_0x3fff10,'folderPathToId':_0x2e0462,'folderIdToPath':_0x371ae0,'segmentNameToId':_0x1ad36e,'activationsBySegmentId':_0x515be7,'emailToIdMap':_0x527f2b,'idToEmailMap':_0x36ccfb,'connectionNameToIdMap':_0x20b56c[_0x18da52(0x211)],'connectionIdToNameMap':_0x20b56c[_0x18da52(0x1d9)],'connectionNameToTypeMap':_0x20b56c['nameToType']};}export function createPushYamlContextForBundle(_0x43c834,_0x4039d1,_0x11b774,_0x19c49d,_0x23b0cf,_0x1d0fad,_0xca7907,_0x1d5eca){const {existingLocalSegmentNames:_0x44ca71,localExpandedRuleToNames:_0x180ed7}=_0x19c49d,_0x2a34eb=new Set(),_0x47f8f7=new Map(),_0x3c74fb=new Map(),_0x4603cd=new Map(),_0x7a0824=createJumpTargetCache(),_0x4c4493=new Map(),_0x472f6d=new Map(),_0x380f4a=new Set();let _0xa90149;const _0x30db09=_0x3773ab=>{const _0x5dd9c3={'resolveSegment':async _0x3e88bf=>{const _0x49f233=a128_0x16b6,_0x3a703e=_0x4603cd['get'](_0x3e88bf);if(_0x3a703e!==undefined)return{'name':_0x3a703e,'isJourneyLocal':!![]};try{const _0x244203=await fetchSegment(_0x43c834,_0x4039d1,_0x3e88bf,_0x11b774);if(!_0x244203)throw new Error(_0x49f233(0x1b3));const _0x1ed16b=generateJourneyLocalName(_0x244203[_0x49f233(0x13a)]),_0x375f54=_0x244203[_0x49f233(0x153)]===SEGMENT_KIND_JOURNEY&&_0x1ed16b!==undefined;let _0x1c9f6e=_0x244203[_0x49f233(0x13a)],_0x111dbe;if(_0x375f54&&_0x244203[_0x49f233(0x1c5)]){const _0x510e96=apiRuleToYaml(_0x244203['rule']);_0x472f6d[_0x49f233(0x12f)](_0x3e88bf,_0x510e96);const _0x2a5091=async _0xa05344=>{const _0x1139c2=_0x49f233,_0x4759ee=collectSegmentRefsFromRule(_0xa05344);for(const _0x54057c of _0x4759ee){if(!_0x472f6d[_0x1139c2(0x1b8)](_0x54057c))try{const _0x157045=await fetchSegment(_0x43c834,_0x4039d1,_0x54057c,_0x11b774);if(_0x157045?.[_0x1139c2(0x1c5)]){const _0x408b4d=apiRuleToYaml(_0x157045['rule']);_0x472f6d[_0x1139c2(0x12f)](_0x54057c,_0x408b4d),await _0x2a5091(_0x408b4d);}}catch(_0x3c457b){logger['debug'](_0x1139c2(0x1bd)+_0x54057c+':\x20'+_0x3c457b);}}};await _0x2a5091(_0x510e96);const _0x47a5f3=serializeExpandedRule(_0x510e96,_0x472f6d),_0x4e3c0d=_0x180ed7[_0x49f233(0x17e)](_0x47a5f3);if(_0x4e3c0d&&_0x4e3c0d[_0x49f233(0x19a)]>0x0){const _0x29c64f=_0x47f8f7['get'](_0x47a5f3)||0x0,_0x40f39b=_0x4e3c0d[_0x29c64f]||_0x4e3c0d[_0x4e3c0d[_0x49f233(0x19a)]-0x1];_0x47f8f7[_0x49f233(0x12f)](_0x47a5f3,_0x29c64f+0x1),_0x1c9f6e=_0x40f39b,_0x2a34eb[_0x49f233(0x201)](_0x1c9f6e),_0x4603cd[_0x49f233(0x12f)](_0x3e88bf,_0x1c9f6e);const _0x23d3eb=await resolveRuleSegmentRefs(_0x510e96,async _0x3d5789=>{const _0x491f7f=_0x49f233,_0x22ac67=_0x4603cd[_0x491f7f(0x17e)](_0x3d5789);if(_0x22ac67)return _0x22ac67;const _0x2db93f=await _0xa90149[_0x491f7f(0x144)](_0x3d5789);return _0x2db93f[_0x491f7f(0x13a)];});_0x111dbe={'description':_0x244203[_0x49f233(0x1ba)],'rule':_0x23d3eb};}else{const _0x3159ed=_0x4c4493['get'](_0x47a5f3);if(_0x3159ed)_0x1c9f6e=_0x3159ed,_0x4603cd['set'](_0x3e88bf,_0x1c9f6e);else{if(_0x1ed16b){let _0x4e72fa=_0x1ed16b,_0x2eb551=0x2;while(_0x2a34eb[_0x49f233(0x1b8)](_0x4e72fa)||_0x44ca71[_0x49f233(0x1b8)](_0x4e72fa)){_0x4e72fa=_0x1ed16b+'_'+_0x2eb551,_0x2eb551++;}_0x2a34eb[_0x49f233(0x201)](_0x4e72fa),_0x1c9f6e=_0x4e72fa;}_0x4603cd[_0x49f233(0x12f)](_0x3e88bf,_0x1c9f6e),_0x4c4493[_0x49f233(0x12f)](_0x47a5f3,_0x1c9f6e);const _0x5f3b44=await resolveRuleSegmentRefs(_0x510e96,async _0x52c1e6=>{const _0x5c96ee=_0x49f233,_0x9e068c=_0x4603cd[_0x5c96ee(0x17e)](_0x52c1e6);if(_0x9e068c)return _0x9e068c;const _0x478e1d=await _0xa90149[_0x5c96ee(0x144)](_0x52c1e6);return _0x478e1d[_0x5c96ee(0x13a)];});_0x111dbe={'description':_0x244203[_0x49f233(0x1ba)],'rule':_0x5f3b44};}}}return{'name':_0x1c9f6e,'isJourneyLocal':_0x375f54,'definition':_0x111dbe};}catch(_0xd7950e){return logger['debug'](_0x49f233(0x14d)+_0x3e88bf+':\x20'+_0xd7950e),{'name':_0x3e88bf,'isJourneyLocal':![]};}},'resolveActivation':async _0x250674=>{const _0xe21360=a128_0x16b6,_0x48c4b0=_0x3c74fb['get'](_0x250674);if(_0x48c4b0!==undefined)return{'name':_0x48c4b0,'isJourneyLocal':!![]};try{let _0x10a046=_0xca7907?.[_0xe21360(0x17e)](_0x250674);!_0x10a046&&(_0x10a046=await _0x43c834[_0xe21360(0x13c)][_0xe21360(0x221)](_0x3773ab,_0x250674));const _0x1d199e=_0x10a046[_0xe21360(0x19f)][_0xe21360(0x160)][_0xe21360(0x13a)]||_0x250674,_0x34e161=sanitizeYamlKey(_0x1d199e)||_0xe21360(0x1f9)+_0x250674,_0x1651a7=_0x34e161;_0x3c74fb[_0xe21360(0x12f)](_0x250674,_0x1651a7);const _0xe790ec=journeyActivationStepToYaml(_0x10a046,_0x23b0cf,_0x1d0fad);return{'name':_0x1651a7,'isJourneyLocal':!![],'definition':_0xe790ec};}catch(_0x6c248c){return logger[_0xe21360(0x187)](_0xe21360(0x12a)+_0x250674+':\x20'+_0x6c248c),{'name':_0x250674,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x39c847,_0x1ffe88)=>resolveJumpTarget(_0x39c847,_0x1ffe88,_0x7a0824,async _0x1b585e=>{const _0x40e928=a128_0x16b6,_0x3b47dd=_0x1d5eca?.[_0x40e928(0x17e)](_0x1b585e);if(_0x3b47dd)return _0x3b47dd;return _0x43c834[_0x40e928(0x13c)][_0x40e928(0x210)](_0x1b585e);})};return _0xa90149=_0x5dd9c3,_0x5dd9c3;},_0x28af7b=async _0x1e992a=>{const _0x4d35f7=a128_0x16b6,{collectSegmentIdsFromJourneyApi:_0x24441e}=await import(_0x4d35f7(0x1ed)),{batchAsync:_0x3fc09c}=await import(_0x4d35f7(0x1ae)),_0x57e80e=new Set();for(const _0x470092 of _0x1e992a){let _0x1c5d94=_0x1d5eca?.[_0x4d35f7(0x17e)](_0x470092);!_0x1c5d94&&(_0x1c5d94=await _0x43c834[_0x4d35f7(0x13c)]['getJourney'](_0x470092));const _0x52ee35=_0x24441e(_0x1c5d94);for(const _0x350e84 of _0x52ee35){_0x57e80e['add'](_0x350e84);}}let _0x35f900=Array['from'](_0x57e80e);while(_0x35f900[_0x4d35f7(0x19a)]>0x0){const _0x5e61a3=_0x35f900[_0x4d35f7(0x18e)](_0x19ef0b=>!_0x380f4a[_0x4d35f7(0x1b8)](_0x19ef0b));if(_0x5e61a3['length']===0x0)break;const _0x433920=await _0x3fc09c(_0x5e61a3,async _0x2517d=>{const _0x3d2c07=_0x4d35f7;_0x380f4a[_0x3d2c07(0x201)](_0x2517d);const _0x4d7a9f=await fetchSegment(_0x43c834,_0x4039d1,_0x2517d,_0x11b774);if(!_0x4d7a9f)return null;return{'segmentId':_0x2517d,'segment':_0x4d7a9f};},0xa),_0x56d7da=new Set();for(const _0x1e6649 of _0x433920){if(!_0x1e6649?.['segment']?.[_0x4d35f7(0x1c5)])continue;const _0x67a93d=apiRuleToYaml(_0x1e6649[_0x4d35f7(0x132)][_0x4d35f7(0x1c5)]);_0x472f6d[_0x4d35f7(0x12f)](_0x1e6649[_0x4d35f7(0x202)],_0x67a93d);const _0x22516d=collectSegmentRefsFromRule(_0x67a93d);for(const _0x10329a of _0x22516d){!_0x380f4a[_0x4d35f7(0x1b8)](_0x10329a)&&_0x56d7da[_0x4d35f7(0x201)](_0x10329a);}}_0x35f900=Array[_0x4d35f7(0x14a)](_0x56d7da);}};return{'createYamlContext':_0x30db09,'prefetchJourneySegments':_0x28af7b};}export async function executePushSegments(_0x5c0ed8,_0x2d7c64,_0x459d3a,_0x501474,_0x535835){const _0x470e5c=a128_0x54e8ba,{segmentDefToCreateRequest:_0x36986b,segmentDefToUpdateRequest:_0xbd6a33}=await import('./child-segment-yaml.js'),_0xdcf527=_0x459d3a[_0x470e5c(0x121)],_0x251c1c=0x5,_0x3f43a5=async _0x108032=>{const _0x52774c=_0x470e5c,_0x4b2178=_0x108032[_0x52774c(0x192)]?_0xdcf527[_0x52774c(0x17e)](_0x108032[_0x52774c(0x192)]):undefined;let _0x3b6093;const _0x5812cc={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x2ed237=_0x108032[_0x52774c(0x135)];if(_0x108032[_0x52774c(0x135)][_0x52774c(0x1c5)]){const _0x11bf52=createSegmentIdResolver(_0x459d3a[_0x52774c(0x152)],_0x108032[_0x52774c(0x135)][_0x52774c(0x13a)]),_0x2fe1c2=await resolveRuleSegmentIds(_0x108032[_0x52774c(0x135)][_0x52774c(0x1c5)],_0x11bf52);_0x2ed237={..._0x108032['yamlConfig'],'rule':_0x2fe1c2};}try{if(_0x108032[_0x52774c(0x184)]){_0x535835[_0x52774c(0x1fa)]?.({'type':_0x52774c(0x1f6),'name':_0x108032[_0x52774c(0x135)][_0x52774c(0x13a)]});const _0x656d4c=_0x36986b(_0x2ed237,_0x4b2178),_0x19130e=await _0x535835['withProgress'](_0x52774c(0x1da)+_0x108032[_0x52774c(0x135)][_0x52774c(0x13a)]+_0x52774c(0x17c),()=>_0x5c0ed8[_0x52774c(0x132)][_0x52774c(0x1af)](_0x501474[_0x52774c(0x21a)],_0x656d4c));_0x3b6093=_0x19130e[_0x52774c(0x198)]['id'],_0x459d3a['segmentNameToId'][_0x52774c(0x12f)](_0x108032[_0x52774c(0x135)][_0x52774c(0x13a)],_0x3b6093),_0x5812cc[_0x52774c(0x1a5)]={'name':_0x108032['yamlConfig'][_0x52774c(0x13a)],'id':_0x3b6093},_0x535835[_0x52774c(0x1fa)]?.({'type':_0x52774c(0x175),'name':_0x108032[_0x52774c(0x135)]['name'],'segmentId':_0x3b6093}),_0x535835[_0x52774c(0x214)]?.(_0x52774c(0x1ad)+_0x108032[_0x52774c(0x135)]['name']+'\x27'),_0x5812cc[_0x52774c(0x1ef)]=0x1;}else{if(_0x108032[_0x52774c(0x1e6)]){_0x535835[_0x52774c(0x1fa)]?.({'type':_0x52774c(0x1aa),'name':_0x108032[_0x52774c(0x135)][_0x52774c(0x13a)]});const _0x4a77e0=_0xbd6a33(_0x2ed237);_0x4b2178!==_0x108032[_0x52774c(0x215)]?.[_0x52774c(0x1c6)]&&(_0x4a77e0['segmentFolderId']=_0x4b2178?parseInt(_0x4b2178,0xa):undefined),await _0x535835[_0x52774c(0x186)](_0x52774c(0x1e9)+_0x108032[_0x52774c(0x135)]['name']+'\x27...',()=>_0x5c0ed8['segment'][_0x52774c(0x168)](_0x501474['parentId'],_0x108032[_0x52774c(0x215)]['id'],_0x4a77e0)),_0x3b6093=_0x108032[_0x52774c(0x215)]['id'],_0x535835['onProgress']?.({'type':_0x52774c(0x11d),'name':_0x108032[_0x52774c(0x135)][_0x52774c(0x13a)]}),_0x535835[_0x52774c(0x214)]?.(_0x52774c(0x1be)+_0x108032['yamlConfig'][_0x52774c(0x13a)]+'\x27'),_0x5812cc[_0x52774c(0x169)]=0x1;}else _0x3b6093=_0x108032[_0x52774c(0x215)]['id'];}}catch(_0x106c4c){const _0x517355=isHttp400Error(_0x106c4c),_0x51a9f4=_0x517355?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x48bff0=getErrorMessage(_0x106c4c);throw new SDKError(_0x51a9f4,'Failed\x20to\x20'+(_0x108032[_0x52774c(0x184)]?_0x52774c(0x130):'update')+_0x52774c(0x1c7)+_0x108032[_0x52774c(0x1b9)]+'\x0a\x20\x20'+_0x48bff0,_0x106c4c);}try{const _0x166c67=await syncActivationsForSegment(_0x5c0ed8,_0x501474[_0x52774c(0x21a)],_0x3b6093,_0x108032[_0x52774c(0x135)]['name'],_0x108032['activationActions'],_0x535835,_0x108032[_0x52774c(0x1b9)]);_0x5812cc[_0x52774c(0x1b0)]=_0x166c67;}catch(_0x4983c6){if(_0x4983c6 instanceof SDKError)throw _0x4983c6;throw new SDKError(ErrorCode[_0x52774c(0x207)],_0x52774c(0x220)+_0x108032[_0x52774c(0x135)][_0x52774c(0x13a)]+_0x52774c(0x1bf)+_0x108032[_0x52774c(0x1b9)]+'\x0a\x20\x20'+getErrorMessage(_0x4983c6),_0x4983c6);}return _0x5812cc;},_0x382289=await batchAsync(_0x2d7c64,_0x3f43a5,_0x251c1c),_0x589aed={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x5b33f4 of _0x382289){_0x589aed[_0x470e5c(0x1ef)]+=_0x5b33f4[_0x470e5c(0x1ef)],_0x589aed[_0x470e5c(0x169)]+=_0x5b33f4[_0x470e5c(0x169)],_0x5b33f4[_0x470e5c(0x1a5)]&&_0x589aed['createdSegmentIds'][_0x470e5c(0x12f)](_0x5b33f4[_0x470e5c(0x1a5)][_0x470e5c(0x13a)],_0x5b33f4[_0x470e5c(0x1a5)]['id']),_0x589aed[_0x470e5c(0x1b0)][_0x470e5c(0x1ef)]+=_0x5b33f4[_0x470e5c(0x1b0)][_0x470e5c(0x1ef)],_0x589aed['activations'][_0x470e5c(0x169)]+=_0x5b33f4[_0x470e5c(0x1b0)][_0x470e5c(0x169)],_0x589aed['activations'][_0x470e5c(0x18c)]+=_0x5b33f4['activations']['deleted'];}return _0x589aed;}async function syncActivationsForSegment(_0x399969,_0x15ec4d,_0x30fe19,_0x8f1d91,_0x217b20,_0x3b17a2,_0x14ae52){const _0x3528b0=a128_0x54e8ba,_0x3c1716={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x2f249f of _0x217b20){try{if(_0x2f249f[_0x3528b0(0x142)]===_0x3528b0(0x130)&&_0x2f249f[_0x3528b0(0x164)])_0x3b17a2[_0x3528b0(0x1fa)]?.({'type':_0x3528b0(0x1df),'segmentName':_0x8f1d91,'activationName':_0x2f249f['name']}),await _0x3b17a2[_0x3528b0(0x186)]('Creating\x20activation\x20\x27'+_0x2f249f[_0x3528b0(0x13a)]+_0x3528b0(0x17c),()=>_0x399969[_0x3528b0(0x132)][_0x3528b0(0x1e3)](_0x15ec4d,_0x30fe19,_0x2f249f[_0x3528b0(0x164)])),_0x3b17a2[_0x3528b0(0x1fa)]?.({'type':_0x3528b0(0x1ca),'segmentName':_0x8f1d91,'activationName':_0x2f249f[_0x3528b0(0x13a)]}),_0x3b17a2['logSuccess']?.(_0x3528b0(0x11c)+_0x2f249f[_0x3528b0(0x13a)]+'\x27'),_0x3c1716['created']++;else{if(_0x2f249f[_0x3528b0(0x142)]===_0x3528b0(0x12e)&&_0x2f249f[_0x3528b0(0x164)]&&_0x2f249f[_0x3528b0(0x1f0)])_0x3b17a2[_0x3528b0(0x1fa)]?.({'type':_0x3528b0(0x1d7),'segmentName':_0x8f1d91,'activationName':_0x2f249f[_0x3528b0(0x13a)]}),await _0x3b17a2[_0x3528b0(0x186)](_0x3528b0(0x21f)+_0x2f249f[_0x3528b0(0x13a)]+'\x27...',()=>_0x399969[_0x3528b0(0x132)]['updateActivation'](_0x15ec4d,_0x30fe19,_0x2f249f[_0x3528b0(0x1f0)]['id'],_0x2f249f['validatedRequest'])),_0x3b17a2[_0x3528b0(0x1fa)]?.({'type':_0x3528b0(0x208),'segmentName':_0x8f1d91,'activationName':_0x2f249f[_0x3528b0(0x13a)]}),_0x3b17a2[_0x3528b0(0x214)]?.('Updated\x20activation\x20\x27'+_0x2f249f[_0x3528b0(0x13a)]+'\x27'),_0x3c1716[_0x3528b0(0x169)]++;else _0x2f249f[_0x3528b0(0x142)]===_0x3528b0(0x131)&&_0x2f249f['existingActivation']&&(_0x3b17a2[_0x3528b0(0x1fa)]?.({'type':_0x3528b0(0x14f),'segmentName':_0x8f1d91,'activationName':_0x2f249f[_0x3528b0(0x13a)]}),await _0x3b17a2[_0x3528b0(0x186)](_0x3528b0(0x167)+_0x2f249f[_0x3528b0(0x13a)]+_0x3528b0(0x17c),()=>_0x399969[_0x3528b0(0x132)][_0x3528b0(0x15c)](_0x15ec4d,_0x30fe19,_0x2f249f[_0x3528b0(0x1f0)]['id'])),_0x3b17a2[_0x3528b0(0x1fa)]?.({'type':'activation_deleted','segmentName':_0x8f1d91,'activationName':_0x2f249f[_0x3528b0(0x13a)]}),_0x3b17a2['logDeleted']?.(_0x3528b0(0x145)+_0x2f249f[_0x3528b0(0x13a)]+'\x27'),_0x3c1716[_0x3528b0(0x18c)]++);}}catch(_0x129029){const _0x3fa285=isHttp400Error(_0x129029),_0x4977ca=_0x3fa285?ErrorCode[_0x3528b0(0x146)]:ErrorCode[_0x3528b0(0x207)],_0x5076df=getErrorMessage(_0x129029);throw new SDKError(_0x4977ca,_0x3528b0(0x148)+_0x2f249f[_0x3528b0(0x142)]+_0x3528b0(0x173)+_0x2f249f['name']+_0x3528b0(0x1bf)+_0x14ae52+_0x3528b0(0x174)+_0x5076df,_0x129029);}}return _0x3c1716;}export async function executePushFolders(_0x3652a1,_0x524dde,_0x186a77,_0x35ee3a,_0x41724a){const _0x1fa62f=a128_0x54e8ba,_0x6c2f2d=new Map(_0x186a77),_0x3836d5=sortFoldersByDepth(_0x524dde);for(const _0x44a13d of _0x3836d5){const _0x1927d3=_0x44a13d[_0x1fa62f(0x1bb)]('/'),_0x46ab2b=_0x1927d3[_0x1927d3[_0x1fa62f(0x19a)]-0x1],_0x235b67=_0x1927d3[_0x1fa62f(0x178)](0x0,-0x1)['join']('/'),_0x336bf6=_0x6c2f2d['get'](_0x235b67);_0x41724a[_0x1fa62f(0x1fa)]?.({'type':'folder_creating','folder':_0x44a13d});const _0x24e0c8={'name':_0x46ab2b,'parentFolderId':_0x336bf6},_0x2b0899=await _0x41724a[_0x1fa62f(0x186)](_0x1fa62f(0x1eb)+_0x44a13d+_0x1fa62f(0x17c),()=>_0x3652a1[_0x1fa62f(0x132)][_0x1fa62f(0x16a)](_0x35ee3a[_0x1fa62f(0x21a)],_0x24e0c8));_0x6c2f2d[_0x1fa62f(0x12f)](_0x44a13d,_0x2b0899[_0x1fa62f(0x198)]['id']),_0x41724a[_0x1fa62f(0x1fa)]?.({'type':'folder_created','folder':_0x44a13d,'folderId':_0x2b0899[_0x1fa62f(0x198)]['id']}),_0x41724a[_0x1fa62f(0x182)]?.(_0x1fa62f(0x217)+_0x44a13d+'\x27');}return _0x6c2f2d;}export async function executePushSegmentDeletions(_0x55f5b0,_0x2c8fba,_0x2004a6){const _0x500855=a128_0x54e8ba;if(_0x2c8fba['length']===0x0)return 0x0;const {batchAsync:_0x367f9a}=await import('../../utils/async.js'),_0x379951=0x5,_0x458f7a=await _0x367f9a(_0x2c8fba,async _0xac1db7=>{const _0x4a5586=a128_0x16b6;return _0x2004a6[_0x4a5586(0x1fa)]?.({'type':_0x4a5586(0x1b2),'name':_0xac1db7['name']}),await _0x55f5b0[_0x4a5586(0x132)][_0x4a5586(0x15d)](_0xac1db7['id']),_0x2004a6[_0x4a5586(0x1fa)]?.({'type':_0x4a5586(0x1a3),'name':_0xac1db7[_0x4a5586(0x13a)]}),_0x2004a6['logDeleted']?.(_0x4a5586(0x1a2)+_0xac1db7[_0x4a5586(0x13a)]+'\x27'),0x1;},_0x379951);return _0x458f7a[_0x500855(0x172)]((_0x2c5de7,_0x138b38)=>_0x2c5de7+_0x138b38,0x0);}function a128_0x16b6(_0x19d2af,_0x11b9db){_0x19d2af=_0x19d2af-0x117;const _0xa9a272=a128_0xa9a2();let _0x16b695=_0xa9a272[_0x19d2af];return _0x16b695;}export async function executePushJourneys(_0x3a1bb3,_0x483a1a,_0x10017b,_0x22e567,_0x225d85){const _0x1e0ee3=a128_0x54e8ba,{journeyDefToRequest:_0x4c46c6}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x3d9020,yamlRuleToApi:_0x12b503,validateSegmentRule:_0x56630a}=await import('./child-segment-yaml.js'),_0x13384e={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x52d136=new Map(_0x10017b[_0x1e0ee3(0x152)]),_0xc517d3=0x5;for(let _0x59daae=0x0;_0x59daae<_0x483a1a[_0x1e0ee3(0x19a)];_0x59daae+=_0xc517d3){const _0x340480=_0x483a1a[_0x1e0ee3(0x178)](_0x59daae,_0x59daae+_0xc517d3),_0x4c5e3d=await Promise[_0x1e0ee3(0x16d)](_0x340480['map'](async _0x5c496d=>{const _0x370bb6=_0x1e0ee3;if(!_0x5c496d[_0x370bb6(0x184)]&&!_0x5c496d[_0x370bb6(0x1e6)])return{'action':_0x370bb6(0x19c),'name':_0x5c496d[_0x370bb6(0x135)][_0x370bb6(0x13a)],'journeyId':_0x5c496d['existingJourney']?.['id']};const _0x1c1984=_0x5c496d['folderPath']?_0x10017b['folderPathToId'][_0x370bb6(0x17e)](_0x5c496d[_0x370bb6(0x192)]):undefined;_0x225d85[_0x370bb6(0x1fa)]?.({'type':_0x5c496d[_0x370bb6(0x184)]?_0x370bb6(0x181):'journey_updating','name':_0x5c496d['yamlConfig'][_0x370bb6(0x13a)]});try{const _0x6c3c5c=await executeSingleJourneyPush(_0x3a1bb3,_0x5c496d,{..._0x10017b,'segmentNameToId':_0x52d136},{'parentId':_0x22e567[_0x370bb6(0x21a)],'rootFolderId':_0x22e567[_0x370bb6(0x13d)],'folderId':_0x1c1984,'verbose':_0x22e567[_0x370bb6(0x1a4)]},_0x225d85,{'journeyDefToRequest':_0x4c46c6,'activationDefToCreateRequest':_0x3d9020,'yamlRuleToApi':_0x12b503,'validateSegmentRule':_0x56630a});for(const [_0x5f1ec,_0x1d2e02]of _0x6c3c5c['embeddedSegmentNameToId']){_0x52d136[_0x370bb6(0x12f)](_0x5f1ec,_0x1d2e02),_0x13384e[_0x370bb6(0x1fe)][_0x370bb6(0x12f)](_0x5f1ec,_0x1d2e02);}if(_0x6c3c5c['action']===_0x370bb6(0x1ef))_0x225d85[_0x370bb6(0x1fa)]?.({'type':_0x370bb6(0x125),'name':_0x5c496d[_0x370bb6(0x135)][_0x370bb6(0x13a)],'journeyId':_0x6c3c5c[_0x370bb6(0x1e2)]}),_0x225d85['logSuccess']?.(_0x370bb6(0x15f)+_0x5c496d[_0x370bb6(0x135)][_0x370bb6(0x13a)]+'\x27'),_0x13384e[_0x370bb6(0x1ef)]++;else _0x6c3c5c[_0x370bb6(0x185)]===_0x370bb6(0x169)&&(_0x225d85['onProgress']?.({'type':_0x370bb6(0x1d0),'name':_0x5c496d[_0x370bb6(0x135)][_0x370bb6(0x13a)]}),_0x225d85[_0x370bb6(0x214)]?.(_0x370bb6(0x180)+_0x5c496d[_0x370bb6(0x135)][_0x370bb6(0x13a)]+'\x27'),_0x13384e[_0x370bb6(0x169)]++);return{'action':_0x6c3c5c[_0x370bb6(0x185)],'name':_0x5c496d[_0x370bb6(0x135)][_0x370bb6(0x13a)],'journeyId':_0x6c3c5c[_0x370bb6(0x1e2)]};}catch(_0x5af2be){const _0x50949e=isHttp400Error(_0x5af2be),_0x5878c1=_0x50949e?ErrorCode[_0x370bb6(0x20d)]:ErrorCode[_0x370bb6(0x158)],_0x469bd0=getErrorMessage(_0x5af2be);throw new SDKError(_0x5878c1,_0x370bb6(0x148)+(_0x5c496d[_0x370bb6(0x184)]?_0x370bb6(0x130):_0x370bb6(0x12e))+_0x370bb6(0x163)+_0x5c496d[_0x370bb6(0x1b9)]+_0x370bb6(0x174)+_0x469bd0,_0x5af2be);}}));_0x13384e[_0x1e0ee3(0x1a1)][_0x1e0ee3(0x197)](..._0x4c5e3d);}return _0x13384e;}async function matchExistingJourneySegments(_0x105726,_0x4f7e31,_0x332c4f,_0x4c1dca,_0x3a5120){const _0x55ef37=a128_0x54e8ba;if(!_0x4f7e31[_0x55ef37(0x18d)]||!_0x4f7e31[_0x55ef37(0x135)][_0x55ef37(0x1e4)])return;const _0x4b43dc=new Map(),_0x27c16d=new Set();for(const _0x16f9d2 of Object[_0x55ef37(0x14b)](_0x4f7e31[_0x55ef37(0x135)][_0x55ef37(0x1e4)])){const _0x4b31f3=generateDeterministicJourneySegmentName(_0x4f7e31[_0x55ef37(0x135)][_0x55ef37(0x13a)],_0x16f9d2);_0x4b43dc['set'](_0x4b31f3,_0x16f9d2),_0x27c16d[_0x55ef37(0x201)](_0x16f9d2);}const _0x11194f=[],_0x2d0109=collectSegmentIdsFromJourneyApi(_0x4f7e31[_0x55ef37(0x18d)]);for(const _0x17dd4f of _0x2d0109){const _0x5212c8=await fetchSegment(_0x105726,_0x332c4f,_0x17dd4f,_0x4c1dca);if(!_0x5212c8?.[_0x55ef37(0x13a)])continue;const _0x5681c5=_0x4b43dc[_0x55ef37(0x17e)](_0x5212c8[_0x55ef37(0x13a)]);_0x5681c5?(_0x3a5120[_0x55ef37(0x12f)](_0x5681c5,_0x17dd4f),_0x27c16d[_0x55ef37(0x131)](_0x5681c5)):_0x11194f['push']({'id':_0x17dd4f,'seg':_0x5212c8});}if(_0x27c16d[_0x55ef37(0x1a9)]>0x0&&_0x11194f['length']>0x0){const {localExpandedRuleToNames:_0x2173b8}=buildLocalExpandedRuleMappings(_0x4f7e31[_0x55ef37(0x135)]),_0x697d3c=new Map();for(const {id:_0xfabef0,seg:_0x2e5698}of _0x11194f){if(_0x2e5698[_0x55ef37(0x1c5)]){const _0x3d45d1=apiRuleToYaml(_0x2e5698['rule']);_0x697d3c[_0x55ef37(0x12f)](_0xfabef0,_0x3d45d1);}}for(const {id:_0x2a0567,seg:_0x4a3d52}of _0x11194f){if(!_0x4a3d52[_0x55ef37(0x1c5)])continue;const _0x436ee5=_0x697d3c['get'](_0x2a0567);if(!_0x436ee5)continue;const _0x44323d=serializeExpandedRule(_0x436ee5,_0x697d3c),_0xaab6ae=_0x2173b8['get'](_0x44323d);if(_0xaab6ae){const _0x11cafa=_0xaab6ae[_0x55ef37(0x188)](_0x5e2d19=>_0x27c16d[_0x55ef37(0x1b8)](_0x5e2d19));_0x11cafa&&(_0x3a5120['set'](_0x11cafa,_0x2a0567),_0x27c16d[_0x55ef37(0x131)](_0x11cafa),logger[_0x55ef37(0x187)](_0x55ef37(0x165)+_0x4a3d52['name']+_0x55ef37(0x1b5)+_0x11cafa+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x40aa63,_0x1ff6ae,_0x306558,_0x954e9e,_0x4236de,_0x4b106f){const _0x3233a6=a128_0x54e8ba,{journeyDefToRequest:_0x150609,activationDefToCreateRequest:_0x502b17,yamlRuleToApi:_0x49c8ad,validateSegmentRule:_0x5567b1}=_0x4b106f,_0x40544e=new Map(),_0xb856c6=new Map();recoverSegmentIdsFromPushRecovery(_0x1ff6ae,_0x40544e,_0x306558[_0x3233a6(0x152)]);const _0x380df2=new Map(),_0x570927=new Map(),_0x5ad396=new Map();let _0x851159;const _0x2ed11c=async()=>{const _0x58d927=_0x3233a6;if(_0x851159)return;_0x851159=new Map();if(!_0x1ff6ae['existingJourney'])return;const _0x293180=await _0x40aa63['journey']['listActivations'](_0x1ff6ae['existingJourney']['id']);for(const _0x1b3190 of _0x293180){const _0x5c2f0a=journeyActivationStepToYaml(_0x1b3190,_0x306558[_0x58d927(0x21b)],_0x306558[_0x58d927(0x1c8)]),_0x27bd10=activationSignature(_0x5c2f0a);!_0x851159[_0x58d927(0x1b8)](_0x27bd10)&&_0x851159[_0x58d927(0x12f)](_0x27bd10,_0x1b3190['id']),_0x5c2f0a['name']&&_0xb856c6[_0x58d927(0x12f)](_0x5c2f0a[_0x58d927(0x13a)],_0x1b3190['id']);}};await matchExistingJourneySegments(_0x40aa63,_0x1ff6ae,_0x954e9e[_0x3233a6(0x21a)],_0x306558[_0x3233a6(0x18b)],_0x306558[_0x3233a6(0x152)]);const _0x2e7d38={'resolveSegmentId':async _0x5a5a63=>{const _0xaa9af5=_0x3233a6,_0x15b679=_0x306558[_0xaa9af5(0x152)]['get'](_0x5a5a63);if(!_0x15b679)throw new SDKError(ErrorCode[_0xaa9af5(0x11e)],_0xaa9af5(0x191)+_0x5a5a63+_0xaa9af5(0x127)+_0x1ff6ae[_0xaa9af5(0x135)][_0xaa9af5(0x13a)]+')');return _0x15b679;},'resolveEmbeddedSegmentId':async(_0x16bf5a,_0x1d366d)=>{const _0x20afab=_0x3233a6,_0x33e90f=_0x306558[_0x20afab(0x152)]['get'](_0x16bf5a);if(_0x33e90f)return _0x33e90f;const _0x214917=_0x306558['existingSegments'][_0x20afab(0x188)](_0x47bc20=>_0x47bc20[_0x20afab(0x13a)]===_0x16bf5a);if(_0x214917)return _0x306558['segmentNameToId'][_0x20afab(0x12f)](_0x16bf5a,_0x214917['id']),_0x214917['id'];if(_0x1ff6ae[_0x20afab(0x184)]){const {stageName:_0xc70c2,criteriaName:_0x452fe7}=findSegmentCriteriaLocation(_0x1ff6ae['yamlConfig'],_0x16bf5a);return _0x5567b1(_0x16bf5a,_0x1d366d[_0x20afab(0x1c5)]),_0x570927[_0x20afab(0x12f)](_0x16bf5a,{'definition':_0x1d366d,'stageName':_0xc70c2,'criteriaName':_0x452fe7}),createPendingSegmentId(_0x16bf5a);}const _0x2952e2=_0x1ff6ae['existingJourney']?.['id'];if(!_0x2952e2)throw new SDKError(ErrorCode[_0x20afab(0x1db)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x14babc=_0x380df2[_0x20afab(0x17e)](_0x16bf5a);if(_0x14babc)return _0x14babc;const _0x5d7ba7=((async()=>{const _0x26efb9=_0x20afab;_0x5567b1(_0x16bf5a,_0x1d366d['rule']);const _0x42dfde=generateDeterministicJourneySegmentName(_0x1ff6ae[_0x26efb9(0x135)]['name'],_0x16bf5a),_0x1ee391=_0x306558[_0x26efb9(0x18b)]['find'](_0x6b5c9a=>_0x6b5c9a['name']===_0x42dfde),_0x1fe3d0=createSegmentIdResolver(_0x306558[_0x26efb9(0x152)],_0x16bf5a),_0x2bdf1e=await resolveRuleSegmentIds(_0x1d366d[_0x26efb9(0x1c5)],_0x1fe3d0);let _0x4d0b2a;return _0x1ee391?(await _0x40aa63[_0x26efb9(0x132)][_0x26efb9(0x168)](_0x954e9e[_0x26efb9(0x21a)],_0x1ee391['id'],{'description':_0x1d366d[_0x26efb9(0x1ba)]||_0x26efb9(0x195)+_0x16bf5a,'rule':_0x49c8ad(_0x2bdf1e,!![]),'countPopulation':!![]}),_0x4d0b2a=_0x1ee391['id'],saveSegmentToPushRecovery(_0x1ff6ae[_0x26efb9(0x1b9)],_0x1ff6ae[_0x26efb9(0x135)][_0x26efb9(0x13a)],_0x16bf5a,{'segmentId':_0x4d0b2a,'uniqueServerName':_0x42dfde,'createdAt':new Date()[_0x26efb9(0x1e1)]()})):_0x4d0b2a=await createOrRecoverEmbeddedSegment(_0x40aa63,_0x1ff6ae,{'localName':_0x16bf5a,'uniqueSegmentName':_0x42dfde,'description':_0x1d366d[_0x26efb9(0x1ba)]||_0x26efb9(0x195)+_0x16bf5a,'journeyId':_0x2952e2,'resolvedRule':_0x2bdf1e,'parentId':_0x954e9e[_0x26efb9(0x21a)],'folderId':_0x954e9e[_0x26efb9(0x13d)]||''},_0x49c8ad),_0x306558[_0x26efb9(0x152)]['set'](_0x16bf5a,_0x4d0b2a),_0x40544e['set'](_0x16bf5a,_0x4d0b2a),_0x4d0b2a;})());_0x380df2[_0x20afab(0x12f)](_0x16bf5a,_0x5d7ba7);try{return await _0x5d7ba7;}finally{_0x380df2[_0x20afab(0x131)](_0x16bf5a);}},'resolveActivationId':async _0xee89c7=>{const _0x4edd76=_0x3233a6,_0x9a1cd2=_0xb856c6[_0x4edd76(0x17e)](_0xee89c7);if(_0x9a1cd2)return _0x9a1cd2;if(_0x1ff6ae[_0x4edd76(0x18d)]){await _0x2ed11c();const _0x117a42=_0xb856c6['get'](_0xee89c7);if(_0x117a42)return _0x117a42;}throw new SDKError(ErrorCode[_0x4edd76(0x141)],'Activation\x20not\x20found:\x20'+_0xee89c7+'\x20(referenced\x20in\x20journey\x20'+_0x1ff6ae[_0x4edd76(0x135)][_0x4edd76(0x13a)]+_0x4edd76(0x21e)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x5d4bd5,_0x1e17e1)=>{const _0x2a5094=_0x3233a6,_0x2a4b2a=_0xb856c6[_0x2a5094(0x17e)](_0x5d4bd5);if(_0x2a4b2a)return _0x2a4b2a;if(_0x1ff6ae[_0x2a5094(0x184)])return _0x5ad396[_0x2a5094(0x12f)](_0x5d4bd5,_0x1e17e1),createPendingActivationId(_0x5d4bd5);if(_0x1ff6ae[_0x2a5094(0x18d)]){await _0x2ed11c();const _0x2fa74c=_0xb856c6[_0x2a5094(0x17e)](_0x1e17e1['name']);if(_0x2fa74c)return _0xb856c6[_0x2a5094(0x12f)](_0x5d4bd5,_0x2fa74c),_0x2fa74c;const _0x94822a=activationSignature(_0x1e17e1),_0xefa455=_0x851159?.['get'](_0x94822a);if(_0xefa455)return _0xb856c6[_0x2a5094(0x12f)](_0x5d4bd5,_0xefa455),_0xefa455;const _0x13c91f=await _0x502b17(_0x1e17e1,_0x306558['activationContext']),_0x574402={..._0x13c91f,..._0x1e17e1[_0x2a5094(0x137)]!==undefined&&{'runAfterJourneyRefresh':_0x1e17e1['run_after_journey_refresh']}},_0x5eb721=await _0x40aa63[_0x2a5094(0x13c)][_0x2a5094(0x1e3)](_0x1ff6ae[_0x2a5094(0x18d)]['id'],_0x574402);return _0xb856c6[_0x2a5094(0x12f)](_0x5d4bd5,_0x5eb721['id']),_0x5eb721['id'];}throw new SDKError(ErrorCode[_0x2a5094(0x1db)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x168b9c=>{const _0x2741ef=_0x3233a6;try{return await _0x40aa63[_0x2741ef(0x13c)][_0x2741ef(0x14e)](_0x954e9e[_0x2741ef(0x21a)],_0x168b9c);}catch(_0x1e2033){throw new SDKError(ErrorCode[_0x2741ef(0x141)],'Journey\x20\x27'+_0x168b9c+_0x2741ef(0x12d)+_0x1ff6ae[_0x2741ef(0x135)][_0x2741ef(0x13a)]+'\x27)',_0x1e2033);}},'resolveStageId':async(_0x3f3ebe,_0x3b4903)=>{const _0x54ddde=_0x3233a6,_0x2f10c1=await _0x40aa63[_0x54ddde(0x13c)][_0x54ddde(0x210)](_0x3f3ebe),_0x57b4a4=_0x2f10c1[_0x54ddde(0x19f)][_0x54ddde(0x12c)]['find'](_0x44acec=>_0x44acec[_0x54ddde(0x13a)][_0x54ddde(0x150)]()===_0x3b4903['toLowerCase']());if(!_0x57b4a4?.['id'])throw new SDKError(ErrorCode[_0x54ddde(0x141)],_0x54ddde(0x1ab)+_0x3b4903+_0x54ddde(0x1c1)+(_0x2f10c1[_0x54ddde(0x19f)][_0x54ddde(0x1f7)]||_0x2f10c1[_0x54ddde(0x19f)][_0x54ddde(0x13a)])+'\x27');return _0x57b4a4['id'];}},_0x54f6b0=await _0x150609(_0x1ff6ae[_0x3233a6(0x135)],_0x954e9e['parentId'],_0x2e7d38),_0x1b8f75=_0x954e9e[_0x3233a6(0x1ce)]||_0x954e9e['rootFolderId'];_0x1b8f75&&(_0x54f6b0[_0x3233a6(0x1e0)]={'parentFolder':{'data':{'id':_0x1b8f75,'type':_0x3233a6(0x1cb)}}});if(_0x1ff6ae['isNew']){if(_0x570927[_0x3233a6(0x1a9)]>0x0||_0x5ad396[_0x3233a6(0x1a9)]>0x0)return await executeThreeStepJourneyCreate(_0x40aa63,_0x1ff6ae,_0x54f6b0,{'pendingEmbeddedSegments':_0x570927,'pendingEmbeddedActivations':_0x5ad396,'embeddedSegmentNameToId':_0x40544e,'journeyActivationNameToId':_0xb856c6},{..._0x954e9e,'effectiveFolderId':_0x1b8f75},_0x306558,_0x4236de,_0x4b106f);else{ensureJourneyDefaults(_0x54f6b0[_0x3233a6(0x19f)]);const _0x3bf8a2=await _0x40aa63['journey'][_0x3233a6(0x130)](_0x54f6b0);return deletePushRecovery(_0x1ff6ae[_0x3233a6(0x1b9)]),{'action':_0x3233a6(0x1ef),'journeyId':_0x3bf8a2['id'],'embeddedSegmentNameToId':_0x40544e};}}else{if(_0x1ff6ae[_0x3233a6(0x1e6)]&&_0x1ff6ae[_0x3233a6(0x18d)]){_0x54f6b0['id']=_0x1ff6ae[_0x3233a6(0x18d)]['id'];const _0x1f05ab=_0x54f6b0[_0x3233a6(0x19f)];_0x1ff6ae['existingJourney'][_0x3233a6(0x19f)]?.[_0x3233a6(0x1f7)]&&(_0x1f05ab[_0x3233a6(0x1f7)]=_0x1ff6ae[_0x3233a6(0x18d)][_0x3233a6(0x19f)][_0x3233a6(0x1f7)]);const _0x478921=_0x1ff6ae[_0x3233a6(0x18d)][_0x3233a6(0x19f)]?.[_0x3233a6(0x12c)];return _0x478921&&_0x54f6b0[_0x3233a6(0x19f)][_0x3233a6(0x12c)]&&injectExistingStageIds(_0x54f6b0['attributes'][_0x3233a6(0x12c)],_0x478921),ensureJourneyDefaults(_0x1f05ab),await _0x40aa63[_0x3233a6(0x13c)]['update'](_0x1ff6ae['existingJourney']['id'],_0x54f6b0),deletePushRecovery(_0x1ff6ae[_0x3233a6(0x1b9)]),{'action':_0x3233a6(0x169),'journeyId':_0x1ff6ae[_0x3233a6(0x18d)]['id'],'embeddedSegmentNameToId':_0x40544e};}}return deletePushRecovery(_0x1ff6ae[_0x3233a6(0x1b9)]),{'action':_0x3233a6(0x19c),'journeyId':_0x1ff6ae[_0x3233a6(0x18d)]?.['id'],'embeddedSegmentNameToId':_0x40544e};}function findSegmentCriteriaLocation(_0x2ccbef,_0x2e6347){const _0x41cafd=a128_0x54e8ba,_0x24ffb5=_0x2ccbef[_0x41cafd(0x19d)]||_0x2ccbef[_0x41cafd(0x19b)]?.[0x0]?.[_0x41cafd(0x19d)]||[];let _0x1a7a73='entry',_0x294a6d=_0x2e6347;const _0x18a311=_0x2ccbef['goal']||_0x2ccbef['journeys']?.[0x0]?.[_0x41cafd(0x13f)];if(_0x18a311?.[_0x41cafd(0x132)]===_0x2e6347)return{'stageName':_0x41cafd(0x13f),'criteriaName':_0x18a311[_0x41cafd(0x13a)]||_0x2e6347};_0x5c767c:for(const _0x3d308b of _0x24ffb5){if(_0x3d308b['entry_criteria']?.[_0x41cafd(0x132)]===_0x2e6347){_0x1a7a73=_0x3d308b[_0x41cafd(0x13a)],_0x294a6d=_0x3d308b[_0x41cafd(0x136)][_0x41cafd(0x13a)]||_0x2e6347;break;}if(_0x3d308b[_0x41cafd(0x1bc)])for(const _0xde628 of _0x3d308b[_0x41cafd(0x1bc)]){if(_0xde628[_0x41cafd(0x142)]==='decision_point'&&_0xde628['with']?.[_0x41cafd(0x13b)])for(const _0x5d443e of _0xde628[_0x41cafd(0x161)][_0x41cafd(0x13b)]){if(_0x5d443e['segment']===_0x2e6347){_0x1a7a73=_0x3d308b[_0x41cafd(0x13a)],_0x294a6d=_0x5d443e['name']||_0x2e6347;break _0x5c767c;}}}}return{'stageName':_0x1a7a73,'criteriaName':_0x294a6d};}async function executeThreeStepJourneyCreate(_0x3bbbd9,_0x134f91,_0x4eb1e0,_0x3af307,_0x6b9f9e,_0x104e3a,_0x42ddbb,_0xfeb106){const _0x126d43=a128_0x54e8ba,{activationDefToCreateRequest:_0x5c2388,yamlRuleToApi:_0x5d6f36}=_0xfeb106,{pendingEmbeddedSegments:_0x19c71f,pendingEmbeddedActivations:_0x495778,embeddedSegmentNameToId:_0x236239}=_0x3af307,_0x4e4f29=JSON[_0x126d43(0x159)](JSON[_0x126d43(0x209)](_0x4eb1e0));ensureJourneyDefaults(_0x4e4f29[_0x126d43(0x19f)]),stripPendingIds(_0x4e4f29);const _0x5da913=await _0x3bbbd9[_0x126d43(0x13c)][_0x126d43(0x130)](_0x4e4f29),_0x5c4b71=_0x5da913['id'],_0x49583c=new Map();for(const _0x30573d of _0x5da913[_0x126d43(0x19f)][_0x126d43(0x12c)]){_0x49583c[_0x126d43(0x12f)](_0x30573d[_0x126d43(0x13a)]['toLowerCase'](),_0x30573d['id']);}recoverSegmentIdsFromPushRecovery(_0x134f91,_0x236239,_0x104e3a[_0x126d43(0x152)]);for(const [_0x1343d7,{definition:_0x5525eb}]of _0x19c71f){if(_0x236239[_0x126d43(0x1b8)](_0x1343d7)){_0x42ddbb[_0x126d43(0x1fa)]?.({'type':_0x126d43(0x20c),'journeyName':_0x134f91[_0x126d43(0x135)][_0x126d43(0x13a)],'segmentName':_0x1343d7});continue;}const _0x545dc4=generateDeterministicJourneySegmentName(_0x134f91[_0x126d43(0x135)][_0x126d43(0x13a)],_0x1343d7);_0x42ddbb[_0x126d43(0x1fa)]?.({'type':_0x126d43(0x1d1),'journeyName':_0x134f91[_0x126d43(0x135)][_0x126d43(0x13a)],'segmentName':_0x1343d7});const _0x208d76=createSegmentIdResolver(_0x104e3a['segmentNameToId'],_0x1343d7),_0x2846e8=await resolveRuleSegmentIds(_0x5525eb[_0x126d43(0x1c5)],_0x208d76),_0x9c46c8=await createOrRecoverEmbeddedSegment(_0x3bbbd9,_0x134f91,{'localName':_0x1343d7,'uniqueSegmentName':_0x545dc4,'description':_0x5525eb['description']||_0x126d43(0x195)+_0x1343d7,'journeyId':_0x5c4b71,'resolvedRule':_0x2846e8,'parentId':_0x6b9f9e[_0x126d43(0x21a)],'folderId':_0x6b9f9e[_0x126d43(0x1f3)]||''},_0x5d6f36);_0x236239['set'](_0x1343d7,_0x9c46c8),_0x104e3a[_0x126d43(0x152)]['set'](_0x1343d7,_0x9c46c8),_0x42ddbb['onProgress']?.({'type':_0x126d43(0x20c),'journeyName':_0x134f91[_0x126d43(0x135)][_0x126d43(0x13a)],'segmentName':_0x1343d7});}const _0x2188d3=new Map();for(const [_0x23c46c,_0x31b52e]of _0x495778){_0x42ddbb[_0x126d43(0x1fa)]?.({'type':'embedded_activation_creating','journeyName':_0x134f91[_0x126d43(0x135)]['name'],'activationName':_0x23c46c});const _0x250dd1=await _0x5c2388(_0x31b52e,_0x104e3a[_0x126d43(0x1dd)]),_0x58127e={..._0x250dd1,..._0x31b52e[_0x126d43(0x137)]!==undefined&&{'runAfterJourneyRefresh':_0x31b52e['run_after_journey_refresh']}},_0x3b50dd=await _0x3bbbd9['journey'][_0x126d43(0x1e3)](_0x5c4b71,_0x58127e);_0x2188d3[_0x126d43(0x12f)](_0x23c46c,_0x3b50dd['id']),_0x3af307[_0x126d43(0x1cf)][_0x126d43(0x12f)](_0x23c46c,_0x3b50dd['id']),_0x42ddbb[_0x126d43(0x1fa)]?.({'type':'embedded_activation_created','journeyName':_0x134f91[_0x126d43(0x135)][_0x126d43(0x13a)],'activationName':_0x23c46c});}const _0x9ae64e=JSON[_0x126d43(0x159)](JSON[_0x126d43(0x209)](_0x4eb1e0));return _0x9ae64e['id']=_0x5c4b71,ensureJourneyDefaults(_0x9ae64e[_0x126d43(0x19f)]),resolvePendingIdsInRequest(_0x9ae64e,_0x4eb1e0,_0x49583c,_0x236239,_0x2188d3,_0x42ddbb),await _0x3bbbd9['journey'][_0x126d43(0x12e)](_0x5c4b71,_0x9ae64e),deletePushRecovery(_0x134f91[_0x126d43(0x1b9)]),{'action':_0x126d43(0x1ef),'journeyId':_0x5c4b71,'embeddedSegmentNameToId':_0x236239};}export function stripWaitStepPendingIds(_0x56f14f){const _0x139f11=a128_0x54e8ba,_0x3265ef=_0x56f14f[_0x139f11(0x1cc)]&&isPendingSegmentId(_0x56f14f[_0x139f11(0x1cc)]),_0x3bf996=_0x56f14f[_0x139f11(0x1e7)]?.[_0x139f11(0x1f4)](_0x3c0e4e=>_0x3c0e4e[_0x139f11(0x202)]&&isPendingSegmentId(_0x3c0e4e[_0x139f11(0x202)]));(_0x3265ef||_0x3bf996)&&(_0x56f14f[_0x139f11(0x1a7)]=_0x139f11(0x1c3),_0x56f14f[_0x139f11(0x1ee)]=0x1,_0x56f14f['waitStepUnit']=_0x139f11(0x1f8),delete _0x56f14f['conditionSegmentId'],delete _0x56f14f[_0x139f11(0x118)],delete _0x56f14f[_0x139f11(0x1d5)],delete _0x56f14f[_0x139f11(0x1e7)]);}export function resolveWaitStepPendingIds(_0x597d64,_0x56ed16,_0x34f1bd,_0x5284a8){const _0x5d0228=a128_0x54e8ba;if(_0x56ed16['conditionSegmentId']&&isPendingSegmentId(_0x56ed16[_0x5d0228(0x1cc)])){const _0x406043=_0x34f1bd(_0x56ed16[_0x5d0228(0x1cc)],'stage\x20\x27'+_0x5284a8+_0x5d0228(0x218));_0x406043&&(_0x597d64['waitStepType']=_0x5d0228(0x11a),_0x597d64[_0x5d0228(0x1cc)]=_0x406043,delete _0x597d64[_0x5d0228(0x1ee)],delete _0x597d64[_0x5d0228(0x17d)],_0x56ed16['conditionTimeoutDuration']!==undefined&&(_0x597d64[_0x5d0228(0x118)]=_0x56ed16[_0x5d0228(0x118)]),_0x56ed16[_0x5d0228(0x1d5)]&&(_0x597d64[_0x5d0228(0x1d5)]=_0x56ed16[_0x5d0228(0x1d5)]));}if(_0x56ed16[_0x5d0228(0x1e7)]){const _0x5396f0=_0x56ed16[_0x5d0228(0x1e7)]['some'](_0x12f599=>_0x12f599['segmentId']&&isPendingSegmentId(_0x12f599['segmentId']));if(_0x5396f0){const _0x598c5d=_0x56ed16[_0x5d0228(0x1e7)][_0x5d0228(0x143)](_0xed8110=>{const _0x1d4d4f=_0x5d0228;if(_0xed8110[_0x1d4d4f(0x202)]&&isPendingSegmentId(_0xed8110[_0x1d4d4f(0x202)])){const _0x50298a=_0x34f1bd(_0xed8110[_0x1d4d4f(0x202)],'stage\x20\x27'+_0x5284a8+_0x1d4d4f(0x218));return{..._0xed8110,'segmentId':_0x50298a||_0xed8110[_0x1d4d4f(0x202)]};}return{..._0xed8110};});_0x597d64[_0x5d0228(0x1a7)]=_0x5d0228(0x11a),_0x597d64[_0x5d0228(0x1e7)]=_0x598c5d,delete _0x597d64['waitStep'],delete _0x597d64[_0x5d0228(0x17d)],delete _0x597d64[_0x5d0228(0x1cc)],delete _0x597d64[_0x5d0228(0x118)],delete _0x597d64[_0x5d0228(0x1d5)];}}}function stripPendingIds(_0x16ace6){const _0xb1fc33=a128_0x54e8ba;_0x16ace6[_0xb1fc33(0x19f)]['goal']?.[_0xb1fc33(0x202)]&&isPendingSegmentId(_0x16ace6[_0xb1fc33(0x19f)][_0xb1fc33(0x13f)][_0xb1fc33(0x202)])&&delete _0x16ace6[_0xb1fc33(0x19f)][_0xb1fc33(0x13f)];for(const _0x49aacf of _0x16ace6[_0xb1fc33(0x19f)][_0xb1fc33(0x12c)]||[]){_0x49aacf[_0xb1fc33(0x138)]?.[_0xb1fc33(0x202)]&&isPendingSegmentId(_0x49aacf[_0xb1fc33(0x138)][_0xb1fc33(0x202)])&&delete _0x49aacf[_0xb1fc33(0x138)];_0x49aacf['milestone']?.[_0xb1fc33(0x202)]&&isPendingSegmentId(_0x49aacf[_0xb1fc33(0x140)]['segmentId'])&&delete _0x49aacf[_0xb1fc33(0x140)];_0x49aacf[_0xb1fc33(0x13e)]&&(_0x49aacf[_0xb1fc33(0x13e)]=_0x49aacf[_0xb1fc33(0x13e)][_0xb1fc33(0x18e)](_0x227c0f=>!_0x227c0f['segmentId']||!isPendingSegmentId(_0x227c0f[_0xb1fc33(0x202)])));if(_0x49aacf[_0xb1fc33(0x1bc)])for(const _0x2d77bc of Object[_0xb1fc33(0x14b)](_0x49aacf[_0xb1fc33(0x1bc)])){const _0x15d027=_0x49aacf[_0xb1fc33(0x1bc)][_0x2d77bc];_0x15d027[_0xb1fc33(0x142)]===_0xb1fc33(0x16f)&&_0x15d027[_0xb1fc33(0x124)]&&isPendingActivationId(_0x15d027[_0xb1fc33(0x124)])&&(_0x15d027[_0xb1fc33(0x124)]='');if(_0x15d027[_0xb1fc33(0x142)]===_0xb1fc33(0x1fc)&&_0x15d027[_0xb1fc33(0x13b)])for(const _0x45f518 of _0x15d027['branches']){_0x45f518[_0xb1fc33(0x202)]&&isPendingSegmentId(_0x45f518[_0xb1fc33(0x202)])&&(_0x45f518[_0xb1fc33(0x202)]='');}_0x15d027[_0xb1fc33(0x142)]===_0xb1fc33(0x1c2)&&stripWaitStepPendingIds(_0x15d027);}}}function resolvePendingIdsInRequest(_0x3bc4ec,_0x8282d9,_0x58fb06,_0x2c9af2,_0x107316,_0x3f4eef){const _0x4a9bc2=a128_0x54e8ba,_0x3151d3=(_0x3b62d4,_0x5dd774)=>{const _0x53fb6c=a128_0x16b6;if(!isPendingSegmentId(_0x3b62d4))return _0x3b62d4;const _0x4eaa34=extractPendingSegmentName(_0x3b62d4),_0xe0bb51=_0x2c9af2[_0x53fb6c(0x17e)](_0x4eaa34);return!_0xe0bb51&&_0x3f4eef[_0x53fb6c(0x1b1)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x4eaa34+'\x27\x20for\x20'+_0x5dd774),_0xe0bb51;};if(_0x3bc4ec[_0x4a9bc2(0x19f)][_0x4a9bc2(0x13f)]?.[_0x4a9bc2(0x202)]&&isPendingSegmentId(_0x3bc4ec['attributes']['goal'][_0x4a9bc2(0x202)])){const _0x1eb7da=_0x3151d3(_0x3bc4ec[_0x4a9bc2(0x19f)][_0x4a9bc2(0x13f)]['segmentId'],_0x4a9bc2(0x1b7));_0x1eb7da&&(_0x3bc4ec[_0x4a9bc2(0x19f)][_0x4a9bc2(0x13f)][_0x4a9bc2(0x202)]=_0x1eb7da);}for(const _0x3357ea of _0x3bc4ec[_0x4a9bc2(0x19f)][_0x4a9bc2(0x12c)]||[]){const _0x4ea96d=_0x58fb06['get'](_0x3357ea['name'][_0x4a9bc2(0x150)]());_0x4ea96d&&(_0x3357ea['id']=_0x4ea96d);if(_0x3357ea[_0x4a9bc2(0x138)]?.[_0x4a9bc2(0x202)]&&isPendingSegmentId(_0x3357ea[_0x4a9bc2(0x138)][_0x4a9bc2(0x202)])){const _0x281616=_0x3151d3(_0x3357ea['entryCriteria']['segmentId'],'stage\x20\x27'+_0x3357ea[_0x4a9bc2(0x13a)]+_0x4a9bc2(0x154));_0x281616&&(_0x3357ea['entryCriteria'][_0x4a9bc2(0x202)]=_0x281616);}if(_0x3357ea[_0x4a9bc2(0x13e)])for(const _0x241fc9 of _0x3357ea[_0x4a9bc2(0x13e)]){if(_0x241fc9[_0x4a9bc2(0x202)]&&isPendingSegmentId(_0x241fc9['segmentId'])){const _0x1fb4d8=_0x3151d3(_0x241fc9[_0x4a9bc2(0x202)],'stage\x20\x27'+_0x3357ea[_0x4a9bc2(0x13a)]+_0x4a9bc2(0x1e5));_0x1fb4d8&&(_0x241fc9[_0x4a9bc2(0x202)]=_0x1fb4d8);}}if(_0x3357ea['milestone']?.[_0x4a9bc2(0x202)]&&isPendingSegmentId(_0x3357ea[_0x4a9bc2(0x140)][_0x4a9bc2(0x202)])){const _0x396cb4=_0x3151d3(_0x3357ea['milestone'][_0x4a9bc2(0x202)],_0x4a9bc2(0x17b)+_0x3357ea['name']+'\x27\x20milestone');_0x396cb4&&(_0x3357ea[_0x4a9bc2(0x140)][_0x4a9bc2(0x202)]=_0x396cb4);}if(_0x3357ea[_0x4a9bc2(0x1bc)]){const _0x1a2b7d=_0x45ac6f=>_0x8282d9['attributes'][_0x4a9bc2(0x12c)]?.['find'](_0x40556f=>_0x40556f[_0x4a9bc2(0x13a)][_0x4a9bc2(0x150)]()===_0x3357ea[_0x4a9bc2(0x13a)][_0x4a9bc2(0x150)]())?.['steps']?.[_0x45ac6f];for(const _0x175c33 of Object['keys'](_0x3357ea['steps'])){const _0x4588df=_0x3357ea[_0x4a9bc2(0x1bc)][_0x175c33],_0xcc3e18=_0x1a2b7d(_0x175c33);if(_0x4588df[_0x4a9bc2(0x142)]===_0x4a9bc2(0x16f)&&_0x4588df[_0x4a9bc2(0x124)]&&(isPendingActivationId(_0x4588df[_0x4a9bc2(0x124)])||_0x4588df['journeyActivationStepId']==='')){if(_0xcc3e18?.[_0x4a9bc2(0x124)]&&isPendingActivationId(_0xcc3e18[_0x4a9bc2(0x124)])){const _0x2bd0a4=extractPendingActivationName(_0xcc3e18[_0x4a9bc2(0x124)]),_0x963bd6=_0x107316[_0x4a9bc2(0x17e)](_0x2bd0a4);_0x963bd6&&(_0x4588df[_0x4a9bc2(0x124)]=_0x963bd6);}}if(_0x4588df[_0x4a9bc2(0x142)]===_0x4a9bc2(0x1fc)&&_0x4588df[_0x4a9bc2(0x13b)]&&_0xcc3e18?.[_0x4a9bc2(0x13b)])for(let _0x579b56=0x0;_0x579b56<_0x4588df[_0x4a9bc2(0x13b)][_0x4a9bc2(0x19a)];_0x579b56++){const _0x59a226=_0x4588df[_0x4a9bc2(0x13b)][_0x579b56],_0x3cc310=_0xcc3e18['branches'][_0x579b56];if(_0x3cc310?.[_0x4a9bc2(0x202)]&&isPendingSegmentId(_0x3cc310['segmentId'])){const _0x5d0c5e=_0x3151d3(_0x3cc310[_0x4a9bc2(0x202)],_0x4a9bc2(0x17b)+_0x3357ea[_0x4a9bc2(0x13a)]+_0x4a9bc2(0x16b)+(_0x59a226[_0x4a9bc2(0x13a)]||_0x579b56)+'\x27');_0x5d0c5e&&(_0x59a226[_0x4a9bc2(0x202)]=_0x5d0c5e);}}_0x4588df[_0x4a9bc2(0x142)]==='WaitStep'&&_0xcc3e18?.[_0x4a9bc2(0x142)]===_0x4a9bc2(0x1c2)&&resolveWaitStepPendingIds(_0x4588df,_0xcc3e18,_0x3151d3,_0x3357ea['name']);}}}}
|
|
1
|
+
function a128_0x2900(_0x32a12c,_0x159d3a){_0x32a12c=_0x32a12c-0x134;const _0x303636=a128_0x3036();let _0x290029=_0x303636[_0x32a12c];return _0x290029;}const a128_0x33d74d=a128_0x2900;(function(_0x32c57e,_0x2b10eb){const _0x4e2a99=a128_0x2900,_0x3b25f7=_0x32c57e();while(!![]){try{const _0x4cb5fe=parseInt(_0x4e2a99(0x1d0))/0x1*(-parseInt(_0x4e2a99(0x166))/0x2)+parseInt(_0x4e2a99(0x224))/0x3*(parseInt(_0x4e2a99(0x203))/0x4)+-parseInt(_0x4e2a99(0x17f))/0x5*(-parseInt(_0x4e2a99(0x208))/0x6)+parseInt(_0x4e2a99(0x19f))/0x7*(parseInt(_0x4e2a99(0x1b9))/0x8)+-parseInt(_0x4e2a99(0x167))/0x9*(-parseInt(_0x4e2a99(0x230))/0xa)+parseInt(_0x4e2a99(0x16f))/0xb*(-parseInt(_0x4e2a99(0x170))/0xc)+-parseInt(_0x4e2a99(0x15c))/0xd*(parseInt(_0x4e2a99(0x1d5))/0xe);if(_0x4cb5fe===_0x2b10eb)break;else _0x3b25f7['push'](_0x3b25f7['shift']());}catch(_0x573983){_0x3b25f7['push'](_0x3b25f7['shift']());}}}(a128_0x3036,0x9bce1));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a128_0x33d74d(0x205);export const PENDING_ACTIVATION_PREFIX=a128_0x33d74d(0x1f3);export function createPendingSegmentId(_0x53042a){return''+PENDING_SEGMENT_PREFIX+_0x53042a+'__';}export function isPendingSegmentId(_0xe9ab17){const _0xed198e=a128_0x33d74d;return _0xe9ab17[_0xed198e(0x15e)](PENDING_SEGMENT_PREFIX)&&!_0xe9ab17[_0xed198e(0x15e)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x37d846){const _0x5d9216=a128_0x33d74d;return _0x37d846[_0x5d9216(0x231)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x3df50e){return''+PENDING_ACTIVATION_PREFIX+_0x3df50e+'__';}export function isPendingActivationId(_0x25c9a4){return _0x25c9a4['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x123e43){return _0x123e43['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x39e83b,_0x575e3b){const _0x4d755b=a128_0x33d74d,_0x504712=_0x39e83b+'::'+(_0x575e3b[_0x4d755b(0x1e2)]()||_0x4d755b(0x159)),_0x57e8db=createHash(_0x4d755b(0x1ae))[_0x4d755b(0x172)](_0x504712)[_0x4d755b(0x22a)](_0x4d755b(0x235))[_0x4d755b(0x164)](0x0,0xc);return'journey_entry_criteria_'+_0x57e8db;}export function ensureJourneyDefaults(_0x46c6ce){const _0x321f14=a128_0x33d74d;!_0x46c6ce[_0x321f14(0x13c)]&&(_0x46c6ce[_0x321f14(0x13c)]=''),!_0x46c6ce['state']&&(_0x46c6ce[_0x321f14(0x13d)]=_0x321f14(0x20a));}export function injectExistingStageIds(_0x55185a,_0x44ce55){const _0x4efd2=a128_0x33d74d,_0x401624=new Map(_0x44ce55[_0x4efd2(0x143)](_0x60623d=>[_0x60623d[_0x4efd2(0x187)],_0x60623d['id']]));for(const _0x2425c0 of _0x55185a){if(!_0x2425c0['id']){const _0x198d70=_0x401624[_0x4efd2(0x1f6)](_0x2425c0[_0x4efd2(0x187)]);_0x198d70&&(_0x2425c0['id']=_0x198d70);}}}export function resolveTDFolderPath(_0x4dfc3f,_0x500f6d,_0x532d76){const _0x334eb1=a128_0x33d74d;if(!_0x500f6d)return _0x4dfc3f;if(_0x4dfc3f===_0x532d76||_0x4dfc3f[_0x334eb1(0x15e)](_0x532d76+'/'))return _0x4dfc3f;return _0x4dfc3f?_0x532d76+'/'+_0x4dfc3f:_0x532d76;}export function addFoldersToCreate(_0x341628,_0x2b80ef,_0x534bee){const _0xce4671=a128_0x33d74d;if(!_0x341628)return;if(_0x2b80ef[_0xce4671(0x236)](_0x341628))return;const _0xf5cab4=_0x341628['split']('/');let _0x21a540='';for(const _0x524b05 of _0xf5cab4){_0x21a540=_0x21a540?_0x21a540+'/'+_0x524b05:_0x524b05,!_0x2b80ef['has'](_0x21a540)&&_0x534bee[_0xce4671(0x1dc)](_0x21a540);}}export function sortFoldersByDepth(_0x41035f){const _0x31fa21=a128_0x33d74d;return[..._0x41035f][_0x31fa21(0x16e)]((_0x47152b,_0x28f8e6)=>{const _0x4f0433=_0x31fa21,_0x4478e1=(_0x47152b[_0x4f0433(0x134)](/\//g)||[])[_0x4f0433(0x157)],_0x46f82d=(_0x28f8e6[_0x4f0433(0x134)](/\//g)||[])[_0x4f0433(0x157)];return _0x4478e1-_0x46f82d;});}import*as a128_0x4039f5 from'yaml';import{readFileSync}from'fs';import a128_0x345688 from'path';import{isJourneyDef,parseYamlString as a128_0x4d818b,toYamlString as a128_0x1196d1,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{batchAsync}from'../../utils/async.js';import{buildFolderMaps}from'./resolution-context.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../errors.js';import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x16b590){const _0x131dca=a128_0x33d74d;if(Array['isArray'](_0x16b590))return'['+_0x16b590['map'](_0x412f15=>stableStringify(_0x412f15))[_0x131dca(0x18d)](',')+']';if(_0x16b590&&typeof _0x16b590===_0x131dca(0x233)){const _0x1a7bc7=_0x16b590,_0x110591=Object[_0x131dca(0x1e4)](_0x1a7bc7)[_0x131dca(0x16e)](),_0x2dba83=_0x110591['map'](_0x56203a=>'\x22'+_0x56203a+'\x22:'+stableStringify(_0x1a7bc7[_0x56203a]));return'{'+_0x2dba83['join'](',')+'}';}const _0x580a9a=JSON['stringify'](_0x16b590);return _0x580a9a===undefined?_0x131dca(0x1ab):_0x580a9a;}function activationSignature(_0x149739){const _0x2a0344=a128_0x33d74d,_0x13ad5c={'connection':_0x149739[_0x2a0344(0x158)],..._0x149739[_0x2a0344(0x232)]!==undefined&&{'all_columns':_0x149739['all_columns']},..._0x149739[_0x2a0344(0x142)]!==undefined&&{'columns':_0x149739[_0x2a0344(0x142)]},..._0x149739[_0x2a0344(0x1a2)]!==undefined&&{'behavior':_0x149739[_0x2a0344(0x1a2)]},..._0x149739['schedule']!==undefined&&{'schedule':_0x149739[_0x2a0344(0x15d)]},..._0x149739[_0x2a0344(0x1d8)]!==undefined&&{'notification':_0x149739[_0x2a0344(0x1d8)]},..._0x149739[_0x2a0344(0x174)]!==undefined&&{'connector_config':_0x149739[_0x2a0344(0x174)]},..._0x149739['activation_template_id']!==undefined&&{'activation_template_id':_0x149739['activation_template_id']}};return stableStringify(_0x13ad5c);}async function fetchSegment(_0x67312e,_0x13a346,_0x2eb7a9,_0xf3aa48){const _0xcdd4a5=a128_0x33d74d,_0x182874=_0xf3aa48?.['find'](_0x2cc044=>_0x2cc044['id']===_0x2eb7a9);if(_0x182874)return _0x182874;try{return await _0x67312e[_0xcdd4a5(0x159)]['getSegment'](_0x13a346,_0x2eb7a9);}catch(_0x4153a9){logger['debug'](_0xcdd4a5(0x176)+_0x2eb7a9+_0xcdd4a5(0x1bb)+_0x4153a9);try{return await _0x67312e[_0xcdd4a5(0x159)][_0xcdd4a5(0x17c)](_0x2eb7a9);}catch(_0xace759){return logger[_0xcdd4a5(0x1d1)](_0xcdd4a5(0x1cc)+_0x2eb7a9+':\x20'+_0xace759),null;}}}function recoverSegmentIdsFromPushRecovery(_0x51b5eb,_0x32d185,_0x40e20d){const _0x2c33bf=a128_0x33d74d,_0x579f1f=readPushRecovery(_0x51b5eb['absolutePath']);if(_0x579f1f?.['journeyName']===_0x51b5eb[_0x2c33bf(0x1e1)]['name'])for(const [_0x2b89fb,_0x148245]of Object[_0x2c33bf(0x1bd)](_0x579f1f[_0x2c33bf(0x199)])){const _0x50b023=generateDeterministicJourneySegmentName(_0x51b5eb[_0x2c33bf(0x1e1)][_0x2c33bf(0x187)],_0x2b89fb);_0x148245['uniqueServerName']===_0x50b023&&(_0x32d185[_0x2c33bf(0x1e0)](_0x2b89fb,_0x148245[_0x2c33bf(0x14f)]),_0x40e20d[_0x2c33bf(0x1e0)](_0x2b89fb,_0x148245[_0x2c33bf(0x14f)]));}}async function createOrRecoverEmbeddedSegment(_0x1219ee,_0x418da0,_0xb57009,_0x20a05b){const _0x4975f8=a128_0x33d74d;let _0x2f08df;try{_0x2f08df=await _0x1219ee[_0x4975f8(0x159)]['createJourneySegment']({'name':_0xb57009[_0x4975f8(0x154)],'description':_0xb57009['description'],'journeyId':_0xb57009[_0x4975f8(0x1ac)],'rule':_0x20a05b(_0xb57009[_0x4975f8(0x147)],!![]),'countPopulation':!![],'parentFolderId':_0xb57009[_0x4975f8(0x14e)],'audienceId':_0xb57009[_0x4975f8(0x1db)]});}catch(_0xc9103f){const _0x491367=_0xc9103f instanceof Error&&_0xc9103f[_0x4975f8(0x196)][_0x4975f8(0x1be)](_0x4975f8(0x16b));if(_0x491367){const _0x320c70=readPushRecovery(_0x418da0[_0x4975f8(0x14b)]),_0x5becb5=_0x320c70?.[_0x4975f8(0x191)]===_0x418da0['yamlConfig']['name']?_0x320c70[_0x4975f8(0x199)][_0xb57009[_0x4975f8(0x1a3)]]:undefined;if(_0x5becb5?.[_0x4975f8(0x227)]===_0xb57009[_0x4975f8(0x154)])await _0x1219ee['segment'][_0x4975f8(0x182)](_0xb57009[_0x4975f8(0x1db)],_0x5becb5['segmentId'],{'description':_0xb57009[_0x4975f8(0x13c)],'rule':_0x20a05b(_0xb57009[_0x4975f8(0x147)],!![]),'countPopulation':!![]}),_0x2f08df=_0x5becb5[_0x4975f8(0x14f)];else throw new SDKError(ErrorCode[_0x4975f8(0x1ff)],_0x4975f8(0x162)+_0xb57009[_0x4975f8(0x1a3)]+_0x4975f8(0x15b)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x418da0['absolutePath'][_0x4975f8(0x231)](/([^/]+)$/,_0x4975f8(0x217))+')\x20')+_0x4975f8(0x1e3),_0xc9103f);}else throw _0xc9103f;}return saveSegmentToPushRecovery(_0x418da0[_0x4975f8(0x14b)],_0x418da0['yamlConfig'][_0x4975f8(0x187)],_0xb57009['localName'],{'segmentId':_0x2f08df,'uniqueServerName':_0xb57009[_0x4975f8(0x154)],'createdAt':new Date()[_0x4975f8(0x1a0)]()}),_0x2f08df;}export async function prepareSegmentFiles(_0x454a7c,_0x4a1db7,_0x3b7c96,_0x2a4828,_0x208ea6){const _0x2cb2fd=a128_0x33d74d,{activationDefToCreateRequest:_0x3099ca}=await import('./child-segment-yaml.js'),_0x28a1c7=[],_0x1b6b2f=new Set();for(const {yamlConfig:_0x2ebe39,folderPath:_0x47f87d,sourcePath:_0x21b01f}of _0x454a7c){const _0x3c87d6=resolveTDFolderPath(_0x47f87d,_0x2a4828,_0x208ea6),_0x5c6e15=_0x3c87d6+':'+_0x2ebe39[_0x2cb2fd(0x187)],_0x454b61=_0x4a1db7[_0x2cb2fd(0x1ea)][_0x2cb2fd(0x1f6)](_0x5c6e15),_0x41d745=_0x454b61?_0x4a1db7[_0x2cb2fd(0x185)][_0x2cb2fd(0x1f6)](_0x454b61['id'])||[]:[];addFoldersToCreate(_0x3c87d6,_0x4a1db7[_0x2cb2fd(0x1c4)],_0x1b6b2f);const _0x4ad754=calculateActivationActions(_0x2ebe39[_0x2cb2fd(0x238)]||[],_0x41d745,_0x4a1db7[_0x2cb2fd(0x20d)],_0x4a1db7[_0x2cb2fd(0x1fc)]);for(const _0x1fcd2 of _0x4ad754){(_0x1fcd2[_0x2cb2fd(0x1f8)]===_0x2cb2fd(0x1bf)||_0x1fcd2[_0x2cb2fd(0x1f8)]==='update')&&_0x1fcd2[_0x2cb2fd(0x1e8)]&&(_0x1fcd2['validatedRequest']=await _0x3099ca(_0x1fcd2[_0x2cb2fd(0x1e8)],_0x3b7c96));}const _0x56ddb9=calculateSegmentDiff(_0x2ebe39,_0x454b61,_0x41d745,_0x4a1db7[_0x2cb2fd(0x20d)],_0x4a1db7['connectionIdToNameMap']);_0x28a1c7[_0x2cb2fd(0x1b1)]({'relativePath':_0x2ebe39[_0x2cb2fd(0x187)],'absolutePath':_0x21b01f,'yamlConfig':_0x2ebe39,'folderPath':_0x3c87d6,'existingSegment':_0x454b61,'existingActivations':_0x41d745,'isNew':_0x56ddb9[_0x2cb2fd(0x151)],'hasChanges':_0x56ddb9['hasChanges'],'diff':_0x56ddb9[_0x2cb2fd(0x1b3)],'activationActions':_0x4ad754});}return{'segmentFiles':_0x28a1c7,'foldersToCreate':_0x1b6b2f};}export async function prepareJourneyFiles(_0x2fc1a1,_0x4899a6,_0x142919,_0x53524f){const _0x5d38ef=a128_0x33d74d,_0x5f0756=[],_0x884c28=new Set();for(const {yamlConfig:_0xe9e0d3,folderPath:_0x5c5eb6,sourcePath:_0x113700}of _0x2fc1a1){const _0x3d2388=resolveTDFolderPath(_0x5c5eb6,_0x142919,_0x53524f),_0x527d7c=_0x3d2388+':'+_0xe9e0d3[_0x5d38ef(0x187)],_0x114a14=_0x4899a6[_0x5d38ef(0x1eb)][_0x5d38ef(0x1f6)](_0x527d7c);let _0x5031b4,_0x2f8aab;if(_0x114a14&&_0x114a14[_0x5d38ef(0x157)]>0x0){const _0x4893ae=buildLocalExpandedRuleMappings(_0xe9e0d3),{createYamlContext:_0x159cc1,prefetchJourneySegments:_0x5d2afe}=createPushYamlContextForBundle(_0x4899a6[_0x5d38ef(0x1ad)],_0x4899a6['parentId'],_0x4899a6[_0x5d38ef(0x165)],_0x4893ae,_0x4899a6[_0x5d38ef(0x20d)],_0x4899a6[_0x5d38ef(0x1fc)],_0x4899a6['activationStepsById'],_0x4899a6['journeyById']);await _0x5d2afe(_0x114a14[_0x5d38ef(0x143)](_0x56bfa9=>_0x56bfa9['id']));const _0x3db790=await _0x4899a6['deps'][_0x5d38ef(0x19e)][_0x5d38ef(0x136)](_0x114a14[0x0]['journeyBundleId']),_0x898656=hasMultipleVersions(_0xe9e0d3),_0x9935f8=async _0x38cedf=>{const _0x46a992=_0x5d38ef,_0x369eb5=_0x4899a6['journeyById']?.[_0x46a992(0x1f6)](_0x38cedf);if(_0x369eb5)return _0x369eb5;return _0x4899a6['fetchJourney']({'journeyId':_0x38cedf,'journeyName':_0xe9e0d3[_0x46a992(0x187)],'isMultiVersion':_0x114a14[_0x46a992(0x157)]>0x1});};if(_0x898656&&_0x114a14['length']>0x1){const _0x313a10=[];for(const _0x3d8f46 of _0x114a14){const _0x48943f=_0x3d8f46['versionNumber']||0x1;_0x4899a6[_0x5d38ef(0x1b8)]?.[_0x5d38ef(0x172)](_0x5d38ef(0x1af)+_0xe9e0d3[_0x5d38ef(0x187)]+'\x20v'+_0x48943f);const _0x388f3e=await _0x9935f8(_0x3d8f46['id']),_0x3967dc=_0x159cc1(_0x3d8f46['id']),_0x58e7a1=await journeyResponseToDef(_0x388f3e,_0x3967dc);_0x313a10[_0x5d38ef(0x1b1)]({'item':_0x3d8f46,'yaml':_0x58e7a1});}const _0x772db4=buildLocalRuleToNameMappingFromJourney(_0xe9e0d3);_0x2f8aab=buildMergedJourneyDef(_0x313a10,_0x772db4,_0x3db790);const _0x392bf8=Math[_0x5d38ef(0x156)](..._0x313a10[_0x5d38ef(0x143)](_0x3369b6=>_0x3369b6[_0x5d38ef(0x1e7)]['versionNumber']||0x0)),_0x5dbe89=_0x114a14['find'](_0x4ad37b=>(_0x4ad37b[_0x5d38ef(0x1d4)]||0x0)===_0x392bf8);_0x5dbe89&&(_0x4899a6['progress']?.['update']('Fetching\x20'+_0xe9e0d3[_0x5d38ef(0x187)]+'\x20v'+_0x392bf8),_0x5031b4=await _0x9935f8(_0x5dbe89['id']));}else{const _0x193940=_0x114a14[_0x114a14[_0x5d38ef(0x157)]-0x1];_0x4899a6['progress']?.[_0x5d38ef(0x172)](_0x5d38ef(0x1af)+_0xe9e0d3[_0x5d38ef(0x187)]),_0x5031b4=await _0x9935f8(_0x193940['id']);const _0x4b259a=_0x159cc1(_0x193940['id']),_0x8f92c8=await journeyResponseToDef(_0x5031b4,_0x4b259a),_0x50ff0d=buildLocalRuleToNameMappingFromJourney(_0xe9e0d3);_0x2f8aab=buildMergedJourneyDef([{'item':_0x193940,'yaml':_0x8f92c8}],_0x50ff0d,_0x3db790);}}addFoldersToCreate(_0x3d2388,_0x4899a6[_0x5d38ef(0x1c4)],_0x884c28);const _0x4ca6a4=calculateJourneyDiff(_0xe9e0d3,_0x2f8aab);_0x5f0756[_0x5d38ef(0x1b1)]({'relativePath':_0xe9e0d3[_0x5d38ef(0x187)],'absolutePath':_0x113700,'yamlConfig':_0xe9e0d3,'folderPath':_0x3d2388,'existingJourney':_0x5031b4,'isNew':_0x4ca6a4['isNew'],'hasChanges':_0x4ca6a4[_0x5d38ef(0x201)],'diff':_0x4ca6a4[_0x5d38ef(0x1b3)]});}return{'journeyFiles':_0x5f0756,'foldersToCreate':_0x884c28};}export function calculateActivationActions(_0x59f393,_0x4b3ea1,_0x198695,_0x3ab723){const _0x229da3=a128_0x33d74d,_0x51dbe8=[],_0x55bb38=new Map();for(const _0x5e44ee of _0x4b3ea1){_0x55bb38['set'](_0x5e44ee[_0x229da3(0x187)],_0x5e44ee);}const _0x239e96=new Map();for(const _0x581215 of _0x59f393){_0x239e96[_0x229da3(0x1e0)](_0x581215[_0x229da3(0x187)],_0x581215);}for(const _0xfaf571 of _0x59f393){const _0x56098b=_0x55bb38['get'](_0xfaf571[_0x229da3(0x187)]);if(!_0x56098b)_0x51dbe8[_0x229da3(0x1b1)]({'type':'create','name':_0xfaf571[_0x229da3(0x187)],'yamlActivation':_0xfaf571});else{const _0xabbc7f=activationResponseToDef(_0x56098b,_0x198695,_0x3ab723),_0x20b50f=a128_0x4039f5['stringify'](_0xabbc7f),_0x42ff8e=a128_0x4039f5[_0x229da3(0x169)](_0xfaf571);_0x20b50f!==_0x42ff8e&&_0x51dbe8[_0x229da3(0x1b1)]({'type':_0x229da3(0x172),'name':_0xfaf571[_0x229da3(0x187)],'yamlActivation':_0xfaf571,'existingActivation':_0x56098b});}}for(const _0x493093 of _0x4b3ea1){!_0x239e96[_0x229da3(0x236)](_0x493093[_0x229da3(0x187)])&&_0x51dbe8[_0x229da3(0x1b1)]({'type':_0x229da3(0x1df),'name':_0x493093[_0x229da3(0x187)],'existingActivation':_0x493093});}return _0x51dbe8;}function a128_0x3036(){const _0x2e8047=['journeys','conditionTimeoutDuration','versionNumber','4983118MLrvbp',').\x20','toLowerCase','notification','segmentNameToId','\x27\x20decision\x20point\x20branch\x20\x27','parentId','add','exitCriterias','createdSegmentId','delete','set','yamlConfig','trim','and\x20the\x20server\x20segment,\x20then\x20retry.','keys','segment_creating','DecisionPoint','item','yamlActivation','relative','segmentByFolderAndName','journeyBundlesByFolderAndName','\x27\x20wait\x20condition','rule','parentFolder','activationActions','\x27...','segment_deleting','Failed\x20to\x20resolve\x20activation\x20','__pending_act_','resolveSegment','JOURNEY_UPDATE_ERROR','get','./journey-yaml.js','type','journey_created','WaitStep','created','connectionIdToNameMap','ACTIVATION_SYNTAX_ERROR','Deleting\x20activation\x20\x27','SEGMENT_UPDATE_ERROR','Updating\x20segment\x20\x27','hasChanges','steps','56748KGhrvz','values','__pending_','waitStepUnit','getJourney','6cANBxs','createActivation','draft','Updating\x20activation\x20\x27','Deleted\x20activation\x20\x27','idToEmailMap','folder_creating','waitStep','milestone','kind','skipSegments','nameToId','withProgress','Created\x20folder\x20\x27','Duration','.$1.push-recovery.json','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','goal','\x20error(s)','\x0a\x20\x20','data','size','attributes','list','Created\x20journey\x20\x27','embedded_segment_created','deleted','../../utils/async.js','258HtNUll','Creating\x20activation\x20\x27','Condition','uniqueServerName','\x20journey\x20from\x20file:\x20','Stage\x20\x27','digest','deleteSegment','reduce','folderPath','\x27\x20by\x20rule\x20content','listActivations','1570CzxJiE','replace','all_columns','object','NOT_FOUND','hex','has','segment_updating','activations','Created\x20segment\x20\x27','match','effectiveFolderId','getLatestJourneyId','journeyActivationNameToId','journeyActivationStepId','filter','Segment\x20not\x20found:\x20','activation_creating','description','state','segmentFolderId','logWarning','logSuccess','flatMap','columns','map','action','find','createSegment','resolvedRule','dirname','embedded_segment_creating','./child-segment-yaml.js','absolutePath','day','decision_point','folderId','segmentId','activation_deleting','isNew','split','Matched\x20server\x20segment\x20\x27','uniqueSegmentName','utf-8','max','length','connection','segment','SEGMENT_SYNTAX_ERROR','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','26dOPFBV','schedule','startsWith','getActivation','parse','updated','Embedded\x20segment\x20\x27','conditionSegmentId','slice','existingSegments','2evkyDZ','41085PkjbGC','entryCriteria','stringify','Deleted\x20segment\x20\x27','Name\x20has\x20already\x20been\x20taken','existingActivation','\x27\x20for\x20','sort','11Stsucf','15176712rluFqJ','results','update','SEGMENT_NOT_FOUND','connector_config','Activation','getSegment\x20failed\x20for\x20','parentSegmentFolder','existingSegment','\x27\x20from\x20file:\x20','nameToType','rootFolderId','getSegmentEntity','activation_updating','folder_created','6347315ASaNia','toString','idToName','updateSegmentById','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','stages','activationsBySegmentId','entry_criteria','name','conditionTimeoutUnit','createFolder','\x20(referenced\x20in\x20journey\x20','Activation\x20not\x20found:\x20','valid','join','logDeleted','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','some','journeyName','validatedRequest','createdSegmentIds','onProgress','errors','message','unchanged','waitStepType','segments','journeyBundleName','\x27\x20not\x20found\x20in\x20journey\x20\x27','branches','segment_updated','journey','84viVHtu','toISOString','Entry\x20criteria:\x20','behavior','localName','embeddedSegmentNameToId','conditions','activation_deleted','stage\x20\x27','existingJourney','verbose','Segment\x20not\x20found','null','journeyId','deps','sha1','Fetching\x20','\x20activation\x20\x27','push','journeyStages','diff','Failed\x20to\x20','journey_creating','activation_updated','goal\x20criteria','progress','45312qNmvUs','INTERNAL',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','embedded_activation_created','entries','includes','create','user','with','\x27\x20entry\x20criteria','ACTIVATION_UPDATE_ERROR','folderPathToId','logInfo','run_after_journey_refresh','resolveJourneyId','all','from','Created\x20activation\x20\x27','Failed\x20to\x20resolve\x20segment\x20','getSegmentEntity\x20also\x20failed\x20for\x20','index','relationships','):\x20','659441uvgtSW','debug'];a128_0x3036=function(){return _0x2e8047;};return a128_0x3036();}function calculateYamlDiff(_0xaea208,_0xccb79f){if(_0xccb79f){const _0xb38827=generateDiff(_0xccb79f,_0xaea208),_0x44f34b=hasChanges(_0xb38827);return{'isNew':![],'hasChanges':_0x44f34b,'diff':_0x44f34b?formatDiffWithColors(_0xb38827):undefined};}const _0x588506=generateDiff('',_0xaea208);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x588506)};}export function calculateSegmentDiff(_0x277434,_0x538ffe,_0x4d796b,_0x4a5c4d,_0x10e00d){const _0x27fdd0=segmentToYamlString(_0x277434),_0x2ae66c=_0x538ffe?segmentToYamlString(segmentWithActivationsToYaml(_0x538ffe,_0x4d796b,undefined,_0x4a5c4d,_0x10e00d)):undefined;return calculateYamlDiff(_0x27fdd0,_0x2ae66c);}export function calculateJourneyDiff(_0x4fdfba,_0x38178d){const _0x32dd49=normalizeJourneyDef(_0x4fdfba,_0x4fdfba),_0x3547fa=a128_0x1196d1(_0x32dd49),_0x30c57c=_0x38178d?a128_0x1196d1(normalizeJourneyDef(_0x38178d,_0x4fdfba)):undefined;return calculateYamlDiff(_0x3547fa,_0x30c57c);}export function findSegmentsToDelete(_0x5b1534,_0x4ee8d3,_0x21fdb7,_0x31413f,_0x12c3c3){const _0x21ef52=a128_0x33d74d,_0x114d2e=new Set();for(const {yamlConfig:_0x29d6ec,folderPath:_0x33a95f}of _0x4ee8d3){_0x114d2e[_0x21ef52(0x1dc)](_0x33a95f+':'+_0x29d6ec[_0x21ef52(0x187)]);}return _0x5b1534[_0x21ef52(0x139)](_0x1cfaf2=>{const _0x22db4b=_0x21ef52,_0x180306=_0x1cfaf2[_0x22db4b(0x13e)]?_0x21fdb7[_0x22db4b(0x1f6)](_0x1cfaf2[_0x22db4b(0x13e)][_0x22db4b(0x180)]())||'':'',_0x289f17=_0x180306+':'+_0x1cfaf2[_0x22db4b(0x187)];if(_0x114d2e[_0x22db4b(0x236)](_0x289f17))return![];if(_0x12c3c3)return _0x180306===_0x31413f||_0x180306['startsWith'](_0x31413f+'/');return!![];});}export function findJourneysToDelete(_0x29a4e9,_0x46a25e,_0x186c07,_0xf76017,_0x3f2bde){const _0xd5eb35=a128_0x33d74d,_0x5501d4=new Set();for(const {yamlConfig:_0x4a992d,folderPath:_0x1d5f35}of _0x46a25e){_0x5501d4['add'](_0x1d5f35+':'+_0x4a992d[_0xd5eb35(0x187)]);}return _0x29a4e9['filter'](_0x8a8f3d=>{const _0x78be1c=_0xd5eb35,_0x62bb69=_0x8a8f3d[_0x78be1c(0x14e)]?_0x186c07[_0x78be1c(0x1f6)](_0x8a8f3d['folderId'])||'':'',_0x1d7edc=_0x62bb69+':'+_0x8a8f3d[_0x78be1c(0x19a)];if(_0x5501d4['has'](_0x1d7edc))return![];if(_0x3f2bde)return _0x62bb69===_0xf76017||_0x62bb69[_0x78be1c(0x15e)](_0xf76017+'/');return!![];});}export function buildSegmentLookupMap(_0x924ee4,_0x25391e){const _0xc6e661=a128_0x33d74d,_0x3df75f=new Map();for(const _0x147d4a of _0x924ee4){const _0x561425=_0x147d4a['segmentFolderId']?_0x25391e[_0xc6e661(0x1f6)](_0x147d4a[_0xc6e661(0x13e)][_0xc6e661(0x180)]())||'':'',_0x61d845=_0x561425+':'+_0x147d4a[_0xc6e661(0x187)];_0x3df75f[_0xc6e661(0x1e0)](_0x61d845,_0x147d4a);}return _0x3df75f;}export function buildSegmentNameToIdMap(_0x3236a7){const _0x4e721f=a128_0x33d74d,_0x495226=new Map();for(const _0x586081 of _0x3236a7){_0x495226[_0x4e721f(0x1e0)](_0x586081[_0x4e721f(0x187)],_0x586081['id']);}return _0x495226;}export function buildJourneyBundleLookupMap(_0x58d317,_0x4a7aa2){const _0x5ee5d8=a128_0x33d74d,_0x1cb38d=new Map();for(const _0x3928b8 of _0x58d317){const _0x496269=_0x3928b8['folderId']?_0x4a7aa2[_0x5ee5d8(0x1f6)](_0x3928b8['folderId'])||'':'',_0x3fab71=_0x496269+':'+_0x3928b8['journeyBundleName'];!_0x1cb38d[_0x5ee5d8(0x236)](_0x3fab71)&&_0x1cb38d[_0x5ee5d8(0x1e0)](_0x3fab71,[]),_0x1cb38d['get'](_0x3fab71)['push'](_0x3928b8);}for(const _0x40e7f9 of _0x1cb38d[_0x5ee5d8(0x204)]()){_0x40e7f9[_0x5ee5d8(0x16e)]((_0x49927d,_0x5b9e8a)=>(_0x49927d[_0x5ee5d8(0x1d4)]||0x0)-(_0x5b9e8a['versionNumber']||0x0));}return _0x1cb38d;}export function collectFoldersToCreate(_0x231794,_0x35f8eb){const _0x27f775=a128_0x33d74d,_0x1ed972=new Set();for(const _0x483e59 of _0x231794){if(!_0x483e59)continue;if(_0x35f8eb[_0x27f775(0x236)](_0x483e59))continue;const _0x38d049=_0x483e59['split']('/');let _0x5f125c='';for(const _0x2ee747 of _0x38d049){_0x5f125c=_0x5f125c?_0x5f125c+'/'+_0x2ee747:_0x2ee747,!_0x35f8eb[_0x27f775(0x236)](_0x5f125c)&&_0x1ed972[_0x27f775(0x1dc)](_0x5f125c);}}return _0x1ed972;}export function parseAndClassifyYamlFiles(_0x21e2bd,_0x5b3094,_0x34d997){const _0x162435=a128_0x33d74d,_0x311cdf=[],_0x5b1060=[];for(const _0x154bda of _0x21e2bd){const _0x245143=a128_0x345688[_0x162435(0x1e9)](_0x5b3094,a128_0x345688[_0x162435(0x148)](_0x154bda)),_0x1e8cc3=_0x245143==='.'?'':_0x245143,_0x44b33a=readFileSync(_0x154bda,_0x162435(0x155)),_0x56b961=a128_0x4039f5[_0x162435(0x160)](_0x44b33a);if(isJourneyDef(_0x56b961)){const _0x4ef879=a128_0x4d818b(_0x44b33a);_0x5b1060[_0x162435(0x1b1)]({'yamlConfig':_0x4ef879,'folderPath':_0x1e8cc3,'sourcePath':_0x154bda});}else{if(!_0x34d997?.[_0x162435(0x212)]){const _0x4849c9=parseSegmentYamlFile(_0x44b33a),_0x7ac292=normalizeChildSegmentYaml(_0x4849c9);_0x311cdf[_0x162435(0x1b1)]({'yamlConfig':_0x7ac292,'folderPath':_0x1e8cc3,'sourcePath':_0x154bda});}}}return{'segments':_0x311cdf,'journeys':_0x5b1060};}export function validateParsedFiles(_0x2a9e8e,_0x1486ec){const _0x168b8c=a128_0x33d74d,_0x5a199f=[];for(const {yamlConfig:_0x1c0b16,sourcePath:_0x4d59ca}of _0x2a9e8e[_0x168b8c(0x199)]){const _0x1dc2f2=readFileSync(_0x4d59ca,_0x168b8c(0x155)),_0x9a3fb2=a128_0x4039f5['parseDocument'](_0x1dc2f2),_0x3a1a8f=validateSegmentDef(_0x1c0b16,{'source':_0x1dc2f2,'document':_0x9a3fb2},{'skipSchema':!![]});if(!_0x3a1a8f[_0x168b8c(0x18c)]){const _0x4e029=a128_0x345688[_0x168b8c(0x1e9)](_0x1486ec,_0x4d59ca);_0x5a199f['push']({'filePath':_0x4e029,'source':_0x1dc2f2,'result':_0x3a1a8f,'isJourney':![]});}}for(const {yamlConfig:_0x5bbd21,sourcePath:_0x17d680}of _0x2a9e8e[_0x168b8c(0x1d2)]){const _0x1ee4e3=readFileSync(_0x17d680,_0x168b8c(0x155)),_0x2deebd=a128_0x4039f5['parseDocument'](_0x1ee4e3),_0x40b6cc=validateJourneyDef(_0x5bbd21,{'source':_0x1ee4e3,'document':_0x2deebd},{'skipSchema':!![]});if(!_0x40b6cc[_0x168b8c(0x18c)]){const _0x22744d=a128_0x345688[_0x168b8c(0x1e9)](_0x1486ec,_0x17d680);_0x5a199f[_0x168b8c(0x1b1)]({'filePath':_0x22744d,'source':_0x1ee4e3,'result':_0x40b6cc,'isJourney':!![]});}}return _0x5a199f;}export function formatValidationErrors(_0x9ee13e){const _0x57d954=a128_0x33d74d,_0x3dfcaa=[];for(const {filePath:_0x461f5c,source:_0x1ff38d,result:_0x5c5e60,isJourney:_0x396189}of _0x9ee13e){const _0x3390d0=_0x396189?_0x57d954(0x19e):_0x57d954(0x159);_0x3dfcaa[_0x57d954(0x1b1)]('\x0a'+_0x461f5c+'\x20('+_0x3390d0+_0x57d954(0x1cf)+_0x5c5e60[_0x57d954(0x195)]['length']+_0x57d954(0x21a)),_0x3dfcaa['push'](formatValidationResult(_0x5c5e60,_0x1ff38d,_0x461f5c));}return _0x3dfcaa['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x10a60b){const _0x390c03=a128_0x33d74d,_0x5d154a=new Set(),_0x3a12db=new Map(),_0x228ef4=collectSegmentUsageCounts(_0x10a60b);if(_0x10a60b[_0x390c03(0x199)])for(const [_0x28eec1,_0x5ad20b]of Object[_0x390c03(0x1bd)](_0x10a60b[_0x390c03(0x199)])){_0x5d154a['add'](_0x28eec1);if(_0x5ad20b[_0x390c03(0x1ed)]){const _0x3973b1=yamlRuleToApi(_0x5ad20b[_0x390c03(0x1ed)]),_0x4f3c0a=apiRuleToYaml(_0x3973b1);_0x3a12db['set'](_0x28eec1,_0x4f3c0a);}}const _0x46adb7=new Map();let _0x717716=0x0;for(const [_0x27480c,_0xcd6c5e]of _0x3a12db){const _0x213740=serializeExpandedRule(_0xcd6c5e,_0x3a12db),_0x222e1c=_0x46adb7[_0x390c03(0x1f6)](_0x213740)||[];_0x222e1c['push']({'name':_0x27480c,'index':_0x717716}),_0x46adb7[_0x390c03(0x1e0)](_0x213740,_0x222e1c),_0x717716++;}const _0x24a167=new Map();for(const [_0x4cf2dd,_0x2ec83d]of _0x46adb7){const _0x210dfa=_0x2ec83d[_0x390c03(0x164)]()[_0x390c03(0x16e)]((_0x85bd5d,_0x5a7438)=>{const _0xc3df30=_0x390c03,_0x5d83ae=_0x228ef4[_0xc3df30(0x1f6)](_0x85bd5d['name'])||0x0,_0x317170=_0x228ef4[_0xc3df30(0x1f6)](_0x5a7438[_0xc3df30(0x187)])||0x0;if(_0x5d83ae!==_0x317170)return _0x317170-_0x5d83ae;return _0x85bd5d[_0xc3df30(0x1cd)]-_0x5a7438[_0xc3df30(0x1cd)];})['map'](_0x5503ec=>_0x5503ec[_0x390c03(0x187)]),_0x2df84e=[];for(const _0x34b2bf of _0x210dfa){const _0x2381a4=_0x228ef4['get'](_0x34b2bf)||0x0,_0x2a21e2=Math['max'](_0x2381a4,0x1);for(let _0x4c8a2e=0x0;_0x4c8a2e<_0x2a21e2;_0x4c8a2e++){_0x2df84e['push'](_0x34b2bf);}}_0x24a167['set'](_0x4cf2dd,_0x2df84e);}return{'existingLocalSegmentNames':_0x5d154a,'localSegmentRules':_0x3a12db,'localExpandedRuleToNames':_0x24a167};}export function createSegmentIdResolver(_0x241456,_0x1ed2be){return async _0x11c3d2=>{const _0x1aac1a=a128_0x2900,_0x2d8a2a=_0x241456[_0x1aac1a(0x1f6)](_0x11c3d2);if(!_0x2d8a2a)throw new SDKError(ErrorCode[_0x1aac1a(0x173)],_0x1aac1a(0x13a)+_0x11c3d2+_0x1aac1a(0x218)+_0x1ed2be+'\x27)');return _0x2d8a2a;};}export function extractRootFolderId(_0x489cb1){const _0x43a965=a128_0x33d74d;return _0x489cb1[_0x43a965(0x1ce)]?.[_0x43a965(0x177)]?.[_0x43a965(0x21c)]?.['id']||_0x489cb1[_0x43a965(0x1ce)]?.[_0x43a965(0x1ee)]?.[_0x43a965(0x21c)]?.['id'];}export function buildConnectionMaps(_0x19ea28){const _0x436393=a128_0x33d74d,_0x1dd897=new Map(),_0x5bb81a=new Map(),_0x1d903e=new Map();for(const _0x8f0ce7 of _0x19ea28){_0x1dd897['set'](_0x8f0ce7['name'],parseInt(_0x8f0ce7['id'],0xa)),_0x5bb81a[_0x436393(0x1e0)](_0x8f0ce7['id'],_0x8f0ce7[_0x436393(0x187)]),_0x1d903e[_0x436393(0x1e0)](_0x8f0ce7[_0x436393(0x187)],_0x8f0ce7[_0x436393(0x1f8)]);}return{'nameToId':_0x1dd897,'idToName':_0x5bb81a,'nameToType':_0x1d903e};}export function calculatePushStats(_0x362551,_0x117c8c,_0xff4e8,_0x3d3919,_0x541097,_0x36e391,_0xd1e42e){const _0x445cb7=a128_0x33d74d,_0x41d2c4=_0x362551['filter'](_0x2e48d0=>_0x2e48d0['isNew']),_0x262806=_0x362551[_0x445cb7(0x139)](_0x1e3b4b=>!_0x1e3b4b[_0x445cb7(0x151)]&&_0x1e3b4b['hasChanges']),_0x36ebf6=_0x362551[_0x445cb7(0x139)](_0x425039=>!_0x425039[_0x445cb7(0x151)]&&!_0x425039['hasChanges']),_0x4d3d82=_0x36e391?_0x3d3919:[],_0x22c745=_0x117c8c['filter'](_0x2f354e=>_0x2f354e[_0x445cb7(0x151)]),_0x582d93=_0x117c8c[_0x445cb7(0x139)](_0x521190=>!_0x521190[_0x445cb7(0x151)]&&_0x521190[_0x445cb7(0x201)]),_0x2e2d16=_0x117c8c['filter'](_0x512b02=>!_0x512b02['isNew']&&!_0x512b02[_0x445cb7(0x201)]),_0x42565d=_0x36e391?_0x541097:[],_0x54bb7a=_0x362551[_0x445cb7(0x141)](_0x1871af=>_0x1871af['activationActions']),_0x48f92a=_0x54bb7a[_0x445cb7(0x139)](_0x35a656=>_0x35a656['type']===_0x445cb7(0x1bf)),_0x2a9146=_0x54bb7a[_0x445cb7(0x139)](_0x1de428=>_0x1de428[_0x445cb7(0x1f8)]==='update'),_0x4c5ed3=_0x54bb7a[_0x445cb7(0x139)](_0x1a85b8=>_0x1a85b8[_0x445cb7(0x1f8)]===_0x445cb7(0x1df)),_0x2ad14a=Array[_0x445cb7(0x1c9)](_0xff4e8)['sort'](),_0x2810de=_0xd1e42e?![]:_0x41d2c4['length']>0x0||_0x262806[_0x445cb7(0x157)]>0x0||_0x4d3d82[_0x445cb7(0x157)]>0x0,_0x5a46b1=_0x22c745[_0x445cb7(0x157)]>0x0||_0x582d93[_0x445cb7(0x157)]>0x0||_0x42565d[_0x445cb7(0x157)]>0x0,_0x276cff=_0xd1e42e?![]:_0x54bb7a[_0x445cb7(0x157)]>0x0,_0x5b624e=_0x2ad14a[_0x445cb7(0x157)]>0x0;return{'segments':{'new':_0x41d2c4,'changed':_0x262806,'unchanged':_0x36ebf6,'toDelete':_0x4d3d82},'journeys':{'new':_0x22c745,'changed':_0x582d93,'unchanged':_0x2e2d16,'toDelete':_0x42565d},'activations':{'all':_0x54bb7a,'toCreate':_0x48f92a,'toUpdate':_0x2a9146,'toDelete':_0x4c5ed3},'folders':{'toCreate':_0x2ad14a},'counts':{'segments':{'new':_0x41d2c4[_0x445cb7(0x157)],'changed':_0x262806[_0x445cb7(0x157)],'unchanged':_0x36ebf6[_0x445cb7(0x157)],'toDelete':_0x4d3d82[_0x445cb7(0x157)]},'journeys':{'new':_0x22c745[_0x445cb7(0x157)],'changed':_0x582d93[_0x445cb7(0x157)],'unchanged':_0x2e2d16[_0x445cb7(0x157)],'toDelete':_0x42565d['length']},'activations':{'create':_0x48f92a['length'],'update':_0x2a9146['length'],'delete':_0x4c5ed3[_0x445cb7(0x157)]},'folders':_0x2ad14a[_0x445cb7(0x157)]},'hasChanges':_0x2810de||_0x5a46b1||_0x276cff||_0x5b624e};}export async function buildPushExecutionContext(_0x6e4448,_0x1dab2b,_0x4383f2,_0x29da2f,_0x4a46e6,_0x1a731b){const _0x3f9972=a128_0x33d74d,_0x346083=extractRootFolderId(_0x4383f2),{pathToId:_0x57ec73,idToPath:_0x2df80e}=buildFolderMaps(_0x4a46e6),_0x2058f1=buildSegmentNameToIdMap(_0x29da2f),_0x3aae4d=new Map(),{batchAsync:_0x30d0f5}=await import('../../utils/async.js'),[_0x471813,_0x407e77]=await Promise[_0x3f9972(0x1c8)]([_0x6e4448[_0x3f9972(0x1c0)]['buildUserMaps'](),_0x6e4448['connection'][_0x3f9972(0x21f)](),((async()=>{const _0x34addd=_0x3f9972;!_0x1a731b&&_0x29da2f[_0x34addd(0x157)]>0x0&&await _0x30d0f5(_0x29da2f,async _0x1ba215=>{const _0x46abe7=_0x34addd,_0x3158a5=await _0x6e4448[_0x46abe7(0x159)][_0x46abe7(0x22f)](_0x1dab2b,_0x1ba215['id']);_0x3aae4d[_0x46abe7(0x1e0)](_0x1ba215['id'],_0x3158a5);});})())]),{emailToId:_0x5ed026,idToEmail:_0x1a441f}=_0x471813,_0x4ef6e7=buildConnectionMaps(_0x407e77);return{'rootFolderId':_0x346083,'folderPathToId':_0x57ec73,'folderIdToPath':_0x2df80e,'segmentNameToId':_0x2058f1,'activationsBySegmentId':_0x3aae4d,'emailToIdMap':_0x5ed026,'idToEmailMap':_0x1a441f,'connectionNameToIdMap':_0x4ef6e7[_0x3f9972(0x213)],'connectionIdToNameMap':_0x4ef6e7[_0x3f9972(0x181)],'connectionNameToTypeMap':_0x4ef6e7[_0x3f9972(0x17a)]};}export function createPushYamlContextForBundle(_0x1f215e,_0x572393,_0x489043,_0x416601,_0x1e4e69,_0x2e98f1,_0xab1ec9,_0x4cce91){const {existingLocalSegmentNames:_0x232d54,localExpandedRuleToNames:_0x76b0de}=_0x416601,_0x4e085f=new Set(),_0x52e1c1=new Map(),_0x4d2b82=new Map(),_0x5acff2=new Map(),_0x15b046=createJumpTargetCache(),_0x59a3f5=new Map(),_0x1131b7=new Map(),_0x46473d=new Set();let _0x47b5de;const _0x519d9d=_0x13414f=>{const _0x1ab005={'resolveSegment':async _0x2a031f=>{const _0x31b6ec=a128_0x2900,_0x1b3cee=_0x5acff2['get'](_0x2a031f);if(_0x1b3cee!==undefined)return{'name':_0x1b3cee,'isJourneyLocal':!![]};try{const _0x5d46f0=await fetchSegment(_0x1f215e,_0x572393,_0x2a031f,_0x489043);if(!_0x5d46f0)throw new Error(_0x31b6ec(0x1aa));const _0x4e497f=generateJourneyLocalName(_0x5d46f0['name']),_0x4f311=_0x5d46f0[_0x31b6ec(0x211)]===SEGMENT_KIND_JOURNEY&&_0x4e497f!==undefined;let _0xc27493=_0x5d46f0['name'],_0x2adb26;if(_0x4f311&&_0x5d46f0[_0x31b6ec(0x1ed)]){const _0x598f5c=apiRuleToYaml(_0x5d46f0[_0x31b6ec(0x1ed)]);_0x1131b7[_0x31b6ec(0x1e0)](_0x2a031f,_0x598f5c);const _0x2cb932=async _0x1b0d8c=>{const _0x518552=_0x31b6ec,_0x502b1c=collectSegmentRefsFromRule(_0x1b0d8c);for(const _0x23922f of _0x502b1c){if(!_0x1131b7[_0x518552(0x236)](_0x23922f))try{const _0x4a896f=await fetchSegment(_0x1f215e,_0x572393,_0x23922f,_0x489043);if(_0x4a896f?.['rule']){const _0x4fa0c0=apiRuleToYaml(_0x4a896f[_0x518552(0x1ed)]);_0x1131b7[_0x518552(0x1e0)](_0x23922f,_0x4fa0c0),await _0x2cb932(_0x4fa0c0);}}catch(_0x5b71b9){logger[_0x518552(0x1d1)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x23922f+':\x20'+_0x5b71b9);}}};await _0x2cb932(_0x598f5c);const _0x2cd7f1=serializeExpandedRule(_0x598f5c,_0x1131b7),_0x94cb4=_0x76b0de[_0x31b6ec(0x1f6)](_0x2cd7f1);if(_0x94cb4&&_0x94cb4[_0x31b6ec(0x157)]>0x0){const _0x249bc4=_0x52e1c1[_0x31b6ec(0x1f6)](_0x2cd7f1)||0x0,_0x434c52=_0x94cb4[_0x249bc4]||_0x94cb4[_0x94cb4[_0x31b6ec(0x157)]-0x1];_0x52e1c1[_0x31b6ec(0x1e0)](_0x2cd7f1,_0x249bc4+0x1),_0xc27493=_0x434c52,_0x4e085f[_0x31b6ec(0x1dc)](_0xc27493),_0x5acff2['set'](_0x2a031f,_0xc27493);const _0x298339=await resolveRuleSegmentRefs(_0x598f5c,async _0x5923c1=>{const _0x247526=_0x31b6ec,_0x39fa5b=_0x5acff2[_0x247526(0x1f6)](_0x5923c1);if(_0x39fa5b)return _0x39fa5b;const _0x43d3d6=await _0x47b5de['resolveSegment'](_0x5923c1);return _0x43d3d6[_0x247526(0x187)];});_0x2adb26={'description':_0x5d46f0[_0x31b6ec(0x13c)],'rule':_0x298339};}else{const _0x1dcfb0=_0x59a3f5[_0x31b6ec(0x1f6)](_0x2cd7f1);if(_0x1dcfb0)_0xc27493=_0x1dcfb0,_0x5acff2[_0x31b6ec(0x1e0)](_0x2a031f,_0xc27493);else{if(_0x4e497f){let _0x116800=_0x4e497f,_0x130a86=0x2;while(_0x4e085f[_0x31b6ec(0x236)](_0x116800)||_0x232d54[_0x31b6ec(0x236)](_0x116800)){_0x116800=_0x4e497f+'_'+_0x130a86,_0x130a86++;}_0x4e085f[_0x31b6ec(0x1dc)](_0x116800),_0xc27493=_0x116800;}_0x5acff2[_0x31b6ec(0x1e0)](_0x2a031f,_0xc27493),_0x59a3f5['set'](_0x2cd7f1,_0xc27493);const _0xb01d86=await resolveRuleSegmentRefs(_0x598f5c,async _0xbdd0a5=>{const _0x33d22f=_0x31b6ec,_0x24e5dd=_0x5acff2[_0x33d22f(0x1f6)](_0xbdd0a5);if(_0x24e5dd)return _0x24e5dd;const _0x211b0e=await _0x47b5de[_0x33d22f(0x1f4)](_0xbdd0a5);return _0x211b0e[_0x33d22f(0x187)];});_0x2adb26={'description':_0x5d46f0[_0x31b6ec(0x13c)],'rule':_0xb01d86};}}}return{'name':_0xc27493,'isJourneyLocal':_0x4f311,'definition':_0x2adb26};}catch(_0x5c0e02){return logger[_0x31b6ec(0x1d1)](_0x31b6ec(0x1cb)+_0x2a031f+':\x20'+_0x5c0e02),{'name':_0x2a031f,'isJourneyLocal':![]};}},'resolveActivation':async _0x1adac9=>{const _0x1eb343=a128_0x2900,_0x5245e4=_0x4d2b82[_0x1eb343(0x1f6)](_0x1adac9);if(_0x5245e4!==undefined)return{'name':_0x5245e4,'isJourneyLocal':!![]};try{let _0x68c810=_0xab1ec9?.[_0x1eb343(0x1f6)](_0x1adac9);!_0x68c810&&(_0x68c810=await _0x1f215e[_0x1eb343(0x19e)][_0x1eb343(0x15f)](_0x13414f,_0x1adac9));const _0x4c8828=_0x68c810[_0x1eb343(0x21e)]['activationParams'][_0x1eb343(0x187)]||_0x1adac9,_0x144c1e=sanitizeYamlKey(_0x4c8828)||'activation_'+_0x1adac9,_0x9131d=_0x144c1e;_0x4d2b82['set'](_0x1adac9,_0x9131d);const _0x2b979b=journeyActivationStepToYaml(_0x68c810,_0x1e4e69,_0x2e98f1);return{'name':_0x9131d,'isJourneyLocal':!![],'definition':_0x2b979b};}catch(_0x5d455e){return logger[_0x1eb343(0x1d1)](_0x1eb343(0x1f2)+_0x1adac9+':\x20'+_0x5d455e),{'name':_0x1adac9,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x3ed71d,_0x4d40bd)=>resolveJumpTarget(_0x3ed71d,_0x4d40bd,_0x15b046,async _0x3b0872=>{const _0x100321=a128_0x2900,_0x443911=_0x4cce91?.[_0x100321(0x1f6)](_0x3b0872);if(_0x443911)return _0x443911;return _0x1f215e[_0x100321(0x19e)][_0x100321(0x207)](_0x3b0872);})};return _0x47b5de=_0x1ab005,_0x1ab005;},_0x4463a4=async _0x2903a0=>{const _0x410088=a128_0x2900,{collectSegmentIdsFromJourneyApi:_0x40bddf}=await import('./journey-yaml.js'),{batchAsync:_0x30de61}=await import(_0x410088(0x223)),_0x2d20e6=new Set();for(const _0x17a23b of _0x2903a0){let _0x1faabe=_0x4cce91?.[_0x410088(0x1f6)](_0x17a23b);!_0x1faabe&&(_0x1faabe=await _0x1f215e[_0x410088(0x19e)][_0x410088(0x207)](_0x17a23b));const _0x350aa6=_0x40bddf(_0x1faabe);for(const _0x5f278a of _0x350aa6){_0x2d20e6[_0x410088(0x1dc)](_0x5f278a);}}let _0x10b376=Array[_0x410088(0x1c9)](_0x2d20e6);while(_0x10b376[_0x410088(0x157)]>0x0){const _0x31c4d5=_0x10b376[_0x410088(0x139)](_0x370fbe=>!_0x46473d[_0x410088(0x236)](_0x370fbe));if(_0x31c4d5[_0x410088(0x157)]===0x0)break;const _0x5b03f3=await _0x30de61(_0x31c4d5,async _0x4a76a0=>{const _0x1be21e=_0x410088;_0x46473d[_0x1be21e(0x1dc)](_0x4a76a0);const _0x21dbce=await fetchSegment(_0x1f215e,_0x572393,_0x4a76a0,_0x489043);if(!_0x21dbce)return null;return{'segmentId':_0x4a76a0,'segment':_0x21dbce};},0xa),_0x1c34c1=new Set();for(const _0x1d9668 of _0x5b03f3){if(!_0x1d9668?.['segment']?.[_0x410088(0x1ed)])continue;const _0x5f42d6=apiRuleToYaml(_0x1d9668[_0x410088(0x159)]['rule']);_0x1131b7[_0x410088(0x1e0)](_0x1d9668[_0x410088(0x14f)],_0x5f42d6);const _0x11d87f=collectSegmentRefsFromRule(_0x5f42d6);for(const _0x54a814 of _0x11d87f){!_0x46473d[_0x410088(0x236)](_0x54a814)&&_0x1c34c1[_0x410088(0x1dc)](_0x54a814);}}_0x10b376=Array[_0x410088(0x1c9)](_0x1c34c1);}};return{'createYamlContext':_0x519d9d,'prefetchJourneySegments':_0x4463a4};}export async function executePushSegments(_0x478b3e,_0x4655e6,_0x4ec9be,_0x235d46,_0x5e77f0){const _0x2405a4=a128_0x33d74d,{segmentDefToCreateRequest:_0x4321b6,segmentDefToUpdateRequest:_0x2fb9be}=await import(_0x2405a4(0x14a)),_0x10c556=_0x4ec9be['folderPathToId'],_0x55bfd0=0x5,_0x64b90f=async _0x4e600b=>{const _0x19c122=_0x2405a4,_0x2c49ae=_0x4e600b['folderPath']?_0x10c556['get'](_0x4e600b['folderPath']):undefined;let _0x422a60;const _0x46b848={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x18c188=_0x4e600b[_0x19c122(0x1e1)];if(_0x4e600b['yamlConfig'][_0x19c122(0x1ed)]){const _0x5737d2=createSegmentIdResolver(_0x4ec9be[_0x19c122(0x1d9)],_0x4e600b[_0x19c122(0x1e1)][_0x19c122(0x187)]),_0x3610e5=await resolveRuleSegmentIds(_0x4e600b['yamlConfig']['rule'],_0x5737d2);_0x18c188={..._0x4e600b['yamlConfig'],'rule':_0x3610e5};}try{if(_0x4e600b[_0x19c122(0x151)]){_0x5e77f0[_0x19c122(0x194)]?.({'type':_0x19c122(0x1e5),'name':_0x4e600b['yamlConfig'][_0x19c122(0x187)]});const _0x40f89b=_0x4321b6(_0x18c188,_0x2c49ae),_0x111228=await _0x5e77f0['withProgress']('Creating\x20segment\x20\x27'+_0x4e600b['yamlConfig'][_0x19c122(0x187)]+'\x27...',()=>_0x478b3e[_0x19c122(0x159)][_0x19c122(0x146)](_0x235d46[_0x19c122(0x1db)],_0x40f89b));_0x422a60=_0x111228[_0x19c122(0x21c)]['id'],_0x4ec9be['segmentNameToId']['set'](_0x4e600b[_0x19c122(0x1e1)]['name'],_0x422a60),_0x46b848[_0x19c122(0x1de)]={'name':_0x4e600b[_0x19c122(0x1e1)][_0x19c122(0x187)],'id':_0x422a60},_0x5e77f0[_0x19c122(0x194)]?.({'type':'segment_created','name':_0x4e600b[_0x19c122(0x1e1)]['name'],'segmentId':_0x422a60}),_0x5e77f0[_0x19c122(0x140)]?.(_0x19c122(0x239)+_0x4e600b[_0x19c122(0x1e1)][_0x19c122(0x187)]+'\x27'),_0x46b848[_0x19c122(0x1fb)]=0x1;}else{if(_0x4e600b[_0x19c122(0x201)]){_0x5e77f0[_0x19c122(0x194)]?.({'type':_0x19c122(0x237),'name':_0x4e600b[_0x19c122(0x1e1)][_0x19c122(0x187)]});const _0x19af96=_0x2fb9be(_0x18c188);_0x2c49ae!==_0x4e600b['existingSegment']?.[_0x19c122(0x13e)]&&(_0x19af96[_0x19c122(0x13e)]=_0x2c49ae?parseInt(_0x2c49ae,0xa):undefined),await _0x5e77f0[_0x19c122(0x214)](_0x19c122(0x200)+_0x4e600b[_0x19c122(0x1e1)][_0x19c122(0x187)]+_0x19c122(0x1f0),()=>_0x478b3e[_0x19c122(0x159)][_0x19c122(0x182)](_0x235d46[_0x19c122(0x1db)],_0x4e600b[_0x19c122(0x178)]['id'],_0x19af96)),_0x422a60=_0x4e600b[_0x19c122(0x178)]['id'],_0x5e77f0[_0x19c122(0x194)]?.({'type':_0x19c122(0x19d),'name':_0x4e600b[_0x19c122(0x1e1)][_0x19c122(0x187)]}),_0x5e77f0[_0x19c122(0x140)]?.('Updated\x20segment\x20\x27'+_0x4e600b[_0x19c122(0x1e1)]['name']+'\x27'),_0x46b848[_0x19c122(0x161)]=0x1;}else _0x422a60=_0x4e600b[_0x19c122(0x178)]['id'];}}catch(_0x46e3a4){const _0x2b8907=isHttp400Error(_0x46e3a4),_0x548a30=_0x2b8907?ErrorCode[_0x19c122(0x15a)]:ErrorCode[_0x19c122(0x1ff)],_0x25f2d9=getErrorMessage(_0x46e3a4);throw new SDKError(_0x548a30,'Failed\x20to\x20'+(_0x4e600b[_0x19c122(0x151)]?_0x19c122(0x1bf):_0x19c122(0x172))+'\x20segment\x20from\x20file:\x20'+_0x4e600b[_0x19c122(0x14b)]+'\x0a\x20\x20'+_0x25f2d9,_0x46e3a4);}try{const _0x17d8fc=await syncActivationsForSegment(_0x478b3e,_0x235d46[_0x19c122(0x1db)],_0x422a60,_0x4e600b[_0x19c122(0x1e1)]['name'],_0x4e600b[_0x19c122(0x1ef)],_0x5e77f0,_0x4e600b[_0x19c122(0x14b)]);_0x46b848[_0x19c122(0x238)]=_0x17d8fc;}catch(_0x4c05b8){if(_0x4c05b8 instanceof SDKError)throw _0x4c05b8;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x4e600b['yamlConfig'][_0x19c122(0x187)]+_0x19c122(0x179)+_0x4e600b[_0x19c122(0x14b)]+_0x19c122(0x21b)+getErrorMessage(_0x4c05b8),_0x4c05b8);}return _0x46b848;},_0x33b096=await batchAsync(_0x4655e6,_0x64b90f,_0x55bfd0),_0x1ddc52={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x2a550a of _0x33b096){_0x1ddc52[_0x2405a4(0x1fb)]+=_0x2a550a[_0x2405a4(0x1fb)],_0x1ddc52['updated']+=_0x2a550a['updated'],_0x2a550a['createdSegmentId']&&_0x1ddc52[_0x2405a4(0x193)][_0x2405a4(0x1e0)](_0x2a550a[_0x2405a4(0x1de)][_0x2405a4(0x187)],_0x2a550a[_0x2405a4(0x1de)]['id']),_0x1ddc52['activations'][_0x2405a4(0x1fb)]+=_0x2a550a[_0x2405a4(0x238)][_0x2405a4(0x1fb)],_0x1ddc52[_0x2405a4(0x238)][_0x2405a4(0x161)]+=_0x2a550a[_0x2405a4(0x238)]['updated'],_0x1ddc52[_0x2405a4(0x238)]['deleted']+=_0x2a550a[_0x2405a4(0x238)][_0x2405a4(0x222)];}return _0x1ddc52;}async function syncActivationsForSegment(_0x47421c,_0x4b7494,_0x415361,_0x10bb1e,_0x30d27f,_0x17f44e,_0xd09a54){const _0x41c656=a128_0x33d74d,_0x1cb6a4={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x53fc35 of _0x30d27f){try{if(_0x53fc35['type']===_0x41c656(0x1bf)&&_0x53fc35['validatedRequest'])_0x17f44e[_0x41c656(0x194)]?.({'type':_0x41c656(0x13b),'segmentName':_0x10bb1e,'activationName':_0x53fc35[_0x41c656(0x187)]}),await _0x17f44e[_0x41c656(0x214)](_0x41c656(0x225)+_0x53fc35[_0x41c656(0x187)]+_0x41c656(0x1f0),()=>_0x47421c[_0x41c656(0x159)][_0x41c656(0x209)](_0x4b7494,_0x415361,_0x53fc35[_0x41c656(0x192)])),_0x17f44e['onProgress']?.({'type':'activation_created','segmentName':_0x10bb1e,'activationName':_0x53fc35[_0x41c656(0x187)]}),_0x17f44e[_0x41c656(0x140)]?.(_0x41c656(0x1ca)+_0x53fc35[_0x41c656(0x187)]+'\x27'),_0x1cb6a4[_0x41c656(0x1fb)]++;else{if(_0x53fc35['type']===_0x41c656(0x172)&&_0x53fc35[_0x41c656(0x192)]&&_0x53fc35[_0x41c656(0x16c)])_0x17f44e[_0x41c656(0x194)]?.({'type':_0x41c656(0x17d),'segmentName':_0x10bb1e,'activationName':_0x53fc35[_0x41c656(0x187)]}),await _0x17f44e[_0x41c656(0x214)](_0x41c656(0x20b)+_0x53fc35[_0x41c656(0x187)]+_0x41c656(0x1f0),()=>_0x47421c[_0x41c656(0x159)]['updateActivation'](_0x4b7494,_0x415361,_0x53fc35[_0x41c656(0x16c)]['id'],_0x53fc35[_0x41c656(0x192)])),_0x17f44e[_0x41c656(0x194)]?.({'type':_0x41c656(0x1b6),'segmentName':_0x10bb1e,'activationName':_0x53fc35[_0x41c656(0x187)]}),_0x17f44e[_0x41c656(0x140)]?.('Updated\x20activation\x20\x27'+_0x53fc35[_0x41c656(0x187)]+'\x27'),_0x1cb6a4[_0x41c656(0x161)]++;else _0x53fc35[_0x41c656(0x1f8)]===_0x41c656(0x1df)&&_0x53fc35[_0x41c656(0x16c)]&&(_0x17f44e[_0x41c656(0x194)]?.({'type':_0x41c656(0x150),'segmentName':_0x10bb1e,'activationName':_0x53fc35[_0x41c656(0x187)]}),await _0x17f44e[_0x41c656(0x214)](_0x41c656(0x1fe)+_0x53fc35[_0x41c656(0x187)]+_0x41c656(0x1f0),()=>_0x47421c[_0x41c656(0x159)]['deleteActivation'](_0x4b7494,_0x415361,_0x53fc35[_0x41c656(0x16c)]['id'])),_0x17f44e['onProgress']?.({'type':_0x41c656(0x1a6),'segmentName':_0x10bb1e,'activationName':_0x53fc35[_0x41c656(0x187)]}),_0x17f44e[_0x41c656(0x18e)]?.(_0x41c656(0x20c)+_0x53fc35['name']+'\x27'),_0x1cb6a4[_0x41c656(0x222)]++);}}catch(_0x49102c){const _0x1f21b6=isHttp400Error(_0x49102c),_0x1892fd=_0x1f21b6?ErrorCode[_0x41c656(0x1fd)]:ErrorCode[_0x41c656(0x1c3)],_0x5cdbf9=getErrorMessage(_0x49102c);throw new SDKError(_0x1892fd,_0x41c656(0x1b4)+_0x53fc35[_0x41c656(0x1f8)]+_0x41c656(0x1b0)+_0x53fc35[_0x41c656(0x187)]+'\x27\x20from\x20file:\x20'+_0xd09a54+_0x41c656(0x21b)+_0x5cdbf9,_0x49102c);}}return _0x1cb6a4;}export async function executePushFolders(_0x1802eb,_0x11b618,_0x5f59dc,_0x5076f7,_0x5061bb){const _0x3fe656=a128_0x33d74d,_0x1c5738=new Map(_0x5f59dc),_0x296ead=sortFoldersByDepth(_0x11b618);for(const _0xe57b58 of _0x296ead){const _0x587ab4=_0xe57b58[_0x3fe656(0x152)]('/'),_0x36e3c0=_0x587ab4[_0x587ab4[_0x3fe656(0x157)]-0x1],_0x5ccc2b=_0x587ab4['slice'](0x0,-0x1)[_0x3fe656(0x18d)]('/'),_0x4d5cab=_0x1c5738[_0x3fe656(0x1f6)](_0x5ccc2b);_0x5061bb[_0x3fe656(0x194)]?.({'type':_0x3fe656(0x20e),'folder':_0xe57b58});const _0x326f1f={'name':_0x36e3c0,'parentFolderId':_0x4d5cab},_0x26f616=await _0x5061bb[_0x3fe656(0x214)]('Creating\x20folder\x20\x27'+_0xe57b58+_0x3fe656(0x1f0),()=>_0x1802eb['segment'][_0x3fe656(0x189)](_0x5076f7[_0x3fe656(0x1db)],_0x326f1f));_0x1c5738[_0x3fe656(0x1e0)](_0xe57b58,_0x26f616[_0x3fe656(0x21c)]['id']),_0x5061bb[_0x3fe656(0x194)]?.({'type':_0x3fe656(0x17e),'folder':_0xe57b58,'folderId':_0x26f616[_0x3fe656(0x21c)]['id']}),_0x5061bb[_0x3fe656(0x1c5)]?.(_0x3fe656(0x215)+_0xe57b58+'\x27');}return _0x1c5738;}export async function executePushSegmentDeletions(_0x253a73,_0x34323b,_0x5de546){const _0x3ed129=a128_0x33d74d;if(_0x34323b[_0x3ed129(0x157)]===0x0)return 0x0;const {batchAsync:_0x35b761}=await import(_0x3ed129(0x223)),_0x220039=0x5,_0x5f4b78=await _0x35b761(_0x34323b,async _0x562907=>{const _0x4dae34=_0x3ed129;return _0x5de546[_0x4dae34(0x194)]?.({'type':_0x4dae34(0x1f1),'name':_0x562907[_0x4dae34(0x187)]}),await _0x253a73['segment'][_0x4dae34(0x22b)](_0x562907['id']),_0x5de546[_0x4dae34(0x194)]?.({'type':'segment_deleted','name':_0x562907[_0x4dae34(0x187)]}),_0x5de546['logDeleted']?.(_0x4dae34(0x16a)+_0x562907[_0x4dae34(0x187)]+'\x27'),0x1;},_0x220039);return _0x5f4b78[_0x3ed129(0x22c)]((_0x16127d,_0x4a6e8a)=>_0x16127d+_0x4a6e8a,0x0);}export async function executePushJourneys(_0x366629,_0x3becbd,_0x238112,_0x490b06,_0x5c873b){const _0x2424fc=a128_0x33d74d,{journeyDefToRequest:_0xcd0fdf}=await import(_0x2424fc(0x1f7)),{activationDefToCreateRequest:_0x1084ee,yamlRuleToApi:_0x52abdb,validateSegmentRule:_0x41f1b4}=await import('./child-segment-yaml.js'),_0x39bddf={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x5d9a63=new Map(_0x238112[_0x2424fc(0x1d9)]),_0x5a4b37=0x5;for(let _0x3c8ad7=0x0;_0x3c8ad7<_0x3becbd[_0x2424fc(0x157)];_0x3c8ad7+=_0x5a4b37){const _0x1fc77d=_0x3becbd[_0x2424fc(0x164)](_0x3c8ad7,_0x3c8ad7+_0x5a4b37),_0x5c8f88=await Promise[_0x2424fc(0x1c8)](_0x1fc77d[_0x2424fc(0x143)](async _0x2eed6c=>{const _0x584e9d=_0x2424fc;if(!_0x2eed6c[_0x584e9d(0x151)]&&!_0x2eed6c[_0x584e9d(0x201)])return{'action':_0x584e9d(0x197),'name':_0x2eed6c['yamlConfig'][_0x584e9d(0x187)],'journeyId':_0x2eed6c[_0x584e9d(0x1a8)]?.['id']};const _0xa2ff7a=_0x2eed6c[_0x584e9d(0x22d)]?_0x238112[_0x584e9d(0x1c4)][_0x584e9d(0x1f6)](_0x2eed6c['folderPath']):undefined;_0x5c873b[_0x584e9d(0x194)]?.({'type':_0x2eed6c[_0x584e9d(0x151)]?_0x584e9d(0x1b5):'journey_updating','name':_0x2eed6c['yamlConfig'][_0x584e9d(0x187)]});try{const _0x23a112=await executeSingleJourneyPush(_0x366629,_0x2eed6c,{..._0x238112,'segmentNameToId':_0x5d9a63},{'parentId':_0x490b06['parentId'],'rootFolderId':_0x490b06[_0x584e9d(0x17b)],'folderId':_0xa2ff7a,'verbose':_0x490b06[_0x584e9d(0x1a9)]},_0x5c873b,{'journeyDefToRequest':_0xcd0fdf,'activationDefToCreateRequest':_0x1084ee,'yamlRuleToApi':_0x52abdb,'validateSegmentRule':_0x41f1b4});for(const [_0x439962,_0x150ca6]of _0x23a112[_0x584e9d(0x1a4)]){_0x5d9a63[_0x584e9d(0x1e0)](_0x439962,_0x150ca6),_0x39bddf['embeddedSegmentNameToId'][_0x584e9d(0x1e0)](_0x439962,_0x150ca6);}if(_0x23a112[_0x584e9d(0x144)]==='created')_0x5c873b[_0x584e9d(0x194)]?.({'type':_0x584e9d(0x1f9),'name':_0x2eed6c[_0x584e9d(0x1e1)][_0x584e9d(0x187)],'journeyId':_0x23a112[_0x584e9d(0x1ac)]}),_0x5c873b[_0x584e9d(0x140)]?.(_0x584e9d(0x220)+_0x2eed6c[_0x584e9d(0x1e1)][_0x584e9d(0x187)]+'\x27'),_0x39bddf[_0x584e9d(0x1fb)]++;else _0x23a112['action']===_0x584e9d(0x161)&&(_0x5c873b[_0x584e9d(0x194)]?.({'type':'journey_updated','name':_0x2eed6c[_0x584e9d(0x1e1)][_0x584e9d(0x187)]}),_0x5c873b[_0x584e9d(0x140)]?.('Updated\x20journey\x20\x27'+_0x2eed6c['yamlConfig'][_0x584e9d(0x187)]+'\x27'),_0x39bddf[_0x584e9d(0x161)]++);return{'action':_0x23a112[_0x584e9d(0x144)],'name':_0x2eed6c[_0x584e9d(0x1e1)][_0x584e9d(0x187)],'journeyId':_0x23a112[_0x584e9d(0x1ac)]};}catch(_0x59db6f){const _0x58ac67=isHttp400Error(_0x59db6f),_0x2c7b47=_0x58ac67?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode[_0x584e9d(0x1f5)],_0xdb124=getErrorMessage(_0x59db6f);throw new SDKError(_0x2c7b47,_0x584e9d(0x1b4)+(_0x2eed6c[_0x584e9d(0x151)]?'create':'update')+_0x584e9d(0x228)+_0x2eed6c[_0x584e9d(0x14b)]+_0x584e9d(0x21b)+_0xdb124,_0x59db6f);}}));_0x39bddf[_0x2424fc(0x171)][_0x2424fc(0x1b1)](..._0x5c8f88);}return _0x39bddf;}async function matchExistingJourneySegments(_0x35b543,_0x37dcf4,_0x301cce,_0x48a28f,_0x15ca5c){const _0x21afc2=a128_0x33d74d;if(!_0x37dcf4[_0x21afc2(0x1a8)]||!_0x37dcf4[_0x21afc2(0x1e1)][_0x21afc2(0x199)])return;const _0x4b0b34=new Map(),_0x320a3b=new Set();for(const _0x5f239a of Object['keys'](_0x37dcf4[_0x21afc2(0x1e1)][_0x21afc2(0x199)])){const _0x3d6952=generateDeterministicJourneySegmentName(_0x37dcf4['yamlConfig'][_0x21afc2(0x187)],_0x5f239a);_0x4b0b34[_0x21afc2(0x1e0)](_0x3d6952,_0x5f239a),_0x320a3b[_0x21afc2(0x1dc)](_0x5f239a);}const _0x1a9f7f=[],_0x526dbc=collectSegmentIdsFromJourneyApi(_0x37dcf4[_0x21afc2(0x1a8)]);for(const _0x5ec87c of _0x526dbc){const _0x2a564c=await fetchSegment(_0x35b543,_0x301cce,_0x5ec87c,_0x48a28f);if(!_0x2a564c?.[_0x21afc2(0x187)])continue;const _0x141c2f=_0x4b0b34[_0x21afc2(0x1f6)](_0x2a564c[_0x21afc2(0x187)]);_0x141c2f?(_0x15ca5c[_0x21afc2(0x1e0)](_0x141c2f,_0x5ec87c),_0x320a3b[_0x21afc2(0x1df)](_0x141c2f)):_0x1a9f7f['push']({'id':_0x5ec87c,'seg':_0x2a564c});}if(_0x320a3b[_0x21afc2(0x21d)]>0x0&&_0x1a9f7f[_0x21afc2(0x157)]>0x0){const {localExpandedRuleToNames:_0x40e11f}=buildLocalExpandedRuleMappings(_0x37dcf4[_0x21afc2(0x1e1)]),_0x4bb856=new Map();for(const {id:_0x3aa15a,seg:_0x22af6d}of _0x1a9f7f){if(_0x22af6d[_0x21afc2(0x1ed)]){const _0x93cdd3=apiRuleToYaml(_0x22af6d[_0x21afc2(0x1ed)]);_0x4bb856['set'](_0x3aa15a,_0x93cdd3);}}for(const {id:_0x243a04,seg:_0x510ab4}of _0x1a9f7f){if(!_0x510ab4[_0x21afc2(0x1ed)])continue;const _0x55de9f=_0x4bb856[_0x21afc2(0x1f6)](_0x243a04);if(!_0x55de9f)continue;const _0x104e79=serializeExpandedRule(_0x55de9f,_0x4bb856),_0x12c4a3=_0x40e11f[_0x21afc2(0x1f6)](_0x104e79);if(_0x12c4a3){const _0xa1fad2=_0x12c4a3[_0x21afc2(0x145)](_0x561802=>_0x320a3b[_0x21afc2(0x236)](_0x561802));_0xa1fad2&&(_0x15ca5c[_0x21afc2(0x1e0)](_0xa1fad2,_0x243a04),_0x320a3b['delete'](_0xa1fad2),logger['debug'](_0x21afc2(0x153)+_0x510ab4[_0x21afc2(0x187)]+'\x27\x20to\x20local\x20\x27'+_0xa1fad2+_0x21afc2(0x22e)));}}}}async function executeSingleJourneyPush(_0x3a96fb,_0x1a1e42,_0x4c6f0b,_0x12bf37,_0x425e8b,_0x1f06be){const _0x28c34a=a128_0x33d74d,{journeyDefToRequest:_0x2028b5,activationDefToCreateRequest:_0x4844da,yamlRuleToApi:_0x630f89,validateSegmentRule:_0x2fe8df}=_0x1f06be,_0x1bc990=new Map(),_0x4b33b5=new Map();recoverSegmentIdsFromPushRecovery(_0x1a1e42,_0x1bc990,_0x4c6f0b[_0x28c34a(0x1d9)]);const _0x535f98=new Map(),_0x225a68=new Map(),_0x283077=new Map();let _0x2924c4;const _0x3f6703=async()=>{const _0x1c5c3c=_0x28c34a;if(_0x2924c4)return;_0x2924c4=new Map();if(!_0x1a1e42[_0x1c5c3c(0x1a8)])return;const _0x1aa227=await _0x3a96fb['journey'][_0x1c5c3c(0x22f)](_0x1a1e42['existingJourney']['id']);for(const _0x45e1a3 of _0x1aa227){const _0x489eff=journeyActivationStepToYaml(_0x45e1a3,_0x4c6f0b[_0x1c5c3c(0x20d)],_0x4c6f0b[_0x1c5c3c(0x1fc)]),_0x160390=activationSignature(_0x489eff);!_0x2924c4['has'](_0x160390)&&_0x2924c4[_0x1c5c3c(0x1e0)](_0x160390,_0x45e1a3['id']),_0x489eff[_0x1c5c3c(0x187)]&&_0x4b33b5[_0x1c5c3c(0x1e0)](_0x489eff[_0x1c5c3c(0x187)],_0x45e1a3['id']);}};await matchExistingJourneySegments(_0x3a96fb,_0x1a1e42,_0x12bf37[_0x28c34a(0x1db)],_0x4c6f0b[_0x28c34a(0x165)],_0x4c6f0b[_0x28c34a(0x1d9)]);const _0x319010={'resolveSegmentId':async _0x150a13=>{const _0x3fe02a=_0x28c34a,_0x5b4fe7=_0x4c6f0b[_0x3fe02a(0x1d9)][_0x3fe02a(0x1f6)](_0x150a13);if(!_0x5b4fe7)throw new SDKError(ErrorCode[_0x3fe02a(0x173)],_0x3fe02a(0x13a)+_0x150a13+'\x20(referenced\x20in\x20journey\x20'+_0x1a1e42[_0x3fe02a(0x1e1)][_0x3fe02a(0x187)]+')');return _0x5b4fe7;},'resolveEmbeddedSegmentId':async(_0x14fef3,_0x4931bb)=>{const _0x21176e=_0x28c34a,_0x5717bb=_0x4c6f0b['segmentNameToId'][_0x21176e(0x1f6)](_0x14fef3);if(_0x5717bb)return _0x5717bb;const _0x45b070=_0x4c6f0b[_0x21176e(0x165)][_0x21176e(0x145)](_0xcc3d1e=>_0xcc3d1e['name']===_0x14fef3);if(_0x45b070)return _0x4c6f0b['segmentNameToId']['set'](_0x14fef3,_0x45b070['id']),_0x45b070['id'];if(_0x1a1e42[_0x21176e(0x151)]){const {stageName:_0x55e685,criteriaName:_0xa3d835}=findSegmentCriteriaLocation(_0x1a1e42['yamlConfig'],_0x14fef3);return _0x2fe8df(_0x14fef3,_0x4931bb[_0x21176e(0x1ed)]),_0x225a68[_0x21176e(0x1e0)](_0x14fef3,{'definition':_0x4931bb,'stageName':_0x55e685,'criteriaName':_0xa3d835}),createPendingSegmentId(_0x14fef3);}const _0x238d19=_0x1a1e42[_0x21176e(0x1a8)]?.['id'];if(!_0x238d19)throw new SDKError(ErrorCode[_0x21176e(0x1ba)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x44a379=_0x535f98['get'](_0x14fef3);if(_0x44a379)return _0x44a379;const _0x3f7582=((async()=>{const _0xe70e4f=_0x21176e;_0x2fe8df(_0x14fef3,_0x4931bb[_0xe70e4f(0x1ed)]);const _0x5eed43=generateDeterministicJourneySegmentName(_0x1a1e42[_0xe70e4f(0x1e1)][_0xe70e4f(0x187)],_0x14fef3),_0x41a546=_0x4c6f0b['existingSegments'][_0xe70e4f(0x145)](_0x528caa=>_0x528caa[_0xe70e4f(0x187)]===_0x5eed43),_0x3c0326=createSegmentIdResolver(_0x4c6f0b['segmentNameToId'],_0x14fef3),_0x4483ca=await resolveRuleSegmentIds(_0x4931bb[_0xe70e4f(0x1ed)],_0x3c0326);let _0x57c4b9;return _0x41a546?(await _0x3a96fb[_0xe70e4f(0x159)][_0xe70e4f(0x182)](_0x12bf37[_0xe70e4f(0x1db)],_0x41a546['id'],{'description':_0x4931bb['description']||'Entry\x20criteria:\x20'+_0x14fef3,'rule':_0x630f89(_0x4483ca,!![]),'countPopulation':!![]}),_0x57c4b9=_0x41a546['id'],saveSegmentToPushRecovery(_0x1a1e42[_0xe70e4f(0x14b)],_0x1a1e42[_0xe70e4f(0x1e1)]['name'],_0x14fef3,{'segmentId':_0x57c4b9,'uniqueServerName':_0x5eed43,'createdAt':new Date()[_0xe70e4f(0x1a0)]()})):_0x57c4b9=await createOrRecoverEmbeddedSegment(_0x3a96fb,_0x1a1e42,{'localName':_0x14fef3,'uniqueSegmentName':_0x5eed43,'description':_0x4931bb['description']||'Entry\x20criteria:\x20'+_0x14fef3,'journeyId':_0x238d19,'resolvedRule':_0x4483ca,'parentId':_0x12bf37['parentId'],'folderId':_0x12bf37[_0xe70e4f(0x17b)]||''},_0x630f89),_0x4c6f0b[_0xe70e4f(0x1d9)]['set'](_0x14fef3,_0x57c4b9),_0x1bc990[_0xe70e4f(0x1e0)](_0x14fef3,_0x57c4b9),_0x57c4b9;})());_0x535f98[_0x21176e(0x1e0)](_0x14fef3,_0x3f7582);try{return await _0x3f7582;}finally{_0x535f98[_0x21176e(0x1df)](_0x14fef3);}},'resolveActivationId':async _0x39a34f=>{const _0x3d31fd=_0x28c34a,_0x5ce32c=_0x4b33b5['get'](_0x39a34f);if(_0x5ce32c)return _0x5ce32c;if(_0x1a1e42[_0x3d31fd(0x1a8)]){await _0x3f6703();const _0x34d894=_0x4b33b5[_0x3d31fd(0x1f6)](_0x39a34f);if(_0x34d894)return _0x34d894;}throw new SDKError(ErrorCode[_0x3d31fd(0x234)],_0x3d31fd(0x18b)+_0x39a34f+_0x3d31fd(0x18a)+_0x1a1e42[_0x3d31fd(0x1e1)]['name']+_0x3d31fd(0x1d6)+_0x3d31fd(0x18f));},'resolveEmbeddedActivationId':async(_0x41e6fd,_0x4a1bbc)=>{const _0x37b511=_0x28c34a,_0x26f332=_0x4b33b5['get'](_0x41e6fd);if(_0x26f332)return _0x26f332;if(_0x1a1e42['isNew'])return _0x283077[_0x37b511(0x1e0)](_0x41e6fd,_0x4a1bbc),createPendingActivationId(_0x41e6fd);if(_0x1a1e42[_0x37b511(0x1a8)]){await _0x3f6703();const _0x58f5b9=_0x4b33b5[_0x37b511(0x1f6)](_0x4a1bbc[_0x37b511(0x187)]);if(_0x58f5b9)return _0x4b33b5['set'](_0x41e6fd,_0x58f5b9),_0x58f5b9;const _0x4758c0=activationSignature(_0x4a1bbc),_0x1fa4c3=_0x2924c4?.[_0x37b511(0x1f6)](_0x4758c0);if(_0x1fa4c3)return _0x4b33b5[_0x37b511(0x1e0)](_0x41e6fd,_0x1fa4c3),_0x1fa4c3;const _0x13a232=await _0x4844da(_0x4a1bbc,_0x4c6f0b['activationContext']),_0x57c2e4={..._0x13a232,..._0x4a1bbc[_0x37b511(0x1c6)]!==undefined&&{'runAfterJourneyRefresh':_0x4a1bbc[_0x37b511(0x1c6)]}},_0x44a549=await _0x3a96fb[_0x37b511(0x19e)]['createActivation'](_0x1a1e42[_0x37b511(0x1a8)]['id'],_0x57c2e4);return _0x4b33b5[_0x37b511(0x1e0)](_0x41e6fd,_0x44a549['id']),_0x44a549['id'];}throw new SDKError(ErrorCode[_0x37b511(0x1ba)],_0x37b511(0x183));},'resolveJourneyId':async _0x4fcf0b=>{const _0x124b19=_0x28c34a;try{return await _0x3a96fb[_0x124b19(0x19e)][_0x124b19(0x1c7)](_0x12bf37['parentId'],_0x4fcf0b);}catch(_0x99ed80){throw new SDKError(ErrorCode['NOT_FOUND'],'Journey\x20\x27'+_0x4fcf0b+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x1a1e42['yamlConfig'][_0x124b19(0x187)]+'\x27)',_0x99ed80);}},'resolveStageId':async(_0x4a0373,_0xd6bb0e)=>{const _0x2aac12=_0x28c34a,_0x4320a9=await _0x3a96fb[_0x2aac12(0x19e)][_0x2aac12(0x207)](_0x4a0373),_0x4392f3=_0x4320a9[_0x2aac12(0x21e)][_0x2aac12(0x1b2)][_0x2aac12(0x145)](_0xd109a3=>_0xd109a3[_0x2aac12(0x187)]['toLowerCase']()===_0xd6bb0e['toLowerCase']());if(!_0x4392f3?.['id'])throw new SDKError(ErrorCode[_0x2aac12(0x234)],_0x2aac12(0x229)+_0xd6bb0e+_0x2aac12(0x19b)+(_0x4320a9['attributes'][_0x2aac12(0x19a)]||_0x4320a9[_0x2aac12(0x21e)][_0x2aac12(0x187)])+'\x27');return _0x4392f3['id'];}},_0x13879c=await _0x2028b5(_0x1a1e42[_0x28c34a(0x1e1)],_0x12bf37[_0x28c34a(0x1db)],_0x319010),_0x37a2bd=_0x12bf37['folderId']||_0x12bf37[_0x28c34a(0x17b)];_0x37a2bd&&(_0x13879c['relationships']={'parentFolder':{'data':{'id':_0x37a2bd,'type':'folder'}}});if(_0x1a1e42[_0x28c34a(0x151)]){if(_0x225a68[_0x28c34a(0x21d)]>0x0||_0x283077[_0x28c34a(0x21d)]>0x0)return await executeThreeStepJourneyCreate(_0x3a96fb,_0x1a1e42,_0x13879c,{'pendingEmbeddedSegments':_0x225a68,'pendingEmbeddedActivations':_0x283077,'embeddedSegmentNameToId':_0x1bc990,'journeyActivationNameToId':_0x4b33b5},{..._0x12bf37,'effectiveFolderId':_0x37a2bd},_0x4c6f0b,_0x425e8b,_0x1f06be);else{ensureJourneyDefaults(_0x13879c[_0x28c34a(0x21e)]);const _0x1b258f=await _0x3a96fb['journey']['create'](_0x13879c);return deletePushRecovery(_0x1a1e42[_0x28c34a(0x14b)]),{'action':_0x28c34a(0x1fb),'journeyId':_0x1b258f['id'],'embeddedSegmentNameToId':_0x1bc990};}}else{if(_0x1a1e42[_0x28c34a(0x201)]&&_0x1a1e42[_0x28c34a(0x1a8)]){_0x13879c['id']=_0x1a1e42[_0x28c34a(0x1a8)]['id'];const _0x194c99=_0x13879c['attributes'];_0x1a1e42[_0x28c34a(0x1a8)][_0x28c34a(0x21e)]?.[_0x28c34a(0x19a)]&&(_0x194c99[_0x28c34a(0x19a)]=_0x1a1e42[_0x28c34a(0x1a8)][_0x28c34a(0x21e)]['journeyBundleName']);const _0x880a0b=_0x1a1e42['existingJourney'][_0x28c34a(0x21e)]?.['journeyStages'];return _0x880a0b&&_0x13879c['attributes'][_0x28c34a(0x1b2)]&&injectExistingStageIds(_0x13879c[_0x28c34a(0x21e)][_0x28c34a(0x1b2)],_0x880a0b),ensureJourneyDefaults(_0x194c99),await _0x3a96fb['journey'][_0x28c34a(0x172)](_0x1a1e42['existingJourney']['id'],_0x13879c),deletePushRecovery(_0x1a1e42[_0x28c34a(0x14b)]),{'action':_0x28c34a(0x161),'journeyId':_0x1a1e42[_0x28c34a(0x1a8)]['id'],'embeddedSegmentNameToId':_0x1bc990};}}return deletePushRecovery(_0x1a1e42['absolutePath']),{'action':_0x28c34a(0x197),'journeyId':_0x1a1e42[_0x28c34a(0x1a8)]?.['id'],'embeddedSegmentNameToId':_0x1bc990};}function findSegmentCriteriaLocation(_0x3d69fb,_0x5f3cdb){const _0x263afe=a128_0x33d74d,_0x56c5d0=_0x3d69fb[_0x263afe(0x184)]||_0x3d69fb[_0x263afe(0x1d2)]?.[0x0]?.['stages']||[];let _0x49fd7a='entry',_0x15e2f3=_0x5f3cdb;const _0x2066f7=_0x3d69fb[_0x263afe(0x219)]||_0x3d69fb[_0x263afe(0x1d2)]?.[0x0]?.[_0x263afe(0x219)];if(_0x2066f7?.[_0x263afe(0x159)]===_0x5f3cdb)return{'stageName':_0x263afe(0x219),'criteriaName':_0x2066f7[_0x263afe(0x187)]||_0x5f3cdb};_0x15c391:for(const _0x14f74d of _0x56c5d0){if(_0x14f74d[_0x263afe(0x186)]?.[_0x263afe(0x159)]===_0x5f3cdb){_0x49fd7a=_0x14f74d[_0x263afe(0x187)],_0x15e2f3=_0x14f74d[_0x263afe(0x186)]['name']||_0x5f3cdb;break;}if(_0x14f74d[_0x263afe(0x202)])for(const _0x4d39f5 of _0x14f74d['steps']){if(_0x4d39f5[_0x263afe(0x1f8)]===_0x263afe(0x14d)&&_0x4d39f5[_0x263afe(0x1c1)]?.[_0x263afe(0x19c)])for(const _0x533e79 of _0x4d39f5[_0x263afe(0x1c1)][_0x263afe(0x19c)]){if(_0x533e79[_0x263afe(0x159)]===_0x5f3cdb){_0x49fd7a=_0x14f74d[_0x263afe(0x187)],_0x15e2f3=_0x533e79[_0x263afe(0x187)]||_0x5f3cdb;break _0x15c391;}}}}return{'stageName':_0x49fd7a,'criteriaName':_0x15e2f3};}async function executeThreeStepJourneyCreate(_0x32fa85,_0x5282cf,_0x3f7b93,_0x15916b,_0x1c24be,_0x4f91f9,_0x3b10a1,_0x2af8f5){const _0xf38480=a128_0x33d74d,{activationDefToCreateRequest:_0x362dc7,yamlRuleToApi:_0x183531}=_0x2af8f5,{pendingEmbeddedSegments:_0x2f9a13,pendingEmbeddedActivations:_0x4fab74,embeddedSegmentNameToId:_0xaf2b35}=_0x15916b,_0x60bf17=JSON[_0xf38480(0x160)](JSON['stringify'](_0x3f7b93));ensureJourneyDefaults(_0x60bf17[_0xf38480(0x21e)]),stripPendingIds(_0x60bf17);const _0x70535d=await _0x32fa85['journey'][_0xf38480(0x1bf)](_0x60bf17),_0x4f1d95=_0x70535d['id'],_0x39d486=new Map();for(const _0x16e5b8 of _0x70535d[_0xf38480(0x21e)][_0xf38480(0x1b2)]){_0x39d486['set'](_0x16e5b8[_0xf38480(0x187)][_0xf38480(0x1d7)](),_0x16e5b8['id']);}recoverSegmentIdsFromPushRecovery(_0x5282cf,_0xaf2b35,_0x4f91f9['segmentNameToId']);for(const [_0x12d877,{definition:_0x852789}]of _0x2f9a13){if(_0xaf2b35['has'](_0x12d877)){_0x3b10a1[_0xf38480(0x194)]?.({'type':_0xf38480(0x221),'journeyName':_0x5282cf['yamlConfig'][_0xf38480(0x187)],'segmentName':_0x12d877});continue;}const _0x57ec7c=generateDeterministicJourneySegmentName(_0x5282cf['yamlConfig']['name'],_0x12d877);_0x3b10a1[_0xf38480(0x194)]?.({'type':_0xf38480(0x149),'journeyName':_0x5282cf['yamlConfig']['name'],'segmentName':_0x12d877});const _0x2d5ddc=createSegmentIdResolver(_0x4f91f9[_0xf38480(0x1d9)],_0x12d877),_0x388550=await resolveRuleSegmentIds(_0x852789[_0xf38480(0x1ed)],_0x2d5ddc),_0x3aae06=await createOrRecoverEmbeddedSegment(_0x32fa85,_0x5282cf,{'localName':_0x12d877,'uniqueSegmentName':_0x57ec7c,'description':_0x852789[_0xf38480(0x13c)]||_0xf38480(0x1a1)+_0x12d877,'journeyId':_0x4f1d95,'resolvedRule':_0x388550,'parentId':_0x1c24be[_0xf38480(0x1db)],'folderId':_0x1c24be[_0xf38480(0x135)]||''},_0x183531);_0xaf2b35['set'](_0x12d877,_0x3aae06),_0x4f91f9['segmentNameToId'][_0xf38480(0x1e0)](_0x12d877,_0x3aae06),_0x3b10a1[_0xf38480(0x194)]?.({'type':_0xf38480(0x221),'journeyName':_0x5282cf[_0xf38480(0x1e1)][_0xf38480(0x187)],'segmentName':_0x12d877});}const _0xd94b95=new Map();for(const [_0x201fff,_0x30dd61]of _0x4fab74){_0x3b10a1[_0xf38480(0x194)]?.({'type':'embedded_activation_creating','journeyName':_0x5282cf[_0xf38480(0x1e1)][_0xf38480(0x187)],'activationName':_0x201fff});const _0x544b10=await _0x362dc7(_0x30dd61,_0x4f91f9['activationContext']),_0x1da4dd={..._0x544b10,..._0x30dd61[_0xf38480(0x1c6)]!==undefined&&{'runAfterJourneyRefresh':_0x30dd61[_0xf38480(0x1c6)]}},_0x5339b4=await _0x32fa85[_0xf38480(0x19e)][_0xf38480(0x209)](_0x4f1d95,_0x1da4dd);_0xd94b95[_0xf38480(0x1e0)](_0x201fff,_0x5339b4['id']),_0x15916b[_0xf38480(0x137)][_0xf38480(0x1e0)](_0x201fff,_0x5339b4['id']),_0x3b10a1[_0xf38480(0x194)]?.({'type':_0xf38480(0x1bc),'journeyName':_0x5282cf[_0xf38480(0x1e1)]['name'],'activationName':_0x201fff});}const _0xb4f3ac=JSON[_0xf38480(0x160)](JSON[_0xf38480(0x169)](_0x3f7b93));return _0xb4f3ac['id']=_0x4f1d95,ensureJourneyDefaults(_0xb4f3ac[_0xf38480(0x21e)]),resolvePendingIdsInRequest(_0xb4f3ac,_0x3f7b93,_0x39d486,_0xaf2b35,_0xd94b95,_0x3b10a1),await _0x32fa85['journey']['update'](_0x4f1d95,_0xb4f3ac),deletePushRecovery(_0x5282cf['absolutePath']),{'action':_0xf38480(0x1fb),'journeyId':_0x4f1d95,'embeddedSegmentNameToId':_0xaf2b35};}export function stripWaitStepPendingIds(_0xe5fa8f){const _0x8473a7=a128_0x33d74d,_0x2a2d79=_0xe5fa8f[_0x8473a7(0x163)]&&isPendingSegmentId(_0xe5fa8f[_0x8473a7(0x163)]),_0x4c8167=_0xe5fa8f[_0x8473a7(0x1a5)]?.[_0x8473a7(0x190)](_0x3d3333=>_0x3d3333[_0x8473a7(0x14f)]&&isPendingSegmentId(_0x3d3333[_0x8473a7(0x14f)]));(_0x2a2d79||_0x4c8167)&&(_0xe5fa8f[_0x8473a7(0x198)]=_0x8473a7(0x216),_0xe5fa8f['waitStep']=0x1,_0xe5fa8f[_0x8473a7(0x206)]=_0x8473a7(0x14c),delete _0xe5fa8f[_0x8473a7(0x163)],delete _0xe5fa8f[_0x8473a7(0x1d3)],delete _0xe5fa8f[_0x8473a7(0x188)],delete _0xe5fa8f[_0x8473a7(0x1a5)]);}export function resolveWaitStepPendingIds(_0x52ebb5,_0x44eb5f,_0x177223,_0x1189ca){const _0x1b0d94=a128_0x33d74d;if(_0x44eb5f[_0x1b0d94(0x163)]&&isPendingSegmentId(_0x44eb5f[_0x1b0d94(0x163)])){const _0x5e4074=_0x177223(_0x44eb5f[_0x1b0d94(0x163)],_0x1b0d94(0x1a7)+_0x1189ca+_0x1b0d94(0x1ec));_0x5e4074&&(_0x52ebb5[_0x1b0d94(0x198)]=_0x1b0d94(0x226),_0x52ebb5[_0x1b0d94(0x163)]=_0x5e4074,delete _0x52ebb5[_0x1b0d94(0x20f)],delete _0x52ebb5[_0x1b0d94(0x206)],_0x44eb5f['conditionTimeoutDuration']!==undefined&&(_0x52ebb5[_0x1b0d94(0x1d3)]=_0x44eb5f[_0x1b0d94(0x1d3)]),_0x44eb5f['conditionTimeoutUnit']&&(_0x52ebb5[_0x1b0d94(0x188)]=_0x44eb5f[_0x1b0d94(0x188)]));}if(_0x44eb5f[_0x1b0d94(0x1a5)]){const _0x5d7444=_0x44eb5f[_0x1b0d94(0x1a5)][_0x1b0d94(0x190)](_0x273084=>_0x273084['segmentId']&&isPendingSegmentId(_0x273084[_0x1b0d94(0x14f)]));if(_0x5d7444){const _0x2039a1=_0x44eb5f[_0x1b0d94(0x1a5)]['map'](_0x42199c=>{const _0x37caf7=_0x1b0d94;if(_0x42199c['segmentId']&&isPendingSegmentId(_0x42199c['segmentId'])){const _0x2d7765=_0x177223(_0x42199c[_0x37caf7(0x14f)],_0x37caf7(0x1a7)+_0x1189ca+_0x37caf7(0x1ec));return{..._0x42199c,'segmentId':_0x2d7765||_0x42199c[_0x37caf7(0x14f)]};}return{..._0x42199c};});_0x52ebb5['waitStepType']=_0x1b0d94(0x226),_0x52ebb5['conditions']=_0x2039a1,delete _0x52ebb5[_0x1b0d94(0x20f)],delete _0x52ebb5['waitStepUnit'],delete _0x52ebb5[_0x1b0d94(0x163)],delete _0x52ebb5['conditionTimeoutDuration'],delete _0x52ebb5[_0x1b0d94(0x188)];}}}function stripPendingIds(_0x49844d){const _0x33d556=a128_0x33d74d;_0x49844d[_0x33d556(0x21e)][_0x33d556(0x219)]?.[_0x33d556(0x14f)]&&isPendingSegmentId(_0x49844d['attributes'][_0x33d556(0x219)][_0x33d556(0x14f)])&&delete _0x49844d['attributes'][_0x33d556(0x219)];for(const _0x2c33a7 of _0x49844d[_0x33d556(0x21e)][_0x33d556(0x1b2)]||[]){_0x2c33a7[_0x33d556(0x168)]?.[_0x33d556(0x14f)]&&isPendingSegmentId(_0x2c33a7['entryCriteria'][_0x33d556(0x14f)])&&delete _0x2c33a7[_0x33d556(0x168)];_0x2c33a7[_0x33d556(0x210)]?.[_0x33d556(0x14f)]&&isPendingSegmentId(_0x2c33a7[_0x33d556(0x210)][_0x33d556(0x14f)])&&delete _0x2c33a7[_0x33d556(0x210)];_0x2c33a7[_0x33d556(0x1dd)]&&(_0x2c33a7[_0x33d556(0x1dd)]=_0x2c33a7['exitCriterias']['filter'](_0x349318=>!_0x349318[_0x33d556(0x14f)]||!isPendingSegmentId(_0x349318['segmentId'])));if(_0x2c33a7[_0x33d556(0x202)])for(const _0x12d9b9 of Object['keys'](_0x2c33a7[_0x33d556(0x202)])){const _0x330366=_0x2c33a7[_0x33d556(0x202)][_0x12d9b9];_0x330366[_0x33d556(0x1f8)]===_0x33d556(0x175)&&_0x330366['journeyActivationStepId']&&isPendingActivationId(_0x330366[_0x33d556(0x138)])&&(_0x330366[_0x33d556(0x138)]='');if(_0x330366[_0x33d556(0x1f8)]===_0x33d556(0x1e6)&&_0x330366[_0x33d556(0x19c)])for(const _0x12e59e of _0x330366[_0x33d556(0x19c)]){_0x12e59e['segmentId']&&isPendingSegmentId(_0x12e59e[_0x33d556(0x14f)])&&(_0x12e59e[_0x33d556(0x14f)]='');}_0x330366[_0x33d556(0x1f8)]==='WaitStep'&&stripWaitStepPendingIds(_0x330366);}}}function resolvePendingIdsInRequest(_0x30bb37,_0x203964,_0x22257e,_0xe985e9,_0x339b40,_0x1d7d65){const _0x36a343=a128_0x33d74d,_0x4df2dc=(_0x4cb9d8,_0x3a085a)=>{const _0x422f50=a128_0x2900;if(!isPendingSegmentId(_0x4cb9d8))return _0x4cb9d8;const _0x4364dd=extractPendingSegmentName(_0x4cb9d8),_0x1a0e57=_0xe985e9[_0x422f50(0x1f6)](_0x4364dd);return!_0x1a0e57&&_0x1d7d65[_0x422f50(0x13f)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x4364dd+_0x422f50(0x16d)+_0x3a085a),_0x1a0e57;};if(_0x30bb37[_0x36a343(0x21e)]['goal']?.[_0x36a343(0x14f)]&&isPendingSegmentId(_0x30bb37[_0x36a343(0x21e)]['goal'][_0x36a343(0x14f)])){const _0x2c7848=_0x4df2dc(_0x30bb37[_0x36a343(0x21e)]['goal'][_0x36a343(0x14f)],_0x36a343(0x1b7));_0x2c7848&&(_0x30bb37[_0x36a343(0x21e)]['goal'][_0x36a343(0x14f)]=_0x2c7848);}for(const _0x760cf1 of _0x30bb37['attributes'][_0x36a343(0x1b2)]||[]){const _0x5b1269=_0x22257e[_0x36a343(0x1f6)](_0x760cf1[_0x36a343(0x187)]['toLowerCase']());_0x5b1269&&(_0x760cf1['id']=_0x5b1269);if(_0x760cf1[_0x36a343(0x168)]?.[_0x36a343(0x14f)]&&isPendingSegmentId(_0x760cf1[_0x36a343(0x168)][_0x36a343(0x14f)])){const _0x767b1a=_0x4df2dc(_0x760cf1[_0x36a343(0x168)]['segmentId'],_0x36a343(0x1a7)+_0x760cf1[_0x36a343(0x187)]+_0x36a343(0x1c2));_0x767b1a&&(_0x760cf1['entryCriteria'][_0x36a343(0x14f)]=_0x767b1a);}if(_0x760cf1[_0x36a343(0x1dd)])for(const _0x35c38d of _0x760cf1['exitCriterias']){if(_0x35c38d[_0x36a343(0x14f)]&&isPendingSegmentId(_0x35c38d['segmentId'])){const _0x1935f0=_0x4df2dc(_0x35c38d[_0x36a343(0x14f)],_0x36a343(0x1a7)+_0x760cf1[_0x36a343(0x187)]+'\x27\x20exit\x20criteria');_0x1935f0&&(_0x35c38d[_0x36a343(0x14f)]=_0x1935f0);}}if(_0x760cf1['milestone']?.[_0x36a343(0x14f)]&&isPendingSegmentId(_0x760cf1[_0x36a343(0x210)][_0x36a343(0x14f)])){const _0x5cded0=_0x4df2dc(_0x760cf1[_0x36a343(0x210)][_0x36a343(0x14f)],_0x36a343(0x1a7)+_0x760cf1[_0x36a343(0x187)]+'\x27\x20milestone');_0x5cded0&&(_0x760cf1[_0x36a343(0x210)][_0x36a343(0x14f)]=_0x5cded0);}if(_0x760cf1[_0x36a343(0x202)]){const _0x543935=_0x5c7b2c=>_0x203964[_0x36a343(0x21e)][_0x36a343(0x1b2)]?.[_0x36a343(0x145)](_0x1fa1f9=>_0x1fa1f9[_0x36a343(0x187)][_0x36a343(0x1d7)]()===_0x760cf1[_0x36a343(0x187)][_0x36a343(0x1d7)]())?.[_0x36a343(0x202)]?.[_0x5c7b2c];for(const _0x56669b of Object[_0x36a343(0x1e4)](_0x760cf1[_0x36a343(0x202)])){const _0x1e15d2=_0x760cf1[_0x36a343(0x202)][_0x56669b],_0x5b3c5c=_0x543935(_0x56669b);if(_0x1e15d2[_0x36a343(0x1f8)]==='Activation'&&_0x1e15d2[_0x36a343(0x138)]&&(isPendingActivationId(_0x1e15d2[_0x36a343(0x138)])||_0x1e15d2[_0x36a343(0x138)]==='')){if(_0x5b3c5c?.[_0x36a343(0x138)]&&isPendingActivationId(_0x5b3c5c[_0x36a343(0x138)])){const _0x29fe1f=extractPendingActivationName(_0x5b3c5c[_0x36a343(0x138)]),_0x54ecea=_0x339b40[_0x36a343(0x1f6)](_0x29fe1f);_0x54ecea&&(_0x1e15d2[_0x36a343(0x138)]=_0x54ecea);}}if(_0x1e15d2[_0x36a343(0x1f8)]==='DecisionPoint'&&_0x1e15d2[_0x36a343(0x19c)]&&_0x5b3c5c?.[_0x36a343(0x19c)])for(let _0x190eb7=0x0;_0x190eb7<_0x1e15d2[_0x36a343(0x19c)][_0x36a343(0x157)];_0x190eb7++){const _0x101123=_0x1e15d2[_0x36a343(0x19c)][_0x190eb7],_0x25ea2b=_0x5b3c5c[_0x36a343(0x19c)][_0x190eb7];if(_0x25ea2b?.[_0x36a343(0x14f)]&&isPendingSegmentId(_0x25ea2b[_0x36a343(0x14f)])){const _0x135c24=_0x4df2dc(_0x25ea2b[_0x36a343(0x14f)],_0x36a343(0x1a7)+_0x760cf1[_0x36a343(0x187)]+_0x36a343(0x1da)+(_0x101123[_0x36a343(0x187)]||_0x190eb7)+'\x27');_0x135c24&&(_0x101123[_0x36a343(0x14f)]=_0x135c24);}}_0x1e15d2[_0x36a343(0x1f8)]===_0x36a343(0x1fa)&&_0x5b3c5c?.['type']===_0x36a343(0x1fa)&&resolveWaitStepPendingIds(_0x1e15d2,_0x5b3c5c,_0x4df2dc,_0x760cf1[_0x36a343(0x187)]);}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4db658,_0x3c6621){const _0x53f3f1=a129_0x436f,_0x3ec227=_0x4db658();while(!![]){try{const _0x64d57a=parseInt(_0x53f3f1(0x1c0))/0x1*(parseInt(_0x53f3f1(0x1b3))/0x2)+parseInt(_0x53f3f1(0x1be))/0x3+-parseInt(_0x53f3f1(0x1bc))/0x4*(parseInt(_0x53f3f1(0x1b9))/0x5)+-parseInt(_0x53f3f1(0x1b5))/0x6*(-parseInt(_0x53f3f1(0x1bf))/0x7)+-parseInt(_0x53f3f1(0x1b2))/0x8+-parseInt(_0x53f3f1(0x1ba))/0x9+-parseInt(_0x53f3f1(0x1bd))/0xa*(parseInt(_0x53f3f1(0x1b6))/0xb);if(_0x64d57a===_0x3c6621)break;else _0x3ec227['push'](_0x3ec227['shift']());}catch(_0x5d76f9){_0x3ec227['push'](_0x3ec227['shift']());}}}(a129_0x35e7,0x528c6));export function buildFolderIdToPathMap(_0x22cc8e){const _0x9b304a=a129_0x436f,_0x3d2fde=new Map(),_0x1ca246=new Map();for(const _0xe5cdf of _0x22cc8e){_0x1ca246[_0x9b304a(0x1bb)](_0xe5cdf['id'],_0xe5cdf);}const _0x182bdc=new Set();for(const _0x3af161 of _0x22cc8e){!_0x3af161[_0x9b304a(0x1b7)]&&_0x182bdc[_0x9b304a(0x1c1)](_0x3af161['id']);}function _0x1ca739(_0x1f3a8b){const _0x52e51f=_0x9b304a;if(_0x3d2fde[_0x52e51f(0x1b1)](_0x1f3a8b['id']))return _0x3d2fde[_0x52e51f(0x1b4)](_0x1f3a8b['id']);if(_0x182bdc[_0x52e51f(0x1b1)](_0x1f3a8b['id']))return _0x3d2fde[_0x52e51f(0x1bb)](_0x1f3a8b['id'],''),'';if(_0x1f3a8b['parentFolderId']){const _0x41e772=_0x1ca246[_0x52e51f(0x1b4)](_0x1f3a8b['parentFolderId']);if(_0x41e772){const _0x1b40ab=_0x1ca739(_0x41e772),_0x9cda4a=_0x1b40ab?_0x1b40ab+'/'+_0x1f3a8b[_0x52e51f(0x1b8)]:_0x1f3a8b['name'];return _0x3d2fde['set'](_0x1f3a8b['id'],_0x9cda4a),_0x9cda4a;}}const _0x326851=_0x1f3a8b['name'];return _0x3d2fde['set'](_0x1f3a8b['id'],_0x326851),_0x326851;}for(const _0x241f9c of _0x22cc8e){_0x1ca739(_0x241f9c);}return _0x3d2fde;}export function buildFolderPathToIdMap(_0x25b879){const _0x3e026f=a129_0x436f,_0xe40cfd=new Map(),_0x2c5000=new Map();for(const _0x4f0eda of _0x25b879){_0x2c5000[_0x3e026f(0x1bb)](_0x4f0eda['id'],_0x4f0eda);}const _0xd01a63=new Set();for(const _0x38486e of _0x25b879){!_0x38486e[_0x3e026f(0x1b7)]&&_0xd01a63[_0x3e026f(0x1c1)](_0x38486e['id']);}function _0x576947(_0x12070a){const _0x5628b2=_0x3e026f;if(_0xd01a63[_0x5628b2(0x1b1)](_0x12070a['id']))return'';if(_0x12070a[_0x5628b2(0x1b7)]){const _0x267a28=_0x2c5000[_0x5628b2(0x1b4)](_0x12070a[_0x5628b2(0x1b7)]);if(_0x267a28){const _0x2ee11f=_0x576947(_0x267a28);return _0x2ee11f?_0x2ee11f+'/'+_0x12070a[_0x5628b2(0x1b8)]:_0x12070a[_0x5628b2(0x1b8)];}}return _0x12070a[_0x5628b2(0x1b8)];}for(const _0x3853da of _0x25b879){const _0x13a2ab=_0x576947(_0x3853da);_0xe40cfd[_0x3e026f(0x1bb)](_0x13a2ab,_0x3853da['id']);}return _0xe40cfd;}export function buildFolderMaps(_0x40cb21){const _0x2afec9=a129_0x436f,_0x2eef01=buildFolderIdToPathMap(_0x40cb21),_0x9506a6=new Map();for(const [_0x43a82f,_0x4c10ab]of _0x2eef01){_0x9506a6[_0x2afec9(0x1bb)](_0x4c10ab,_0x43a82f);}return{'idToPath':_0x2eef01,'pathToId':_0x9506a6};}export function getFolderPath(_0x1adb05,_0x3973ce){const _0x5b99f9=a129_0x436f;if(!_0x1adb05)return'';return _0x3973ce[_0x5b99f9(0x1b4)](_0x1adb05)??'';}function a129_0x436f(_0x1a4f47,_0x5aed32){_0x1a4f47=_0x1a4f47-0x1b1;const _0x35e767=a129_0x35e7();let _0x436f06=_0x35e767[_0x1a4f47];return _0x436f06;}function a129_0x35e7(){const _0x879d96=['parentFolderId','name','5eKXyKO','1322568jIxnfU','set','2367672pMbIAA','10wEDoHs','1951473iNSYvt','3733933ihrfME','58cHAalD','add','has','4895200XYpmCm','20972ZtFmgX','get','6GExgqa','1135310hkGTKi'];a129_0x35e7=function(){return _0x879d96;};return a129_0x35e7();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x835d15,_0x1b98dc){const _0x7b207d=a130_0x1316,_0x458eb6=_0x835d15();while(!![]){try{const _0x41a7aa=-parseInt(_0x7b207d(0x12f))/0x1*(parseInt(_0x7b207d(0x129))/0x2)+parseInt(_0x7b207d(0x12d))/0x3+-parseInt(_0x7b207d(0x12e))/0x4+-parseInt(_0x7b207d(0x12b))/0x5+-parseInt(_0x7b207d(0x12a))/0x6*(-parseInt(_0x7b207d(0x141))/0x7)+-parseInt(_0x7b207d(0x13c))/0x8+parseInt(_0x7b207d(0x143))/0x9*(parseInt(_0x7b207d(0x134))/0xa);if(_0x41a7aa===_0x1b98dc)break;else _0x458eb6['push'](_0x458eb6['shift']());}catch(_0x9680b2){_0x458eb6['push'](_0x458eb6['shift']());}}}(a130_0x216f,0x57f46));function a130_0x1316(_0x85db8d,_0x14c676){_0x85db8d=_0x85db8d-0x11b;const _0x216fea=a130_0x216f();let _0x131622=_0x216fea[_0x85db8d];return _0x131622;}import a130_0x45bf9a from'path';import{parse as a130_0x138163}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x1a740e){const _0xd62aea=a130_0x1316;if(!_0x1a740e||_0x1a740e[_0xd62aea(0x127)]()==='')throw new Error(_0xd62aea(0x11f));const _0x5c7069=_0x1a740e[_0xd62aea(0x127)]();if(_0x5c7069==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x1a740e};const _0x5dd305=_0x5c7069[_0xd62aea(0x13d)]('/')?_0x5c7069[_0xd62aea(0x142)](0x1):_0x5c7069,_0x2829d5=_0x5dd305[_0xd62aea(0x121)]('/')[_0xd62aea(0x126)](_0x5db918=>_0x5db918!=='');if(_0x2829d5[_0xd62aea(0x135)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x1143be=_0x5c7069[_0xd62aea(0x13d)]('/')||!isRelativePathSegment(_0x2829d5[0x0]);for(const _0x111371 of _0x2829d5){validatePathSegment(_0x111371);}return{'segments':_0x2829d5,'isAbsolute':_0x1143be,'raw':_0x1a740e};}function isRelativePathSegment(_0x54721b){return _0x54721b==='.'||_0x54721b==='..';}function validatePathSegment(_0x29498f){const _0x3b4193=a130_0x1316;if(_0x29498f==='')throw new Error(_0x3b4193(0x144));if(_0x29498f==='.'||_0x29498f==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x29498f))throw new Error(_0x3b4193(0x139)+_0x29498f);if(_0x29498f!==_0x29498f[_0x3b4193(0x127)]()){}}export function validatePath(_0x4f3c25){const _0x3eede3=a130_0x1316;if(_0x4f3c25[_0x3eede3(0x133)][_0x3eede3(0x135)]===0x0&&!_0x4f3c25['isAbsolute'])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x4f3c25[_0x3eede3(0x13f)]){if(_0x4f3c25[_0x3eede3(0x133)][0x0]==='..')throw new Error(_0x3eede3(0x145));let _0x491078=0x0;for(const _0x389cf6 of _0x4f3c25[_0x3eede3(0x133)]){if(_0x389cf6==='..'){if(_0x491078===0x0)throw new Error(_0x3eede3(0x137));_0x491078--;}else _0x389cf6!=='.'&&_0x491078++;}}}export function joinPaths(_0x23547d,_0x554e2a){const _0x4785e8=a130_0x1316;if(!_0x23547d||_0x23547d==='/')return _0x554e2a;if(!_0x554e2a||_0x554e2a==='.')return _0x23547d;if(_0x554e2a[_0x4785e8(0x13d)]('/'))return _0x554e2a;const _0x733f2b=parsePath(_0x23547d),_0x2ec51a=parsePath(_0x554e2a),_0x235784=[..._0x733f2b[_0x4785e8(0x133)]];for(const _0x579423 of _0x2ec51a[_0x4785e8(0x133)]){if(_0x579423==='.')continue;else{if(_0x579423==='..'){if(_0x235784[_0x4785e8(0x135)]===0x0)throw new Error(_0x4785e8(0x138));_0x235784[_0x4785e8(0x11d)]();}else _0x235784[_0x4785e8(0x11e)](_0x579423);}}const _0xcf7230=_0x235784['join']('/');return _0x733f2b['raw']['startsWith']('/')?'/'+_0xcf7230:_0xcf7230;}export function normalizePath(_0x2efe89){const _0x18a104=a130_0x1316,_0x47e0e7=parsePath(_0x2efe89),_0x4e47eb=[];for(const _0x1b2ab1 of _0x47e0e7['segments']){if(_0x1b2ab1==='.')continue;else{if(_0x1b2ab1==='..'){if(_0x4e47eb[_0x18a104(0x135)]===0x0){if(_0x47e0e7[_0x18a104(0x13f)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x4e47eb[_0x18a104(0x11e)]('..');}else _0x4e47eb[_0x4e47eb[_0x18a104(0x135)]-0x1]==='..'?_0x4e47eb[_0x18a104(0x11e)]('..'):_0x4e47eb[_0x18a104(0x11d)]();}else _0x4e47eb['push'](_0x1b2ab1);}}if(_0x4e47eb[_0x18a104(0x135)]===0x0)return _0x47e0e7[_0x18a104(0x13f)]?'/':'.';const _0x4cca14=_0x4e47eb[_0x18a104(0x146)]('/');return _0x47e0e7['raw'][_0x18a104(0x13d)]('/')?'/'+_0x4cca14:_0x4cca14;}export function getParentPath(_0x1f17ec){const _0x2d12b3=a130_0x1316,_0x448498=parsePath(_0x1f17ec);if(_0x448498[_0x2d12b3(0x133)][_0x2d12b3(0x135)]<=0x1)return'/';const _0x2585d7=_0x448498['segments']['slice'](0x0,-0x1)[_0x2d12b3(0x146)]('/');return _0x448498[_0x2d12b3(0x120)][_0x2d12b3(0x13d)]('/')?'/'+_0x2585d7:_0x2585d7;}export function getBaseName(_0x456d1b){const _0x1d916c=a130_0x1316,_0x5966ff=parsePath(_0x456d1b);return _0x5966ff['segments'][_0x5966ff[_0x1d916c(0x133)][_0x1d916c(0x135)]-0x1]||'';}export function isChildPath(_0x22a0ba,_0x937e2f){const _0x1b5466=a130_0x1316,_0x19acf4=parsePath(_0x22a0ba),_0xd129e9=parsePath(_0x937e2f);if(_0x19acf4['segments'][_0x1b5466(0x135)]<=_0xd129e9['segments'][_0x1b5466(0x135)])return![];for(let _0x206b0b=0x0;_0x206b0b<_0xd129e9[_0x1b5466(0x133)][_0x1b5466(0x135)];_0x206b0b++){if(_0x19acf4[_0x1b5466(0x133)][_0x206b0b]!==_0xd129e9[_0x1b5466(0x133)][_0x206b0b])return![];}return!![];}function a130_0x216f(){const _0x339091=['Cannot\x20navigate\x20above\x20root','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','readFile','File\x20not\x20found:\x20','1454648tEbrzX','startsWith','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','isAbsolute','parse','2177ltFAEP','substring','34641qlKpAC','Path\x20segment\x20cannot\x20be\x20empty','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','join','tdx.json','resolve','parent_segment','pop','push','Path\x20cannot\x20be\x20empty','raw','split','.yaml','segment','exists','journey','filter','trim','Cannot\x20split\x20empty\x20path','118EGiAhV','12882fMxuno','213205bPIzMg','dirname','827853qEIAjv','1302144PVdyxP','2197FdyzRo','No\x20tdx.json\x20found\x20for\x20file:\x20','endsWith','slice','segments','250CMBHbd','length','name','Path\x20attempts\x20to\x20navigate\x20above\x20root'];a130_0x216f=function(){return _0x339091;};return a130_0x216f();}export function splitPath(_0x30c270){const _0x3144a6=a130_0x1316,_0x359060=parsePath(_0x30c270);if(_0x359060[_0x3144a6(0x133)][_0x3144a6(0x135)]===0x0)throw new Error(_0x3144a6(0x128));if(_0x359060[_0x3144a6(0x133)][_0x3144a6(0x135)]===0x1)return{'parent':_0x359060[_0x3144a6(0x133)][0x0]};return{'parent':_0x359060['segments'][0x0],'child':_0x359060[_0x3144a6(0x133)][_0x3144a6(0x132)](0x1)[_0x3144a6(0x146)]('/')};}export function isYamlFilePath(_0x413726){const _0x1ded94=a130_0x1316;return _0x413726[_0x1ded94(0x131)]('.yml')||_0x413726['endsWith'](_0x1ded94(0x122));}export async function resolveYamlFilePath(_0xf90f6f,_0x5402a3=nodeFileSystem){const _0x2d4944=a130_0x1316,_0x2a5615=a130_0x45bf9a[_0x2d4944(0x11b)](_0xf90f6f);if(!await _0x5402a3[_0x2d4944(0x124)](_0x2a5615))throw new Error(_0x2d4944(0x13b)+_0xf90f6f);let _0x3f008b=a130_0x45bf9a[_0x2d4944(0x12c)](_0x2a5615),_0x4ddcb0=null,_0x457842=null;const _0x3bf3ce=a130_0x45bf9a[_0x2d4944(0x140)](_0x3f008b)['root'];while(_0x3f008b!==_0x3bf3ce){const _0x39fc1f=a130_0x45bf9a[_0x2d4944(0x146)](_0x3f008b,_0x2d4944(0x147));if(await _0x5402a3[_0x2d4944(0x124)](_0x39fc1f)){_0x4ddcb0=_0x39fc1f,_0x457842=_0x3f008b;break;}_0x3f008b=a130_0x45bf9a[_0x2d4944(0x12c)](_0x3f008b);}if(!_0x4ddcb0||!_0x457842)throw new Error(_0x2d4944(0x130)+_0xf90f6f+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x3cb129=await _0x5402a3[_0x2d4944(0x13a)](_0x4ddcb0),_0xc642bf=JSON[_0x2d4944(0x140)](_0x3cb129),_0x3aba75=_0xc642bf[_0x2d4944(0x11c)];if(!_0x3aba75)throw new Error(_0x2d4944(0x13e));const _0x1057ef=await _0x5402a3['readFile'](_0x2a5615),_0x512eb2=a130_0x138163(_0x1057ef),_0x384ecb=_0x512eb2[_0x2d4944(0x136)];if(!_0x384ecb)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0xf90f6f);const _0x2acf98=_0x512eb2['type']===_0x2d4944(0x125)?_0x2d4944(0x125):_0x2d4944(0x123),_0x1c00b1=a130_0x45bf9a['relative'](_0x457842,_0x2a5615),_0x698b8b=a130_0x45bf9a['dirname'](_0x1c00b1),_0x4818f3=_0x698b8b==='.'?'':_0x698b8b['replace'](/\\/g,'/'),_0xb41fb9=_0x4818f3?_0x3aba75+'/'+_0x4818f3+'/'+_0x384ecb:_0x3aba75+'/'+_0x384ecb;return{'parentSegment':_0x3aba75,'segmentName':_0x384ecb,'folderPath':_0x4818f3,'fullPath':_0xb41fb9,'resourceType':_0x2acf98,'content':_0x1057ef};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a131_0x5105(_0x1114a5,_0x4b24b6){_0x1114a5=_0x1114a5-0x14f;const _0x26d4d7=a131_0x26d4();let _0x51052c=_0x26d4d7[_0x1114a5];return _0x51052c;}(function(_0x26c3af,_0x2ba4d4){const _0x340b67=a131_0x5105,_0xcf421b=_0x26c3af();while(!![]){try{const _0x52006b=-parseInt(_0x340b67(0x15d))/0x1*(parseInt(_0x340b67(0x158))/0x2)+-parseInt(_0x340b67(0x154))/0x3+parseInt(_0x340b67(0x153))/0x4+-parseInt(_0x340b67(0x15b))/0x5*(parseInt(_0x340b67(0x156))/0x6)+-parseInt(_0x340b67(0x152))/0x7+-parseInt(_0x340b67(0x15a))/0x8*(parseInt(_0x340b67(0x150))/0x9)+-parseInt(_0x340b67(0x151))/0xa*(-parseInt(_0x340b67(0x155))/0xb);if(_0x52006b===_0x2ba4d4)break;else _0xcf421b['push'](_0xcf421b['shift']());}catch(_0x1263cb){_0xcf421b['push'](_0xcf421b['shift']());}}}(a131_0x26d4,0x93dd9));export function parseSegmentRef(_0x1c21f6){const _0x2682b6=a131_0x5105,_0xb0ec70=_0x1c21f6['indexOf']('/');if(_0xb0ec70===-0x1)return{'parentId':_0x1c21f6};if(_0xb0ec70===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x1c21f6+_0x2682b6(0x159));const _0x1dc48f=_0x1c21f6[_0x2682b6(0x157)](0x0,_0xb0ec70),_0x4f9f44=_0x1c21f6[_0x2682b6(0x157)](_0xb0ec70+0x1);if(_0x4f9f44==='')throw new Error(_0x2682b6(0x14f)+_0x1c21f6+_0x2682b6(0x15c));return{'parentId':_0x1dc48f,'childId':_0x4f9f44};}function a131_0x26d4(){const _0x52f512=['Invalid\x20segment\x20reference\x20format:\x20','27TEHdGw','11402250eJvtBT','5429669NlMECZ','3116148ZGZyHK','1843065TBdnQJ','33BbhJCS','1829886vPmsLU','substring','8314CKIcXe','.\x20Parent\x20name\x20cannot\x20be\x20empty','2148696jFUGMz','5POgBtm','.\x20Child\x20name\x20cannot\x20be\x20empty','263lREkGS'];a131_0x26d4=function(){return _0x52f512;};return a131_0x26d4();}
|