@treasuredata/tdx 2026.3.20 → 2026.3.21
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.d.ts +1 -1
- package/dist/cli-categories.js +1 -1
- package/dist/cli-categories.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +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/auth-login-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/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/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-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/policy-command.d.ts +33 -0
- package/dist/commands/policy-command.d.ts.map +1 -0
- package/dist/commands/policy-command.js +1 -0
- package/dist/commands/policy-command.js.map +1 -0
- 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/oauth-keychain.js +1 -1
- package/dist/core/oauth.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/oauth-refresh.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/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-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/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.d.ts +7 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/index.js.map +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/policy.d.ts +41 -0
- package/dist/sdk/policy.d.ts.map +1 -0
- package/dist/sdk/policy.js +1 -0
- package/dist/sdk/policy.js.map +1 -0
- 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.d.ts +1 -0
- package/dist/sdk/types/index.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/index.js.map +1 -1
- package/dist/sdk/types/policy.d.ts +58 -0
- package/dist/sdk/types/policy.d.ts.map +1 -0
- package/dist/sdk/types/policy.js +1 -0
- package/dist/sdk/types/policy.js.map +1 -0
- 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/paginate.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.js +1 -1
- 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 a141_0x48aec1=a141_0xd6ea;(function(_0x3ec0eb,_0x176ec3){const _0x5eced4=a141_0xd6ea,_0x5a6a70=_0x3ec0eb();while(!![]){try{const _0x55d799=-parseInt(_0x5eced4(0x195))/0x1*(parseInt(_0x5eced4(0x19b))/0x2)+parseInt(_0x5eced4(0x186))/0x3*(parseInt(_0x5eced4(0x19a))/0x4)+-parseInt(_0x5eced4(0x18e))/0x5*(-parseInt(_0x5eced4(0x19e))/0x6)+parseInt(_0x5eced4(0x18c))/0x7+parseInt(_0x5eced4(0x194))/0x8+-parseInt(_0x5eced4(0x18a))/0x9*(-parseInt(_0x5eced4(0x198))/0xa)+-parseInt(_0x5eced4(0x196))/0xb;if(_0x55d799===_0x176ec3)break;else _0x5a6a70['push'](_0x5a6a70['shift']());}catch(_0x89c21c){_0x5a6a70['push'](_0x5a6a70['shift']());}}}(a141_0x16c4,0x9ba53));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a141_0x2d28ab from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a141_0x48aec1(0x18b));export function getPushRecoveryPath(_0x5d0e3f){const _0xec4f2d=a141_0x48aec1,_0xaf22c0=a141_0x2d28ab[_0xec4f2d(0x190)](_0x5d0e3f),_0x5a5bf4=a141_0x2d28ab[_0xec4f2d(0x18f)](_0x5d0e3f);return a141_0x2d28ab['join'](_0xaf22c0,'.'+_0x5a5bf4+_0xec4f2d(0x187));}export function readPushRecovery(_0x368270){const _0x5b0779=a141_0x48aec1,_0x210363=getPushRecoveryPath(_0x368270);if(!existsSync(_0x210363))return undefined;try{const _0x997d33=readFileSync(_0x210363,_0x5b0779(0x1a0)),_0x239f1c=JSON[_0x5b0779(0x19d)](_0x997d33);if(_0x239f1c?.[_0x5b0779(0x19c)]!==0x1||typeof _0x239f1c[_0x5b0779(0x185)]!=='string')return undefined;return _0x239f1c;}catch(_0x17549a){return _0x17549a instanceof SyntaxError?logger[_0x5b0779(0x1a1)](_0x5b0779(0x199)+_0x17549a):logger[_0x5b0779(0x19f)](_0x5b0779(0x1a2)+_0x17549a),undefined;}}function a141_0x16c4(){const _0x4d7aa0=['10930gOednr','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','158716kmxDfV','5826vjUuQj','version','parse','49092huoRKR','warn','utf-8','debug','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','journeyName','3SFwIpE','.push-recovery.json','segments','.tmp','3177sGACsD','tdx.sdk.push-recovery','4578525GKzGEh','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','670PsSQuA','basename','dirname','toISOString','code','ENOENT','5975624dineUd','148ytcdFT','20397047lqqFPi','stringify'];a141_0x16c4=function(){return _0x4d7aa0;};return a141_0x16c4();}function a141_0xd6ea(_0x66e304,_0x41aac0){_0x66e304=_0x66e304-0x185;const _0x16c439=a141_0x16c4();let _0xd6eaa4=_0x16c439[_0x66e304];return _0xd6eaa4;}export function writePushRecovery(_0x1b119a,_0xe019ef){const _0x21f904=a141_0x48aec1,_0x4c8f38=getPushRecoveryPath(_0x1b119a),_0x18d5d4=_0x4c8f38+_0x21f904(0x189);writeFileSync(_0x18d5d4,JSON[_0x21f904(0x197)](_0xe019ef,null,0x2)+'\x0a',_0x21f904(0x1a0)),renameSync(_0x18d5d4,_0x4c8f38);}export function deletePushRecovery(_0x181933){const _0x1e7b31=a141_0x48aec1,_0x57f9c2=getPushRecoveryPath(_0x181933);try{unlinkSync(_0x57f9c2);}catch(_0x40d7fa){_0x40d7fa[_0x1e7b31(0x192)]!==_0x1e7b31(0x193)&&logger[_0x1e7b31(0x1a1)](_0x1e7b31(0x18d)+_0x40d7fa);}}export function saveSegmentToPushRecovery(_0x2ac92d,_0x5dd983,_0x21e336,_0x48cd76){const _0x412106=a141_0x48aec1,_0x49400a=readPushRecovery(_0x2ac92d),_0x251b47=_0x49400a?.[_0x412106(0x185)]===_0x5dd983?{..._0x49400a,'updatedAt':new Date()[_0x412106(0x191)]()}:{'version':0x1,'journeyName':_0x5dd983,'updatedAt':new Date()[_0x412106(0x191)](),'segments':{}};_0x251b47[_0x412106(0x188)][_0x21e336]=_0x48cd76,writePushRecovery(_0x2ac92d,_0x251b47);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a140_0x2bcd56=a140_0x275f;(function(_0x1633c1,_0x1be4f3){const _0x3dbe66=a140_0x275f,_0xf416a2=_0x1633c1();while(!![]){try{const _0xe11502=parseInt(_0x3dbe66(0x21f))/0x1*(-parseInt(_0x3dbe66(0x223))/0x2)+parseInt(_0x3dbe66(0x16a))/0x3+parseInt(_0x3dbe66(0x14b))/0x4*(parseInt(_0x3dbe66(0x1c0))/0x5)+-parseInt(_0x3dbe66(0x171))/0x6+parseInt(_0x3dbe66(0x1f7))/0x7*(parseInt(_0x3dbe66(0x144))/0x8)+-parseInt(_0x3dbe66(0x1ee))/0x9*(parseInt(_0x3dbe66(0x19b))/0xa)+parseInt(_0x3dbe66(0x1a0))/0xb;if(_0xe11502===_0x1be4f3)break;else _0xf416a2['push'](_0xf416a2['shift']());}catch(_0x1b3131){_0xf416a2['push'](_0xf416a2['shift']());}}}(a140_0x4a99,0x61e66));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x2bcd56(0x179));export const PENDING_SEGMENT_PREFIX=a140_0x2bcd56(0x226);export const PENDING_ACTIVATION_PREFIX=a140_0x2bcd56(0x16b);export function createPendingSegmentId(_0x581d58){return''+PENDING_SEGMENT_PREFIX+_0x581d58+'__';}export function isPendingSegmentId(_0x14f772){const _0x48685b=a140_0x2bcd56;return _0x14f772[_0x48685b(0x145)](PENDING_SEGMENT_PREFIX)&&!_0x14f772[_0x48685b(0x145)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0xea3d4b){const _0x145fc8=a140_0x2bcd56;return _0xea3d4b[_0x145fc8(0x235)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x2325ae){return''+PENDING_ACTIVATION_PREFIX+_0x2325ae+'__';}export function isPendingActivationId(_0x407fa8){const _0xbc5d7c=a140_0x2bcd56;return _0x407fa8[_0xbc5d7c(0x145)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0xe9d50){return _0xe9d50['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x5c91b6,_0x577f64){const _0x335e15=a140_0x2bcd56,_0x2781d2=_0x5c91b6+'::'+(_0x577f64['trim']()||_0x335e15(0x169)),_0x32bead=createHash(_0x335e15(0x20a))[_0x335e15(0x1d5)](_0x2781d2)[_0x335e15(0x207)](_0x335e15(0x1f2))[_0x335e15(0x18c)](0x0,0xc);return _0x335e15(0x1ab)+_0x32bead;}export function ensureJourneyDefaults(_0x2189e0){const _0x455247=a140_0x2bcd56;!_0x2189e0[_0x455247(0x1ad)]&&(_0x2189e0[_0x455247(0x1ad)]=''),!_0x2189e0[_0x455247(0x150)]&&(_0x2189e0[_0x455247(0x150)]=_0x455247(0x13f));}export function injectExistingStageIds(_0x1ef27a,_0x1cffd6){const _0x126d7f=a140_0x2bcd56,_0x5859c5=new Map(_0x1cffd6[_0x126d7f(0x185)](_0x1e8ec3=>[_0x1e8ec3[_0x126d7f(0x141)],_0x1e8ec3['id']]));for(const _0xb1a958 of _0x1ef27a){if(!_0xb1a958['id']){const _0x4a1a54=_0x5859c5[_0x126d7f(0x195)](_0xb1a958[_0x126d7f(0x141)]);_0x4a1a54&&(_0xb1a958['id']=_0x4a1a54);}}}function a140_0x275f(_0x4165d6,_0x2d9359){_0x4165d6=_0x4165d6-0x13e;const _0x4a99fc=a140_0x4a99();let _0x275f8c=_0x4a99fc[_0x4165d6];return _0x275f8c;}export function resolveTDFolderPath(_0x15d5f6,_0x37f119,_0x26cbca){if(!_0x37f119)return _0x15d5f6;if(_0x15d5f6===_0x26cbca||_0x15d5f6['startsWith'](_0x26cbca+'/'))return _0x15d5f6;return _0x15d5f6?_0x26cbca+'/'+_0x15d5f6:_0x26cbca;}export function addFoldersToCreate(_0x2d6763,_0x55015c,_0x29a9c7){const _0x236869=a140_0x2bcd56;if(!_0x2d6763)return;if(_0x55015c[_0x236869(0x15b)](_0x2d6763))return;const _0x48a660=_0x2d6763[_0x236869(0x180)]('/');let _0x3b5825='';for(const _0xcb25d2 of _0x48a660){_0x3b5825=_0x3b5825?_0x3b5825+'/'+_0xcb25d2:_0xcb25d2,!_0x55015c[_0x236869(0x15b)](_0x3b5825)&&_0x29a9c7[_0x236869(0x192)](_0x3b5825);}}export function sortFoldersByDepth(_0x3724b1){const _0x52452e=a140_0x2bcd56;return[..._0x3724b1][_0x52452e(0x160)]((_0x6316c2,_0x1e0ac8)=>{const _0x1c8020=_0x52452e,_0x1cb1f7=(_0x6316c2[_0x1c8020(0x170)](/\//g)||[])[_0x1c8020(0x1eb)],_0x1d0ebc=(_0x1e0ac8[_0x1c8020(0x170)](/\//g)||[])['length'];return _0x1cb1f7-_0x1d0ebc;});}import*as a140_0x3404f8 from'yaml';import{readFileSync}from'fs';import a140_0x4533d9 from'path';import{isJourneyDef,parseYamlString as a140_0x388d86,toYamlString as a140_0x26ca9c,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(_0xe01c33){const _0x2ef001=a140_0x2bcd56;if(Array['isArray'](_0xe01c33))return'['+_0xe01c33[_0x2ef001(0x185)](_0x17513a=>stableStringify(_0x17513a))[_0x2ef001(0x15d)](',')+']';if(_0xe01c33&&typeof _0xe01c33===_0x2ef001(0x1da)){const _0x5c3ce0=_0xe01c33,_0x58e220=Object['keys'](_0x5c3ce0)['sort'](),_0x1b91b2=_0x58e220[_0x2ef001(0x185)](_0x555201=>'\x22'+_0x555201+'\x22:'+stableStringify(_0x5c3ce0[_0x555201]));return'{'+_0x1b91b2[_0x2ef001(0x15d)](',')+'}';}const _0x30f3e1=JSON[_0x2ef001(0x1f0)](_0xe01c33);return _0x30f3e1===undefined?_0x2ef001(0x1a4):_0x30f3e1;}function activationSignature(_0x5cb0d2){const _0x108b93=a140_0x2bcd56,_0x4be7b8={'connection':_0x5cb0d2[_0x108b93(0x1ea)],..._0x5cb0d2[_0x108b93(0x1d1)]!==undefined&&{'all_columns':_0x5cb0d2[_0x108b93(0x1d1)]},..._0x5cb0d2['columns']!==undefined&&{'columns':_0x5cb0d2['columns']},..._0x5cb0d2[_0x108b93(0x1a9)]!==undefined&&{'behavior':_0x5cb0d2[_0x108b93(0x1a9)]},..._0x5cb0d2['schedule']!==undefined&&{'schedule':_0x5cb0d2[_0x108b93(0x1ae)]},..._0x5cb0d2[_0x108b93(0x17c)]!==undefined&&{'notification':_0x5cb0d2['notification']},..._0x5cb0d2[_0x108b93(0x1cf)]!==undefined&&{'connector_config':_0x5cb0d2[_0x108b93(0x1cf)]},..._0x5cb0d2[_0x108b93(0x21a)]!==undefined&&{'activation_template_id':_0x5cb0d2['activation_template_id']}};return stableStringify(_0x4be7b8);}async function fetchSegment(_0x277cce,_0x50db1b,_0x361ccf,_0xa86aeb){const _0xd33ef4=a140_0x2bcd56,_0x5024d8=_0xa86aeb?.[_0xd33ef4(0x1f9)](_0x1e0ad7=>_0x1e0ad7['id']===_0x361ccf);if(_0x5024d8)return _0x5024d8;try{return await _0x277cce[_0xd33ef4(0x169)][_0xd33ef4(0x148)](_0x50db1b,_0x361ccf);}catch(_0x3254ca){logger['debug']('getSegment\x20failed\x20for\x20'+_0x361ccf+_0xd33ef4(0x1ff)+_0x3254ca);try{return await _0x277cce[_0xd33ef4(0x169)][_0xd33ef4(0x23a)](_0x361ccf);}catch(_0x36e2de){return logger['debug'](_0xd33ef4(0x18f)+_0x361ccf+':\x20'+_0x36e2de),null;}}}function recoverSegmentIdsFromPushRecovery(_0xbacbab,_0x142e16,_0x5e2843){const _0x46459e=a140_0x2bcd56,_0x220c76=readPushRecovery(_0xbacbab['absolutePath']);if(_0x220c76?.['journeyName']===_0xbacbab[_0x46459e(0x1b2)][_0x46459e(0x141)])for(const [_0x4700db,_0x27ccb9]of Object[_0x46459e(0x1b3)](_0x220c76[_0x46459e(0x188)])){const _0x4f6f37=generateDeterministicJourneySegmentName(_0xbacbab['yamlConfig'][_0x46459e(0x141)],_0x4700db);_0x27ccb9[_0x46459e(0x1c9)]===_0x4f6f37&&(_0x142e16[_0x46459e(0x19e)](_0x4700db,_0x27ccb9['segmentId']),_0x5e2843[_0x46459e(0x19e)](_0x4700db,_0x27ccb9[_0x46459e(0x149)]));}}async function createOrRecoverEmbeddedSegment(_0x5d803e,_0x4b44b0,_0x33f670,_0x1619a2){const _0x4082f5=a140_0x2bcd56;let _0x4adbf6;try{_0x4adbf6=await _0x5d803e[_0x4082f5(0x169)][_0x4082f5(0x22a)]({'name':_0x33f670[_0x4082f5(0x1e1)],'description':_0x33f670[_0x4082f5(0x1ad)],'journeyId':_0x33f670[_0x4082f5(0x1bf)],'rule':_0x1619a2(_0x33f670['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x33f670[_0x4082f5(0x229)],'audienceId':_0x33f670[_0x4082f5(0x200)]});}catch(_0x1409cd){const _0x403ffc=_0x1409cd instanceof Error&&_0x1409cd[_0x4082f5(0x21e)][_0x4082f5(0x14a)](_0x4082f5(0x1b0));if(_0x403ffc){const _0x1de811=readPushRecovery(_0x4b44b0[_0x4082f5(0x16c)]),_0x51f36a=_0x1de811?.[_0x4082f5(0x1aa)]===_0x4b44b0['yamlConfig'][_0x4082f5(0x141)]?_0x1de811[_0x4082f5(0x188)][_0x33f670[_0x4082f5(0x154)]]:undefined;if(_0x51f36a?.[_0x4082f5(0x1c9)]===_0x33f670[_0x4082f5(0x1e1)])await _0x5d803e[_0x4082f5(0x169)]['updateSegmentById'](_0x33f670[_0x4082f5(0x200)],_0x51f36a[_0x4082f5(0x149)],{'description':_0x33f670['description'],'rule':_0x1619a2(_0x33f670[_0x4082f5(0x17e)],!![]),'countPopulation':!![]}),_0x4adbf6=_0x51f36a[_0x4082f5(0x149)];else throw new SDKError(ErrorCode[_0x4082f5(0x1c6)],_0x4082f5(0x183)+_0x33f670['localName']+_0x4082f5(0x17f)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x4b44b0[_0x4082f5(0x16c)][_0x4082f5(0x235)](/([^/]+)$/,_0x4082f5(0x1fb))+')\x20')+_0x4082f5(0x146),_0x1409cd);}else throw _0x1409cd;}return saveSegmentToPushRecovery(_0x4b44b0[_0x4082f5(0x16c)],_0x4b44b0[_0x4082f5(0x1b2)][_0x4082f5(0x141)],_0x33f670[_0x4082f5(0x154)],{'segmentId':_0x4adbf6,'uniqueServerName':_0x33f670[_0x4082f5(0x1e1)],'createdAt':new Date()[_0x4082f5(0x174)]()}),_0x4adbf6;}export async function prepareSegmentFiles(_0x49fd55,_0xbb7c19,_0x41081b,_0x399437,_0x1e396d){const _0x5679e7=a140_0x2bcd56,{activationDefToCreateRequest:_0x30c16a}=await import('./child-segment-yaml.js'),_0x4777ba=[],_0x252e01=new Set();for(const {yamlConfig:_0x43f0ed,folderPath:_0x48b923,sourcePath:_0x4b549e}of _0x49fd55){const _0x421651=resolveTDFolderPath(_0x48b923,_0x399437,_0x1e396d),_0x33ba46=_0x421651+':'+_0x43f0ed[_0x5679e7(0x141)],_0x5e5b3b=_0xbb7c19[_0x5679e7(0x1c1)][_0x5679e7(0x195)](_0x33ba46),_0x331a9c=_0x5e5b3b?_0xbb7c19[_0x5679e7(0x23f)]['get'](_0x5e5b3b['id'])||[]:[];addFoldersToCreate(_0x421651,_0xbb7c19[_0x5679e7(0x23e)],_0x252e01);const _0x256a23=calculateActivationActions(_0x43f0ed[_0x5679e7(0x161)]||[],_0x331a9c,_0xbb7c19[_0x5679e7(0x18a)],_0xbb7c19[_0x5679e7(0x177)]);for(const _0x4d70fb of _0x256a23){(_0x4d70fb[_0x5679e7(0x20c)]===_0x5679e7(0x172)||_0x4d70fb['type']===_0x5679e7(0x1d5))&&_0x4d70fb[_0x5679e7(0x1a1)]&&(_0x4d70fb[_0x5679e7(0x157)]=await _0x30c16a(_0x4d70fb[_0x5679e7(0x1a1)],_0x41081b));}const _0x58ec34=calculateSegmentDiff(_0x43f0ed,_0x5e5b3b,_0x331a9c,_0xbb7c19[_0x5679e7(0x18a)],_0xbb7c19[_0x5679e7(0x177)]);_0x4777ba['push']({'relativePath':_0x43f0ed[_0x5679e7(0x141)],'absolutePath':_0x4b549e,'yamlConfig':_0x43f0ed,'folderPath':_0x421651,'existingSegment':_0x5e5b3b,'existingActivations':_0x331a9c,'isNew':_0x58ec34[_0x5679e7(0x1cd)],'hasChanges':_0x58ec34[_0x5679e7(0x21c)],'diff':_0x58ec34[_0x5679e7(0x204)],'activationActions':_0x256a23});}return{'segmentFiles':_0x4777ba,'foldersToCreate':_0x252e01};}export async function prepareJourneyFiles(_0x11d784,_0x7180df,_0x116eb3,_0x13c831){const _0xf131f5=a140_0x2bcd56,_0x127c9e=[],_0x10f437=new Set();for(const {yamlConfig:_0x54370b,folderPath:_0x430091,sourcePath:_0x31e868}of _0x11d784){const _0x2eda22=resolveTDFolderPath(_0x430091,_0x116eb3,_0x13c831),_0x14ffd8=_0x2eda22+':'+_0x54370b[_0xf131f5(0x141)],_0x5e278e=_0x7180df[_0xf131f5(0x142)][_0xf131f5(0x195)](_0x14ffd8);let _0x5d891c,_0x1a2bc4;if(_0x5e278e&&_0x5e278e['length']>0x0){const _0x574a97=buildLocalExpandedRuleMappings(_0x54370b),{createYamlContext:_0x1024f4,prefetchJourneySegments:_0x37b332}=createPushYamlContextForBundle(_0x7180df['deps'],_0x7180df[_0xf131f5(0x200)],_0x7180df[_0xf131f5(0x1b7)],_0x574a97,_0x7180df[_0xf131f5(0x18a)],_0x7180df[_0xf131f5(0x177)],_0x7180df['activationStepsById'],_0x7180df[_0xf131f5(0x193)]);await _0x37b332(_0x5e278e[_0xf131f5(0x185)](_0x3b31e2=>_0x3b31e2['id']));const _0x27f28a=await _0x7180df[_0xf131f5(0x230)][_0xf131f5(0x1f4)][_0xf131f5(0x1fa)](_0x5e278e[0x0][_0xf131f5(0x166)]),_0x23fd6d=hasMultipleVersions(_0x54370b),_0x4288c9=async _0x48f6c4=>{const _0xec63e=_0xf131f5,_0x284293=_0x7180df[_0xec63e(0x193)]?.[_0xec63e(0x195)](_0x48f6c4);if(_0x284293)return _0x284293;return _0x7180df['fetchJourney']({'journeyId':_0x48f6c4,'journeyName':_0x54370b[_0xec63e(0x141)],'isMultiVersion':_0x5e278e['length']>0x1});};if(_0x23fd6d&&_0x5e278e[_0xf131f5(0x1eb)]>0x1){const _0x52cc9c=[];for(const _0x27c4d6 of _0x5e278e){const _0xc594c=_0x27c4d6[_0xf131f5(0x1d7)]||0x1;_0x7180df[_0xf131f5(0x1a5)]?.[_0xf131f5(0x1d5)]('Fetching\x20'+_0x54370b['name']+'\x20v'+_0xc594c);const _0x13be23=await _0x4288c9(_0x27c4d6['id']),_0x3d34f5=_0x1024f4(_0x27c4d6['id']),_0x5e2779=await journeyResponseToDef(_0x13be23,_0x3d34f5);_0x52cc9c[_0xf131f5(0x19d)]({'item':_0x27c4d6,'yaml':_0x5e2779});}const _0xa08c61=buildLocalRuleToNameMappingFromJourney(_0x54370b);_0x1a2bc4=buildMergedJourneyDef(_0x52cc9c,_0xa08c61,_0x27f28a);const _0x2e1009=Math['max'](..._0x52cc9c[_0xf131f5(0x185)](_0x1c1133=>_0x1c1133[_0xf131f5(0x187)][_0xf131f5(0x1d7)]||0x0)),_0x4b914c=_0x5e278e[_0xf131f5(0x1f9)](_0x3a3e92=>(_0x3a3e92[_0xf131f5(0x1d7)]||0x0)===_0x2e1009);_0x4b914c&&(_0x7180df[_0xf131f5(0x1a5)]?.[_0xf131f5(0x1d5)](_0xf131f5(0x1ba)+_0x54370b[_0xf131f5(0x141)]+'\x20v'+_0x2e1009),_0x5d891c=await _0x4288c9(_0x4b914c['id']));}else{const _0x16aedd=_0x5e278e[_0x5e278e[_0xf131f5(0x1eb)]-0x1];_0x7180df[_0xf131f5(0x1a5)]?.[_0xf131f5(0x1d5)](_0xf131f5(0x1ba)+_0x54370b[_0xf131f5(0x141)]),_0x5d891c=await _0x4288c9(_0x16aedd['id']);const _0x4da8d2=_0x1024f4(_0x16aedd['id']),_0x1fe267=await journeyResponseToDef(_0x5d891c,_0x4da8d2),_0xb69451=buildLocalRuleToNameMappingFromJourney(_0x54370b);_0x1a2bc4=buildMergedJourneyDef([{'item':_0x16aedd,'yaml':_0x1fe267}],_0xb69451,_0x27f28a);}}addFoldersToCreate(_0x2eda22,_0x7180df[_0xf131f5(0x23e)],_0x10f437);const _0x2eb69a=calculateJourneyDiff(_0x54370b,_0x1a2bc4);_0x127c9e[_0xf131f5(0x19d)]({'relativePath':_0x54370b[_0xf131f5(0x141)],'absolutePath':_0x31e868,'yamlConfig':_0x54370b,'folderPath':_0x2eda22,'existingJourney':_0x5d891c,'isNew':_0x2eb69a['isNew'],'hasChanges':_0x2eb69a[_0xf131f5(0x21c)],'diff':_0x2eb69a[_0xf131f5(0x204)]});}return{'journeyFiles':_0x127c9e,'foldersToCreate':_0x10f437};}export function calculateActivationActions(_0x41952d,_0xb2d13f,_0x1b465b,_0x149f38){const _0x443068=a140_0x2bcd56,_0x231ea3=[],_0x41bd5d=new Map();for(const _0x75075b of _0xb2d13f){_0x41bd5d[_0x443068(0x19e)](_0x75075b[_0x443068(0x141)],_0x75075b);}const _0x5a69d9=new Map();for(const _0x179893 of _0x41952d){_0x5a69d9[_0x443068(0x19e)](_0x179893[_0x443068(0x141)],_0x179893);}for(const _0x422290 of _0x41952d){const _0x166491=_0x41bd5d[_0x443068(0x195)](_0x422290[_0x443068(0x141)]);if(!_0x166491)_0x231ea3[_0x443068(0x19d)]({'type':_0x443068(0x172),'name':_0x422290[_0x443068(0x141)],'yamlActivation':_0x422290});else{const _0x2d717f=activationResponseToDef(_0x166491,_0x1b465b,_0x149f38),_0x2e4802=a140_0x3404f8[_0x443068(0x1f0)](_0x2d717f),_0xb856a9=a140_0x3404f8[_0x443068(0x1f0)](_0x422290);_0x2e4802!==_0xb856a9&&_0x231ea3['push']({'type':_0x443068(0x1d5),'name':_0x422290[_0x443068(0x141)],'yamlActivation':_0x422290,'existingActivation':_0x166491});}}for(const _0x3301f2 of _0xb2d13f){!_0x5a69d9[_0x443068(0x15b)](_0x3301f2['name'])&&_0x231ea3['push']({'type':_0x443068(0x167),'name':_0x3301f2[_0x443068(0x141)],'existingActivation':_0x3301f2});}return _0x231ea3;}function calculateYamlDiff(_0x59127d,_0x46b1c9){if(_0x46b1c9){const _0x327a7a=generateDiff(_0x46b1c9,_0x59127d),_0x2a9901=hasChanges(_0x327a7a);return{'isNew':![],'hasChanges':_0x2a9901,'diff':_0x2a9901?formatDiffWithColors(_0x327a7a):undefined};}const _0x567e67=generateDiff('',_0x59127d);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x567e67)};}export function calculateSegmentDiff(_0x2fa4b8,_0x598e76,_0x4f0e09,_0x3819c0,_0x174611){const _0x1f570a=segmentToYamlString(_0x2fa4b8),_0xde3604=_0x598e76?segmentToYamlString(segmentWithActivationsToYaml(_0x598e76,_0x4f0e09,undefined,_0x3819c0,_0x174611)):undefined;return calculateYamlDiff(_0x1f570a,_0xde3604);}export function calculateJourneyDiff(_0x13436a,_0x2357cd){const _0x1091ad=normalizeJourneyDef(_0x13436a,_0x13436a),_0x50b266=a140_0x26ca9c(_0x1091ad),_0x3f1440=_0x2357cd?a140_0x26ca9c(normalizeJourneyDef(_0x2357cd,_0x13436a)):undefined;return calculateYamlDiff(_0x50b266,_0x3f1440);}export function findSegmentsToDelete(_0x2a82fc,_0x4356f6,_0x144671,_0x3e3293,_0x30178d){const _0x1079c3=a140_0x2bcd56,_0x29e219=new Set();for(const {yamlConfig:_0x1c4d84,folderPath:_0x34a4bf}of _0x4356f6){_0x29e219[_0x1079c3(0x192)](_0x34a4bf+':'+_0x1c4d84['name']);}return _0x2a82fc[_0x1079c3(0x238)](_0x42cecf=>{const _0x19954c=_0x1079c3,_0x3ac842=_0x42cecf[_0x19954c(0x210)]?_0x144671[_0x19954c(0x195)](_0x42cecf[_0x19954c(0x210)]['toString']())||'':'',_0x225c57=_0x3ac842+':'+_0x42cecf[_0x19954c(0x141)];if(_0x29e219[_0x19954c(0x15b)](_0x225c57))return![];if(_0x30178d)return _0x3ac842===_0x3e3293||_0x3ac842[_0x19954c(0x145)](_0x3e3293+'/');return!![];});}export function findJourneysToDelete(_0x5b2545,_0x28252f,_0x5c2fac,_0x2e704c,_0xff9cfb){const _0x2357ba=a140_0x2bcd56,_0x3615ab=new Set();for(const {yamlConfig:_0x5f3e52,folderPath:_0x4f8fdc}of _0x28252f){_0x3615ab[_0x2357ba(0x192)](_0x4f8fdc+':'+_0x5f3e52[_0x2357ba(0x141)]);}return _0x5b2545[_0x2357ba(0x238)](_0x285115=>{const _0x55622f=_0x2357ba,_0x993a88=_0x285115[_0x55622f(0x229)]?_0x5c2fac['get'](_0x285115[_0x55622f(0x229)])||'':'',_0x33b130=_0x993a88+':'+_0x285115[_0x55622f(0x220)];if(_0x3615ab[_0x55622f(0x15b)](_0x33b130))return![];if(_0xff9cfb)return _0x993a88===_0x2e704c||_0x993a88[_0x55622f(0x145)](_0x2e704c+'/');return!![];});}export function buildSegmentLookupMap(_0x489c6f,_0x47abe5){const _0x2223f3=a140_0x2bcd56,_0x5be2ff=new Map();for(const _0x5cbcbe of _0x489c6f){const _0x3e69da=_0x5cbcbe[_0x2223f3(0x210)]?_0x47abe5[_0x2223f3(0x195)](_0x5cbcbe['segmentFolderId'][_0x2223f3(0x1e9)]())||'':'',_0x186788=_0x3e69da+':'+_0x5cbcbe[_0x2223f3(0x141)];_0x5be2ff[_0x2223f3(0x19e)](_0x186788,_0x5cbcbe);}return _0x5be2ff;}export function buildSegmentNameToIdMap(_0x46123){const _0x463ec7=a140_0x2bcd56,_0x29e02e=new Map();for(const _0x5bc145 of _0x46123){_0x29e02e[_0x463ec7(0x19e)](_0x5bc145[_0x463ec7(0x141)],_0x5bc145['id']);}return _0x29e02e;}export function buildJourneyBundleLookupMap(_0xb52f89,_0x45c5f4){const _0x208672=a140_0x2bcd56,_0x18d68f=new Map();for(const _0x8192d6 of _0xb52f89){const _0x3c039e=_0x8192d6[_0x208672(0x229)]?_0x45c5f4[_0x208672(0x195)](_0x8192d6['folderId'])||'':'',_0x32bf5e=_0x3c039e+':'+_0x8192d6[_0x208672(0x220)];!_0x18d68f[_0x208672(0x15b)](_0x32bf5e)&&_0x18d68f[_0x208672(0x19e)](_0x32bf5e,[]),_0x18d68f['get'](_0x32bf5e)[_0x208672(0x19d)](_0x8192d6);}for(const _0x3fd53c of _0x18d68f[_0x208672(0x19c)]()){_0x3fd53c['sort']((_0x51c11,_0x21e57c)=>(_0x51c11[_0x208672(0x1d7)]||0x0)-(_0x21e57c['versionNumber']||0x0));}return _0x18d68f;}export function collectFoldersToCreate(_0x3be38a,_0x346e6f){const _0x3e894b=a140_0x2bcd56,_0x30a02a=new Set();for(const _0x3d41b6 of _0x3be38a){if(!_0x3d41b6)continue;if(_0x346e6f['has'](_0x3d41b6))continue;const _0x2d2e21=_0x3d41b6[_0x3e894b(0x180)]('/');let _0xf0b343='';for(const _0x40d62c of _0x2d2e21){_0xf0b343=_0xf0b343?_0xf0b343+'/'+_0x40d62c:_0x40d62c,!_0x346e6f['has'](_0xf0b343)&&_0x30a02a[_0x3e894b(0x192)](_0xf0b343);}}return _0x30a02a;}export function parseAndClassifyYamlFiles(_0x5557bd,_0x5a85f2,_0x3cbbd5){const _0x4c0fc7=a140_0x2bcd56,_0x18b67c=[],_0x66eefb=[];for(const _0x44c217 of _0x5557bd){const _0x56c9c0=a140_0x4533d9[_0x4c0fc7(0x152)](_0x5a85f2,a140_0x4533d9[_0x4c0fc7(0x214)](_0x44c217)),_0x2b8718=_0x56c9c0==='.'?'':_0x56c9c0,_0x30b59c=readFileSync(_0x44c217,_0x4c0fc7(0x1be)),_0x36950b=a140_0x3404f8[_0x4c0fc7(0x1ef)](_0x30b59c);if(isJourneyDef(_0x36950b)){const _0x4fe776=a140_0x388d86(_0x30b59c);_0x66eefb[_0x4c0fc7(0x19d)]({'yamlConfig':_0x4fe776,'folderPath':_0x2b8718,'sourcePath':_0x44c217});}else{if(!_0x3cbbd5?.[_0x4c0fc7(0x1d0)]){const _0x4faa81=parseSegmentYamlFile(_0x30b59c),_0x348278=normalizeChildSegmentYaml(_0x4faa81);_0x18b67c[_0x4c0fc7(0x19d)]({'yamlConfig':_0x348278,'folderPath':_0x2b8718,'sourcePath':_0x44c217});}}}return{'segments':_0x18b67c,'journeys':_0x66eefb};}export function validateParsedFiles(_0x1d763e,_0x43f3ed){const _0x5f206b=a140_0x2bcd56,_0x200e01=[];for(const {yamlConfig:_0x3f7062,sourcePath:_0x297b59}of _0x1d763e[_0x5f206b(0x188)]){const _0x52830a=readFileSync(_0x297b59,'utf-8'),_0x2a4978=a140_0x3404f8['parseDocument'](_0x52830a),_0x1de571=validateSegmentDef(_0x3f7062,{'source':_0x52830a,'document':_0x2a4978},{'skipSchema':!![]});if(!_0x1de571[_0x5f206b(0x1cc)]){const _0x442193=a140_0x4533d9[_0x5f206b(0x152)](_0x43f3ed,_0x297b59);_0x200e01[_0x5f206b(0x19d)]({'filePath':_0x442193,'source':_0x52830a,'result':_0x1de571,'isJourney':![]});}}for(const {yamlConfig:_0x2c1b47,sourcePath:_0xd7cf57}of _0x1d763e['journeys']){const _0x19664b=readFileSync(_0xd7cf57,'utf-8'),_0x4551d7=a140_0x3404f8[_0x5f206b(0x20f)](_0x19664b),_0x1253ab=validateJourneyDef(_0x2c1b47,{'source':_0x19664b,'document':_0x4551d7},{'skipSchema':!![]});if(!_0x1253ab[_0x5f206b(0x1cc)]){const _0x605657=a140_0x4533d9[_0x5f206b(0x152)](_0x43f3ed,_0xd7cf57);_0x200e01[_0x5f206b(0x19d)]({'filePath':_0x605657,'source':_0x19664b,'result':_0x1253ab,'isJourney':!![]});}}return _0x200e01;}export function formatValidationErrors(_0x7da5a0){const _0x4808f0=a140_0x2bcd56,_0x5cc365=[];for(const {filePath:_0x2b1da3,source:_0x3ba2b5,result:_0x38fe70,isJourney:_0x5ed265}of _0x7da5a0){const _0x3e4e81=_0x5ed265?'journey':_0x4808f0(0x169);_0x5cc365[_0x4808f0(0x19d)]('\x0a'+_0x2b1da3+'\x20('+_0x3e4e81+'):\x20'+_0x38fe70[_0x4808f0(0x1f8)][_0x4808f0(0x1eb)]+_0x4808f0(0x212)),_0x5cc365[_0x4808f0(0x19d)](formatValidationResult(_0x38fe70,_0x3ba2b5,_0x2b1da3));}return _0x5cc365[_0x4808f0(0x15d)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x504e73){const _0x5429e0=a140_0x2bcd56,_0x3fd340=new Set(),_0x5d0097=new Map(),_0x5884ac=collectSegmentUsageCounts(_0x504e73);if(_0x504e73[_0x5429e0(0x188)])for(const [_0x504d1d,_0x4e08c0]of Object[_0x5429e0(0x1b3)](_0x504e73[_0x5429e0(0x188)])){_0x3fd340['add'](_0x504d1d);if(_0x4e08c0['rule']){const _0x5abd49=yamlRuleToApi(_0x4e08c0[_0x5429e0(0x156)]),_0x2c8797=apiRuleToYaml(_0x5abd49);_0x5d0097[_0x5429e0(0x19e)](_0x504d1d,_0x2c8797);}}const _0x17b02d=new Map();let _0x576562=0x0;for(const [_0x592e45,_0x1ae8e0]of _0x5d0097){const _0x49c3e3=serializeExpandedRule(_0x1ae8e0,_0x5d0097),_0x260ef5=_0x17b02d[_0x5429e0(0x195)](_0x49c3e3)||[];_0x260ef5['push']({'name':_0x592e45,'index':_0x576562}),_0x17b02d[_0x5429e0(0x19e)](_0x49c3e3,_0x260ef5),_0x576562++;}const _0x20060f=new Map();for(const [_0x208211,_0x56ca84]of _0x17b02d){const _0x1afc60=_0x56ca84[_0x5429e0(0x18c)]()[_0x5429e0(0x160)]((_0x2d9190,_0x2a0804)=>{const _0x753236=_0x5429e0,_0x2b6b0e=_0x5884ac[_0x753236(0x195)](_0x2d9190[_0x753236(0x141)])||0x0,_0x4c1e7b=_0x5884ac[_0x753236(0x195)](_0x2a0804[_0x753236(0x141)])||0x0;if(_0x2b6b0e!==_0x4c1e7b)return _0x4c1e7b-_0x2b6b0e;return _0x2d9190[_0x753236(0x13e)]-_0x2a0804[_0x753236(0x13e)];})[_0x5429e0(0x185)](_0x49ab43=>_0x49ab43[_0x5429e0(0x141)]),_0x43477a=[];for(const _0x4fec0b of _0x1afc60){const _0x50661a=_0x5884ac['get'](_0x4fec0b)||0x0,_0x29f65a=Math[_0x5429e0(0x21d)](_0x50661a,0x1);for(let _0x46a4e4=0x0;_0x46a4e4<_0x29f65a;_0x46a4e4++){_0x43477a[_0x5429e0(0x19d)](_0x4fec0b);}}_0x20060f[_0x5429e0(0x19e)](_0x208211,_0x43477a);}return{'existingLocalSegmentNames':_0x3fd340,'localSegmentRules':_0x5d0097,'localExpandedRuleToNames':_0x20060f};}export function createSegmentIdResolver(_0x387e6c,_0x5d46e9){return async _0x278ad7=>{const _0x385f88=a140_0x275f,_0x1459a3=_0x387e6c[_0x385f88(0x195)](_0x278ad7);if(!_0x1459a3)throw new SDKError(ErrorCode[_0x385f88(0x14c)],_0x385f88(0x1dc)+_0x278ad7+_0x385f88(0x203)+_0x5d46e9+'\x27)');return _0x1459a3;};}export function extractRootFolderId(_0x4c68cd){const _0x4815dc=a140_0x2bcd56;return _0x4c68cd[_0x4815dc(0x232)]?.[_0x4815dc(0x211)]?.[_0x4815dc(0x236)]?.['id']||_0x4c68cd[_0x4815dc(0x232)]?.[_0x4815dc(0x197)]?.[_0x4815dc(0x236)]?.['id'];}export function buildConnectionMaps(_0x36d9fa){const _0x4d2e99=a140_0x2bcd56,_0x5cd4cf=new Map(),_0xc201c4=new Map(),_0x237684=new Map();for(const _0x55c701 of _0x36d9fa){_0x5cd4cf['set'](_0x55c701[_0x4d2e99(0x141)],parseInt(_0x55c701['id'],0xa)),_0xc201c4[_0x4d2e99(0x19e)](_0x55c701['id'],_0x55c701[_0x4d2e99(0x141)]),_0x237684[_0x4d2e99(0x19e)](_0x55c701[_0x4d2e99(0x141)],_0x55c701[_0x4d2e99(0x20c)]);}return{'nameToId':_0x5cd4cf,'idToName':_0xc201c4,'nameToType':_0x237684};}function a140_0x4a99(){const _0x23c7bf=['Activation\x20not\x20found:\x20','branches','uniqueServerName','activationContext','embedded_activation_creating','valid','isNew','action','connector_config','skipSegments','all_columns','steps','activationParams','WaitStep','update','getJourney','versionNumber',').\x20','flatMap','object','updated','Segment\x20not\x20found:\x20','activation_','conditionTimeoutUnit','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','\x27\x20by\x20rule\x20content','uniqueSegmentName','\x0a\x20\x20','updateSegmentById','conditionTimeoutDuration','\x27\x20wait\x20condition','\x20(referenced\x20in\x20journey\x20','DecisionPoint','Created\x20journey\x20\x27','toString','connection','length','conditions','deleteSegment','470412mcoedL','parse','stringify','results','hex','embeddedSegmentNameToId','journey','withProgress','decision_point','532yiFzqh','errors','find','getLatestJourneyId','.$1.push-recovery.json','\x27\x20not\x20found\x20in\x20journey\x20\x27','entry','logDeleted',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','parentId','\x27\x20to\x20local\x20\x27','logWarning','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','diff','Creating\x20activation\x20\x27','segment_created','digest','list','./child-segment-yaml.js','sha1','existingSegment','type','exitCriterias','segmentNameToId','parseDocument','segmentFolderId','parentSegmentFolder','\x20error(s)','deleted','dirname','verbose','activation_deleting','logInfo','resolveJourneyId','some','activation_template_id','Condition','hasChanges','max','message','2yOgSyf','journeyBundleName','debug','journey_creating','371534rCdrWR','createdSegmentId','embedded_segment_creating','__pending_','./journey-yaml.js','logSuccess','folderId','createJourneySegment','folder','folderPath','Duration','createdSegmentIds','\x27\x20from\x20file:\x20','deps','NOT_FOUND','relationships','stage\x20\x27','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','replace','data','Created\x20folder\x20\x27','filter','SEGMENT_SYNTAX_ERROR','getSegmentEntity','\x27...','activation_creating','toLowerCase','folderPathToId','activationsBySegmentId','waitStepUnit','Updating\x20activation\x20\x27','idToName','from','ACTIVATION_SYNTAX_ERROR','index','draft','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','name','journeyBundlesByFolderAndName','onProgress','61768nwaJrp','startsWith','and\x20the\x20server\x20segment,\x20then\x20retry.','stages','getSegment','segmentId','includes','20EMjWby','SEGMENT_NOT_FOUND','listActivations','\x20segment\x20from\x20file:\x20','createFolder','state','\x27\x20for\x20','relative','getActivation','localName','Updating\x20segment\x20\x27','rule','validatedRequest','\x20activation\x20\x27','resolveSegment','journeyActivationStepId','has','all','join','rootFolderId','journeyStages','sort','activations','Creating\x20segment\x20\x27','../../utils/async.js','embedded_activation_created','existingJourney','journeyBundleId','delete','Updated\x20activation\x20\x27','segment','1031379KRpwtN','__pending_act_','absolutePath','goal\x20criteria','milestone','\x20journey\x20from\x20file:\x20','match','1465482RmTRRc','create','Updated\x20journey\x20\x27','toISOString','segment_creating','deleteActivation','connectionIdToNameMap','unchanged','tdx.sdk.push-workflow','Created\x20activation\x20\x27','entryCriteria','notification','createSegment','resolvedRule','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','split','Entry\x20criteria:\x20','journey_updated','Embedded\x20segment\x20\x27','goal','map','waitStepType','item','segments','segment_updating','idToEmailMap','Matched\x20server\x20segment\x20\x27','slice','embedded_segment_created','Segment\x20not\x20found','getSegmentEntity\x20also\x20failed\x20for\x20','nameToType','activation_updated','add','journeyById','Failed\x20to\x20','get','waitStep','parentFolder','journeyActivationNameToId','reduce','attributes','110fnIjBQ','values','push','set','keys','4885243PLkJVx','yamlActivation','existingActivation','size','null','progress','run_after_journey_refresh','INTERNAL','\x27\x20milestone','behavior','journeyName','journey_entry_criteria_','conditionSegmentId','description','schedule','ACTIVATION_UPDATE_ERROR','Name\x20has\x20already\x20been\x20taken','\x27\x20entry\x20criteria','yamlConfig','entries','kind','buildUserMaps','Activation','existingSegments','createActivation','activationActions','Fetching\x20','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','with','Deleting\x20activation\x20\x27','utf-8','journeyId','217025PFNKEf','segmentByFolderAndName','activation_created','created','segment_deleting','folder_created','SEGMENT_UPDATE_ERROR'];a140_0x4a99=function(){return _0x23c7bf;};return a140_0x4a99();}export function calculatePushStats(_0x146572,_0x469188,_0x57b3a8,_0x3fdc3f,_0x2e399c,_0x53c831,_0x50dcdc){const _0x2f950e=a140_0x2bcd56,_0x7e98c4=_0x146572['filter'](_0x13048e=>_0x13048e[_0x2f950e(0x1cd)]),_0x1b8717=_0x146572[_0x2f950e(0x238)](_0x2800a6=>!_0x2800a6[_0x2f950e(0x1cd)]&&_0x2800a6[_0x2f950e(0x21c)]),_0x5ae196=_0x146572['filter'](_0x37f936=>!_0x37f936['isNew']&&!_0x37f936[_0x2f950e(0x21c)]),_0x349e6d=_0x53c831?_0x3fdc3f:[],_0x4a9011=_0x469188[_0x2f950e(0x238)](_0x333e43=>_0x333e43[_0x2f950e(0x1cd)]),_0x11a173=_0x469188['filter'](_0x40489a=>!_0x40489a[_0x2f950e(0x1cd)]&&_0x40489a[_0x2f950e(0x21c)]),_0x2f28db=_0x469188[_0x2f950e(0x238)](_0x13cf56=>!_0x13cf56[_0x2f950e(0x1cd)]&&!_0x13cf56[_0x2f950e(0x21c)]),_0x304ad7=_0x53c831?_0x2e399c:[],_0x44a298=_0x146572[_0x2f950e(0x1d9)](_0x3556d8=>_0x3556d8[_0x2f950e(0x1b9)]),_0xd9565b=_0x44a298['filter'](_0x270d7f=>_0x270d7f['type']==='create'),_0x1b6d47=_0x44a298[_0x2f950e(0x238)](_0x27cfa0=>_0x27cfa0[_0x2f950e(0x20c)]===_0x2f950e(0x1d5)),_0x5690f0=_0x44a298['filter'](_0x426532=>_0x426532[_0x2f950e(0x20c)]==='delete'),_0x38081e=Array[_0x2f950e(0x243)](_0x57b3a8)[_0x2f950e(0x160)](),_0x4b9f23=_0x50dcdc?![]:_0x7e98c4[_0x2f950e(0x1eb)]>0x0||_0x1b8717[_0x2f950e(0x1eb)]>0x0||_0x349e6d['length']>0x0,_0x1d77ae=_0x4a9011[_0x2f950e(0x1eb)]>0x0||_0x11a173['length']>0x0||_0x304ad7['length']>0x0,_0x5ca393=_0x50dcdc?![]:_0x44a298[_0x2f950e(0x1eb)]>0x0,_0x29a447=_0x38081e['length']>0x0;return{'segments':{'new':_0x7e98c4,'changed':_0x1b8717,'unchanged':_0x5ae196,'toDelete':_0x349e6d},'journeys':{'new':_0x4a9011,'changed':_0x11a173,'unchanged':_0x2f28db,'toDelete':_0x304ad7},'activations':{'all':_0x44a298,'toCreate':_0xd9565b,'toUpdate':_0x1b6d47,'toDelete':_0x5690f0},'folders':{'toCreate':_0x38081e},'counts':{'segments':{'new':_0x7e98c4[_0x2f950e(0x1eb)],'changed':_0x1b8717[_0x2f950e(0x1eb)],'unchanged':_0x5ae196[_0x2f950e(0x1eb)],'toDelete':_0x349e6d['length']},'journeys':{'new':_0x4a9011[_0x2f950e(0x1eb)],'changed':_0x11a173[_0x2f950e(0x1eb)],'unchanged':_0x2f28db[_0x2f950e(0x1eb)],'toDelete':_0x304ad7[_0x2f950e(0x1eb)]},'activations':{'create':_0xd9565b[_0x2f950e(0x1eb)],'update':_0x1b6d47[_0x2f950e(0x1eb)],'delete':_0x5690f0['length']},'folders':_0x38081e[_0x2f950e(0x1eb)]},'hasChanges':_0x4b9f23||_0x1d77ae||_0x5ca393||_0x29a447};}export async function buildPushExecutionContext(_0x358c90,_0x1f9710,_0xa43b1e,_0x510a20,_0x2b6ebc,_0x42da28){const _0x938511=a140_0x2bcd56,_0x36e082=extractRootFolderId(_0xa43b1e),{pathToId:_0x20d1a7,idToPath:_0x552676}=buildFolderMaps(_0x2b6ebc),_0x5bc952=buildSegmentNameToIdMap(_0x510a20),_0x31ba0d=new Map(),{batchAsync:_0x34932e}=await import(_0x938511(0x163)),[_0x1c6062,_0x4cde4d]=await Promise[_0x938511(0x15c)]([_0x358c90['user'][_0x938511(0x1b5)](),_0x358c90[_0x938511(0x1ea)][_0x938511(0x208)](),((async()=>{const _0x56daa5=_0x938511;!_0x42da28&&_0x510a20[_0x56daa5(0x1eb)]>0x0&&await _0x34932e(_0x510a20,async _0x47f8ad=>{const _0x45be26=await _0x358c90['segment']['listActivations'](_0x1f9710,_0x47f8ad['id']);_0x31ba0d['set'](_0x47f8ad['id'],_0x45be26);});})())]),{emailToId:_0x2d0877,idToEmail:_0x25d695}=_0x1c6062,_0x2c2617=buildConnectionMaps(_0x4cde4d);return{'rootFolderId':_0x36e082,'folderPathToId':_0x20d1a7,'folderIdToPath':_0x552676,'segmentNameToId':_0x5bc952,'activationsBySegmentId':_0x31ba0d,'emailToIdMap':_0x2d0877,'idToEmailMap':_0x25d695,'connectionNameToIdMap':_0x2c2617['nameToId'],'connectionIdToNameMap':_0x2c2617[_0x938511(0x242)],'connectionNameToTypeMap':_0x2c2617[_0x938511(0x190)]};}export function createPushYamlContextForBundle(_0x473c98,_0xc93761,_0x4a34fa,_0x5d51c2,_0xb47c02,_0x518353,_0x5b1113,_0x84244c){const {existingLocalSegmentNames:_0x2a61cc,localExpandedRuleToNames:_0x165be8}=_0x5d51c2,_0x788d=new Set(),_0x19e026=new Map(),_0x1989b4=new Map(),_0x466ff3=new Map(),_0x259092=createJumpTargetCache(),_0xbd2f80=new Map(),_0x1f4d21=new Map(),_0x20d14f=new Set();let _0xc289bd;const _0x3394da=_0x45bc05=>{const _0x545973={'resolveSegment':async _0x4b5ed8=>{const _0x5af5f6=a140_0x275f,_0x5b26ff=_0x466ff3['get'](_0x4b5ed8);if(_0x5b26ff!==undefined)return{'name':_0x5b26ff,'isJourneyLocal':!![]};try{const _0x493610=await fetchSegment(_0x473c98,_0xc93761,_0x4b5ed8,_0x4a34fa);if(!_0x493610)throw new Error(_0x5af5f6(0x18e));const _0xd51846=generateJourneyLocalName(_0x493610['name']),_0x142e47=_0x493610[_0x5af5f6(0x1b4)]===SEGMENT_KIND_JOURNEY&&_0xd51846!==undefined;let _0x358c57=_0x493610[_0x5af5f6(0x141)],_0x15b3d4;if(_0x142e47&&_0x493610[_0x5af5f6(0x156)]){const _0x1a286f=apiRuleToYaml(_0x493610[_0x5af5f6(0x156)]);_0x1f4d21[_0x5af5f6(0x19e)](_0x4b5ed8,_0x1a286f);const _0x3075a7=async _0x2b8c38=>{const _0x2faf25=_0x5af5f6,_0x245fb8=collectSegmentRefsFromRule(_0x2b8c38);for(const _0x494673 of _0x245fb8){if(!_0x1f4d21['has'](_0x494673))try{const _0x2d0b3f=await fetchSegment(_0x473c98,_0xc93761,_0x494673,_0x4a34fa);if(_0x2d0b3f?.[_0x2faf25(0x156)]){const _0x134fc5=apiRuleToYaml(_0x2d0b3f['rule']);_0x1f4d21[_0x2faf25(0x19e)](_0x494673,_0x134fc5),await _0x3075a7(_0x134fc5);}}catch(_0x56c06c){logger[_0x2faf25(0x221)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x494673+':\x20'+_0x56c06c);}}};await _0x3075a7(_0x1a286f);const _0x5c825f=serializeExpandedRule(_0x1a286f,_0x1f4d21),_0x160f5c=_0x165be8['get'](_0x5c825f);if(_0x160f5c&&_0x160f5c['length']>0x0){const _0x1f0503=_0x19e026['get'](_0x5c825f)||0x0,_0x4236fd=_0x160f5c[_0x1f0503]||_0x160f5c[_0x160f5c[_0x5af5f6(0x1eb)]-0x1];_0x19e026['set'](_0x5c825f,_0x1f0503+0x1),_0x358c57=_0x4236fd,_0x788d[_0x5af5f6(0x192)](_0x358c57),_0x466ff3[_0x5af5f6(0x19e)](_0x4b5ed8,_0x358c57);const _0x58376a=await resolveRuleSegmentRefs(_0x1a286f,async _0x10a2ce=>{const _0x3f5039=_0x5af5f6,_0x35b5e9=_0x466ff3[_0x3f5039(0x195)](_0x10a2ce);if(_0x35b5e9)return _0x35b5e9;const _0x4e93f1=await _0xc289bd[_0x3f5039(0x159)](_0x10a2ce);return _0x4e93f1[_0x3f5039(0x141)];});_0x15b3d4={'description':_0x493610['description'],'rule':_0x58376a};}else{const _0x4907e3=_0xbd2f80[_0x5af5f6(0x195)](_0x5c825f);if(_0x4907e3)_0x358c57=_0x4907e3,_0x466ff3['set'](_0x4b5ed8,_0x358c57);else{if(_0xd51846){let _0x440c57=_0xd51846,_0x4eef75=0x2;while(_0x788d[_0x5af5f6(0x15b)](_0x440c57)||_0x2a61cc[_0x5af5f6(0x15b)](_0x440c57)){_0x440c57=_0xd51846+'_'+_0x4eef75,_0x4eef75++;}_0x788d[_0x5af5f6(0x192)](_0x440c57),_0x358c57=_0x440c57;}_0x466ff3[_0x5af5f6(0x19e)](_0x4b5ed8,_0x358c57),_0xbd2f80[_0x5af5f6(0x19e)](_0x5c825f,_0x358c57);const _0x4969ea=await resolveRuleSegmentRefs(_0x1a286f,async _0x2dc3f1=>{const _0x2b0e96=_0x5af5f6,_0x2b9e78=_0x466ff3[_0x2b0e96(0x195)](_0x2dc3f1);if(_0x2b9e78)return _0x2b9e78;const _0x1b2fd0=await _0xc289bd['resolveSegment'](_0x2dc3f1);return _0x1b2fd0[_0x2b0e96(0x141)];});_0x15b3d4={'description':_0x493610[_0x5af5f6(0x1ad)],'rule':_0x4969ea};}}}return{'name':_0x358c57,'isJourneyLocal':_0x142e47,'definition':_0x15b3d4};}catch(_0x2ba0d5){return logger[_0x5af5f6(0x221)]('Failed\x20to\x20resolve\x20segment\x20'+_0x4b5ed8+':\x20'+_0x2ba0d5),{'name':_0x4b5ed8,'isJourneyLocal':![]};}},'resolveActivation':async _0x5154f4=>{const _0x4b0750=a140_0x275f,_0x4ca7db=_0x1989b4[_0x4b0750(0x195)](_0x5154f4);if(_0x4ca7db!==undefined)return{'name':_0x4ca7db,'isJourneyLocal':!![]};try{let _0x2bc24f=_0x5b1113?.[_0x4b0750(0x195)](_0x5154f4);!_0x2bc24f&&(_0x2bc24f=await _0x473c98[_0x4b0750(0x1f4)][_0x4b0750(0x153)](_0x45bc05,_0x5154f4));const _0x3910f1=_0x2bc24f['attributes'][_0x4b0750(0x1d3)][_0x4b0750(0x141)]||_0x5154f4,_0x4d1a12=sanitizeYamlKey(_0x3910f1)||_0x4b0750(0x1dd)+_0x5154f4,_0x52b296=_0x4d1a12;_0x1989b4[_0x4b0750(0x19e)](_0x5154f4,_0x52b296);const _0x3010a1=journeyActivationStepToYaml(_0x2bc24f,_0xb47c02,_0x518353);return{'name':_0x52b296,'isJourneyLocal':!![],'definition':_0x3010a1};}catch(_0x54bb62){return logger[_0x4b0750(0x221)]('Failed\x20to\x20resolve\x20activation\x20'+_0x5154f4+':\x20'+_0x54bb62),{'name':_0x5154f4,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x4b7a54,_0x417d16)=>resolveJumpTarget(_0x4b7a54,_0x417d16,_0x259092,async _0x23846e=>{const _0x3730b4=a140_0x275f,_0x425783=_0x84244c?.[_0x3730b4(0x195)](_0x23846e);if(_0x425783)return _0x425783;return _0x473c98['journey'][_0x3730b4(0x1d6)](_0x23846e);})};return _0xc289bd=_0x545973,_0x545973;},_0x58f274=async _0x2e0aa9=>{const _0x31fef5=a140_0x275f,{collectSegmentIdsFromJourneyApi:_0x2914cb}=await import(_0x31fef5(0x227)),{batchAsync:_0x3e4eb0}=await import(_0x31fef5(0x163)),_0xb94efe=new Set();for(const _0x28e696 of _0x2e0aa9){let _0x399c7d=_0x84244c?.['get'](_0x28e696);!_0x399c7d&&(_0x399c7d=await _0x473c98[_0x31fef5(0x1f4)]['getJourney'](_0x28e696));const _0x3b87ef=_0x2914cb(_0x399c7d);for(const _0x2c9e1a of _0x3b87ef){_0xb94efe[_0x31fef5(0x192)](_0x2c9e1a);}}let _0xc24500=Array[_0x31fef5(0x243)](_0xb94efe);while(_0xc24500[_0x31fef5(0x1eb)]>0x0){const _0x4f7bb2=_0xc24500[_0x31fef5(0x238)](_0x24e483=>!_0x20d14f[_0x31fef5(0x15b)](_0x24e483));if(_0x4f7bb2[_0x31fef5(0x1eb)]===0x0)break;const _0x557d72=await _0x3e4eb0(_0x4f7bb2,async _0x1f87bd=>{_0x20d14f['add'](_0x1f87bd);const _0x311f9d=await fetchSegment(_0x473c98,_0xc93761,_0x1f87bd,_0x4a34fa);if(!_0x311f9d)return null;return{'segmentId':_0x1f87bd,'segment':_0x311f9d};},0xa),_0x7d0794=new Set();for(const _0x4926f0 of _0x557d72){if(!_0x4926f0?.[_0x31fef5(0x169)]?.[_0x31fef5(0x156)])continue;const _0x351213=apiRuleToYaml(_0x4926f0['segment'][_0x31fef5(0x156)]);_0x1f4d21[_0x31fef5(0x19e)](_0x4926f0[_0x31fef5(0x149)],_0x351213);const _0x2c5e1a=collectSegmentRefsFromRule(_0x351213);for(const _0xaad08a of _0x2c5e1a){!_0x20d14f['has'](_0xaad08a)&&_0x7d0794['add'](_0xaad08a);}}_0xc24500=Array['from'](_0x7d0794);}};return{'createYamlContext':_0x3394da,'prefetchJourneySegments':_0x58f274};}export async function executePushSegments(_0x2fcdd8,_0x5de0cf,_0x8617d5,_0x59390a,_0x374c3a){const _0x570023=a140_0x2bcd56,{segmentDefToCreateRequest:_0x3087cd,segmentDefToUpdateRequest:_0x52366d}=await import(_0x570023(0x209)),_0x46bb67=_0x8617d5['folderPathToId'],_0x2ee73c=0x5,_0x234f46=async _0x4c0a73=>{const _0x4a31ad=_0x570023,_0x250dc3=_0x4c0a73[_0x4a31ad(0x22c)]?_0x46bb67[_0x4a31ad(0x195)](_0x4c0a73[_0x4a31ad(0x22c)]):undefined;let _0x50178a;const _0x219e33={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x161853=_0x4c0a73[_0x4a31ad(0x1b2)];if(_0x4c0a73[_0x4a31ad(0x1b2)]['rule']){const _0x293536=createSegmentIdResolver(_0x8617d5[_0x4a31ad(0x20e)],_0x4c0a73[_0x4a31ad(0x1b2)][_0x4a31ad(0x141)]),_0xa1a510=await resolveRuleSegmentIds(_0x4c0a73[_0x4a31ad(0x1b2)][_0x4a31ad(0x156)],_0x293536);_0x161853={..._0x4c0a73[_0x4a31ad(0x1b2)],'rule':_0xa1a510};}try{if(_0x4c0a73[_0x4a31ad(0x1cd)]){_0x374c3a[_0x4a31ad(0x143)]?.({'type':_0x4a31ad(0x175),'name':_0x4c0a73[_0x4a31ad(0x1b2)][_0x4a31ad(0x141)]});const _0x316e91=_0x3087cd(_0x161853,_0x250dc3),_0x15719a=await _0x374c3a['withProgress'](_0x4a31ad(0x162)+_0x4c0a73['yamlConfig'][_0x4a31ad(0x141)]+_0x4a31ad(0x23b),()=>_0x2fcdd8['segment'][_0x4a31ad(0x17d)](_0x59390a['parentId'],_0x316e91));_0x50178a=_0x15719a[_0x4a31ad(0x236)]['id'],_0x8617d5[_0x4a31ad(0x20e)][_0x4a31ad(0x19e)](_0x4c0a73[_0x4a31ad(0x1b2)][_0x4a31ad(0x141)],_0x50178a),_0x219e33['createdSegmentId']={'name':_0x4c0a73[_0x4a31ad(0x1b2)][_0x4a31ad(0x141)],'id':_0x50178a},_0x374c3a[_0x4a31ad(0x143)]?.({'type':_0x4a31ad(0x206),'name':_0x4c0a73['yamlConfig']['name'],'segmentId':_0x50178a}),_0x374c3a[_0x4a31ad(0x228)]?.('Created\x20segment\x20\x27'+_0x4c0a73[_0x4a31ad(0x1b2)][_0x4a31ad(0x141)]+'\x27'),_0x219e33[_0x4a31ad(0x1c3)]=0x1;}else{if(_0x4c0a73[_0x4a31ad(0x21c)]){_0x374c3a[_0x4a31ad(0x143)]?.({'type':_0x4a31ad(0x189),'name':_0x4c0a73['yamlConfig'][_0x4a31ad(0x141)]});const _0x5941bc=_0x52366d(_0x161853);_0x250dc3!==_0x4c0a73[_0x4a31ad(0x20b)]?.['segmentFolderId']&&(_0x5941bc[_0x4a31ad(0x210)]=_0x250dc3?parseInt(_0x250dc3,0xa):undefined),await _0x374c3a['withProgress'](_0x4a31ad(0x155)+_0x4c0a73['yamlConfig'][_0x4a31ad(0x141)]+'\x27...',()=>_0x2fcdd8[_0x4a31ad(0x169)][_0x4a31ad(0x1e3)](_0x59390a[_0x4a31ad(0x200)],_0x4c0a73[_0x4a31ad(0x20b)]['id'],_0x5941bc)),_0x50178a=_0x4c0a73[_0x4a31ad(0x20b)]['id'],_0x374c3a[_0x4a31ad(0x143)]?.({'type':'segment_updated','name':_0x4c0a73[_0x4a31ad(0x1b2)][_0x4a31ad(0x141)]}),_0x374c3a[_0x4a31ad(0x228)]?.('Updated\x20segment\x20\x27'+_0x4c0a73[_0x4a31ad(0x1b2)][_0x4a31ad(0x141)]+'\x27'),_0x219e33[_0x4a31ad(0x1db)]=0x1;}else _0x50178a=_0x4c0a73[_0x4a31ad(0x20b)]['id'];}}catch(_0x4169b1){const _0x349133=isHttp400Error(_0x4169b1),_0x323618=_0x349133?ErrorCode[_0x4a31ad(0x239)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0xd91881=getErrorMessage(_0x4169b1);throw new SDKError(_0x323618,'Failed\x20to\x20'+(_0x4c0a73[_0x4a31ad(0x1cd)]?_0x4a31ad(0x172):_0x4a31ad(0x1d5))+_0x4a31ad(0x14e)+_0x4c0a73[_0x4a31ad(0x16c)]+_0x4a31ad(0x1e2)+_0xd91881,_0x4169b1);}try{const _0x303995=await syncActivationsForSegment(_0x2fcdd8,_0x59390a[_0x4a31ad(0x200)],_0x50178a,_0x4c0a73[_0x4a31ad(0x1b2)]['name'],_0x4c0a73[_0x4a31ad(0x1b9)],_0x374c3a,_0x4c0a73[_0x4a31ad(0x16c)]);_0x219e33[_0x4a31ad(0x161)]=_0x303995;}catch(_0x237402){if(_0x237402 instanceof SDKError)throw _0x237402;throw new SDKError(ErrorCode[_0x4a31ad(0x1af)],_0x4a31ad(0x234)+_0x4c0a73[_0x4a31ad(0x1b2)][_0x4a31ad(0x141)]+_0x4a31ad(0x22f)+_0x4c0a73[_0x4a31ad(0x16c)]+_0x4a31ad(0x1e2)+getErrorMessage(_0x237402),_0x237402);}return _0x219e33;},_0x162fb4=await batchAsync(_0x5de0cf,_0x234f46,_0x2ee73c),_0x87c7c3={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x3b72b8 of _0x162fb4){_0x87c7c3[_0x570023(0x1c3)]+=_0x3b72b8[_0x570023(0x1c3)],_0x87c7c3[_0x570023(0x1db)]+=_0x3b72b8[_0x570023(0x1db)],_0x3b72b8[_0x570023(0x224)]&&_0x87c7c3[_0x570023(0x22e)]['set'](_0x3b72b8[_0x570023(0x224)][_0x570023(0x141)],_0x3b72b8['createdSegmentId']['id']),_0x87c7c3[_0x570023(0x161)][_0x570023(0x1c3)]+=_0x3b72b8[_0x570023(0x161)][_0x570023(0x1c3)],_0x87c7c3[_0x570023(0x161)]['updated']+=_0x3b72b8[_0x570023(0x161)][_0x570023(0x1db)],_0x87c7c3['activations']['deleted']+=_0x3b72b8[_0x570023(0x161)][_0x570023(0x213)];}return _0x87c7c3;}async function syncActivationsForSegment(_0x911773,_0x4420d0,_0x25250d,_0x2ba399,_0x557198,_0x7aca9,_0xce03ad){const _0x457631=a140_0x2bcd56,_0x377253={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x305135 of _0x557198){try{if(_0x305135[_0x457631(0x20c)]==='create'&&_0x305135[_0x457631(0x157)])_0x7aca9[_0x457631(0x143)]?.({'type':_0x457631(0x23c),'segmentName':_0x2ba399,'activationName':_0x305135['name']}),await _0x7aca9[_0x457631(0x1f5)](_0x457631(0x205)+_0x305135[_0x457631(0x141)]+_0x457631(0x23b),()=>_0x911773[_0x457631(0x169)][_0x457631(0x1b8)](_0x4420d0,_0x25250d,_0x305135[_0x457631(0x157)])),_0x7aca9[_0x457631(0x143)]?.({'type':_0x457631(0x1c2),'segmentName':_0x2ba399,'activationName':_0x305135[_0x457631(0x141)]}),_0x7aca9[_0x457631(0x228)]?.(_0x457631(0x17a)+_0x305135[_0x457631(0x141)]+'\x27'),_0x377253[_0x457631(0x1c3)]++;else{if(_0x305135[_0x457631(0x20c)]===_0x457631(0x1d5)&&_0x305135['validatedRequest']&&_0x305135[_0x457631(0x1a2)])_0x7aca9[_0x457631(0x143)]?.({'type':'activation_updating','segmentName':_0x2ba399,'activationName':_0x305135[_0x457631(0x141)]}),await _0x7aca9[_0x457631(0x1f5)](_0x457631(0x241)+_0x305135['name']+_0x457631(0x23b),()=>_0x911773[_0x457631(0x169)]['updateActivation'](_0x4420d0,_0x25250d,_0x305135[_0x457631(0x1a2)]['id'],_0x305135[_0x457631(0x157)])),_0x7aca9[_0x457631(0x143)]?.({'type':_0x457631(0x191),'segmentName':_0x2ba399,'activationName':_0x305135[_0x457631(0x141)]}),_0x7aca9['logSuccess']?.(_0x457631(0x168)+_0x305135['name']+'\x27'),_0x377253[_0x457631(0x1db)]++;else _0x305135[_0x457631(0x20c)]==='delete'&&_0x305135[_0x457631(0x1a2)]&&(_0x7aca9[_0x457631(0x143)]?.({'type':_0x457631(0x216),'segmentName':_0x2ba399,'activationName':_0x305135[_0x457631(0x141)]}),await _0x7aca9[_0x457631(0x1f5)](_0x457631(0x1bd)+_0x305135[_0x457631(0x141)]+'\x27...',()=>_0x911773['segment'][_0x457631(0x176)](_0x4420d0,_0x25250d,_0x305135[_0x457631(0x1a2)]['id'])),_0x7aca9[_0x457631(0x143)]?.({'type':'activation_deleted','segmentName':_0x2ba399,'activationName':_0x305135[_0x457631(0x141)]}),_0x7aca9[_0x457631(0x1fe)]?.('Deleted\x20activation\x20\x27'+_0x305135[_0x457631(0x141)]+'\x27'),_0x377253[_0x457631(0x213)]++);}}catch(_0x50ba49){const _0x43ab59=isHttp400Error(_0x50ba49),_0x3ad22c=_0x43ab59?ErrorCode[_0x457631(0x244)]:ErrorCode[_0x457631(0x1af)],_0x75d1ba=getErrorMessage(_0x50ba49);throw new SDKError(_0x3ad22c,_0x457631(0x194)+_0x305135['type']+_0x457631(0x158)+_0x305135[_0x457631(0x141)]+'\x27\x20from\x20file:\x20'+_0xce03ad+_0x457631(0x1e2)+_0x75d1ba,_0x50ba49);}}return _0x377253;}export async function executePushFolders(_0x4a9da0,_0x3e6b76,_0x200012,_0x5b5174,_0x34e611){const _0x2280e8=a140_0x2bcd56,_0x271faa=new Map(_0x200012),_0x86af21=sortFoldersByDepth(_0x3e6b76);for(const _0xa187cd of _0x86af21){const _0x1d5700=_0xa187cd[_0x2280e8(0x180)]('/'),_0x5dbb85=_0x1d5700[_0x1d5700[_0x2280e8(0x1eb)]-0x1],_0x32816c=_0x1d5700[_0x2280e8(0x18c)](0x0,-0x1)[_0x2280e8(0x15d)]('/'),_0x3a04a9=_0x271faa[_0x2280e8(0x195)](_0x32816c);_0x34e611[_0x2280e8(0x143)]?.({'type':'folder_creating','folder':_0xa187cd});const _0xfdb2b8={'name':_0x5dbb85,'parentFolderId':_0x3a04a9},_0x159c26=await _0x34e611[_0x2280e8(0x1f5)]('Creating\x20folder\x20\x27'+_0xa187cd+_0x2280e8(0x23b),()=>_0x4a9da0[_0x2280e8(0x169)][_0x2280e8(0x14f)](_0x5b5174[_0x2280e8(0x200)],_0xfdb2b8));_0x271faa[_0x2280e8(0x19e)](_0xa187cd,_0x159c26[_0x2280e8(0x236)]['id']),_0x34e611[_0x2280e8(0x143)]?.({'type':_0x2280e8(0x1c5),'folder':_0xa187cd,'folderId':_0x159c26[_0x2280e8(0x236)]['id']}),_0x34e611[_0x2280e8(0x217)]?.(_0x2280e8(0x237)+_0xa187cd+'\x27');}return _0x271faa;}export async function executePushSegmentDeletions(_0x30da5e,_0x339a16,_0x1b8cda){const _0x46ec06=a140_0x2bcd56;if(_0x339a16[_0x46ec06(0x1eb)]===0x0)return 0x0;const {batchAsync:_0x47e1dd}=await import(_0x46ec06(0x163)),_0x28db0e=0x5,_0x5e2185=await _0x47e1dd(_0x339a16,async _0x1c9e4b=>{const _0xc81bb5=_0x46ec06;return _0x1b8cda[_0xc81bb5(0x143)]?.({'type':_0xc81bb5(0x1c4),'name':_0x1c9e4b[_0xc81bb5(0x141)]}),await _0x30da5e[_0xc81bb5(0x169)][_0xc81bb5(0x1ed)](_0x1c9e4b['id']),_0x1b8cda[_0xc81bb5(0x143)]?.({'type':'segment_deleted','name':_0x1c9e4b['name']}),_0x1b8cda[_0xc81bb5(0x1fe)]?.('Deleted\x20segment\x20\x27'+_0x1c9e4b['name']+'\x27'),0x1;},_0x28db0e);return _0x5e2185[_0x46ec06(0x199)]((_0x20126c,_0x1eae37)=>_0x20126c+_0x1eae37,0x0);}export async function executePushJourneys(_0x43c3b6,_0x2b89f6,_0x443d8b,_0x2b88bb,_0x5e9fb3){const _0x539e54=a140_0x2bcd56,{journeyDefToRequest:_0x4263a1}=await import(_0x539e54(0x227)),{activationDefToCreateRequest:_0x112d8b,yamlRuleToApi:_0x5f3279,validateSegmentRule:_0x1c3b50}=await import(_0x539e54(0x209)),_0xce6d95={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x3bf5d9=new Map(_0x443d8b[_0x539e54(0x20e)]),_0x11a98b=0x5;for(let _0x4faf4c=0x0;_0x4faf4c<_0x2b89f6[_0x539e54(0x1eb)];_0x4faf4c+=_0x11a98b){const _0x5be7a1=_0x2b89f6[_0x539e54(0x18c)](_0x4faf4c,_0x4faf4c+_0x11a98b),_0x424f0d=await Promise['all'](_0x5be7a1[_0x539e54(0x185)](async _0x88803b=>{const _0x516310=_0x539e54;if(!_0x88803b[_0x516310(0x1cd)]&&!_0x88803b[_0x516310(0x21c)])return{'action':_0x516310(0x178),'name':_0x88803b['yamlConfig']['name'],'journeyId':_0x88803b[_0x516310(0x165)]?.['id']};const _0x3652c4=_0x88803b['folderPath']?_0x443d8b['folderPathToId'][_0x516310(0x195)](_0x88803b['folderPath']):undefined;_0x5e9fb3[_0x516310(0x143)]?.({'type':_0x88803b[_0x516310(0x1cd)]?_0x516310(0x222):'journey_updating','name':_0x88803b['yamlConfig']['name']});try{const _0x5ede50=await executeSingleJourneyPush(_0x43c3b6,_0x88803b,{..._0x443d8b,'segmentNameToId':_0x3bf5d9},{'parentId':_0x2b88bb['parentId'],'rootFolderId':_0x2b88bb['rootFolderId'],'folderId':_0x3652c4,'verbose':_0x2b88bb[_0x516310(0x215)]},_0x5e9fb3,{'journeyDefToRequest':_0x4263a1,'activationDefToCreateRequest':_0x112d8b,'yamlRuleToApi':_0x5f3279,'validateSegmentRule':_0x1c3b50});for(const [_0x19c69b,_0x1623d8]of _0x5ede50[_0x516310(0x1f3)]){_0x3bf5d9[_0x516310(0x19e)](_0x19c69b,_0x1623d8),_0xce6d95[_0x516310(0x1f3)][_0x516310(0x19e)](_0x19c69b,_0x1623d8);}if(_0x5ede50[_0x516310(0x1ce)]===_0x516310(0x1c3))_0x5e9fb3[_0x516310(0x143)]?.({'type':'journey_created','name':_0x88803b['yamlConfig']['name'],'journeyId':_0x5ede50['journeyId']}),_0x5e9fb3[_0x516310(0x228)]?.(_0x516310(0x1e8)+_0x88803b['yamlConfig'][_0x516310(0x141)]+'\x27'),_0xce6d95[_0x516310(0x1c3)]++;else _0x5ede50[_0x516310(0x1ce)]===_0x516310(0x1db)&&(_0x5e9fb3[_0x516310(0x143)]?.({'type':_0x516310(0x182),'name':_0x88803b[_0x516310(0x1b2)][_0x516310(0x141)]}),_0x5e9fb3['logSuccess']?.(_0x516310(0x173)+_0x88803b['yamlConfig'][_0x516310(0x141)]+'\x27'),_0xce6d95['updated']++);return{'action':_0x5ede50[_0x516310(0x1ce)],'name':_0x88803b['yamlConfig'][_0x516310(0x141)],'journeyId':_0x5ede50['journeyId']};}catch(_0xf09d30){const _0x1d2b65=isHttp400Error(_0xf09d30),_0x2e71c2=_0x1d2b65?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0xfcdb15=getErrorMessage(_0xf09d30);throw new SDKError(_0x2e71c2,_0x516310(0x194)+(_0x88803b[_0x516310(0x1cd)]?_0x516310(0x172):_0x516310(0x1d5))+_0x516310(0x16f)+_0x88803b[_0x516310(0x16c)]+_0x516310(0x1e2)+_0xfcdb15,_0xf09d30);}}));_0xce6d95[_0x539e54(0x1f1)]['push'](..._0x424f0d);}return _0xce6d95;}async function matchExistingJourneySegments(_0x11a0db,_0x2480c3,_0x4a0f0b,_0x40948f,_0x59bc83){const _0x2810a8=a140_0x2bcd56;if(!_0x2480c3['existingJourney']||!_0x2480c3[_0x2810a8(0x1b2)]['segments'])return;const _0x204a94=new Map(),_0x209ce7=new Set();for(const _0x450b9e of Object[_0x2810a8(0x19f)](_0x2480c3[_0x2810a8(0x1b2)][_0x2810a8(0x188)])){const _0x43586b=generateDeterministicJourneySegmentName(_0x2480c3['yamlConfig'][_0x2810a8(0x141)],_0x450b9e);_0x204a94['set'](_0x43586b,_0x450b9e),_0x209ce7[_0x2810a8(0x192)](_0x450b9e);}const _0x1fade3=[],_0x32e590=collectSegmentIdsFromJourneyApi(_0x2480c3[_0x2810a8(0x165)]);for(const _0x16f995 of _0x32e590){const _0x42ec00=await fetchSegment(_0x11a0db,_0x4a0f0b,_0x16f995,_0x40948f);if(!_0x42ec00?.[_0x2810a8(0x141)])continue;const _0x1cdf69=_0x204a94[_0x2810a8(0x195)](_0x42ec00[_0x2810a8(0x141)]);_0x1cdf69?(_0x59bc83[_0x2810a8(0x19e)](_0x1cdf69,_0x16f995),_0x209ce7[_0x2810a8(0x167)](_0x1cdf69)):_0x1fade3[_0x2810a8(0x19d)]({'id':_0x16f995,'seg':_0x42ec00});}if(_0x209ce7[_0x2810a8(0x1a3)]>0x0&&_0x1fade3[_0x2810a8(0x1eb)]>0x0){const {localExpandedRuleToNames:_0x2fab6f}=buildLocalExpandedRuleMappings(_0x2480c3[_0x2810a8(0x1b2)]),_0x4f40c8=new Map();for(const {id:_0x7bb351,seg:_0xf18985}of _0x1fade3){if(_0xf18985[_0x2810a8(0x156)]){const _0x2133b1=apiRuleToYaml(_0xf18985[_0x2810a8(0x156)]);_0x4f40c8[_0x2810a8(0x19e)](_0x7bb351,_0x2133b1);}}for(const {id:_0x12d3a4,seg:_0x5bf033}of _0x1fade3){if(!_0x5bf033['rule'])continue;const _0x50a3d2=_0x4f40c8[_0x2810a8(0x195)](_0x12d3a4);if(!_0x50a3d2)continue;const _0x3d3a91=serializeExpandedRule(_0x50a3d2,_0x4f40c8),_0x3a2e80=_0x2fab6f[_0x2810a8(0x195)](_0x3d3a91);if(_0x3a2e80){const _0x25a779=_0x3a2e80[_0x2810a8(0x1f9)](_0x5b503b=>_0x209ce7[_0x2810a8(0x15b)](_0x5b503b));_0x25a779&&(_0x59bc83[_0x2810a8(0x19e)](_0x25a779,_0x12d3a4),_0x209ce7['delete'](_0x25a779),logger[_0x2810a8(0x221)](_0x2810a8(0x18b)+_0x5bf033[_0x2810a8(0x141)]+_0x2810a8(0x201)+_0x25a779+_0x2810a8(0x1e0)));}}}}async function executeSingleJourneyPush(_0x2c6d96,_0xe83972,_0xeca2af,_0xcff551,_0xc3e81e,_0x206dd8){const _0x3281a1=a140_0x2bcd56,{journeyDefToRequest:_0x1ec4b7,activationDefToCreateRequest:_0x1f3103,yamlRuleToApi:_0x31bf63,validateSegmentRule:_0x499d2d}=_0x206dd8,_0x4a1e56=new Map(),_0x3178e4=new Map();recoverSegmentIdsFromPushRecovery(_0xe83972,_0x4a1e56,_0xeca2af[_0x3281a1(0x20e)]);const _0x6f4918=new Map(),_0x2d7258=new Map(),_0x49f0ea=new Map();let _0x19a5ab;const _0x39bcab=async()=>{const _0x4522bb=_0x3281a1;if(_0x19a5ab)return;_0x19a5ab=new Map();if(!_0xe83972[_0x4522bb(0x165)])return;const _0x54c943=await _0x2c6d96[_0x4522bb(0x1f4)][_0x4522bb(0x14d)](_0xe83972[_0x4522bb(0x165)]['id']);for(const _0x1a8d24 of _0x54c943){const _0x5efc34=journeyActivationStepToYaml(_0x1a8d24,_0xeca2af['idToEmailMap'],_0xeca2af['connectionIdToNameMap']),_0x8dd77a=activationSignature(_0x5efc34);!_0x19a5ab['has'](_0x8dd77a)&&_0x19a5ab[_0x4522bb(0x19e)](_0x8dd77a,_0x1a8d24['id']),_0x5efc34[_0x4522bb(0x141)]&&_0x3178e4[_0x4522bb(0x19e)](_0x5efc34[_0x4522bb(0x141)],_0x1a8d24['id']);}};await matchExistingJourneySegments(_0x2c6d96,_0xe83972,_0xcff551['parentId'],_0xeca2af[_0x3281a1(0x1b7)],_0xeca2af[_0x3281a1(0x20e)]);const _0x17d04a={'resolveSegmentId':async _0xc8a4a2=>{const _0x6f28a6=_0x3281a1,_0x55b6a4=_0xeca2af[_0x6f28a6(0x20e)][_0x6f28a6(0x195)](_0xc8a4a2);if(!_0x55b6a4)throw new SDKError(ErrorCode[_0x6f28a6(0x14c)],'Segment\x20not\x20found:\x20'+_0xc8a4a2+'\x20(referenced\x20in\x20journey\x20'+_0xe83972['yamlConfig']['name']+')');return _0x55b6a4;},'resolveEmbeddedSegmentId':async(_0x2a25cc,_0x1b3396)=>{const _0x50052b=_0x3281a1,_0x776c80=_0xeca2af[_0x50052b(0x20e)]['get'](_0x2a25cc);if(_0x776c80)return _0x776c80;const _0x1152b9=_0xeca2af[_0x50052b(0x1b7)][_0x50052b(0x1f9)](_0x3bd519=>_0x3bd519[_0x50052b(0x141)]===_0x2a25cc);if(_0x1152b9)return _0xeca2af[_0x50052b(0x20e)][_0x50052b(0x19e)](_0x2a25cc,_0x1152b9['id']),_0x1152b9['id'];if(_0xe83972['isNew']){const {stageName:_0x13d0a0,criteriaName:_0x1bd2b5}=findSegmentCriteriaLocation(_0xe83972['yamlConfig'],_0x2a25cc);return _0x499d2d(_0x2a25cc,_0x1b3396[_0x50052b(0x156)]),_0x2d7258[_0x50052b(0x19e)](_0x2a25cc,{'definition':_0x1b3396,'stageName':_0x13d0a0,'criteriaName':_0x1bd2b5}),createPendingSegmentId(_0x2a25cc);}const _0x532790=_0xe83972[_0x50052b(0x165)]?.['id'];if(!_0x532790)throw new SDKError(ErrorCode[_0x50052b(0x1a7)],_0x50052b(0x140));const _0x1cc478=_0x6f4918[_0x50052b(0x195)](_0x2a25cc);if(_0x1cc478)return _0x1cc478;const _0x229397=((async()=>{const _0xb1d713=_0x50052b;_0x499d2d(_0x2a25cc,_0x1b3396['rule']);const _0x27ee7b=generateDeterministicJourneySegmentName(_0xe83972[_0xb1d713(0x1b2)][_0xb1d713(0x141)],_0x2a25cc),_0x3ed2d9=_0xeca2af['existingSegments'][_0xb1d713(0x1f9)](_0x1a0fcc=>_0x1a0fcc[_0xb1d713(0x141)]===_0x27ee7b),_0x48571f=createSegmentIdResolver(_0xeca2af[_0xb1d713(0x20e)],_0x2a25cc),_0xcfe9af=await resolveRuleSegmentIds(_0x1b3396[_0xb1d713(0x156)],_0x48571f);let _0x3eee6d;return _0x3ed2d9?(await _0x2c6d96['segment']['updateSegmentById'](_0xcff551[_0xb1d713(0x200)],_0x3ed2d9['id'],{'description':_0x1b3396[_0xb1d713(0x1ad)]||_0xb1d713(0x181)+_0x2a25cc,'rule':_0x31bf63(_0xcfe9af,!![]),'countPopulation':!![]}),_0x3eee6d=_0x3ed2d9['id'],saveSegmentToPushRecovery(_0xe83972['absolutePath'],_0xe83972['yamlConfig'][_0xb1d713(0x141)],_0x2a25cc,{'segmentId':_0x3eee6d,'uniqueServerName':_0x27ee7b,'createdAt':new Date()[_0xb1d713(0x174)]()})):_0x3eee6d=await createOrRecoverEmbeddedSegment(_0x2c6d96,_0xe83972,{'localName':_0x2a25cc,'uniqueSegmentName':_0x27ee7b,'description':_0x1b3396[_0xb1d713(0x1ad)]||_0xb1d713(0x181)+_0x2a25cc,'journeyId':_0x532790,'resolvedRule':_0xcfe9af,'parentId':_0xcff551[_0xb1d713(0x200)],'folderId':_0xcff551['rootFolderId']||''},_0x31bf63),_0xeca2af[_0xb1d713(0x20e)][_0xb1d713(0x19e)](_0x2a25cc,_0x3eee6d),_0x4a1e56[_0xb1d713(0x19e)](_0x2a25cc,_0x3eee6d),_0x3eee6d;})());_0x6f4918[_0x50052b(0x19e)](_0x2a25cc,_0x229397);try{return await _0x229397;}finally{_0x6f4918['delete'](_0x2a25cc);}},'resolveActivationId':async _0x175bd4=>{const _0x538d97=_0x3281a1,_0x49825c=_0x3178e4[_0x538d97(0x195)](_0x175bd4);if(_0x49825c)return _0x49825c;if(_0xe83972[_0x538d97(0x165)]){await _0x39bcab();const _0x2ff560=_0x3178e4[_0x538d97(0x195)](_0x175bd4);if(_0x2ff560)return _0x2ff560;}throw new SDKError(ErrorCode[_0x538d97(0x231)],_0x538d97(0x1c7)+_0x175bd4+_0x538d97(0x1e6)+_0xe83972[_0x538d97(0x1b2)][_0x538d97(0x141)]+_0x538d97(0x1d8)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x525ddd,_0x22f19e)=>{const _0x3e99f9=_0x3281a1,_0x158588=_0x3178e4['get'](_0x525ddd);if(_0x158588)return _0x158588;if(_0xe83972[_0x3e99f9(0x1cd)])return _0x49f0ea[_0x3e99f9(0x19e)](_0x525ddd,_0x22f19e),createPendingActivationId(_0x525ddd);if(_0xe83972['existingJourney']){await _0x39bcab();const _0x42ed6b=_0x3178e4[_0x3e99f9(0x195)](_0x22f19e[_0x3e99f9(0x141)]);if(_0x42ed6b)return _0x3178e4[_0x3e99f9(0x19e)](_0x525ddd,_0x42ed6b),_0x42ed6b;const _0x4ba0d2=activationSignature(_0x22f19e),_0x729bde=_0x19a5ab?.[_0x3e99f9(0x195)](_0x4ba0d2);if(_0x729bde)return _0x3178e4[_0x3e99f9(0x19e)](_0x525ddd,_0x729bde),_0x729bde;const _0x40df85=await _0x1f3103(_0x22f19e,_0xeca2af[_0x3e99f9(0x1ca)]),_0x29d95f={..._0x40df85,..._0x22f19e[_0x3e99f9(0x1a6)]!==undefined&&{'runAfterJourneyRefresh':_0x22f19e[_0x3e99f9(0x1a6)]}},_0x534c48=await _0x2c6d96[_0x3e99f9(0x1f4)][_0x3e99f9(0x1b8)](_0xe83972[_0x3e99f9(0x165)]['id'],_0x29d95f);return _0x3178e4[_0x3e99f9(0x19e)](_0x525ddd,_0x534c48['id']),_0x534c48['id'];}throw new SDKError(ErrorCode[_0x3e99f9(0x1a7)],_0x3e99f9(0x1df));},'resolveJourneyId':async _0x30b72f=>{const _0x51b739=_0x3281a1;try{return await _0x2c6d96[_0x51b739(0x1f4)][_0x51b739(0x218)](_0xcff551[_0x51b739(0x200)],_0x30b72f);}catch(_0x5ab9c7){throw new SDKError(ErrorCode['NOT_FOUND'],'Journey\x20\x27'+_0x30b72f+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0xe83972[_0x51b739(0x1b2)][_0x51b739(0x141)]+'\x27)',_0x5ab9c7);}},'resolveStageId':async(_0x1f89ea,_0x2cfa1b)=>{const _0x88ab48=_0x3281a1,_0x51ddd9=await _0x2c6d96[_0x88ab48(0x1f4)][_0x88ab48(0x1d6)](_0x1f89ea),_0x499b2c=_0x51ddd9[_0x88ab48(0x19a)][_0x88ab48(0x15f)][_0x88ab48(0x1f9)](_0x160856=>_0x160856[_0x88ab48(0x141)][_0x88ab48(0x23d)]()===_0x2cfa1b['toLowerCase']());if(!_0x499b2c?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],'Stage\x20\x27'+_0x2cfa1b+_0x88ab48(0x1fc)+(_0x51ddd9['attributes'][_0x88ab48(0x220)]||_0x51ddd9[_0x88ab48(0x19a)][_0x88ab48(0x141)])+'\x27');return _0x499b2c['id'];}},_0x5cd4f2=await _0x1ec4b7(_0xe83972[_0x3281a1(0x1b2)],_0xcff551[_0x3281a1(0x200)],_0x17d04a),_0x23fb8f=_0xcff551[_0x3281a1(0x229)]||_0xcff551[_0x3281a1(0x15e)];_0x23fb8f&&(_0x5cd4f2[_0x3281a1(0x232)]={'parentFolder':{'data':{'id':_0x23fb8f,'type':_0x3281a1(0x22b)}}});if(_0xe83972['isNew']){if(_0x2d7258[_0x3281a1(0x1a3)]>0x0||_0x49f0ea[_0x3281a1(0x1a3)]>0x0)return await executeThreeStepJourneyCreate(_0x2c6d96,_0xe83972,_0x5cd4f2,{'pendingEmbeddedSegments':_0x2d7258,'pendingEmbeddedActivations':_0x49f0ea,'embeddedSegmentNameToId':_0x4a1e56,'journeyActivationNameToId':_0x3178e4},{..._0xcff551,'effectiveFolderId':_0x23fb8f},_0xeca2af,_0xc3e81e,_0x206dd8);else{ensureJourneyDefaults(_0x5cd4f2[_0x3281a1(0x19a)]);const _0x4f9f75=await _0x2c6d96[_0x3281a1(0x1f4)][_0x3281a1(0x172)](_0x5cd4f2);return deletePushRecovery(_0xe83972['absolutePath']),{'action':_0x3281a1(0x1c3),'journeyId':_0x4f9f75['id'],'embeddedSegmentNameToId':_0x4a1e56};}}else{if(_0xe83972[_0x3281a1(0x21c)]&&_0xe83972[_0x3281a1(0x165)]){_0x5cd4f2['id']=_0xe83972[_0x3281a1(0x165)]['id'];const _0x2edf79=_0x5cd4f2[_0x3281a1(0x19a)];_0xe83972[_0x3281a1(0x165)][_0x3281a1(0x19a)]?.[_0x3281a1(0x220)]&&(_0x2edf79[_0x3281a1(0x220)]=_0xe83972[_0x3281a1(0x165)][_0x3281a1(0x19a)][_0x3281a1(0x220)]);const _0x392ac9=_0xe83972['existingJourney'][_0x3281a1(0x19a)]?.[_0x3281a1(0x15f)];return _0x392ac9&&_0x5cd4f2['attributes']['journeyStages']&&injectExistingStageIds(_0x5cd4f2[_0x3281a1(0x19a)][_0x3281a1(0x15f)],_0x392ac9),ensureJourneyDefaults(_0x2edf79),await _0x2c6d96['journey']['update'](_0xe83972[_0x3281a1(0x165)]['id'],_0x5cd4f2),deletePushRecovery(_0xe83972[_0x3281a1(0x16c)]),{'action':_0x3281a1(0x1db),'journeyId':_0xe83972[_0x3281a1(0x165)]['id'],'embeddedSegmentNameToId':_0x4a1e56};}}return deletePushRecovery(_0xe83972[_0x3281a1(0x16c)]),{'action':_0x3281a1(0x178),'journeyId':_0xe83972[_0x3281a1(0x165)]?.['id'],'embeddedSegmentNameToId':_0x4a1e56};}function findSegmentCriteriaLocation(_0x4aa158,_0x1dda76){const _0x14a5bc=a140_0x2bcd56,_0x38a5f9=_0x4aa158[_0x14a5bc(0x147)]||_0x4aa158['journeys']?.[0x0]?.[_0x14a5bc(0x147)]||[];let _0xde77c9=_0x14a5bc(0x1fd),_0x333c22=_0x1dda76;const _0xb48d92=_0x4aa158[_0x14a5bc(0x184)]||_0x4aa158['journeys']?.[0x0]?.['goal'];if(_0xb48d92?.['segment']===_0x1dda76)return{'stageName':'goal','criteriaName':_0xb48d92[_0x14a5bc(0x141)]||_0x1dda76};_0x7a8dc7:for(const _0x4f10ef of _0x38a5f9){if(_0x4f10ef['entry_criteria']?.[_0x14a5bc(0x169)]===_0x1dda76){_0xde77c9=_0x4f10ef[_0x14a5bc(0x141)],_0x333c22=_0x4f10ef['entry_criteria'][_0x14a5bc(0x141)]||_0x1dda76;break;}if(_0x4f10ef['steps'])for(const _0x3a1c30 of _0x4f10ef[_0x14a5bc(0x1d2)]){if(_0x3a1c30[_0x14a5bc(0x20c)]===_0x14a5bc(0x1f6)&&_0x3a1c30[_0x14a5bc(0x1bc)]?.[_0x14a5bc(0x1c8)])for(const _0x45c8eb of _0x3a1c30[_0x14a5bc(0x1bc)][_0x14a5bc(0x1c8)]){if(_0x45c8eb[_0x14a5bc(0x169)]===_0x1dda76){_0xde77c9=_0x4f10ef[_0x14a5bc(0x141)],_0x333c22=_0x45c8eb[_0x14a5bc(0x141)]||_0x1dda76;break _0x7a8dc7;}}}}return{'stageName':_0xde77c9,'criteriaName':_0x333c22};}async function executeThreeStepJourneyCreate(_0x3da9a9,_0x3279f3,_0x589401,_0x1c7d7a,_0x232682,_0x572eee,_0x42796a,_0x39f29d){const _0x15b8bb=a140_0x2bcd56,{activationDefToCreateRequest:_0x3e803a,yamlRuleToApi:_0x501ffa}=_0x39f29d,{pendingEmbeddedSegments:_0x42ced2,pendingEmbeddedActivations:_0x203893,embeddedSegmentNameToId:_0x395c89}=_0x1c7d7a,_0x2cf12b=JSON[_0x15b8bb(0x1ef)](JSON[_0x15b8bb(0x1f0)](_0x589401));ensureJourneyDefaults(_0x2cf12b[_0x15b8bb(0x19a)]),stripPendingIds(_0x2cf12b);const _0x554985=await _0x3da9a9[_0x15b8bb(0x1f4)][_0x15b8bb(0x172)](_0x2cf12b),_0x6863be=_0x554985['id'],_0x38b977=new Map();for(const _0x11368d of _0x554985['attributes'][_0x15b8bb(0x15f)]){_0x38b977[_0x15b8bb(0x19e)](_0x11368d[_0x15b8bb(0x141)][_0x15b8bb(0x23d)](),_0x11368d['id']);}recoverSegmentIdsFromPushRecovery(_0x3279f3,_0x395c89,_0x572eee['segmentNameToId']);for(const [_0x1dc4f6,{definition:_0x150915}]of _0x42ced2){if(_0x395c89['has'](_0x1dc4f6)){_0x42796a[_0x15b8bb(0x143)]?.({'type':_0x15b8bb(0x18d),'journeyName':_0x3279f3[_0x15b8bb(0x1b2)][_0x15b8bb(0x141)],'segmentName':_0x1dc4f6});continue;}const _0x27d573=generateDeterministicJourneySegmentName(_0x3279f3[_0x15b8bb(0x1b2)][_0x15b8bb(0x141)],_0x1dc4f6);_0x42796a[_0x15b8bb(0x143)]?.({'type':_0x15b8bb(0x225),'journeyName':_0x3279f3[_0x15b8bb(0x1b2)][_0x15b8bb(0x141)],'segmentName':_0x1dc4f6});const _0x53aa89=createSegmentIdResolver(_0x572eee[_0x15b8bb(0x20e)],_0x1dc4f6),_0x2b90b5=await resolveRuleSegmentIds(_0x150915['rule'],_0x53aa89),_0x9b20a0=await createOrRecoverEmbeddedSegment(_0x3da9a9,_0x3279f3,{'localName':_0x1dc4f6,'uniqueSegmentName':_0x27d573,'description':_0x150915['description']||_0x15b8bb(0x181)+_0x1dc4f6,'journeyId':_0x6863be,'resolvedRule':_0x2b90b5,'parentId':_0x232682['parentId'],'folderId':_0x232682['effectiveFolderId']||''},_0x501ffa);_0x395c89[_0x15b8bb(0x19e)](_0x1dc4f6,_0x9b20a0),_0x572eee[_0x15b8bb(0x20e)]['set'](_0x1dc4f6,_0x9b20a0),_0x42796a[_0x15b8bb(0x143)]?.({'type':_0x15b8bb(0x18d),'journeyName':_0x3279f3[_0x15b8bb(0x1b2)][_0x15b8bb(0x141)],'segmentName':_0x1dc4f6});}const _0x48c637=new Map();for(const [_0x28431f,_0x425d34]of _0x203893){_0x42796a[_0x15b8bb(0x143)]?.({'type':_0x15b8bb(0x1cb),'journeyName':_0x3279f3[_0x15b8bb(0x1b2)][_0x15b8bb(0x141)],'activationName':_0x28431f});const _0x9e2fde=await _0x3e803a(_0x425d34,_0x572eee[_0x15b8bb(0x1ca)]),_0x3804bb={..._0x9e2fde,..._0x425d34[_0x15b8bb(0x1a6)]!==undefined&&{'runAfterJourneyRefresh':_0x425d34[_0x15b8bb(0x1a6)]}},_0x3d7d8e=await _0x3da9a9[_0x15b8bb(0x1f4)][_0x15b8bb(0x1b8)](_0x6863be,_0x3804bb);_0x48c637[_0x15b8bb(0x19e)](_0x28431f,_0x3d7d8e['id']),_0x1c7d7a[_0x15b8bb(0x198)][_0x15b8bb(0x19e)](_0x28431f,_0x3d7d8e['id']),_0x42796a[_0x15b8bb(0x143)]?.({'type':_0x15b8bb(0x164),'journeyName':_0x3279f3['yamlConfig'][_0x15b8bb(0x141)],'activationName':_0x28431f});}const _0x132bd7=JSON['parse'](JSON['stringify'](_0x589401));return _0x132bd7['id']=_0x6863be,ensureJourneyDefaults(_0x132bd7[_0x15b8bb(0x19a)]),resolvePendingIdsInRequest(_0x132bd7,_0x589401,_0x38b977,_0x395c89,_0x48c637,_0x42796a),await _0x3da9a9[_0x15b8bb(0x1f4)][_0x15b8bb(0x1d5)](_0x6863be,_0x132bd7),deletePushRecovery(_0x3279f3['absolutePath']),{'action':_0x15b8bb(0x1c3),'journeyId':_0x6863be,'embeddedSegmentNameToId':_0x395c89};}export function stripWaitStepPendingIds(_0x3d97e6){const _0x336ebd=a140_0x2bcd56,_0x11db10=_0x3d97e6[_0x336ebd(0x1ac)]&&isPendingSegmentId(_0x3d97e6['conditionSegmentId']),_0x5add43=_0x3d97e6[_0x336ebd(0x1ec)]?.['some'](_0x1118af=>_0x1118af[_0x336ebd(0x149)]&&isPendingSegmentId(_0x1118af[_0x336ebd(0x149)]));(_0x11db10||_0x5add43)&&(_0x3d97e6[_0x336ebd(0x186)]=_0x336ebd(0x22d),_0x3d97e6[_0x336ebd(0x196)]=0x1,_0x3d97e6['waitStepUnit']='day',delete _0x3d97e6[_0x336ebd(0x1ac)],delete _0x3d97e6[_0x336ebd(0x1e4)],delete _0x3d97e6[_0x336ebd(0x1de)],delete _0x3d97e6[_0x336ebd(0x1ec)]);}export function resolveWaitStepPendingIds(_0x5f00f8,_0x5babb5,_0x35231d,_0x5dde92){const _0x38f8fd=a140_0x2bcd56;if(_0x5babb5[_0x38f8fd(0x1ac)]&&isPendingSegmentId(_0x5babb5[_0x38f8fd(0x1ac)])){const _0x4218f7=_0x35231d(_0x5babb5[_0x38f8fd(0x1ac)],'stage\x20\x27'+_0x5dde92+_0x38f8fd(0x1e5));_0x4218f7&&(_0x5f00f8[_0x38f8fd(0x186)]=_0x38f8fd(0x21b),_0x5f00f8['conditionSegmentId']=_0x4218f7,delete _0x5f00f8[_0x38f8fd(0x196)],delete _0x5f00f8[_0x38f8fd(0x240)],_0x5babb5[_0x38f8fd(0x1e4)]!==undefined&&(_0x5f00f8['conditionTimeoutDuration']=_0x5babb5[_0x38f8fd(0x1e4)]),_0x5babb5['conditionTimeoutUnit']&&(_0x5f00f8[_0x38f8fd(0x1de)]=_0x5babb5['conditionTimeoutUnit']));}if(_0x5babb5['conditions']){const _0x322930=_0x5babb5[_0x38f8fd(0x1ec)][_0x38f8fd(0x219)](_0x138096=>_0x138096[_0x38f8fd(0x149)]&&isPendingSegmentId(_0x138096[_0x38f8fd(0x149)]));if(_0x322930){const _0xd820cf=_0x5babb5[_0x38f8fd(0x1ec)][_0x38f8fd(0x185)](_0x5cd46d=>{const _0x30eb75=_0x38f8fd;if(_0x5cd46d[_0x30eb75(0x149)]&&isPendingSegmentId(_0x5cd46d[_0x30eb75(0x149)])){const _0x5da7f4=_0x35231d(_0x5cd46d[_0x30eb75(0x149)],_0x30eb75(0x233)+_0x5dde92+_0x30eb75(0x1e5));return{..._0x5cd46d,'segmentId':_0x5da7f4||_0x5cd46d['segmentId']};}return{..._0x5cd46d};});_0x5f00f8[_0x38f8fd(0x186)]=_0x38f8fd(0x21b),_0x5f00f8[_0x38f8fd(0x1ec)]=_0xd820cf,delete _0x5f00f8[_0x38f8fd(0x196)],delete _0x5f00f8['waitStepUnit'],delete _0x5f00f8[_0x38f8fd(0x1ac)],delete _0x5f00f8['conditionTimeoutDuration'],delete _0x5f00f8[_0x38f8fd(0x1de)];}}}function stripPendingIds(_0x52ef84){const _0xe747ae=a140_0x2bcd56;_0x52ef84[_0xe747ae(0x19a)]['goal']?.[_0xe747ae(0x149)]&&isPendingSegmentId(_0x52ef84[_0xe747ae(0x19a)][_0xe747ae(0x184)]['segmentId'])&&delete _0x52ef84[_0xe747ae(0x19a)][_0xe747ae(0x184)];for(const _0x9304d9 of _0x52ef84[_0xe747ae(0x19a)]['journeyStages']||[]){_0x9304d9[_0xe747ae(0x17b)]?.[_0xe747ae(0x149)]&&isPendingSegmentId(_0x9304d9[_0xe747ae(0x17b)][_0xe747ae(0x149)])&&delete _0x9304d9['entryCriteria'];_0x9304d9['milestone']?.[_0xe747ae(0x149)]&&isPendingSegmentId(_0x9304d9['milestone']['segmentId'])&&delete _0x9304d9[_0xe747ae(0x16e)];_0x9304d9[_0xe747ae(0x20d)]&&(_0x9304d9[_0xe747ae(0x20d)]=_0x9304d9['exitCriterias'][_0xe747ae(0x238)](_0x45ae7c=>!_0x45ae7c['segmentId']||!isPendingSegmentId(_0x45ae7c[_0xe747ae(0x149)])));if(_0x9304d9[_0xe747ae(0x1d2)])for(const _0x50e2d9 of Object['keys'](_0x9304d9[_0xe747ae(0x1d2)])){const _0x5915a2=_0x9304d9['steps'][_0x50e2d9];_0x5915a2[_0xe747ae(0x20c)]==='Activation'&&_0x5915a2[_0xe747ae(0x15a)]&&isPendingActivationId(_0x5915a2['journeyActivationStepId'])&&(_0x5915a2[_0xe747ae(0x15a)]='');if(_0x5915a2[_0xe747ae(0x20c)]===_0xe747ae(0x1e7)&&_0x5915a2[_0xe747ae(0x1c8)])for(const _0x1a972a of _0x5915a2[_0xe747ae(0x1c8)]){_0x1a972a['segmentId']&&isPendingSegmentId(_0x1a972a['segmentId'])&&(_0x1a972a['segmentId']='');}_0x5915a2[_0xe747ae(0x20c)]===_0xe747ae(0x1d4)&&stripWaitStepPendingIds(_0x5915a2);}}}function resolvePendingIdsInRequest(_0x77528f,_0x1d4ec2,_0x55086f,_0x179ad5,_0x26e1bc,_0x202914){const _0x255dbf=a140_0x2bcd56,_0x105568=(_0xfa9f03,_0x4350b7)=>{const _0x4f79e4=a140_0x275f;if(!isPendingSegmentId(_0xfa9f03))return _0xfa9f03;const _0x2f1d8c=extractPendingSegmentName(_0xfa9f03),_0x4ae419=_0x179ad5['get'](_0x2f1d8c);return!_0x4ae419&&_0x202914[_0x4f79e4(0x202)]?.(_0x4f79e4(0x1bb)+_0x2f1d8c+_0x4f79e4(0x151)+_0x4350b7),_0x4ae419;};if(_0x77528f['attributes'][_0x255dbf(0x184)]?.[_0x255dbf(0x149)]&&isPendingSegmentId(_0x77528f['attributes'][_0x255dbf(0x184)]['segmentId'])){const _0x138a60=_0x105568(_0x77528f[_0x255dbf(0x19a)][_0x255dbf(0x184)]['segmentId'],_0x255dbf(0x16d));_0x138a60&&(_0x77528f[_0x255dbf(0x19a)][_0x255dbf(0x184)]['segmentId']=_0x138a60);}for(const _0x280a5f of _0x77528f[_0x255dbf(0x19a)][_0x255dbf(0x15f)]||[]){const _0xe2754b=_0x55086f[_0x255dbf(0x195)](_0x280a5f['name'][_0x255dbf(0x23d)]());_0xe2754b&&(_0x280a5f['id']=_0xe2754b);if(_0x280a5f[_0x255dbf(0x17b)]?.['segmentId']&&isPendingSegmentId(_0x280a5f['entryCriteria'][_0x255dbf(0x149)])){const _0x460ee0=_0x105568(_0x280a5f[_0x255dbf(0x17b)][_0x255dbf(0x149)],_0x255dbf(0x233)+_0x280a5f[_0x255dbf(0x141)]+_0x255dbf(0x1b1));_0x460ee0&&(_0x280a5f[_0x255dbf(0x17b)]['segmentId']=_0x460ee0);}if(_0x280a5f[_0x255dbf(0x20d)])for(const _0x3bd0df of _0x280a5f['exitCriterias']){if(_0x3bd0df[_0x255dbf(0x149)]&&isPendingSegmentId(_0x3bd0df[_0x255dbf(0x149)])){const _0x2c4173=_0x105568(_0x3bd0df[_0x255dbf(0x149)],_0x255dbf(0x233)+_0x280a5f['name']+'\x27\x20exit\x20criteria');_0x2c4173&&(_0x3bd0df['segmentId']=_0x2c4173);}}if(_0x280a5f['milestone']?.[_0x255dbf(0x149)]&&isPendingSegmentId(_0x280a5f[_0x255dbf(0x16e)][_0x255dbf(0x149)])){const _0x4e20f0=_0x105568(_0x280a5f[_0x255dbf(0x16e)][_0x255dbf(0x149)],_0x255dbf(0x233)+_0x280a5f[_0x255dbf(0x141)]+_0x255dbf(0x1a8));_0x4e20f0&&(_0x280a5f[_0x255dbf(0x16e)]['segmentId']=_0x4e20f0);}if(_0x280a5f[_0x255dbf(0x1d2)]){const _0x5c01a6=_0x4460bd=>_0x1d4ec2[_0x255dbf(0x19a)]['journeyStages']?.[_0x255dbf(0x1f9)](_0x2359a8=>_0x2359a8[_0x255dbf(0x141)][_0x255dbf(0x23d)]()===_0x280a5f['name'][_0x255dbf(0x23d)]())?.[_0x255dbf(0x1d2)]?.[_0x4460bd];for(const _0x7cf702 of Object[_0x255dbf(0x19f)](_0x280a5f[_0x255dbf(0x1d2)])){const _0x47b592=_0x280a5f['steps'][_0x7cf702],_0x1c1619=_0x5c01a6(_0x7cf702);if(_0x47b592[_0x255dbf(0x20c)]===_0x255dbf(0x1b6)&&_0x47b592[_0x255dbf(0x15a)]&&(isPendingActivationId(_0x47b592[_0x255dbf(0x15a)])||_0x47b592[_0x255dbf(0x15a)]==='')){if(_0x1c1619?.[_0x255dbf(0x15a)]&&isPendingActivationId(_0x1c1619[_0x255dbf(0x15a)])){const _0x14db5f=extractPendingActivationName(_0x1c1619[_0x255dbf(0x15a)]),_0x441187=_0x26e1bc[_0x255dbf(0x195)](_0x14db5f);_0x441187&&(_0x47b592[_0x255dbf(0x15a)]=_0x441187);}}if(_0x47b592['type']===_0x255dbf(0x1e7)&&_0x47b592[_0x255dbf(0x1c8)]&&_0x1c1619?.[_0x255dbf(0x1c8)])for(let _0x427715=0x0;_0x427715<_0x47b592[_0x255dbf(0x1c8)]['length'];_0x427715++){const _0x259557=_0x47b592[_0x255dbf(0x1c8)][_0x427715],_0x295c39=_0x1c1619['branches'][_0x427715];if(_0x295c39?.[_0x255dbf(0x149)]&&isPendingSegmentId(_0x295c39[_0x255dbf(0x149)])){const _0x1480ad=_0x105568(_0x295c39['segmentId'],'stage\x20\x27'+_0x280a5f['name']+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x259557[_0x255dbf(0x141)]||_0x427715)+'\x27');_0x1480ad&&(_0x259557[_0x255dbf(0x149)]=_0x1480ad);}}_0x47b592['type']==='WaitStep'&&_0x1c1619?.[_0x255dbf(0x20c)]===_0x255dbf(0x1d4)&&resolveWaitStepPendingIds(_0x47b592,_0x1c1619,_0x105568,_0x280a5f[_0x255dbf(0x141)]);}}}}
|
|
1
|
+
const a142_0x5a51=a142_0x42c6;(function(_0x4f7c7d,_0x492334){const _0xda4d1d=a142_0x42c6,_0x541bb6=_0x4f7c7d();while(!![]){try{const _0x522e54=parseInt(_0xda4d1d(0x181))/0x1*(parseInt(_0xda4d1d(0xff))/0x2)+-parseInt(_0xda4d1d(0x14f))/0x3*(parseInt(_0xda4d1d(0x14c))/0x4)+parseInt(_0xda4d1d(0x92))/0x5*(parseInt(_0xda4d1d(0x132))/0x6)+-parseInt(_0xda4d1d(0x13e))/0x7+-parseInt(_0xda4d1d(0xb9))/0x8+-parseInt(_0xda4d1d(0x9e))/0x9*(parseInt(_0xda4d1d(0xbd))/0xa)+-parseInt(_0xda4d1d(0x10d))/0xb*(-parseInt(_0xda4d1d(0xa0))/0xc);if(_0x522e54===_0x492334)break;else _0x541bb6['push'](_0x541bb6['shift']());}catch(_0x2faf8b){_0x541bb6['push'](_0x541bb6['shift']());}}}(a142_0x2daf,0x63b1e));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a142_0x5a51(0x119);export const PENDING_ACTIVATION_PREFIX=a142_0x5a51(0x109);export function createPendingSegmentId(_0x571aae){return''+PENDING_SEGMENT_PREFIX+_0x571aae+'__';}export function isPendingSegmentId(_0xe3897f){const _0x2dde29=a142_0x5a51;return _0xe3897f[_0x2dde29(0x129)](PENDING_SEGMENT_PREFIX)&&!_0xe3897f['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x5e6e5a){const _0x10e9f1=a142_0x5a51;return _0x5e6e5a[_0x10e9f1(0xb8)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5cf379){return''+PENDING_ACTIVATION_PREFIX+_0x5cf379+'__';}export function isPendingActivationId(_0x407f34){const _0x2fb25c=a142_0x5a51;return _0x407f34[_0x2fb25c(0x129)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x2ac047){const _0x18bef9=a142_0x5a51;return _0x2ac047[_0x18bef9(0xb8)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x5eb90a,_0x5c7cb3){const _0x1c635e=a142_0x5a51,_0x1e53fc=_0x5eb90a+'::'+(_0x5c7cb3[_0x1c635e(0xc7)]()||_0x1c635e(0xf2)),_0x47ddcf=createHash(_0x1c635e(0x147))[_0x1c635e(0x17b)](_0x1e53fc)[_0x1c635e(0x12c)](_0x1c635e(0xca))['slice'](0x0,0xc);return _0x1c635e(0x174)+_0x47ddcf;}export function ensureJourneyDefaults(_0xacaa0d){const _0x1d8834=a142_0x5a51;!_0xacaa0d[_0x1d8834(0x167)]&&(_0xacaa0d['description']=''),!_0xacaa0d[_0x1d8834(0xb3)]&&(_0xacaa0d[_0x1d8834(0xb3)]=_0x1d8834(0x162));}export function injectExistingStageIds(_0x2a7484,_0x3873ca){const _0x34f5a9=a142_0x5a51,_0x14a6d2=new Map(_0x3873ca[_0x34f5a9(0xc1)](_0xf2cce8=>[_0xf2cce8[_0x34f5a9(0x8c)],_0xf2cce8['id']]));for(const _0x1f613e of _0x2a7484){if(!_0x1f613e['id']){const _0x217cc6=_0x14a6d2[_0x34f5a9(0x185)](_0x1f613e[_0x34f5a9(0x8c)]);_0x217cc6&&(_0x1f613e['id']=_0x217cc6);}}}export function resolveTDFolderPath(_0x106fba,_0x5cd35a,_0x253cdb){const _0x29695f=a142_0x5a51;if(!_0x5cd35a)return _0x106fba;if(_0x106fba===_0x253cdb||_0x106fba[_0x29695f(0x129)](_0x253cdb+'/'))return _0x106fba;return _0x106fba?_0x253cdb+'/'+_0x106fba:_0x253cdb;}export function addFoldersToCreate(_0x446c09,_0x51664b,_0x956fa2){const _0x415031=a142_0x5a51;if(!_0x446c09)return;if(_0x51664b[_0x415031(0xd3)](_0x446c09))return;const _0x65c4ee=_0x446c09[_0x415031(0x8d)]('/');let _0xc241ac='';for(const _0x24e110 of _0x65c4ee){_0xc241ac=_0xc241ac?_0xc241ac+'/'+_0x24e110:_0x24e110,!_0x51664b[_0x415031(0xd3)](_0xc241ac)&&_0x956fa2['add'](_0xc241ac);}}export function sortFoldersByDepth(_0x10ed1c){return[..._0x10ed1c]['sort']((_0x6cbd6e,_0x28a7eb)=>{const _0x445b88=a142_0x42c6,_0x2697ef=(_0x6cbd6e[_0x445b88(0x16d)](/\//g)||[])['length'],_0x58c146=(_0x28a7eb[_0x445b88(0x16d)](/\//g)||[])['length'];return _0x2697ef-_0x58c146;});}import*as a142_0x5a9249 from'yaml';import{readFileSync}from'fs';import a142_0x5c3462 from'path';import{isJourneyDef,parseYamlString as a142_0x2514e4,toYamlString as a142_0x2aac63,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(_0x4dd403){const _0x1a36b7=a142_0x5a51;if(Array[_0x1a36b7(0x15e)](_0x4dd403))return'['+_0x4dd403[_0x1a36b7(0xc1)](_0x431089=>stableStringify(_0x431089))['join'](',')+']';if(_0x4dd403&&typeof _0x4dd403===_0x1a36b7(0xd0)){const _0x35dba4=_0x4dd403,_0x3ee925=Object[_0x1a36b7(0x10b)](_0x35dba4)[_0x1a36b7(0xfd)](),_0x8280f5=_0x3ee925[_0x1a36b7(0xc1)](_0x3d65b4=>'\x22'+_0x3d65b4+'\x22:'+stableStringify(_0x35dba4[_0x3d65b4]));return'{'+_0x8280f5['join'](',')+'}';}const _0x1032a3=JSON[_0x1a36b7(0x183)](_0x4dd403);return _0x1032a3===undefined?_0x1a36b7(0x111):_0x1032a3;}function a142_0x2daf(){const _0x22b846=['entryCriteria','size','waitStepUnit','logDeleted','delete','Creating\x20segment\x20\x27','folderPath','conditions','__pending_act_','DecisionPoint','keys','updateSegmentById','8708271EXvhWK','\x20error(s)','and\x20the\x20server\x20segment,\x20then\x20retry.','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','null','rootFolderId','Embedded\x20segment\x20\x27','./journey-yaml.js','withProgress','folderPathToId','\x27\x20decision\x20point\x20branch\x20\x27','activation_deleting','__pending_','journeyActivationStepId','activationActions','getLatestJourneyId','logSuccess','localName','logInfo','absolutePath','results','Deleted\x20segment\x20\x27','waitStepType','yamlConfig','stages','all','Entry\x20criteria:\x20','versionNumber','startsWith','./child-segment-yaml.js','includes','digest','list','Created\x20folder\x20\x27','journeyName','user','parentFolder','2231004yWDoOU','Created\x20activation\x20\x27','connection','connectionIdToNameMap','createActivation','toISOString','conditionSegmentId','existingJourney','parentSegmentFolder','Condition','utf-8','entry_criteria','4219999DhvmHz','Created\x20segment\x20\x27','Fetching\x20','schedule','activation_','create','goal\x20criteria','\x20journey\x20from\x20file:\x20','ACTIVATION_UPDATE_ERROR','sha1','WaitStep','data','journeys','journey_creating','2414176vZNzud','SEGMENT_UPDATE_ERROR','fetchJourney','3CWzNbb','Created\x20journey\x20\x27','segmentNameToId','\x27\x20from\x20file:\x20','verbose','add','filter','set','getJourney','connector_config','Journey\x20\x27','entries','stage\x20\x27','Updated\x20activation\x20\x27','parseDocument','isArray','journeyStages',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','getSegment\x20failed\x20for\x20','draft','relationships','journey','getSegment','journeyBundlesByFolderAndName','description','exitCriterias','segmentByFolderAndName','embedded_segment_creating','\x20segment\x20from\x20file:\x20','find','match','toLowerCase','segment_creating','activationParams','conditionTimeoutUnit','\x20(referenced\x20in\x20journey\x20','push','journey_entry_criteria_','with','rule','waitStep','Activation','yamlActivation','idToEmailMap','update','uniqueServerName','activations','diff','existingSegments','Updating\x20activation\x20\x27','86iLMDwO','Updating\x20segment\x20\x27','stringify','decision_point','get','debug','branches','listActivations','relative','createdSegmentId','activation_template_id','folder_creating','../../utils/async.js','activationContext','uniqueSegmentName','effectiveFolderId','isNew','JOURNEY_UPDATE_ERROR','all_columns','name','split','NOT_FOUND','segmentFolderId',').\x20','activation_updating','5HXzHcV','kind','validatedRequest','segmentId','folder','from','Segment\x20not\x20found','embedded_activation_created','Delete\x20the\x20push\x20recovery\x20file\x20(','INTERNAL','goal','columns','382131UEGkeJ','idToName','24xZpFZK','message','type','existingSegment','max','deleteSegment','run_after_journey_refresh','embedded_segment_created','created','Creating\x20activation\x20\x27','journeyId','\x27\x20by\x20rule\x20content','journey_created','onProgress','action','embeddedSegmentNameToId','entry','createSegment','nameToType','state','\x27\x20exit\x20criteria','existingActivation','resolvedRule','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','replace','51008cyzuMV','steps','\x27...','logWarning','170eMwCam','reduce','SEGMENT_SYNTAX_ERROR','\x27\x20to\x20local\x20\x27','map','some','parse','\x0a\x20\x20','createJourneySegment','attributes','trim','Creating\x20folder\x20\x27','\x27\x20entry\x20criteria','hex','folderId','toString','join','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','notification','object','journeyBundleName','\x27\x20for\x20','has','segments','Deleting\x20activation\x20\x27','deleteActivation','updateActivation','createdSegmentIds','\x20activation\x20\x27','JOURNEY_SYNTAX_ERROR','behavior','folder_created','resolveSegment','updated','errors','Matched\x20server\x20segment\x20\x27','\x27\x20not\x20found\x20in\x20journey\x20\x27','segment_deleting','hasChanges','activation_updated','createFolder','SEGMENT_NOT_FOUND','\x27\x20wait\x20condition','unchanged','Deleted\x20activation\x20\x27','journeyById','milestone','length','Failed\x20to\x20','parentId','deleted','conditionTimeoutDuration','progress','segment','index','activationsBySegmentId','Segment\x20not\x20found:\x20','slice','day','activationStepsById','segment_updated','Activation\x20not\x20found:\x20','journeyBundleId','resolveJourneyId','sort','deps','9018ftAwMo','Name\x20has\x20already\x20been\x20taken'];a142_0x2daf=function(){return _0x22b846;};return a142_0x2daf();}function activationSignature(_0x9d2209){const _0x3bdefc=a142_0x5a51,_0xde05c9={'connection':_0x9d2209[_0x3bdefc(0x134)],..._0x9d2209[_0x3bdefc(0x8b)]!==undefined&&{'all_columns':_0x9d2209[_0x3bdefc(0x8b)]},..._0x9d2209[_0x3bdefc(0x9d)]!==undefined&&{'columns':_0x9d2209[_0x3bdefc(0x9d)]},..._0x9d2209[_0x3bdefc(0xdb)]!==undefined&&{'behavior':_0x9d2209[_0x3bdefc(0xdb)]},..._0x9d2209[_0x3bdefc(0x141)]!==undefined&&{'schedule':_0x9d2209[_0x3bdefc(0x141)]},..._0x9d2209[_0x3bdefc(0xcf)]!==undefined&&{'notification':_0x9d2209['notification']},..._0x9d2209[_0x3bdefc(0x158)]!==undefined&&{'connector_config':_0x9d2209['connector_config']},..._0x9d2209['activation_template_id']!==undefined&&{'activation_template_id':_0x9d2209[_0x3bdefc(0x83)]}};return stableStringify(_0xde05c9);}async function fetchSegment(_0x1a7eeb,_0x3098e9,_0x2a4565,_0x116a4b){const _0xb4bc97=a142_0x5a51,_0x84db7b=_0x116a4b?.[_0xb4bc97(0x16c)](_0x36c889=>_0x36c889['id']===_0x2a4565);if(_0x84db7b)return _0x84db7b;try{return await _0x1a7eeb['segment'][_0xb4bc97(0x165)](_0x3098e9,_0x2a4565);}catch(_0x5bc1cd){logger[_0xb4bc97(0x186)](_0xb4bc97(0x161)+_0x2a4565+_0xb4bc97(0x160)+_0x5bc1cd);try{return await _0x1a7eeb['segment']['getSegmentEntity'](_0x2a4565);}catch(_0x59b8c8){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x2a4565+':\x20'+_0x59b8c8),null;}}}function recoverSegmentIdsFromPushRecovery(_0x6cf4cb,_0x175c77,_0x538fed){const _0x42d519=a142_0x5a51,_0x136ec0=readPushRecovery(_0x6cf4cb[_0x42d519(0x120)]);if(_0x136ec0?.[_0x42d519(0x12f)]===_0x6cf4cb['yamlConfig']['name'])for(const [_0x485e3c,_0x236717]of Object[_0x42d519(0x15a)](_0x136ec0[_0x42d519(0xd4)])){const _0xaf0685=generateDeterministicJourneySegmentName(_0x6cf4cb['yamlConfig'][_0x42d519(0x8c)],_0x485e3c);_0x236717[_0x42d519(0x17c)]===_0xaf0685&&(_0x175c77[_0x42d519(0x156)](_0x485e3c,_0x236717[_0x42d519(0x95)]),_0x538fed[_0x42d519(0x156)](_0x485e3c,_0x236717[_0x42d519(0x95)]));}}async function createOrRecoverEmbeddedSegment(_0x419d,_0x1accc7,_0x490373,_0x526675){const _0x3127f1=a142_0x5a51;let _0x12cb44;try{_0x12cb44=await _0x419d['segment'][_0x3127f1(0xc5)]({'name':_0x490373[_0x3127f1(0x87)],'description':_0x490373[_0x3127f1(0x167)],'journeyId':_0x490373[_0x3127f1(0xaa)],'rule':_0x526675(_0x490373[_0x3127f1(0xb6)],!![]),'countPopulation':!![],'parentFolderId':_0x490373['folderId'],'audienceId':_0x490373['parentId']});}catch(_0x27d38b){const _0x159602=_0x27d38b instanceof Error&&_0x27d38b[_0x3127f1(0xa1)][_0x3127f1(0x12b)](_0x3127f1(0x100));if(_0x159602){const _0x2ed4d7=readPushRecovery(_0x1accc7[_0x3127f1(0x120)]),_0x400b64=_0x2ed4d7?.['journeyName']===_0x1accc7[_0x3127f1(0x124)]['name']?_0x2ed4d7[_0x3127f1(0xd4)][_0x490373[_0x3127f1(0x11e)]]:undefined;if(_0x400b64?.[_0x3127f1(0x17c)]===_0x490373[_0x3127f1(0x87)])await _0x419d[_0x3127f1(0xf2)]['updateSegmentById'](_0x490373[_0x3127f1(0xee)],_0x400b64['segmentId'],{'description':_0x490373[_0x3127f1(0x167)],'rule':_0x526675(_0x490373[_0x3127f1(0xb6)],!![]),'countPopulation':!![]}),_0x12cb44=_0x400b64['segmentId'];else throw new SDKError(ErrorCode[_0x3127f1(0x14d)],_0x3127f1(0x113)+_0x490373[_0x3127f1(0x11e)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x3127f1(0x9a)+_0x1accc7[_0x3127f1(0x120)][_0x3127f1(0xb8)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+_0x3127f1(0x10f),_0x27d38b);}else throw _0x27d38b;}return saveSegmentToPushRecovery(_0x1accc7[_0x3127f1(0x120)],_0x1accc7[_0x3127f1(0x124)][_0x3127f1(0x8c)],_0x490373['localName'],{'segmentId':_0x12cb44,'uniqueServerName':_0x490373[_0x3127f1(0x87)],'createdAt':new Date()[_0x3127f1(0x137)]()}),_0x12cb44;}export async function prepareSegmentFiles(_0x248ccb,_0x3210ec,_0x8f86db,_0x5aa599,_0xbceed9){const _0x98d691=a142_0x5a51,{activationDefToCreateRequest:_0x2dd52a}=await import('./child-segment-yaml.js'),_0x141c02=[],_0xa367d2=new Set();for(const {yamlConfig:_0x3b76be,folderPath:_0x21c546,sourcePath:_0xbd6f2c}of _0x248ccb){const _0x32c3ba=resolveTDFolderPath(_0x21c546,_0x5aa599,_0xbceed9),_0x58c44e=_0x32c3ba+':'+_0x3b76be['name'],_0x5519db=_0x3210ec[_0x98d691(0x169)]['get'](_0x58c44e),_0x32cbc3=_0x5519db?_0x3210ec[_0x98d691(0xf4)][_0x98d691(0x185)](_0x5519db['id'])||[]:[];addFoldersToCreate(_0x32c3ba,_0x3210ec[_0x98d691(0x116)],_0xa367d2);const _0x582e2b=calculateActivationActions(_0x3b76be['activations']||[],_0x32cbc3,_0x3210ec['idToEmailMap'],_0x3210ec[_0x98d691(0x135)]);for(const _0x49da54 of _0x582e2b){(_0x49da54[_0x98d691(0xa2)]==='create'||_0x49da54[_0x98d691(0xa2)]===_0x98d691(0x17b))&&_0x49da54[_0x98d691(0x179)]&&(_0x49da54[_0x98d691(0x94)]=await _0x2dd52a(_0x49da54[_0x98d691(0x179)],_0x8f86db));}const _0x538900=calculateSegmentDiff(_0x3b76be,_0x5519db,_0x32cbc3,_0x3210ec[_0x98d691(0x17a)],_0x3210ec[_0x98d691(0x135)]);_0x141c02[_0x98d691(0x173)]({'relativePath':_0x3b76be['name'],'absolutePath':_0xbd6f2c,'yamlConfig':_0x3b76be,'folderPath':_0x32c3ba,'existingSegment':_0x5519db,'existingActivations':_0x32cbc3,'isNew':_0x538900['isNew'],'hasChanges':_0x538900[_0x98d691(0xe3)],'diff':_0x538900[_0x98d691(0x17e)],'activationActions':_0x582e2b});}return{'segmentFiles':_0x141c02,'foldersToCreate':_0xa367d2};}export async function prepareJourneyFiles(_0xdcc3ad,_0x24774c,_0x1d0534,_0x36fd06){const _0x49665d=a142_0x5a51,_0x247da6=[],_0x6a6ae0=new Set();for(const {yamlConfig:_0x7ecf54,folderPath:_0xff617a,sourcePath:_0x3f3864}of _0xdcc3ad){const _0x1ebe11=resolveTDFolderPath(_0xff617a,_0x1d0534,_0x36fd06),_0x1fe15c=_0x1ebe11+':'+_0x7ecf54[_0x49665d(0x8c)],_0x132e30=_0x24774c[_0x49665d(0x166)][_0x49665d(0x185)](_0x1fe15c);let _0x1b8802,_0x5ada81;if(_0x132e30&&_0x132e30['length']>0x0){const _0x4c4a9b=buildLocalExpandedRuleMappings(_0x7ecf54),{createYamlContext:_0xd33cfa,prefetchJourneySegments:_0x299850}=createPushYamlContextForBundle(_0x24774c[_0x49665d(0xfe)],_0x24774c[_0x49665d(0xee)],_0x24774c[_0x49665d(0x17f)],_0x4c4a9b,_0x24774c[_0x49665d(0x17a)],_0x24774c[_0x49665d(0x135)],_0x24774c[_0x49665d(0xf8)],_0x24774c[_0x49665d(0xea)]);await _0x299850(_0x132e30[_0x49665d(0xc1)](_0x2422d6=>_0x2422d6['id']));const _0x4fa8d8=await _0x24774c['deps'][_0x49665d(0x164)][_0x49665d(0x11c)](_0x132e30[0x0][_0x49665d(0xfb)]),_0x904231=hasMultipleVersions(_0x7ecf54),_0x10166d=async _0x5b1c6b=>{const _0x5bdad8=_0x49665d,_0x238b39=_0x24774c['journeyById']?.[_0x5bdad8(0x185)](_0x5b1c6b);if(_0x238b39)return _0x238b39;return _0x24774c[_0x5bdad8(0x14e)]({'journeyId':_0x5b1c6b,'journeyName':_0x7ecf54['name'],'isMultiVersion':_0x132e30['length']>0x1});};if(_0x904231&&_0x132e30[_0x49665d(0xec)]>0x1){const _0x38180b=[];for(const _0x54d2cb of _0x132e30){const _0x5b7290=_0x54d2cb[_0x49665d(0x128)]||0x1;_0x24774c[_0x49665d(0xf1)]?.['update'](_0x49665d(0x140)+_0x7ecf54['name']+'\x20v'+_0x5b7290);const _0x3e9c88=await _0x10166d(_0x54d2cb['id']),_0x40b70e=_0xd33cfa(_0x54d2cb['id']),_0x3a2faf=await journeyResponseToDef(_0x3e9c88,_0x40b70e);_0x38180b[_0x49665d(0x173)]({'item':_0x54d2cb,'yaml':_0x3a2faf});}const _0x150bb0=buildLocalRuleToNameMappingFromJourney(_0x7ecf54);_0x5ada81=buildMergedJourneyDef(_0x38180b,_0x150bb0,_0x4fa8d8);const _0x985fdf=Math[_0x49665d(0xa4)](..._0x38180b[_0x49665d(0xc1)](_0x3f2cd6=>_0x3f2cd6['item']['versionNumber']||0x0)),_0x30ce47=_0x132e30[_0x49665d(0x16c)](_0x5ce3fc=>(_0x5ce3fc[_0x49665d(0x128)]||0x0)===_0x985fdf);_0x30ce47&&(_0x24774c[_0x49665d(0xf1)]?.[_0x49665d(0x17b)](_0x49665d(0x140)+_0x7ecf54[_0x49665d(0x8c)]+'\x20v'+_0x985fdf),_0x1b8802=await _0x10166d(_0x30ce47['id']));}else{const _0x4a6e26=_0x132e30[_0x132e30[_0x49665d(0xec)]-0x1];_0x24774c['progress']?.['update'](_0x49665d(0x140)+_0x7ecf54[_0x49665d(0x8c)]),_0x1b8802=await _0x10166d(_0x4a6e26['id']);const _0x297004=_0xd33cfa(_0x4a6e26['id']),_0x2324ec=await journeyResponseToDef(_0x1b8802,_0x297004),_0x2ad8b2=buildLocalRuleToNameMappingFromJourney(_0x7ecf54);_0x5ada81=buildMergedJourneyDef([{'item':_0x4a6e26,'yaml':_0x2324ec}],_0x2ad8b2,_0x4fa8d8);}}addFoldersToCreate(_0x1ebe11,_0x24774c[_0x49665d(0x116)],_0x6a6ae0);const _0x8d7cba=calculateJourneyDiff(_0x7ecf54,_0x5ada81);_0x247da6[_0x49665d(0x173)]({'relativePath':_0x7ecf54[_0x49665d(0x8c)],'absolutePath':_0x3f3864,'yamlConfig':_0x7ecf54,'folderPath':_0x1ebe11,'existingJourney':_0x1b8802,'isNew':_0x8d7cba[_0x49665d(0x89)],'hasChanges':_0x8d7cba[_0x49665d(0xe3)],'diff':_0x8d7cba[_0x49665d(0x17e)]});}return{'journeyFiles':_0x247da6,'foldersToCreate':_0x6a6ae0};}export function calculateActivationActions(_0x58f71e,_0x304efd,_0x5e2ba1,_0xce5716){const _0x5315b4=a142_0x5a51,_0x9ce64e=[],_0xb9684f=new Map();for(const _0x752462 of _0x304efd){_0xb9684f['set'](_0x752462['name'],_0x752462);}const _0x1be4d6=new Map();for(const _0x1f5083 of _0x58f71e){_0x1be4d6[_0x5315b4(0x156)](_0x1f5083[_0x5315b4(0x8c)],_0x1f5083);}for(const _0xb8f9cb of _0x58f71e){const _0x42f0c1=_0xb9684f[_0x5315b4(0x185)](_0xb8f9cb[_0x5315b4(0x8c)]);if(!_0x42f0c1)_0x9ce64e[_0x5315b4(0x173)]({'type':_0x5315b4(0x143),'name':_0xb8f9cb[_0x5315b4(0x8c)],'yamlActivation':_0xb8f9cb});else{const _0x4804c4=activationResponseToDef(_0x42f0c1,_0x5e2ba1,_0xce5716),_0x13b3ef=a142_0x5a9249[_0x5315b4(0x183)](_0x4804c4),_0x3c9cc7=a142_0x5a9249['stringify'](_0xb8f9cb);_0x13b3ef!==_0x3c9cc7&&_0x9ce64e['push']({'type':_0x5315b4(0x17b),'name':_0xb8f9cb['name'],'yamlActivation':_0xb8f9cb,'existingActivation':_0x42f0c1});}}for(const _0x1a33c0 of _0x304efd){!_0x1be4d6[_0x5315b4(0xd3)](_0x1a33c0[_0x5315b4(0x8c)])&&_0x9ce64e[_0x5315b4(0x173)]({'type':_0x5315b4(0x105),'name':_0x1a33c0['name'],'existingActivation':_0x1a33c0});}return _0x9ce64e;}function calculateYamlDiff(_0x990951,_0x32152b){if(_0x32152b){const _0x5390c9=generateDiff(_0x32152b,_0x990951),_0x42f6eb=hasChanges(_0x5390c9);return{'isNew':![],'hasChanges':_0x42f6eb,'diff':_0x42f6eb?formatDiffWithColors(_0x5390c9):undefined};}const _0x11ccf4=generateDiff('',_0x990951);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x11ccf4)};}export function calculateSegmentDiff(_0x82deb1,_0x2cc9d9,_0x14033a,_0x193315,_0x5b9939){const _0x166968=segmentToYamlString(_0x82deb1),_0x3959b8=_0x2cc9d9?segmentToYamlString(segmentWithActivationsToYaml(_0x2cc9d9,_0x14033a,undefined,_0x193315,_0x5b9939)):undefined;return calculateYamlDiff(_0x166968,_0x3959b8);}export function calculateJourneyDiff(_0x3493d3,_0xf77c54){const _0x505d4d=normalizeJourneyDef(_0x3493d3,_0x3493d3),_0x5e2317=a142_0x2aac63(_0x505d4d),_0x339e11=_0xf77c54?a142_0x2aac63(normalizeJourneyDef(_0xf77c54,_0x3493d3)):undefined;return calculateYamlDiff(_0x5e2317,_0x339e11);}export function findSegmentsToDelete(_0xdff48f,_0x394a0c,_0x1ace6f,_0x39cf7c,_0x5afa30){const _0x139aa8=a142_0x5a51,_0x40e83f=new Set();for(const {yamlConfig:_0x4797aa,folderPath:_0x3e8821}of _0x394a0c){_0x40e83f[_0x139aa8(0x154)](_0x3e8821+':'+_0x4797aa[_0x139aa8(0x8c)]);}return _0xdff48f[_0x139aa8(0x155)](_0x58d4ca=>{const _0x525887=_0x139aa8,_0x1a2875=_0x58d4ca['segmentFolderId']?_0x1ace6f['get'](_0x58d4ca[_0x525887(0x8f)][_0x525887(0xcc)]())||'':'',_0x31595a=_0x1a2875+':'+_0x58d4ca[_0x525887(0x8c)];if(_0x40e83f[_0x525887(0xd3)](_0x31595a))return![];if(_0x5afa30)return _0x1a2875===_0x39cf7c||_0x1a2875['startsWith'](_0x39cf7c+'/');return!![];});}export function findJourneysToDelete(_0x5cf46d,_0x2fdc54,_0x391d8f,_0x3cfb42,_0x3ec681){const _0x34aa71=a142_0x5a51,_0x32bd82=new Set();for(const {yamlConfig:_0x6ad753,folderPath:_0x312f17}of _0x2fdc54){_0x32bd82['add'](_0x312f17+':'+_0x6ad753[_0x34aa71(0x8c)]);}return _0x5cf46d[_0x34aa71(0x155)](_0x2842a0=>{const _0x2a6800=_0x34aa71,_0x4b1a91=_0x2842a0[_0x2a6800(0xcb)]?_0x391d8f[_0x2a6800(0x185)](_0x2842a0[_0x2a6800(0xcb)])||'':'',_0xa0abe3=_0x4b1a91+':'+_0x2842a0[_0x2a6800(0xd1)];if(_0x32bd82['has'](_0xa0abe3))return![];if(_0x3ec681)return _0x4b1a91===_0x3cfb42||_0x4b1a91[_0x2a6800(0x129)](_0x3cfb42+'/');return!![];});}export function buildSegmentLookupMap(_0xf46b00,_0x4676a0){const _0x298632=a142_0x5a51,_0x4b4585=new Map();for(const _0x85f7de of _0xf46b00){const _0xdb7018=_0x85f7de[_0x298632(0x8f)]?_0x4676a0[_0x298632(0x185)](_0x85f7de[_0x298632(0x8f)][_0x298632(0xcc)]())||'':'',_0x5c8cd8=_0xdb7018+':'+_0x85f7de[_0x298632(0x8c)];_0x4b4585['set'](_0x5c8cd8,_0x85f7de);}return _0x4b4585;}export function buildSegmentNameToIdMap(_0x9dd6d4){const _0x5e9b44=a142_0x5a51,_0x36f095=new Map();for(const _0x27bfda of _0x9dd6d4){_0x36f095[_0x5e9b44(0x156)](_0x27bfda['name'],_0x27bfda['id']);}return _0x36f095;}export function buildJourneyBundleLookupMap(_0x3d4565,_0x99f2d3){const _0x2499c7=a142_0x5a51,_0x4b2076=new Map();for(const _0x1d7805 of _0x3d4565){const _0x4ad5b8=_0x1d7805[_0x2499c7(0xcb)]?_0x99f2d3[_0x2499c7(0x185)](_0x1d7805[_0x2499c7(0xcb)])||'':'',_0x324052=_0x4ad5b8+':'+_0x1d7805[_0x2499c7(0xd1)];!_0x4b2076['has'](_0x324052)&&_0x4b2076[_0x2499c7(0x156)](_0x324052,[]),_0x4b2076[_0x2499c7(0x185)](_0x324052)[_0x2499c7(0x173)](_0x1d7805);}for(const _0x52d521 of _0x4b2076['values']()){_0x52d521[_0x2499c7(0xfd)]((_0x2d8a81,_0x38a98c)=>(_0x2d8a81[_0x2499c7(0x128)]||0x0)-(_0x38a98c[_0x2499c7(0x128)]||0x0));}return _0x4b2076;}function a142_0x42c6(_0x3718ef,_0x5ef35c){_0x3718ef=_0x3718ef-0x80;const _0x2daf34=a142_0x2daf();let _0x42c6d8=_0x2daf34[_0x3718ef];return _0x42c6d8;}export function collectFoldersToCreate(_0x3dcd06,_0x52fcb5){const _0x1496fd=a142_0x5a51,_0x5959bf=new Set();for(const _0x3d1409 of _0x3dcd06){if(!_0x3d1409)continue;if(_0x52fcb5[_0x1496fd(0xd3)](_0x3d1409))continue;const _0x53a0f3=_0x3d1409[_0x1496fd(0x8d)]('/');let _0x44c4e6='';for(const _0xbcceab of _0x53a0f3){_0x44c4e6=_0x44c4e6?_0x44c4e6+'/'+_0xbcceab:_0xbcceab,!_0x52fcb5[_0x1496fd(0xd3)](_0x44c4e6)&&_0x5959bf[_0x1496fd(0x154)](_0x44c4e6);}}return _0x5959bf;}export function parseAndClassifyYamlFiles(_0x4a0a44,_0xeafc1a,_0x3a8f93){const _0x19affd=a142_0x5a51,_0x160204=[],_0x3b4ac4=[];for(const _0x3199b4 of _0x4a0a44){const _0x532b40=a142_0x5c3462[_0x19affd(0x81)](_0xeafc1a,a142_0x5c3462['dirname'](_0x3199b4)),_0x36b571=_0x532b40==='.'?'':_0x532b40,_0x13d4c9=readFileSync(_0x3199b4,'utf-8'),_0x1f43f8=a142_0x5a9249['parse'](_0x13d4c9);if(isJourneyDef(_0x1f43f8)){const _0x4f2aa8=a142_0x2514e4(_0x13d4c9);_0x3b4ac4['push']({'yamlConfig':_0x4f2aa8,'folderPath':_0x36b571,'sourcePath':_0x3199b4});}else{if(!_0x3a8f93?.['skipSegments']){const _0x4876ee=parseSegmentYamlFile(_0x13d4c9),_0x12eaee=normalizeChildSegmentYaml(_0x4876ee);_0x160204[_0x19affd(0x173)]({'yamlConfig':_0x12eaee,'folderPath':_0x36b571,'sourcePath':_0x3199b4});}}}return{'segments':_0x160204,'journeys':_0x3b4ac4};}export function validateParsedFiles(_0x2dc82b,_0x567b52){const _0x1ec5a8=a142_0x5a51,_0x15250d=[];for(const {yamlConfig:_0x1b0625,sourcePath:_0x45830a}of _0x2dc82b[_0x1ec5a8(0xd4)]){const _0x528174=readFileSync(_0x45830a,'utf-8'),_0x2f9432=a142_0x5a9249['parseDocument'](_0x528174),_0x1be537=validateSegmentDef(_0x1b0625,{'source':_0x528174,'document':_0x2f9432},{'skipSchema':!![]});if(!_0x1be537['valid']){const _0x4a5db4=a142_0x5c3462[_0x1ec5a8(0x81)](_0x567b52,_0x45830a);_0x15250d[_0x1ec5a8(0x173)]({'filePath':_0x4a5db4,'source':_0x528174,'result':_0x1be537,'isJourney':![]});}}for(const {yamlConfig:_0x22e545,sourcePath:_0x3c9e38}of _0x2dc82b[_0x1ec5a8(0x14a)]){const _0x5a3aba=readFileSync(_0x3c9e38,_0x1ec5a8(0x13c)),_0x15de33=a142_0x5a9249[_0x1ec5a8(0x15d)](_0x5a3aba),_0x797505=validateJourneyDef(_0x22e545,{'source':_0x5a3aba,'document':_0x15de33},{'skipSchema':!![]});if(!_0x797505['valid']){const _0xa49e5c=a142_0x5c3462[_0x1ec5a8(0x81)](_0x567b52,_0x3c9e38);_0x15250d[_0x1ec5a8(0x173)]({'filePath':_0xa49e5c,'source':_0x5a3aba,'result':_0x797505,'isJourney':!![]});}}return _0x15250d;}export function formatValidationErrors(_0x49ff49){const _0x533700=a142_0x5a51,_0x46a41c=[];for(const {filePath:_0x56ff60,source:_0x1f778a,result:_0x3022ea,isJourney:_0x377ba0}of _0x49ff49){const _0x254ff5=_0x377ba0?'journey':_0x533700(0xf2);_0x46a41c[_0x533700(0x173)]('\x0a'+_0x56ff60+'\x20('+_0x254ff5+'):\x20'+_0x3022ea[_0x533700(0xdf)][_0x533700(0xec)]+_0x533700(0x10e)),_0x46a41c[_0x533700(0x173)](formatValidationResult(_0x3022ea,_0x1f778a,_0x56ff60));}return _0x46a41c[_0x533700(0xcd)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x55279f){const _0x5ccada=a142_0x5a51,_0x5e2fe5=new Set(),_0x2a8d08=new Map(),_0x14574e=collectSegmentUsageCounts(_0x55279f);if(_0x55279f[_0x5ccada(0xd4)])for(const [_0x5df350,_0x170d22]of Object[_0x5ccada(0x15a)](_0x55279f['segments'])){_0x5e2fe5[_0x5ccada(0x154)](_0x5df350);if(_0x170d22[_0x5ccada(0x176)]){const _0x4790b9=yamlRuleToApi(_0x170d22[_0x5ccada(0x176)]),_0x2417d3=apiRuleToYaml(_0x4790b9);_0x2a8d08[_0x5ccada(0x156)](_0x5df350,_0x2417d3);}}const _0x8832e4=new Map();let _0x32f362=0x0;for(const [_0x43fc6a,_0x6b5071]of _0x2a8d08){const _0x39528c=serializeExpandedRule(_0x6b5071,_0x2a8d08),_0x1571fc=_0x8832e4[_0x5ccada(0x185)](_0x39528c)||[];_0x1571fc['push']({'name':_0x43fc6a,'index':_0x32f362}),_0x8832e4['set'](_0x39528c,_0x1571fc),_0x32f362++;}const _0x32e82c=new Map();for(const [_0x10e110,_0x5198a4]of _0x8832e4){const _0x281aa9=_0x5198a4[_0x5ccada(0xf6)]()[_0x5ccada(0xfd)]((_0x4e8b7e,_0x11deb0)=>{const _0xc88da=_0x5ccada,_0x11ef97=_0x14574e[_0xc88da(0x185)](_0x4e8b7e[_0xc88da(0x8c)])||0x0,_0x11b573=_0x14574e['get'](_0x11deb0[_0xc88da(0x8c)])||0x0;if(_0x11ef97!==_0x11b573)return _0x11b573-_0x11ef97;return _0x4e8b7e[_0xc88da(0xf3)]-_0x11deb0[_0xc88da(0xf3)];})[_0x5ccada(0xc1)](_0x2d1b39=>_0x2d1b39[_0x5ccada(0x8c)]),_0x5d17ba=[];for(const _0x674426 of _0x281aa9){const _0x51870e=_0x14574e['get'](_0x674426)||0x0,_0x46e904=Math[_0x5ccada(0xa4)](_0x51870e,0x1);for(let _0x1dcc3a=0x0;_0x1dcc3a<_0x46e904;_0x1dcc3a++){_0x5d17ba['push'](_0x674426);}}_0x32e82c[_0x5ccada(0x156)](_0x10e110,_0x5d17ba);}return{'existingLocalSegmentNames':_0x5e2fe5,'localSegmentRules':_0x2a8d08,'localExpandedRuleToNames':_0x32e82c};}export function createSegmentIdResolver(_0x2afbe2,_0x3d941b){return async _0x2efdb0=>{const _0x488fa5=a142_0x42c6,_0x2eb103=_0x2afbe2[_0x488fa5(0x185)](_0x2efdb0);if(!_0x2eb103)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x2efdb0+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x3d941b+'\x27)');return _0x2eb103;};}export function extractRootFolderId(_0x2cf952){const _0x577f9d=a142_0x5a51;return _0x2cf952[_0x577f9d(0x163)]?.[_0x577f9d(0x13a)]?.[_0x577f9d(0x149)]?.['id']||_0x2cf952['relationships']?.[_0x577f9d(0x131)]?.['data']?.['id'];}export function buildConnectionMaps(_0x59a6e9){const _0x5e0186=a142_0x5a51,_0x27ad77=new Map(),_0x3496bc=new Map(),_0x43660a=new Map();for(const _0x404ac8 of _0x59a6e9){_0x27ad77[_0x5e0186(0x156)](_0x404ac8[_0x5e0186(0x8c)],parseInt(_0x404ac8['id'],0xa)),_0x3496bc['set'](_0x404ac8['id'],_0x404ac8['name']),_0x43660a['set'](_0x404ac8[_0x5e0186(0x8c)],_0x404ac8[_0x5e0186(0xa2)]);}return{'nameToId':_0x27ad77,'idToName':_0x3496bc,'nameToType':_0x43660a};}export function calculatePushStats(_0x36fa0e,_0x1cf009,_0x3716b6,_0x5f07ff,_0x5aa2ba,_0x57dce2,_0x31ae22){const _0xc734ad=a142_0x5a51,_0x344315=_0x36fa0e[_0xc734ad(0x155)](_0x4d8738=>_0x4d8738[_0xc734ad(0x89)]),_0x21a547=_0x36fa0e['filter'](_0x14d41d=>!_0x14d41d['isNew']&&_0x14d41d[_0xc734ad(0xe3)]),_0x5b9f5d=_0x36fa0e[_0xc734ad(0x155)](_0x2846b5=>!_0x2846b5['isNew']&&!_0x2846b5[_0xc734ad(0xe3)]),_0x1f050d=_0x57dce2?_0x5f07ff:[],_0x1f5d08=_0x1cf009['filter'](_0x507457=>_0x507457['isNew']),_0x5dd6b5=_0x1cf009[_0xc734ad(0x155)](_0x22dce7=>!_0x22dce7[_0xc734ad(0x89)]&&_0x22dce7[_0xc734ad(0xe3)]),_0x129a97=_0x1cf009['filter'](_0x4e09e2=>!_0x4e09e2[_0xc734ad(0x89)]&&!_0x4e09e2[_0xc734ad(0xe3)]),_0x2b7728=_0x57dce2?_0x5aa2ba:[],_0x46db84=_0x36fa0e['flatMap'](_0x4ece71=>_0x4ece71[_0xc734ad(0x11b)]),_0x34ca16=_0x46db84[_0xc734ad(0x155)](_0x74c39f=>_0x74c39f[_0xc734ad(0xa2)]===_0xc734ad(0x143)),_0xb07d8b=_0x46db84[_0xc734ad(0x155)](_0x2c34da=>_0x2c34da[_0xc734ad(0xa2)]===_0xc734ad(0x17b)),_0xded13c=_0x46db84[_0xc734ad(0x155)](_0x46b166=>_0x46b166['type']===_0xc734ad(0x105)),_0x2e1d7a=Array[_0xc734ad(0x97)](_0x3716b6)[_0xc734ad(0xfd)](),_0x4c51a3=_0x31ae22?![]:_0x344315[_0xc734ad(0xec)]>0x0||_0x21a547[_0xc734ad(0xec)]>0x0||_0x1f050d[_0xc734ad(0xec)]>0x0,_0x4142a2=_0x1f5d08['length']>0x0||_0x5dd6b5['length']>0x0||_0x2b7728[_0xc734ad(0xec)]>0x0,_0x3339c2=_0x31ae22?![]:_0x46db84['length']>0x0,_0x3b91a2=_0x2e1d7a[_0xc734ad(0xec)]>0x0;return{'segments':{'new':_0x344315,'changed':_0x21a547,'unchanged':_0x5b9f5d,'toDelete':_0x1f050d},'journeys':{'new':_0x1f5d08,'changed':_0x5dd6b5,'unchanged':_0x129a97,'toDelete':_0x2b7728},'activations':{'all':_0x46db84,'toCreate':_0x34ca16,'toUpdate':_0xb07d8b,'toDelete':_0xded13c},'folders':{'toCreate':_0x2e1d7a},'counts':{'segments':{'new':_0x344315[_0xc734ad(0xec)],'changed':_0x21a547[_0xc734ad(0xec)],'unchanged':_0x5b9f5d[_0xc734ad(0xec)],'toDelete':_0x1f050d[_0xc734ad(0xec)]},'journeys':{'new':_0x1f5d08[_0xc734ad(0xec)],'changed':_0x5dd6b5[_0xc734ad(0xec)],'unchanged':_0x129a97[_0xc734ad(0xec)],'toDelete':_0x2b7728[_0xc734ad(0xec)]},'activations':{'create':_0x34ca16['length'],'update':_0xb07d8b[_0xc734ad(0xec)],'delete':_0xded13c[_0xc734ad(0xec)]},'folders':_0x2e1d7a[_0xc734ad(0xec)]},'hasChanges':_0x4c51a3||_0x4142a2||_0x3339c2||_0x3b91a2};}export async function buildPushExecutionContext(_0x385612,_0x4572b2,_0x1b6a6b,_0x1d9447,_0x53d2c1,_0xfffcf0){const _0x1f1d5a=a142_0x5a51,_0x2e3502=extractRootFolderId(_0x1b6a6b),{pathToId:_0x30fbb8,idToPath:_0x2bd96b}=buildFolderMaps(_0x53d2c1),_0xadb840=buildSegmentNameToIdMap(_0x1d9447),_0x47d13a=new Map(),{batchAsync:_0x13697a}=await import('../../utils/async.js'),[_0x987490,_0x59d42a]=await Promise[_0x1f1d5a(0x126)]([_0x385612[_0x1f1d5a(0x130)]['buildUserMaps'](),_0x385612[_0x1f1d5a(0x134)][_0x1f1d5a(0x12d)](),((async()=>{!_0xfffcf0&&_0x1d9447['length']>0x0&&await _0x13697a(_0x1d9447,async _0x34d55f=>{const _0x2acb87=a142_0x42c6,_0x1c68a2=await _0x385612[_0x2acb87(0xf2)][_0x2acb87(0x80)](_0x4572b2,_0x34d55f['id']);_0x47d13a[_0x2acb87(0x156)](_0x34d55f['id'],_0x1c68a2);});})())]),{emailToId:_0x4875cd,idToEmail:_0x5e2417}=_0x987490,_0x268670=buildConnectionMaps(_0x59d42a);return{'rootFolderId':_0x2e3502,'folderPathToId':_0x30fbb8,'folderIdToPath':_0x2bd96b,'segmentNameToId':_0xadb840,'activationsBySegmentId':_0x47d13a,'emailToIdMap':_0x4875cd,'idToEmailMap':_0x5e2417,'connectionNameToIdMap':_0x268670['nameToId'],'connectionIdToNameMap':_0x268670[_0x1f1d5a(0x9f)],'connectionNameToTypeMap':_0x268670[_0x1f1d5a(0xb2)]};}export function createPushYamlContextForBundle(_0x36588d,_0x3b5738,_0x5162c8,_0x2252d3,_0x381aa9,_0x1a9b32,_0x5e6ca5,_0x3e9e49){const {existingLocalSegmentNames:_0x1eef09,localExpandedRuleToNames:_0x38a6a0}=_0x2252d3,_0x8cddf3=new Set(),_0x46031c=new Map(),_0x4658c5=new Map(),_0x546225=new Map(),_0x1412aa=createJumpTargetCache(),_0x5d6d86=new Map(),_0x392ec7=new Map(),_0x5c828b=new Set();let _0x440a88;const _0x584009=_0x357ac1=>{const _0x5d11f1={'resolveSegment':async _0xf5d455=>{const _0x4c0262=a142_0x42c6,_0x4bcb06=_0x546225[_0x4c0262(0x185)](_0xf5d455);if(_0x4bcb06!==undefined)return{'name':_0x4bcb06,'isJourneyLocal':!![]};try{const _0x2317c0=await fetchSegment(_0x36588d,_0x3b5738,_0xf5d455,_0x5162c8);if(!_0x2317c0)throw new Error(_0x4c0262(0x98));const _0x3b1db4=generateJourneyLocalName(_0x2317c0[_0x4c0262(0x8c)]),_0x4f7d38=_0x2317c0[_0x4c0262(0x93)]===SEGMENT_KIND_JOURNEY&&_0x3b1db4!==undefined;let _0x384e29=_0x2317c0[_0x4c0262(0x8c)],_0x5dd9ce;if(_0x4f7d38&&_0x2317c0[_0x4c0262(0x176)]){const _0x595519=apiRuleToYaml(_0x2317c0['rule']);_0x392ec7[_0x4c0262(0x156)](_0xf5d455,_0x595519);const _0x43c197=async _0x257567=>{const _0x2692e6=_0x4c0262,_0x181091=collectSegmentRefsFromRule(_0x257567);for(const _0x174a3f of _0x181091){if(!_0x392ec7[_0x2692e6(0xd3)](_0x174a3f))try{const _0x47a782=await fetchSegment(_0x36588d,_0x3b5738,_0x174a3f,_0x5162c8);if(_0x47a782?.[_0x2692e6(0x176)]){const _0x2ebc7c=apiRuleToYaml(_0x47a782[_0x2692e6(0x176)]);_0x392ec7[_0x2692e6(0x156)](_0x174a3f,_0x2ebc7c),await _0x43c197(_0x2ebc7c);}}catch(_0x39ebab){logger[_0x2692e6(0x186)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x174a3f+':\x20'+_0x39ebab);}}};await _0x43c197(_0x595519);const _0x236beb=serializeExpandedRule(_0x595519,_0x392ec7),_0x490afb=_0x38a6a0[_0x4c0262(0x185)](_0x236beb);if(_0x490afb&&_0x490afb[_0x4c0262(0xec)]>0x0){const _0x5d47ec=_0x46031c[_0x4c0262(0x185)](_0x236beb)||0x0,_0x55e79e=_0x490afb[_0x5d47ec]||_0x490afb[_0x490afb[_0x4c0262(0xec)]-0x1];_0x46031c[_0x4c0262(0x156)](_0x236beb,_0x5d47ec+0x1),_0x384e29=_0x55e79e,_0x8cddf3[_0x4c0262(0x154)](_0x384e29),_0x546225[_0x4c0262(0x156)](_0xf5d455,_0x384e29);const _0x8b25db=await resolveRuleSegmentRefs(_0x595519,async _0x431a0c=>{const _0x3c543c=_0x4c0262,_0x39183f=_0x546225['get'](_0x431a0c);if(_0x39183f)return _0x39183f;const _0x4c4bc6=await _0x440a88[_0x3c543c(0xdd)](_0x431a0c);return _0x4c4bc6[_0x3c543c(0x8c)];});_0x5dd9ce={'description':_0x2317c0['description'],'rule':_0x8b25db};}else{const _0x394af1=_0x5d6d86[_0x4c0262(0x185)](_0x236beb);if(_0x394af1)_0x384e29=_0x394af1,_0x546225[_0x4c0262(0x156)](_0xf5d455,_0x384e29);else{if(_0x3b1db4){let _0x2a04e3=_0x3b1db4,_0x2c8dcb=0x2;while(_0x8cddf3['has'](_0x2a04e3)||_0x1eef09[_0x4c0262(0xd3)](_0x2a04e3)){_0x2a04e3=_0x3b1db4+'_'+_0x2c8dcb,_0x2c8dcb++;}_0x8cddf3[_0x4c0262(0x154)](_0x2a04e3),_0x384e29=_0x2a04e3;}_0x546225['set'](_0xf5d455,_0x384e29),_0x5d6d86[_0x4c0262(0x156)](_0x236beb,_0x384e29);const _0x263997=await resolveRuleSegmentRefs(_0x595519,async _0x7970c6=>{const _0x16330f=_0x4c0262,_0x2fdfe2=_0x546225[_0x16330f(0x185)](_0x7970c6);if(_0x2fdfe2)return _0x2fdfe2;const _0x3ecc7a=await _0x440a88['resolveSegment'](_0x7970c6);return _0x3ecc7a['name'];});_0x5dd9ce={'description':_0x2317c0[_0x4c0262(0x167)],'rule':_0x263997};}}}return{'name':_0x384e29,'isJourneyLocal':_0x4f7d38,'definition':_0x5dd9ce};}catch(_0x46af5a){return logger['debug']('Failed\x20to\x20resolve\x20segment\x20'+_0xf5d455+':\x20'+_0x46af5a),{'name':_0xf5d455,'isJourneyLocal':![]};}},'resolveActivation':async _0x5a98b4=>{const _0x3ea871=a142_0x42c6,_0x9408b7=_0x4658c5['get'](_0x5a98b4);if(_0x9408b7!==undefined)return{'name':_0x9408b7,'isJourneyLocal':!![]};try{let _0x5066de=_0x5e6ca5?.[_0x3ea871(0x185)](_0x5a98b4);!_0x5066de&&(_0x5066de=await _0x36588d[_0x3ea871(0x164)]['getActivation'](_0x357ac1,_0x5a98b4));const _0x1c58cc=_0x5066de[_0x3ea871(0xc6)][_0x3ea871(0x170)][_0x3ea871(0x8c)]||_0x5a98b4,_0x5a51e8=sanitizeYamlKey(_0x1c58cc)||_0x3ea871(0x142)+_0x5a98b4,_0x20f108=_0x5a51e8;_0x4658c5['set'](_0x5a98b4,_0x20f108);const _0x53540b=journeyActivationStepToYaml(_0x5066de,_0x381aa9,_0x1a9b32);return{'name':_0x20f108,'isJourneyLocal':!![],'definition':_0x53540b};}catch(_0x10f54f){return logger[_0x3ea871(0x186)]('Failed\x20to\x20resolve\x20activation\x20'+_0x5a98b4+':\x20'+_0x10f54f),{'name':_0x5a98b4,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x1338a3,_0x455314)=>resolveJumpTarget(_0x1338a3,_0x455314,_0x1412aa,async _0x467ff4=>{const _0x668283=a142_0x42c6,_0x1a3be4=_0x3e9e49?.[_0x668283(0x185)](_0x467ff4);if(_0x1a3be4)return _0x1a3be4;return _0x36588d['journey'][_0x668283(0x157)](_0x467ff4);})};return _0x440a88=_0x5d11f1,_0x5d11f1;},_0x75893e=async _0xe932e5=>{const _0x265242=a142_0x42c6,{collectSegmentIdsFromJourneyApi:_0x39dadd}=await import(_0x265242(0x114)),{batchAsync:_0x508690}=await import(_0x265242(0x85)),_0x24ef11=new Set();for(const _0x29bead of _0xe932e5){let _0x509d27=_0x3e9e49?.[_0x265242(0x185)](_0x29bead);!_0x509d27&&(_0x509d27=await _0x36588d['journey'][_0x265242(0x157)](_0x29bead));const _0x8c0c10=_0x39dadd(_0x509d27);for(const _0x2cbd0f of _0x8c0c10){_0x24ef11['add'](_0x2cbd0f);}}let _0x4598d0=Array['from'](_0x24ef11);while(_0x4598d0['length']>0x0){const _0x122a09=_0x4598d0[_0x265242(0x155)](_0x4efba4=>!_0x5c828b[_0x265242(0xd3)](_0x4efba4));if(_0x122a09[_0x265242(0xec)]===0x0)break;const _0x47a4f7=await _0x508690(_0x122a09,async _0x44e8ba=>{const _0x1deb81=_0x265242;_0x5c828b[_0x1deb81(0x154)](_0x44e8ba);const _0x3a50e0=await fetchSegment(_0x36588d,_0x3b5738,_0x44e8ba,_0x5162c8);if(!_0x3a50e0)return null;return{'segmentId':_0x44e8ba,'segment':_0x3a50e0};},0xa),_0x5b47b2=new Set();for(const _0x44f1f0 of _0x47a4f7){if(!_0x44f1f0?.[_0x265242(0xf2)]?.['rule'])continue;const _0x9037cd=apiRuleToYaml(_0x44f1f0[_0x265242(0xf2)][_0x265242(0x176)]);_0x392ec7['set'](_0x44f1f0['segmentId'],_0x9037cd);const _0x5988b8=collectSegmentRefsFromRule(_0x9037cd);for(const _0x2ac34b of _0x5988b8){!_0x5c828b['has'](_0x2ac34b)&&_0x5b47b2[_0x265242(0x154)](_0x2ac34b);}}_0x4598d0=Array[_0x265242(0x97)](_0x5b47b2);}};return{'createYamlContext':_0x584009,'prefetchJourneySegments':_0x75893e};}export async function executePushSegments(_0x588e96,_0x10462c,_0x285050,_0x54f431,_0x2d1614){const _0x40cf85=a142_0x5a51,{segmentDefToCreateRequest:_0x440784,segmentDefToUpdateRequest:_0x46f965}=await import(_0x40cf85(0x12a)),_0x3c93bb=_0x285050[_0x40cf85(0x116)],_0x49e9af=0x5,_0x3795cb=async _0x4e2bf3=>{const _0x236c2e=_0x40cf85,_0x31789e=_0x4e2bf3[_0x236c2e(0x107)]?_0x3c93bb['get'](_0x4e2bf3[_0x236c2e(0x107)]):undefined;let _0x230d8a;const _0x3b22cd={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x2c5e7b=_0x4e2bf3[_0x236c2e(0x124)];if(_0x4e2bf3['yamlConfig'][_0x236c2e(0x176)]){const _0x2d5a03=createSegmentIdResolver(_0x285050[_0x236c2e(0x151)],_0x4e2bf3[_0x236c2e(0x124)]['name']),_0x5d31ff=await resolveRuleSegmentIds(_0x4e2bf3['yamlConfig']['rule'],_0x2d5a03);_0x2c5e7b={..._0x4e2bf3['yamlConfig'],'rule':_0x5d31ff};}try{if(_0x4e2bf3['isNew']){_0x2d1614[_0x236c2e(0xad)]?.({'type':_0x236c2e(0x16f),'name':_0x4e2bf3[_0x236c2e(0x124)][_0x236c2e(0x8c)]});const _0x4d71cf=_0x440784(_0x2c5e7b,_0x31789e),_0x56b9cc=await _0x2d1614[_0x236c2e(0x115)](_0x236c2e(0x106)+_0x4e2bf3[_0x236c2e(0x124)]['name']+'\x27...',()=>_0x588e96['segment'][_0x236c2e(0xb1)](_0x54f431[_0x236c2e(0xee)],_0x4d71cf));_0x230d8a=_0x56b9cc[_0x236c2e(0x149)]['id'],_0x285050[_0x236c2e(0x151)][_0x236c2e(0x156)](_0x4e2bf3[_0x236c2e(0x124)][_0x236c2e(0x8c)],_0x230d8a),_0x3b22cd[_0x236c2e(0x82)]={'name':_0x4e2bf3[_0x236c2e(0x124)][_0x236c2e(0x8c)],'id':_0x230d8a},_0x2d1614[_0x236c2e(0xad)]?.({'type':'segment_created','name':_0x4e2bf3[_0x236c2e(0x124)]['name'],'segmentId':_0x230d8a}),_0x2d1614['logSuccess']?.(_0x236c2e(0x13f)+_0x4e2bf3[_0x236c2e(0x124)][_0x236c2e(0x8c)]+'\x27'),_0x3b22cd[_0x236c2e(0xa8)]=0x1;}else{if(_0x4e2bf3[_0x236c2e(0xe3)]){_0x2d1614['onProgress']?.({'type':'segment_updating','name':_0x4e2bf3[_0x236c2e(0x124)][_0x236c2e(0x8c)]});const _0x431c9c=_0x46f965(_0x2c5e7b);_0x31789e!==_0x4e2bf3['existingSegment']?.['segmentFolderId']&&(_0x431c9c[_0x236c2e(0x8f)]=_0x31789e?parseInt(_0x31789e,0xa):undefined),await _0x2d1614[_0x236c2e(0x115)](_0x236c2e(0x182)+_0x4e2bf3[_0x236c2e(0x124)][_0x236c2e(0x8c)]+'\x27...',()=>_0x588e96[_0x236c2e(0xf2)][_0x236c2e(0x10c)](_0x54f431[_0x236c2e(0xee)],_0x4e2bf3[_0x236c2e(0xa3)]['id'],_0x431c9c)),_0x230d8a=_0x4e2bf3[_0x236c2e(0xa3)]['id'],_0x2d1614['onProgress']?.({'type':_0x236c2e(0xf9),'name':_0x4e2bf3[_0x236c2e(0x124)][_0x236c2e(0x8c)]}),_0x2d1614[_0x236c2e(0x11d)]?.('Updated\x20segment\x20\x27'+_0x4e2bf3[_0x236c2e(0x124)]['name']+'\x27'),_0x3b22cd['updated']=0x1;}else _0x230d8a=_0x4e2bf3[_0x236c2e(0xa3)]['id'];}}catch(_0x261057){const _0x25d892=isHttp400Error(_0x261057),_0xd860a8=_0x25d892?ErrorCode[_0x236c2e(0xbf)]:ErrorCode[_0x236c2e(0x14d)],_0x5d1024=getErrorMessage(_0x261057);throw new SDKError(_0xd860a8,_0x236c2e(0xed)+(_0x4e2bf3['isNew']?_0x236c2e(0x143):_0x236c2e(0x17b))+_0x236c2e(0x16b)+_0x4e2bf3['absolutePath']+_0x236c2e(0xc4)+_0x5d1024,_0x261057);}try{const _0x89f99d=await syncActivationsForSegment(_0x588e96,_0x54f431[_0x236c2e(0xee)],_0x230d8a,_0x4e2bf3[_0x236c2e(0x124)][_0x236c2e(0x8c)],_0x4e2bf3[_0x236c2e(0x11b)],_0x2d1614,_0x4e2bf3['absolutePath']);_0x3b22cd[_0x236c2e(0x17d)]=_0x89f99d;}catch(_0x309042){if(_0x309042 instanceof SDKError)throw _0x309042;throw new SDKError(ErrorCode[_0x236c2e(0x146)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x4e2bf3['yamlConfig']['name']+_0x236c2e(0x152)+_0x4e2bf3['absolutePath']+_0x236c2e(0xc4)+getErrorMessage(_0x309042),_0x309042);}return _0x3b22cd;},_0x2761ca=await batchAsync(_0x10462c,_0x3795cb,_0x49e9af),_0x4b69e6={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0xeec735 of _0x2761ca){_0x4b69e6[_0x40cf85(0xa8)]+=_0xeec735[_0x40cf85(0xa8)],_0x4b69e6['updated']+=_0xeec735[_0x40cf85(0xde)],_0xeec735['createdSegmentId']&&_0x4b69e6[_0x40cf85(0xd8)][_0x40cf85(0x156)](_0xeec735[_0x40cf85(0x82)][_0x40cf85(0x8c)],_0xeec735[_0x40cf85(0x82)]['id']),_0x4b69e6[_0x40cf85(0x17d)][_0x40cf85(0xa8)]+=_0xeec735[_0x40cf85(0x17d)][_0x40cf85(0xa8)],_0x4b69e6[_0x40cf85(0x17d)][_0x40cf85(0xde)]+=_0xeec735[_0x40cf85(0x17d)][_0x40cf85(0xde)],_0x4b69e6['activations']['deleted']+=_0xeec735['activations'][_0x40cf85(0xef)];}return _0x4b69e6;}async function syncActivationsForSegment(_0x49c204,_0x587189,_0x1bffb5,_0x3e3488,_0x567926,_0x2216e9,_0x3fcda2){const _0x136a46=a142_0x5a51,_0x574bd6={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x2175e1 of _0x567926){try{if(_0x2175e1[_0x136a46(0xa2)]==='create'&&_0x2175e1['validatedRequest'])_0x2216e9[_0x136a46(0xad)]?.({'type':'activation_creating','segmentName':_0x3e3488,'activationName':_0x2175e1['name']}),await _0x2216e9[_0x136a46(0x115)](_0x136a46(0xa9)+_0x2175e1[_0x136a46(0x8c)]+'\x27...',()=>_0x49c204[_0x136a46(0xf2)]['createActivation'](_0x587189,_0x1bffb5,_0x2175e1[_0x136a46(0x94)])),_0x2216e9[_0x136a46(0xad)]?.({'type':'activation_created','segmentName':_0x3e3488,'activationName':_0x2175e1[_0x136a46(0x8c)]}),_0x2216e9['logSuccess']?.(_0x136a46(0x133)+_0x2175e1[_0x136a46(0x8c)]+'\x27'),_0x574bd6[_0x136a46(0xa8)]++;else{if(_0x2175e1['type']===_0x136a46(0x17b)&&_0x2175e1[_0x136a46(0x94)]&&_0x2175e1[_0x136a46(0xb5)])_0x2216e9['onProgress']?.({'type':_0x136a46(0x91),'segmentName':_0x3e3488,'activationName':_0x2175e1['name']}),await _0x2216e9[_0x136a46(0x115)](_0x136a46(0x180)+_0x2175e1['name']+'\x27...',()=>_0x49c204['segment'][_0x136a46(0xd7)](_0x587189,_0x1bffb5,_0x2175e1[_0x136a46(0xb5)]['id'],_0x2175e1[_0x136a46(0x94)])),_0x2216e9[_0x136a46(0xad)]?.({'type':_0x136a46(0xe4),'segmentName':_0x3e3488,'activationName':_0x2175e1[_0x136a46(0x8c)]}),_0x2216e9[_0x136a46(0x11d)]?.(_0x136a46(0x15c)+_0x2175e1[_0x136a46(0x8c)]+'\x27'),_0x574bd6[_0x136a46(0xde)]++;else _0x2175e1[_0x136a46(0xa2)]===_0x136a46(0x105)&&_0x2175e1['existingActivation']&&(_0x2216e9[_0x136a46(0xad)]?.({'type':_0x136a46(0x118),'segmentName':_0x3e3488,'activationName':_0x2175e1[_0x136a46(0x8c)]}),await _0x2216e9[_0x136a46(0x115)](_0x136a46(0xd5)+_0x2175e1[_0x136a46(0x8c)]+_0x136a46(0xbb),()=>_0x49c204[_0x136a46(0xf2)][_0x136a46(0xd6)](_0x587189,_0x1bffb5,_0x2175e1[_0x136a46(0xb5)]['id'])),_0x2216e9[_0x136a46(0xad)]?.({'type':'activation_deleted','segmentName':_0x3e3488,'activationName':_0x2175e1[_0x136a46(0x8c)]}),_0x2216e9[_0x136a46(0x104)]?.(_0x136a46(0xe9)+_0x2175e1[_0x136a46(0x8c)]+'\x27'),_0x574bd6[_0x136a46(0xef)]++);}}catch(_0x5a2680){const _0x437538=isHttp400Error(_0x5a2680),_0x1bbc54=_0x437538?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x136a46(0x146)],_0x352847=getErrorMessage(_0x5a2680);throw new SDKError(_0x1bbc54,_0x136a46(0xed)+_0x2175e1['type']+_0x136a46(0xd9)+_0x2175e1[_0x136a46(0x8c)]+_0x136a46(0x152)+_0x3fcda2+_0x136a46(0xc4)+_0x352847,_0x5a2680);}}return _0x574bd6;}export async function executePushFolders(_0x5823ad,_0x5868f2,_0x9b5398,_0xbb0ce8,_0xe30116){const _0x22abca=a142_0x5a51,_0x3a6d6d=new Map(_0x9b5398),_0x29f9f9=sortFoldersByDepth(_0x5868f2);for(const _0x4a78ea of _0x29f9f9){const _0xa3ad2=_0x4a78ea[_0x22abca(0x8d)]('/'),_0x175874=_0xa3ad2[_0xa3ad2[_0x22abca(0xec)]-0x1],_0x498a2f=_0xa3ad2['slice'](0x0,-0x1)['join']('/'),_0x3b1475=_0x3a6d6d[_0x22abca(0x185)](_0x498a2f);_0xe30116[_0x22abca(0xad)]?.({'type':_0x22abca(0x84),'folder':_0x4a78ea});const _0x2379cb={'name':_0x175874,'parentFolderId':_0x3b1475},_0x5a60cc=await _0xe30116['withProgress'](_0x22abca(0xc8)+_0x4a78ea+_0x22abca(0xbb),()=>_0x5823ad[_0x22abca(0xf2)][_0x22abca(0xe5)](_0xbb0ce8[_0x22abca(0xee)],_0x2379cb));_0x3a6d6d[_0x22abca(0x156)](_0x4a78ea,_0x5a60cc[_0x22abca(0x149)]['id']),_0xe30116['onProgress']?.({'type':_0x22abca(0xdc),'folder':_0x4a78ea,'folderId':_0x5a60cc[_0x22abca(0x149)]['id']}),_0xe30116[_0x22abca(0x11f)]?.(_0x22abca(0x12e)+_0x4a78ea+'\x27');}return _0x3a6d6d;}export async function executePushSegmentDeletions(_0x4a58ba,_0x3ddc1f,_0x93602e){const _0x905e62=a142_0x5a51;if(_0x3ddc1f[_0x905e62(0xec)]===0x0)return 0x0;const {batchAsync:_0x50cf31}=await import(_0x905e62(0x85)),_0x2202f6=0x5,_0x222128=await _0x50cf31(_0x3ddc1f,async _0x2b4f76=>{const _0x546eed=_0x905e62;return _0x93602e['onProgress']?.({'type':_0x546eed(0xe2),'name':_0x2b4f76[_0x546eed(0x8c)]}),await _0x4a58ba[_0x546eed(0xf2)][_0x546eed(0xa5)](_0x2b4f76['id']),_0x93602e[_0x546eed(0xad)]?.({'type':'segment_deleted','name':_0x2b4f76[_0x546eed(0x8c)]}),_0x93602e[_0x546eed(0x104)]?.(_0x546eed(0x122)+_0x2b4f76['name']+'\x27'),0x1;},_0x2202f6);return _0x222128[_0x905e62(0xbe)]((_0x1d13bc,_0x23ebfd)=>_0x1d13bc+_0x23ebfd,0x0);}export async function executePushJourneys(_0x374b39,_0x4c99fd,_0xe769aa,_0x3716d5,_0x59369c){const _0x1dcab4=a142_0x5a51,{journeyDefToRequest:_0xacad6d}=await import(_0x1dcab4(0x114)),{activationDefToCreateRequest:_0x226d0c,yamlRuleToApi:_0x4493b3,validateSegmentRule:_0x1db275}=await import('./child-segment-yaml.js'),_0x57c0a6={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4275a0=new Map(_0xe769aa['segmentNameToId']),_0x104a3e=0x5;for(let _0x8c8d38=0x0;_0x8c8d38<_0x4c99fd['length'];_0x8c8d38+=_0x104a3e){const _0x4b85ac=_0x4c99fd[_0x1dcab4(0xf6)](_0x8c8d38,_0x8c8d38+_0x104a3e),_0x3e9efa=await Promise[_0x1dcab4(0x126)](_0x4b85ac[_0x1dcab4(0xc1)](async _0x401e0e=>{const _0x1fc850=_0x1dcab4;if(!_0x401e0e[_0x1fc850(0x89)]&&!_0x401e0e[_0x1fc850(0xe3)])return{'action':_0x1fc850(0xe8),'name':_0x401e0e[_0x1fc850(0x124)]['name'],'journeyId':_0x401e0e[_0x1fc850(0x139)]?.['id']};const _0x209361=_0x401e0e[_0x1fc850(0x107)]?_0xe769aa[_0x1fc850(0x116)]['get'](_0x401e0e[_0x1fc850(0x107)]):undefined;_0x59369c[_0x1fc850(0xad)]?.({'type':_0x401e0e[_0x1fc850(0x89)]?_0x1fc850(0x14b):'journey_updating','name':_0x401e0e['yamlConfig'][_0x1fc850(0x8c)]});try{const _0x77a589=await executeSingleJourneyPush(_0x374b39,_0x401e0e,{..._0xe769aa,'segmentNameToId':_0x4275a0},{'parentId':_0x3716d5[_0x1fc850(0xee)],'rootFolderId':_0x3716d5['rootFolderId'],'folderId':_0x209361,'verbose':_0x3716d5[_0x1fc850(0x153)]},_0x59369c,{'journeyDefToRequest':_0xacad6d,'activationDefToCreateRequest':_0x226d0c,'yamlRuleToApi':_0x4493b3,'validateSegmentRule':_0x1db275});for(const [_0x3c16ba,_0x356448]of _0x77a589['embeddedSegmentNameToId']){_0x4275a0['set'](_0x3c16ba,_0x356448),_0x57c0a6[_0x1fc850(0xaf)][_0x1fc850(0x156)](_0x3c16ba,_0x356448);}if(_0x77a589[_0x1fc850(0xae)]==='created')_0x59369c[_0x1fc850(0xad)]?.({'type':_0x1fc850(0xac),'name':_0x401e0e['yamlConfig'][_0x1fc850(0x8c)],'journeyId':_0x77a589[_0x1fc850(0xaa)]}),_0x59369c['logSuccess']?.(_0x1fc850(0x150)+_0x401e0e['yamlConfig'][_0x1fc850(0x8c)]+'\x27'),_0x57c0a6[_0x1fc850(0xa8)]++;else _0x77a589[_0x1fc850(0xae)]===_0x1fc850(0xde)&&(_0x59369c[_0x1fc850(0xad)]?.({'type':'journey_updated','name':_0x401e0e['yamlConfig'][_0x1fc850(0x8c)]}),_0x59369c[_0x1fc850(0x11d)]?.('Updated\x20journey\x20\x27'+_0x401e0e['yamlConfig'][_0x1fc850(0x8c)]+'\x27'),_0x57c0a6[_0x1fc850(0xde)]++);return{'action':_0x77a589[_0x1fc850(0xae)],'name':_0x401e0e[_0x1fc850(0x124)][_0x1fc850(0x8c)],'journeyId':_0x77a589['journeyId']};}catch(_0x5a0f12){const _0x5233e1=isHttp400Error(_0x5a0f12),_0x20ed45=_0x5233e1?ErrorCode[_0x1fc850(0xda)]:ErrorCode[_0x1fc850(0x8a)],_0x445cd9=getErrorMessage(_0x5a0f12);throw new SDKError(_0x20ed45,_0x1fc850(0xed)+(_0x401e0e['isNew']?_0x1fc850(0x143):_0x1fc850(0x17b))+_0x1fc850(0x145)+_0x401e0e[_0x1fc850(0x120)]+_0x1fc850(0xc4)+_0x445cd9,_0x5a0f12);}}));_0x57c0a6[_0x1dcab4(0x121)][_0x1dcab4(0x173)](..._0x3e9efa);}return _0x57c0a6;}async function matchExistingJourneySegments(_0x74815d,_0x5db306,_0x5b055e,_0x42805d,_0x403a3b){const _0x27df41=a142_0x5a51;if(!_0x5db306['existingJourney']||!_0x5db306[_0x27df41(0x124)][_0x27df41(0xd4)])return;const _0x1a4b8c=new Map(),_0x2d54c1=new Set();for(const _0x3dda6a of Object['keys'](_0x5db306['yamlConfig'][_0x27df41(0xd4)])){const _0x48e40a=generateDeterministicJourneySegmentName(_0x5db306[_0x27df41(0x124)][_0x27df41(0x8c)],_0x3dda6a);_0x1a4b8c['set'](_0x48e40a,_0x3dda6a),_0x2d54c1[_0x27df41(0x154)](_0x3dda6a);}const _0x3675bd=[],_0x228460=collectSegmentIdsFromJourneyApi(_0x5db306[_0x27df41(0x139)]);for(const _0x5922b7 of _0x228460){const _0x218706=await fetchSegment(_0x74815d,_0x5b055e,_0x5922b7,_0x42805d);if(!_0x218706?.['name'])continue;const _0x8fa2a7=_0x1a4b8c[_0x27df41(0x185)](_0x218706[_0x27df41(0x8c)]);_0x8fa2a7?(_0x403a3b[_0x27df41(0x156)](_0x8fa2a7,_0x5922b7),_0x2d54c1[_0x27df41(0x105)](_0x8fa2a7)):_0x3675bd[_0x27df41(0x173)]({'id':_0x5922b7,'seg':_0x218706});}if(_0x2d54c1[_0x27df41(0x102)]>0x0&&_0x3675bd[_0x27df41(0xec)]>0x0){const {localExpandedRuleToNames:_0x4d77bf}=buildLocalExpandedRuleMappings(_0x5db306[_0x27df41(0x124)]),_0x1c9afa=new Map();for(const {id:_0x22b212,seg:_0x2bea31}of _0x3675bd){if(_0x2bea31['rule']){const _0x4be6c4=apiRuleToYaml(_0x2bea31[_0x27df41(0x176)]);_0x1c9afa[_0x27df41(0x156)](_0x22b212,_0x4be6c4);}}for(const {id:_0x3c27e8,seg:_0x30cd7a}of _0x3675bd){if(!_0x30cd7a['rule'])continue;const _0x9d1d0=_0x1c9afa[_0x27df41(0x185)](_0x3c27e8);if(!_0x9d1d0)continue;const _0x1df3dd=serializeExpandedRule(_0x9d1d0,_0x1c9afa),_0x7bcc41=_0x4d77bf[_0x27df41(0x185)](_0x1df3dd);if(_0x7bcc41){const _0x290145=_0x7bcc41[_0x27df41(0x16c)](_0x1c1f0c=>_0x2d54c1['has'](_0x1c1f0c));_0x290145&&(_0x403a3b[_0x27df41(0x156)](_0x290145,_0x3c27e8),_0x2d54c1[_0x27df41(0x105)](_0x290145),logger[_0x27df41(0x186)](_0x27df41(0xe0)+_0x30cd7a[_0x27df41(0x8c)]+_0x27df41(0xc0)+_0x290145+_0x27df41(0xab)));}}}}async function executeSingleJourneyPush(_0x11b996,_0x588fcf,_0x4c0641,_0x4a44b2,_0x36f362,_0x43fd61){const _0x26112f=a142_0x5a51,{journeyDefToRequest:_0x4a88a3,activationDefToCreateRequest:_0x3383bb,yamlRuleToApi:_0x24972a,validateSegmentRule:_0x2249b8}=_0x43fd61,_0x4ba5bb=new Map(),_0x478422=new Map();recoverSegmentIdsFromPushRecovery(_0x588fcf,_0x4ba5bb,_0x4c0641[_0x26112f(0x151)]);const _0x50b447=new Map(),_0xcc2a49=new Map(),_0x49b72c=new Map();let _0x437b68;const _0x5b206b=async()=>{const _0x15eec0=_0x26112f;if(_0x437b68)return;_0x437b68=new Map();if(!_0x588fcf[_0x15eec0(0x139)])return;const _0x466a97=await _0x11b996[_0x15eec0(0x164)]['listActivations'](_0x588fcf[_0x15eec0(0x139)]['id']);for(const _0x2f062f of _0x466a97){const _0x5689a5=journeyActivationStepToYaml(_0x2f062f,_0x4c0641[_0x15eec0(0x17a)],_0x4c0641[_0x15eec0(0x135)]),_0x8e79c3=activationSignature(_0x5689a5);!_0x437b68[_0x15eec0(0xd3)](_0x8e79c3)&&_0x437b68[_0x15eec0(0x156)](_0x8e79c3,_0x2f062f['id']),_0x5689a5[_0x15eec0(0x8c)]&&_0x478422[_0x15eec0(0x156)](_0x5689a5[_0x15eec0(0x8c)],_0x2f062f['id']);}};await matchExistingJourneySegments(_0x11b996,_0x588fcf,_0x4a44b2['parentId'],_0x4c0641[_0x26112f(0x17f)],_0x4c0641[_0x26112f(0x151)]);const _0x47ca1c={'resolveSegmentId':async _0x433f99=>{const _0x5e02ee=_0x26112f,_0x2550ca=_0x4c0641[_0x5e02ee(0x151)][_0x5e02ee(0x185)](_0x433f99);if(!_0x2550ca)throw new SDKError(ErrorCode[_0x5e02ee(0xe6)],_0x5e02ee(0xf5)+_0x433f99+_0x5e02ee(0x172)+_0x588fcf['yamlConfig'][_0x5e02ee(0x8c)]+')');return _0x2550ca;},'resolveEmbeddedSegmentId':async(_0x474dbb,_0x11956b)=>{const _0x580e65=_0x26112f,_0x201941=_0x4c0641['segmentNameToId'][_0x580e65(0x185)](_0x474dbb);if(_0x201941)return _0x201941;const _0x143213=_0x4c0641[_0x580e65(0x17f)][_0x580e65(0x16c)](_0x3215f0=>_0x3215f0[_0x580e65(0x8c)]===_0x474dbb);if(_0x143213)return _0x4c0641['segmentNameToId'][_0x580e65(0x156)](_0x474dbb,_0x143213['id']),_0x143213['id'];if(_0x588fcf[_0x580e65(0x89)]){const {stageName:_0x3174f8,criteriaName:_0x511c89}=findSegmentCriteriaLocation(_0x588fcf[_0x580e65(0x124)],_0x474dbb);return _0x2249b8(_0x474dbb,_0x11956b['rule']),_0xcc2a49['set'](_0x474dbb,{'definition':_0x11956b,'stageName':_0x3174f8,'criteriaName':_0x511c89}),createPendingSegmentId(_0x474dbb);}const _0x5df5bd=_0x588fcf['existingJourney']?.['id'];if(!_0x5df5bd)throw new SDKError(ErrorCode[_0x580e65(0x9b)],_0x580e65(0x110));const _0x2fe73e=_0x50b447[_0x580e65(0x185)](_0x474dbb);if(_0x2fe73e)return _0x2fe73e;const _0xaf086d=((async()=>{const _0x2dcfa6=_0x580e65;_0x2249b8(_0x474dbb,_0x11956b[_0x2dcfa6(0x176)]);const _0x59e090=generateDeterministicJourneySegmentName(_0x588fcf[_0x2dcfa6(0x124)][_0x2dcfa6(0x8c)],_0x474dbb),_0x371c53=_0x4c0641[_0x2dcfa6(0x17f)]['find'](_0x2d7ec0=>_0x2d7ec0[_0x2dcfa6(0x8c)]===_0x59e090),_0x26515b=createSegmentIdResolver(_0x4c0641['segmentNameToId'],_0x474dbb),_0x347543=await resolveRuleSegmentIds(_0x11956b[_0x2dcfa6(0x176)],_0x26515b);let _0x53f471;return _0x371c53?(await _0x11b996[_0x2dcfa6(0xf2)][_0x2dcfa6(0x10c)](_0x4a44b2['parentId'],_0x371c53['id'],{'description':_0x11956b[_0x2dcfa6(0x167)]||_0x2dcfa6(0x127)+_0x474dbb,'rule':_0x24972a(_0x347543,!![]),'countPopulation':!![]}),_0x53f471=_0x371c53['id'],saveSegmentToPushRecovery(_0x588fcf[_0x2dcfa6(0x120)],_0x588fcf['yamlConfig']['name'],_0x474dbb,{'segmentId':_0x53f471,'uniqueServerName':_0x59e090,'createdAt':new Date()[_0x2dcfa6(0x137)]()})):_0x53f471=await createOrRecoverEmbeddedSegment(_0x11b996,_0x588fcf,{'localName':_0x474dbb,'uniqueSegmentName':_0x59e090,'description':_0x11956b[_0x2dcfa6(0x167)]||_0x2dcfa6(0x127)+_0x474dbb,'journeyId':_0x5df5bd,'resolvedRule':_0x347543,'parentId':_0x4a44b2[_0x2dcfa6(0xee)],'folderId':_0x4a44b2[_0x2dcfa6(0x112)]||''},_0x24972a),_0x4c0641[_0x2dcfa6(0x151)][_0x2dcfa6(0x156)](_0x474dbb,_0x53f471),_0x4ba5bb[_0x2dcfa6(0x156)](_0x474dbb,_0x53f471),_0x53f471;})());_0x50b447[_0x580e65(0x156)](_0x474dbb,_0xaf086d);try{return await _0xaf086d;}finally{_0x50b447[_0x580e65(0x105)](_0x474dbb);}},'resolveActivationId':async _0x729138=>{const _0x160275=_0x26112f,_0x32456b=_0x478422[_0x160275(0x185)](_0x729138);if(_0x32456b)return _0x32456b;if(_0x588fcf['existingJourney']){await _0x5b206b();const _0x10301a=_0x478422[_0x160275(0x185)](_0x729138);if(_0x10301a)return _0x10301a;}throw new SDKError(ErrorCode[_0x160275(0x8e)],_0x160275(0xfa)+_0x729138+_0x160275(0x172)+_0x588fcf[_0x160275(0x124)][_0x160275(0x8c)]+_0x160275(0x90)+_0x160275(0xce));},'resolveEmbeddedActivationId':async(_0x268af6,_0x1317d1)=>{const _0x5646b7=_0x26112f,_0x279821=_0x478422[_0x5646b7(0x185)](_0x268af6);if(_0x279821)return _0x279821;if(_0x588fcf[_0x5646b7(0x89)])return _0x49b72c[_0x5646b7(0x156)](_0x268af6,_0x1317d1),createPendingActivationId(_0x268af6);if(_0x588fcf[_0x5646b7(0x139)]){await _0x5b206b();const _0x3c5596=_0x478422[_0x5646b7(0x185)](_0x1317d1[_0x5646b7(0x8c)]);if(_0x3c5596)return _0x478422[_0x5646b7(0x156)](_0x268af6,_0x3c5596),_0x3c5596;const _0x374413=activationSignature(_0x1317d1),_0x308c8d=_0x437b68?.[_0x5646b7(0x185)](_0x374413);if(_0x308c8d)return _0x478422[_0x5646b7(0x156)](_0x268af6,_0x308c8d),_0x308c8d;const _0x1b6cf0=await _0x3383bb(_0x1317d1,_0x4c0641[_0x5646b7(0x86)]),_0x1f1913={..._0x1b6cf0,..._0x1317d1['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x1317d1[_0x5646b7(0xa6)]}},_0x530e28=await _0x11b996[_0x5646b7(0x164)]['createActivation'](_0x588fcf[_0x5646b7(0x139)]['id'],_0x1f1913);return _0x478422['set'](_0x268af6,_0x530e28['id']),_0x530e28['id'];}throw new SDKError(ErrorCode[_0x5646b7(0x9b)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x41dcc5=>{const _0x1c1e5e=_0x26112f;try{return await _0x11b996['journey'][_0x1c1e5e(0xfc)](_0x4a44b2[_0x1c1e5e(0xee)],_0x41dcc5);}catch(_0x5c1648){throw new SDKError(ErrorCode['NOT_FOUND'],_0x1c1e5e(0x159)+_0x41dcc5+_0x1c1e5e(0xb7)+_0x588fcf[_0x1c1e5e(0x124)][_0x1c1e5e(0x8c)]+'\x27)',_0x5c1648);}},'resolveStageId':async(_0xedeb39,_0x27be53)=>{const _0x42ce19=_0x26112f,_0x66d144=await _0x11b996[_0x42ce19(0x164)]['getJourney'](_0xedeb39),_0x2b1fb9=_0x66d144[_0x42ce19(0xc6)]['journeyStages'][_0x42ce19(0x16c)](_0x4af592=>_0x4af592[_0x42ce19(0x8c)][_0x42ce19(0x16e)]()===_0x27be53['toLowerCase']());if(!_0x2b1fb9?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],'Stage\x20\x27'+_0x27be53+_0x42ce19(0xe1)+(_0x66d144[_0x42ce19(0xc6)][_0x42ce19(0xd1)]||_0x66d144[_0x42ce19(0xc6)][_0x42ce19(0x8c)])+'\x27');return _0x2b1fb9['id'];}},_0x56ca37=await _0x4a88a3(_0x588fcf[_0x26112f(0x124)],_0x4a44b2['parentId'],_0x47ca1c),_0xb8a67=_0x4a44b2['folderId']||_0x4a44b2[_0x26112f(0x112)];_0xb8a67&&(_0x56ca37[_0x26112f(0x163)]={'parentFolder':{'data':{'id':_0xb8a67,'type':_0x26112f(0x96)}}});if(_0x588fcf[_0x26112f(0x89)]){if(_0xcc2a49['size']>0x0||_0x49b72c[_0x26112f(0x102)]>0x0)return await executeThreeStepJourneyCreate(_0x11b996,_0x588fcf,_0x56ca37,{'pendingEmbeddedSegments':_0xcc2a49,'pendingEmbeddedActivations':_0x49b72c,'embeddedSegmentNameToId':_0x4ba5bb,'journeyActivationNameToId':_0x478422},{..._0x4a44b2,'effectiveFolderId':_0xb8a67},_0x4c0641,_0x36f362,_0x43fd61);else{ensureJourneyDefaults(_0x56ca37[_0x26112f(0xc6)]);const _0x4a7bec=await _0x11b996['journey'][_0x26112f(0x143)](_0x56ca37);return deletePushRecovery(_0x588fcf['absolutePath']),{'action':_0x26112f(0xa8),'journeyId':_0x4a7bec['id'],'embeddedSegmentNameToId':_0x4ba5bb};}}else{if(_0x588fcf[_0x26112f(0xe3)]&&_0x588fcf[_0x26112f(0x139)]){_0x56ca37['id']=_0x588fcf[_0x26112f(0x139)]['id'];const _0x3ecd98=_0x56ca37[_0x26112f(0xc6)];_0x588fcf[_0x26112f(0x139)]['attributes']?.[_0x26112f(0xd1)]&&(_0x3ecd98['journeyBundleName']=_0x588fcf[_0x26112f(0x139)][_0x26112f(0xc6)]['journeyBundleName']);const _0xf829d3=_0x588fcf[_0x26112f(0x139)][_0x26112f(0xc6)]?.[_0x26112f(0x15f)];return _0xf829d3&&_0x56ca37[_0x26112f(0xc6)][_0x26112f(0x15f)]&&injectExistingStageIds(_0x56ca37[_0x26112f(0xc6)][_0x26112f(0x15f)],_0xf829d3),ensureJourneyDefaults(_0x3ecd98),await _0x11b996[_0x26112f(0x164)]['update'](_0x588fcf[_0x26112f(0x139)]['id'],_0x56ca37),deletePushRecovery(_0x588fcf[_0x26112f(0x120)]),{'action':_0x26112f(0xde),'journeyId':_0x588fcf['existingJourney']['id'],'embeddedSegmentNameToId':_0x4ba5bb};}}return deletePushRecovery(_0x588fcf[_0x26112f(0x120)]),{'action':_0x26112f(0xe8),'journeyId':_0x588fcf[_0x26112f(0x139)]?.['id'],'embeddedSegmentNameToId':_0x4ba5bb};}function findSegmentCriteriaLocation(_0xa05284,_0x4d80b6){const _0x467053=a142_0x5a51,_0x10a0b5=_0xa05284[_0x467053(0x125)]||_0xa05284['journeys']?.[0x0]?.['stages']||[];let _0x278943=_0x467053(0xb0),_0x5f4b66=_0x4d80b6;const _0x2687f0=_0xa05284[_0x467053(0x9c)]||_0xa05284[_0x467053(0x14a)]?.[0x0]?.[_0x467053(0x9c)];if(_0x2687f0?.[_0x467053(0xf2)]===_0x4d80b6)return{'stageName':'goal','criteriaName':_0x2687f0[_0x467053(0x8c)]||_0x4d80b6};_0x3aa711:for(const _0x2906f9 of _0x10a0b5){if(_0x2906f9[_0x467053(0x13d)]?.['segment']===_0x4d80b6){_0x278943=_0x2906f9[_0x467053(0x8c)],_0x5f4b66=_0x2906f9['entry_criteria'][_0x467053(0x8c)]||_0x4d80b6;break;}if(_0x2906f9[_0x467053(0xba)])for(const _0x18cb51 of _0x2906f9[_0x467053(0xba)]){if(_0x18cb51[_0x467053(0xa2)]===_0x467053(0x184)&&_0x18cb51[_0x467053(0x175)]?.[_0x467053(0x187)])for(const _0x475ee1 of _0x18cb51['with'][_0x467053(0x187)]){if(_0x475ee1['segment']===_0x4d80b6){_0x278943=_0x2906f9[_0x467053(0x8c)],_0x5f4b66=_0x475ee1[_0x467053(0x8c)]||_0x4d80b6;break _0x3aa711;}}}}return{'stageName':_0x278943,'criteriaName':_0x5f4b66};}async function executeThreeStepJourneyCreate(_0x45f174,_0x44a949,_0x36f202,_0x21a199,_0x5c2421,_0x339f34,_0x263009,_0x44fffa){const _0x1d3fda=a142_0x5a51,{activationDefToCreateRequest:_0x446727,yamlRuleToApi:_0x47037d}=_0x44fffa,{pendingEmbeddedSegments:_0x4f7dba,pendingEmbeddedActivations:_0xcb41,embeddedSegmentNameToId:_0x3c12c7}=_0x21a199,_0x34f306=JSON[_0x1d3fda(0xc3)](JSON[_0x1d3fda(0x183)](_0x36f202));ensureJourneyDefaults(_0x34f306['attributes']),stripPendingIds(_0x34f306);const _0x2049b9=await _0x45f174[_0x1d3fda(0x164)][_0x1d3fda(0x143)](_0x34f306),_0x5394bd=_0x2049b9['id'],_0x3b179d=new Map();for(const _0x2a3cd7 of _0x2049b9[_0x1d3fda(0xc6)]['journeyStages']){_0x3b179d[_0x1d3fda(0x156)](_0x2a3cd7[_0x1d3fda(0x8c)][_0x1d3fda(0x16e)](),_0x2a3cd7['id']);}recoverSegmentIdsFromPushRecovery(_0x44a949,_0x3c12c7,_0x339f34[_0x1d3fda(0x151)]);for(const [_0x117703,{definition:_0x2ccd49}]of _0x4f7dba){if(_0x3c12c7[_0x1d3fda(0xd3)](_0x117703)){_0x263009[_0x1d3fda(0xad)]?.({'type':_0x1d3fda(0xa7),'journeyName':_0x44a949[_0x1d3fda(0x124)]['name'],'segmentName':_0x117703});continue;}const _0x355150=generateDeterministicJourneySegmentName(_0x44a949['yamlConfig']['name'],_0x117703);_0x263009[_0x1d3fda(0xad)]?.({'type':_0x1d3fda(0x16a),'journeyName':_0x44a949[_0x1d3fda(0x124)][_0x1d3fda(0x8c)],'segmentName':_0x117703});const _0x31089=createSegmentIdResolver(_0x339f34[_0x1d3fda(0x151)],_0x117703),_0x2fd1f1=await resolveRuleSegmentIds(_0x2ccd49['rule'],_0x31089),_0x1cbe96=await createOrRecoverEmbeddedSegment(_0x45f174,_0x44a949,{'localName':_0x117703,'uniqueSegmentName':_0x355150,'description':_0x2ccd49[_0x1d3fda(0x167)]||_0x1d3fda(0x127)+_0x117703,'journeyId':_0x5394bd,'resolvedRule':_0x2fd1f1,'parentId':_0x5c2421[_0x1d3fda(0xee)],'folderId':_0x5c2421[_0x1d3fda(0x88)]||''},_0x47037d);_0x3c12c7[_0x1d3fda(0x156)](_0x117703,_0x1cbe96),_0x339f34[_0x1d3fda(0x151)]['set'](_0x117703,_0x1cbe96),_0x263009[_0x1d3fda(0xad)]?.({'type':_0x1d3fda(0xa7),'journeyName':_0x44a949[_0x1d3fda(0x124)]['name'],'segmentName':_0x117703});}const _0x1a2738=new Map();for(const [_0x12839a,_0x1f9b9e]of _0xcb41){_0x263009['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x44a949[_0x1d3fda(0x124)]['name'],'activationName':_0x12839a});const _0x2afd9e=await _0x446727(_0x1f9b9e,_0x339f34[_0x1d3fda(0x86)]),_0x29481a={..._0x2afd9e,..._0x1f9b9e[_0x1d3fda(0xa6)]!==undefined&&{'runAfterJourneyRefresh':_0x1f9b9e[_0x1d3fda(0xa6)]}},_0x5c26fa=await _0x45f174['journey'][_0x1d3fda(0x136)](_0x5394bd,_0x29481a);_0x1a2738['set'](_0x12839a,_0x5c26fa['id']),_0x21a199['journeyActivationNameToId'][_0x1d3fda(0x156)](_0x12839a,_0x5c26fa['id']),_0x263009[_0x1d3fda(0xad)]?.({'type':_0x1d3fda(0x99),'journeyName':_0x44a949[_0x1d3fda(0x124)][_0x1d3fda(0x8c)],'activationName':_0x12839a});}const _0x52d4d7=JSON[_0x1d3fda(0xc3)](JSON['stringify'](_0x36f202));return _0x52d4d7['id']=_0x5394bd,ensureJourneyDefaults(_0x52d4d7[_0x1d3fda(0xc6)]),resolvePendingIdsInRequest(_0x52d4d7,_0x36f202,_0x3b179d,_0x3c12c7,_0x1a2738,_0x263009),await _0x45f174[_0x1d3fda(0x164)]['update'](_0x5394bd,_0x52d4d7),deletePushRecovery(_0x44a949[_0x1d3fda(0x120)]),{'action':_0x1d3fda(0xa8),'journeyId':_0x5394bd,'embeddedSegmentNameToId':_0x3c12c7};}export function stripWaitStepPendingIds(_0xde265b){const _0x3daa0b=a142_0x5a51,_0x3a4a4d=_0xde265b[_0x3daa0b(0x138)]&&isPendingSegmentId(_0xde265b[_0x3daa0b(0x138)]),_0x5df801=_0xde265b['conditions']?.[_0x3daa0b(0xc2)](_0x2936b0=>_0x2936b0[_0x3daa0b(0x95)]&&isPendingSegmentId(_0x2936b0[_0x3daa0b(0x95)]));(_0x3a4a4d||_0x5df801)&&(_0xde265b[_0x3daa0b(0x123)]='Duration',_0xde265b[_0x3daa0b(0x177)]=0x1,_0xde265b['waitStepUnit']=_0x3daa0b(0xf7),delete _0xde265b[_0x3daa0b(0x138)],delete _0xde265b['conditionTimeoutDuration'],delete _0xde265b['conditionTimeoutUnit'],delete _0xde265b[_0x3daa0b(0x108)]);}export function resolveWaitStepPendingIds(_0x1fcf0a,_0x562c46,_0xd9db44,_0x1056fa){const _0x528945=a142_0x5a51;if(_0x562c46[_0x528945(0x138)]&&isPendingSegmentId(_0x562c46['conditionSegmentId'])){const _0x4c2d90=_0xd9db44(_0x562c46[_0x528945(0x138)],_0x528945(0x15b)+_0x1056fa+_0x528945(0xe7));_0x4c2d90&&(_0x1fcf0a['waitStepType']='Condition',_0x1fcf0a[_0x528945(0x138)]=_0x4c2d90,delete _0x1fcf0a[_0x528945(0x177)],delete _0x1fcf0a[_0x528945(0x103)],_0x562c46[_0x528945(0xf0)]!==undefined&&(_0x1fcf0a[_0x528945(0xf0)]=_0x562c46['conditionTimeoutDuration']),_0x562c46[_0x528945(0x171)]&&(_0x1fcf0a[_0x528945(0x171)]=_0x562c46[_0x528945(0x171)]));}if(_0x562c46[_0x528945(0x108)]){const _0x136e33=_0x562c46[_0x528945(0x108)][_0x528945(0xc2)](_0x1c2b2a=>_0x1c2b2a[_0x528945(0x95)]&&isPendingSegmentId(_0x1c2b2a[_0x528945(0x95)]));if(_0x136e33){const _0x5aaab7=_0x562c46[_0x528945(0x108)]['map'](_0x22bb31=>{const _0x25764d=_0x528945;if(_0x22bb31[_0x25764d(0x95)]&&isPendingSegmentId(_0x22bb31['segmentId'])){const _0x7301b7=_0xd9db44(_0x22bb31[_0x25764d(0x95)],'stage\x20\x27'+_0x1056fa+'\x27\x20wait\x20condition');return{..._0x22bb31,'segmentId':_0x7301b7||_0x22bb31[_0x25764d(0x95)]};}return{..._0x22bb31};});_0x1fcf0a[_0x528945(0x123)]=_0x528945(0x13b),_0x1fcf0a[_0x528945(0x108)]=_0x5aaab7,delete _0x1fcf0a['waitStep'],delete _0x1fcf0a[_0x528945(0x103)],delete _0x1fcf0a['conditionSegmentId'],delete _0x1fcf0a[_0x528945(0xf0)],delete _0x1fcf0a['conditionTimeoutUnit'];}}}function stripPendingIds(_0x1ef132){const _0x2a9a68=a142_0x5a51;_0x1ef132[_0x2a9a68(0xc6)][_0x2a9a68(0x9c)]?.[_0x2a9a68(0x95)]&&isPendingSegmentId(_0x1ef132['attributes']['goal'][_0x2a9a68(0x95)])&&delete _0x1ef132[_0x2a9a68(0xc6)]['goal'];for(const _0x509508 of _0x1ef132['attributes']['journeyStages']||[]){_0x509508[_0x2a9a68(0x101)]?.['segmentId']&&isPendingSegmentId(_0x509508[_0x2a9a68(0x101)][_0x2a9a68(0x95)])&&delete _0x509508[_0x2a9a68(0x101)];_0x509508[_0x2a9a68(0xeb)]?.['segmentId']&&isPendingSegmentId(_0x509508[_0x2a9a68(0xeb)][_0x2a9a68(0x95)])&&delete _0x509508[_0x2a9a68(0xeb)];_0x509508[_0x2a9a68(0x168)]&&(_0x509508[_0x2a9a68(0x168)]=_0x509508[_0x2a9a68(0x168)]['filter'](_0x4bde94=>!_0x4bde94[_0x2a9a68(0x95)]||!isPendingSegmentId(_0x4bde94[_0x2a9a68(0x95)])));if(_0x509508[_0x2a9a68(0xba)])for(const _0x97d2e6 of Object[_0x2a9a68(0x10b)](_0x509508[_0x2a9a68(0xba)])){const _0x38c671=_0x509508[_0x2a9a68(0xba)][_0x97d2e6];_0x38c671[_0x2a9a68(0xa2)]===_0x2a9a68(0x178)&&_0x38c671[_0x2a9a68(0x11a)]&&isPendingActivationId(_0x38c671[_0x2a9a68(0x11a)])&&(_0x38c671['journeyActivationStepId']='');if(_0x38c671['type']===_0x2a9a68(0x10a)&&_0x38c671[_0x2a9a68(0x187)])for(const _0x597c66 of _0x38c671['branches']){_0x597c66[_0x2a9a68(0x95)]&&isPendingSegmentId(_0x597c66[_0x2a9a68(0x95)])&&(_0x597c66[_0x2a9a68(0x95)]='');}_0x38c671[_0x2a9a68(0xa2)]===_0x2a9a68(0x148)&&stripWaitStepPendingIds(_0x38c671);}}}function resolvePendingIdsInRequest(_0x410094,_0x5045bb,_0xc301b,_0xba1dd9,_0x3685a5,_0x30c072){const _0x27f3fb=a142_0x5a51,_0x9f1589=(_0x16815f,_0x5d9b8c)=>{const _0x519601=a142_0x42c6;if(!isPendingSegmentId(_0x16815f))return _0x16815f;const _0x572cb9=extractPendingSegmentName(_0x16815f),_0x52d497=_0xba1dd9[_0x519601(0x185)](_0x572cb9);return!_0x52d497&&_0x30c072[_0x519601(0xbc)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x572cb9+_0x519601(0xd2)+_0x5d9b8c),_0x52d497;};if(_0x410094['attributes']['goal']?.[_0x27f3fb(0x95)]&&isPendingSegmentId(_0x410094[_0x27f3fb(0xc6)]['goal'][_0x27f3fb(0x95)])){const _0x131035=_0x9f1589(_0x410094[_0x27f3fb(0xc6)]['goal'][_0x27f3fb(0x95)],_0x27f3fb(0x144));_0x131035&&(_0x410094[_0x27f3fb(0xc6)]['goal'][_0x27f3fb(0x95)]=_0x131035);}for(const _0x1593f1 of _0x410094[_0x27f3fb(0xc6)][_0x27f3fb(0x15f)]||[]){const _0x3448c0=_0xc301b[_0x27f3fb(0x185)](_0x1593f1[_0x27f3fb(0x8c)][_0x27f3fb(0x16e)]());_0x3448c0&&(_0x1593f1['id']=_0x3448c0);if(_0x1593f1[_0x27f3fb(0x101)]?.[_0x27f3fb(0x95)]&&isPendingSegmentId(_0x1593f1[_0x27f3fb(0x101)]['segmentId'])){const _0x4ffae4=_0x9f1589(_0x1593f1['entryCriteria'][_0x27f3fb(0x95)],_0x27f3fb(0x15b)+_0x1593f1[_0x27f3fb(0x8c)]+_0x27f3fb(0xc9));_0x4ffae4&&(_0x1593f1[_0x27f3fb(0x101)][_0x27f3fb(0x95)]=_0x4ffae4);}if(_0x1593f1[_0x27f3fb(0x168)])for(const _0x424150 of _0x1593f1[_0x27f3fb(0x168)]){if(_0x424150['segmentId']&&isPendingSegmentId(_0x424150['segmentId'])){const _0x569de2=_0x9f1589(_0x424150[_0x27f3fb(0x95)],_0x27f3fb(0x15b)+_0x1593f1['name']+_0x27f3fb(0xb4));_0x569de2&&(_0x424150['segmentId']=_0x569de2);}}if(_0x1593f1['milestone']?.['segmentId']&&isPendingSegmentId(_0x1593f1[_0x27f3fb(0xeb)]['segmentId'])){const _0xe8358b=_0x9f1589(_0x1593f1[_0x27f3fb(0xeb)][_0x27f3fb(0x95)],_0x27f3fb(0x15b)+_0x1593f1[_0x27f3fb(0x8c)]+'\x27\x20milestone');_0xe8358b&&(_0x1593f1[_0x27f3fb(0xeb)]['segmentId']=_0xe8358b);}if(_0x1593f1[_0x27f3fb(0xba)]){const _0x4d78cf=_0x149100=>_0x5045bb['attributes'][_0x27f3fb(0x15f)]?.[_0x27f3fb(0x16c)](_0x47de85=>_0x47de85[_0x27f3fb(0x8c)][_0x27f3fb(0x16e)]()===_0x1593f1[_0x27f3fb(0x8c)][_0x27f3fb(0x16e)]())?.[_0x27f3fb(0xba)]?.[_0x149100];for(const _0x10920b of Object[_0x27f3fb(0x10b)](_0x1593f1[_0x27f3fb(0xba)])){const _0x844122=_0x1593f1[_0x27f3fb(0xba)][_0x10920b],_0x1ae0cb=_0x4d78cf(_0x10920b);if(_0x844122[_0x27f3fb(0xa2)]===_0x27f3fb(0x178)&&_0x844122[_0x27f3fb(0x11a)]&&(isPendingActivationId(_0x844122[_0x27f3fb(0x11a)])||_0x844122[_0x27f3fb(0x11a)]==='')){if(_0x1ae0cb?.['journeyActivationStepId']&&isPendingActivationId(_0x1ae0cb[_0x27f3fb(0x11a)])){const _0x4d9f18=extractPendingActivationName(_0x1ae0cb[_0x27f3fb(0x11a)]),_0x13dfea=_0x3685a5[_0x27f3fb(0x185)](_0x4d9f18);_0x13dfea&&(_0x844122[_0x27f3fb(0x11a)]=_0x13dfea);}}if(_0x844122[_0x27f3fb(0xa2)]===_0x27f3fb(0x10a)&&_0x844122[_0x27f3fb(0x187)]&&_0x1ae0cb?.[_0x27f3fb(0x187)])for(let _0x40986f=0x0;_0x40986f<_0x844122[_0x27f3fb(0x187)][_0x27f3fb(0xec)];_0x40986f++){const _0x52c51d=_0x844122['branches'][_0x40986f],_0x2cf092=_0x1ae0cb[_0x27f3fb(0x187)][_0x40986f];if(_0x2cf092?.[_0x27f3fb(0x95)]&&isPendingSegmentId(_0x2cf092[_0x27f3fb(0x95)])){const _0x1b23b0=_0x9f1589(_0x2cf092[_0x27f3fb(0x95)],_0x27f3fb(0x15b)+_0x1593f1['name']+_0x27f3fb(0x117)+(_0x52c51d[_0x27f3fb(0x8c)]||_0x40986f)+'\x27');_0x1b23b0&&(_0x52c51d['segmentId']=_0x1b23b0);}}_0x844122[_0x27f3fb(0xa2)]==='WaitStep'&&_0x1ae0cb?.[_0x27f3fb(0xa2)]===_0x27f3fb(0x148)&&resolveWaitStepPendingIds(_0x844122,_0x1ae0cb,_0x9f1589,_0x1593f1[_0x27f3fb(0x8c)]);}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x493e33,_0x417bc4){const _0x227142=a143_0x7e7f,_0x30bc57=_0x493e33();while(!![]){try{const _0x3acc85=-parseInt(_0x227142(0xc4))/0x1+-parseInt(_0x227142(0xc6))/0x2+-parseInt(_0x227142(0xc2))/0x3+parseInt(_0x227142(0xc0))/0x4+parseInt(_0x227142(0xbe))/0x5*(parseInt(_0x227142(0xb8))/0x6)+parseInt(_0x227142(0xba))/0x7+-parseInt(_0x227142(0xbf))/0x8*(-parseInt(_0x227142(0xc3))/0x9);if(_0x3acc85===_0x417bc4)break;else _0x30bc57['push'](_0x30bc57['shift']());}catch(_0x476399){_0x30bc57['push'](_0x30bc57['shift']());}}}(a143_0x4c94,0x8cb9c));function a143_0x7e7f(_0x1344ee,_0x474247){_0x1344ee=_0x1344ee-0xb8;const _0x4c94fc=a143_0x4c94();let _0x7e7fb4=_0x4c94fc[_0x1344ee];return _0x7e7fb4;}export function buildFolderIdToPathMap(_0x5c8142){const _0x5bfce1=a143_0x7e7f,_0x571eeb=new Map(),_0x1397b7=new Map();for(const _0x4ca77f of _0x5c8142){_0x1397b7[_0x5bfce1(0xbb)](_0x4ca77f['id'],_0x4ca77f);}const _0x4f11b6=new Set();for(const _0x13e0f2 of _0x5c8142){!_0x13e0f2[_0x5bfce1(0xb9)]&&_0x4f11b6[_0x5bfce1(0xbc)](_0x13e0f2['id']);}function _0x3ef238(_0x91f6a9){const _0x18a4b2=_0x5bfce1;if(_0x571eeb['has'](_0x91f6a9['id']))return _0x571eeb[_0x18a4b2(0xbd)](_0x91f6a9['id']);if(_0x4f11b6[_0x18a4b2(0xc5)](_0x91f6a9['id']))return _0x571eeb[_0x18a4b2(0xbb)](_0x91f6a9['id'],''),'';if(_0x91f6a9['parentFolderId']){const _0x246715=_0x1397b7[_0x18a4b2(0xbd)](_0x91f6a9[_0x18a4b2(0xb9)]);if(_0x246715){const _0x333493=_0x3ef238(_0x246715),_0xf2bbbb=_0x333493?_0x333493+'/'+_0x91f6a9[_0x18a4b2(0xc1)]:_0x91f6a9[_0x18a4b2(0xc1)];return _0x571eeb[_0x18a4b2(0xbb)](_0x91f6a9['id'],_0xf2bbbb),_0xf2bbbb;}}const _0x16ad8e=_0x91f6a9[_0x18a4b2(0xc1)];return _0x571eeb[_0x18a4b2(0xbb)](_0x91f6a9['id'],_0x16ad8e),_0x16ad8e;}for(const _0x1d383c of _0x5c8142){_0x3ef238(_0x1d383c);}return _0x571eeb;}export function buildFolderPathToIdMap(_0xaa70b7){const _0xfea502=a143_0x7e7f,_0x57ba27=new Map(),_0x24924d=new Map();for(const _0x427945 of _0xaa70b7){_0x24924d[_0xfea502(0xbb)](_0x427945['id'],_0x427945);}const _0xa8ec05=new Set();for(const _0x10cd8a of _0xaa70b7){!_0x10cd8a[_0xfea502(0xb9)]&&_0xa8ec05['add'](_0x10cd8a['id']);}function _0x41d43a(_0xd1115b){const _0x352448=_0xfea502;if(_0xa8ec05[_0x352448(0xc5)](_0xd1115b['id']))return'';if(_0xd1115b[_0x352448(0xb9)]){const _0x12c7eb=_0x24924d[_0x352448(0xbd)](_0xd1115b['parentFolderId']);if(_0x12c7eb){const _0x2a6dcc=_0x41d43a(_0x12c7eb);return _0x2a6dcc?_0x2a6dcc+'/'+_0xd1115b[_0x352448(0xc1)]:_0xd1115b['name'];}}return _0xd1115b[_0x352448(0xc1)];}for(const _0x5c3d51 of _0xaa70b7){const _0xfc8b92=_0x41d43a(_0x5c3d51);_0x57ba27[_0xfea502(0xbb)](_0xfc8b92,_0x5c3d51['id']);}return _0x57ba27;}export function buildFolderMaps(_0x226e61){const _0x416248=buildFolderIdToPathMap(_0x226e61),_0x29b75f=new Map();for(const [_0x22b53f,_0x2d8df8]of _0x416248){_0x29b75f['set'](_0x2d8df8,_0x22b53f);}return{'idToPath':_0x416248,'pathToId':_0x29b75f};}function a143_0x4c94(){const _0x1f8b9e=['name','865458LZZgBn','1306440RoVgrl','1104788WwCYNs','has','1119212eKuxHN','26268XgjyVO','parentFolderId','4921336WTfvRO','set','add','get','730VzHgwa','8LrSMtg','4167584FeGmzw'];a143_0x4c94=function(){return _0x1f8b9e;};return a143_0x4c94();}export function getFolderPath(_0x5ef5ed,_0x2f1531){if(!_0x5ef5ed)return'';return _0x2f1531['get'](_0x5ef5ed)??'';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x62b332,_0x979fd8){const _0x15c83c=a144_0x4e90,_0x5044e9=_0x62b332();while(!![]){try{const _0x2d2631=-parseInt(_0x15c83c(0x1a1))/0x1*(-parseInt(_0x15c83c(0x19e))/0x2)+parseInt(_0x15c83c(0x198))/0x3+parseInt(_0x15c83c(0x18a))/0x4*(-parseInt(_0x15c83c(0x185))/0x5)+parseInt(_0x15c83c(0x18c))/0x6*(-parseInt(_0x15c83c(0x17b))/0x7)+-parseInt(_0x15c83c(0x190))/0x8*(-parseInt(_0x15c83c(0x183))/0x9)+-parseInt(_0x15c83c(0x1a0))/0xa*(-parseInt(_0x15c83c(0x17e))/0xb)+parseInt(_0x15c83c(0x19a))/0xc;if(_0x2d2631===_0x979fd8)break;else _0x5044e9['push'](_0x5044e9['shift']());}catch(_0x52523a){_0x5044e9['push'](_0x5044e9['shift']());}}}(a144_0x2287,0x1f7a8));import a144_0x5df9b6 from'path';import{parse as a144_0x5a2a69}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x265fbd){const _0x4cf204=a144_0x4e90;if(!_0x265fbd||_0x265fbd[_0x4cf204(0x199)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x27e423=_0x265fbd[_0x4cf204(0x199)]();if(_0x27e423==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x265fbd};const _0x4fd8fa=_0x27e423[_0x4cf204(0x17a)]('/')?_0x27e423[_0x4cf204(0x19c)](0x1):_0x27e423,_0x222c0b=_0x4fd8fa[_0x4cf204(0x195)]('/')['filter'](_0x415177=>_0x415177!=='');if(_0x222c0b[_0x4cf204(0x184)]===0x0)throw new Error(_0x4cf204(0x1a3));const _0x5ac8df=_0x27e423[_0x4cf204(0x17a)]('/')||!isRelativePathSegment(_0x222c0b[0x0]);for(const _0x435921 of _0x222c0b){validatePathSegment(_0x435921);}return{'segments':_0x222c0b,'isAbsolute':_0x5ac8df,'raw':_0x265fbd};}function isRelativePathSegment(_0x28b84e){return _0x28b84e==='.'||_0x28b84e==='..';}function validatePathSegment(_0x1fcf3a){const _0x593223=a144_0x4e90;if(_0x1fcf3a==='')throw new Error(_0x593223(0x197));if(_0x1fcf3a==='.'||_0x1fcf3a==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x1fcf3a))throw new Error(_0x593223(0x18e)+_0x1fcf3a);if(_0x1fcf3a!==_0x1fcf3a['trim']()){}}export function validatePath(_0xf73f29){const _0x1108f1=a144_0x4e90;if(_0xf73f29[_0x1108f1(0x18d)][_0x1108f1(0x184)]===0x0&&!_0xf73f29['isAbsolute'])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0xf73f29[_0x1108f1(0x192)]){if(_0xf73f29[_0x1108f1(0x18d)][0x0]==='..')throw new Error(_0x1108f1(0x19b));let _0x5f31bf=0x0;for(const _0xd91cb8 of _0xf73f29['segments']){if(_0xd91cb8==='..'){if(_0x5f31bf===0x0)throw new Error(_0x1108f1(0x182));_0x5f31bf--;}else _0xd91cb8!=='.'&&_0x5f31bf++;}}}export function joinPaths(_0x28675a,_0x1a2ff2){const _0x38c1dc=a144_0x4e90;if(!_0x28675a||_0x28675a==='/')return _0x1a2ff2;if(!_0x1a2ff2||_0x1a2ff2==='.')return _0x28675a;if(_0x1a2ff2[_0x38c1dc(0x17a)]('/'))return _0x1a2ff2;const _0x1ac997=parsePath(_0x28675a),_0x3160f4=parsePath(_0x1a2ff2),_0x7b8b47=[..._0x1ac997['segments']];for(const _0x587d15 of _0x3160f4[_0x38c1dc(0x18d)]){if(_0x587d15==='.')continue;else{if(_0x587d15==='..'){if(_0x7b8b47[_0x38c1dc(0x184)]===0x0)throw new Error(_0x38c1dc(0x196));_0x7b8b47['pop']();}else _0x7b8b47[_0x38c1dc(0x18f)](_0x587d15);}}const _0x3c7a20=_0x7b8b47[_0x38c1dc(0x180)]('/');return _0x1ac997[_0x38c1dc(0x189)][_0x38c1dc(0x17a)]('/')?'/'+_0x3c7a20:_0x3c7a20;}function a144_0x2287(){const _0x51698b=['Cannot\x20split\x20empty\x20path','470740jEvVWg','18862Enqkaa','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','File\x20not\x20found:\x20','parent_segment','tdx.json','dirname','.yml','startsWith','3976wUpKXU','pop','slice','11QgPhQb','.yaml','join','name','Path\x20attempts\x20to\x20navigate\x20above\x20root','18lEwQHA','length','5IvpJly','relative','segment','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','raw','67724ABGHYG','exists','1758aoTBIa','segments','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','push','46264kfCKYa','endsWith','isAbsolute','resolve','readFile','split','Cannot\x20navigate\x20above\x20root','Path\x20segment\x20cannot\x20be\x20empty','71424iynzsy','trim','41988RfYoDl','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','substring','journey','24nOdCpG'];a144_0x2287=function(){return _0x51698b;};return a144_0x2287();}export function normalizePath(_0x491f19){const _0x1cf386=a144_0x4e90,_0x44c086=parsePath(_0x491f19),_0x58aa4e=[];for(const _0x2fe4f3 of _0x44c086[_0x1cf386(0x18d)]){if(_0x2fe4f3==='.')continue;else{if(_0x2fe4f3==='..'){if(_0x58aa4e[_0x1cf386(0x184)]===0x0){if(_0x44c086[_0x1cf386(0x192)])throw new Error(_0x1cf386(0x196));_0x58aa4e[_0x1cf386(0x18f)]('..');}else _0x58aa4e[_0x58aa4e['length']-0x1]==='..'?_0x58aa4e[_0x1cf386(0x18f)]('..'):_0x58aa4e[_0x1cf386(0x17c)]();}else _0x58aa4e[_0x1cf386(0x18f)](_0x2fe4f3);}}if(_0x58aa4e[_0x1cf386(0x184)]===0x0)return _0x44c086[_0x1cf386(0x192)]?'/':'.';const _0xa4fb32=_0x58aa4e[_0x1cf386(0x180)]('/');return _0x44c086[_0x1cf386(0x189)][_0x1cf386(0x17a)]('/')?'/'+_0xa4fb32:_0xa4fb32;}function a144_0x4e90(_0x2d5605,_0x140dc1){_0x2d5605=_0x2d5605-0x17a;const _0x2287e8=a144_0x2287();let _0x4e9085=_0x2287e8[_0x2d5605];return _0x4e9085;}export function getParentPath(_0x5b6a89){const _0x4783d0=a144_0x4e90,_0x4c3e6d=parsePath(_0x5b6a89);if(_0x4c3e6d['segments'][_0x4783d0(0x184)]<=0x1)return'/';const _0x40506a=_0x4c3e6d[_0x4783d0(0x18d)][_0x4783d0(0x17d)](0x0,-0x1)[_0x4783d0(0x180)]('/');return _0x4c3e6d[_0x4783d0(0x189)]['startsWith']('/')?'/'+_0x40506a:_0x40506a;}export function getBaseName(_0x23b9e3){const _0x49fea9=a144_0x4e90,_0x5de520=parsePath(_0x23b9e3);return _0x5de520[_0x49fea9(0x18d)][_0x5de520['segments'][_0x49fea9(0x184)]-0x1]||'';}export function isChildPath(_0x3e9dfb,_0x494940){const _0x599c85=a144_0x4e90,_0x14d0e1=parsePath(_0x3e9dfb),_0x287fd0=parsePath(_0x494940);if(_0x14d0e1[_0x599c85(0x18d)][_0x599c85(0x184)]<=_0x287fd0[_0x599c85(0x18d)]['length'])return![];for(let _0x4ee71a=0x0;_0x4ee71a<_0x287fd0['segments']['length'];_0x4ee71a++){if(_0x14d0e1[_0x599c85(0x18d)][_0x4ee71a]!==_0x287fd0[_0x599c85(0x18d)][_0x4ee71a])return![];}return!![];}export function splitPath(_0x522a46){const _0x20b3de=a144_0x4e90,_0x4cc9bb=parsePath(_0x522a46);if(_0x4cc9bb[_0x20b3de(0x18d)]['length']===0x0)throw new Error(_0x20b3de(0x19f));if(_0x4cc9bb[_0x20b3de(0x18d)][_0x20b3de(0x184)]===0x1)return{'parent':_0x4cc9bb['segments'][0x0]};return{'parent':_0x4cc9bb[_0x20b3de(0x18d)][0x0],'child':_0x4cc9bb[_0x20b3de(0x18d)][_0x20b3de(0x17d)](0x1)[_0x20b3de(0x180)]('/')};}export function isYamlFilePath(_0x1bcf29){const _0x12c03f=a144_0x4e90;return _0x1bcf29[_0x12c03f(0x191)](_0x12c03f(0x1a8))||_0x1bcf29[_0x12c03f(0x191)](_0x12c03f(0x17f));}export async function resolveYamlFilePath(_0x5071c8,_0x12ff5e=nodeFileSystem){const _0x4eaf77=a144_0x4e90,_0x146bd4=a144_0x5df9b6[_0x4eaf77(0x193)](_0x5071c8);if(!await _0x12ff5e[_0x4eaf77(0x18b)](_0x146bd4))throw new Error(_0x4eaf77(0x1a4)+_0x5071c8);let _0x35aeca=a144_0x5df9b6['dirname'](_0x146bd4),_0x3edc48=null,_0x3ea01e=null;const _0x2fad12=a144_0x5df9b6['parse'](_0x35aeca)['root'];while(_0x35aeca!==_0x2fad12){const _0x27df40=a144_0x5df9b6[_0x4eaf77(0x180)](_0x35aeca,_0x4eaf77(0x1a6));if(await _0x12ff5e[_0x4eaf77(0x18b)](_0x27df40)){_0x3edc48=_0x27df40,_0x3ea01e=_0x35aeca;break;}_0x35aeca=a144_0x5df9b6[_0x4eaf77(0x1a7)](_0x35aeca);}if(!_0x3edc48||!_0x3ea01e)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x5071c8+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x2c0f36=await _0x12ff5e[_0x4eaf77(0x194)](_0x3edc48),_0x43c566=JSON['parse'](_0x2c0f36),_0x46efd7=_0x43c566[_0x4eaf77(0x1a5)];if(!_0x46efd7)throw new Error(_0x4eaf77(0x1a2));const _0xb8b49a=await _0x12ff5e[_0x4eaf77(0x194)](_0x146bd4),_0x1242aa=a144_0x5a2a69(_0xb8b49a),_0x175cfc=_0x1242aa[_0x4eaf77(0x181)];if(!_0x175cfc)throw new Error(_0x4eaf77(0x188)+_0x5071c8);const _0x101f39=_0x1242aa['type']==='journey'?_0x4eaf77(0x19d):_0x4eaf77(0x187),_0x550346=a144_0x5df9b6[_0x4eaf77(0x186)](_0x3ea01e,_0x146bd4),_0x52fec1=a144_0x5df9b6[_0x4eaf77(0x1a7)](_0x550346),_0x5a84d0=_0x52fec1==='.'?'':_0x52fec1['replace'](/\\/g,'/'),_0x4d5a70=_0x5a84d0?_0x46efd7+'/'+_0x5a84d0+'/'+_0x175cfc:_0x46efd7+'/'+_0x175cfc;return{'parentSegment':_0x46efd7,'segmentName':_0x175cfc,'folderPath':_0x5a84d0,'fullPath':_0x4d5a70,'resourceType':_0x101f39,'content':_0xb8b49a};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1cdf02,_0x32a45b){const _0x652dbb=a145_0xb0c9,_0x47ca60=_0x1cdf02();while(!![]){try{const _0x2fe5cd=-parseInt(_0x652dbb(0x16f))/0x1+-parseInt(_0x652dbb(0x17a))/0x2+parseInt(_0x652dbb(0x172))/0x3+-parseInt(_0x652dbb(0x177))/0x4*(parseInt(_0x652dbb(0x178))/0x5)+parseInt(_0x652dbb(0x16d))/0x6*(parseInt(_0x652dbb(0x176))/0x7)+parseInt(_0x652dbb(0x171))/0x8+parseInt(_0x652dbb(0x16e))/0x9;if(_0x2fe5cd===_0x32a45b)break;else _0x47ca60['push'](_0x47ca60['shift']());}catch(_0x290c3a){_0x47ca60['push'](_0x47ca60['shift']());}}}(a145_0x30b1,0x6426c));function a145_0x30b1(){const _0x20463d=['2166556wBuhdN','4msaLLm','1913705Avusll','.\x20Parent\x20name\x20cannot\x20be\x20empty','463354JvDZQD','6HAkFfC','4962627znVEII','627137DuRSYA','substring','5263088HVZuuW','398934UGoDil','Invalid\x20segment\x20reference\x20format:\x20','.\x20Child\x20name\x20cannot\x20be\x20empty','indexOf'];a145_0x30b1=function(){return _0x20463d;};return a145_0x30b1();}function a145_0xb0c9(_0xdb4971,_0x3c3450){_0xdb4971=_0xdb4971-0x16d;const _0x30b145=a145_0x30b1();let _0xb0c918=_0x30b145[_0xdb4971];return _0xb0c918;}export function parseSegmentRef(_0x1b0c27){const _0x976123=a145_0xb0c9,_0x312d02=_0x1b0c27[_0x976123(0x175)]('/');if(_0x312d02===-0x1)return{'parentId':_0x1b0c27};if(_0x312d02===0x0)throw new Error(_0x976123(0x173)+_0x1b0c27+_0x976123(0x179));const _0x20c92f=_0x1b0c27[_0x976123(0x170)](0x0,_0x312d02),_0x50c3eb=_0x1b0c27[_0x976123(0x170)](_0x312d02+0x1);if(_0x50c3eb==='')throw new Error(_0x976123(0x173)+_0x1b0c27+_0x976123(0x174));return{'parentId':_0x20c92f,'childId':_0x50c3eb};}
|