@treasuredata/tdx 2026.5.0 → 2026.5.1
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.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/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.d.ts +9 -0
- package/dist/commands/journey-command.d.ts.map +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-command.js.map +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/table-deleted.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.d.ts +8 -1
- package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/cdp-api-client.js.map +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.d.ts +8 -1
- package/dist/sdk/journey.d.ts.map +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/journey.js.map +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/llm/user-settings.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/deleted-table-validation.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/cdp.d.ts +19 -0
- package/dist/sdk/types/cdp.d.ts.map +1 -1
- package/dist/sdk/types/index.d.ts +1 -1
- package/dist/sdk/types/index.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/index.js.map +1 -1
- package/dist/sdk/types/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/task-graph.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/access-tracker.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 a155_0x24d83c=a155_0xe8d7;(function(_0x237e04,_0x465c7a){const _0x23be2e=a155_0xe8d7,_0x14ff36=_0x237e04();while(!![]){try{const _0x126f29=parseInt(_0x23be2e(0x22d))/0x1*(parseInt(_0x23be2e(0x235))/0x2)+parseInt(_0x23be2e(0x248))/0x3*(parseInt(_0x23be2e(0x23c))/0x4)+parseInt(_0x23be2e(0x1b7))/0x5*(-parseInt(_0x23be2e(0x1eb))/0x6)+-parseInt(_0x23be2e(0x253))/0x7*(parseInt(_0x23be2e(0x212))/0x8)+-parseInt(_0x23be2e(0x179))/0x9+parseInt(_0x23be2e(0x1f5))/0xa*(-parseInt(_0x23be2e(0x260))/0xb)+parseInt(_0x23be2e(0x18f))/0xc*(parseInt(_0x23be2e(0x1d7))/0xd);if(_0x126f29===_0x465c7a)break;else _0x14ff36['push'](_0x14ff36['shift']());}catch(_0x56a4d0){_0x14ff36['push'](_0x14ff36['shift']());}}}(a155_0x4115,0xe0e13));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a155_0x24d83c(0x1f6));function a155_0x4115(){const _0x4a1fb7=['filter','SEGMENT_NOT_FOUND','createdSegmentId','segment_updated','day','keys','segment_deleting','resolveJourneyId','entryCriteria','activation_deleted','journeyId','updateActivation','diff','entry_criteria','\x27\x20milestone','uniqueSegmentName','\x27\x20wait\x20condition','kind','\x27\x20decision\x20point\x20branch\x20\x27','and\x20the\x20server\x20segment,\x20then\x20retry.','logWarning','valid','\x20activation\x20\x27','Fetching\x20','activation_created','activation_','connectionIdToNameMap',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','length','deleteSegment','resolveSegment','\x27\x20from\x20file:\x20','290TkTdQM','toString','stages','unchanged','add','folderPath','folder','folderId','embedded_segment_created','listActivations','journey_created','idToName','decision_point','\x27\x20for\x20','Deleting\x20activation\x20\x27','trim','relationships','Created\x20segment\x20\x27','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','debug','entries','journeys','segment_deleted','\x27...','yamlConfig','validatedRequest','relative','JOURNEY_UPDATE_ERROR','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','delete','Entry\x20criteria:\x20','activationParams','884NVAnMz','):\x20','deleteActivation','Deleted\x20activation\x20\x27','ACTIVATION_UPDATE_ERROR','embedded_segment_creating','conditionTimeoutUnit','activations','Activation\x20not\x20found:\x20','nameToId','activation_creating','hasChanges','existingSegments','Segment\x20not\x20found','nameToType','journey_creating','\x20error(s)','getSegment','SEGMENT_SYNTAX_ERROR','\x27\x20entry\x20criteria','153744ehkLZG','slice','deps','journeyActivationStepId','onProgress','all','state','connection','from','Journey\x20\x27','90LJSSSx','tdx.sdk.push-workflow','schedule','Segment\x20not\x20found:\x20','logInfo','get','updateSegmentById','name','localName','activation_template_id','Created\x20activation\x20\x27','attributes','Failed\x20to\x20','activationStepsById','segmentFolderId','logSuccess','results','segment','conditionSegmentId','startsWith','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','absolutePath','embedded_activation_created','createActivation','.$1.push-recovery.json','segmentByFolderAndName','toLowerCase','waitStepUnit','isArray','16kVYize','Matched\x20server\x20segment\x20\x27','Creating\x20folder\x20\x27','existingActivation','createFolder','resolvedRule','match','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','rule','milestone','journey','push','\x20(referenced\x20in\x20journey\x20','__pending_act_','folderPathToId','Activation','Updated\x20activation\x20\x27','digest','./child-segment-yaml.js','all_columns','user','goal\x20criteria','folder_created','segment_updating','ACTIVATION_SYNTAX_ERROR','fetchJourney','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','50XtolTE','create','journeyStages','waitStepType','segments','Creating\x20activation\x20\x27',').\x20','run_after_journey_refresh','2400vaPQWh','goal','values','withProgress','activation_updating','getJourney','activation_deleting','6355780cHLAcl','buildUserMaps','../../utils/async.js','action','sha1','journeyBundleId','journeyName','description','reduce','sort','existingSegment','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','3RHVWlT','activationsBySegmentId','steps','segmentNameToId','update','Deleted\x20segment\x20\x27','getActivation','created','getSegmentEntity\x20also\x20failed\x20for\x20','getSegment\x20failed\x20for\x20','journeyActivationNameToId','5289578UoWnlQ','idToEmailMap','createSegment','errors','\x27\x20exit\x20criteria','isNew','\x27\x20to\x20local\x20\x27','INTERNAL','stringify','NOT_FOUND','versionNumber','yamlActivation','conditionTimeoutDuration','2198273RrTdWg','journeyById','deleted','activationActions','utf-8','replace','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','rootFolderId','null','\x20journey\x20from\x20file:\x20','object','WaitStep','Failed\x20to\x20resolve\x20activation\x20','index','segment_creating','set','existingJourney','progress','Condition','Name\x20has\x20already\x20been\x20taken','map','logDeleted','branches','parentId','find','some','Updating\x20activation\x20\x27','has','journey_updating','columns','stage\x20\x27','12858003ulmRGq','\x20segment\x20from\x20file:\x20','exitCriterias','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','parentFolder','./journey-yaml.js','size','data','Created\x20journey\x20\x27','journeyBundleName','parse','connector_config','behavior','\x0a\x20\x20','split','join','max','conditions','SEGMENT_UPDATE_ERROR','updated','type','segmentId','970044cKlLtq','DecisionPoint','parseDocument','journey_entry_criteria_','\x27\x20not\x20found\x20in\x20journey\x20\x27','notification','with','uniqueServerName'];a155_0x4115=function(){return _0x4a1fb7;};return a155_0x4115();}export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a155_0x24d83c(0x21f);export function createPendingSegmentId(_0x4e1ec1){return''+PENDING_SEGMENT_PREFIX+_0x4e1ec1+'__';}export function isPendingSegmentId(_0x477889){const _0x456f68=a155_0x24d83c;return _0x477889[_0x456f68(0x208)](PENDING_SEGMENT_PREFIX)&&!_0x477889['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x1375e3){const _0x1f67e9=a155_0x24d83c;return _0x1375e3[_0x1f67e9(0x265)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4c4001){return''+PENDING_ACTIVATION_PREFIX+_0x4c4001+'__';}export function isPendingActivationId(_0x4b92f2){return _0x4b92f2['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x2e3593){return _0x2e3593['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x38fa22,_0x3ecba4){const _0x197e3a=a155_0x24d83c,_0x31f690=_0x38fa22+'::'+(_0x3ecba4[_0x197e3a(0x1c6)]()||_0x197e3a(0x206)),_0x163f5f=createHash(_0x197e3a(0x240))[_0x197e3a(0x24c)](_0x31f690)[_0x197e3a(0x223)]('hex')[_0x197e3a(0x1ec)](0x0,0xc);return _0x197e3a(0x192)+_0x163f5f;}export function ensureJourneyDefaults(_0x520d62){const _0x54994d=a155_0x24d83c;!_0x520d62[_0x54994d(0x243)]&&(_0x520d62[_0x54994d(0x243)]=''),!_0x520d62[_0x54994d(0x1f1)]&&(_0x520d62[_0x54994d(0x1f1)]='draft');}export function injectExistingStageIds(_0x2b23db,_0x266cf1){const _0x1b22e3=a155_0x24d83c,_0x369fa1=new Map(_0x266cf1[_0x1b22e3(0x16e)](_0x3bb8fd=>[_0x3bb8fd['name'],_0x3bb8fd['id']]));for(const _0x180566 of _0x2b23db){if(!_0x180566['id']){const _0x177d90=_0x369fa1['get'](_0x180566['name']);_0x177d90&&(_0x180566['id']=_0x177d90);}}}export function resolveTDFolderPath(_0xf22939,_0x11f2b3,_0x500275){const _0x48d2d5=a155_0x24d83c;if(!_0x11f2b3)return _0xf22939;if(_0xf22939===_0x500275||_0xf22939[_0x48d2d5(0x208)](_0x500275+'/'))return _0xf22939;return _0xf22939?_0x500275+'/'+_0xf22939:_0x500275;}export function addFoldersToCreate(_0x374ff6,_0x22050a,_0x932937){const _0x378ba9=a155_0x24d83c;if(!_0x374ff6)return;if(_0x22050a['has'](_0x374ff6))return;const _0x4f9f67=_0x374ff6[_0x378ba9(0x187)]('/');let _0x51c6ba='';for(const _0x226806 of _0x4f9f67){_0x51c6ba=_0x51c6ba?_0x51c6ba+'/'+_0x226806:_0x226806,!_0x22050a['has'](_0x51c6ba)&&_0x932937[_0x378ba9(0x1bb)](_0x51c6ba);}}export function sortFoldersByDepth(_0x19e66c){return[..._0x19e66c]['sort']((_0x50de3c,_0x548f5c)=>{const _0x319e8f=a155_0xe8d7,_0x75ed79=(_0x50de3c[_0x319e8f(0x218)](/\//g)||[])[_0x319e8f(0x1b3)],_0x24dc56=(_0x548f5c[_0x319e8f(0x218)](/\//g)||[])[_0x319e8f(0x1b3)];return _0x75ed79-_0x24dc56;});}import*as a155_0x1b98de from'yaml';import{readFileSync}from'fs';import a155_0x3076d8 from'path';import{isJourneyDef,parseYamlString as a155_0x384924,toYamlString as a155_0x771727,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(_0x15b4d3){const _0x236aa0=a155_0x24d83c;if(Array[_0x236aa0(0x211)](_0x15b4d3))return'['+_0x15b4d3[_0x236aa0(0x16e)](_0x96b3fb=>stableStringify(_0x96b3fb))[_0x236aa0(0x188)](',')+']';if(_0x15b4d3&&typeof _0x15b4d3===_0x236aa0(0x26a)){const _0x4ac61a=_0x15b4d3,_0x5980b6=Object[_0x236aa0(0x19c)](_0x4ac61a)[_0x236aa0(0x245)](),_0x5bd414=_0x5980b6['map'](_0x35f6f2=>'\x22'+_0x35f6f2+'\x22:'+stableStringify(_0x4ac61a[_0x35f6f2]));return'{'+_0x5bd414[_0x236aa0(0x188)](',')+'}';}const _0x4b837f=JSON['stringify'](_0x15b4d3);return _0x4b837f===undefined?_0x236aa0(0x268):_0x4b837f;}function activationSignature(_0x5c05cc){const _0x53c641=a155_0x24d83c,_0x4a6e14={'connection':_0x5c05cc[_0x53c641(0x1f2)],..._0x5c05cc[_0x53c641(0x225)]!==undefined&&{'all_columns':_0x5c05cc[_0x53c641(0x225)]},..._0x5c05cc[_0x53c641(0x177)]!==undefined&&{'columns':_0x5c05cc[_0x53c641(0x177)]},..._0x5c05cc[_0x53c641(0x185)]!==undefined&&{'behavior':_0x5c05cc[_0x53c641(0x185)]},..._0x5c05cc[_0x53c641(0x1f7)]!==undefined&&{'schedule':_0x5c05cc[_0x53c641(0x1f7)]},..._0x5c05cc[_0x53c641(0x194)]!==undefined&&{'notification':_0x5c05cc[_0x53c641(0x194)]},..._0x5c05cc[_0x53c641(0x184)]!==undefined&&{'connector_config':_0x5c05cc[_0x53c641(0x184)]},..._0x5c05cc[_0x53c641(0x1fe)]!==undefined&&{'activation_template_id':_0x5c05cc[_0x53c641(0x1fe)]}};return stableStringify(_0x4a6e14);}async function fetchSegment(_0x353de5,_0x42d5a2,_0x34e000,_0x3f2b3d){const _0x1b297d=a155_0x24d83c,_0x85517a=_0x3f2b3d?.['find'](_0x44d8dd=>_0x44d8dd['id']===_0x34e000);if(_0x85517a)return _0x85517a;try{return await _0x353de5[_0x1b297d(0x206)][_0x1b297d(0x1e8)](_0x42d5a2,_0x34e000);}catch(_0x905b99){logger[_0x1b297d(0x1ca)](_0x1b297d(0x251)+_0x34e000+_0x1b297d(0x1b2)+_0x905b99);try{return await _0x353de5[_0x1b297d(0x206)]['getSegmentEntity'](_0x34e000);}catch(_0x5716c6){return logger['debug'](_0x1b297d(0x250)+_0x34e000+':\x20'+_0x5716c6),null;}}}function a155_0xe8d7(_0x36ecdd,_0x350b7b){_0x36ecdd=_0x36ecdd-0x169;const _0x411514=a155_0x4115();let _0xe8d71a=_0x411514[_0x36ecdd];return _0xe8d71a;}function recoverSegmentIdsFromPushRecovery(_0x583f80,_0x3d5faa,_0x58b6ea){const _0x446760=a155_0x24d83c,_0x377f29=readPushRecovery(_0x583f80[_0x446760(0x20a)]);if(_0x377f29?.[_0x446760(0x242)]===_0x583f80[_0x446760(0x1cf)]['name'])for(const [_0x1f9da8,_0x427132]of Object[_0x446760(0x1cb)](_0x377f29[_0x446760(0x231)])){const _0x5761bd=generateDeterministicJourneySegmentName(_0x583f80[_0x446760(0x1cf)][_0x446760(0x1fc)],_0x1f9da8);_0x427132[_0x446760(0x196)]===_0x5761bd&&(_0x3d5faa['set'](_0x1f9da8,_0x427132[_0x446760(0x18e)]),_0x58b6ea['set'](_0x1f9da8,_0x427132['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x1ed316,_0xf089cf,_0x44d0d5,_0x3642da){const _0x502dd0=a155_0x24d83c;let _0x36d072;try{_0x36d072=await _0x1ed316[_0x502dd0(0x206)]['createJourneySegment']({'name':_0x44d0d5['uniqueSegmentName'],'description':_0x44d0d5[_0x502dd0(0x243)],'journeyId':_0x44d0d5[_0x502dd0(0x1a1)],'rule':_0x3642da(_0x44d0d5['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x44d0d5[_0x502dd0(0x1be)],'audienceId':_0x44d0d5[_0x502dd0(0x171)]});}catch(_0x57398f){const _0xbb1abf=_0x57398f instanceof Error&&_0x57398f['message']['includes'](_0x502dd0(0x16d));if(_0xbb1abf){const _0x2ef260=readPushRecovery(_0xf089cf[_0x502dd0(0x20a)]),_0x3d7104=_0x2ef260?.[_0x502dd0(0x242)]===_0xf089cf['yamlConfig'][_0x502dd0(0x1fc)]?_0x2ef260[_0x502dd0(0x231)][_0x44d0d5[_0x502dd0(0x1fd)]]:undefined;if(_0x3d7104?.['uniqueServerName']===_0x44d0d5['uniqueSegmentName'])await _0x1ed316[_0x502dd0(0x206)][_0x502dd0(0x1fb)](_0x44d0d5['parentId'],_0x3d7104[_0x502dd0(0x18e)],{'description':_0x44d0d5[_0x502dd0(0x243)],'rule':_0x3642da(_0x44d0d5[_0x502dd0(0x217)],!![]),'countPopulation':!![]}),_0x36d072=_0x3d7104[_0x502dd0(0x18e)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0x44d0d5[_0x502dd0(0x1fd)]+_0x502dd0(0x1c9)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0xf089cf['absolutePath'][_0x502dd0(0x265)](/([^/]+)$/,_0x502dd0(0x20d))+')\x20')+_0x502dd0(0x1aa),_0x57398f);}else throw _0x57398f;}return saveSegmentToPushRecovery(_0xf089cf[_0x502dd0(0x20a)],_0xf089cf[_0x502dd0(0x1cf)][_0x502dd0(0x1fc)],_0x44d0d5['localName'],{'segmentId':_0x36d072,'uniqueServerName':_0x44d0d5[_0x502dd0(0x1a6)],'createdAt':new Date()['toISOString']()}),_0x36d072;}export async function prepareSegmentFiles(_0xcb005a,_0x17eda5,_0x548742,_0x5a2604,_0x1e35f1){const _0x2c0e2e=a155_0x24d83c,{activationDefToCreateRequest:_0x321cb1}=await import('./child-segment-yaml.js'),_0xb36860=[],_0x1784e7=new Set();for(const {yamlConfig:_0x1fc920,folderPath:_0x1e021e,sourcePath:_0x3bbe23}of _0xcb005a){const _0x254004=resolveTDFolderPath(_0x1e021e,_0x5a2604,_0x1e35f1),_0xbf0e1a=_0x254004+':'+_0x1fc920[_0x2c0e2e(0x1fc)],_0x63e936=_0x17eda5[_0x2c0e2e(0x20e)][_0x2c0e2e(0x1fa)](_0xbf0e1a),_0x356533=_0x63e936?_0x17eda5[_0x2c0e2e(0x249)][_0x2c0e2e(0x1fa)](_0x63e936['id'])||[]:[];addFoldersToCreate(_0x254004,_0x17eda5[_0x2c0e2e(0x220)],_0x1784e7);const _0x4f4467=calculateActivationActions(_0x1fc920[_0x2c0e2e(0x1de)]||[],_0x356533,_0x17eda5[_0x2c0e2e(0x254)],_0x17eda5[_0x2c0e2e(0x1b1)]);for(const _0x4db2a3 of _0x4f4467){(_0x4db2a3[_0x2c0e2e(0x18d)]===_0x2c0e2e(0x22e)||_0x4db2a3[_0x2c0e2e(0x18d)]===_0x2c0e2e(0x24c))&&_0x4db2a3['yamlActivation']&&(_0x4db2a3[_0x2c0e2e(0x1d0)]=await _0x321cb1(_0x4db2a3[_0x2c0e2e(0x25e)],_0x548742));}const _0x9dd73f=calculateSegmentDiff(_0x1fc920,_0x63e936,_0x356533,_0x17eda5[_0x2c0e2e(0x254)],_0x17eda5[_0x2c0e2e(0x1b1)]);_0xb36860[_0x2c0e2e(0x21d)]({'relativePath':_0x1fc920['name'],'absolutePath':_0x3bbe23,'yamlConfig':_0x1fc920,'folderPath':_0x254004,'existingSegment':_0x63e936,'existingActivations':_0x356533,'isNew':_0x9dd73f['isNew'],'hasChanges':_0x9dd73f['hasChanges'],'diff':_0x9dd73f[_0x2c0e2e(0x1a3)],'activationActions':_0x4f4467});}return{'segmentFiles':_0xb36860,'foldersToCreate':_0x1784e7};}export async function prepareJourneyFiles(_0x1c7aa5,_0x501471,_0x26ef04,_0x2c3335){const _0x363d34=a155_0x24d83c,_0x336472=[],_0xf4cbdb=new Set();for(const {yamlConfig:_0x41068f,folderPath:_0x5b0c05,sourcePath:_0x32063a}of _0x1c7aa5){const _0x54c6ad=resolveTDFolderPath(_0x5b0c05,_0x26ef04,_0x2c3335),_0x77d71f=_0x54c6ad+':'+_0x41068f[_0x363d34(0x1fc)],_0x3d57c3=_0x501471['journeyBundlesByFolderAndName'][_0x363d34(0x1fa)](_0x77d71f);let _0x222df0,_0x42d43b;if(_0x3d57c3&&_0x3d57c3[_0x363d34(0x1b3)]>0x0){const _0xfc4a97=buildLocalExpandedRuleMappings(_0x41068f),{createYamlContext:_0x3e2602,prefetchJourneySegments:_0x773015}=createPushYamlContextForBundle(_0x501471[_0x363d34(0x1ed)],_0x501471[_0x363d34(0x171)],_0x501471[_0x363d34(0x1e3)],_0xfc4a97,_0x501471[_0x363d34(0x254)],_0x501471[_0x363d34(0x1b1)],_0x501471[_0x363d34(0x202)],_0x501471[_0x363d34(0x261)]);await _0x773015(_0x3d57c3[_0x363d34(0x16e)](_0x4248a1=>_0x4248a1['id']));const _0x3efb1b=await _0x501471['deps']['journey']['getLatestJourneyId'](_0x3d57c3[0x0][_0x363d34(0x241)]),_0x6c0c96=hasMultipleVersions(_0x41068f),_0x34ff19=async _0x12b7f3=>{const _0x5272ba=_0x363d34,_0x38706a=_0x501471['journeyById']?.[_0x5272ba(0x1fa)](_0x12b7f3);if(_0x38706a)return _0x38706a;return _0x501471[_0x5272ba(0x22b)]({'journeyId':_0x12b7f3,'journeyName':_0x41068f[_0x5272ba(0x1fc)],'isMultiVersion':_0x3d57c3[_0x5272ba(0x1b3)]>0x1});};if(_0x6c0c96&&_0x3d57c3[_0x363d34(0x1b3)]>0x1){const _0x5584f2=[];for(const _0x12df2c of _0x3d57c3){const _0x4ab784=_0x12df2c[_0x363d34(0x25d)]||0x1;_0x501471[_0x363d34(0x16b)]?.[_0x363d34(0x24c)](_0x363d34(0x1ae)+_0x41068f[_0x363d34(0x1fc)]+'\x20v'+_0x4ab784);const _0x1e3521=await _0x34ff19(_0x12df2c['id']),_0xa6525c=_0x3e2602(_0x12df2c['id']),_0x2731c9=await journeyResponseToDef(_0x1e3521,_0xa6525c);_0x5584f2[_0x363d34(0x21d)]({'item':_0x12df2c,'yaml':_0x2731c9});}const _0x47e4ea=buildLocalRuleToNameMappingFromJourney(_0x41068f);_0x42d43b=buildMergedJourneyDef(_0x5584f2,_0x47e4ea,_0x3efb1b);const _0x2df730=Math[_0x363d34(0x189)](..._0x5584f2['map'](_0x27ee15=>_0x27ee15['item'][_0x363d34(0x25d)]||0x0)),_0x3d1ec9=_0x3d57c3[_0x363d34(0x172)](_0x1dad03=>(_0x1dad03[_0x363d34(0x25d)]||0x0)===_0x2df730);_0x3d1ec9&&(_0x501471[_0x363d34(0x16b)]?.[_0x363d34(0x24c)](_0x363d34(0x1ae)+_0x41068f[_0x363d34(0x1fc)]+'\x20v'+_0x2df730),_0x222df0=await _0x34ff19(_0x3d1ec9['id']));}else{const _0x32ab72=_0x3d57c3[_0x3d57c3[_0x363d34(0x1b3)]-0x1];_0x501471[_0x363d34(0x16b)]?.[_0x363d34(0x24c)](_0x363d34(0x1ae)+_0x41068f[_0x363d34(0x1fc)]),_0x222df0=await _0x34ff19(_0x32ab72['id']);const _0x29267b=_0x3e2602(_0x32ab72['id']),_0x460179=await journeyResponseToDef(_0x222df0,_0x29267b),_0x22b417=buildLocalRuleToNameMappingFromJourney(_0x41068f);_0x42d43b=buildMergedJourneyDef([{'item':_0x32ab72,'yaml':_0x460179}],_0x22b417,_0x3efb1b);}}addFoldersToCreate(_0x54c6ad,_0x501471[_0x363d34(0x220)],_0xf4cbdb);const _0x38e2fa=calculateJourneyDiff(_0x41068f,_0x42d43b);_0x336472['push']({'relativePath':_0x41068f['name'],'absolutePath':_0x32063a,'yamlConfig':_0x41068f,'folderPath':_0x54c6ad,'existingJourney':_0x222df0,'isNew':_0x38e2fa[_0x363d34(0x258)],'hasChanges':_0x38e2fa['hasChanges'],'diff':_0x38e2fa[_0x363d34(0x1a3)]});}return{'journeyFiles':_0x336472,'foldersToCreate':_0xf4cbdb};}export function calculateActivationActions(_0xd36a6c,_0x399cd8,_0x5a30f0,_0x3c69d6){const _0x53134c=a155_0x24d83c,_0x57fe71=[],_0x439aca=new Map();for(const _0xd1f454 of _0x399cd8){_0x439aca['set'](_0xd1f454[_0x53134c(0x1fc)],_0xd1f454);}const _0x3bd1ff=new Map();for(const _0x3e0a55 of _0xd36a6c){_0x3bd1ff['set'](_0x3e0a55['name'],_0x3e0a55);}for(const _0x12ad7a of _0xd36a6c){const _0x595f86=_0x439aca[_0x53134c(0x1fa)](_0x12ad7a[_0x53134c(0x1fc)]);if(!_0x595f86)_0x57fe71[_0x53134c(0x21d)]({'type':_0x53134c(0x22e),'name':_0x12ad7a[_0x53134c(0x1fc)],'yamlActivation':_0x12ad7a});else{const _0x537a5e=activationResponseToDef(_0x595f86,_0x5a30f0,_0x3c69d6),_0x22f1c9=a155_0x1b98de[_0x53134c(0x25b)](_0x537a5e),_0x40fbd3=a155_0x1b98de[_0x53134c(0x25b)](_0x12ad7a);_0x22f1c9!==_0x40fbd3&&_0x57fe71['push']({'type':'update','name':_0x12ad7a['name'],'yamlActivation':_0x12ad7a,'existingActivation':_0x595f86});}}for(const _0x4ecf02 of _0x399cd8){!_0x3bd1ff[_0x53134c(0x175)](_0x4ecf02['name'])&&_0x57fe71[_0x53134c(0x21d)]({'type':_0x53134c(0x1d4),'name':_0x4ecf02[_0x53134c(0x1fc)],'existingActivation':_0x4ecf02});}return _0x57fe71;}function calculateYamlDiff(_0x38a494,_0x288eb5){if(_0x288eb5){const _0x5be259=generateDiff(_0x288eb5,_0x38a494),_0x15676d=hasChanges(_0x5be259);return{'isNew':![],'hasChanges':_0x15676d,'diff':_0x15676d?formatDiffWithColors(_0x5be259):undefined};}const _0x1a1b69=generateDiff('',_0x38a494);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x1a1b69)};}export function calculateSegmentDiff(_0x26141b,_0x5f2f8d,_0x4e332c,_0x1c6fae,_0x3bca01){const _0x3c969c=segmentToYamlString(_0x26141b),_0x1c6e5c=_0x5f2f8d?segmentToYamlString(segmentWithActivationsToYaml(_0x5f2f8d,_0x4e332c,undefined,_0x1c6fae,_0x3bca01)):undefined;return calculateYamlDiff(_0x3c969c,_0x1c6e5c);}export function calculateJourneyDiff(_0x553743,_0x196f5c){const _0x1c054b=normalizeJourneyDef(_0x553743,_0x553743),_0x164ffb=a155_0x771727(_0x1c054b),_0x550038=_0x196f5c?a155_0x771727(normalizeJourneyDef(_0x196f5c,_0x553743)):undefined;return calculateYamlDiff(_0x164ffb,_0x550038);}export function findSegmentsToDelete(_0x312e36,_0x52b0eb,_0x14f00f,_0xd06c54,_0x1b53c6){const _0x3663cf=a155_0x24d83c,_0x3de45c=new Set();for(const {yamlConfig:_0x4f9f0e,folderPath:_0x2bf370}of _0x52b0eb){_0x3de45c['add'](_0x2bf370+':'+_0x4f9f0e[_0x3663cf(0x1fc)]);}return _0x312e36['filter'](_0x15caf3=>{const _0x5ebb13=_0x3663cf,_0xa277d0=_0x15caf3[_0x5ebb13(0x203)]?_0x14f00f[_0x5ebb13(0x1fa)](_0x15caf3['segmentFolderId'][_0x5ebb13(0x1b8)]())||'':'',_0x4cb2c6=_0xa277d0+':'+_0x15caf3['name'];if(_0x3de45c[_0x5ebb13(0x175)](_0x4cb2c6))return![];if(_0x1b53c6)return _0xa277d0===_0xd06c54||_0xa277d0[_0x5ebb13(0x208)](_0xd06c54+'/');return!![];});}export function findJourneysToDelete(_0x493c55,_0x3e807e,_0x15ff68,_0x4cf303,_0x4008bd){const _0x430ba1=a155_0x24d83c,_0x430d98=new Set();for(const {yamlConfig:_0x1b0f59,folderPath:_0x404554}of _0x3e807e){_0x430d98[_0x430ba1(0x1bb)](_0x404554+':'+_0x1b0f59['name']);}return _0x493c55[_0x430ba1(0x197)](_0x2be61c=>{const _0x391b3b=_0x430ba1,_0xf076c3=_0x2be61c[_0x391b3b(0x1be)]?_0x15ff68['get'](_0x2be61c['folderId'])||'':'',_0x1d2452=_0xf076c3+':'+_0x2be61c[_0x391b3b(0x182)];if(_0x430d98[_0x391b3b(0x175)](_0x1d2452))return![];if(_0x4008bd)return _0xf076c3===_0x4cf303||_0xf076c3['startsWith'](_0x4cf303+'/');return!![];});}export function buildSegmentLookupMap(_0x54f1e1,_0x41e3f1){const _0x36e506=a155_0x24d83c,_0x1e6b9d=new Map();for(const _0x1ad31e of _0x54f1e1){const _0x4ee25b=_0x1ad31e[_0x36e506(0x203)]?_0x41e3f1[_0x36e506(0x1fa)](_0x1ad31e[_0x36e506(0x203)][_0x36e506(0x1b8)]())||'':'',_0x516e83=_0x4ee25b+':'+_0x1ad31e[_0x36e506(0x1fc)];_0x1e6b9d[_0x36e506(0x169)](_0x516e83,_0x1ad31e);}return _0x1e6b9d;}export function buildSegmentNameToIdMap(_0x42abcf){const _0x3ba382=a155_0x24d83c,_0xffb546=new Map();for(const _0x4a37b5 of _0x42abcf){_0xffb546['set'](_0x4a37b5[_0x3ba382(0x1fc)],_0x4a37b5['id']);}return _0xffb546;}export function buildJourneyBundleLookupMap(_0x50d2e9,_0x195e66){const _0x4ec32b=a155_0x24d83c,_0x1b82fd=new Map();for(const _0x52641e of _0x50d2e9){const _0x399024=_0x52641e[_0x4ec32b(0x1be)]?_0x195e66[_0x4ec32b(0x1fa)](_0x52641e[_0x4ec32b(0x1be)])||'':'',_0x59a40=_0x399024+':'+_0x52641e[_0x4ec32b(0x182)];!_0x1b82fd[_0x4ec32b(0x175)](_0x59a40)&&_0x1b82fd['set'](_0x59a40,[]),_0x1b82fd[_0x4ec32b(0x1fa)](_0x59a40)[_0x4ec32b(0x21d)](_0x52641e);}for(const _0x21d9ed of _0x1b82fd[_0x4ec32b(0x237)]()){_0x21d9ed[_0x4ec32b(0x245)]((_0x16aad9,_0x42dbad)=>(_0x16aad9['versionNumber']||0x0)-(_0x42dbad['versionNumber']||0x0));}return _0x1b82fd;}export function collectFoldersToCreate(_0x241e96,_0x478cc4){const _0x27bd6=a155_0x24d83c,_0x388231=new Set();for(const _0x30ddab of _0x241e96){if(!_0x30ddab)continue;if(_0x478cc4['has'](_0x30ddab))continue;const _0xbe8278=_0x30ddab[_0x27bd6(0x187)]('/');let _0xe5f58='';for(const _0x4a47c1 of _0xbe8278){_0xe5f58=_0xe5f58?_0xe5f58+'/'+_0x4a47c1:_0x4a47c1,!_0x478cc4[_0x27bd6(0x175)](_0xe5f58)&&_0x388231[_0x27bd6(0x1bb)](_0xe5f58);}}return _0x388231;}export function parseAndClassifyYamlFiles(_0x2548cb,_0x51a7f2,_0x4566b0){const _0x4661fb=a155_0x24d83c,_0x28702d=[],_0x34cf8d=[];for(const _0x24c87b of _0x2548cb){const _0x3412fd=a155_0x3076d8['relative'](_0x51a7f2,a155_0x3076d8['dirname'](_0x24c87b)),_0x31237a=_0x3412fd==='.'?'':_0x3412fd[_0x4661fb(0x265)](/\\/g,'/'),_0x4cc79=readFileSync(_0x24c87b,_0x4661fb(0x264)),_0xbb8cc4=a155_0x1b98de['parse'](_0x4cc79);if(isJourneyDef(_0xbb8cc4)){const _0x2f3117=a155_0x384924(_0x4cc79);_0x34cf8d[_0x4661fb(0x21d)]({'yamlConfig':_0x2f3117,'folderPath':_0x31237a,'sourcePath':_0x24c87b});}else{if(!_0x4566b0?.['skipSegments']){const _0x3136c2=parseSegmentYamlFile(_0x4cc79),_0x162a00=normalizeChildSegmentYaml(_0x3136c2);_0x28702d[_0x4661fb(0x21d)]({'yamlConfig':_0x162a00,'folderPath':_0x31237a,'sourcePath':_0x24c87b});}}}return{'segments':_0x28702d,'journeys':_0x34cf8d};}export function validateParsedFiles(_0x12d0f6,_0x256b0a){const _0x3507f9=a155_0x24d83c,_0x26a0a2=[];for(const {yamlConfig:_0x55649b,sourcePath:_0x2a6125}of _0x12d0f6[_0x3507f9(0x231)]){const _0x3cc02e=readFileSync(_0x2a6125,_0x3507f9(0x264)),_0x469a31=a155_0x1b98de[_0x3507f9(0x191)](_0x3cc02e),_0x4ccc87=validateSegmentDef(_0x55649b,{'source':_0x3cc02e,'document':_0x469a31},{'skipSchema':!![]});if(!_0x4ccc87['valid']){const _0x4cf983=a155_0x3076d8[_0x3507f9(0x1d1)](_0x256b0a,_0x2a6125);_0x26a0a2[_0x3507f9(0x21d)]({'filePath':_0x4cf983,'source':_0x3cc02e,'result':_0x4ccc87,'isJourney':![]});}}for(const {yamlConfig:_0x57d1ca,sourcePath:_0x19ff98}of _0x12d0f6[_0x3507f9(0x1cc)]){const _0x3a4849=readFileSync(_0x19ff98,_0x3507f9(0x264)),_0x58b74d=a155_0x1b98de[_0x3507f9(0x191)](_0x3a4849),_0x3c51af=validateJourneyDef(_0x57d1ca,{'source':_0x3a4849,'document':_0x58b74d},{'skipSchema':!![]});if(!_0x3c51af[_0x3507f9(0x1ac)]){const _0x2692c7=a155_0x3076d8[_0x3507f9(0x1d1)](_0x256b0a,_0x19ff98);_0x26a0a2[_0x3507f9(0x21d)]({'filePath':_0x2692c7,'source':_0x3a4849,'result':_0x3c51af,'isJourney':!![]});}}return _0x26a0a2;}export function formatValidationErrors(_0x29713b){const _0x173daf=a155_0x24d83c,_0x15a8d8=[];for(const {filePath:_0x2601cf,source:_0x44c99a,result:_0x5311b7,isJourney:_0xbf9cd1}of _0x29713b){const _0x987ae2=_0xbf9cd1?'journey':'segment';_0x15a8d8[_0x173daf(0x21d)]('\x0a'+_0x2601cf+'\x20('+_0x987ae2+_0x173daf(0x1d8)+_0x5311b7[_0x173daf(0x256)][_0x173daf(0x1b3)]+_0x173daf(0x1e7)),_0x15a8d8['push'](formatValidationResult(_0x5311b7,_0x44c99a,_0x2601cf));}return _0x15a8d8[_0x173daf(0x188)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x791041){const _0x20b0cb=a155_0x24d83c,_0x9819ce=new Set(),_0x5c4da4=new Map(),_0x3099ee=collectSegmentUsageCounts(_0x791041);if(_0x791041[_0x20b0cb(0x231)])for(const [_0x19df27,_0x4bda1f]of Object[_0x20b0cb(0x1cb)](_0x791041[_0x20b0cb(0x231)])){_0x9819ce[_0x20b0cb(0x1bb)](_0x19df27);if(_0x4bda1f[_0x20b0cb(0x21a)]){const _0x1028f3=yamlRuleToApi(_0x4bda1f[_0x20b0cb(0x21a)]),_0x58644c=apiRuleToYaml(_0x1028f3);_0x5c4da4['set'](_0x19df27,_0x58644c);}}const _0x1107b2=new Map();let _0x78bb2a=0x0;for(const [_0x26d707,_0x170071]of _0x5c4da4){const _0x32ff88=serializeExpandedRule(_0x170071,_0x5c4da4),_0x804b24=_0x1107b2[_0x20b0cb(0x1fa)](_0x32ff88)||[];_0x804b24[_0x20b0cb(0x21d)]({'name':_0x26d707,'index':_0x78bb2a}),_0x1107b2[_0x20b0cb(0x169)](_0x32ff88,_0x804b24),_0x78bb2a++;}const _0x1ce357=new Map();for(const [_0x364fb4,_0x50665e]of _0x1107b2){const _0x577332=_0x50665e[_0x20b0cb(0x1ec)]()['sort']((_0x44a303,_0x166e68)=>{const _0x2715e4=_0x20b0cb,_0x3832e3=_0x3099ee[_0x2715e4(0x1fa)](_0x44a303[_0x2715e4(0x1fc)])||0x0,_0x375d68=_0x3099ee['get'](_0x166e68[_0x2715e4(0x1fc)])||0x0;if(_0x3832e3!==_0x375d68)return _0x375d68-_0x3832e3;return _0x44a303['index']-_0x166e68[_0x2715e4(0x26d)];})[_0x20b0cb(0x16e)](_0x194066=>_0x194066[_0x20b0cb(0x1fc)]),_0x467820=[];for(const _0x4951e5 of _0x577332){const _0x55fa95=_0x3099ee[_0x20b0cb(0x1fa)](_0x4951e5)||0x0,_0x2562c7=Math['max'](_0x55fa95,0x1);for(let _0x1e9329=0x0;_0x1e9329<_0x2562c7;_0x1e9329++){_0x467820['push'](_0x4951e5);}}_0x1ce357[_0x20b0cb(0x169)](_0x364fb4,_0x467820);}return{'existingLocalSegmentNames':_0x9819ce,'localSegmentRules':_0x5c4da4,'localExpandedRuleToNames':_0x1ce357};}export function createSegmentIdResolver(_0xfe77bc,_0x12f30b){return async _0x7cbf6c=>{const _0x26de91=a155_0xe8d7,_0xd69b3e=_0xfe77bc[_0x26de91(0x1fa)](_0x7cbf6c);if(!_0xd69b3e)throw new SDKError(ErrorCode[_0x26de91(0x198)],_0x26de91(0x1f8)+_0x7cbf6c+_0x26de91(0x22c)+_0x12f30b+'\x27)');return _0xd69b3e;};}export function extractRootFolderId(_0x54488d){const _0x4a44e3=a155_0x24d83c;return _0x54488d[_0x4a44e3(0x1c7)]?.['parentSegmentFolder']?.['data']?.['id']||_0x54488d[_0x4a44e3(0x1c7)]?.[_0x4a44e3(0x17d)]?.[_0x4a44e3(0x180)]?.['id'];}export function buildConnectionMaps(_0x2a6357){const _0x1ee603=a155_0x24d83c,_0x4e4209=new Map(),_0x591ea1=new Map(),_0x32838f=new Map();for(const _0x41742d of _0x2a6357){_0x4e4209['set'](_0x41742d[_0x1ee603(0x1fc)],parseInt(_0x41742d['id'],0xa)),_0x591ea1[_0x1ee603(0x169)](_0x41742d['id'],_0x41742d[_0x1ee603(0x1fc)]),_0x32838f[_0x1ee603(0x169)](_0x41742d[_0x1ee603(0x1fc)],_0x41742d['type']);}return{'nameToId':_0x4e4209,'idToName':_0x591ea1,'nameToType':_0x32838f};}export function calculatePushStats(_0x58a941,_0x3534c7,_0x4471e8,_0x2409ff,_0x5a75d6,_0xa1526a,_0x908bb4){const _0x1bc72c=a155_0x24d83c,_0x1229af=_0x58a941['filter'](_0x373454=>_0x373454[_0x1bc72c(0x258)]),_0x20f58e=_0x58a941[_0x1bc72c(0x197)](_0x43716c=>!_0x43716c[_0x1bc72c(0x258)]&&_0x43716c[_0x1bc72c(0x1e2)]),_0x594781=_0x58a941[_0x1bc72c(0x197)](_0x14cef4=>!_0x14cef4[_0x1bc72c(0x258)]&&!_0x14cef4[_0x1bc72c(0x1e2)]),_0x4d44ca=_0xa1526a?_0x2409ff:[],_0x3618ff=_0x3534c7[_0x1bc72c(0x197)](_0x24c9e8=>_0x24c9e8[_0x1bc72c(0x258)]),_0x464139=_0x3534c7[_0x1bc72c(0x197)](_0x8ecb26=>!_0x8ecb26[_0x1bc72c(0x258)]&&_0x8ecb26[_0x1bc72c(0x1e2)]),_0x24c036=_0x3534c7[_0x1bc72c(0x197)](_0x50c6db=>!_0x50c6db[_0x1bc72c(0x258)]&&!_0x50c6db[_0x1bc72c(0x1e2)]),_0x3d683f=_0xa1526a?_0x5a75d6:[],_0x28126c=_0x58a941['flatMap'](_0x38afc4=>_0x38afc4[_0x1bc72c(0x263)]),_0x427dbc=_0x28126c[_0x1bc72c(0x197)](_0x366451=>_0x366451[_0x1bc72c(0x18d)]===_0x1bc72c(0x22e)),_0x5d236c=_0x28126c[_0x1bc72c(0x197)](_0x5d7385=>_0x5d7385[_0x1bc72c(0x18d)]===_0x1bc72c(0x24c)),_0x141edd=_0x28126c[_0x1bc72c(0x197)](_0x20f750=>_0x20f750['type']===_0x1bc72c(0x1d4)),_0x2cd14f=Array[_0x1bc72c(0x1f3)](_0x4471e8)['sort'](),_0x7ef4a7=_0x908bb4?![]:_0x1229af[_0x1bc72c(0x1b3)]>0x0||_0x20f58e[_0x1bc72c(0x1b3)]>0x0||_0x4d44ca['length']>0x0,_0x3d5702=_0x3618ff[_0x1bc72c(0x1b3)]>0x0||_0x464139['length']>0x0||_0x3d683f[_0x1bc72c(0x1b3)]>0x0,_0x48a031=_0x908bb4?![]:_0x28126c[_0x1bc72c(0x1b3)]>0x0,_0x50ffee=_0x2cd14f['length']>0x0;return{'segments':{'new':_0x1229af,'changed':_0x20f58e,'unchanged':_0x594781,'toDelete':_0x4d44ca},'journeys':{'new':_0x3618ff,'changed':_0x464139,'unchanged':_0x24c036,'toDelete':_0x3d683f},'activations':{'all':_0x28126c,'toCreate':_0x427dbc,'toUpdate':_0x5d236c,'toDelete':_0x141edd},'folders':{'toCreate':_0x2cd14f},'counts':{'segments':{'new':_0x1229af[_0x1bc72c(0x1b3)],'changed':_0x20f58e[_0x1bc72c(0x1b3)],'unchanged':_0x594781['length'],'toDelete':_0x4d44ca['length']},'journeys':{'new':_0x3618ff[_0x1bc72c(0x1b3)],'changed':_0x464139[_0x1bc72c(0x1b3)],'unchanged':_0x24c036[_0x1bc72c(0x1b3)],'toDelete':_0x3d683f['length']},'activations':{'create':_0x427dbc[_0x1bc72c(0x1b3)],'update':_0x5d236c[_0x1bc72c(0x1b3)],'delete':_0x141edd[_0x1bc72c(0x1b3)]},'folders':_0x2cd14f[_0x1bc72c(0x1b3)]},'hasChanges':_0x7ef4a7||_0x3d5702||_0x48a031||_0x50ffee};}export async function buildPushExecutionContext(_0x1e1bb3,_0x51add7,_0x371805,_0xb4e655,_0x547e58,_0x432749){const _0x37f321=a155_0x24d83c,_0x4ab70b=extractRootFolderId(_0x371805),{pathToId:_0x4fa357,idToPath:_0xe7ac0}=buildFolderMaps(_0x547e58),_0x43dbab=buildSegmentNameToIdMap(_0xb4e655),_0x2828df=new Map(),{batchAsync:_0x4abde0}=await import('../../utils/async.js'),[_0xf9a988,_0x44f159]=await Promise[_0x37f321(0x1f0)]([_0x1e1bb3[_0x37f321(0x226)][_0x37f321(0x23d)](),_0x1e1bb3[_0x37f321(0x1f2)]['list'](),((async()=>{!_0x432749&&_0xb4e655['length']>0x0&&await _0x4abde0(_0xb4e655,async _0x5da4bc=>{const _0x21ac05=a155_0xe8d7,_0x53e99a=await _0x1e1bb3[_0x21ac05(0x206)][_0x21ac05(0x1c0)](_0x51add7,_0x5da4bc['id']);_0x2828df[_0x21ac05(0x169)](_0x5da4bc['id'],_0x53e99a);});})())]),{emailToId:_0x8b5e64,idToEmail:_0x2410d1}=_0xf9a988,_0x5e2f8c=buildConnectionMaps(_0x44f159);return{'rootFolderId':_0x4ab70b,'folderPathToId':_0x4fa357,'folderIdToPath':_0xe7ac0,'segmentNameToId':_0x43dbab,'activationsBySegmentId':_0x2828df,'emailToIdMap':_0x8b5e64,'idToEmailMap':_0x2410d1,'connectionNameToIdMap':_0x5e2f8c[_0x37f321(0x1e0)],'connectionIdToNameMap':_0x5e2f8c[_0x37f321(0x1c2)],'connectionNameToTypeMap':_0x5e2f8c[_0x37f321(0x1e5)]};}export function createPushYamlContextForBundle(_0x5b1cd0,_0x5e5394,_0x1b0727,_0x421227,_0x3a8bb2,_0xe6f081,_0x92d162,_0x23dfa9){const {existingLocalSegmentNames:_0x270293,localExpandedRuleToNames:_0x3fccf4}=_0x421227,_0x5ca56e=new Set(),_0x494ede=new Map(),_0x32e326=new Map(),_0x3ef9f2=new Map(),_0x41cab4=createJumpTargetCache(),_0x1c3f9d=new Map(),_0x297eab=new Map(),_0x15c0ae=new Set();let _0x30bd91;const _0xa97ee2=_0x4f96d0=>{const _0x219bc1={'resolveSegment':async _0x5c8e5e=>{const _0x48bd7=a155_0xe8d7,_0x3769a2=_0x3ef9f2[_0x48bd7(0x1fa)](_0x5c8e5e);if(_0x3769a2!==undefined)return{'name':_0x3769a2,'isJourneyLocal':!![]};try{const _0x3de607=await fetchSegment(_0x5b1cd0,_0x5e5394,_0x5c8e5e,_0x1b0727);if(!_0x3de607)throw new Error(_0x48bd7(0x1e4));const _0x2ec8a6=generateJourneyLocalName(_0x3de607[_0x48bd7(0x1fc)]),_0x234f1c=_0x3de607[_0x48bd7(0x1a8)]===SEGMENT_KIND_JOURNEY&&_0x2ec8a6!==undefined;let _0x13952f=_0x3de607['name'],_0x5aa228;if(_0x234f1c&&_0x3de607[_0x48bd7(0x21a)]){const _0x3e51c1=apiRuleToYaml(_0x3de607[_0x48bd7(0x21a)]);_0x297eab[_0x48bd7(0x169)](_0x5c8e5e,_0x3e51c1);const _0x2b5a01=async _0x115fef=>{const _0x47c3af=_0x48bd7,_0xdc83db=collectSegmentRefsFromRule(_0x115fef);for(const _0x26f48d of _0xdc83db){if(!_0x297eab[_0x47c3af(0x175)](_0x26f48d))try{const _0xf70949=await fetchSegment(_0x5b1cd0,_0x5e5394,_0x26f48d,_0x1b0727);if(_0xf70949?.[_0x47c3af(0x21a)]){const _0x4f2d0=apiRuleToYaml(_0xf70949[_0x47c3af(0x21a)]);_0x297eab[_0x47c3af(0x169)](_0x26f48d,_0x4f2d0),await _0x2b5a01(_0x4f2d0);}}catch(_0xcd1ed3){logger[_0x47c3af(0x1ca)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x26f48d+':\x20'+_0xcd1ed3);}}};await _0x2b5a01(_0x3e51c1);const _0x19b0b9=serializeExpandedRule(_0x3e51c1,_0x297eab),_0x20e9a7=_0x3fccf4[_0x48bd7(0x1fa)](_0x19b0b9);if(_0x20e9a7&&_0x20e9a7['length']>0x0){const _0x53a1ae=_0x494ede['get'](_0x19b0b9)||0x0,_0x57a8d8=_0x20e9a7[_0x53a1ae]||_0x20e9a7[_0x20e9a7[_0x48bd7(0x1b3)]-0x1];_0x494ede[_0x48bd7(0x169)](_0x19b0b9,_0x53a1ae+0x1),_0x13952f=_0x57a8d8,_0x5ca56e[_0x48bd7(0x1bb)](_0x13952f),_0x3ef9f2['set'](_0x5c8e5e,_0x13952f);const _0x464202=await resolveRuleSegmentRefs(_0x3e51c1,async _0x399548=>{const _0x45355e=_0x48bd7,_0x2f5a93=_0x3ef9f2[_0x45355e(0x1fa)](_0x399548);if(_0x2f5a93)return _0x2f5a93;const _0x6f717=await _0x30bd91[_0x45355e(0x1b5)](_0x399548);return _0x6f717[_0x45355e(0x1fc)];});_0x5aa228={'description':_0x3de607[_0x48bd7(0x243)],'rule':_0x464202};}else{const _0x4409fe=_0x1c3f9d[_0x48bd7(0x1fa)](_0x19b0b9);if(_0x4409fe)_0x13952f=_0x4409fe,_0x3ef9f2[_0x48bd7(0x169)](_0x5c8e5e,_0x13952f);else{if(_0x2ec8a6){let _0x3dc5bb=_0x2ec8a6,_0x17a365=0x2;while(_0x5ca56e[_0x48bd7(0x175)](_0x3dc5bb)||_0x270293[_0x48bd7(0x175)](_0x3dc5bb)){_0x3dc5bb=_0x2ec8a6+'_'+_0x17a365,_0x17a365++;}_0x5ca56e[_0x48bd7(0x1bb)](_0x3dc5bb),_0x13952f=_0x3dc5bb;}_0x3ef9f2['set'](_0x5c8e5e,_0x13952f),_0x1c3f9d[_0x48bd7(0x169)](_0x19b0b9,_0x13952f);const _0x53bdcd=await resolveRuleSegmentRefs(_0x3e51c1,async _0x444da4=>{const _0x1567de=_0x48bd7,_0x3ed8c8=_0x3ef9f2[_0x1567de(0x1fa)](_0x444da4);if(_0x3ed8c8)return _0x3ed8c8;const _0x1c0a15=await _0x30bd91[_0x1567de(0x1b5)](_0x444da4);return _0x1c0a15[_0x1567de(0x1fc)];});_0x5aa228={'description':_0x3de607[_0x48bd7(0x243)],'rule':_0x53bdcd};}}}return{'name':_0x13952f,'isJourneyLocal':_0x234f1c,'definition':_0x5aa228};}catch(_0x5ad4d8){return logger[_0x48bd7(0x1ca)]('Failed\x20to\x20resolve\x20segment\x20'+_0x5c8e5e+':\x20'+_0x5ad4d8),{'name':_0x5c8e5e,'isJourneyLocal':![]};}},'resolveActivation':async _0x59d299=>{const _0x42d006=a155_0xe8d7,_0x39f34e=_0x32e326[_0x42d006(0x1fa)](_0x59d299);if(_0x39f34e!==undefined)return{'name':_0x39f34e,'isJourneyLocal':!![]};try{let _0x895646=_0x92d162?.[_0x42d006(0x1fa)](_0x59d299);!_0x895646&&(_0x895646=await _0x5b1cd0[_0x42d006(0x21c)][_0x42d006(0x24e)](_0x4f96d0,_0x59d299));const _0x1a5ed6=_0x895646[_0x42d006(0x200)][_0x42d006(0x1d6)][_0x42d006(0x1fc)]||_0x59d299,_0x25cbfa=sanitizeYamlKey(_0x1a5ed6)||_0x42d006(0x1b0)+_0x59d299,_0x199918=_0x25cbfa;_0x32e326['set'](_0x59d299,_0x199918);const _0x20cd85=journeyActivationStepToYaml(_0x895646,_0x3a8bb2,_0xe6f081);return{'name':_0x199918,'isJourneyLocal':!![],'definition':_0x20cd85};}catch(_0xdc6a99){return logger['debug'](_0x42d006(0x26c)+_0x59d299+':\x20'+_0xdc6a99),{'name':_0x59d299,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x39d64c,_0x4dc019)=>resolveJumpTarget(_0x39d64c,_0x4dc019,_0x41cab4,async _0x3b6503=>{const _0x1b9c06=a155_0xe8d7,_0x3f47c2=_0x23dfa9?.[_0x1b9c06(0x1fa)](_0x3b6503);if(_0x3f47c2)return _0x3f47c2;return _0x5b1cd0['journey'][_0x1b9c06(0x23a)](_0x3b6503);})};return _0x30bd91=_0x219bc1,_0x219bc1;},_0x3bd605=async _0x2d5ffc=>{const _0x449c76=a155_0xe8d7,{collectSegmentIdsFromJourneyApi:_0x31468e}=await import('./journey-yaml.js'),{batchAsync:_0x5e0625}=await import('../../utils/async.js'),_0xd63e1d=new Set();for(const _0x4a0532 of _0x2d5ffc){let _0x26ef65=_0x23dfa9?.[_0x449c76(0x1fa)](_0x4a0532);!_0x26ef65&&(_0x26ef65=await _0x5b1cd0[_0x449c76(0x21c)][_0x449c76(0x23a)](_0x4a0532));const _0x54dc75=_0x31468e(_0x26ef65);for(const _0x5b416b of _0x54dc75){_0xd63e1d['add'](_0x5b416b);}}let _0x17c454=Array[_0x449c76(0x1f3)](_0xd63e1d);while(_0x17c454['length']>0x0){const _0x49c1a9=_0x17c454[_0x449c76(0x197)](_0x2c4ded=>!_0x15c0ae[_0x449c76(0x175)](_0x2c4ded));if(_0x49c1a9['length']===0x0)break;const _0x565208=await _0x5e0625(_0x49c1a9,async _0x58586b=>{_0x15c0ae['add'](_0x58586b);const _0x565cfe=await fetchSegment(_0x5b1cd0,_0x5e5394,_0x58586b,_0x1b0727);if(!_0x565cfe)return null;return{'segmentId':_0x58586b,'segment':_0x565cfe};},0xa),_0x3df747=new Set();for(const _0x3a4fe3 of _0x565208){if(!_0x3a4fe3?.[_0x449c76(0x206)]?.[_0x449c76(0x21a)])continue;const _0xb088d0=apiRuleToYaml(_0x3a4fe3[_0x449c76(0x206)][_0x449c76(0x21a)]);_0x297eab['set'](_0x3a4fe3[_0x449c76(0x18e)],_0xb088d0);const _0x46a43d=collectSegmentRefsFromRule(_0xb088d0);for(const _0x5c5c26 of _0x46a43d){!_0x15c0ae[_0x449c76(0x175)](_0x5c5c26)&&_0x3df747[_0x449c76(0x1bb)](_0x5c5c26);}}_0x17c454=Array['from'](_0x3df747);}};return{'createYamlContext':_0xa97ee2,'prefetchJourneySegments':_0x3bd605};}export async function executePushSegments(_0x496d95,_0x34f89f,_0x2e88e7,_0x2e8ea8,_0x505405){const _0xdc72ee=a155_0x24d83c,{segmentDefToCreateRequest:_0x13be7d,segmentDefToUpdateRequest:_0x3153eb}=await import(_0xdc72ee(0x224)),_0x221947=_0x2e88e7[_0xdc72ee(0x220)],_0x31338c=0x5,_0x1d5cf9=async _0x331f58=>{const _0x112eef=_0xdc72ee,_0xd31707=_0x331f58[_0x112eef(0x1bc)]?_0x221947[_0x112eef(0x1fa)](_0x331f58['folderPath']):undefined;let _0x2e94cb;const _0x46f67f={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x64e868=_0x331f58[_0x112eef(0x1cf)];if(_0x331f58['yamlConfig'][_0x112eef(0x21a)]){const _0x4906ba=createSegmentIdResolver(_0x2e88e7['segmentNameToId'],_0x331f58['yamlConfig'][_0x112eef(0x1fc)]),_0x377ebf=await resolveRuleSegmentIds(_0x331f58['yamlConfig'][_0x112eef(0x21a)],_0x4906ba);_0x64e868={..._0x331f58[_0x112eef(0x1cf)],'rule':_0x377ebf};}try{if(_0x331f58[_0x112eef(0x258)]){_0x505405[_0x112eef(0x1ef)]?.({'type':_0x112eef(0x26e),'name':_0x331f58[_0x112eef(0x1cf)][_0x112eef(0x1fc)]});const _0x2aaea1=_0x13be7d(_0x64e868,_0xd31707),_0x32e4dc=await _0x505405[_0x112eef(0x238)]('Creating\x20segment\x20\x27'+_0x331f58[_0x112eef(0x1cf)][_0x112eef(0x1fc)]+'\x27...',()=>_0x496d95[_0x112eef(0x206)][_0x112eef(0x255)](_0x2e8ea8[_0x112eef(0x171)],_0x2aaea1));_0x2e94cb=_0x32e4dc['data']['id'],_0x2e88e7['segmentNameToId'][_0x112eef(0x169)](_0x331f58['yamlConfig'][_0x112eef(0x1fc)],_0x2e94cb),_0x46f67f[_0x112eef(0x199)]={'name':_0x331f58[_0x112eef(0x1cf)][_0x112eef(0x1fc)],'id':_0x2e94cb},_0x505405[_0x112eef(0x1ef)]?.({'type':'segment_created','name':_0x331f58[_0x112eef(0x1cf)][_0x112eef(0x1fc)],'segmentId':_0x2e94cb}),_0x505405[_0x112eef(0x204)]?.(_0x112eef(0x1c8)+_0x331f58['yamlConfig'][_0x112eef(0x1fc)]+'\x27'),_0x46f67f[_0x112eef(0x24f)]=0x1;}else{if(_0x331f58[_0x112eef(0x1e2)]){_0x505405[_0x112eef(0x1ef)]?.({'type':_0x112eef(0x229),'name':_0x331f58[_0x112eef(0x1cf)][_0x112eef(0x1fc)]});const _0x3cbc2c=_0x3153eb(_0x64e868);_0xd31707!==_0x331f58[_0x112eef(0x246)]?.[_0x112eef(0x203)]&&(_0x3cbc2c[_0x112eef(0x203)]=_0xd31707?parseInt(_0xd31707,0xa):undefined),await _0x505405['withProgress']('Updating\x20segment\x20\x27'+_0x331f58[_0x112eef(0x1cf)][_0x112eef(0x1fc)]+_0x112eef(0x1ce),()=>_0x496d95[_0x112eef(0x206)]['updateSegmentById'](_0x2e8ea8[_0x112eef(0x171)],_0x331f58[_0x112eef(0x246)]['id'],_0x3cbc2c)),_0x2e94cb=_0x331f58[_0x112eef(0x246)]['id'],_0x505405['onProgress']?.({'type':_0x112eef(0x19a),'name':_0x331f58[_0x112eef(0x1cf)][_0x112eef(0x1fc)]}),_0x505405[_0x112eef(0x204)]?.('Updated\x20segment\x20\x27'+_0x331f58[_0x112eef(0x1cf)][_0x112eef(0x1fc)]+'\x27'),_0x46f67f['updated']=0x1;}else _0x2e94cb=_0x331f58[_0x112eef(0x246)]['id'];}}catch(_0x13e420){const _0x241bde=isHttp400Error(_0x13e420),_0x226b22=_0x241bde?ErrorCode[_0x112eef(0x1e9)]:ErrorCode[_0x112eef(0x18b)],_0x4e6bc4=getErrorMessage(_0x13e420);throw new SDKError(_0x226b22,_0x112eef(0x201)+(_0x331f58[_0x112eef(0x258)]?_0x112eef(0x22e):_0x112eef(0x24c))+_0x112eef(0x17a)+_0x331f58[_0x112eef(0x20a)]+'\x0a\x20\x20'+_0x4e6bc4,_0x13e420);}try{const _0x3d9edb=await syncActivationsForSegment(_0x496d95,_0x2e8ea8[_0x112eef(0x171)],_0x2e94cb,_0x331f58[_0x112eef(0x1cf)][_0x112eef(0x1fc)],_0x331f58[_0x112eef(0x263)],_0x505405,_0x331f58['absolutePath']);_0x46f67f[_0x112eef(0x1de)]=_0x3d9edb;}catch(_0x329449){if(_0x329449 instanceof SDKError)throw _0x329449;throw new SDKError(ErrorCode[_0x112eef(0x1db)],_0x112eef(0x266)+_0x331f58[_0x112eef(0x1cf)][_0x112eef(0x1fc)]+_0x112eef(0x1b6)+_0x331f58[_0x112eef(0x20a)]+_0x112eef(0x186)+getErrorMessage(_0x329449),_0x329449);}return _0x46f67f;},_0x29d285=await batchAsync(_0x34f89f,_0x1d5cf9,_0x31338c),_0x5756c6={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x2e9ca0 of _0x29d285){_0x5756c6[_0xdc72ee(0x24f)]+=_0x2e9ca0[_0xdc72ee(0x24f)],_0x5756c6[_0xdc72ee(0x18c)]+=_0x2e9ca0[_0xdc72ee(0x18c)],_0x2e9ca0[_0xdc72ee(0x199)]&&_0x5756c6['createdSegmentIds'][_0xdc72ee(0x169)](_0x2e9ca0[_0xdc72ee(0x199)][_0xdc72ee(0x1fc)],_0x2e9ca0[_0xdc72ee(0x199)]['id']),_0x5756c6[_0xdc72ee(0x1de)]['created']+=_0x2e9ca0[_0xdc72ee(0x1de)]['created'],_0x5756c6[_0xdc72ee(0x1de)][_0xdc72ee(0x18c)]+=_0x2e9ca0[_0xdc72ee(0x1de)][_0xdc72ee(0x18c)],_0x5756c6[_0xdc72ee(0x1de)]['deleted']+=_0x2e9ca0[_0xdc72ee(0x1de)]['deleted'];}return _0x5756c6;}async function syncActivationsForSegment(_0x370e57,_0x2fa39b,_0x51b6c2,_0x2d1503,_0x4175af,_0x23dd92,_0x587e42){const _0x5c15d3=a155_0x24d83c,_0x400191={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x5b2d7f of _0x4175af){try{if(_0x5b2d7f[_0x5c15d3(0x18d)]==='create'&&_0x5b2d7f[_0x5c15d3(0x1d0)])_0x23dd92['onProgress']?.({'type':_0x5c15d3(0x1e1),'segmentName':_0x2d1503,'activationName':_0x5b2d7f[_0x5c15d3(0x1fc)]}),await _0x23dd92['withProgress'](_0x5c15d3(0x232)+_0x5b2d7f[_0x5c15d3(0x1fc)]+_0x5c15d3(0x1ce),()=>_0x370e57[_0x5c15d3(0x206)][_0x5c15d3(0x20c)](_0x2fa39b,_0x51b6c2,_0x5b2d7f[_0x5c15d3(0x1d0)])),_0x23dd92[_0x5c15d3(0x1ef)]?.({'type':_0x5c15d3(0x1af),'segmentName':_0x2d1503,'activationName':_0x5b2d7f[_0x5c15d3(0x1fc)]}),_0x23dd92[_0x5c15d3(0x204)]?.(_0x5c15d3(0x1ff)+_0x5b2d7f[_0x5c15d3(0x1fc)]+'\x27'),_0x400191[_0x5c15d3(0x24f)]++;else{if(_0x5b2d7f['type']===_0x5c15d3(0x24c)&&_0x5b2d7f[_0x5c15d3(0x1d0)]&&_0x5b2d7f[_0x5c15d3(0x215)])_0x23dd92[_0x5c15d3(0x1ef)]?.({'type':_0x5c15d3(0x239),'segmentName':_0x2d1503,'activationName':_0x5b2d7f[_0x5c15d3(0x1fc)]}),await _0x23dd92[_0x5c15d3(0x238)](_0x5c15d3(0x174)+_0x5b2d7f[_0x5c15d3(0x1fc)]+_0x5c15d3(0x1ce),()=>_0x370e57[_0x5c15d3(0x206)][_0x5c15d3(0x1a2)](_0x2fa39b,_0x51b6c2,_0x5b2d7f[_0x5c15d3(0x215)]['id'],_0x5b2d7f['validatedRequest'])),_0x23dd92[_0x5c15d3(0x1ef)]?.({'type':'activation_updated','segmentName':_0x2d1503,'activationName':_0x5b2d7f[_0x5c15d3(0x1fc)]}),_0x23dd92[_0x5c15d3(0x204)]?.(_0x5c15d3(0x222)+_0x5b2d7f[_0x5c15d3(0x1fc)]+'\x27'),_0x400191[_0x5c15d3(0x18c)]++;else _0x5b2d7f['type']===_0x5c15d3(0x1d4)&&_0x5b2d7f['existingActivation']&&(_0x23dd92[_0x5c15d3(0x1ef)]?.({'type':_0x5c15d3(0x23b),'segmentName':_0x2d1503,'activationName':_0x5b2d7f['name']}),await _0x23dd92[_0x5c15d3(0x238)](_0x5c15d3(0x1c5)+_0x5b2d7f[_0x5c15d3(0x1fc)]+_0x5c15d3(0x1ce),()=>_0x370e57[_0x5c15d3(0x206)][_0x5c15d3(0x1d9)](_0x2fa39b,_0x51b6c2,_0x5b2d7f[_0x5c15d3(0x215)]['id'])),_0x23dd92['onProgress']?.({'type':_0x5c15d3(0x1a0),'segmentName':_0x2d1503,'activationName':_0x5b2d7f['name']}),_0x23dd92[_0x5c15d3(0x16f)]?.(_0x5c15d3(0x1da)+_0x5b2d7f[_0x5c15d3(0x1fc)]+'\x27'),_0x400191[_0x5c15d3(0x262)]++);}}catch(_0x2f45f7){const _0x4962de=isHttp400Error(_0x2f45f7),_0x563de8=_0x4962de?ErrorCode[_0x5c15d3(0x22a)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x388d7a=getErrorMessage(_0x2f45f7);throw new SDKError(_0x563de8,_0x5c15d3(0x201)+_0x5b2d7f[_0x5c15d3(0x18d)]+_0x5c15d3(0x1ad)+_0x5b2d7f['name']+_0x5c15d3(0x1b6)+_0x587e42+'\x0a\x20\x20'+_0x388d7a,_0x2f45f7);}}return _0x400191;}export async function executePushFolders(_0x56dab8,_0x16ced8,_0x2e9425,_0x1be0bd,_0x167265){const _0x1bfeca=a155_0x24d83c,_0x50528b=new Map(_0x2e9425),_0x8cf7dc=sortFoldersByDepth(_0x16ced8);for(const _0x2001fb of _0x8cf7dc){const _0x257b8=_0x2001fb[_0x1bfeca(0x187)]('/'),_0x3a8900=_0x257b8[_0x257b8[_0x1bfeca(0x1b3)]-0x1],_0x3de86c=_0x257b8[_0x1bfeca(0x1ec)](0x0,-0x1)['join']('/'),_0x483bb1=_0x50528b[_0x1bfeca(0x1fa)](_0x3de86c);_0x167265[_0x1bfeca(0x1ef)]?.({'type':'folder_creating','folder':_0x2001fb});const _0x5b391a={'name':_0x3a8900,'parentFolderId':_0x483bb1},_0x5905ef=await _0x167265[_0x1bfeca(0x238)](_0x1bfeca(0x214)+_0x2001fb+_0x1bfeca(0x1ce),()=>_0x56dab8[_0x1bfeca(0x206)][_0x1bfeca(0x216)](_0x1be0bd['parentId'],_0x5b391a));_0x50528b[_0x1bfeca(0x169)](_0x2001fb,_0x5905ef['data']['id']),_0x167265[_0x1bfeca(0x1ef)]?.({'type':_0x1bfeca(0x228),'folder':_0x2001fb,'folderId':_0x5905ef[_0x1bfeca(0x180)]['id']}),_0x167265[_0x1bfeca(0x1f9)]?.('Created\x20folder\x20\x27'+_0x2001fb+'\x27');}return _0x50528b;}export async function executePushSegmentDeletions(_0x2f4594,_0x387f49,_0x31cb5b){const _0x2644ff=a155_0x24d83c;if(_0x387f49[_0x2644ff(0x1b3)]===0x0)return 0x0;const {batchAsync:_0x532f54}=await import(_0x2644ff(0x23e)),_0x47d112=0x5,_0x5e4561=await _0x532f54(_0x387f49,async _0x2c13a5=>{const _0x19d92f=_0x2644ff;return _0x31cb5b[_0x19d92f(0x1ef)]?.({'type':_0x19d92f(0x19d),'name':_0x2c13a5[_0x19d92f(0x1fc)]}),await _0x2f4594[_0x19d92f(0x206)][_0x19d92f(0x1b4)](_0x2c13a5['id']),_0x31cb5b['onProgress']?.({'type':_0x19d92f(0x1cd),'name':_0x2c13a5[_0x19d92f(0x1fc)]}),_0x31cb5b['logDeleted']?.(_0x19d92f(0x24d)+_0x2c13a5['name']+'\x27'),0x1;},_0x47d112);return _0x5e4561[_0x2644ff(0x244)]((_0x107a84,_0x1354f7)=>_0x107a84+_0x1354f7,0x0);}export async function executePushJourneys(_0x90512a,_0x37c41e,_0x18c3ff,_0x283455,_0x2efb1e){const _0x699f49=a155_0x24d83c,{journeyDefToRequest:_0xcc4f3d}=await import(_0x699f49(0x17e)),{activationDefToCreateRequest:_0x42ed09,yamlRuleToApi:_0x3c8f37,validateSegmentRule:_0x43b7cd}=await import(_0x699f49(0x224)),_0x2c5aa0={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x406bb4=new Map(_0x18c3ff['segmentNameToId']),_0x45793f=0x5;for(let _0x31b93d=0x0;_0x31b93d<_0x37c41e['length'];_0x31b93d+=_0x45793f){const _0x17de8a=_0x37c41e[_0x699f49(0x1ec)](_0x31b93d,_0x31b93d+_0x45793f),_0x3c5bf5=await Promise[_0x699f49(0x1f0)](_0x17de8a['map'](async _0x34d77a=>{const _0x4e5e13=_0x699f49;if(!_0x34d77a[_0x4e5e13(0x258)]&&!_0x34d77a[_0x4e5e13(0x1e2)])return{'action':_0x4e5e13(0x1ba),'name':_0x34d77a[_0x4e5e13(0x1cf)]['name'],'journeyId':_0x34d77a[_0x4e5e13(0x16a)]?.['id']};const _0x11a520=_0x34d77a['folderPath']?_0x18c3ff['folderPathToId'][_0x4e5e13(0x1fa)](_0x34d77a[_0x4e5e13(0x1bc)]):undefined;_0x2efb1e[_0x4e5e13(0x1ef)]?.({'type':_0x34d77a[_0x4e5e13(0x258)]?_0x4e5e13(0x1e6):_0x4e5e13(0x176),'name':_0x34d77a[_0x4e5e13(0x1cf)]['name']});try{const _0x1db120=await executeSingleJourneyPush(_0x90512a,_0x34d77a,{..._0x18c3ff,'segmentNameToId':_0x406bb4},{'parentId':_0x283455[_0x4e5e13(0x171)],'rootFolderId':_0x283455[_0x4e5e13(0x267)],'folderId':_0x11a520,'verbose':_0x283455['verbose']},_0x2efb1e,{'journeyDefToRequest':_0xcc4f3d,'activationDefToCreateRequest':_0x42ed09,'yamlRuleToApi':_0x3c8f37,'validateSegmentRule':_0x43b7cd});for(const [_0x550088,_0x21e1f9]of _0x1db120['embeddedSegmentNameToId']){_0x406bb4[_0x4e5e13(0x169)](_0x550088,_0x21e1f9),_0x2c5aa0['embeddedSegmentNameToId']['set'](_0x550088,_0x21e1f9);}if(_0x1db120[_0x4e5e13(0x23f)]===_0x4e5e13(0x24f))_0x2efb1e[_0x4e5e13(0x1ef)]?.({'type':_0x4e5e13(0x1c1),'name':_0x34d77a[_0x4e5e13(0x1cf)][_0x4e5e13(0x1fc)],'journeyId':_0x1db120[_0x4e5e13(0x1a1)]}),_0x2efb1e[_0x4e5e13(0x204)]?.(_0x4e5e13(0x181)+_0x34d77a[_0x4e5e13(0x1cf)][_0x4e5e13(0x1fc)]+'\x27'),_0x2c5aa0[_0x4e5e13(0x24f)]++;else _0x1db120[_0x4e5e13(0x23f)]==='updated'&&(_0x2efb1e[_0x4e5e13(0x1ef)]?.({'type':'journey_updated','name':_0x34d77a[_0x4e5e13(0x1cf)][_0x4e5e13(0x1fc)]}),_0x2efb1e[_0x4e5e13(0x204)]?.('Updated\x20journey\x20\x27'+_0x34d77a[_0x4e5e13(0x1cf)][_0x4e5e13(0x1fc)]+'\x27'),_0x2c5aa0['updated']++);return{'action':_0x1db120[_0x4e5e13(0x23f)],'name':_0x34d77a[_0x4e5e13(0x1cf)][_0x4e5e13(0x1fc)],'journeyId':_0x1db120[_0x4e5e13(0x1a1)]};}catch(_0x226250){const _0x378a21=isHttp400Error(_0x226250),_0xd6bbb6=_0x378a21?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode[_0x4e5e13(0x1d2)],_0x2de798=getErrorMessage(_0x226250);throw new SDKError(_0xd6bbb6,_0x4e5e13(0x201)+(_0x34d77a[_0x4e5e13(0x258)]?_0x4e5e13(0x22e):'update')+_0x4e5e13(0x269)+_0x34d77a[_0x4e5e13(0x20a)]+_0x4e5e13(0x186)+_0x2de798,_0x226250);}}));_0x2c5aa0[_0x699f49(0x205)][_0x699f49(0x21d)](..._0x3c5bf5);}return _0x2c5aa0;}async function matchExistingJourneySegments(_0x1982bf,_0x21e44d,_0x2df260,_0x5bc171,_0x4ddd4b){const _0x5e470c=a155_0x24d83c;if(!_0x21e44d['existingJourney']||!_0x21e44d[_0x5e470c(0x1cf)][_0x5e470c(0x231)])return;const _0x35e923=new Map(),_0xc4305d=new Set();for(const _0x21e5d8 of Object[_0x5e470c(0x19c)](_0x21e44d['yamlConfig'][_0x5e470c(0x231)])){const _0x18204c=generateDeterministicJourneySegmentName(_0x21e44d['yamlConfig'][_0x5e470c(0x1fc)],_0x21e5d8);_0x35e923['set'](_0x18204c,_0x21e5d8),_0xc4305d[_0x5e470c(0x1bb)](_0x21e5d8);}const _0x5e1b0a=[],_0x59d627=collectSegmentIdsFromJourneyApi(_0x21e44d[_0x5e470c(0x16a)]);for(const _0x515755 of _0x59d627){const _0x519938=await fetchSegment(_0x1982bf,_0x2df260,_0x515755,_0x5bc171);if(!_0x519938?.[_0x5e470c(0x1fc)])continue;const _0x3fb8bb=_0x35e923[_0x5e470c(0x1fa)](_0x519938[_0x5e470c(0x1fc)]);_0x3fb8bb?(_0x4ddd4b[_0x5e470c(0x169)](_0x3fb8bb,_0x515755),_0xc4305d[_0x5e470c(0x1d4)](_0x3fb8bb)):_0x5e1b0a['push']({'id':_0x515755,'seg':_0x519938});}if(_0xc4305d[_0x5e470c(0x17f)]>0x0&&_0x5e1b0a[_0x5e470c(0x1b3)]>0x0){const {localExpandedRuleToNames:_0xa55fcd}=buildLocalExpandedRuleMappings(_0x21e44d[_0x5e470c(0x1cf)]),_0x3eb365=new Map();for(const {id:_0x462e03,seg:_0x38552b}of _0x5e1b0a){if(_0x38552b[_0x5e470c(0x21a)]){const _0x232e09=apiRuleToYaml(_0x38552b[_0x5e470c(0x21a)]);_0x3eb365[_0x5e470c(0x169)](_0x462e03,_0x232e09);}}for(const {id:_0x1f63f0,seg:_0x3920c0}of _0x5e1b0a){if(!_0x3920c0[_0x5e470c(0x21a)])continue;const _0x1bd83b=_0x3eb365[_0x5e470c(0x1fa)](_0x1f63f0);if(!_0x1bd83b)continue;const _0x1e566c=serializeExpandedRule(_0x1bd83b,_0x3eb365),_0x58ccaa=_0xa55fcd[_0x5e470c(0x1fa)](_0x1e566c);if(_0x58ccaa){const _0x39006f=_0x58ccaa[_0x5e470c(0x172)](_0x46a86f=>_0xc4305d[_0x5e470c(0x175)](_0x46a86f));_0x39006f&&(_0x4ddd4b[_0x5e470c(0x169)](_0x39006f,_0x1f63f0),_0xc4305d[_0x5e470c(0x1d4)](_0x39006f),logger[_0x5e470c(0x1ca)](_0x5e470c(0x213)+_0x3920c0['name']+_0x5e470c(0x259)+_0x39006f+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x5338b9,_0x2cd705,_0x3e8653,_0x4b6551,_0x263f58,_0x507707){const _0x3e78d4=a155_0x24d83c,{journeyDefToRequest:_0x132216,activationDefToCreateRequest:_0x3c05bc,yamlRuleToApi:_0x287c3e,validateSegmentRule:_0x5df5ae}=_0x507707,_0x35b646=new Map(),_0x2ad25c=new Map();recoverSegmentIdsFromPushRecovery(_0x2cd705,_0x35b646,_0x3e8653['segmentNameToId']);const _0x55359a=new Map(),_0x5ba672=new Map(),_0x2cca0b=new Map();let _0x232edf;const _0x4a989c=async()=>{const _0x244171=a155_0xe8d7;if(_0x232edf)return;_0x232edf=new Map();if(!_0x2cd705[_0x244171(0x16a)])return;const _0x3213a5=await _0x5338b9[_0x244171(0x21c)][_0x244171(0x1c0)](_0x2cd705[_0x244171(0x16a)]['id']);for(const _0x222c60 of _0x3213a5){const _0x29f61b=journeyActivationStepToYaml(_0x222c60,_0x3e8653[_0x244171(0x254)],_0x3e8653[_0x244171(0x1b1)]),_0x241dc3=activationSignature(_0x29f61b);!_0x232edf[_0x244171(0x175)](_0x241dc3)&&_0x232edf[_0x244171(0x169)](_0x241dc3,_0x222c60['id']),_0x29f61b[_0x244171(0x1fc)]&&_0x2ad25c['set'](_0x29f61b[_0x244171(0x1fc)],_0x222c60['id']);}};await matchExistingJourneySegments(_0x5338b9,_0x2cd705,_0x4b6551[_0x3e78d4(0x171)],_0x3e8653[_0x3e78d4(0x1e3)],_0x3e8653['segmentNameToId']);const _0x108930={'resolveSegmentId':async _0x47e6f8=>{const _0x2e831b=_0x3e78d4,_0x1adfe8=_0x3e8653[_0x2e831b(0x24b)]['get'](_0x47e6f8);if(!_0x1adfe8)throw new SDKError(ErrorCode[_0x2e831b(0x198)],_0x2e831b(0x1f8)+_0x47e6f8+'\x20(referenced\x20in\x20journey\x20'+_0x2cd705[_0x2e831b(0x1cf)][_0x2e831b(0x1fc)]+')');return _0x1adfe8;},'resolveEmbeddedSegmentId':async(_0x2e7a24,_0x37803f)=>{const _0x5bca94=_0x3e78d4,_0x3adc9b=_0x3e8653[_0x5bca94(0x24b)][_0x5bca94(0x1fa)](_0x2e7a24);if(_0x3adc9b)return _0x3adc9b;const _0x314a5c=_0x3e8653['existingSegments'][_0x5bca94(0x172)](_0x42c41c=>_0x42c41c[_0x5bca94(0x1fc)]===_0x2e7a24);if(_0x314a5c)return _0x3e8653['segmentNameToId']['set'](_0x2e7a24,_0x314a5c['id']),_0x314a5c['id'];if(_0x2cd705['isNew']){const {stageName:_0x16e2a6,criteriaName:_0x30875a}=findSegmentCriteriaLocation(_0x2cd705['yamlConfig'],_0x2e7a24);return _0x5df5ae(_0x2e7a24,_0x37803f[_0x5bca94(0x21a)]),_0x5ba672[_0x5bca94(0x169)](_0x2e7a24,{'definition':_0x37803f,'stageName':_0x16e2a6,'criteriaName':_0x30875a}),createPendingSegmentId(_0x2e7a24);}const _0x47c03b=_0x2cd705['existingJourney']?.['id'];if(!_0x47c03b)throw new SDKError(ErrorCode['INTERNAL'],_0x5bca94(0x209));const _0x249cec=_0x55359a[_0x5bca94(0x1fa)](_0x2e7a24);if(_0x249cec)return _0x249cec;const _0x86f21b=((async()=>{const _0x3fabdf=_0x5bca94;_0x5df5ae(_0x2e7a24,_0x37803f['rule']);const _0x6d8985=generateDeterministicJourneySegmentName(_0x2cd705[_0x3fabdf(0x1cf)]['name'],_0x2e7a24),_0x392190=_0x3e8653[_0x3fabdf(0x1e3)][_0x3fabdf(0x172)](_0x57ce50=>_0x57ce50['name']===_0x6d8985),_0x42dd2a=createSegmentIdResolver(_0x3e8653['segmentNameToId'],_0x2e7a24),_0x24a3e7=await resolveRuleSegmentIds(_0x37803f['rule'],_0x42dd2a);let _0x2aa1b9;return _0x392190?(await _0x5338b9[_0x3fabdf(0x206)]['updateSegmentById'](_0x4b6551[_0x3fabdf(0x171)],_0x392190['id'],{'description':_0x37803f[_0x3fabdf(0x243)]||_0x3fabdf(0x1d5)+_0x2e7a24,'rule':_0x287c3e(_0x24a3e7),'countPopulation':!![]}),_0x2aa1b9=_0x392190['id'],saveSegmentToPushRecovery(_0x2cd705[_0x3fabdf(0x20a)],_0x2cd705[_0x3fabdf(0x1cf)]['name'],_0x2e7a24,{'segmentId':_0x2aa1b9,'uniqueServerName':_0x6d8985,'createdAt':new Date()['toISOString']()})):_0x2aa1b9=await createOrRecoverEmbeddedSegment(_0x5338b9,_0x2cd705,{'localName':_0x2e7a24,'uniqueSegmentName':_0x6d8985,'description':_0x37803f[_0x3fabdf(0x243)]||_0x3fabdf(0x1d5)+_0x2e7a24,'journeyId':_0x47c03b,'resolvedRule':_0x24a3e7,'parentId':_0x4b6551['parentId'],'folderId':_0x4b6551[_0x3fabdf(0x267)]||''},_0x287c3e),_0x3e8653[_0x3fabdf(0x24b)][_0x3fabdf(0x169)](_0x2e7a24,_0x2aa1b9),_0x35b646[_0x3fabdf(0x169)](_0x2e7a24,_0x2aa1b9),_0x2aa1b9;})());_0x55359a[_0x5bca94(0x169)](_0x2e7a24,_0x86f21b);try{return await _0x86f21b;}finally{_0x55359a[_0x5bca94(0x1d4)](_0x2e7a24);}},'resolveActivationId':async _0x34fb04=>{const _0x3a0eb2=_0x3e78d4,_0x1aa13e=_0x2ad25c[_0x3a0eb2(0x1fa)](_0x34fb04);if(_0x1aa13e)return _0x1aa13e;if(_0x2cd705[_0x3a0eb2(0x16a)]){await _0x4a989c();const _0x5cbbe6=_0x2ad25c['get'](_0x34fb04);if(_0x5cbbe6)return _0x5cbbe6;}throw new SDKError(ErrorCode[_0x3a0eb2(0x25c)],_0x3a0eb2(0x1df)+_0x34fb04+_0x3a0eb2(0x21e)+_0x2cd705[_0x3a0eb2(0x1cf)][_0x3a0eb2(0x1fc)]+_0x3a0eb2(0x233)+_0x3a0eb2(0x247));},'resolveEmbeddedActivationId':async(_0x2aa776,_0xb05aff)=>{const _0x2099fd=_0x3e78d4,_0x5bdcf0=_0x2ad25c['get'](_0x2aa776);if(_0x5bdcf0)return _0x5bdcf0;if(_0x2cd705['isNew'])return _0x2cca0b[_0x2099fd(0x169)](_0x2aa776,_0xb05aff),createPendingActivationId(_0x2aa776);if(_0x2cd705[_0x2099fd(0x16a)]){await _0x4a989c();const _0x20e73a=_0x2ad25c[_0x2099fd(0x1fa)](_0xb05aff[_0x2099fd(0x1fc)]);if(_0x20e73a)return _0x2ad25c[_0x2099fd(0x169)](_0x2aa776,_0x20e73a),_0x20e73a;const _0x273a28=activationSignature(_0xb05aff),_0x42773b=_0x232edf?.['get'](_0x273a28);if(_0x42773b)return _0x2ad25c[_0x2099fd(0x169)](_0x2aa776,_0x42773b),_0x42773b;const _0x418eae=await _0x3c05bc(_0xb05aff,_0x3e8653['activationContext']),_0x2fcc41={..._0x418eae,..._0xb05aff[_0x2099fd(0x234)]!==undefined&&{'runAfterJourneyRefresh':_0xb05aff['run_after_journey_refresh']}},_0x408b14=await _0x5338b9[_0x2099fd(0x21c)]['createActivation'](_0x2cd705[_0x2099fd(0x16a)]['id'],_0x2fcc41);return _0x2ad25c['set'](_0x2aa776,_0x408b14['id']),_0x408b14['id'];}throw new SDKError(ErrorCode[_0x2099fd(0x25a)],_0x2099fd(0x219));},'resolveJourneyId':async _0x129c7a=>{const _0x70357f=_0x3e78d4;try{return await _0x5338b9['journey'][_0x70357f(0x19e)](_0x4b6551[_0x70357f(0x171)],_0x129c7a);}catch(_0x9f204b){throw new SDKError(ErrorCode[_0x70357f(0x25c)],_0x70357f(0x1f4)+_0x129c7a+_0x70357f(0x1d3)+_0x2cd705['yamlConfig'][_0x70357f(0x1fc)]+'\x27)',_0x9f204b);}},'resolveStageId':async(_0x3ff193,_0x371b27)=>{const _0x59b7c1=_0x3e78d4,_0x5ece8c=await _0x5338b9[_0x59b7c1(0x21c)][_0x59b7c1(0x23a)](_0x3ff193),_0xdd5198=_0x5ece8c[_0x59b7c1(0x200)][_0x59b7c1(0x22f)][_0x59b7c1(0x172)](_0x5f1268=>_0x5f1268[_0x59b7c1(0x1fc)][_0x59b7c1(0x20f)]()===_0x371b27[_0x59b7c1(0x20f)]());if(!_0xdd5198?.['id'])throw new SDKError(ErrorCode[_0x59b7c1(0x25c)],'Stage\x20\x27'+_0x371b27+_0x59b7c1(0x193)+(_0x5ece8c[_0x59b7c1(0x200)][_0x59b7c1(0x182)]||_0x5ece8c[_0x59b7c1(0x200)][_0x59b7c1(0x1fc)])+'\x27');return _0xdd5198['id'];}},_0x1c0616=await _0x132216(_0x2cd705[_0x3e78d4(0x1cf)],_0x4b6551['parentId'],_0x108930),_0x1ab2d1=_0x4b6551[_0x3e78d4(0x1be)]||_0x4b6551[_0x3e78d4(0x267)];_0x1ab2d1&&(_0x1c0616[_0x3e78d4(0x1c7)]={'parentFolder':{'data':{'id':_0x1ab2d1,'type':_0x3e78d4(0x1bd)}}});if(_0x2cd705[_0x3e78d4(0x258)]){if(_0x5ba672[_0x3e78d4(0x17f)]>0x0||_0x2cca0b[_0x3e78d4(0x17f)]>0x0)return await executeThreeStepJourneyCreate(_0x5338b9,_0x2cd705,_0x1c0616,{'pendingEmbeddedSegments':_0x5ba672,'pendingEmbeddedActivations':_0x2cca0b,'embeddedSegmentNameToId':_0x35b646,'journeyActivationNameToId':_0x2ad25c},{..._0x4b6551,'effectiveFolderId':_0x1ab2d1},_0x3e8653,_0x263f58,_0x507707);else{ensureJourneyDefaults(_0x1c0616[_0x3e78d4(0x200)]);const _0x20623f=await _0x5338b9[_0x3e78d4(0x21c)][_0x3e78d4(0x22e)](_0x1c0616);return deletePushRecovery(_0x2cd705['absolutePath']),{'action':_0x3e78d4(0x24f),'journeyId':_0x20623f['id'],'embeddedSegmentNameToId':_0x35b646};}}else{if(_0x2cd705[_0x3e78d4(0x1e2)]&&_0x2cd705[_0x3e78d4(0x16a)]){_0x1c0616['id']=_0x2cd705[_0x3e78d4(0x16a)]['id'];const _0x7b6688=_0x1c0616[_0x3e78d4(0x200)];_0x2cd705['existingJourney'][_0x3e78d4(0x200)]?.[_0x3e78d4(0x182)]&&(_0x7b6688[_0x3e78d4(0x182)]=_0x2cd705[_0x3e78d4(0x16a)][_0x3e78d4(0x200)][_0x3e78d4(0x182)]);const _0x342d14=_0x2cd705[_0x3e78d4(0x16a)][_0x3e78d4(0x200)]?.[_0x3e78d4(0x22f)];return _0x342d14&&_0x1c0616['attributes'][_0x3e78d4(0x22f)]&&injectExistingStageIds(_0x1c0616['attributes'][_0x3e78d4(0x22f)],_0x342d14),ensureJourneyDefaults(_0x7b6688),await _0x5338b9['journey'][_0x3e78d4(0x24c)](_0x2cd705[_0x3e78d4(0x16a)]['id'],_0x1c0616),deletePushRecovery(_0x2cd705['absolutePath']),{'action':_0x3e78d4(0x18c),'journeyId':_0x2cd705[_0x3e78d4(0x16a)]['id'],'embeddedSegmentNameToId':_0x35b646};}}return deletePushRecovery(_0x2cd705[_0x3e78d4(0x20a)]),{'action':_0x3e78d4(0x1ba),'journeyId':_0x2cd705['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x35b646};}function findSegmentCriteriaLocation(_0x10b856,_0x5eb296){const _0x4c9163=a155_0x24d83c,_0x5e0d0f=_0x10b856[_0x4c9163(0x1b9)]||_0x10b856[_0x4c9163(0x1cc)]?.[0x0]?.['stages']||[];let _0x54e5fe='entry',_0x452fd4=_0x5eb296;const _0x13e40f=_0x10b856['goal']||_0x10b856['journeys']?.[0x0]?.[_0x4c9163(0x236)];if(_0x13e40f?.[_0x4c9163(0x206)]===_0x5eb296)return{'stageName':_0x4c9163(0x236),'criteriaName':_0x13e40f['name']||_0x5eb296};_0x558fc3:for(const _0x478312 of _0x5e0d0f){if(_0x478312[_0x4c9163(0x1a4)]?.[_0x4c9163(0x206)]===_0x5eb296){_0x54e5fe=_0x478312[_0x4c9163(0x1fc)],_0x452fd4=_0x478312[_0x4c9163(0x1a4)][_0x4c9163(0x1fc)]||_0x5eb296;break;}if(_0x478312[_0x4c9163(0x24a)])for(const _0x146ce9 of _0x478312[_0x4c9163(0x24a)]){if(_0x146ce9[_0x4c9163(0x18d)]===_0x4c9163(0x1c3)&&_0x146ce9['with']?.[_0x4c9163(0x170)])for(const _0x12c709 of _0x146ce9[_0x4c9163(0x195)][_0x4c9163(0x170)]){if(_0x12c709[_0x4c9163(0x206)]===_0x5eb296){_0x54e5fe=_0x478312[_0x4c9163(0x1fc)],_0x452fd4=_0x12c709[_0x4c9163(0x1fc)]||_0x5eb296;break _0x558fc3;}}}}return{'stageName':_0x54e5fe,'criteriaName':_0x452fd4};}async function executeThreeStepJourneyCreate(_0x51a279,_0x30cc30,_0x4c14d5,_0x81eff,_0x47f221,_0x4416c8,_0x52907e,_0x302c68){const _0x52e71c=a155_0x24d83c,{activationDefToCreateRequest:_0x1c3094,yamlRuleToApi:_0x3aba6f}=_0x302c68,{pendingEmbeddedSegments:_0x5f03c7,pendingEmbeddedActivations:_0x204e09,embeddedSegmentNameToId:_0x51f655}=_0x81eff,_0x41f586=JSON['parse'](JSON[_0x52e71c(0x25b)](_0x4c14d5));ensureJourneyDefaults(_0x41f586['attributes']),stripPendingIds(_0x41f586);const _0x483be4=await _0x51a279[_0x52e71c(0x21c)][_0x52e71c(0x22e)](_0x41f586),_0x2152b9=_0x483be4['id'],_0xf318cf=new Map();for(const _0x390f25 of _0x483be4[_0x52e71c(0x200)][_0x52e71c(0x22f)]){_0xf318cf[_0x52e71c(0x169)](_0x390f25['name']['toLowerCase'](),_0x390f25['id']);}recoverSegmentIdsFromPushRecovery(_0x30cc30,_0x51f655,_0x4416c8[_0x52e71c(0x24b)]);for(const [_0x349f0f,{definition:_0x1f3619}]of _0x5f03c7){if(_0x51f655['has'](_0x349f0f)){_0x52907e['onProgress']?.({'type':_0x52e71c(0x1bf),'journeyName':_0x30cc30[_0x52e71c(0x1cf)]['name'],'segmentName':_0x349f0f});continue;}const _0xc4f453=generateDeterministicJourneySegmentName(_0x30cc30['yamlConfig']['name'],_0x349f0f);_0x52907e[_0x52e71c(0x1ef)]?.({'type':_0x52e71c(0x1dc),'journeyName':_0x30cc30[_0x52e71c(0x1cf)][_0x52e71c(0x1fc)],'segmentName':_0x349f0f});const _0x159d5a=createSegmentIdResolver(_0x4416c8[_0x52e71c(0x24b)],_0x349f0f),_0x3f3da1=await resolveRuleSegmentIds(_0x1f3619[_0x52e71c(0x21a)],_0x159d5a),_0x4ccaa9=await createOrRecoverEmbeddedSegment(_0x51a279,_0x30cc30,{'localName':_0x349f0f,'uniqueSegmentName':_0xc4f453,'description':_0x1f3619[_0x52e71c(0x243)]||_0x52e71c(0x1d5)+_0x349f0f,'journeyId':_0x2152b9,'resolvedRule':_0x3f3da1,'parentId':_0x47f221['parentId'],'folderId':_0x47f221['effectiveFolderId']||''},_0x3aba6f);_0x51f655[_0x52e71c(0x169)](_0x349f0f,_0x4ccaa9),_0x4416c8[_0x52e71c(0x24b)][_0x52e71c(0x169)](_0x349f0f,_0x4ccaa9),_0x52907e[_0x52e71c(0x1ef)]?.({'type':_0x52e71c(0x1bf),'journeyName':_0x30cc30[_0x52e71c(0x1cf)][_0x52e71c(0x1fc)],'segmentName':_0x349f0f});}const _0x5b9065=new Map();for(const [_0x50b528,_0x44ff07]of _0x204e09){_0x52907e['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x30cc30['yamlConfig'][_0x52e71c(0x1fc)],'activationName':_0x50b528});const _0x5924c4=await _0x1c3094(_0x44ff07,_0x4416c8['activationContext']),_0x153992={..._0x5924c4,..._0x44ff07[_0x52e71c(0x234)]!==undefined&&{'runAfterJourneyRefresh':_0x44ff07['run_after_journey_refresh']}},_0x3fab28=await _0x51a279[_0x52e71c(0x21c)][_0x52e71c(0x20c)](_0x2152b9,_0x153992);_0x5b9065[_0x52e71c(0x169)](_0x50b528,_0x3fab28['id']),_0x81eff[_0x52e71c(0x252)]['set'](_0x50b528,_0x3fab28['id']),_0x52907e[_0x52e71c(0x1ef)]?.({'type':_0x52e71c(0x20b),'journeyName':_0x30cc30[_0x52e71c(0x1cf)][_0x52e71c(0x1fc)],'activationName':_0x50b528});}const _0x4217d4=JSON[_0x52e71c(0x183)](JSON['stringify'](_0x4c14d5));return _0x4217d4['id']=_0x2152b9,ensureJourneyDefaults(_0x4217d4[_0x52e71c(0x200)]),resolvePendingIdsInRequest(_0x4217d4,_0x4c14d5,_0xf318cf,_0x51f655,_0x5b9065,_0x52907e),await _0x51a279[_0x52e71c(0x21c)][_0x52e71c(0x24c)](_0x2152b9,_0x4217d4),deletePushRecovery(_0x30cc30[_0x52e71c(0x20a)]),{'action':_0x52e71c(0x24f),'journeyId':_0x2152b9,'embeddedSegmentNameToId':_0x51f655};}export function stripWaitStepPendingIds(_0x4eb4db){const _0x5dc5b9=a155_0x24d83c,_0x6d26c4=_0x4eb4db['conditionSegmentId']&&isPendingSegmentId(_0x4eb4db['conditionSegmentId']),_0x6005ab=_0x4eb4db['conditions']?.[_0x5dc5b9(0x173)](_0x4e78f6=>_0x4e78f6[_0x5dc5b9(0x18e)]&&isPendingSegmentId(_0x4e78f6[_0x5dc5b9(0x18e)]));(_0x6d26c4||_0x6005ab)&&(_0x4eb4db[_0x5dc5b9(0x230)]='Duration',_0x4eb4db['waitStep']=0x1,_0x4eb4db['waitStepUnit']=_0x5dc5b9(0x19b),delete _0x4eb4db[_0x5dc5b9(0x207)],delete _0x4eb4db[_0x5dc5b9(0x25f)],delete _0x4eb4db[_0x5dc5b9(0x1dd)],delete _0x4eb4db[_0x5dc5b9(0x18a)]);}export function resolveWaitStepPendingIds(_0x27e56d,_0x20f6fe,_0x44cc75,_0x4bc030){const _0x120ebe=a155_0x24d83c;if(_0x20f6fe[_0x120ebe(0x207)]&&isPendingSegmentId(_0x20f6fe[_0x120ebe(0x207)])){const _0x495bfb=_0x44cc75(_0x20f6fe[_0x120ebe(0x207)],_0x120ebe(0x178)+_0x4bc030+_0x120ebe(0x1a7));_0x495bfb&&(_0x27e56d[_0x120ebe(0x230)]=_0x120ebe(0x16c),_0x27e56d[_0x120ebe(0x207)]=_0x495bfb,delete _0x27e56d['waitStep'],delete _0x27e56d[_0x120ebe(0x210)],_0x20f6fe[_0x120ebe(0x25f)]!==undefined&&(_0x27e56d[_0x120ebe(0x25f)]=_0x20f6fe['conditionTimeoutDuration']),_0x20f6fe[_0x120ebe(0x1dd)]&&(_0x27e56d['conditionTimeoutUnit']=_0x20f6fe[_0x120ebe(0x1dd)]));}if(_0x20f6fe[_0x120ebe(0x18a)]){const _0x1a79fb=_0x20f6fe[_0x120ebe(0x18a)]['some'](_0x157b5f=>_0x157b5f[_0x120ebe(0x18e)]&&isPendingSegmentId(_0x157b5f[_0x120ebe(0x18e)]));if(_0x1a79fb){const _0x5e75c0=_0x20f6fe[_0x120ebe(0x18a)]['map'](_0x5deb16=>{const _0xb82cfc=_0x120ebe;if(_0x5deb16[_0xb82cfc(0x18e)]&&isPendingSegmentId(_0x5deb16[_0xb82cfc(0x18e)])){const _0x5a7b17=_0x44cc75(_0x5deb16[_0xb82cfc(0x18e)],_0xb82cfc(0x178)+_0x4bc030+_0xb82cfc(0x1a7));return{..._0x5deb16,'segmentId':_0x5a7b17||_0x5deb16[_0xb82cfc(0x18e)]};}return{..._0x5deb16};});_0x27e56d[_0x120ebe(0x230)]=_0x120ebe(0x16c),_0x27e56d[_0x120ebe(0x18a)]=_0x5e75c0,delete _0x27e56d['waitStep'],delete _0x27e56d['waitStepUnit'],delete _0x27e56d[_0x120ebe(0x207)],delete _0x27e56d['conditionTimeoutDuration'],delete _0x27e56d[_0x120ebe(0x1dd)];}}}function stripPendingIds(_0x9051d4){const _0x52827b=a155_0x24d83c;_0x9051d4[_0x52827b(0x200)][_0x52827b(0x236)]?.[_0x52827b(0x18e)]&&isPendingSegmentId(_0x9051d4[_0x52827b(0x200)][_0x52827b(0x236)][_0x52827b(0x18e)])&&delete _0x9051d4['attributes'][_0x52827b(0x236)];for(const _0x26b5e5 of _0x9051d4['attributes'][_0x52827b(0x22f)]||[]){_0x26b5e5[_0x52827b(0x19f)]?.[_0x52827b(0x18e)]&&isPendingSegmentId(_0x26b5e5[_0x52827b(0x19f)][_0x52827b(0x18e)])&&delete _0x26b5e5[_0x52827b(0x19f)];_0x26b5e5[_0x52827b(0x21b)]?.[_0x52827b(0x18e)]&&isPendingSegmentId(_0x26b5e5[_0x52827b(0x21b)][_0x52827b(0x18e)])&&delete _0x26b5e5[_0x52827b(0x21b)];_0x26b5e5['exitCriterias']&&(_0x26b5e5[_0x52827b(0x17b)]=_0x26b5e5[_0x52827b(0x17b)][_0x52827b(0x197)](_0x534da9=>!_0x534da9[_0x52827b(0x18e)]||!isPendingSegmentId(_0x534da9[_0x52827b(0x18e)])));if(_0x26b5e5[_0x52827b(0x24a)])for(const _0x31c9db of Object[_0x52827b(0x19c)](_0x26b5e5[_0x52827b(0x24a)])){const _0x2bfc60=_0x26b5e5[_0x52827b(0x24a)][_0x31c9db];_0x2bfc60['type']===_0x52827b(0x221)&&_0x2bfc60['journeyActivationStepId']&&isPendingActivationId(_0x2bfc60['journeyActivationStepId'])&&(_0x2bfc60[_0x52827b(0x1ee)]='');if(_0x2bfc60['type']==='DecisionPoint'&&_0x2bfc60[_0x52827b(0x170)])for(const _0x236557 of _0x2bfc60[_0x52827b(0x170)]){_0x236557['segmentId']&&isPendingSegmentId(_0x236557['segmentId'])&&(_0x236557[_0x52827b(0x18e)]='');}_0x2bfc60[_0x52827b(0x18d)]==='WaitStep'&&stripWaitStepPendingIds(_0x2bfc60);}}}function resolvePendingIdsInRequest(_0x3627e2,_0x9ca34c,_0x3a1f70,_0x4dfd72,_0x28d8fb,_0xa75a0e){const _0x2b9fc4=a155_0x24d83c,_0x2f5688=(_0x110342,_0xeae538)=>{const _0xc3c831=a155_0xe8d7;if(!isPendingSegmentId(_0x110342))return _0x110342;const _0x411f31=extractPendingSegmentName(_0x110342),_0x15091a=_0x4dfd72['get'](_0x411f31);return!_0x15091a&&_0xa75a0e[_0xc3c831(0x1ab)]?.(_0xc3c831(0x17c)+_0x411f31+_0xc3c831(0x1c4)+_0xeae538),_0x15091a;};if(_0x3627e2[_0x2b9fc4(0x200)][_0x2b9fc4(0x236)]?.[_0x2b9fc4(0x18e)]&&isPendingSegmentId(_0x3627e2[_0x2b9fc4(0x200)][_0x2b9fc4(0x236)][_0x2b9fc4(0x18e)])){const _0x8d21a4=_0x2f5688(_0x3627e2[_0x2b9fc4(0x200)][_0x2b9fc4(0x236)][_0x2b9fc4(0x18e)],_0x2b9fc4(0x227));_0x8d21a4&&(_0x3627e2[_0x2b9fc4(0x200)]['goal'][_0x2b9fc4(0x18e)]=_0x8d21a4);}for(const _0xd9096f of _0x3627e2[_0x2b9fc4(0x200)]['journeyStages']||[]){const _0x5d9d26=_0x3a1f70[_0x2b9fc4(0x1fa)](_0xd9096f[_0x2b9fc4(0x1fc)]['toLowerCase']());_0x5d9d26&&(_0xd9096f['id']=_0x5d9d26);if(_0xd9096f[_0x2b9fc4(0x19f)]?.['segmentId']&&isPendingSegmentId(_0xd9096f['entryCriteria'][_0x2b9fc4(0x18e)])){const _0x333026=_0x2f5688(_0xd9096f[_0x2b9fc4(0x19f)]['segmentId'],'stage\x20\x27'+_0xd9096f[_0x2b9fc4(0x1fc)]+_0x2b9fc4(0x1ea));_0x333026&&(_0xd9096f['entryCriteria'][_0x2b9fc4(0x18e)]=_0x333026);}if(_0xd9096f['exitCriterias'])for(const _0x4eda6b of _0xd9096f[_0x2b9fc4(0x17b)]){if(_0x4eda6b[_0x2b9fc4(0x18e)]&&isPendingSegmentId(_0x4eda6b[_0x2b9fc4(0x18e)])){const _0x265e33=_0x2f5688(_0x4eda6b[_0x2b9fc4(0x18e)],'stage\x20\x27'+_0xd9096f['name']+_0x2b9fc4(0x257));_0x265e33&&(_0x4eda6b[_0x2b9fc4(0x18e)]=_0x265e33);}}if(_0xd9096f[_0x2b9fc4(0x21b)]?.['segmentId']&&isPendingSegmentId(_0xd9096f['milestone'][_0x2b9fc4(0x18e)])){const _0x1c9f83=_0x2f5688(_0xd9096f[_0x2b9fc4(0x21b)]['segmentId'],_0x2b9fc4(0x178)+_0xd9096f[_0x2b9fc4(0x1fc)]+_0x2b9fc4(0x1a5));_0x1c9f83&&(_0xd9096f[_0x2b9fc4(0x21b)][_0x2b9fc4(0x18e)]=_0x1c9f83);}if(_0xd9096f[_0x2b9fc4(0x24a)]){const _0x1508ba=_0xe29bd4=>_0x9ca34c[_0x2b9fc4(0x200)][_0x2b9fc4(0x22f)]?.['find'](_0x24118b=>_0x24118b['name'][_0x2b9fc4(0x20f)]()===_0xd9096f[_0x2b9fc4(0x1fc)][_0x2b9fc4(0x20f)]())?.[_0x2b9fc4(0x24a)]?.[_0xe29bd4];for(const _0x15ca5d of Object[_0x2b9fc4(0x19c)](_0xd9096f[_0x2b9fc4(0x24a)])){const _0x54928f=_0xd9096f[_0x2b9fc4(0x24a)][_0x15ca5d],_0x17f623=_0x1508ba(_0x15ca5d);if(_0x54928f[_0x2b9fc4(0x18d)]===_0x2b9fc4(0x221)&&_0x54928f[_0x2b9fc4(0x1ee)]&&(isPendingActivationId(_0x54928f[_0x2b9fc4(0x1ee)])||_0x54928f[_0x2b9fc4(0x1ee)]==='')){if(_0x17f623?.[_0x2b9fc4(0x1ee)]&&isPendingActivationId(_0x17f623['journeyActivationStepId'])){const _0x4f18cd=extractPendingActivationName(_0x17f623[_0x2b9fc4(0x1ee)]),_0x2a4438=_0x28d8fb[_0x2b9fc4(0x1fa)](_0x4f18cd);_0x2a4438&&(_0x54928f[_0x2b9fc4(0x1ee)]=_0x2a4438);}}if(_0x54928f[_0x2b9fc4(0x18d)]===_0x2b9fc4(0x190)&&_0x54928f[_0x2b9fc4(0x170)]&&_0x17f623?.[_0x2b9fc4(0x170)])for(let _0x585ca8=0x0;_0x585ca8<_0x54928f[_0x2b9fc4(0x170)][_0x2b9fc4(0x1b3)];_0x585ca8++){const _0x1ec90c=_0x54928f[_0x2b9fc4(0x170)][_0x585ca8],_0x215caa=_0x17f623[_0x2b9fc4(0x170)][_0x585ca8];if(_0x215caa?.[_0x2b9fc4(0x18e)]&&isPendingSegmentId(_0x215caa[_0x2b9fc4(0x18e)])){const _0x469ad8=_0x2f5688(_0x215caa[_0x2b9fc4(0x18e)],'stage\x20\x27'+_0xd9096f['name']+_0x2b9fc4(0x1a9)+(_0x1ec90c['name']||_0x585ca8)+'\x27');_0x469ad8&&(_0x1ec90c[_0x2b9fc4(0x18e)]=_0x469ad8);}}_0x54928f[_0x2b9fc4(0x18d)]===_0x2b9fc4(0x26b)&&_0x17f623?.[_0x2b9fc4(0x18d)]===_0x2b9fc4(0x26b)&&resolveWaitStepPendingIds(_0x54928f,_0x17f623,_0x2f5688,_0xd9096f[_0x2b9fc4(0x1fc)]);}}}}
|
|
1
|
+
const a155_0x30a951=a155_0x5a27;(function(_0x4fde03,_0x5836bc){const _0x5db042=a155_0x5a27,_0x2582f8=_0x4fde03();while(!![]){try{const _0x3b9d70=parseInt(_0x5db042(0x28f))/0x1+parseInt(_0x5db042(0x206))/0x2*(parseInt(_0x5db042(0x1cc))/0x3)+parseInt(_0x5db042(0x210))/0x4+parseInt(_0x5db042(0x20f))/0x5+-parseInt(_0x5db042(0x1bb))/0x6*(-parseInt(_0x5db042(0x1dc))/0x7)+parseInt(_0x5db042(0x281))/0x8+-parseInt(_0x5db042(0x1a9))/0x9;if(_0x3b9d70===_0x5836bc)break;else _0x2582f8['push'](_0x2582f8['shift']());}catch(_0x40303f){_0x2582f8['push'](_0x2582f8['shift']());}}}(a155_0x3980,0x29673));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a155_0x30a951(0x1ec));export const PENDING_SEGMENT_PREFIX=a155_0x30a951(0x29f);function a155_0x3980(){const _0x1b191a=['journey_created','skipSegments','resolveJourneyId','folderId','delete','milestone','withProgress','2370976TvtZQi','stages','createActivation','verbose','getSegment','Failed\x20to\x20fetch\x20referenced\x20segment\x20','folderPath','existingSegments','journey_updating','values','updated','activationContext','Creating\x20segment\x20\x27','reduce','229747YUuUVv','flatMap','split','Stage\x20\x27','stage\x20\x27','folder_created','connectionIdToNameMap','toISOString','journeyBundleName','Created\x20journey\x20\x27','activationStepsById','Entry\x20criteria:\x20','__pending_act_','toString','debug','match','__pending_','activation_template_id','run_after_journey_refresh','activation_','\x27\x20exit\x20criteria','behavior','columns','journeyById','11453130MVaGZq','Condition','Delete\x20the\x20push\x20recovery\x20file\x20(','getSegmentEntity\x20also\x20failed\x20for\x20','segment','connector_config','replace','Matched\x20server\x20segment\x20\x27','getSegmentEntity','uniqueSegmentName','entryCriteria','and\x20the\x20server\x20segment,\x20then\x20retry.','activation_updating','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','updateActivation','journeyBundlesByFolderAndName','from','\x20error(s)','915546rRRMsL','getJourney','embeddedSegmentNameToId','embedded_activation_creating','activationsBySegmentId','data','updateSegmentById','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','digest','JOURNEY_SYNTAX_ERROR','logDeleted','set','nameToType','embedded_segment_creating','resolvedRule','isArray','diff','3iPBsml','Segment\x20not\x20found','createdSegmentId','Updating\x20activation\x20\x27','logInfo','waitStep','idToEmailMap','parse','createFolder','getSegment\x20failed\x20for\x20','trim','journeyActivationNameToId','join','progress','unchanged','fetchJourney','7jUHedI','\x20(referenced\x20in\x20journey\x20','attributes','description','parentSegmentFolder','idToName','versionNumber','folder','ACTIVATION_SYNTAX_ERROR','keys','max','index','../../utils/async.js','\x20activation\x20\x27','localName','resolveSegment','tdx.sdk.push-workflow','exitCriterias','Name\x20has\x20already\x20been\x20taken','draft','push','toLowerCase','activationActions','length','get','sort','entries','startsWith','add','action','goal','Updated\x20journey\x20\x27','schedule','\x0a\x20\x20','\x27\x20for\x20','./journey-yaml.js','connection','filter','journeyId','all','segmentId','null','631586wjxCjC','conditionSegmentId','\x27\x20entry\x20criteria','name','effectiveFolderId','isNew','journey','\x27\x20decision\x20point\x20branch\x20\x27','type','1171710eMfGum','853248dMUndJ','deleted','user','ACTIVATION_UPDATE_ERROR','hasChanges','Failed\x20to\x20resolve\x20segment\x20','Updated\x20activation\x20\x27','Fetching\x20','hex','./child-segment-yaml.js','Created\x20segment\x20\x27','deps',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','some','branches','activation_created','rule','journeyStages','parentId','Failed\x20to\x20','yamlConfig','\x27...','journey_updated','find','folder_creating','buildUserMaps','waitStepUnit','createJourneySegment','\x27\x20wait\x20condition','segments','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Failed\x20to\x20resolve\x20activation\x20','embedded_segment_created','Duration','absolutePath','journeyActivationStepId','Activation\x20not\x20found:\x20','segmentByFolderAndName','journeyName','listActivations','activation_updated','has','onProgress','parseDocument','segmentFolderId','SEGMENT_UPDATE_ERROR','Creating\x20activation\x20\x27','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','segment_creating','utf-8','steps','slice','existingJourney','segmentNameToId','create','Deleting\x20activation\x20\x27','valid','segment_created','all_columns','uniqueServerName','stringify','Deleted\x20segment\x20\x27','results','logWarning','created','logSuccess','WaitStep','NOT_FOUND','Updated\x20segment\x20\x27','\x27\x20milestone','size','map','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','item','getActivation','activations','rootFolderId','conditionTimeoutUnit','SEGMENT_NOT_FOUND','entry','Updating\x20segment\x20\x27','conditions','journeys','\x27\x20from\x20file:\x20','kind','sha1','yamlActivation','relative','journey_entry_criteria_','Segment\x20not\x20found:\x20','update','DecisionPoint','state','deleteActivation','existingSegment','waitStepType','validatedRequest','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','entry_criteria','segment_deleted','Activation','INTERNAL','dirname','conditionTimeoutDuration','existingActivation'];a155_0x3980=function(){return _0x1b191a;};return a155_0x3980();}export const PENDING_ACTIVATION_PREFIX=a155_0x30a951(0x29b);export function createPendingSegmentId(_0x314e0a){return''+PENDING_SEGMENT_PREFIX+_0x314e0a+'__';}export function isPendingSegmentId(_0x3d18cc){const _0x178001=a155_0x30a951;return _0x3d18cc['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x3d18cc[_0x178001(0x1f7)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x1c35c8){const _0x43b0bc=a155_0x30a951;return _0x1c35c8[_0x43b0bc(0x1af)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4d6680){return''+PENDING_ACTIVATION_PREFIX+_0x4d6680+'__';}export function isPendingActivationId(_0x4037f4){const _0x4db08c=a155_0x30a951;return _0x4037f4[_0x4db08c(0x1f7)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x21ace2){const _0x27068d=a155_0x30a951;return _0x21ace2[_0x27068d(0x1af)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x86a2e6,_0xf08637){const _0x56e036=a155_0x30a951,_0x4f5827=_0x86a2e6+'::'+(_0xf08637[_0x56e036(0x1d6)]()||_0x56e036(0x1ad)),_0x134def=createHash(_0x56e036(0x266))[_0x56e036(0x26b)](_0x4f5827)[_0x56e036(0x1c3)](_0x56e036(0x218))[_0x56e036(0x244)](0x0,0xc);return _0x56e036(0x269)+_0x134def;}export function ensureJourneyDefaults(_0x2f22ea){const _0x2286ed=a155_0x30a951;!_0x2f22ea[_0x2286ed(0x1df)]&&(_0x2f22ea[_0x2286ed(0x1df)]=''),!_0x2f22ea[_0x2286ed(0x26d)]&&(_0x2f22ea[_0x2286ed(0x26d)]=_0x2286ed(0x1ef));}export function injectExistingStageIds(_0x1e4dc4,_0x125b34){const _0x2372c4=a155_0x30a951,_0x20cb4b=new Map(_0x125b34[_0x2372c4(0x258)](_0x3082d4=>[_0x3082d4[_0x2372c4(0x209)],_0x3082d4['id']]));for(const _0x2bca89 of _0x1e4dc4){if(!_0x2bca89['id']){const _0x3087ab=_0x20cb4b[_0x2372c4(0x1f4)](_0x2bca89['name']);_0x3087ab&&(_0x2bca89['id']=_0x3087ab);}}}export function resolveTDFolderPath(_0x3d22c2,_0x4619c7,_0x45e2fb){const _0x1e5c2a=a155_0x30a951;if(!_0x4619c7)return _0x3d22c2;if(_0x3d22c2===_0x45e2fb||_0x3d22c2[_0x1e5c2a(0x1f7)](_0x45e2fb+'/'))return _0x3d22c2;return _0x3d22c2?_0x45e2fb+'/'+_0x3d22c2:_0x45e2fb;}export function addFoldersToCreate(_0x5679e2,_0x1009e4,_0x123d09){const _0x2245fa=a155_0x30a951;if(!_0x5679e2)return;if(_0x1009e4[_0x2245fa(0x239)](_0x5679e2))return;const _0x686b71=_0x5679e2[_0x2245fa(0x291)]('/');let _0x3249ee='';for(const _0x32ec82 of _0x686b71){_0x3249ee=_0x3249ee?_0x3249ee+'/'+_0x32ec82:_0x32ec82,!_0x1009e4[_0x2245fa(0x239)](_0x3249ee)&&_0x123d09['add'](_0x3249ee);}}export function sortFoldersByDepth(_0x532bb3){const _0x3bf5fd=a155_0x30a951;return[..._0x532bb3][_0x3bf5fd(0x1f5)]((_0x2129db,_0x3d7b5f)=>{const _0xe53c89=_0x3bf5fd,_0x1a6549=(_0x2129db[_0xe53c89(0x29e)](/\//g)||[])[_0xe53c89(0x1f3)],_0x458445=(_0x3d7b5f[_0xe53c89(0x29e)](/\//g)||[])[_0xe53c89(0x1f3)];return _0x1a6549-_0x458445;});}import*as a155_0x26d673 from'yaml';import{readFileSync}from'fs';import a155_0x5c2d81 from'path';import{isJourneyDef,parseYamlString as a155_0x14fa23,toYamlString as a155_0x199b9e,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(_0x494c4c){const _0x356020=a155_0x30a951;if(Array[_0x356020(0x1ca)](_0x494c4c))return'['+_0x494c4c[_0x356020(0x258)](_0x38f83c=>stableStringify(_0x38f83c))[_0x356020(0x1d8)](',')+']';if(_0x494c4c&&typeof _0x494c4c==='object'){const _0x45266c=_0x494c4c,_0x347ee5=Object['keys'](_0x45266c)[_0x356020(0x1f5)](),_0x4e1030=_0x347ee5[_0x356020(0x258)](_0x4e8a24=>'\x22'+_0x4e8a24+'\x22:'+stableStringify(_0x45266c[_0x4e8a24]));return'{'+_0x4e1030['join'](',')+'}';}const _0x1dc8fe=JSON[_0x356020(0x24d)](_0x494c4c);return _0x1dc8fe===undefined?_0x356020(0x205):_0x1dc8fe;}function activationSignature(_0x3bffed){const _0x10fe79=a155_0x30a951,_0x292c94={'connection':_0x3bffed[_0x10fe79(0x200)],..._0x3bffed[_0x10fe79(0x24b)]!==undefined&&{'all_columns':_0x3bffed[_0x10fe79(0x24b)]},..._0x3bffed[_0x10fe79(0x1a7)]!==undefined&&{'columns':_0x3bffed['columns']},..._0x3bffed[_0x10fe79(0x2a4)]!==undefined&&{'behavior':_0x3bffed[_0x10fe79(0x2a4)]},..._0x3bffed[_0x10fe79(0x1fc)]!==undefined&&{'schedule':_0x3bffed['schedule']},..._0x3bffed['notification']!==undefined&&{'notification':_0x3bffed['notification']},..._0x3bffed[_0x10fe79(0x1ae)]!==undefined&&{'connector_config':_0x3bffed[_0x10fe79(0x1ae)]},..._0x3bffed['activation_template_id']!==undefined&&{'activation_template_id':_0x3bffed[_0x10fe79(0x2a0)]}};return stableStringify(_0x292c94);}async function fetchSegment(_0x4c3ff8,_0x1332fc,_0x55b62e,_0x2b1363){const _0x2c1aa1=a155_0x30a951,_0x1205be=_0x2b1363?.[_0x2c1aa1(0x227)](_0x1a6b93=>_0x1a6b93['id']===_0x55b62e);if(_0x1205be)return _0x1205be;try{return await _0x4c3ff8['segment'][_0x2c1aa1(0x285)](_0x1332fc,_0x55b62e);}catch(_0x4c7e7c){logger[_0x2c1aa1(0x29d)](_0x2c1aa1(0x1d5)+_0x55b62e+_0x2c1aa1(0x21c)+_0x4c7e7c);try{return await _0x4c3ff8[_0x2c1aa1(0x1ad)][_0x2c1aa1(0x1b1)](_0x55b62e);}catch(_0x572c3f){return logger[_0x2c1aa1(0x29d)](_0x2c1aa1(0x1ac)+_0x55b62e+':\x20'+_0x572c3f),null;}}}function recoverSegmentIdsFromPushRecovery(_0x13ade3,_0x3d88c7,_0x514641){const _0x1555a8=a155_0x30a951,_0x4da611=readPushRecovery(_0x13ade3['absolutePath']);if(_0x4da611?.[_0x1555a8(0x236)]===_0x13ade3[_0x1555a8(0x224)][_0x1555a8(0x209)])for(const [_0x289088,_0x2bc384]of Object['entries'](_0x4da611[_0x1555a8(0x22d)])){const _0x4cdc89=generateDeterministicJourneySegmentName(_0x13ade3[_0x1555a8(0x224)][_0x1555a8(0x209)],_0x289088);_0x2bc384[_0x1555a8(0x24c)]===_0x4cdc89&&(_0x3d88c7[_0x1555a8(0x1c6)](_0x289088,_0x2bc384[_0x1555a8(0x204)]),_0x514641[_0x1555a8(0x1c6)](_0x289088,_0x2bc384['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x504ecf,_0x5b37a7,_0x32571e,_0x3443e7){const _0x9df7de=a155_0x30a951;let _0x5319ec;try{_0x5319ec=await _0x504ecf[_0x9df7de(0x1ad)][_0x9df7de(0x22b)]({'name':_0x32571e[_0x9df7de(0x1b2)],'description':_0x32571e[_0x9df7de(0x1df)],'journeyId':_0x32571e[_0x9df7de(0x202)],'rule':_0x3443e7(_0x32571e[_0x9df7de(0x1c9)],!![]),'countPopulation':!![],'parentFolderId':_0x32571e[_0x9df7de(0x27d)],'audienceId':_0x32571e[_0x9df7de(0x222)]});}catch(_0x16a1b2){const _0x1dd958=_0x16a1b2 instanceof Error&&_0x16a1b2['message']['includes'](_0x9df7de(0x1ee));if(_0x1dd958){const _0x2e0b50=readPushRecovery(_0x5b37a7[_0x9df7de(0x232)]),_0x154df6=_0x2e0b50?.[_0x9df7de(0x236)]===_0x5b37a7['yamlConfig'][_0x9df7de(0x209)]?_0x2e0b50[_0x9df7de(0x22d)][_0x32571e[_0x9df7de(0x1ea)]]:undefined;if(_0x154df6?.[_0x9df7de(0x24c)]===_0x32571e[_0x9df7de(0x1b2)])await _0x504ecf['segment'][_0x9df7de(0x1c1)](_0x32571e[_0x9df7de(0x222)],_0x154df6['segmentId'],{'description':_0x32571e[_0x9df7de(0x1df)],'rule':_0x3443e7(_0x32571e[_0x9df7de(0x1c9)],!![]),'countPopulation':!![]}),_0x5319ec=_0x154df6[_0x9df7de(0x204)];else throw new SDKError(ErrorCode[_0x9df7de(0x23d)],'Embedded\x20segment\x20\x27'+_0x32571e['localName']+_0x9df7de(0x272)+(_0x9df7de(0x1ab)+_0x5b37a7[_0x9df7de(0x232)][_0x9df7de(0x1af)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+_0x9df7de(0x1b4),_0x16a1b2);}else throw _0x16a1b2;}return saveSegmentToPushRecovery(_0x5b37a7[_0x9df7de(0x232)],_0x5b37a7['yamlConfig'][_0x9df7de(0x209)],_0x32571e['localName'],{'segmentId':_0x5319ec,'uniqueServerName':_0x32571e[_0x9df7de(0x1b2)],'createdAt':new Date()[_0x9df7de(0x296)]()}),_0x5319ec;}export async function prepareSegmentFiles(_0x3a52dd,_0xe5541f,_0x1a17e7,_0x455a47,_0xe9479d){const _0x505477=a155_0x30a951,{activationDefToCreateRequest:_0x5ffc62}=await import(_0x505477(0x219)),_0xefd141=[],_0x2ea80b=new Set();for(const {yamlConfig:_0x462832,folderPath:_0x350ef6,sourcePath:_0x33dbbc}of _0x3a52dd){const _0x10606b=resolveTDFolderPath(_0x350ef6,_0x455a47,_0xe9479d),_0x1f5bc1=_0x10606b+':'+_0x462832[_0x505477(0x209)],_0x5c89a0=_0xe5541f[_0x505477(0x235)][_0x505477(0x1f4)](_0x1f5bc1),_0x28936c=_0x5c89a0?_0xe5541f[_0x505477(0x1bf)][_0x505477(0x1f4)](_0x5c89a0['id'])||[]:[];addFoldersToCreate(_0x10606b,_0xe5541f['folderPathToId'],_0x2ea80b);const _0x5e1f55=calculateActivationActions(_0x462832['activations']||[],_0x28936c,_0xe5541f[_0x505477(0x1d2)],_0xe5541f[_0x505477(0x295)]);for(const _0x1312b8 of _0x5e1f55){(_0x1312b8['type']==='create'||_0x1312b8[_0x505477(0x20e)]===_0x505477(0x26b))&&_0x1312b8[_0x505477(0x267)]&&(_0x1312b8[_0x505477(0x271)]=await _0x5ffc62(_0x1312b8[_0x505477(0x267)],_0x1a17e7));}const _0xe0ab0d=calculateSegmentDiff(_0x462832,_0x5c89a0,_0x28936c,_0xe5541f[_0x505477(0x1d2)],_0xe5541f[_0x505477(0x295)]);_0xefd141[_0x505477(0x1f0)]({'relativePath':_0x462832['name'],'absolutePath':_0x33dbbc,'yamlConfig':_0x462832,'folderPath':_0x10606b,'existingSegment':_0x5c89a0,'existingActivations':_0x28936c,'isNew':_0xe0ab0d[_0x505477(0x20b)],'hasChanges':_0xe0ab0d[_0x505477(0x214)],'diff':_0xe0ab0d['diff'],'activationActions':_0x5e1f55});}return{'segmentFiles':_0xefd141,'foldersToCreate':_0x2ea80b};}export async function prepareJourneyFiles(_0x5905a7,_0x346cec,_0x2a4c51,_0x30aa0b){const _0x2f1115=a155_0x30a951,_0x5a5b38=[],_0x5dd846=new Set();for(const {yamlConfig:_0xe0a2df,folderPath:_0x9fad6f,sourcePath:_0x30d97c}of _0x5905a7){const _0x4850c9=resolveTDFolderPath(_0x9fad6f,_0x2a4c51,_0x30aa0b),_0x226241=_0x4850c9+':'+_0xe0a2df[_0x2f1115(0x209)],_0x2a6719=_0x346cec[_0x2f1115(0x1b8)][_0x2f1115(0x1f4)](_0x226241);let _0x3ec71a,_0x3ac0de;if(_0x2a6719&&_0x2a6719[_0x2f1115(0x1f3)]>0x0){const _0x451269=buildLocalExpandedRuleMappings(_0xe0a2df),{createYamlContext:_0x1e3786,prefetchJourneySegments:_0x4bfaef}=createPushYamlContextForBundle(_0x346cec[_0x2f1115(0x21b)],_0x346cec[_0x2f1115(0x222)],_0x346cec[_0x2f1115(0x288)],_0x451269,_0x346cec[_0x2f1115(0x1d2)],_0x346cec[_0x2f1115(0x295)],_0x346cec[_0x2f1115(0x299)],_0x346cec[_0x2f1115(0x1a8)]);await _0x4bfaef(_0x2a6719[_0x2f1115(0x258)](_0x53b051=>_0x53b051['id']));const _0x589858=await _0x346cec[_0x2f1115(0x21b)][_0x2f1115(0x20c)]['getLatestJourneyId'](_0x2a6719[0x0]['journeyBundleId']),_0x3e29bb=hasMultipleVersions(_0xe0a2df),_0x3ffe7d=async _0x42a18e=>{const _0x551eb0=_0x2f1115,_0x28f69a=_0x346cec[_0x551eb0(0x1a8)]?.[_0x551eb0(0x1f4)](_0x42a18e);if(_0x28f69a)return _0x28f69a;return _0x346cec[_0x551eb0(0x1db)]({'journeyId':_0x42a18e,'journeyName':_0xe0a2df[_0x551eb0(0x209)],'isMultiVersion':_0x2a6719[_0x551eb0(0x1f3)]>0x1});};if(_0x3e29bb&&_0x2a6719['length']>0x1){const _0x2ed059=[];for(const _0x303e2b of _0x2a6719){const _0x321b76=_0x303e2b[_0x2f1115(0x1e2)]||0x1;_0x346cec[_0x2f1115(0x1d9)]?.['update'](_0x2f1115(0x217)+_0xe0a2df[_0x2f1115(0x209)]+'\x20v'+_0x321b76);const _0x1de52c=await _0x3ffe7d(_0x303e2b['id']),_0x3b69a5=_0x1e3786(_0x303e2b['id']),_0xf2ff3b=await journeyResponseToDef(_0x1de52c,_0x3b69a5);_0x2ed059['push']({'item':_0x303e2b,'yaml':_0xf2ff3b});}const _0x1f2953=buildLocalRuleToNameMappingFromJourney(_0xe0a2df);_0x3ac0de=buildMergedJourneyDef(_0x2ed059,_0x1f2953,_0x589858);const _0x5ce3b5=Math[_0x2f1115(0x1e6)](..._0x2ed059[_0x2f1115(0x258)](_0x178d88=>_0x178d88[_0x2f1115(0x25a)][_0x2f1115(0x1e2)]||0x0)),_0x54210f=_0x2a6719[_0x2f1115(0x227)](_0x15da65=>(_0x15da65[_0x2f1115(0x1e2)]||0x0)===_0x5ce3b5);_0x54210f&&(_0x346cec[_0x2f1115(0x1d9)]?.[_0x2f1115(0x26b)]('Fetching\x20'+_0xe0a2df[_0x2f1115(0x209)]+'\x20v'+_0x5ce3b5),_0x3ec71a=await _0x3ffe7d(_0x54210f['id']));}else{const _0x28c914=_0x2a6719[_0x2a6719[_0x2f1115(0x1f3)]-0x1];_0x346cec[_0x2f1115(0x1d9)]?.[_0x2f1115(0x26b)](_0x2f1115(0x217)+_0xe0a2df[_0x2f1115(0x209)]),_0x3ec71a=await _0x3ffe7d(_0x28c914['id']);const _0x2a44be=_0x1e3786(_0x28c914['id']),_0x574644=await journeyResponseToDef(_0x3ec71a,_0x2a44be),_0x18c5a5=buildLocalRuleToNameMappingFromJourney(_0xe0a2df);_0x3ac0de=buildMergedJourneyDef([{'item':_0x28c914,'yaml':_0x574644}],_0x18c5a5,_0x589858);}}addFoldersToCreate(_0x4850c9,_0x346cec['folderPathToId'],_0x5dd846);const _0x57aed4=calculateJourneyDiff(_0xe0a2df,_0x3ac0de);_0x5a5b38[_0x2f1115(0x1f0)]({'relativePath':_0xe0a2df['name'],'absolutePath':_0x30d97c,'yamlConfig':_0xe0a2df,'folderPath':_0x4850c9,'existingJourney':_0x3ec71a,'isNew':_0x57aed4[_0x2f1115(0x20b)],'hasChanges':_0x57aed4[_0x2f1115(0x214)],'diff':_0x57aed4[_0x2f1115(0x1cb)]});}return{'journeyFiles':_0x5a5b38,'foldersToCreate':_0x5dd846};}export function calculateActivationActions(_0x296a78,_0x5c5a68,_0x1a604f,_0x12b47f){const _0x1488b7=a155_0x30a951,_0x2e7373=[],_0x2ee0f7=new Map();for(const _0xcaf8a0 of _0x5c5a68){_0x2ee0f7['set'](_0xcaf8a0[_0x1488b7(0x209)],_0xcaf8a0);}const _0x1939cf=new Map();for(const _0x561084 of _0x296a78){_0x1939cf['set'](_0x561084['name'],_0x561084);}for(const _0x4245b2 of _0x296a78){const _0x1366e4=_0x2ee0f7[_0x1488b7(0x1f4)](_0x4245b2[_0x1488b7(0x209)]);if(!_0x1366e4)_0x2e7373[_0x1488b7(0x1f0)]({'type':_0x1488b7(0x247),'name':_0x4245b2[_0x1488b7(0x209)],'yamlActivation':_0x4245b2});else{const _0x12d676=activationResponseToDef(_0x1366e4,_0x1a604f,_0x12b47f),_0xfae057=a155_0x26d673['stringify'](_0x12d676),_0x1fb6d1=a155_0x26d673[_0x1488b7(0x24d)](_0x4245b2);_0xfae057!==_0x1fb6d1&&_0x2e7373[_0x1488b7(0x1f0)]({'type':_0x1488b7(0x26b),'name':_0x4245b2[_0x1488b7(0x209)],'yamlActivation':_0x4245b2,'existingActivation':_0x1366e4});}}for(const _0x344318 of _0x5c5a68){!_0x1939cf[_0x1488b7(0x239)](_0x344318[_0x1488b7(0x209)])&&_0x2e7373[_0x1488b7(0x1f0)]({'type':_0x1488b7(0x27e),'name':_0x344318['name'],'existingActivation':_0x344318});}return _0x2e7373;}function calculateYamlDiff(_0x35326f,_0x7f27eb){if(_0x7f27eb){const _0x4e6fd5=generateDiff(_0x7f27eb,_0x35326f),_0x22d593=hasChanges(_0x4e6fd5);return{'isNew':![],'hasChanges':_0x22d593,'diff':_0x22d593?formatDiffWithColors(_0x4e6fd5):undefined};}const _0x32cc53=generateDiff('',_0x35326f);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x32cc53)};}export function calculateSegmentDiff(_0x5cee25,_0x43f445,_0x1f180f,_0x14d468,_0x261723){const _0xa5c577=segmentToYamlString(_0x5cee25),_0x3b716d=_0x43f445?segmentToYamlString(segmentWithActivationsToYaml(_0x43f445,_0x1f180f,undefined,_0x14d468,_0x261723)):undefined;return calculateYamlDiff(_0xa5c577,_0x3b716d);}export function calculateJourneyDiff(_0x42bb7b,_0xc3e7ef){const _0x453f29=normalizeJourneyDef(_0x42bb7b,_0x42bb7b),_0x366313=a155_0x199b9e(_0x453f29),_0x19ab07=_0xc3e7ef?a155_0x199b9e(normalizeJourneyDef(_0xc3e7ef,_0x42bb7b)):undefined;return calculateYamlDiff(_0x366313,_0x19ab07);}export function findSegmentsToDelete(_0x5c712b,_0x8eb1ce,_0x50d95b,_0x27498c,_0xe40d91){const _0x14eb4c=a155_0x30a951,_0x385ef2=new Set();for(const {yamlConfig:_0x70532f,folderPath:_0x317389}of _0x8eb1ce){_0x385ef2[_0x14eb4c(0x1f8)](_0x317389+':'+_0x70532f[_0x14eb4c(0x209)]);}return _0x5c712b[_0x14eb4c(0x201)](_0x5845c0=>{const _0x2fc024=_0x14eb4c,_0x420d61=_0x5845c0[_0x2fc024(0x23c)]?_0x50d95b['get'](_0x5845c0[_0x2fc024(0x23c)][_0x2fc024(0x29c)]())||'':'',_0x35797f=_0x420d61+':'+_0x5845c0[_0x2fc024(0x209)];if(_0x385ef2['has'](_0x35797f))return![];if(_0xe40d91)return _0x420d61===_0x27498c||_0x420d61[_0x2fc024(0x1f7)](_0x27498c+'/');return!![];});}export function findJourneysToDelete(_0x2a0c88,_0x54134b,_0x34c627,_0x3b0b1b,_0x5dcfd6){const _0x41e763=a155_0x30a951,_0x5a35c1=new Set();for(const {yamlConfig:_0x47d8e5,folderPath:_0x1765a}of _0x54134b){_0x5a35c1[_0x41e763(0x1f8)](_0x1765a+':'+_0x47d8e5[_0x41e763(0x209)]);}return _0x2a0c88[_0x41e763(0x201)](_0x5c0c52=>{const _0x3a9737=_0x41e763,_0x5c62a6=_0x5c0c52[_0x3a9737(0x27d)]?_0x34c627[_0x3a9737(0x1f4)](_0x5c0c52[_0x3a9737(0x27d)])||'':'',_0xa243a1=_0x5c62a6+':'+_0x5c0c52[_0x3a9737(0x297)];if(_0x5a35c1[_0x3a9737(0x239)](_0xa243a1))return![];if(_0x5dcfd6)return _0x5c62a6===_0x3b0b1b||_0x5c62a6['startsWith'](_0x3b0b1b+'/');return!![];});}export function buildSegmentLookupMap(_0x1aabfc,_0x57781a){const _0x16304f=a155_0x30a951,_0x3f1a1a=new Map();for(const _0x567ba9 of _0x1aabfc){const _0x205b50=_0x567ba9[_0x16304f(0x23c)]?_0x57781a[_0x16304f(0x1f4)](_0x567ba9['segmentFolderId']['toString']())||'':'',_0x2fe43d=_0x205b50+':'+_0x567ba9[_0x16304f(0x209)];_0x3f1a1a[_0x16304f(0x1c6)](_0x2fe43d,_0x567ba9);}return _0x3f1a1a;}export function buildSegmentNameToIdMap(_0xd3ed8b){const _0x245562=new Map();for(const _0x5e167e of _0xd3ed8b){_0x245562['set'](_0x5e167e['name'],_0x5e167e['id']);}return _0x245562;}export function buildJourneyBundleLookupMap(_0x2b378f,_0x3effc4){const _0x38ecc3=a155_0x30a951,_0x4254ff=new Map();for(const _0x557959 of _0x2b378f){const _0x4a8f2f=_0x557959['folderId']?_0x3effc4['get'](_0x557959['folderId'])||'':'',_0x2e4509=_0x4a8f2f+':'+_0x557959[_0x38ecc3(0x297)];!_0x4254ff['has'](_0x2e4509)&&_0x4254ff[_0x38ecc3(0x1c6)](_0x2e4509,[]),_0x4254ff[_0x38ecc3(0x1f4)](_0x2e4509)[_0x38ecc3(0x1f0)](_0x557959);}for(const _0x43138b of _0x4254ff[_0x38ecc3(0x28a)]()){_0x43138b[_0x38ecc3(0x1f5)]((_0x93d793,_0xbe97bd)=>(_0x93d793[_0x38ecc3(0x1e2)]||0x0)-(_0xbe97bd[_0x38ecc3(0x1e2)]||0x0));}return _0x4254ff;}export function collectFoldersToCreate(_0x271ea7,_0x38d553){const _0x3a8754=a155_0x30a951,_0x57afbb=new Set();for(const _0x742766 of _0x271ea7){if(!_0x742766)continue;if(_0x38d553['has'](_0x742766))continue;const _0x24f471=_0x742766[_0x3a8754(0x291)]('/');let _0x21d326='';for(const _0x5e742a of _0x24f471){_0x21d326=_0x21d326?_0x21d326+'/'+_0x5e742a:_0x5e742a,!_0x38d553['has'](_0x21d326)&&_0x57afbb[_0x3a8754(0x1f8)](_0x21d326);}}return _0x57afbb;}export function parseAndClassifyYamlFiles(_0x61982e,_0x23ccd4,_0x1c1e06){const _0x5d2371=a155_0x30a951,_0x55a1d0=[],_0x2053d4=[];for(const _0xa2e2c1 of _0x61982e){const _0x26dd2d=a155_0x5c2d81[_0x5d2371(0x268)](_0x23ccd4,a155_0x5c2d81[_0x5d2371(0x277)](_0xa2e2c1)),_0x2a5257=_0x26dd2d==='.'?'':_0x26dd2d['replace'](/\\/g,'/'),_0x46d4a4=readFileSync(_0xa2e2c1,_0x5d2371(0x242)),_0x14be99=a155_0x26d673['parse'](_0x46d4a4);if(isJourneyDef(_0x14be99)){const _0x1e10f9=a155_0x14fa23(_0x46d4a4);_0x2053d4['push']({'yamlConfig':_0x1e10f9,'folderPath':_0x2a5257,'sourcePath':_0xa2e2c1});}else{if(!_0x1c1e06?.[_0x5d2371(0x27b)]){const _0x13e29e=parseSegmentYamlFile(_0x46d4a4),_0x5a3f80=normalizeChildSegmentYaml(_0x13e29e);_0x55a1d0[_0x5d2371(0x1f0)]({'yamlConfig':_0x5a3f80,'folderPath':_0x2a5257,'sourcePath':_0xa2e2c1});}}}return{'segments':_0x55a1d0,'journeys':_0x2053d4};}export function validateParsedFiles(_0x28d123,_0x44f5a5){const _0x5776cc=a155_0x30a951,_0x10869f=[];for(const {yamlConfig:_0x73105e,sourcePath:_0x2338ce}of _0x28d123[_0x5776cc(0x22d)]){const _0x3dbd9d=readFileSync(_0x2338ce,_0x5776cc(0x242)),_0x594fc0=a155_0x26d673['parseDocument'](_0x3dbd9d),_0x14c895=validateSegmentDef(_0x73105e,{'source':_0x3dbd9d,'document':_0x594fc0},{'skipSchema':!![]});if(!_0x14c895[_0x5776cc(0x249)]){const _0x422e80=a155_0x5c2d81[_0x5776cc(0x268)](_0x44f5a5,_0x2338ce);_0x10869f[_0x5776cc(0x1f0)]({'filePath':_0x422e80,'source':_0x3dbd9d,'result':_0x14c895,'isJourney':![]});}}for(const {yamlConfig:_0x3a7dc4,sourcePath:_0x53f6c8}of _0x28d123[_0x5776cc(0x263)]){const _0x405784=readFileSync(_0x53f6c8,'utf-8'),_0x41d9b0=a155_0x26d673[_0x5776cc(0x23b)](_0x405784),_0x5de613=validateJourneyDef(_0x3a7dc4,{'source':_0x405784,'document':_0x41d9b0},{'skipSchema':!![]});if(!_0x5de613[_0x5776cc(0x249)]){const _0x535fd5=a155_0x5c2d81[_0x5776cc(0x268)](_0x44f5a5,_0x53f6c8);_0x10869f['push']({'filePath':_0x535fd5,'source':_0x405784,'result':_0x5de613,'isJourney':!![]});}}return _0x10869f;}export function formatValidationErrors(_0x32d7d1){const _0x16493d=a155_0x30a951,_0x41b6af=[];for(const {filePath:_0x4206a0,source:_0x2b3457,result:_0x55be1b,isJourney:_0x256e03}of _0x32d7d1){const _0x23d309=_0x256e03?_0x16493d(0x20c):_0x16493d(0x1ad);_0x41b6af['push']('\x0a'+_0x4206a0+'\x20('+_0x23d309+'):\x20'+_0x55be1b['errors'][_0x16493d(0x1f3)]+_0x16493d(0x1ba)),_0x41b6af[_0x16493d(0x1f0)](formatValidationResult(_0x55be1b,_0x2b3457,_0x4206a0));}return _0x41b6af[_0x16493d(0x1d8)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x480fda){const _0xce09ab=a155_0x30a951,_0x2fc49d=new Set(),_0xee31e1=new Map(),_0x168523=collectSegmentUsageCounts(_0x480fda);if(_0x480fda['segments'])for(const [_0x3c0d50,_0x1dadd6]of Object[_0xce09ab(0x1f6)](_0x480fda['segments'])){_0x2fc49d['add'](_0x3c0d50);if(_0x1dadd6[_0xce09ab(0x220)]){const _0x598a48=yamlRuleToApi(_0x1dadd6[_0xce09ab(0x220)]),_0x363d2c=apiRuleToYaml(_0x598a48);_0xee31e1[_0xce09ab(0x1c6)](_0x3c0d50,_0x363d2c);}}const _0x263a97=new Map();let _0x551675=0x0;for(const [_0x59ba40,_0x15b9e4]of _0xee31e1){const _0x5e3888=serializeExpandedRule(_0x15b9e4,_0xee31e1),_0x140385=_0x263a97[_0xce09ab(0x1f4)](_0x5e3888)||[];_0x140385[_0xce09ab(0x1f0)]({'name':_0x59ba40,'index':_0x551675}),_0x263a97['set'](_0x5e3888,_0x140385),_0x551675++;}const _0x122ca7=new Map();for(const [_0x15cf24,_0x5ded23]of _0x263a97){const _0x43bd98=_0x5ded23['slice']()['sort']((_0x206335,_0x35256a)=>{const _0x5d4267=_0xce09ab,_0x548191=_0x168523[_0x5d4267(0x1f4)](_0x206335[_0x5d4267(0x209)])||0x0,_0x500e98=_0x168523[_0x5d4267(0x1f4)](_0x35256a[_0x5d4267(0x209)])||0x0;if(_0x548191!==_0x500e98)return _0x500e98-_0x548191;return _0x206335[_0x5d4267(0x1e7)]-_0x35256a[_0x5d4267(0x1e7)];})[_0xce09ab(0x258)](_0x55dcd3=>_0x55dcd3['name']),_0x3e6f67=[];for(const _0x5e639d of _0x43bd98){const _0x362eaf=_0x168523[_0xce09ab(0x1f4)](_0x5e639d)||0x0,_0x226065=Math[_0xce09ab(0x1e6)](_0x362eaf,0x1);for(let _0x37d093=0x0;_0x37d093<_0x226065;_0x37d093++){_0x3e6f67[_0xce09ab(0x1f0)](_0x5e639d);}}_0x122ca7[_0xce09ab(0x1c6)](_0x15cf24,_0x3e6f67);}return{'existingLocalSegmentNames':_0x2fc49d,'localSegmentRules':_0xee31e1,'localExpandedRuleToNames':_0x122ca7};}export function createSegmentIdResolver(_0x1424fc,_0x328da8){return async _0x1d5515=>{const _0x1f57bf=a155_0x5a27,_0x29c039=_0x1424fc[_0x1f57bf(0x1f4)](_0x1d5515);if(!_0x29c039)throw new SDKError(ErrorCode[_0x1f57bf(0x25f)],_0x1f57bf(0x26a)+_0x1d5515+_0x1f57bf(0x259)+_0x328da8+'\x27)');return _0x29c039;};}export function extractRootFolderId(_0x2cdd54){const _0x512709=a155_0x30a951;return _0x2cdd54['relationships']?.[_0x512709(0x1e0)]?.[_0x512709(0x1c0)]?.['id']||_0x2cdd54['relationships']?.['parentFolder']?.[_0x512709(0x1c0)]?.['id'];}export function buildConnectionMaps(_0x2ea047){const _0x1a4b7c=a155_0x30a951,_0x2a4c29=new Map(),_0x25b62a=new Map(),_0x144f6d=new Map();for(const _0x185443 of _0x2ea047){_0x2a4c29[_0x1a4b7c(0x1c6)](_0x185443[_0x1a4b7c(0x209)],parseInt(_0x185443['id'],0xa)),_0x25b62a[_0x1a4b7c(0x1c6)](_0x185443['id'],_0x185443['name']),_0x144f6d[_0x1a4b7c(0x1c6)](_0x185443[_0x1a4b7c(0x209)],_0x185443[_0x1a4b7c(0x20e)]);}return{'nameToId':_0x2a4c29,'idToName':_0x25b62a,'nameToType':_0x144f6d};}export function calculatePushStats(_0x4163b1,_0x3483c1,_0x17d9d0,_0x249eb0,_0x3a83c3,_0x507d75,_0x19cdce){const _0x18a67d=a155_0x30a951,_0x55f89b=_0x4163b1[_0x18a67d(0x201)](_0x55cc9e=>_0x55cc9e[_0x18a67d(0x20b)]),_0xb4fa16=_0x4163b1[_0x18a67d(0x201)](_0x22e1c0=>!_0x22e1c0[_0x18a67d(0x20b)]&&_0x22e1c0[_0x18a67d(0x214)]),_0x44b4ec=_0x4163b1[_0x18a67d(0x201)](_0x438b11=>!_0x438b11[_0x18a67d(0x20b)]&&!_0x438b11[_0x18a67d(0x214)]),_0x326eec=_0x507d75?_0x249eb0:[],_0x265adb=_0x3483c1[_0x18a67d(0x201)](_0x402f33=>_0x402f33['isNew']),_0x2b1cb6=_0x3483c1[_0x18a67d(0x201)](_0xb47688=>!_0xb47688[_0x18a67d(0x20b)]&&_0xb47688[_0x18a67d(0x214)]),_0x3f150b=_0x3483c1[_0x18a67d(0x201)](_0x2b8340=>!_0x2b8340['isNew']&&!_0x2b8340[_0x18a67d(0x214)]),_0x53fc17=_0x507d75?_0x3a83c3:[],_0x17dd4c=_0x4163b1[_0x18a67d(0x290)](_0x5a94d8=>_0x5a94d8['activationActions']),_0x5b74e4=_0x17dd4c[_0x18a67d(0x201)](_0x3a7ce1=>_0x3a7ce1[_0x18a67d(0x20e)]==='create'),_0x12c56c=_0x17dd4c[_0x18a67d(0x201)](_0x514ec1=>_0x514ec1['type']==='update'),_0x178dd7=_0x17dd4c['filter'](_0x2b73c0=>_0x2b73c0[_0x18a67d(0x20e)]===_0x18a67d(0x27e)),_0x94fd69=Array[_0x18a67d(0x1b9)](_0x17d9d0)[_0x18a67d(0x1f5)](),_0x594db3=_0x19cdce?![]:_0x55f89b[_0x18a67d(0x1f3)]>0x0||_0xb4fa16[_0x18a67d(0x1f3)]>0x0||_0x326eec[_0x18a67d(0x1f3)]>0x0,_0x1c59c2=_0x265adb[_0x18a67d(0x1f3)]>0x0||_0x2b1cb6[_0x18a67d(0x1f3)]>0x0||_0x53fc17[_0x18a67d(0x1f3)]>0x0,_0x338627=_0x19cdce?![]:_0x17dd4c[_0x18a67d(0x1f3)]>0x0,_0x2f5365=_0x94fd69['length']>0x0;return{'segments':{'new':_0x55f89b,'changed':_0xb4fa16,'unchanged':_0x44b4ec,'toDelete':_0x326eec},'journeys':{'new':_0x265adb,'changed':_0x2b1cb6,'unchanged':_0x3f150b,'toDelete':_0x53fc17},'activations':{'all':_0x17dd4c,'toCreate':_0x5b74e4,'toUpdate':_0x12c56c,'toDelete':_0x178dd7},'folders':{'toCreate':_0x94fd69},'counts':{'segments':{'new':_0x55f89b[_0x18a67d(0x1f3)],'changed':_0xb4fa16[_0x18a67d(0x1f3)],'unchanged':_0x44b4ec[_0x18a67d(0x1f3)],'toDelete':_0x326eec[_0x18a67d(0x1f3)]},'journeys':{'new':_0x265adb[_0x18a67d(0x1f3)],'changed':_0x2b1cb6[_0x18a67d(0x1f3)],'unchanged':_0x3f150b[_0x18a67d(0x1f3)],'toDelete':_0x53fc17[_0x18a67d(0x1f3)]},'activations':{'create':_0x5b74e4['length'],'update':_0x12c56c[_0x18a67d(0x1f3)],'delete':_0x178dd7[_0x18a67d(0x1f3)]},'folders':_0x94fd69[_0x18a67d(0x1f3)]},'hasChanges':_0x594db3||_0x1c59c2||_0x338627||_0x2f5365};}export async function buildPushExecutionContext(_0x1912d2,_0x3ec2ae,_0x5f4cc7,_0x1406c9,_0x2a55c7,_0x15fb24){const _0x1992ac=a155_0x30a951,_0x57d5d7=extractRootFolderId(_0x5f4cc7),{pathToId:_0x50d80,idToPath:_0x4ad1ab}=buildFolderMaps(_0x2a55c7),_0x2c705f=buildSegmentNameToIdMap(_0x1406c9),_0x2226c1=new Map(),{batchAsync:_0x47dc6a}=await import('../../utils/async.js'),[_0x288fc9,_0x376b20]=await Promise[_0x1992ac(0x203)]([_0x1912d2[_0x1992ac(0x212)][_0x1992ac(0x229)](),_0x1912d2[_0x1992ac(0x200)]['list'](),((async()=>{const _0xdd2e54=_0x1992ac;!_0x15fb24&&_0x1406c9[_0xdd2e54(0x1f3)]>0x0&&await _0x47dc6a(_0x1406c9,async _0x3c491a=>{const _0x14382f=_0xdd2e54,_0x40b266=await _0x1912d2[_0x14382f(0x1ad)][_0x14382f(0x237)](_0x3ec2ae,_0x3c491a['id']);_0x2226c1['set'](_0x3c491a['id'],_0x40b266);});})())]),{emailToId:_0x505f27,idToEmail:_0x28253b}=_0x288fc9,_0x2806b7=buildConnectionMaps(_0x376b20);return{'rootFolderId':_0x57d5d7,'folderPathToId':_0x50d80,'folderIdToPath':_0x4ad1ab,'segmentNameToId':_0x2c705f,'activationsBySegmentId':_0x2226c1,'emailToIdMap':_0x505f27,'idToEmailMap':_0x28253b,'connectionNameToIdMap':_0x2806b7['nameToId'],'connectionIdToNameMap':_0x2806b7[_0x1992ac(0x1e1)],'connectionNameToTypeMap':_0x2806b7[_0x1992ac(0x1c7)]};}export function createPushYamlContextForBundle(_0x58c851,_0x101285,_0x4b5ede,_0x447b74,_0x4f56b4,_0x135b79,_0x1dee95,_0x7d8acc){const {existingLocalSegmentNames:_0x34634d,localExpandedRuleToNames:_0x379bf4}=_0x447b74,_0x40328d=new Set(),_0x1fac3c=new Map(),_0x30383b=new Map(),_0x310ef1=new Map(),_0x234bee=createJumpTargetCache(),_0x5f25f4=new Map(),_0x46e953=new Map(),_0x1c3eec=new Set();let _0xb49b60;const _0x584f5a=_0x8198cf=>{const _0x1eef90={'resolveSegment':async _0x3ad0fa=>{const _0x378f26=a155_0x5a27,_0x1ec674=_0x310ef1[_0x378f26(0x1f4)](_0x3ad0fa);if(_0x1ec674!==undefined)return{'name':_0x1ec674,'isJourneyLocal':!![]};try{const _0x2ac564=await fetchSegment(_0x58c851,_0x101285,_0x3ad0fa,_0x4b5ede);if(!_0x2ac564)throw new Error(_0x378f26(0x1cd));const _0x38fc3a=generateJourneyLocalName(_0x2ac564[_0x378f26(0x209)]),_0x2ec9bc=_0x2ac564[_0x378f26(0x265)]===SEGMENT_KIND_JOURNEY&&_0x38fc3a!==undefined;let _0x323653=_0x2ac564['name'],_0x1c7fe3;if(_0x2ec9bc&&_0x2ac564[_0x378f26(0x220)]){const _0x97b95b=apiRuleToYaml(_0x2ac564[_0x378f26(0x220)]);_0x46e953[_0x378f26(0x1c6)](_0x3ad0fa,_0x97b95b);const _0xcfd213=async _0x2de0f2=>{const _0x673db0=_0x378f26,_0x4d01f5=collectSegmentRefsFromRule(_0x2de0f2);for(const _0x231b23 of _0x4d01f5){if(!_0x46e953['has'](_0x231b23))try{const _0x12c66a=await fetchSegment(_0x58c851,_0x101285,_0x231b23,_0x4b5ede);if(_0x12c66a?.[_0x673db0(0x220)]){const _0x49f7a1=apiRuleToYaml(_0x12c66a[_0x673db0(0x220)]);_0x46e953[_0x673db0(0x1c6)](_0x231b23,_0x49f7a1),await _0xcfd213(_0x49f7a1);}}catch(_0x54a6f8){logger['debug'](_0x673db0(0x286)+_0x231b23+':\x20'+_0x54a6f8);}}};await _0xcfd213(_0x97b95b);const _0x4cb20f=serializeExpandedRule(_0x97b95b,_0x46e953),_0x53fef8=_0x379bf4[_0x378f26(0x1f4)](_0x4cb20f);if(_0x53fef8&&_0x53fef8['length']>0x0){const _0x54480e=_0x1fac3c[_0x378f26(0x1f4)](_0x4cb20f)||0x0,_0x1325e3=_0x53fef8[_0x54480e]||_0x53fef8[_0x53fef8[_0x378f26(0x1f3)]-0x1];_0x1fac3c[_0x378f26(0x1c6)](_0x4cb20f,_0x54480e+0x1),_0x323653=_0x1325e3,_0x40328d['add'](_0x323653),_0x310ef1['set'](_0x3ad0fa,_0x323653);const _0x334e68=await resolveRuleSegmentRefs(_0x97b95b,async _0xa2dfd7=>{const _0x1b6998=_0x378f26,_0x21fe08=_0x310ef1[_0x1b6998(0x1f4)](_0xa2dfd7);if(_0x21fe08)return _0x21fe08;const _0x3b25c0=await _0xb49b60[_0x1b6998(0x1eb)](_0xa2dfd7);return _0x3b25c0[_0x1b6998(0x209)];});_0x1c7fe3={'description':_0x2ac564[_0x378f26(0x1df)],'rule':_0x334e68};}else{const _0x2d6c6e=_0x5f25f4['get'](_0x4cb20f);if(_0x2d6c6e)_0x323653=_0x2d6c6e,_0x310ef1[_0x378f26(0x1c6)](_0x3ad0fa,_0x323653);else{if(_0x38fc3a){let _0x465a3b=_0x38fc3a,_0x5bff49=0x2;while(_0x40328d[_0x378f26(0x239)](_0x465a3b)||_0x34634d[_0x378f26(0x239)](_0x465a3b)){_0x465a3b=_0x38fc3a+'_'+_0x5bff49,_0x5bff49++;}_0x40328d[_0x378f26(0x1f8)](_0x465a3b),_0x323653=_0x465a3b;}_0x310ef1[_0x378f26(0x1c6)](_0x3ad0fa,_0x323653),_0x5f25f4[_0x378f26(0x1c6)](_0x4cb20f,_0x323653);const _0x1d02f8=await resolveRuleSegmentRefs(_0x97b95b,async _0x337b99=>{const _0x5b31bd=_0x378f26,_0x5715c8=_0x310ef1[_0x5b31bd(0x1f4)](_0x337b99);if(_0x5715c8)return _0x5715c8;const _0x3cbc8d=await _0xb49b60[_0x5b31bd(0x1eb)](_0x337b99);return _0x3cbc8d[_0x5b31bd(0x209)];});_0x1c7fe3={'description':_0x2ac564[_0x378f26(0x1df)],'rule':_0x1d02f8};}}}return{'name':_0x323653,'isJourneyLocal':_0x2ec9bc,'definition':_0x1c7fe3};}catch(_0x4e7e03){return logger[_0x378f26(0x29d)](_0x378f26(0x215)+_0x3ad0fa+':\x20'+_0x4e7e03),{'name':_0x3ad0fa,'isJourneyLocal':![]};}},'resolveActivation':async _0x1b0f15=>{const _0x116ffe=a155_0x5a27,_0x3e281d=_0x30383b[_0x116ffe(0x1f4)](_0x1b0f15);if(_0x3e281d!==undefined)return{'name':_0x3e281d,'isJourneyLocal':!![]};try{let _0x2e1e99=_0x1dee95?.[_0x116ffe(0x1f4)](_0x1b0f15);!_0x2e1e99&&(_0x2e1e99=await _0x58c851[_0x116ffe(0x20c)][_0x116ffe(0x25b)](_0x8198cf,_0x1b0f15));const _0x411438=_0x2e1e99[_0x116ffe(0x1de)]['activationParams'][_0x116ffe(0x209)]||_0x1b0f15,_0x25787b=sanitizeYamlKey(_0x411438)||_0x116ffe(0x2a2)+_0x1b0f15,_0x29ca0e=_0x25787b;_0x30383b[_0x116ffe(0x1c6)](_0x1b0f15,_0x29ca0e);const _0x1421f2=journeyActivationStepToYaml(_0x2e1e99,_0x4f56b4,_0x135b79);return{'name':_0x29ca0e,'isJourneyLocal':!![],'definition':_0x1421f2};}catch(_0x1ad89f){return logger['debug'](_0x116ffe(0x22f)+_0x1b0f15+':\x20'+_0x1ad89f),{'name':_0x1b0f15,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x17bd48,_0x5ccd78)=>resolveJumpTarget(_0x17bd48,_0x5ccd78,_0x234bee,async _0x142a10=>{const _0x2b0aa0=a155_0x5a27,_0x26a15f=_0x7d8acc?.[_0x2b0aa0(0x1f4)](_0x142a10);if(_0x26a15f)return _0x26a15f;return _0x58c851['journey'][_0x2b0aa0(0x1bc)](_0x142a10);})};return _0xb49b60=_0x1eef90,_0x1eef90;},_0x27d3b7=async _0x3a859b=>{const _0x2a3e38=a155_0x5a27,{collectSegmentIdsFromJourneyApi:_0x3b3c7d}=await import('./journey-yaml.js'),{batchAsync:_0x249fd1}=await import('../../utils/async.js'),_0x104dfb=new Set();for(const _0x43ce48 of _0x3a859b){let _0x609c86=_0x7d8acc?.[_0x2a3e38(0x1f4)](_0x43ce48);!_0x609c86&&(_0x609c86=await _0x58c851[_0x2a3e38(0x20c)][_0x2a3e38(0x1bc)](_0x43ce48));const _0x37e1c5=_0x3b3c7d(_0x609c86);for(const _0x479343 of _0x37e1c5){_0x104dfb[_0x2a3e38(0x1f8)](_0x479343);}}let _0xe470ec=Array[_0x2a3e38(0x1b9)](_0x104dfb);while(_0xe470ec[_0x2a3e38(0x1f3)]>0x0){const _0x378a84=_0xe470ec[_0x2a3e38(0x201)](_0x5c65f3=>!_0x1c3eec[_0x2a3e38(0x239)](_0x5c65f3));if(_0x378a84['length']===0x0)break;const _0xe68200=await _0x249fd1(_0x378a84,async _0x211a4c=>{const _0x2a6006=_0x2a3e38;_0x1c3eec[_0x2a6006(0x1f8)](_0x211a4c);const _0x14f78e=await fetchSegment(_0x58c851,_0x101285,_0x211a4c,_0x4b5ede);if(!_0x14f78e)return null;return{'segmentId':_0x211a4c,'segment':_0x14f78e};},0xa),_0x2cf4c3=new Set();for(const _0x1cbb23 of _0xe68200){if(!_0x1cbb23?.[_0x2a3e38(0x1ad)]?.[_0x2a3e38(0x220)])continue;const _0xa56bae=apiRuleToYaml(_0x1cbb23[_0x2a3e38(0x1ad)]['rule']);_0x46e953[_0x2a3e38(0x1c6)](_0x1cbb23['segmentId'],_0xa56bae);const _0x59033f=collectSegmentRefsFromRule(_0xa56bae);for(const _0x49fa89 of _0x59033f){!_0x1c3eec[_0x2a3e38(0x239)](_0x49fa89)&&_0x2cf4c3['add'](_0x49fa89);}}_0xe470ec=Array['from'](_0x2cf4c3);}};return{'createYamlContext':_0x584f5a,'prefetchJourneySegments':_0x27d3b7};}export async function executePushSegments(_0x392f19,_0x2fa742,_0x3d4a4b,_0x140cd3,_0x36dcc7){const _0x298424=a155_0x30a951,{segmentDefToCreateRequest:_0x341219,segmentDefToUpdateRequest:_0xb2113f}=await import('./child-segment-yaml.js'),_0x49fea9=_0x3d4a4b['folderPathToId'],_0x486266=0x5,_0x2a3af3=async _0x42571a=>{const _0xe20a3b=a155_0x5a27,_0x4790c4=_0x42571a[_0xe20a3b(0x287)]?_0x49fea9[_0xe20a3b(0x1f4)](_0x42571a[_0xe20a3b(0x287)]):undefined;let _0x25efbd;const _0x496c5a={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x26ebd5=_0x42571a[_0xe20a3b(0x224)];if(_0x42571a['yamlConfig']['rule']){const _0x327e38=createSegmentIdResolver(_0x3d4a4b[_0xe20a3b(0x246)],_0x42571a['yamlConfig']['name']),_0x33184a=await resolveRuleSegmentIds(_0x42571a[_0xe20a3b(0x224)][_0xe20a3b(0x220)],_0x327e38);_0x26ebd5={..._0x42571a[_0xe20a3b(0x224)],'rule':_0x33184a};}try{if(_0x42571a[_0xe20a3b(0x20b)]){_0x36dcc7[_0xe20a3b(0x23a)]?.({'type':_0xe20a3b(0x241),'name':_0x42571a[_0xe20a3b(0x224)][_0xe20a3b(0x209)]});const _0x5db0e1=_0x341219(_0x26ebd5,_0x4790c4),_0x56ff9c=await _0x36dcc7[_0xe20a3b(0x280)](_0xe20a3b(0x28d)+_0x42571a[_0xe20a3b(0x224)][_0xe20a3b(0x209)]+'\x27...',()=>_0x392f19[_0xe20a3b(0x1ad)]['createSegment'](_0x140cd3[_0xe20a3b(0x222)],_0x5db0e1));_0x25efbd=_0x56ff9c[_0xe20a3b(0x1c0)]['id'],_0x3d4a4b['segmentNameToId']['set'](_0x42571a[_0xe20a3b(0x224)]['name'],_0x25efbd),_0x496c5a[_0xe20a3b(0x1ce)]={'name':_0x42571a['yamlConfig']['name'],'id':_0x25efbd},_0x36dcc7[_0xe20a3b(0x23a)]?.({'type':_0xe20a3b(0x24a),'name':_0x42571a[_0xe20a3b(0x224)][_0xe20a3b(0x209)],'segmentId':_0x25efbd}),_0x36dcc7[_0xe20a3b(0x252)]?.(_0xe20a3b(0x21a)+_0x42571a[_0xe20a3b(0x224)]['name']+'\x27'),_0x496c5a['created']=0x1;}else{if(_0x42571a[_0xe20a3b(0x214)]){_0x36dcc7['onProgress']?.({'type':'segment_updating','name':_0x42571a[_0xe20a3b(0x224)][_0xe20a3b(0x209)]});const _0x5c41cf=_0xb2113f(_0x26ebd5);_0x4790c4!==_0x42571a['existingSegment']?.[_0xe20a3b(0x23c)]&&(_0x5c41cf[_0xe20a3b(0x23c)]=_0x4790c4?parseInt(_0x4790c4,0xa):undefined),await _0x36dcc7[_0xe20a3b(0x280)](_0xe20a3b(0x261)+_0x42571a[_0xe20a3b(0x224)][_0xe20a3b(0x209)]+_0xe20a3b(0x225),()=>_0x392f19[_0xe20a3b(0x1ad)]['updateSegmentById'](_0x140cd3[_0xe20a3b(0x222)],_0x42571a['existingSegment']['id'],_0x5c41cf)),_0x25efbd=_0x42571a[_0xe20a3b(0x26f)]['id'],_0x36dcc7[_0xe20a3b(0x23a)]?.({'type':'segment_updated','name':_0x42571a['yamlConfig']['name']}),_0x36dcc7[_0xe20a3b(0x252)]?.(_0xe20a3b(0x255)+_0x42571a[_0xe20a3b(0x224)][_0xe20a3b(0x209)]+'\x27'),_0x496c5a[_0xe20a3b(0x28b)]=0x1;}else _0x25efbd=_0x42571a['existingSegment']['id'];}}catch(_0x9a8db7){const _0x5ef2a9=isHttp400Error(_0x9a8db7),_0x25ba25=_0x5ef2a9?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0xe20a3b(0x23d)],_0x558942=getErrorMessage(_0x9a8db7);throw new SDKError(_0x25ba25,'Failed\x20to\x20'+(_0x42571a['isNew']?_0xe20a3b(0x247):_0xe20a3b(0x26b))+'\x20segment\x20from\x20file:\x20'+_0x42571a[_0xe20a3b(0x232)]+_0xe20a3b(0x1fd)+_0x558942,_0x9a8db7);}try{const _0x4f245b=await syncActivationsForSegment(_0x392f19,_0x140cd3[_0xe20a3b(0x222)],_0x25efbd,_0x42571a[_0xe20a3b(0x224)][_0xe20a3b(0x209)],_0x42571a[_0xe20a3b(0x1f2)],_0x36dcc7,_0x42571a[_0xe20a3b(0x232)]);_0x496c5a[_0xe20a3b(0x25c)]=_0x4f245b;}catch(_0x5cbdc9){if(_0x5cbdc9 instanceof SDKError)throw _0x5cbdc9;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0xe20a3b(0x240)+_0x42571a['yamlConfig']['name']+_0xe20a3b(0x264)+_0x42571a[_0xe20a3b(0x232)]+'\x0a\x20\x20'+getErrorMessage(_0x5cbdc9),_0x5cbdc9);}return _0x496c5a;},_0x4a3bd6=await batchAsync(_0x2fa742,_0x2a3af3,_0x486266),_0x30f68c={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x55851e of _0x4a3bd6){_0x30f68c[_0x298424(0x251)]+=_0x55851e[_0x298424(0x251)],_0x30f68c[_0x298424(0x28b)]+=_0x55851e[_0x298424(0x28b)],_0x55851e['createdSegmentId']&&_0x30f68c['createdSegmentIds'][_0x298424(0x1c6)](_0x55851e[_0x298424(0x1ce)][_0x298424(0x209)],_0x55851e[_0x298424(0x1ce)]['id']),_0x30f68c[_0x298424(0x25c)][_0x298424(0x251)]+=_0x55851e['activations'][_0x298424(0x251)],_0x30f68c[_0x298424(0x25c)][_0x298424(0x28b)]+=_0x55851e[_0x298424(0x25c)][_0x298424(0x28b)],_0x30f68c[_0x298424(0x25c)]['deleted']+=_0x55851e[_0x298424(0x25c)][_0x298424(0x211)];}return _0x30f68c;}function a155_0x5a27(_0x39a59a,_0x2add34){_0x39a59a=_0x39a59a-0x1a7;const _0x3980d1=a155_0x3980();let _0x5a2743=_0x3980d1[_0x39a59a];return _0x5a2743;}async function syncActivationsForSegment(_0x5cb661,_0x371d5e,_0x4c51ea,_0x44cbc3,_0x10018c,_0x410917,_0x10dfd6){const _0x402f17=a155_0x30a951,_0x22a2ab={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x381e97 of _0x10018c){try{if(_0x381e97['type']===_0x402f17(0x247)&&_0x381e97[_0x402f17(0x271)])_0x410917[_0x402f17(0x23a)]?.({'type':'activation_creating','segmentName':_0x44cbc3,'activationName':_0x381e97['name']}),await _0x410917['withProgress'](_0x402f17(0x23e)+_0x381e97[_0x402f17(0x209)]+_0x402f17(0x225),()=>_0x5cb661[_0x402f17(0x1ad)]['createActivation'](_0x371d5e,_0x4c51ea,_0x381e97[_0x402f17(0x271)])),_0x410917[_0x402f17(0x23a)]?.({'type':_0x402f17(0x21f),'segmentName':_0x44cbc3,'activationName':_0x381e97[_0x402f17(0x209)]}),_0x410917['logSuccess']?.('Created\x20activation\x20\x27'+_0x381e97[_0x402f17(0x209)]+'\x27'),_0x22a2ab[_0x402f17(0x251)]++;else{if(_0x381e97[_0x402f17(0x20e)]===_0x402f17(0x26b)&&_0x381e97[_0x402f17(0x271)]&&_0x381e97[_0x402f17(0x279)])_0x410917[_0x402f17(0x23a)]?.({'type':_0x402f17(0x1b5),'segmentName':_0x44cbc3,'activationName':_0x381e97[_0x402f17(0x209)]}),await _0x410917[_0x402f17(0x280)](_0x402f17(0x1cf)+_0x381e97[_0x402f17(0x209)]+_0x402f17(0x225),()=>_0x5cb661[_0x402f17(0x1ad)][_0x402f17(0x1b7)](_0x371d5e,_0x4c51ea,_0x381e97[_0x402f17(0x279)]['id'],_0x381e97['validatedRequest'])),_0x410917[_0x402f17(0x23a)]?.({'type':_0x402f17(0x238),'segmentName':_0x44cbc3,'activationName':_0x381e97[_0x402f17(0x209)]}),_0x410917[_0x402f17(0x252)]?.(_0x402f17(0x216)+_0x381e97[_0x402f17(0x209)]+'\x27'),_0x22a2ab['updated']++;else _0x381e97[_0x402f17(0x20e)]==='delete'&&_0x381e97[_0x402f17(0x279)]&&(_0x410917[_0x402f17(0x23a)]?.({'type':'activation_deleting','segmentName':_0x44cbc3,'activationName':_0x381e97[_0x402f17(0x209)]}),await _0x410917[_0x402f17(0x280)](_0x402f17(0x248)+_0x381e97[_0x402f17(0x209)]+_0x402f17(0x225),()=>_0x5cb661[_0x402f17(0x1ad)][_0x402f17(0x26e)](_0x371d5e,_0x4c51ea,_0x381e97[_0x402f17(0x279)]['id'])),_0x410917[_0x402f17(0x23a)]?.({'type':'activation_deleted','segmentName':_0x44cbc3,'activationName':_0x381e97[_0x402f17(0x209)]}),_0x410917[_0x402f17(0x1c5)]?.('Deleted\x20activation\x20\x27'+_0x381e97[_0x402f17(0x209)]+'\x27'),_0x22a2ab['deleted']++);}}catch(_0x397d1f){const _0x475ca0=isHttp400Error(_0x397d1f),_0x1cdfeb=_0x475ca0?ErrorCode[_0x402f17(0x1e4)]:ErrorCode[_0x402f17(0x213)],_0x5ae28c=getErrorMessage(_0x397d1f);throw new SDKError(_0x1cdfeb,_0x402f17(0x223)+_0x381e97[_0x402f17(0x20e)]+_0x402f17(0x1e9)+_0x381e97[_0x402f17(0x209)]+_0x402f17(0x264)+_0x10dfd6+_0x402f17(0x1fd)+_0x5ae28c,_0x397d1f);}}return _0x22a2ab;}export async function executePushFolders(_0x4496be,_0x3880ff,_0x4d25ee,_0x429eb9,_0x43fe72){const _0x4f9d5f=a155_0x30a951,_0x20e16b=new Map(_0x4d25ee),_0x4c63f2=sortFoldersByDepth(_0x3880ff);for(const _0x2e9ce6 of _0x4c63f2){const _0x42ea2a=_0x2e9ce6['split']('/'),_0x4bb413=_0x42ea2a[_0x42ea2a[_0x4f9d5f(0x1f3)]-0x1],_0x5d0640=_0x42ea2a[_0x4f9d5f(0x244)](0x0,-0x1)[_0x4f9d5f(0x1d8)]('/'),_0x5522cf=_0x20e16b['get'](_0x5d0640);_0x43fe72[_0x4f9d5f(0x23a)]?.({'type':_0x4f9d5f(0x228),'folder':_0x2e9ce6});const _0x4dc66f={'name':_0x4bb413,'parentFolderId':_0x5522cf},_0x2370c5=await _0x43fe72[_0x4f9d5f(0x280)]('Creating\x20folder\x20\x27'+_0x2e9ce6+'\x27...',()=>_0x4496be['segment'][_0x4f9d5f(0x1d4)](_0x429eb9[_0x4f9d5f(0x222)],_0x4dc66f));_0x20e16b[_0x4f9d5f(0x1c6)](_0x2e9ce6,_0x2370c5['data']['id']),_0x43fe72[_0x4f9d5f(0x23a)]?.({'type':_0x4f9d5f(0x294),'folder':_0x2e9ce6,'folderId':_0x2370c5[_0x4f9d5f(0x1c0)]['id']}),_0x43fe72[_0x4f9d5f(0x1d0)]?.('Created\x20folder\x20\x27'+_0x2e9ce6+'\x27');}return _0x20e16b;}export async function executePushSegmentDeletions(_0x1c8c06,_0x2d1b2a,_0x336b63){const _0x85cfdf=a155_0x30a951;if(_0x2d1b2a[_0x85cfdf(0x1f3)]===0x0)return 0x0;const {batchAsync:_0x229dee}=await import(_0x85cfdf(0x1e8)),_0x55dd9e=0x5,_0x4af6e7=await _0x229dee(_0x2d1b2a,async _0x4b0a29=>{const _0x2c8d0c=_0x85cfdf;return _0x336b63['onProgress']?.({'type':'segment_deleting','name':_0x4b0a29[_0x2c8d0c(0x209)]}),await _0x1c8c06['segment']['deleteSegment'](_0x4b0a29['id']),_0x336b63['onProgress']?.({'type':_0x2c8d0c(0x274),'name':_0x4b0a29['name']}),_0x336b63[_0x2c8d0c(0x1c5)]?.(_0x2c8d0c(0x24e)+_0x4b0a29[_0x2c8d0c(0x209)]+'\x27'),0x1;},_0x55dd9e);return _0x4af6e7[_0x85cfdf(0x28e)]((_0x31b865,_0x1e2738)=>_0x31b865+_0x1e2738,0x0);}export async function executePushJourneys(_0x24ece2,_0x55c2f4,_0x47cee6,_0x5800fa,_0x53eaa6){const _0x4d1dbb=a155_0x30a951,{journeyDefToRequest:_0x48c34f}=await import(_0x4d1dbb(0x1ff)),{activationDefToCreateRequest:_0xec6691,yamlRuleToApi:_0x32e45f,validateSegmentRule:_0x282158}=await import(_0x4d1dbb(0x219)),_0xcf905a={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x5709de=new Map(_0x47cee6['segmentNameToId']),_0x26e218=0x5;for(let _0x4c1268=0x0;_0x4c1268<_0x55c2f4[_0x4d1dbb(0x1f3)];_0x4c1268+=_0x26e218){const _0x435cdf=_0x55c2f4[_0x4d1dbb(0x244)](_0x4c1268,_0x4c1268+_0x26e218),_0x41ff75=await Promise[_0x4d1dbb(0x203)](_0x435cdf[_0x4d1dbb(0x258)](async _0x4084ee=>{const _0x48d778=_0x4d1dbb;if(!_0x4084ee[_0x48d778(0x20b)]&&!_0x4084ee['hasChanges'])return{'action':_0x48d778(0x1da),'name':_0x4084ee[_0x48d778(0x224)][_0x48d778(0x209)],'journeyId':_0x4084ee[_0x48d778(0x245)]?.['id']};const _0x2b22f9=_0x4084ee[_0x48d778(0x287)]?_0x47cee6['folderPathToId'][_0x48d778(0x1f4)](_0x4084ee[_0x48d778(0x287)]):undefined;_0x53eaa6[_0x48d778(0x23a)]?.({'type':_0x4084ee[_0x48d778(0x20b)]?'journey_creating':_0x48d778(0x289),'name':_0x4084ee['yamlConfig'][_0x48d778(0x209)]});try{const _0x7efbf0=await executeSingleJourneyPush(_0x24ece2,_0x4084ee,{..._0x47cee6,'segmentNameToId':_0x5709de},{'parentId':_0x5800fa['parentId'],'rootFolderId':_0x5800fa[_0x48d778(0x25d)],'folderId':_0x2b22f9,'verbose':_0x5800fa[_0x48d778(0x284)]},_0x53eaa6,{'journeyDefToRequest':_0x48c34f,'activationDefToCreateRequest':_0xec6691,'yamlRuleToApi':_0x32e45f,'validateSegmentRule':_0x282158});for(const [_0x5c5149,_0x3ca315]of _0x7efbf0[_0x48d778(0x1bd)]){_0x5709de['set'](_0x5c5149,_0x3ca315),_0xcf905a['embeddedSegmentNameToId']['set'](_0x5c5149,_0x3ca315);}if(_0x7efbf0['action']===_0x48d778(0x251))_0x53eaa6['onProgress']?.({'type':_0x48d778(0x27a),'name':_0x4084ee['yamlConfig'][_0x48d778(0x209)],'journeyId':_0x7efbf0[_0x48d778(0x202)]}),_0x53eaa6['logSuccess']?.(_0x48d778(0x298)+_0x4084ee[_0x48d778(0x224)][_0x48d778(0x209)]+'\x27'),_0xcf905a[_0x48d778(0x251)]++;else _0x7efbf0[_0x48d778(0x1f9)]==='updated'&&(_0x53eaa6[_0x48d778(0x23a)]?.({'type':_0x48d778(0x226),'name':_0x4084ee[_0x48d778(0x224)][_0x48d778(0x209)]}),_0x53eaa6['logSuccess']?.(_0x48d778(0x1fb)+_0x4084ee[_0x48d778(0x224)][_0x48d778(0x209)]+'\x27'),_0xcf905a[_0x48d778(0x28b)]++);return{'action':_0x7efbf0[_0x48d778(0x1f9)],'name':_0x4084ee[_0x48d778(0x224)][_0x48d778(0x209)],'journeyId':_0x7efbf0[_0x48d778(0x202)]};}catch(_0x35af52){const _0x3a3a0e=isHttp400Error(_0x35af52),_0x14dad8=_0x3a3a0e?ErrorCode[_0x48d778(0x1c4)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x477375=getErrorMessage(_0x35af52);throw new SDKError(_0x14dad8,_0x48d778(0x223)+(_0x4084ee['isNew']?_0x48d778(0x247):_0x48d778(0x26b))+'\x20journey\x20from\x20file:\x20'+_0x4084ee[_0x48d778(0x232)]+_0x48d778(0x1fd)+_0x477375,_0x35af52);}}));_0xcf905a[_0x4d1dbb(0x24f)][_0x4d1dbb(0x1f0)](..._0x41ff75);}return _0xcf905a;}async function matchExistingJourneySegments(_0x5b0dc9,_0x480294,_0x5a6bbe,_0xf40760,_0x3fa737){const _0x44ce30=a155_0x30a951;if(!_0x480294[_0x44ce30(0x245)]||!_0x480294[_0x44ce30(0x224)][_0x44ce30(0x22d)])return;const _0xcbb380=new Map(),_0x564295=new Set();for(const _0x5a0566 of Object[_0x44ce30(0x1e5)](_0x480294[_0x44ce30(0x224)]['segments'])){const _0xd5e7b3=generateDeterministicJourneySegmentName(_0x480294[_0x44ce30(0x224)][_0x44ce30(0x209)],_0x5a0566);_0xcbb380[_0x44ce30(0x1c6)](_0xd5e7b3,_0x5a0566),_0x564295[_0x44ce30(0x1f8)](_0x5a0566);}const _0x20dc84=[],_0x3100b9=collectSegmentIdsFromJourneyApi(_0x480294['existingJourney']);for(const _0x5709a0 of _0x3100b9){const _0x1cee9f=await fetchSegment(_0x5b0dc9,_0x5a6bbe,_0x5709a0,_0xf40760);if(!_0x1cee9f?.[_0x44ce30(0x209)])continue;const _0x4e8355=_0xcbb380[_0x44ce30(0x1f4)](_0x1cee9f[_0x44ce30(0x209)]);_0x4e8355?(_0x3fa737[_0x44ce30(0x1c6)](_0x4e8355,_0x5709a0),_0x564295[_0x44ce30(0x27e)](_0x4e8355)):_0x20dc84[_0x44ce30(0x1f0)]({'id':_0x5709a0,'seg':_0x1cee9f});}if(_0x564295[_0x44ce30(0x257)]>0x0&&_0x20dc84[_0x44ce30(0x1f3)]>0x0){const {localExpandedRuleToNames:_0xcd6be5}=buildLocalExpandedRuleMappings(_0x480294['yamlConfig']),_0x930b27=new Map();for(const {id:_0x4f48ca,seg:_0x4e51be}of _0x20dc84){if(_0x4e51be[_0x44ce30(0x220)]){const _0x4228da=apiRuleToYaml(_0x4e51be['rule']);_0x930b27[_0x44ce30(0x1c6)](_0x4f48ca,_0x4228da);}}for(const {id:_0x4f8a53,seg:_0x2e3eea}of _0x20dc84){if(!_0x2e3eea[_0x44ce30(0x220)])continue;const _0x1fb185=_0x930b27[_0x44ce30(0x1f4)](_0x4f8a53);if(!_0x1fb185)continue;const _0x4fc448=serializeExpandedRule(_0x1fb185,_0x930b27),_0x34c970=_0xcd6be5['get'](_0x4fc448);if(_0x34c970){const _0x39758c=_0x34c970['find'](_0x42ca7f=>_0x564295['has'](_0x42ca7f));_0x39758c&&(_0x3fa737['set'](_0x39758c,_0x4f8a53),_0x564295[_0x44ce30(0x27e)](_0x39758c),logger[_0x44ce30(0x29d)](_0x44ce30(0x1b0)+_0x2e3eea[_0x44ce30(0x209)]+'\x27\x20to\x20local\x20\x27'+_0x39758c+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x17b66a,_0x2a7ced,_0x6e9b4a,_0x359150,_0x1ee12c,_0x73f23c){const _0x5a3e35=a155_0x30a951,{journeyDefToRequest:_0x21fbc4,activationDefToCreateRequest:_0x208ac8,yamlRuleToApi:_0x666664,validateSegmentRule:_0x4c78aa}=_0x73f23c,_0x39ac5d=new Map(),_0x45220a=new Map();recoverSegmentIdsFromPushRecovery(_0x2a7ced,_0x39ac5d,_0x6e9b4a['segmentNameToId']);const _0x42153f=new Map(),_0x319777=new Map(),_0x4feb9e=new Map();let _0x4334a0;const _0xa3ff2c=async()=>{const _0x222637=a155_0x5a27;if(_0x4334a0)return;_0x4334a0=new Map();if(!_0x2a7ced[_0x222637(0x245)])return;const _0x2a9129=await _0x17b66a[_0x222637(0x20c)]['listActivations'](_0x2a7ced[_0x222637(0x245)]['id']);for(const _0x48f22d of _0x2a9129){const _0x4ab7b0=journeyActivationStepToYaml(_0x48f22d,_0x6e9b4a[_0x222637(0x1d2)],_0x6e9b4a[_0x222637(0x295)]),_0x3108b1=activationSignature(_0x4ab7b0);!_0x4334a0[_0x222637(0x239)](_0x3108b1)&&_0x4334a0['set'](_0x3108b1,_0x48f22d['id']),_0x4ab7b0[_0x222637(0x209)]&&_0x45220a[_0x222637(0x1c6)](_0x4ab7b0[_0x222637(0x209)],_0x48f22d['id']);}};await matchExistingJourneySegments(_0x17b66a,_0x2a7ced,_0x359150[_0x5a3e35(0x222)],_0x6e9b4a[_0x5a3e35(0x288)],_0x6e9b4a[_0x5a3e35(0x246)]);const _0x7d1484={'resolveSegmentId':async _0x5cbcf8=>{const _0x58cf31=_0x5a3e35,_0x1aa16c=_0x6e9b4a[_0x58cf31(0x246)][_0x58cf31(0x1f4)](_0x5cbcf8);if(!_0x1aa16c)throw new SDKError(ErrorCode[_0x58cf31(0x25f)],_0x58cf31(0x26a)+_0x5cbcf8+'\x20(referenced\x20in\x20journey\x20'+_0x2a7ced[_0x58cf31(0x224)]['name']+')');return _0x1aa16c;},'resolveEmbeddedSegmentId':async(_0x2cb54e,_0x18aeaa)=>{const _0x4b11d2=_0x5a3e35,_0x273f30=_0x6e9b4a[_0x4b11d2(0x246)]['get'](_0x2cb54e);if(_0x273f30)return _0x273f30;const _0x19da16=_0x6e9b4a[_0x4b11d2(0x288)][_0x4b11d2(0x227)](_0x5bad5d=>_0x5bad5d['name']===_0x2cb54e);if(_0x19da16)return _0x6e9b4a[_0x4b11d2(0x246)]['set'](_0x2cb54e,_0x19da16['id']),_0x19da16['id'];if(_0x2a7ced['isNew']){const {stageName:_0x3e06e4,criteriaName:_0x472ab3}=findSegmentCriteriaLocation(_0x2a7ced[_0x4b11d2(0x224)],_0x2cb54e);return _0x4c78aa(_0x2cb54e,_0x18aeaa[_0x4b11d2(0x220)]),_0x319777['set'](_0x2cb54e,{'definition':_0x18aeaa,'stageName':_0x3e06e4,'criteriaName':_0x472ab3}),createPendingSegmentId(_0x2cb54e);}const _0x290e79=_0x2a7ced['existingJourney']?.['id'];if(!_0x290e79)throw new SDKError(ErrorCode[_0x4b11d2(0x276)],_0x4b11d2(0x23f));const _0x3c0cf8=_0x42153f[_0x4b11d2(0x1f4)](_0x2cb54e);if(_0x3c0cf8)return _0x3c0cf8;const _0x1872a4=((async()=>{const _0x29f1d6=_0x4b11d2;_0x4c78aa(_0x2cb54e,_0x18aeaa[_0x29f1d6(0x220)]);const _0x4334dd=generateDeterministicJourneySegmentName(_0x2a7ced['yamlConfig']['name'],_0x2cb54e),_0x18d4fe=_0x6e9b4a['existingSegments'][_0x29f1d6(0x227)](_0x4e51ac=>_0x4e51ac[_0x29f1d6(0x209)]===_0x4334dd),_0x53e841=createSegmentIdResolver(_0x6e9b4a['segmentNameToId'],_0x2cb54e),_0x1a523d=await resolveRuleSegmentIds(_0x18aeaa[_0x29f1d6(0x220)],_0x53e841);let _0x4f0f30;return _0x18d4fe?(await _0x17b66a[_0x29f1d6(0x1ad)][_0x29f1d6(0x1c1)](_0x359150[_0x29f1d6(0x222)],_0x18d4fe['id'],{'description':_0x18aeaa[_0x29f1d6(0x1df)]||_0x29f1d6(0x29a)+_0x2cb54e,'rule':_0x666664(_0x1a523d),'countPopulation':!![]}),_0x4f0f30=_0x18d4fe['id'],saveSegmentToPushRecovery(_0x2a7ced['absolutePath'],_0x2a7ced['yamlConfig'][_0x29f1d6(0x209)],_0x2cb54e,{'segmentId':_0x4f0f30,'uniqueServerName':_0x4334dd,'createdAt':new Date()[_0x29f1d6(0x296)]()})):_0x4f0f30=await createOrRecoverEmbeddedSegment(_0x17b66a,_0x2a7ced,{'localName':_0x2cb54e,'uniqueSegmentName':_0x4334dd,'description':_0x18aeaa[_0x29f1d6(0x1df)]||_0x29f1d6(0x29a)+_0x2cb54e,'journeyId':_0x290e79,'resolvedRule':_0x1a523d,'parentId':_0x359150['parentId'],'folderId':_0x359150['rootFolderId']||''},_0x666664),_0x6e9b4a[_0x29f1d6(0x246)][_0x29f1d6(0x1c6)](_0x2cb54e,_0x4f0f30),_0x39ac5d[_0x29f1d6(0x1c6)](_0x2cb54e,_0x4f0f30),_0x4f0f30;})());_0x42153f[_0x4b11d2(0x1c6)](_0x2cb54e,_0x1872a4);try{return await _0x1872a4;}finally{_0x42153f['delete'](_0x2cb54e);}},'resolveActivationId':async _0x4c7e5d=>{const _0x4bf478=_0x5a3e35,_0x3e7b7a=_0x45220a[_0x4bf478(0x1f4)](_0x4c7e5d);if(_0x3e7b7a)return _0x3e7b7a;if(_0x2a7ced[_0x4bf478(0x245)]){await _0xa3ff2c();const _0x56ba68=_0x45220a[_0x4bf478(0x1f4)](_0x4c7e5d);if(_0x56ba68)return _0x56ba68;}throw new SDKError(ErrorCode[_0x4bf478(0x254)],_0x4bf478(0x234)+_0x4c7e5d+_0x4bf478(0x1dd)+_0x2a7ced['yamlConfig']['name']+').\x20'+_0x4bf478(0x1c2));},'resolveEmbeddedActivationId':async(_0x39f3e6,_0x529a0f)=>{const _0x29cecb=_0x5a3e35,_0xae7dd0=_0x45220a[_0x29cecb(0x1f4)](_0x39f3e6);if(_0xae7dd0)return _0xae7dd0;if(_0x2a7ced[_0x29cecb(0x20b)])return _0x4feb9e[_0x29cecb(0x1c6)](_0x39f3e6,_0x529a0f),createPendingActivationId(_0x39f3e6);if(_0x2a7ced['existingJourney']){await _0xa3ff2c();const _0x3b8164=_0x45220a[_0x29cecb(0x1f4)](_0x529a0f[_0x29cecb(0x209)]);if(_0x3b8164)return _0x45220a[_0x29cecb(0x1c6)](_0x39f3e6,_0x3b8164),_0x3b8164;const _0x381083=activationSignature(_0x529a0f),_0x11b54a=_0x4334a0?.[_0x29cecb(0x1f4)](_0x381083);if(_0x11b54a)return _0x45220a[_0x29cecb(0x1c6)](_0x39f3e6,_0x11b54a),_0x11b54a;const _0x1cc938=await _0x208ac8(_0x529a0f,_0x6e9b4a[_0x29cecb(0x28c)]),_0x56af74={..._0x1cc938,..._0x529a0f[_0x29cecb(0x2a1)]!==undefined&&{'runAfterJourneyRefresh':_0x529a0f[_0x29cecb(0x2a1)]}},_0x58695b=await _0x17b66a[_0x29cecb(0x20c)][_0x29cecb(0x283)](_0x2a7ced[_0x29cecb(0x245)]['id'],_0x56af74);return _0x45220a[_0x29cecb(0x1c6)](_0x39f3e6,_0x58695b['id']),_0x58695b['id'];}throw new SDKError(ErrorCode[_0x29cecb(0x276)],_0x29cecb(0x1b6));},'resolveJourneyId':async _0x408cd8=>{const _0xfb45=_0x5a3e35;try{return await _0x17b66a[_0xfb45(0x20c)][_0xfb45(0x27c)](_0x359150[_0xfb45(0x222)],_0x408cd8);}catch(_0x43fe4f){throw new SDKError(ErrorCode[_0xfb45(0x254)],'Journey\x20\x27'+_0x408cd8+_0xfb45(0x22e)+_0x2a7ced[_0xfb45(0x224)][_0xfb45(0x209)]+'\x27)',_0x43fe4f);}},'resolveStageId':async(_0x4bf76b,_0x519b26)=>{const _0x2217e4=_0x5a3e35,_0x3420fc=await _0x17b66a['journey'][_0x2217e4(0x1bc)](_0x4bf76b),_0x549143=_0x3420fc['attributes']['journeyStages'][_0x2217e4(0x227)](_0x332adb=>_0x332adb['name'][_0x2217e4(0x1f1)]()===_0x519b26[_0x2217e4(0x1f1)]());if(!_0x549143?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x2217e4(0x292)+_0x519b26+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x3420fc[_0x2217e4(0x1de)][_0x2217e4(0x297)]||_0x3420fc[_0x2217e4(0x1de)][_0x2217e4(0x209)])+'\x27');return _0x549143['id'];}},_0x5de21a=await _0x21fbc4(_0x2a7ced[_0x5a3e35(0x224)],_0x359150[_0x5a3e35(0x222)],_0x7d1484),_0x4065ba=_0x359150['folderId']||_0x359150['rootFolderId'];_0x4065ba&&(_0x5de21a['relationships']={'parentFolder':{'data':{'id':_0x4065ba,'type':_0x5a3e35(0x1e3)}}});if(_0x2a7ced[_0x5a3e35(0x20b)]){if(_0x319777[_0x5a3e35(0x257)]>0x0||_0x4feb9e[_0x5a3e35(0x257)]>0x0)return await executeThreeStepJourneyCreate(_0x17b66a,_0x2a7ced,_0x5de21a,{'pendingEmbeddedSegments':_0x319777,'pendingEmbeddedActivations':_0x4feb9e,'embeddedSegmentNameToId':_0x39ac5d,'journeyActivationNameToId':_0x45220a},{..._0x359150,'effectiveFolderId':_0x4065ba},_0x6e9b4a,_0x1ee12c,_0x73f23c);else{ensureJourneyDefaults(_0x5de21a['attributes']);const _0x49b7f7=await _0x17b66a['journey'][_0x5a3e35(0x247)](_0x5de21a);return deletePushRecovery(_0x2a7ced['absolutePath']),{'action':_0x5a3e35(0x251),'journeyId':_0x49b7f7['id'],'embeddedSegmentNameToId':_0x39ac5d};}}else{if(_0x2a7ced[_0x5a3e35(0x214)]&&_0x2a7ced['existingJourney']){_0x5de21a['id']=_0x2a7ced[_0x5a3e35(0x245)]['id'];const _0x4c767b=_0x5de21a[_0x5a3e35(0x1de)];_0x2a7ced['existingJourney'][_0x5a3e35(0x1de)]?.[_0x5a3e35(0x297)]&&(_0x4c767b[_0x5a3e35(0x297)]=_0x2a7ced['existingJourney'][_0x5a3e35(0x1de)]['journeyBundleName']);const _0xe378f1=_0x2a7ced['existingJourney'][_0x5a3e35(0x1de)]?.[_0x5a3e35(0x221)];return _0xe378f1&&_0x5de21a['attributes']['journeyStages']&&injectExistingStageIds(_0x5de21a[_0x5a3e35(0x1de)]['journeyStages'],_0xe378f1),ensureJourneyDefaults(_0x4c767b),await _0x17b66a[_0x5a3e35(0x20c)][_0x5a3e35(0x26b)](_0x2a7ced[_0x5a3e35(0x245)]['id'],_0x5de21a),deletePushRecovery(_0x2a7ced[_0x5a3e35(0x232)]),{'action':_0x5a3e35(0x28b),'journeyId':_0x2a7ced[_0x5a3e35(0x245)]['id'],'embeddedSegmentNameToId':_0x39ac5d};}}return deletePushRecovery(_0x2a7ced[_0x5a3e35(0x232)]),{'action':_0x5a3e35(0x1da),'journeyId':_0x2a7ced[_0x5a3e35(0x245)]?.['id'],'embeddedSegmentNameToId':_0x39ac5d};}function findSegmentCriteriaLocation(_0xefa6e4,_0x15e620){const _0x142859=a155_0x30a951,_0x11340d=_0xefa6e4[_0x142859(0x282)]||_0xefa6e4[_0x142859(0x263)]?.[0x0]?.[_0x142859(0x282)]||[];let _0x442a16=_0x142859(0x260),_0x4f9c35=_0x15e620;const _0x23bf00=_0xefa6e4[_0x142859(0x1fa)]||_0xefa6e4[_0x142859(0x263)]?.[0x0]?.[_0x142859(0x1fa)];if(_0x23bf00?.[_0x142859(0x1ad)]===_0x15e620)return{'stageName':'goal','criteriaName':_0x23bf00[_0x142859(0x209)]||_0x15e620};_0x233bf4:for(const _0x2563ad of _0x11340d){if(_0x2563ad[_0x142859(0x273)]?.[_0x142859(0x1ad)]===_0x15e620){_0x442a16=_0x2563ad['name'],_0x4f9c35=_0x2563ad[_0x142859(0x273)][_0x142859(0x209)]||_0x15e620;break;}if(_0x2563ad[_0x142859(0x243)])for(const _0x574ecf of _0x2563ad[_0x142859(0x243)]){if(_0x574ecf[_0x142859(0x20e)]==='decision_point'&&_0x574ecf['with']?.['branches'])for(const _0xe265e7 of _0x574ecf['with'][_0x142859(0x21e)]){if(_0xe265e7[_0x142859(0x1ad)]===_0x15e620){_0x442a16=_0x2563ad[_0x142859(0x209)],_0x4f9c35=_0xe265e7[_0x142859(0x209)]||_0x15e620;break _0x233bf4;}}}}return{'stageName':_0x442a16,'criteriaName':_0x4f9c35};}async function executeThreeStepJourneyCreate(_0x345a19,_0x2ec764,_0x3b785f,_0x1e3c10,_0x2c46fc,_0x364bf0,_0x381f8a,_0x5daca4){const _0x1235f9=a155_0x30a951,{activationDefToCreateRequest:_0x4233ab,yamlRuleToApi:_0x569f8a}=_0x5daca4,{pendingEmbeddedSegments:_0x237244,pendingEmbeddedActivations:_0x3c11ac,embeddedSegmentNameToId:_0x122c42}=_0x1e3c10,_0xe6f08a=JSON[_0x1235f9(0x1d3)](JSON[_0x1235f9(0x24d)](_0x3b785f));ensureJourneyDefaults(_0xe6f08a['attributes']),stripPendingIds(_0xe6f08a);const _0x21e024=await _0x345a19[_0x1235f9(0x20c)][_0x1235f9(0x247)](_0xe6f08a),_0x972f10=_0x21e024['id'],_0x4dda0d=new Map();for(const _0x460421 of _0x21e024['attributes'][_0x1235f9(0x221)]){_0x4dda0d[_0x1235f9(0x1c6)](_0x460421[_0x1235f9(0x209)][_0x1235f9(0x1f1)](),_0x460421['id']);}recoverSegmentIdsFromPushRecovery(_0x2ec764,_0x122c42,_0x364bf0[_0x1235f9(0x246)]);for(const [_0x1d83d7,{definition:_0x2a09f0}]of _0x237244){if(_0x122c42[_0x1235f9(0x239)](_0x1d83d7)){_0x381f8a[_0x1235f9(0x23a)]?.({'type':_0x1235f9(0x230),'journeyName':_0x2ec764[_0x1235f9(0x224)][_0x1235f9(0x209)],'segmentName':_0x1d83d7});continue;}const _0x8c250e=generateDeterministicJourneySegmentName(_0x2ec764[_0x1235f9(0x224)][_0x1235f9(0x209)],_0x1d83d7);_0x381f8a[_0x1235f9(0x23a)]?.({'type':_0x1235f9(0x1c8),'journeyName':_0x2ec764[_0x1235f9(0x224)]['name'],'segmentName':_0x1d83d7});const _0x51df5e=createSegmentIdResolver(_0x364bf0['segmentNameToId'],_0x1d83d7),_0x536d5c=await resolveRuleSegmentIds(_0x2a09f0['rule'],_0x51df5e),_0x496a5b=await createOrRecoverEmbeddedSegment(_0x345a19,_0x2ec764,{'localName':_0x1d83d7,'uniqueSegmentName':_0x8c250e,'description':_0x2a09f0[_0x1235f9(0x1df)]||_0x1235f9(0x29a)+_0x1d83d7,'journeyId':_0x972f10,'resolvedRule':_0x536d5c,'parentId':_0x2c46fc[_0x1235f9(0x222)],'folderId':_0x2c46fc[_0x1235f9(0x20a)]||''},_0x569f8a);_0x122c42[_0x1235f9(0x1c6)](_0x1d83d7,_0x496a5b),_0x364bf0[_0x1235f9(0x246)][_0x1235f9(0x1c6)](_0x1d83d7,_0x496a5b),_0x381f8a[_0x1235f9(0x23a)]?.({'type':_0x1235f9(0x230),'journeyName':_0x2ec764[_0x1235f9(0x224)][_0x1235f9(0x209)],'segmentName':_0x1d83d7});}const _0x34f06d=new Map();for(const [_0x5ddf7b,_0x379fd2]of _0x3c11ac){_0x381f8a[_0x1235f9(0x23a)]?.({'type':_0x1235f9(0x1be),'journeyName':_0x2ec764[_0x1235f9(0x224)][_0x1235f9(0x209)],'activationName':_0x5ddf7b});const _0x1b8a14=await _0x4233ab(_0x379fd2,_0x364bf0[_0x1235f9(0x28c)]),_0x572e2f={..._0x1b8a14,..._0x379fd2[_0x1235f9(0x2a1)]!==undefined&&{'runAfterJourneyRefresh':_0x379fd2['run_after_journey_refresh']}},_0x2929cd=await _0x345a19[_0x1235f9(0x20c)][_0x1235f9(0x283)](_0x972f10,_0x572e2f);_0x34f06d[_0x1235f9(0x1c6)](_0x5ddf7b,_0x2929cd['id']),_0x1e3c10[_0x1235f9(0x1d7)][_0x1235f9(0x1c6)](_0x5ddf7b,_0x2929cd['id']),_0x381f8a[_0x1235f9(0x23a)]?.({'type':'embedded_activation_created','journeyName':_0x2ec764[_0x1235f9(0x224)][_0x1235f9(0x209)],'activationName':_0x5ddf7b});}const _0x25a22d=JSON[_0x1235f9(0x1d3)](JSON[_0x1235f9(0x24d)](_0x3b785f));return _0x25a22d['id']=_0x972f10,ensureJourneyDefaults(_0x25a22d[_0x1235f9(0x1de)]),resolvePendingIdsInRequest(_0x25a22d,_0x3b785f,_0x4dda0d,_0x122c42,_0x34f06d,_0x381f8a),await _0x345a19[_0x1235f9(0x20c)][_0x1235f9(0x26b)](_0x972f10,_0x25a22d),deletePushRecovery(_0x2ec764[_0x1235f9(0x232)]),{'action':'created','journeyId':_0x972f10,'embeddedSegmentNameToId':_0x122c42};}export function stripWaitStepPendingIds(_0x48e2bb){const _0x1a206e=a155_0x30a951,_0x229283=_0x48e2bb[_0x1a206e(0x207)]&&isPendingSegmentId(_0x48e2bb['conditionSegmentId']),_0x113109=_0x48e2bb[_0x1a206e(0x262)]?.[_0x1a206e(0x21d)](_0x3ce1bc=>_0x3ce1bc[_0x1a206e(0x204)]&&isPendingSegmentId(_0x3ce1bc[_0x1a206e(0x204)]));(_0x229283||_0x113109)&&(_0x48e2bb[_0x1a206e(0x270)]=_0x1a206e(0x231),_0x48e2bb[_0x1a206e(0x1d1)]=0x1,_0x48e2bb[_0x1a206e(0x22a)]='day',delete _0x48e2bb['conditionSegmentId'],delete _0x48e2bb[_0x1a206e(0x278)],delete _0x48e2bb[_0x1a206e(0x25e)],delete _0x48e2bb[_0x1a206e(0x262)]);}export function resolveWaitStepPendingIds(_0x472e06,_0x250947,_0x7ae222,_0x139923){const _0x46e695=a155_0x30a951;if(_0x250947[_0x46e695(0x207)]&&isPendingSegmentId(_0x250947[_0x46e695(0x207)])){const _0x1b1d00=_0x7ae222(_0x250947[_0x46e695(0x207)],_0x46e695(0x293)+_0x139923+_0x46e695(0x22c));_0x1b1d00&&(_0x472e06[_0x46e695(0x270)]=_0x46e695(0x1aa),_0x472e06[_0x46e695(0x207)]=_0x1b1d00,delete _0x472e06[_0x46e695(0x1d1)],delete _0x472e06[_0x46e695(0x22a)],_0x250947[_0x46e695(0x278)]!==undefined&&(_0x472e06[_0x46e695(0x278)]=_0x250947[_0x46e695(0x278)]),_0x250947['conditionTimeoutUnit']&&(_0x472e06['conditionTimeoutUnit']=_0x250947[_0x46e695(0x25e)]));}if(_0x250947[_0x46e695(0x262)]){const _0x506c36=_0x250947[_0x46e695(0x262)]['some'](_0x3b01c7=>_0x3b01c7[_0x46e695(0x204)]&&isPendingSegmentId(_0x3b01c7[_0x46e695(0x204)]));if(_0x506c36){const _0x48c3ae=_0x250947['conditions'][_0x46e695(0x258)](_0x5498ca=>{const _0x252c88=_0x46e695;if(_0x5498ca[_0x252c88(0x204)]&&isPendingSegmentId(_0x5498ca[_0x252c88(0x204)])){const _0x4da096=_0x7ae222(_0x5498ca[_0x252c88(0x204)],_0x252c88(0x293)+_0x139923+_0x252c88(0x22c));return{..._0x5498ca,'segmentId':_0x4da096||_0x5498ca[_0x252c88(0x204)]};}return{..._0x5498ca};});_0x472e06[_0x46e695(0x270)]=_0x46e695(0x1aa),_0x472e06[_0x46e695(0x262)]=_0x48c3ae,delete _0x472e06['waitStep'],delete _0x472e06['waitStepUnit'],delete _0x472e06[_0x46e695(0x207)],delete _0x472e06['conditionTimeoutDuration'],delete _0x472e06['conditionTimeoutUnit'];}}}function stripPendingIds(_0x4aeb18){const _0x3324a5=a155_0x30a951;_0x4aeb18[_0x3324a5(0x1de)][_0x3324a5(0x1fa)]?.[_0x3324a5(0x204)]&&isPendingSegmentId(_0x4aeb18[_0x3324a5(0x1de)]['goal'][_0x3324a5(0x204)])&&delete _0x4aeb18[_0x3324a5(0x1de)][_0x3324a5(0x1fa)];for(const _0x2fd2d4 of _0x4aeb18['attributes'][_0x3324a5(0x221)]||[]){_0x2fd2d4[_0x3324a5(0x1b3)]?.[_0x3324a5(0x204)]&&isPendingSegmentId(_0x2fd2d4[_0x3324a5(0x1b3)][_0x3324a5(0x204)])&&delete _0x2fd2d4[_0x3324a5(0x1b3)];_0x2fd2d4[_0x3324a5(0x27f)]?.[_0x3324a5(0x204)]&&isPendingSegmentId(_0x2fd2d4[_0x3324a5(0x27f)][_0x3324a5(0x204)])&&delete _0x2fd2d4['milestone'];_0x2fd2d4[_0x3324a5(0x1ed)]&&(_0x2fd2d4[_0x3324a5(0x1ed)]=_0x2fd2d4[_0x3324a5(0x1ed)][_0x3324a5(0x201)](_0x1ee9e4=>!_0x1ee9e4[_0x3324a5(0x204)]||!isPendingSegmentId(_0x1ee9e4[_0x3324a5(0x204)])));if(_0x2fd2d4[_0x3324a5(0x243)])for(const _0x597901 of Object[_0x3324a5(0x1e5)](_0x2fd2d4['steps'])){const _0x463bbb=_0x2fd2d4[_0x3324a5(0x243)][_0x597901];_0x463bbb[_0x3324a5(0x20e)]===_0x3324a5(0x275)&&_0x463bbb[_0x3324a5(0x233)]&&isPendingActivationId(_0x463bbb[_0x3324a5(0x233)])&&(_0x463bbb[_0x3324a5(0x233)]='');if(_0x463bbb[_0x3324a5(0x20e)]===_0x3324a5(0x26c)&&_0x463bbb[_0x3324a5(0x21e)])for(const _0x5ce0f9 of _0x463bbb[_0x3324a5(0x21e)]){_0x5ce0f9[_0x3324a5(0x204)]&&isPendingSegmentId(_0x5ce0f9[_0x3324a5(0x204)])&&(_0x5ce0f9[_0x3324a5(0x204)]='');}_0x463bbb[_0x3324a5(0x20e)]===_0x3324a5(0x253)&&stripWaitStepPendingIds(_0x463bbb);}}}function resolvePendingIdsInRequest(_0x3fe06a,_0x1fdda0,_0xeeee79,_0x3bb306,_0x552c10,_0x3b668b){const _0x53586c=a155_0x30a951,_0x2f9344=(_0x21b2b0,_0x2848e5)=>{const _0x528ca6=a155_0x5a27;if(!isPendingSegmentId(_0x21b2b0))return _0x21b2b0;const _0x1b4e9e=extractPendingSegmentName(_0x21b2b0),_0x43bdd8=_0x3bb306[_0x528ca6(0x1f4)](_0x1b4e9e);return!_0x43bdd8&&_0x3b668b[_0x528ca6(0x250)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x1b4e9e+_0x528ca6(0x1fe)+_0x2848e5),_0x43bdd8;};if(_0x3fe06a[_0x53586c(0x1de)][_0x53586c(0x1fa)]?.[_0x53586c(0x204)]&&isPendingSegmentId(_0x3fe06a[_0x53586c(0x1de)]['goal']['segmentId'])){const _0x2dc5ec=_0x2f9344(_0x3fe06a[_0x53586c(0x1de)][_0x53586c(0x1fa)][_0x53586c(0x204)],'goal\x20criteria');_0x2dc5ec&&(_0x3fe06a['attributes'][_0x53586c(0x1fa)]['segmentId']=_0x2dc5ec);}for(const _0xee679c of _0x3fe06a[_0x53586c(0x1de)]['journeyStages']||[]){const _0x8505ce=_0xeeee79['get'](_0xee679c[_0x53586c(0x209)][_0x53586c(0x1f1)]());_0x8505ce&&(_0xee679c['id']=_0x8505ce);if(_0xee679c[_0x53586c(0x1b3)]?.[_0x53586c(0x204)]&&isPendingSegmentId(_0xee679c[_0x53586c(0x1b3)][_0x53586c(0x204)])){const _0x29c436=_0x2f9344(_0xee679c[_0x53586c(0x1b3)]['segmentId'],'stage\x20\x27'+_0xee679c[_0x53586c(0x209)]+_0x53586c(0x208));_0x29c436&&(_0xee679c[_0x53586c(0x1b3)][_0x53586c(0x204)]=_0x29c436);}if(_0xee679c[_0x53586c(0x1ed)])for(const _0x2e8946 of _0xee679c['exitCriterias']){if(_0x2e8946['segmentId']&&isPendingSegmentId(_0x2e8946['segmentId'])){const _0x56a73f=_0x2f9344(_0x2e8946[_0x53586c(0x204)],_0x53586c(0x293)+_0xee679c[_0x53586c(0x209)]+_0x53586c(0x2a3));_0x56a73f&&(_0x2e8946[_0x53586c(0x204)]=_0x56a73f);}}if(_0xee679c[_0x53586c(0x27f)]?.[_0x53586c(0x204)]&&isPendingSegmentId(_0xee679c[_0x53586c(0x27f)][_0x53586c(0x204)])){const _0x4c2fa2=_0x2f9344(_0xee679c[_0x53586c(0x27f)][_0x53586c(0x204)],'stage\x20\x27'+_0xee679c['name']+_0x53586c(0x256));_0x4c2fa2&&(_0xee679c[_0x53586c(0x27f)]['segmentId']=_0x4c2fa2);}if(_0xee679c[_0x53586c(0x243)]){const _0x867f41=_0x3b4edf=>_0x1fdda0[_0x53586c(0x1de)]['journeyStages']?.[_0x53586c(0x227)](_0x4fecf4=>_0x4fecf4[_0x53586c(0x209)][_0x53586c(0x1f1)]()===_0xee679c['name'][_0x53586c(0x1f1)]())?.[_0x53586c(0x243)]?.[_0x3b4edf];for(const _0x284b3e of Object['keys'](_0xee679c[_0x53586c(0x243)])){const _0x59cc03=_0xee679c[_0x53586c(0x243)][_0x284b3e],_0xca6a1e=_0x867f41(_0x284b3e);if(_0x59cc03[_0x53586c(0x20e)]===_0x53586c(0x275)&&_0x59cc03['journeyActivationStepId']&&(isPendingActivationId(_0x59cc03[_0x53586c(0x233)])||_0x59cc03[_0x53586c(0x233)]==='')){if(_0xca6a1e?.['journeyActivationStepId']&&isPendingActivationId(_0xca6a1e[_0x53586c(0x233)])){const _0x25ef0b=extractPendingActivationName(_0xca6a1e[_0x53586c(0x233)]),_0x222291=_0x552c10[_0x53586c(0x1f4)](_0x25ef0b);_0x222291&&(_0x59cc03['journeyActivationStepId']=_0x222291);}}if(_0x59cc03[_0x53586c(0x20e)]===_0x53586c(0x26c)&&_0x59cc03['branches']&&_0xca6a1e?.[_0x53586c(0x21e)])for(let _0x90e67f=0x0;_0x90e67f<_0x59cc03[_0x53586c(0x21e)][_0x53586c(0x1f3)];_0x90e67f++){const _0x2226b2=_0x59cc03[_0x53586c(0x21e)][_0x90e67f],_0x29bbf6=_0xca6a1e[_0x53586c(0x21e)][_0x90e67f];if(_0x29bbf6?.[_0x53586c(0x204)]&&isPendingSegmentId(_0x29bbf6[_0x53586c(0x204)])){const _0xdfe421=_0x2f9344(_0x29bbf6[_0x53586c(0x204)],_0x53586c(0x293)+_0xee679c['name']+_0x53586c(0x20d)+(_0x2226b2['name']||_0x90e67f)+'\x27');_0xdfe421&&(_0x2226b2[_0x53586c(0x204)]=_0xdfe421);}}_0x59cc03[_0x53586c(0x20e)]===_0x53586c(0x253)&&_0xca6a1e?.[_0x53586c(0x20e)]===_0x53586c(0x253)&&resolveWaitStepPendingIds(_0x59cc03,_0xca6a1e,_0x2f9344,_0xee679c['name']);}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x53cc68,_0x129b56){const _0x32ec62=a156_0x4ace,_0x31424=_0x53cc68();while(!![]){try{const _0x1193f2=-parseInt(_0x32ec62(0x159))/0x1+parseInt(_0x32ec62(0x151))/0x2*(-parseInt(_0x32ec62(0x15d))/0x3)+-parseInt(_0x32ec62(0x153))/0x4+parseInt(_0x32ec62(0x15b))/0x5*(-parseInt(_0x32ec62(0x14f))/0x6)+-parseInt(_0x32ec62(0x154))/0x7+parseInt(_0x32ec62(0x15e))/0x8+-parseInt(_0x32ec62(0x158))/0x9*(-parseInt(_0x32ec62(0x152))/0xa);if(_0x1193f2===_0x129b56)break;else _0x31424['push'](_0x31424['shift']());}catch(_0x4c71c6){_0x31424['push'](_0x31424['shift']());}}}(a156_0x5957,0x6e5fe));function a156_0x4ace(_0x43c0ad,_0x31363d){_0x43c0ad=_0x43c0ad-0x14f;const _0x595759=a156_0x5957();let _0x4ace4b=_0x595759[_0x43c0ad];return _0x4ace4b;}export function buildFolderIdToPathMap(_0x50d0b8){const _0x40e859=a156_0x4ace,_0x1e54b2=new Map(),_0x639252=new Map();for(const _0x10ae90 of _0x50d0b8){_0x639252[_0x40e859(0x157)](_0x10ae90['id'],_0x10ae90);}const _0x30e088=new Set();for(const _0x305bd8 of _0x50d0b8){!_0x305bd8[_0x40e859(0x155)]&&_0x30e088[_0x40e859(0x15a)](_0x305bd8['id']);}function _0x4f56f8(_0x2175c2){const _0x1d4d92=_0x40e859;if(_0x1e54b2['has'](_0x2175c2['id']))return _0x1e54b2[_0x1d4d92(0x156)](_0x2175c2['id']);if(_0x30e088['has'](_0x2175c2['id']))return _0x1e54b2['set'](_0x2175c2['id'],''),'';if(_0x2175c2[_0x1d4d92(0x155)]){const _0x1dd2ca=_0x639252[_0x1d4d92(0x156)](_0x2175c2[_0x1d4d92(0x155)]);if(_0x1dd2ca){const _0x56b858=_0x4f56f8(_0x1dd2ca),_0x33ca8c=_0x56b858?_0x56b858+'/'+_0x2175c2[_0x1d4d92(0x15c)]:_0x2175c2[_0x1d4d92(0x15c)];return _0x1e54b2[_0x1d4d92(0x157)](_0x2175c2['id'],_0x33ca8c),_0x33ca8c;}}const _0x5a2732=_0x2175c2[_0x1d4d92(0x15c)];return _0x1e54b2['set'](_0x2175c2['id'],_0x5a2732),_0x5a2732;}for(const _0x3b5f45 of _0x50d0b8){_0x4f56f8(_0x3b5f45);}return _0x1e54b2;}function a156_0x5957(){const _0x1b9dc7=['371100WAXseh','4315710goGbUR','parentFolderId','get','set','14215923OXfzEv','861855NRwYTj','add','108665fXzVRK','name','1306119taqsCJ','1176960dBlDUf','234tcpEnA','has','2BIbOxU','20lmlqhM'];a156_0x5957=function(){return _0x1b9dc7;};return a156_0x5957();}export function buildFolderPathToIdMap(_0x5adf02){const _0x440dba=a156_0x4ace,_0x445e15=new Map(),_0x43ebeb=new Map();for(const _0x4b9d3c of _0x5adf02){_0x43ebeb[_0x440dba(0x157)](_0x4b9d3c['id'],_0x4b9d3c);}const _0x26fbeb=new Set();for(const _0x188c76 of _0x5adf02){!_0x188c76[_0x440dba(0x155)]&&_0x26fbeb['add'](_0x188c76['id']);}function _0x3c2849(_0x3cb6e9){const _0x65602f=_0x440dba;if(_0x26fbeb[_0x65602f(0x150)](_0x3cb6e9['id']))return'';if(_0x3cb6e9[_0x65602f(0x155)]){const _0x5a3d8a=_0x43ebeb[_0x65602f(0x156)](_0x3cb6e9[_0x65602f(0x155)]);if(_0x5a3d8a){const _0xc67159=_0x3c2849(_0x5a3d8a);return _0xc67159?_0xc67159+'/'+_0x3cb6e9[_0x65602f(0x15c)]:_0x3cb6e9['name'];}}return _0x3cb6e9[_0x65602f(0x15c)];}for(const _0x35307e of _0x5adf02){const _0x25967e=_0x3c2849(_0x35307e);_0x445e15[_0x440dba(0x157)](_0x25967e,_0x35307e['id']);}return _0x445e15;}export function buildFolderMaps(_0x322764){const _0x3261b5=a156_0x4ace,_0x5ed5f6=buildFolderIdToPathMap(_0x322764),_0x53fcc5=new Map();for(const [_0x32acb1,_0xb9e9fb]of _0x5ed5f6){_0x53fcc5[_0x3261b5(0x157)](_0xb9e9fb,_0x32acb1);}return{'idToPath':_0x5ed5f6,'pathToId':_0x53fcc5};}export function getFolderPath(_0xcd913f,_0x36b530){const _0x415c66=a156_0x4ace;if(!_0xcd913f)return'';return _0x36b530[_0x415c66(0x156)](_0xcd913f)??'';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x450de2,_0x7ae52d){const _0x1540b9=a157_0x30bb,_0x1c1b8b=_0x450de2();while(!![]){try{const _0x5e26bd=-parseInt(_0x1540b9(0xa5))/0x1*(parseInt(_0x1540b9(0x81))/0x2)+parseInt(_0x1540b9(0x8b))/0x3+-parseInt(_0x1540b9(0x8e))/0x4+parseInt(_0x1540b9(0xa6))/0x5+parseInt(_0x1540b9(0x8d))/0x6*(-parseInt(_0x1540b9(0x80))/0x7)+parseInt(_0x1540b9(0xa0))/0x8*(-parseInt(_0x1540b9(0x90))/0x9)+parseInt(_0x1540b9(0x83))/0xa;if(_0x5e26bd===_0x7ae52d)break;else _0x1c1b8b['push'](_0x1c1b8b['shift']());}catch(_0x192da8){_0x1c1b8b['push'](_0x1c1b8b['shift']());}}}(a157_0x1c77,0x6595e));import a157_0x5a34de from'path';import{parse as a157_0x46dc91}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x56e29a){const _0x1937c5=a157_0x30bb;if(!_0x56e29a||_0x56e29a[_0x1937c5(0x9d)]()==='')throw new Error(_0x1937c5(0x84));const _0x16af86=_0x56e29a[_0x1937c5(0x9d)]();if(_0x16af86==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x56e29a};const _0x2906ae=_0x16af86[_0x1937c5(0xa2)]('/')?_0x16af86['substring'](0x1):_0x16af86,_0x30ddd7=_0x2906ae[_0x1937c5(0x7c)]('/')[_0x1937c5(0x96)](_0x3d73dc=>_0x3d73dc!=='');if(_0x30ddd7[_0x1937c5(0x95)]===0x0)throw new Error(_0x1937c5(0xa3));const _0x2d8643=_0x16af86[_0x1937c5(0xa2)]('/')||!isRelativePathSegment(_0x30ddd7[0x0]);for(const _0x569f17 of _0x30ddd7){validatePathSegment(_0x569f17);}return{'segments':_0x30ddd7,'isAbsolute':_0x2d8643,'raw':_0x56e29a};}function isRelativePathSegment(_0x5dd6b6){return _0x5dd6b6==='.'||_0x5dd6b6==='..';}function validatePathSegment(_0x5baae6){const _0x3098c0=a157_0x30bb;if(_0x5baae6==='')throw new Error(_0x3098c0(0x8c));if(_0x5baae6==='.'||_0x5baae6==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x5baae6))throw new Error(_0x3098c0(0x7d)+_0x5baae6);if(_0x5baae6!==_0x5baae6[_0x3098c0(0x9d)]()){}}export function validatePath(_0x2540a2){const _0x24e983=a157_0x30bb;if(_0x2540a2[_0x24e983(0x97)]['length']===0x0&&!_0x2540a2[_0x24e983(0x87)])throw new Error(_0x24e983(0xa1));if(_0x2540a2[_0x24e983(0x87)]){if(_0x2540a2[_0x24e983(0x97)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x4351ac=0x0;for(const _0x2599b7 of _0x2540a2[_0x24e983(0x97)]){if(_0x2599b7==='..'){if(_0x4351ac===0x0)throw new Error(_0x24e983(0x9e));_0x4351ac--;}else _0x2599b7!=='.'&&_0x4351ac++;}}}export function joinPaths(_0x95a221,_0x3b5e9f){const _0x367202=a157_0x30bb;if(!_0x95a221||_0x95a221==='/')return _0x3b5e9f;if(!_0x3b5e9f||_0x3b5e9f==='.')return _0x95a221;if(_0x3b5e9f[_0x367202(0xa2)]('/'))return _0x3b5e9f;const _0x4d49e5=parsePath(_0x95a221),_0x4763e2=parsePath(_0x3b5e9f),_0x24504e=[..._0x4d49e5[_0x367202(0x97)]];for(const _0x253e7f of _0x4763e2[_0x367202(0x97)]){if(_0x253e7f==='.')continue;else{if(_0x253e7f==='..'){if(_0x24504e[_0x367202(0x95)]===0x0)throw new Error(_0x367202(0x89));_0x24504e['pop']();}else _0x24504e['push'](_0x253e7f);}}const _0x2c63eb=_0x24504e['join']('/');return _0x4d49e5[_0x367202(0x93)]['startsWith']('/')?'/'+_0x2c63eb:_0x2c63eb;}export function normalizePath(_0x312fd1){const _0x384d3b=a157_0x30bb,_0x21f2bd=parsePath(_0x312fd1),_0x56009f=[];for(const _0x35fe38 of _0x21f2bd[_0x384d3b(0x97)]){if(_0x35fe38==='.')continue;else{if(_0x35fe38==='..'){if(_0x56009f[_0x384d3b(0x95)]===0x0){if(_0x21f2bd[_0x384d3b(0x87)])throw new Error(_0x384d3b(0x89));_0x56009f[_0x384d3b(0xa4)]('..');}else _0x56009f[_0x56009f[_0x384d3b(0x95)]-0x1]==='..'?_0x56009f[_0x384d3b(0xa4)]('..'):_0x56009f[_0x384d3b(0x9c)]();}else _0x56009f[_0x384d3b(0xa4)](_0x35fe38);}}if(_0x56009f[_0x384d3b(0x95)]===0x0)return _0x21f2bd['isAbsolute']?'/':'.';const _0x39f467=_0x56009f[_0x384d3b(0x86)]('/');return _0x21f2bd['raw']['startsWith']('/')?'/'+_0x39f467:_0x39f467;}export function getParentPath(_0x1e0147){const _0x20388b=a157_0x30bb,_0x846718=parsePath(_0x1e0147);if(_0x846718[_0x20388b(0x97)][_0x20388b(0x95)]<=0x1)return'/';const _0x284783=_0x846718[_0x20388b(0x97)]['slice'](0x0,-0x1)[_0x20388b(0x86)]('/');return _0x846718[_0x20388b(0x93)]['startsWith']('/')?'/'+_0x284783:_0x284783;}function a157_0x1c77(){const _0x57c1ed=['journey','No\x20tdx.json\x20found\x20for\x20file:\x20','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','split','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','readFile','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','217UHxgps','298FRimEx','type','17810430GYPKWI','Path\x20cannot\x20be\x20empty','parent_segment','join','isAbsolute','root','Cannot\x20navigate\x20above\x20root','exists','1274040HYCaiz','Path\x20segment\x20cannot\x20be\x20empty','100014JLsUfJ','2858476IrRrDu','.yaml','18clPRXK','.yml','slice','raw','dirname','length','filter','segments','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','resolve','parse','name','pop','trim','Path\x20attempts\x20to\x20navigate\x20above\x20root','endsWith','970544iZuqNb','Relative\x20path\x20cannot\x20be\x20empty','startsWith','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','push','2885vQImLs','571150MkqfgN','relative'];a157_0x1c77=function(){return _0x57c1ed;};return a157_0x1c77();}function a157_0x30bb(_0x290595,_0x4ab967){_0x290595=_0x290595-0x79;const _0x1c77b4=a157_0x1c77();let _0x30bba9=_0x1c77b4[_0x290595];return _0x30bba9;}export function getBaseName(_0x27b313){const _0x403176=a157_0x30bb,_0x345917=parsePath(_0x27b313);return _0x345917[_0x403176(0x97)][_0x345917[_0x403176(0x97)][_0x403176(0x95)]-0x1]||'';}export function isChildPath(_0x224f90,_0x2de1bd){const _0x343f5f=a157_0x30bb,_0x576922=parsePath(_0x224f90),_0x1a26dc=parsePath(_0x2de1bd);if(_0x576922[_0x343f5f(0x97)][_0x343f5f(0x95)]<=_0x1a26dc[_0x343f5f(0x97)]['length'])return![];for(let _0x57c6d1=0x0;_0x57c6d1<_0x1a26dc[_0x343f5f(0x97)][_0x343f5f(0x95)];_0x57c6d1++){if(_0x576922[_0x343f5f(0x97)][_0x57c6d1]!==_0x1a26dc[_0x343f5f(0x97)][_0x57c6d1])return![];}return!![];}export function splitPath(_0x34d174){const _0x3a1c50=a157_0x30bb,_0x548ebc=parsePath(_0x34d174);if(_0x548ebc[_0x3a1c50(0x97)][_0x3a1c50(0x95)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x548ebc[_0x3a1c50(0x97)][_0x3a1c50(0x95)]===0x1)return{'parent':_0x548ebc[_0x3a1c50(0x97)][0x0]};return{'parent':_0x548ebc['segments'][0x0],'child':_0x548ebc['segments'][_0x3a1c50(0x92)](0x1)[_0x3a1c50(0x86)]('/')};}export function isYamlFilePath(_0x3f118a){const _0x56145c=a157_0x30bb;return _0x3f118a[_0x56145c(0x9f)](_0x56145c(0x91))||_0x3f118a['endsWith'](_0x56145c(0x8f));}export async function resolveYamlFilePath(_0x17b624,_0x2d0a58=nodeFileSystem){const _0x41fff6=a157_0x30bb,_0x4ec227=a157_0x5a34de[_0x41fff6(0x99)](_0x17b624);if(!await _0x2d0a58[_0x41fff6(0x8a)](_0x4ec227))throw new Error('File\x20not\x20found:\x20'+_0x17b624);let _0x3d59be=a157_0x5a34de[_0x41fff6(0x94)](_0x4ec227),_0x978643=null,_0x4cd704=null;const _0x1e9756=a157_0x5a34de[_0x41fff6(0x9a)](_0x3d59be)[_0x41fff6(0x88)];while(_0x3d59be!==_0x1e9756){const _0x30eb73=a157_0x5a34de[_0x41fff6(0x86)](_0x3d59be,'tdx.json');if(await _0x2d0a58[_0x41fff6(0x8a)](_0x30eb73)){_0x978643=_0x30eb73,_0x4cd704=_0x3d59be;break;}_0x3d59be=a157_0x5a34de[_0x41fff6(0x94)](_0x3d59be);}if(!_0x978643||!_0x4cd704)throw new Error(_0x41fff6(0x7a)+_0x17b624+'\x0a'+_0x41fff6(0x7f));const _0x5c0341=await _0x2d0a58[_0x41fff6(0x7e)](_0x978643),_0x316250=JSON[_0x41fff6(0x9a)](_0x5c0341),_0x21d243=_0x316250[_0x41fff6(0x85)];if(!_0x21d243)throw new Error(_0x41fff6(0x7b));const _0x4c5cd3=await _0x2d0a58[_0x41fff6(0x7e)](_0x4ec227),_0x3deaa7=a157_0x46dc91(_0x4c5cd3),_0x2e573b=_0x3deaa7[_0x41fff6(0x9b)];if(!_0x2e573b)throw new Error(_0x41fff6(0x98)+_0x17b624);const _0xb95af9=_0x3deaa7[_0x41fff6(0x82)]===_0x41fff6(0x79)?'journey':'segment',_0x2d91f3=a157_0x5a34de[_0x41fff6(0xa7)](_0x4cd704,_0x4ec227),_0x128257=a157_0x5a34de['dirname'](_0x2d91f3),_0x3a6b84=_0x128257==='.'?'':_0x128257['replace'](/\\/g,'/'),_0x4fdd9b=_0x3a6b84?_0x21d243+'/'+_0x3a6b84+'/'+_0x2e573b:_0x21d243+'/'+_0x2e573b;return{'parentSegment':_0x21d243,'segmentName':_0x2e573b,'folderPath':_0x3a6b84,'fullPath':_0x4fdd9b,'resourceType':_0xb95af9,'content':_0x4c5cd3};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a158_0x2975(_0xd07025,_0x25ea84){_0xd07025=_0xd07025-0x169;const _0x48099b=a158_0x4809();let _0x29752f=_0x48099b[_0xd07025];return _0x29752f;}(function(_0x20a3bd,_0x55a740){const _0x536332=a158_0x2975,_0x3a8bfa=_0x20a3bd();while(!![]){try{const _0x1810d2=parseInt(_0x536332(0x16c))/0x1+parseInt(_0x536332(0x16b))/0x2+parseInt(_0x536332(0x170))/0x3*(-parseInt(_0x536332(0x176))/0x4)+parseInt(_0x536332(0x171))/0x5+-parseInt(_0x536332(0x16a))/0x6*(-parseInt(_0x536332(0x16e))/0x7)+-parseInt(_0x536332(0x16f))/0x8+-parseInt(_0x536332(0x16d))/0x9;if(_0x1810d2===_0x55a740)break;else _0x3a8bfa['push'](_0x3a8bfa['shift']());}catch(_0x1036be){_0x3a8bfa['push'](_0x3a8bfa['shift']());}}}(a158_0x4809,0xe58b2));export function parseSegmentRef(_0x2f7817){const _0x45a5e7=a158_0x2975,_0x467777=_0x2f7817[_0x45a5e7(0x169)]('/');if(_0x467777===-0x1)return{'parentId':_0x2f7817};if(_0x467777===0x0)throw new Error(_0x45a5e7(0x173)+_0x2f7817+_0x45a5e7(0x175));const _0x59b449=_0x2f7817[_0x45a5e7(0x174)](0x0,_0x467777),_0x46bb54=_0x2f7817[_0x45a5e7(0x174)](_0x467777+0x1);if(_0x46bb54==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x2f7817+_0x45a5e7(0x172));return{'parentId':_0x59b449,'childId':_0x46bb54};}function a158_0x4809(){const _0x167241=['1217658KYMbAj','1571498GeVmVm','1272841VQmNIK','4681719fTCKqD','14hGaERI','3265896sYbLWz','2361QckvpR','2529810wuUBGS','.\x20Child\x20name\x20cannot\x20be\x20empty','Invalid\x20segment\x20reference\x20format:\x20','substring','.\x20Parent\x20name\x20cannot\x20be\x20empty','5600UjSfOu','indexOf'];a158_0x4809=function(){return _0x167241;};return a158_0x4809();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x3cba41,_0x6738e7){const _0x5c9c3a=a159_0x46b3,_0x3c9e3b=_0x3cba41();while(!![]){try{const _0x25b594=parseInt(_0x5c9c3a(0x94))/0x1*(parseInt(_0x5c9c3a(0x91))/0x2)+-parseInt(_0x5c9c3a(0xa2))/0x3+parseInt(_0x5c9c3a(0x99))/0x4*(parseInt(_0x5c9c3a(0x88))/0x5)+parseInt(_0x5c9c3a(0xb6))/0x6+-parseInt(_0x5c9c3a(0xaa))/0x7+parseInt(_0x5c9c3a(0xb9))/0x8*(-parseInt(_0x5c9c3a(0x81))/0x9)+-parseInt(_0x5c9c3a(0xa3))/0xa;if(_0x25b594===_0x6738e7)break;else _0x3c9e3b['push'](_0x3c9e3b['shift']());}catch(_0x15cdce){_0x3c9e3b['push'](_0x3c9e3b['shift']());}}}(a159_0x3533,0x48f3f));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';function a159_0x3533(){const _0x5d01e5=['2116242JAJmhM','MISSING_CONDITIONS','.attribute','2064wSciOq','Composite','success','includes','NESTED_CONDITION_GROUP','.type','error','EMPTY_CONDITIONS','.segment','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','Behavior\x20source\x20\x27','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','.operator.type','length','aggregation','params','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','MISSING_NAME','2133biVtyO','filter','endsWith','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','Attribute\x20name\x20cannot\x20be\x20empty','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','5OQWPog','description','.operator.value','MISSING_TIME_UNIT','attribute','code','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','.conditions[','238sVyTxR','type','safeParse','1525JbsICz','path','rule','rule.type','conditions','1713856jMSlso','MISSING_BETWEEN_BOUNDS','\x27\x20with\x20attribute\x20\x27','And','source','warning','document','MISSING_OPERATOR_VALUE','validationCode','1494273TKvmZI','3840IolaCY','map','arrayMatching','.source','push','level','custom','729470fKLiIC','INVALID_OPERATOR_TYPE','.conditions','data','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','BEHAVIOR_SOURCE_MISSING_FILTER','match','message','name','issues','INVALID_RULE_TYPE','symbol'];a159_0x3533=function(){return _0x5d01e5;};return a159_0x3533();}import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x376801,_0x3b6292={},_0x4d2003={}){const _0x425676=a159_0x46b3;if(_0x4d2003['skipSchema'])return runSemanticChecks(_0x376801,_0x3b6292);const _0x13fbeb=SegmentDefSchema[_0x425676(0x93)](_0x376801);if(_0x13fbeb[_0x425676(0xbb)])return runSemanticChecks(_0x13fbeb['data'],_0x3b6292);return zodErrorsToValidationResult(_0x13fbeb[_0x425676(0x75)],_0x3b6292);}export function validateRuleDef(_0x27dd37,_0x39c158,_0x13e750){const _0x4fb24f=a159_0x46b3;if(!_0x27dd37)return[];const _0x3c7062=RuleDefSchema[_0x4fb24f(0x93)](_0x27dd37);if(_0x3c7062[_0x4fb24f(0xbb)])return checkRule(_0x3c7062[_0x4fb24f(0xad)],_0x39c158,_0x13e750);const _0x1d1d32=flattenZodIssues(_0x3c7062[_0x4fb24f(0x75)][_0x4fb24f(0xb3)]);return _0x1d1d32[_0x4fb24f(0xa4)](_0x2db934=>{const _0x7ce88d=_0x4fb24f,_0x256a31=formatZodPath(_0x2db934[_0x7ce88d(0x95)]),_0x177c0e=_0x256a31?_0x39c158+'.'+_0x256a31:_0x39c158,_0x8aaa8b=mapZodIssueToCode(_0x2db934,_0x256a31),_0xd7542e=getLocationFromPath(_0x13e750[_0x7ce88d(0x9f)],_0x13e750[_0x7ce88d(0x9d)],pathToArray(_0x177c0e));return{'level':_0x7ce88d(0x75),'path':_0x177c0e,'code':_0x8aaa8b,'message':_0x2db934[_0x7ce88d(0xb1)],..._0xd7542e&&{'location':_0xd7542e}};});}function zodErrorsToValidationResult(_0x456f51,_0x38ea94){const _0x1c9000=a159_0x46b3,_0x5011f6=flattenZodIssues(_0x456f51[_0x1c9000(0xb3)]),_0x28186c=_0x5011f6[_0x1c9000(0xa4)](_0x35bae9=>{const _0x3935ba=_0x1c9000,_0x54b26a=formatZodPath(_0x35bae9[_0x3935ba(0x95)]),_0x149274=mapZodIssueToCode(_0x35bae9,_0x54b26a),_0x4e9b4e=getLocationFromPath(_0x38ea94['document'],_0x38ea94[_0x3935ba(0x9d)],_0x35bae9[_0x3935ba(0x95)][_0x3935ba(0xa4)](_0x1bba87=>typeof _0x1bba87===_0x3935ba(0xb5)?String(_0x1bba87):_0x1bba87));return{'level':_0x3935ba(0x75),'path':_0x54b26a,'code':_0x149274,'message':_0x35bae9[_0x3935ba(0xb1)],..._0x4e9b4e&&{'location':_0x4e9b4e}};});return{'valid':![],'errors':_0x28186c,'warnings':[]};}function mapZodIssueToCode(_0x4b31f4,_0x9c44de){const _0x15ca7b=a159_0x46b3,_0x9a1124=_0x4b31f4[_0x15ca7b(0x8d)]===_0x15ca7b(0xa9)?_0x4b31f4[_0x15ca7b(0x7e)]:undefined;if(_0x9c44de===_0x15ca7b(0xb2))return _0x15ca7b(0x80);if(_0x9c44de==='rule.type'||_0x9c44de[_0x15ca7b(0x83)](_0x15ca7b(0x74))){if(_0x4b31f4[_0x15ca7b(0x8d)]==='invalid_value'){if(_0x9c44de===_0x15ca7b(0x97)||_0x9c44de[_0x15ca7b(0xb0)](/\.conditions\[\d+\]\.type$/))return _0x15ca7b(0xb4);}}if(_0x9c44de['endsWith'](_0x15ca7b(0x7b)))return _0x15ca7b(0xab);if(_0x9c44de[_0x15ca7b(0x83)](_0x15ca7b(0x8a)))return _0x15ca7b(0xa0);if(_0x9a1124?.[_0x15ca7b(0xa1)]===_0x15ca7b(0x9a))return _0x15ca7b(0x9a);if(_0x9a1124?.[_0x15ca7b(0xa1)]===_0x15ca7b(0x8b))return _0x15ca7b(0x8b);if(_0x9c44de['endsWith']('.conditions')||_0x9c44de===_0x15ca7b(0x98))return _0x15ca7b(0xb7);if(_0x9c44de[_0x15ca7b(0x72)](_0x15ca7b(0xa5)))return'INVALID_ARRAY_MATCHING';if(_0x9c44de[_0x15ca7b(0x83)](_0x15ca7b(0x77)))return'MISSING_SEGMENT_REFERENCE';return'SEGMENT_SCHEMA_ERROR';}function runSemanticChecks(_0x376829,_0x14c3fb){const _0x250ac1=a159_0x46b3,_0x21f618=[];_0x376829['rule']&&_0x21f618[_0x250ac1(0xa7)](...checkRule(_0x376829['rule'],_0x250ac1(0x96),_0x14c3fb));const _0x448530=_0x21f618[_0x250ac1(0x82)](_0x16fea8=>_0x16fea8['level']==='error'),_0x455798=_0x21f618[_0x250ac1(0x82)](_0x9fdbfd=>_0x9fdbfd[_0x250ac1(0xa8)]===_0x250ac1(0x9e));return{'valid':_0x448530['length']===0x0,'errors':_0x448530,'warnings':_0x455798};}function checkRule(_0x18850c,_0x536dc8,_0x3647f3){const _0xbdc4e2=a159_0x46b3,_0x4d37d8=[];if(_0x18850c[_0xbdc4e2(0x98)][_0xbdc4e2(0x7c)]===0x0)return _0x4d37d8[_0xbdc4e2(0xa7)]({'level':_0xbdc4e2(0x75),'path':_0x536dc8+_0xbdc4e2(0xac),'code':_0xbdc4e2(0x76),'message':_0xbdc4e2(0x78),'location':getLocationFromPath(_0x3647f3[_0xbdc4e2(0x9f)],_0x3647f3[_0xbdc4e2(0x9d)],pathToArray(_0x536dc8+'.conditions'))}),_0x4d37d8;return _0x4d37d8[_0xbdc4e2(0xa7)](...checkConditions(_0x18850c[_0xbdc4e2(0x98)],_0x536dc8,_0x3647f3)),_0x4d37d8;}function a159_0x46b3(_0x60f4ae,_0x284959){_0x60f4ae=_0x60f4ae-0x72;const _0x3533a7=a159_0x3533();let _0x46b387=_0x3533a7[_0x60f4ae];return _0x46b387;}function checkConditions(_0x4a1589,_0x32d7f6,_0x470205){const _0x4f5a74=a159_0x46b3,_0x214c28=[];for(let _0x583340=0x0;_0x583340<_0x4a1589[_0x4f5a74(0x7c)];_0x583340++){const _0x3b1c7b=_0x4a1589[_0x583340],_0x16f9f5=_0x32d7f6+_0x4f5a74(0x90)+_0x583340+']';_0x214c28['push'](...checkCondition(_0x3b1c7b,_0x16f9f5,_0x470205));}return _0x214c28;}function checkCondition(_0x34bf21,_0x58e2e5,_0x443853){const _0x491d92=a159_0x46b3,_0x10075d=[];if(_0x34bf21['type']===_0x491d92(0x9c)||_0x34bf21[_0x491d92(0x92)]==='Or'||_0x34bf21[_0x491d92(0x92)]===_0x491d92(0xba)){if(_0x34bf21[_0x491d92(0x98)][_0x491d92(0x7c)]===0x0)_0x10075d[_0x491d92(0xa7)]({'level':_0x491d92(0x75),'path':_0x58e2e5+_0x491d92(0xac),'code':_0x491d92(0x76),'message':_0x34bf21[_0x491d92(0x92)]+_0x491d92(0x87),'location':getLocationFromPath(_0x443853[_0x491d92(0x9f)],_0x443853['source'],pathToArray(_0x58e2e5+_0x491d92(0xac)))});else{const _0x259305=_0x34bf21[_0x491d92(0x89)]!==undefined,_0x21a34f=_0x34bf21[_0x491d92(0x92)]===_0x491d92(0xba);!_0x259305&&!_0x21a34f&&_0x10075d[_0x491d92(0xa7)]({'level':_0x491d92(0x9e),'path':_0x58e2e5,'code':_0x491d92(0x73),'message':_0x34bf21[_0x491d92(0x92)]+_0x491d92(0x84)+_0x491d92(0xae)+_0x491d92(0x7a),'location':getLocationFromPath(_0x443853[_0x491d92(0x9f)],_0x443853[_0x491d92(0x9d)],pathToArray(_0x58e2e5))}),_0x10075d[_0x491d92(0xa7)](...checkConditions(_0x34bf21['conditions'],_0x58e2e5,_0x443853));}return _0x10075d;}if(_0x34bf21['type']==='Value'||_0x34bf21[_0x491d92(0x92)]==='Behavior'){const _0x3ff9de=_0x34bf21,_0x226eda=_0x3ff9de[_0x491d92(0x9d)],_0x4e4ea4=_0x3ff9de[_0x491d92(0x7d)],_0x296945=_0x226eda||_0x4e4ea4;(!_0x3ff9de['attribute']||_0x3ff9de['attribute']==='')&&(!_0x296945&&_0x10075d[_0x491d92(0xa7)]({'level':_0x491d92(0x75),'path':_0x58e2e5+_0x491d92(0xb8),'code':'EMPTY_ATTRIBUTE','message':_0x491d92(0x85),'location':getLocationFromPath(_0x443853[_0x491d92(0x9f)],_0x443853['source'],pathToArray(_0x58e2e5+_0x491d92(0xb8)))}));_0x3ff9de[_0x491d92(0x82)]&&_0x10075d[_0x491d92(0xa7)](...checkRule(_0x3ff9de[_0x491d92(0x82)],_0x58e2e5+'.filter',_0x443853));if(_0x3ff9de[_0x491d92(0x9d)]){const _0x121440=_0x3ff9de['attribute']&&_0x3ff9de[_0x491d92(0x8c)]!=='';_0x121440&&!_0x3ff9de['filter']&&_0x10075d[_0x491d92(0xa7)]({'level':'error','path':_0x58e2e5+_0x491d92(0xa6),'code':_0x491d92(0xaf),'message':_0x491d92(0x79)+_0x3ff9de[_0x491d92(0x9d)]+_0x491d92(0x9b)+_0x3ff9de[_0x491d92(0x8c)]+'\x27\x20'+_0x491d92(0x8e)+'the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20'+_0x491d92(0x7f),'location':getLocationFromPath(_0x443853[_0x491d92(0x9f)],_0x443853[_0x491d92(0x9d)],pathToArray(_0x58e2e5+_0x491d92(0xa6)))}),_0x121440&&_0x3ff9de['filter']&&_0x10075d[_0x491d92(0xa7)]({'level':_0x491d92(0x9e),'path':_0x58e2e5+_0x491d92(0xb8),'code':_0x491d92(0x8f),'message':'Attribute\x20\x27'+_0x3ff9de[_0x491d92(0x8c)]+_0x491d92(0x86)+'For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','location':getLocationFromPath(_0x443853['document'],_0x443853['source'],pathToArray(_0x58e2e5+_0x491d92(0xb8)))});}}return _0x10075d;}
|
|
1
|
+
(function(_0xa830b5,_0x172956){const _0x8cb099=a159_0x2e7c,_0x4ddd67=_0xa830b5();while(!![]){try{const _0x3831bf=-parseInt(_0x8cb099(0x1c9))/0x1*(parseInt(_0x8cb099(0x1e3))/0x2)+parseInt(_0x8cb099(0x1cf))/0x3*(parseInt(_0x8cb099(0x1d0))/0x4)+-parseInt(_0x8cb099(0x1e0))/0x5*(-parseInt(_0x8cb099(0x1fb))/0x6)+-parseInt(_0x8cb099(0x1ca))/0x7*(-parseInt(_0x8cb099(0x1c0))/0x8)+parseInt(_0x8cb099(0x1b8))/0x9+-parseInt(_0x8cb099(0x1cb))/0xa*(parseInt(_0x8cb099(0x1f2))/0xb)+-parseInt(_0x8cb099(0x1d3))/0xc*(parseInt(_0x8cb099(0x1fd))/0xd);if(_0x3831bf===_0x172956)break;else _0x4ddd67['push'](_0x4ddd67['shift']());}catch(_0x40780f){_0x4ddd67['push'](_0x4ddd67['shift']());}}}(a159_0x4215,0x8b192));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x4f280d,_0x555bec={},_0x3c6cbc={}){const _0x43030a=a159_0x2e7c;if(_0x3c6cbc['skipSchema'])return runSemanticChecks(_0x4f280d,_0x555bec);const _0x240553=SegmentDefSchema['safeParse'](_0x4f280d);if(_0x240553[_0x43030a(0x1d2)])return runSemanticChecks(_0x240553['data'],_0x555bec);return zodErrorsToValidationResult(_0x240553[_0x43030a(0x1ef)],_0x555bec);}export function validateRuleDef(_0x4e3dde,_0x4df985,_0x527436){const _0x2119db=a159_0x2e7c;if(!_0x4e3dde)return[];const _0x2cc676=RuleDefSchema[_0x2119db(0x1dd)](_0x4e3dde);if(_0x2cc676[_0x2119db(0x1d2)])return checkRule(_0x2cc676[_0x2119db(0x1f8)],_0x4df985,_0x527436);const _0x360a6c=flattenZodIssues(_0x2cc676[_0x2119db(0x1ef)][_0x2119db(0x1cc)]);return _0x360a6c[_0x2119db(0x1be)](_0x54ae53=>{const _0x352da5=_0x2119db,_0x443d2b=formatZodPath(_0x54ae53[_0x352da5(0x1e4)]),_0x34c161=_0x443d2b?_0x4df985+'.'+_0x443d2b:_0x4df985,_0x495f64=mapZodIssueToCode(_0x54ae53,_0x443d2b),_0x507506=getLocationFromPath(_0x527436[_0x352da5(0x200)],_0x527436['source'],pathToArray(_0x34c161));return{'level':_0x352da5(0x1ef),'path':_0x34c161,'code':_0x495f64,'message':_0x54ae53[_0x352da5(0x1e7)],..._0x507506&&{'location':_0x507506}};});}function zodErrorsToValidationResult(_0x3c8869,_0x7ab39d){const _0x3ecf11=a159_0x2e7c,_0x13b979=flattenZodIssues(_0x3c8869[_0x3ecf11(0x1cc)]),_0x16cc59=_0x13b979['map'](_0x15b7f1=>{const _0x4e1382=_0x3ecf11,_0x33daf8=formatZodPath(_0x15b7f1[_0x4e1382(0x1e4)]),_0x2244db=mapZodIssueToCode(_0x15b7f1,_0x33daf8),_0x27f161=getLocationFromPath(_0x7ab39d[_0x4e1382(0x200)],_0x7ab39d[_0x4e1382(0x203)],_0x15b7f1[_0x4e1382(0x1e4)][_0x4e1382(0x1be)](_0x2cb97c=>typeof _0x2cb97c==='symbol'?String(_0x2cb97c):_0x2cb97c));return{'level':_0x4e1382(0x1ef),'path':_0x33daf8,'code':_0x2244db,'message':_0x15b7f1['message'],..._0x27f161&&{'location':_0x27f161}};});return{'valid':![],'errors':_0x16cc59,'warnings':[]};}function a159_0x2e7c(_0x12e436,_0x5b19f0){_0x12e436=_0x12e436-0x1b6;const _0x4215be=a159_0x4215();let _0x2e7c24=_0x4215be[_0x12e436];return _0x2e7c24;}function mapZodIssueToCode(_0x218ea6,_0x48ad6a){const _0x27198d=a159_0x2e7c,_0x19957b=_0x218ea6['code']==='custom'?_0x218ea6[_0x27198d(0x1f9)]:undefined;if(_0x48ad6a===_0x27198d(0x1fc))return _0x27198d(0x1d7);if(_0x48ad6a===_0x27198d(0x1b6)||_0x48ad6a['endsWith'](_0x27198d(0x1fa))){if(_0x218ea6[_0x27198d(0x1d9)]===_0x27198d(0x1e6)){if(_0x48ad6a===_0x27198d(0x1b6)||_0x48ad6a['match'](/\.conditions\[\d+\]\.type$/))return _0x27198d(0x1d8);}}if(_0x48ad6a[_0x27198d(0x1cd)]('.operator.type'))return _0x27198d(0x1e2);if(_0x48ad6a['endsWith'](_0x27198d(0x1f0)))return _0x27198d(0x1c8);if(_0x19957b?.[_0x27198d(0x1c3)]===_0x27198d(0x1fe))return _0x27198d(0x1fe);if(_0x19957b?.[_0x27198d(0x1c3)]===_0x27198d(0x1c4))return _0x27198d(0x1c4);if(_0x48ad6a[_0x27198d(0x1cd)](_0x27198d(0x1c7))||_0x48ad6a===_0x27198d(0x1c6))return _0x27198d(0x1ce);if(_0x48ad6a[_0x27198d(0x1d1)](_0x27198d(0x1c5)))return _0x27198d(0x1bb);if(_0x48ad6a[_0x27198d(0x1cd)](_0x27198d(0x1df)))return _0x27198d(0x1ba);return _0x27198d(0x1d4);}function a159_0x4215(){const _0x40624b=['filter','6448050QagSZl','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','MISSING_SEGMENT_REFERENCE','INVALID_ARRAY_MATCHING','.source','NESTED_CONDITION_GROUP','map','length','329768ohGKit','Behavior','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','validationCode','MISSING_TIME_UNIT','arrayMatching','conditions','.conditions','MISSING_OPERATOR_VALUE','288731FjTkWS','14PNhECH','3325430MuOdJm','issues','endsWith','MISSING_CONDITIONS','1707MLXZOd','6608iQinQZ','includes','success','72ZrUJCU','SEGMENT_SCHEMA_ERROR','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','rule','MISSING_NAME','INVALID_RULE_TYPE','code','push','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','safeParse','BEHAVIOR_SOURCE_MISSING_FILTER','.segment','1098065KfVfEJ','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','INVALID_OPERATOR_TYPE','4SNwpAN','path','.attribute','invalid_value','message','warning','level','\x27\x20with\x20attribute\x20\x27','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','EMPTY_ATTRIBUTE','.conditions[','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','error','.operator.value','And','11uSCimG','Attribute\x20name\x20cannot\x20be\x20empty','Composite','EMPTY_CONDITIONS','Attribute\x20\x27','description','data','params','.type','30vXCgWK','name','2940587TLnAGA','MISSING_BETWEEN_BOUNDS','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','document','type','attribute','source','rule.type'];a159_0x4215=function(){return _0x40624b;};return a159_0x4215();}function runSemanticChecks(_0x21ca15,_0x51c256){const _0x4fa871=a159_0x2e7c,_0x2eb8a8=[];_0x21ca15['rule']&&_0x2eb8a8[_0x4fa871(0x1da)](...checkRule(_0x21ca15[_0x4fa871(0x1d6)],_0x4fa871(0x1d6),_0x51c256));const _0x3ec7da=_0x2eb8a8['filter'](_0xa78cd0=>_0xa78cd0[_0x4fa871(0x1e9)]===_0x4fa871(0x1ef)),_0x428404=_0x2eb8a8[_0x4fa871(0x1b7)](_0x5d574e=>_0x5d574e[_0x4fa871(0x1e9)]===_0x4fa871(0x1e8));return{'valid':_0x3ec7da['length']===0x0,'errors':_0x3ec7da,'warnings':_0x428404};}function checkRule(_0x4496a4,_0x33e28b,_0x2aff19){const _0x4a6177=a159_0x2e7c,_0xcc638=[];if(_0x4496a4[_0x4a6177(0x1c6)][_0x4a6177(0x1bf)]===0x0)return _0xcc638['push']({'level':'error','path':_0x33e28b+_0x4a6177(0x1c7),'code':_0x4a6177(0x1f5),'message':_0x4a6177(0x1eb),'location':getLocationFromPath(_0x2aff19[_0x4a6177(0x200)],_0x2aff19['source'],pathToArray(_0x33e28b+_0x4a6177(0x1c7)))}),_0xcc638;return _0xcc638[_0x4a6177(0x1da)](...checkConditions(_0x4496a4['conditions'],_0x33e28b,_0x2aff19)),_0xcc638;}function checkConditions(_0x2c694b,_0x5105e8,_0x217799){const _0x17b674=a159_0x2e7c,_0x191b99=[];for(let _0xf11ab6=0x0;_0xf11ab6<_0x2c694b[_0x17b674(0x1bf)];_0xf11ab6++){const _0x427d9f=_0x2c694b[_0xf11ab6],_0x233900=_0x5105e8+_0x17b674(0x1ed)+_0xf11ab6+']';_0x191b99[_0x17b674(0x1da)](...checkCondition(_0x427d9f,_0x233900,_0x217799));}return _0x191b99;}function checkCondition(_0x536216,_0x596e67,_0x1720ef){const _0x39aa64=a159_0x2e7c,_0x174b52=[];if(_0x536216[_0x39aa64(0x201)]===_0x39aa64(0x1f1)||_0x536216[_0x39aa64(0x201)]==='Or'||_0x536216[_0x39aa64(0x201)]===_0x39aa64(0x1f4)){if(_0x536216['conditions'][_0x39aa64(0x1bf)]===0x0)_0x174b52[_0x39aa64(0x1da)]({'level':_0x39aa64(0x1ef),'path':_0x596e67+_0x39aa64(0x1c7),'code':_0x39aa64(0x1f5),'message':_0x536216[_0x39aa64(0x201)]+_0x39aa64(0x1dc),'location':getLocationFromPath(_0x1720ef[_0x39aa64(0x200)],_0x1720ef[_0x39aa64(0x203)],pathToArray(_0x596e67+_0x39aa64(0x1c7)))});else{const _0x2fcf6c=_0x536216[_0x39aa64(0x1f7)]!==undefined,_0x378e62=_0x536216[_0x39aa64(0x201)]===_0x39aa64(0x1f4);!_0x2fcf6c&&!_0x378e62&&_0x174b52[_0x39aa64(0x1da)]({'level':_0x39aa64(0x1e8),'path':_0x596e67,'code':_0x39aa64(0x1bd),'message':_0x536216['type']+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+_0x39aa64(0x1e1)+_0x39aa64(0x1b9),'location':getLocationFromPath(_0x1720ef[_0x39aa64(0x200)],_0x1720ef[_0x39aa64(0x203)],pathToArray(_0x596e67))}),_0x174b52['push'](...checkConditions(_0x536216[_0x39aa64(0x1c6)],_0x596e67,_0x1720ef));}return _0x174b52;}if(_0x536216[_0x39aa64(0x201)]==='Value'||_0x536216[_0x39aa64(0x201)]===_0x39aa64(0x1c1)){const _0x3d672b=_0x536216,_0x15eaa4=_0x3d672b[_0x39aa64(0x203)],_0x554c0a=_0x3d672b['aggregation'],_0x41e39c=_0x15eaa4||_0x554c0a;(!_0x3d672b[_0x39aa64(0x202)]||_0x3d672b['attribute']==='')&&(!_0x41e39c&&_0x174b52['push']({'level':_0x39aa64(0x1ef),'path':_0x596e67+'.attribute','code':_0x39aa64(0x1ec),'message':_0x39aa64(0x1f3),'location':getLocationFromPath(_0x1720ef[_0x39aa64(0x200)],_0x1720ef[_0x39aa64(0x203)],pathToArray(_0x596e67+'.attribute'))}));_0x3d672b[_0x39aa64(0x1b7)]&&_0x174b52['push'](...checkRule(_0x3d672b[_0x39aa64(0x1b7)],_0x596e67+'.filter',_0x1720ef));if(_0x3d672b[_0x39aa64(0x203)]){const _0x5b6917=_0x3d672b[_0x39aa64(0x202)]&&_0x3d672b['attribute']!=='';_0x5b6917&&!_0x3d672b[_0x39aa64(0x1b7)]&&_0x174b52[_0x39aa64(0x1da)]({'level':'error','path':_0x596e67+_0x39aa64(0x1bc),'code':_0x39aa64(0x1de),'message':'Behavior\x20source\x20\x27'+_0x3d672b[_0x39aa64(0x203)]+_0x39aa64(0x1ea)+_0x3d672b[_0x39aa64(0x202)]+'\x27\x20'+_0x39aa64(0x1db)+_0x39aa64(0x1ee)+_0x39aa64(0x1ff),'location':getLocationFromPath(_0x1720ef['document'],_0x1720ef['source'],pathToArray(_0x596e67+_0x39aa64(0x1bc)))}),_0x5b6917&&_0x3d672b['filter']&&_0x174b52[_0x39aa64(0x1da)]({'level':_0x39aa64(0x1e8),'path':_0x596e67+_0x39aa64(0x1e5),'code':_0x39aa64(0x1c2),'message':_0x39aa64(0x1f6)+_0x3d672b[_0x39aa64(0x202)]+'\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20'+_0x39aa64(0x1d5),'location':getLocationFromPath(_0x1720ef[_0x39aa64(0x200)],_0x1720ef[_0x39aa64(0x203)],pathToArray(_0x596e67+_0x39aa64(0x1e5)))});}}return _0x174b52;}
|