@treasuredata/tdx 0.10.0 → 0.11.0

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.
Files changed (163) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/context-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-command.js +1 -1
  21. package/dist/commands/job-command.js +1 -1
  22. package/dist/commands/journey-command.js +1 -1
  23. package/dist/commands/journey-validate-command.js +1 -1
  24. package/dist/commands/llm-command.js +1 -1
  25. package/dist/commands/llm-proxy.js +1 -1
  26. package/dist/commands/parent-segment-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/tables.js +1 -1
  40. package/dist/commands/use-command.js +1 -1
  41. package/dist/commands/user-command.js +1 -1
  42. package/dist/commands/workflow-command.d.ts +73 -3
  43. package/dist/commands/workflow-command.d.ts.map +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/commands/workflow-command.js.map +1 -1
  46. package/dist/core/auth.js +1 -1
  47. package/dist/core/command-output.d.ts +1 -1
  48. package/dist/core/command-output.d.ts.map +1 -1
  49. package/dist/core/command-output.js +1 -1
  50. package/dist/core/config.js +1 -1
  51. package/dist/core/connection-cache.js +1 -1
  52. package/dist/core/constants.js +1 -1
  53. package/dist/core/credential-cache.js +1 -1
  54. package/dist/core/global-context.d.ts +1 -0
  55. package/dist/core/global-context.d.ts.map +1 -1
  56. package/dist/core/global-context.js +1 -1
  57. package/dist/core/global-context.js.map +1 -1
  58. package/dist/core/keychain.js +1 -1
  59. package/dist/core/profile.js +1 -1
  60. package/dist/core/project-config.js +1 -1
  61. package/dist/core/session.d.ts +1 -0
  62. package/dist/core/session.d.ts.map +1 -1
  63. package/dist/core/session.js +1 -1
  64. package/dist/core/session.js.map +1 -1
  65. package/dist/core/user-cache.js +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/proxy/anthropic-adapter.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.js +1 -1
  69. package/dist/proxy/context-signature.js +1 -1
  70. package/dist/proxy/conversation-utils.js +1 -1
  71. package/dist/proxy/server.js +1 -1
  72. package/dist/proxy/session-cache.js +1 -1
  73. package/dist/sdk/agent/agent-config.js +1 -1
  74. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  75. package/dist/sdk/agent/agent-yaml.js +1 -1
  76. package/dist/sdk/api.js +1 -1
  77. package/dist/sdk/client/cdp-api-client.js +1 -1
  78. package/dist/sdk/client/endpoints.js +1 -1
  79. package/dist/sdk/client/engage-api-client.js +1 -1
  80. package/dist/sdk/client/http-client.js +1 -1
  81. package/dist/sdk/client/llm-api-client.js +1 -1
  82. package/dist/sdk/client/rate-limiter.js +1 -1
  83. package/dist/sdk/client/td-api-client.js +1 -1
  84. package/dist/sdk/client/trino-api-client.js +1 -1
  85. package/dist/sdk/client/workflow-client.d.ts +32 -4
  86. package/dist/sdk/client/workflow-client.d.ts.map +1 -1
  87. package/dist/sdk/client/workflow-client.js +1 -1
  88. package/dist/sdk/client/workflow-client.js.map +1 -1
  89. package/dist/sdk/connection-validator.d.ts +10 -6
  90. package/dist/sdk/connection-validator.d.ts.map +1 -1
  91. package/dist/sdk/connection-validator.js +1 -1
  92. package/dist/sdk/connection-validator.js.map +1 -1
  93. package/dist/sdk/connection.js +1 -1
  94. package/dist/sdk/engage.js +1 -1
  95. package/dist/sdk/errors.d.ts +2 -0
  96. package/dist/sdk/errors.d.ts.map +1 -1
  97. package/dist/sdk/errors.js +1 -1
  98. package/dist/sdk/errors.js.map +1 -1
  99. package/dist/sdk/index.js +1 -1
  100. package/dist/sdk/io/index.js +1 -1
  101. package/dist/sdk/io/node-filesystem.js +1 -1
  102. package/dist/sdk/job.js +1 -1
  103. package/dist/sdk/journey.js +1 -1
  104. package/dist/sdk/llm/chat-cache.js +1 -1
  105. package/dist/sdk/llm/index.js +1 -1
  106. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  107. package/dist/sdk/llm/model-aliases.js +1 -1
  108. package/dist/sdk/llm/model-factors.js +1 -1
  109. package/dist/sdk/query/index.js +1 -1
  110. package/dist/sdk/query/sql-parser.js +1 -1
  111. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  112. package/dist/sdk/segment/fields-display.js +1 -1
  113. package/dist/sdk/segment/file-discovery.js +1 -1
  114. package/dist/sdk/segment/journey-utils.js +1 -1
  115. package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
  116. package/dist/sdk/segment/journey-yaml.js +1 -1
  117. package/dist/sdk/segment/journey-yaml.js.map +1 -1
  118. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  119. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  120. package/dist/sdk/segment/pull-workflow.js +1 -1
  121. package/dist/sdk/segment/push-workflow.js +1 -1
  122. package/dist/sdk/segment/push-workflow.js.map +1 -1
  123. package/dist/sdk/segment/resolution-context.js +1 -1
  124. package/dist/sdk/segment/segment-path-parser.js +1 -1
  125. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  126. package/dist/sdk/segment/target-resolution.js +1 -1
  127. package/dist/sdk/segment/tdx-config.js +1 -1
  128. package/dist/sdk/segment/validate-files.js +1 -1
  129. package/dist/sdk/segment/yaml-validator.js +1 -1
  130. package/dist/sdk/segment.js +1 -1
  131. package/dist/sdk/types/cdp.d.ts +5 -2
  132. package/dist/sdk/types/cdp.d.ts.map +1 -1
  133. package/dist/sdk/types/index.d.ts +1 -0
  134. package/dist/sdk/types/index.d.ts.map +1 -1
  135. package/dist/sdk/types/index.js +1 -1
  136. package/dist/sdk/types/index.js.map +1 -1
  137. package/dist/sdk/types/progress.js +1 -1
  138. package/dist/sdk/user.js +1 -1
  139. package/dist/sdk/util/format-detector.js +1 -1
  140. package/dist/sdk/util/formatters.js +1 -1
  141. package/dist/sdk/util/index.js +1 -1
  142. package/dist/sdk/util/tree-formatter.js +1 -1
  143. package/dist/sdk/workflow/index.d.ts +74 -4
  144. package/dist/sdk/workflow/index.d.ts.map +1 -1
  145. package/dist/sdk/workflow/index.js +1 -1
  146. package/dist/sdk/workflow/index.js.map +1 -1
  147. package/dist/sdk/workflow/workflow-utils.js +1 -1
  148. package/dist/utils/async.js +1 -1
  149. package/dist/utils/colors.js +1 -1
  150. package/dist/utils/diff.js +1 -1
  151. package/dist/utils/file-permissions.js +1 -1
  152. package/dist/utils/json-loader.js +1 -1
  153. package/dist/utils/option-validation.js +1 -1
  154. package/dist/utils/port.js +1 -1
  155. package/dist/utils/process.js +1 -1
  156. package/dist/utils/prompt.js +1 -1
  157. package/dist/utils/spinner.js +1 -1
  158. package/dist/utils/sse-parser.js +1 -1
  159. package/dist/utils/string-utils.js +1 -1
  160. package/dist/utils/table-ref-parser.js +1 -1
  161. package/dist/utils/tdx-logger.js +1 -1
  162. package/dist/utils/version-check.js +1 -1
  163. package/package.json +1 -1
@@ -1 +1 @@
1
- const a97_0x3d28bc=a97_0x5045;(function(_0x679b93,_0x11d485){const _0x509fe5=a97_0x5045,_0x1c2eae=_0x679b93();while(!![]){try{const _0x2d575b=parseInt(_0x509fe5(0x209))/0x1*(-parseInt(_0x509fe5(0x26c))/0x2)+-parseInt(_0x509fe5(0x25f))/0x3*(parseInt(_0x509fe5(0x1e6))/0x4)+parseInt(_0x509fe5(0x1e9))/0x5*(-parseInt(_0x509fe5(0x1d5))/0x6)+-parseInt(_0x509fe5(0x261))/0x7*(-parseInt(_0x509fe5(0x2a1))/0x8)+-parseInt(_0x509fe5(0x269))/0x9*(-parseInt(_0x509fe5(0x251))/0xa)+-parseInt(_0x509fe5(0x1bf))/0xb+parseInt(_0x509fe5(0x221))/0xc*(parseInt(_0x509fe5(0x20c))/0xd);if(_0x2d575b===_0x11d485)break;else _0x1c2eae['push'](_0x1c2eae['shift']());}catch(_0x3d036e){_0x1c2eae['push'](_0x1c2eae['shift']());}}}(a97_0x1717,0xc5e3f));import{createHash}from'crypto';function a97_0x5045(_0x25a6a3,_0xf2aa30){_0x25a6a3=_0x25a6a3-0x1bf;const _0x171775=a97_0x1717();let _0x504521=_0x171775[_0x25a6a3];return _0x504521;}export const PENDING_SEGMENT_PREFIX=a97_0x3d28bc(0x25c);export const PENDING_ACTIVATION_PREFIX=a97_0x3d28bc(0x24e);export function createPendingSegmentId(_0x7293da){return''+PENDING_SEGMENT_PREFIX+_0x7293da+'__';}export function isPendingSegmentId(_0x410a72){return _0x410a72['startsWith'](PENDING_SEGMENT_PREFIX);}export function extractPendingSegmentName(_0x294516){const _0x23fc0d=a97_0x3d28bc;return _0x294516[_0x23fc0d(0x1d1)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0xa4ade8){return''+PENDING_ACTIVATION_PREFIX+_0xa4ade8+'__';}export function isPendingActivationId(_0x2ae923){return _0x2ae923['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1aec06){return _0x1aec06['replace'](/^__pending_act_(.+)__$/,'$1');}function generateDeterministicJourneySegmentName(_0x45baf1,_0x4bcde6){const _0x35d999=a97_0x3d28bc,_0x5918f7=_0x45baf1+'::'+(_0x4bcde6[_0x35d999(0x1d3)]()||_0x35d999(0x255)),_0x28b4e2=createHash(_0x35d999(0x21c))['update'](_0x5918f7)[_0x35d999(0x1c0)]('hex')[_0x35d999(0x1e0)](0x0,0xc);return _0x35d999(0x20a)+_0x28b4e2;}export function ensureJourneyDefaults(_0x3ba66a){const _0x4abfe1=a97_0x3d28bc;!_0x3ba66a[_0x4abfe1(0x29b)]&&(_0x3ba66a[_0x4abfe1(0x29b)]=''),!_0x3ba66a[_0x4abfe1(0x297)]&&(_0x3ba66a['state']=_0x4abfe1(0x1c2));}export function resolveTDFolderPath(_0x440568,_0x302418,_0x2a081d){const _0x3debbc=a97_0x3d28bc;if(!_0x302418)return _0x440568;if(_0x440568===_0x2a081d||_0x440568[_0x3debbc(0x1c1)](_0x2a081d+'/'))return _0x440568;return _0x440568?_0x2a081d+'/'+_0x440568:_0x2a081d;}export function addFoldersToCreate(_0x561195,_0x2d3187,_0x42e5a7){const _0x2e6263=a97_0x3d28bc;if(!_0x561195)return;if(_0x2d3187[_0x2e6263(0x20f)](_0x561195))return;const _0xfb1ccb=_0x561195[_0x2e6263(0x277)]('/');let _0x1864a8='';for(const _0x1f1829 of _0xfb1ccb){_0x1864a8=_0x1864a8?_0x1864a8+'/'+_0x1f1829:_0x1f1829,!_0x2d3187[_0x2e6263(0x20f)](_0x1864a8)&&_0x42e5a7[_0x2e6263(0x22e)](_0x1864a8);}}import*as a97_0xb38f62 from'yaml';import{readFileSync}from'fs';import a97_0x54bcec from'path';import{isJourneyDef,parseYamlString as a97_0x24d767,toYamlString as a97_0x12627c,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{validateSegmentDef,validateJourneyDef,formatValidationResult}from'./yaml-validator.js';function stableStringify(_0x1157bd){const _0x137a89=a97_0x3d28bc;if(Array[_0x137a89(0x27d)](_0x1157bd))return'['+_0x1157bd[_0x137a89(0x1f8)](_0xc6498c=>stableStringify(_0xc6498c))[_0x137a89(0x1f3)](',')+']';if(_0x1157bd&&typeof _0x1157bd===_0x137a89(0x1d8)){const _0x12633a=_0x1157bd,_0x352a2c=Object[_0x137a89(0x26e)](_0x12633a)[_0x137a89(0x26f)](),_0x59542b=_0x352a2c[_0x137a89(0x1f8)](_0x5de3c4=>'\x22'+_0x5de3c4+'\x22:'+stableStringify(_0x12633a[_0x5de3c4]));return'{'+_0x59542b[_0x137a89(0x1f3)](',')+'}';}const _0x4dc966=JSON[_0x137a89(0x1f1)](_0x1157bd);return _0x4dc966===undefined?_0x137a89(0x1da):_0x4dc966;}function activationSignature(_0x4204d9){const _0x250bdd=a97_0x3d28bc,_0x592dda={'connection':_0x4204d9[_0x250bdd(0x20e)],..._0x4204d9[_0x250bdd(0x23d)]!==undefined&&{'all_columns':_0x4204d9['all_columns']},..._0x4204d9['columns']!==undefined&&{'columns':_0x4204d9[_0x250bdd(0x26d)]},..._0x4204d9[_0x250bdd(0x28b)]!==undefined&&{'behavior':_0x4204d9[_0x250bdd(0x28b)]},..._0x4204d9['schedule']!==undefined&&{'schedule':_0x4204d9['schedule']},..._0x4204d9[_0x250bdd(0x293)]!==undefined&&{'notification':_0x4204d9['notification']},..._0x4204d9['connector_config']!==undefined&&{'connector_config':_0x4204d9[_0x250bdd(0x240)]},..._0x4204d9['activation_template_id']!==undefined&&{'activation_template_id':_0x4204d9[_0x250bdd(0x295)]}};return stableStringify(_0x592dda);}export async function prepareSegmentFiles(_0x2602ad,_0x230b3b,_0x2e804e,_0x4cdd70,_0x4e7fd0){const _0x4f1db4=a97_0x3d28bc,{activationDefToCreateRequest:_0x490a2d}=await import(_0x4f1db4(0x1fe)),_0x3f9e99=[],_0x5aa780=new Set();for(const {yamlConfig:_0x54a25b,folderPath:_0x4bc05e,sourcePath:_0x19c1f2}of _0x2602ad){const _0xc382ad=resolveTDFolderPath(_0x4bc05e,_0x4cdd70,_0x4e7fd0),_0x70dfe3=_0xc382ad+':'+_0x54a25b['name'],_0x4f58a6=_0x230b3b[_0x4f1db4(0x232)]['get'](_0x70dfe3),_0x2bfb41=_0x4f58a6?_0x230b3b[_0x4f1db4(0x1ef)][_0x4f1db4(0x272)](_0x4f58a6['id'])||[]:[];addFoldersToCreate(_0xc382ad,_0x230b3b[_0x4f1db4(0x25d)],_0x5aa780);const _0x570d62=calculateActivationActions(_0x54a25b[_0x4f1db4(0x1fa)]||[],_0x2bfb41,_0x230b3b[_0x4f1db4(0x215)],_0x230b3b[_0x4f1db4(0x244)]);for(const _0x2b6c07 of _0x570d62){(_0x2b6c07[_0x4f1db4(0x203)]===_0x4f1db4(0x275)||_0x2b6c07['type']===_0x4f1db4(0x1ff))&&_0x2b6c07[_0x4f1db4(0x1f2)]&&(_0x2b6c07[_0x4f1db4(0x25a)]=await _0x490a2d(_0x2b6c07[_0x4f1db4(0x1f2)],_0x2e804e));}const _0x2555b9=calculateSegmentDiff(_0x54a25b,_0x4f58a6,_0x2bfb41,_0x230b3b['idToEmailMap'],_0x230b3b['connectionIdToNameMap']);_0x3f9e99[_0x4f1db4(0x283)]({'relativePath':_0x54a25b['name'],'absolutePath':_0x19c1f2,'yamlConfig':_0x54a25b,'folderPath':_0xc382ad,'existingSegment':_0x4f58a6,'existingActivations':_0x2bfb41,'isNew':_0x2555b9[_0x4f1db4(0x25b)],'hasChanges':_0x2555b9[_0x4f1db4(0x204)],'diff':_0x2555b9[_0x4f1db4(0x274)],'activationActions':_0x570d62});}return{'segmentFiles':_0x3f9e99,'foldersToCreate':_0x5aa780};}export async function prepareJourneyFiles(_0x1da036,_0x1e36bf,_0x4b9d22,_0x4836c1){const _0x5798ea=a97_0x3d28bc,_0x274fe2=[],_0x5b38f0=new Set();for(const {yamlConfig:_0x10ca7f,folderPath:_0x5b655a,sourcePath:_0x25fc34}of _0x1da036){const _0x566ead=resolveTDFolderPath(_0x5b655a,_0x4b9d22,_0x4836c1),_0xdf80de=_0x566ead+':'+_0x10ca7f[_0x5798ea(0x21b)],_0x52375e=_0x1e36bf[_0x5798ea(0x1d7)]['get'](_0xdf80de);let _0x3d4fe6,_0x23ebd6;if(_0x52375e&&_0x52375e['length']>0x0){const _0x41821e=buildLocalExpandedRuleMappings(_0x10ca7f),{createYamlContext:_0x527716,prefetchJourneySegments:_0x592352}=createPushYamlContextForBundle(_0x1e36bf[_0x5798ea(0x267)],_0x1e36bf[_0x5798ea(0x282)],_0x1e36bf[_0x5798ea(0x234)],_0x41821e,_0x1e36bf[_0x5798ea(0x215)],_0x1e36bf[_0x5798ea(0x244)],_0x1e36bf[_0x5798ea(0x247)],_0x1e36bf['journeyById']);await _0x592352(_0x52375e[_0x5798ea(0x1f8)](_0x2fb6f8=>_0x2fb6f8['id']));const _0x5d900f=hasMultipleVersions(_0x10ca7f),_0x217e1f=async _0x53eb05=>{const _0x2c82da=_0x5798ea,_0x41981e=_0x1e36bf[_0x2c82da(0x210)]?.[_0x2c82da(0x272)](_0x53eb05);if(_0x41981e)return _0x41981e;return _0x1e36bf[_0x2c82da(0x256)]({'journeyId':_0x53eb05,'journeyName':_0x10ca7f[_0x2c82da(0x21b)],'isMultiVersion':_0x52375e[_0x2c82da(0x21a)]>0x1});};if(_0x5d900f&&_0x52375e[_0x5798ea(0x21a)]>0x1){const _0xa8ca39=[];for(const _0x42721c of _0x52375e){const _0x346640=_0x42721c[_0x5798ea(0x22c)]||0x1;_0x1e36bf[_0x5798ea(0x281)]?.[_0x5798ea(0x1ff)](_0x5798ea(0x286)+_0x10ca7f[_0x5798ea(0x21b)]+'\x20v'+_0x346640);const _0x56d7e9=await _0x217e1f(_0x42721c['id']),_0x194dca=_0x527716(_0x42721c['id']),_0x287f9a=await journeyResponseToDef(_0x56d7e9,_0x194dca);_0xa8ca39[_0x5798ea(0x283)]({'item':_0x42721c,'yaml':_0x287f9a});}const _0x342500=buildLocalRuleToNameMappingFromJourney(_0x10ca7f);_0x23ebd6=buildMergedJourneyDef(_0xa8ca39,_0x342500);const _0x33fc19=Math[_0x5798ea(0x2a4)](..._0xa8ca39['map'](_0x59c283=>_0x59c283[_0x5798ea(0x20d)]['versionNumber']||0x0)),_0x421398=_0x52375e['find'](_0x4e0eae=>(_0x4e0eae[_0x5798ea(0x22c)]||0x0)===_0x33fc19);_0x421398&&(_0x1e36bf['progress']?.['update'](_0x5798ea(0x286)+_0x10ca7f[_0x5798ea(0x21b)]+'\x20v'+_0x33fc19),_0x3d4fe6=await _0x217e1f(_0x421398['id']));}else{const _0xaf742f=_0x52375e[_0x52375e['length']-0x1];_0x1e36bf[_0x5798ea(0x281)]?.['update'](_0x5798ea(0x286)+_0x10ca7f[_0x5798ea(0x21b)]),_0x3d4fe6=await _0x217e1f(_0xaf742f['id']);const _0x580c74=_0x527716(_0xaf742f['id']),_0x32e71b=await journeyResponseToDef(_0x3d4fe6,_0x580c74),_0x3d92d0=buildLocalRuleToNameMappingFromJourney(_0x10ca7f);_0x23ebd6=buildMergedJourneyDef([{'item':_0xaf742f,'yaml':_0x32e71b}],_0x3d92d0);}}addFoldersToCreate(_0x566ead,_0x1e36bf[_0x5798ea(0x25d)],_0x5b38f0);const _0x253a68=calculateJourneyDiff(_0x10ca7f,_0x23ebd6);_0x274fe2[_0x5798ea(0x283)]({'relativePath':_0x10ca7f['name'],'absolutePath':_0x25fc34,'yamlConfig':_0x10ca7f,'folderPath':_0x566ead,'existingJourney':_0x3d4fe6,'isNew':_0x253a68[_0x5798ea(0x25b)],'hasChanges':_0x253a68[_0x5798ea(0x204)],'diff':_0x253a68[_0x5798ea(0x274)]});}return{'journeyFiles':_0x274fe2,'foldersToCreate':_0x5b38f0};}export function calculateActivationActions(_0x44d5a2,_0x52c12e,_0x38d35d,_0x30fd48){const _0x10f82f=a97_0x3d28bc,_0x49a6d4=[],_0x5ddca9=new Map();for(const _0x40a991 of _0x52c12e){_0x5ddca9['set'](_0x40a991[_0x10f82f(0x21b)],_0x40a991);}const _0x4b5302=new Map();for(const _0x3a3008 of _0x44d5a2){_0x4b5302['set'](_0x3a3008[_0x10f82f(0x21b)],_0x3a3008);}for(const _0x3b8328 of _0x44d5a2){const _0x4f76d0=_0x5ddca9[_0x10f82f(0x272)](_0x3b8328[_0x10f82f(0x21b)]);if(!_0x4f76d0)_0x49a6d4[_0x10f82f(0x283)]({'type':_0x10f82f(0x275),'name':_0x3b8328[_0x10f82f(0x21b)],'yamlActivation':_0x3b8328});else{const _0x142612=activationResponseToDef(_0x4f76d0,_0x38d35d,_0x30fd48),_0x218a13=a97_0xb38f62[_0x10f82f(0x1f1)](_0x142612),_0xa5357f=a97_0xb38f62['stringify'](_0x3b8328);_0x218a13!==_0xa5357f&&_0x49a6d4[_0x10f82f(0x283)]({'type':'update','name':_0x3b8328[_0x10f82f(0x21b)],'yamlActivation':_0x3b8328,'existingActivation':_0x4f76d0});}}for(const _0x3f0735 of _0x52c12e){!_0x4b5302[_0x10f82f(0x20f)](_0x3f0735[_0x10f82f(0x21b)])&&_0x49a6d4[_0x10f82f(0x283)]({'type':_0x10f82f(0x229),'name':_0x3f0735[_0x10f82f(0x21b)],'existingActivation':_0x3f0735});}return _0x49a6d4;}export function calculateSegmentDiff(_0x5914be,_0xaa2db6,_0x49e81c,_0x4a9158,_0x40d65d){const _0x16647a=segmentToYamlString(_0x5914be);if(_0xaa2db6){const _0x55c33c=segmentWithActivationsToYaml(_0xaa2db6,_0x49e81c,undefined,_0x4a9158,_0x40d65d),_0x4d3604=segmentToYamlString(_0x55c33c),_0x1d209c=generateDiff(_0x4d3604,_0x16647a),_0x5ef720=hasChanges(_0x1d209c);return{'isNew':![],'hasChanges':_0x5ef720,'diff':_0x5ef720?formatDiffWithColors(_0x1d209c):undefined};}const _0x4307ce=generateDiff('',_0x16647a);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x4307ce)};}export function calculateJourneyDiff(_0x38f376,_0x2f0775){const _0x58c779=normalizeJourneyDef(_0x38f376,_0x38f376),_0x1cd1ac=a97_0x12627c(_0x58c779);if(_0x2f0775){const _0x54f5a2=normalizeJourneyDef(_0x2f0775,_0x38f376),_0x45ed7a=a97_0x12627c(_0x54f5a2),_0x6958e8=generateDiff(_0x45ed7a,_0x1cd1ac),_0x4720a0=hasChanges(_0x6958e8);return{'isNew':![],'hasChanges':_0x4720a0,'diff':_0x4720a0?formatDiffWithColors(_0x6958e8):undefined};}const _0x25bbc7=generateDiff('',_0x1cd1ac);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x25bbc7)};}export function findSegmentsToDelete(_0x52ba47,_0x23ca66,_0x3b24fd,_0x245a87,_0x59e08a){const _0x47e79f=a97_0x3d28bc,_0x43cce8=new Set();for(const {yamlConfig:_0xa7b1e0,folderPath:_0x590678}of _0x23ca66){_0x43cce8[_0x47e79f(0x22e)](_0x590678+':'+_0xa7b1e0['name']);}return _0x52ba47[_0x47e79f(0x25e)](_0x177d75=>{const _0x40b30a=_0x47e79f,_0x25a4b9=_0x177d75[_0x40b30a(0x1cb)]?_0x3b24fd[_0x40b30a(0x272)](_0x177d75[_0x40b30a(0x1cb)][_0x40b30a(0x252)]())||'':'',_0x3d46eb=_0x25a4b9+':'+_0x177d75[_0x40b30a(0x21b)];if(_0x43cce8[_0x40b30a(0x20f)](_0x3d46eb))return![];if(_0x59e08a)return _0x25a4b9===_0x245a87||_0x25a4b9[_0x40b30a(0x1c1)](_0x245a87+'/');return!![];});}export function findJourneysToDelete(_0x5cd527,_0x2d7493,_0x359f0a,_0x31f52c,_0x33a1b9){const _0x3a21df=a97_0x3d28bc,_0x1c4340=new Set();for(const {yamlConfig:_0x3010f1,folderPath:_0x403343}of _0x2d7493){_0x1c4340[_0x3a21df(0x22e)](_0x403343+':'+_0x3010f1[_0x3a21df(0x21b)]);}return _0x5cd527[_0x3a21df(0x25e)](_0x40de56=>{const _0x37f683=_0x3a21df,_0x36f0b6=_0x40de56[_0x37f683(0x259)]?_0x359f0a[_0x37f683(0x272)](_0x40de56[_0x37f683(0x259)])||'':'',_0x3b61f3=_0x36f0b6+':'+_0x40de56[_0x37f683(0x260)];if(_0x1c4340['has'](_0x3b61f3))return![];if(_0x33a1b9)return _0x36f0b6===_0x31f52c||_0x36f0b6[_0x37f683(0x1c1)](_0x31f52c+'/');return!![];});}export function buildSegmentLookupMap(_0x49a176,_0x2fef40){const _0x460000=a97_0x3d28bc,_0x5505e3=new Map();for(const _0x1d26fb of _0x49a176){const _0x131233=_0x1d26fb[_0x460000(0x1cb)]?_0x2fef40[_0x460000(0x272)](_0x1d26fb['segmentFolderId'][_0x460000(0x252)]())||'':'',_0x2fbf4c=_0x131233+':'+_0x1d26fb[_0x460000(0x21b)];_0x5505e3[_0x460000(0x207)](_0x2fbf4c,_0x1d26fb);}return _0x5505e3;}export function buildSegmentNameToIdMap(_0x2ab404){const _0x561c5e=a97_0x3d28bc,_0x3d50a0=new Map();for(const _0xcb048 of _0x2ab404){_0x3d50a0['set'](_0xcb048[_0x561c5e(0x21b)],_0xcb048['id']);}return _0x3d50a0;}export function buildJourneyBundleLookupMap(_0x293191,_0x27a1a1){const _0x42512a=a97_0x3d28bc,_0x181438=new Map();for(const _0x58635d of _0x293191){const _0x45be68=_0x58635d[_0x42512a(0x259)]?_0x27a1a1[_0x42512a(0x272)](_0x58635d[_0x42512a(0x259)])||'':'',_0x258eb3=_0x45be68+':'+_0x58635d[_0x42512a(0x260)];!_0x181438[_0x42512a(0x20f)](_0x258eb3)&&_0x181438[_0x42512a(0x207)](_0x258eb3,[]),_0x181438[_0x42512a(0x272)](_0x258eb3)[_0x42512a(0x283)](_0x58635d);}for(const _0x690095 of _0x181438[_0x42512a(0x29c)]()){_0x690095[_0x42512a(0x26f)]((_0x11a56e,_0x1ddfe0)=>(_0x11a56e[_0x42512a(0x22c)]||0x0)-(_0x1ddfe0[_0x42512a(0x22c)]||0x0));}return _0x181438;}export function collectFoldersToCreate(_0x515b83,_0x5a928a){const _0x642d78=a97_0x3d28bc,_0x264319=new Set();for(const _0x10a336 of _0x515b83){if(!_0x10a336)continue;if(_0x5a928a[_0x642d78(0x20f)](_0x10a336))continue;const _0x4ade40=_0x10a336[_0x642d78(0x277)]('/');let _0x224de2='';for(const _0x1d2262 of _0x4ade40){_0x224de2=_0x224de2?_0x224de2+'/'+_0x1d2262:_0x1d2262,!_0x5a928a['has'](_0x224de2)&&_0x264319[_0x642d78(0x22e)](_0x224de2);}}return _0x264319;}export function parseAndClassifyYamlFiles(_0x3a9e41,_0x2c5c9c,_0x30fed9){const _0x52d1e1=a97_0x3d28bc,_0x8b3a87=[],_0xdc0859=[];for(const _0x1b65ef of _0x3a9e41){const _0x3688ee=a97_0x54bcec[_0x52d1e1(0x1c4)](_0x2c5c9c,a97_0x54bcec[_0x52d1e1(0x1f5)](_0x1b65ef)),_0x5ca5ea=_0x3688ee==='.'?'':_0x3688ee,_0x180ea1=readFileSync(_0x1b65ef,_0x52d1e1(0x1de)),_0x4d425e=a97_0xb38f62[_0x52d1e1(0x258)](_0x180ea1);if(isJourneyDef(_0x4d425e)){const _0x15a26b=a97_0x24d767(_0x180ea1);_0xdc0859[_0x52d1e1(0x283)]({'yamlConfig':_0x15a26b,'folderPath':_0x5ca5ea,'sourcePath':_0x1b65ef});}else{if(!_0x30fed9?.[_0x52d1e1(0x212)]){const _0x10c377=parseSegmentYamlFile(_0x180ea1),_0x3447e5=normalizeChildSegmentYaml(_0x10c377);_0x8b3a87[_0x52d1e1(0x283)]({'yamlConfig':_0x3447e5,'folderPath':_0x5ca5ea,'sourcePath':_0x1b65ef});}}}return{'segments':_0x8b3a87,'journeys':_0xdc0859};}export function validateParsedFiles(_0x5743f6,_0x1d903a){const _0x38f9db=a97_0x3d28bc,_0x523a5d=[];for(const {yamlConfig:_0x5666e7,sourcePath:_0x4b5aac}of _0x5743f6[_0x38f9db(0x200)]){const _0x4f620f=readFileSync(_0x4b5aac,'utf-8'),_0x163bc9=a97_0xb38f62[_0x38f9db(0x2a5)](_0x4f620f),_0xde608e=validateSegmentDef(_0x5666e7,{'source':_0x4f620f,'document':_0x163bc9});if(!_0xde608e[_0x38f9db(0x264)]){const _0x30b11f=a97_0x54bcec[_0x38f9db(0x1c4)](_0x1d903a,_0x4b5aac);_0x523a5d[_0x38f9db(0x283)]({'filePath':_0x30b11f,'source':_0x4f620f,'result':_0xde608e,'isJourney':![]});}}for(const {yamlConfig:_0x4cb131,sourcePath:_0x18403d}of _0x5743f6[_0x38f9db(0x2a0)]){const _0x48d286=readFileSync(_0x18403d,_0x38f9db(0x1de)),_0x7e4702=a97_0xb38f62[_0x38f9db(0x2a5)](_0x48d286),_0x5336a9=validateJourneyDef(_0x4cb131,{'source':_0x48d286,'document':_0x7e4702});if(!_0x5336a9['valid']){const _0x355356=a97_0x54bcec['relative'](_0x1d903a,_0x18403d);_0x523a5d['push']({'filePath':_0x355356,'source':_0x48d286,'result':_0x5336a9,'isJourney':!![]});}}return _0x523a5d;}export function formatValidationErrors(_0x606033){const _0x144986=a97_0x3d28bc,_0x16f53b=[];for(const {filePath:_0x1eec35,source:_0x4d4415,result:_0x5cf3f0,isJourney:_0x3e6bff}of _0x606033){const _0x39a313=_0x3e6bff?_0x144986(0x23b):_0x144986(0x255);_0x16f53b[_0x144986(0x283)]('\x0a'+_0x1eec35+'\x20('+_0x39a313+_0x144986(0x2a7)+_0x5cf3f0['errors'][_0x144986(0x21a)]+_0x144986(0x296)),_0x16f53b[_0x144986(0x283)](formatValidationResult(_0x5cf3f0,_0x4d4415,_0x1eec35));}return _0x16f53b[_0x144986(0x1f3)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x372ae9){const _0xf67f89=a97_0x3d28bc,_0x5e0118=new Set(),_0xfaf9d9=new Map(),_0xf46155=collectSegmentUsageCounts(_0x372ae9);if(_0x372ae9[_0xf67f89(0x200)])for(const [_0x15f435,_0x16dfa0]of Object['entries'](_0x372ae9['segments'])){_0x5e0118[_0xf67f89(0x22e)](_0x15f435);if(_0x16dfa0[_0xf67f89(0x1c5)]){const _0x7bbfbf=yamlRuleToApi(_0x16dfa0['rule']),_0x2163f5=apiRuleToYaml(_0x7bbfbf);_0xfaf9d9['set'](_0x15f435,_0x2163f5);}}const _0x5e4eaf=new Map();let _0x51a298=0x0;for(const [_0x1d9618,_0x59674b]of _0xfaf9d9){const _0x473e0=serializeExpandedRule(_0x59674b,_0xfaf9d9),_0x3e8680=_0x5e4eaf[_0xf67f89(0x272)](_0x473e0)||[];_0x3e8680[_0xf67f89(0x283)]({'name':_0x1d9618,'index':_0x51a298}),_0x5e4eaf[_0xf67f89(0x207)](_0x473e0,_0x3e8680),_0x51a298++;}const _0x5bd88c=new Map();for(const [_0x2fa66d,_0x409a08]of _0x5e4eaf){const _0x298631=_0x409a08[_0xf67f89(0x1e0)]()['sort']((_0x2045fc,_0x13f62d)=>{const _0x16fec8=_0xf67f89,_0x334fe7=_0xf46155['get'](_0x2045fc[_0x16fec8(0x21b)])||0x0,_0x16a703=_0xf46155[_0x16fec8(0x272)](_0x13f62d['name'])||0x0;if(_0x334fe7!==_0x16a703)return _0x16a703-_0x334fe7;return _0x2045fc[_0x16fec8(0x1e2)]-_0x13f62d[_0x16fec8(0x1e2)];})[_0xf67f89(0x1f8)](_0xe15328=>_0xe15328[_0xf67f89(0x21b)]),_0x10f377=[];for(const _0x38dee1 of _0x298631){const _0x4d71af=_0xf46155['get'](_0x38dee1)||0x0,_0xd18c5e=Math['max'](_0x4d71af,0x1);for(let _0x1f960b=0x0;_0x1f960b<_0xd18c5e;_0x1f960b++){_0x10f377['push'](_0x38dee1);}}_0x5bd88c[_0xf67f89(0x207)](_0x2fa66d,_0x10f377);}return{'existingLocalSegmentNames':_0x5e0118,'localSegmentRules':_0xfaf9d9,'localExpandedRuleToNames':_0x5bd88c};}async function buildServerSegmentRuleMap(_0x38e11c,_0x496905,_0xc9165e,_0x382c8f){const _0x4b20fe=new Map(),_0x5afd10=new Set(),_0x48539e=async _0x2390b9=>{const _0x5bfdbd=a97_0x5045;if(_0x5afd10[_0x5bfdbd(0x20f)](_0x2390b9))return;_0x5afd10[_0x5bfdbd(0x22e)](_0x2390b9);let _0x9f808d=_0xc9165e[_0x5bfdbd(0x22d)](_0x4a7ee9=>_0x4a7ee9['id']===_0x2390b9);if(!_0x9f808d)try{_0x9f808d=await _0x38e11c['segment']['getSegment'](_0x496905,_0x2390b9);}catch{return;}if(!_0x9f808d?.['rule'])return;const _0x5df42e=apiRuleToYaml(_0x9f808d[_0x5bfdbd(0x1c5)]);_0x4b20fe[_0x5bfdbd(0x207)](_0x2390b9,_0x5df42e);const _0x587f24=collectSegmentRefsFromRule(_0x5df42e);for(const _0x39fd8e of _0x587f24){await _0x48539e(_0x39fd8e);}};for(const _0x1866f1 of _0x382c8f){await _0x48539e(_0x1866f1);}return _0x4b20fe;}export function createSegmentIdResolver(_0x2cf25e,_0x58766){return async _0xdfa381=>{const _0x247b50=a97_0x5045,_0x16986b=_0x2cf25e[_0x247b50(0x272)](_0xdfa381);if(!_0x16986b)throw new SDKError(ErrorCode[_0x247b50(0x27e)],_0x247b50(0x227)+_0xdfa381+_0x247b50(0x1f7)+_0x58766+'\x27)');return _0x16986b;};}export function extractRootFolderId(_0x498e04){const _0x1c6f6b=a97_0x3d28bc;return _0x498e04['relationships']?.[_0x1c6f6b(0x219)]?.[_0x1c6f6b(0x1ce)]?.['id']||_0x498e04[_0x1c6f6b(0x201)]?.[_0x1c6f6b(0x1eb)]?.[_0x1c6f6b(0x1ce)]?.['id'];}export function buildConnectionMaps(_0x1bdd5d){const _0x454bdf=a97_0x3d28bc,_0x1ae8cd=new Map(),_0x29f08c=new Map(),_0x1f2559=new Map();for(const _0x19dca9 of _0x1bdd5d){_0x1ae8cd[_0x454bdf(0x207)](_0x19dca9[_0x454bdf(0x21b)],parseInt(_0x19dca9['id'],0xa)),_0x29f08c[_0x454bdf(0x207)](_0x19dca9['id'],_0x19dca9[_0x454bdf(0x21b)]),_0x1f2559[_0x454bdf(0x207)](_0x19dca9[_0x454bdf(0x21b)],_0x19dca9[_0x454bdf(0x203)]);}return{'nameToId':_0x1ae8cd,'idToName':_0x29f08c,'nameToType':_0x1f2559};}export function calculatePushStats(_0x2659f1,_0x2f9f06,_0x8fea58,_0x4d44fd,_0x16f61d,_0x1e0edf,_0x54435a){const _0x25f020=a97_0x3d28bc,_0xb7c6d6=_0x2659f1[_0x25f020(0x25e)](_0x3c9114=>_0x3c9114['isNew']),_0xa7b2d6=_0x2659f1[_0x25f020(0x25e)](_0x449517=>!_0x449517['isNew']&&_0x449517[_0x25f020(0x204)]),_0x1fa415=_0x2659f1[_0x25f020(0x25e)](_0x2a3aef=>!_0x2a3aef[_0x25f020(0x25b)]&&!_0x2a3aef[_0x25f020(0x204)]),_0x51cb2d=_0x1e0edf?_0x4d44fd:[],_0x241ca3=_0x2f9f06[_0x25f020(0x25e)](_0x540375=>_0x540375[_0x25f020(0x25b)]),_0x1c212e=_0x2f9f06[_0x25f020(0x25e)](_0x285cae=>!_0x285cae[_0x25f020(0x25b)]&&_0x285cae['hasChanges']),_0x269f49=_0x2f9f06[_0x25f020(0x25e)](_0x25fb37=>!_0x25fb37[_0x25f020(0x25b)]&&!_0x25fb37[_0x25f020(0x204)]),_0x78c25c=_0x1e0edf?_0x16f61d:[],_0x1d10cd=_0x2659f1[_0x25f020(0x1c6)](_0x399842=>_0x399842[_0x25f020(0x1e3)]),_0x23d46d=_0x1d10cd['filter'](_0x120260=>_0x120260[_0x25f020(0x203)]===_0x25f020(0x275)),_0x26a794=_0x1d10cd[_0x25f020(0x25e)](_0x32f27b=>_0x32f27b[_0x25f020(0x203)]===_0x25f020(0x1ff)),_0x516ecf=_0x1d10cd[_0x25f020(0x25e)](_0x519c85=>_0x519c85['type']==='delete'),_0x26a56c=Array[_0x25f020(0x24b)](_0x8fea58)[_0x25f020(0x26f)](),_0xedf3c4=_0x54435a?![]:_0xb7c6d6[_0x25f020(0x21a)]>0x0||_0xa7b2d6[_0x25f020(0x21a)]>0x0||_0x51cb2d[_0x25f020(0x21a)]>0x0,_0x12b6f5=_0x241ca3['length']>0x0||_0x1c212e[_0x25f020(0x21a)]>0x0||_0x78c25c[_0x25f020(0x21a)]>0x0,_0x5828bc=_0x54435a?![]:_0x1d10cd[_0x25f020(0x21a)]>0x0,_0x41c49d=_0x26a56c[_0x25f020(0x21a)]>0x0;return{'segments':{'new':_0xb7c6d6,'changed':_0xa7b2d6,'unchanged':_0x1fa415,'toDelete':_0x51cb2d},'journeys':{'new':_0x241ca3,'changed':_0x1c212e,'unchanged':_0x269f49,'toDelete':_0x78c25c},'activations':{'all':_0x1d10cd,'toCreate':_0x23d46d,'toUpdate':_0x26a794,'toDelete':_0x516ecf},'folders':{'toCreate':_0x26a56c},'counts':{'segments':{'new':_0xb7c6d6[_0x25f020(0x21a)],'changed':_0xa7b2d6[_0x25f020(0x21a)],'unchanged':_0x1fa415['length'],'toDelete':_0x51cb2d[_0x25f020(0x21a)]},'journeys':{'new':_0x241ca3[_0x25f020(0x21a)],'changed':_0x1c212e[_0x25f020(0x21a)],'unchanged':_0x269f49['length'],'toDelete':_0x78c25c[_0x25f020(0x21a)]},'activations':{'create':_0x23d46d[_0x25f020(0x21a)],'update':_0x26a794[_0x25f020(0x21a)],'delete':_0x516ecf[_0x25f020(0x21a)]},'folders':_0x26a56c['length']},'hasChanges':_0xedf3c4||_0x12b6f5||_0x5828bc||_0x41c49d};}export async function buildPushExecutionContext(_0xcd74b0,_0x32f498,_0x13bcfe,_0x3a64d8,_0x44f48,_0x4b5f3f){const _0x1519d4=a97_0x3d28bc,_0x46b815=extractRootFolderId(_0x13bcfe),{pathToId:_0x3b420d,idToPath:_0x4e2dc0}=buildFolderMaps(_0x44f48),_0x31f9bd=buildSegmentNameToIdMap(_0x3a64d8),_0x48e74b=new Map(),{batchAsync:_0x5618e1}=await import(_0x1519d4(0x280)),[_0xa57bc2,_0x403537]=await Promise['all']([_0xcd74b0[_0x1519d4(0x1f4)][_0x1519d4(0x1df)](),_0xcd74b0[_0x1519d4(0x20e)][_0x1519d4(0x1fd)](),((async()=>{!_0x4b5f3f&&_0x3a64d8['length']>0x0&&await _0x5618e1(_0x3a64d8,async _0x556003=>{const _0x44c419=a97_0x5045,_0x45f62c=await _0xcd74b0['segment'][_0x44c419(0x278)](_0x32f498,_0x556003['id']);_0x48e74b['set'](_0x556003['id'],_0x45f62c);});})())]),{emailToId:_0x4b52f0,idToEmail:_0x4fe410}=_0xa57bc2,_0x158e7c=buildConnectionMaps(_0x403537);return{'rootFolderId':_0x46b815,'folderPathToId':_0x3b420d,'folderIdToPath':_0x4e2dc0,'segmentNameToId':_0x31f9bd,'activationsBySegmentId':_0x48e74b,'emailToIdMap':_0x4b52f0,'idToEmailMap':_0x4fe410,'connectionNameToIdMap':_0x158e7c['nameToId'],'connectionIdToNameMap':_0x158e7c[_0x1519d4(0x24d)],'connectionNameToTypeMap':_0x158e7c[_0x1519d4(0x1d2)]};}function a97_0x1717(){const _0x5432c8=['null','ACTIVATION_UPDATE_ERROR','activation_creating','logDeleted','utf-8','buildUserMaps','slice','SEGMENT_SYNTAX_ERROR','index','activationActions','Created\x20journey\x20\x27','embedded_segment_created','6158732MBGtLg','segment_created','\x27\x20from\x20file:\x20','35VdYrSI','localSegmentRules','parentFolder','updateActivation','folderPath',').\x20','activationsBySegmentId','Deleting\x20activation\x20\x27','stringify','yamlActivation','join','user','dirname','activationParams','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','map','\x27\x20exit\x20criteria','activations','Creating\x20activation\x20\x27','Entry\x20criteria:\x20','list','./child-segment-yaml.js','update','segments','relationships','segment_updated','type','hasChanges','Created\x20folder\x20\x27','with','set','effectiveFolderId','1FYCpaX','journey_entry_criteria_','segment_creating','273yuwMXd','item','connection','has','journeyById','absolutePath','skipSegments','journeyActivationNameToId','size','idToEmailMap','embedded_activation_created','Failed\x20to\x20','activation_','parentSegmentFolder','length','name','sha1','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','\x27\x20not\x20found\x20in\x20journey\x20\x27','withProgress','getJourney','2365992otMGXu','createActivation','decision_point','DecisionPoint','journeyStages','embeddedSegmentNameToId','Segment\x20not\x20found:\x20','journeyActivationStepId','delete','goal','NOT_FOUND','versionNumber','find','add','Activation','goal\x20criteria','logInfo','segmentByFolderAndName','branches','existingSegments','exitCriterias','existingSegment','activation_deleting','Stage\x20\x27','segmentId','deleted','journey','existingActivation','all_columns','\x20segment\x20from\x20file:\x20','attributes','connector_config','embedded_activation_creating','activationContext','steps','connectionIdToNameMap','\x20(referenced\x20in\x20journey\x20','deleteActivation','activationStepsById','stages','segment_deleted','entry','from','Updating\x20activation\x20\x27','idToName','__pending_act_','results','Creating\x20folder\x20\x27','193400IBlhvw','toString','reduce','all','segment','fetchJourney','folder_creating','parse','folderId','validatedRequest','isNew','__pending_','folderPathToId','filter','3SMpZVm','journeyBundleName','819098mOXgqx','JOURNEY_SYNTAX_ERROR','folder_created','valid','journeyId','kind','deps','rootFolderId','45MJaAvx','ACTIVATION_SYNTAX_ERROR','updateSegmentById','2160974VpnFCi','columns','keys','sort','getActivation','existingJourney','get','unchanged','diff','create','Journey\x20\x27','split','listActivations','\x0a\x20\x20','entryCriteria','\x27...','INTERNAL','isArray','SEGMENT_NOT_FOUND','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','../../utils/async.js','progress','parentId','push','stage\x20\x27','yamlConfig','Fetching\x20','./journey-yaml.js','embedded_segment_creating','entry_criteria','activation_updated','behavior','resolveSegment','Updated\x20activation\x20\x27','\x20journey\x20from\x20file:\x20','\x27\x20entry\x20criteria','logSuccess','created','onProgress','notification','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','activation_template_id','\x20error(s)','state','createJourneySegment','SEGMENT_UPDATE_ERROR','segment_updating','description','values','getSegment','updated','activation_deleted','journeys','40uXsOvn','createdSegmentId','toLowerCase','max','parseDocument','verbose','):\x20','10188915kPWvHr','digest','startsWith','draft','Created\x20segment\x20\x27','relative','rule','flatMap','createFolder','journey_updating','Deleted\x20segment\x20\x27','segmentNameToId','segmentFolderId','activation_updating','Activation\x20not\x20found:\x20','data','\x27\x20milestone','milestone','replace','nameToType','trim','JOURNEY_UPDATE_ERROR','398796UWHytO','Created\x20activation\x20\x27','journeyBundlesByFolderAndName','object','action'];a97_0x1717=function(){return _0x5432c8;};return a97_0x1717();}export function createPushYamlContextForBundle(_0x3e3215,_0x3addfb,_0x41d28b,_0x215154,_0x203812,_0x446d9a,_0x2608b5,_0x146eb5){const {existingLocalSegmentNames:_0x3b1f84,localExpandedRuleToNames:_0x24a2c2}=_0x215154,_0x4fed05=new Set(),_0x42b196=new Map(),_0x3ac27c=new Set(),_0x1d6eb5=new Map(),_0x4fd9a6=new Map(),_0x2660d=createJumpTargetCache(),_0x3822c0=new Map(),_0x25c83d=new Map(),_0x493765=new Set();let _0x114cd3;const _0x1bf838=_0x3985e9=>{const _0x3cfc3a={'resolveSegment':async _0x103c6c=>{const _0x265153=a97_0x5045,_0x1bd65d=_0x4fd9a6[_0x265153(0x272)](_0x103c6c);if(_0x1bd65d!==undefined)return{'name':_0x1bd65d,'isJourneyLocal':!![]};try{let _0x316ffb=_0x41d28b['find'](_0x4e5871=>_0x4e5871['id']===_0x103c6c);!_0x316ffb&&(_0x316ffb=await _0x3e3215[_0x265153(0x255)]['getSegment'](_0x3addfb,_0x103c6c));const _0x1bdf57=generateJourneyLocalName(_0x316ffb[_0x265153(0x21b)]),_0x509628=_0x316ffb[_0x265153(0x266)]===SEGMENT_KIND_JOURNEY&&_0x1bdf57!==undefined;let _0xb2ff9a=_0x316ffb[_0x265153(0x21b)],_0xdbc609;if(_0x509628&&_0x316ffb[_0x265153(0x1c5)]){const _0x354a8b=apiRuleToYaml(_0x316ffb[_0x265153(0x1c5)]);_0x25c83d[_0x265153(0x207)](_0x103c6c,_0x354a8b);const _0x10b5b1=async _0x6fc638=>{const _0x4b49e5=_0x265153,_0x856210=collectSegmentRefsFromRule(_0x6fc638);for(const _0x3539a4 of _0x856210){if(!_0x25c83d['has'](_0x3539a4))try{const _0x28d3c6=await _0x3e3215['segment'][_0x4b49e5(0x29d)](_0x3addfb,_0x3539a4);if(_0x28d3c6?.[_0x4b49e5(0x1c5)]){const _0x1ed9ce=apiRuleToYaml(_0x28d3c6[_0x4b49e5(0x1c5)]);_0x25c83d[_0x4b49e5(0x207)](_0x3539a4,_0x1ed9ce),await _0x10b5b1(_0x1ed9ce);}}catch{}}};await _0x10b5b1(_0x354a8b);const _0x48366e=serializeExpandedRule(_0x354a8b,_0x25c83d),_0x13aef9=_0x24a2c2[_0x265153(0x272)](_0x48366e);if(_0x13aef9&&_0x13aef9['length']>0x0){const _0x5004d3=_0x42b196[_0x265153(0x272)](_0x48366e)||0x0,_0x99e766=_0x13aef9[_0x5004d3]||_0x13aef9[_0x13aef9[_0x265153(0x21a)]-0x1];_0x42b196[_0x265153(0x207)](_0x48366e,_0x5004d3+0x1),_0xb2ff9a=_0x99e766,_0x4fed05['add'](_0xb2ff9a),_0x4fd9a6[_0x265153(0x207)](_0x103c6c,_0xb2ff9a);const _0x33f8b4=await resolveRuleSegmentRefs(_0x354a8b,async _0xd46035=>{const _0x5939f8=_0x265153,_0x430234=_0x4fd9a6['get'](_0xd46035);if(_0x430234)return _0x430234;const _0x11cafc=await _0x114cd3[_0x5939f8(0x28c)](_0xd46035);return _0x11cafc[_0x5939f8(0x21b)];});_0xdbc609={'description':_0x316ffb[_0x265153(0x29b)],'rule':_0x33f8b4};}else{const _0x4f985f=_0x3822c0[_0x265153(0x272)](_0x48366e);if(_0x4f985f)_0xb2ff9a=_0x4f985f,_0x4fd9a6[_0x265153(0x207)](_0x103c6c,_0xb2ff9a);else{if(_0x1bdf57){let _0x518375=_0x1bdf57,_0x4226c8=0x2;while(_0x4fed05[_0x265153(0x20f)](_0x518375)||_0x3b1f84['has'](_0x518375)){_0x518375=_0x1bdf57+'_'+_0x4226c8,_0x4226c8++;}_0x4fed05[_0x265153(0x22e)](_0x518375),_0xb2ff9a=_0x518375;}_0x4fd9a6[_0x265153(0x207)](_0x103c6c,_0xb2ff9a),_0x3822c0[_0x265153(0x207)](_0x48366e,_0xb2ff9a);const _0x25ede2=await resolveRuleSegmentRefs(_0x354a8b,async _0x2f1dee=>{const _0x356b7c=_0x265153,_0x310e03=_0x4fd9a6[_0x356b7c(0x272)](_0x2f1dee);if(_0x310e03)return _0x310e03;const _0x1cc49f=await _0x114cd3[_0x356b7c(0x28c)](_0x2f1dee);return _0x1cc49f[_0x356b7c(0x21b)];});_0xdbc609={'description':_0x316ffb[_0x265153(0x29b)],'rule':_0x25ede2};}}}return{'name':_0xb2ff9a,'isJourneyLocal':_0x509628,'definition':_0xdbc609};}catch{return{'name':_0x103c6c,'isJourneyLocal':![]};}},'resolveActivation':async _0x393f3f=>{const _0x5582fe=a97_0x5045,_0x595f8d=_0x1d6eb5[_0x5582fe(0x272)](_0x393f3f);if(_0x595f8d!==undefined)return{'name':_0x595f8d,'isJourneyLocal':!![]};try{let _0x5b2a08=_0x2608b5?.[_0x5582fe(0x272)](_0x393f3f);!_0x5b2a08&&(_0x5b2a08=await _0x3e3215[_0x5582fe(0x23b)][_0x5582fe(0x270)](_0x3985e9,_0x393f3f));const _0x2d59f5=_0x5b2a08[_0x5582fe(0x23f)][_0x5582fe(0x1f6)][_0x5582fe(0x21b)]||_0x393f3f,_0x31d81b=sanitizeYamlKey(_0x2d59f5)||_0x5582fe(0x218)+_0x393f3f;let _0x48a597=_0x31d81b,_0x379ec6=0x2;while(_0x3ac27c['has'](_0x48a597)){_0x48a597=_0x31d81b+'_'+_0x379ec6,_0x379ec6++;}_0x3ac27c[_0x5582fe(0x22e)](_0x48a597),_0x1d6eb5[_0x5582fe(0x207)](_0x393f3f,_0x48a597);const _0x16544f=journeyActivationStepToYaml(_0x5b2a08,_0x203812,_0x446d9a);return{'name':_0x48a597,'isJourneyLocal':!![],'definition':_0x16544f};}catch{return{'name':_0x393f3f,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x45e69b,_0x3475c9)=>resolveJumpTarget(_0x45e69b,_0x3475c9,_0x2660d,async _0x4e259f=>{const _0x4232a2=a97_0x5045,_0x3518ce=_0x146eb5?.['get'](_0x4e259f);if(_0x3518ce)return _0x3518ce;return _0x3e3215['journey'][_0x4232a2(0x220)](_0x4e259f);})};return _0x114cd3=_0x3cfc3a,_0x3cfc3a;},_0x3b5b9b=async _0x26c7b6=>{const _0x28b24f=a97_0x5045,{collectSegmentIdsFromJourneyApi:_0x3b9347}=await import('./journey-yaml.js'),{batchAsync:_0x172936}=await import(_0x28b24f(0x280)),_0xf6d005=new Set();for(const _0x2f1130 of _0x26c7b6){let _0x29f6ca=_0x146eb5?.[_0x28b24f(0x272)](_0x2f1130);!_0x29f6ca&&(_0x29f6ca=await _0x3e3215[_0x28b24f(0x23b)][_0x28b24f(0x220)](_0x2f1130));const _0x48d2c2=_0x3b9347(_0x29f6ca);for(const _0x35aef9 of _0x48d2c2){_0xf6d005[_0x28b24f(0x22e)](_0x35aef9);}}let _0x5daa88=Array[_0x28b24f(0x24b)](_0xf6d005);while(_0x5daa88['length']>0x0){const _0x3da275=_0x5daa88['filter'](_0x2a9236=>!_0x493765[_0x28b24f(0x20f)](_0x2a9236));if(_0x3da275['length']===0x0)break;const _0x2e95ed=await _0x172936(_0x3da275,async _0x2f87a9=>{const _0x25232c=_0x28b24f;_0x493765[_0x25232c(0x22e)](_0x2f87a9);let _0x306f3d=_0x41d28b[_0x25232c(0x22d)](_0x38feb3=>_0x38feb3['id']===_0x2f87a9);if(!_0x306f3d)try{_0x306f3d=await _0x3e3215['segment']['getSegment'](_0x3addfb,_0x2f87a9);}catch{return null;}return{'segmentId':_0x2f87a9,'segment':_0x306f3d};},0xa),_0x59ae1b=new Set();for(const _0x2d853b of _0x2e95ed){if(!_0x2d853b?.[_0x28b24f(0x255)]?.[_0x28b24f(0x1c5)])continue;const _0x3eaa4d=apiRuleToYaml(_0x2d853b['segment']['rule']);_0x25c83d[_0x28b24f(0x207)](_0x2d853b['segmentId'],_0x3eaa4d);const _0x5fde5d=collectSegmentRefsFromRule(_0x3eaa4d);for(const _0x574f00 of _0x5fde5d){!_0x493765[_0x28b24f(0x20f)](_0x574f00)&&_0x59ae1b[_0x28b24f(0x22e)](_0x574f00);}}_0x5daa88=Array[_0x28b24f(0x24b)](_0x59ae1b);}};return{'createYamlContext':_0x1bf838,'prefetchJourneySegments':_0x3b5b9b};}export async function executePushSegments(_0x3a1f0d,_0x2e7942,_0x15184e,_0x8e7445,_0x565751){const _0x47a7a5=a97_0x3d28bc,{segmentDefToCreateRequest:_0x49df86,segmentDefToUpdateRequest:_0x12120c}=await import(_0x47a7a5(0x1fe)),_0x591f29=_0x15184e[_0x47a7a5(0x25d)],_0xdb45fc=0x5,_0x380b89=async _0x55e22b=>{const _0x142245=_0x47a7a5,_0x47199b=_0x55e22b[_0x142245(0x1ed)]?_0x591f29['get'](_0x55e22b[_0x142245(0x1ed)]):undefined;let _0x23930b;const _0x3d1ef6={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};try{if(_0x55e22b[_0x142245(0x25b)]){_0x565751[_0x142245(0x292)]?.({'type':_0x142245(0x20b),'name':_0x55e22b[_0x142245(0x285)]['name']});const _0x1d9ef4=_0x49df86(_0x55e22b[_0x142245(0x285)],_0x47199b),_0x3704ae=await _0x565751[_0x142245(0x21f)]('Creating\x20segment\x20\x27'+_0x55e22b[_0x142245(0x285)]['name']+_0x142245(0x27b),()=>_0x3a1f0d[_0x142245(0x255)]['createSegment'](_0x8e7445[_0x142245(0x282)],_0x1d9ef4));_0x23930b=_0x3704ae['data']['id'],_0x3d1ef6[_0x142245(0x2a2)]={'name':_0x55e22b[_0x142245(0x285)][_0x142245(0x21b)],'id':_0x23930b},_0x565751[_0x142245(0x292)]?.({'type':_0x142245(0x1e7),'name':_0x55e22b[_0x142245(0x285)][_0x142245(0x21b)],'segmentId':_0x23930b}),_0x565751['logSuccess']?.(_0x142245(0x1c3)+_0x55e22b[_0x142245(0x285)][_0x142245(0x21b)]+'\x27'),_0x3d1ef6[_0x142245(0x291)]=0x1;}else{if(_0x55e22b[_0x142245(0x204)]){_0x565751[_0x142245(0x292)]?.({'type':_0x142245(0x29a),'name':_0x55e22b[_0x142245(0x285)][_0x142245(0x21b)]});const _0x3fd1dc=_0x12120c(_0x55e22b[_0x142245(0x285)]);_0x47199b!==_0x55e22b['existingSegment']?.[_0x142245(0x1cb)]&&(_0x3fd1dc[_0x142245(0x1cb)]=_0x47199b?parseInt(_0x47199b,0xa):undefined),await _0x565751[_0x142245(0x21f)]('Updating\x20segment\x20\x27'+_0x55e22b[_0x142245(0x285)][_0x142245(0x21b)]+_0x142245(0x27b),()=>_0x3a1f0d['segment'][_0x142245(0x26b)](_0x8e7445[_0x142245(0x282)],_0x55e22b[_0x142245(0x236)]['id'],_0x3fd1dc)),_0x23930b=_0x55e22b[_0x142245(0x236)]['id'],_0x565751[_0x142245(0x292)]?.({'type':_0x142245(0x202),'name':_0x55e22b[_0x142245(0x285)][_0x142245(0x21b)]}),_0x565751['logSuccess']?.('Updated\x20segment\x20\x27'+_0x55e22b[_0x142245(0x285)][_0x142245(0x21b)]+'\x27'),_0x3d1ef6[_0x142245(0x29e)]=0x1;}else _0x23930b=_0x55e22b[_0x142245(0x236)]['id'];}}catch(_0x3e89bb){const _0x5de41b=isHttp400Error(_0x3e89bb),_0x5600d9=_0x5de41b?ErrorCode[_0x142245(0x1e1)]:ErrorCode[_0x142245(0x299)],_0x396d7a=getErrorMessage(_0x3e89bb);throw new SDKError(_0x5600d9,_0x142245(0x217)+(_0x55e22b['isNew']?'create':'update')+_0x142245(0x23e)+_0x55e22b[_0x142245(0x211)]+_0x142245(0x279)+_0x396d7a,_0x3e89bb);}try{const _0x49ab7a=await syncActivationsForSegment(_0x3a1f0d,_0x8e7445[_0x142245(0x282)],_0x23930b,_0x55e22b[_0x142245(0x285)][_0x142245(0x21b)],_0x55e22b[_0x142245(0x1e3)],_0x565751,_0x55e22b[_0x142245(0x211)]);_0x3d1ef6[_0x142245(0x1fa)]=_0x49ab7a;}catch(_0x23e721){if(_0x23e721 instanceof SDKError)throw _0x23e721;throw new SDKError(ErrorCode[_0x142245(0x1db)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x55e22b['yamlConfig'][_0x142245(0x21b)]+_0x142245(0x1e8)+_0x55e22b['absolutePath']+_0x142245(0x279)+getErrorMessage(_0x23e721),_0x23e721);}return _0x3d1ef6;},_0x38e6d5=await batchAsync(_0x2e7942,_0x380b89,_0xdb45fc),_0x1ed17f={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x12e733 of _0x38e6d5){_0x1ed17f['created']+=_0x12e733['created'],_0x1ed17f['updated']+=_0x12e733[_0x47a7a5(0x29e)],_0x12e733[_0x47a7a5(0x2a2)]&&_0x1ed17f['createdSegmentIds']['set'](_0x12e733[_0x47a7a5(0x2a2)][_0x47a7a5(0x21b)],_0x12e733[_0x47a7a5(0x2a2)]['id']),_0x1ed17f['activations'][_0x47a7a5(0x291)]+=_0x12e733[_0x47a7a5(0x1fa)][_0x47a7a5(0x291)],_0x1ed17f['activations'][_0x47a7a5(0x29e)]+=_0x12e733['activations'][_0x47a7a5(0x29e)],_0x1ed17f[_0x47a7a5(0x1fa)][_0x47a7a5(0x23a)]+=_0x12e733[_0x47a7a5(0x1fa)][_0x47a7a5(0x23a)];}return _0x1ed17f;}async function syncActivationsForSegment(_0x8b5625,_0x4d86c5,_0x562f83,_0x5af39c,_0x407cb8,_0x43d1f0,_0x3ff9a6){const _0x4d1a8d=a97_0x3d28bc,_0x38070a={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x27b567 of _0x407cb8){try{if(_0x27b567['type']==='create'&&_0x27b567[_0x4d1a8d(0x25a)])_0x43d1f0['onProgress']?.({'type':_0x4d1a8d(0x1dc),'segmentName':_0x5af39c,'activationName':_0x27b567[_0x4d1a8d(0x21b)]}),await _0x43d1f0['withProgress'](_0x4d1a8d(0x1fb)+_0x27b567[_0x4d1a8d(0x21b)]+'\x27...',()=>_0x8b5625[_0x4d1a8d(0x255)]['createActivation'](_0x4d86c5,_0x562f83,_0x27b567[_0x4d1a8d(0x25a)])),_0x43d1f0[_0x4d1a8d(0x292)]?.({'type':'activation_created','segmentName':_0x5af39c,'activationName':_0x27b567[_0x4d1a8d(0x21b)]}),_0x43d1f0[_0x4d1a8d(0x290)]?.(_0x4d1a8d(0x1d6)+_0x27b567[_0x4d1a8d(0x21b)]+'\x27'),_0x38070a[_0x4d1a8d(0x291)]++;else{if(_0x27b567['type']==='update'&&_0x27b567[_0x4d1a8d(0x25a)]&&_0x27b567[_0x4d1a8d(0x23c)])_0x43d1f0[_0x4d1a8d(0x292)]?.({'type':_0x4d1a8d(0x1cc),'segmentName':_0x5af39c,'activationName':_0x27b567[_0x4d1a8d(0x21b)]}),await _0x43d1f0[_0x4d1a8d(0x21f)](_0x4d1a8d(0x24c)+_0x27b567[_0x4d1a8d(0x21b)]+_0x4d1a8d(0x27b),()=>_0x8b5625[_0x4d1a8d(0x255)][_0x4d1a8d(0x1ec)](_0x4d86c5,_0x562f83,_0x27b567[_0x4d1a8d(0x23c)]['id'],_0x27b567[_0x4d1a8d(0x25a)])),_0x43d1f0[_0x4d1a8d(0x292)]?.({'type':_0x4d1a8d(0x28a),'segmentName':_0x5af39c,'activationName':_0x27b567['name']}),_0x43d1f0[_0x4d1a8d(0x290)]?.(_0x4d1a8d(0x28d)+_0x27b567[_0x4d1a8d(0x21b)]+'\x27'),_0x38070a[_0x4d1a8d(0x29e)]++;else _0x27b567['type']===_0x4d1a8d(0x229)&&_0x27b567['existingActivation']&&(_0x43d1f0[_0x4d1a8d(0x292)]?.({'type':_0x4d1a8d(0x237),'segmentName':_0x5af39c,'activationName':_0x27b567[_0x4d1a8d(0x21b)]}),await _0x43d1f0[_0x4d1a8d(0x21f)](_0x4d1a8d(0x1f0)+_0x27b567['name']+_0x4d1a8d(0x27b),()=>_0x8b5625[_0x4d1a8d(0x255)][_0x4d1a8d(0x246)](_0x4d86c5,_0x562f83,_0x27b567[_0x4d1a8d(0x23c)]['id'])),_0x43d1f0['onProgress']?.({'type':_0x4d1a8d(0x29f),'segmentName':_0x5af39c,'activationName':_0x27b567['name']}),_0x43d1f0[_0x4d1a8d(0x1dd)]?.('Deleted\x20activation\x20\x27'+_0x27b567[_0x4d1a8d(0x21b)]+'\x27'),_0x38070a[_0x4d1a8d(0x23a)]++);}}catch(_0x118483){const _0x53d13e=isHttp400Error(_0x118483),_0x5196c2=_0x53d13e?ErrorCode[_0x4d1a8d(0x26a)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x5619fd=getErrorMessage(_0x118483);throw new SDKError(_0x5196c2,_0x4d1a8d(0x217)+_0x27b567[_0x4d1a8d(0x203)]+'\x20activation\x20\x27'+_0x27b567[_0x4d1a8d(0x21b)]+_0x4d1a8d(0x1e8)+_0x3ff9a6+_0x4d1a8d(0x279)+_0x5619fd,_0x118483);}}return _0x38070a;}export async function executePushFolders(_0x2c700d,_0x265542,_0x5412e0,_0x4575ed,_0x1d3228){const _0x47f06e=a97_0x3d28bc,_0x4a1350=new Map(_0x5412e0);for(const _0x4e80b7 of _0x265542){const _0x5687d3=_0x4e80b7[_0x47f06e(0x277)]('/'),_0x5176d2=_0x5687d3[_0x5687d3[_0x47f06e(0x21a)]-0x1],_0x5a58a7=_0x5687d3['slice'](0x0,-0x1)[_0x47f06e(0x1f3)]('/'),_0x136e9b=_0x4a1350[_0x47f06e(0x272)](_0x5a58a7);_0x1d3228['onProgress']?.({'type':_0x47f06e(0x257),'folder':_0x4e80b7});const _0x199417={'name':_0x5176d2,'parentFolderId':_0x136e9b},_0x4abca5=await _0x1d3228[_0x47f06e(0x21f)](_0x47f06e(0x250)+_0x4e80b7+'\x27...',()=>_0x2c700d['segment'][_0x47f06e(0x1c7)](_0x4575ed['parentId'],_0x199417));_0x4a1350[_0x47f06e(0x207)](_0x4e80b7,_0x4abca5[_0x47f06e(0x1ce)]['id']),_0x1d3228[_0x47f06e(0x292)]?.({'type':_0x47f06e(0x263),'folder':_0x4e80b7,'folderId':_0x4abca5[_0x47f06e(0x1ce)]['id']}),_0x1d3228[_0x47f06e(0x231)]?.(_0x47f06e(0x205)+_0x4e80b7+'\x27');}return _0x4a1350;}export async function executePushSegmentDeletions(_0x3d6139,_0x12c14c,_0x40fe89){const _0x844fcf=a97_0x3d28bc;if(_0x12c14c[_0x844fcf(0x21a)]===0x0)return 0x0;const {batchAsync:_0x316cce}=await import('../../utils/async.js'),_0x235e89=0x5,_0x4c561c=await _0x316cce(_0x12c14c,async _0x26b9d0=>{const _0xee21d1=_0x844fcf;return _0x40fe89[_0xee21d1(0x292)]?.({'type':'segment_deleting','name':_0x26b9d0[_0xee21d1(0x21b)]}),await _0x3d6139[_0xee21d1(0x255)]['deleteSegment'](_0x26b9d0['id']),_0x40fe89[_0xee21d1(0x292)]?.({'type':_0xee21d1(0x249),'name':_0x26b9d0[_0xee21d1(0x21b)]}),_0x40fe89[_0xee21d1(0x1dd)]?.(_0xee21d1(0x1c9)+_0x26b9d0[_0xee21d1(0x21b)]+'\x27'),0x1;},_0x235e89);return _0x4c561c[_0x844fcf(0x253)]((_0x3e08db,_0x554402)=>_0x3e08db+_0x554402,0x0);}export async function executePushJourneys(_0xeb8a8,_0x57f2a1,_0x3fd302,_0xfd0e86,_0x3d1848){const _0x5004f8=a97_0x3d28bc,{journeyDefToRequest:_0x445336}=await import(_0x5004f8(0x287)),{activationDefToCreateRequest:_0x2ba15b,yamlRuleToApi:_0x14dfa0,validateSegmentRule:_0x45c814}=await import(_0x5004f8(0x1fe)),_0x439da5={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x77cb56=new Map(_0x3fd302[_0x5004f8(0x1ca)]),_0x51d8e6=0x5;for(let _0x50d672=0x0;_0x50d672<_0x57f2a1[_0x5004f8(0x21a)];_0x50d672+=_0x51d8e6){const _0x2e985a=_0x57f2a1['slice'](_0x50d672,_0x50d672+_0x51d8e6),_0x363d25=await Promise[_0x5004f8(0x254)](_0x2e985a[_0x5004f8(0x1f8)](async _0x18f2de=>{const _0x1e0102=_0x5004f8;if(!_0x18f2de[_0x1e0102(0x25b)]&&!_0x18f2de[_0x1e0102(0x204)])return{'action':'unchanged','name':_0x18f2de['yamlConfig'][_0x1e0102(0x21b)],'journeyId':_0x18f2de[_0x1e0102(0x271)]?.['id']};const _0x4f7e50=_0x18f2de[_0x1e0102(0x1ed)]?_0x3fd302[_0x1e0102(0x25d)][_0x1e0102(0x272)](_0x18f2de['folderPath']):undefined;_0x3d1848[_0x1e0102(0x292)]?.({'type':_0x18f2de[_0x1e0102(0x25b)]?'journey_creating':_0x1e0102(0x1c8),'name':_0x18f2de[_0x1e0102(0x285)]['name']});try{const _0xf4cd9b=await executeSingleJourneyPush(_0xeb8a8,_0x18f2de,{..._0x3fd302,'segmentNameToId':_0x77cb56},{'parentId':_0xfd0e86[_0x1e0102(0x282)],'rootFolderId':_0xfd0e86[_0x1e0102(0x268)],'folderId':_0x4f7e50,'verbose':_0xfd0e86[_0x1e0102(0x2a6)]},_0x3d1848,{'journeyDefToRequest':_0x445336,'activationDefToCreateRequest':_0x2ba15b,'yamlRuleToApi':_0x14dfa0,'validateSegmentRule':_0x45c814});for(const [_0x4fb75d,_0x5deddb]of _0xf4cd9b[_0x1e0102(0x226)]){_0x77cb56[_0x1e0102(0x207)](_0x4fb75d,_0x5deddb),_0x439da5[_0x1e0102(0x226)][_0x1e0102(0x207)](_0x4fb75d,_0x5deddb);}if(_0xf4cd9b[_0x1e0102(0x1d9)]===_0x1e0102(0x291))_0x3d1848[_0x1e0102(0x292)]?.({'type':'journey_created','name':_0x18f2de[_0x1e0102(0x285)]['name'],'journeyId':_0xf4cd9b[_0x1e0102(0x265)]}),_0x3d1848[_0x1e0102(0x290)]?.(_0x1e0102(0x1e4)+_0x18f2de[_0x1e0102(0x285)][_0x1e0102(0x21b)]+'\x27'),_0x439da5[_0x1e0102(0x291)]++;else _0xf4cd9b[_0x1e0102(0x1d9)]===_0x1e0102(0x29e)&&(_0x3d1848['onProgress']?.({'type':'journey_updated','name':_0x18f2de[_0x1e0102(0x285)][_0x1e0102(0x21b)]}),_0x3d1848['logSuccess']?.('Updated\x20journey\x20\x27'+_0x18f2de[_0x1e0102(0x285)][_0x1e0102(0x21b)]+'\x27'),_0x439da5['updated']++);return{'action':_0xf4cd9b[_0x1e0102(0x1d9)],'name':_0x18f2de[_0x1e0102(0x285)]['name'],'journeyId':_0xf4cd9b[_0x1e0102(0x265)]};}catch(_0x2b7a78){const _0x46ad1f=isHttp400Error(_0x2b7a78),_0x456dce=_0x46ad1f?ErrorCode[_0x1e0102(0x262)]:ErrorCode[_0x1e0102(0x1d4)],_0x35db3d=getErrorMessage(_0x2b7a78);throw new SDKError(_0x456dce,_0x1e0102(0x217)+(_0x18f2de[_0x1e0102(0x25b)]?_0x1e0102(0x275):'update')+_0x1e0102(0x28e)+_0x18f2de[_0x1e0102(0x211)]+_0x1e0102(0x279)+_0x35db3d,_0x2b7a78);}}));_0x439da5[_0x5004f8(0x24f)][_0x5004f8(0x283)](..._0x363d25);}return _0x439da5;}async function executeSingleJourneyPush(_0x2ee861,_0x56c9d3,_0x58f740,_0x3bd836,_0x5dd730,_0x12445d){const _0x25784f=a97_0x3d28bc,{journeyDefToRequest:_0x1c7104,activationDefToCreateRequest:_0x5c5934,yamlRuleToApi:_0x22d030,validateSegmentRule:_0x4f7fa9}=_0x12445d,_0x3f163e=new Map(),_0x29a497=new Map(),_0x59e8cc=new Map(),_0x4b55b8=new Map(),_0x4c64b6=new Map();let _0x13cc0b;const _0x2bd043=async()=>{const _0x17893=a97_0x5045;if(_0x13cc0b)return;_0x13cc0b=new Map();if(!_0x56c9d3[_0x17893(0x271)])return;const _0x3e2819=await _0x2ee861[_0x17893(0x23b)][_0x17893(0x278)](_0x56c9d3[_0x17893(0x271)]['id']);for(const _0x32a989 of _0x3e2819){const _0x5a6fb2=journeyActivationStepToYaml(_0x32a989,_0x58f740[_0x17893(0x215)],_0x58f740[_0x17893(0x244)]),_0x1da9d6=activationSignature(_0x5a6fb2);!_0x13cc0b[_0x17893(0x20f)](_0x1da9d6)&&_0x13cc0b[_0x17893(0x207)](_0x1da9d6,_0x32a989['id']),_0x5a6fb2[_0x17893(0x21b)]&&_0x29a497['set'](_0x5a6fb2[_0x17893(0x21b)],_0x32a989['id']);}};if(_0x56c9d3[_0x25784f(0x271)]&&_0x56c9d3[_0x25784f(0x285)][_0x25784f(0x200)]){const _0x48e0f8=buildLocalExpandedRuleMappings(_0x56c9d3[_0x25784f(0x285)]),_0x4fbb12=_0x48e0f8[_0x25784f(0x1ea)];if(_0x4fbb12[_0x25784f(0x214)]>0x0){const _0x297cb1=new Map();for(const [_0x4c404d,_0x3fadbc]of _0x4fbb12){const _0x531f01=serializeExpandedRule(_0x3fadbc,_0x4fbb12);_0x297cb1[_0x25784f(0x207)](_0x4c404d,_0x531f01);}const _0xdbe714=collectSegmentIdsFromJourneyApi(_0x56c9d3[_0x25784f(0x271)]);if(_0xdbe714[_0x25784f(0x214)]>0x0){const _0xc0a3ac=await buildServerSegmentRuleMap(_0x2ee861,_0x3bd836['parentId'],_0x58f740[_0x25784f(0x234)],_0xdbe714);if(_0xc0a3ac[_0x25784f(0x214)]>0x0){const _0x5c40d2=new Map();for(const [_0x463aa1,_0x4a9016]of _0xc0a3ac){const _0xa130e3=serializeExpandedRule(_0x4a9016,_0xc0a3ac);!_0x5c40d2['has'](_0xa130e3)&&_0x5c40d2[_0x25784f(0x207)](_0xa130e3,_0x463aa1);}for(const [_0x57fb96,_0x46ea18]of _0x297cb1){const _0x2d7b5e=_0x5c40d2['get'](_0x46ea18);_0x2d7b5e&&(_0x4c64b6[_0x25784f(0x207)](_0x57fb96,_0x2d7b5e),_0x58f740[_0x25784f(0x1ca)][_0x25784f(0x207)](_0x57fb96,_0x2d7b5e));}}}}}const _0x5385d4={'resolveSegmentId':async _0x4a1e65=>{const _0x1ba64b=_0x25784f,_0x2881fe=_0x58f740['segmentNameToId'][_0x1ba64b(0x272)](_0x4a1e65);if(!_0x2881fe)throw new SDKError(ErrorCode[_0x1ba64b(0x27e)],'Segment\x20not\x20found:\x20'+_0x4a1e65+_0x1ba64b(0x245)+_0x56c9d3[_0x1ba64b(0x285)][_0x1ba64b(0x21b)]+')');return _0x2881fe;},'resolveEmbeddedSegmentId':async(_0xabeac3,_0x1af8ce)=>{const _0xd0cf83=_0x25784f,_0x3981d9=_0x58f740['segmentNameToId'][_0xd0cf83(0x272)](_0xabeac3);if(_0x3981d9)return _0x3981d9;const _0x3b009e=_0x4c64b6[_0xd0cf83(0x272)](_0xabeac3);if(_0x3b009e)return _0x58f740['segmentNameToId'][_0xd0cf83(0x207)](_0xabeac3,_0x3b009e),_0x3b009e;const _0x5f3dd2=_0x58f740[_0xd0cf83(0x234)][_0xd0cf83(0x22d)](_0x33f6dc=>_0x33f6dc[_0xd0cf83(0x21b)]===_0xabeac3);if(_0x5f3dd2)return _0x58f740[_0xd0cf83(0x1ca)]['set'](_0xabeac3,_0x5f3dd2['id']),_0x5f3dd2['id'];if(_0x56c9d3[_0xd0cf83(0x25b)]){const {stageName:_0x48d161,criteriaName:_0x4c11ca}=findSegmentCriteriaLocation(_0x56c9d3[_0xd0cf83(0x285)],_0xabeac3);return _0x4f7fa9(_0xabeac3,_0x1af8ce[_0xd0cf83(0x1c5)]),_0x59e8cc[_0xd0cf83(0x207)](_0xabeac3,{'definition':_0x1af8ce,'stageName':_0x48d161,'criteriaName':_0x4c11ca}),createPendingSegmentId(_0xabeac3);}const _0x3b3311=_0x56c9d3[_0xd0cf83(0x271)]?.['id'];if(!_0x3b3311)throw new SDKError(ErrorCode['INTERNAL'],_0xd0cf83(0x21d));_0x4f7fa9(_0xabeac3,_0x1af8ce['rule']);const _0x205c93=generateDeterministicJourneySegmentName(_0x56c9d3[_0xd0cf83(0x285)][_0xd0cf83(0x21b)],_0xabeac3),_0x58b143=createSegmentIdResolver(_0x58f740['segmentNameToId'],_0xabeac3),_0x4e375a=await resolveRuleSegmentIds(_0x1af8ce[_0xd0cf83(0x1c5)],_0x58b143),_0x387bd1=await _0x2ee861[_0xd0cf83(0x255)][_0xd0cf83(0x298)]({'name':_0x205c93,'description':_0x1af8ce[_0xd0cf83(0x29b)]||_0xd0cf83(0x1fc)+_0xabeac3,'journeyId':_0x3b3311,'rule':_0x22d030(_0x4e375a,!![]),'countPopulation':!![],'parentFolderId':_0x3bd836['rootFolderId']||'','audienceId':_0x3bd836['parentId']});return _0x58f740[_0xd0cf83(0x1ca)][_0xd0cf83(0x207)](_0xabeac3,_0x387bd1),_0x3f163e[_0xd0cf83(0x207)](_0xabeac3,_0x387bd1),_0x387bd1;},'resolveActivationId':async _0x4b08eb=>{const _0x1a3a34=_0x25784f,_0x23fc63=_0x29a497[_0x1a3a34(0x272)](_0x4b08eb);if(_0x23fc63)return _0x23fc63;if(_0x56c9d3[_0x1a3a34(0x271)]){await _0x2bd043();const _0x371a3a=_0x29a497[_0x1a3a34(0x272)](_0x4b08eb);if(_0x371a3a)return _0x371a3a;}throw new SDKError(ErrorCode[_0x1a3a34(0x22b)],_0x1a3a34(0x1cd)+_0x4b08eb+_0x1a3a34(0x245)+_0x56c9d3['yamlConfig'][_0x1a3a34(0x21b)]+_0x1a3a34(0x1ee)+_0x1a3a34(0x27f));},'resolveEmbeddedActivationId':async(_0xf1ce68,_0xd0c650)=>{const _0x261155=_0x25784f,_0x5045e1=_0x29a497['get'](_0xf1ce68);if(_0x5045e1)return _0x5045e1;if(_0x56c9d3[_0x261155(0x25b)])return _0x4b55b8[_0x261155(0x207)](_0xf1ce68,_0xd0c650),createPendingActivationId(_0xf1ce68);if(_0x56c9d3['existingJourney']){await _0x2bd043();const _0x35d2f7=_0x29a497['get'](_0xd0c650[_0x261155(0x21b)]);if(_0x35d2f7)return _0x29a497[_0x261155(0x207)](_0xf1ce68,_0x35d2f7),_0x35d2f7;const _0x3cef97=activationSignature(_0xd0c650),_0x32e412=_0x13cc0b?.['get'](_0x3cef97);if(_0x32e412)return _0x29a497[_0x261155(0x207)](_0xf1ce68,_0x32e412),_0x32e412;const _0x3558ff=await _0x5c5934(_0xd0c650,_0x58f740['activationContext']),_0x34caa2=await _0x2ee861[_0x261155(0x23b)][_0x261155(0x222)](_0x56c9d3['existingJourney']['id'],_0x3558ff);return _0x29a497[_0x261155(0x207)](_0xf1ce68,_0x34caa2['id']),_0x34caa2['id'];}throw new SDKError(ErrorCode[_0x261155(0x27c)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x2cfa86=>{const _0x36b584=_0x25784f;try{return await _0x2ee861[_0x36b584(0x23b)]['resolveJourneyId'](_0x3bd836['parentId'],_0x2cfa86);}catch(_0x133149){throw new SDKError(ErrorCode[_0x36b584(0x22b)],_0x36b584(0x276)+_0x2cfa86+_0x36b584(0x294)+_0x56c9d3['yamlConfig'][_0x36b584(0x21b)]+'\x27)',_0x133149);}},'resolveStageId':async(_0x1db3cb,_0x29679c)=>{const _0x3cd552=_0x25784f,_0x4869c6=await _0x2ee861[_0x3cd552(0x23b)][_0x3cd552(0x220)](_0x1db3cb),_0xefc0e=_0x4869c6['attributes'][_0x3cd552(0x225)][_0x3cd552(0x22d)](_0x2ee1ae=>_0x2ee1ae[_0x3cd552(0x21b)][_0x3cd552(0x2a3)]()===_0x29679c[_0x3cd552(0x2a3)]());if(!_0xefc0e?.['id'])throw new SDKError(ErrorCode[_0x3cd552(0x22b)],_0x3cd552(0x238)+_0x29679c+_0x3cd552(0x21e)+(_0x4869c6[_0x3cd552(0x23f)][_0x3cd552(0x260)]||_0x4869c6[_0x3cd552(0x23f)][_0x3cd552(0x21b)])+'\x27');return _0xefc0e['id'];}},_0x5e784a=await _0x1c7104(_0x56c9d3[_0x25784f(0x285)],_0x3bd836[_0x25784f(0x282)],_0x5385d4),_0xc9cfd5=_0x3bd836[_0x25784f(0x259)]||_0x3bd836[_0x25784f(0x268)];_0xc9cfd5&&(_0x5e784a[_0x25784f(0x201)]={'parentFolder':{'data':{'id':_0xc9cfd5,'type':'folder'}}});if(_0x56c9d3[_0x25784f(0x25b)]){if(_0x59e8cc[_0x25784f(0x214)]>0x0||_0x4b55b8['size']>0x0)return await executeThreeStepJourneyCreate(_0x2ee861,_0x56c9d3,_0x5e784a,{'pendingEmbeddedSegments':_0x59e8cc,'pendingEmbeddedActivations':_0x4b55b8,'embeddedSegmentNameToId':_0x3f163e,'journeyActivationNameToId':_0x29a497},{..._0x3bd836,'effectiveFolderId':_0xc9cfd5},_0x58f740,_0x5dd730,_0x12445d);else{ensureJourneyDefaults(_0x5e784a[_0x25784f(0x23f)]);const _0x563786=await _0x2ee861[_0x25784f(0x23b)][_0x25784f(0x275)](_0x5e784a);return{'action':_0x25784f(0x291),'journeyId':_0x563786['id'],'embeddedSegmentNameToId':_0x3f163e};}}else{if(_0x56c9d3[_0x25784f(0x204)]&&_0x56c9d3[_0x25784f(0x271)])return ensureJourneyDefaults(_0x5e784a[_0x25784f(0x23f)]),await _0x2ee861[_0x25784f(0x23b)]['update'](_0x56c9d3[_0x25784f(0x271)]['id'],_0x5e784a),{'action':'updated','journeyId':_0x56c9d3['existingJourney']['id'],'embeddedSegmentNameToId':_0x3f163e};}return{'action':_0x25784f(0x273),'journeyId':_0x56c9d3['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x3f163e};}function findSegmentCriteriaLocation(_0x169ab6,_0x157d85){const _0x4410fb=a97_0x3d28bc,_0x4e1d9f=_0x169ab6[_0x4410fb(0x248)]||_0x169ab6[_0x4410fb(0x2a0)]?.[0x0]?.[_0x4410fb(0x248)]||[];let _0xfd98c0=_0x4410fb(0x24a),_0xac7e7f=_0x157d85;const _0x32b27f=_0x169ab6[_0x4410fb(0x22a)]||_0x169ab6[_0x4410fb(0x2a0)]?.[0x0]?.['goal'];if(_0x32b27f?.['segment']===_0x157d85)return{'stageName':_0x4410fb(0x22a),'criteriaName':_0x32b27f['name']||_0x157d85};_0x5df442:for(const _0x449342 of _0x4e1d9f){if(_0x449342[_0x4410fb(0x289)]?.[_0x4410fb(0x255)]===_0x157d85){_0xfd98c0=_0x449342[_0x4410fb(0x21b)],_0xac7e7f=_0x449342[_0x4410fb(0x289)][_0x4410fb(0x21b)]||_0x157d85;break;}if(_0x449342[_0x4410fb(0x243)])for(const _0x53438c of _0x449342[_0x4410fb(0x243)]){if(_0x53438c[_0x4410fb(0x203)]===_0x4410fb(0x223)&&_0x53438c[_0x4410fb(0x206)]?.[_0x4410fb(0x233)])for(const _0x5f16b3 of _0x53438c[_0x4410fb(0x206)][_0x4410fb(0x233)]){if(_0x5f16b3['segment']===_0x157d85){_0xfd98c0=_0x449342['name'],_0xac7e7f=_0x5f16b3['name']||_0x157d85;break _0x5df442;}}}}return{'stageName':_0xfd98c0,'criteriaName':_0xac7e7f};}async function executeThreeStepJourneyCreate(_0x5599e9,_0x2c3487,_0x106657,_0x355ce9,_0x5cb817,_0x1a4f43,_0x3660b9,_0x3d173a){const _0x40885f=a97_0x3d28bc,{activationDefToCreateRequest:_0x43e402,yamlRuleToApi:_0x4cde81}=_0x3d173a,{pendingEmbeddedSegments:_0x40abbb,pendingEmbeddedActivations:_0x4429c7,embeddedSegmentNameToId:_0x2803a4}=_0x355ce9,_0x416233=JSON[_0x40885f(0x258)](JSON[_0x40885f(0x1f1)](_0x106657));ensureJourneyDefaults(_0x416233[_0x40885f(0x23f)]),stripPendingIds(_0x416233);const _0x4fa92f=await _0x5599e9['journey'][_0x40885f(0x275)](_0x416233),_0x5bbb5c=_0x4fa92f['id'],_0x22a7ff=new Map();for(const _0x502e31 of _0x4fa92f['attributes'][_0x40885f(0x225)]){_0x22a7ff[_0x40885f(0x207)](_0x502e31[_0x40885f(0x21b)]['toLowerCase'](),_0x502e31['id']);}for(const [_0x418876,{definition:_0x34ba93}]of _0x40abbb){const _0x46fca9=generateDeterministicJourneySegmentName(_0x2c3487[_0x40885f(0x285)][_0x40885f(0x21b)],_0x418876);_0x3660b9[_0x40885f(0x292)]?.({'type':_0x40885f(0x288),'journeyName':_0x2c3487[_0x40885f(0x285)][_0x40885f(0x21b)],'segmentName':_0x418876});const _0x52a463=createSegmentIdResolver(_0x1a4f43[_0x40885f(0x1ca)],_0x418876),_0x560453=await resolveRuleSegmentIds(_0x34ba93[_0x40885f(0x1c5)],_0x52a463),_0x485f69=await _0x5599e9[_0x40885f(0x255)][_0x40885f(0x298)]({'name':_0x46fca9,'description':_0x34ba93[_0x40885f(0x29b)]||_0x40885f(0x1fc)+_0x418876,'journeyId':_0x5bbb5c,'rule':_0x4cde81(_0x560453,!![]),'countPopulation':!![],'parentFolderId':_0x5cb817[_0x40885f(0x208)]||'','audienceId':_0x5cb817[_0x40885f(0x282)]});_0x2803a4['set'](_0x418876,_0x485f69),_0x1a4f43[_0x40885f(0x1ca)][_0x40885f(0x207)](_0x418876,_0x485f69),_0x3660b9[_0x40885f(0x292)]?.({'type':_0x40885f(0x1e5),'journeyName':_0x2c3487[_0x40885f(0x285)]['name'],'segmentName':_0x418876});}const _0x130d89=new Map();for(const [_0x87e790,_0x23ff4c]of _0x4429c7){_0x3660b9[_0x40885f(0x292)]?.({'type':_0x40885f(0x241),'journeyName':_0x2c3487['yamlConfig'][_0x40885f(0x21b)],'activationName':_0x87e790});const _0x1a5129=await _0x43e402(_0x23ff4c,_0x1a4f43[_0x40885f(0x242)]),_0x383ee2=await _0x5599e9[_0x40885f(0x23b)][_0x40885f(0x222)](_0x5bbb5c,_0x1a5129);_0x130d89['set'](_0x87e790,_0x383ee2['id']),_0x355ce9[_0x40885f(0x213)][_0x40885f(0x207)](_0x87e790,_0x383ee2['id']),_0x3660b9['onProgress']?.({'type':_0x40885f(0x216),'journeyName':_0x2c3487[_0x40885f(0x285)]['name'],'activationName':_0x87e790});}const _0x581d0d=JSON[_0x40885f(0x258)](JSON[_0x40885f(0x1f1)](_0x106657));return _0x581d0d['id']=_0x5bbb5c,ensureJourneyDefaults(_0x581d0d[_0x40885f(0x23f)]),resolvePendingIdsInRequest(_0x581d0d,_0x106657,_0x22a7ff,_0x2803a4,_0x130d89,_0x3660b9),await _0x5599e9[_0x40885f(0x23b)][_0x40885f(0x1ff)](_0x5bbb5c,_0x581d0d),{'action':_0x40885f(0x291),'journeyId':_0x5bbb5c,'embeddedSegmentNameToId':_0x2803a4};}function stripPendingIds(_0x5ec8d5){const _0x2773d3=a97_0x3d28bc;for(const _0x2aeb90 of _0x5ec8d5[_0x2773d3(0x23f)][_0x2773d3(0x225)]||[]){_0x2aeb90[_0x2773d3(0x27a)]?.['segmentId']&&isPendingSegmentId(_0x2aeb90[_0x2773d3(0x27a)][_0x2773d3(0x239)])&&delete _0x2aeb90[_0x2773d3(0x27a)];if(_0x2aeb90['steps'])for(const _0x1140a1 of Object[_0x2773d3(0x26e)](_0x2aeb90['steps'])){const _0x4d8790=_0x2aeb90['steps'][_0x1140a1];_0x4d8790[_0x2773d3(0x203)]==='Activation'&&_0x4d8790[_0x2773d3(0x228)]&&isPendingActivationId(_0x4d8790[_0x2773d3(0x228)])&&(_0x4d8790[_0x2773d3(0x228)]='');if(_0x4d8790[_0x2773d3(0x203)]==='DecisionPoint'&&_0x4d8790[_0x2773d3(0x233)])for(const _0x54fe58 of _0x4d8790[_0x2773d3(0x233)]){_0x54fe58[_0x2773d3(0x239)]&&isPendingSegmentId(_0x54fe58[_0x2773d3(0x239)])&&(_0x54fe58[_0x2773d3(0x239)]='');}}}}function resolvePendingIdsInRequest(_0x366bcc,_0x12e6be,_0x4e60fe,_0x2d1e31,_0x15dd30,_0x137848){const _0x2f948b=a97_0x3d28bc,_0x37b22e=(_0x11e5f0,_0x4088d5)=>{if(!isPendingSegmentId(_0x11e5f0))return _0x11e5f0;const _0x128ebe=extractPendingSegmentName(_0x11e5f0),_0x5af7df=_0x2d1e31['get'](_0x128ebe);return!_0x5af7df&&_0x137848['logWarning']?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x128ebe+'\x27\x20for\x20'+_0x4088d5),_0x5af7df;};if(_0x366bcc[_0x2f948b(0x23f)][_0x2f948b(0x22a)]?.[_0x2f948b(0x239)]&&isPendingSegmentId(_0x366bcc[_0x2f948b(0x23f)][_0x2f948b(0x22a)][_0x2f948b(0x239)])){const _0x1ce30e=_0x37b22e(_0x366bcc['attributes']['goal'][_0x2f948b(0x239)],_0x2f948b(0x230));_0x1ce30e&&(_0x366bcc[_0x2f948b(0x23f)][_0x2f948b(0x22a)]['segmentId']=_0x1ce30e);}for(const _0x4006e4 of _0x366bcc[_0x2f948b(0x23f)][_0x2f948b(0x225)]||[]){const _0x5f1c27=_0x4e60fe['get'](_0x4006e4[_0x2f948b(0x21b)]['toLowerCase']());_0x5f1c27&&(_0x4006e4['id']=_0x5f1c27);if(_0x4006e4[_0x2f948b(0x27a)]?.[_0x2f948b(0x239)]&&isPendingSegmentId(_0x4006e4['entryCriteria']['segmentId'])){const _0x2fb2bf=_0x37b22e(_0x4006e4[_0x2f948b(0x27a)][_0x2f948b(0x239)],_0x2f948b(0x284)+_0x4006e4[_0x2f948b(0x21b)]+_0x2f948b(0x28f));_0x2fb2bf&&(_0x4006e4[_0x2f948b(0x27a)]['segmentId']=_0x2fb2bf);}if(_0x4006e4['exitCriterias'])for(const _0x39a8d2 of _0x4006e4[_0x2f948b(0x235)]){if(_0x39a8d2['segmentId']&&isPendingSegmentId(_0x39a8d2[_0x2f948b(0x239)])){const _0x76d465=_0x37b22e(_0x39a8d2[_0x2f948b(0x239)],_0x2f948b(0x284)+_0x4006e4['name']+_0x2f948b(0x1f9));_0x76d465&&(_0x39a8d2[_0x2f948b(0x239)]=_0x76d465);}}if(_0x4006e4[_0x2f948b(0x1d0)]?.[_0x2f948b(0x239)]&&isPendingSegmentId(_0x4006e4[_0x2f948b(0x1d0)][_0x2f948b(0x239)])){const _0x565037=_0x37b22e(_0x4006e4[_0x2f948b(0x1d0)][_0x2f948b(0x239)],_0x2f948b(0x284)+_0x4006e4['name']+_0x2f948b(0x1cf));_0x565037&&(_0x4006e4[_0x2f948b(0x1d0)][_0x2f948b(0x239)]=_0x565037);}if(_0x4006e4[_0x2f948b(0x243)]){const _0x2ad4a8=_0x2146ad=>_0x12e6be[_0x2f948b(0x23f)]['journeyStages'][_0x2f948b(0x22d)](_0x52d0d7=>_0x52d0d7[_0x2f948b(0x21b)][_0x2f948b(0x2a3)]()===_0x4006e4[_0x2f948b(0x21b)]['toLowerCase']())?.['steps']?.[_0x2146ad];for(const _0x99a6b6 of Object[_0x2f948b(0x26e)](_0x4006e4[_0x2f948b(0x243)])){const _0x2e1443=_0x4006e4[_0x2f948b(0x243)][_0x99a6b6],_0x39fe93=_0x2ad4a8(_0x99a6b6);if(_0x2e1443[_0x2f948b(0x203)]===_0x2f948b(0x22f)&&_0x2e1443[_0x2f948b(0x228)]&&(isPendingActivationId(_0x2e1443[_0x2f948b(0x228)])||_0x2e1443[_0x2f948b(0x228)]==='')){if(_0x39fe93?.[_0x2f948b(0x228)]&&isPendingActivationId(_0x39fe93[_0x2f948b(0x228)])){const _0x643cb=extractPendingActivationName(_0x39fe93[_0x2f948b(0x228)]),_0x16826a=_0x15dd30['get'](_0x643cb);_0x16826a&&(_0x2e1443[_0x2f948b(0x228)]=_0x16826a);}}if(_0x2e1443[_0x2f948b(0x203)]===_0x2f948b(0x224)&&_0x2e1443['branches']&&_0x39fe93?.[_0x2f948b(0x233)])for(let _0x3f735b=0x0;_0x3f735b<_0x2e1443['branches']['length'];_0x3f735b++){const _0x4003f5=_0x2e1443[_0x2f948b(0x233)][_0x3f735b],_0x141a13=_0x39fe93[_0x2f948b(0x233)][_0x3f735b];if(_0x141a13?.['segmentId']&&isPendingSegmentId(_0x141a13[_0x2f948b(0x239)])){const _0x17ff2d=_0x37b22e(_0x141a13[_0x2f948b(0x239)],'stage\x20\x27'+_0x4006e4[_0x2f948b(0x21b)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x4003f5[_0x2f948b(0x21b)]||_0x3f735b)+'\x27');_0x17ff2d&&(_0x4003f5[_0x2f948b(0x239)]=_0x17ff2d);}}}}}}
1
+ const a97_0x560ff4=a97_0x1212;(function(_0x4c1880,_0x587964){const _0x6a83ec=a97_0x1212,_0x4e7ca9=_0x4c1880();while(!![]){try{const _0x1d73f3=-parseInt(_0x6a83ec(0x1f3))/0x1+-parseInt(_0x6a83ec(0x18c))/0x2+-parseInt(_0x6a83ec(0x1ac))/0x3*(parseInt(_0x6a83ec(0x1de))/0x4)+parseInt(_0x6a83ec(0x21e))/0x5*(parseInt(_0x6a83ec(0x20f))/0x6)+-parseInt(_0x6a83ec(0x21c))/0x7+-parseInt(_0x6a83ec(0x1c5))/0x8+parseInt(_0x6a83ec(0x212))/0x9;if(_0x1d73f3===_0x587964)break;else _0x4e7ca9['push'](_0x4e7ca9['shift']());}catch(_0x28c9c9){_0x4e7ca9['push'](_0x4e7ca9['shift']());}}}(a97_0x5250,0x9b75e));import{createHash}from'crypto';export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a97_0x560ff4(0x1b1);export function createPendingSegmentId(_0x32db08){return''+PENDING_SEGMENT_PREFIX+_0x32db08+'__';}export function isPendingSegmentId(_0x22bda4){const _0x74343a=a97_0x560ff4;return _0x22bda4[_0x74343a(0x152)](PENDING_SEGMENT_PREFIX);}export function extractPendingSegmentName(_0x245202){const _0x3619f0=a97_0x560ff4;return _0x245202[_0x3619f0(0x199)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x231542){return''+PENDING_ACTIVATION_PREFIX+_0x231542+'__';}export function isPendingActivationId(_0x251252){const _0xbbf0fe=a97_0x560ff4;return _0x251252[_0xbbf0fe(0x152)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x39f9ab){const _0x4cbc74=a97_0x560ff4;return _0x39f9ab[_0x4cbc74(0x199)](/^__pending_act_(.+)__$/,'$1');}function generateDeterministicJourneySegmentName(_0x50ac73,_0x58939f){const _0x423d33=a97_0x560ff4,_0x30610=_0x50ac73+'::'+(_0x58939f[_0x423d33(0x201)]()||_0x423d33(0x22f)),_0x4b40d7=createHash(_0x423d33(0x19a))[_0x423d33(0x1be)](_0x30610)[_0x423d33(0x1c4)](_0x423d33(0x237))['slice'](0x0,0xc);return _0x423d33(0x1ec)+_0x4b40d7;}export function ensureJourneyDefaults(_0x2f1a6b){const _0xc15899=a97_0x560ff4;!_0x2f1a6b[_0xc15899(0x15a)]&&(_0x2f1a6b['description']=''),!_0x2f1a6b[_0xc15899(0x1bd)]&&(_0x2f1a6b['state']=_0xc15899(0x210));}export function resolveTDFolderPath(_0x35a21a,_0x24a45a,_0x6d87f5){const _0x1d9526=a97_0x560ff4;if(!_0x24a45a)return _0x35a21a;if(_0x35a21a===_0x6d87f5||_0x35a21a[_0x1d9526(0x152)](_0x6d87f5+'/'))return _0x35a21a;return _0x35a21a?_0x6d87f5+'/'+_0x35a21a:_0x6d87f5;}export function addFoldersToCreate(_0x2bef1c,_0x2f512d,_0x1a6b52){const _0x4194c2=a97_0x560ff4;if(!_0x2bef1c)return;if(_0x2f512d['has'](_0x2bef1c))return;const _0x1178e4=_0x2bef1c['split']('/');let _0x1b9638='';for(const _0x1429e1 of _0x1178e4){_0x1b9638=_0x1b9638?_0x1b9638+'/'+_0x1429e1:_0x1429e1,!_0x2f512d[_0x4194c2(0x219)](_0x1b9638)&&_0x1a6b52[_0x4194c2(0x188)](_0x1b9638);}}import*as a97_0xb8392 from'yaml';import{readFileSync}from'fs';import a97_0x2db96c from'path';import{isJourneyDef,parseYamlString as a97_0x549390,toYamlString as a97_0x2102e8,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{validateSegmentDef,validateJourneyDef,formatValidationResult}from'./yaml-validator.js';function stableStringify(_0x4aef2e){const _0x7fa3a3=a97_0x560ff4;if(Array['isArray'](_0x4aef2e))return'['+_0x4aef2e[_0x7fa3a3(0x1b2)](_0x475bd8=>stableStringify(_0x475bd8))[_0x7fa3a3(0x239)](',')+']';if(_0x4aef2e&&typeof _0x4aef2e===_0x7fa3a3(0x1a3)){const _0x2d67ba=_0x4aef2e,_0x535a62=Object['keys'](_0x2d67ba)[_0x7fa3a3(0x1ee)](),_0x29f5dd=_0x535a62['map'](_0x50fb6e=>'\x22'+_0x50fb6e+'\x22:'+stableStringify(_0x2d67ba[_0x50fb6e]));return'{'+_0x29f5dd['join'](',')+'}';}const _0x5dce0a=JSON['stringify'](_0x4aef2e);return _0x5dce0a===undefined?_0x7fa3a3(0x1ea):_0x5dce0a;}function activationSignature(_0x29f343){const _0x1ed725=a97_0x560ff4,_0x50214f={'connection':_0x29f343['connection'],..._0x29f343[_0x1ed725(0x174)]!==undefined&&{'all_columns':_0x29f343['all_columns']},..._0x29f343[_0x1ed725(0x168)]!==undefined&&{'columns':_0x29f343[_0x1ed725(0x168)]},..._0x29f343['behavior']!==undefined&&{'behavior':_0x29f343[_0x1ed725(0x181)]},..._0x29f343[_0x1ed725(0x1b3)]!==undefined&&{'schedule':_0x29f343[_0x1ed725(0x1b3)]},..._0x29f343['notification']!==undefined&&{'notification':_0x29f343[_0x1ed725(0x21b)]},..._0x29f343['connector_config']!==undefined&&{'connector_config':_0x29f343[_0x1ed725(0x213)]},..._0x29f343[_0x1ed725(0x222)]!==undefined&&{'activation_template_id':_0x29f343[_0x1ed725(0x222)]}};return stableStringify(_0x50214f);}export async function prepareSegmentFiles(_0x1415ff,_0x1222e6,_0xf4c7b8,_0x29f32f,_0x464b53){const _0x286a39=a97_0x560ff4,{activationDefToCreateRequest:_0x35b708}=await import(_0x286a39(0x205)),_0x42bd9f=[],_0x494962=new Set();for(const {yamlConfig:_0x3ccf5e,folderPath:_0x3c7ea5,sourcePath:_0x5ea5ec}of _0x1415ff){const _0x5661f7=resolveTDFolderPath(_0x3c7ea5,_0x29f32f,_0x464b53),_0x598750=_0x5661f7+':'+_0x3ccf5e[_0x286a39(0x1eb)],_0x3ea006=_0x1222e6['segmentByFolderAndName'][_0x286a39(0x1e0)](_0x598750),_0x5adfb7=_0x3ea006?_0x1222e6['activationsBySegmentId']['get'](_0x3ea006['id'])||[]:[];addFoldersToCreate(_0x5661f7,_0x1222e6[_0x286a39(0x158)],_0x494962);const _0x96c30c=calculateActivationActions(_0x3ccf5e[_0x286a39(0x218)]||[],_0x5adfb7,_0x1222e6[_0x286a39(0x1ef)],_0x1222e6[_0x286a39(0x1fa)]);for(const _0xbfc212 of _0x96c30c){(_0xbfc212['type']===_0x286a39(0x220)||_0xbfc212[_0x286a39(0x1f7)]===_0x286a39(0x1be))&&_0xbfc212['yamlActivation']&&(_0xbfc212[_0x286a39(0x231)]=await _0x35b708(_0xbfc212[_0x286a39(0x1c8)],_0xf4c7b8));}const _0xd59372=calculateSegmentDiff(_0x3ccf5e,_0x3ea006,_0x5adfb7,_0x1222e6[_0x286a39(0x1ef)],_0x1222e6['connectionIdToNameMap']);_0x42bd9f[_0x286a39(0x1e3)]({'relativePath':_0x3ccf5e[_0x286a39(0x1eb)],'absolutePath':_0x5ea5ec,'yamlConfig':_0x3ccf5e,'folderPath':_0x5661f7,'existingSegment':_0x3ea006,'existingActivations':_0x5adfb7,'isNew':_0xd59372[_0x286a39(0x20b)],'hasChanges':_0xd59372[_0x286a39(0x203)],'diff':_0xd59372['diff'],'activationActions':_0x96c30c});}return{'segmentFiles':_0x42bd9f,'foldersToCreate':_0x494962};}export async function prepareJourneyFiles(_0x3e3b7b,_0x22cd29,_0x230110,_0x1e7562){const _0x586e68=a97_0x560ff4,_0xb6929a=[],_0x501664=new Set();for(const {yamlConfig:_0x1bcab1,folderPath:_0x1c0fd2,sourcePath:_0x211261}of _0x3e3b7b){const _0xd351ed=resolveTDFolderPath(_0x1c0fd2,_0x230110,_0x1e7562),_0x2ebadf=_0xd351ed+':'+_0x1bcab1[_0x586e68(0x1eb)],_0x5a55b8=_0x22cd29[_0x586e68(0x1d9)][_0x586e68(0x1e0)](_0x2ebadf);let _0x4d8c8c,_0x458247;if(_0x5a55b8&&_0x5a55b8[_0x586e68(0x1fc)]>0x0){const _0x19afdb=buildLocalExpandedRuleMappings(_0x1bcab1),{createYamlContext:_0xeed26,prefetchJourneySegments:_0x14bafe}=createPushYamlContextForBundle(_0x22cd29[_0x586e68(0x1c3)],_0x22cd29[_0x586e68(0x226)],_0x22cd29[_0x586e68(0x15f)],_0x19afdb,_0x22cd29[_0x586e68(0x1ef)],_0x22cd29['connectionIdToNameMap'],_0x22cd29['activationStepsById'],_0x22cd29[_0x586e68(0x177)]);await _0x14bafe(_0x5a55b8[_0x586e68(0x1b2)](_0x277c88=>_0x277c88['id']));const _0x385a11=hasMultipleVersions(_0x1bcab1),_0xdeb046=async _0x93f3cd=>{const _0x141f44=_0x586e68,_0x1f8a3b=_0x22cd29[_0x141f44(0x177)]?.['get'](_0x93f3cd);if(_0x1f8a3b)return _0x1f8a3b;return _0x22cd29[_0x141f44(0x159)]({'journeyId':_0x93f3cd,'journeyName':_0x1bcab1['name'],'isMultiVersion':_0x5a55b8['length']>0x1});};if(_0x385a11&&_0x5a55b8[_0x586e68(0x1fc)]>0x1){const _0x1f5bfd=[];for(const _0x1c14b2 of _0x5a55b8){const _0x2e6bd0=_0x1c14b2[_0x586e68(0x238)]||0x1;_0x22cd29[_0x586e68(0x21f)]?.['update'](_0x586e68(0x1f4)+_0x1bcab1['name']+'\x20v'+_0x2e6bd0);const _0x2a8b3c=await _0xdeb046(_0x1c14b2['id']),_0x283746=_0xeed26(_0x1c14b2['id']),_0x52c2d5=await journeyResponseToDef(_0x2a8b3c,_0x283746);_0x1f5bfd['push']({'item':_0x1c14b2,'yaml':_0x52c2d5});}const _0x24707f=buildLocalRuleToNameMappingFromJourney(_0x1bcab1);_0x458247=buildMergedJourneyDef(_0x1f5bfd,_0x24707f);const _0x718147=Math[_0x586e68(0x229)](..._0x1f5bfd[_0x586e68(0x1b2)](_0x6bc99f=>_0x6bc99f[_0x586e68(0x228)][_0x586e68(0x238)]||0x0)),_0x34c782=_0x5a55b8['find'](_0x3d6422=>(_0x3d6422['versionNumber']||0x0)===_0x718147);_0x34c782&&(_0x22cd29[_0x586e68(0x21f)]?.[_0x586e68(0x1be)](_0x586e68(0x1f4)+_0x1bcab1[_0x586e68(0x1eb)]+'\x20v'+_0x718147),_0x4d8c8c=await _0xdeb046(_0x34c782['id']));}else{const _0x2da55a=_0x5a55b8[_0x5a55b8[_0x586e68(0x1fc)]-0x1];_0x22cd29[_0x586e68(0x21f)]?.[_0x586e68(0x1be)](_0x586e68(0x1f4)+_0x1bcab1[_0x586e68(0x1eb)]),_0x4d8c8c=await _0xdeb046(_0x2da55a['id']);const _0x1ec109=_0xeed26(_0x2da55a['id']),_0xb5e8d1=await journeyResponseToDef(_0x4d8c8c,_0x1ec109),_0x450ca0=buildLocalRuleToNameMappingFromJourney(_0x1bcab1);_0x458247=buildMergedJourneyDef([{'item':_0x2da55a,'yaml':_0xb5e8d1}],_0x450ca0);}}addFoldersToCreate(_0xd351ed,_0x22cd29['folderPathToId'],_0x501664);const _0x30d291=calculateJourneyDiff(_0x1bcab1,_0x458247);_0xb6929a[_0x586e68(0x1e3)]({'relativePath':_0x1bcab1['name'],'absolutePath':_0x211261,'yamlConfig':_0x1bcab1,'folderPath':_0xd351ed,'existingJourney':_0x4d8c8c,'isNew':_0x30d291[_0x586e68(0x20b)],'hasChanges':_0x30d291[_0x586e68(0x203)],'diff':_0x30d291[_0x586e68(0x17e)]});}return{'journeyFiles':_0xb6929a,'foldersToCreate':_0x501664};}export function calculateActivationActions(_0x264637,_0x30c090,_0x1a26c1,_0x565f3d){const _0x5bbb72=a97_0x560ff4,_0x3d1f07=[],_0x124970=new Map();for(const _0x4539a8 of _0x30c090){_0x124970[_0x5bbb72(0x1dc)](_0x4539a8[_0x5bbb72(0x1eb)],_0x4539a8);}const _0x3a29e1=new Map();for(const _0x1b0e17 of _0x264637){_0x3a29e1[_0x5bbb72(0x1dc)](_0x1b0e17[_0x5bbb72(0x1eb)],_0x1b0e17);}for(const _0x42eb94 of _0x264637){const _0x416219=_0x124970['get'](_0x42eb94['name']);if(!_0x416219)_0x3d1f07[_0x5bbb72(0x1e3)]({'type':_0x5bbb72(0x220),'name':_0x42eb94[_0x5bbb72(0x1eb)],'yamlActivation':_0x42eb94});else{const _0x6d93ce=activationResponseToDef(_0x416219,_0x1a26c1,_0x565f3d),_0x1559af=a97_0xb8392[_0x5bbb72(0x171)](_0x6d93ce),_0x23a266=a97_0xb8392[_0x5bbb72(0x171)](_0x42eb94);_0x1559af!==_0x23a266&&_0x3d1f07['push']({'type':'update','name':_0x42eb94[_0x5bbb72(0x1eb)],'yamlActivation':_0x42eb94,'existingActivation':_0x416219});}}for(const _0x291943 of _0x30c090){!_0x3a29e1['has'](_0x291943[_0x5bbb72(0x1eb)])&&_0x3d1f07[_0x5bbb72(0x1e3)]({'type':_0x5bbb72(0x1ba),'name':_0x291943[_0x5bbb72(0x1eb)],'existingActivation':_0x291943});}return _0x3d1f07;}export function calculateSegmentDiff(_0x3c43e4,_0x1d0e76,_0x52a5fc,_0x392a36,_0x139e00){const _0x1f83e7=segmentToYamlString(_0x3c43e4);if(_0x1d0e76){const _0x2fac99=segmentWithActivationsToYaml(_0x1d0e76,_0x52a5fc,undefined,_0x392a36,_0x139e00),_0x34361e=segmentToYamlString(_0x2fac99),_0x5b579e=generateDiff(_0x34361e,_0x1f83e7),_0x1d2ae5=hasChanges(_0x5b579e);return{'isNew':![],'hasChanges':_0x1d2ae5,'diff':_0x1d2ae5?formatDiffWithColors(_0x5b579e):undefined};}const _0x21a461=generateDiff('',_0x1f83e7);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x21a461)};}export function calculateJourneyDiff(_0x3c908f,_0x4fcdea){const _0x51ee51=normalizeJourneyDef(_0x3c908f,_0x3c908f),_0x30fa21=a97_0x2102e8(_0x51ee51);if(_0x4fcdea){const _0x2aa852=normalizeJourneyDef(_0x4fcdea,_0x3c908f),_0x45ce8f=a97_0x2102e8(_0x2aa852),_0x2887c4=generateDiff(_0x45ce8f,_0x30fa21),_0x479d95=hasChanges(_0x2887c4);return{'isNew':![],'hasChanges':_0x479d95,'diff':_0x479d95?formatDiffWithColors(_0x2887c4):undefined};}const _0x145415=generateDiff('',_0x30fa21);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x145415)};}export function findSegmentsToDelete(_0x3f0117,_0x339c3e,_0x12286f,_0x3719f4,_0x57d561){const _0x5c7e40=a97_0x560ff4,_0x3aa199=new Set();for(const {yamlConfig:_0x3079c8,folderPath:_0x1d9c1d}of _0x339c3e){_0x3aa199[_0x5c7e40(0x188)](_0x1d9c1d+':'+_0x3079c8[_0x5c7e40(0x1eb)]);}return _0x3f0117[_0x5c7e40(0x207)](_0x25009d=>{const _0x9d821e=_0x5c7e40,_0x5ea117=_0x25009d[_0x9d821e(0x185)]?_0x12286f[_0x9d821e(0x1e0)](_0x25009d['segmentFolderId'][_0x9d821e(0x19d)]())||'':'',_0xe9073f=_0x5ea117+':'+_0x25009d['name'];if(_0x3aa199['has'](_0xe9073f))return![];if(_0x57d561)return _0x5ea117===_0x3719f4||_0x5ea117[_0x9d821e(0x152)](_0x3719f4+'/');return!![];});}export function findJourneysToDelete(_0x5196e3,_0x3fc073,_0x3f266a,_0x3e94c9,_0x3e1925){const _0x2dc3ea=a97_0x560ff4,_0x15f486=new Set();for(const {yamlConfig:_0x1f3f61,folderPath:_0x638c8c}of _0x3fc073){_0x15f486['add'](_0x638c8c+':'+_0x1f3f61[_0x2dc3ea(0x1eb)]);}return _0x5196e3[_0x2dc3ea(0x207)](_0x4ee722=>{const _0x18de69=_0x2dc3ea,_0x50d68d=_0x4ee722[_0x18de69(0x1dd)]?_0x3f266a[_0x18de69(0x1e0)](_0x4ee722[_0x18de69(0x1dd)])||'':'',_0x377177=_0x50d68d+':'+_0x4ee722['journeyBundleName'];if(_0x15f486[_0x18de69(0x219)](_0x377177))return![];if(_0x3e1925)return _0x50d68d===_0x3e94c9||_0x50d68d['startsWith'](_0x3e94c9+'/');return!![];});}export function buildSegmentLookupMap(_0x3ac4bc,_0x169ecd){const _0x41b742=a97_0x560ff4,_0x41d48c=new Map();for(const _0x2cb70e of _0x3ac4bc){const _0x548b92=_0x2cb70e[_0x41b742(0x185)]?_0x169ecd[_0x41b742(0x1e0)](_0x2cb70e[_0x41b742(0x185)][_0x41b742(0x19d)]())||'':'',_0x546a67=_0x548b92+':'+_0x2cb70e['name'];_0x41d48c[_0x41b742(0x1dc)](_0x546a67,_0x2cb70e);}return _0x41d48c;}export function buildSegmentNameToIdMap(_0x5e5264){const _0x3bed8f=a97_0x560ff4,_0x17598a=new Map();for(const _0x42e0ff of _0x5e5264){_0x17598a[_0x3bed8f(0x1dc)](_0x42e0ff['name'],_0x42e0ff['id']);}return _0x17598a;}export function buildJourneyBundleLookupMap(_0x4188d1,_0x2f207){const _0x5e1e2e=a97_0x560ff4,_0x3e2807=new Map();for(const _0x5054ff of _0x4188d1){const _0x9b070d=_0x5054ff[_0x5e1e2e(0x1dd)]?_0x2f207['get'](_0x5054ff[_0x5e1e2e(0x1dd)])||'':'',_0x3535bb=_0x9b070d+':'+_0x5054ff[_0x5e1e2e(0x16b)];!_0x3e2807['has'](_0x3535bb)&&_0x3e2807['set'](_0x3535bb,[]),_0x3e2807['get'](_0x3535bb)[_0x5e1e2e(0x1e3)](_0x5054ff);}for(const _0x219fd7 of _0x3e2807['values']()){_0x219fd7[_0x5e1e2e(0x1ee)]((_0x4aa529,_0x285886)=>(_0x4aa529[_0x5e1e2e(0x238)]||0x0)-(_0x285886[_0x5e1e2e(0x238)]||0x0));}return _0x3e2807;}export function collectFoldersToCreate(_0x2ff323,_0x25a833){const _0x19772d=a97_0x560ff4,_0x318df3=new Set();for(const _0x5c4f38 of _0x2ff323){if(!_0x5c4f38)continue;if(_0x25a833[_0x19772d(0x219)](_0x5c4f38))continue;const _0xe148bd=_0x5c4f38[_0x19772d(0x163)]('/');let _0x2eda42='';for(const _0x189bfd of _0xe148bd){_0x2eda42=_0x2eda42?_0x2eda42+'/'+_0x189bfd:_0x189bfd,!_0x25a833['has'](_0x2eda42)&&_0x318df3[_0x19772d(0x188)](_0x2eda42);}}return _0x318df3;}export function parseAndClassifyYamlFiles(_0x45e547,_0x534690,_0x55863b){const _0x431953=a97_0x560ff4,_0x4705eb=[],_0x260653=[];for(const _0x900b9b of _0x45e547){const _0x65e1b0=a97_0x2db96c['relative'](_0x534690,a97_0x2db96c[_0x431953(0x1cc)](_0x900b9b)),_0x481f1a=_0x65e1b0==='.'?'':_0x65e1b0,_0x5f04cf=readFileSync(_0x900b9b,_0x431953(0x236)),_0x433641=a97_0xb8392[_0x431953(0x1a1)](_0x5f04cf);if(isJourneyDef(_0x433641)){const _0x1c1610=a97_0x549390(_0x5f04cf);_0x260653['push']({'yamlConfig':_0x1c1610,'folderPath':_0x481f1a,'sourcePath':_0x900b9b});}else{if(!_0x55863b?.[_0x431953(0x1e7)]){const _0x846256=parseSegmentYamlFile(_0x5f04cf),_0x5a4ebf=normalizeChildSegmentYaml(_0x846256);_0x4705eb[_0x431953(0x1e3)]({'yamlConfig':_0x5a4ebf,'folderPath':_0x481f1a,'sourcePath':_0x900b9b});}}}return{'segments':_0x4705eb,'journeys':_0x260653};}export function validateParsedFiles(_0x1a9cd3,_0x110447){const _0x3cf9f5=a97_0x560ff4,_0x5bf0ec=[];for(const {yamlConfig:_0x42add8,sourcePath:_0x117609}of _0x1a9cd3[_0x3cf9f5(0x1a6)]){const _0x187280=readFileSync(_0x117609,_0x3cf9f5(0x236)),_0xdfa143=a97_0xb8392[_0x3cf9f5(0x1b9)](_0x187280),_0x39f798=validateSegmentDef(_0x42add8,{'source':_0x187280,'document':_0xdfa143});if(!_0x39f798[_0x3cf9f5(0x216)]){const _0x23b515=a97_0x2db96c[_0x3cf9f5(0x1f2)](_0x110447,_0x117609);_0x5bf0ec[_0x3cf9f5(0x1e3)]({'filePath':_0x23b515,'source':_0x187280,'result':_0x39f798,'isJourney':![]});}}for(const {yamlConfig:_0x22b1bf,sourcePath:_0x42451a}of _0x1a9cd3[_0x3cf9f5(0x1d8)]){const _0x542fb6=readFileSync(_0x42451a,_0x3cf9f5(0x236)),_0x403fd5=a97_0xb8392[_0x3cf9f5(0x1b9)](_0x542fb6),_0x325d42=validateJourneyDef(_0x22b1bf,{'source':_0x542fb6,'document':_0x403fd5});if(!_0x325d42[_0x3cf9f5(0x216)]){const _0x23dab1=a97_0x2db96c[_0x3cf9f5(0x1f2)](_0x110447,_0x42451a);_0x5bf0ec[_0x3cf9f5(0x1e3)]({'filePath':_0x23dab1,'source':_0x542fb6,'result':_0x325d42,'isJourney':!![]});}}return _0x5bf0ec;}export function formatValidationErrors(_0x25a323){const _0x7cfdd6=a97_0x560ff4,_0x5b1c9c=[];for(const {filePath:_0x51161b,source:_0x58eca1,result:_0x30d348,isJourney:_0x27b320}of _0x25a323){const _0x30ee21=_0x27b320?_0x7cfdd6(0x22a):_0x7cfdd6(0x22f);_0x5b1c9c[_0x7cfdd6(0x1e3)]('\x0a'+_0x51161b+'\x20('+_0x30ee21+_0x7cfdd6(0x22d)+_0x30d348[_0x7cfdd6(0x18e)][_0x7cfdd6(0x1fc)]+_0x7cfdd6(0x1f8)),_0x5b1c9c[_0x7cfdd6(0x1e3)](formatValidationResult(_0x30d348,_0x58eca1,_0x51161b));}return _0x5b1c9c['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x2bf80d){const _0x510885=a97_0x560ff4,_0x3c784c=new Set(),_0x10f391=new Map(),_0x440ad0=collectSegmentUsageCounts(_0x2bf80d);if(_0x2bf80d[_0x510885(0x1a6)])for(const [_0xc0fab2,_0x3a75c1]of Object[_0x510885(0x1f0)](_0x2bf80d[_0x510885(0x1a6)])){_0x3c784c[_0x510885(0x188)](_0xc0fab2);if(_0x3a75c1[_0x510885(0x1f1)]){const _0x2b5835=yamlRuleToApi(_0x3a75c1[_0x510885(0x1f1)]),_0x23ec00=apiRuleToYaml(_0x2b5835);_0x10f391[_0x510885(0x1dc)](_0xc0fab2,_0x23ec00);}}const _0x168883=new Map();let _0x17794a=0x0;for(const [_0x4e60c5,_0x373d6c]of _0x10f391){const _0x33e381=serializeExpandedRule(_0x373d6c,_0x10f391),_0x5776c4=_0x168883[_0x510885(0x1e0)](_0x33e381)||[];_0x5776c4[_0x510885(0x1e3)]({'name':_0x4e60c5,'index':_0x17794a}),_0x168883[_0x510885(0x1dc)](_0x33e381,_0x5776c4),_0x17794a++;}const _0x34b5de=new Map();for(const [_0x2eec24,_0x1ebd6c]of _0x168883){const _0x585c9=_0x1ebd6c[_0x510885(0x223)]()['sort']((_0x298cf4,_0x11722f)=>{const _0x5d69ac=_0x510885,_0xc0a177=_0x440ad0[_0x5d69ac(0x1e0)](_0x298cf4[_0x5d69ac(0x1eb)])||0x0,_0x3f72c1=_0x440ad0['get'](_0x11722f[_0x5d69ac(0x1eb)])||0x0;if(_0xc0a177!==_0x3f72c1)return _0x3f72c1-_0xc0a177;return _0x298cf4[_0x5d69ac(0x190)]-_0x11722f[_0x5d69ac(0x190)];})[_0x510885(0x1b2)](_0x231f11=>_0x231f11[_0x510885(0x1eb)]),_0x13c58c=[];for(const _0x2f3ef6 of _0x585c9){const _0x3a18ef=_0x440ad0['get'](_0x2f3ef6)||0x0,_0x539906=Math[_0x510885(0x229)](_0x3a18ef,0x1);for(let _0x4060d6=0x0;_0x4060d6<_0x539906;_0x4060d6++){_0x13c58c[_0x510885(0x1e3)](_0x2f3ef6);}}_0x34b5de[_0x510885(0x1dc)](_0x2eec24,_0x13c58c);}return{'existingLocalSegmentNames':_0x3c784c,'localSegmentRules':_0x10f391,'localExpandedRuleToNames':_0x34b5de};}async function buildServerSegmentRuleMap(_0x534005,_0x58ca4c,_0x119e86,_0x1ad652){const _0x1dd72c=new Map(),_0x3a86d3=new Set(),_0x371b5b=async _0x698588=>{const _0x256dcf=a97_0x1212;if(_0x3a86d3[_0x256dcf(0x219)](_0x698588))return;_0x3a86d3[_0x256dcf(0x188)](_0x698588);let _0x224a4a=_0x119e86['find'](_0x17d6b4=>_0x17d6b4['id']===_0x698588);if(!_0x224a4a)try{_0x224a4a=await _0x534005[_0x256dcf(0x22f)][_0x256dcf(0x1d6)](_0x58ca4c,_0x698588);}catch{return;}if(!_0x224a4a?.['rule'])return;const _0x55324c=apiRuleToYaml(_0x224a4a[_0x256dcf(0x1f1)]);_0x1dd72c['set'](_0x698588,_0x55324c);const _0x25955e=collectSegmentRefsFromRule(_0x55324c);for(const _0x3204fe of _0x25955e){await _0x371b5b(_0x3204fe);}};for(const _0x26e9dc of _0x1ad652){await _0x371b5b(_0x26e9dc);}return _0x1dd72c;}export function createSegmentIdResolver(_0x5aeb48,_0x4b0063){return async _0x4d22b8=>{const _0x51790b=a97_0x1212,_0x3db8cc=_0x5aeb48[_0x51790b(0x1e0)](_0x4d22b8);if(!_0x3db8cc)throw new SDKError(ErrorCode[_0x51790b(0x161)],_0x51790b(0x1a4)+_0x4d22b8+_0x51790b(0x1e5)+_0x4b0063+'\x27)');return _0x3db8cc;};}export function extractRootFolderId(_0x42e494){const _0x130d28=a97_0x560ff4;return _0x42e494['relationships']?.[_0x130d28(0x1fe)]?.[_0x130d28(0x154)]?.['id']||_0x42e494[_0x130d28(0x166)]?.[_0x130d28(0x1b8)]?.['data']?.['id'];}export function buildConnectionMaps(_0x120cc0){const _0x153253=a97_0x560ff4,_0x48f753=new Map(),_0x3a3351=new Map(),_0x197abf=new Map();for(const _0x47f254 of _0x120cc0){_0x48f753[_0x153253(0x1dc)](_0x47f254[_0x153253(0x1eb)],parseInt(_0x47f254['id'],0xa)),_0x3a3351[_0x153253(0x1dc)](_0x47f254['id'],_0x47f254[_0x153253(0x1eb)]),_0x197abf[_0x153253(0x1dc)](_0x47f254[_0x153253(0x1eb)],_0x47f254[_0x153253(0x1f7)]);}return{'nameToId':_0x48f753,'idToName':_0x3a3351,'nameToType':_0x197abf};}export function calculatePushStats(_0x5a0750,_0xdd14d7,_0x2337ed,_0x3c2a32,_0x2b12a7,_0x3888d8,_0x359da8){const _0xd896a8=a97_0x560ff4,_0x4fe4ce=_0x5a0750[_0xd896a8(0x207)](_0x20b319=>_0x20b319[_0xd896a8(0x20b)]),_0x1173c6=_0x5a0750[_0xd896a8(0x207)](_0x27ffee=>!_0x27ffee['isNew']&&_0x27ffee['hasChanges']),_0x32b5f2=_0x5a0750['filter'](_0x43205b=>!_0x43205b[_0xd896a8(0x20b)]&&!_0x43205b['hasChanges']),_0xa67c1e=_0x3888d8?_0x3c2a32:[],_0x5e1675=_0xdd14d7[_0xd896a8(0x207)](_0x356d02=>_0x356d02[_0xd896a8(0x20b)]),_0x23b922=_0xdd14d7[_0xd896a8(0x207)](_0x556d55=>!_0x556d55['isNew']&&_0x556d55[_0xd896a8(0x203)]),_0x3d38f1=_0xdd14d7[_0xd896a8(0x207)](_0x43f00b=>!_0x43f00b[_0xd896a8(0x20b)]&&!_0x43f00b[_0xd896a8(0x203)]),_0xf9e8a5=_0x3888d8?_0x2b12a7:[],_0x223f1a=_0x5a0750[_0xd896a8(0x221)](_0x25f0a7=>_0x25f0a7[_0xd896a8(0x235)]),_0x399abe=_0x223f1a['filter'](_0x5a68ba=>_0x5a68ba[_0xd896a8(0x1f7)]===_0xd896a8(0x220)),_0x18d834=_0x223f1a['filter'](_0x49ea52=>_0x49ea52[_0xd896a8(0x1f7)]===_0xd896a8(0x1be)),_0x3f0c16=_0x223f1a[_0xd896a8(0x207)](_0x5abb68=>_0x5abb68[_0xd896a8(0x1f7)]==='delete'),_0x2c2b88=Array[_0xd896a8(0x178)](_0x2337ed)[_0xd896a8(0x1ee)](),_0x1c6372=_0x359da8?![]:_0x4fe4ce['length']>0x0||_0x1173c6[_0xd896a8(0x1fc)]>0x0||_0xa67c1e[_0xd896a8(0x1fc)]>0x0,_0x16e5b3=_0x5e1675[_0xd896a8(0x1fc)]>0x0||_0x23b922['length']>0x0||_0xf9e8a5[_0xd896a8(0x1fc)]>0x0,_0x10d45f=_0x359da8?![]:_0x223f1a[_0xd896a8(0x1fc)]>0x0,_0x4c5644=_0x2c2b88['length']>0x0;return{'segments':{'new':_0x4fe4ce,'changed':_0x1173c6,'unchanged':_0x32b5f2,'toDelete':_0xa67c1e},'journeys':{'new':_0x5e1675,'changed':_0x23b922,'unchanged':_0x3d38f1,'toDelete':_0xf9e8a5},'activations':{'all':_0x223f1a,'toCreate':_0x399abe,'toUpdate':_0x18d834,'toDelete':_0x3f0c16},'folders':{'toCreate':_0x2c2b88},'counts':{'segments':{'new':_0x4fe4ce[_0xd896a8(0x1fc)],'changed':_0x1173c6['length'],'unchanged':_0x32b5f2['length'],'toDelete':_0xa67c1e[_0xd896a8(0x1fc)]},'journeys':{'new':_0x5e1675['length'],'changed':_0x23b922[_0xd896a8(0x1fc)],'unchanged':_0x3d38f1[_0xd896a8(0x1fc)],'toDelete':_0xf9e8a5[_0xd896a8(0x1fc)]},'activations':{'create':_0x399abe[_0xd896a8(0x1fc)],'update':_0x18d834[_0xd896a8(0x1fc)],'delete':_0x3f0c16['length']},'folders':_0x2c2b88[_0xd896a8(0x1fc)]},'hasChanges':_0x1c6372||_0x16e5b3||_0x10d45f||_0x4c5644};}export async function buildPushExecutionContext(_0x356962,_0x842a40,_0x50d738,_0x11f436,_0x335fe2,_0x1dc97d){const _0x49d8f9=a97_0x560ff4,_0x1c1cdb=extractRootFolderId(_0x50d738),{pathToId:_0x4e2735,idToPath:_0x2afb90}=buildFolderMaps(_0x335fe2),_0x8786d5=buildSegmentNameToIdMap(_0x11f436),_0x378df5=new Map(),{batchAsync:_0xf91aea}=await import(_0x49d8f9(0x1d7)),[_0x1922be,_0x23a06a]=await Promise[_0x49d8f9(0x160)]([_0x356962[_0x49d8f9(0x214)][_0x49d8f9(0x179)](),_0x356962[_0x49d8f9(0x1ae)][_0x49d8f9(0x1c7)](),((async()=>{const _0x5eed9b=_0x49d8f9;!_0x1dc97d&&_0x11f436[_0x5eed9b(0x1fc)]>0x0&&await _0xf91aea(_0x11f436,async _0x387f36=>{const _0x545bda=_0x5eed9b,_0x4379df=await _0x356962[_0x545bda(0x22f)]['listActivations'](_0x842a40,_0x387f36['id']);_0x378df5[_0x545bda(0x1dc)](_0x387f36['id'],_0x4379df);});})())]),{emailToId:_0xf506b4,idToEmail:_0x3d51c2}=_0x1922be,_0x264212=buildConnectionMaps(_0x23a06a);return{'rootFolderId':_0x1c1cdb,'folderPathToId':_0x4e2735,'folderIdToPath':_0x2afb90,'segmentNameToId':_0x8786d5,'activationsBySegmentId':_0x378df5,'emailToIdMap':_0xf506b4,'idToEmailMap':_0x3d51c2,'connectionNameToIdMap':_0x264212[_0x49d8f9(0x1ff)],'connectionIdToNameMap':_0x264212['idToName'],'connectionNameToTypeMap':_0x264212[_0x49d8f9(0x17a)]};}export function createPushYamlContextForBundle(_0x391d43,_0x4ce54e,_0xfda393,_0x3f5064,_0x2ebb4d,_0x4cee59,_0x497795,_0xe1ae82){const {existingLocalSegmentNames:_0x1d9a4e,localExpandedRuleToNames:_0x4c91ca}=_0x3f5064,_0x14d525=new Set(),_0x693b33=new Map(),_0x1cdafc=new Set(),_0x4b6a32=new Map(),_0x1925fa=new Map(),_0x456989=createJumpTargetCache(),_0x4f1525=new Map(),_0x443ba1=new Map(),_0x23c676=new Set();let _0x57ac18;const _0x2a6500=_0x5a85b9=>{const _0x343e15={'resolveSegment':async _0x84207f=>{const _0x68f589=a97_0x1212,_0x4e593f=_0x1925fa[_0x68f589(0x1e0)](_0x84207f);if(_0x4e593f!==undefined)return{'name':_0x4e593f,'isJourneyLocal':!![]};try{let _0x51850a=_0xfda393[_0x68f589(0x16e)](_0x4ec7f2=>_0x4ec7f2['id']===_0x84207f);!_0x51850a&&(_0x51850a=await _0x391d43[_0x68f589(0x22f)][_0x68f589(0x1d6)](_0x4ce54e,_0x84207f));const _0x5c6628=generateJourneyLocalName(_0x51850a[_0x68f589(0x1eb)]),_0x42f01d=_0x51850a[_0x68f589(0x19b)]===SEGMENT_KIND_JOURNEY&&_0x5c6628!==undefined;let _0x26a0b8=_0x51850a[_0x68f589(0x1eb)],_0x486460;if(_0x42f01d&&_0x51850a['rule']){const _0x57b71c=apiRuleToYaml(_0x51850a['rule']);_0x443ba1[_0x68f589(0x1dc)](_0x84207f,_0x57b71c);const _0x4a61cc=async _0x31936a=>{const _0x2916d6=_0x68f589,_0x9bed2d=collectSegmentRefsFromRule(_0x31936a);for(const _0x45ab37 of _0x9bed2d){if(!_0x443ba1['has'](_0x45ab37))try{const _0x5adb5d=await _0x391d43[_0x2916d6(0x22f)][_0x2916d6(0x1d6)](_0x4ce54e,_0x45ab37);if(_0x5adb5d?.['rule']){const _0x4dfc34=apiRuleToYaml(_0x5adb5d[_0x2916d6(0x1f1)]);_0x443ba1[_0x2916d6(0x1dc)](_0x45ab37,_0x4dfc34),await _0x4a61cc(_0x4dfc34);}}catch{}}};await _0x4a61cc(_0x57b71c);const _0x1ee747=serializeExpandedRule(_0x57b71c,_0x443ba1),_0x31c223=_0x4c91ca[_0x68f589(0x1e0)](_0x1ee747);if(_0x31c223&&_0x31c223[_0x68f589(0x1fc)]>0x0){const _0x5c6ef3=_0x693b33[_0x68f589(0x1e0)](_0x1ee747)||0x0,_0x26bfe6=_0x31c223[_0x5c6ef3]||_0x31c223[_0x31c223[_0x68f589(0x1fc)]-0x1];_0x693b33['set'](_0x1ee747,_0x5c6ef3+0x1),_0x26a0b8=_0x26bfe6,_0x14d525[_0x68f589(0x188)](_0x26a0b8),_0x1925fa['set'](_0x84207f,_0x26a0b8);const _0x38a7ff=await resolveRuleSegmentRefs(_0x57b71c,async _0x3c9915=>{const _0x5275a9=_0x68f589,_0x56c3ab=_0x1925fa['get'](_0x3c9915);if(_0x56c3ab)return _0x56c3ab;const _0x4e8e19=await _0x57ac18[_0x5275a9(0x1c0)](_0x3c9915);return _0x4e8e19[_0x5275a9(0x1eb)];});_0x486460={'description':_0x51850a[_0x68f589(0x15a)],'rule':_0x38a7ff};}else{const _0x1ebedb=_0x4f1525['get'](_0x1ee747);if(_0x1ebedb)_0x26a0b8=_0x1ebedb,_0x1925fa[_0x68f589(0x1dc)](_0x84207f,_0x26a0b8);else{if(_0x5c6628){let _0x4b504f=_0x5c6628,_0x777c43=0x2;while(_0x14d525[_0x68f589(0x219)](_0x4b504f)||_0x1d9a4e[_0x68f589(0x219)](_0x4b504f)){_0x4b504f=_0x5c6628+'_'+_0x777c43,_0x777c43++;}_0x14d525[_0x68f589(0x188)](_0x4b504f),_0x26a0b8=_0x4b504f;}_0x1925fa[_0x68f589(0x1dc)](_0x84207f,_0x26a0b8),_0x4f1525['set'](_0x1ee747,_0x26a0b8);const _0x113512=await resolveRuleSegmentRefs(_0x57b71c,async _0x3ef2b9=>{const _0x3caaf0=_0x68f589,_0x17bc2b=_0x1925fa[_0x3caaf0(0x1e0)](_0x3ef2b9);if(_0x17bc2b)return _0x17bc2b;const _0xef1e5=await _0x57ac18[_0x3caaf0(0x1c0)](_0x3ef2b9);return _0xef1e5['name'];});_0x486460={'description':_0x51850a[_0x68f589(0x15a)],'rule':_0x113512};}}}return{'name':_0x26a0b8,'isJourneyLocal':_0x42f01d,'definition':_0x486460};}catch{return{'name':_0x84207f,'isJourneyLocal':![]};}},'resolveActivation':async _0x47235c=>{const _0x1bf3ed=a97_0x1212,_0x44281f=_0x4b6a32[_0x1bf3ed(0x1e0)](_0x47235c);if(_0x44281f!==undefined)return{'name':_0x44281f,'isJourneyLocal':!![]};try{let _0x2f0eb6=_0x497795?.[_0x1bf3ed(0x1e0)](_0x47235c);!_0x2f0eb6&&(_0x2f0eb6=await _0x391d43[_0x1bf3ed(0x22a)]['getActivation'](_0x5a85b9,_0x47235c));const _0x2f5604=_0x2f0eb6[_0x1bf3ed(0x1bc)][_0x1bf3ed(0x184)][_0x1bf3ed(0x1eb)]||_0x47235c,_0x5413d1=sanitizeYamlKey(_0x2f5604)||'activation_'+_0x47235c;let _0x48e01f=_0x5413d1,_0x3e1eb2=0x2;while(_0x1cdafc[_0x1bf3ed(0x219)](_0x48e01f)){_0x48e01f=_0x5413d1+'_'+_0x3e1eb2,_0x3e1eb2++;}_0x1cdafc[_0x1bf3ed(0x188)](_0x48e01f),_0x4b6a32[_0x1bf3ed(0x1dc)](_0x47235c,_0x48e01f);const _0x249bcb=journeyActivationStepToYaml(_0x2f0eb6,_0x2ebb4d,_0x4cee59);return{'name':_0x48e01f,'isJourneyLocal':!![],'definition':_0x249bcb};}catch{return{'name':_0x47235c,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x14d32c,_0x3816a4)=>resolveJumpTarget(_0x14d32c,_0x3816a4,_0x456989,async _0x49d576=>{const _0x533449=a97_0x1212,_0x221542=_0xe1ae82?.[_0x533449(0x1e0)](_0x49d576);if(_0x221542)return _0x221542;return _0x391d43[_0x533449(0x22a)][_0x533449(0x172)](_0x49d576);})};return _0x57ac18=_0x343e15,_0x343e15;},_0x3b346d=async _0x74ab31=>{const _0x3a0891=a97_0x1212,{collectSegmentIdsFromJourneyApi:_0x17af12}=await import(_0x3a0891(0x155)),{batchAsync:_0xb3278a}=await import(_0x3a0891(0x1d7)),_0x538fa8=new Set();for(const _0xbeca48 of _0x74ab31){let _0x3c6f4a=_0xe1ae82?.['get'](_0xbeca48);!_0x3c6f4a&&(_0x3c6f4a=await _0x391d43[_0x3a0891(0x22a)][_0x3a0891(0x172)](_0xbeca48));const _0x213919=_0x17af12(_0x3c6f4a);for(const _0x559150 of _0x213919){_0x538fa8[_0x3a0891(0x188)](_0x559150);}}let _0x3e3abd=Array[_0x3a0891(0x178)](_0x538fa8);while(_0x3e3abd[_0x3a0891(0x1fc)]>0x0){const _0x268e8a=_0x3e3abd[_0x3a0891(0x207)](_0x5dc85b=>!_0x23c676['has'](_0x5dc85b));if(_0x268e8a[_0x3a0891(0x1fc)]===0x0)break;const _0x154723=await _0xb3278a(_0x268e8a,async _0x268232=>{const _0x305d1f=_0x3a0891;_0x23c676[_0x305d1f(0x188)](_0x268232);let _0x545c7e=_0xfda393[_0x305d1f(0x16e)](_0x7f695f=>_0x7f695f['id']===_0x268232);if(!_0x545c7e)try{_0x545c7e=await _0x391d43['segment'][_0x305d1f(0x1d6)](_0x4ce54e,_0x268232);}catch{return null;}return{'segmentId':_0x268232,'segment':_0x545c7e};},0xa),_0x1b9388=new Set();for(const _0x2f4ad6 of _0x154723){if(!_0x2f4ad6?.[_0x3a0891(0x22f)]?.['rule'])continue;const _0x4601b8=apiRuleToYaml(_0x2f4ad6[_0x3a0891(0x22f)]['rule']);_0x443ba1[_0x3a0891(0x1dc)](_0x2f4ad6[_0x3a0891(0x17b)],_0x4601b8);const _0x25d35a=collectSegmentRefsFromRule(_0x4601b8);for(const _0x4b50d1 of _0x25d35a){!_0x23c676[_0x3a0891(0x219)](_0x4b50d1)&&_0x1b9388[_0x3a0891(0x188)](_0x4b50d1);}}_0x3e3abd=Array['from'](_0x1b9388);}};return{'createYamlContext':_0x2a6500,'prefetchJourneySegments':_0x3b346d};}export async function executePushSegments(_0x237086,_0x3d8685,_0x10e2a4,_0xe68e60,_0x179af4){const _0x3b3b05=a97_0x560ff4,{segmentDefToCreateRequest:_0x2807c7,segmentDefToUpdateRequest:_0xdf6594}=await import(_0x3b3b05(0x205)),_0x46a043=_0x10e2a4[_0x3b3b05(0x158)],_0x551c41=0x5,_0x5e76ad=async _0x40012a=>{const _0x2f8836=_0x3b3b05,_0x45f2f5=_0x40012a[_0x2f8836(0x194)]?_0x46a043['get'](_0x40012a[_0x2f8836(0x194)]):undefined;let _0x545fb1;const _0x2ea72f={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};try{if(_0x40012a[_0x2f8836(0x20b)]){_0x179af4[_0x2f8836(0x15c)]?.({'type':'segment_creating','name':_0x40012a['yamlConfig']['name']});const _0x454752=_0x2807c7(_0x40012a[_0x2f8836(0x1a5)],_0x45f2f5),_0x5b3cd4=await _0x179af4[_0x2f8836(0x18f)](_0x2f8836(0x1cf)+_0x40012a[_0x2f8836(0x1a5)][_0x2f8836(0x1eb)]+_0x2f8836(0x224),()=>_0x237086[_0x2f8836(0x22f)][_0x2f8836(0x208)](_0xe68e60[_0x2f8836(0x226)],_0x454752));_0x545fb1=_0x5b3cd4[_0x2f8836(0x154)]['id'],_0x2ea72f[_0x2f8836(0x164)]={'name':_0x40012a['yamlConfig'][_0x2f8836(0x1eb)],'id':_0x545fb1},_0x179af4[_0x2f8836(0x15c)]?.({'type':_0x2f8836(0x234),'name':_0x40012a[_0x2f8836(0x1a5)][_0x2f8836(0x1eb)],'segmentId':_0x545fb1}),_0x179af4['logSuccess']?.(_0x2f8836(0x1fb)+_0x40012a[_0x2f8836(0x1a5)]['name']+'\x27'),_0x2ea72f[_0x2f8836(0x162)]=0x1;}else{if(_0x40012a[_0x2f8836(0x203)]){_0x179af4['onProgress']?.({'type':_0x2f8836(0x195),'name':_0x40012a[_0x2f8836(0x1a5)][_0x2f8836(0x1eb)]});const _0xfeb70d=_0xdf6594(_0x40012a[_0x2f8836(0x1a5)]);_0x45f2f5!==_0x40012a['existingSegment']?.[_0x2f8836(0x185)]&&(_0xfeb70d[_0x2f8836(0x185)]=_0x45f2f5?parseInt(_0x45f2f5,0xa):undefined),await _0x179af4['withProgress']('Updating\x20segment\x20\x27'+_0x40012a['yamlConfig'][_0x2f8836(0x1eb)]+_0x2f8836(0x224),()=>_0x237086[_0x2f8836(0x22f)][_0x2f8836(0x1d2)](_0xe68e60[_0x2f8836(0x226)],_0x40012a[_0x2f8836(0x16c)]['id'],_0xfeb70d)),_0x545fb1=_0x40012a[_0x2f8836(0x16c)]['id'],_0x179af4['onProgress']?.({'type':_0x2f8836(0x1c1),'name':_0x40012a['yamlConfig'][_0x2f8836(0x1eb)]}),_0x179af4[_0x2f8836(0x1c6)]?.('Updated\x20segment\x20\x27'+_0x40012a[_0x2f8836(0x1a5)]['name']+'\x27'),_0x2ea72f[_0x2f8836(0x1e6)]=0x1;}else _0x545fb1=_0x40012a['existingSegment']['id'];}}catch(_0x29445f){const _0x500320=isHttp400Error(_0x29445f),_0x564ad6=_0x500320?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x2f8836(0x1cb)],_0x11d4d6=getErrorMessage(_0x29445f);throw new SDKError(_0x564ad6,_0x2f8836(0x230)+(_0x40012a[_0x2f8836(0x20b)]?_0x2f8836(0x220):_0x2f8836(0x1be))+'\x20segment\x20from\x20file:\x20'+_0x40012a[_0x2f8836(0x156)]+_0x2f8836(0x1ce)+_0x11d4d6,_0x29445f);}try{const _0x36672b=await syncActivationsForSegment(_0x237086,_0xe68e60[_0x2f8836(0x226)],_0x545fb1,_0x40012a['yamlConfig']['name'],_0x40012a[_0x2f8836(0x235)],_0x179af4,_0x40012a['absolutePath']);_0x2ea72f[_0x2f8836(0x218)]=_0x36672b;}catch(_0x4ad1a3){if(_0x4ad1a3 instanceof SDKError)throw _0x4ad1a3;throw new SDKError(ErrorCode[_0x2f8836(0x22b)],_0x2f8836(0x1a8)+_0x40012a[_0x2f8836(0x1a5)][_0x2f8836(0x1eb)]+_0x2f8836(0x16d)+_0x40012a[_0x2f8836(0x156)]+'\x0a\x20\x20'+getErrorMessage(_0x4ad1a3),_0x4ad1a3);}return _0x2ea72f;},_0x288cd0=await batchAsync(_0x3d8685,_0x5e76ad,_0x551c41),_0x10de56={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x21dfdd of _0x288cd0){_0x10de56[_0x3b3b05(0x162)]+=_0x21dfdd[_0x3b3b05(0x162)],_0x10de56[_0x3b3b05(0x1e6)]+=_0x21dfdd['updated'],_0x21dfdd[_0x3b3b05(0x164)]&&_0x10de56[_0x3b3b05(0x20c)][_0x3b3b05(0x1dc)](_0x21dfdd[_0x3b3b05(0x164)][_0x3b3b05(0x1eb)],_0x21dfdd[_0x3b3b05(0x164)]['id']),_0x10de56[_0x3b3b05(0x218)][_0x3b3b05(0x162)]+=_0x21dfdd[_0x3b3b05(0x218)][_0x3b3b05(0x162)],_0x10de56['activations'][_0x3b3b05(0x1e6)]+=_0x21dfdd[_0x3b3b05(0x218)][_0x3b3b05(0x1e6)],_0x10de56[_0x3b3b05(0x218)][_0x3b3b05(0x1a7)]+=_0x21dfdd[_0x3b3b05(0x218)][_0x3b3b05(0x1a7)];}return _0x10de56;}async function syncActivationsForSegment(_0x51e575,_0x3c5fcc,_0x33bc63,_0x5702d3,_0x2110ed,_0x2d77d3,_0x20e595){const _0x4ceb60=a97_0x560ff4,_0x4881e2={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x26f601 of _0x2110ed){try{if(_0x26f601[_0x4ceb60(0x1f7)]===_0x4ceb60(0x220)&&_0x26f601[_0x4ceb60(0x231)])_0x2d77d3[_0x4ceb60(0x15c)]?.({'type':'activation_creating','segmentName':_0x5702d3,'activationName':_0x26f601['name']}),await _0x2d77d3['withProgress']('Creating\x20activation\x20\x27'+_0x26f601[_0x4ceb60(0x1eb)]+_0x4ceb60(0x224),()=>_0x51e575[_0x4ceb60(0x22f)]['createActivation'](_0x3c5fcc,_0x33bc63,_0x26f601['validatedRequest'])),_0x2d77d3[_0x4ceb60(0x15c)]?.({'type':_0x4ceb60(0x19f),'segmentName':_0x5702d3,'activationName':_0x26f601['name']}),_0x2d77d3[_0x4ceb60(0x1c6)]?.('Created\x20activation\x20\x27'+_0x26f601[_0x4ceb60(0x1eb)]+'\x27'),_0x4881e2[_0x4ceb60(0x162)]++;else{if(_0x26f601[_0x4ceb60(0x1f7)]===_0x4ceb60(0x1be)&&_0x26f601[_0x4ceb60(0x231)]&&_0x26f601['existingActivation'])_0x2d77d3['onProgress']?.({'type':_0x4ceb60(0x202),'segmentName':_0x5702d3,'activationName':_0x26f601[_0x4ceb60(0x1eb)]}),await _0x2d77d3[_0x4ceb60(0x18f)](_0x4ceb60(0x232)+_0x26f601['name']+_0x4ceb60(0x224),()=>_0x51e575['segment'][_0x4ceb60(0x1c2)](_0x3c5fcc,_0x33bc63,_0x26f601[_0x4ceb60(0x15b)]['id'],_0x26f601[_0x4ceb60(0x231)])),_0x2d77d3[_0x4ceb60(0x15c)]?.({'type':'activation_updated','segmentName':_0x5702d3,'activationName':_0x26f601[_0x4ceb60(0x1eb)]}),_0x2d77d3['logSuccess']?.(_0x4ceb60(0x1ca)+_0x26f601['name']+'\x27'),_0x4881e2[_0x4ceb60(0x1e6)]++;else _0x26f601[_0x4ceb60(0x1f7)]===_0x4ceb60(0x1ba)&&_0x26f601[_0x4ceb60(0x15b)]&&(_0x2d77d3[_0x4ceb60(0x15c)]?.({'type':_0x4ceb60(0x21a),'segmentName':_0x5702d3,'activationName':_0x26f601[_0x4ceb60(0x1eb)]}),await _0x2d77d3['withProgress'](_0x4ceb60(0x186)+_0x26f601[_0x4ceb60(0x1eb)]+_0x4ceb60(0x224),()=>_0x51e575[_0x4ceb60(0x22f)][_0x4ceb60(0x21d)](_0x3c5fcc,_0x33bc63,_0x26f601[_0x4ceb60(0x15b)]['id'])),_0x2d77d3[_0x4ceb60(0x15c)]?.({'type':_0x4ceb60(0x151),'segmentName':_0x5702d3,'activationName':_0x26f601[_0x4ceb60(0x1eb)]}),_0x2d77d3['logDeleted']?.(_0x4ceb60(0x197)+_0x26f601['name']+'\x27'),_0x4881e2['deleted']++);}}catch(_0x3b8caf){const _0x3ec439=isHttp400Error(_0x3b8caf),_0x15819c=_0x3ec439?ErrorCode[_0x4ceb60(0x16f)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x531b41=getErrorMessage(_0x3b8caf);throw new SDKError(_0x15819c,_0x4ceb60(0x230)+_0x26f601['type']+_0x4ceb60(0x20d)+_0x26f601[_0x4ceb60(0x1eb)]+_0x4ceb60(0x16d)+_0x20e595+'\x0a\x20\x20'+_0x531b41,_0x3b8caf);}}return _0x4881e2;}export async function executePushFolders(_0x115a22,_0x19ebd2,_0xa28377,_0x1422c9,_0x5ccafb){const _0x3eb588=a97_0x560ff4,_0x3abd6f=new Map(_0xa28377);for(const _0x403b8f of _0x19ebd2){const _0x581f9a=_0x403b8f['split']('/'),_0x2714e2=_0x581f9a[_0x581f9a[_0x3eb588(0x1fc)]-0x1],_0x38f44b=_0x581f9a['slice'](0x0,-0x1)[_0x3eb588(0x239)]('/'),_0x4ec414=_0x3abd6f['get'](_0x38f44b);_0x5ccafb['onProgress']?.({'type':_0x3eb588(0x153),'folder':_0x403b8f});const _0x393e93={'name':_0x2714e2,'parentFolderId':_0x4ec414},_0x58cd15=await _0x5ccafb[_0x3eb588(0x18f)](_0x3eb588(0x169)+_0x403b8f+_0x3eb588(0x224),()=>_0x115a22[_0x3eb588(0x22f)][_0x3eb588(0x1e2)](_0x1422c9[_0x3eb588(0x226)],_0x393e93));_0x3abd6f[_0x3eb588(0x1dc)](_0x403b8f,_0x58cd15[_0x3eb588(0x154)]['id']),_0x5ccafb[_0x3eb588(0x15c)]?.({'type':'folder_created','folder':_0x403b8f,'folderId':_0x58cd15[_0x3eb588(0x154)]['id']}),_0x5ccafb[_0x3eb588(0x1bf)]?.(_0x3eb588(0x1d4)+_0x403b8f+'\x27');}return _0x3abd6f;}export async function executePushSegmentDeletions(_0x18ca53,_0x510fef,_0x1fe888){const _0x40c683=a97_0x560ff4;if(_0x510fef[_0x40c683(0x1fc)]===0x0)return 0x0;const {batchAsync:_0x4b0483}=await import(_0x40c683(0x1d7)),_0x144e23=0x5,_0x140298=await _0x4b0483(_0x510fef,async _0x56686c=>{const _0x2e0ca5=_0x40c683;return _0x1fe888[_0x2e0ca5(0x15c)]?.({'type':_0x2e0ca5(0x17d),'name':_0x56686c[_0x2e0ca5(0x1eb)]}),await _0x18ca53['segment'][_0x2e0ca5(0x1c9)](_0x56686c['id']),_0x1fe888['onProgress']?.({'type':_0x2e0ca5(0x19c),'name':_0x56686c[_0x2e0ca5(0x1eb)]}),_0x1fe888[_0x2e0ca5(0x191)]?.(_0x2e0ca5(0x165)+_0x56686c[_0x2e0ca5(0x1eb)]+'\x27'),0x1;},_0x144e23);return _0x140298[_0x40c683(0x175)]((_0xd1422b,_0x139f26)=>_0xd1422b+_0x139f26,0x0);}function a97_0x5250(){const _0x11ed1e=['__pending_act_','map','schedule','journeyActivationStepId','JOURNEY_UPDATE_ERROR','INTERNAL','\x27\x20milestone','parentFolder','parseDocument','delete','embedded_segment_creating','attributes','state','update','logInfo','resolveSegment','segment_updated','updateActivation','deps','digest','10128168eeGHIj','logSuccess','list','yamlActivation','deleteSegment','Updated\x20activation\x20\x27','SEGMENT_UPDATE_ERROR','dirname','\x20(referenced\x20in\x20journey\x20','\x0a\x20\x20','Creating\x20segment\x20\x27','stages','listActivations','updateSegmentById','activationContext','Created\x20folder\x20\x27','listSegments','getSegment','../../utils/async.js','journeys','journeyBundlesByFolderAndName','\x27\x20decision\x20point\x20branch\x20\x27','verbose','set','folderId','4yiUkaJ','steps','get',').\x20','createFolder','push','results','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','updated','skipSegments','journey_updated','Activation\x20not\x20found:\x20','null','name','journey_entry_criteria_','entryCriteria','sort','idToEmailMap','entries','rule','relative','274768biWlOp','Fetching\x20','journeyStages','toLowerCase','type','\x20error(s)','embedded_activation_creating','connectionIdToNameMap','Created\x20segment\x20\x27','length','createJourneySegment','parentSegmentFolder','nameToId','journey_created','trim','activation_updating','hasChanges','resolveJourneyId','./child-segment-yaml.js','branches','filter','createSegment','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Created\x20journey\x20\x27','isNew','createdSegmentIds','\x20activation\x20\x27','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','1630272jIsyQV','draft','effectiveFolderId','40577823bFJoxo','connector_config','user','folder','valid','goal\x20criteria','activations','has','activation_deleting','notification','8028230SyKSuP','deleteActivation','20RURVYL','progress','create','flatMap','activation_template_id','slice','\x27...','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','parentId','message','item','max','journey','ACTIVATION_UPDATE_ERROR','NOT_FOUND','):\x20','entry_criteria','segment','Failed\x20to\x20','validatedRequest','Updating\x20activation\x20\x27','createActivation','segment_created','activationActions','utf-8','hex','versionNumber','join','activation_deleted','startsWith','folder_creating','data','./journey-yaml.js','absolutePath','segmentNameToId','folderPathToId','fetchJourney','description','existingActivation','onProgress','\x27\x20entry\x20criteria','journeyId','existingSegments','all','SEGMENT_NOT_FOUND','created','split','createdSegmentId','Deleted\x20segment\x20\x27','relationships','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','columns','Creating\x20folder\x20\x27','with','journeyBundleName','existingSegment','\x27\x20from\x20file:\x20','find','ACTIVATION_SYNTAX_ERROR','\x20journey\x20from\x20file:\x20','stringify','getJourney','embeddedSegmentNameToId','all_columns','reduce','exitCriterias','journeyById','from','buildUserMaps','nameToType','segmentId','action','segment_deleting','diff','Activation','decision_point','behavior','entry','Stage\x20\x27','activationParams','segmentFolderId','Deleting\x20activation\x20\x27','stage\x20\x27','add','existingJourney','goal','unchanged','2108568ozSwgV','embedded_segment_created','errors','withProgress','index','logDeleted','milestone','embedded_activation_created','folderPath','segment_updating','DecisionPoint','Deleted\x20activation\x20\x27','Name\x20has\x20already\x20been\x20taken','replace','sha1','kind','segment_deleted','toString','journeyActivationNameToId','activation_created','logWarning','parse','Entry\x20criteria:\x20','object','Segment\x20not\x20found:\x20','yamlConfig','segments','deleted','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','size','JOURNEY_SYNTAX_ERROR','rootFolderId','3650298XtagTw','journey_updating','connection','includes','Updated\x20journey\x20\x27'];a97_0x5250=function(){return _0x11ed1e;};return a97_0x5250();}export async function executePushJourneys(_0x770291,_0x4b9ab2,_0x1b3e27,_0x2e71ed,_0xb432f7){const _0x31591b=a97_0x560ff4,{journeyDefToRequest:_0x45655c}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0xe58d4a,yamlRuleToApi:_0x4e19c8,validateSegmentRule:_0x20bba6}=await import('./child-segment-yaml.js'),_0x34d8fd={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x3618de=new Map(_0x1b3e27[_0x31591b(0x157)]),_0x21ef5a=0x5;for(let _0x3da41a=0x0;_0x3da41a<_0x4b9ab2['length'];_0x3da41a+=_0x21ef5a){const _0x346734=_0x4b9ab2[_0x31591b(0x223)](_0x3da41a,_0x3da41a+_0x21ef5a),_0x10a8e0=await Promise[_0x31591b(0x160)](_0x346734[_0x31591b(0x1b2)](async _0x4bc995=>{const _0x2ffbb9=_0x31591b;if(!_0x4bc995[_0x2ffbb9(0x20b)]&&!_0x4bc995[_0x2ffbb9(0x203)])return{'action':_0x2ffbb9(0x18b),'name':_0x4bc995[_0x2ffbb9(0x1a5)][_0x2ffbb9(0x1eb)],'journeyId':_0x4bc995[_0x2ffbb9(0x189)]?.['id']};const _0x231a3a=_0x4bc995[_0x2ffbb9(0x194)]?_0x1b3e27[_0x2ffbb9(0x158)][_0x2ffbb9(0x1e0)](_0x4bc995['folderPath']):undefined;_0xb432f7[_0x2ffbb9(0x15c)]?.({'type':_0x4bc995[_0x2ffbb9(0x20b)]?'journey_creating':_0x2ffbb9(0x1ad),'name':_0x4bc995[_0x2ffbb9(0x1a5)]['name']});try{const _0x1851b9=await executeSingleJourneyPush(_0x770291,_0x4bc995,{..._0x1b3e27,'segmentNameToId':_0x3618de},{'parentId':_0x2e71ed[_0x2ffbb9(0x226)],'rootFolderId':_0x2e71ed[_0x2ffbb9(0x1ab)],'folderId':_0x231a3a,'verbose':_0x2e71ed[_0x2ffbb9(0x1db)]},_0xb432f7,{'journeyDefToRequest':_0x45655c,'activationDefToCreateRequest':_0xe58d4a,'yamlRuleToApi':_0x4e19c8,'validateSegmentRule':_0x20bba6});for(const [_0x37b6de,_0xe5bf1b]of _0x1851b9[_0x2ffbb9(0x173)]){_0x3618de[_0x2ffbb9(0x1dc)](_0x37b6de,_0xe5bf1b),_0x34d8fd[_0x2ffbb9(0x173)][_0x2ffbb9(0x1dc)](_0x37b6de,_0xe5bf1b);}if(_0x1851b9['action']===_0x2ffbb9(0x162))_0xb432f7[_0x2ffbb9(0x15c)]?.({'type':_0x2ffbb9(0x200),'name':_0x4bc995[_0x2ffbb9(0x1a5)][_0x2ffbb9(0x1eb)],'journeyId':_0x1851b9[_0x2ffbb9(0x15e)]}),_0xb432f7[_0x2ffbb9(0x1c6)]?.(_0x2ffbb9(0x20a)+_0x4bc995[_0x2ffbb9(0x1a5)][_0x2ffbb9(0x1eb)]+'\x27'),_0x34d8fd[_0x2ffbb9(0x162)]++;else _0x1851b9[_0x2ffbb9(0x17c)]===_0x2ffbb9(0x1e6)&&(_0xb432f7[_0x2ffbb9(0x15c)]?.({'type':_0x2ffbb9(0x1e8),'name':_0x4bc995[_0x2ffbb9(0x1a5)]['name']}),_0xb432f7[_0x2ffbb9(0x1c6)]?.(_0x2ffbb9(0x1b0)+_0x4bc995[_0x2ffbb9(0x1a5)]['name']+'\x27'),_0x34d8fd[_0x2ffbb9(0x1e6)]++);return{'action':_0x1851b9[_0x2ffbb9(0x17c)],'name':_0x4bc995[_0x2ffbb9(0x1a5)][_0x2ffbb9(0x1eb)],'journeyId':_0x1851b9[_0x2ffbb9(0x15e)]};}catch(_0x1d2410){const _0xcdafa=isHttp400Error(_0x1d2410),_0x3d31f7=_0xcdafa?ErrorCode[_0x2ffbb9(0x1aa)]:ErrorCode[_0x2ffbb9(0x1b5)],_0x4826f8=getErrorMessage(_0x1d2410);throw new SDKError(_0x3d31f7,_0x2ffbb9(0x230)+(_0x4bc995[_0x2ffbb9(0x20b)]?'create':_0x2ffbb9(0x1be))+_0x2ffbb9(0x170)+_0x4bc995['absolutePath']+'\x0a\x20\x20'+_0x4826f8,_0x1d2410);}}));_0x34d8fd[_0x31591b(0x1e4)][_0x31591b(0x1e3)](..._0x10a8e0);}return _0x34d8fd;}async function executeSingleJourneyPush(_0x36392d,_0x1e9664,_0x25c162,_0x4aa9d6,_0x395183,_0x303aa3){const _0x1cab7f=a97_0x560ff4,{journeyDefToRequest:_0x1687c2,activationDefToCreateRequest:_0x3d3318,yamlRuleToApi:_0x44cd90,validateSegmentRule:_0x5bd22b}=_0x303aa3,_0x282f74=new Map(),_0x265d28=new Map(),_0x203e3f=new Map(),_0x174888=new Map(),_0x130828=new Map();let _0x28e735;const _0x4a2786=async()=>{const _0x4d56af=a97_0x1212;if(_0x28e735)return;_0x28e735=new Map();if(!_0x1e9664['existingJourney'])return;const _0x2c7b31=await _0x36392d[_0x4d56af(0x22a)][_0x4d56af(0x1d1)](_0x1e9664[_0x4d56af(0x189)]['id']);for(const _0x53a1c7 of _0x2c7b31){const _0x4c1548=journeyActivationStepToYaml(_0x53a1c7,_0x25c162[_0x4d56af(0x1ef)],_0x25c162['connectionIdToNameMap']),_0x3013dd=activationSignature(_0x4c1548);!_0x28e735['has'](_0x3013dd)&&_0x28e735[_0x4d56af(0x1dc)](_0x3013dd,_0x53a1c7['id']),_0x4c1548[_0x4d56af(0x1eb)]&&_0x265d28[_0x4d56af(0x1dc)](_0x4c1548[_0x4d56af(0x1eb)],_0x53a1c7['id']);}};if(_0x1e9664['existingJourney']&&_0x1e9664['yamlConfig']['segments']){const _0x2a49e0=buildLocalExpandedRuleMappings(_0x1e9664['yamlConfig']),_0xe583ce=_0x2a49e0['localSegmentRules'];if(_0xe583ce[_0x1cab7f(0x1a9)]>0x0){const _0x511129=new Map();for(const [_0x26253d,_0x28924d]of _0xe583ce){const _0x125971=serializeExpandedRule(_0x28924d,_0xe583ce);_0x511129[_0x1cab7f(0x1dc)](_0x26253d,_0x125971);}const _0x468e4b=collectSegmentIdsFromJourneyApi(_0x1e9664[_0x1cab7f(0x189)]);if(_0x468e4b[_0x1cab7f(0x1a9)]>0x0){const _0x36482f=await buildServerSegmentRuleMap(_0x36392d,_0x4aa9d6[_0x1cab7f(0x226)],_0x25c162[_0x1cab7f(0x15f)],_0x468e4b);if(_0x36482f[_0x1cab7f(0x1a9)]>0x0){const _0x1a34d1=new Map();for(const [_0x3640b1,_0x3ff790]of _0x36482f){const _0x2cfc09=serializeExpandedRule(_0x3ff790,_0x36482f);!_0x1a34d1[_0x1cab7f(0x219)](_0x2cfc09)&&_0x1a34d1['set'](_0x2cfc09,_0x3640b1);}for(const [_0x24ac7a,_0x825b3f]of _0x511129){const _0x1eb817=_0x1a34d1[_0x1cab7f(0x1e0)](_0x825b3f);_0x1eb817&&(_0x130828[_0x1cab7f(0x1dc)](_0x24ac7a,_0x1eb817),_0x25c162[_0x1cab7f(0x157)][_0x1cab7f(0x1dc)](_0x24ac7a,_0x1eb817));}}}}}const _0x19edf3={'resolveSegmentId':async _0x277cd9=>{const _0x47110a=_0x1cab7f,_0x2a6a87=_0x25c162[_0x47110a(0x157)][_0x47110a(0x1e0)](_0x277cd9);if(!_0x2a6a87)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x277cd9+_0x47110a(0x1cd)+_0x1e9664[_0x47110a(0x1a5)][_0x47110a(0x1eb)]+')');return _0x2a6a87;},'resolveEmbeddedSegmentId':async(_0x5ab852,_0x5ef114)=>{const _0x5497b8=_0x1cab7f,_0x103e8d=_0x25c162[_0x5497b8(0x157)][_0x5497b8(0x1e0)](_0x5ab852);if(_0x103e8d)return _0x103e8d;const _0x2648f0=_0x130828['get'](_0x5ab852);if(_0x2648f0)return _0x25c162[_0x5497b8(0x157)][_0x5497b8(0x1dc)](_0x5ab852,_0x2648f0),_0x2648f0;const _0x31852f=_0x25c162[_0x5497b8(0x15f)][_0x5497b8(0x16e)](_0x1b3056=>_0x1b3056[_0x5497b8(0x1eb)]===_0x5ab852);if(_0x31852f)return _0x25c162['segmentNameToId']['set'](_0x5ab852,_0x31852f['id']),_0x31852f['id'];if(_0x1e9664['isNew']){const {stageName:_0x5ee4a4,criteriaName:_0x12f1ff}=findSegmentCriteriaLocation(_0x1e9664['yamlConfig'],_0x5ab852);return _0x5bd22b(_0x5ab852,_0x5ef114[_0x5497b8(0x1f1)]),_0x203e3f[_0x5497b8(0x1dc)](_0x5ab852,{'definition':_0x5ef114,'stageName':_0x5ee4a4,'criteriaName':_0x12f1ff}),createPendingSegmentId(_0x5ab852);}const _0x45dc07=_0x1e9664[_0x5497b8(0x189)]?.['id'];if(!_0x45dc07)throw new SDKError(ErrorCode[_0x5497b8(0x1b6)],_0x5497b8(0x20e));_0x5bd22b(_0x5ab852,_0x5ef114['rule']);const _0x991e2c=generateDeterministicJourneySegmentName(_0x1e9664['yamlConfig'][_0x5497b8(0x1eb)],_0x5ab852),_0x2de7a8=_0x25c162[_0x5497b8(0x15f)][_0x5497b8(0x16e)](_0x2cb58f=>_0x2cb58f['name']===_0x991e2c),_0x4e1e27=createSegmentIdResolver(_0x25c162['segmentNameToId'],_0x5ab852),_0x1567a5=await resolveRuleSegmentIds(_0x5ef114[_0x5497b8(0x1f1)],_0x4e1e27);let _0x528a08;if(_0x2de7a8)await _0x36392d['segment'][_0x5497b8(0x1d2)](_0x4aa9d6[_0x5497b8(0x226)],_0x2de7a8['id'],{'description':_0x5ef114[_0x5497b8(0x15a)]||_0x5497b8(0x1a2)+_0x5ab852,'rule':_0x44cd90(_0x1567a5,!![]),'countPopulation':!![]}),_0x528a08=_0x2de7a8['id'];else try{_0x528a08=await _0x36392d['segment']['createJourneySegment']({'name':_0x991e2c,'description':_0x5ef114['description']||_0x5497b8(0x1a2)+_0x5ab852,'journeyId':_0x45dc07,'rule':_0x44cd90(_0x1567a5,!![]),'countPopulation':!![],'parentFolderId':_0x4aa9d6['rootFolderId']||'','audienceId':_0x4aa9d6['parentId']});}catch(_0x37f989){const _0x11599a=_0x37f989 instanceof Error&&_0x37f989[_0x5497b8(0x227)][_0x5497b8(0x1af)](_0x5497b8(0x198));if(_0x11599a){const _0x51da76=await _0x36392d[_0x5497b8(0x22f)][_0x5497b8(0x1d5)](_0x4aa9d6[_0x5497b8(0x226)]),_0x41a757=_0x51da76['find'](_0x225713=>_0x225713[_0x5497b8(0x1eb)]===_0x991e2c);if(_0x41a757)await _0x36392d[_0x5497b8(0x22f)][_0x5497b8(0x1d2)](_0x4aa9d6[_0x5497b8(0x226)],_0x41a757['id'],{'description':_0x5ef114[_0x5497b8(0x15a)]||_0x5497b8(0x1a2)+_0x5ab852,'rule':_0x44cd90(_0x1567a5,!![]),'countPopulation':!![]}),_0x528a08=_0x41a757['id'];else throw _0x37f989;}else throw _0x37f989;}return _0x25c162[_0x5497b8(0x157)][_0x5497b8(0x1dc)](_0x5ab852,_0x528a08),_0x282f74[_0x5497b8(0x1dc)](_0x5ab852,_0x528a08),_0x528a08;},'resolveActivationId':async _0x3a13a5=>{const _0x316208=_0x1cab7f,_0x33b65a=_0x265d28[_0x316208(0x1e0)](_0x3a13a5);if(_0x33b65a)return _0x33b65a;if(_0x1e9664[_0x316208(0x189)]){await _0x4a2786();const _0x13c1ea=_0x265d28['get'](_0x3a13a5);if(_0x13c1ea)return _0x13c1ea;}throw new SDKError(ErrorCode[_0x316208(0x22c)],_0x316208(0x1e9)+_0x3a13a5+_0x316208(0x1cd)+_0x1e9664[_0x316208(0x1a5)][_0x316208(0x1eb)]+_0x316208(0x1e1)+_0x316208(0x209));},'resolveEmbeddedActivationId':async(_0x1622e1,_0x25ee78)=>{const _0xf03413=_0x1cab7f,_0x3849a7=_0x265d28['get'](_0x1622e1);if(_0x3849a7)return _0x3849a7;if(_0x1e9664[_0xf03413(0x20b)])return _0x174888['set'](_0x1622e1,_0x25ee78),createPendingActivationId(_0x1622e1);if(_0x1e9664[_0xf03413(0x189)]){await _0x4a2786();const _0x109463=_0x265d28['get'](_0x25ee78[_0xf03413(0x1eb)]);if(_0x109463)return _0x265d28['set'](_0x1622e1,_0x109463),_0x109463;const _0x47c28d=activationSignature(_0x25ee78),_0x3db397=_0x28e735?.[_0xf03413(0x1e0)](_0x47c28d);if(_0x3db397)return _0x265d28[_0xf03413(0x1dc)](_0x1622e1,_0x3db397),_0x3db397;const _0x306e77=await _0x3d3318(_0x25ee78,_0x25c162[_0xf03413(0x1d3)]),_0x5ee6b2=await _0x36392d[_0xf03413(0x22a)][_0xf03413(0x233)](_0x1e9664[_0xf03413(0x189)]['id'],_0x306e77);return _0x265d28[_0xf03413(0x1dc)](_0x1622e1,_0x5ee6b2['id']),_0x5ee6b2['id'];}throw new SDKError(ErrorCode[_0xf03413(0x1b6)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x1e3528=>{const _0x49e997=_0x1cab7f;try{return await _0x36392d[_0x49e997(0x22a)][_0x49e997(0x204)](_0x4aa9d6['parentId'],_0x1e3528);}catch(_0x3a9f44){throw new SDKError(ErrorCode['NOT_FOUND'],'Journey\x20\x27'+_0x1e3528+_0x49e997(0x167)+_0x1e9664[_0x49e997(0x1a5)][_0x49e997(0x1eb)]+'\x27)',_0x3a9f44);}},'resolveStageId':async(_0x1902e9,_0x332bc6)=>{const _0x2d74bb=_0x1cab7f,_0x15e5d3=await _0x36392d[_0x2d74bb(0x22a)][_0x2d74bb(0x172)](_0x1902e9),_0x52fec0=_0x15e5d3[_0x2d74bb(0x1bc)]['journeyStages'][_0x2d74bb(0x16e)](_0x51f126=>_0x51f126[_0x2d74bb(0x1eb)][_0x2d74bb(0x1f6)]()===_0x332bc6['toLowerCase']());if(!_0x52fec0?.['id'])throw new SDKError(ErrorCode[_0x2d74bb(0x22c)],_0x2d74bb(0x183)+_0x332bc6+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x15e5d3[_0x2d74bb(0x1bc)][_0x2d74bb(0x16b)]||_0x15e5d3['attributes'][_0x2d74bb(0x1eb)])+'\x27');return _0x52fec0['id'];}},_0x220184=await _0x1687c2(_0x1e9664['yamlConfig'],_0x4aa9d6[_0x1cab7f(0x226)],_0x19edf3),_0xdd3374=_0x4aa9d6[_0x1cab7f(0x1dd)]||_0x4aa9d6['rootFolderId'];_0xdd3374&&(_0x220184['relationships']={'parentFolder':{'data':{'id':_0xdd3374,'type':_0x1cab7f(0x215)}}});if(_0x1e9664[_0x1cab7f(0x20b)]){if(_0x203e3f[_0x1cab7f(0x1a9)]>0x0||_0x174888['size']>0x0)return await executeThreeStepJourneyCreate(_0x36392d,_0x1e9664,_0x220184,{'pendingEmbeddedSegments':_0x203e3f,'pendingEmbeddedActivations':_0x174888,'embeddedSegmentNameToId':_0x282f74,'journeyActivationNameToId':_0x265d28},{..._0x4aa9d6,'effectiveFolderId':_0xdd3374},_0x25c162,_0x395183,_0x303aa3);else{ensureJourneyDefaults(_0x220184['attributes']);const _0xf86542=await _0x36392d[_0x1cab7f(0x22a)][_0x1cab7f(0x220)](_0x220184);return{'action':_0x1cab7f(0x162),'journeyId':_0xf86542['id'],'embeddedSegmentNameToId':_0x282f74};}}else{if(_0x1e9664['hasChanges']&&_0x1e9664['existingJourney'])return ensureJourneyDefaults(_0x220184[_0x1cab7f(0x1bc)]),await _0x36392d[_0x1cab7f(0x22a)][_0x1cab7f(0x1be)](_0x1e9664[_0x1cab7f(0x189)]['id'],_0x220184),{'action':_0x1cab7f(0x1e6),'journeyId':_0x1e9664[_0x1cab7f(0x189)]['id'],'embeddedSegmentNameToId':_0x282f74};}return{'action':'unchanged','journeyId':_0x1e9664[_0x1cab7f(0x189)]?.['id'],'embeddedSegmentNameToId':_0x282f74};}function findSegmentCriteriaLocation(_0x56c2d5,_0x14b79c){const _0x3b835e=a97_0x560ff4,_0x19fb97=_0x56c2d5[_0x3b835e(0x1d0)]||_0x56c2d5['journeys']?.[0x0]?.[_0x3b835e(0x1d0)]||[];let _0x3f9f62=_0x3b835e(0x182),_0x48ae3c=_0x14b79c;const _0x689841=_0x56c2d5[_0x3b835e(0x18a)]||_0x56c2d5[_0x3b835e(0x1d8)]?.[0x0]?.[_0x3b835e(0x18a)];if(_0x689841?.[_0x3b835e(0x22f)]===_0x14b79c)return{'stageName':_0x3b835e(0x18a),'criteriaName':_0x689841[_0x3b835e(0x1eb)]||_0x14b79c};_0x5d1069:for(const _0x572c33 of _0x19fb97){if(_0x572c33[_0x3b835e(0x22e)]?.[_0x3b835e(0x22f)]===_0x14b79c){_0x3f9f62=_0x572c33['name'],_0x48ae3c=_0x572c33[_0x3b835e(0x22e)][_0x3b835e(0x1eb)]||_0x14b79c;break;}if(_0x572c33[_0x3b835e(0x1df)])for(const _0x26c129 of _0x572c33[_0x3b835e(0x1df)]){if(_0x26c129['type']===_0x3b835e(0x180)&&_0x26c129[_0x3b835e(0x16a)]?.['branches'])for(const _0x10ce99 of _0x26c129['with'][_0x3b835e(0x206)]){if(_0x10ce99[_0x3b835e(0x22f)]===_0x14b79c){_0x3f9f62=_0x572c33[_0x3b835e(0x1eb)],_0x48ae3c=_0x10ce99[_0x3b835e(0x1eb)]||_0x14b79c;break _0x5d1069;}}}}return{'stageName':_0x3f9f62,'criteriaName':_0x48ae3c};}function a97_0x1212(_0x505e1f,_0x57162b){_0x505e1f=_0x505e1f-0x151;const _0x52501d=a97_0x5250();let _0x1212d3=_0x52501d[_0x505e1f];return _0x1212d3;}async function executeThreeStepJourneyCreate(_0x28708a,_0xba003e,_0x128636,_0x377d97,_0x2168a7,_0x391ca3,_0x204db2,_0x2fc421){const _0x417c11=a97_0x560ff4,{activationDefToCreateRequest:_0x4a4112,yamlRuleToApi:_0x1b7c0c}=_0x2fc421,{pendingEmbeddedSegments:_0x25aed9,pendingEmbeddedActivations:_0x43f4cc,embeddedSegmentNameToId:_0x31c5f7}=_0x377d97,_0x3bd6e2=JSON['parse'](JSON[_0x417c11(0x171)](_0x128636));ensureJourneyDefaults(_0x3bd6e2[_0x417c11(0x1bc)]),stripPendingIds(_0x3bd6e2);const _0x3067a2=await _0x28708a[_0x417c11(0x22a)]['create'](_0x3bd6e2),_0x370e50=_0x3067a2['id'],_0x3e629a=new Map();for(const _0x159442 of _0x3067a2[_0x417c11(0x1bc)][_0x417c11(0x1f5)]){_0x3e629a[_0x417c11(0x1dc)](_0x159442['name']['toLowerCase'](),_0x159442['id']);}for(const [_0x40e58c,{definition:_0x5545f8}]of _0x25aed9){const _0x19cd6f=generateDeterministicJourneySegmentName(_0xba003e[_0x417c11(0x1a5)][_0x417c11(0x1eb)],_0x40e58c);_0x204db2[_0x417c11(0x15c)]?.({'type':_0x417c11(0x1bb),'journeyName':_0xba003e[_0x417c11(0x1a5)]['name'],'segmentName':_0x40e58c});const _0x2cd6d3=createSegmentIdResolver(_0x391ca3[_0x417c11(0x157)],_0x40e58c),_0x3a2c18=await resolveRuleSegmentIds(_0x5545f8[_0x417c11(0x1f1)],_0x2cd6d3),_0x43d8d4=await _0x28708a[_0x417c11(0x22f)][_0x417c11(0x1fd)]({'name':_0x19cd6f,'description':_0x5545f8[_0x417c11(0x15a)]||_0x417c11(0x1a2)+_0x40e58c,'journeyId':_0x370e50,'rule':_0x1b7c0c(_0x3a2c18,!![]),'countPopulation':!![],'parentFolderId':_0x2168a7[_0x417c11(0x211)]||'','audienceId':_0x2168a7[_0x417c11(0x226)]});_0x31c5f7[_0x417c11(0x1dc)](_0x40e58c,_0x43d8d4),_0x391ca3[_0x417c11(0x157)][_0x417c11(0x1dc)](_0x40e58c,_0x43d8d4),_0x204db2['onProgress']?.({'type':_0x417c11(0x18d),'journeyName':_0xba003e[_0x417c11(0x1a5)][_0x417c11(0x1eb)],'segmentName':_0x40e58c});}const _0x516755=new Map();for(const [_0x1dca31,_0x3b965b]of _0x43f4cc){_0x204db2[_0x417c11(0x15c)]?.({'type':_0x417c11(0x1f9),'journeyName':_0xba003e['yamlConfig'][_0x417c11(0x1eb)],'activationName':_0x1dca31});const _0x44a853=await _0x4a4112(_0x3b965b,_0x391ca3[_0x417c11(0x1d3)]),_0x4a0bd1=await _0x28708a['journey'][_0x417c11(0x233)](_0x370e50,_0x44a853);_0x516755[_0x417c11(0x1dc)](_0x1dca31,_0x4a0bd1['id']),_0x377d97[_0x417c11(0x19e)][_0x417c11(0x1dc)](_0x1dca31,_0x4a0bd1['id']),_0x204db2[_0x417c11(0x15c)]?.({'type':_0x417c11(0x193),'journeyName':_0xba003e[_0x417c11(0x1a5)][_0x417c11(0x1eb)],'activationName':_0x1dca31});}const _0xf3c1ec=JSON[_0x417c11(0x1a1)](JSON[_0x417c11(0x171)](_0x128636));return _0xf3c1ec['id']=_0x370e50,ensureJourneyDefaults(_0xf3c1ec['attributes']),resolvePendingIdsInRequest(_0xf3c1ec,_0x128636,_0x3e629a,_0x31c5f7,_0x516755,_0x204db2),await _0x28708a[_0x417c11(0x22a)]['update'](_0x370e50,_0xf3c1ec),{'action':_0x417c11(0x162),'journeyId':_0x370e50,'embeddedSegmentNameToId':_0x31c5f7};}function stripPendingIds(_0x3411b7){const _0x45998e=a97_0x560ff4;for(const _0x2394d0 of _0x3411b7[_0x45998e(0x1bc)][_0x45998e(0x1f5)]||[]){_0x2394d0[_0x45998e(0x1ed)]?.['segmentId']&&isPendingSegmentId(_0x2394d0['entryCriteria'][_0x45998e(0x17b)])&&delete _0x2394d0[_0x45998e(0x1ed)];if(_0x2394d0[_0x45998e(0x1df)])for(const _0x2072ba of Object['keys'](_0x2394d0[_0x45998e(0x1df)])){const _0x32ddf3=_0x2394d0[_0x45998e(0x1df)][_0x2072ba];_0x32ddf3[_0x45998e(0x1f7)]===_0x45998e(0x17f)&&_0x32ddf3['journeyActivationStepId']&&isPendingActivationId(_0x32ddf3[_0x45998e(0x1b4)])&&(_0x32ddf3['journeyActivationStepId']='');if(_0x32ddf3[_0x45998e(0x1f7)]==='DecisionPoint'&&_0x32ddf3[_0x45998e(0x206)])for(const _0x1a9503 of _0x32ddf3[_0x45998e(0x206)]){_0x1a9503[_0x45998e(0x17b)]&&isPendingSegmentId(_0x1a9503[_0x45998e(0x17b)])&&(_0x1a9503[_0x45998e(0x17b)]='');}}}}function resolvePendingIdsInRequest(_0x3c7fea,_0x2c6a3d,_0x2b3144,_0x4a173e,_0xaaee22,_0x3602a1){const _0x294278=a97_0x560ff4,_0x1c2c5d=(_0x393f9a,_0x3e74a4)=>{const _0xb34eb5=a97_0x1212;if(!isPendingSegmentId(_0x393f9a))return _0x393f9a;const _0x67dd59=extractPendingSegmentName(_0x393f9a),_0x27fd37=_0x4a173e['get'](_0x67dd59);return!_0x27fd37&&_0x3602a1[_0xb34eb5(0x1a0)]?.(_0xb34eb5(0x225)+_0x67dd59+'\x27\x20for\x20'+_0x3e74a4),_0x27fd37;};if(_0x3c7fea[_0x294278(0x1bc)][_0x294278(0x18a)]?.[_0x294278(0x17b)]&&isPendingSegmentId(_0x3c7fea[_0x294278(0x1bc)][_0x294278(0x18a)][_0x294278(0x17b)])){const _0x50b436=_0x1c2c5d(_0x3c7fea[_0x294278(0x1bc)][_0x294278(0x18a)][_0x294278(0x17b)],_0x294278(0x217));_0x50b436&&(_0x3c7fea[_0x294278(0x1bc)]['goal'][_0x294278(0x17b)]=_0x50b436);}for(const _0x45a0b8 of _0x3c7fea[_0x294278(0x1bc)][_0x294278(0x1f5)]||[]){const _0x4c7410=_0x2b3144[_0x294278(0x1e0)](_0x45a0b8[_0x294278(0x1eb)][_0x294278(0x1f6)]());_0x4c7410&&(_0x45a0b8['id']=_0x4c7410);if(_0x45a0b8[_0x294278(0x1ed)]?.[_0x294278(0x17b)]&&isPendingSegmentId(_0x45a0b8[_0x294278(0x1ed)][_0x294278(0x17b)])){const _0x2fb77e=_0x1c2c5d(_0x45a0b8[_0x294278(0x1ed)][_0x294278(0x17b)],'stage\x20\x27'+_0x45a0b8[_0x294278(0x1eb)]+_0x294278(0x15d));_0x2fb77e&&(_0x45a0b8['entryCriteria']['segmentId']=_0x2fb77e);}if(_0x45a0b8[_0x294278(0x176)])for(const _0x83a810 of _0x45a0b8[_0x294278(0x176)]){if(_0x83a810[_0x294278(0x17b)]&&isPendingSegmentId(_0x83a810['segmentId'])){const _0x182900=_0x1c2c5d(_0x83a810[_0x294278(0x17b)],_0x294278(0x187)+_0x45a0b8['name']+'\x27\x20exit\x20criteria');_0x182900&&(_0x83a810[_0x294278(0x17b)]=_0x182900);}}if(_0x45a0b8[_0x294278(0x192)]?.[_0x294278(0x17b)]&&isPendingSegmentId(_0x45a0b8[_0x294278(0x192)][_0x294278(0x17b)])){const _0x503fc7=_0x1c2c5d(_0x45a0b8[_0x294278(0x192)]['segmentId'],_0x294278(0x187)+_0x45a0b8['name']+_0x294278(0x1b7));_0x503fc7&&(_0x45a0b8[_0x294278(0x192)][_0x294278(0x17b)]=_0x503fc7);}if(_0x45a0b8[_0x294278(0x1df)]){const _0x76bc31=_0x7796cd=>_0x2c6a3d['attributes'][_0x294278(0x1f5)][_0x294278(0x16e)](_0x1cb030=>_0x1cb030['name'][_0x294278(0x1f6)]()===_0x45a0b8[_0x294278(0x1eb)]['toLowerCase']())?.[_0x294278(0x1df)]?.[_0x7796cd];for(const _0x3c475d of Object['keys'](_0x45a0b8[_0x294278(0x1df)])){const _0x2f8f19=_0x45a0b8['steps'][_0x3c475d],_0x181723=_0x76bc31(_0x3c475d);if(_0x2f8f19['type']==='Activation'&&_0x2f8f19[_0x294278(0x1b4)]&&(isPendingActivationId(_0x2f8f19[_0x294278(0x1b4)])||_0x2f8f19[_0x294278(0x1b4)]==='')){if(_0x181723?.[_0x294278(0x1b4)]&&isPendingActivationId(_0x181723[_0x294278(0x1b4)])){const _0x14b97c=extractPendingActivationName(_0x181723[_0x294278(0x1b4)]),_0x36febe=_0xaaee22[_0x294278(0x1e0)](_0x14b97c);_0x36febe&&(_0x2f8f19['journeyActivationStepId']=_0x36febe);}}if(_0x2f8f19[_0x294278(0x1f7)]===_0x294278(0x196)&&_0x2f8f19['branches']&&_0x181723?.['branches'])for(let _0x58ba60=0x0;_0x58ba60<_0x2f8f19[_0x294278(0x206)]['length'];_0x58ba60++){const _0xed8109=_0x2f8f19[_0x294278(0x206)][_0x58ba60],_0x5019a0=_0x181723['branches'][_0x58ba60];if(_0x5019a0?.['segmentId']&&isPendingSegmentId(_0x5019a0[_0x294278(0x17b)])){const _0x48ffe6=_0x1c2c5d(_0x5019a0['segmentId'],_0x294278(0x187)+_0x45a0b8[_0x294278(0x1eb)]+_0x294278(0x1da)+(_0xed8109[_0x294278(0x1eb)]||_0x58ba60)+'\x27');_0x48ffe6&&(_0xed8109[_0x294278(0x17b)]=_0x48ffe6);}}}}}}