@treasuredata/tdx 2026.3.53 → 2026.3.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/cas-command.js +1 -1
- package/dist/commands/cas-segment-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.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-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/tools/work-create-item.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/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.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.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.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/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.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
|
-
const a152_0x451377=a152_0x18a7;(function(_0x5b21b3,_0x55c3b4){const _0x3f28bc=a152_0x18a7,_0x360796=_0x5b21b3();while(!![]){try{const _0x24432a=-parseInt(_0x3f28bc(0xfa))/0x1*(parseInt(_0x3f28bc(0x167))/0x2)+parseInt(_0x3f28bc(0x148))/0x3*(-parseInt(_0x3f28bc(0x1bb))/0x4)+-parseInt(_0x3f28bc(0xc6))/0x5+parseInt(_0x3f28bc(0x1b6))/0x6*(-parseInt(_0x3f28bc(0x19f))/0x7)+parseInt(_0x3f28bc(0x15b))/0x8*(parseInt(_0x3f28bc(0x10a))/0x9)+-parseInt(_0x3f28bc(0xf4))/0xa*(parseInt(_0x3f28bc(0xd6))/0xb)+parseInt(_0x3f28bc(0x14a))/0xc;if(_0x24432a===_0x55c3b4)break;else _0x360796['push'](_0x360796['shift']());}catch(_0x53d5d9){_0x360796['push'](_0x360796['shift']());}}}(a152_0x2189,0x9d946));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x451377(0x12d));export const PENDING_SEGMENT_PREFIX=a152_0x451377(0x118);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x4619a4){return''+PENDING_SEGMENT_PREFIX+_0x4619a4+'__';}function a152_0x2189(){const _0x3fc77f=['Updating\x20activation\x20\x27','Failed\x20to\x20resolve\x20segment\x20','__pending_','notification','create','Segment\x20not\x20found','columns','draft','withProgress','all','all_columns','activation_creating','nameToType','WaitStep','logSuccess','\x20(referenced\x20in\x20journey\x20','getSegment','\x20segment\x20from\x20file:\x20','activation_','deps','conditionTimeoutDuration','Creating\x20segment\x20\x27','segmentFolderId','tdx.sdk.push-workflow','state','get','NOT_FOUND','../../utils/async.js','Entry\x20criteria:\x20','journeyBundleName','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','type','split','unchanged','uniqueServerName','and\x20the\x20server\x20segment,\x20then\x20retry.','\x27\x20entry\x20criteria','\x27\x20milestone','idToEmailMap','activationContext','versionNumber','\x20activation\x20\x27','errors','skipSegments','relative','journeyId','Delete\x20the\x20push\x20recovery\x20file\x20(','set','deleteActivation','stringify','723kmAdkP','conditionSegmentId','31287072LmViiU','some','updated','deleted','exitCriterias','yamlConfig','existingJourney','branches','Failed\x20to\x20resolve\x20activation\x20','Deleted\x20segment\x20\x27','journeyActivationStepId','listActivations','SEGMENT_NOT_FOUND','digest','activation_deleting','results',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','8uQunPk','waitStep','journey','slice','segment_created','list','user','createdSegmentIds','entry','folder','\x27\x20wait\x20condition','folderId','2FREAyH','startsWith','flatMap','rootFolderId','createdSegmentId','length','onProgress','attributes','folder_creating','size','index','segments','parentFolder','valid','push','update','journey_created','updateActivation','Fetching\x20','SEGMENT_UPDATE_ERROR','message','createSegment','includes','debug','journeys','segmentNameToId','./child-segment-yaml.js','embedded_activation_created','resolvedRule','Segment\x20not\x20found:\x20','max','null','Embedded\x20segment\x20\x27','journeyById','existingSegment','toString','segment_deleted','ACTIVATION_SYNTAX_ERROR','utf-8','folderPath','parse','createFolder','journeyName','segment','uniqueSegmentName','conditionTimeoutUnit','conditions','createActivation','Activation\x20not\x20found:\x20','filter','steps','segmentId','rule','match','createJourneySegment','find','239351AdIYHo','created','parseDocument','getJourney','activation_template_id','run_after_journey_refresh','activation_updated','absolutePath','Journey\x20\x27','validatedRequest','.$1.push-recovery.json','has','\x27\x20not\x20found\x20in\x20journey\x20\x27','behavior','Created\x20activation\x20\x27','localName','goal\x20criteria','\x27\x20decision\x20point\x20branch\x20\x27','map','\x20journey\x20from\x20file:\x20','object','action','resolveJourneyId','24iFdbeT','JOURNEY_SYNTAX_ERROR','name','stage\x20\x27','connection','6928QSNtcZ','journeyBundleId','description','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','waitStepType','embeddedSegmentNameToId','\x0a\x20\x20','connector_config','\x27\x20from\x20file:\x20','fetchJourney','Failed\x20to\x20','folderPathToId','diff','):\x20','values','existingSegments','Updating\x20segment\x20\x27','milestone','4910105tskYUo','idToName','ACTIVATION_UPDATE_ERROR','add','toLowerCase','join','Created\x20journey\x20\x27','stages','journeyStages','sort','kind','logWarning','entries','journey_creating','DecisionPoint','keys','607343XhfVTa','activationStepsById','isNew','getSegment\x20failed\x20for\x20','hex','existingActivation','logDeleted','Updated\x20segment\x20\x27','Updated\x20journey\x20\x27','logInfo',').\x20','activationActions','Condition','progress','Matched\x20server\x20segment\x20\x27','connectionIdToNameMap','\x27...','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','updateSegmentById','buildUserMaps','decision_point','journeyActivationNameToId','embedded_segment_creating','activationParams','Duration','./journey-yaml.js','INTERNAL','getActivation','sha1','170kOXFem','parentId','segment_deleting','delete','journey_updated','activation_created','609551ZOrBmG','Activation','verbose','toISOString','entryCriteria','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','entry_criteria','trim','\x27\x20exit\x20criteria','Failed\x20to\x20fetch\x20referenced\x20segment\x20','data','yamlActivation','segment_updating','dirname','journey_updating','relationships','10103103ovFmSG','resolveSegment','effectiveFolderId','activations','segment_creating','hasChanges','from','Deleted\x20activation\x20\x27','Name\x20has\x20already\x20been\x20taken','goal','Updated\x20activation\x20\x27','nameToId'];a152_0x2189=function(){return _0x3fc77f;};return a152_0x2189();}export function isPendingSegmentId(_0x2a3a43){const _0x16a8e4=a152_0x451377;return _0x2a3a43[_0x16a8e4(0x168)](PENDING_SEGMENT_PREFIX)&&!_0x2a3a43['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x3cce03){return _0x3cce03['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5593b2){return''+PENDING_ACTIVATION_PREFIX+_0x5593b2+'__';}export function isPendingActivationId(_0x351b34){const _0x49525b=a152_0x451377;return _0x351b34[_0x49525b(0x168)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0xb45536){return _0xb45536['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x962963,_0x552223){const _0x1e0d67=a152_0x451377,_0x50ebae=_0x962963+'::'+(_0x552223[_0x1e0d67(0x101)]()||_0x1e0d67(0x192)),_0x523774=createHash(_0x1e0d67(0xf3))['update'](_0x50ebae)[_0x1e0d67(0x157)](_0x1e0d67(0xda))['slice'](0x0,0xc);return'journey_entry_criteria_'+_0x523774;}export function ensureJourneyDefaults(_0x166d33){const _0x57003c=a152_0x451377;!_0x166d33[_0x57003c(0x1bd)]&&(_0x166d33[_0x57003c(0x1bd)]=''),!_0x166d33[_0x57003c(0x12e)]&&(_0x166d33[_0x57003c(0x12e)]=_0x57003c(0x11d));}export function injectExistingStageIds(_0x3c5281,_0x21783c){const _0x5e5257=a152_0x451377,_0x31b36b=new Map(_0x21783c[_0x5e5257(0x1b1)](_0x2d8645=>[_0x2d8645[_0x5e5257(0x1b8)],_0x2d8645['id']]));for(const _0x18a8d3 of _0x3c5281){if(!_0x18a8d3['id']){const _0x4691b3=_0x31b36b[_0x5e5257(0x12f)](_0x18a8d3[_0x5e5257(0x1b8)]);_0x4691b3&&(_0x18a8d3['id']=_0x4691b3);}}}export function resolveTDFolderPath(_0x5ee177,_0x323b8f,_0x4f1a97){const _0x44cdc3=a152_0x451377;if(!_0x323b8f)return _0x5ee177;if(_0x5ee177===_0x4f1a97||_0x5ee177[_0x44cdc3(0x168)](_0x4f1a97+'/'))return _0x5ee177;return _0x5ee177?_0x4f1a97+'/'+_0x5ee177:_0x4f1a97;}export function addFoldersToCreate(_0x12d967,_0x4d05d2,_0x3a584a){const _0x2c6224=a152_0x451377;if(!_0x12d967)return;if(_0x4d05d2[_0x2c6224(0x1aa)](_0x12d967))return;const _0x36a59a=_0x12d967[_0x2c6224(0x136)]('/');let _0x3ed343='';for(const _0xdf607b of _0x36a59a){_0x3ed343=_0x3ed343?_0x3ed343+'/'+_0xdf607b:_0xdf607b,!_0x4d05d2[_0x2c6224(0x1aa)](_0x3ed343)&&_0x3a584a[_0x2c6224(0xc9)](_0x3ed343);}}export function sortFoldersByDepth(_0x5a5abb){const _0x2ab33=a152_0x451377;return[..._0x5a5abb][_0x2ab33(0xcf)]((_0x1d3e71,_0x5d7c15)=>{const _0x52b3a7=_0x2ab33,_0x35c98c=(_0x1d3e71[_0x52b3a7(0x19c)](/\//g)||[])[_0x52b3a7(0x16c)],_0x44f95d=(_0x5d7c15['match'](/\//g)||[])['length'];return _0x35c98c-_0x44f95d;});}import*as a152_0x4a5dd5 from'yaml';import{readFileSync}from'fs';import a152_0x219797 from'path';import{isJourneyDef,parseYamlString as a152_0x3920c3,toYamlString as a152_0x32ba86,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(_0x1be58b){const _0x3e98b9=a152_0x451377;if(Array['isArray'](_0x1be58b))return'['+_0x1be58b[_0x3e98b9(0x1b1)](_0x357d55=>stableStringify(_0x357d55))['join'](',')+']';if(_0x1be58b&&typeof _0x1be58b===_0x3e98b9(0x1b3)){const _0x436ab8=_0x1be58b,_0x2cabb8=Object['keys'](_0x436ab8)['sort'](),_0x33aae8=_0x2cabb8['map'](_0x9c1a7b=>'\x22'+_0x9c1a7b+'\x22:'+stableStringify(_0x436ab8[_0x9c1a7b]));return'{'+_0x33aae8[_0x3e98b9(0xcb)](',')+'}';}const _0x45c3aa=JSON[_0x3e98b9(0x147)](_0x1be58b);return _0x45c3aa===undefined?_0x3e98b9(0x186):_0x45c3aa;}function activationSignature(_0x29f432){const _0xccf062=a152_0x451377,_0x2e8434={'connection':_0x29f432[_0xccf062(0x1ba)],..._0x29f432[_0xccf062(0x120)]!==undefined&&{'all_columns':_0x29f432[_0xccf062(0x120)]},..._0x29f432[_0xccf062(0x11c)]!==undefined&&{'columns':_0x29f432[_0xccf062(0x11c)]},..._0x29f432[_0xccf062(0x1ac)]!==undefined&&{'behavior':_0x29f432[_0xccf062(0x1ac)]},..._0x29f432['schedule']!==undefined&&{'schedule':_0x29f432['schedule']},..._0x29f432[_0xccf062(0x119)]!==undefined&&{'notification':_0x29f432[_0xccf062(0x119)]},..._0x29f432['connector_config']!==undefined&&{'connector_config':_0x29f432[_0xccf062(0xbb)]},..._0x29f432['activation_template_id']!==undefined&&{'activation_template_id':_0x29f432[_0xccf062(0x1a3)]}};return stableStringify(_0x2e8434);}async function fetchSegment(_0x3480ac,_0x3adc53,_0x3a8f64,_0x4d0ec9){const _0x362c37=a152_0x451377,_0x1376be=_0x4d0ec9?.[_0x362c37(0x19e)](_0x1b50a5=>_0x1b50a5['id']===_0x3a8f64);if(_0x1376be)return _0x1376be;try{return await _0x3480ac[_0x362c37(0x192)][_0x362c37(0x126)](_0x3adc53,_0x3a8f64);}catch(_0x5537f3){logger['debug'](_0x362c37(0xd9)+_0x3a8f64+_0x362c37(0x15a)+_0x5537f3);try{return await _0x3480ac[_0x362c37(0x192)]['getSegmentEntity'](_0x3a8f64);}catch(_0xbc5b95){return logger[_0x362c37(0x17e)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x3a8f64+':\x20'+_0xbc5b95),null;}}}function recoverSegmentIdsFromPushRecovery(_0x49683f,_0x2c9f39,_0x5270fa){const _0x36ec7d=a152_0x451377,_0x20d919=readPushRecovery(_0x49683f['absolutePath']);if(_0x20d919?.[_0x36ec7d(0x191)]===_0x49683f[_0x36ec7d(0x14f)][_0x36ec7d(0x1b8)])for(const [_0xde4967,_0x2a04f1]of Object[_0x36ec7d(0xd2)](_0x20d919['segments'])){const _0x2829b9=generateDeterministicJourneySegmentName(_0x49683f[_0x36ec7d(0x14f)][_0x36ec7d(0x1b8)],_0xde4967);_0x2a04f1[_0x36ec7d(0x138)]===_0x2829b9&&(_0x2c9f39['set'](_0xde4967,_0x2a04f1['segmentId']),_0x5270fa[_0x36ec7d(0x145)](_0xde4967,_0x2a04f1['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x44df82,_0x20cccb,_0x28b075,_0x530a8a){const _0x1c36bb=a152_0x451377;let _0x4aa966;try{_0x4aa966=await _0x44df82[_0x1c36bb(0x192)][_0x1c36bb(0x19d)]({'name':_0x28b075[_0x1c36bb(0x193)],'description':_0x28b075[_0x1c36bb(0x1bd)],'journeyId':_0x28b075[_0x1c36bb(0x143)],'rule':_0x530a8a(_0x28b075[_0x1c36bb(0x183)],!![]),'countPopulation':!![],'parentFolderId':_0x28b075[_0x1c36bb(0x166)],'audienceId':_0x28b075[_0x1c36bb(0xf5)]});}catch(_0x29f156){const _0x44b94e=_0x29f156 instanceof Error&&_0x29f156[_0x1c36bb(0x17b)][_0x1c36bb(0x17d)](_0x1c36bb(0x112));if(_0x44b94e){const _0x5e6ad0=readPushRecovery(_0x20cccb['absolutePath']),_0x506832=_0x5e6ad0?.[_0x1c36bb(0x191)]===_0x20cccb[_0x1c36bb(0x14f)][_0x1c36bb(0x1b8)]?_0x5e6ad0[_0x1c36bb(0x172)][_0x28b075[_0x1c36bb(0x1ae)]]:undefined;if(_0x506832?.[_0x1c36bb(0x138)]===_0x28b075['uniqueSegmentName'])await _0x44df82[_0x1c36bb(0x192)][_0x1c36bb(0xe9)](_0x28b075[_0x1c36bb(0xf5)],_0x506832[_0x1c36bb(0x19a)],{'description':_0x28b075['description'],'rule':_0x530a8a(_0x28b075[_0x1c36bb(0x183)],!![]),'countPopulation':!![]}),_0x4aa966=_0x506832[_0x1c36bb(0x19a)];else throw new SDKError(ErrorCode[_0x1c36bb(0x17a)],_0x1c36bb(0x187)+_0x28b075['localName']+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x1c36bb(0x144)+_0x20cccb[_0x1c36bb(0x1a6)]['replace'](/([^/]+)$/,_0x1c36bb(0x1a9))+')\x20')+_0x1c36bb(0x139),_0x29f156);}else throw _0x29f156;}return saveSegmentToPushRecovery(_0x20cccb[_0x1c36bb(0x1a6)],_0x20cccb[_0x1c36bb(0x14f)][_0x1c36bb(0x1b8)],_0x28b075[_0x1c36bb(0x1ae)],{'segmentId':_0x4aa966,'uniqueServerName':_0x28b075[_0x1c36bb(0x193)],'createdAt':new Date()[_0x1c36bb(0xfd)]()}),_0x4aa966;}export async function prepareSegmentFiles(_0x94a004,_0x46aa7d,_0x2d40e7,_0xcdae52,_0x45de64){const _0x579c7f=a152_0x451377,{activationDefToCreateRequest:_0x5466fc}=await import(_0x579c7f(0x181)),_0x485840=[],_0x1496a4=new Set();for(const {yamlConfig:_0x544524,folderPath:_0x3e008d,sourcePath:_0xef59c3}of _0x94a004){const _0x12c8b2=resolveTDFolderPath(_0x3e008d,_0xcdae52,_0x45de64),_0x7edf4b=_0x12c8b2+':'+_0x544524[_0x579c7f(0x1b8)],_0x372c61=_0x46aa7d['segmentByFolderAndName']['get'](_0x7edf4b),_0x1f591a=_0x372c61?_0x46aa7d['activationsBySegmentId'][_0x579c7f(0x12f)](_0x372c61['id'])||[]:[];addFoldersToCreate(_0x12c8b2,_0x46aa7d['folderPathToId'],_0x1496a4);const _0x232331=calculateActivationActions(_0x544524[_0x579c7f(0x10d)]||[],_0x1f591a,_0x46aa7d['idToEmailMap'],_0x46aa7d[_0x579c7f(0xe5)]);for(const _0x3833d0 of _0x232331){(_0x3833d0[_0x579c7f(0x135)]===_0x579c7f(0x11a)||_0x3833d0[_0x579c7f(0x135)]===_0x579c7f(0x176))&&_0x3833d0[_0x579c7f(0x105)]&&(_0x3833d0['validatedRequest']=await _0x5466fc(_0x3833d0[_0x579c7f(0x105)],_0x2d40e7));}const _0x58ed62=calculateSegmentDiff(_0x544524,_0x372c61,_0x1f591a,_0x46aa7d[_0x579c7f(0x13c)],_0x46aa7d['connectionIdToNameMap']);_0x485840[_0x579c7f(0x175)]({'relativePath':_0x544524[_0x579c7f(0x1b8)],'absolutePath':_0xef59c3,'yamlConfig':_0x544524,'folderPath':_0x12c8b2,'existingSegment':_0x372c61,'existingActivations':_0x1f591a,'isNew':_0x58ed62['isNew'],'hasChanges':_0x58ed62['hasChanges'],'diff':_0x58ed62['diff'],'activationActions':_0x232331});}return{'segmentFiles':_0x485840,'foldersToCreate':_0x1496a4};}export async function prepareJourneyFiles(_0x1d1766,_0x591021,_0x170067,_0x50bfe2){const _0x290454=a152_0x451377,_0x25878d=[],_0x472c6b=new Set();for(const {yamlConfig:_0x3055ba,folderPath:_0x41b40e,sourcePath:_0x3e8eee}of _0x1d1766){const _0x3b15a2=resolveTDFolderPath(_0x41b40e,_0x170067,_0x50bfe2),_0x2a0ccc=_0x3b15a2+':'+_0x3055ba['name'],_0x7b1fee=_0x591021['journeyBundlesByFolderAndName'][_0x290454(0x12f)](_0x2a0ccc);let _0x3af42e,_0xa25960;if(_0x7b1fee&&_0x7b1fee[_0x290454(0x16c)]>0x0){const _0x86d9c=buildLocalExpandedRuleMappings(_0x3055ba),{createYamlContext:_0x4b14b4,prefetchJourneySegments:_0x3d3909}=createPushYamlContextForBundle(_0x591021[_0x290454(0x129)],_0x591021['parentId'],_0x591021['existingSegments'],_0x86d9c,_0x591021['idToEmailMap'],_0x591021[_0x290454(0xe5)],_0x591021[_0x290454(0xd7)],_0x591021['journeyById']);await _0x3d3909(_0x7b1fee[_0x290454(0x1b1)](_0x11f0fb=>_0x11f0fb['id']));const _0x42dda5=await _0x591021['deps'][_0x290454(0x15d)]['getLatestJourneyId'](_0x7b1fee[0x0][_0x290454(0x1bc)]),_0x4aba50=hasMultipleVersions(_0x3055ba),_0x5a8b4d=async _0x5ebdd8=>{const _0x50462d=_0x290454,_0x1323c8=_0x591021[_0x50462d(0x188)]?.['get'](_0x5ebdd8);if(_0x1323c8)return _0x1323c8;return _0x591021[_0x50462d(0xbd)]({'journeyId':_0x5ebdd8,'journeyName':_0x3055ba[_0x50462d(0x1b8)],'isMultiVersion':_0x7b1fee[_0x50462d(0x16c)]>0x1});};if(_0x4aba50&&_0x7b1fee[_0x290454(0x16c)]>0x1){const _0x10bb5e=[];for(const _0x2b0d36 of _0x7b1fee){const _0x5bbe34=_0x2b0d36[_0x290454(0x13e)]||0x1;_0x591021['progress']?.[_0x290454(0x176)](_0x290454(0x179)+_0x3055ba[_0x290454(0x1b8)]+'\x20v'+_0x5bbe34);const _0x4fc820=await _0x5a8b4d(_0x2b0d36['id']),_0x3a4fcc=_0x4b14b4(_0x2b0d36['id']),_0x4776ca=await journeyResponseToDef(_0x4fc820,_0x3a4fcc);_0x10bb5e[_0x290454(0x175)]({'item':_0x2b0d36,'yaml':_0x4776ca});}const _0x42433=buildLocalRuleToNameMappingFromJourney(_0x3055ba);_0xa25960=buildMergedJourneyDef(_0x10bb5e,_0x42433,_0x42dda5);const _0x20baab=Math[_0x290454(0x185)](..._0x10bb5e[_0x290454(0x1b1)](_0x51c901=>_0x51c901['item'][_0x290454(0x13e)]||0x0)),_0x2256fa=_0x7b1fee[_0x290454(0x19e)](_0x744971=>(_0x744971[_0x290454(0x13e)]||0x0)===_0x20baab);_0x2256fa&&(_0x591021['progress']?.[_0x290454(0x176)](_0x290454(0x179)+_0x3055ba[_0x290454(0x1b8)]+'\x20v'+_0x20baab),_0x3af42e=await _0x5a8b4d(_0x2256fa['id']));}else{const _0xaea7df=_0x7b1fee[_0x7b1fee['length']-0x1];_0x591021[_0x290454(0xe3)]?.[_0x290454(0x176)](_0x290454(0x179)+_0x3055ba['name']),_0x3af42e=await _0x5a8b4d(_0xaea7df['id']);const _0x2d4f02=_0x4b14b4(_0xaea7df['id']),_0x12d815=await journeyResponseToDef(_0x3af42e,_0x2d4f02),_0x5a8b9b=buildLocalRuleToNameMappingFromJourney(_0x3055ba);_0xa25960=buildMergedJourneyDef([{'item':_0xaea7df,'yaml':_0x12d815}],_0x5a8b9b,_0x42dda5);}}addFoldersToCreate(_0x3b15a2,_0x591021[_0x290454(0xbf)],_0x472c6b);const _0x118217=calculateJourneyDiff(_0x3055ba,_0xa25960);_0x25878d[_0x290454(0x175)]({'relativePath':_0x3055ba['name'],'absolutePath':_0x3e8eee,'yamlConfig':_0x3055ba,'folderPath':_0x3b15a2,'existingJourney':_0x3af42e,'isNew':_0x118217[_0x290454(0xd8)],'hasChanges':_0x118217[_0x290454(0x10f)],'diff':_0x118217[_0x290454(0xc0)]});}return{'journeyFiles':_0x25878d,'foldersToCreate':_0x472c6b};}function a152_0x18a7(_0x222b6a,_0x43679f){_0x222b6a=_0x222b6a-0xb8;const _0x2189cf=a152_0x2189();let _0x18a7a9=_0x2189cf[_0x222b6a];return _0x18a7a9;}export function calculateActivationActions(_0x1ebdcf,_0x769ca4,_0x544de1,_0x2977b7){const _0x1a53e9=a152_0x451377,_0x4302d8=[],_0x111553=new Map();for(const _0x1394a4 of _0x769ca4){_0x111553[_0x1a53e9(0x145)](_0x1394a4[_0x1a53e9(0x1b8)],_0x1394a4);}const _0xd3020d=new Map();for(const _0x43b2e1 of _0x1ebdcf){_0xd3020d[_0x1a53e9(0x145)](_0x43b2e1['name'],_0x43b2e1);}for(const _0x38845b of _0x1ebdcf){const _0x24ec2c=_0x111553['get'](_0x38845b[_0x1a53e9(0x1b8)]);if(!_0x24ec2c)_0x4302d8[_0x1a53e9(0x175)]({'type':'create','name':_0x38845b['name'],'yamlActivation':_0x38845b});else{const _0x340a95=activationResponseToDef(_0x24ec2c,_0x544de1,_0x2977b7),_0x48b6a4=a152_0x4a5dd5[_0x1a53e9(0x147)](_0x340a95),_0x7686ec=a152_0x4a5dd5[_0x1a53e9(0x147)](_0x38845b);_0x48b6a4!==_0x7686ec&&_0x4302d8[_0x1a53e9(0x175)]({'type':_0x1a53e9(0x176),'name':_0x38845b[_0x1a53e9(0x1b8)],'yamlActivation':_0x38845b,'existingActivation':_0x24ec2c});}}for(const _0x4df230 of _0x769ca4){!_0xd3020d[_0x1a53e9(0x1aa)](_0x4df230['name'])&&_0x4302d8[_0x1a53e9(0x175)]({'type':_0x1a53e9(0xf7),'name':_0x4df230['name'],'existingActivation':_0x4df230});}return _0x4302d8;}function calculateYamlDiff(_0x29c014,_0x53ce09){if(_0x53ce09){const _0x2c5e13=generateDiff(_0x53ce09,_0x29c014),_0x529642=hasChanges(_0x2c5e13);return{'isNew':![],'hasChanges':_0x529642,'diff':_0x529642?formatDiffWithColors(_0x2c5e13):undefined};}const _0xffc45=generateDiff('',_0x29c014);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0xffc45)};}export function calculateSegmentDiff(_0x404155,_0x5617cd,_0x357d04,_0x4cd10e,_0x100694){const _0xa8a061=segmentToYamlString(_0x404155),_0x4ae82f=_0x5617cd?segmentToYamlString(segmentWithActivationsToYaml(_0x5617cd,_0x357d04,undefined,_0x4cd10e,_0x100694)):undefined;return calculateYamlDiff(_0xa8a061,_0x4ae82f);}export function calculateJourneyDiff(_0x182fb7,_0x340a24){const _0x4ca93e=normalizeJourneyDef(_0x182fb7,_0x182fb7),_0x1e2e2b=a152_0x32ba86(_0x4ca93e),_0x23d3e4=_0x340a24?a152_0x32ba86(normalizeJourneyDef(_0x340a24,_0x182fb7)):undefined;return calculateYamlDiff(_0x1e2e2b,_0x23d3e4);}export function findSegmentsToDelete(_0x45a409,_0x29eb2d,_0x59e44d,_0x30009f,_0x4cf1c2){const _0x2d5ea8=a152_0x451377,_0x456c2f=new Set();for(const {yamlConfig:_0x3347d2,folderPath:_0x3a9c5e}of _0x29eb2d){_0x456c2f[_0x2d5ea8(0xc9)](_0x3a9c5e+':'+_0x3347d2[_0x2d5ea8(0x1b8)]);}return _0x45a409[_0x2d5ea8(0x198)](_0x2dcd64=>{const _0x39c651=_0x2d5ea8,_0x1fbf72=_0x2dcd64[_0x39c651(0x12c)]?_0x59e44d[_0x39c651(0x12f)](_0x2dcd64[_0x39c651(0x12c)][_0x39c651(0x18a)]())||'':'',_0x147f7b=_0x1fbf72+':'+_0x2dcd64['name'];if(_0x456c2f[_0x39c651(0x1aa)](_0x147f7b))return![];if(_0x4cf1c2)return _0x1fbf72===_0x30009f||_0x1fbf72[_0x39c651(0x168)](_0x30009f+'/');return!![];});}export function findJourneysToDelete(_0x23ec0b,_0x575c14,_0x107f82,_0x575008,_0x43fc34){const _0x2e275f=a152_0x451377,_0x20b308=new Set();for(const {yamlConfig:_0x49b328,folderPath:_0x193328}of _0x575c14){_0x20b308[_0x2e275f(0xc9)](_0x193328+':'+_0x49b328[_0x2e275f(0x1b8)]);}return _0x23ec0b[_0x2e275f(0x198)](_0x29f883=>{const _0xb4e416=_0x2e275f,_0x3d7f0b=_0x29f883[_0xb4e416(0x166)]?_0x107f82[_0xb4e416(0x12f)](_0x29f883[_0xb4e416(0x166)])||'':'',_0x2f40d0=_0x3d7f0b+':'+_0x29f883[_0xb4e416(0x133)];if(_0x20b308['has'](_0x2f40d0))return![];if(_0x43fc34)return _0x3d7f0b===_0x575008||_0x3d7f0b[_0xb4e416(0x168)](_0x575008+'/');return!![];});}export function buildSegmentLookupMap(_0x22811b,_0x2f3823){const _0x2b6eea=a152_0x451377,_0x7bf1f4=new Map();for(const _0x3f26dd of _0x22811b){const _0x2e8ce5=_0x3f26dd[_0x2b6eea(0x12c)]?_0x2f3823[_0x2b6eea(0x12f)](_0x3f26dd[_0x2b6eea(0x12c)]['toString']())||'':'',_0x1d31b4=_0x2e8ce5+':'+_0x3f26dd[_0x2b6eea(0x1b8)];_0x7bf1f4[_0x2b6eea(0x145)](_0x1d31b4,_0x3f26dd);}return _0x7bf1f4;}export function buildSegmentNameToIdMap(_0x1e14e3){const _0x1046a6=a152_0x451377,_0xc2d140=new Map();for(const _0x3661e5 of _0x1e14e3){_0xc2d140['set'](_0x3661e5[_0x1046a6(0x1b8)],_0x3661e5['id']);}return _0xc2d140;}export function buildJourneyBundleLookupMap(_0x31ef1b,_0x43c7f7){const _0x57b4bf=a152_0x451377,_0x490862=new Map();for(const _0x474d42 of _0x31ef1b){const _0xcbf6ca=_0x474d42['folderId']?_0x43c7f7['get'](_0x474d42[_0x57b4bf(0x166)])||'':'',_0x745a8e=_0xcbf6ca+':'+_0x474d42[_0x57b4bf(0x133)];!_0x490862[_0x57b4bf(0x1aa)](_0x745a8e)&&_0x490862['set'](_0x745a8e,[]),_0x490862[_0x57b4bf(0x12f)](_0x745a8e)[_0x57b4bf(0x175)](_0x474d42);}for(const _0xcac887 of _0x490862[_0x57b4bf(0xc2)]()){_0xcac887[_0x57b4bf(0xcf)]((_0x20424f,_0x39cfcb)=>(_0x20424f['versionNumber']||0x0)-(_0x39cfcb['versionNumber']||0x0));}return _0x490862;}export function collectFoldersToCreate(_0x262918,_0x502c23){const _0x5a0634=a152_0x451377,_0x119b4b=new Set();for(const _0xa900e4 of _0x262918){if(!_0xa900e4)continue;if(_0x502c23[_0x5a0634(0x1aa)](_0xa900e4))continue;const _0x23103f=_0xa900e4[_0x5a0634(0x136)]('/');let _0x30a2fd='';for(const _0x2c31 of _0x23103f){_0x30a2fd=_0x30a2fd?_0x30a2fd+'/'+_0x2c31:_0x2c31,!_0x502c23['has'](_0x30a2fd)&&_0x119b4b[_0x5a0634(0xc9)](_0x30a2fd);}}return _0x119b4b;}export function parseAndClassifyYamlFiles(_0x4c5694,_0x6c186,_0x55aaa4){const _0x11d8ef=a152_0x451377,_0x214905=[],_0x1d2d29=[];for(const _0x36e488 of _0x4c5694){const _0x944fdc=a152_0x219797['relative'](_0x6c186,a152_0x219797[_0x11d8ef(0x107)](_0x36e488)),_0x8b53b2=_0x944fdc==='.'?'':_0x944fdc,_0x40c1f2=readFileSync(_0x36e488,'utf-8'),_0x47bbd4=a152_0x4a5dd5[_0x11d8ef(0x18f)](_0x40c1f2);if(isJourneyDef(_0x47bbd4)){const _0xeb359=a152_0x3920c3(_0x40c1f2);_0x1d2d29[_0x11d8ef(0x175)]({'yamlConfig':_0xeb359,'folderPath':_0x8b53b2,'sourcePath':_0x36e488});}else{if(!_0x55aaa4?.[_0x11d8ef(0x141)]){const _0x138af3=parseSegmentYamlFile(_0x40c1f2),_0x4ac252=normalizeChildSegmentYaml(_0x138af3);_0x214905[_0x11d8ef(0x175)]({'yamlConfig':_0x4ac252,'folderPath':_0x8b53b2,'sourcePath':_0x36e488});}}}return{'segments':_0x214905,'journeys':_0x1d2d29};}export function validateParsedFiles(_0x21c3a0,_0x298a28){const _0x24a5a0=a152_0x451377,_0x2658b3=[];for(const {yamlConfig:_0x48bf8b,sourcePath:_0x1247f9}of _0x21c3a0[_0x24a5a0(0x172)]){const _0x4ed216=readFileSync(_0x1247f9,_0x24a5a0(0x18d)),_0x58fec7=a152_0x4a5dd5[_0x24a5a0(0x1a1)](_0x4ed216),_0x4abf14=validateSegmentDef(_0x48bf8b,{'source':_0x4ed216,'document':_0x58fec7},{'skipSchema':!![]});if(!_0x4abf14[_0x24a5a0(0x174)]){const _0x1ae8d7=a152_0x219797[_0x24a5a0(0x142)](_0x298a28,_0x1247f9);_0x2658b3[_0x24a5a0(0x175)]({'filePath':_0x1ae8d7,'source':_0x4ed216,'result':_0x4abf14,'isJourney':![]});}}for(const {yamlConfig:_0x53fb1b,sourcePath:_0x205957}of _0x21c3a0[_0x24a5a0(0x17f)]){const _0x386987=readFileSync(_0x205957,_0x24a5a0(0x18d)),_0xea18a5=a152_0x4a5dd5['parseDocument'](_0x386987),_0x4b483f=validateJourneyDef(_0x53fb1b,{'source':_0x386987,'document':_0xea18a5},{'skipSchema':!![]});if(!_0x4b483f[_0x24a5a0(0x174)]){const _0x36c150=a152_0x219797[_0x24a5a0(0x142)](_0x298a28,_0x205957);_0x2658b3[_0x24a5a0(0x175)]({'filePath':_0x36c150,'source':_0x386987,'result':_0x4b483f,'isJourney':!![]});}}return _0x2658b3;}export function formatValidationErrors(_0x186006){const _0x409c78=a152_0x451377,_0x14985b=[];for(const {filePath:_0x48f03f,source:_0xf3a1b5,result:_0x436bc1,isJourney:_0x48bfdf}of _0x186006){const _0x131f66=_0x48bfdf?'journey':'segment';_0x14985b['push']('\x0a'+_0x48f03f+'\x20('+_0x131f66+_0x409c78(0xc1)+_0x436bc1[_0x409c78(0x140)][_0x409c78(0x16c)]+'\x20error(s)'),_0x14985b['push'](formatValidationResult(_0x436bc1,_0xf3a1b5,_0x48f03f));}return _0x14985b[_0x409c78(0xcb)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x16976a){const _0x47e50c=a152_0x451377,_0x17de09=new Set(),_0x447097=new Map(),_0x4016ed=collectSegmentUsageCounts(_0x16976a);if(_0x16976a[_0x47e50c(0x172)])for(const [_0x407aa9,_0x29a0f1]of Object[_0x47e50c(0xd2)](_0x16976a[_0x47e50c(0x172)])){_0x17de09[_0x47e50c(0xc9)](_0x407aa9);if(_0x29a0f1[_0x47e50c(0x19b)]){const _0x766a9d=yamlRuleToApi(_0x29a0f1[_0x47e50c(0x19b)]),_0x587eb5=apiRuleToYaml(_0x766a9d);_0x447097['set'](_0x407aa9,_0x587eb5);}}const _0x1e0e6d=new Map();let _0x4a8b9f=0x0;for(const [_0x6c9d00,_0x5eae8e]of _0x447097){const _0x2f90b4=serializeExpandedRule(_0x5eae8e,_0x447097),_0x3fd303=_0x1e0e6d[_0x47e50c(0x12f)](_0x2f90b4)||[];_0x3fd303[_0x47e50c(0x175)]({'name':_0x6c9d00,'index':_0x4a8b9f}),_0x1e0e6d['set'](_0x2f90b4,_0x3fd303),_0x4a8b9f++;}const _0x4314e6=new Map();for(const [_0x5479a3,_0xc46974]of _0x1e0e6d){const _0x246b38=_0xc46974[_0x47e50c(0x15e)]()[_0x47e50c(0xcf)]((_0x13103,_0x58470c)=>{const _0x25f615=_0x47e50c,_0x98afce=_0x4016ed['get'](_0x13103[_0x25f615(0x1b8)])||0x0,_0x45036a=_0x4016ed['get'](_0x58470c[_0x25f615(0x1b8)])||0x0;if(_0x98afce!==_0x45036a)return _0x45036a-_0x98afce;return _0x13103[_0x25f615(0x171)]-_0x58470c['index'];})[_0x47e50c(0x1b1)](_0x17f8bd=>_0x17f8bd[_0x47e50c(0x1b8)]),_0x1833af=[];for(const _0x245876 of _0x246b38){const _0x451931=_0x4016ed[_0x47e50c(0x12f)](_0x245876)||0x0,_0x27b9ab=Math[_0x47e50c(0x185)](_0x451931,0x1);for(let _0x14d259=0x0;_0x14d259<_0x27b9ab;_0x14d259++){_0x1833af[_0x47e50c(0x175)](_0x245876);}}_0x4314e6[_0x47e50c(0x145)](_0x5479a3,_0x1833af);}return{'existingLocalSegmentNames':_0x17de09,'localSegmentRules':_0x447097,'localExpandedRuleToNames':_0x4314e6};}export function createSegmentIdResolver(_0x423c1a,_0x2c53ab){return async _0x3585bc=>{const _0x3eb6f1=a152_0x18a7,_0x4ce11f=_0x423c1a[_0x3eb6f1(0x12f)](_0x3585bc);if(!_0x4ce11f)throw new SDKError(ErrorCode[_0x3eb6f1(0x156)],_0x3eb6f1(0x184)+_0x3585bc+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x2c53ab+'\x27)');return _0x4ce11f;};}export function extractRootFolderId(_0x3432c3){const _0xe77d12=a152_0x451377;return _0x3432c3[_0xe77d12(0x109)]?.['parentSegmentFolder']?.[_0xe77d12(0x104)]?.['id']||_0x3432c3[_0xe77d12(0x109)]?.[_0xe77d12(0x173)]?.[_0xe77d12(0x104)]?.['id'];}export function buildConnectionMaps(_0x2a8183){const _0x404120=a152_0x451377,_0x88d23e=new Map(),_0x4dd71b=new Map(),_0x41ccd9=new Map();for(const _0x4f49c6 of _0x2a8183){_0x88d23e[_0x404120(0x145)](_0x4f49c6[_0x404120(0x1b8)],parseInt(_0x4f49c6['id'],0xa)),_0x4dd71b[_0x404120(0x145)](_0x4f49c6['id'],_0x4f49c6[_0x404120(0x1b8)]),_0x41ccd9[_0x404120(0x145)](_0x4f49c6['name'],_0x4f49c6['type']);}return{'nameToId':_0x88d23e,'idToName':_0x4dd71b,'nameToType':_0x41ccd9};}export function calculatePushStats(_0x1116b9,_0x490d7b,_0x33b8bb,_0x43d7b8,_0x46ae82,_0x1abdf8,_0xfe097f){const _0x50ce1a=a152_0x451377,_0xd14f68=_0x1116b9[_0x50ce1a(0x198)](_0x12ed44=>_0x12ed44[_0x50ce1a(0xd8)]),_0x1a1fd0=_0x1116b9[_0x50ce1a(0x198)](_0x539ddf=>!_0x539ddf[_0x50ce1a(0xd8)]&&_0x539ddf[_0x50ce1a(0x10f)]),_0x37ce2c=_0x1116b9[_0x50ce1a(0x198)](_0x4d0d82=>!_0x4d0d82[_0x50ce1a(0xd8)]&&!_0x4d0d82[_0x50ce1a(0x10f)]),_0x1516d=_0x1abdf8?_0x43d7b8:[],_0x4cde36=_0x490d7b[_0x50ce1a(0x198)](_0x2d14d6=>_0x2d14d6[_0x50ce1a(0xd8)]),_0x3d2ea6=_0x490d7b['filter'](_0x21eb33=>!_0x21eb33[_0x50ce1a(0xd8)]&&_0x21eb33['hasChanges']),_0x462253=_0x490d7b[_0x50ce1a(0x198)](_0x4dd8aa=>!_0x4dd8aa[_0x50ce1a(0xd8)]&&!_0x4dd8aa[_0x50ce1a(0x10f)]),_0x40187b=_0x1abdf8?_0x46ae82:[],_0x9c877=_0x1116b9[_0x50ce1a(0x169)](_0x1f7f2b=>_0x1f7f2b[_0x50ce1a(0xe1)]),_0x57885a=_0x9c877[_0x50ce1a(0x198)](_0x23c43b=>_0x23c43b['type']===_0x50ce1a(0x11a)),_0x267780=_0x9c877[_0x50ce1a(0x198)](_0x13a84f=>_0x13a84f[_0x50ce1a(0x135)]==='update'),_0xbe38a2=_0x9c877[_0x50ce1a(0x198)](_0x541d8b=>_0x541d8b[_0x50ce1a(0x135)]===_0x50ce1a(0xf7)),_0x23a213=Array[_0x50ce1a(0x110)](_0x33b8bb)['sort'](),_0x5405c4=_0xfe097f?![]:_0xd14f68[_0x50ce1a(0x16c)]>0x0||_0x1a1fd0['length']>0x0||_0x1516d[_0x50ce1a(0x16c)]>0x0,_0x48253a=_0x4cde36[_0x50ce1a(0x16c)]>0x0||_0x3d2ea6[_0x50ce1a(0x16c)]>0x0||_0x40187b['length']>0x0,_0x13f6af=_0xfe097f?![]:_0x9c877['length']>0x0,_0x4981da=_0x23a213[_0x50ce1a(0x16c)]>0x0;return{'segments':{'new':_0xd14f68,'changed':_0x1a1fd0,'unchanged':_0x37ce2c,'toDelete':_0x1516d},'journeys':{'new':_0x4cde36,'changed':_0x3d2ea6,'unchanged':_0x462253,'toDelete':_0x40187b},'activations':{'all':_0x9c877,'toCreate':_0x57885a,'toUpdate':_0x267780,'toDelete':_0xbe38a2},'folders':{'toCreate':_0x23a213},'counts':{'segments':{'new':_0xd14f68[_0x50ce1a(0x16c)],'changed':_0x1a1fd0[_0x50ce1a(0x16c)],'unchanged':_0x37ce2c['length'],'toDelete':_0x1516d[_0x50ce1a(0x16c)]},'journeys':{'new':_0x4cde36['length'],'changed':_0x3d2ea6[_0x50ce1a(0x16c)],'unchanged':_0x462253['length'],'toDelete':_0x40187b['length']},'activations':{'create':_0x57885a[_0x50ce1a(0x16c)],'update':_0x267780[_0x50ce1a(0x16c)],'delete':_0xbe38a2[_0x50ce1a(0x16c)]},'folders':_0x23a213[_0x50ce1a(0x16c)]},'hasChanges':_0x5405c4||_0x48253a||_0x13f6af||_0x4981da};}export async function buildPushExecutionContext(_0x4b3031,_0x2d2322,_0xad3ee3,_0x4765de,_0x2105f8,_0x5da02b){const _0x3edf32=a152_0x451377,_0x11a490=extractRootFolderId(_0xad3ee3),{pathToId:_0x301967,idToPath:_0xe56ecb}=buildFolderMaps(_0x2105f8),_0x37fb26=buildSegmentNameToIdMap(_0x4765de),_0x21983a=new Map(),{batchAsync:_0x26a1a8}=await import(_0x3edf32(0x131)),[_0x5121fe,_0x5873da]=await Promise['all']([_0x4b3031[_0x3edf32(0x161)][_0x3edf32(0xea)](),_0x4b3031['connection'][_0x3edf32(0x160)](),((async()=>{const _0x4028ee=_0x3edf32;!_0x5da02b&&_0x4765de[_0x4028ee(0x16c)]>0x0&&await _0x26a1a8(_0x4765de,async _0x4baab6=>{const _0x33e4b3=_0x4028ee,_0xcadb6f=await _0x4b3031[_0x33e4b3(0x192)]['listActivations'](_0x2d2322,_0x4baab6['id']);_0x21983a[_0x33e4b3(0x145)](_0x4baab6['id'],_0xcadb6f);});})())]),{emailToId:_0x387f2d,idToEmail:_0x4af57c}=_0x5121fe,_0x1c5e5d=buildConnectionMaps(_0x5873da);return{'rootFolderId':_0x11a490,'folderPathToId':_0x301967,'folderIdToPath':_0xe56ecb,'segmentNameToId':_0x37fb26,'activationsBySegmentId':_0x21983a,'emailToIdMap':_0x387f2d,'idToEmailMap':_0x4af57c,'connectionNameToIdMap':_0x1c5e5d[_0x3edf32(0x115)],'connectionIdToNameMap':_0x1c5e5d[_0x3edf32(0xc7)],'connectionNameToTypeMap':_0x1c5e5d[_0x3edf32(0x122)]};}export function createPushYamlContextForBundle(_0x2aa7ef,_0x1111e6,_0x3751e5,_0x4cc1ee,_0x25ff4d,_0x3a8b54,_0x9bb907,_0x3f9e22){const {existingLocalSegmentNames:_0x348cf8,localExpandedRuleToNames:_0x4cb442}=_0x4cc1ee,_0x44c344=new Set(),_0x432d79=new Map(),_0x178ab6=new Map(),_0x47d7ce=new Map(),_0x37684c=createJumpTargetCache(),_0x4c421f=new Map(),_0x4a6230=new Map(),_0x4cbda0=new Set();let _0x54ef60;const _0x221fbb=_0x25df16=>{const _0x13a04d={'resolveSegment':async _0x2e8b80=>{const _0x11a51b=a152_0x18a7,_0xcda15f=_0x47d7ce[_0x11a51b(0x12f)](_0x2e8b80);if(_0xcda15f!==undefined)return{'name':_0xcda15f,'isJourneyLocal':!![]};try{const _0x3b9992=await fetchSegment(_0x2aa7ef,_0x1111e6,_0x2e8b80,_0x3751e5);if(!_0x3b9992)throw new Error(_0x11a51b(0x11b));const _0x2903a6=generateJourneyLocalName(_0x3b9992[_0x11a51b(0x1b8)]),_0x18483c=_0x3b9992[_0x11a51b(0xd0)]===SEGMENT_KIND_JOURNEY&&_0x2903a6!==undefined;let _0x3ef84f=_0x3b9992[_0x11a51b(0x1b8)],_0x446665;if(_0x18483c&&_0x3b9992[_0x11a51b(0x19b)]){const _0x216177=apiRuleToYaml(_0x3b9992[_0x11a51b(0x19b)]);_0x4a6230[_0x11a51b(0x145)](_0x2e8b80,_0x216177);const _0x144aa1=async _0x1a2088=>{const _0x16a7cc=_0x11a51b,_0x39431f=collectSegmentRefsFromRule(_0x1a2088);for(const _0x282eb4 of _0x39431f){if(!_0x4a6230[_0x16a7cc(0x1aa)](_0x282eb4))try{const _0x2910c=await fetchSegment(_0x2aa7ef,_0x1111e6,_0x282eb4,_0x3751e5);if(_0x2910c?.[_0x16a7cc(0x19b)]){const _0x37c337=apiRuleToYaml(_0x2910c['rule']);_0x4a6230[_0x16a7cc(0x145)](_0x282eb4,_0x37c337),await _0x144aa1(_0x37c337);}}catch(_0x4cea9b){logger['debug'](_0x16a7cc(0x103)+_0x282eb4+':\x20'+_0x4cea9b);}}};await _0x144aa1(_0x216177);const _0x24ef6b=serializeExpandedRule(_0x216177,_0x4a6230),_0xd3d01=_0x4cb442[_0x11a51b(0x12f)](_0x24ef6b);if(_0xd3d01&&_0xd3d01['length']>0x0){const _0x70adb0=_0x432d79[_0x11a51b(0x12f)](_0x24ef6b)||0x0,_0x65c6c1=_0xd3d01[_0x70adb0]||_0xd3d01[_0xd3d01['length']-0x1];_0x432d79['set'](_0x24ef6b,_0x70adb0+0x1),_0x3ef84f=_0x65c6c1,_0x44c344[_0x11a51b(0xc9)](_0x3ef84f),_0x47d7ce[_0x11a51b(0x145)](_0x2e8b80,_0x3ef84f);const _0xd86813=await resolveRuleSegmentRefs(_0x216177,async _0x587b5c=>{const _0x11bf10=_0x11a51b,_0x5a48e3=_0x47d7ce[_0x11bf10(0x12f)](_0x587b5c);if(_0x5a48e3)return _0x5a48e3;const _0x498da6=await _0x54ef60[_0x11bf10(0x10b)](_0x587b5c);return _0x498da6['name'];});_0x446665={'description':_0x3b9992[_0x11a51b(0x1bd)],'rule':_0xd86813};}else{const _0x3015cf=_0x4c421f[_0x11a51b(0x12f)](_0x24ef6b);if(_0x3015cf)_0x3ef84f=_0x3015cf,_0x47d7ce['set'](_0x2e8b80,_0x3ef84f);else{if(_0x2903a6){let _0x266cf8=_0x2903a6,_0x19b405=0x2;while(_0x44c344['has'](_0x266cf8)||_0x348cf8[_0x11a51b(0x1aa)](_0x266cf8)){_0x266cf8=_0x2903a6+'_'+_0x19b405,_0x19b405++;}_0x44c344[_0x11a51b(0xc9)](_0x266cf8),_0x3ef84f=_0x266cf8;}_0x47d7ce['set'](_0x2e8b80,_0x3ef84f),_0x4c421f[_0x11a51b(0x145)](_0x24ef6b,_0x3ef84f);const _0x732115=await resolveRuleSegmentRefs(_0x216177,async _0x5db139=>{const _0x4d86a6=_0x11a51b,_0xa75b4c=_0x47d7ce[_0x4d86a6(0x12f)](_0x5db139);if(_0xa75b4c)return _0xa75b4c;const _0x2e66c5=await _0x54ef60[_0x4d86a6(0x10b)](_0x5db139);return _0x2e66c5[_0x4d86a6(0x1b8)];});_0x446665={'description':_0x3b9992[_0x11a51b(0x1bd)],'rule':_0x732115};}}}return{'name':_0x3ef84f,'isJourneyLocal':_0x18483c,'definition':_0x446665};}catch(_0x38c60e){return logger[_0x11a51b(0x17e)](_0x11a51b(0x117)+_0x2e8b80+':\x20'+_0x38c60e),{'name':_0x2e8b80,'isJourneyLocal':![]};}},'resolveActivation':async _0x569241=>{const _0xd56154=a152_0x18a7,_0x10633a=_0x178ab6[_0xd56154(0x12f)](_0x569241);if(_0x10633a!==undefined)return{'name':_0x10633a,'isJourneyLocal':!![]};try{let _0x24d222=_0x9bb907?.[_0xd56154(0x12f)](_0x569241);!_0x24d222&&(_0x24d222=await _0x2aa7ef[_0xd56154(0x15d)][_0xd56154(0xf2)](_0x25df16,_0x569241));const _0x1126f6=_0x24d222[_0xd56154(0x16e)][_0xd56154(0xee)][_0xd56154(0x1b8)]||_0x569241,_0x2895bb=sanitizeYamlKey(_0x1126f6)||_0xd56154(0x128)+_0x569241,_0x1616cf=_0x2895bb;_0x178ab6[_0xd56154(0x145)](_0x569241,_0x1616cf);const _0x480626=journeyActivationStepToYaml(_0x24d222,_0x25ff4d,_0x3a8b54);return{'name':_0x1616cf,'isJourneyLocal':!![],'definition':_0x480626};}catch(_0x103a77){return logger[_0xd56154(0x17e)](_0xd56154(0x152)+_0x569241+':\x20'+_0x103a77),{'name':_0x569241,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x5159bf,_0x4a9ac6)=>resolveJumpTarget(_0x5159bf,_0x4a9ac6,_0x37684c,async _0x2f8e1c=>{const _0x76c58d=a152_0x18a7,_0x5cafae=_0x3f9e22?.[_0x76c58d(0x12f)](_0x2f8e1c);if(_0x5cafae)return _0x5cafae;return _0x2aa7ef[_0x76c58d(0x15d)][_0x76c58d(0x1a2)](_0x2f8e1c);})};return _0x54ef60=_0x13a04d,_0x13a04d;},_0x3cb698=async _0x1e8b90=>{const _0x3a7288=a152_0x18a7,{collectSegmentIdsFromJourneyApi:_0x56bb6f}=await import(_0x3a7288(0xf0)),{batchAsync:_0x19d225}=await import(_0x3a7288(0x131)),_0x485127=new Set();for(const _0x32d704 of _0x1e8b90){let _0x2fd1a8=_0x3f9e22?.[_0x3a7288(0x12f)](_0x32d704);!_0x2fd1a8&&(_0x2fd1a8=await _0x2aa7ef['journey'][_0x3a7288(0x1a2)](_0x32d704));const _0x103bc4=_0x56bb6f(_0x2fd1a8);for(const _0xc79f82 of _0x103bc4){_0x485127[_0x3a7288(0xc9)](_0xc79f82);}}let _0x137fff=Array[_0x3a7288(0x110)](_0x485127);while(_0x137fff[_0x3a7288(0x16c)]>0x0){const _0x1a0d4b=_0x137fff['filter'](_0x582cc6=>!_0x4cbda0[_0x3a7288(0x1aa)](_0x582cc6));if(_0x1a0d4b[_0x3a7288(0x16c)]===0x0)break;const _0x471854=await _0x19d225(_0x1a0d4b,async _0x5802a7=>{const _0x4cb048=_0x3a7288;_0x4cbda0[_0x4cb048(0xc9)](_0x5802a7);const _0x4d421f=await fetchSegment(_0x2aa7ef,_0x1111e6,_0x5802a7,_0x3751e5);if(!_0x4d421f)return null;return{'segmentId':_0x5802a7,'segment':_0x4d421f};},0xa),_0x43cc41=new Set();for(const _0xb8a994 of _0x471854){if(!_0xb8a994?.[_0x3a7288(0x192)]?.[_0x3a7288(0x19b)])continue;const _0x15493e=apiRuleToYaml(_0xb8a994[_0x3a7288(0x192)]['rule']);_0x4a6230[_0x3a7288(0x145)](_0xb8a994['segmentId'],_0x15493e);const _0x3ef1ba=collectSegmentRefsFromRule(_0x15493e);for(const _0x336886 of _0x3ef1ba){!_0x4cbda0[_0x3a7288(0x1aa)](_0x336886)&&_0x43cc41[_0x3a7288(0xc9)](_0x336886);}}_0x137fff=Array[_0x3a7288(0x110)](_0x43cc41);}};return{'createYamlContext':_0x221fbb,'prefetchJourneySegments':_0x3cb698};}export async function executePushSegments(_0x5da40c,_0x1eb7e7,_0x33c350,_0x57346a,_0x1d12eb){const _0x154c2c=a152_0x451377,{segmentDefToCreateRequest:_0x5ea9f6,segmentDefToUpdateRequest:_0x5eff48}=await import(_0x154c2c(0x181)),_0x4fd61a=_0x33c350[_0x154c2c(0xbf)],_0x4f2fb2=0x5,_0x295c6f=async _0x401656=>{const _0x1f85d0=_0x154c2c,_0x5b522a=_0x401656[_0x1f85d0(0x18e)]?_0x4fd61a[_0x1f85d0(0x12f)](_0x401656[_0x1f85d0(0x18e)]):undefined;let _0xb6384c;const _0x36e9d7={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x373d9a=_0x401656[_0x1f85d0(0x14f)];if(_0x401656[_0x1f85d0(0x14f)][_0x1f85d0(0x19b)]){const _0x532df7=createSegmentIdResolver(_0x33c350[_0x1f85d0(0x180)],_0x401656[_0x1f85d0(0x14f)][_0x1f85d0(0x1b8)]),_0x5d7867=await resolveRuleSegmentIds(_0x401656[_0x1f85d0(0x14f)]['rule'],_0x532df7);_0x373d9a={..._0x401656['yamlConfig'],'rule':_0x5d7867};}try{if(_0x401656[_0x1f85d0(0xd8)]){_0x1d12eb['onProgress']?.({'type':_0x1f85d0(0x10e),'name':_0x401656[_0x1f85d0(0x14f)]['name']});const _0x50da3b=_0x5ea9f6(_0x373d9a,_0x5b522a),_0x5a4955=await _0x1d12eb[_0x1f85d0(0x11e)](_0x1f85d0(0x12b)+_0x401656[_0x1f85d0(0x14f)][_0x1f85d0(0x1b8)]+_0x1f85d0(0xe6),()=>_0x5da40c['segment'][_0x1f85d0(0x17c)](_0x57346a[_0x1f85d0(0xf5)],_0x50da3b));_0xb6384c=_0x5a4955[_0x1f85d0(0x104)]['id'],_0x33c350[_0x1f85d0(0x180)][_0x1f85d0(0x145)](_0x401656[_0x1f85d0(0x14f)][_0x1f85d0(0x1b8)],_0xb6384c),_0x36e9d7['createdSegmentId']={'name':_0x401656['yamlConfig']['name'],'id':_0xb6384c},_0x1d12eb[_0x1f85d0(0x16d)]?.({'type':_0x1f85d0(0x15f),'name':_0x401656[_0x1f85d0(0x14f)][_0x1f85d0(0x1b8)],'segmentId':_0xb6384c}),_0x1d12eb[_0x1f85d0(0x124)]?.('Created\x20segment\x20\x27'+_0x401656[_0x1f85d0(0x14f)][_0x1f85d0(0x1b8)]+'\x27'),_0x36e9d7['created']=0x1;}else{if(_0x401656[_0x1f85d0(0x10f)]){_0x1d12eb[_0x1f85d0(0x16d)]?.({'type':_0x1f85d0(0x106),'name':_0x401656[_0x1f85d0(0x14f)][_0x1f85d0(0x1b8)]});const _0x5d10fc=_0x5eff48(_0x373d9a);_0x5b522a!==_0x401656[_0x1f85d0(0x189)]?.[_0x1f85d0(0x12c)]&&(_0x5d10fc[_0x1f85d0(0x12c)]=_0x5b522a?parseInt(_0x5b522a,0xa):undefined),await _0x1d12eb[_0x1f85d0(0x11e)](_0x1f85d0(0xc4)+_0x401656[_0x1f85d0(0x14f)]['name']+_0x1f85d0(0xe6),()=>_0x5da40c[_0x1f85d0(0x192)][_0x1f85d0(0xe9)](_0x57346a[_0x1f85d0(0xf5)],_0x401656[_0x1f85d0(0x189)]['id'],_0x5d10fc)),_0xb6384c=_0x401656[_0x1f85d0(0x189)]['id'],_0x1d12eb['onProgress']?.({'type':'segment_updated','name':_0x401656['yamlConfig']['name']}),_0x1d12eb[_0x1f85d0(0x124)]?.(_0x1f85d0(0xdd)+_0x401656[_0x1f85d0(0x14f)][_0x1f85d0(0x1b8)]+'\x27'),_0x36e9d7[_0x1f85d0(0x14c)]=0x1;}else _0xb6384c=_0x401656['existingSegment']['id'];}}catch(_0x107245){const _0x316af6=isHttp400Error(_0x107245),_0x5eafe=_0x316af6?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x1f85d0(0x17a)],_0x15b246=getErrorMessage(_0x107245);throw new SDKError(_0x5eafe,_0x1f85d0(0xbe)+(_0x401656[_0x1f85d0(0xd8)]?_0x1f85d0(0x11a):_0x1f85d0(0x176))+_0x1f85d0(0x127)+_0x401656['absolutePath']+_0x1f85d0(0xba)+_0x15b246,_0x107245);}try{const _0xb4644f=await syncActivationsForSegment(_0x5da40c,_0x57346a[_0x1f85d0(0xf5)],_0xb6384c,_0x401656[_0x1f85d0(0x14f)][_0x1f85d0(0x1b8)],_0x401656[_0x1f85d0(0xe1)],_0x1d12eb,_0x401656[_0x1f85d0(0x1a6)]);_0x36e9d7[_0x1f85d0(0x10d)]=_0xb4644f;}catch(_0x66e376){if(_0x66e376 instanceof SDKError)throw _0x66e376;throw new SDKError(ErrorCode[_0x1f85d0(0xc8)],_0x1f85d0(0x134)+_0x401656['yamlConfig'][_0x1f85d0(0x1b8)]+_0x1f85d0(0xbc)+_0x401656[_0x1f85d0(0x1a6)]+_0x1f85d0(0xba)+getErrorMessage(_0x66e376),_0x66e376);}return _0x36e9d7;},_0xd0b692=await batchAsync(_0x1eb7e7,_0x295c6f,_0x4f2fb2),_0x3499b4={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x484095 of _0xd0b692){_0x3499b4[_0x154c2c(0x1a0)]+=_0x484095['created'],_0x3499b4[_0x154c2c(0x14c)]+=_0x484095['updated'],_0x484095[_0x154c2c(0x16b)]&&_0x3499b4[_0x154c2c(0x162)][_0x154c2c(0x145)](_0x484095['createdSegmentId']['name'],_0x484095[_0x154c2c(0x16b)]['id']),_0x3499b4[_0x154c2c(0x10d)][_0x154c2c(0x1a0)]+=_0x484095[_0x154c2c(0x10d)][_0x154c2c(0x1a0)],_0x3499b4[_0x154c2c(0x10d)]['updated']+=_0x484095['activations'][_0x154c2c(0x14c)],_0x3499b4[_0x154c2c(0x10d)][_0x154c2c(0x14d)]+=_0x484095[_0x154c2c(0x10d)]['deleted'];}return _0x3499b4;}async function syncActivationsForSegment(_0x581bcd,_0x1dbef7,_0x5a7a67,_0x414027,_0x552561,_0x7ab587,_0x5ea5b8){const _0x214b44=a152_0x451377,_0x13c9c8={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x3fa2ca of _0x552561){try{if(_0x3fa2ca[_0x214b44(0x135)]==='create'&&_0x3fa2ca[_0x214b44(0x1a8)])_0x7ab587[_0x214b44(0x16d)]?.({'type':_0x214b44(0x121),'segmentName':_0x414027,'activationName':_0x3fa2ca[_0x214b44(0x1b8)]}),await _0x7ab587[_0x214b44(0x11e)]('Creating\x20activation\x20\x27'+_0x3fa2ca['name']+_0x214b44(0xe6),()=>_0x581bcd[_0x214b44(0x192)][_0x214b44(0x196)](_0x1dbef7,_0x5a7a67,_0x3fa2ca[_0x214b44(0x1a8)])),_0x7ab587[_0x214b44(0x16d)]?.({'type':_0x214b44(0xf9),'segmentName':_0x414027,'activationName':_0x3fa2ca[_0x214b44(0x1b8)]}),_0x7ab587[_0x214b44(0x124)]?.(_0x214b44(0x1ad)+_0x3fa2ca[_0x214b44(0x1b8)]+'\x27'),_0x13c9c8['created']++;else{if(_0x3fa2ca['type']===_0x214b44(0x176)&&_0x3fa2ca[_0x214b44(0x1a8)]&&_0x3fa2ca[_0x214b44(0xdb)])_0x7ab587[_0x214b44(0x16d)]?.({'type':'activation_updating','segmentName':_0x414027,'activationName':_0x3fa2ca['name']}),await _0x7ab587['withProgress'](_0x214b44(0x116)+_0x3fa2ca[_0x214b44(0x1b8)]+_0x214b44(0xe6),()=>_0x581bcd[_0x214b44(0x192)][_0x214b44(0x178)](_0x1dbef7,_0x5a7a67,_0x3fa2ca[_0x214b44(0xdb)]['id'],_0x3fa2ca[_0x214b44(0x1a8)])),_0x7ab587[_0x214b44(0x16d)]?.({'type':_0x214b44(0x1a5),'segmentName':_0x414027,'activationName':_0x3fa2ca['name']}),_0x7ab587['logSuccess']?.(_0x214b44(0x114)+_0x3fa2ca[_0x214b44(0x1b8)]+'\x27'),_0x13c9c8['updated']++;else _0x3fa2ca[_0x214b44(0x135)]===_0x214b44(0xf7)&&_0x3fa2ca[_0x214b44(0xdb)]&&(_0x7ab587['onProgress']?.({'type':_0x214b44(0x158),'segmentName':_0x414027,'activationName':_0x3fa2ca[_0x214b44(0x1b8)]}),await _0x7ab587[_0x214b44(0x11e)]('Deleting\x20activation\x20\x27'+_0x3fa2ca[_0x214b44(0x1b8)]+_0x214b44(0xe6),()=>_0x581bcd[_0x214b44(0x192)][_0x214b44(0x146)](_0x1dbef7,_0x5a7a67,_0x3fa2ca[_0x214b44(0xdb)]['id'])),_0x7ab587[_0x214b44(0x16d)]?.({'type':'activation_deleted','segmentName':_0x414027,'activationName':_0x3fa2ca[_0x214b44(0x1b8)]}),_0x7ab587[_0x214b44(0xdc)]?.(_0x214b44(0x111)+_0x3fa2ca[_0x214b44(0x1b8)]+'\x27'),_0x13c9c8['deleted']++);}}catch(_0x3c6a7d){const _0x5966ba=isHttp400Error(_0x3c6a7d),_0x3da5d3=_0x5966ba?ErrorCode[_0x214b44(0x18c)]:ErrorCode[_0x214b44(0xc8)],_0x45e401=getErrorMessage(_0x3c6a7d);throw new SDKError(_0x3da5d3,_0x214b44(0xbe)+_0x3fa2ca[_0x214b44(0x135)]+_0x214b44(0x13f)+_0x3fa2ca[_0x214b44(0x1b8)]+_0x214b44(0xbc)+_0x5ea5b8+_0x214b44(0xba)+_0x45e401,_0x3c6a7d);}}return _0x13c9c8;}export async function executePushFolders(_0xb9ff12,_0x3c6cd0,_0x1dce38,_0x1cce3e,_0x16eae7){const _0x212698=a152_0x451377,_0xf9270f=new Map(_0x1dce38),_0x18c8be=sortFoldersByDepth(_0x3c6cd0);for(const _0x41ab93 of _0x18c8be){const _0x385479=_0x41ab93[_0x212698(0x136)]('/'),_0x4ea5ef=_0x385479[_0x385479[_0x212698(0x16c)]-0x1],_0x39183c=_0x385479[_0x212698(0x15e)](0x0,-0x1)[_0x212698(0xcb)]('/'),_0x2847cf=_0xf9270f[_0x212698(0x12f)](_0x39183c);_0x16eae7[_0x212698(0x16d)]?.({'type':_0x212698(0x16f),'folder':_0x41ab93});const _0x1c0924={'name':_0x4ea5ef,'parentFolderId':_0x2847cf},_0x1c6e10=await _0x16eae7[_0x212698(0x11e)]('Creating\x20folder\x20\x27'+_0x41ab93+_0x212698(0xe6),()=>_0xb9ff12[_0x212698(0x192)][_0x212698(0x190)](_0x1cce3e['parentId'],_0x1c0924));_0xf9270f[_0x212698(0x145)](_0x41ab93,_0x1c6e10[_0x212698(0x104)]['id']),_0x16eae7['onProgress']?.({'type':'folder_created','folder':_0x41ab93,'folderId':_0x1c6e10[_0x212698(0x104)]['id']}),_0x16eae7[_0x212698(0xdf)]?.('Created\x20folder\x20\x27'+_0x41ab93+'\x27');}return _0xf9270f;}export async function executePushSegmentDeletions(_0x57eb8e,_0x287538,_0x5814cc){const _0x10fd24=a152_0x451377;if(_0x287538[_0x10fd24(0x16c)]===0x0)return 0x0;const {batchAsync:_0x435ccb}=await import(_0x10fd24(0x131)),_0x557e34=0x5,_0x354f56=await _0x435ccb(_0x287538,async _0x61513e=>{const _0x54edfd=_0x10fd24;return _0x5814cc['onProgress']?.({'type':_0x54edfd(0xf6),'name':_0x61513e[_0x54edfd(0x1b8)]}),await _0x57eb8e[_0x54edfd(0x192)]['deleteSegment'](_0x61513e['id']),_0x5814cc[_0x54edfd(0x16d)]?.({'type':_0x54edfd(0x18b),'name':_0x61513e[_0x54edfd(0x1b8)]}),_0x5814cc[_0x54edfd(0xdc)]?.(_0x54edfd(0x153)+_0x61513e['name']+'\x27'),0x1;},_0x557e34);return _0x354f56['reduce']((_0x189f5b,_0x4b1407)=>_0x189f5b+_0x4b1407,0x0);}export async function executePushJourneys(_0x40402e,_0x22adef,_0x2710b0,_0x35794f,_0x23327b){const _0x5d3752=a152_0x451377,{journeyDefToRequest:_0x4c81b2}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x274ea4,yamlRuleToApi:_0x5525d4,validateSegmentRule:_0x121469}=await import(_0x5d3752(0x181)),_0x3a7862={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x1b65fe=new Map(_0x2710b0[_0x5d3752(0x180)]),_0x37facc=0x5;for(let _0x42ebff=0x0;_0x42ebff<_0x22adef[_0x5d3752(0x16c)];_0x42ebff+=_0x37facc){const _0x25ad4d=_0x22adef[_0x5d3752(0x15e)](_0x42ebff,_0x42ebff+_0x37facc),_0x4398c1=await Promise[_0x5d3752(0x11f)](_0x25ad4d[_0x5d3752(0x1b1)](async _0x54efdc=>{const _0x4dff5a=_0x5d3752;if(!_0x54efdc[_0x4dff5a(0xd8)]&&!_0x54efdc[_0x4dff5a(0x10f)])return{'action':_0x4dff5a(0x137),'name':_0x54efdc[_0x4dff5a(0x14f)][_0x4dff5a(0x1b8)],'journeyId':_0x54efdc[_0x4dff5a(0x150)]?.['id']};const _0x288142=_0x54efdc[_0x4dff5a(0x18e)]?_0x2710b0['folderPathToId']['get'](_0x54efdc[_0x4dff5a(0x18e)]):undefined;_0x23327b[_0x4dff5a(0x16d)]?.({'type':_0x54efdc[_0x4dff5a(0xd8)]?_0x4dff5a(0xd3):_0x4dff5a(0x108),'name':_0x54efdc['yamlConfig'][_0x4dff5a(0x1b8)]});try{const _0x2ee1d7=await executeSingleJourneyPush(_0x40402e,_0x54efdc,{..._0x2710b0,'segmentNameToId':_0x1b65fe},{'parentId':_0x35794f['parentId'],'rootFolderId':_0x35794f[_0x4dff5a(0x16a)],'folderId':_0x288142,'verbose':_0x35794f[_0x4dff5a(0xfc)]},_0x23327b,{'journeyDefToRequest':_0x4c81b2,'activationDefToCreateRequest':_0x274ea4,'yamlRuleToApi':_0x5525d4,'validateSegmentRule':_0x121469});for(const [_0x140bbf,_0x15aaa7]of _0x2ee1d7['embeddedSegmentNameToId']){_0x1b65fe[_0x4dff5a(0x145)](_0x140bbf,_0x15aaa7),_0x3a7862[_0x4dff5a(0xb9)][_0x4dff5a(0x145)](_0x140bbf,_0x15aaa7);}if(_0x2ee1d7[_0x4dff5a(0x1b4)]===_0x4dff5a(0x1a0))_0x23327b[_0x4dff5a(0x16d)]?.({'type':_0x4dff5a(0x177),'name':_0x54efdc['yamlConfig'][_0x4dff5a(0x1b8)],'journeyId':_0x2ee1d7[_0x4dff5a(0x143)]}),_0x23327b[_0x4dff5a(0x124)]?.(_0x4dff5a(0xcc)+_0x54efdc['yamlConfig'][_0x4dff5a(0x1b8)]+'\x27'),_0x3a7862['created']++;else _0x2ee1d7['action']===_0x4dff5a(0x14c)&&(_0x23327b[_0x4dff5a(0x16d)]?.({'type':_0x4dff5a(0xf8),'name':_0x54efdc['yamlConfig'][_0x4dff5a(0x1b8)]}),_0x23327b[_0x4dff5a(0x124)]?.(_0x4dff5a(0xde)+_0x54efdc[_0x4dff5a(0x14f)][_0x4dff5a(0x1b8)]+'\x27'),_0x3a7862[_0x4dff5a(0x14c)]++);return{'action':_0x2ee1d7['action'],'name':_0x54efdc[_0x4dff5a(0x14f)][_0x4dff5a(0x1b8)],'journeyId':_0x2ee1d7[_0x4dff5a(0x143)]};}catch(_0x468bda){const _0x91705d=isHttp400Error(_0x468bda),_0xa726e9=_0x91705d?ErrorCode[_0x4dff5a(0x1b7)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x1f259b=getErrorMessage(_0x468bda);throw new SDKError(_0xa726e9,_0x4dff5a(0xbe)+(_0x54efdc[_0x4dff5a(0xd8)]?_0x4dff5a(0x11a):'update')+_0x4dff5a(0x1b2)+_0x54efdc[_0x4dff5a(0x1a6)]+_0x4dff5a(0xba)+_0x1f259b,_0x468bda);}}));_0x3a7862[_0x5d3752(0x159)][_0x5d3752(0x175)](..._0x4398c1);}return _0x3a7862;}async function matchExistingJourneySegments(_0x1964ff,_0x1ecb3c,_0xe4a751,_0x2e84c2,_0x2606bf){const _0x23f4fe=a152_0x451377;if(!_0x1ecb3c[_0x23f4fe(0x150)]||!_0x1ecb3c[_0x23f4fe(0x14f)]['segments'])return;const _0x2fb390=new Map(),_0x126b31=new Set();for(const _0x4d6606 of Object[_0x23f4fe(0xd5)](_0x1ecb3c['yamlConfig']['segments'])){const _0xd626e=generateDeterministicJourneySegmentName(_0x1ecb3c['yamlConfig'][_0x23f4fe(0x1b8)],_0x4d6606);_0x2fb390[_0x23f4fe(0x145)](_0xd626e,_0x4d6606),_0x126b31[_0x23f4fe(0xc9)](_0x4d6606);}const _0x22c5b6=[],_0x55f983=collectSegmentIdsFromJourneyApi(_0x1ecb3c[_0x23f4fe(0x150)]);for(const _0x2cc22c of _0x55f983){const _0x28e3a2=await fetchSegment(_0x1964ff,_0xe4a751,_0x2cc22c,_0x2e84c2);if(!_0x28e3a2?.[_0x23f4fe(0x1b8)])continue;const _0x17436b=_0x2fb390['get'](_0x28e3a2[_0x23f4fe(0x1b8)]);_0x17436b?(_0x2606bf[_0x23f4fe(0x145)](_0x17436b,_0x2cc22c),_0x126b31[_0x23f4fe(0xf7)](_0x17436b)):_0x22c5b6['push']({'id':_0x2cc22c,'seg':_0x28e3a2});}if(_0x126b31[_0x23f4fe(0x170)]>0x0&&_0x22c5b6[_0x23f4fe(0x16c)]>0x0){const {localExpandedRuleToNames:_0x31c0d9}=buildLocalExpandedRuleMappings(_0x1ecb3c[_0x23f4fe(0x14f)]),_0x2cdaf9=new Map();for(const {id:_0x466811,seg:_0x4ab4b0}of _0x22c5b6){if(_0x4ab4b0[_0x23f4fe(0x19b)]){const _0x85ee06=apiRuleToYaml(_0x4ab4b0[_0x23f4fe(0x19b)]);_0x2cdaf9['set'](_0x466811,_0x85ee06);}}for(const {id:_0x5ce056,seg:_0x4f8e42}of _0x22c5b6){if(!_0x4f8e42[_0x23f4fe(0x19b)])continue;const _0x385ede=_0x2cdaf9[_0x23f4fe(0x12f)](_0x5ce056);if(!_0x385ede)continue;const _0x1041dd=serializeExpandedRule(_0x385ede,_0x2cdaf9),_0x487ce0=_0x31c0d9[_0x23f4fe(0x12f)](_0x1041dd);if(_0x487ce0){const _0x4e16eb=_0x487ce0[_0x23f4fe(0x19e)](_0x393eb1=>_0x126b31[_0x23f4fe(0x1aa)](_0x393eb1));_0x4e16eb&&(_0x2606bf[_0x23f4fe(0x145)](_0x4e16eb,_0x5ce056),_0x126b31[_0x23f4fe(0xf7)](_0x4e16eb),logger['debug'](_0x23f4fe(0xe4)+_0x4f8e42['name']+'\x27\x20to\x20local\x20\x27'+_0x4e16eb+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x4398a1,_0xc35544,_0x157dae,_0x195980,_0x13b059,_0x57b5ba){const _0x7caa69=a152_0x451377,{journeyDefToRequest:_0x1115ed,activationDefToCreateRequest:_0x5672eb,yamlRuleToApi:_0x26006a,validateSegmentRule:_0x164266}=_0x57b5ba,_0x36b426=new Map(),_0x325528=new Map();recoverSegmentIdsFromPushRecovery(_0xc35544,_0x36b426,_0x157dae[_0x7caa69(0x180)]);const _0xbc9801=new Map(),_0x57cc24=new Map(),_0x179408=new Map();let _0x3275ea;const _0x2fe011=async()=>{const _0x12061c=_0x7caa69;if(_0x3275ea)return;_0x3275ea=new Map();if(!_0xc35544[_0x12061c(0x150)])return;const _0x20c722=await _0x4398a1[_0x12061c(0x15d)][_0x12061c(0x155)](_0xc35544[_0x12061c(0x150)]['id']);for(const _0x54b5f2 of _0x20c722){const _0x44685d=journeyActivationStepToYaml(_0x54b5f2,_0x157dae[_0x12061c(0x13c)],_0x157dae[_0x12061c(0xe5)]),_0x1e6861=activationSignature(_0x44685d);!_0x3275ea[_0x12061c(0x1aa)](_0x1e6861)&&_0x3275ea['set'](_0x1e6861,_0x54b5f2['id']),_0x44685d[_0x12061c(0x1b8)]&&_0x325528[_0x12061c(0x145)](_0x44685d[_0x12061c(0x1b8)],_0x54b5f2['id']);}};await matchExistingJourneySegments(_0x4398a1,_0xc35544,_0x195980['parentId'],_0x157dae[_0x7caa69(0xc3)],_0x157dae['segmentNameToId']);const _0x2624b0={'resolveSegmentId':async _0xdfa4f3=>{const _0x16aa6d=_0x7caa69,_0x43aa89=_0x157dae[_0x16aa6d(0x180)]['get'](_0xdfa4f3);if(!_0x43aa89)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x16aa6d(0x184)+_0xdfa4f3+_0x16aa6d(0x125)+_0xc35544[_0x16aa6d(0x14f)]['name']+')');return _0x43aa89;},'resolveEmbeddedSegmentId':async(_0x388ac0,_0x4b9d1f)=>{const _0x5a0611=_0x7caa69,_0x5c6e44=_0x157dae[_0x5a0611(0x180)][_0x5a0611(0x12f)](_0x388ac0);if(_0x5c6e44)return _0x5c6e44;const _0xef0953=_0x157dae['existingSegments'][_0x5a0611(0x19e)](_0x4ab999=>_0x4ab999[_0x5a0611(0x1b8)]===_0x388ac0);if(_0xef0953)return _0x157dae['segmentNameToId'][_0x5a0611(0x145)](_0x388ac0,_0xef0953['id']),_0xef0953['id'];if(_0xc35544[_0x5a0611(0xd8)]){const {stageName:_0x5aaa94,criteriaName:_0x3a3b30}=findSegmentCriteriaLocation(_0xc35544[_0x5a0611(0x14f)],_0x388ac0);return _0x164266(_0x388ac0,_0x4b9d1f[_0x5a0611(0x19b)]),_0x57cc24[_0x5a0611(0x145)](_0x388ac0,{'definition':_0x4b9d1f,'stageName':_0x5aaa94,'criteriaName':_0x3a3b30}),createPendingSegmentId(_0x388ac0);}const _0x390d27=_0xc35544[_0x5a0611(0x150)]?.['id'];if(!_0x390d27)throw new SDKError(ErrorCode['INTERNAL'],_0x5a0611(0x1be));const _0x403c94=_0xbc9801[_0x5a0611(0x12f)](_0x388ac0);if(_0x403c94)return _0x403c94;const _0xd2d038=((async()=>{const _0x206a34=_0x5a0611;_0x164266(_0x388ac0,_0x4b9d1f['rule']);const _0xe85876=generateDeterministicJourneySegmentName(_0xc35544['yamlConfig']['name'],_0x388ac0),_0x4d317c=_0x157dae[_0x206a34(0xc3)][_0x206a34(0x19e)](_0x404847=>_0x404847[_0x206a34(0x1b8)]===_0xe85876),_0x3d94b4=createSegmentIdResolver(_0x157dae[_0x206a34(0x180)],_0x388ac0),_0x2d7a35=await resolveRuleSegmentIds(_0x4b9d1f[_0x206a34(0x19b)],_0x3d94b4);let _0x33d69d;return _0x4d317c?(await _0x4398a1[_0x206a34(0x192)][_0x206a34(0xe9)](_0x195980['parentId'],_0x4d317c['id'],{'description':_0x4b9d1f[_0x206a34(0x1bd)]||_0x206a34(0x132)+_0x388ac0,'rule':_0x26006a(_0x2d7a35),'countPopulation':!![]}),_0x33d69d=_0x4d317c['id'],saveSegmentToPushRecovery(_0xc35544[_0x206a34(0x1a6)],_0xc35544[_0x206a34(0x14f)][_0x206a34(0x1b8)],_0x388ac0,{'segmentId':_0x33d69d,'uniqueServerName':_0xe85876,'createdAt':new Date()[_0x206a34(0xfd)]()})):_0x33d69d=await createOrRecoverEmbeddedSegment(_0x4398a1,_0xc35544,{'localName':_0x388ac0,'uniqueSegmentName':_0xe85876,'description':_0x4b9d1f[_0x206a34(0x1bd)]||_0x206a34(0x132)+_0x388ac0,'journeyId':_0x390d27,'resolvedRule':_0x2d7a35,'parentId':_0x195980[_0x206a34(0xf5)],'folderId':_0x195980[_0x206a34(0x16a)]||''},_0x26006a),_0x157dae[_0x206a34(0x180)][_0x206a34(0x145)](_0x388ac0,_0x33d69d),_0x36b426['set'](_0x388ac0,_0x33d69d),_0x33d69d;})());_0xbc9801[_0x5a0611(0x145)](_0x388ac0,_0xd2d038);try{return await _0xd2d038;}finally{_0xbc9801[_0x5a0611(0xf7)](_0x388ac0);}},'resolveActivationId':async _0x2e3d98=>{const _0x3a4cdd=_0x7caa69,_0x376c85=_0x325528[_0x3a4cdd(0x12f)](_0x2e3d98);if(_0x376c85)return _0x376c85;if(_0xc35544['existingJourney']){await _0x2fe011();const _0x184f64=_0x325528['get'](_0x2e3d98);if(_0x184f64)return _0x184f64;}throw new SDKError(ErrorCode['NOT_FOUND'],_0x3a4cdd(0x197)+_0x2e3d98+_0x3a4cdd(0x125)+_0xc35544[_0x3a4cdd(0x14f)][_0x3a4cdd(0x1b8)]+_0x3a4cdd(0xe0)+_0x3a4cdd(0xe8));},'resolveEmbeddedActivationId':async(_0x59189b,_0x112580)=>{const _0x40f024=_0x7caa69,_0x23318c=_0x325528[_0x40f024(0x12f)](_0x59189b);if(_0x23318c)return _0x23318c;if(_0xc35544[_0x40f024(0xd8)])return _0x179408['set'](_0x59189b,_0x112580),createPendingActivationId(_0x59189b);if(_0xc35544[_0x40f024(0x150)]){await _0x2fe011();const _0x172c73=_0x325528['get'](_0x112580[_0x40f024(0x1b8)]);if(_0x172c73)return _0x325528['set'](_0x59189b,_0x172c73),_0x172c73;const _0x43c173=activationSignature(_0x112580),_0x22c757=_0x3275ea?.[_0x40f024(0x12f)](_0x43c173);if(_0x22c757)return _0x325528[_0x40f024(0x145)](_0x59189b,_0x22c757),_0x22c757;const _0x1d4a49=await _0x5672eb(_0x112580,_0x157dae[_0x40f024(0x13d)]),_0x11621f={..._0x1d4a49,..._0x112580['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x112580[_0x40f024(0x1a4)]}},_0x50f003=await _0x4398a1[_0x40f024(0x15d)][_0x40f024(0x196)](_0xc35544[_0x40f024(0x150)]['id'],_0x11621f);return _0x325528['set'](_0x59189b,_0x50f003['id']),_0x50f003['id'];}throw new SDKError(ErrorCode[_0x40f024(0xf1)],_0x40f024(0xe7));},'resolveJourneyId':async _0x5e16b9=>{const _0x10e5ff=_0x7caa69;try{return await _0x4398a1[_0x10e5ff(0x15d)][_0x10e5ff(0x1b5)](_0x195980['parentId'],_0x5e16b9);}catch(_0x356228){throw new SDKError(ErrorCode[_0x10e5ff(0x130)],_0x10e5ff(0x1a7)+_0x5e16b9+_0x10e5ff(0xff)+_0xc35544[_0x10e5ff(0x14f)][_0x10e5ff(0x1b8)]+'\x27)',_0x356228);}},'resolveStageId':async(_0x4b417a,_0x5be60c)=>{const _0x5dba8e=_0x7caa69,_0x241806=await _0x4398a1['journey']['getJourney'](_0x4b417a),_0x1e5ed=_0x241806[_0x5dba8e(0x16e)][_0x5dba8e(0xce)][_0x5dba8e(0x19e)](_0x542ba4=>_0x542ba4[_0x5dba8e(0x1b8)][_0x5dba8e(0xca)]()===_0x5be60c['toLowerCase']());if(!_0x1e5ed?.['id'])throw new SDKError(ErrorCode[_0x5dba8e(0x130)],'Stage\x20\x27'+_0x5be60c+_0x5dba8e(0x1ab)+(_0x241806[_0x5dba8e(0x16e)][_0x5dba8e(0x133)]||_0x241806['attributes']['name'])+'\x27');return _0x1e5ed['id'];}},_0x4cc7d4=await _0x1115ed(_0xc35544[_0x7caa69(0x14f)],_0x195980[_0x7caa69(0xf5)],_0x2624b0),_0x4f332f=_0x195980[_0x7caa69(0x166)]||_0x195980[_0x7caa69(0x16a)];_0x4f332f&&(_0x4cc7d4['relationships']={'parentFolder':{'data':{'id':_0x4f332f,'type':_0x7caa69(0x164)}}});if(_0xc35544[_0x7caa69(0xd8)]){if(_0x57cc24['size']>0x0||_0x179408[_0x7caa69(0x170)]>0x0)return await executeThreeStepJourneyCreate(_0x4398a1,_0xc35544,_0x4cc7d4,{'pendingEmbeddedSegments':_0x57cc24,'pendingEmbeddedActivations':_0x179408,'embeddedSegmentNameToId':_0x36b426,'journeyActivationNameToId':_0x325528},{..._0x195980,'effectiveFolderId':_0x4f332f},_0x157dae,_0x13b059,_0x57b5ba);else{ensureJourneyDefaults(_0x4cc7d4[_0x7caa69(0x16e)]);const _0x42f956=await _0x4398a1['journey']['create'](_0x4cc7d4);return deletePushRecovery(_0xc35544[_0x7caa69(0x1a6)]),{'action':_0x7caa69(0x1a0),'journeyId':_0x42f956['id'],'embeddedSegmentNameToId':_0x36b426};}}else{if(_0xc35544[_0x7caa69(0x10f)]&&_0xc35544[_0x7caa69(0x150)]){_0x4cc7d4['id']=_0xc35544[_0x7caa69(0x150)]['id'];const _0x41a804=_0x4cc7d4[_0x7caa69(0x16e)];_0xc35544[_0x7caa69(0x150)]['attributes']?.['journeyBundleName']&&(_0x41a804[_0x7caa69(0x133)]=_0xc35544['existingJourney']['attributes'][_0x7caa69(0x133)]);const _0x5807d7=_0xc35544[_0x7caa69(0x150)][_0x7caa69(0x16e)]?.['journeyStages'];return _0x5807d7&&_0x4cc7d4[_0x7caa69(0x16e)]['journeyStages']&&injectExistingStageIds(_0x4cc7d4[_0x7caa69(0x16e)][_0x7caa69(0xce)],_0x5807d7),ensureJourneyDefaults(_0x41a804),await _0x4398a1[_0x7caa69(0x15d)][_0x7caa69(0x176)](_0xc35544[_0x7caa69(0x150)]['id'],_0x4cc7d4),deletePushRecovery(_0xc35544['absolutePath']),{'action':_0x7caa69(0x14c),'journeyId':_0xc35544[_0x7caa69(0x150)]['id'],'embeddedSegmentNameToId':_0x36b426};}}return deletePushRecovery(_0xc35544[_0x7caa69(0x1a6)]),{'action':_0x7caa69(0x137),'journeyId':_0xc35544[_0x7caa69(0x150)]?.['id'],'embeddedSegmentNameToId':_0x36b426};}function findSegmentCriteriaLocation(_0x3c41f0,_0xe74268){const _0x2ce5ce=a152_0x451377,_0x1ff4d1=_0x3c41f0['stages']||_0x3c41f0['journeys']?.[0x0]?.[_0x2ce5ce(0xcd)]||[];let _0x356be9=_0x2ce5ce(0x163),_0x317532=_0xe74268;const _0x16617f=_0x3c41f0[_0x2ce5ce(0x113)]||_0x3c41f0[_0x2ce5ce(0x17f)]?.[0x0]?.[_0x2ce5ce(0x113)];if(_0x16617f?.['segment']===_0xe74268)return{'stageName':_0x2ce5ce(0x113),'criteriaName':_0x16617f[_0x2ce5ce(0x1b8)]||_0xe74268};_0x3b78c5:for(const _0x4a551d of _0x1ff4d1){if(_0x4a551d[_0x2ce5ce(0x100)]?.['segment']===_0xe74268){_0x356be9=_0x4a551d[_0x2ce5ce(0x1b8)],_0x317532=_0x4a551d[_0x2ce5ce(0x100)]['name']||_0xe74268;break;}if(_0x4a551d[_0x2ce5ce(0x199)])for(const _0x49a0b8 of _0x4a551d[_0x2ce5ce(0x199)]){if(_0x49a0b8[_0x2ce5ce(0x135)]===_0x2ce5ce(0xeb)&&_0x49a0b8['with']?.[_0x2ce5ce(0x151)])for(const _0x3cbb5d of _0x49a0b8['with'][_0x2ce5ce(0x151)]){if(_0x3cbb5d['segment']===_0xe74268){_0x356be9=_0x4a551d[_0x2ce5ce(0x1b8)],_0x317532=_0x3cbb5d[_0x2ce5ce(0x1b8)]||_0xe74268;break _0x3b78c5;}}}}return{'stageName':_0x356be9,'criteriaName':_0x317532};}async function executeThreeStepJourneyCreate(_0x395aae,_0x35742b,_0x5eeabb,_0x500e02,_0x2c3231,_0x56293d,_0x361533,_0x145cc9){const _0x5ea9cb=a152_0x451377,{activationDefToCreateRequest:_0x97e0d3,yamlRuleToApi:_0xd0ae64}=_0x145cc9,{pendingEmbeddedSegments:_0xf9d08c,pendingEmbeddedActivations:_0x50bc42,embeddedSegmentNameToId:_0x416117}=_0x500e02,_0x4d9a36=JSON[_0x5ea9cb(0x18f)](JSON[_0x5ea9cb(0x147)](_0x5eeabb));ensureJourneyDefaults(_0x4d9a36[_0x5ea9cb(0x16e)]),stripPendingIds(_0x4d9a36);const _0x40db70=await _0x395aae[_0x5ea9cb(0x15d)]['create'](_0x4d9a36),_0x201419=_0x40db70['id'],_0x5636e6=new Map();for(const _0x44fe47 of _0x40db70[_0x5ea9cb(0x16e)]['journeyStages']){_0x5636e6[_0x5ea9cb(0x145)](_0x44fe47[_0x5ea9cb(0x1b8)][_0x5ea9cb(0xca)](),_0x44fe47['id']);}recoverSegmentIdsFromPushRecovery(_0x35742b,_0x416117,_0x56293d[_0x5ea9cb(0x180)]);for(const [_0xa770b9,{definition:_0x358084}]of _0xf9d08c){if(_0x416117['has'](_0xa770b9)){_0x361533['onProgress']?.({'type':'embedded_segment_created','journeyName':_0x35742b[_0x5ea9cb(0x14f)][_0x5ea9cb(0x1b8)],'segmentName':_0xa770b9});continue;}const _0x3610ca=generateDeterministicJourneySegmentName(_0x35742b[_0x5ea9cb(0x14f)]['name'],_0xa770b9);_0x361533[_0x5ea9cb(0x16d)]?.({'type':_0x5ea9cb(0xed),'journeyName':_0x35742b[_0x5ea9cb(0x14f)][_0x5ea9cb(0x1b8)],'segmentName':_0xa770b9});const _0x353306=createSegmentIdResolver(_0x56293d['segmentNameToId'],_0xa770b9),_0x3c543b=await resolveRuleSegmentIds(_0x358084[_0x5ea9cb(0x19b)],_0x353306),_0x92bbf1=await createOrRecoverEmbeddedSegment(_0x395aae,_0x35742b,{'localName':_0xa770b9,'uniqueSegmentName':_0x3610ca,'description':_0x358084[_0x5ea9cb(0x1bd)]||_0x5ea9cb(0x132)+_0xa770b9,'journeyId':_0x201419,'resolvedRule':_0x3c543b,'parentId':_0x2c3231[_0x5ea9cb(0xf5)],'folderId':_0x2c3231[_0x5ea9cb(0x10c)]||''},_0xd0ae64);_0x416117['set'](_0xa770b9,_0x92bbf1),_0x56293d[_0x5ea9cb(0x180)][_0x5ea9cb(0x145)](_0xa770b9,_0x92bbf1),_0x361533[_0x5ea9cb(0x16d)]?.({'type':'embedded_segment_created','journeyName':_0x35742b['yamlConfig'][_0x5ea9cb(0x1b8)],'segmentName':_0xa770b9});}const _0x32b218=new Map();for(const [_0x42d697,_0x4b11a1]of _0x50bc42){_0x361533[_0x5ea9cb(0x16d)]?.({'type':'embedded_activation_creating','journeyName':_0x35742b[_0x5ea9cb(0x14f)][_0x5ea9cb(0x1b8)],'activationName':_0x42d697});const _0x35f9b7=await _0x97e0d3(_0x4b11a1,_0x56293d[_0x5ea9cb(0x13d)]),_0x2da7c4={..._0x35f9b7,..._0x4b11a1['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x4b11a1[_0x5ea9cb(0x1a4)]}},_0x2828e8=await _0x395aae[_0x5ea9cb(0x15d)][_0x5ea9cb(0x196)](_0x201419,_0x2da7c4);_0x32b218['set'](_0x42d697,_0x2828e8['id']),_0x500e02[_0x5ea9cb(0xec)][_0x5ea9cb(0x145)](_0x42d697,_0x2828e8['id']),_0x361533['onProgress']?.({'type':_0x5ea9cb(0x182),'journeyName':_0x35742b[_0x5ea9cb(0x14f)][_0x5ea9cb(0x1b8)],'activationName':_0x42d697});}const _0x19ae81=JSON[_0x5ea9cb(0x18f)](JSON[_0x5ea9cb(0x147)](_0x5eeabb));return _0x19ae81['id']=_0x201419,ensureJourneyDefaults(_0x19ae81[_0x5ea9cb(0x16e)]),resolvePendingIdsInRequest(_0x19ae81,_0x5eeabb,_0x5636e6,_0x416117,_0x32b218,_0x361533),await _0x395aae['journey'][_0x5ea9cb(0x176)](_0x201419,_0x19ae81),deletePushRecovery(_0x35742b[_0x5ea9cb(0x1a6)]),{'action':'created','journeyId':_0x201419,'embeddedSegmentNameToId':_0x416117};}export function stripWaitStepPendingIds(_0xcc8418){const _0x516a13=a152_0x451377,_0x3ffabf=_0xcc8418[_0x516a13(0x149)]&&isPendingSegmentId(_0xcc8418['conditionSegmentId']),_0x65916a=_0xcc8418[_0x516a13(0x195)]?.[_0x516a13(0x14b)](_0x19f1d2=>_0x19f1d2[_0x516a13(0x19a)]&&isPendingSegmentId(_0x19f1d2['segmentId']));(_0x3ffabf||_0x65916a)&&(_0xcc8418[_0x516a13(0xb8)]=_0x516a13(0xef),_0xcc8418[_0x516a13(0x15c)]=0x1,_0xcc8418['waitStepUnit']='day',delete _0xcc8418['conditionSegmentId'],delete _0xcc8418[_0x516a13(0x12a)],delete _0xcc8418[_0x516a13(0x194)],delete _0xcc8418[_0x516a13(0x195)]);}export function resolveWaitStepPendingIds(_0x4ff3f4,_0x59bea1,_0x29ed99,_0x3fa1d2){const _0x2ceed1=a152_0x451377;if(_0x59bea1[_0x2ceed1(0x149)]&&isPendingSegmentId(_0x59bea1[_0x2ceed1(0x149)])){const _0x39ad53=_0x29ed99(_0x59bea1[_0x2ceed1(0x149)],_0x2ceed1(0x1b9)+_0x3fa1d2+_0x2ceed1(0x165));_0x39ad53&&(_0x4ff3f4[_0x2ceed1(0xb8)]=_0x2ceed1(0xe2),_0x4ff3f4[_0x2ceed1(0x149)]=_0x39ad53,delete _0x4ff3f4['waitStep'],delete _0x4ff3f4['waitStepUnit'],_0x59bea1['conditionTimeoutDuration']!==undefined&&(_0x4ff3f4[_0x2ceed1(0x12a)]=_0x59bea1[_0x2ceed1(0x12a)]),_0x59bea1['conditionTimeoutUnit']&&(_0x4ff3f4[_0x2ceed1(0x194)]=_0x59bea1[_0x2ceed1(0x194)]));}if(_0x59bea1[_0x2ceed1(0x195)]){const _0xa4f67b=_0x59bea1['conditions'][_0x2ceed1(0x14b)](_0x4be41d=>_0x4be41d[_0x2ceed1(0x19a)]&&isPendingSegmentId(_0x4be41d[_0x2ceed1(0x19a)]));if(_0xa4f67b){const _0x2c6fd6=_0x59bea1[_0x2ceed1(0x195)][_0x2ceed1(0x1b1)](_0x27c1a3=>{const _0x169a4a=_0x2ceed1;if(_0x27c1a3[_0x169a4a(0x19a)]&&isPendingSegmentId(_0x27c1a3[_0x169a4a(0x19a)])){const _0x52b211=_0x29ed99(_0x27c1a3[_0x169a4a(0x19a)],_0x169a4a(0x1b9)+_0x3fa1d2+'\x27\x20wait\x20condition');return{..._0x27c1a3,'segmentId':_0x52b211||_0x27c1a3[_0x169a4a(0x19a)]};}return{..._0x27c1a3};});_0x4ff3f4[_0x2ceed1(0xb8)]=_0x2ceed1(0xe2),_0x4ff3f4['conditions']=_0x2c6fd6,delete _0x4ff3f4[_0x2ceed1(0x15c)],delete _0x4ff3f4['waitStepUnit'],delete _0x4ff3f4['conditionSegmentId'],delete _0x4ff3f4[_0x2ceed1(0x12a)],delete _0x4ff3f4[_0x2ceed1(0x194)];}}}function stripPendingIds(_0x5a523d){const _0x41cb24=a152_0x451377;_0x5a523d[_0x41cb24(0x16e)][_0x41cb24(0x113)]?.[_0x41cb24(0x19a)]&&isPendingSegmentId(_0x5a523d['attributes']['goal'][_0x41cb24(0x19a)])&&delete _0x5a523d[_0x41cb24(0x16e)][_0x41cb24(0x113)];for(const _0x2d632c of _0x5a523d[_0x41cb24(0x16e)][_0x41cb24(0xce)]||[]){_0x2d632c[_0x41cb24(0xfe)]?.[_0x41cb24(0x19a)]&&isPendingSegmentId(_0x2d632c[_0x41cb24(0xfe)][_0x41cb24(0x19a)])&&delete _0x2d632c[_0x41cb24(0xfe)];_0x2d632c[_0x41cb24(0xc5)]?.[_0x41cb24(0x19a)]&&isPendingSegmentId(_0x2d632c[_0x41cb24(0xc5)][_0x41cb24(0x19a)])&&delete _0x2d632c[_0x41cb24(0xc5)];_0x2d632c['exitCriterias']&&(_0x2d632c[_0x41cb24(0x14e)]=_0x2d632c['exitCriterias'][_0x41cb24(0x198)](_0x5b6b43=>!_0x5b6b43[_0x41cb24(0x19a)]||!isPendingSegmentId(_0x5b6b43[_0x41cb24(0x19a)])));if(_0x2d632c[_0x41cb24(0x199)])for(const _0x5ad6b0 of Object['keys'](_0x2d632c['steps'])){const _0x123b37=_0x2d632c['steps'][_0x5ad6b0];_0x123b37['type']==='Activation'&&_0x123b37[_0x41cb24(0x154)]&&isPendingActivationId(_0x123b37['journeyActivationStepId'])&&(_0x123b37[_0x41cb24(0x154)]='');if(_0x123b37[_0x41cb24(0x135)]===_0x41cb24(0xd4)&&_0x123b37[_0x41cb24(0x151)])for(const _0x27d210 of _0x123b37[_0x41cb24(0x151)]){_0x27d210[_0x41cb24(0x19a)]&&isPendingSegmentId(_0x27d210[_0x41cb24(0x19a)])&&(_0x27d210[_0x41cb24(0x19a)]='');}_0x123b37[_0x41cb24(0x135)]===_0x41cb24(0x123)&&stripWaitStepPendingIds(_0x123b37);}}}function resolvePendingIdsInRequest(_0x50394a,_0x34e332,_0x4d0293,_0x47af2a,_0x9947b3,_0x25bd32){const _0x2687af=a152_0x451377,_0x4ee162=(_0x17c3e2,_0x5a9e0a)=>{const _0x2c27ac=a152_0x18a7;if(!isPendingSegmentId(_0x17c3e2))return _0x17c3e2;const _0x1d2d46=extractPendingSegmentName(_0x17c3e2),_0x4dc30a=_0x47af2a['get'](_0x1d2d46);return!_0x4dc30a&&_0x25bd32[_0x2c27ac(0xd1)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x1d2d46+'\x27\x20for\x20'+_0x5a9e0a),_0x4dc30a;};if(_0x50394a[_0x2687af(0x16e)][_0x2687af(0x113)]?.['segmentId']&&isPendingSegmentId(_0x50394a[_0x2687af(0x16e)][_0x2687af(0x113)][_0x2687af(0x19a)])){const _0x2d9d6f=_0x4ee162(_0x50394a[_0x2687af(0x16e)]['goal'][_0x2687af(0x19a)],_0x2687af(0x1af));_0x2d9d6f&&(_0x50394a[_0x2687af(0x16e)][_0x2687af(0x113)][_0x2687af(0x19a)]=_0x2d9d6f);}for(const _0x2438e0 of _0x50394a[_0x2687af(0x16e)][_0x2687af(0xce)]||[]){const _0x34e2e4=_0x4d0293[_0x2687af(0x12f)](_0x2438e0['name'][_0x2687af(0xca)]());_0x34e2e4&&(_0x2438e0['id']=_0x34e2e4);if(_0x2438e0[_0x2687af(0xfe)]?.[_0x2687af(0x19a)]&&isPendingSegmentId(_0x2438e0[_0x2687af(0xfe)]['segmentId'])){const _0x51216a=_0x4ee162(_0x2438e0['entryCriteria'][_0x2687af(0x19a)],_0x2687af(0x1b9)+_0x2438e0[_0x2687af(0x1b8)]+_0x2687af(0x13a));_0x51216a&&(_0x2438e0[_0x2687af(0xfe)]['segmentId']=_0x51216a);}if(_0x2438e0['exitCriterias'])for(const _0x4b5d41 of _0x2438e0[_0x2687af(0x14e)]){if(_0x4b5d41[_0x2687af(0x19a)]&&isPendingSegmentId(_0x4b5d41[_0x2687af(0x19a)])){const _0x45af52=_0x4ee162(_0x4b5d41[_0x2687af(0x19a)],_0x2687af(0x1b9)+_0x2438e0[_0x2687af(0x1b8)]+_0x2687af(0x102));_0x45af52&&(_0x4b5d41['segmentId']=_0x45af52);}}if(_0x2438e0[_0x2687af(0xc5)]?.[_0x2687af(0x19a)]&&isPendingSegmentId(_0x2438e0[_0x2687af(0xc5)][_0x2687af(0x19a)])){const _0x16fef9=_0x4ee162(_0x2438e0[_0x2687af(0xc5)][_0x2687af(0x19a)],_0x2687af(0x1b9)+_0x2438e0[_0x2687af(0x1b8)]+_0x2687af(0x13b));_0x16fef9&&(_0x2438e0[_0x2687af(0xc5)][_0x2687af(0x19a)]=_0x16fef9);}if(_0x2438e0['steps']){const _0x41f2cb=_0xf330c=>_0x34e332[_0x2687af(0x16e)][_0x2687af(0xce)]?.[_0x2687af(0x19e)](_0x5d975b=>_0x5d975b['name']['toLowerCase']()===_0x2438e0[_0x2687af(0x1b8)][_0x2687af(0xca)]())?.[_0x2687af(0x199)]?.[_0xf330c];for(const _0x1f2eeb of Object[_0x2687af(0xd5)](_0x2438e0[_0x2687af(0x199)])){const _0x4ab7e1=_0x2438e0['steps'][_0x1f2eeb],_0x17eabf=_0x41f2cb(_0x1f2eeb);if(_0x4ab7e1[_0x2687af(0x135)]===_0x2687af(0xfb)&&_0x4ab7e1['journeyActivationStepId']&&(isPendingActivationId(_0x4ab7e1['journeyActivationStepId'])||_0x4ab7e1[_0x2687af(0x154)]==='')){if(_0x17eabf?.['journeyActivationStepId']&&isPendingActivationId(_0x17eabf['journeyActivationStepId'])){const _0xce9893=extractPendingActivationName(_0x17eabf['journeyActivationStepId']),_0x50aa6b=_0x9947b3[_0x2687af(0x12f)](_0xce9893);_0x50aa6b&&(_0x4ab7e1[_0x2687af(0x154)]=_0x50aa6b);}}if(_0x4ab7e1[_0x2687af(0x135)]===_0x2687af(0xd4)&&_0x4ab7e1[_0x2687af(0x151)]&&_0x17eabf?.[_0x2687af(0x151)])for(let _0x286d5f=0x0;_0x286d5f<_0x4ab7e1[_0x2687af(0x151)][_0x2687af(0x16c)];_0x286d5f++){const _0x36f33c=_0x4ab7e1[_0x2687af(0x151)][_0x286d5f],_0x139248=_0x17eabf['branches'][_0x286d5f];if(_0x139248?.[_0x2687af(0x19a)]&&isPendingSegmentId(_0x139248[_0x2687af(0x19a)])){const _0xc67c8e=_0x4ee162(_0x139248[_0x2687af(0x19a)],_0x2687af(0x1b9)+_0x2438e0[_0x2687af(0x1b8)]+_0x2687af(0x1b0)+(_0x36f33c[_0x2687af(0x1b8)]||_0x286d5f)+'\x27');_0xc67c8e&&(_0x36f33c[_0x2687af(0x19a)]=_0xc67c8e);}}_0x4ab7e1[_0x2687af(0x135)]===_0x2687af(0x123)&&_0x17eabf?.[_0x2687af(0x135)]===_0x2687af(0x123)&&resolveWaitStepPendingIds(_0x4ab7e1,_0x17eabf,_0x4ee162,_0x2438e0[_0x2687af(0x1b8)]);}}}}
|
|
1
|
+
const a152_0x18f4ba=a152_0x3e6f;(function(_0x5cff17,_0x2bf05a){const _0x218dfd=a152_0x3e6f,_0x4b7240=_0x5cff17();while(!![]){try{const _0x530de1=parseInt(_0x218dfd(0xdd))/0x1*(-parseInt(_0x218dfd(0x156))/0x2)+parseInt(_0x218dfd(0x175))/0x3*(-parseInt(_0x218dfd(0x162))/0x4)+-parseInt(_0x218dfd(0x108))/0x5*(-parseInt(_0x218dfd(0xf9))/0x6)+parseInt(_0x218dfd(0x161))/0x7+parseInt(_0x218dfd(0x14c))/0x8+parseInt(_0x218dfd(0x17f))/0x9*(parseInt(_0x218dfd(0xf8))/0xa)+parseInt(_0x218dfd(0x165))/0xb*(-parseInt(_0x218dfd(0x116))/0xc);if(_0x530de1===_0x2bf05a)break;else _0x4b7240['push'](_0x4b7240['shift']());}catch(_0x3e5eae){_0x4b7240['push'](_0x4b7240['shift']());}}}(a152_0x43f1,0xcf7be));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x18f4ba(0xa4));export const PENDING_SEGMENT_PREFIX=a152_0x18f4ba(0x112);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x1f8175){return''+PENDING_SEGMENT_PREFIX+_0x1f8175+'__';}export function isPendingSegmentId(_0x20edb4){const _0x312ed4=a152_0x18f4ba;return _0x20edb4[_0x312ed4(0xe4)](PENDING_SEGMENT_PREFIX)&&!_0x20edb4[_0x312ed4(0xe4)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x2f1ebe){return _0x2f1ebe['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0xb16872){return''+PENDING_ACTIVATION_PREFIX+_0xb16872+'__';}export function isPendingActivationId(_0x29923e){return _0x29923e['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x19ce92){const _0x2e0d0b=a152_0x18f4ba;return _0x19ce92[_0x2e0d0b(0x17d)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0xbc6c9a,_0x2ba0ef){const _0x3a7140=a152_0x18f4ba,_0x10c76d=_0xbc6c9a+'::'+(_0x2ba0ef[_0x3a7140(0x138)]()||_0x3a7140(0x184)),_0x5e5c70=createHash(_0x3a7140(0xcb))['update'](_0x10c76d)[_0x3a7140(0x105)](_0x3a7140(0xfb))[_0x3a7140(0x120)](0x0,0xc);return'journey_entry_criteria_'+_0x5e5c70;}export function ensureJourneyDefaults(_0x26c91e){const _0x257b27=a152_0x18f4ba;!_0x26c91e[_0x257b27(0x129)]&&(_0x26c91e[_0x257b27(0x129)]=''),!_0x26c91e[_0x257b27(0xee)]&&(_0x26c91e[_0x257b27(0xee)]=_0x257b27(0x186));}export function injectExistingStageIds(_0xa1024a,_0x5f0c73){const _0x2a598a=a152_0x18f4ba,_0x236887=new Map(_0x5f0c73[_0x2a598a(0x19f)](_0x481948=>[_0x481948[_0x2a598a(0x166)],_0x481948['id']]));for(const _0x291c94 of _0xa1024a){if(!_0x291c94['id']){const _0x453722=_0x236887[_0x2a598a(0x19d)](_0x291c94[_0x2a598a(0x166)]);_0x453722&&(_0x291c94['id']=_0x453722);}}}export function resolveTDFolderPath(_0x279dff,_0x1e5016,_0x47a0dc){const _0x8098b9=a152_0x18f4ba;if(!_0x1e5016)return _0x279dff;if(_0x279dff===_0x47a0dc||_0x279dff[_0x8098b9(0xe4)](_0x47a0dc+'/'))return _0x279dff;return _0x279dff?_0x47a0dc+'/'+_0x279dff:_0x47a0dc;}export function addFoldersToCreate(_0x20ee70,_0x55d8a5,_0x596d38){const _0xff38af=a152_0x18f4ba;if(!_0x20ee70)return;if(_0x55d8a5['has'](_0x20ee70))return;const _0x2531ab=_0x20ee70[_0xff38af(0x141)]('/');let _0x285dcf='';for(const _0x47f115 of _0x2531ab){_0x285dcf=_0x285dcf?_0x285dcf+'/'+_0x47f115:_0x47f115,!_0x55d8a5[_0xff38af(0x1a4)](_0x285dcf)&&_0x596d38[_0xff38af(0x106)](_0x285dcf);}}export function sortFoldersByDepth(_0x55264d){const _0x122226=a152_0x18f4ba;return[..._0x55264d][_0x122226(0x137)]((_0x14eb3a,_0x3019ff)=>{const _0x36e300=_0x122226,_0x5762f2=(_0x14eb3a[_0x36e300(0xb2)](/\//g)||[])[_0x36e300(0x17e)],_0x45d073=(_0x3019ff[_0x36e300(0xb2)](/\//g)||[])['length'];return _0x5762f2-_0x45d073;});}import*as a152_0x3adb27 from'yaml';import{readFileSync}from'fs';import a152_0x19fc04 from'path';import{isJourneyDef,parseYamlString as a152_0x45d0de,toYamlString as a152_0xe132d5,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(_0x133066){const _0x616d71=a152_0x18f4ba;if(Array[_0x616d71(0x100)](_0x133066))return'['+_0x133066['map'](_0x2e7e5e=>stableStringify(_0x2e7e5e))[_0x616d71(0x19e)](',')+']';if(_0x133066&&typeof _0x133066===_0x616d71(0xd0)){const _0x3f7900=_0x133066,_0x2a2dd8=Object[_0x616d71(0x10e)](_0x3f7900)[_0x616d71(0x137)](),_0xc7fe8=_0x2a2dd8[_0x616d71(0x19f)](_0x152505=>'\x22'+_0x152505+'\x22:'+stableStringify(_0x3f7900[_0x152505]));return'{'+_0xc7fe8[_0x616d71(0x19e)](',')+'}';}const _0x4e8974=JSON[_0x616d71(0x11d)](_0x133066);return _0x4e8974===undefined?'null':_0x4e8974;}function activationSignature(_0x459506){const _0x2b5bc0=a152_0x18f4ba,_0x2a847a={'connection':_0x459506[_0x2b5bc0(0x164)],..._0x459506[_0x2b5bc0(0x143)]!==undefined&&{'all_columns':_0x459506[_0x2b5bc0(0x143)]},..._0x459506[_0x2b5bc0(0x169)]!==undefined&&{'columns':_0x459506[_0x2b5bc0(0x169)]},..._0x459506[_0x2b5bc0(0x144)]!==undefined&&{'behavior':_0x459506[_0x2b5bc0(0x144)]},..._0x459506['schedule']!==undefined&&{'schedule':_0x459506['schedule']},..._0x459506['notification']!==undefined&&{'notification':_0x459506[_0x2b5bc0(0x1a0)]},..._0x459506[_0x2b5bc0(0x191)]!==undefined&&{'connector_config':_0x459506[_0x2b5bc0(0x191)]},..._0x459506[_0x2b5bc0(0xbc)]!==undefined&&{'activation_template_id':_0x459506[_0x2b5bc0(0xbc)]}};return stableStringify(_0x2a847a);}async function fetchSegment(_0x2deccf,_0x52bce0,_0x1c89f1,_0x21e519){const _0x12ebbe=a152_0x18f4ba,_0x3e59f0=_0x21e519?.['find'](_0x3db5c8=>_0x3db5c8['id']===_0x1c89f1);if(_0x3e59f0)return _0x3e59f0;try{return await _0x2deccf[_0x12ebbe(0x184)][_0x12ebbe(0x148)](_0x52bce0,_0x1c89f1);}catch(_0x59865c){logger[_0x12ebbe(0xed)](_0x12ebbe(0xa8)+_0x1c89f1+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x59865c);try{return await _0x2deccf[_0x12ebbe(0x184)]['getSegmentEntity'](_0x1c89f1);}catch(_0xe0f781){return logger[_0x12ebbe(0xed)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x1c89f1+':\x20'+_0xe0f781),null;}}}function recoverSegmentIdsFromPushRecovery(_0x196bc5,_0x277cd2,_0x53c7ee){const _0x20ccf8=a152_0x18f4ba,_0x17a94c=readPushRecovery(_0x196bc5[_0x20ccf8(0x111)]);if(_0x17a94c?.[_0x20ccf8(0x170)]===_0x196bc5[_0x20ccf8(0xf1)][_0x20ccf8(0x166)])for(const [_0x302991,_0x37aec8]of Object['entries'](_0x17a94c[_0x20ccf8(0x19a)])){const _0x508880=generateDeterministicJourneySegmentName(_0x196bc5['yamlConfig']['name'],_0x302991);_0x37aec8[_0x20ccf8(0x149)]===_0x508880&&(_0x277cd2[_0x20ccf8(0x174)](_0x302991,_0x37aec8[_0x20ccf8(0xef)]),_0x53c7ee[_0x20ccf8(0x174)](_0x302991,_0x37aec8[_0x20ccf8(0xef)]));}}async function createOrRecoverEmbeddedSegment(_0x552802,_0x52948c,_0x4c9803,_0x1f204b){const _0x2135c3=a152_0x18f4ba;let _0xff040d;try{_0xff040d=await _0x552802['segment'][_0x2135c3(0xf6)]({'name':_0x4c9803[_0x2135c3(0x128)],'description':_0x4c9803[_0x2135c3(0x129)],'journeyId':_0x4c9803[_0x2135c3(0x15b)],'rule':_0x1f204b(_0x4c9803[_0x2135c3(0x1b6)],!![]),'countPopulation':!![],'parentFolderId':_0x4c9803[_0x2135c3(0x10c)],'audienceId':_0x4c9803[_0x2135c3(0x19c)]});}catch(_0x4bf207){const _0x366ac3=_0x4bf207 instanceof Error&&_0x4bf207[_0x2135c3(0xe3)][_0x2135c3(0x180)](_0x2135c3(0x19b));if(_0x366ac3){const _0x4a8fdd=readPushRecovery(_0x52948c[_0x2135c3(0x111)]),_0x3aad4f=_0x4a8fdd?.[_0x2135c3(0x170)]===_0x52948c[_0x2135c3(0xf1)][_0x2135c3(0x166)]?_0x4a8fdd[_0x2135c3(0x19a)][_0x4c9803[_0x2135c3(0x157)]]:undefined;if(_0x3aad4f?.[_0x2135c3(0x149)]===_0x4c9803['uniqueSegmentName'])await _0x552802[_0x2135c3(0x184)][_0x2135c3(0xcf)](_0x4c9803[_0x2135c3(0x19c)],_0x3aad4f[_0x2135c3(0xef)],{'description':_0x4c9803[_0x2135c3(0x129)],'rule':_0x1f204b(_0x4c9803[_0x2135c3(0x1b6)],!![]),'countPopulation':!![]}),_0xff040d=_0x3aad4f[_0x2135c3(0xef)];else throw new SDKError(ErrorCode[_0x2135c3(0x1b1)],_0x2135c3(0x173)+_0x4c9803[_0x2135c3(0x157)]+_0x2135c3(0x11c)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x52948c[_0x2135c3(0x111)][_0x2135c3(0x17d)](/([^/]+)$/,_0x2135c3(0x1b3))+')\x20')+_0x2135c3(0x145),_0x4bf207);}else throw _0x4bf207;}return saveSegmentToPushRecovery(_0x52948c['absolutePath'],_0x52948c[_0x2135c3(0xf1)][_0x2135c3(0x166)],_0x4c9803[_0x2135c3(0x157)],{'segmentId':_0xff040d,'uniqueServerName':_0x4c9803[_0x2135c3(0x128)],'createdAt':new Date()[_0x2135c3(0x171)]()}),_0xff040d;}function a152_0x3e6f(_0x15d590,_0xc05da){_0x15d590=_0x15d590-0xa4;const _0x43f148=a152_0x43f1();let _0x3e6f1f=_0x43f148[_0x15d590];return _0x3e6f1f;}export async function prepareSegmentFiles(_0x4849bc,_0x1b6375,_0x168ac4,_0x27db9f,_0x414b2f){const _0x32ee6a=a152_0x18f4ba,{activationDefToCreateRequest:_0x4075a3}=await import(_0x32ee6a(0xc3)),_0x4d03bc=[],_0x1c6ec2=new Set();for(const {yamlConfig:_0x4c33de,folderPath:_0x295e5e,sourcePath:_0x2272f2}of _0x4849bc){const _0x50e252=resolveTDFolderPath(_0x295e5e,_0x27db9f,_0x414b2f),_0x31a2f7=_0x50e252+':'+_0x4c33de[_0x32ee6a(0x166)],_0x4a1b62=_0x1b6375[_0x32ee6a(0x172)][_0x32ee6a(0x19d)](_0x31a2f7),_0x1edae9=_0x4a1b62?_0x1b6375[_0x32ee6a(0x12c)][_0x32ee6a(0x19d)](_0x4a1b62['id'])||[]:[];addFoldersToCreate(_0x50e252,_0x1b6375['folderPathToId'],_0x1c6ec2);const _0x2e97b8=calculateActivationActions(_0x4c33de[_0x32ee6a(0x189)]||[],_0x1edae9,_0x1b6375['idToEmailMap'],_0x1b6375[_0x32ee6a(0xdb)]);for(const _0x41dbd1 of _0x2e97b8){(_0x41dbd1['type']===_0x32ee6a(0xe5)||_0x41dbd1['type']===_0x32ee6a(0x12e))&&_0x41dbd1[_0x32ee6a(0x14a)]&&(_0x41dbd1['validatedRequest']=await _0x4075a3(_0x41dbd1[_0x32ee6a(0x14a)],_0x168ac4));}const _0x36111d=calculateSegmentDiff(_0x4c33de,_0x4a1b62,_0x1edae9,_0x1b6375[_0x32ee6a(0x1aa)],_0x1b6375['connectionIdToNameMap']);_0x4d03bc[_0x32ee6a(0xb8)]({'relativePath':_0x4c33de['name'],'absolutePath':_0x2272f2,'yamlConfig':_0x4c33de,'folderPath':_0x50e252,'existingSegment':_0x4a1b62,'existingActivations':_0x1edae9,'isNew':_0x36111d[_0x32ee6a(0x181)],'hasChanges':_0x36111d['hasChanges'],'diff':_0x36111d[_0x32ee6a(0x179)],'activationActions':_0x2e97b8});}return{'segmentFiles':_0x4d03bc,'foldersToCreate':_0x1c6ec2};}export async function prepareJourneyFiles(_0x4df113,_0x48aa6a,_0x5307f3,_0x20a531){const _0x2b8b12=a152_0x18f4ba,_0x148530=[],_0x536101=new Set();for(const {yamlConfig:_0x245f3a,folderPath:_0x1cdcf3,sourcePath:_0x48ae45}of _0x4df113){const _0x42cbbd=resolveTDFolderPath(_0x1cdcf3,_0x5307f3,_0x20a531),_0x553d11=_0x42cbbd+':'+_0x245f3a['name'],_0x4bde91=_0x48aa6a['journeyBundlesByFolderAndName']['get'](_0x553d11);let _0x309c68,_0x169c47;if(_0x4bde91&&_0x4bde91[_0x2b8b12(0x17e)]>0x0){const _0x37616c=buildLocalExpandedRuleMappings(_0x245f3a),{createYamlContext:_0x1a5943,prefetchJourneySegments:_0x408c07}=createPushYamlContextForBundle(_0x48aa6a[_0x2b8b12(0x154)],_0x48aa6a[_0x2b8b12(0x19c)],_0x48aa6a[_0x2b8b12(0xf5)],_0x37616c,_0x48aa6a['idToEmailMap'],_0x48aa6a[_0x2b8b12(0xdb)],_0x48aa6a[_0x2b8b12(0x14e)],_0x48aa6a['journeyById']);await _0x408c07(_0x4bde91[_0x2b8b12(0x19f)](_0xcd0270=>_0xcd0270['id']));const _0x26c026=await _0x48aa6a[_0x2b8b12(0x154)][_0x2b8b12(0x1a2)][_0x2b8b12(0x14b)](_0x4bde91[0x0][_0x2b8b12(0xd7)]),_0xb75997=hasMultipleVersions(_0x245f3a),_0x8b0fb5=async _0x226a9a=>{const _0x50c410=_0x2b8b12,_0x50ac3f=_0x48aa6a[_0x50c410(0xe6)]?.['get'](_0x226a9a);if(_0x50ac3f)return _0x50ac3f;return _0x48aa6a[_0x50c410(0xd9)]({'journeyId':_0x226a9a,'journeyName':_0x245f3a[_0x50c410(0x166)],'isMultiVersion':_0x4bde91[_0x50c410(0x17e)]>0x1});};if(_0xb75997&&_0x4bde91['length']>0x1){const _0x74bc33=[];for(const _0x1f3a85 of _0x4bde91){const _0xccb567=_0x1f3a85[_0x2b8b12(0xca)]||0x1;_0x48aa6a[_0x2b8b12(0xa5)]?.['update'](_0x2b8b12(0x198)+_0x245f3a[_0x2b8b12(0x166)]+'\x20v'+_0xccb567);const _0x32f462=await _0x8b0fb5(_0x1f3a85['id']),_0x40d780=_0x1a5943(_0x1f3a85['id']),_0xd0655=await journeyResponseToDef(_0x32f462,_0x40d780);_0x74bc33[_0x2b8b12(0xb8)]({'item':_0x1f3a85,'yaml':_0xd0655});}const _0x11d3ed=buildLocalRuleToNameMappingFromJourney(_0x245f3a);_0x169c47=buildMergedJourneyDef(_0x74bc33,_0x11d3ed,_0x26c026);const _0x1786fe=Math['max'](..._0x74bc33[_0x2b8b12(0x19f)](_0x202c58=>_0x202c58[_0x2b8b12(0xa6)][_0x2b8b12(0xca)]||0x0)),_0x497e38=_0x4bde91[_0x2b8b12(0x10b)](_0x1161c2=>(_0x1161c2['versionNumber']||0x0)===_0x1786fe);_0x497e38&&(_0x48aa6a[_0x2b8b12(0xa5)]?.[_0x2b8b12(0x12e)](_0x2b8b12(0x198)+_0x245f3a[_0x2b8b12(0x166)]+'\x20v'+_0x1786fe),_0x309c68=await _0x8b0fb5(_0x497e38['id']));}else{const _0xac9bcb=_0x4bde91[_0x4bde91['length']-0x1];_0x48aa6a[_0x2b8b12(0xa5)]?.[_0x2b8b12(0x12e)](_0x2b8b12(0x198)+_0x245f3a['name']),_0x309c68=await _0x8b0fb5(_0xac9bcb['id']);const _0x766feb=_0x1a5943(_0xac9bcb['id']),_0x273104=await journeyResponseToDef(_0x309c68,_0x766feb),_0x3ee144=buildLocalRuleToNameMappingFromJourney(_0x245f3a);_0x169c47=buildMergedJourneyDef([{'item':_0xac9bcb,'yaml':_0x273104}],_0x3ee144,_0x26c026);}}addFoldersToCreate(_0x42cbbd,_0x48aa6a[_0x2b8b12(0x130)],_0x536101);const _0x515f33=calculateJourneyDiff(_0x245f3a,_0x169c47);_0x148530['push']({'relativePath':_0x245f3a['name'],'absolutePath':_0x48ae45,'yamlConfig':_0x245f3a,'folderPath':_0x42cbbd,'existingJourney':_0x309c68,'isNew':_0x515f33[_0x2b8b12(0x181)],'hasChanges':_0x515f33[_0x2b8b12(0xeb)],'diff':_0x515f33[_0x2b8b12(0x179)]});}return{'journeyFiles':_0x148530,'foldersToCreate':_0x536101};}export function calculateActivationActions(_0x16ae4a,_0x298780,_0x50d9da,_0x49b2f6){const _0x33eb2c=a152_0x18f4ba,_0x1bcf4b=[],_0x136719=new Map();for(const _0x4c69a8 of _0x298780){_0x136719[_0x33eb2c(0x174)](_0x4c69a8[_0x33eb2c(0x166)],_0x4c69a8);}const _0x456a10=new Map();for(const _0x36a04a of _0x16ae4a){_0x456a10['set'](_0x36a04a[_0x33eb2c(0x166)],_0x36a04a);}for(const _0x119882 of _0x16ae4a){const _0x4811bc=_0x136719[_0x33eb2c(0x19d)](_0x119882[_0x33eb2c(0x166)]);if(!_0x4811bc)_0x1bcf4b[_0x33eb2c(0xb8)]({'type':'create','name':_0x119882['name'],'yamlActivation':_0x119882});else{const _0x54cc78=activationResponseToDef(_0x4811bc,_0x50d9da,_0x49b2f6),_0x117328=a152_0x3adb27['stringify'](_0x54cc78),_0x58773c=a152_0x3adb27[_0x33eb2c(0x11d)](_0x119882);_0x117328!==_0x58773c&&_0x1bcf4b[_0x33eb2c(0xb8)]({'type':_0x33eb2c(0x12e),'name':_0x119882[_0x33eb2c(0x166)],'yamlActivation':_0x119882,'existingActivation':_0x4811bc});}}for(const _0x533960 of _0x298780){!_0x456a10[_0x33eb2c(0x1a4)](_0x533960[_0x33eb2c(0x166)])&&_0x1bcf4b[_0x33eb2c(0xb8)]({'type':_0x33eb2c(0x196),'name':_0x533960[_0x33eb2c(0x166)],'existingActivation':_0x533960});}return _0x1bcf4b;}function calculateYamlDiff(_0x384922,_0x194557){if(_0x194557){const _0x4badc9=generateDiff(_0x194557,_0x384922),_0x22b05c=hasChanges(_0x4badc9);return{'isNew':![],'hasChanges':_0x22b05c,'diff':_0x22b05c?formatDiffWithColors(_0x4badc9):undefined};}const _0x12cc96=generateDiff('',_0x384922);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x12cc96)};}export function calculateSegmentDiff(_0x2ddc3a,_0x5747f5,_0x164103,_0x10326e,_0x58e6e4){const _0x4e2eb1=segmentToYamlString(_0x2ddc3a),_0x3192b7=_0x5747f5?segmentToYamlString(segmentWithActivationsToYaml(_0x5747f5,_0x164103,undefined,_0x10326e,_0x58e6e4)):undefined;return calculateYamlDiff(_0x4e2eb1,_0x3192b7);}export function calculateJourneyDiff(_0x13e972,_0x1bbe0d){const _0x16bdb3=normalizeJourneyDef(_0x13e972,_0x13e972),_0xd29895=a152_0xe132d5(_0x16bdb3),_0x844174=_0x1bbe0d?a152_0xe132d5(normalizeJourneyDef(_0x1bbe0d,_0x13e972)):undefined;return calculateYamlDiff(_0xd29895,_0x844174);}export function findSegmentsToDelete(_0x40df90,_0xcadfb1,_0x4dc2cc,_0x3ebb46,_0x552ac6){const _0x19b9fc=a152_0x18f4ba,_0x2ec6b3=new Set();for(const {yamlConfig:_0x5ce754,folderPath:_0x4e0e7c}of _0xcadfb1){_0x2ec6b3[_0x19b9fc(0x106)](_0x4e0e7c+':'+_0x5ce754[_0x19b9fc(0x166)]);}return _0x40df90['filter'](_0xda6ad2=>{const _0x497d1a=_0x19b9fc,_0x587663=_0xda6ad2['segmentFolderId']?_0x4dc2cc[_0x497d1a(0x19d)](_0xda6ad2[_0x497d1a(0xa9)][_0x497d1a(0x1ab)]())||'':'',_0x2d9657=_0x587663+':'+_0xda6ad2[_0x497d1a(0x166)];if(_0x2ec6b3[_0x497d1a(0x1a4)](_0x2d9657))return![];if(_0x552ac6)return _0x587663===_0x3ebb46||_0x587663[_0x497d1a(0xe4)](_0x3ebb46+'/');return!![];});}export function findJourneysToDelete(_0x1e237c,_0x39836c,_0x1c1610,_0x1a6b2b,_0x52387d){const _0xa6a485=a152_0x18f4ba,_0x4217a1=new Set();for(const {yamlConfig:_0xe4281c,folderPath:_0xde3342}of _0x39836c){_0x4217a1['add'](_0xde3342+':'+_0xe4281c['name']);}return _0x1e237c[_0xa6a485(0x121)](_0x2312d4=>{const _0x3ffe6f=_0xa6a485,_0x351616=_0x2312d4[_0x3ffe6f(0x10c)]?_0x1c1610['get'](_0x2312d4[_0x3ffe6f(0x10c)])||'':'',_0x2d63be=_0x351616+':'+_0x2312d4[_0x3ffe6f(0x194)];if(_0x4217a1['has'](_0x2d63be))return![];if(_0x52387d)return _0x351616===_0x1a6b2b||_0x351616['startsWith'](_0x1a6b2b+'/');return!![];});}export function buildSegmentLookupMap(_0x22301c,_0x3e6f34){const _0x39e168=a152_0x18f4ba,_0x69b928=new Map();for(const _0x25faab of _0x22301c){const _0x44b1d9=_0x25faab[_0x39e168(0xa9)]?_0x3e6f34[_0x39e168(0x19d)](_0x25faab['segmentFolderId'][_0x39e168(0x1ab)]())||'':'',_0x2b92cf=_0x44b1d9+':'+_0x25faab[_0x39e168(0x166)];_0x69b928[_0x39e168(0x174)](_0x2b92cf,_0x25faab);}return _0x69b928;}export function buildSegmentNameToIdMap(_0x235012){const _0x441828=a152_0x18f4ba,_0x204a0e=new Map();for(const _0x85755a of _0x235012){_0x204a0e[_0x441828(0x174)](_0x85755a[_0x441828(0x166)],_0x85755a['id']);}return _0x204a0e;}export function buildJourneyBundleLookupMap(_0x56d392,_0x38364e){const _0x564c8f=a152_0x18f4ba,_0x138f1e=new Map();for(const _0x28aa71 of _0x56d392){const _0x1ddef7=_0x28aa71[_0x564c8f(0x10c)]?_0x38364e[_0x564c8f(0x19d)](_0x28aa71[_0x564c8f(0x10c)])||'':'',_0x32ae4b=_0x1ddef7+':'+_0x28aa71[_0x564c8f(0x194)];!_0x138f1e['has'](_0x32ae4b)&&_0x138f1e[_0x564c8f(0x174)](_0x32ae4b,[]),_0x138f1e[_0x564c8f(0x19d)](_0x32ae4b)[_0x564c8f(0xb8)](_0x28aa71);}for(const _0x12cdeb of _0x138f1e[_0x564c8f(0x11a)]()){_0x12cdeb[_0x564c8f(0x137)]((_0x21a6d3,_0x2f659d)=>(_0x21a6d3[_0x564c8f(0xca)]||0x0)-(_0x2f659d[_0x564c8f(0xca)]||0x0));}return _0x138f1e;}export function collectFoldersToCreate(_0x7e9624,_0x2bfaf9){const _0x5d5fb5=a152_0x18f4ba,_0x37f6df=new Set();for(const _0x49ac4d of _0x7e9624){if(!_0x49ac4d)continue;if(_0x2bfaf9['has'](_0x49ac4d))continue;const _0x5319c0=_0x49ac4d['split']('/');let _0x293e04='';for(const _0x268020 of _0x5319c0){_0x293e04=_0x293e04?_0x293e04+'/'+_0x268020:_0x268020,!_0x2bfaf9[_0x5d5fb5(0x1a4)](_0x293e04)&&_0x37f6df[_0x5d5fb5(0x106)](_0x293e04);}}return _0x37f6df;}function a152_0x43f1(){const _0xa33b57=['\x27\x20decision\x20point\x20branch\x20\x27','message','startsWith','create','journeyById','validatedRequest','JOURNEY_UPDATE_ERROR','Updated\x20activation\x20\x27','resolveSegment','hasChanges','activation_deleted','debug','state','segmentId','\x20(referenced\x20in\x20journey\x20','yamlConfig','nameToType','attributes','\x27\x20milestone','existingSegments','createJourneySegment','idToName','1269460zCrvYU','3225996xGFHDT','Activation\x20not\x20found:\x20','hex','\x27\x20exit\x20criteria','createSegment','Entry\x20criteria:\x20','embedded_activation_creating','isArray','with','existingSegment','journey_created','existingActivation','digest','add','\x27...','10npOnzX','verbose','Deleted\x20segment\x20\x27','find','folderId','Segment\x20not\x20found','keys','DecisionPoint','activation_deleting','absolutePath','__pending_','relationships','errors','embedded_segment_creating','6708804wJvmry','onProgress','Updating\x20segment\x20\x27','\x27\x20from\x20file:\x20','values','exitCriterias','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','stringify','conditionSegmentId','SEGMENT_NOT_FOUND','slice','filter','rootFolderId','withProgress','Created\x20folder\x20\x27','journeys','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Deleting\x20activation\x20\x27','uniqueSegmentName','description','\x27\x20to\x20local\x20\x27','deleteSegment','activationsBySegmentId','logSuccess','update','size','folderPathToId','\x0a\x20\x20','Created\x20segment\x20\x27','segment_created','index','Updating\x20activation\x20\x27','entry_criteria','sort','trim','parse','Creating\x20activation\x20\x27','kind','goal','steps','embeddedSegmentNameToId','activation_created','utf-8','split','max','all_columns','behavior','and\x20the\x20server\x20segment,\x20then\x20retry.','type','stages','getSegment','uniqueServerName','yamlActivation','getLatestJourneyId','6456048etjdqz','reduce','activationStepsById','waitStep','segment_creating','rule','effectiveFolderId','Creating\x20segment\x20\x27','deps','conditions','2796402MJyQsH','localName','waitStepType','deleted','Deleted\x20activation\x20\x27','journeyId','valid','toLowerCase','Activation','NOT_FOUND','getActivation','1700202UMHWaN','4GkHLkO','Updated\x20journey\x20\x27','connection','22WqLuDh','name','createdSegmentId','folder','columns','entry','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','activation_','resolveJourneyId','Failed\x20to\x20resolve\x20activation\x20','segmentNameToId','journeyName','toISOString','segmentByFolderAndName','Embedded\x20segment\x20\x27','set','1227999HctDpq','getJourney','milestone','activation_creating','diff','Failed\x20to\x20fetch\x20referenced\x20segment\x20','parentSegmentFolder','\x27\x20by\x20rule\x20content','replace','length','117ZeGutM','includes','isNew','INTERNAL','createdSegmentIds','segment',').\x20','draft','Condition','logWarning','activations','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','\x20activation\x20\x27','createActivation','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','entries','listActivations','created','connector_config','conditionTimeoutDuration','conditionTimeoutUnit','journeyBundleName','parseDocument','delete','logDeleted','Fetching\x20','segment_updating','segments','Name\x20has\x20already\x20been\x20taken','parentId','get','join','map','notification','ACTIVATION_UPDATE_ERROR','journey','all','has','../../utils/async.js','from','\x27\x20entry\x20criteria','Created\x20journey\x20\x27','waitStepUnit','idToEmailMap','toString','Matched\x20server\x20segment\x20\x27','Failed\x20to\x20','action','branches','flatMap','SEGMENT_UPDATE_ERROR','updated','.$1.push-recovery.json','segment_updated','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','resolvedRule','tdx.sdk.push-workflow','progress','item','JOURNEY_SYNTAX_ERROR','getSegment\x20failed\x20for\x20','segmentFolderId','journey_creating','some','folderPath','journeyActivationNameToId','decision_point','Creating\x20folder\x20\x27','run_after_journey_refresh','unchanged','match','existingJourney','\x20error(s)','\x20journey\x20from\x20file:\x20','journeyActivationStepId','day','push','journeyStages','list','WaitStep','activation_template_id','Stage\x20\x27','data','Segment\x20not\x20found:\x20','activationParams','\x27\x20wait\x20condition','deleteActivation','./child-segment-yaml.js','Created\x20activation\x20\x27','buildUserMaps','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','createFolder','folder_creating','segment_deleted','versionNumber','sha1','embedded_segment_created','./journey-yaml.js','activationActions','updateSegmentById','object','embedded_activation_created','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','\x20segment\x20from\x20file:\x20','Failed\x20to\x20resolve\x20segment\x20','parentFolder','dirname','journeyBundleId','activation_updating','fetchJourney','stage\x20\x27','connectionIdToNameMap','):\x20','1pVQVkf','entryCriteria','logInfo','journey_updated','journey_updating'];a152_0x43f1=function(){return _0xa33b57;};return a152_0x43f1();}export function parseAndClassifyYamlFiles(_0x19de8e,_0x4c9b43,_0x1dd799){const _0xf4016f=a152_0x18f4ba,_0x48a851=[],_0x24a774=[];for(const _0x5b9f29 of _0x19de8e){const _0x1b757c=a152_0x19fc04['relative'](_0x4c9b43,a152_0x19fc04[_0xf4016f(0xd6)](_0x5b9f29)),_0x5af87d=_0x1b757c==='.'?'':_0x1b757c,_0x69de31=readFileSync(_0x5b9f29,_0xf4016f(0x140)),_0x539683=a152_0x3adb27[_0xf4016f(0x139)](_0x69de31);if(isJourneyDef(_0x539683)){const _0x2862d4=a152_0x45d0de(_0x69de31);_0x24a774[_0xf4016f(0xb8)]({'yamlConfig':_0x2862d4,'folderPath':_0x5af87d,'sourcePath':_0x5b9f29});}else{if(!_0x1dd799?.['skipSegments']){const _0x2daafa=parseSegmentYamlFile(_0x69de31),_0x3d2fa9=normalizeChildSegmentYaml(_0x2daafa);_0x48a851['push']({'yamlConfig':_0x3d2fa9,'folderPath':_0x5af87d,'sourcePath':_0x5b9f29});}}}return{'segments':_0x48a851,'journeys':_0x24a774};}export function validateParsedFiles(_0x4d6788,_0xc717b6){const _0x5deb31=a152_0x18f4ba,_0xf3264a=[];for(const {yamlConfig:_0x24dbf8,sourcePath:_0x217ae7}of _0x4d6788[_0x5deb31(0x19a)]){const _0x585de1=readFileSync(_0x217ae7,_0x5deb31(0x140)),_0x9f6cfd=a152_0x3adb27[_0x5deb31(0x195)](_0x585de1),_0x40ba36=validateSegmentDef(_0x24dbf8,{'source':_0x585de1,'document':_0x9f6cfd},{'skipSchema':!![]});if(!_0x40ba36[_0x5deb31(0x15c)]){const _0x39e357=a152_0x19fc04['relative'](_0xc717b6,_0x217ae7);_0xf3264a[_0x5deb31(0xb8)]({'filePath':_0x39e357,'source':_0x585de1,'result':_0x40ba36,'isJourney':![]});}}for(const {yamlConfig:_0x320004,sourcePath:_0x2f5689}of _0x4d6788[_0x5deb31(0x125)]){const _0x2fb581=readFileSync(_0x2f5689,_0x5deb31(0x140)),_0x267203=a152_0x3adb27['parseDocument'](_0x2fb581),_0xa76f3=validateJourneyDef(_0x320004,{'source':_0x2fb581,'document':_0x267203},{'skipSchema':!![]});if(!_0xa76f3[_0x5deb31(0x15c)]){const _0x54d90b=a152_0x19fc04['relative'](_0xc717b6,_0x2f5689);_0xf3264a[_0x5deb31(0xb8)]({'filePath':_0x54d90b,'source':_0x2fb581,'result':_0xa76f3,'isJourney':!![]});}}return _0xf3264a;}export function formatValidationErrors(_0x22e06b){const _0x26589e=a152_0x18f4ba,_0x29198f=[];for(const {filePath:_0x560dd6,source:_0x2ed903,result:_0x36cc2c,isJourney:_0x5cce2f}of _0x22e06b){const _0xaad821=_0x5cce2f?_0x26589e(0x1a2):_0x26589e(0x184);_0x29198f['push']('\x0a'+_0x560dd6+'\x20('+_0xaad821+_0x26589e(0xdc)+_0x36cc2c[_0x26589e(0x114)]['length']+_0x26589e(0xb4)),_0x29198f[_0x26589e(0xb8)](formatValidationResult(_0x36cc2c,_0x2ed903,_0x560dd6));}return _0x29198f[_0x26589e(0x19e)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x51db77){const _0x51c4a3=a152_0x18f4ba,_0x149234=new Set(),_0x2f63a8=new Map(),_0x54719a=collectSegmentUsageCounts(_0x51db77);if(_0x51db77[_0x51c4a3(0x19a)])for(const [_0x21c041,_0x2f0b2b]of Object[_0x51c4a3(0x18e)](_0x51db77[_0x51c4a3(0x19a)])){_0x149234[_0x51c4a3(0x106)](_0x21c041);if(_0x2f0b2b['rule']){const _0x52c076=yamlRuleToApi(_0x2f0b2b[_0x51c4a3(0x151)]),_0x59aa3c=apiRuleToYaml(_0x52c076);_0x2f63a8['set'](_0x21c041,_0x59aa3c);}}const _0x118d72=new Map();let _0x8b2c9d=0x0;for(const [_0x5c0eb2,_0x2fc555]of _0x2f63a8){const _0x1d682c=serializeExpandedRule(_0x2fc555,_0x2f63a8),_0xe4abd3=_0x118d72['get'](_0x1d682c)||[];_0xe4abd3['push']({'name':_0x5c0eb2,'index':_0x8b2c9d}),_0x118d72[_0x51c4a3(0x174)](_0x1d682c,_0xe4abd3),_0x8b2c9d++;}const _0x4f72ab=new Map();for(const [_0x15b3bd,_0x2a73c3]of _0x118d72){const _0x51740c=_0x2a73c3[_0x51c4a3(0x120)]()['sort']((_0x15292e,_0x55f7d8)=>{const _0x1cc224=_0x51c4a3,_0x2b310e=_0x54719a['get'](_0x15292e[_0x1cc224(0x166)])||0x0,_0x1c897b=_0x54719a[_0x1cc224(0x19d)](_0x55f7d8[_0x1cc224(0x166)])||0x0;if(_0x2b310e!==_0x1c897b)return _0x1c897b-_0x2b310e;return _0x15292e[_0x1cc224(0x134)]-_0x55f7d8[_0x1cc224(0x134)];})[_0x51c4a3(0x19f)](_0x331553=>_0x331553[_0x51c4a3(0x166)]),_0x4824ed=[];for(const _0x155ff9 of _0x51740c){const _0x51a147=_0x54719a['get'](_0x155ff9)||0x0,_0x224868=Math[_0x51c4a3(0x142)](_0x51a147,0x1);for(let _0x29262a=0x0;_0x29262a<_0x224868;_0x29262a++){_0x4824ed[_0x51c4a3(0xb8)](_0x155ff9);}}_0x4f72ab[_0x51c4a3(0x174)](_0x15b3bd,_0x4824ed);}return{'existingLocalSegmentNames':_0x149234,'localSegmentRules':_0x2f63a8,'localExpandedRuleToNames':_0x4f72ab};}export function createSegmentIdResolver(_0x4a49eb,_0xbc427c){return async _0x18cc6a=>{const _0xd7611f=a152_0x3e6f,_0x4a62ca=_0x4a49eb[_0xd7611f(0x19d)](_0x18cc6a);if(!_0x4a62ca)throw new SDKError(ErrorCode[_0xd7611f(0x11f)],'Segment\x20not\x20found:\x20'+_0x18cc6a+_0xd7611f(0x1b5)+_0xbc427c+'\x27)');return _0x4a62ca;};}export function extractRootFolderId(_0x396007){const _0x1aec13=a152_0x18f4ba;return _0x396007[_0x1aec13(0x113)]?.[_0x1aec13(0x17b)]?.[_0x1aec13(0xbe)]?.['id']||_0x396007['relationships']?.[_0x1aec13(0xd5)]?.['data']?.['id'];}export function buildConnectionMaps(_0x60ae06){const _0x847bca=a152_0x18f4ba,_0x4206ff=new Map(),_0x539a68=new Map(),_0x59296b=new Map();for(const _0x340880 of _0x60ae06){_0x4206ff['set'](_0x340880[_0x847bca(0x166)],parseInt(_0x340880['id'],0xa)),_0x539a68[_0x847bca(0x174)](_0x340880['id'],_0x340880[_0x847bca(0x166)]),_0x59296b[_0x847bca(0x174)](_0x340880[_0x847bca(0x166)],_0x340880[_0x847bca(0x146)]);}return{'nameToId':_0x4206ff,'idToName':_0x539a68,'nameToType':_0x59296b};}export function calculatePushStats(_0x22e9a6,_0x521466,_0x3100e2,_0x54c56d,_0x3e9b76,_0x3ad581,_0x2b5081){const _0x5b0dd9=a152_0x18f4ba,_0x1dc284=_0x22e9a6[_0x5b0dd9(0x121)](_0x4f430d=>_0x4f430d[_0x5b0dd9(0x181)]),_0x3f3c6c=_0x22e9a6['filter'](_0x5b7fb1=>!_0x5b7fb1[_0x5b0dd9(0x181)]&&_0x5b7fb1[_0x5b0dd9(0xeb)]),_0x5d53dd=_0x22e9a6[_0x5b0dd9(0x121)](_0x76f1ad=>!_0x76f1ad[_0x5b0dd9(0x181)]&&!_0x76f1ad[_0x5b0dd9(0xeb)]),_0x189398=_0x3ad581?_0x54c56d:[],_0x1b3861=_0x521466[_0x5b0dd9(0x121)](_0x4e5410=>_0x4e5410[_0x5b0dd9(0x181)]),_0xfa4080=_0x521466[_0x5b0dd9(0x121)](_0x328dbb=>!_0x328dbb[_0x5b0dd9(0x181)]&&_0x328dbb[_0x5b0dd9(0xeb)]),_0xae7495=_0x521466['filter'](_0x391535=>!_0x391535[_0x5b0dd9(0x181)]&&!_0x391535['hasChanges']),_0x8bc84b=_0x3ad581?_0x3e9b76:[],_0x137d8d=_0x22e9a6[_0x5b0dd9(0x1b0)](_0x16beaa=>_0x16beaa['activationActions']),_0x2aebe4=_0x137d8d[_0x5b0dd9(0x121)](_0x19f94e=>_0x19f94e[_0x5b0dd9(0x146)]===_0x5b0dd9(0xe5)),_0x3d94f6=_0x137d8d[_0x5b0dd9(0x121)](_0x3a80fb=>_0x3a80fb[_0x5b0dd9(0x146)]===_0x5b0dd9(0x12e)),_0x471814=_0x137d8d[_0x5b0dd9(0x121)](_0x5506e2=>_0x5506e2[_0x5b0dd9(0x146)]==='delete'),_0x43367a=Array['from'](_0x3100e2)[_0x5b0dd9(0x137)](),_0x68f144=_0x2b5081?![]:_0x1dc284[_0x5b0dd9(0x17e)]>0x0||_0x3f3c6c[_0x5b0dd9(0x17e)]>0x0||_0x189398['length']>0x0,_0x1b012a=_0x1b3861[_0x5b0dd9(0x17e)]>0x0||_0xfa4080['length']>0x0||_0x8bc84b[_0x5b0dd9(0x17e)]>0x0,_0x32742d=_0x2b5081?![]:_0x137d8d['length']>0x0,_0x4e17dc=_0x43367a['length']>0x0;return{'segments':{'new':_0x1dc284,'changed':_0x3f3c6c,'unchanged':_0x5d53dd,'toDelete':_0x189398},'journeys':{'new':_0x1b3861,'changed':_0xfa4080,'unchanged':_0xae7495,'toDelete':_0x8bc84b},'activations':{'all':_0x137d8d,'toCreate':_0x2aebe4,'toUpdate':_0x3d94f6,'toDelete':_0x471814},'folders':{'toCreate':_0x43367a},'counts':{'segments':{'new':_0x1dc284[_0x5b0dd9(0x17e)],'changed':_0x3f3c6c['length'],'unchanged':_0x5d53dd[_0x5b0dd9(0x17e)],'toDelete':_0x189398[_0x5b0dd9(0x17e)]},'journeys':{'new':_0x1b3861[_0x5b0dd9(0x17e)],'changed':_0xfa4080[_0x5b0dd9(0x17e)],'unchanged':_0xae7495['length'],'toDelete':_0x8bc84b[_0x5b0dd9(0x17e)]},'activations':{'create':_0x2aebe4[_0x5b0dd9(0x17e)],'update':_0x3d94f6[_0x5b0dd9(0x17e)],'delete':_0x471814[_0x5b0dd9(0x17e)]},'folders':_0x43367a['length']},'hasChanges':_0x68f144||_0x1b012a||_0x32742d||_0x4e17dc};}export async function buildPushExecutionContext(_0x3c1fe9,_0x5e1f5f,_0x5752fa,_0xddb0e0,_0x4d82e1,_0x522d29){const _0x1c1bc9=a152_0x18f4ba,_0x20cb8d=extractRootFolderId(_0x5752fa),{pathToId:_0x5c3d14,idToPath:_0x263fe4}=buildFolderMaps(_0x4d82e1),_0x3ab951=buildSegmentNameToIdMap(_0xddb0e0),_0x1c788e=new Map(),{batchAsync:_0x11eaad}=await import(_0x1c1bc9(0x1a5)),[_0x17e5de,_0x2f5dd0]=await Promise[_0x1c1bc9(0x1a3)]([_0x3c1fe9['user'][_0x1c1bc9(0xc5)](),_0x3c1fe9[_0x1c1bc9(0x164)][_0x1c1bc9(0xba)](),((async()=>{const _0x442403=_0x1c1bc9;!_0x522d29&&_0xddb0e0[_0x442403(0x17e)]>0x0&&await _0x11eaad(_0xddb0e0,async _0x33914a=>{const _0x2e41d3=_0x442403,_0x4bb910=await _0x3c1fe9[_0x2e41d3(0x184)][_0x2e41d3(0x18f)](_0x5e1f5f,_0x33914a['id']);_0x1c788e[_0x2e41d3(0x174)](_0x33914a['id'],_0x4bb910);});})())]),{emailToId:_0x2b06af,idToEmail:_0x202a32}=_0x17e5de,_0x10a1ae=buildConnectionMaps(_0x2f5dd0);return{'rootFolderId':_0x20cb8d,'folderPathToId':_0x5c3d14,'folderIdToPath':_0x263fe4,'segmentNameToId':_0x3ab951,'activationsBySegmentId':_0x1c788e,'emailToIdMap':_0x2b06af,'idToEmailMap':_0x202a32,'connectionNameToIdMap':_0x10a1ae['nameToId'],'connectionIdToNameMap':_0x10a1ae[_0x1c1bc9(0xf7)],'connectionNameToTypeMap':_0x10a1ae[_0x1c1bc9(0xf2)]};}export function createPushYamlContextForBundle(_0x2fed62,_0x1a1c0e,_0x5d4912,_0x3fb091,_0x59ccf4,_0x192dab,_0x3b4a33,_0x755c94){const {existingLocalSegmentNames:_0x59609a,localExpandedRuleToNames:_0x114e6d}=_0x3fb091,_0x462557=new Set(),_0x5e51f3=new Map(),_0x379301=new Map(),_0x349683=new Map(),_0x164f54=createJumpTargetCache(),_0x376075=new Map(),_0x358036=new Map(),_0x13f335=new Set();let _0x470e92;const _0x57b8d4=_0x29582e=>{const _0x12ecf9={'resolveSegment':async _0x5acff3=>{const _0x3e7423=a152_0x3e6f,_0x1b6234=_0x349683[_0x3e7423(0x19d)](_0x5acff3);if(_0x1b6234!==undefined)return{'name':_0x1b6234,'isJourneyLocal':!![]};try{const _0x1fe2b0=await fetchSegment(_0x2fed62,_0x1a1c0e,_0x5acff3,_0x5d4912);if(!_0x1fe2b0)throw new Error(_0x3e7423(0x10d));const _0x1ecd1e=generateJourneyLocalName(_0x1fe2b0[_0x3e7423(0x166)]),_0x3d20b7=_0x1fe2b0[_0x3e7423(0x13b)]===SEGMENT_KIND_JOURNEY&&_0x1ecd1e!==undefined;let _0x1644ce=_0x1fe2b0[_0x3e7423(0x166)],_0x506ebc;if(_0x3d20b7&&_0x1fe2b0[_0x3e7423(0x151)]){const _0xcf5d8=apiRuleToYaml(_0x1fe2b0[_0x3e7423(0x151)]);_0x358036[_0x3e7423(0x174)](_0x5acff3,_0xcf5d8);const _0x553f2d=async _0x4b086a=>{const _0x5c81da=_0x3e7423,_0x103a0f=collectSegmentRefsFromRule(_0x4b086a);for(const _0x4c3496 of _0x103a0f){if(!_0x358036['has'](_0x4c3496))try{const _0x130590=await fetchSegment(_0x2fed62,_0x1a1c0e,_0x4c3496,_0x5d4912);if(_0x130590?.['rule']){const _0x4f360b=apiRuleToYaml(_0x130590['rule']);_0x358036[_0x5c81da(0x174)](_0x4c3496,_0x4f360b),await _0x553f2d(_0x4f360b);}}catch(_0x367f05){logger[_0x5c81da(0xed)](_0x5c81da(0x17a)+_0x4c3496+':\x20'+_0x367f05);}}};await _0x553f2d(_0xcf5d8);const _0x27d9fe=serializeExpandedRule(_0xcf5d8,_0x358036),_0x21a31d=_0x114e6d[_0x3e7423(0x19d)](_0x27d9fe);if(_0x21a31d&&_0x21a31d['length']>0x0){const _0x109c1a=_0x5e51f3[_0x3e7423(0x19d)](_0x27d9fe)||0x0,_0x36c951=_0x21a31d[_0x109c1a]||_0x21a31d[_0x21a31d[_0x3e7423(0x17e)]-0x1];_0x5e51f3[_0x3e7423(0x174)](_0x27d9fe,_0x109c1a+0x1),_0x1644ce=_0x36c951,_0x462557[_0x3e7423(0x106)](_0x1644ce),_0x349683[_0x3e7423(0x174)](_0x5acff3,_0x1644ce);const _0x2e6d52=await resolveRuleSegmentRefs(_0xcf5d8,async _0x530511=>{const _0x1e0f8c=_0x3e7423,_0x4f778c=_0x349683[_0x1e0f8c(0x19d)](_0x530511);if(_0x4f778c)return _0x4f778c;const _0x45f9fb=await _0x470e92[_0x1e0f8c(0xea)](_0x530511);return _0x45f9fb[_0x1e0f8c(0x166)];});_0x506ebc={'description':_0x1fe2b0['description'],'rule':_0x2e6d52};}else{const _0x7ec601=_0x376075[_0x3e7423(0x19d)](_0x27d9fe);if(_0x7ec601)_0x1644ce=_0x7ec601,_0x349683[_0x3e7423(0x174)](_0x5acff3,_0x1644ce);else{if(_0x1ecd1e){let _0x1be89a=_0x1ecd1e,_0x454e3d=0x2;while(_0x462557[_0x3e7423(0x1a4)](_0x1be89a)||_0x59609a[_0x3e7423(0x1a4)](_0x1be89a)){_0x1be89a=_0x1ecd1e+'_'+_0x454e3d,_0x454e3d++;}_0x462557['add'](_0x1be89a),_0x1644ce=_0x1be89a;}_0x349683[_0x3e7423(0x174)](_0x5acff3,_0x1644ce),_0x376075[_0x3e7423(0x174)](_0x27d9fe,_0x1644ce);const _0x20011a=await resolveRuleSegmentRefs(_0xcf5d8,async _0x24b86d=>{const _0x28b31d=_0x3e7423,_0x56f31d=_0x349683[_0x28b31d(0x19d)](_0x24b86d);if(_0x56f31d)return _0x56f31d;const _0x6058e4=await _0x470e92['resolveSegment'](_0x24b86d);return _0x6058e4[_0x28b31d(0x166)];});_0x506ebc={'description':_0x1fe2b0['description'],'rule':_0x20011a};}}}return{'name':_0x1644ce,'isJourneyLocal':_0x3d20b7,'definition':_0x506ebc};}catch(_0x6066f9){return logger['debug'](_0x3e7423(0xd4)+_0x5acff3+':\x20'+_0x6066f9),{'name':_0x5acff3,'isJourneyLocal':![]};}},'resolveActivation':async _0xf07c2=>{const _0x5298ac=a152_0x3e6f,_0x239d3e=_0x379301[_0x5298ac(0x19d)](_0xf07c2);if(_0x239d3e!==undefined)return{'name':_0x239d3e,'isJourneyLocal':!![]};try{let _0x1f232d=_0x3b4a33?.[_0x5298ac(0x19d)](_0xf07c2);!_0x1f232d&&(_0x1f232d=await _0x2fed62[_0x5298ac(0x1a2)][_0x5298ac(0x160)](_0x29582e,_0xf07c2));const _0x31ae26=_0x1f232d[_0x5298ac(0xf3)][_0x5298ac(0xc0)]['name']||_0xf07c2,_0x5a7fbc=sanitizeYamlKey(_0x31ae26)||_0x5298ac(0x16c)+_0xf07c2,_0x5bcca5=_0x5a7fbc;_0x379301[_0x5298ac(0x174)](_0xf07c2,_0x5bcca5);const _0x32d937=journeyActivationStepToYaml(_0x1f232d,_0x59ccf4,_0x192dab);return{'name':_0x5bcca5,'isJourneyLocal':!![],'definition':_0x32d937};}catch(_0x1c0511){return logger[_0x5298ac(0xed)](_0x5298ac(0x16e)+_0xf07c2+':\x20'+_0x1c0511),{'name':_0xf07c2,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0xc787a6,_0x32f862)=>resolveJumpTarget(_0xc787a6,_0x32f862,_0x164f54,async _0x1445b8=>{const _0x4887a3=a152_0x3e6f,_0x52fe03=_0x755c94?.[_0x4887a3(0x19d)](_0x1445b8);if(_0x52fe03)return _0x52fe03;return _0x2fed62[_0x4887a3(0x1a2)][_0x4887a3(0x176)](_0x1445b8);})};return _0x470e92=_0x12ecf9,_0x12ecf9;},_0x35af1e=async _0x513ee8=>{const _0x146b8d=a152_0x3e6f,{collectSegmentIdsFromJourneyApi:_0x37b276}=await import('./journey-yaml.js'),{batchAsync:_0x1fcf6d}=await import(_0x146b8d(0x1a5)),_0x1efdf5=new Set();for(const _0xbc2eb3 of _0x513ee8){let _0x39ba16=_0x755c94?.[_0x146b8d(0x19d)](_0xbc2eb3);!_0x39ba16&&(_0x39ba16=await _0x2fed62[_0x146b8d(0x1a2)][_0x146b8d(0x176)](_0xbc2eb3));const _0x52811b=_0x37b276(_0x39ba16);for(const _0x1ec817 of _0x52811b){_0x1efdf5[_0x146b8d(0x106)](_0x1ec817);}}let _0x289b25=Array[_0x146b8d(0x1a6)](_0x1efdf5);while(_0x289b25[_0x146b8d(0x17e)]>0x0){const _0x28b865=_0x289b25[_0x146b8d(0x121)](_0x41dd9b=>!_0x13f335['has'](_0x41dd9b));if(_0x28b865[_0x146b8d(0x17e)]===0x0)break;const _0x2eb17b=await _0x1fcf6d(_0x28b865,async _0x5b57ff=>{const _0x266233=_0x146b8d;_0x13f335[_0x266233(0x106)](_0x5b57ff);const _0x1130b3=await fetchSegment(_0x2fed62,_0x1a1c0e,_0x5b57ff,_0x5d4912);if(!_0x1130b3)return null;return{'segmentId':_0x5b57ff,'segment':_0x1130b3};},0xa),_0x52f6a5=new Set();for(const _0x378e3d of _0x2eb17b){if(!_0x378e3d?.[_0x146b8d(0x184)]?.[_0x146b8d(0x151)])continue;const _0x521325=apiRuleToYaml(_0x378e3d['segment'][_0x146b8d(0x151)]);_0x358036[_0x146b8d(0x174)](_0x378e3d[_0x146b8d(0xef)],_0x521325);const _0x13fa3e=collectSegmentRefsFromRule(_0x521325);for(const _0x431439 of _0x13fa3e){!_0x13f335[_0x146b8d(0x1a4)](_0x431439)&&_0x52f6a5[_0x146b8d(0x106)](_0x431439);}}_0x289b25=Array[_0x146b8d(0x1a6)](_0x52f6a5);}};return{'createYamlContext':_0x57b8d4,'prefetchJourneySegments':_0x35af1e};}export async function executePushSegments(_0x3fd853,_0x29cf52,_0x1edc01,_0x4ce9c9,_0xff2889){const _0x5a49dd=a152_0x18f4ba,{segmentDefToCreateRequest:_0x5d7ed6,segmentDefToUpdateRequest:_0x12e777}=await import(_0x5a49dd(0xc3)),_0x1856b0=_0x1edc01[_0x5a49dd(0x130)],_0x26aa84=0x5,_0x58d4e3=async _0x221e08=>{const _0x3dca04=_0x5a49dd,_0x525f37=_0x221e08[_0x3dca04(0xac)]?_0x1856b0[_0x3dca04(0x19d)](_0x221e08['folderPath']):undefined;let _0x5aa066;const _0xb0a0a2={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x50d992=_0x221e08[_0x3dca04(0xf1)];if(_0x221e08[_0x3dca04(0xf1)]['rule']){const _0x5f0940=createSegmentIdResolver(_0x1edc01['segmentNameToId'],_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]),_0x17309e=await resolveRuleSegmentIds(_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x151)],_0x5f0940);_0x50d992={..._0x221e08['yamlConfig'],'rule':_0x17309e};}try{if(_0x221e08[_0x3dca04(0x181)]){_0xff2889[_0x3dca04(0x117)]?.({'type':_0x3dca04(0x150),'name':_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]});const _0x3325fe=_0x5d7ed6(_0x50d992,_0x525f37),_0x377566=await _0xff2889[_0x3dca04(0x123)](_0x3dca04(0x153)+_0x221e08[_0x3dca04(0xf1)]['name']+_0x3dca04(0x107),()=>_0x3fd853['segment'][_0x3dca04(0xfd)](_0x4ce9c9[_0x3dca04(0x19c)],_0x3325fe));_0x5aa066=_0x377566[_0x3dca04(0xbe)]['id'],_0x1edc01[_0x3dca04(0x16f)][_0x3dca04(0x174)](_0x221e08[_0x3dca04(0xf1)]['name'],_0x5aa066),_0xb0a0a2[_0x3dca04(0x167)]={'name':_0x221e08['yamlConfig'][_0x3dca04(0x166)],'id':_0x5aa066},_0xff2889['onProgress']?.({'type':_0x3dca04(0x133),'name':_0x221e08[_0x3dca04(0xf1)]['name'],'segmentId':_0x5aa066}),_0xff2889[_0x3dca04(0x12d)]?.(_0x3dca04(0x132)+_0x221e08['yamlConfig'][_0x3dca04(0x166)]+'\x27'),_0xb0a0a2[_0x3dca04(0x190)]=0x1;}else{if(_0x221e08['hasChanges']){_0xff2889[_0x3dca04(0x117)]?.({'type':_0x3dca04(0x199),'name':_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]});const _0x4d8c6b=_0x12e777(_0x50d992);_0x525f37!==_0x221e08['existingSegment']?.[_0x3dca04(0xa9)]&&(_0x4d8c6b[_0x3dca04(0xa9)]=_0x525f37?parseInt(_0x525f37,0xa):undefined),await _0xff2889['withProgress'](_0x3dca04(0x118)+_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]+'\x27...',()=>_0x3fd853['segment'][_0x3dca04(0xcf)](_0x4ce9c9[_0x3dca04(0x19c)],_0x221e08[_0x3dca04(0x102)]['id'],_0x4d8c6b)),_0x5aa066=_0x221e08[_0x3dca04(0x102)]['id'],_0xff2889[_0x3dca04(0x117)]?.({'type':_0x3dca04(0x1b4),'name':_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]}),_0xff2889['logSuccess']?.('Updated\x20segment\x20\x27'+_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]+'\x27'),_0xb0a0a2['updated']=0x1;}else _0x5aa066=_0x221e08['existingSegment']['id'];}}catch(_0x50dbed){const _0x2ed613=isHttp400Error(_0x50dbed),_0x2c8e0f=_0x2ed613?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x3dca04(0x1b1)],_0x45fd5a=getErrorMessage(_0x50dbed);throw new SDKError(_0x2c8e0f,_0x3dca04(0x1ad)+(_0x221e08[_0x3dca04(0x181)]?'create':_0x3dca04(0x12e))+_0x3dca04(0xd3)+_0x221e08[_0x3dca04(0x111)]+_0x3dca04(0x131)+_0x45fd5a,_0x50dbed);}try{const _0x5bd02a=await syncActivationsForSegment(_0x3fd853,_0x4ce9c9[_0x3dca04(0x19c)],_0x5aa066,_0x221e08['yamlConfig'][_0x3dca04(0x166)],_0x221e08[_0x3dca04(0xce)],_0xff2889,_0x221e08[_0x3dca04(0x111)]);_0xb0a0a2['activations']=_0x5bd02a;}catch(_0x178cef){if(_0x178cef instanceof SDKError)throw _0x178cef;throw new SDKError(ErrorCode[_0x3dca04(0x1a1)],_0x3dca04(0x126)+_0x221e08[_0x3dca04(0xf1)]['name']+_0x3dca04(0x119)+_0x221e08[_0x3dca04(0x111)]+'\x0a\x20\x20'+getErrorMessage(_0x178cef),_0x178cef);}return _0xb0a0a2;},_0x9d30bc=await batchAsync(_0x29cf52,_0x58d4e3,_0x26aa84),_0x210dd9={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x1fc5b4 of _0x9d30bc){_0x210dd9['created']+=_0x1fc5b4[_0x5a49dd(0x190)],_0x210dd9[_0x5a49dd(0x1b2)]+=_0x1fc5b4[_0x5a49dd(0x1b2)],_0x1fc5b4['createdSegmentId']&&_0x210dd9[_0x5a49dd(0x183)][_0x5a49dd(0x174)](_0x1fc5b4['createdSegmentId'][_0x5a49dd(0x166)],_0x1fc5b4[_0x5a49dd(0x167)]['id']),_0x210dd9[_0x5a49dd(0x189)]['created']+=_0x1fc5b4['activations'][_0x5a49dd(0x190)],_0x210dd9[_0x5a49dd(0x189)]['updated']+=_0x1fc5b4['activations'][_0x5a49dd(0x1b2)],_0x210dd9[_0x5a49dd(0x189)][_0x5a49dd(0x159)]+=_0x1fc5b4[_0x5a49dd(0x189)]['deleted'];}return _0x210dd9;}async function syncActivationsForSegment(_0x3aae2a,_0x5d54db,_0x48e8bc,_0x216c63,_0x308f8e,_0x285a5d,_0x59c2f0){const _0x1aac62=a152_0x18f4ba,_0x51cdae={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x5c9837 of _0x308f8e){try{if(_0x5c9837['type']==='create'&&_0x5c9837[_0x1aac62(0xe7)])_0x285a5d['onProgress']?.({'type':_0x1aac62(0x178),'segmentName':_0x216c63,'activationName':_0x5c9837[_0x1aac62(0x166)]}),await _0x285a5d[_0x1aac62(0x123)](_0x1aac62(0x13a)+_0x5c9837[_0x1aac62(0x166)]+_0x1aac62(0x107),()=>_0x3aae2a[_0x1aac62(0x184)][_0x1aac62(0x18c)](_0x5d54db,_0x48e8bc,_0x5c9837[_0x1aac62(0xe7)])),_0x285a5d['onProgress']?.({'type':_0x1aac62(0x13f),'segmentName':_0x216c63,'activationName':_0x5c9837[_0x1aac62(0x166)]}),_0x285a5d['logSuccess']?.(_0x1aac62(0xc4)+_0x5c9837['name']+'\x27'),_0x51cdae['created']++;else{if(_0x5c9837[_0x1aac62(0x146)]===_0x1aac62(0x12e)&&_0x5c9837[_0x1aac62(0xe7)]&&_0x5c9837[_0x1aac62(0x104)])_0x285a5d[_0x1aac62(0x117)]?.({'type':_0x1aac62(0xd8),'segmentName':_0x216c63,'activationName':_0x5c9837[_0x1aac62(0x166)]}),await _0x285a5d['withProgress'](_0x1aac62(0x135)+_0x5c9837[_0x1aac62(0x166)]+_0x1aac62(0x107),()=>_0x3aae2a['segment']['updateActivation'](_0x5d54db,_0x48e8bc,_0x5c9837['existingActivation']['id'],_0x5c9837[_0x1aac62(0xe7)])),_0x285a5d[_0x1aac62(0x117)]?.({'type':'activation_updated','segmentName':_0x216c63,'activationName':_0x5c9837[_0x1aac62(0x166)]}),_0x285a5d[_0x1aac62(0x12d)]?.(_0x1aac62(0xe9)+_0x5c9837[_0x1aac62(0x166)]+'\x27'),_0x51cdae[_0x1aac62(0x1b2)]++;else _0x5c9837[_0x1aac62(0x146)]===_0x1aac62(0x196)&&_0x5c9837[_0x1aac62(0x104)]&&(_0x285a5d[_0x1aac62(0x117)]?.({'type':_0x1aac62(0x110),'segmentName':_0x216c63,'activationName':_0x5c9837['name']}),await _0x285a5d[_0x1aac62(0x123)](_0x1aac62(0x127)+_0x5c9837['name']+_0x1aac62(0x107),()=>_0x3aae2a['segment'][_0x1aac62(0xc2)](_0x5d54db,_0x48e8bc,_0x5c9837[_0x1aac62(0x104)]['id'])),_0x285a5d[_0x1aac62(0x117)]?.({'type':_0x1aac62(0xec),'segmentName':_0x216c63,'activationName':_0x5c9837[_0x1aac62(0x166)]}),_0x285a5d[_0x1aac62(0x197)]?.(_0x1aac62(0x15a)+_0x5c9837[_0x1aac62(0x166)]+'\x27'),_0x51cdae[_0x1aac62(0x159)]++);}}catch(_0x10f3d3){const _0x2ea403=isHttp400Error(_0x10f3d3),_0x38ac4f=_0x2ea403?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x1aac62(0x1a1)],_0x27a3a5=getErrorMessage(_0x10f3d3);throw new SDKError(_0x38ac4f,'Failed\x20to\x20'+_0x5c9837[_0x1aac62(0x146)]+_0x1aac62(0x18b)+_0x5c9837[_0x1aac62(0x166)]+_0x1aac62(0x119)+_0x59c2f0+'\x0a\x20\x20'+_0x27a3a5,_0x10f3d3);}}return _0x51cdae;}export async function executePushFolders(_0x55b9ed,_0xb84399,_0x47c2f9,_0x5a958e,_0x2ea658){const _0xbc5ec6=a152_0x18f4ba,_0xf33bd3=new Map(_0x47c2f9),_0x1a62ac=sortFoldersByDepth(_0xb84399);for(const _0x2068e2 of _0x1a62ac){const _0x4af5ea=_0x2068e2[_0xbc5ec6(0x141)]('/'),_0x37f390=_0x4af5ea[_0x4af5ea[_0xbc5ec6(0x17e)]-0x1],_0x2b6e6c=_0x4af5ea[_0xbc5ec6(0x120)](0x0,-0x1)[_0xbc5ec6(0x19e)]('/'),_0x4610f0=_0xf33bd3[_0xbc5ec6(0x19d)](_0x2b6e6c);_0x2ea658[_0xbc5ec6(0x117)]?.({'type':_0xbc5ec6(0xc8),'folder':_0x2068e2});const _0x391bd8={'name':_0x37f390,'parentFolderId':_0x4610f0},_0x2ecf10=await _0x2ea658[_0xbc5ec6(0x123)](_0xbc5ec6(0xaf)+_0x2068e2+_0xbc5ec6(0x107),()=>_0x55b9ed[_0xbc5ec6(0x184)][_0xbc5ec6(0xc7)](_0x5a958e[_0xbc5ec6(0x19c)],_0x391bd8));_0xf33bd3[_0xbc5ec6(0x174)](_0x2068e2,_0x2ecf10['data']['id']),_0x2ea658[_0xbc5ec6(0x117)]?.({'type':'folder_created','folder':_0x2068e2,'folderId':_0x2ecf10[_0xbc5ec6(0xbe)]['id']}),_0x2ea658[_0xbc5ec6(0xdf)]?.(_0xbc5ec6(0x124)+_0x2068e2+'\x27');}return _0xf33bd3;}export async function executePushSegmentDeletions(_0x3feba1,_0x45076f,_0x448921){const _0x3b31ea=a152_0x18f4ba;if(_0x45076f[_0x3b31ea(0x17e)]===0x0)return 0x0;const {batchAsync:_0x28950d}=await import(_0x3b31ea(0x1a5)),_0x221f34=0x5,_0x3200b7=await _0x28950d(_0x45076f,async _0x17dfc9=>{const _0x190ca1=_0x3b31ea;return _0x448921[_0x190ca1(0x117)]?.({'type':'segment_deleting','name':_0x17dfc9[_0x190ca1(0x166)]}),await _0x3feba1[_0x190ca1(0x184)][_0x190ca1(0x12b)](_0x17dfc9['id']),_0x448921[_0x190ca1(0x117)]?.({'type':_0x190ca1(0xc9),'name':_0x17dfc9[_0x190ca1(0x166)]}),_0x448921[_0x190ca1(0x197)]?.(_0x190ca1(0x10a)+_0x17dfc9[_0x190ca1(0x166)]+'\x27'),0x1;},_0x221f34);return _0x3200b7[_0x3b31ea(0x14d)]((_0xff17f8,_0x531789)=>_0xff17f8+_0x531789,0x0);}export async function executePushJourneys(_0xa9061a,_0x99b1e8,_0x569b19,_0x378d99,_0x30d5f7){const _0x28cfee=a152_0x18f4ba,{journeyDefToRequest:_0x8db824}=await import(_0x28cfee(0xcd)),{activationDefToCreateRequest:_0x1bc49a,yamlRuleToApi:_0x3a4290,validateSegmentRule:_0x511494}=await import(_0x28cfee(0xc3)),_0x3efce0={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4517c9=new Map(_0x569b19[_0x28cfee(0x16f)]),_0x34a9b9=0x5;for(let _0x4b96af=0x0;_0x4b96af<_0x99b1e8[_0x28cfee(0x17e)];_0x4b96af+=_0x34a9b9){const _0x925b58=_0x99b1e8[_0x28cfee(0x120)](_0x4b96af,_0x4b96af+_0x34a9b9),_0x463f28=await Promise[_0x28cfee(0x1a3)](_0x925b58['map'](async _0x4c5056=>{const _0x522a04=_0x28cfee;if(!_0x4c5056[_0x522a04(0x181)]&&!_0x4c5056['hasChanges'])return{'action':_0x522a04(0xb1),'name':_0x4c5056['yamlConfig'][_0x522a04(0x166)],'journeyId':_0x4c5056[_0x522a04(0xb3)]?.['id']};const _0x1f7d86=_0x4c5056[_0x522a04(0xac)]?_0x569b19[_0x522a04(0x130)]['get'](_0x4c5056[_0x522a04(0xac)]):undefined;_0x30d5f7[_0x522a04(0x117)]?.({'type':_0x4c5056[_0x522a04(0x181)]?_0x522a04(0xaa):_0x522a04(0xe1),'name':_0x4c5056['yamlConfig'][_0x522a04(0x166)]});try{const _0x276d07=await executeSingleJourneyPush(_0xa9061a,_0x4c5056,{..._0x569b19,'segmentNameToId':_0x4517c9},{'parentId':_0x378d99[_0x522a04(0x19c)],'rootFolderId':_0x378d99[_0x522a04(0x122)],'folderId':_0x1f7d86,'verbose':_0x378d99[_0x522a04(0x109)]},_0x30d5f7,{'journeyDefToRequest':_0x8db824,'activationDefToCreateRequest':_0x1bc49a,'yamlRuleToApi':_0x3a4290,'validateSegmentRule':_0x511494});for(const [_0x13cfec,_0x434e37]of _0x276d07[_0x522a04(0x13e)]){_0x4517c9[_0x522a04(0x174)](_0x13cfec,_0x434e37),_0x3efce0[_0x522a04(0x13e)][_0x522a04(0x174)](_0x13cfec,_0x434e37);}if(_0x276d07[_0x522a04(0x1ae)]===_0x522a04(0x190))_0x30d5f7[_0x522a04(0x117)]?.({'type':_0x522a04(0x103),'name':_0x4c5056[_0x522a04(0xf1)][_0x522a04(0x166)],'journeyId':_0x276d07['journeyId']}),_0x30d5f7[_0x522a04(0x12d)]?.(_0x522a04(0x1a8)+_0x4c5056[_0x522a04(0xf1)][_0x522a04(0x166)]+'\x27'),_0x3efce0[_0x522a04(0x190)]++;else _0x276d07[_0x522a04(0x1ae)]==='updated'&&(_0x30d5f7[_0x522a04(0x117)]?.({'type':_0x522a04(0xe0),'name':_0x4c5056[_0x522a04(0xf1)]['name']}),_0x30d5f7[_0x522a04(0x12d)]?.(_0x522a04(0x163)+_0x4c5056[_0x522a04(0xf1)][_0x522a04(0x166)]+'\x27'),_0x3efce0['updated']++);return{'action':_0x276d07[_0x522a04(0x1ae)],'name':_0x4c5056['yamlConfig']['name'],'journeyId':_0x276d07[_0x522a04(0x15b)]};}catch(_0x2ba1b1){const _0x157667=isHttp400Error(_0x2ba1b1),_0x309577=_0x157667?ErrorCode[_0x522a04(0xa7)]:ErrorCode[_0x522a04(0xe8)],_0x289fea=getErrorMessage(_0x2ba1b1);throw new SDKError(_0x309577,_0x522a04(0x1ad)+(_0x4c5056[_0x522a04(0x181)]?_0x522a04(0xe5):_0x522a04(0x12e))+_0x522a04(0xb5)+_0x4c5056[_0x522a04(0x111)]+_0x522a04(0x131)+_0x289fea,_0x2ba1b1);}}));_0x3efce0['results'][_0x28cfee(0xb8)](..._0x463f28);}return _0x3efce0;}async function matchExistingJourneySegments(_0x409263,_0x1c2b64,_0x50be5f,_0x40290a,_0x3c2327){const _0x2e5c53=a152_0x18f4ba;if(!_0x1c2b64[_0x2e5c53(0xb3)]||!_0x1c2b64['yamlConfig']['segments'])return;const _0xbcc94a=new Map(),_0x309fda=new Set();for(const _0x145402 of Object[_0x2e5c53(0x10e)](_0x1c2b64['yamlConfig'][_0x2e5c53(0x19a)])){const _0xf52455=generateDeterministicJourneySegmentName(_0x1c2b64[_0x2e5c53(0xf1)][_0x2e5c53(0x166)],_0x145402);_0xbcc94a[_0x2e5c53(0x174)](_0xf52455,_0x145402),_0x309fda[_0x2e5c53(0x106)](_0x145402);}const _0x3d5708=[],_0x6cea01=collectSegmentIdsFromJourneyApi(_0x1c2b64[_0x2e5c53(0xb3)]);for(const _0x441227 of _0x6cea01){const _0x15ea21=await fetchSegment(_0x409263,_0x50be5f,_0x441227,_0x40290a);if(!_0x15ea21?.[_0x2e5c53(0x166)])continue;const _0x20f5bd=_0xbcc94a['get'](_0x15ea21['name']);_0x20f5bd?(_0x3c2327[_0x2e5c53(0x174)](_0x20f5bd,_0x441227),_0x309fda[_0x2e5c53(0x196)](_0x20f5bd)):_0x3d5708[_0x2e5c53(0xb8)]({'id':_0x441227,'seg':_0x15ea21});}if(_0x309fda['size']>0x0&&_0x3d5708[_0x2e5c53(0x17e)]>0x0){const {localExpandedRuleToNames:_0x4bb33b}=buildLocalExpandedRuleMappings(_0x1c2b64['yamlConfig']),_0x5ef1e5=new Map();for(const {id:_0x450444,seg:_0x1f8396}of _0x3d5708){if(_0x1f8396['rule']){const _0x321485=apiRuleToYaml(_0x1f8396[_0x2e5c53(0x151)]);_0x5ef1e5[_0x2e5c53(0x174)](_0x450444,_0x321485);}}for(const {id:_0x531b43,seg:_0x3eb652}of _0x3d5708){if(!_0x3eb652['rule'])continue;const _0x2d5d31=_0x5ef1e5[_0x2e5c53(0x19d)](_0x531b43);if(!_0x2d5d31)continue;const _0x5bb8a9=serializeExpandedRule(_0x2d5d31,_0x5ef1e5),_0x3fb205=_0x4bb33b['get'](_0x5bb8a9);if(_0x3fb205){const _0x4439d4=_0x3fb205['find'](_0xf67484=>_0x309fda[_0x2e5c53(0x1a4)](_0xf67484));_0x4439d4&&(_0x3c2327[_0x2e5c53(0x174)](_0x4439d4,_0x531b43),_0x309fda[_0x2e5c53(0x196)](_0x4439d4),logger[_0x2e5c53(0xed)](_0x2e5c53(0x1ac)+_0x3eb652[_0x2e5c53(0x166)]+_0x2e5c53(0x12a)+_0x4439d4+_0x2e5c53(0x17c)));}}}}async function executeSingleJourneyPush(_0x4161c4,_0x466a8f,_0x1dab23,_0x3c646e,_0x242c32,_0x215efd){const _0x5db401=a152_0x18f4ba,{journeyDefToRequest:_0x28de25,activationDefToCreateRequest:_0x40a1ad,yamlRuleToApi:_0x5ee0e3,validateSegmentRule:_0x4e9a03}=_0x215efd,_0x3dceeb=new Map(),_0x2fb78b=new Map();recoverSegmentIdsFromPushRecovery(_0x466a8f,_0x3dceeb,_0x1dab23[_0x5db401(0x16f)]);const _0x533a45=new Map(),_0x25d037=new Map(),_0x39f789=new Map();let _0x1246cc;const _0x41f417=async()=>{const _0x5131ad=_0x5db401;if(_0x1246cc)return;_0x1246cc=new Map();if(!_0x466a8f[_0x5131ad(0xb3)])return;const _0x147b8a=await _0x4161c4[_0x5131ad(0x1a2)][_0x5131ad(0x18f)](_0x466a8f[_0x5131ad(0xb3)]['id']);for(const _0x50fad1 of _0x147b8a){const _0x5aea2f=journeyActivationStepToYaml(_0x50fad1,_0x1dab23[_0x5131ad(0x1aa)],_0x1dab23[_0x5131ad(0xdb)]),_0xa94fb5=activationSignature(_0x5aea2f);!_0x1246cc[_0x5131ad(0x1a4)](_0xa94fb5)&&_0x1246cc[_0x5131ad(0x174)](_0xa94fb5,_0x50fad1['id']),_0x5aea2f[_0x5131ad(0x166)]&&_0x2fb78b[_0x5131ad(0x174)](_0x5aea2f[_0x5131ad(0x166)],_0x50fad1['id']);}};await matchExistingJourneySegments(_0x4161c4,_0x466a8f,_0x3c646e['parentId'],_0x1dab23[_0x5db401(0xf5)],_0x1dab23[_0x5db401(0x16f)]);const _0x5b38f0={'resolveSegmentId':async _0x36d6ef=>{const _0xd2923f=_0x5db401,_0x2fcf2b=_0x1dab23[_0xd2923f(0x16f)][_0xd2923f(0x19d)](_0x36d6ef);if(!_0x2fcf2b)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xd2923f(0xbf)+_0x36d6ef+_0xd2923f(0xf0)+_0x466a8f['yamlConfig'][_0xd2923f(0x166)]+')');return _0x2fcf2b;},'resolveEmbeddedSegmentId':async(_0x466604,_0x4da0ec)=>{const _0x2770e7=_0x5db401,_0xb9866e=_0x1dab23['segmentNameToId'][_0x2770e7(0x19d)](_0x466604);if(_0xb9866e)return _0xb9866e;const _0x4fbe59=_0x1dab23[_0x2770e7(0xf5)][_0x2770e7(0x10b)](_0x13bb98=>_0x13bb98[_0x2770e7(0x166)]===_0x466604);if(_0x4fbe59)return _0x1dab23['segmentNameToId']['set'](_0x466604,_0x4fbe59['id']),_0x4fbe59['id'];if(_0x466a8f['isNew']){const {stageName:_0x409e7f,criteriaName:_0x2300db}=findSegmentCriteriaLocation(_0x466a8f[_0x2770e7(0xf1)],_0x466604);return _0x4e9a03(_0x466604,_0x4da0ec['rule']),_0x25d037[_0x2770e7(0x174)](_0x466604,{'definition':_0x4da0ec,'stageName':_0x409e7f,'criteriaName':_0x2300db}),createPendingSegmentId(_0x466604);}const _0x112c20=_0x466a8f[_0x2770e7(0xb3)]?.['id'];if(!_0x112c20)throw new SDKError(ErrorCode[_0x2770e7(0x182)],_0x2770e7(0x16b));const _0x360fc0=_0x533a45[_0x2770e7(0x19d)](_0x466604);if(_0x360fc0)return _0x360fc0;const _0x321b06=((async()=>{const _0xba70e5=_0x2770e7;_0x4e9a03(_0x466604,_0x4da0ec['rule']);const _0x54da2a=generateDeterministicJourneySegmentName(_0x466a8f[_0xba70e5(0xf1)]['name'],_0x466604),_0x3de285=_0x1dab23[_0xba70e5(0xf5)][_0xba70e5(0x10b)](_0x53c0cf=>_0x53c0cf[_0xba70e5(0x166)]===_0x54da2a),_0x52600c=createSegmentIdResolver(_0x1dab23[_0xba70e5(0x16f)],_0x466604),_0x26a58d=await resolveRuleSegmentIds(_0x4da0ec[_0xba70e5(0x151)],_0x52600c);let _0x36835f;return _0x3de285?(await _0x4161c4[_0xba70e5(0x184)][_0xba70e5(0xcf)](_0x3c646e[_0xba70e5(0x19c)],_0x3de285['id'],{'description':_0x4da0ec[_0xba70e5(0x129)]||_0xba70e5(0xfe)+_0x466604,'rule':_0x5ee0e3(_0x26a58d),'countPopulation':!![]}),_0x36835f=_0x3de285['id'],saveSegmentToPushRecovery(_0x466a8f[_0xba70e5(0x111)],_0x466a8f[_0xba70e5(0xf1)]['name'],_0x466604,{'segmentId':_0x36835f,'uniqueServerName':_0x54da2a,'createdAt':new Date()[_0xba70e5(0x171)]()})):_0x36835f=await createOrRecoverEmbeddedSegment(_0x4161c4,_0x466a8f,{'localName':_0x466604,'uniqueSegmentName':_0x54da2a,'description':_0x4da0ec['description']||_0xba70e5(0xfe)+_0x466604,'journeyId':_0x112c20,'resolvedRule':_0x26a58d,'parentId':_0x3c646e[_0xba70e5(0x19c)],'folderId':_0x3c646e[_0xba70e5(0x122)]||''},_0x5ee0e3),_0x1dab23['segmentNameToId'][_0xba70e5(0x174)](_0x466604,_0x36835f),_0x3dceeb[_0xba70e5(0x174)](_0x466604,_0x36835f),_0x36835f;})());_0x533a45[_0x2770e7(0x174)](_0x466604,_0x321b06);try{return await _0x321b06;}finally{_0x533a45[_0x2770e7(0x196)](_0x466604);}},'resolveActivationId':async _0x45f96a=>{const _0x6b2259=_0x5db401,_0x49c069=_0x2fb78b[_0x6b2259(0x19d)](_0x45f96a);if(_0x49c069)return _0x49c069;if(_0x466a8f[_0x6b2259(0xb3)]){await _0x41f417();const _0x4e7a5=_0x2fb78b[_0x6b2259(0x19d)](_0x45f96a);if(_0x4e7a5)return _0x4e7a5;}throw new SDKError(ErrorCode[_0x6b2259(0x15f)],_0x6b2259(0xfa)+_0x45f96a+'\x20(referenced\x20in\x20journey\x20'+_0x466a8f[_0x6b2259(0xf1)][_0x6b2259(0x166)]+_0x6b2259(0x185)+_0x6b2259(0x18a));},'resolveEmbeddedActivationId':async(_0x4c7768,_0xc04151)=>{const _0x75aca4=_0x5db401,_0x3f685c=_0x2fb78b[_0x75aca4(0x19d)](_0x4c7768);if(_0x3f685c)return _0x3f685c;if(_0x466a8f[_0x75aca4(0x181)])return _0x39f789['set'](_0x4c7768,_0xc04151),createPendingActivationId(_0x4c7768);if(_0x466a8f[_0x75aca4(0xb3)]){await _0x41f417();const _0x509915=_0x2fb78b['get'](_0xc04151[_0x75aca4(0x166)]);if(_0x509915)return _0x2fb78b['set'](_0x4c7768,_0x509915),_0x509915;const _0x11f5d1=activationSignature(_0xc04151),_0x8b432e=_0x1246cc?.[_0x75aca4(0x19d)](_0x11f5d1);if(_0x8b432e)return _0x2fb78b[_0x75aca4(0x174)](_0x4c7768,_0x8b432e),_0x8b432e;const _0x53a6a0=await _0x40a1ad(_0xc04151,_0x1dab23['activationContext']),_0x19787d={..._0x53a6a0,..._0xc04151['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0xc04151['run_after_journey_refresh']}},_0x3c93a3=await _0x4161c4[_0x75aca4(0x1a2)][_0x75aca4(0x18c)](_0x466a8f[_0x75aca4(0xb3)]['id'],_0x19787d);return _0x2fb78b[_0x75aca4(0x174)](_0x4c7768,_0x3c93a3['id']),_0x3c93a3['id'];}throw new SDKError(ErrorCode[_0x75aca4(0x182)],_0x75aca4(0xc6));},'resolveJourneyId':async _0x3554fa=>{const _0x825587=_0x5db401;try{return await _0x4161c4[_0x825587(0x1a2)][_0x825587(0x16d)](_0x3c646e[_0x825587(0x19c)],_0x3554fa);}catch(_0x4013c3){throw new SDKError(ErrorCode[_0x825587(0x15f)],'Journey\x20\x27'+_0x3554fa+_0x825587(0x18d)+_0x466a8f[_0x825587(0xf1)][_0x825587(0x166)]+'\x27)',_0x4013c3);}},'resolveStageId':async(_0x2f3628,_0x43d275)=>{const _0x2d9e25=_0x5db401,_0x40d0ed=await _0x4161c4[_0x2d9e25(0x1a2)]['getJourney'](_0x2f3628),_0x292024=_0x40d0ed[_0x2d9e25(0xf3)][_0x2d9e25(0xb9)]['find'](_0x53ce5c=>_0x53ce5c[_0x2d9e25(0x166)][_0x2d9e25(0x15d)]()===_0x43d275['toLowerCase']());if(!_0x292024?.['id'])throw new SDKError(ErrorCode[_0x2d9e25(0x15f)],_0x2d9e25(0xbd)+_0x43d275+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x40d0ed[_0x2d9e25(0xf3)][_0x2d9e25(0x194)]||_0x40d0ed[_0x2d9e25(0xf3)][_0x2d9e25(0x166)])+'\x27');return _0x292024['id'];}},_0x2867ad=await _0x28de25(_0x466a8f[_0x5db401(0xf1)],_0x3c646e[_0x5db401(0x19c)],_0x5b38f0),_0x42d9fc=_0x3c646e['folderId']||_0x3c646e[_0x5db401(0x122)];_0x42d9fc&&(_0x2867ad[_0x5db401(0x113)]={'parentFolder':{'data':{'id':_0x42d9fc,'type':_0x5db401(0x168)}}});if(_0x466a8f['isNew']){if(_0x25d037['size']>0x0||_0x39f789[_0x5db401(0x12f)]>0x0)return await executeThreeStepJourneyCreate(_0x4161c4,_0x466a8f,_0x2867ad,{'pendingEmbeddedSegments':_0x25d037,'pendingEmbeddedActivations':_0x39f789,'embeddedSegmentNameToId':_0x3dceeb,'journeyActivationNameToId':_0x2fb78b},{..._0x3c646e,'effectiveFolderId':_0x42d9fc},_0x1dab23,_0x242c32,_0x215efd);else{ensureJourneyDefaults(_0x2867ad[_0x5db401(0xf3)]);const _0x130108=await _0x4161c4[_0x5db401(0x1a2)][_0x5db401(0xe5)](_0x2867ad);return deletePushRecovery(_0x466a8f['absolutePath']),{'action':_0x5db401(0x190),'journeyId':_0x130108['id'],'embeddedSegmentNameToId':_0x3dceeb};}}else{if(_0x466a8f[_0x5db401(0xeb)]&&_0x466a8f['existingJourney']){_0x2867ad['id']=_0x466a8f[_0x5db401(0xb3)]['id'];const _0x5434f2=_0x2867ad[_0x5db401(0xf3)];_0x466a8f['existingJourney'][_0x5db401(0xf3)]?.[_0x5db401(0x194)]&&(_0x5434f2[_0x5db401(0x194)]=_0x466a8f['existingJourney']['attributes']['journeyBundleName']);const _0x18ff78=_0x466a8f[_0x5db401(0xb3)][_0x5db401(0xf3)]?.['journeyStages'];return _0x18ff78&&_0x2867ad[_0x5db401(0xf3)]['journeyStages']&&injectExistingStageIds(_0x2867ad[_0x5db401(0xf3)][_0x5db401(0xb9)],_0x18ff78),ensureJourneyDefaults(_0x5434f2),await _0x4161c4[_0x5db401(0x1a2)][_0x5db401(0x12e)](_0x466a8f[_0x5db401(0xb3)]['id'],_0x2867ad),deletePushRecovery(_0x466a8f[_0x5db401(0x111)]),{'action':'updated','journeyId':_0x466a8f['existingJourney']['id'],'embeddedSegmentNameToId':_0x3dceeb};}}return deletePushRecovery(_0x466a8f[_0x5db401(0x111)]),{'action':_0x5db401(0xb1),'journeyId':_0x466a8f[_0x5db401(0xb3)]?.['id'],'embeddedSegmentNameToId':_0x3dceeb};}function findSegmentCriteriaLocation(_0x53c9af,_0x5eea34){const _0x4c21ff=a152_0x18f4ba,_0x2d2ef3=_0x53c9af[_0x4c21ff(0x147)]||_0x53c9af[_0x4c21ff(0x125)]?.[0x0]?.['stages']||[];let _0x1e1b1e=_0x4c21ff(0x16a),_0x835bd7=_0x5eea34;const _0x4eed25=_0x53c9af[_0x4c21ff(0x13c)]||_0x53c9af[_0x4c21ff(0x125)]?.[0x0]?.[_0x4c21ff(0x13c)];if(_0x4eed25?.['segment']===_0x5eea34)return{'stageName':_0x4c21ff(0x13c),'criteriaName':_0x4eed25[_0x4c21ff(0x166)]||_0x5eea34};_0x5d108d:for(const _0x281a5b of _0x2d2ef3){if(_0x281a5b[_0x4c21ff(0x136)]?.[_0x4c21ff(0x184)]===_0x5eea34){_0x1e1b1e=_0x281a5b[_0x4c21ff(0x166)],_0x835bd7=_0x281a5b[_0x4c21ff(0x136)][_0x4c21ff(0x166)]||_0x5eea34;break;}if(_0x281a5b['steps'])for(const _0x2fb03b of _0x281a5b['steps']){if(_0x2fb03b[_0x4c21ff(0x146)]===_0x4c21ff(0xae)&&_0x2fb03b[_0x4c21ff(0x101)]?.[_0x4c21ff(0x1af)])for(const _0x5caf2d of _0x2fb03b[_0x4c21ff(0x101)][_0x4c21ff(0x1af)]){if(_0x5caf2d[_0x4c21ff(0x184)]===_0x5eea34){_0x1e1b1e=_0x281a5b['name'],_0x835bd7=_0x5caf2d[_0x4c21ff(0x166)]||_0x5eea34;break _0x5d108d;}}}}return{'stageName':_0x1e1b1e,'criteriaName':_0x835bd7};}async function executeThreeStepJourneyCreate(_0x5bb65f,_0x11df20,_0x81217d,_0xeb037,_0x3331a5,_0x234826,_0x38134e,_0x1bc551){const _0x5f4975=a152_0x18f4ba,{activationDefToCreateRequest:_0x5b04fa,yamlRuleToApi:_0x77c42f}=_0x1bc551,{pendingEmbeddedSegments:_0x22c697,pendingEmbeddedActivations:_0x1a004c,embeddedSegmentNameToId:_0x315fb0}=_0xeb037,_0x39fcd6=JSON[_0x5f4975(0x139)](JSON['stringify'](_0x81217d));ensureJourneyDefaults(_0x39fcd6[_0x5f4975(0xf3)]),stripPendingIds(_0x39fcd6);const _0x269a00=await _0x5bb65f[_0x5f4975(0x1a2)][_0x5f4975(0xe5)](_0x39fcd6),_0x385499=_0x269a00['id'],_0xbd26fd=new Map();for(const _0x1fadea of _0x269a00['attributes']['journeyStages']){_0xbd26fd['set'](_0x1fadea[_0x5f4975(0x166)]['toLowerCase'](),_0x1fadea['id']);}recoverSegmentIdsFromPushRecovery(_0x11df20,_0x315fb0,_0x234826['segmentNameToId']);for(const [_0x3d68d5,{definition:_0x5ba49b}]of _0x22c697){if(_0x315fb0[_0x5f4975(0x1a4)](_0x3d68d5)){_0x38134e[_0x5f4975(0x117)]?.({'type':_0x5f4975(0xcc),'journeyName':_0x11df20[_0x5f4975(0xf1)]['name'],'segmentName':_0x3d68d5});continue;}const _0x524e02=generateDeterministicJourneySegmentName(_0x11df20[_0x5f4975(0xf1)][_0x5f4975(0x166)],_0x3d68d5);_0x38134e['onProgress']?.({'type':_0x5f4975(0x115),'journeyName':_0x11df20['yamlConfig'][_0x5f4975(0x166)],'segmentName':_0x3d68d5});const _0x49c1bb=createSegmentIdResolver(_0x234826[_0x5f4975(0x16f)],_0x3d68d5),_0xd319ca=await resolveRuleSegmentIds(_0x5ba49b['rule'],_0x49c1bb),_0x1f3676=await createOrRecoverEmbeddedSegment(_0x5bb65f,_0x11df20,{'localName':_0x3d68d5,'uniqueSegmentName':_0x524e02,'description':_0x5ba49b['description']||_0x5f4975(0xfe)+_0x3d68d5,'journeyId':_0x385499,'resolvedRule':_0xd319ca,'parentId':_0x3331a5[_0x5f4975(0x19c)],'folderId':_0x3331a5[_0x5f4975(0x152)]||''},_0x77c42f);_0x315fb0[_0x5f4975(0x174)](_0x3d68d5,_0x1f3676),_0x234826[_0x5f4975(0x16f)]['set'](_0x3d68d5,_0x1f3676),_0x38134e['onProgress']?.({'type':_0x5f4975(0xcc),'journeyName':_0x11df20['yamlConfig']['name'],'segmentName':_0x3d68d5});}const _0x28853d=new Map();for(const [_0x1480fd,_0x2b43b8]of _0x1a004c){_0x38134e['onProgress']?.({'type':_0x5f4975(0xff),'journeyName':_0x11df20['yamlConfig']['name'],'activationName':_0x1480fd});const _0x25142f=await _0x5b04fa(_0x2b43b8,_0x234826['activationContext']),_0x5b2d90={..._0x25142f,..._0x2b43b8['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x2b43b8[_0x5f4975(0xb0)]}},_0x198e11=await _0x5bb65f['journey'][_0x5f4975(0x18c)](_0x385499,_0x5b2d90);_0x28853d[_0x5f4975(0x174)](_0x1480fd,_0x198e11['id']),_0xeb037[_0x5f4975(0xad)][_0x5f4975(0x174)](_0x1480fd,_0x198e11['id']),_0x38134e['onProgress']?.({'type':_0x5f4975(0xd1),'journeyName':_0x11df20[_0x5f4975(0xf1)][_0x5f4975(0x166)],'activationName':_0x1480fd});}const _0xded31b=JSON[_0x5f4975(0x139)](JSON[_0x5f4975(0x11d)](_0x81217d));return _0xded31b['id']=_0x385499,ensureJourneyDefaults(_0xded31b[_0x5f4975(0xf3)]),resolvePendingIdsInRequest(_0xded31b,_0x81217d,_0xbd26fd,_0x315fb0,_0x28853d,_0x38134e),await _0x5bb65f[_0x5f4975(0x1a2)][_0x5f4975(0x12e)](_0x385499,_0xded31b),deletePushRecovery(_0x11df20['absolutePath']),{'action':_0x5f4975(0x190),'journeyId':_0x385499,'embeddedSegmentNameToId':_0x315fb0};}export function stripWaitStepPendingIds(_0x370ad5){const _0x47b909=a152_0x18f4ba,_0x36d2b0=_0x370ad5['conditionSegmentId']&&isPendingSegmentId(_0x370ad5[_0x47b909(0x11e)]),_0x32d250=_0x370ad5['conditions']?.[_0x47b909(0xab)](_0x14afa3=>_0x14afa3['segmentId']&&isPendingSegmentId(_0x14afa3[_0x47b909(0xef)]));(_0x36d2b0||_0x32d250)&&(_0x370ad5[_0x47b909(0x158)]='Duration',_0x370ad5[_0x47b909(0x14f)]=0x1,_0x370ad5[_0x47b909(0x1a9)]=_0x47b909(0xb7),delete _0x370ad5[_0x47b909(0x11e)],delete _0x370ad5[_0x47b909(0x192)],delete _0x370ad5[_0x47b909(0x193)],delete _0x370ad5[_0x47b909(0x155)]);}export function resolveWaitStepPendingIds(_0x284731,_0x2ace34,_0x293ec0,_0x46ce42){const _0x294e9e=a152_0x18f4ba;if(_0x2ace34['conditionSegmentId']&&isPendingSegmentId(_0x2ace34[_0x294e9e(0x11e)])){const _0x1d5558=_0x293ec0(_0x2ace34['conditionSegmentId'],_0x294e9e(0xda)+_0x46ce42+'\x27\x20wait\x20condition');_0x1d5558&&(_0x284731['waitStepType']=_0x294e9e(0x187),_0x284731[_0x294e9e(0x11e)]=_0x1d5558,delete _0x284731[_0x294e9e(0x14f)],delete _0x284731[_0x294e9e(0x1a9)],_0x2ace34['conditionTimeoutDuration']!==undefined&&(_0x284731['conditionTimeoutDuration']=_0x2ace34[_0x294e9e(0x192)]),_0x2ace34[_0x294e9e(0x193)]&&(_0x284731['conditionTimeoutUnit']=_0x2ace34[_0x294e9e(0x193)]));}if(_0x2ace34[_0x294e9e(0x155)]){const _0x41f00e=_0x2ace34['conditions'][_0x294e9e(0xab)](_0x40e443=>_0x40e443[_0x294e9e(0xef)]&&isPendingSegmentId(_0x40e443[_0x294e9e(0xef)]));if(_0x41f00e){const _0x4fa1e1=_0x2ace34[_0x294e9e(0x155)][_0x294e9e(0x19f)](_0x566b9f=>{const _0x4172ea=_0x294e9e;if(_0x566b9f['segmentId']&&isPendingSegmentId(_0x566b9f[_0x4172ea(0xef)])){const _0x467036=_0x293ec0(_0x566b9f[_0x4172ea(0xef)],_0x4172ea(0xda)+_0x46ce42+_0x4172ea(0xc1));return{..._0x566b9f,'segmentId':_0x467036||_0x566b9f[_0x4172ea(0xef)]};}return{..._0x566b9f};});_0x284731[_0x294e9e(0x158)]=_0x294e9e(0x187),_0x284731[_0x294e9e(0x155)]=_0x4fa1e1,delete _0x284731['waitStep'],delete _0x284731[_0x294e9e(0x1a9)],delete _0x284731['conditionSegmentId'],delete _0x284731[_0x294e9e(0x192)],delete _0x284731[_0x294e9e(0x193)];}}}function stripPendingIds(_0x41213c){const _0x5bd0df=a152_0x18f4ba;_0x41213c[_0x5bd0df(0xf3)][_0x5bd0df(0x13c)]?.[_0x5bd0df(0xef)]&&isPendingSegmentId(_0x41213c[_0x5bd0df(0xf3)][_0x5bd0df(0x13c)][_0x5bd0df(0xef)])&&delete _0x41213c[_0x5bd0df(0xf3)]['goal'];for(const _0x2a7362 of _0x41213c['attributes'][_0x5bd0df(0xb9)]||[]){_0x2a7362[_0x5bd0df(0xde)]?.['segmentId']&&isPendingSegmentId(_0x2a7362[_0x5bd0df(0xde)][_0x5bd0df(0xef)])&&delete _0x2a7362[_0x5bd0df(0xde)];_0x2a7362[_0x5bd0df(0x177)]?.['segmentId']&&isPendingSegmentId(_0x2a7362[_0x5bd0df(0x177)][_0x5bd0df(0xef)])&&delete _0x2a7362['milestone'];_0x2a7362[_0x5bd0df(0x11b)]&&(_0x2a7362['exitCriterias']=_0x2a7362[_0x5bd0df(0x11b)][_0x5bd0df(0x121)](_0x5a0da0=>!_0x5a0da0[_0x5bd0df(0xef)]||!isPendingSegmentId(_0x5a0da0[_0x5bd0df(0xef)])));if(_0x2a7362[_0x5bd0df(0x13d)])for(const _0x41f4e4 of Object[_0x5bd0df(0x10e)](_0x2a7362[_0x5bd0df(0x13d)])){const _0x9d4f6a=_0x2a7362[_0x5bd0df(0x13d)][_0x41f4e4];_0x9d4f6a[_0x5bd0df(0x146)]===_0x5bd0df(0x15e)&&_0x9d4f6a[_0x5bd0df(0xb6)]&&isPendingActivationId(_0x9d4f6a[_0x5bd0df(0xb6)])&&(_0x9d4f6a[_0x5bd0df(0xb6)]='');if(_0x9d4f6a[_0x5bd0df(0x146)]===_0x5bd0df(0x10f)&&_0x9d4f6a[_0x5bd0df(0x1af)])for(const _0x1c442d of _0x9d4f6a[_0x5bd0df(0x1af)]){_0x1c442d[_0x5bd0df(0xef)]&&isPendingSegmentId(_0x1c442d[_0x5bd0df(0xef)])&&(_0x1c442d[_0x5bd0df(0xef)]='');}_0x9d4f6a[_0x5bd0df(0x146)]===_0x5bd0df(0xbb)&&stripWaitStepPendingIds(_0x9d4f6a);}}}function resolvePendingIdsInRequest(_0x5b1bc1,_0x512e9a,_0x109500,_0x2a3cbc,_0x81d38f,_0x371a10){const _0x5481dc=a152_0x18f4ba,_0x527b3b=(_0x1234a2,_0x292b78)=>{const _0x350318=a152_0x3e6f;if(!isPendingSegmentId(_0x1234a2))return _0x1234a2;const _0x2affdf=extractPendingSegmentName(_0x1234a2),_0x474367=_0x2a3cbc['get'](_0x2affdf);return!_0x474367&&_0x371a10[_0x350318(0x188)]?.(_0x350318(0xd2)+_0x2affdf+'\x27\x20for\x20'+_0x292b78),_0x474367;};if(_0x5b1bc1[_0x5481dc(0xf3)]['goal']?.['segmentId']&&isPendingSegmentId(_0x5b1bc1[_0x5481dc(0xf3)][_0x5481dc(0x13c)]['segmentId'])){const _0x3569c9=_0x527b3b(_0x5b1bc1[_0x5481dc(0xf3)]['goal'][_0x5481dc(0xef)],'goal\x20criteria');_0x3569c9&&(_0x5b1bc1['attributes']['goal'][_0x5481dc(0xef)]=_0x3569c9);}for(const _0x3edc80 of _0x5b1bc1[_0x5481dc(0xf3)][_0x5481dc(0xb9)]||[]){const _0x243db5=_0x109500['get'](_0x3edc80[_0x5481dc(0x166)][_0x5481dc(0x15d)]());_0x243db5&&(_0x3edc80['id']=_0x243db5);if(_0x3edc80['entryCriteria']?.[_0x5481dc(0xef)]&&isPendingSegmentId(_0x3edc80['entryCriteria'][_0x5481dc(0xef)])){const _0x2d0dd6=_0x527b3b(_0x3edc80[_0x5481dc(0xde)][_0x5481dc(0xef)],_0x5481dc(0xda)+_0x3edc80[_0x5481dc(0x166)]+_0x5481dc(0x1a7));_0x2d0dd6&&(_0x3edc80[_0x5481dc(0xde)][_0x5481dc(0xef)]=_0x2d0dd6);}if(_0x3edc80[_0x5481dc(0x11b)])for(const _0x3d2d72 of _0x3edc80[_0x5481dc(0x11b)]){if(_0x3d2d72['segmentId']&&isPendingSegmentId(_0x3d2d72[_0x5481dc(0xef)])){const _0x503832=_0x527b3b(_0x3d2d72[_0x5481dc(0xef)],_0x5481dc(0xda)+_0x3edc80[_0x5481dc(0x166)]+_0x5481dc(0xfc));_0x503832&&(_0x3d2d72[_0x5481dc(0xef)]=_0x503832);}}if(_0x3edc80['milestone']?.[_0x5481dc(0xef)]&&isPendingSegmentId(_0x3edc80[_0x5481dc(0x177)][_0x5481dc(0xef)])){const _0x4013a3=_0x527b3b(_0x3edc80[_0x5481dc(0x177)][_0x5481dc(0xef)],_0x5481dc(0xda)+_0x3edc80[_0x5481dc(0x166)]+_0x5481dc(0xf4));_0x4013a3&&(_0x3edc80[_0x5481dc(0x177)][_0x5481dc(0xef)]=_0x4013a3);}if(_0x3edc80['steps']){const _0x55d972=_0x318e0f=>_0x512e9a['attributes']['journeyStages']?.['find'](_0x40b4c0=>_0x40b4c0[_0x5481dc(0x166)][_0x5481dc(0x15d)]()===_0x3edc80[_0x5481dc(0x166)]['toLowerCase']())?.[_0x5481dc(0x13d)]?.[_0x318e0f];for(const _0x21a260 of Object[_0x5481dc(0x10e)](_0x3edc80[_0x5481dc(0x13d)])){const _0x58fbf6=_0x3edc80[_0x5481dc(0x13d)][_0x21a260],_0x3daf99=_0x55d972(_0x21a260);if(_0x58fbf6[_0x5481dc(0x146)]==='Activation'&&_0x58fbf6[_0x5481dc(0xb6)]&&(isPendingActivationId(_0x58fbf6['journeyActivationStepId'])||_0x58fbf6['journeyActivationStepId']==='')){if(_0x3daf99?.[_0x5481dc(0xb6)]&&isPendingActivationId(_0x3daf99[_0x5481dc(0xb6)])){const _0xad0338=extractPendingActivationName(_0x3daf99[_0x5481dc(0xb6)]),_0x15d15d=_0x81d38f[_0x5481dc(0x19d)](_0xad0338);_0x15d15d&&(_0x58fbf6[_0x5481dc(0xb6)]=_0x15d15d);}}if(_0x58fbf6[_0x5481dc(0x146)]==='DecisionPoint'&&_0x58fbf6['branches']&&_0x3daf99?.[_0x5481dc(0x1af)])for(let _0x76e17b=0x0;_0x76e17b<_0x58fbf6[_0x5481dc(0x1af)]['length'];_0x76e17b++){const _0x22d46f=_0x58fbf6[_0x5481dc(0x1af)][_0x76e17b],_0x568e6c=_0x3daf99['branches'][_0x76e17b];if(_0x568e6c?.[_0x5481dc(0xef)]&&isPendingSegmentId(_0x568e6c[_0x5481dc(0xef)])){const _0x1e2900=_0x527b3b(_0x568e6c[_0x5481dc(0xef)],_0x5481dc(0xda)+_0x3edc80[_0x5481dc(0x166)]+_0x5481dc(0xe2)+(_0x22d46f['name']||_0x76e17b)+'\x27');_0x1e2900&&(_0x22d46f['segmentId']=_0x1e2900);}}_0x58fbf6[_0x5481dc(0x146)]===_0x5481dc(0xbb)&&_0x3daf99?.[_0x5481dc(0x146)]===_0x5481dc(0xbb)&&resolveWaitStepPendingIds(_0x58fbf6,_0x3daf99,_0x527b3b,_0x3edc80[_0x5481dc(0x166)]);}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a153_0x1f4a(_0x54ae2d,_0x31b01d){_0x54ae2d=_0x54ae2d-0x120;const _0x313373=a153_0x3133();let _0x1f4a83=_0x313373[_0x54ae2d];return _0x1f4a83;}(function(_0x28e841,_0xdbd75c){const _0x2d5e06=a153_0x1f4a,_0x1f5bd1=_0x28e841();while(!![]){try{const _0x9c5a1=-parseInt(_0x2d5e06(0x12a))/0x1*(parseInt(_0x2d5e06(0x124))/0x2)+-parseInt(_0x2d5e06(0x123))/0x3*(-parseInt(_0x2d5e06(0x12e))/0x4)+parseInt(_0x2d5e06(0x125))/0x5+parseInt(_0x2d5e06(0x122))/0x6*(parseInt(_0x2d5e06(0x129))/0x7)+-parseInt(_0x2d5e06(0x130))/0x8+-parseInt(_0x2d5e06(0x128))/0x9*(parseInt(_0x2d5e06(0x120))/0xa)+parseInt(_0x2d5e06(0x127))/0xb;if(_0x9c5a1===_0xdbd75c)break;else _0x1f5bd1['push'](_0x1f5bd1['shift']());}catch(_0x35b142){_0x1f5bd1['push'](_0x1f5bd1['shift']());}}}(a153_0x3133,0x9bb09));export function buildFolderIdToPathMap(_0x33d1e0){const _0xc00a70=a153_0x1f4a,_0x11af81=new Map(),_0x5ca50d=new Map();for(const _0x52db75 of _0x33d1e0){_0x5ca50d[_0xc00a70(0x126)](_0x52db75['id'],_0x52db75);}const _0x5506e5=new Set();for(const _0x37da15 of _0x33d1e0){!_0x37da15[_0xc00a70(0x12d)]&&_0x5506e5[_0xc00a70(0x12b)](_0x37da15['id']);}function _0x1080d7(_0x52dfa2){const _0x50cb47=_0xc00a70;if(_0x11af81[_0x50cb47(0x121)](_0x52dfa2['id']))return _0x11af81[_0x50cb47(0x12f)](_0x52dfa2['id']);if(_0x5506e5['has'](_0x52dfa2['id']))return _0x11af81[_0x50cb47(0x126)](_0x52dfa2['id'],''),'';if(_0x52dfa2[_0x50cb47(0x12d)]){const _0x210d71=_0x5ca50d[_0x50cb47(0x12f)](_0x52dfa2[_0x50cb47(0x12d)]);if(_0x210d71){const _0x24b074=_0x1080d7(_0x210d71),_0x12c64a=_0x24b074?_0x24b074+'/'+_0x52dfa2[_0x50cb47(0x12c)]:_0x52dfa2[_0x50cb47(0x12c)];return _0x11af81[_0x50cb47(0x126)](_0x52dfa2['id'],_0x12c64a),_0x12c64a;}}const _0x4caa6c=_0x52dfa2['name'];return _0x11af81[_0x50cb47(0x126)](_0x52dfa2['id'],_0x4caa6c),_0x4caa6c;}for(const _0x456131 of _0x33d1e0){_0x1080d7(_0x456131);}return _0x11af81;}export function buildFolderPathToIdMap(_0x52ef68){const _0x524b7a=a153_0x1f4a,_0x1c816e=new Map(),_0x117964=new Map();for(const _0x33184c of _0x52ef68){_0x117964[_0x524b7a(0x126)](_0x33184c['id'],_0x33184c);}const _0x2d9039=new Set();for(const _0x5eee54 of _0x52ef68){!_0x5eee54[_0x524b7a(0x12d)]&&_0x2d9039[_0x524b7a(0x12b)](_0x5eee54['id']);}function _0x3b5623(_0x3de36c){const _0x52624f=_0x524b7a;if(_0x2d9039['has'](_0x3de36c['id']))return'';if(_0x3de36c['parentFolderId']){const _0xa826d2=_0x117964[_0x52624f(0x12f)](_0x3de36c[_0x52624f(0x12d)]);if(_0xa826d2){const _0x441331=_0x3b5623(_0xa826d2);return _0x441331?_0x441331+'/'+_0x3de36c[_0x52624f(0x12c)]:_0x3de36c[_0x52624f(0x12c)];}}return _0x3de36c['name'];}for(const _0x32b48f of _0x52ef68){const _0x5c248b=_0x3b5623(_0x32b48f);_0x1c816e['set'](_0x5c248b,_0x32b48f['id']);}return _0x1c816e;}function a153_0x3133(){const _0x2e21f9=['9930160NGdFCk','has','18ehgxiN','5982mzkNtL','1231570hMeQDr','3897215eAKXmD','set','5991161hogNHe','9wCpJlc','2080904PpvmVA','2dUXlDh','add','name','parentFolderId','1736QierBB','get','1752120QtEjRM'];a153_0x3133=function(){return _0x2e21f9;};return a153_0x3133();}export function buildFolderMaps(_0x15c5ab){const _0x530575=buildFolderIdToPathMap(_0x15c5ab),_0xc89e38=new Map();for(const [_0x2fc3fc,_0x399a2e]of _0x530575){_0xc89e38['set'](_0x399a2e,_0x2fc3fc);}return{'idToPath':_0x530575,'pathToId':_0xc89e38};}export function getFolderPath(_0x49fefb,_0x20ef6b){const _0x167e5a=a153_0x1f4a;if(!_0x49fefb)return'';return _0x20ef6b[_0x167e5a(0x12f)](_0x49fefb)??'';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3d7509,_0x531ff4){const _0x548b79=a154_0x3b92,_0x45a0d9=_0x3d7509();while(!![]){try{const _0x51cd88=-parseInt(_0x548b79(0x9a))/0x1+-parseInt(_0x548b79(0x8d))/0x2*(parseInt(_0x548b79(0xb5))/0x3)+-parseInt(_0x548b79(0xba))/0x4*(-parseInt(_0x548b79(0xad))/0x5)+-parseInt(_0x548b79(0x91))/0x6*(-parseInt(_0x548b79(0xa0))/0x7)+-parseInt(_0x548b79(0xa9))/0x8*(-parseInt(_0x548b79(0xaf))/0x9)+parseInt(_0x548b79(0x92))/0xa*(parseInt(_0x548b79(0xa1))/0xb)+-parseInt(_0x548b79(0x8f))/0xc;if(_0x51cd88===_0x531ff4)break;else _0x45a0d9['push'](_0x45a0d9['shift']());}catch(_0x3a0153){_0x45a0d9['push'](_0x45a0d9['shift']());}}}(a154_0x165f,0x798ce));import a154_0x1885cb from'path';function a154_0x3b92(_0x5c1d75,_0x9801fd){_0x5c1d75=_0x5c1d75-0x8b;const _0x165f01=a154_0x165f();let _0x3b92d9=_0x165f01[_0x5c1d75];return _0x3b92d9;}import{parse as a154_0xd0275e}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x4545b5){const _0x55faf6=a154_0x3b92;if(!_0x4545b5||_0x4545b5[_0x55faf6(0xa8)]()==='')throw new Error(_0x55faf6(0xaa));const _0x4ae819=_0x4545b5[_0x55faf6(0xa8)]();if(_0x4ae819==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x4545b5};const _0x3a7755=_0x4ae819['startsWith']('/')?_0x4ae819[_0x55faf6(0x9f)](0x1):_0x4ae819,_0x37a078=_0x3a7755['split']('/')[_0x55faf6(0xb0)](_0x4f6a52=>_0x4f6a52!=='');if(_0x37a078['length']===0x0)throw new Error(_0x55faf6(0x97));const _0x409046=_0x4ae819['startsWith']('/')||!isRelativePathSegment(_0x37a078[0x0]);for(const _0xf06e40 of _0x37a078){validatePathSegment(_0xf06e40);}return{'segments':_0x37a078,'isAbsolute':_0x409046,'raw':_0x4545b5};}function isRelativePathSegment(_0x5c69bb){return _0x5c69bb==='.'||_0x5c69bb==='..';}function validatePathSegment(_0x36bec6){const _0x4e8625=a154_0x3b92;if(_0x36bec6==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x36bec6==='.'||_0x36bec6==='..')return;if(/[\x00-\x1F\x7F]/[_0x4e8625(0xa6)](_0x36bec6))throw new Error(_0x4e8625(0xb4)+_0x36bec6);if(_0x36bec6!==_0x36bec6[_0x4e8625(0xa8)]()){}}export function validatePath(_0x10c0b3){const _0x2907a4=a154_0x3b92;if(_0x10c0b3[_0x2907a4(0x9e)][_0x2907a4(0xac)]===0x0&&!_0x10c0b3[_0x2907a4(0xb3)])throw new Error(_0x2907a4(0x95));if(_0x10c0b3[_0x2907a4(0xb3)]){if(_0x10c0b3[_0x2907a4(0x9e)][0x0]==='..')throw new Error(_0x2907a4(0x94));let _0x22ee03=0x0;for(const _0x13e181 of _0x10c0b3[_0x2907a4(0x9e)]){if(_0x13e181==='..'){if(_0x22ee03===0x0)throw new Error(_0x2907a4(0x9c));_0x22ee03--;}else _0x13e181!=='.'&&_0x22ee03++;}}}export function joinPaths(_0x38bf9c,_0x2f8c30){const _0x2e4a82=a154_0x3b92;if(!_0x38bf9c||_0x38bf9c==='/')return _0x2f8c30;if(!_0x2f8c30||_0x2f8c30==='.')return _0x38bf9c;if(_0x2f8c30[_0x2e4a82(0x9b)]('/'))return _0x2f8c30;const _0x44c948=parsePath(_0x38bf9c),_0x3eb89a=parsePath(_0x2f8c30),_0x31a0b8=[..._0x44c948['segments']];for(const _0x12c46d of _0x3eb89a[_0x2e4a82(0x9e)]){if(_0x12c46d==='.')continue;else{if(_0x12c46d==='..'){if(_0x31a0b8[_0x2e4a82(0xac)]===0x0)throw new Error(_0x2e4a82(0x8c));_0x31a0b8[_0x2e4a82(0x96)]();}else _0x31a0b8['push'](_0x12c46d);}}const _0x125624=_0x31a0b8[_0x2e4a82(0x9d)]('/');return _0x44c948[_0x2e4a82(0x8e)][_0x2e4a82(0x9b)]('/')?'/'+_0x125624:_0x125624;}function a154_0x165f(){const _0x5cb1fe=['push','readFile','104zXmUkT','type','exists','Cannot\x20navigate\x20above\x20root','165118ipiRiC','raw','1219884GTyvSN','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','468komhHq','1687270aTKZnp','.yaml','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','Relative\x20path\x20cannot\x20be\x20empty','pop','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','journey','File\x20not\x20found:\x20','155520IQQJbm','startsWith','Path\x20attempts\x20to\x20navigate\x20above\x20root','join','segments','substring','5957iCyVCc','44TJyZhp','parse','parent_segment','tdx.json','resolve','test','name','trim','615968FvLJgJ','Path\x20cannot\x20be\x20empty','root','length','130730tzTXsd','relative','9FxPkLi','filter','No\x20tdx.json\x20found\x20for\x20file:\x20','.yml','isAbsolute','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','27kankjy','slice','dirname'];a154_0x165f=function(){return _0x5cb1fe;};return a154_0x165f();}export function normalizePath(_0x293a8f){const _0xfeea8d=a154_0x3b92,_0x168af6=parsePath(_0x293a8f),_0x37e334=[];for(const _0x43931a of _0x168af6[_0xfeea8d(0x9e)]){if(_0x43931a==='.')continue;else{if(_0x43931a==='..'){if(_0x37e334[_0xfeea8d(0xac)]===0x0){if(_0x168af6[_0xfeea8d(0xb3)])throw new Error(_0xfeea8d(0x8c));_0x37e334[_0xfeea8d(0xb8)]('..');}else _0x37e334[_0x37e334[_0xfeea8d(0xac)]-0x1]==='..'?_0x37e334['push']('..'):_0x37e334['pop']();}else _0x37e334[_0xfeea8d(0xb8)](_0x43931a);}}if(_0x37e334[_0xfeea8d(0xac)]===0x0)return _0x168af6[_0xfeea8d(0xb3)]?'/':'.';const _0x338474=_0x37e334[_0xfeea8d(0x9d)]('/');return _0x168af6[_0xfeea8d(0x8e)][_0xfeea8d(0x9b)]('/')?'/'+_0x338474:_0x338474;}export function getParentPath(_0x11722f){const _0x254a80=a154_0x3b92,_0xa0279a=parsePath(_0x11722f);if(_0xa0279a['segments'][_0x254a80(0xac)]<=0x1)return'/';const _0x1c4ef7=_0xa0279a[_0x254a80(0x9e)][_0x254a80(0xb6)](0x0,-0x1)[_0x254a80(0x9d)]('/');return _0xa0279a['raw'][_0x254a80(0x9b)]('/')?'/'+_0x1c4ef7:_0x1c4ef7;}export function getBaseName(_0x225a01){const _0x4476aa=a154_0x3b92,_0x186f37=parsePath(_0x225a01);return _0x186f37['segments'][_0x186f37[_0x4476aa(0x9e)][_0x4476aa(0xac)]-0x1]||'';}export function isChildPath(_0xd7951a,_0x4f17ec){const _0x541545=a154_0x3b92,_0x15e4f7=parsePath(_0xd7951a),_0x1f449a=parsePath(_0x4f17ec);if(_0x15e4f7[_0x541545(0x9e)][_0x541545(0xac)]<=_0x1f449a[_0x541545(0x9e)][_0x541545(0xac)])return![];for(let _0xfb7da1=0x0;_0xfb7da1<_0x1f449a[_0x541545(0x9e)][_0x541545(0xac)];_0xfb7da1++){if(_0x15e4f7['segments'][_0xfb7da1]!==_0x1f449a[_0x541545(0x9e)][_0xfb7da1])return![];}return!![];}export function splitPath(_0x1f4527){const _0x3f67f4=a154_0x3b92,_0x20c661=parsePath(_0x1f4527);if(_0x20c661[_0x3f67f4(0x9e)][_0x3f67f4(0xac)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x20c661[_0x3f67f4(0x9e)][_0x3f67f4(0xac)]===0x1)return{'parent':_0x20c661[_0x3f67f4(0x9e)][0x0]};return{'parent':_0x20c661[_0x3f67f4(0x9e)][0x0],'child':_0x20c661[_0x3f67f4(0x9e)]['slice'](0x1)[_0x3f67f4(0x9d)]('/')};}export function isYamlFilePath(_0x905027){const _0x263bce=a154_0x3b92;return _0x905027['endsWith'](_0x263bce(0xb2))||_0x905027['endsWith'](_0x263bce(0x93));}export async function resolveYamlFilePath(_0x1e51a9,_0x10f808=nodeFileSystem){const _0x53e9af=a154_0x3b92,_0x245773=a154_0x1885cb[_0x53e9af(0xa5)](_0x1e51a9);if(!await _0x10f808[_0x53e9af(0x8b)](_0x245773))throw new Error(_0x53e9af(0x99)+_0x1e51a9);let _0x1b0142=a154_0x1885cb[_0x53e9af(0xb7)](_0x245773),_0x3debc4=null,_0x1e7151=null;const _0x4aafaa=a154_0x1885cb[_0x53e9af(0xa2)](_0x1b0142)[_0x53e9af(0xab)];while(_0x1b0142!==_0x4aafaa){const _0x34e1e7=a154_0x1885cb['join'](_0x1b0142,_0x53e9af(0xa4));if(await _0x10f808[_0x53e9af(0x8b)](_0x34e1e7)){_0x3debc4=_0x34e1e7,_0x1e7151=_0x1b0142;break;}_0x1b0142=a154_0x1885cb[_0x53e9af(0xb7)](_0x1b0142);}if(!_0x3debc4||!_0x1e7151)throw new Error(_0x53e9af(0xb1)+_0x1e51a9+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x1ce0e3=await _0x10f808[_0x53e9af(0xb9)](_0x3debc4),_0x26dfc4=JSON[_0x53e9af(0xa2)](_0x1ce0e3),_0x25d7f1=_0x26dfc4[_0x53e9af(0xa3)];if(!_0x25d7f1)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x5169eb=await _0x10f808['readFile'](_0x245773),_0x57744e=a154_0xd0275e(_0x5169eb),_0x243e3a=_0x57744e[_0x53e9af(0xa7)];if(!_0x243e3a)throw new Error(_0x53e9af(0x90)+_0x1e51a9);const _0x4be6c2=_0x57744e[_0x53e9af(0xbb)]===_0x53e9af(0x98)?_0x53e9af(0x98):'segment',_0x4d39c6=a154_0x1885cb[_0x53e9af(0xae)](_0x1e7151,_0x245773),_0x2f86ce=a154_0x1885cb['dirname'](_0x4d39c6),_0x3a473d=_0x2f86ce==='.'?'':_0x2f86ce['replace'](/\\/g,'/'),_0x1ba9bc=_0x3a473d?_0x25d7f1+'/'+_0x3a473d+'/'+_0x243e3a:_0x25d7f1+'/'+_0x243e3a;return{'parentSegment':_0x25d7f1,'segmentName':_0x243e3a,'folderPath':_0x3a473d,'fullPath':_0x1ba9bc,'resourceType':_0x4be6c2,'content':_0x5169eb};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a155_0x58be(_0x5b98cc,_0x7cdba8){_0x5b98cc=_0x5b98cc-0x100;const _0x4828d7=a155_0x4828();let _0x58bef0=_0x4828d7[_0x5b98cc];return _0x58bef0;}function a155_0x4828(){const _0x4e86d2=['7349405RFdMvK','5160gqshJU','.\x20Parent\x20name\x20cannot\x20be\x20empty','8581536sShRqi','15834YpYkCE','1199246qTozMX','3939ccmcGc','9194592riEhTr','11820wCFuEe','Invalid\x20segment\x20reference\x20format:\x20','indexOf','4wrLZby','1004SDHzny','substring','.\x20Child\x20name\x20cannot\x20be\x20empty','19140xjKwZJ'];a155_0x4828=function(){return _0x4e86d2;};return a155_0x4828();}(function(_0x5edce3,_0xcdb980){const _0x10a5d0=a155_0x58be,_0x279591=_0x5edce3();while(!![]){try{const _0x40cd6c=parseInt(_0x10a5d0(0x106))/0x1+parseInt(_0x10a5d0(0x10d))/0x2*(-parseInt(_0x10a5d0(0x107))/0x3)+parseInt(_0x10a5d0(0x10c))/0x4*(-parseInt(_0x10a5d0(0x101))/0x5)+parseInt(_0x10a5d0(0x108))/0x6+parseInt(_0x10a5d0(0x105))/0x7*(parseInt(_0x10a5d0(0x102))/0x8)+parseInt(_0x10a5d0(0x104))/0x9+-parseInt(_0x10a5d0(0x109))/0xa*(parseInt(_0x10a5d0(0x100))/0xb);if(_0x40cd6c===_0xcdb980)break;else _0x279591['push'](_0x279591['shift']());}catch(_0x57b23d){_0x279591['push'](_0x279591['shift']());}}}(a155_0x4828,0xea015));export function parseSegmentRef(_0x5efb55){const _0x1d4c9b=a155_0x58be,_0x54d910=_0x5efb55[_0x1d4c9b(0x10b)]('/');if(_0x54d910===-0x1)return{'parentId':_0x5efb55};if(_0x54d910===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x5efb55+_0x1d4c9b(0x103));const _0x1ed453=_0x5efb55[_0x1d4c9b(0x10e)](0x0,_0x54d910),_0xd91d95=_0x5efb55[_0x1d4c9b(0x10e)](_0x54d910+0x1);if(_0xd91d95==='')throw new Error(_0x1d4c9b(0x10a)+_0x5efb55+_0x1d4c9b(0x10f));return{'parentId':_0x1ed453,'childId':_0xd91d95};}
|