@treasuredata/tdx 2026.7.3 → 2026.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  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/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.d.ts +67 -0
  16. package/dist/commands/claude-command.d.ts.map +1 -1
  17. package/dist/commands/claude-command.js +1 -1
  18. package/dist/commands/claude-command.js.map +1 -1
  19. package/dist/commands/claude-statusline-command.js +1 -1
  20. package/dist/commands/claude-usage-command.js +1 -1
  21. package/dist/commands/command.js +1 -1
  22. package/dist/commands/connection-command.js +1 -1
  23. package/dist/commands/databases.js +1 -1
  24. package/dist/commands/delivery-command.js +1 -1
  25. package/dist/commands/describe.d.ts +11 -0
  26. package/dist/commands/describe.d.ts.map +1 -1
  27. package/dist/commands/describe.js +1 -1
  28. package/dist/commands/describe.js.map +1 -1
  29. package/dist/commands/engage-campaign-pull-command.js +1 -1
  30. package/dist/commands/engage-campaign-push-command.js +1 -1
  31. package/dist/commands/engage-campaign-validate-command.js +1 -1
  32. package/dist/commands/engage-command.js +1 -1
  33. package/dist/commands/engage-template-pull-command.js +1 -1
  34. package/dist/commands/engage-template-push-command.js +1 -1
  35. package/dist/commands/engage-template-validate-command.js +1 -1
  36. package/dist/commands/job-command.d.ts.map +1 -1
  37. package/dist/commands/job-command.js +1 -1
  38. package/dist/commands/job-command.js.map +1 -1
  39. package/dist/commands/journey-command.js +1 -1
  40. package/dist/commands/journey-validate-command.js +1 -1
  41. package/dist/commands/llm-command.d.ts.map +1 -1
  42. package/dist/commands/llm-command.js +1 -1
  43. package/dist/commands/llm-command.js.map +1 -1
  44. package/dist/commands/mcp-command.js +1 -1
  45. package/dist/commands/parent-segment-command.js +1 -1
  46. package/dist/commands/policy-command.js +1 -1
  47. package/dist/commands/profile-command.js +1 -1
  48. package/dist/commands/profiles-command.js +1 -1
  49. package/dist/commands/query-command.js +1 -1
  50. package/dist/commands/schedule-command.js +1 -1
  51. package/dist/commands/segment-command.js +1 -1
  52. package/dist/commands/segment-create-command.js +1 -1
  53. package/dist/commands/segment-fields-command.js +1 -1
  54. package/dist/commands/segment-move-command.js +1 -1
  55. package/dist/commands/segment-pull-command.js +1 -1
  56. package/dist/commands/segment-push-command.js +1 -1
  57. package/dist/commands/segment-update-command.js +1 -1
  58. package/dist/commands/segment-use-command.js +1 -1
  59. package/dist/commands/segment-validate-command.js +1 -1
  60. package/dist/commands/segments.js +1 -1
  61. package/dist/commands/show.js +1 -1
  62. package/dist/commands/status-command.js +1 -1
  63. package/dist/commands/table-deleted.js +1 -1
  64. package/dist/commands/tables.js +1 -1
  65. package/dist/commands/unset-command.js +1 -1
  66. package/dist/commands/upgrade-command.js +1 -1
  67. package/dist/commands/use-command.js +1 -1
  68. package/dist/commands/user-command.js +1 -1
  69. package/dist/commands/work-command.js +1 -1
  70. package/dist/commands/workflow-command.d.ts.map +1 -1
  71. package/dist/commands/workflow-command.js +1 -1
  72. package/dist/commands/workflow-command.js.map +1 -1
  73. package/dist/core/auth.js +1 -1
  74. package/dist/core/command-output.js +1 -1
  75. package/dist/core/config.js +1 -1
  76. package/dist/core/connection-cache.js +1 -1
  77. package/dist/core/constants.js +1 -1
  78. package/dist/core/credential-cache.js +1 -1
  79. package/dist/core/global-context.js +1 -1
  80. package/dist/core/keychain.js +1 -1
  81. package/dist/core/oauth-keychain.js +1 -1
  82. package/dist/core/oauth.js +1 -1
  83. package/dist/core/profile.js +1 -1
  84. package/dist/core/project-config.js +1 -1
  85. package/dist/core/session.js +1 -1
  86. package/dist/core/user-cache.js +1 -1
  87. package/dist/core/version.js +1 -1
  88. package/dist/index.js +1 -1
  89. package/dist/mcp/server.js +1 -1
  90. package/dist/mcp/tools/index.js +1 -1
  91. package/dist/mcp/tools/tdx-run.js +1 -1
  92. package/dist/mcp/tools/tdx-search.js +1 -1
  93. package/dist/mcp/tools/work-create-item.js +1 -1
  94. package/dist/mcp/utils.js +1 -1
  95. package/dist/proxy/claude-usage-tracker.js +1 -1
  96. package/dist/proxy/passthrough-server.js +1 -1
  97. package/dist/proxy/sse-usage-parser.js +1 -1
  98. package/dist/sdk/agent/agent-config.js +1 -1
  99. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  100. package/dist/sdk/agent/agent-yaml.js +1 -1
  101. package/dist/sdk/agent/test/evaluator.js +1 -1
  102. package/dist/sdk/agent/test/executor.js +1 -1
  103. package/dist/sdk/agent/test/index.js +1 -1
  104. package/dist/sdk/agent/test/output.js +1 -1
  105. package/dist/sdk/agent/test/parser.js +1 -1
  106. package/dist/sdk/agent/tool-target-registry.js +1 -1
  107. package/dist/sdk/api.js +1 -1
  108. package/dist/sdk/cas/cas-api-client.d.ts.map +1 -1
  109. package/dist/sdk/cas/cas-api-client.js +1 -1
  110. package/dist/sdk/cas/cas-api-client.js.map +1 -1
  111. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  112. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  113. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  114. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  115. package/dist/sdk/cas/index.js +1 -1
  116. package/dist/sdk/cas/pull-workflow.js +1 -1
  117. package/dist/sdk/cas/push-workflow.js +1 -1
  118. package/dist/sdk/cas/validate-files.js +1 -1
  119. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  120. package/dist/sdk/client/cdp-api-client.js +1 -1
  121. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  122. package/dist/sdk/client/delivery-api-client.js +1 -1
  123. package/dist/sdk/client/endpoints.js +1 -1
  124. package/dist/sdk/client/engage-api-client.js +1 -1
  125. package/dist/sdk/client/http-client.js +1 -1
  126. package/dist/sdk/client/llm-api-client.js +1 -1
  127. package/dist/sdk/client/oauth-refresh.js +1 -1
  128. package/dist/sdk/client/rate-limiter.js +1 -1
  129. package/dist/sdk/client/td-api-client.js +1 -1
  130. package/dist/sdk/client/trino-api-client.js +1 -1
  131. package/dist/sdk/client/workflow-client.js +1 -1
  132. package/dist/sdk/connection-validator.js +1 -1
  133. package/dist/sdk/connection.js +1 -1
  134. package/dist/sdk/delivery.js +1 -1
  135. package/dist/sdk/engage/campaign-pull.js +1 -1
  136. package/dist/sdk/engage/campaign-push.js +1 -1
  137. package/dist/sdk/engage/campaign-validator.js +1 -1
  138. package/dist/sdk/engage/campaign-yaml.js +1 -1
  139. package/dist/sdk/engage/template-pull.js +1 -1
  140. package/dist/sdk/engage/template-push.js +1 -1
  141. package/dist/sdk/engage/template-validator.js +1 -1
  142. package/dist/sdk/engage/template-yaml.js +1 -1
  143. package/dist/sdk/engage/types/campaign-def.js +1 -1
  144. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  145. package/dist/sdk/engage/types/template-schema.js +1 -1
  146. package/dist/sdk/engage.js +1 -1
  147. package/dist/sdk/errors.js +1 -1
  148. package/dist/sdk/index.js +1 -1
  149. package/dist/sdk/io/index.js +1 -1
  150. package/dist/sdk/io/node-filesystem.js +1 -1
  151. package/dist/sdk/job.js +1 -1
  152. package/dist/sdk/journey.js +1 -1
  153. package/dist/sdk/llm/chat-cache.js +1 -1
  154. package/dist/sdk/llm/index.js +1 -1
  155. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  156. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  157. package/dist/sdk/llm/model-factors.js +1 -1
  158. package/dist/sdk/llm/model-factors.js.map +1 -1
  159. package/dist/sdk/llm/user-settings.js +1 -1
  160. package/dist/sdk/personalization.js +1 -1
  161. package/dist/sdk/policy.js +1 -1
  162. package/dist/sdk/query/deleted-table-validation.js +1 -1
  163. package/dist/sdk/query/index.d.ts +9 -1
  164. package/dist/sdk/query/index.d.ts.map +1 -1
  165. package/dist/sdk/query/index.js +1 -1
  166. package/dist/sdk/query/index.js.map +1 -1
  167. package/dist/sdk/query/sql-parser.js +1 -1
  168. package/dist/sdk/realtime.js +1 -1
  169. package/dist/sdk/schedule.js +1 -1
  170. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  171. package/dist/sdk/segment/fields-display.js +1 -1
  172. package/dist/sdk/segment/file-discovery.js +1 -1
  173. package/dist/sdk/segment/journey-utils.js +1 -1
  174. package/dist/sdk/segment/journey-validator.js +1 -1
  175. package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
  176. package/dist/sdk/segment/journey-yaml.js +1 -1
  177. package/dist/sdk/segment/journey-yaml.js.map +1 -1
  178. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  179. package/dist/sdk/segment/parent-segment-yaml.d.ts.map +1 -1
  180. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  181. package/dist/sdk/segment/parent-segment-yaml.js.map +1 -1
  182. package/dist/sdk/segment/pull-workflow.js +1 -1
  183. package/dist/sdk/segment/push-recovery.js +1 -1
  184. package/dist/sdk/segment/push-workflow.js +1 -1
  185. package/dist/sdk/segment/resolution-context.js +1 -1
  186. package/dist/sdk/segment/segment-path-parser.js +1 -1
  187. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  188. package/dist/sdk/segment/segment-validator.js +1 -1
  189. package/dist/sdk/segment/target-resolution.d.ts.map +1 -1
  190. package/dist/sdk/segment/target-resolution.js +1 -1
  191. package/dist/sdk/segment/target-resolution.js.map +1 -1
  192. package/dist/sdk/segment/tdx-config.js +1 -1
  193. package/dist/sdk/segment/types/activation-schema.js +1 -1
  194. package/dist/sdk/segment/types/journey-def.d.ts.map +1 -1
  195. package/dist/sdk/segment/types/journey-def.js +1 -1
  196. package/dist/sdk/segment/types/journey-schema.js +1 -1
  197. package/dist/sdk/segment/types/parent-segment-def.d.ts.map +1 -1
  198. package/dist/sdk/segment/types/segment-def.js +1 -1
  199. package/dist/sdk/segment/types/segment-schema.js +1 -1
  200. package/dist/sdk/segment/validate-files.js +1 -1
  201. package/dist/sdk/segment/yaml-validator.js +1 -1
  202. package/dist/sdk/segment.js +1 -1
  203. package/dist/sdk/types/cdp.d.ts.map +1 -1
  204. package/dist/sdk/types/engage.d.ts.map +1 -1
  205. package/dist/sdk/types/index.js +1 -1
  206. package/dist/sdk/types/llm.d.ts.map +1 -1
  207. package/dist/sdk/types/progress.js +1 -1
  208. package/dist/sdk/types/workspace.d.ts.map +1 -1
  209. package/dist/sdk/types/workspace.js +1 -1
  210. package/dist/sdk/types/workspace.js.map +1 -1
  211. package/dist/sdk/user.js +1 -1
  212. package/dist/sdk/util/format-detector.js +1 -1
  213. package/dist/sdk/util/formatters.js +1 -1
  214. package/dist/sdk/util/index.js +1 -1
  215. package/dist/sdk/util/paginate.js +1 -1
  216. package/dist/sdk/util/tree-formatter.js +1 -1
  217. package/dist/sdk/util/tree-search.js +1 -1
  218. package/dist/sdk/workflow/archive-validation.js +1 -1
  219. package/dist/sdk/workflow/clone-workflow.js +1 -1
  220. package/dist/sdk/workflow/index.js +1 -1
  221. package/dist/sdk/workflow/pull-workflow.js +1 -1
  222. package/dist/sdk/workflow/push-workflow.js +1 -1
  223. package/dist/sdk/workflow/task-graph.js +1 -1
  224. package/dist/sdk/workflow/tdx-config.js +1 -1
  225. package/dist/sdk/workflow/workflow-utils.js +1 -1
  226. package/dist/sdk/workspace/access-tracker.js +1 -1
  227. package/dist/sdk/workspace/frontmatter.js +1 -1
  228. package/dist/sdk/workspace/git.js +1 -1
  229. package/dist/sdk/workspace/index.js +1 -1
  230. package/dist/sdk/workspace/templates.js +1 -1
  231. package/dist/sdk/workspace/weekly.js +1 -1
  232. package/dist/sdk/workspace/wikilinks.js +1 -1
  233. package/dist/test-utils/command-runner.js +1 -1
  234. package/dist/test-utils/factories.js +1 -1
  235. package/dist/test-utils/fixtures.js +1 -1
  236. package/dist/test-utils/http-mock.js +1 -1
  237. package/dist/test-utils/index.js +1 -1
  238. package/dist/utils/async.js +1 -1
  239. package/dist/utils/claude-code-state.d.ts +33 -0
  240. package/dist/utils/claude-code-state.d.ts.map +1 -0
  241. package/dist/utils/claude-code-state.js +1 -0
  242. package/dist/utils/claude-code-state.js.map +1 -0
  243. package/dist/utils/colors.js +1 -1
  244. package/dist/utils/diff.js +1 -1
  245. package/dist/utils/file-permissions.js +1 -1
  246. package/dist/utils/file-reader.js +1 -1
  247. package/dist/utils/github-releases.js +1 -1
  248. package/dist/utils/global-cache.js +1 -1
  249. package/dist/utils/json-loader.js +1 -1
  250. package/dist/utils/local-cache.js +1 -1
  251. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  252. package/dist/utils/logger/formatters/index.js +1 -1
  253. package/dist/utils/logger/handlers/console-handler.js +1 -1
  254. package/dist/utils/logger/handlers/file-handler.js +1 -1
  255. package/dist/utils/logger/handlers/index.js +1 -1
  256. package/dist/utils/logger/handlers/null-handler.js +1 -1
  257. package/dist/utils/logger/index.js +1 -1
  258. package/dist/utils/logger/logger.js +1 -1
  259. package/dist/utils/logger/types.js +1 -1
  260. package/dist/utils/option-validation.js +1 -1
  261. package/dist/utils/process.js +1 -1
  262. package/dist/utils/prompt.js +1 -1
  263. package/dist/utils/proxy-fetch.js +1 -1
  264. package/dist/utils/spinner.js +1 -1
  265. package/dist/utils/sse-parser.js +1 -1
  266. package/dist/utils/string-utils.js +1 -1
  267. package/dist/utils/table-ref-parser.js +1 -1
  268. package/dist/utils/tdx-logger.js +1 -1
  269. package/dist/utils/version-check.js +1 -1
  270. package/package.json +18 -10
@@ -1 +1 @@
1
- function a157_0x18a4(_0x417943,_0x5b18ad){_0x417943=_0x417943-0xa1;const _0xc644=a157_0xc644();let _0x18a493=_0xc644[_0x417943];return _0x18a493;}(function(_0x158a04,_0x140c38){const _0x1d8f49=a157_0x18a4,_0xebb901=_0x158a04();while(!![]){try{const _0x5a1c0e=parseInt(_0x1d8f49(0xe2))/0x1+-parseInt(_0x1d8f49(0xd5))/0x2*(-parseInt(_0x1d8f49(0xb0))/0x3)+parseInt(_0x1d8f49(0xe9))/0x4*(parseInt(_0x1d8f49(0xbe))/0x5)+parseInt(_0x1d8f49(0xd0))/0x6*(parseInt(_0x1d8f49(0xce))/0x7)+-parseInt(_0x1d8f49(0xbf))/0x8+parseInt(_0x1d8f49(0xb9))/0x9+parseInt(_0x1d8f49(0xac))/0xa;if(_0x5a1c0e===_0x140c38)break;else _0xebb901['push'](_0xebb901['shift']());}catch(_0x48a38a){_0xebb901['push'](_0xebb901['shift']());}}}(a157_0xc644,0xd436e));import a157_0x1dc051 from'path';import{existsSync,readFileSync}from'fs';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{sanitizeFileName}from'../../utils/string-utils.js';import{batchAsync}from'../../utils/async.js';import{buildFolderIdToPathMap}from'./resolution-context.js';import{segmentWithActivationsToYaml,segmentToYamlString,segmentResponseToDef,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{journeyResponseToDef,toYamlString as a157_0x1e4119,normalizeJourneyDef,parseYamlString as a157_0x2bc811}from'./journey-yaml.js';function a157_0xc644(){const _0x3d1852=['segmentFolderId','createdAt','Fetching\x20activations','308474RmfEpE','state','Resolving\x20parent\x20segment','Fetching\x20segments,\x20folders,\x20and\x20journeys','push','join','reduce','journey','journeyBundleName','toLowerCase','getSegment','updatedAt','getJourney','1124736WeekNY','Processing\x20segments','audienceId','map','set','isNew','\x20not\x20found\x20in\x20pre-fetched\x20data,\x20skipping','1060tdMYaJ','activation_','Processing\x20journey:\x20','slice','kind','name','Fetching\x20parent\x20segment\x20info','segments/','utf-8','listSegments','all','data','2700130abyYSj','length','versionNumber','getActivation','3XrjuHX','attributes','user','values','Warning:\x20Journey\x20','sort','description','add','listFolders','3646782IwMEZX','targetResourceName','from','folderId','paused','975JeSqIB','10866632GGncJo','rule','getParent','getLatestJourneyId','get','tdx.json','hasChanges','relative','filter','buildIdToEmailMap','.yml','listActivations','size','segment','listJourneysWithDetailsFromParentSegment','775950ICNedm','journeyBundleId','12WIVHac','update'];a157_0xc644=function(){return _0x3d1852;};return a157_0xc644();}import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,createJumpTargetCache,resolveJumpTarget}from'./journey-utils.js';import{createTdxConfigContent}from'./tdx-config.js';function prepareFile(_0x2fa1f6,_0x14a0db,_0x132d62){const _0x579743=a157_0x18a4,_0x5ef3e7=a157_0x1dc051[_0x579743(0xc6)](_0x132d62,_0x2fa1f6);if(existsSync(_0x2fa1f6)){const _0x5c06e7=readFileSync(_0x2fa1f6,_0x579743(0xa8)),_0x140fb1=generateDiff(_0x5c06e7,_0x14a0db),_0x932c4d=hasChanges(_0x140fb1);return{'relativePath':_0x5ef3e7,'absolutePath':_0x2fa1f6,'content':_0x14a0db,'isNew':![],'hasChanges':_0x932c4d,'diff':_0x932c4d?formatDiffWithColors(_0x140fb1):undefined};}return{'relativePath':_0x5ef3e7,'absolutePath':_0x2fa1f6,'content':_0x14a0db,'isNew':!![],'hasChanges':![]};}function getUniqueFileName(_0x9dd03b,_0x2a3c35,_0x2e0a84){const _0x846556=a157_0x18a4,_0x592a55=_0x9dd03b+':'+_0x2a3c35,_0x13f4e1=_0x2e0a84[_0x846556(0xc3)](_0x592a55)||0x0;_0x2e0a84[_0x846556(0xe6)](_0x592a55,_0x13f4e1+0x1);if(_0x13f4e1===0x0)return _0x2a3c35;return _0x2a3c35+'_'+(_0x13f4e1+0x1);}export async function pullSegments(_0x26032d,_0x5c44ac,_0x796bdf={}){const _0x111516=a157_0x18a4,{targetDir:_0x22ce47,progress:_0x34ebd2}=_0x796bdf;_0x34ebd2?.[_0x111516(0xd1)](_0x111516(0xd7));const _0x2b4264=await _0x26032d[_0x111516(0xcc)]['resolveParentId'](_0x5c44ac);_0x34ebd2?.[_0x111516(0xd1)](_0x111516(0xa6));const _0x268d66=await _0x26032d[_0x111516(0xcc)][_0x111516(0xc1)](_0x2b4264),_0x409f6e=_0x268d66[_0x111516(0xb1)][_0x111516(0xa5)];_0x34ebd2?.[_0x111516(0xd1)](_0x111516(0xd8));const [_0xffa570,_0x3c0dc1,_0xc38816]=await Promise[_0x111516(0xaa)]([_0x26032d[_0x111516(0xcc)][_0x111516(0xa9)](_0x2b4264),_0x26032d['segment'][_0x111516(0xb8)](_0x2b4264),_0x26032d[_0x111516(0xdc)][_0x111516(0xcd)](_0x2b4264,{'includeAllVersions':!![]})]),{journeys:_0x4ffb17,activationStepsById:_0x4c7dff}=_0xc38816,_0x598260=new Map();for(const _0x481dae of _0x4ffb17){_0x598260[_0x111516(0xe6)](_0x481dae['id'],_0x481dae);}const _0x427279=_0x4ffb17['map'](_0x559443=>({'id':_0x559443['id'],'name':_0x559443['attributes'][_0x111516(0xa5)],'journeyBundleName':_0x559443[_0x111516(0xb1)][_0x111516(0xdd)]||'','journeyBundleId':_0x559443[_0x111516(0xb1)][_0x111516(0xcf)]||'','versionNumber':_0x559443['attributes'][_0x111516(0xae)],'description':_0x559443[_0x111516(0xb1)][_0x111516(0xb6)],'state':_0x559443[_0x111516(0xb1)][_0x111516(0xd6)],'paused':_0x559443[_0x111516(0xb1)][_0x111516(0xbd)],'audienceId':_0x559443['attributes'][_0x111516(0xe4)],'folderId':_0x559443['relationships']?.['parentFolder']?.[_0x111516(0xab)]?.['id'],'createdAt':_0x559443[_0x111516(0xb1)][_0x111516(0xd3)],'updatedAt':_0x559443[_0x111516(0xb1)][_0x111516(0xe0)]})),_0x4bd2f3=buildFolderIdToPathMap(_0x3c0dc1),_0x311480=_0x22ce47||_0x111516(0xa7)+sanitizeFileName(_0x409f6e);_0x34ebd2?.[_0x111516(0xd1)](_0x111516(0xd4));const _0x357134=new Map();await batchAsync(_0xffa570,async _0x432dd1=>{const _0x261979=_0x111516,_0x36cdca=await _0x26032d['segment'][_0x261979(0xca)](_0x2b4264,_0x432dd1['id']);_0x357134['set'](_0x432dd1['id'],_0x36cdca);}),_0x34ebd2?.[_0x111516(0xd1)]('Fetching\x20users\x20and\x20connections');const [_0x4fc524,_0x512c61]=await Promise[_0x111516(0xaa)]([_0x26032d[_0x111516(0xb2)][_0x111516(0xc8)](),_0x26032d['connection']['buildIdToNameMap']()]),_0x5451fc=[],_0x178470=new Map(),_0x5d2904=a157_0x1dc051[_0x111516(0xda)](_0x311480,_0x111516(0xc4)),_0x3a680a=createTdxConfigContent(_0x409f6e);_0x5451fc[_0x111516(0xd9)](prepareFile(_0x5d2904,_0x3a680a,_0x311480));const _0x3be592=new Map();for(const _0x2fe690 of _0xffa570){_0x3be592[_0x111516(0xe6)](_0x2fe690['id'],_0x2fe690);}let _0x5d9e98=_0xffa570;if(_0x796bdf[_0x111516(0xba)]){const _0xcc5bc1=_0xffa570['filter'](_0x4c3ef9=>_0x4c3ef9[_0x111516(0xa5)]['toLowerCase']()===_0x796bdf[_0x111516(0xba)][_0x111516(0xde)]());_0xcc5bc1[_0x111516(0xad)]>0x0&&(_0x5d9e98=_0xcc5bc1);}_0x34ebd2?.[_0x111516(0xd1)](_0x111516(0xe3));for(const _0x26a2bb of _0x5d9e98){if(_0x26a2bb[_0x111516(0xa4)]===SEGMENT_KIND_JOURNEY)continue;const _0x17c34a=_0x26a2bb[_0x111516(0xd2)]?_0x4bd2f3[_0x111516(0xc3)](_0x26a2bb['segmentFolderId'])||'':'',_0x1eb31b=_0x357134['get'](_0x26a2bb['id'])||[],_0x2d0cc5=segmentWithActivationsToYaml(_0x26a2bb,_0x1eb31b,undefined,_0x4fc524,_0x512c61),_0x2d8f3b=_0x17c34a?a157_0x1dc051[_0x111516(0xda)](_0x311480,_0x17c34a):_0x311480,_0x4ec16d=sanitizeFileName(_0x26a2bb[_0x111516(0xa5)]),_0x4ec252=getUniqueFileName(_0x2d8f3b,_0x4ec16d,_0x178470),_0x4cd609=a157_0x1dc051[_0x111516(0xda)](_0x2d8f3b,_0x4ec252+_0x111516(0xc9)),_0x3cbdf0=segmentToYamlString(_0x2d0cc5);_0x5451fc[_0x111516(0xd9)](prepareFile(_0x4cd609,_0x3cbdf0,_0x311480));}const _0x2f6fd6=new Map();for(const _0x35dcb2 of _0x427279){const _0x359c91=_0x35dcb2[_0x111516(0xcf)];!_0x2f6fd6['has'](_0x359c91)&&_0x2f6fd6[_0x111516(0xe6)](_0x359c91,[]),_0x2f6fd6[_0x111516(0xc3)](_0x359c91)[_0x111516(0xd9)](_0x35dcb2);}for(const _0x31cd14 of _0x2f6fd6[_0x111516(0xb3)]()){_0x31cd14[_0x111516(0xb5)]((_0x5a44de,_0x40c7)=>(_0x5a44de[_0x111516(0xae)]||0x0)-(_0x40c7[_0x111516(0xae)]||0x0));}if(_0x796bdf[_0x111516(0xba)]){const _0x2536fb=new Map();for(const [_0x5cc252,_0x259e5d]of _0x2f6fd6){const _0x85204f=_0x259e5d[0x0][_0x111516(0xdd)];if(_0x85204f['toLowerCase']()===_0x796bdf[_0x111516(0xba)][_0x111516(0xde)]()){_0x2536fb[_0x111516(0xe6)](_0x5cc252,_0x259e5d);break;}}_0x2f6fd6['clear']();for(const [_0x2c7ddf,_0x56357b]of _0x2536fb){_0x2f6fd6[_0x111516(0xe6)](_0x2c7ddf,_0x56357b);}}if(_0x2f6fd6[_0x111516(0xcb)]>0x0){_0x34ebd2?.[_0x111516(0xd1)]('Processing\x20journeys');const _0x302a5c=Array[_0x111516(0xbb)](_0x2f6fd6[_0x111516(0xb3)]()),_0x25aeba=0x5,{createYamlContext:_0xf7b1b4}=createYamlContextForBundle(_0x26032d,_0x3be592,_0x4fc524,_0x512c61,_0x4c7dff,_0x598260);for(let _0x1ed03a=0x0;_0x1ed03a<_0x302a5c[_0x111516(0xad)];_0x1ed03a+=_0x25aeba){const _0x859470=_0x302a5c[_0x111516(0xa3)](_0x1ed03a,_0x1ed03a+_0x25aeba),_0xd6e7cb=await Promise[_0x111516(0xaa)](_0x859470[_0x111516(0xe5)](async _0x2afc3c=>{const _0x54845d=_0x111516,_0x457a70=_0x2afc3c[0x0],_0x1893a7=_0x457a70[_0x54845d(0xdd)];_0x34ebd2?.[_0x54845d(0xd1)](_0x54845d(0xa2)+_0x1893a7);const _0xc426b=_0x457a70[_0x54845d(0xbc)]?_0x4bd2f3[_0x54845d(0xc3)](_0x457a70[_0x54845d(0xbc)])||'':'',_0x272bb4=_0xc426b?a157_0x1dc051[_0x54845d(0xda)](_0x311480,_0xc426b):_0x311480,_0x3e9a6b=sanitizeFileName(_0x1893a7),_0x3a24ee=a157_0x1dc051['join'](_0x272bb4,_0x3e9a6b+'.yml');let _0x3f50c0;if(existsSync(_0x3a24ee))try{const _0x3e57ad=readFileSync(_0x3a24ee,_0x54845d(0xa8)),_0xe92f4c=a157_0x2bc811(_0x3e57ad);_0x3f50c0=buildLocalRuleToNameMappingFromJourney(_0xe92f4c);}catch{}const _0x48f92c=[];for(const _0xbb1680 of _0x2afc3c){const _0x24701c=_0x598260[_0x54845d(0xc3)](_0xbb1680['id']);if(!_0x24701c){_0x34ebd2?.['update'](_0x54845d(0xb4)+_0xbb1680['id']+_0x54845d(0xe8));continue;}const _0x15878a=_0x24701c[_0x54845d(0xb1)]?.[_0x54845d(0xe4)],_0x1febac=_0xf7b1b4(_0xbb1680['id'],_0x15878a),_0x227bc4=await journeyResponseToDef(_0x24701c,_0x1febac);_0x48f92c[_0x54845d(0xd9)]({'item':_0xbb1680,'yaml':_0x227bc4});}const _0x6b2478=await _0x26032d[_0x54845d(0xdc)][_0x54845d(0xc2)](_0x457a70[_0x54845d(0xcf)]),_0x3478e3=buildMergedJourneyDef(_0x48f92c,_0x3f50c0,_0x6b2478);return{'bundleName':_0x1893a7,'folderPath':_0xc426b,'finalYaml':_0x3478e3};}));for(const {bundleName:_0x2ce1e9,folderPath:_0x5a3357,finalYaml:_0x33d055}of _0xd6e7cb){const _0x315aa6=normalizeJourneyDef(_0x33d055),_0xedb914=a157_0x1e4119(_0x315aa6),_0x8c9cb9=_0x5a3357?a157_0x1dc051['join'](_0x311480,_0x5a3357):_0x311480,_0x1ca4fd=sanitizeFileName(_0x2ce1e9),_0x3bb886=getUniqueFileName(_0x8c9cb9,_0x1ca4fd,_0x178470),_0x4ba43e=a157_0x1dc051[_0x111516(0xda)](_0x8c9cb9,_0x3bb886+'.yml');_0x5451fc[_0x111516(0xd9)](prepareFile(_0x4ba43e,_0xedb914,_0x311480));}}}const _0x331935=Array['from'](_0x357134[_0x111516(0xb3)]())[_0x111516(0xdb)]((_0x1d3199,_0x41d88a)=>_0x1d3199+_0x41d88a[_0x111516(0xad)],0x0),_0x1c17f9=_0x5d9e98[_0x111516(0xc7)](_0x4a8f05=>_0x4a8f05['kind']!==SEGMENT_KIND_JOURNEY),_0x304a2b=_0x5451fc[_0x111516(0xc7)](_0x4df8a8=>_0x4df8a8[_0x111516(0xe7)])['length'],_0x52687f=_0x5451fc['filter'](_0x5b5697=>!_0x5b5697[_0x111516(0xe7)]&&_0x5b5697[_0x111516(0xc5)])[_0x111516(0xad)],_0x5376cd=_0x5451fc['filter'](_0x357cca=>!_0x357cca[_0x111516(0xe7)]&&!_0x357cca[_0x111516(0xc5)])[_0x111516(0xad)],_0x2c6179=Array[_0x111516(0xbb)](_0x2f6fd6[_0x111516(0xb3)]())[_0x111516(0xdb)]((_0x18ab23,_0x3ba684)=>_0x18ab23+_0x3ba684[_0x111516(0xad)],0x0);return{'parentName':_0x409f6e,'parentId':_0x2b4264,'targetDir':_0x311480,'files':_0x5451fc,'counts':{'segments':_0x1c17f9[_0x111516(0xad)],'journeys':_0x2f6fd6[_0x111516(0xcb)],'journeyVersions':_0x2c6179,'activations':_0x331935},'newFiles':_0x304a2b,'changedFiles':_0x52687f,'unchangedFiles':_0x5376cd};}function createYamlContextForBundle(_0x2c0168,_0x1a828a,_0x133208,_0x29031a,_0x24d0c9,_0x561c3b){const _0x93a82e=new Set(),_0xd7b8d7=new Map(),_0x342526=new Map(),_0x3ead8e=createJumpTargetCache(),_0x4d5ec8=async(_0x1b70e9,_0x287900)=>{const _0x1c9e01=a157_0x18a4,_0x391521=_0xd7b8d7[_0x1c9e01(0xc3)](_0x1b70e9);if(_0x391521!==undefined)return _0x391521;if(!_0x287900)return _0x1b70e9;try{let _0x4af925=_0x1a828a['get'](_0x1b70e9);!_0x4af925&&(_0x4af925=await _0x2c0168['segment'][_0x1c9e01(0xdf)](_0x287900,_0x1b70e9),_0x1a828a['set'](_0x1b70e9,_0x4af925));const _0x136da7=generateJourneyLocalName(_0x4af925['name']),_0x2716a6=_0x4af925[_0x1c9e01(0xa4)]===SEGMENT_KIND_JOURNEY&&_0x136da7!==undefined;if(_0x2716a6&&_0x136da7){let _0x593d30=_0x136da7,_0x5befcf=0x2;while(_0x93a82e['has'](_0x593d30)){_0x593d30=_0x136da7+'_'+_0x5befcf,_0x5befcf++;}return _0x93a82e[_0x1c9e01(0xb7)](_0x593d30),_0xd7b8d7[_0x1c9e01(0xe6)](_0x1b70e9,_0x593d30),_0x593d30;}return _0x4af925[_0x1c9e01(0xa5)];}catch{return _0x1b70e9;}},_0x35b23e=(_0x52b196,_0x47a73f)=>({'resolveSegment':async _0x41614b=>{const _0x236e8b=a157_0x18a4,_0x219143=_0xd7b8d7['get'](_0x41614b);if(_0x219143!==undefined)return{'name':_0x219143,'isJourneyLocal':!![]};if(!_0x47a73f)return{'name':_0x41614b,'isJourneyLocal':![]};try{let _0x2faa93=_0x1a828a[_0x236e8b(0xc3)](_0x41614b);!_0x2faa93&&(_0x2faa93=await _0x2c0168[_0x236e8b(0xcc)][_0x236e8b(0xdf)](_0x47a73f,_0x41614b),_0x1a828a[_0x236e8b(0xe6)](_0x41614b,_0x2faa93));const _0x2d53fd=generateJourneyLocalName(_0x2faa93[_0x236e8b(0xa5)]),_0x17e4c3=_0x2faa93['kind']===SEGMENT_KIND_JOURNEY&&_0x2d53fd!==undefined;if(_0x17e4c3&&!_0x2faa93[_0x236e8b(0xc0)]&&_0x47a73f)try{const _0x42bf8d=await _0x2c0168[_0x236e8b(0xcc)][_0x236e8b(0xdf)](_0x47a73f,_0x41614b);_0x1a828a[_0x236e8b(0xe6)](_0x41614b,_0x42bf8d),_0x2faa93=_0x42bf8d;}catch{}const _0x44d564=await _0x4d5ec8(_0x41614b,_0x47a73f);let _0x54a866;if(_0x17e4c3&&_0x2faa93[_0x236e8b(0xc0)]){const _0x31625a=await segmentResponseToDef(_0x2faa93,{'resolveSegmentName':_0x2ab86b=>_0x4d5ec8(_0x2ab86b,_0x47a73f)});_0x54a866={'description':_0x2faa93[_0x236e8b(0xb6)],'rule':_0x31625a['rule']};}return{'name':_0x44d564,'isJourneyLocal':_0x17e4c3,'definition':_0x54a866};}catch{return{'name':_0x41614b,'isJourneyLocal':![]};}},'resolveActivation':async _0xe1181e=>{const _0x1d9d65=a157_0x18a4,_0x1154d=_0x342526[_0x1d9d65(0xc3)](_0xe1181e);if(_0x1154d!==undefined)return{'name':_0x1154d,'isJourneyLocal':!![]};try{let _0x560406=_0x24d0c9[_0x1d9d65(0xc3)](_0xe1181e);!_0x560406&&(_0x560406=await _0x2c0168[_0x1d9d65(0xdc)][_0x1d9d65(0xaf)](_0x52b196,_0xe1181e));const _0x311cc6=_0x560406[_0x1d9d65(0xb1)]['activationParams'][_0x1d9d65(0xa5)]||_0xe1181e,_0x363d4e=sanitizeYamlKey(_0x311cc6)||_0x1d9d65(0xa1)+_0xe1181e,_0x3a898d=_0x363d4e;_0x342526[_0x1d9d65(0xe6)](_0xe1181e,_0x3a898d);const _0x2744cf=journeyActivationStepToYaml(_0x560406,_0x133208,_0x29031a);return{'name':_0x3a898d,'isJourneyLocal':!![],'definition':_0x2744cf};}catch{return{'name':_0xe1181e,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x1a9495,_0x5b500b)=>resolveJumpTarget(_0x1a9495,_0x5b500b,_0x3ead8e,async _0x20c31b=>{const _0x5b41c9=a157_0x18a4,_0x1b39d5=_0x561c3b['get'](_0x20c31b);if(_0x1b39d5)return _0x1b39d5;return _0x2c0168[_0x5b41c9(0xdc)][_0x5b41c9(0xe1)](_0x20c31b);})});return{'createYamlContext':_0x35b23e};}
1
+ function a157_0x5b7c(){const _0x4735ba=['reduce','join','Fetching\x20segments,\x20folders,\x20and\x20journeys','update','journeyBundleId','slice','33664JdJLzD','segments/','add','3565688olSyVS','Warning:\x20Journey\x20','27568QoQLbv','createdAt','get','values','segmentFolderId','\x20not\x20found\x20in\x20pre-fetched\x20data,\x20skipping','835865fLWuRU','1408524LPhLKh','rule','getSegment','push','paused','map','827486mzxrhD','buildIdToNameMap','listSegments','hasChanges','journeyBundleName','filter','listJourneysWithDetailsFromParentSegment','size','Processing\x20journeys','connection','set','versionNumber','listFolders','name','Fetching\x20activations','from','description','segment','isNew','attributes','buildIdToEmailMap','state','.yml','audienceId','parentFolder','Fetching\x20users\x20and\x20connections','tdx.json','targetResourceName','relative','getJourney','folderId','user','utf-8','Processing\x20segments','getParent','activationParams','all','kind','866205XYOvZV','getActivation','has','51KTDzBU','Fetching\x20parent\x20segment\x20info','journey','length','30GRaFIb','toLowerCase','250eWEnBx','getLatestJourneyId'];a157_0x5b7c=function(){return _0x4735ba;};return a157_0x5b7c();}(function(_0x45cff1,_0x290f0b){const _0x1da2f2=a157_0x11ac,_0x5cc356=_0x45cff1();while(!![]){try{const _0x17d8fb=-parseInt(_0x1da2f2(0x1e9))/0x1+-parseInt(_0x1da2f2(0x1e3))/0x2+-parseInt(_0x1da2f2(0x1c9))/0x3*(parseInt(_0x1da2f2(0x1dc))/0x4)+parseInt(_0x1da2f2(0x1e2))/0x5*(-parseInt(_0x1da2f2(0x1cd))/0x6)+parseInt(_0x1da2f2(0x1da))/0x7+parseInt(_0x1da2f2(0x1d7))/0x8+-parseInt(_0x1da2f2(0x1c6))/0x9*(-parseInt(_0x1da2f2(0x1cf))/0xa);if(_0x17d8fb===_0x290f0b)break;else _0x5cc356['push'](_0x5cc356['shift']());}catch(_0x364a7e){_0x5cc356['push'](_0x5cc356['shift']());}}}(a157_0x5b7c,0x6a2fc));import a157_0x2a8a52 from'path';import{existsSync,readFileSync}from'fs';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{sanitizeFileName}from'../../utils/string-utils.js';import{batchAsync}from'../../utils/async.js';import{buildFolderIdToPathMap}from'./resolution-context.js';import{segmentWithActivationsToYaml,segmentToYamlString,segmentResponseToDef,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{journeyResponseToDef,toYamlString as a157_0x3cb878,normalizeJourneyDef,parseYamlString as a157_0xb99287}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,createJumpTargetCache,resolveJumpTarget}from'./journey-utils.js';import{createTdxConfigContent}from'./tdx-config.js';function a157_0x11ac(_0x33bf30,_0x4318a5){_0x33bf30=_0x33bf30-0x1b6;const _0x5b7c57=a157_0x5b7c();let _0x11ac24=_0x5b7c57[_0x33bf30];return _0x11ac24;}function prepareFile(_0x1fc4e0,_0x32f9d9,_0x1678ca){const _0x109b5e=a157_0x11ac,_0x38cea5=a157_0x2a8a52[_0x109b5e(0x1bc)](_0x1678ca,_0x1fc4e0);if(existsSync(_0x1fc4e0)){const _0x5cf05c=readFileSync(_0x1fc4e0,_0x109b5e(0x1c0)),_0x3975bd=generateDiff(_0x5cf05c,_0x32f9d9),_0x5d6a9f=hasChanges(_0x3975bd);return{'relativePath':_0x38cea5,'absolutePath':_0x1fc4e0,'content':_0x32f9d9,'isNew':![],'hasChanges':_0x5d6a9f,'diff':_0x5d6a9f?formatDiffWithColors(_0x3975bd):undefined};}return{'relativePath':_0x38cea5,'absolutePath':_0x1fc4e0,'content':_0x32f9d9,'isNew':!![],'hasChanges':![]};}function getUniqueFileName(_0x5d0589,_0x1225da,_0x8c9bf1){const _0x3c5cd=a157_0x11ac,_0x564e37=_0x5d0589+':'+_0x1225da,_0x993c6=_0x8c9bf1[_0x3c5cd(0x1de)](_0x564e37)||0x0;_0x8c9bf1[_0x3c5cd(0x1f3)](_0x564e37,_0x993c6+0x1);if(_0x993c6===0x0)return _0x1225da;return _0x1225da+'_'+(_0x993c6+0x1);}export async function pullSegments(_0x2cccfb,_0x378ddc,_0x2efcdc={}){const _0x593e17=a157_0x11ac,{targetDir:_0x5b67da,progress:_0x214c96}=_0x2efcdc;_0x214c96?.[_0x593e17(0x1d4)]('Resolving\x20parent\x20segment');const _0x978d7e=await _0x2cccfb[_0x593e17(0x1fa)]['resolveParentId'](_0x378ddc);_0x214c96?.['update'](_0x593e17(0x1ca));const _0x49190b=await _0x2cccfb[_0x593e17(0x1fa)][_0x593e17(0x1c2)](_0x978d7e),_0x4ac99b=_0x49190b[_0x593e17(0x1fc)]['name'];_0x214c96?.[_0x593e17(0x1d4)](_0x593e17(0x1d3));const [_0x3d305c,_0x37b61a,_0x7b1b3c]=await Promise[_0x593e17(0x1c4)]([_0x2cccfb[_0x593e17(0x1fa)][_0x593e17(0x1eb)](_0x978d7e),_0x2cccfb['segment'][_0x593e17(0x1f5)](_0x978d7e),_0x2cccfb[_0x593e17(0x1cb)][_0x593e17(0x1ef)](_0x978d7e,{'includeAllVersions':!![]})]),{journeys:_0x5f31e5,activationStepsById:_0xc58456}=_0x7b1b3c,_0x377409=new Map();for(const _0x1fbb5a of _0x5f31e5){_0x377409[_0x593e17(0x1f3)](_0x1fbb5a['id'],_0x1fbb5a);}const _0x2839c1=_0x5f31e5[_0x593e17(0x1e8)](_0x5dbdbc=>({'id':_0x5dbdbc['id'],'name':_0x5dbdbc['attributes']['name'],'journeyBundleName':_0x5dbdbc[_0x593e17(0x1fc)][_0x593e17(0x1ed)]||'','journeyBundleId':_0x5dbdbc[_0x593e17(0x1fc)]['journeyBundleId']||'','versionNumber':_0x5dbdbc[_0x593e17(0x1fc)][_0x593e17(0x1f4)],'description':_0x5dbdbc[_0x593e17(0x1fc)]['description'],'state':_0x5dbdbc[_0x593e17(0x1fc)][_0x593e17(0x1fe)],'paused':_0x5dbdbc[_0x593e17(0x1fc)][_0x593e17(0x1e7)],'audienceId':_0x5dbdbc[_0x593e17(0x1fc)][_0x593e17(0x1b7)],'folderId':_0x5dbdbc['relationships']?.[_0x593e17(0x1b8)]?.['data']?.['id'],'createdAt':_0x5dbdbc[_0x593e17(0x1fc)][_0x593e17(0x1dd)],'updatedAt':_0x5dbdbc[_0x593e17(0x1fc)]['updatedAt']})),_0x53a626=buildFolderIdToPathMap(_0x37b61a),_0x1b8b04=_0x5b67da||_0x593e17(0x1d8)+sanitizeFileName(_0x4ac99b);_0x214c96?.[_0x593e17(0x1d4)](_0x593e17(0x1f7));const _0x5ab24a=new Map();await batchAsync(_0x3d305c,async _0x1dc7c3=>{const _0xd09d36=_0x593e17,_0x5524b4=await _0x2cccfb[_0xd09d36(0x1fa)]['listActivations'](_0x978d7e,_0x1dc7c3['id']);_0x5ab24a[_0xd09d36(0x1f3)](_0x1dc7c3['id'],_0x5524b4);}),_0x214c96?.['update'](_0x593e17(0x1b9));const [_0xa14b4b,_0x1c3f1d]=await Promise[_0x593e17(0x1c4)]([_0x2cccfb[_0x593e17(0x1bf)][_0x593e17(0x1fd)](),_0x2cccfb[_0x593e17(0x1f2)][_0x593e17(0x1ea)]()]),_0x2dfe91=[],_0x26e3e8=new Map(),_0x31130c=a157_0x2a8a52[_0x593e17(0x1d2)](_0x1b8b04,_0x593e17(0x1ba)),_0x34b3e4=createTdxConfigContent(_0x4ac99b);_0x2dfe91['push'](prepareFile(_0x31130c,_0x34b3e4,_0x1b8b04));const _0x2d42fb=new Map();for(const _0x536ad5 of _0x3d305c){_0x2d42fb['set'](_0x536ad5['id'],_0x536ad5);}let _0x6c2a13=_0x3d305c;if(_0x2efcdc[_0x593e17(0x1bb)]){const _0x526c1d=_0x3d305c['filter'](_0x18a3e1=>_0x18a3e1[_0x593e17(0x1f6)]['toLowerCase']()===_0x2efcdc['targetResourceName'][_0x593e17(0x1ce)]());_0x526c1d[_0x593e17(0x1cc)]>0x0&&(_0x6c2a13=_0x526c1d);}_0x214c96?.[_0x593e17(0x1d4)](_0x593e17(0x1c1));for(const _0x360139 of _0x6c2a13){if(_0x360139['kind']===SEGMENT_KIND_JOURNEY)continue;const _0x271d44=_0x360139[_0x593e17(0x1e0)]?_0x53a626[_0x593e17(0x1de)](_0x360139['segmentFolderId'])||'':'',_0xeea7cc=_0x5ab24a[_0x593e17(0x1de)](_0x360139['id'])||[],_0x2de964=segmentWithActivationsToYaml(_0x360139,_0xeea7cc,undefined,_0xa14b4b,_0x1c3f1d),_0x2e3cb2=_0x271d44?a157_0x2a8a52[_0x593e17(0x1d2)](_0x1b8b04,_0x271d44):_0x1b8b04,_0x2cde30=sanitizeFileName(_0x360139[_0x593e17(0x1f6)]),_0x34c186=getUniqueFileName(_0x2e3cb2,_0x2cde30,_0x26e3e8),_0x53a24c=a157_0x2a8a52['join'](_0x2e3cb2,_0x34c186+'.yml'),_0x1b8d15=segmentToYamlString(_0x2de964);_0x2dfe91[_0x593e17(0x1e6)](prepareFile(_0x53a24c,_0x1b8d15,_0x1b8b04));}const _0xa67427=new Map();for(const _0x571f2d of _0x2839c1){const _0x286f89=_0x571f2d[_0x593e17(0x1d5)];!_0xa67427[_0x593e17(0x1c8)](_0x286f89)&&_0xa67427[_0x593e17(0x1f3)](_0x286f89,[]),_0xa67427[_0x593e17(0x1de)](_0x286f89)['push'](_0x571f2d);}for(const _0x3abe70 of _0xa67427[_0x593e17(0x1df)]()){_0x3abe70['sort']((_0x43497f,_0x2e4281)=>(_0x43497f[_0x593e17(0x1f4)]||0x0)-(_0x2e4281['versionNumber']||0x0));}if(_0x2efcdc['targetResourceName']){const _0x261cfb=new Map();for(const [_0x54c1c4,_0x33d17e]of _0xa67427){const _0x18c006=_0x33d17e[0x0]['journeyBundleName'];if(_0x18c006['toLowerCase']()===_0x2efcdc[_0x593e17(0x1bb)][_0x593e17(0x1ce)]()){_0x261cfb['set'](_0x54c1c4,_0x33d17e);break;}}_0xa67427['clear']();for(const [_0x180907,_0x2df248]of _0x261cfb){_0xa67427['set'](_0x180907,_0x2df248);}}if(_0xa67427[_0x593e17(0x1f0)]>0x0){_0x214c96?.[_0x593e17(0x1d4)](_0x593e17(0x1f1));const _0x469430=Array[_0x593e17(0x1f8)](_0xa67427['values']()),_0x130551=0x5,{createYamlContext:_0x176699}=createYamlContextForBundle(_0x2cccfb,_0x2d42fb,_0xa14b4b,_0x1c3f1d,_0xc58456,_0x377409);for(let _0x184dc5=0x0;_0x184dc5<_0x469430[_0x593e17(0x1cc)];_0x184dc5+=_0x130551){const _0x30522c=_0x469430[_0x593e17(0x1d6)](_0x184dc5,_0x184dc5+_0x130551),_0x387004=await Promise[_0x593e17(0x1c4)](_0x30522c['map'](async _0x565b31=>{const _0x40d42f=_0x593e17,_0x322505=_0x565b31[0x0],_0xe1e9a7=_0x322505[_0x40d42f(0x1ed)];_0x214c96?.[_0x40d42f(0x1d4)]('Processing\x20journey:\x20'+_0xe1e9a7);const _0x3df44d=_0x322505[_0x40d42f(0x1be)]?_0x53a626[_0x40d42f(0x1de)](_0x322505[_0x40d42f(0x1be)])||'':'',_0xc9cbcc=_0x3df44d?a157_0x2a8a52[_0x40d42f(0x1d2)](_0x1b8b04,_0x3df44d):_0x1b8b04,_0x3c0d5b=sanitizeFileName(_0xe1e9a7),_0x14c75b=a157_0x2a8a52[_0x40d42f(0x1d2)](_0xc9cbcc,_0x3c0d5b+_0x40d42f(0x1b6));let _0x41682;if(existsSync(_0x14c75b))try{const _0x2826bb=readFileSync(_0x14c75b,'utf-8'),_0x186b31=a157_0xb99287(_0x2826bb);_0x41682=buildLocalRuleToNameMappingFromJourney(_0x186b31);}catch{}const _0x58767a=[];for(const _0x568afe of _0x565b31){const _0x11ac4b=_0x377409['get'](_0x568afe['id']);if(!_0x11ac4b){_0x214c96?.[_0x40d42f(0x1d4)](_0x40d42f(0x1db)+_0x568afe['id']+_0x40d42f(0x1e1));continue;}const _0x26948e=_0x11ac4b['attributes']?.[_0x40d42f(0x1b7)],_0x4c15b4=_0x176699(_0x568afe['id'],_0x26948e),_0x45bb16=await journeyResponseToDef(_0x11ac4b,_0x4c15b4);_0x58767a[_0x40d42f(0x1e6)]({'item':_0x568afe,'yaml':_0x45bb16});}const _0xa34cf=await _0x2cccfb[_0x40d42f(0x1cb)][_0x40d42f(0x1d0)](_0x322505[_0x40d42f(0x1d5)]),_0x26e180=buildMergedJourneyDef(_0x58767a,_0x41682,_0xa34cf);return{'bundleName':_0xe1e9a7,'folderPath':_0x3df44d,'finalYaml':_0x26e180};}));for(const {bundleName:_0x47c629,folderPath:_0x4b5502,finalYaml:_0x160087}of _0x387004){const _0x526cd7=normalizeJourneyDef(_0x160087),_0x2805ed=a157_0x3cb878(_0x526cd7),_0x3ee793=_0x4b5502?a157_0x2a8a52[_0x593e17(0x1d2)](_0x1b8b04,_0x4b5502):_0x1b8b04,_0x4be149=sanitizeFileName(_0x47c629),_0x5c6f4f=getUniqueFileName(_0x3ee793,_0x4be149,_0x26e3e8),_0x152fc7=a157_0x2a8a52[_0x593e17(0x1d2)](_0x3ee793,_0x5c6f4f+_0x593e17(0x1b6));_0x2dfe91[_0x593e17(0x1e6)](prepareFile(_0x152fc7,_0x2805ed,_0x1b8b04));}}}const _0x39b782=Array[_0x593e17(0x1f8)](_0x5ab24a[_0x593e17(0x1df)]())[_0x593e17(0x1d1)]((_0x59924e,_0x363c50)=>_0x59924e+_0x363c50[_0x593e17(0x1cc)],0x0),_0x951c8d=_0x6c2a13[_0x593e17(0x1ee)](_0x3332f2=>_0x3332f2[_0x593e17(0x1c5)]!==SEGMENT_KIND_JOURNEY),_0x2094d2=_0x2dfe91[_0x593e17(0x1ee)](_0x4d0182=>_0x4d0182['isNew'])[_0x593e17(0x1cc)],_0x4140fa=_0x2dfe91[_0x593e17(0x1ee)](_0x1419b9=>!_0x1419b9[_0x593e17(0x1fb)]&&_0x1419b9['hasChanges'])['length'],_0xe8447d=_0x2dfe91[_0x593e17(0x1ee)](_0x56bf6a=>!_0x56bf6a[_0x593e17(0x1fb)]&&!_0x56bf6a[_0x593e17(0x1ec)])[_0x593e17(0x1cc)],_0x2556c1=Array[_0x593e17(0x1f8)](_0xa67427[_0x593e17(0x1df)]())[_0x593e17(0x1d1)]((_0x4ef8b6,_0x13d16b)=>_0x4ef8b6+_0x13d16b[_0x593e17(0x1cc)],0x0);return{'parentName':_0x4ac99b,'parentId':_0x978d7e,'targetDir':_0x1b8b04,'files':_0x2dfe91,'counts':{'segments':_0x951c8d[_0x593e17(0x1cc)],'journeys':_0xa67427['size'],'journeyVersions':_0x2556c1,'activations':_0x39b782},'newFiles':_0x2094d2,'changedFiles':_0x4140fa,'unchangedFiles':_0xe8447d};}function createYamlContextForBundle(_0x5ec1df,_0x217fa4,_0x3b721e,_0x1294ab,_0x5f596e,_0x54ecc6){const _0x2fcf72=new Set(),_0x4b7791=new Map(),_0x37fedd=new Map(),_0x510677=createJumpTargetCache(),_0x4b65cf=async(_0x4019c0,_0x549318)=>{const _0x20d23f=a157_0x11ac,_0x87083c=_0x4b7791[_0x20d23f(0x1de)](_0x4019c0);if(_0x87083c!==undefined)return _0x87083c;if(!_0x549318)return _0x4019c0;try{let _0x14f30d=_0x217fa4[_0x20d23f(0x1de)](_0x4019c0);!_0x14f30d&&(_0x14f30d=await _0x5ec1df[_0x20d23f(0x1fa)][_0x20d23f(0x1e5)](_0x549318,_0x4019c0),_0x217fa4[_0x20d23f(0x1f3)](_0x4019c0,_0x14f30d));const _0x3c0c10=generateJourneyLocalName(_0x14f30d[_0x20d23f(0x1f6)]),_0x88f5a1=_0x14f30d['kind']===SEGMENT_KIND_JOURNEY&&_0x3c0c10!==undefined;if(_0x88f5a1&&_0x3c0c10){let _0x292fb3=_0x3c0c10,_0x533509=0x2;while(_0x2fcf72[_0x20d23f(0x1c8)](_0x292fb3)){_0x292fb3=_0x3c0c10+'_'+_0x533509,_0x533509++;}return _0x2fcf72[_0x20d23f(0x1d9)](_0x292fb3),_0x4b7791[_0x20d23f(0x1f3)](_0x4019c0,_0x292fb3),_0x292fb3;}return _0x14f30d[_0x20d23f(0x1f6)];}catch{return _0x4019c0;}},_0x499e3b=(_0x79d3d2,_0x23c90e)=>({'resolveSegment':async _0x2e1b0c=>{const _0x2796f5=a157_0x11ac,_0x74f2be=_0x4b7791['get'](_0x2e1b0c);if(_0x74f2be!==undefined)return{'name':_0x74f2be,'isJourneyLocal':!![]};if(!_0x23c90e)return{'name':_0x2e1b0c,'isJourneyLocal':![]};try{let _0x28ef2c=_0x217fa4[_0x2796f5(0x1de)](_0x2e1b0c);!_0x28ef2c&&(_0x28ef2c=await _0x5ec1df[_0x2796f5(0x1fa)][_0x2796f5(0x1e5)](_0x23c90e,_0x2e1b0c),_0x217fa4[_0x2796f5(0x1f3)](_0x2e1b0c,_0x28ef2c));const _0x43e736=generateJourneyLocalName(_0x28ef2c['name']),_0x44ced8=_0x28ef2c[_0x2796f5(0x1c5)]===SEGMENT_KIND_JOURNEY&&_0x43e736!==undefined;if(_0x44ced8&&!_0x28ef2c[_0x2796f5(0x1e4)]&&_0x23c90e)try{const _0x485aee=await _0x5ec1df[_0x2796f5(0x1fa)][_0x2796f5(0x1e5)](_0x23c90e,_0x2e1b0c);_0x217fa4[_0x2796f5(0x1f3)](_0x2e1b0c,_0x485aee),_0x28ef2c=_0x485aee;}catch{}const _0x65ca13=await _0x4b65cf(_0x2e1b0c,_0x23c90e);let _0x4fd2bd;if(_0x44ced8&&_0x28ef2c[_0x2796f5(0x1e4)]){const _0x21cfe0=await segmentResponseToDef(_0x28ef2c,{'resolveSegmentName':_0x5b15b1=>_0x4b65cf(_0x5b15b1,_0x23c90e)});_0x4fd2bd={'description':_0x28ef2c[_0x2796f5(0x1f9)],'rule':_0x21cfe0[_0x2796f5(0x1e4)]};}return{'name':_0x65ca13,'isJourneyLocal':_0x44ced8,'definition':_0x4fd2bd};}catch{return{'name':_0x2e1b0c,'isJourneyLocal':![]};}},'resolveActivation':async _0x3b5719=>{const _0x2fe1b2=a157_0x11ac,_0x557ad3=_0x37fedd[_0x2fe1b2(0x1de)](_0x3b5719);if(_0x557ad3!==undefined)return{'name':_0x557ad3,'isJourneyLocal':!![]};try{let _0x465e54=_0x5f596e[_0x2fe1b2(0x1de)](_0x3b5719);!_0x465e54&&(_0x465e54=await _0x5ec1df['journey'][_0x2fe1b2(0x1c7)](_0x79d3d2,_0x3b5719));const _0x4a44e4=_0x465e54['attributes'][_0x2fe1b2(0x1c3)]['name']||_0x3b5719,_0x4d8397=sanitizeYamlKey(_0x4a44e4)||'activation_'+_0x3b5719,_0x328143=_0x4d8397;_0x37fedd['set'](_0x3b5719,_0x328143);const _0x63e54d=journeyActivationStepToYaml(_0x465e54,_0x3b721e,_0x1294ab);return{'name':_0x328143,'isJourneyLocal':!![],'definition':_0x63e54d};}catch{return{'name':_0x3b5719,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0xf14a9c,_0x3943c2)=>resolveJumpTarget(_0xf14a9c,_0x3943c2,_0x510677,async _0x1ae01d=>{const _0x10fc82=a157_0x11ac,_0x367df1=_0x54ecc6[_0x10fc82(0x1de)](_0x1ae01d);if(_0x367df1)return _0x367df1;return _0x5ec1df[_0x10fc82(0x1cb)][_0x10fc82(0x1bd)](_0x1ae01d);})});return{'createYamlContext':_0x499e3b};}
@@ -1 +1 @@
1
- (function(_0x31eb83,_0x473639){const _0x21bde4=a158_0x5154,_0x419dbe=_0x31eb83();while(!![]){try{const _0x10da0a=parseInt(_0x21bde4(0x112))/0x1*(-parseInt(_0x21bde4(0x10a))/0x2)+-parseInt(_0x21bde4(0x104))/0x3*(parseInt(_0x21bde4(0x10b))/0x4)+parseInt(_0x21bde4(0xff))/0x5+parseInt(_0x21bde4(0x108))/0x6*(-parseInt(_0x21bde4(0x10e))/0x7)+-parseInt(_0x21bde4(0x107))/0x8+parseInt(_0x21bde4(0xfd))/0x9+-parseInt(_0x21bde4(0xf8))/0xa*(-parseInt(_0x21bde4(0x105))/0xb);if(_0x10da0a===_0x473639)break;else _0x419dbe['push'](_0x419dbe['shift']());}catch(_0x48e74){_0x419dbe['push'](_0x419dbe['shift']());}}}(a158_0x12f8,0x6dd9f));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a158_0x2e9d7c from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-recovery');export function getPushRecoveryPath(_0x523eff){const _0x5bafc4=a158_0x5154,_0x51be60=a158_0x2e9d7c[_0x5bafc4(0x100)](_0x523eff),_0x280e92=a158_0x2e9d7c[_0x5bafc4(0x103)](_0x523eff);return a158_0x2e9d7c[_0x5bafc4(0x102)](_0x51be60,'.'+_0x280e92+'.push-recovery.json');}export function readPushRecovery(_0x34a3b8){const _0x26e7d8=a158_0x5154,_0x32c489=getPushRecoveryPath(_0x34a3b8);if(!existsSync(_0x32c489))return undefined;try{const _0x287c0d=readFileSync(_0x32c489,_0x26e7d8(0x101)),_0x13297d=JSON['parse'](_0x287c0d);if(_0x13297d?.[_0x26e7d8(0xfa)]!==0x1||typeof _0x13297d['journeyName']!==_0x26e7d8(0xfc))return undefined;return _0x13297d;}catch(_0x3245be){return _0x3245be instanceof SyntaxError?logger[_0x26e7d8(0x10f)]('Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20'+_0x3245be):logger['warn'](_0x26e7d8(0x10d)+_0x3245be),undefined;}}function a158_0x12f8(){const _0x292355=['toISOString','string','1313289vMfxvK','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','1416065lrEvIb','dirname','utf-8','join','basename','18hXxEcQ','11LkeRlM','journeyName','4129264zyQopl','18wqVrgn','stringify','10ygOFlM','7112SScLNN','segments','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','357609XyDZhE','debug','.tmp','code','128949qmauUD','13456490pKNeoS','ENOENT','version'];a158_0x12f8=function(){return _0x292355;};return a158_0x12f8();}export function writePushRecovery(_0x3bee8f,_0x7e5116){const _0xbfb9f7=a158_0x5154,_0x143e12=getPushRecoveryPath(_0x3bee8f),_0x3fbeb7=_0x143e12+_0xbfb9f7(0x110);writeFileSync(_0x3fbeb7,JSON[_0xbfb9f7(0x109)](_0x7e5116,null,0x2)+'\x0a','utf-8'),renameSync(_0x3fbeb7,_0x143e12);}export function deletePushRecovery(_0x152ebe){const _0x59ebf1=a158_0x5154,_0x2030ce=getPushRecoveryPath(_0x152ebe);try{unlinkSync(_0x2030ce);}catch(_0x4ff845){_0x4ff845[_0x59ebf1(0x111)]!==_0x59ebf1(0xf9)&&logger['debug'](_0x59ebf1(0xfe)+_0x4ff845);}}function a158_0x5154(_0x29b9a6,_0x362cb8){_0x29b9a6=_0x29b9a6-0xf8;const _0x12f8bd=a158_0x12f8();let _0x5154eb=_0x12f8bd[_0x29b9a6];return _0x5154eb;}export function saveSegmentToPushRecovery(_0x3dca7b,_0x3c3581,_0x511177,_0x1e466a){const _0x6f654d=a158_0x5154,_0x599953=readPushRecovery(_0x3dca7b),_0x4355fa=_0x599953?.[_0x6f654d(0x106)]===_0x3c3581?{..._0x599953,'updatedAt':new Date()[_0x6f654d(0xfb)]()}:{'version':0x1,'journeyName':_0x3c3581,'updatedAt':new Date()[_0x6f654d(0xfb)](),'segments':{}};_0x4355fa[_0x6f654d(0x10c)][_0x511177]=_0x1e466a,writePushRecovery(_0x3dca7b,_0x4355fa);}
1
+ const a158_0x23a8a9=a158_0x4586;(function(_0x7afe45,_0x2d3fe6){const _0x43dd1b=a158_0x4586,_0x262e61=_0x7afe45();while(!![]){try{const _0x329ba1=parseInt(_0x43dd1b(0xd2))/0x1*(-parseInt(_0x43dd1b(0xdc))/0x2)+-parseInt(_0x43dd1b(0xd8))/0x3+parseInt(_0x43dd1b(0xdf))/0x4*(parseInt(_0x43dd1b(0xe2))/0x5)+-parseInt(_0x43dd1b(0xd9))/0x6+parseInt(_0x43dd1b(0xd7))/0x7+-parseInt(_0x43dd1b(0xdb))/0x8+parseInt(_0x43dd1b(0xda))/0x9;if(_0x329ba1===_0x2d3fe6)break;else _0x262e61['push'](_0x262e61['shift']());}catch(_0x1f3b82){_0x262e61['push'](_0x262e61['shift']());}}}(a158_0x4bda,0x5b121));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a158_0x5bd29c from'path';import{Logger}from'../../utils/logger/index.js';function a158_0x4586(_0x2ae681,_0x34a3c9){_0x2ae681=_0x2ae681-0xd2;const _0x4bda7b=a158_0x4bda();let _0x4586f4=_0x4bda7b[_0x2ae681];return _0x4586f4;}const logger=Logger['of'](a158_0x23a8a9(0xe1));export function getPushRecoveryPath(_0x1646af){const _0x39cce9=a158_0x23a8a9,_0x1d4ff8=a158_0x5bd29c[_0x39cce9(0xe3)](_0x1646af),_0x2c48e6=a158_0x5bd29c[_0x39cce9(0xd3)](_0x1646af);return a158_0x5bd29c['join'](_0x1d4ff8,'.'+_0x2c48e6+_0x39cce9(0xde));}export function readPushRecovery(_0x159077){const _0x3cb06a=a158_0x23a8a9,_0x3e8712=getPushRecoveryPath(_0x159077);if(!existsSync(_0x3e8712))return undefined;try{const _0x55dce9=readFileSync(_0x3e8712,_0x3cb06a(0xd6)),_0x4ba844=JSON['parse'](_0x55dce9);if(_0x4ba844?.[_0x3cb06a(0xe8)]!==0x1||typeof _0x4ba844[_0x3cb06a(0xe0)]!==_0x3cb06a(0xe4))return undefined;return _0x4ba844;}catch(_0x1dc37b){return _0x1dc37b instanceof SyntaxError?logger['debug']('Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20'+_0x1dc37b):logger['warn'](_0x3cb06a(0xe5)+_0x1dc37b),undefined;}}export function writePushRecovery(_0x4dee19,_0x205088){const _0x11ad2f=a158_0x23a8a9,_0x219fdd=getPushRecoveryPath(_0x4dee19),_0x4ed855=_0x219fdd+_0x11ad2f(0xd4);writeFileSync(_0x4ed855,JSON[_0x11ad2f(0xe6)](_0x205088,null,0x2)+'\x0a',_0x11ad2f(0xd6)),renameSync(_0x4ed855,_0x219fdd);}function a158_0x4bda(){const _0x65a0f0=['4AaPizW','journeyName','tdx.sdk.push-recovery','265180fVcxJS','dirname','string','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','stringify','debug','version','code','191xmLaDb','basename','.tmp','segments','utf-8','1095353bQsYcv','1144362fywmwL','2797680noywIY','17869761NTZBTf','2184992WOpjRP','7342slWbjx','ENOENT','.push-recovery.json'];a158_0x4bda=function(){return _0x65a0f0;};return a158_0x4bda();}export function deletePushRecovery(_0x1f9289){const _0x3d2dce=a158_0x23a8a9,_0x169179=getPushRecoveryPath(_0x1f9289);try{unlinkSync(_0x169179);}catch(_0x3cec1f){_0x3cec1f[_0x3d2dce(0xe9)]!==_0x3d2dce(0xdd)&&logger[_0x3d2dce(0xe7)]('Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20'+_0x3cec1f);}}export function saveSegmentToPushRecovery(_0x588aa7,_0xede5c3,_0x329feb,_0x41bf69){const _0x1229f0=a158_0x23a8a9,_0x78c465=readPushRecovery(_0x588aa7),_0x5b879e=_0x78c465?.[_0x1229f0(0xe0)]===_0xede5c3?{..._0x78c465,'updatedAt':new Date()['toISOString']()}:{'version':0x1,'journeyName':_0xede5c3,'updatedAt':new Date()['toISOString'](),'segments':{}};_0x5b879e[_0x1229f0(0xd5)][_0x329feb]=_0x41bf69,writePushRecovery(_0x588aa7,_0x5b879e);}
@@ -1 +1 @@
1
- const a159_0x1187c8=a159_0x35a2;(function(_0x101547,_0x3d4b16){const _0x42b22d=a159_0x35a2,_0x39c0d0=_0x101547();while(!![]){try{const _0x4c4bb3=-parseInt(_0x42b22d(0x17e))/0x1*(parseInt(_0x42b22d(0x140))/0x2)+-parseInt(_0x42b22d(0xed))/0x3+-parseInt(_0x42b22d(0x141))/0x4+-parseInt(_0x42b22d(0xf5))/0x5*(parseInt(_0x42b22d(0x189))/0x6)+parseInt(_0x42b22d(0xf6))/0x7+-parseInt(_0x42b22d(0x130))/0x8*(parseInt(_0x42b22d(0xca))/0x9)+parseInt(_0x42b22d(0xbb))/0xa;if(_0x4c4bb3===_0x3d4b16)break;else _0x39c0d0['push'](_0x39c0d0['shift']());}catch(_0x5ac1d7){_0x39c0d0['push'](_0x39c0d0['shift']());}}}(a159_0x1c6d,0xa2e4d));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a159_0x1187c8(0x11d));export const PENDING_SEGMENT_PREFIX=a159_0x1187c8(0x99);export const PENDING_ACTIVATION_PREFIX='__pending_act_';function a159_0x1c6d(){const _0x172b62=['\x20journey\x20from\x20file:\x20','steps','Journey\x20\x27','SEGMENT_NOT_FOUND','getLatestJourneyId','conditionTimeoutDuration','skipSegments','Updating\x20segment\x20\x27','isArray','parentId','folder_created','\x27\x20entry\x20criteria','Failed\x20to\x20fetch\x20referenced\x20segment\x20','\x27\x20to\x20local\x20\x27','\x27\x20wait\x20condition','versionNumber','journeyStages','segments','dirname','hasChanges','Creating\x20activation\x20\x27','from','segment_created','../../utils/async.js','folderPath','onProgress','63408AgZtGi','Stage\x20\x27','results','day','deleted','yamlConfig','deleteSegment','goal\x20criteria','5ALUvyJ','5536629JphmvS','Failed\x20to\x20resolve\x20segment\x20','\x27\x20by\x20rule\x20content','has','relationships','add','journey_entry_criteria_','activationStepsById','hex','DecisionPoint','list','segment_deleted',').\x20','entry','embedded_segment_creating','existingSegments','journeyBundleId','startsWith','Duration','ACTIVATION_SYNTAX_ERROR','all_columns','getSegment\x20failed\x20for\x20','size','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','journeyId','Failed\x20to\x20resolve\x20activation\x20','./journey-yaml.js','existingJourney','connectionIdToNameMap','INTERNAL','Entry\x20criteria:\x20','segmentNameToId','uniqueSegmentName','activation_deleting','withProgress','JOURNEY_SYNTAX_ERROR','resolveSegment','listActivations','journeyActivationStepId','tdx.sdk.push-workflow','includes','SEGMENT_UPDATE_ERROR','segment','SEGMENT_SYNTAX_ERROR','activation_updating','existingSegment','notification','stage\x20\x27','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','find','toLowerCase','segment_creating','logSuccess','./child-segment-yaml.js','waitStepUnit','activationParams','rule','rootFolderId','221944bALmIq','segment_updated','journeyById','Deleting\x20activation\x20\x27','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','Condition','length','Updated\x20activation\x20\x27','conditionTimeoutUnit','relative','Segment\x20not\x20found:\x20','toString','journeyName','run_after_journey_refresh','activation_template_id','\x27\x20decision\x20point\x20branch\x20\x27','2ScQcyU','3072836Xdppnk','\x20(referenced\x20in\x20journey\x20','deleteActivation','Created\x20folder\x20\x27','journey_creating','branches','draft','activation_updated','resolveJourneyId','folder','schedule','index','journey_updated','parentSegmentFolder','debug','\x27...','create','exitCriterias','Created\x20journey\x20\x27','createdSegmentId','updateSegmentById','deps','match','filter','journey_updating','idToName','sha1','getJourney','logInfo','connector_config','sort','split','stages','Creating\x20folder\x20\x27','entries','Matched\x20server\x20segment\x20\x27','fetchJourney','absolutePath','Segment\x20not\x20found','embedded_segment_created','JOURNEY_UPDATE_ERROR','diff','conditions','activationActions','journeyBundleName','get','ACTIVATION_UPDATE_ERROR','Creating\x20segment\x20\x27','activationContext','createJourneySegment',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','waitStep','stringify','unchanged','item','errors','createdSegmentIds','user','utf-8','getSegmentEntity\x20also\x20failed\x20for\x20','slice','161561pgClbD','replace','null','values','\x27\x20from\x20file:\x20','journey_created','valid','segmentId','description','join','keys','168186qSuSgz','attributes','resolvedRule','yamlActivation','entryCriteria','Updating\x20activation\x20\x27','journeys','digest','Deleted\x20activation\x20\x27','Name\x20has\x20already\x20been\x20taken','logDeleted','folderId','\x20error(s)','isNew','progress','):\x20','update','max','\x0a\x20\x20','push','journey','__pending_','Activation','trim','activation_deleted','getActivation','parseDocument','entry_criteria','embeddedSegmentNameToId','embedded_activation_creating','conditionSegmentId','connection','goal','name','getSegment','all','NOT_FOUND','embedded_activation_created','waitStepType','behavior','WaitStep','validatedRequest','created','columns','activationsBySegmentId','segment_deleting','parentFolder','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','journeyBundlesByFolderAndName','folderPathToId','uniqueServerName','Created\x20segment\x20\x27','Activation\x20not\x20found:\x20','\x27\x20not\x20found\x20in\x20journey\x20\x27','localName','13823200rXJLKO','segmentFolderId','map','Failed\x20to\x20','parse','createActivation','activation_','nameToType','existingActivation','\x20segment\x20from\x20file:\x20','activations','delete','Created\x20activation\x20\x27','createFolder','folder_creating','171RzSWgg','updated','set','idToEmailMap','milestone','action','type','Fetching\x20','data'];a159_0x1c6d=function(){return _0x172b62;};return a159_0x1c6d();}export function createPendingSegmentId(_0xb44e85){return''+PENDING_SEGMENT_PREFIX+_0xb44e85+'__';}export function isPendingSegmentId(_0x4e34d7){const _0x5aae06=a159_0x1187c8;return _0x4e34d7[_0x5aae06(0x107)](PENDING_SEGMENT_PREFIX)&&!_0x4e34d7[_0x5aae06(0x107)](PENDING_ACTIVATION_PREFIX);}function a159_0x35a2(_0x1fe239,_0x4d16e7){_0x1fe239=_0x1fe239-0x87;const _0x1c6d2a=a159_0x1c6d();let _0x35a21e=_0x1c6d2a[_0x1fe239];return _0x35a21e;}export function extractPendingSegmentName(_0x2f9ad3){const _0x65bbb8=a159_0x1187c8;return _0x2f9ad3[_0x65bbb8(0x17f)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x6188af){return''+PENDING_ACTIVATION_PREFIX+_0x6188af+'__';}export function isPendingActivationId(_0xc9f347){return _0xc9f347['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5e8dc8){const _0x18a467=a159_0x1187c8;return _0x5e8dc8[_0x18a467(0x17f)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x492f06,_0x173277){const _0x1fc5a1=a159_0x1187c8,_0x1cf688=_0x492f06+'::'+(_0x173277[_0x1fc5a1(0x9b)]()||_0x1fc5a1(0x120)),_0x31ec24=createHash(_0x1fc5a1(0x15b))[_0x1fc5a1(0x94)](_0x1cf688)[_0x1fc5a1(0x8b)](_0x1fc5a1(0xfe))[_0x1fc5a1(0x17d)](0x0,0xc);return _0x1fc5a1(0xfc)+_0x31ec24;}export function ensureJourneyDefaults(_0x2b2d56){const _0x81dd15=a159_0x1187c8;!_0x2b2d56['description']&&(_0x2b2d56[_0x81dd15(0x186)]=''),!_0x2b2d56['state']&&(_0x2b2d56['state']=_0x81dd15(0x147));}export function injectExistingStageIds(_0x170c2b,_0xa994ec){const _0x296b44=a159_0x1187c8,_0x17a3a3=new Map(_0xa994ec[_0x296b44(0xbd)](_0x44ff64=>[_0x44ff64[_0x296b44(0xa5)],_0x44ff64['id']]));for(const _0x5190fa of _0x170c2b){if(!_0x5190fa['id']){const _0x7e262c=_0x17a3a3[_0x296b44(0x16e)](_0x5190fa['name']);_0x7e262c&&(_0x5190fa['id']=_0x7e262c);}}}export function resolveTDFolderPath(_0x55f6c9,_0x68f74e,_0x52436a){const _0x1acb9f=a159_0x1187c8;if(!_0x68f74e)return _0x55f6c9;if(_0x55f6c9===_0x52436a||_0x55f6c9[_0x1acb9f(0x107)](_0x52436a+'/'))return _0x55f6c9;return _0x55f6c9?_0x52436a+'/'+_0x55f6c9:_0x52436a;}export function addFoldersToCreate(_0x4ace33,_0x37c79f,_0x179abe){const _0x38acef=a159_0x1187c8;if(!_0x4ace33)return;if(_0x37c79f[_0x38acef(0xf9)](_0x4ace33))return;const _0x5be7a9=_0x4ace33[_0x38acef(0x160)]('/');let _0x54959a='';for(const _0x14f1b3 of _0x5be7a9){_0x54959a=_0x54959a?_0x54959a+'/'+_0x14f1b3:_0x14f1b3,!_0x37c79f[_0x38acef(0xf9)](_0x54959a)&&_0x179abe[_0x38acef(0xfb)](_0x54959a);}}export function sortFoldersByDepth(_0x4ff5ba){return[..._0x4ff5ba]['sort']((_0x40a38e,_0x284833)=>{const _0x247db3=a159_0x35a2,_0x23782e=(_0x40a38e[_0x247db3(0x157)](/\//g)||[])[_0x247db3(0x136)],_0x27364c=(_0x284833[_0x247db3(0x157)](/\//g)||[])['length'];return _0x23782e-_0x27364c;});}import*as a159_0x674282 from'yaml';import{readFileSync}from'fs';import a159_0x4ef545 from'path';import{isJourneyDef,parseYamlString as a159_0x29057a,toYamlString as a159_0x164755,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{batchAsync}from'../../utils/async.js';import{buildFolderMaps}from'./resolution-context.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../errors.js';import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x184fed){const _0xbc5a8a=a159_0x1187c8;if(Array[_0xbc5a8a(0xdb)](_0x184fed))return'['+_0x184fed[_0xbc5a8a(0xbd)](_0x43bff7=>stableStringify(_0x43bff7))[_0xbc5a8a(0x187)](',')+']';if(_0x184fed&&typeof _0x184fed==='object'){const _0x130943=_0x184fed,_0x3e48d7=Object[_0xbc5a8a(0x188)](_0x130943)['sort'](),_0x4121e1=_0x3e48d7[_0xbc5a8a(0xbd)](_0x39d05b=>'\x22'+_0x39d05b+'\x22:'+stableStringify(_0x130943[_0x39d05b]));return'{'+_0x4121e1[_0xbc5a8a(0x187)](',')+'}';}const _0x49e75d=JSON['stringify'](_0x184fed);return _0x49e75d===undefined?_0xbc5a8a(0x180):_0x49e75d;}function activationSignature(_0x133ec5){const _0x5e1ab0=a159_0x1187c8,_0x3c99cd={'connection':_0x133ec5[_0x5e1ab0(0xa3)],..._0x133ec5[_0x5e1ab0(0x10a)]!==undefined&&{'all_columns':_0x133ec5[_0x5e1ab0(0x10a)]},..._0x133ec5[_0x5e1ab0(0xaf)]!==undefined&&{'columns':_0x133ec5[_0x5e1ab0(0xaf)]},..._0x133ec5[_0x5e1ab0(0xab)]!==undefined&&{'behavior':_0x133ec5[_0x5e1ab0(0xab)]},..._0x133ec5[_0x5e1ab0(0x14b)]!==undefined&&{'schedule':_0x133ec5[_0x5e1ab0(0x14b)]},..._0x133ec5['notification']!==undefined&&{'notification':_0x133ec5[_0x5e1ab0(0x124)]},..._0x133ec5[_0x5e1ab0(0x15e)]!==undefined&&{'connector_config':_0x133ec5[_0x5e1ab0(0x15e)]},..._0x133ec5[_0x5e1ab0(0x13e)]!==undefined&&{'activation_template_id':_0x133ec5[_0x5e1ab0(0x13e)]}};return stableStringify(_0x3c99cd);}async function fetchSegment(_0x4c9253,_0x74c365,_0xd0b745,_0x22e32c){const _0x356744=a159_0x1187c8,_0xcd2e98=_0x22e32c?.['find'](_0x457b90=>_0x457b90['id']===_0xd0b745);if(_0xcd2e98)return _0xcd2e98;try{return await _0x4c9253[_0x356744(0x120)][_0x356744(0xa6)](_0x74c365,_0xd0b745);}catch(_0x4018d0){logger['debug'](_0x356744(0x10b)+_0xd0b745+_0x356744(0x173)+_0x4018d0);try{return await _0x4c9253[_0x356744(0x120)]['getSegmentEntity'](_0xd0b745);}catch(_0x530b8b){return logger[_0x356744(0x14f)](_0x356744(0x17c)+_0xd0b745+':\x20'+_0x530b8b),null;}}}function recoverSegmentIdsFromPushRecovery(_0x489554,_0x50d4b0,_0xd3fcbf){const _0x1f57da=a159_0x1187c8,_0x2be1bb=readPushRecovery(_0x489554[_0x1f57da(0x166)]);if(_0x2be1bb?.[_0x1f57da(0x13c)]===_0x489554[_0x1f57da(0xf2)][_0x1f57da(0xa5)])for(const [_0x5baf2e,_0x3631fb]of Object[_0x1f57da(0x163)](_0x2be1bb[_0x1f57da(0xe4)])){const _0x4b5abe=generateDeterministicJourneySegmentName(_0x489554[_0x1f57da(0xf2)]['name'],_0x5baf2e);_0x3631fb[_0x1f57da(0xb6)]===_0x4b5abe&&(_0x50d4b0[_0x1f57da(0xcc)](_0x5baf2e,_0x3631fb[_0x1f57da(0x185)]),_0xd3fcbf[_0x1f57da(0xcc)](_0x5baf2e,_0x3631fb['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x5ce824,_0x5a3f91,_0xf1613b,_0x5f0ac1){const _0x568c9b=a159_0x1187c8;let _0x12df31;try{_0x12df31=await _0x5ce824[_0x568c9b(0x120)][_0x568c9b(0x172)]({'name':_0xf1613b[_0x568c9b(0x116)],'description':_0xf1613b[_0x568c9b(0x186)],'journeyId':_0xf1613b['journeyId'],'rule':_0x5f0ac1(_0xf1613b[_0x568c9b(0x18b)],!![]),'countPopulation':!![],'parentFolderId':_0xf1613b['folderId'],'audienceId':_0xf1613b[_0x568c9b(0xdc)]});}catch(_0x49bd96){const _0x2e1059=_0x49bd96 instanceof Error&&_0x49bd96['message'][_0x568c9b(0x11e)](_0x568c9b(0x8d));if(_0x2e1059){const _0x5643f8=readPushRecovery(_0x5a3f91[_0x568c9b(0x166)]),_0x3cca04=_0x5643f8?.[_0x568c9b(0x13c)]===_0x5a3f91['yamlConfig'][_0x568c9b(0xa5)]?_0x5643f8['segments'][_0xf1613b[_0x568c9b(0xba)]]:undefined;if(_0x3cca04?.[_0x568c9b(0xb6)]===_0xf1613b[_0x568c9b(0x116)])await _0x5ce824[_0x568c9b(0x120)][_0x568c9b(0x155)](_0xf1613b[_0x568c9b(0xdc)],_0x3cca04[_0x568c9b(0x185)],{'description':_0xf1613b[_0x568c9b(0x186)],'rule':_0x5f0ac1(_0xf1613b[_0x568c9b(0x18b)],!![]),'countPopulation':!![]}),_0x12df31=_0x3cca04['segmentId'];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0xf1613b[_0x568c9b(0xba)]+_0x568c9b(0x10d)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x5a3f91['absolutePath'][_0x568c9b(0x17f)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x49bd96);}else throw _0x49bd96;}return saveSegmentToPushRecovery(_0x5a3f91[_0x568c9b(0x166)],_0x5a3f91['yamlConfig'][_0x568c9b(0xa5)],_0xf1613b['localName'],{'segmentId':_0x12df31,'uniqueServerName':_0xf1613b['uniqueSegmentName'],'createdAt':new Date()['toISOString']()}),_0x12df31;}export async function prepareSegmentFiles(_0x15e25f,_0x1478b5,_0x125931,_0x2bfd03,_0x398f42){const _0x3894bd=a159_0x1187c8,{activationDefToCreateRequest:_0x2da313}=await import(_0x3894bd(0x12b)),_0x100025=[],_0x57b6c6=new Set();for(const {yamlConfig:_0x4f20cb,folderPath:_0x4e1e1c,sourcePath:_0x27f64d}of _0x15e25f){const _0x314c91=resolveTDFolderPath(_0x4e1e1c,_0x2bfd03,_0x398f42),_0x3f6cbe=_0x314c91+':'+_0x4f20cb[_0x3894bd(0xa5)],_0x475138=_0x1478b5['segmentByFolderAndName'][_0x3894bd(0x16e)](_0x3f6cbe),_0x4e4cf4=_0x475138?_0x1478b5[_0x3894bd(0xb0)]['get'](_0x475138['id'])||[]:[];addFoldersToCreate(_0x314c91,_0x1478b5[_0x3894bd(0xb5)],_0x57b6c6);const _0x36fc9d=calculateActivationActions(_0x4f20cb['activations']||[],_0x4e4cf4,_0x1478b5['idToEmailMap'],_0x1478b5[_0x3894bd(0x112)]);for(const _0xb40994 of _0x36fc9d){(_0xb40994[_0x3894bd(0xd0)]===_0x3894bd(0x151)||_0xb40994['type']===_0x3894bd(0x94))&&_0xb40994[_0x3894bd(0x87)]&&(_0xb40994[_0x3894bd(0xad)]=await _0x2da313(_0xb40994[_0x3894bd(0x87)],_0x125931));}const _0x553d7e=calculateSegmentDiff(_0x4f20cb,_0x475138,_0x4e4cf4,_0x1478b5[_0x3894bd(0xcd)],_0x1478b5[_0x3894bd(0x112)]);_0x100025['push']({'relativePath':_0x4f20cb[_0x3894bd(0xa5)],'absolutePath':_0x27f64d,'yamlConfig':_0x4f20cb,'folderPath':_0x314c91,'existingSegment':_0x475138,'existingActivations':_0x4e4cf4,'isNew':_0x553d7e[_0x3894bd(0x91)],'hasChanges':_0x553d7e[_0x3894bd(0xe6)],'diff':_0x553d7e[_0x3894bd(0x16a)],'activationActions':_0x36fc9d});}return{'segmentFiles':_0x100025,'foldersToCreate':_0x57b6c6};}export async function prepareJourneyFiles(_0x3fde0d,_0x12a96d,_0x232d87,_0xafdbd3){const _0x45a777=a159_0x1187c8,_0x3343ac=[],_0x2956e1=new Set();for(const {yamlConfig:_0x1768e9,folderPath:_0x105585,sourcePath:_0x2ea9c5}of _0x3fde0d){const _0x1d2c6d=resolveTDFolderPath(_0x105585,_0x232d87,_0xafdbd3),_0x4e8337=_0x1d2c6d+':'+_0x1768e9[_0x45a777(0xa5)],_0x508903=_0x12a96d[_0x45a777(0xb4)][_0x45a777(0x16e)](_0x4e8337);let _0x6df062,_0x270a7b;if(_0x508903&&_0x508903['length']>0x0){const _0x3885a9=buildLocalExpandedRuleMappings(_0x1768e9),{createYamlContext:_0x315e9b,prefetchJourneySegments:_0x439d2e}=createPushYamlContextForBundle(_0x12a96d[_0x45a777(0x156)],_0x12a96d[_0x45a777(0xdc)],_0x12a96d[_0x45a777(0x105)],_0x3885a9,_0x12a96d[_0x45a777(0xcd)],_0x12a96d[_0x45a777(0x112)],_0x12a96d[_0x45a777(0xfd)],_0x12a96d[_0x45a777(0x132)]);await _0x439d2e(_0x508903[_0x45a777(0xbd)](_0x159323=>_0x159323['id']));const _0x5d03bd=await _0x12a96d[_0x45a777(0x156)][_0x45a777(0x98)][_0x45a777(0xd7)](_0x508903[0x0][_0x45a777(0x106)]),_0x388c62=hasMultipleVersions(_0x1768e9),_0x1381c6=async _0x325b61=>{const _0x274259=_0x45a777,_0x2ee838=_0x12a96d[_0x274259(0x132)]?.['get'](_0x325b61);if(_0x2ee838)return _0x2ee838;return _0x12a96d[_0x274259(0x165)]({'journeyId':_0x325b61,'journeyName':_0x1768e9[_0x274259(0xa5)],'isMultiVersion':_0x508903[_0x274259(0x136)]>0x1});};if(_0x388c62&&_0x508903[_0x45a777(0x136)]>0x1){const _0x57d380=[];for(const _0x4aa674 of _0x508903){const _0x40233c=_0x4aa674[_0x45a777(0xe2)]||0x1;_0x12a96d[_0x45a777(0x92)]?.[_0x45a777(0x94)](_0x45a777(0xd1)+_0x1768e9['name']+'\x20v'+_0x40233c);const _0x24c496=await _0x1381c6(_0x4aa674['id']),_0x16cc3e=_0x315e9b(_0x4aa674['id']),_0x1b336d=await journeyResponseToDef(_0x24c496,_0x16cc3e);_0x57d380['push']({'item':_0x4aa674,'yaml':_0x1b336d});}const _0x2638ed=buildLocalRuleToNameMappingFromJourney(_0x1768e9);_0x270a7b=buildMergedJourneyDef(_0x57d380,_0x2638ed,_0x5d03bd);const _0x4fe503=Math[_0x45a777(0x95)](..._0x57d380['map'](_0x374bde=>_0x374bde[_0x45a777(0x177)][_0x45a777(0xe2)]||0x0)),_0xc7d83c=_0x508903[_0x45a777(0x127)](_0x3b8e6b=>(_0x3b8e6b[_0x45a777(0xe2)]||0x0)===_0x4fe503);_0xc7d83c&&(_0x12a96d['progress']?.[_0x45a777(0x94)](_0x45a777(0xd1)+_0x1768e9[_0x45a777(0xa5)]+'\x20v'+_0x4fe503),_0x6df062=await _0x1381c6(_0xc7d83c['id']));}else{const _0x42d850=_0x508903[_0x508903[_0x45a777(0x136)]-0x1];_0x12a96d['progress']?.[_0x45a777(0x94)](_0x45a777(0xd1)+_0x1768e9[_0x45a777(0xa5)]),_0x6df062=await _0x1381c6(_0x42d850['id']);const _0x5d351d=_0x315e9b(_0x42d850['id']),_0x342fb7=await journeyResponseToDef(_0x6df062,_0x5d351d),_0x546d=buildLocalRuleToNameMappingFromJourney(_0x1768e9);_0x270a7b=buildMergedJourneyDef([{'item':_0x42d850,'yaml':_0x342fb7}],_0x546d,_0x5d03bd);}}addFoldersToCreate(_0x1d2c6d,_0x12a96d[_0x45a777(0xb5)],_0x2956e1);const _0x3b2245=calculateJourneyDiff(_0x1768e9,_0x270a7b);_0x3343ac[_0x45a777(0x97)]({'relativePath':_0x1768e9['name'],'absolutePath':_0x2ea9c5,'yamlConfig':_0x1768e9,'folderPath':_0x1d2c6d,'existingJourney':_0x6df062,'isNew':_0x3b2245[_0x45a777(0x91)],'hasChanges':_0x3b2245[_0x45a777(0xe6)],'diff':_0x3b2245[_0x45a777(0x16a)]});}return{'journeyFiles':_0x3343ac,'foldersToCreate':_0x2956e1};}export function calculateActivationActions(_0x1e2e27,_0x5dd7bb,_0xc35b91,_0x57e4fe){const _0x183227=a159_0x1187c8,_0x41fd99=[],_0x5fc8fd=new Map();for(const _0x8d9493 of _0x5dd7bb){_0x5fc8fd['set'](_0x8d9493[_0x183227(0xa5)],_0x8d9493);}const _0xbb6318=new Map();for(const _0x44efda of _0x1e2e27){_0xbb6318[_0x183227(0xcc)](_0x44efda['name'],_0x44efda);}for(const _0x1f260e of _0x1e2e27){const _0x470771=_0x5fc8fd['get'](_0x1f260e[_0x183227(0xa5)]);if(!_0x470771)_0x41fd99[_0x183227(0x97)]({'type':_0x183227(0x151),'name':_0x1f260e[_0x183227(0xa5)],'yamlActivation':_0x1f260e});else{const _0x62216c=activationResponseToDef(_0x470771,_0xc35b91,_0x57e4fe),_0x583695=a159_0x674282['stringify'](_0x62216c),_0x484767=a159_0x674282['stringify'](_0x1f260e);_0x583695!==_0x484767&&_0x41fd99[_0x183227(0x97)]({'type':_0x183227(0x94),'name':_0x1f260e[_0x183227(0xa5)],'yamlActivation':_0x1f260e,'existingActivation':_0x470771});}}for(const _0x2ad389 of _0x5dd7bb){!_0xbb6318[_0x183227(0xf9)](_0x2ad389[_0x183227(0xa5)])&&_0x41fd99[_0x183227(0x97)]({'type':_0x183227(0xc6),'name':_0x2ad389[_0x183227(0xa5)],'existingActivation':_0x2ad389});}return _0x41fd99;}function calculateYamlDiff(_0x443c0e,_0x2d2287){if(_0x2d2287){const _0x60e1ff=generateDiff(_0x2d2287,_0x443c0e),_0x14ded0=hasChanges(_0x60e1ff);return{'isNew':![],'hasChanges':_0x14ded0,'diff':_0x14ded0?formatDiffWithColors(_0x60e1ff):undefined};}const _0x4253db=generateDiff('',_0x443c0e);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x4253db)};}export function calculateSegmentDiff(_0x5a4936,_0x386275,_0x56f61c,_0x36cb1d,_0x182226){const _0x356ed3=segmentToYamlString(_0x5a4936),_0x1d8208=_0x386275?segmentToYamlString(segmentWithActivationsToYaml(_0x386275,_0x56f61c,undefined,_0x36cb1d,_0x182226)):undefined;return calculateYamlDiff(_0x356ed3,_0x1d8208);}export function calculateJourneyDiff(_0x4603b4,_0x941e53){const _0x208c0b=normalizeJourneyDef(_0x4603b4,_0x4603b4),_0x2b25b9=a159_0x164755(_0x208c0b),_0x41c716=_0x941e53?a159_0x164755(normalizeJourneyDef(_0x941e53,_0x4603b4)):undefined;return calculateYamlDiff(_0x2b25b9,_0x41c716);}export function findSegmentsToDelete(_0x22a59f,_0x51ed0e,_0x35fb64,_0x657404,_0x15e511){const _0x5c6601=new Set();for(const {yamlConfig:_0x5eaf18,folderPath:_0x77dd9b}of _0x51ed0e){_0x5c6601['add'](_0x77dd9b+':'+_0x5eaf18['name']);}return _0x22a59f['filter'](_0x46b33a=>{const _0x164ebd=a159_0x35a2,_0x5b564b=_0x46b33a['segmentFolderId']?_0x35fb64[_0x164ebd(0x16e)](_0x46b33a[_0x164ebd(0xbc)][_0x164ebd(0x13b)]())||'':'',_0x243458=_0x5b564b+':'+_0x46b33a['name'];if(_0x5c6601[_0x164ebd(0xf9)](_0x243458))return![];if(_0x15e511)return _0x5b564b===_0x657404||_0x5b564b[_0x164ebd(0x107)](_0x657404+'/');return!![];});}export function findJourneysToDelete(_0x27fd1e,_0x3bf093,_0x133b0e,_0x5cb1ca,_0x1bb1e4){const _0xb8dbd1=a159_0x1187c8,_0x262f8a=new Set();for(const {yamlConfig:_0x5a5cd2,folderPath:_0x14e82c}of _0x3bf093){_0x262f8a['add'](_0x14e82c+':'+_0x5a5cd2[_0xb8dbd1(0xa5)]);}return _0x27fd1e[_0xb8dbd1(0x158)](_0x156e07=>{const _0x29d8eb=_0xb8dbd1,_0x3ac938=_0x156e07[_0x29d8eb(0x8f)]?_0x133b0e['get'](_0x156e07[_0x29d8eb(0x8f)])||'':'',_0x1acb71=_0x3ac938+':'+_0x156e07[_0x29d8eb(0x16d)];if(_0x262f8a[_0x29d8eb(0xf9)](_0x1acb71))return![];if(_0x1bb1e4)return _0x3ac938===_0x5cb1ca||_0x3ac938['startsWith'](_0x5cb1ca+'/');return!![];});}export function buildSegmentLookupMap(_0x2017a8,_0x27d0ae){const _0x138fab=a159_0x1187c8,_0xc6db72=new Map();for(const _0x1bdbcc of _0x2017a8){const _0xc250a1=_0x1bdbcc['segmentFolderId']?_0x27d0ae[_0x138fab(0x16e)](_0x1bdbcc[_0x138fab(0xbc)][_0x138fab(0x13b)]())||'':'',_0x562fd6=_0xc250a1+':'+_0x1bdbcc[_0x138fab(0xa5)];_0xc6db72[_0x138fab(0xcc)](_0x562fd6,_0x1bdbcc);}return _0xc6db72;}export function buildSegmentNameToIdMap(_0x5b6840){const _0x3f0e8c=a159_0x1187c8,_0x1191a5=new Map();for(const _0x29cbbe of _0x5b6840){_0x1191a5[_0x3f0e8c(0xcc)](_0x29cbbe[_0x3f0e8c(0xa5)],_0x29cbbe['id']);}return _0x1191a5;}export function buildJourneyBundleLookupMap(_0x1103c2,_0x456359){const _0x78a794=a159_0x1187c8,_0x2fe3dd=new Map();for(const _0x3095ac of _0x1103c2){const _0x11c35c=_0x3095ac[_0x78a794(0x8f)]?_0x456359[_0x78a794(0x16e)](_0x3095ac[_0x78a794(0x8f)])||'':'',_0x2358a5=_0x11c35c+':'+_0x3095ac[_0x78a794(0x16d)];!_0x2fe3dd[_0x78a794(0xf9)](_0x2358a5)&&_0x2fe3dd[_0x78a794(0xcc)](_0x2358a5,[]),_0x2fe3dd[_0x78a794(0x16e)](_0x2358a5)[_0x78a794(0x97)](_0x3095ac);}for(const _0x37fc98 of _0x2fe3dd[_0x78a794(0x181)]()){_0x37fc98['sort']((_0x866cfc,_0x50afae)=>(_0x866cfc[_0x78a794(0xe2)]||0x0)-(_0x50afae['versionNumber']||0x0));}return _0x2fe3dd;}export function collectFoldersToCreate(_0x239552,_0x1d7a00){const _0x2301ee=a159_0x1187c8,_0xdf1478=new Set();for(const _0x19621a of _0x239552){if(!_0x19621a)continue;if(_0x1d7a00[_0x2301ee(0xf9)](_0x19621a))continue;const _0x37f99c=_0x19621a[_0x2301ee(0x160)]('/');let _0xc3729e='';for(const _0x5effd8 of _0x37f99c){_0xc3729e=_0xc3729e?_0xc3729e+'/'+_0x5effd8:_0x5effd8,!_0x1d7a00['has'](_0xc3729e)&&_0xdf1478[_0x2301ee(0xfb)](_0xc3729e);}}return _0xdf1478;}export function parseAndClassifyYamlFiles(_0x223fa7,_0x1715e9,_0x4d243a){const _0x2883ed=a159_0x1187c8,_0x17cc21=[],_0x2313d9=[];for(const _0x154db0 of _0x223fa7){const _0x5142b7=a159_0x4ef545[_0x2883ed(0x139)](_0x1715e9,a159_0x4ef545[_0x2883ed(0xe5)](_0x154db0)),_0x31383b=_0x5142b7==='.'?'':_0x5142b7['replace'](/\\/g,'/'),_0x10ee54=readFileSync(_0x154db0,_0x2883ed(0x17b)),_0xd39954=a159_0x674282[_0x2883ed(0xbf)](_0x10ee54);if(isJourneyDef(_0xd39954,_0x154db0)){const _0x23eeae=a159_0x29057a(_0x10ee54);_0x2313d9[_0x2883ed(0x97)]({'yamlConfig':_0x23eeae,'folderPath':_0x31383b,'sourcePath':_0x154db0});}else{if(!_0x4d243a?.[_0x2883ed(0xd9)]){const _0x31536a=parseSegmentYamlFile(_0x10ee54),_0x376121=normalizeChildSegmentYaml(_0x31536a);_0x17cc21[_0x2883ed(0x97)]({'yamlConfig':_0x376121,'folderPath':_0x31383b,'sourcePath':_0x154db0});}}}return{'segments':_0x17cc21,'journeys':_0x2313d9};}export function validateParsedFiles(_0x2b9c26,_0x53a7be){const _0x3aef1f=a159_0x1187c8,_0x2e3c81=[];for(const {yamlConfig:_0xf7fa24,sourcePath:_0x9b2c2}of _0x2b9c26[_0x3aef1f(0xe4)]){const _0x14a4e2=readFileSync(_0x9b2c2,_0x3aef1f(0x17b)),_0x4cad8e=a159_0x674282[_0x3aef1f(0x9e)](_0x14a4e2),_0x18b850=validateSegmentDef(_0xf7fa24,{'source':_0x14a4e2,'document':_0x4cad8e},{'skipSchema':!![]});if(!_0x18b850[_0x3aef1f(0x184)]){const _0x4cf512=a159_0x4ef545['relative'](_0x53a7be,_0x9b2c2);_0x2e3c81['push']({'filePath':_0x4cf512,'source':_0x14a4e2,'result':_0x18b850,'isJourney':![]});}}for(const {yamlConfig:_0x2937c7,sourcePath:_0x4f0f0f}of _0x2b9c26[_0x3aef1f(0x8a)]){const _0x2039d2=readFileSync(_0x4f0f0f,_0x3aef1f(0x17b)),_0x4c086b=a159_0x674282[_0x3aef1f(0x9e)](_0x2039d2),_0x398179=validateJourneyDef(_0x2937c7,{'source':_0x2039d2,'document':_0x4c086b},{'skipSchema':!![]});if(!_0x398179[_0x3aef1f(0x184)]){const _0x3324d7=a159_0x4ef545[_0x3aef1f(0x139)](_0x53a7be,_0x4f0f0f);_0x2e3c81[_0x3aef1f(0x97)]({'filePath':_0x3324d7,'source':_0x2039d2,'result':_0x398179,'isJourney':!![]});}}return _0x2e3c81;}export function formatValidationErrors(_0x354abb){const _0x3aece7=a159_0x1187c8,_0x4cb135=[];for(const {filePath:_0x4635b0,source:_0x318076,result:_0x46cbcf,isJourney:_0x547a68}of _0x354abb){const _0x5b640b=_0x547a68?_0x3aece7(0x98):_0x3aece7(0x120);_0x4cb135[_0x3aece7(0x97)]('\x0a'+_0x4635b0+'\x20('+_0x5b640b+_0x3aece7(0x93)+_0x46cbcf[_0x3aece7(0x178)][_0x3aece7(0x136)]+_0x3aece7(0x90)),_0x4cb135[_0x3aece7(0x97)](formatValidationResult(_0x46cbcf,_0x318076,_0x4635b0));}return _0x4cb135['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x239e41){const _0x120bcb=a159_0x1187c8,_0x423bc4=new Set(),_0x5a1c0e=new Map(),_0x3d3188=collectSegmentUsageCounts(_0x239e41);if(_0x239e41[_0x120bcb(0xe4)])for(const [_0x4df432,_0x2eb52a]of Object[_0x120bcb(0x163)](_0x239e41[_0x120bcb(0xe4)])){_0x423bc4[_0x120bcb(0xfb)](_0x4df432);if(_0x2eb52a['rule']){const _0x1af29a=yamlRuleToApi(_0x2eb52a[_0x120bcb(0x12e)]),_0x304f6e=apiRuleToYaml(_0x1af29a);_0x5a1c0e['set'](_0x4df432,_0x304f6e);}}const _0x202afa=new Map();let _0x5c479b=0x0;for(const [_0x30e7bb,_0x3b097b]of _0x5a1c0e){const _0x5b0ee7=serializeExpandedRule(_0x3b097b,_0x5a1c0e),_0x145f9a=_0x202afa[_0x120bcb(0x16e)](_0x5b0ee7)||[];_0x145f9a[_0x120bcb(0x97)]({'name':_0x30e7bb,'index':_0x5c479b}),_0x202afa[_0x120bcb(0xcc)](_0x5b0ee7,_0x145f9a),_0x5c479b++;}const _0x511099=new Map();for(const [_0xbf041a,_0x4aa4c6]of _0x202afa){const _0x4ebfe8=_0x4aa4c6[_0x120bcb(0x17d)]()[_0x120bcb(0x15f)]((_0x5d47f5,_0x99d892)=>{const _0x5d4dee=_0x120bcb,_0x3253f5=_0x3d3188[_0x5d4dee(0x16e)](_0x5d47f5[_0x5d4dee(0xa5)])||0x0,_0x2d4e71=_0x3d3188[_0x5d4dee(0x16e)](_0x99d892[_0x5d4dee(0xa5)])||0x0;if(_0x3253f5!==_0x2d4e71)return _0x2d4e71-_0x3253f5;return _0x5d47f5[_0x5d4dee(0x14c)]-_0x99d892['index'];})[_0x120bcb(0xbd)](_0x422173=>_0x422173[_0x120bcb(0xa5)]),_0x5cc507=[];for(const _0x92147b of _0x4ebfe8){const _0x55de0a=_0x3d3188['get'](_0x92147b)||0x0,_0x265bc8=Math['max'](_0x55de0a,0x1);for(let _0x9bf64a=0x0;_0x9bf64a<_0x265bc8;_0x9bf64a++){_0x5cc507['push'](_0x92147b);}}_0x511099['set'](_0xbf041a,_0x5cc507);}return{'existingLocalSegmentNames':_0x423bc4,'localSegmentRules':_0x5a1c0e,'localExpandedRuleToNames':_0x511099};}export function createSegmentIdResolver(_0x4d8d0a,_0x3cfe38){return async _0x928968=>{const _0x378665=a159_0x35a2,_0x1198b8=_0x4d8d0a['get'](_0x928968);if(!_0x1198b8)throw new SDKError(ErrorCode[_0x378665(0xd6)],_0x378665(0x13a)+_0x928968+_0x378665(0xb3)+_0x3cfe38+'\x27)');return _0x1198b8;};}export function extractRootFolderId(_0x1fded9){const _0x1b8bca=a159_0x1187c8;return _0x1fded9[_0x1b8bca(0xfa)]?.[_0x1b8bca(0x14e)]?.['data']?.['id']||_0x1fded9[_0x1b8bca(0xfa)]?.[_0x1b8bca(0xb2)]?.['data']?.['id'];}export function buildConnectionMaps(_0x236501){const _0x8f3a5d=a159_0x1187c8,_0x12767b=new Map(),_0x454bd2=new Map(),_0x254303=new Map();for(const _0x14ecce of _0x236501){_0x12767b[_0x8f3a5d(0xcc)](_0x14ecce[_0x8f3a5d(0xa5)],parseInt(_0x14ecce['id'],0xa)),_0x454bd2[_0x8f3a5d(0xcc)](_0x14ecce['id'],_0x14ecce[_0x8f3a5d(0xa5)]),_0x254303[_0x8f3a5d(0xcc)](_0x14ecce[_0x8f3a5d(0xa5)],_0x14ecce[_0x8f3a5d(0xd0)]);}return{'nameToId':_0x12767b,'idToName':_0x454bd2,'nameToType':_0x254303};}export function calculatePushStats(_0x45ad1e,_0x5b971f,_0x2d015e,_0x3d14df,_0x3426e3,_0x561f62,_0x2ee43c){const _0x13526b=a159_0x1187c8,_0x14fdb8=_0x45ad1e['filter'](_0x2985d6=>_0x2985d6[_0x13526b(0x91)]),_0x3c6b38=_0x45ad1e[_0x13526b(0x158)](_0x3d14ea=>!_0x3d14ea[_0x13526b(0x91)]&&_0x3d14ea['hasChanges']),_0xf42d9=_0x45ad1e[_0x13526b(0x158)](_0x28e225=>!_0x28e225[_0x13526b(0x91)]&&!_0x28e225[_0x13526b(0xe6)]),_0x5b746c=_0x561f62?_0x3d14df:[],_0x67572e=_0x5b971f[_0x13526b(0x158)](_0x1b4317=>_0x1b4317[_0x13526b(0x91)]),_0x31cb11=_0x5b971f[_0x13526b(0x158)](_0x2bf11c=>!_0x2bf11c[_0x13526b(0x91)]&&_0x2bf11c[_0x13526b(0xe6)]),_0x541d7c=_0x5b971f[_0x13526b(0x158)](_0x4ae164=>!_0x4ae164['isNew']&&!_0x4ae164[_0x13526b(0xe6)]),_0x4309b1=_0x561f62?_0x3426e3:[],_0x11734c=_0x45ad1e['flatMap'](_0x2adf6b=>_0x2adf6b[_0x13526b(0x16c)]),_0x1ae157=_0x11734c[_0x13526b(0x158)](_0x35babd=>_0x35babd[_0x13526b(0xd0)]==='create'),_0x2454ee=_0x11734c['filter'](_0x3b9392=>_0x3b9392[_0x13526b(0xd0)]==='update'),_0x4bc860=_0x11734c[_0x13526b(0x158)](_0x4e786d=>_0x4e786d[_0x13526b(0xd0)]===_0x13526b(0xc6)),_0x18eb0d=Array[_0x13526b(0xe8)](_0x2d015e)[_0x13526b(0x15f)](),_0x2fe995=_0x2ee43c?![]:_0x14fdb8['length']>0x0||_0x3c6b38[_0x13526b(0x136)]>0x0||_0x5b746c[_0x13526b(0x136)]>0x0,_0x25514f=_0x67572e[_0x13526b(0x136)]>0x0||_0x31cb11[_0x13526b(0x136)]>0x0||_0x4309b1['length']>0x0,_0x5c8cda=_0x2ee43c?![]:_0x11734c[_0x13526b(0x136)]>0x0,_0x5c07dc=_0x18eb0d[_0x13526b(0x136)]>0x0;return{'segments':{'new':_0x14fdb8,'changed':_0x3c6b38,'unchanged':_0xf42d9,'toDelete':_0x5b746c},'journeys':{'new':_0x67572e,'changed':_0x31cb11,'unchanged':_0x541d7c,'toDelete':_0x4309b1},'activations':{'all':_0x11734c,'toCreate':_0x1ae157,'toUpdate':_0x2454ee,'toDelete':_0x4bc860},'folders':{'toCreate':_0x18eb0d},'counts':{'segments':{'new':_0x14fdb8[_0x13526b(0x136)],'changed':_0x3c6b38['length'],'unchanged':_0xf42d9[_0x13526b(0x136)],'toDelete':_0x5b746c[_0x13526b(0x136)]},'journeys':{'new':_0x67572e[_0x13526b(0x136)],'changed':_0x31cb11[_0x13526b(0x136)],'unchanged':_0x541d7c['length'],'toDelete':_0x4309b1[_0x13526b(0x136)]},'activations':{'create':_0x1ae157[_0x13526b(0x136)],'update':_0x2454ee[_0x13526b(0x136)],'delete':_0x4bc860['length']},'folders':_0x18eb0d[_0x13526b(0x136)]},'hasChanges':_0x2fe995||_0x25514f||_0x5c8cda||_0x5c07dc};}export async function buildPushExecutionContext(_0x32f74a,_0xea0719,_0x305552,_0x30ecc7,_0x2e5d45,_0x1cb9df){const _0x61a025=a159_0x1187c8,_0x4b5886=extractRootFolderId(_0x305552),{pathToId:_0xb40653,idToPath:_0x445f5e}=buildFolderMaps(_0x2e5d45),_0x22b67f=buildSegmentNameToIdMap(_0x30ecc7),_0x2d0104=new Map(),{batchAsync:_0xb9693d}=await import(_0x61a025(0xea)),[_0x12c5f1,_0x5c7504]=await Promise[_0x61a025(0xa7)]([_0x32f74a[_0x61a025(0x17a)]['buildUserMaps'](),_0x32f74a[_0x61a025(0xa3)][_0x61a025(0x100)](),((async()=>{const _0x648262=_0x61a025;!_0x1cb9df&&_0x30ecc7[_0x648262(0x136)]>0x0&&await _0xb9693d(_0x30ecc7,async _0x2a61d4=>{const _0x1d4483=_0x648262,_0x4cbc3b=await _0x32f74a[_0x1d4483(0x120)][_0x1d4483(0x11b)](_0xea0719,_0x2a61d4['id']);_0x2d0104['set'](_0x2a61d4['id'],_0x4cbc3b);});})())]),{emailToId:_0x6a6692,idToEmail:_0xade433}=_0x12c5f1,_0xbfca31=buildConnectionMaps(_0x5c7504);return{'rootFolderId':_0x4b5886,'folderPathToId':_0xb40653,'folderIdToPath':_0x445f5e,'segmentNameToId':_0x22b67f,'activationsBySegmentId':_0x2d0104,'emailToIdMap':_0x6a6692,'idToEmailMap':_0xade433,'connectionNameToIdMap':_0xbfca31['nameToId'],'connectionIdToNameMap':_0xbfca31[_0x61a025(0x15a)],'connectionNameToTypeMap':_0xbfca31[_0x61a025(0xc2)]};}export function createPushYamlContextForBundle(_0x512579,_0x4a5cc3,_0x4be111,_0x143f9d,_0x7de4d4,_0x5a69e1,_0x5f5618,_0x40bdae){const {existingLocalSegmentNames:_0x24e176,localExpandedRuleToNames:_0x51e872}=_0x143f9d,_0x12f82c=new Set(),_0x23236a=new Map(),_0x4775bd=new Map(),_0x209a5f=new Map(),_0x513339=createJumpTargetCache(),_0x200fdb=new Map(),_0x184094=new Map(),_0x4d0e21=new Set();let _0x339b67;const _0x371aa7=_0x189d00=>{const _0x3d9e89={'resolveSegment':async _0x15df92=>{const _0x3c15e7=a159_0x35a2,_0x2b6b1a=_0x209a5f[_0x3c15e7(0x16e)](_0x15df92);if(_0x2b6b1a!==undefined)return{'name':_0x2b6b1a,'isJourneyLocal':!![]};try{const _0x97c5cd=await fetchSegment(_0x512579,_0x4a5cc3,_0x15df92,_0x4be111);if(!_0x97c5cd)throw new Error(_0x3c15e7(0x167));const _0x591a9e=generateJourneyLocalName(_0x97c5cd[_0x3c15e7(0xa5)]),_0x2c6bb1=_0x97c5cd['kind']===SEGMENT_KIND_JOURNEY&&_0x591a9e!==undefined;let _0x4af9b0=_0x97c5cd[_0x3c15e7(0xa5)],_0x3822eb;if(_0x2c6bb1&&_0x97c5cd['rule']){const _0x4cd0b6=apiRuleToYaml(_0x97c5cd[_0x3c15e7(0x12e)]);_0x184094[_0x3c15e7(0xcc)](_0x15df92,_0x4cd0b6);const _0x288d15=async _0x46e98b=>{const _0x2fbbb0=_0x3c15e7,_0x36c583=collectSegmentRefsFromRule(_0x46e98b);for(const _0x42fec5 of _0x36c583){if(!_0x184094[_0x2fbbb0(0xf9)](_0x42fec5))try{const _0x4fae76=await fetchSegment(_0x512579,_0x4a5cc3,_0x42fec5,_0x4be111);if(_0x4fae76?.['rule']){const _0x54148b=apiRuleToYaml(_0x4fae76[_0x2fbbb0(0x12e)]);_0x184094['set'](_0x42fec5,_0x54148b),await _0x288d15(_0x54148b);}}catch(_0x2193a4){logger[_0x2fbbb0(0x14f)](_0x2fbbb0(0xdf)+_0x42fec5+':\x20'+_0x2193a4);}}};await _0x288d15(_0x4cd0b6);const _0x5ef622=serializeExpandedRule(_0x4cd0b6,_0x184094),_0x406f6d=_0x51e872[_0x3c15e7(0x16e)](_0x5ef622);if(_0x406f6d&&_0x406f6d[_0x3c15e7(0x136)]>0x0){const _0x5cb85e=_0x23236a['get'](_0x5ef622)||0x0,_0x2aa241=_0x406f6d[_0x5cb85e]||_0x406f6d[_0x406f6d[_0x3c15e7(0x136)]-0x1];_0x23236a['set'](_0x5ef622,_0x5cb85e+0x1),_0x4af9b0=_0x2aa241,_0x12f82c['add'](_0x4af9b0),_0x209a5f['set'](_0x15df92,_0x4af9b0);const _0x597626=await resolveRuleSegmentRefs(_0x4cd0b6,async _0x5e2d26=>{const _0x3eaac5=_0x3c15e7,_0x58d075=_0x209a5f[_0x3eaac5(0x16e)](_0x5e2d26);if(_0x58d075)return _0x58d075;const _0xffcc69=await _0x339b67[_0x3eaac5(0x11a)](_0x5e2d26);return _0xffcc69[_0x3eaac5(0xa5)];});_0x3822eb={'description':_0x97c5cd[_0x3c15e7(0x186)],'rule':_0x597626};}else{const _0x22ef7f=_0x200fdb[_0x3c15e7(0x16e)](_0x5ef622);if(_0x22ef7f)_0x4af9b0=_0x22ef7f,_0x209a5f[_0x3c15e7(0xcc)](_0x15df92,_0x4af9b0);else{if(_0x591a9e){let _0x55c8fd=_0x591a9e,_0xc9a13a=0x2;while(_0x12f82c['has'](_0x55c8fd)||_0x24e176[_0x3c15e7(0xf9)](_0x55c8fd)){_0x55c8fd=_0x591a9e+'_'+_0xc9a13a,_0xc9a13a++;}_0x12f82c[_0x3c15e7(0xfb)](_0x55c8fd),_0x4af9b0=_0x55c8fd;}_0x209a5f[_0x3c15e7(0xcc)](_0x15df92,_0x4af9b0),_0x200fdb['set'](_0x5ef622,_0x4af9b0);const _0xd3f93f=await resolveRuleSegmentRefs(_0x4cd0b6,async _0x4eda8c=>{const _0x4211f6=_0x3c15e7,_0x142f0d=_0x209a5f[_0x4211f6(0x16e)](_0x4eda8c);if(_0x142f0d)return _0x142f0d;const _0x1a135d=await _0x339b67[_0x4211f6(0x11a)](_0x4eda8c);return _0x1a135d['name'];});_0x3822eb={'description':_0x97c5cd[_0x3c15e7(0x186)],'rule':_0xd3f93f};}}}return{'name':_0x4af9b0,'isJourneyLocal':_0x2c6bb1,'definition':_0x3822eb};}catch(_0x59fd99){return logger['debug'](_0x3c15e7(0xf7)+_0x15df92+':\x20'+_0x59fd99),{'name':_0x15df92,'isJourneyLocal':![]};}},'resolveActivation':async _0x147da2=>{const _0x4b06cf=a159_0x35a2,_0x3abb90=_0x4775bd[_0x4b06cf(0x16e)](_0x147da2);if(_0x3abb90!==undefined)return{'name':_0x3abb90,'isJourneyLocal':!![]};try{let _0x827553=_0x5f5618?.['get'](_0x147da2);!_0x827553&&(_0x827553=await _0x512579['journey'][_0x4b06cf(0x9d)](_0x189d00,_0x147da2));const _0x4fc910=_0x827553[_0x4b06cf(0x18a)][_0x4b06cf(0x12d)][_0x4b06cf(0xa5)]||_0x147da2,_0x20d0b5=sanitizeYamlKey(_0x4fc910)||_0x4b06cf(0xc1)+_0x147da2,_0x1878a3=_0x20d0b5;_0x4775bd[_0x4b06cf(0xcc)](_0x147da2,_0x1878a3);const _0x5095a8=journeyActivationStepToYaml(_0x827553,_0x7de4d4,_0x5a69e1);return{'name':_0x1878a3,'isJourneyLocal':!![],'definition':_0x5095a8};}catch(_0x2d3104){return logger[_0x4b06cf(0x14f)](_0x4b06cf(0x10f)+_0x147da2+':\x20'+_0x2d3104),{'name':_0x147da2,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x39b45b,_0x265be2)=>resolveJumpTarget(_0x39b45b,_0x265be2,_0x513339,async _0x324810=>{const _0x48a432=a159_0x35a2,_0x5dffb0=_0x40bdae?.[_0x48a432(0x16e)](_0x324810);if(_0x5dffb0)return _0x5dffb0;return _0x512579[_0x48a432(0x98)]['getJourney'](_0x324810);})};return _0x339b67=_0x3d9e89,_0x3d9e89;},_0xea0e0f=async _0x33329e=>{const _0x41a76f=a159_0x35a2,{collectSegmentIdsFromJourneyApi:_0x47ec0b}=await import(_0x41a76f(0x110)),{batchAsync:_0x152ab2}=await import(_0x41a76f(0xea)),_0x1c2db4=new Set();for(const _0x253ace of _0x33329e){let _0xbb4bbd=_0x40bdae?.['get'](_0x253ace);!_0xbb4bbd&&(_0xbb4bbd=await _0x512579[_0x41a76f(0x98)][_0x41a76f(0x15c)](_0x253ace));const _0x16d175=_0x47ec0b(_0xbb4bbd);for(const _0x240604 of _0x16d175){_0x1c2db4[_0x41a76f(0xfb)](_0x240604);}}let _0xee3313=Array['from'](_0x1c2db4);while(_0xee3313['length']>0x0){const _0x1c8e4b=_0xee3313[_0x41a76f(0x158)](_0x8369fb=>!_0x4d0e21['has'](_0x8369fb));if(_0x1c8e4b['length']===0x0)break;const _0x2c9a8e=await _0x152ab2(_0x1c8e4b,async _0x5abe87=>{const _0x1f8f6d=_0x41a76f;_0x4d0e21[_0x1f8f6d(0xfb)](_0x5abe87);const _0x5e7e5b=await fetchSegment(_0x512579,_0x4a5cc3,_0x5abe87,_0x4be111);if(!_0x5e7e5b)return null;return{'segmentId':_0x5abe87,'segment':_0x5e7e5b};},0xa),_0xd5f95=new Set();for(const _0x40e758 of _0x2c9a8e){if(!_0x40e758?.[_0x41a76f(0x120)]?.[_0x41a76f(0x12e)])continue;const _0x592977=apiRuleToYaml(_0x40e758[_0x41a76f(0x120)][_0x41a76f(0x12e)]);_0x184094[_0x41a76f(0xcc)](_0x40e758['segmentId'],_0x592977);const _0x1cb76e=collectSegmentRefsFromRule(_0x592977);for(const _0x237fe4 of _0x1cb76e){!_0x4d0e21[_0x41a76f(0xf9)](_0x237fe4)&&_0xd5f95[_0x41a76f(0xfb)](_0x237fe4);}}_0xee3313=Array[_0x41a76f(0xe8)](_0xd5f95);}};return{'createYamlContext':_0x371aa7,'prefetchJourneySegments':_0xea0e0f};}export async function executePushSegments(_0x50cdfb,_0x37a596,_0x10d9f4,_0x3782a4,_0x124880){const _0x581b51=a159_0x1187c8,{segmentDefToCreateRequest:_0x226f00,segmentDefToUpdateRequest:_0x2d5e34}=await import('./child-segment-yaml.js'),_0x25650=_0x10d9f4[_0x581b51(0xb5)],_0x18bfb5=0x5,_0x548df4=async _0x41bc14=>{const _0x5d3923=_0x581b51,_0x398746=_0x41bc14[_0x5d3923(0xeb)]?_0x25650[_0x5d3923(0x16e)](_0x41bc14['folderPath']):undefined;let _0x46aa22;const _0x5d2eee={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x250060=_0x41bc14['yamlConfig'];if(_0x41bc14['yamlConfig'][_0x5d3923(0x12e)]){const _0x1d7bda=createSegmentIdResolver(_0x10d9f4['segmentNameToId'],_0x41bc14[_0x5d3923(0xf2)]['name']),_0x26a87c=await resolveRuleSegmentIds(_0x41bc14[_0x5d3923(0xf2)]['rule'],_0x1d7bda);_0x250060={..._0x41bc14[_0x5d3923(0xf2)],'rule':_0x26a87c};}try{if(_0x41bc14['isNew']){_0x124880[_0x5d3923(0xec)]?.({'type':_0x5d3923(0x129),'name':_0x41bc14[_0x5d3923(0xf2)]['name']});const _0x5e6f57=_0x226f00(_0x250060,_0x398746),_0x37efcb=await _0x124880[_0x5d3923(0x118)](_0x5d3923(0x170)+_0x41bc14[_0x5d3923(0xf2)]['name']+'\x27...',()=>_0x50cdfb['segment']['createSegment'](_0x3782a4[_0x5d3923(0xdc)],_0x5e6f57));_0x46aa22=_0x37efcb[_0x5d3923(0xd2)]['id'],_0x10d9f4[_0x5d3923(0x115)][_0x5d3923(0xcc)](_0x41bc14[_0x5d3923(0xf2)][_0x5d3923(0xa5)],_0x46aa22),_0x5d2eee[_0x5d3923(0x154)]={'name':_0x41bc14['yamlConfig'][_0x5d3923(0xa5)],'id':_0x46aa22},_0x124880[_0x5d3923(0xec)]?.({'type':_0x5d3923(0xe9),'name':_0x41bc14['yamlConfig'][_0x5d3923(0xa5)],'segmentId':_0x46aa22}),_0x124880[_0x5d3923(0x12a)]?.(_0x5d3923(0xb7)+_0x41bc14[_0x5d3923(0xf2)][_0x5d3923(0xa5)]+'\x27'),_0x5d2eee[_0x5d3923(0xae)]=0x1;}else{if(_0x41bc14['hasChanges']){_0x124880['onProgress']?.({'type':'segment_updating','name':_0x41bc14['yamlConfig'][_0x5d3923(0xa5)]});const _0x19fe79=_0x2d5e34(_0x250060);_0x398746!==_0x41bc14[_0x5d3923(0x123)]?.[_0x5d3923(0xbc)]&&(_0x19fe79[_0x5d3923(0xbc)]=_0x398746?parseInt(_0x398746,0xa):undefined),await _0x124880[_0x5d3923(0x118)](_0x5d3923(0xda)+_0x41bc14['yamlConfig'][_0x5d3923(0xa5)]+_0x5d3923(0x150),()=>_0x50cdfb['segment'][_0x5d3923(0x155)](_0x3782a4[_0x5d3923(0xdc)],_0x41bc14[_0x5d3923(0x123)]['id'],_0x19fe79)),_0x46aa22=_0x41bc14[_0x5d3923(0x123)]['id'],_0x124880[_0x5d3923(0xec)]?.({'type':_0x5d3923(0x131),'name':_0x41bc14[_0x5d3923(0xf2)][_0x5d3923(0xa5)]}),_0x124880[_0x5d3923(0x12a)]?.('Updated\x20segment\x20\x27'+_0x41bc14[_0x5d3923(0xf2)][_0x5d3923(0xa5)]+'\x27'),_0x5d2eee[_0x5d3923(0xcb)]=0x1;}else _0x46aa22=_0x41bc14[_0x5d3923(0x123)]['id'];}}catch(_0x15c9b9){const _0x5bd40a=isHttp400Error(_0x15c9b9),_0x5bcc93=_0x5bd40a?ErrorCode[_0x5d3923(0x121)]:ErrorCode[_0x5d3923(0x11f)],_0x337073=getErrorMessage(_0x15c9b9);throw new SDKError(_0x5bcc93,'Failed\x20to\x20'+(_0x41bc14[_0x5d3923(0x91)]?_0x5d3923(0x151):_0x5d3923(0x94))+_0x5d3923(0xc4)+_0x41bc14['absolutePath']+_0x5d3923(0x96)+_0x337073,_0x15c9b9);}try{const _0x4e7a1f=await syncActivationsForSegment(_0x50cdfb,_0x3782a4['parentId'],_0x46aa22,_0x41bc14[_0x5d3923(0xf2)]['name'],_0x41bc14[_0x5d3923(0x16c)],_0x124880,_0x41bc14[_0x5d3923(0x166)]);_0x5d2eee[_0x5d3923(0xc5)]=_0x4e7a1f;}catch(_0xfd0f76){if(_0xfd0f76 instanceof SDKError)throw _0xfd0f76;throw new SDKError(ErrorCode[_0x5d3923(0x16f)],_0x5d3923(0x126)+_0x41bc14[_0x5d3923(0xf2)][_0x5d3923(0xa5)]+_0x5d3923(0x182)+_0x41bc14['absolutePath']+_0x5d3923(0x96)+getErrorMessage(_0xfd0f76),_0xfd0f76);}return _0x5d2eee;},_0x426811=await batchAsync(_0x37a596,_0x548df4,_0x18bfb5),_0x4143a2={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x478f0c of _0x426811){_0x4143a2[_0x581b51(0xae)]+=_0x478f0c['created'],_0x4143a2[_0x581b51(0xcb)]+=_0x478f0c['updated'],_0x478f0c[_0x581b51(0x154)]&&_0x4143a2[_0x581b51(0x179)][_0x581b51(0xcc)](_0x478f0c[_0x581b51(0x154)][_0x581b51(0xa5)],_0x478f0c['createdSegmentId']['id']),_0x4143a2[_0x581b51(0xc5)][_0x581b51(0xae)]+=_0x478f0c[_0x581b51(0xc5)][_0x581b51(0xae)],_0x4143a2[_0x581b51(0xc5)][_0x581b51(0xcb)]+=_0x478f0c[_0x581b51(0xc5)][_0x581b51(0xcb)],_0x4143a2['activations'][_0x581b51(0xf1)]+=_0x478f0c[_0x581b51(0xc5)][_0x581b51(0xf1)];}return _0x4143a2;}async function syncActivationsForSegment(_0x529ba4,_0x23ed1c,_0xb7e409,_0x164d29,_0x3c371d,_0x33588d,_0x38d908){const _0x56d4de=a159_0x1187c8,_0x4ec326={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x419dc2 of _0x3c371d){try{if(_0x419dc2[_0x56d4de(0xd0)]==='create'&&_0x419dc2['validatedRequest'])_0x33588d['onProgress']?.({'type':'activation_creating','segmentName':_0x164d29,'activationName':_0x419dc2[_0x56d4de(0xa5)]}),await _0x33588d[_0x56d4de(0x118)](_0x56d4de(0xe7)+_0x419dc2[_0x56d4de(0xa5)]+'\x27...',()=>_0x529ba4[_0x56d4de(0x120)][_0x56d4de(0xc0)](_0x23ed1c,_0xb7e409,_0x419dc2[_0x56d4de(0xad)])),_0x33588d[_0x56d4de(0xec)]?.({'type':'activation_created','segmentName':_0x164d29,'activationName':_0x419dc2['name']}),_0x33588d[_0x56d4de(0x12a)]?.(_0x56d4de(0xc7)+_0x419dc2[_0x56d4de(0xa5)]+'\x27'),_0x4ec326[_0x56d4de(0xae)]++;else{if(_0x419dc2[_0x56d4de(0xd0)]==='update'&&_0x419dc2[_0x56d4de(0xad)]&&_0x419dc2[_0x56d4de(0xc3)])_0x33588d[_0x56d4de(0xec)]?.({'type':_0x56d4de(0x122),'segmentName':_0x164d29,'activationName':_0x419dc2[_0x56d4de(0xa5)]}),await _0x33588d[_0x56d4de(0x118)](_0x56d4de(0x89)+_0x419dc2['name']+_0x56d4de(0x150),()=>_0x529ba4[_0x56d4de(0x120)]['updateActivation'](_0x23ed1c,_0xb7e409,_0x419dc2[_0x56d4de(0xc3)]['id'],_0x419dc2[_0x56d4de(0xad)])),_0x33588d[_0x56d4de(0xec)]?.({'type':_0x56d4de(0x148),'segmentName':_0x164d29,'activationName':_0x419dc2[_0x56d4de(0xa5)]}),_0x33588d[_0x56d4de(0x12a)]?.(_0x56d4de(0x137)+_0x419dc2[_0x56d4de(0xa5)]+'\x27'),_0x4ec326[_0x56d4de(0xcb)]++;else _0x419dc2[_0x56d4de(0xd0)]===_0x56d4de(0xc6)&&_0x419dc2[_0x56d4de(0xc3)]&&(_0x33588d[_0x56d4de(0xec)]?.({'type':_0x56d4de(0x117),'segmentName':_0x164d29,'activationName':_0x419dc2[_0x56d4de(0xa5)]}),await _0x33588d[_0x56d4de(0x118)](_0x56d4de(0x133)+_0x419dc2[_0x56d4de(0xa5)]+_0x56d4de(0x150),()=>_0x529ba4['segment'][_0x56d4de(0x143)](_0x23ed1c,_0xb7e409,_0x419dc2['existingActivation']['id'])),_0x33588d[_0x56d4de(0xec)]?.({'type':_0x56d4de(0x9c),'segmentName':_0x164d29,'activationName':_0x419dc2[_0x56d4de(0xa5)]}),_0x33588d['logDeleted']?.(_0x56d4de(0x8c)+_0x419dc2['name']+'\x27'),_0x4ec326[_0x56d4de(0xf1)]++);}}catch(_0x266c5a){const _0x4852d6=isHttp400Error(_0x266c5a),_0x272084=_0x4852d6?ErrorCode[_0x56d4de(0x109)]:ErrorCode[_0x56d4de(0x16f)],_0x57852a=getErrorMessage(_0x266c5a);throw new SDKError(_0x272084,_0x56d4de(0xbe)+_0x419dc2[_0x56d4de(0xd0)]+'\x20activation\x20\x27'+_0x419dc2[_0x56d4de(0xa5)]+_0x56d4de(0x182)+_0x38d908+_0x56d4de(0x96)+_0x57852a,_0x266c5a);}}return _0x4ec326;}export async function executePushFolders(_0x107331,_0x5adc8f,_0x53cb3e,_0x313cfd,_0xb960e4){const _0x32bd63=a159_0x1187c8,_0x35162d=new Map(_0x53cb3e),_0x2e92ca=sortFoldersByDepth(_0x5adc8f);for(const _0x1b15c9 of _0x2e92ca){const _0x1c71ed=_0x1b15c9[_0x32bd63(0x160)]('/'),_0x2c043a=_0x1c71ed[_0x1c71ed[_0x32bd63(0x136)]-0x1],_0x215bed=_0x1c71ed[_0x32bd63(0x17d)](0x0,-0x1)[_0x32bd63(0x187)]('/'),_0x3b697e=_0x35162d[_0x32bd63(0x16e)](_0x215bed);_0xb960e4[_0x32bd63(0xec)]?.({'type':_0x32bd63(0xc9),'folder':_0x1b15c9});const _0x1f20c7={'name':_0x2c043a,'parentFolderId':_0x3b697e},_0x3e2d23=await _0xb960e4['withProgress'](_0x32bd63(0x162)+_0x1b15c9+_0x32bd63(0x150),()=>_0x107331[_0x32bd63(0x120)][_0x32bd63(0xc8)](_0x313cfd[_0x32bd63(0xdc)],_0x1f20c7));_0x35162d[_0x32bd63(0xcc)](_0x1b15c9,_0x3e2d23[_0x32bd63(0xd2)]['id']),_0xb960e4[_0x32bd63(0xec)]?.({'type':_0x32bd63(0xdd),'folder':_0x1b15c9,'folderId':_0x3e2d23[_0x32bd63(0xd2)]['id']}),_0xb960e4[_0x32bd63(0x15d)]?.(_0x32bd63(0x144)+_0x1b15c9+'\x27');}return _0x35162d;}export async function executePushSegmentDeletions(_0x5046a5,_0x74ff11,_0x9a1de){const _0x28401f=a159_0x1187c8;if(_0x74ff11['length']===0x0)return 0x0;const {batchAsync:_0x1b491d}=await import(_0x28401f(0xea)),_0x526903=0x5,_0x38483b=await _0x1b491d(_0x74ff11,async _0x3dde6e=>{const _0x203a96=_0x28401f;return _0x9a1de['onProgress']?.({'type':_0x203a96(0xb1),'name':_0x3dde6e[_0x203a96(0xa5)]}),await _0x5046a5[_0x203a96(0x120)][_0x203a96(0xf3)](_0x3dde6e['id']),_0x9a1de[_0x203a96(0xec)]?.({'type':_0x203a96(0x101),'name':_0x3dde6e['name']}),_0x9a1de[_0x203a96(0x8e)]?.('Deleted\x20segment\x20\x27'+_0x3dde6e[_0x203a96(0xa5)]+'\x27'),0x1;},_0x526903);return _0x38483b['reduce']((_0x1380a8,_0x544e80)=>_0x1380a8+_0x544e80,0x0);}export async function executePushJourneys(_0xb684e8,_0x1e49b5,_0x431465,_0x4120ef,_0x3ef027){const _0x4c1dc6=a159_0x1187c8,{journeyDefToRequest:_0x42daf2}=await import(_0x4c1dc6(0x110)),{activationDefToCreateRequest:_0xe45a22,yamlRuleToApi:_0x1e6ede,validateSegmentRule:_0x12ca30}=await import(_0x4c1dc6(0x12b)),_0x57d274={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x2400c1=new Map(_0x431465[_0x4c1dc6(0x115)]),_0x5d61e7=0x5;for(let _0x28e73b=0x0;_0x28e73b<_0x1e49b5[_0x4c1dc6(0x136)];_0x28e73b+=_0x5d61e7){const _0x300719=_0x1e49b5[_0x4c1dc6(0x17d)](_0x28e73b,_0x28e73b+_0x5d61e7),_0x2bde2b=await Promise[_0x4c1dc6(0xa7)](_0x300719[_0x4c1dc6(0xbd)](async _0x169678=>{const _0x408477=_0x4c1dc6;if(!_0x169678[_0x408477(0x91)]&&!_0x169678[_0x408477(0xe6)])return{'action':_0x408477(0x176),'name':_0x169678[_0x408477(0xf2)][_0x408477(0xa5)],'journeyId':_0x169678[_0x408477(0x111)]?.['id']};const _0x9a3a4d=_0x169678[_0x408477(0xeb)]?_0x431465[_0x408477(0xb5)][_0x408477(0x16e)](_0x169678[_0x408477(0xeb)]):undefined;_0x3ef027[_0x408477(0xec)]?.({'type':_0x169678[_0x408477(0x91)]?_0x408477(0x145):_0x408477(0x159),'name':_0x169678[_0x408477(0xf2)][_0x408477(0xa5)]});try{const _0x3f71b8=await executeSingleJourneyPush(_0xb684e8,_0x169678,{..._0x431465,'segmentNameToId':_0x2400c1},{'parentId':_0x4120ef[_0x408477(0xdc)],'rootFolderId':_0x4120ef['rootFolderId'],'folderId':_0x9a3a4d,'verbose':_0x4120ef['verbose']},_0x3ef027,{'journeyDefToRequest':_0x42daf2,'activationDefToCreateRequest':_0xe45a22,'yamlRuleToApi':_0x1e6ede,'validateSegmentRule':_0x12ca30});for(const [_0xbf57e0,_0x4884a1]of _0x3f71b8[_0x408477(0xa0)]){_0x2400c1[_0x408477(0xcc)](_0xbf57e0,_0x4884a1),_0x57d274['embeddedSegmentNameToId'][_0x408477(0xcc)](_0xbf57e0,_0x4884a1);}if(_0x3f71b8[_0x408477(0xcf)]===_0x408477(0xae))_0x3ef027['onProgress']?.({'type':_0x408477(0x183),'name':_0x169678['yamlConfig'][_0x408477(0xa5)],'journeyId':_0x3f71b8['journeyId']}),_0x3ef027[_0x408477(0x12a)]?.(_0x408477(0x153)+_0x169678[_0x408477(0xf2)][_0x408477(0xa5)]+'\x27'),_0x57d274[_0x408477(0xae)]++;else _0x3f71b8['action']==='updated'&&(_0x3ef027[_0x408477(0xec)]?.({'type':_0x408477(0x14d),'name':_0x169678[_0x408477(0xf2)]['name']}),_0x3ef027[_0x408477(0x12a)]?.('Updated\x20journey\x20\x27'+_0x169678[_0x408477(0xf2)]['name']+'\x27'),_0x57d274[_0x408477(0xcb)]++);return{'action':_0x3f71b8[_0x408477(0xcf)],'name':_0x169678[_0x408477(0xf2)][_0x408477(0xa5)],'journeyId':_0x3f71b8[_0x408477(0x10e)]};}catch(_0x1eeec6){const _0x174b44=isHttp400Error(_0x1eeec6),_0x30f811=_0x174b44?ErrorCode[_0x408477(0x119)]:ErrorCode[_0x408477(0x169)],_0x443667=getErrorMessage(_0x1eeec6);throw new SDKError(_0x30f811,_0x408477(0xbe)+(_0x169678['isNew']?_0x408477(0x151):_0x408477(0x94))+_0x408477(0xd3)+_0x169678[_0x408477(0x166)]+_0x408477(0x96)+_0x443667,_0x1eeec6);}}));_0x57d274[_0x4c1dc6(0xef)][_0x4c1dc6(0x97)](..._0x2bde2b);}return _0x57d274;}async function matchExistingJourneySegments(_0x700232,_0x756ce0,_0x3f1d07,_0xca83e8,_0x10f72e){const _0x465ec1=a159_0x1187c8;if(!_0x756ce0['existingJourney']||!_0x756ce0['yamlConfig'][_0x465ec1(0xe4)])return;const _0x4251c2=new Map(),_0x2c15b0=new Set();for(const _0x401dc9 of Object['keys'](_0x756ce0['yamlConfig'][_0x465ec1(0xe4)])){const _0x2253d7=generateDeterministicJourneySegmentName(_0x756ce0[_0x465ec1(0xf2)][_0x465ec1(0xa5)],_0x401dc9);_0x4251c2[_0x465ec1(0xcc)](_0x2253d7,_0x401dc9),_0x2c15b0[_0x465ec1(0xfb)](_0x401dc9);}const _0x18a894=[],_0x29a1f5=collectSegmentIdsFromJourneyApi(_0x756ce0[_0x465ec1(0x111)]);for(const _0x39747f of _0x29a1f5){const _0xd78770=await fetchSegment(_0x700232,_0x3f1d07,_0x39747f,_0xca83e8);if(!_0xd78770?.['name'])continue;const _0x481e33=_0x4251c2[_0x465ec1(0x16e)](_0xd78770['name']);_0x481e33?(_0x10f72e[_0x465ec1(0xcc)](_0x481e33,_0x39747f),_0x2c15b0['delete'](_0x481e33)):_0x18a894['push']({'id':_0x39747f,'seg':_0xd78770});}if(_0x2c15b0[_0x465ec1(0x10c)]>0x0&&_0x18a894['length']>0x0){const {localExpandedRuleToNames:_0x3059f7}=buildLocalExpandedRuleMappings(_0x756ce0[_0x465ec1(0xf2)]),_0x4ade81=new Map();for(const {id:_0x2bdf50,seg:_0x4ad4fe}of _0x18a894){if(_0x4ad4fe[_0x465ec1(0x12e)]){const _0x3e33ee=apiRuleToYaml(_0x4ad4fe['rule']);_0x4ade81[_0x465ec1(0xcc)](_0x2bdf50,_0x3e33ee);}}for(const {id:_0x15d37b,seg:_0x2e5a77}of _0x18a894){if(!_0x2e5a77[_0x465ec1(0x12e)])continue;const _0x75f6e0=_0x4ade81[_0x465ec1(0x16e)](_0x15d37b);if(!_0x75f6e0)continue;const _0x1e1a13=serializeExpandedRule(_0x75f6e0,_0x4ade81),_0x19e5e8=_0x3059f7['get'](_0x1e1a13);if(_0x19e5e8){const _0x1b85cd=_0x19e5e8[_0x465ec1(0x127)](_0x2a3f51=>_0x2c15b0[_0x465ec1(0xf9)](_0x2a3f51));_0x1b85cd&&(_0x10f72e['set'](_0x1b85cd,_0x15d37b),_0x2c15b0[_0x465ec1(0xc6)](_0x1b85cd),logger[_0x465ec1(0x14f)](_0x465ec1(0x164)+_0x2e5a77[_0x465ec1(0xa5)]+_0x465ec1(0xe0)+_0x1b85cd+_0x465ec1(0xf8)));}}}}async function executeSingleJourneyPush(_0x56578d,_0x6235eb,_0x435b90,_0x28a080,_0x8e1f1,_0x4f4b4c){const _0x122bb1=a159_0x1187c8,{journeyDefToRequest:_0x115d8b,activationDefToCreateRequest:_0x32815e,yamlRuleToApi:_0x4bef11,validateSegmentRule:_0x447b7a}=_0x4f4b4c,_0x5a2fb6=new Map(),_0x46acc4=new Map();recoverSegmentIdsFromPushRecovery(_0x6235eb,_0x5a2fb6,_0x435b90[_0x122bb1(0x115)]);const _0x4a1d70=new Map(),_0x13a7d1=new Map(),_0x55f169=new Map();let _0x88e575;const _0x5ce401=async()=>{const _0x30bf08=_0x122bb1;if(_0x88e575)return;_0x88e575=new Map();if(!_0x6235eb[_0x30bf08(0x111)])return;const _0x3d7381=await _0x56578d['journey'][_0x30bf08(0x11b)](_0x6235eb[_0x30bf08(0x111)]['id']);for(const _0x12b73b of _0x3d7381){const _0x425097=journeyActivationStepToYaml(_0x12b73b,_0x435b90[_0x30bf08(0xcd)],_0x435b90['connectionIdToNameMap']),_0x247b5f=activationSignature(_0x425097);!_0x88e575[_0x30bf08(0xf9)](_0x247b5f)&&_0x88e575[_0x30bf08(0xcc)](_0x247b5f,_0x12b73b['id']),_0x425097[_0x30bf08(0xa5)]&&_0x46acc4['set'](_0x425097['name'],_0x12b73b['id']);}};await matchExistingJourneySegments(_0x56578d,_0x6235eb,_0x28a080['parentId'],_0x435b90[_0x122bb1(0x105)],_0x435b90[_0x122bb1(0x115)]);const _0x3c97dc={'resolveSegmentId':async _0x1971b3=>{const _0x5f0c8b=_0x122bb1,_0x5a3588=_0x435b90[_0x5f0c8b(0x115)][_0x5f0c8b(0x16e)](_0x1971b3);if(!_0x5a3588)throw new SDKError(ErrorCode[_0x5f0c8b(0xd6)],_0x5f0c8b(0x13a)+_0x1971b3+_0x5f0c8b(0x142)+_0x6235eb[_0x5f0c8b(0xf2)][_0x5f0c8b(0xa5)]+')');return _0x5a3588;},'resolveEmbeddedSegmentId':async(_0x4cb3ab,_0x7b15df)=>{const _0x5b3902=_0x122bb1,_0x5d4d91=_0x435b90[_0x5b3902(0x115)][_0x5b3902(0x16e)](_0x4cb3ab);if(_0x5d4d91)return _0x5d4d91;const _0x3a2213=_0x435b90[_0x5b3902(0x105)][_0x5b3902(0x127)](_0x551492=>_0x551492[_0x5b3902(0xa5)]===_0x4cb3ab);if(_0x3a2213)return _0x435b90[_0x5b3902(0x115)][_0x5b3902(0xcc)](_0x4cb3ab,_0x3a2213['id']),_0x3a2213['id'];if(_0x6235eb['isNew']){const {stageName:_0x195ed7,criteriaName:_0x3f89d2}=findSegmentCriteriaLocation(_0x6235eb[_0x5b3902(0xf2)],_0x4cb3ab);return _0x447b7a(_0x4cb3ab,_0x7b15df[_0x5b3902(0x12e)]),_0x13a7d1[_0x5b3902(0xcc)](_0x4cb3ab,{'definition':_0x7b15df,'stageName':_0x195ed7,'criteriaName':_0x3f89d2}),createPendingSegmentId(_0x4cb3ab);}const _0x3bcb7f=_0x6235eb[_0x5b3902(0x111)]?.['id'];if(!_0x3bcb7f)throw new SDKError(ErrorCode[_0x5b3902(0x113)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x43baad=_0x4a1d70[_0x5b3902(0x16e)](_0x4cb3ab);if(_0x43baad)return _0x43baad;const _0x203bc8=((async()=>{const _0x4573f1=_0x5b3902;_0x447b7a(_0x4cb3ab,_0x7b15df['rule']);const _0x347a10=generateDeterministicJourneySegmentName(_0x6235eb[_0x4573f1(0xf2)][_0x4573f1(0xa5)],_0x4cb3ab),_0x41f948=_0x435b90[_0x4573f1(0x105)]['find'](_0x12576d=>_0x12576d[_0x4573f1(0xa5)]===_0x347a10),_0x4bfa4c=createSegmentIdResolver(_0x435b90[_0x4573f1(0x115)],_0x4cb3ab),_0x716371=await resolveRuleSegmentIds(_0x7b15df[_0x4573f1(0x12e)],_0x4bfa4c);let _0x3dbf5c;return _0x41f948?(await _0x56578d[_0x4573f1(0x120)][_0x4573f1(0x155)](_0x28a080[_0x4573f1(0xdc)],_0x41f948['id'],{'description':_0x7b15df['description']||'Entry\x20criteria:\x20'+_0x4cb3ab,'rule':_0x4bef11(_0x716371),'countPopulation':!![]}),_0x3dbf5c=_0x41f948['id'],saveSegmentToPushRecovery(_0x6235eb[_0x4573f1(0x166)],_0x6235eb[_0x4573f1(0xf2)]['name'],_0x4cb3ab,{'segmentId':_0x3dbf5c,'uniqueServerName':_0x347a10,'createdAt':new Date()['toISOString']()})):_0x3dbf5c=await createOrRecoverEmbeddedSegment(_0x56578d,_0x6235eb,{'localName':_0x4cb3ab,'uniqueSegmentName':_0x347a10,'description':_0x7b15df[_0x4573f1(0x186)]||_0x4573f1(0x114)+_0x4cb3ab,'journeyId':_0x3bcb7f,'resolvedRule':_0x716371,'parentId':_0x28a080[_0x4573f1(0xdc)],'folderId':_0x28a080[_0x4573f1(0x12f)]||''},_0x4bef11),_0x435b90['segmentNameToId'][_0x4573f1(0xcc)](_0x4cb3ab,_0x3dbf5c),_0x5a2fb6[_0x4573f1(0xcc)](_0x4cb3ab,_0x3dbf5c),_0x3dbf5c;})());_0x4a1d70['set'](_0x4cb3ab,_0x203bc8);try{return await _0x203bc8;}finally{_0x4a1d70[_0x5b3902(0xc6)](_0x4cb3ab);}},'resolveActivationId':async _0x19d8f=>{const _0x4d6cdd=_0x122bb1,_0x2c9d3c=_0x46acc4[_0x4d6cdd(0x16e)](_0x19d8f);if(_0x2c9d3c)return _0x2c9d3c;if(_0x6235eb[_0x4d6cdd(0x111)]){await _0x5ce401();const _0x6e2061=_0x46acc4[_0x4d6cdd(0x16e)](_0x19d8f);if(_0x6e2061)return _0x6e2061;}throw new SDKError(ErrorCode[_0x4d6cdd(0xa8)],_0x4d6cdd(0xb8)+_0x19d8f+_0x4d6cdd(0x142)+_0x6235eb[_0x4d6cdd(0xf2)][_0x4d6cdd(0xa5)]+_0x4d6cdd(0x102)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x560d60,_0x3cfd76)=>{const _0x3538c9=_0x122bb1,_0x8ce214=_0x46acc4['get'](_0x560d60);if(_0x8ce214)return _0x8ce214;if(_0x6235eb[_0x3538c9(0x91)])return _0x55f169[_0x3538c9(0xcc)](_0x560d60,_0x3cfd76),createPendingActivationId(_0x560d60);if(_0x6235eb[_0x3538c9(0x111)]){await _0x5ce401();const _0x5aa26a=_0x46acc4[_0x3538c9(0x16e)](_0x3cfd76[_0x3538c9(0xa5)]);if(_0x5aa26a)return _0x46acc4[_0x3538c9(0xcc)](_0x560d60,_0x5aa26a),_0x5aa26a;const _0x44d50d=activationSignature(_0x3cfd76),_0x19c758=_0x88e575?.[_0x3538c9(0x16e)](_0x44d50d);if(_0x19c758)return _0x46acc4[_0x3538c9(0xcc)](_0x560d60,_0x19c758),_0x19c758;const _0x232796=await _0x32815e(_0x3cfd76,_0x435b90['activationContext']),_0x44ca58={..._0x232796,..._0x3cfd76[_0x3538c9(0x13d)]!==undefined&&{'runAfterJourneyRefresh':_0x3cfd76['run_after_journey_refresh']}},_0x5cb340=await _0x56578d[_0x3538c9(0x98)][_0x3538c9(0xc0)](_0x6235eb['existingJourney']['id'],_0x44ca58);return _0x46acc4[_0x3538c9(0xcc)](_0x560d60,_0x5cb340['id']),_0x5cb340['id'];}throw new SDKError(ErrorCode[_0x3538c9(0x113)],_0x3538c9(0x134));},'resolveJourneyId':async _0x48b6b9=>{const _0x37a4b6=_0x122bb1;try{return await _0x56578d['journey'][_0x37a4b6(0x149)](_0x28a080[_0x37a4b6(0xdc)],_0x48b6b9);}catch(_0x118cff){throw new SDKError(ErrorCode[_0x37a4b6(0xa8)],_0x37a4b6(0xd5)+_0x48b6b9+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x6235eb[_0x37a4b6(0xf2)][_0x37a4b6(0xa5)]+'\x27)',_0x118cff);}},'resolveStageId':async(_0x1d49d7,_0x1c6bf5)=>{const _0x55ca22=_0x122bb1,_0x2318d6=await _0x56578d['journey'][_0x55ca22(0x15c)](_0x1d49d7),_0x1591d9=_0x2318d6[_0x55ca22(0x18a)][_0x55ca22(0xe3)][_0x55ca22(0x127)](_0xbeebf1=>_0xbeebf1['name']['toLowerCase']()===_0x1c6bf5[_0x55ca22(0x128)]());if(!_0x1591d9?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x55ca22(0xee)+_0x1c6bf5+_0x55ca22(0xb9)+(_0x2318d6[_0x55ca22(0x18a)]['journeyBundleName']||_0x2318d6[_0x55ca22(0x18a)][_0x55ca22(0xa5)])+'\x27');return _0x1591d9['id'];}},_0x2d8df4=await _0x115d8b(_0x6235eb[_0x122bb1(0xf2)],_0x28a080[_0x122bb1(0xdc)],_0x3c97dc),_0x2ee6f7=_0x28a080['folderId']||_0x28a080[_0x122bb1(0x12f)];_0x2ee6f7&&(_0x2d8df4['relationships']={'parentFolder':{'data':{'id':_0x2ee6f7,'type':_0x122bb1(0x14a)}}});if(_0x6235eb[_0x122bb1(0x91)]){if(_0x13a7d1[_0x122bb1(0x10c)]>0x0||_0x55f169['size']>0x0)return await executeThreeStepJourneyCreate(_0x56578d,_0x6235eb,_0x2d8df4,{'pendingEmbeddedSegments':_0x13a7d1,'pendingEmbeddedActivations':_0x55f169,'embeddedSegmentNameToId':_0x5a2fb6,'journeyActivationNameToId':_0x46acc4},{..._0x28a080,'effectiveFolderId':_0x2ee6f7},_0x435b90,_0x8e1f1,_0x4f4b4c);else{ensureJourneyDefaults(_0x2d8df4['attributes']);const _0x33238b=await _0x56578d[_0x122bb1(0x98)][_0x122bb1(0x151)](_0x2d8df4);return deletePushRecovery(_0x6235eb[_0x122bb1(0x166)]),{'action':_0x122bb1(0xae),'journeyId':_0x33238b['id'],'embeddedSegmentNameToId':_0x5a2fb6};}}else{if(_0x6235eb['hasChanges']&&_0x6235eb[_0x122bb1(0x111)]){_0x2d8df4['id']=_0x6235eb[_0x122bb1(0x111)]['id'];const _0x3b678e=_0x2d8df4[_0x122bb1(0x18a)];_0x6235eb[_0x122bb1(0x111)][_0x122bb1(0x18a)]?.[_0x122bb1(0x16d)]&&(_0x3b678e[_0x122bb1(0x16d)]=_0x6235eb[_0x122bb1(0x111)]['attributes'][_0x122bb1(0x16d)]);const _0x30015c=_0x6235eb['existingJourney'][_0x122bb1(0x18a)]?.['journeyStages'];return _0x30015c&&_0x2d8df4[_0x122bb1(0x18a)][_0x122bb1(0xe3)]&&injectExistingStageIds(_0x2d8df4['attributes'][_0x122bb1(0xe3)],_0x30015c),ensureJourneyDefaults(_0x3b678e),await _0x56578d[_0x122bb1(0x98)][_0x122bb1(0x94)](_0x6235eb[_0x122bb1(0x111)]['id'],_0x2d8df4),deletePushRecovery(_0x6235eb[_0x122bb1(0x166)]),{'action':_0x122bb1(0xcb),'journeyId':_0x6235eb[_0x122bb1(0x111)]['id'],'embeddedSegmentNameToId':_0x5a2fb6};}}return deletePushRecovery(_0x6235eb[_0x122bb1(0x166)]),{'action':_0x122bb1(0x176),'journeyId':_0x6235eb[_0x122bb1(0x111)]?.['id'],'embeddedSegmentNameToId':_0x5a2fb6};}function findSegmentCriteriaLocation(_0x39f41c,_0x203334){const _0x409f22=a159_0x1187c8,_0x38511a=_0x39f41c[_0x409f22(0x161)]||_0x39f41c['journeys']?.[0x0]?.['stages']||[];let _0x3205df=_0x409f22(0x103),_0x5cf218=_0x203334;const _0x5c6f5e=_0x39f41c[_0x409f22(0xa4)]||_0x39f41c[_0x409f22(0x8a)]?.[0x0]?.[_0x409f22(0xa4)];if(_0x5c6f5e?.[_0x409f22(0x120)]===_0x203334)return{'stageName':_0x409f22(0xa4),'criteriaName':_0x5c6f5e[_0x409f22(0xa5)]||_0x203334};_0xfe6050:for(const _0x3ddb07 of _0x38511a){if(_0x3ddb07[_0x409f22(0x9f)]?.[_0x409f22(0x120)]===_0x203334){_0x3205df=_0x3ddb07['name'],_0x5cf218=_0x3ddb07[_0x409f22(0x9f)]['name']||_0x203334;break;}if(_0x3ddb07[_0x409f22(0xd4)])for(const _0x27c1c0 of _0x3ddb07[_0x409f22(0xd4)]){if(_0x27c1c0[_0x409f22(0xd0)]==='decision_point'&&_0x27c1c0['with']?.[_0x409f22(0x146)])for(const _0x455ce5 of _0x27c1c0['with'][_0x409f22(0x146)]){if(_0x455ce5[_0x409f22(0x120)]===_0x203334){_0x3205df=_0x3ddb07['name'],_0x5cf218=_0x455ce5[_0x409f22(0xa5)]||_0x203334;break _0xfe6050;}}}}return{'stageName':_0x3205df,'criteriaName':_0x5cf218};}async function executeThreeStepJourneyCreate(_0x98e15a,_0x2b561b,_0x5989f4,_0x50740c,_0x11bc67,_0x318488,_0x3a0e1a,_0x356d97){const _0x1c6c42=a159_0x1187c8,{activationDefToCreateRequest:_0x49198a,yamlRuleToApi:_0x170bd0}=_0x356d97,{pendingEmbeddedSegments:_0x2d907b,pendingEmbeddedActivations:_0x273b4f,embeddedSegmentNameToId:_0x10b85b}=_0x50740c,_0x517a1b=JSON[_0x1c6c42(0xbf)](JSON[_0x1c6c42(0x175)](_0x5989f4));ensureJourneyDefaults(_0x517a1b[_0x1c6c42(0x18a)]),stripPendingIds(_0x517a1b);const _0x333856=await _0x98e15a[_0x1c6c42(0x98)]['create'](_0x517a1b),_0x1f32c3=_0x333856['id'],_0x34755f=new Map();for(const _0xb95bb5 of _0x333856[_0x1c6c42(0x18a)][_0x1c6c42(0xe3)]){_0x34755f['set'](_0xb95bb5['name'][_0x1c6c42(0x128)](),_0xb95bb5['id']);}recoverSegmentIdsFromPushRecovery(_0x2b561b,_0x10b85b,_0x318488['segmentNameToId']);for(const [_0x10abcb,{definition:_0x3d50cc}]of _0x2d907b){if(_0x10b85b[_0x1c6c42(0xf9)](_0x10abcb)){_0x3a0e1a[_0x1c6c42(0xec)]?.({'type':'embedded_segment_created','journeyName':_0x2b561b[_0x1c6c42(0xf2)]['name'],'segmentName':_0x10abcb});continue;}const _0x5cb7d1=generateDeterministicJourneySegmentName(_0x2b561b[_0x1c6c42(0xf2)][_0x1c6c42(0xa5)],_0x10abcb);_0x3a0e1a[_0x1c6c42(0xec)]?.({'type':_0x1c6c42(0x104),'journeyName':_0x2b561b['yamlConfig'][_0x1c6c42(0xa5)],'segmentName':_0x10abcb});const _0x4a61c5=createSegmentIdResolver(_0x318488[_0x1c6c42(0x115)],_0x10abcb),_0x48a531=await resolveRuleSegmentIds(_0x3d50cc['rule'],_0x4a61c5),_0x5e8144=await createOrRecoverEmbeddedSegment(_0x98e15a,_0x2b561b,{'localName':_0x10abcb,'uniqueSegmentName':_0x5cb7d1,'description':_0x3d50cc[_0x1c6c42(0x186)]||_0x1c6c42(0x114)+_0x10abcb,'journeyId':_0x1f32c3,'resolvedRule':_0x48a531,'parentId':_0x11bc67[_0x1c6c42(0xdc)],'folderId':_0x11bc67['effectiveFolderId']||''},_0x170bd0);_0x10b85b[_0x1c6c42(0xcc)](_0x10abcb,_0x5e8144),_0x318488[_0x1c6c42(0x115)][_0x1c6c42(0xcc)](_0x10abcb,_0x5e8144),_0x3a0e1a['onProgress']?.({'type':_0x1c6c42(0x168),'journeyName':_0x2b561b['yamlConfig'][_0x1c6c42(0xa5)],'segmentName':_0x10abcb});}const _0x375806=new Map();for(const [_0x48bf4a,_0x15f4b6]of _0x273b4f){_0x3a0e1a[_0x1c6c42(0xec)]?.({'type':_0x1c6c42(0xa1),'journeyName':_0x2b561b[_0x1c6c42(0xf2)][_0x1c6c42(0xa5)],'activationName':_0x48bf4a});const _0x439f94=await _0x49198a(_0x15f4b6,_0x318488[_0x1c6c42(0x171)]),_0x25a2ec={..._0x439f94,..._0x15f4b6['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x15f4b6[_0x1c6c42(0x13d)]}},_0x13a432=await _0x98e15a[_0x1c6c42(0x98)][_0x1c6c42(0xc0)](_0x1f32c3,_0x25a2ec);_0x375806['set'](_0x48bf4a,_0x13a432['id']),_0x50740c['journeyActivationNameToId'][_0x1c6c42(0xcc)](_0x48bf4a,_0x13a432['id']),_0x3a0e1a['onProgress']?.({'type':_0x1c6c42(0xa9),'journeyName':_0x2b561b[_0x1c6c42(0xf2)][_0x1c6c42(0xa5)],'activationName':_0x48bf4a});}const _0x2b9265=JSON['parse'](JSON['stringify'](_0x5989f4));return _0x2b9265['id']=_0x1f32c3,ensureJourneyDefaults(_0x2b9265[_0x1c6c42(0x18a)]),resolvePendingIdsInRequest(_0x2b9265,_0x5989f4,_0x34755f,_0x10b85b,_0x375806,_0x3a0e1a),await _0x98e15a[_0x1c6c42(0x98)][_0x1c6c42(0x94)](_0x1f32c3,_0x2b9265),deletePushRecovery(_0x2b561b['absolutePath']),{'action':_0x1c6c42(0xae),'journeyId':_0x1f32c3,'embeddedSegmentNameToId':_0x10b85b};}export function stripWaitStepPendingIds(_0x1dda7c){const _0x2e3118=a159_0x1187c8,_0x32ab2d=_0x1dda7c[_0x2e3118(0xa2)]&&isPendingSegmentId(_0x1dda7c[_0x2e3118(0xa2)]),_0x6f4776=_0x1dda7c['conditions']?.['some'](_0x1d9e74=>_0x1d9e74['segmentId']&&isPendingSegmentId(_0x1d9e74[_0x2e3118(0x185)]));(_0x32ab2d||_0x6f4776)&&(_0x1dda7c['waitStepType']=_0x2e3118(0x108),_0x1dda7c['waitStep']=0x1,_0x1dda7c[_0x2e3118(0x12c)]=_0x2e3118(0xf0),delete _0x1dda7c[_0x2e3118(0xa2)],delete _0x1dda7c[_0x2e3118(0xd8)],delete _0x1dda7c[_0x2e3118(0x138)],delete _0x1dda7c['conditions']);}export function resolveWaitStepPendingIds(_0x174a6b,_0x144261,_0x124e24,_0x44e434){const _0x55e270=a159_0x1187c8;if(_0x144261[_0x55e270(0xa2)]&&isPendingSegmentId(_0x144261['conditionSegmentId'])){const _0xc6395=_0x124e24(_0x144261[_0x55e270(0xa2)],_0x55e270(0x125)+_0x44e434+_0x55e270(0xe1));_0xc6395&&(_0x174a6b[_0x55e270(0xaa)]=_0x55e270(0x135),_0x174a6b['conditionSegmentId']=_0xc6395,delete _0x174a6b[_0x55e270(0x174)],delete _0x174a6b[_0x55e270(0x12c)],_0x144261[_0x55e270(0xd8)]!==undefined&&(_0x174a6b['conditionTimeoutDuration']=_0x144261[_0x55e270(0xd8)]),_0x144261[_0x55e270(0x138)]&&(_0x174a6b[_0x55e270(0x138)]=_0x144261['conditionTimeoutUnit']));}if(_0x144261['conditions']){const _0x4f3370=_0x144261[_0x55e270(0x16b)]['some'](_0x2bfcc3=>_0x2bfcc3[_0x55e270(0x185)]&&isPendingSegmentId(_0x2bfcc3['segmentId']));if(_0x4f3370){const _0x4b5541=_0x144261[_0x55e270(0x16b)][_0x55e270(0xbd)](_0x2e1b8f=>{const _0x449811=_0x55e270;if(_0x2e1b8f['segmentId']&&isPendingSegmentId(_0x2e1b8f[_0x449811(0x185)])){const _0x5755f7=_0x124e24(_0x2e1b8f[_0x449811(0x185)],_0x449811(0x125)+_0x44e434+_0x449811(0xe1));return{..._0x2e1b8f,'segmentId':_0x5755f7||_0x2e1b8f[_0x449811(0x185)]};}return{..._0x2e1b8f};});_0x174a6b[_0x55e270(0xaa)]=_0x55e270(0x135),_0x174a6b[_0x55e270(0x16b)]=_0x4b5541,delete _0x174a6b[_0x55e270(0x174)],delete _0x174a6b[_0x55e270(0x12c)],delete _0x174a6b['conditionSegmentId'],delete _0x174a6b[_0x55e270(0xd8)],delete _0x174a6b['conditionTimeoutUnit'];}}}function stripPendingIds(_0xc284bc){const _0x217e79=a159_0x1187c8;_0xc284bc[_0x217e79(0x18a)][_0x217e79(0xa4)]?.['segmentId']&&isPendingSegmentId(_0xc284bc[_0x217e79(0x18a)][_0x217e79(0xa4)][_0x217e79(0x185)])&&delete _0xc284bc[_0x217e79(0x18a)]['goal'];for(const _0x4a57d0 of _0xc284bc[_0x217e79(0x18a)][_0x217e79(0xe3)]||[]){_0x4a57d0[_0x217e79(0x88)]?.['segmentId']&&isPendingSegmentId(_0x4a57d0['entryCriteria'][_0x217e79(0x185)])&&delete _0x4a57d0['entryCriteria'];_0x4a57d0['milestone']?.['segmentId']&&isPendingSegmentId(_0x4a57d0[_0x217e79(0xce)][_0x217e79(0x185)])&&delete _0x4a57d0[_0x217e79(0xce)];_0x4a57d0[_0x217e79(0x152)]&&(_0x4a57d0[_0x217e79(0x152)]=_0x4a57d0['exitCriterias']['filter'](_0x1a0025=>!_0x1a0025[_0x217e79(0x185)]||!isPendingSegmentId(_0x1a0025[_0x217e79(0x185)])));if(_0x4a57d0[_0x217e79(0xd4)])for(const _0x302bf2 of Object[_0x217e79(0x188)](_0x4a57d0[_0x217e79(0xd4)])){const _0x5c4c6d=_0x4a57d0[_0x217e79(0xd4)][_0x302bf2];_0x5c4c6d['type']===_0x217e79(0x9a)&&_0x5c4c6d[_0x217e79(0x11c)]&&isPendingActivationId(_0x5c4c6d[_0x217e79(0x11c)])&&(_0x5c4c6d[_0x217e79(0x11c)]='');if(_0x5c4c6d[_0x217e79(0xd0)]===_0x217e79(0xff)&&_0x5c4c6d[_0x217e79(0x146)])for(const _0xc51ea0 of _0x5c4c6d[_0x217e79(0x146)]){_0xc51ea0[_0x217e79(0x185)]&&isPendingSegmentId(_0xc51ea0['segmentId'])&&(_0xc51ea0[_0x217e79(0x185)]='');}_0x5c4c6d[_0x217e79(0xd0)]===_0x217e79(0xac)&&stripWaitStepPendingIds(_0x5c4c6d);}}}function resolvePendingIdsInRequest(_0x503a49,_0x4c87dd,_0x386c54,_0x5d6aa1,_0x4fb358,_0x55fe93){const _0x586dc9=a159_0x1187c8,_0x4bb3b5=(_0x296105,_0x5afac7)=>{if(!isPendingSegmentId(_0x296105))return _0x296105;const _0x3d8e49=extractPendingSegmentName(_0x296105),_0xe89225=_0x5d6aa1['get'](_0x3d8e49);return!_0xe89225&&_0x55fe93['logWarning']?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x3d8e49+'\x27\x20for\x20'+_0x5afac7),_0xe89225;};if(_0x503a49['attributes'][_0x586dc9(0xa4)]?.[_0x586dc9(0x185)]&&isPendingSegmentId(_0x503a49['attributes'][_0x586dc9(0xa4)][_0x586dc9(0x185)])){const _0x4add7f=_0x4bb3b5(_0x503a49['attributes']['goal'][_0x586dc9(0x185)],_0x586dc9(0xf4));_0x4add7f&&(_0x503a49[_0x586dc9(0x18a)][_0x586dc9(0xa4)][_0x586dc9(0x185)]=_0x4add7f);}for(const _0x271be2 of _0x503a49['attributes'][_0x586dc9(0xe3)]||[]){const _0x22b28d=_0x386c54[_0x586dc9(0x16e)](_0x271be2['name'][_0x586dc9(0x128)]());_0x22b28d&&(_0x271be2['id']=_0x22b28d);if(_0x271be2[_0x586dc9(0x88)]?.[_0x586dc9(0x185)]&&isPendingSegmentId(_0x271be2[_0x586dc9(0x88)][_0x586dc9(0x185)])){const _0x9de45a=_0x4bb3b5(_0x271be2[_0x586dc9(0x88)][_0x586dc9(0x185)],_0x586dc9(0x125)+_0x271be2[_0x586dc9(0xa5)]+_0x586dc9(0xde));_0x9de45a&&(_0x271be2[_0x586dc9(0x88)]['segmentId']=_0x9de45a);}if(_0x271be2[_0x586dc9(0x152)])for(const _0x10c9e3 of _0x271be2[_0x586dc9(0x152)]){if(_0x10c9e3[_0x586dc9(0x185)]&&isPendingSegmentId(_0x10c9e3[_0x586dc9(0x185)])){const _0xacf616=_0x4bb3b5(_0x10c9e3[_0x586dc9(0x185)],_0x586dc9(0x125)+_0x271be2[_0x586dc9(0xa5)]+'\x27\x20exit\x20criteria');_0xacf616&&(_0x10c9e3[_0x586dc9(0x185)]=_0xacf616);}}if(_0x271be2[_0x586dc9(0xce)]?.[_0x586dc9(0x185)]&&isPendingSegmentId(_0x271be2[_0x586dc9(0xce)][_0x586dc9(0x185)])){const _0x2124d3=_0x4bb3b5(_0x271be2['milestone'][_0x586dc9(0x185)],_0x586dc9(0x125)+_0x271be2[_0x586dc9(0xa5)]+'\x27\x20milestone');_0x2124d3&&(_0x271be2[_0x586dc9(0xce)][_0x586dc9(0x185)]=_0x2124d3);}if(_0x271be2['steps']){const _0x4ff22a=_0xbab69d=>_0x4c87dd[_0x586dc9(0x18a)][_0x586dc9(0xe3)]?.[_0x586dc9(0x127)](_0x5ce862=>_0x5ce862[_0x586dc9(0xa5)][_0x586dc9(0x128)]()===_0x271be2[_0x586dc9(0xa5)][_0x586dc9(0x128)]())?.[_0x586dc9(0xd4)]?.[_0xbab69d];for(const _0x2f4cca of Object[_0x586dc9(0x188)](_0x271be2[_0x586dc9(0xd4)])){const _0xf0afae=_0x271be2[_0x586dc9(0xd4)][_0x2f4cca],_0x5635cf=_0x4ff22a(_0x2f4cca);if(_0xf0afae[_0x586dc9(0xd0)]===_0x586dc9(0x9a)&&_0xf0afae[_0x586dc9(0x11c)]&&(isPendingActivationId(_0xf0afae[_0x586dc9(0x11c)])||_0xf0afae[_0x586dc9(0x11c)]==='')){if(_0x5635cf?.[_0x586dc9(0x11c)]&&isPendingActivationId(_0x5635cf[_0x586dc9(0x11c)])){const _0x8167a8=extractPendingActivationName(_0x5635cf[_0x586dc9(0x11c)]),_0xd04b72=_0x4fb358['get'](_0x8167a8);_0xd04b72&&(_0xf0afae[_0x586dc9(0x11c)]=_0xd04b72);}}if(_0xf0afae['type']===_0x586dc9(0xff)&&_0xf0afae[_0x586dc9(0x146)]&&_0x5635cf?.[_0x586dc9(0x146)])for(let _0x42a5e6=0x0;_0x42a5e6<_0xf0afae['branches'][_0x586dc9(0x136)];_0x42a5e6++){const _0x25ad93=_0xf0afae[_0x586dc9(0x146)][_0x42a5e6],_0x53c96b=_0x5635cf[_0x586dc9(0x146)][_0x42a5e6];if(_0x53c96b?.[_0x586dc9(0x185)]&&isPendingSegmentId(_0x53c96b[_0x586dc9(0x185)])){const _0x53712c=_0x4bb3b5(_0x53c96b[_0x586dc9(0x185)],'stage\x20\x27'+_0x271be2[_0x586dc9(0xa5)]+_0x586dc9(0x13f)+(_0x25ad93['name']||_0x42a5e6)+'\x27');_0x53712c&&(_0x25ad93[_0x586dc9(0x185)]=_0x53712c);}}_0xf0afae[_0x586dc9(0xd0)]==='WaitStep'&&_0x5635cf?.['type']==='WaitStep'&&resolveWaitStepPendingIds(_0xf0afae,_0x5635cf,_0x4bb3b5,_0x271be2[_0x586dc9(0xa5)]);}}}}
1
+ const a159_0x3ddbd6=a159_0x4982;(function(_0x1e7e40,_0x23f3fa){const _0x437d51=a159_0x4982,_0x111189=_0x1e7e40();while(!![]){try{const _0x691ddd=parseInt(_0x437d51(0x168))/0x1*(parseInt(_0x437d51(0x10c))/0x2)+parseInt(_0x437d51(0x175))/0x3*(-parseInt(_0x437d51(0x1c7))/0x4)+-parseInt(_0x437d51(0x13d))/0x5+-parseInt(_0x437d51(0x1d3))/0x6+-parseInt(_0x437d51(0xfe))/0x7+parseInt(_0x437d51(0x1a9))/0x8+parseInt(_0x437d51(0x136))/0x9*(parseInt(_0x437d51(0x170))/0xa);if(_0x691ddd===_0x23f3fa)break;else _0x111189['push'](_0x111189['shift']());}catch(_0x4ddb51){_0x111189['push'](_0x111189['shift']());}}}(a159_0x535c,0x9f16d));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a159_0x3ddbd6(0x116));export const PENDING_SEGMENT_PREFIX=a159_0x3ddbd6(0x1c4);export const PENDING_ACTIVATION_PREFIX=a159_0x3ddbd6(0x1d9);export function createPendingSegmentId(_0x189e8a){return''+PENDING_SEGMENT_PREFIX+_0x189e8a+'__';}export function isPendingSegmentId(_0x59b35c){const _0x1674ef=a159_0x3ddbd6;return _0x59b35c[_0x1674ef(0x135)](PENDING_SEGMENT_PREFIX)&&!_0x59b35c['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x7c28d6){const _0x33ca63=a159_0x3ddbd6;return _0x7c28d6[_0x33ca63(0x12d)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x286398){return''+PENDING_ACTIVATION_PREFIX+_0x286398+'__';}export function isPendingActivationId(_0x273790){return _0x273790['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x50a9ba){const _0xdb5333=a159_0x3ddbd6;return _0x50a9ba[_0xdb5333(0x12d)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x556986,_0xcbf519){const _0x460f9d=a159_0x3ddbd6,_0x3733a1=_0x556986+'::'+(_0xcbf519[_0x460f9d(0x164)]()||'segment'),_0x28e21a=createHash(_0x460f9d(0x162))[_0x460f9d(0xf5)](_0x3733a1)['digest']('hex')['slice'](0x0,0xc);return'journey_entry_criteria_'+_0x28e21a;}export function ensureJourneyDefaults(_0x577caa){const _0x412250=a159_0x3ddbd6;!_0x577caa['description']&&(_0x577caa['description']=''),!_0x577caa['state']&&(_0x577caa[_0x412250(0x17e)]=_0x412250(0xf9));}export function injectExistingStageIds(_0x50c51d,_0x3fe8b5){const _0x37eb75=a159_0x3ddbd6,_0x3a0faf=new Map(_0x3fe8b5[_0x37eb75(0x185)](_0x4c4ebe=>[_0x4c4ebe[_0x37eb75(0x101)],_0x4c4ebe['id']]));for(const _0x515e41 of _0x50c51d){if(!_0x515e41['id']){const _0xdc56b0=_0x3a0faf['get'](_0x515e41[_0x37eb75(0x101)]);_0xdc56b0&&(_0x515e41['id']=_0xdc56b0);}}}export function resolveTDFolderPath(_0x447e5f,_0x1e87f3,_0x57becb){const _0x8bb841=a159_0x3ddbd6;if(!_0x1e87f3)return _0x447e5f;if(_0x447e5f===_0x57becb||_0x447e5f[_0x8bb841(0x135)](_0x57becb+'/'))return _0x447e5f;return _0x447e5f?_0x57becb+'/'+_0x447e5f:_0x57becb;}export function addFoldersToCreate(_0x567fdf,_0xbfc8d3,_0x238b65){const _0x2ac715=a159_0x3ddbd6;if(!_0x567fdf)return;if(_0xbfc8d3[_0x2ac715(0x18e)](_0x567fdf))return;const _0x4127c8=_0x567fdf['split']('/');let _0x19addc='';for(const _0x47caad of _0x4127c8){_0x19addc=_0x19addc?_0x19addc+'/'+_0x47caad:_0x47caad,!_0xbfc8d3[_0x2ac715(0x18e)](_0x19addc)&&_0x238b65[_0x2ac715(0x1cd)](_0x19addc);}}export function sortFoldersByDepth(_0x5c815f){return[..._0x5c815f]['sort']((_0x55dff1,_0x4cd025)=>{const _0x244ecf=a159_0x4982,_0x52eb3e=(_0x55dff1[_0x244ecf(0x105)](/\//g)||[])[_0x244ecf(0x107)],_0x28044c=(_0x4cd025['match'](/\//g)||[])[_0x244ecf(0x107)];return _0x52eb3e-_0x28044c;});}import*as a159_0x424d42 from'yaml';import{readFileSync}from'fs';import a159_0x59f5d5 from'path';import{isJourneyDef,parseYamlString as a159_0x21833f,toYamlString as a159_0x529b31,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';function a159_0x535c(){const _0x50b571=['utf-8','diff','embedded_activation_created','toString','folder_creating','kind','9092400PTolJn','segment_updated','\x20journey\x20from\x20file:\x20','some','journey_updated','Failed\x20to\x20fetch\x20referenced\x20segment\x20','existingSegments','Stage\x20\x27','conditionSegmentId','create','exitCriterias','Created\x20journey\x20\x27','attributes','createdSegmentId','unchanged','join','existingActivation','folderPath','.$1.push-recovery.json','segmentId','branches','find','\x0a\x20\x20','existingSegment','createSegment','WaitStep','activation_deleted','__pending_','push','size','2404UXKRYr','Duration','activation_updating','action','relationships','folder_created','add','segment_created','\x20error(s)','waitStep','user','\x27\x20by\x20rule\x20content','3499116kKAoeh','valid','\x27\x20from\x20file:\x20','message','journeyStages','embedded_activation_creating','__pending_act_','activationContext',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','logWarning','ACTIVATION_UPDATE_ERROR','index','folderId','segment_deleted','\x27\x20entry\x20criteria','fetchJourney','segment_creating','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','relative','created','getActivation','Updated\x20activation\x20\x27','connector_config','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','isNew','Entry\x20criteria:\x20','connectionIdToNameMap','Delete\x20the\x20push\x20recovery\x20file\x20(','waitStepUnit','deps','schedule','update','errors','embedded_segment_creating','logInfo','draft','createdSegmentIds','parseDocument','Creating\x20folder\x20\x27','progress','5239479rMUZDl','absolutePath','\x20(referenced\x20in\x20journey\x20','name','rootFolderId','Deleting\x20activation\x20\x27','journeyBundlesByFolderAndName','match','conditionTimeoutDuration','length','entry_criteria','resolveJourneyId','from','localName','360jrzkMU','activationActions','folder','uniqueSegmentName','type','results','with','nameToType','folderPathToId','reduce','tdx.sdk.push-workflow','day','journeyBundleId','Creating\x20segment\x20\x27','Matched\x20server\x20segment\x20\x27','decision_point','idToEmailMap','all','listActivations','updateSegmentById','stage\x20\x27','\x27...','\x27\x20wait\x20condition','steps','\x27\x20exit\x20criteria','withProgress','JOURNEY_SYNTAX_ERROR','createActivation','Embedded\x20segment\x20\x27','columns','activation_created','delete','deleted','replace',').\x20','updated','values','existingJourney','segment_deleting','description','getLatestJourneyId','startsWith','104283UblWQM','activations','Segment\x20not\x20found','entryCriteria','isArray','activation_','list','4408250NftTyx','debug','notification','waitStepType','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','validatedRequest','activation_template_id','dirname','Updating\x20segment\x20\x27','entries','getSegment\x20failed\x20for\x20','toISOString','Deleted\x20segment\x20\x27','getJourney','max','journeyActivationStepId','Deleted\x20activation\x20\x27','hasChanges','Segment\x20not\x20found:\x20','keys','updateActivation','Updated\x20journey\x20\x27','resolvedRule','idToName','./child-segment-yaml.js','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Created\x20folder\x20\x27','Created\x20activation\x20\x27','../../utils/async.js','resolveSegment','journey_creating','embedded_segment_created','logSuccess','createFolder','journey_created','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Failed\x20to\x20','sha1','logDeleted','trim','Condition','all_columns','segments','5597mgGCyA','Activation\x20not\x20found:\x20','stringify','embeddedSegmentNameToId','skipSegments','Updating\x20activation\x20\x27','activationParams','./journey-yaml.js','1130nIaveX','Activation','segmentNameToId','onProgress','rule','2937KRZJqT','journeys','segment','journeyName','data','effectiveFolderId','journeyId','journey','DecisionPoint','state','get','segmentFolderId','deleteActivation','createJourneySegment','split','parentId','map','filter','parse','toLowerCase','SEGMENT_UPDATE_ERROR','set','connection','\x27\x20for\x20','conditionTimeoutUnit','has','Journey\x20\x27','journeyById','goal','buildUserMaps','activationsBySegmentId','\x20segment\x20from\x20file:\x20','SEGMENT_SYNTAX_ERROR','milestone','sort','conditions','\x27\x20decision\x20point\x20branch\x20\x27','behavior','run_after_journey_refresh','NOT_FOUND','nameToId','journeyBundleName','yamlConfig','versionNumber','slice','uniqueServerName'];a159_0x535c=function(){return _0x50b571;};return a159_0x535c();}import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{batchAsync}from'../../utils/async.js';import{buildFolderMaps}from'./resolution-context.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../errors.js';import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x9d5916){const _0x3ee24a=a159_0x3ddbd6;if(Array[_0x3ee24a(0x13a)](_0x9d5916))return'['+_0x9d5916[_0x3ee24a(0x185)](_0x1d60f7=>stableStringify(_0x1d60f7))['join'](',')+']';if(_0x9d5916&&typeof _0x9d5916==='object'){const _0x125454=_0x9d5916,_0x5c54e8=Object[_0x3ee24a(0x150)](_0x125454)[_0x3ee24a(0x197)](),_0x5ec8e3=_0x5c54e8[_0x3ee24a(0x185)](_0x4d1ced=>'\x22'+_0x4d1ced+'\x22:'+stableStringify(_0x125454[_0x4d1ced]));return'{'+_0x5ec8e3['join'](',')+'}';}const _0x211504=JSON[_0x3ee24a(0x16a)](_0x9d5916);return _0x211504===undefined?'null':_0x211504;}function activationSignature(_0x1570db){const _0x5e6530=a159_0x3ddbd6,_0x5e57d1={'connection':_0x1570db[_0x5e6530(0x18b)],..._0x1570db['all_columns']!==undefined&&{'all_columns':_0x1570db[_0x5e6530(0x166)]},..._0x1570db[_0x5e6530(0x129)]!==undefined&&{'columns':_0x1570db['columns']},..._0x1570db[_0x5e6530(0x19a)]!==undefined&&{'behavior':_0x1570db[_0x5e6530(0x19a)]},..._0x1570db[_0x5e6530(0xf4)]!==undefined&&{'schedule':_0x1570db['schedule']},..._0x1570db[_0x5e6530(0x13f)]!==undefined&&{'notification':_0x1570db[_0x5e6530(0x13f)]},..._0x1570db[_0x5e6530(0xec)]!==undefined&&{'connector_config':_0x1570db[_0x5e6530(0xec)]},..._0x1570db[_0x5e6530(0x143)]!==undefined&&{'activation_template_id':_0x1570db['activation_template_id']}};return stableStringify(_0x5e57d1);}async function fetchSegment(_0x41ceea,_0x5148b6,_0x2233a6,_0x22be8a){const _0x5aad07=a159_0x3ddbd6,_0x5c1e5e=_0x22be8a?.[_0x5aad07(0x1be)](_0x1aa91d=>_0x1aa91d['id']===_0x2233a6);if(_0x5c1e5e)return _0x5c1e5e;try{return await _0x41ceea[_0x5aad07(0x177)]['getSegment'](_0x5148b6,_0x2233a6);}catch(_0x14c9fd){logger[_0x5aad07(0x13e)](_0x5aad07(0x147)+_0x2233a6+_0x5aad07(0x1db)+_0x14c9fd);try{return await _0x41ceea[_0x5aad07(0x177)]['getSegmentEntity'](_0x2233a6);}catch(_0x21c49a){return logger[_0x5aad07(0x13e)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x2233a6+':\x20'+_0x21c49a),null;}}}function recoverSegmentIdsFromPushRecovery(_0x4019f7,_0x51ff2c,_0x481757){const _0x28714e=a159_0x3ddbd6,_0x4faf0a=readPushRecovery(_0x4019f7[_0x28714e(0xff)]);if(_0x4faf0a?.[_0x28714e(0x178)]===_0x4019f7[_0x28714e(0x19f)]['name'])for(const [_0x5763f9,_0x530157]of Object[_0x28714e(0x146)](_0x4faf0a['segments'])){const _0x24c92d=generateDeterministicJourneySegmentName(_0x4019f7[_0x28714e(0x19f)][_0x28714e(0x101)],_0x5763f9);_0x530157[_0x28714e(0x1a2)]===_0x24c92d&&(_0x51ff2c[_0x28714e(0x18a)](_0x5763f9,_0x530157['segmentId']),_0x481757[_0x28714e(0x18a)](_0x5763f9,_0x530157[_0x28714e(0x1bc)]));}}async function createOrRecoverEmbeddedSegment(_0x3b5414,_0x82ff7f,_0x5309a3,_0x180102){const _0x4c51a1=a159_0x3ddbd6;let _0x196d06;try{_0x196d06=await _0x3b5414[_0x4c51a1(0x177)][_0x4c51a1(0x182)]({'name':_0x5309a3[_0x4c51a1(0x10f)],'description':_0x5309a3[_0x4c51a1(0x133)],'journeyId':_0x5309a3[_0x4c51a1(0x17b)],'rule':_0x180102(_0x5309a3[_0x4c51a1(0x153)],!![]),'countPopulation':!![],'parentFolderId':_0x5309a3[_0x4c51a1(0x1df)],'audienceId':_0x5309a3['parentId']});}catch(_0x2c4b9a){const _0x2b8587=_0x2c4b9a instanceof Error&&_0x2c4b9a[_0x4c51a1(0x1d6)]['includes']('Name\x20has\x20already\x20been\x20taken');if(_0x2b8587){const _0xf7868c=readPushRecovery(_0x82ff7f[_0x4c51a1(0xff)]),_0x40f6d3=_0xf7868c?.[_0x4c51a1(0x178)]===_0x82ff7f[_0x4c51a1(0x19f)][_0x4c51a1(0x101)]?_0xf7868c['segments'][_0x5309a3[_0x4c51a1(0x10b)]]:undefined;if(_0x40f6d3?.[_0x4c51a1(0x1a2)]===_0x5309a3[_0x4c51a1(0x10f)])await _0x3b5414[_0x4c51a1(0x177)][_0x4c51a1(0x11f)](_0x5309a3[_0x4c51a1(0x184)],_0x40f6d3[_0x4c51a1(0x1bc)],{'description':_0x5309a3[_0x4c51a1(0x133)],'rule':_0x180102(_0x5309a3[_0x4c51a1(0x153)],!![]),'countPopulation':!![]}),_0x196d06=_0x40f6d3[_0x4c51a1(0x1bc)];else throw new SDKError(ErrorCode[_0x4c51a1(0x189)],_0x4c51a1(0x128)+_0x5309a3['localName']+_0x4c51a1(0x1e4)+(_0x4c51a1(0xf1)+_0x82ff7f[_0x4c51a1(0xff)]['replace'](/([^/]+)$/,_0x4c51a1(0x1bb))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x2c4b9a);}else throw _0x2c4b9a;}return saveSegmentToPushRecovery(_0x82ff7f[_0x4c51a1(0xff)],_0x82ff7f['yamlConfig'][_0x4c51a1(0x101)],_0x5309a3['localName'],{'segmentId':_0x196d06,'uniqueServerName':_0x5309a3['uniqueSegmentName'],'createdAt':new Date()[_0x4c51a1(0x148)]()}),_0x196d06;}export async function prepareSegmentFiles(_0x466a1a,_0x57b966,_0x17e547,_0x444951,_0x48a07b){const _0x4c92a1=a159_0x3ddbd6,{activationDefToCreateRequest:_0x14a08d}=await import(_0x4c92a1(0x155)),_0x5a7a23=[],_0x3f8c7d=new Set();for(const {yamlConfig:_0x1bdaf0,folderPath:_0x277afa,sourcePath:_0x47cbb4}of _0x466a1a){const _0xf6ae90=resolveTDFolderPath(_0x277afa,_0x444951,_0x48a07b),_0x11242e=_0xf6ae90+':'+_0x1bdaf0[_0x4c92a1(0x101)],_0x48f2a8=_0x57b966['segmentByFolderAndName'][_0x4c92a1(0x17f)](_0x11242e),_0x1af312=_0x48f2a8?_0x57b966[_0x4c92a1(0x193)][_0x4c92a1(0x17f)](_0x48f2a8['id'])||[]:[];addFoldersToCreate(_0xf6ae90,_0x57b966[_0x4c92a1(0x114)],_0x3f8c7d);const _0x5dd5b8=calculateActivationActions(_0x1bdaf0[_0x4c92a1(0x137)]||[],_0x1af312,_0x57b966[_0x4c92a1(0x11c)],_0x57b966[_0x4c92a1(0xf0)]);for(const _0x2e1ca0 of _0x5dd5b8){(_0x2e1ca0[_0x4c92a1(0x110)]===_0x4c92a1(0x1b2)||_0x2e1ca0[_0x4c92a1(0x110)]==='update')&&_0x2e1ca0['yamlActivation']&&(_0x2e1ca0[_0x4c92a1(0x142)]=await _0x14a08d(_0x2e1ca0['yamlActivation'],_0x17e547));}const _0x4101aa=calculateSegmentDiff(_0x1bdaf0,_0x48f2a8,_0x1af312,_0x57b966['idToEmailMap'],_0x57b966[_0x4c92a1(0xf0)]);_0x5a7a23[_0x4c92a1(0x1c5)]({'relativePath':_0x1bdaf0['name'],'absolutePath':_0x47cbb4,'yamlConfig':_0x1bdaf0,'folderPath':_0xf6ae90,'existingSegment':_0x48f2a8,'existingActivations':_0x1af312,'isNew':_0x4101aa[_0x4c92a1(0xee)],'hasChanges':_0x4101aa[_0x4c92a1(0x14e)],'diff':_0x4101aa[_0x4c92a1(0x1a4)],'activationActions':_0x5dd5b8});}return{'segmentFiles':_0x5a7a23,'foldersToCreate':_0x3f8c7d};}export async function prepareJourneyFiles(_0x147a66,_0xdac77b,_0x15f24d,_0x28fe3a){const _0x5a3247=a159_0x3ddbd6,_0x4437c4=[],_0xdd308b=new Set();for(const {yamlConfig:_0x1a36a0,folderPath:_0x361168,sourcePath:_0x8bf96f}of _0x147a66){const _0x2d4a2b=resolveTDFolderPath(_0x361168,_0x15f24d,_0x28fe3a),_0x2d0b01=_0x2d4a2b+':'+_0x1a36a0['name'],_0x1b3e09=_0xdac77b[_0x5a3247(0x104)][_0x5a3247(0x17f)](_0x2d0b01);let _0x29de59,_0x487cb5;if(_0x1b3e09&&_0x1b3e09['length']>0x0){const _0x24f23c=buildLocalExpandedRuleMappings(_0x1a36a0),{createYamlContext:_0x202ba1,prefetchJourneySegments:_0x29824d}=createPushYamlContextForBundle(_0xdac77b[_0x5a3247(0xf3)],_0xdac77b[_0x5a3247(0x184)],_0xdac77b[_0x5a3247(0x1af)],_0x24f23c,_0xdac77b[_0x5a3247(0x11c)],_0xdac77b[_0x5a3247(0xf0)],_0xdac77b['activationStepsById'],_0xdac77b[_0x5a3247(0x190)]);await _0x29824d(_0x1b3e09[_0x5a3247(0x185)](_0x381aa8=>_0x381aa8['id']));const _0x3eee6e=await _0xdac77b[_0x5a3247(0xf3)][_0x5a3247(0x17c)][_0x5a3247(0x134)](_0x1b3e09[0x0][_0x5a3247(0x118)]),_0x335159=hasMultipleVersions(_0x1a36a0),_0x3729fd=async _0x2e6781=>{const _0x5cc705=_0x5a3247,_0x3860d9=_0xdac77b['journeyById']?.[_0x5cc705(0x17f)](_0x2e6781);if(_0x3860d9)return _0x3860d9;return _0xdac77b[_0x5cc705(0x1e2)]({'journeyId':_0x2e6781,'journeyName':_0x1a36a0['name'],'isMultiVersion':_0x1b3e09['length']>0x1});};if(_0x335159&&_0x1b3e09[_0x5a3247(0x107)]>0x1){const _0xf816f3=[];for(const _0xa99e95 of _0x1b3e09){const _0xc5357d=_0xa99e95[_0x5a3247(0x1a0)]||0x1;_0xdac77b[_0x5a3247(0xfd)]?.[_0x5a3247(0xf5)]('Fetching\x20'+_0x1a36a0['name']+'\x20v'+_0xc5357d);const _0x36f4c2=await _0x3729fd(_0xa99e95['id']),_0x20d7f1=_0x202ba1(_0xa99e95['id']),_0x39fec1=await journeyResponseToDef(_0x36f4c2,_0x20d7f1);_0xf816f3[_0x5a3247(0x1c5)]({'item':_0xa99e95,'yaml':_0x39fec1});}const _0x1f1b33=buildLocalRuleToNameMappingFromJourney(_0x1a36a0);_0x487cb5=buildMergedJourneyDef(_0xf816f3,_0x1f1b33,_0x3eee6e);const _0x5a7c9b=Math[_0x5a3247(0x14b)](..._0xf816f3[_0x5a3247(0x185)](_0x60d1a3=>_0x60d1a3['item'][_0x5a3247(0x1a0)]||0x0)),_0x4c0c10=_0x1b3e09[_0x5a3247(0x1be)](_0x4a076c=>(_0x4a076c[_0x5a3247(0x1a0)]||0x0)===_0x5a7c9b);_0x4c0c10&&(_0xdac77b['progress']?.[_0x5a3247(0xf5)]('Fetching\x20'+_0x1a36a0[_0x5a3247(0x101)]+'\x20v'+_0x5a7c9b),_0x29de59=await _0x3729fd(_0x4c0c10['id']));}else{const _0x428978=_0x1b3e09[_0x1b3e09[_0x5a3247(0x107)]-0x1];_0xdac77b['progress']?.[_0x5a3247(0xf5)]('Fetching\x20'+_0x1a36a0[_0x5a3247(0x101)]),_0x29de59=await _0x3729fd(_0x428978['id']);const _0x3e4b55=_0x202ba1(_0x428978['id']),_0x2ce8c8=await journeyResponseToDef(_0x29de59,_0x3e4b55),_0x241ead=buildLocalRuleToNameMappingFromJourney(_0x1a36a0);_0x487cb5=buildMergedJourneyDef([{'item':_0x428978,'yaml':_0x2ce8c8}],_0x241ead,_0x3eee6e);}}addFoldersToCreate(_0x2d4a2b,_0xdac77b[_0x5a3247(0x114)],_0xdd308b);const _0x38adb0=calculateJourneyDiff(_0x1a36a0,_0x487cb5);_0x4437c4[_0x5a3247(0x1c5)]({'relativePath':_0x1a36a0[_0x5a3247(0x101)],'absolutePath':_0x8bf96f,'yamlConfig':_0x1a36a0,'folderPath':_0x2d4a2b,'existingJourney':_0x29de59,'isNew':_0x38adb0['isNew'],'hasChanges':_0x38adb0[_0x5a3247(0x14e)],'diff':_0x38adb0[_0x5a3247(0x1a4)]});}return{'journeyFiles':_0x4437c4,'foldersToCreate':_0xdd308b};}export function calculateActivationActions(_0x421e4e,_0x41e73f,_0x2da067,_0x333d30){const _0x21194b=a159_0x3ddbd6,_0x32c6d9=[],_0x355631=new Map();for(const _0x43be73 of _0x41e73f){_0x355631[_0x21194b(0x18a)](_0x43be73[_0x21194b(0x101)],_0x43be73);}const _0x30893e=new Map();for(const _0x486809 of _0x421e4e){_0x30893e[_0x21194b(0x18a)](_0x486809[_0x21194b(0x101)],_0x486809);}for(const _0x3c0a2c of _0x421e4e){const _0x1843aa=_0x355631['get'](_0x3c0a2c[_0x21194b(0x101)]);if(!_0x1843aa)_0x32c6d9[_0x21194b(0x1c5)]({'type':_0x21194b(0x1b2),'name':_0x3c0a2c['name'],'yamlActivation':_0x3c0a2c});else{const _0x498ccb=activationResponseToDef(_0x1843aa,_0x2da067,_0x333d30),_0x37a77a=a159_0x424d42[_0x21194b(0x16a)](_0x498ccb),_0x3033ed=a159_0x424d42[_0x21194b(0x16a)](_0x3c0a2c);_0x37a77a!==_0x3033ed&&_0x32c6d9['push']({'type':_0x21194b(0xf5),'name':_0x3c0a2c[_0x21194b(0x101)],'yamlActivation':_0x3c0a2c,'existingActivation':_0x1843aa});}}for(const _0x5f5dd4 of _0x41e73f){!_0x30893e[_0x21194b(0x18e)](_0x5f5dd4[_0x21194b(0x101)])&&_0x32c6d9['push']({'type':'delete','name':_0x5f5dd4[_0x21194b(0x101)],'existingActivation':_0x5f5dd4});}return _0x32c6d9;}function calculateYamlDiff(_0x39302a,_0x3b05cb){if(_0x3b05cb){const _0x22bd08=generateDiff(_0x3b05cb,_0x39302a),_0x51c10c=hasChanges(_0x22bd08);return{'isNew':![],'hasChanges':_0x51c10c,'diff':_0x51c10c?formatDiffWithColors(_0x22bd08):undefined};}const _0x329843=generateDiff('',_0x39302a);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x329843)};}export function calculateSegmentDiff(_0x6a089c,_0xcf5f8e,_0x48eddd,_0x3306ea,_0x1093ff){const _0x4474b8=segmentToYamlString(_0x6a089c),_0x98e5ab=_0xcf5f8e?segmentToYamlString(segmentWithActivationsToYaml(_0xcf5f8e,_0x48eddd,undefined,_0x3306ea,_0x1093ff)):undefined;return calculateYamlDiff(_0x4474b8,_0x98e5ab);}export function calculateJourneyDiff(_0x415540,_0x201ea4){const _0x1dd511=normalizeJourneyDef(_0x415540,_0x415540),_0x6f64ee=a159_0x529b31(_0x1dd511),_0x3fb121=_0x201ea4?a159_0x529b31(normalizeJourneyDef(_0x201ea4,_0x415540)):undefined;return calculateYamlDiff(_0x6f64ee,_0x3fb121);}export function findSegmentsToDelete(_0x46c2b0,_0x4b0740,_0x2e44ed,_0x141045,_0x16b894){const _0x28cb60=a159_0x3ddbd6,_0x10a8c4=new Set();for(const {yamlConfig:_0x16dae9,folderPath:_0x3fd705}of _0x4b0740){_0x10a8c4[_0x28cb60(0x1cd)](_0x3fd705+':'+_0x16dae9[_0x28cb60(0x101)]);}return _0x46c2b0['filter'](_0x4a038d=>{const _0x4ed033=_0x28cb60,_0x2b9623=_0x4a038d[_0x4ed033(0x180)]?_0x2e44ed[_0x4ed033(0x17f)](_0x4a038d[_0x4ed033(0x180)][_0x4ed033(0x1a6)]())||'':'',_0x459e02=_0x2b9623+':'+_0x4a038d[_0x4ed033(0x101)];if(_0x10a8c4[_0x4ed033(0x18e)](_0x459e02))return![];if(_0x16b894)return _0x2b9623===_0x141045||_0x2b9623['startsWith'](_0x141045+'/');return!![];});}export function findJourneysToDelete(_0x47ac5f,_0x4a1748,_0x4f4169,_0x514f16,_0x1e1f09){const _0x33662d=a159_0x3ddbd6,_0x24b469=new Set();for(const {yamlConfig:_0x54eb5f,folderPath:_0xe09dfe}of _0x4a1748){_0x24b469[_0x33662d(0x1cd)](_0xe09dfe+':'+_0x54eb5f[_0x33662d(0x101)]);}return _0x47ac5f['filter'](_0x565fbb=>{const _0x57a5b1=_0x33662d,_0x57cf17=_0x565fbb[_0x57a5b1(0x1df)]?_0x4f4169[_0x57a5b1(0x17f)](_0x565fbb[_0x57a5b1(0x1df)])||'':'',_0x19317d=_0x57cf17+':'+_0x565fbb[_0x57a5b1(0x19e)];if(_0x24b469['has'](_0x19317d))return![];if(_0x1e1f09)return _0x57cf17===_0x514f16||_0x57cf17['startsWith'](_0x514f16+'/');return!![];});}export function buildSegmentLookupMap(_0x3d76b1,_0x3effc9){const _0x4e455f=a159_0x3ddbd6,_0x1d190f=new Map();for(const _0x36eab4 of _0x3d76b1){const _0x59ecf3=_0x36eab4[_0x4e455f(0x180)]?_0x3effc9[_0x4e455f(0x17f)](_0x36eab4[_0x4e455f(0x180)]['toString']())||'':'',_0x559dc8=_0x59ecf3+':'+_0x36eab4[_0x4e455f(0x101)];_0x1d190f[_0x4e455f(0x18a)](_0x559dc8,_0x36eab4);}return _0x1d190f;}export function buildSegmentNameToIdMap(_0x27c33e){const _0x29de9f=a159_0x3ddbd6,_0x27e5ca=new Map();for(const _0x4aa957 of _0x27c33e){_0x27e5ca[_0x29de9f(0x18a)](_0x4aa957['name'],_0x4aa957['id']);}return _0x27e5ca;}export function buildJourneyBundleLookupMap(_0x254ce0,_0x58d226){const _0x53f3e2=a159_0x3ddbd6,_0x354e32=new Map();for(const _0x24a6c3 of _0x254ce0){const _0x926943=_0x24a6c3['folderId']?_0x58d226['get'](_0x24a6c3[_0x53f3e2(0x1df)])||'':'',_0x1ec8e0=_0x926943+':'+_0x24a6c3[_0x53f3e2(0x19e)];!_0x354e32[_0x53f3e2(0x18e)](_0x1ec8e0)&&_0x354e32[_0x53f3e2(0x18a)](_0x1ec8e0,[]),_0x354e32[_0x53f3e2(0x17f)](_0x1ec8e0)[_0x53f3e2(0x1c5)](_0x24a6c3);}for(const _0x56f4a8 of _0x354e32[_0x53f3e2(0x130)]()){_0x56f4a8[_0x53f3e2(0x197)]((_0x510225,_0x459b6a)=>(_0x510225[_0x53f3e2(0x1a0)]||0x0)-(_0x459b6a[_0x53f3e2(0x1a0)]||0x0));}return _0x354e32;}export function collectFoldersToCreate(_0x1bbba4,_0x184051){const _0x27536a=a159_0x3ddbd6,_0x19c57f=new Set();for(const _0x918408 of _0x1bbba4){if(!_0x918408)continue;if(_0x184051[_0x27536a(0x18e)](_0x918408))continue;const _0x3a92cf=_0x918408[_0x27536a(0x183)]('/');let _0x53f568='';for(const _0x341de7 of _0x3a92cf){_0x53f568=_0x53f568?_0x53f568+'/'+_0x341de7:_0x341de7,!_0x184051[_0x27536a(0x18e)](_0x53f568)&&_0x19c57f[_0x27536a(0x1cd)](_0x53f568);}}return _0x19c57f;}export function parseAndClassifyYamlFiles(_0x352933,_0x100b5a,_0x45f328){const _0x59177e=a159_0x3ddbd6,_0x5522e4=[],_0x3c6a3f=[];for(const _0x29973b of _0x352933){const _0x2b7197=a159_0x59f5d5[_0x59177e(0x1e5)](_0x100b5a,a159_0x59f5d5[_0x59177e(0x144)](_0x29973b)),_0x28b192=_0x2b7197==='.'?'':_0x2b7197[_0x59177e(0x12d)](/\\/g,'/'),_0x16a709=readFileSync(_0x29973b,_0x59177e(0x1a3)),_0x27b7a0=a159_0x424d42['parse'](_0x16a709);if(isJourneyDef(_0x27b7a0,_0x29973b)){const _0x5d99d7=a159_0x21833f(_0x16a709);_0x3c6a3f['push']({'yamlConfig':_0x5d99d7,'folderPath':_0x28b192,'sourcePath':_0x29973b});}else{if(!_0x45f328?.[_0x59177e(0x16c)]){const _0x35898d=parseSegmentYamlFile(_0x16a709),_0x472e0d=normalizeChildSegmentYaml(_0x35898d);_0x5522e4[_0x59177e(0x1c5)]({'yamlConfig':_0x472e0d,'folderPath':_0x28b192,'sourcePath':_0x29973b});}}}return{'segments':_0x5522e4,'journeys':_0x3c6a3f};}export function validateParsedFiles(_0xb06a85,_0x3151c0){const _0x4ec6d4=a159_0x3ddbd6,_0x29105a=[];for(const {yamlConfig:_0x30ac84,sourcePath:_0x40e819}of _0xb06a85['segments']){const _0x361e2f=readFileSync(_0x40e819,_0x4ec6d4(0x1a3)),_0x50ac92=a159_0x424d42[_0x4ec6d4(0xfb)](_0x361e2f),_0x43443a=validateSegmentDef(_0x30ac84,{'source':_0x361e2f,'document':_0x50ac92},{'skipSchema':!![]});if(!_0x43443a[_0x4ec6d4(0x1d4)]){const _0x38fb25=a159_0x59f5d5[_0x4ec6d4(0x1e5)](_0x3151c0,_0x40e819);_0x29105a[_0x4ec6d4(0x1c5)]({'filePath':_0x38fb25,'source':_0x361e2f,'result':_0x43443a,'isJourney':![]});}}for(const {yamlConfig:_0x1fe081,sourcePath:_0x554224}of _0xb06a85[_0x4ec6d4(0x176)]){const _0x4428cc=readFileSync(_0x554224,'utf-8'),_0x13b129=a159_0x424d42[_0x4ec6d4(0xfb)](_0x4428cc),_0x4087e3=validateJourneyDef(_0x1fe081,{'source':_0x4428cc,'document':_0x13b129},{'skipSchema':!![]});if(!_0x4087e3[_0x4ec6d4(0x1d4)]){const _0x396ea9=a159_0x59f5d5['relative'](_0x3151c0,_0x554224);_0x29105a['push']({'filePath':_0x396ea9,'source':_0x4428cc,'result':_0x4087e3,'isJourney':!![]});}}return _0x29105a;}export function formatValidationErrors(_0x3889de){const _0x5e99b3=a159_0x3ddbd6,_0x4746b1=[];for(const {filePath:_0x1ad2ef,source:_0x591852,result:_0x58def9,isJourney:_0x316962}of _0x3889de){const _0x1b0b4a=_0x316962?_0x5e99b3(0x17c):_0x5e99b3(0x177);_0x4746b1['push']('\x0a'+_0x1ad2ef+'\x20('+_0x1b0b4a+'):\x20'+_0x58def9[_0x5e99b3(0xf6)][_0x5e99b3(0x107)]+_0x5e99b3(0x1cf)),_0x4746b1[_0x5e99b3(0x1c5)](formatValidationResult(_0x58def9,_0x591852,_0x1ad2ef));}return _0x4746b1[_0x5e99b3(0x1b8)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x324376){const _0x4db69d=a159_0x3ddbd6,_0x2da24b=new Set(),_0x13979d=new Map(),_0x5460c9=collectSegmentUsageCounts(_0x324376);if(_0x324376['segments'])for(const [_0x449c6d,_0x25f0c7]of Object[_0x4db69d(0x146)](_0x324376[_0x4db69d(0x167)])){_0x2da24b[_0x4db69d(0x1cd)](_0x449c6d);if(_0x25f0c7['rule']){const _0x5ebc3d=yamlRuleToApi(_0x25f0c7['rule']),_0x56f285=apiRuleToYaml(_0x5ebc3d);_0x13979d['set'](_0x449c6d,_0x56f285);}}const _0x191312=new Map();let _0x501305=0x0;for(const [_0x510055,_0x412bda]of _0x13979d){const _0x2fd155=serializeExpandedRule(_0x412bda,_0x13979d),_0x2fe20d=_0x191312[_0x4db69d(0x17f)](_0x2fd155)||[];_0x2fe20d[_0x4db69d(0x1c5)]({'name':_0x510055,'index':_0x501305}),_0x191312[_0x4db69d(0x18a)](_0x2fd155,_0x2fe20d),_0x501305++;}const _0x3f5795=new Map();for(const [_0x1f93af,_0x420259]of _0x191312){const _0xc17c49=_0x420259['slice']()[_0x4db69d(0x197)]((_0x2d8044,_0x30b390)=>{const _0x136175=_0x4db69d,_0x653ed4=_0x5460c9[_0x136175(0x17f)](_0x2d8044[_0x136175(0x101)])||0x0,_0x42176b=_0x5460c9[_0x136175(0x17f)](_0x30b390[_0x136175(0x101)])||0x0;if(_0x653ed4!==_0x42176b)return _0x42176b-_0x653ed4;return _0x2d8044['index']-_0x30b390[_0x136175(0x1de)];})[_0x4db69d(0x185)](_0x1c9c62=>_0x1c9c62['name']),_0x1fecbb=[];for(const _0x5bc51f of _0xc17c49){const _0x191d42=_0x5460c9[_0x4db69d(0x17f)](_0x5bc51f)||0x0,_0x47eaa4=Math['max'](_0x191d42,0x1);for(let _0x4cf3b7=0x0;_0x4cf3b7<_0x47eaa4;_0x4cf3b7++){_0x1fecbb['push'](_0x5bc51f);}}_0x3f5795[_0x4db69d(0x18a)](_0x1f93af,_0x1fecbb);}return{'existingLocalSegmentNames':_0x2da24b,'localSegmentRules':_0x13979d,'localExpandedRuleToNames':_0x3f5795};}export function createSegmentIdResolver(_0x1a92d5,_0x1e8a33){return async _0x631c3a=>{const _0x39820c=a159_0x4982,_0x3352ec=_0x1a92d5[_0x39820c(0x17f)](_0x631c3a);if(!_0x3352ec)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x39820c(0x14f)+_0x631c3a+_0x39820c(0x141)+_0x1e8a33+'\x27)');return _0x3352ec;};}export function extractRootFolderId(_0x58a596){const _0x25d992=a159_0x3ddbd6;return _0x58a596[_0x25d992(0x1cb)]?.['parentSegmentFolder']?.[_0x25d992(0x179)]?.['id']||_0x58a596[_0x25d992(0x1cb)]?.['parentFolder']?.['data']?.['id'];}export function buildConnectionMaps(_0x26df14){const _0x550a45=a159_0x3ddbd6,_0x22dd59=new Map(),_0x12602c=new Map(),_0x17fa3b=new Map();for(const _0x54b22a of _0x26df14){_0x22dd59['set'](_0x54b22a['name'],parseInt(_0x54b22a['id'],0xa)),_0x12602c['set'](_0x54b22a['id'],_0x54b22a[_0x550a45(0x101)]),_0x17fa3b[_0x550a45(0x18a)](_0x54b22a[_0x550a45(0x101)],_0x54b22a[_0x550a45(0x110)]);}return{'nameToId':_0x22dd59,'idToName':_0x12602c,'nameToType':_0x17fa3b};}export function calculatePushStats(_0x5e9e02,_0xbb9995,_0x546d80,_0x21a68c,_0x14763b,_0x85f115,_0x4100c8){const _0x21ae8e=a159_0x3ddbd6,_0x2e4c5b=_0x5e9e02[_0x21ae8e(0x186)](_0x37f40f=>_0x37f40f[_0x21ae8e(0xee)]),_0xa10df3=_0x5e9e02[_0x21ae8e(0x186)](_0x1b7828=>!_0x1b7828[_0x21ae8e(0xee)]&&_0x1b7828[_0x21ae8e(0x14e)]),_0x46ed2f=_0x5e9e02['filter'](_0x29b333=>!_0x29b333[_0x21ae8e(0xee)]&&!_0x29b333[_0x21ae8e(0x14e)]),_0x51c46b=_0x85f115?_0x21a68c:[],_0x5654c1=_0xbb9995[_0x21ae8e(0x186)](_0x55a40e=>_0x55a40e[_0x21ae8e(0xee)]),_0x135b1a=_0xbb9995[_0x21ae8e(0x186)](_0x1b8ea0=>!_0x1b8ea0[_0x21ae8e(0xee)]&&_0x1b8ea0['hasChanges']),_0x5490a0=_0xbb9995[_0x21ae8e(0x186)](_0x201938=>!_0x201938[_0x21ae8e(0xee)]&&!_0x201938[_0x21ae8e(0x14e)]),_0x33e8ff=_0x85f115?_0x14763b:[],_0x107b45=_0x5e9e02['flatMap'](_0x11637f=>_0x11637f[_0x21ae8e(0x10d)]),_0x192747=_0x107b45['filter'](_0x3d5be4=>_0x3d5be4['type']===_0x21ae8e(0x1b2)),_0x101f23=_0x107b45['filter'](_0x30df05=>_0x30df05[_0x21ae8e(0x110)]===_0x21ae8e(0xf5)),_0x15dc8e=_0x107b45[_0x21ae8e(0x186)](_0x276e43=>_0x276e43[_0x21ae8e(0x110)]==='delete'),_0x53f613=Array[_0x21ae8e(0x10a)](_0x546d80)[_0x21ae8e(0x197)](),_0x581bd3=_0x4100c8?![]:_0x2e4c5b[_0x21ae8e(0x107)]>0x0||_0xa10df3[_0x21ae8e(0x107)]>0x0||_0x51c46b[_0x21ae8e(0x107)]>0x0,_0x261cc4=_0x5654c1[_0x21ae8e(0x107)]>0x0||_0x135b1a['length']>0x0||_0x33e8ff[_0x21ae8e(0x107)]>0x0,_0xd5b850=_0x4100c8?![]:_0x107b45['length']>0x0,_0xcc67cb=_0x53f613[_0x21ae8e(0x107)]>0x0;return{'segments':{'new':_0x2e4c5b,'changed':_0xa10df3,'unchanged':_0x46ed2f,'toDelete':_0x51c46b},'journeys':{'new':_0x5654c1,'changed':_0x135b1a,'unchanged':_0x5490a0,'toDelete':_0x33e8ff},'activations':{'all':_0x107b45,'toCreate':_0x192747,'toUpdate':_0x101f23,'toDelete':_0x15dc8e},'folders':{'toCreate':_0x53f613},'counts':{'segments':{'new':_0x2e4c5b[_0x21ae8e(0x107)],'changed':_0xa10df3[_0x21ae8e(0x107)],'unchanged':_0x46ed2f[_0x21ae8e(0x107)],'toDelete':_0x51c46b['length']},'journeys':{'new':_0x5654c1[_0x21ae8e(0x107)],'changed':_0x135b1a[_0x21ae8e(0x107)],'unchanged':_0x5490a0[_0x21ae8e(0x107)],'toDelete':_0x33e8ff[_0x21ae8e(0x107)]},'activations':{'create':_0x192747[_0x21ae8e(0x107)],'update':_0x101f23['length'],'delete':_0x15dc8e[_0x21ae8e(0x107)]},'folders':_0x53f613[_0x21ae8e(0x107)]},'hasChanges':_0x581bd3||_0x261cc4||_0xd5b850||_0xcc67cb};}export async function buildPushExecutionContext(_0x56b4ef,_0x9d9b79,_0x43af37,_0x37e042,_0x988ff6,_0x41dd2d){const _0x64af19=a159_0x3ddbd6,_0x1c323d=extractRootFolderId(_0x43af37),{pathToId:_0xf61cfc,idToPath:_0x42bf7f}=buildFolderMaps(_0x988ff6),_0x7aff65=buildSegmentNameToIdMap(_0x37e042),_0x2c6f58=new Map(),{batchAsync:_0x14f706}=await import(_0x64af19(0x159)),[_0x458c0c,_0x29aaf6]=await Promise[_0x64af19(0x11d)]([_0x56b4ef[_0x64af19(0x1d1)][_0x64af19(0x192)](),_0x56b4ef[_0x64af19(0x18b)][_0x64af19(0x13c)](),((async()=>{const _0x26a6aa=_0x64af19;!_0x41dd2d&&_0x37e042[_0x26a6aa(0x107)]>0x0&&await _0x14f706(_0x37e042,async _0x31fafe=>{const _0x1c34c4=_0x26a6aa,_0x3c8f28=await _0x56b4ef[_0x1c34c4(0x177)]['listActivations'](_0x9d9b79,_0x31fafe['id']);_0x2c6f58[_0x1c34c4(0x18a)](_0x31fafe['id'],_0x3c8f28);});})())]),{emailToId:_0x1f8c74,idToEmail:_0x4365a0}=_0x458c0c,_0x3ec595=buildConnectionMaps(_0x29aaf6);return{'rootFolderId':_0x1c323d,'folderPathToId':_0xf61cfc,'folderIdToPath':_0x42bf7f,'segmentNameToId':_0x7aff65,'activationsBySegmentId':_0x2c6f58,'emailToIdMap':_0x1f8c74,'idToEmailMap':_0x4365a0,'connectionNameToIdMap':_0x3ec595[_0x64af19(0x19d)],'connectionIdToNameMap':_0x3ec595[_0x64af19(0x154)],'connectionNameToTypeMap':_0x3ec595[_0x64af19(0x113)]};}function a159_0x4982(_0xeb2b73,_0x29e503){_0xeb2b73=_0xeb2b73-0xec;const _0x535c67=a159_0x535c();let _0x498297=_0x535c67[_0xeb2b73];return _0x498297;}export function createPushYamlContextForBundle(_0x213842,_0x3ca17c,_0x37e0ad,_0x1e01d6,_0x3af9a6,_0x23b6fb,_0x348a84,_0x458a0c){const {existingLocalSegmentNames:_0x301907,localExpandedRuleToNames:_0x10f8e0}=_0x1e01d6,_0x3b7c6a=new Set(),_0x3ef5b6=new Map(),_0x5e0989=new Map(),_0x433325=new Map(),_0x13fce8=createJumpTargetCache(),_0x3d7dc6=new Map(),_0x7e8a48=new Map(),_0x5c3321=new Set();let _0x28472f;const _0x45f796=_0x1b3ebb=>{const _0x14b880={'resolveSegment':async _0x4135e0=>{const _0x5111ae=a159_0x4982,_0x34b582=_0x433325['get'](_0x4135e0);if(_0x34b582!==undefined)return{'name':_0x34b582,'isJourneyLocal':!![]};try{const _0x1d6c5f=await fetchSegment(_0x213842,_0x3ca17c,_0x4135e0,_0x37e0ad);if(!_0x1d6c5f)throw new Error(_0x5111ae(0x138));const _0x17096c=generateJourneyLocalName(_0x1d6c5f[_0x5111ae(0x101)]),_0x3b2f97=_0x1d6c5f[_0x5111ae(0x1a8)]===SEGMENT_KIND_JOURNEY&&_0x17096c!==undefined;let _0x18405e=_0x1d6c5f[_0x5111ae(0x101)],_0x172878;if(_0x3b2f97&&_0x1d6c5f['rule']){const _0x2d8dd1=apiRuleToYaml(_0x1d6c5f[_0x5111ae(0x174)]);_0x7e8a48[_0x5111ae(0x18a)](_0x4135e0,_0x2d8dd1);const _0x53b485=async _0xed1af7=>{const _0x31423a=_0x5111ae,_0x2052aa=collectSegmentRefsFromRule(_0xed1af7);for(const _0x195e76 of _0x2052aa){if(!_0x7e8a48[_0x31423a(0x18e)](_0x195e76))try{const _0x3d19ff=await fetchSegment(_0x213842,_0x3ca17c,_0x195e76,_0x37e0ad);if(_0x3d19ff?.[_0x31423a(0x174)]){const _0x56e184=apiRuleToYaml(_0x3d19ff[_0x31423a(0x174)]);_0x7e8a48[_0x31423a(0x18a)](_0x195e76,_0x56e184),await _0x53b485(_0x56e184);}}catch(_0x5bc22a){logger[_0x31423a(0x13e)](_0x31423a(0x1ae)+_0x195e76+':\x20'+_0x5bc22a);}}};await _0x53b485(_0x2d8dd1);const _0x43fd90=serializeExpandedRule(_0x2d8dd1,_0x7e8a48),_0x106247=_0x10f8e0['get'](_0x43fd90);if(_0x106247&&_0x106247[_0x5111ae(0x107)]>0x0){const _0xa50c45=_0x3ef5b6[_0x5111ae(0x17f)](_0x43fd90)||0x0,_0x2dfb22=_0x106247[_0xa50c45]||_0x106247[_0x106247['length']-0x1];_0x3ef5b6['set'](_0x43fd90,_0xa50c45+0x1),_0x18405e=_0x2dfb22,_0x3b7c6a['add'](_0x18405e),_0x433325[_0x5111ae(0x18a)](_0x4135e0,_0x18405e);const _0x50e34e=await resolveRuleSegmentRefs(_0x2d8dd1,async _0x2fec75=>{const _0x107bff=_0x5111ae,_0x2fc001=_0x433325[_0x107bff(0x17f)](_0x2fec75);if(_0x2fc001)return _0x2fc001;const _0xc5ace4=await _0x28472f[_0x107bff(0x15a)](_0x2fec75);return _0xc5ace4['name'];});_0x172878={'description':_0x1d6c5f[_0x5111ae(0x133)],'rule':_0x50e34e};}else{const _0x28b064=_0x3d7dc6['get'](_0x43fd90);if(_0x28b064)_0x18405e=_0x28b064,_0x433325[_0x5111ae(0x18a)](_0x4135e0,_0x18405e);else{if(_0x17096c){let _0x23d227=_0x17096c,_0x4a2b67=0x2;while(_0x3b7c6a[_0x5111ae(0x18e)](_0x23d227)||_0x301907[_0x5111ae(0x18e)](_0x23d227)){_0x23d227=_0x17096c+'_'+_0x4a2b67,_0x4a2b67++;}_0x3b7c6a[_0x5111ae(0x1cd)](_0x23d227),_0x18405e=_0x23d227;}_0x433325[_0x5111ae(0x18a)](_0x4135e0,_0x18405e),_0x3d7dc6[_0x5111ae(0x18a)](_0x43fd90,_0x18405e);const _0x2d5887=await resolveRuleSegmentRefs(_0x2d8dd1,async _0x2235d2=>{const _0x1dea3d=_0x5111ae,_0x28e94c=_0x433325[_0x1dea3d(0x17f)](_0x2235d2);if(_0x28e94c)return _0x28e94c;const _0x4c5e12=await _0x28472f[_0x1dea3d(0x15a)](_0x2235d2);return _0x4c5e12[_0x1dea3d(0x101)];});_0x172878={'description':_0x1d6c5f[_0x5111ae(0x133)],'rule':_0x2d5887};}}}return{'name':_0x18405e,'isJourneyLocal':_0x3b2f97,'definition':_0x172878};}catch(_0x29a678){return logger[_0x5111ae(0x13e)]('Failed\x20to\x20resolve\x20segment\x20'+_0x4135e0+':\x20'+_0x29a678),{'name':_0x4135e0,'isJourneyLocal':![]};}},'resolveActivation':async _0x29fb77=>{const _0x19eb49=a159_0x4982,_0x2e5dc5=_0x5e0989[_0x19eb49(0x17f)](_0x29fb77);if(_0x2e5dc5!==undefined)return{'name':_0x2e5dc5,'isJourneyLocal':!![]};try{let _0x37ebf8=_0x348a84?.[_0x19eb49(0x17f)](_0x29fb77);!_0x37ebf8&&(_0x37ebf8=await _0x213842['journey'][_0x19eb49(0x1e7)](_0x1b3ebb,_0x29fb77));const _0x219272=_0x37ebf8[_0x19eb49(0x1b5)][_0x19eb49(0x16e)][_0x19eb49(0x101)]||_0x29fb77,_0x4fdfcd=sanitizeYamlKey(_0x219272)||_0x19eb49(0x13b)+_0x29fb77,_0x56225b=_0x4fdfcd;_0x5e0989[_0x19eb49(0x18a)](_0x29fb77,_0x56225b);const _0x19f221=journeyActivationStepToYaml(_0x37ebf8,_0x3af9a6,_0x23b6fb);return{'name':_0x56225b,'isJourneyLocal':!![],'definition':_0x19f221};}catch(_0x17bc6e){return logger['debug']('Failed\x20to\x20resolve\x20activation\x20'+_0x29fb77+':\x20'+_0x17bc6e),{'name':_0x29fb77,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x26b6aa,_0x2676ba)=>resolveJumpTarget(_0x26b6aa,_0x2676ba,_0x13fce8,async _0x3eafad=>{const _0x4d61ad=a159_0x4982,_0x2686c2=_0x458a0c?.[_0x4d61ad(0x17f)](_0x3eafad);if(_0x2686c2)return _0x2686c2;return _0x213842[_0x4d61ad(0x17c)][_0x4d61ad(0x14a)](_0x3eafad);})};return _0x28472f=_0x14b880,_0x14b880;},_0x466640=async _0x506514=>{const _0x3064a8=a159_0x4982,{collectSegmentIdsFromJourneyApi:_0x344719}=await import('./journey-yaml.js'),{batchAsync:_0x2ed0be}=await import(_0x3064a8(0x159)),_0x6520a=new Set();for(const _0x44e1e9 of _0x506514){let _0x5da265=_0x458a0c?.['get'](_0x44e1e9);!_0x5da265&&(_0x5da265=await _0x213842[_0x3064a8(0x17c)]['getJourney'](_0x44e1e9));const _0x5cd792=_0x344719(_0x5da265);for(const _0xe96335 of _0x5cd792){_0x6520a[_0x3064a8(0x1cd)](_0xe96335);}}let _0x135f31=Array[_0x3064a8(0x10a)](_0x6520a);while(_0x135f31[_0x3064a8(0x107)]>0x0){const _0x23782f=_0x135f31['filter'](_0x5805cb=>!_0x5c3321[_0x3064a8(0x18e)](_0x5805cb));if(_0x23782f[_0x3064a8(0x107)]===0x0)break;const _0x137e7b=await _0x2ed0be(_0x23782f,async _0x13a4a7=>{_0x5c3321['add'](_0x13a4a7);const _0x38e22d=await fetchSegment(_0x213842,_0x3ca17c,_0x13a4a7,_0x37e0ad);if(!_0x38e22d)return null;return{'segmentId':_0x13a4a7,'segment':_0x38e22d};},0xa),_0x4f1877=new Set();for(const _0x2da2e6 of _0x137e7b){if(!_0x2da2e6?.[_0x3064a8(0x177)]?.[_0x3064a8(0x174)])continue;const _0x4c3dc9=apiRuleToYaml(_0x2da2e6[_0x3064a8(0x177)][_0x3064a8(0x174)]);_0x7e8a48[_0x3064a8(0x18a)](_0x2da2e6[_0x3064a8(0x1bc)],_0x4c3dc9);const _0xa88a82=collectSegmentRefsFromRule(_0x4c3dc9);for(const _0x20f213 of _0xa88a82){!_0x5c3321[_0x3064a8(0x18e)](_0x20f213)&&_0x4f1877[_0x3064a8(0x1cd)](_0x20f213);}}_0x135f31=Array[_0x3064a8(0x10a)](_0x4f1877);}};return{'createYamlContext':_0x45f796,'prefetchJourneySegments':_0x466640};}export async function executePushSegments(_0x3190e8,_0x56d9a4,_0x2b089e,_0x9fb39e,_0x45180b){const _0x430339=a159_0x3ddbd6,{segmentDefToCreateRequest:_0x399095,segmentDefToUpdateRequest:_0x184e9c}=await import(_0x430339(0x155)),_0x22ad3b=_0x2b089e[_0x430339(0x114)],_0x1fd4e6=0x5,_0x1ad7f2=async _0x54ba7a=>{const _0x408ff7=_0x430339,_0x5c0ee8=_0x54ba7a['folderPath']?_0x22ad3b[_0x408ff7(0x17f)](_0x54ba7a[_0x408ff7(0x1ba)]):undefined;let _0x5ceaa4;const _0x4d3afc={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x387879=_0x54ba7a[_0x408ff7(0x19f)];if(_0x54ba7a['yamlConfig'][_0x408ff7(0x174)]){const _0x5b27c8=createSegmentIdResolver(_0x2b089e[_0x408ff7(0x172)],_0x54ba7a['yamlConfig']['name']),_0x3f6f79=await resolveRuleSegmentIds(_0x54ba7a[_0x408ff7(0x19f)][_0x408ff7(0x174)],_0x5b27c8);_0x387879={..._0x54ba7a[_0x408ff7(0x19f)],'rule':_0x3f6f79};}try{if(_0x54ba7a[_0x408ff7(0xee)]){_0x45180b[_0x408ff7(0x173)]?.({'type':_0x408ff7(0x1e3),'name':_0x54ba7a[_0x408ff7(0x19f)]['name']});const _0xf5e65c=_0x399095(_0x387879,_0x5c0ee8),_0x4241ae=await _0x45180b['withProgress'](_0x408ff7(0x119)+_0x54ba7a[_0x408ff7(0x19f)]['name']+_0x408ff7(0x121),()=>_0x3190e8[_0x408ff7(0x177)][_0x408ff7(0x1c1)](_0x9fb39e[_0x408ff7(0x184)],_0xf5e65c));_0x5ceaa4=_0x4241ae[_0x408ff7(0x179)]['id'],_0x2b089e[_0x408ff7(0x172)][_0x408ff7(0x18a)](_0x54ba7a[_0x408ff7(0x19f)][_0x408ff7(0x101)],_0x5ceaa4),_0x4d3afc[_0x408ff7(0x1b6)]={'name':_0x54ba7a['yamlConfig'][_0x408ff7(0x101)],'id':_0x5ceaa4},_0x45180b[_0x408ff7(0x173)]?.({'type':_0x408ff7(0x1ce),'name':_0x54ba7a['yamlConfig'][_0x408ff7(0x101)],'segmentId':_0x5ceaa4}),_0x45180b[_0x408ff7(0x15d)]?.('Created\x20segment\x20\x27'+_0x54ba7a[_0x408ff7(0x19f)][_0x408ff7(0x101)]+'\x27'),_0x4d3afc[_0x408ff7(0x1e6)]=0x1;}else{if(_0x54ba7a[_0x408ff7(0x14e)]){_0x45180b[_0x408ff7(0x173)]?.({'type':'segment_updating','name':_0x54ba7a[_0x408ff7(0x19f)][_0x408ff7(0x101)]});const _0x41c3a6=_0x184e9c(_0x387879);_0x5c0ee8!==_0x54ba7a[_0x408ff7(0x1c0)]?.[_0x408ff7(0x180)]&&(_0x41c3a6[_0x408ff7(0x180)]=_0x5c0ee8?parseInt(_0x5c0ee8,0xa):undefined),await _0x45180b[_0x408ff7(0x125)](_0x408ff7(0x145)+_0x54ba7a[_0x408ff7(0x19f)][_0x408ff7(0x101)]+_0x408ff7(0x121),()=>_0x3190e8[_0x408ff7(0x177)]['updateSegmentById'](_0x9fb39e['parentId'],_0x54ba7a['existingSegment']['id'],_0x41c3a6)),_0x5ceaa4=_0x54ba7a[_0x408ff7(0x1c0)]['id'],_0x45180b['onProgress']?.({'type':_0x408ff7(0x1aa),'name':_0x54ba7a['yamlConfig'][_0x408ff7(0x101)]}),_0x45180b[_0x408ff7(0x15d)]?.('Updated\x20segment\x20\x27'+_0x54ba7a[_0x408ff7(0x19f)][_0x408ff7(0x101)]+'\x27'),_0x4d3afc[_0x408ff7(0x12f)]=0x1;}else _0x5ceaa4=_0x54ba7a[_0x408ff7(0x1c0)]['id'];}}catch(_0x25be0c){const _0x1fe2b4=isHttp400Error(_0x25be0c),_0x1b59db=_0x1fe2b4?ErrorCode[_0x408ff7(0x195)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x1d26a0=getErrorMessage(_0x25be0c);throw new SDKError(_0x1b59db,_0x408ff7(0x161)+(_0x54ba7a[_0x408ff7(0xee)]?_0x408ff7(0x1b2):_0x408ff7(0xf5))+_0x408ff7(0x194)+_0x54ba7a[_0x408ff7(0xff)]+'\x0a\x20\x20'+_0x1d26a0,_0x25be0c);}try{const _0x55b0ce=await syncActivationsForSegment(_0x3190e8,_0x9fb39e[_0x408ff7(0x184)],_0x5ceaa4,_0x54ba7a[_0x408ff7(0x19f)]['name'],_0x54ba7a['activationActions'],_0x45180b,_0x54ba7a[_0x408ff7(0xff)]);_0x4d3afc[_0x408ff7(0x137)]=_0x55b0ce;}catch(_0x1765d8){if(_0x1765d8 instanceof SDKError)throw _0x1765d8;throw new SDKError(ErrorCode[_0x408ff7(0x1dd)],_0x408ff7(0x160)+_0x54ba7a[_0x408ff7(0x19f)][_0x408ff7(0x101)]+_0x408ff7(0x1d5)+_0x54ba7a['absolutePath']+_0x408ff7(0x1bf)+getErrorMessage(_0x1765d8),_0x1765d8);}return _0x4d3afc;},_0x42d1b=await batchAsync(_0x56d9a4,_0x1ad7f2,_0x1fd4e6),_0x13ebae={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x48eb86 of _0x42d1b){_0x13ebae[_0x430339(0x1e6)]+=_0x48eb86['created'],_0x13ebae[_0x430339(0x12f)]+=_0x48eb86[_0x430339(0x12f)],_0x48eb86[_0x430339(0x1b6)]&&_0x13ebae[_0x430339(0xfa)][_0x430339(0x18a)](_0x48eb86[_0x430339(0x1b6)][_0x430339(0x101)],_0x48eb86[_0x430339(0x1b6)]['id']),_0x13ebae[_0x430339(0x137)]['created']+=_0x48eb86['activations'][_0x430339(0x1e6)],_0x13ebae['activations'][_0x430339(0x12f)]+=_0x48eb86['activations'][_0x430339(0x12f)],_0x13ebae[_0x430339(0x137)][_0x430339(0x12c)]+=_0x48eb86[_0x430339(0x137)]['deleted'];}return _0x13ebae;}async function syncActivationsForSegment(_0x48881f,_0x4ece03,_0x18ae90,_0x25fbbc,_0x47e806,_0x69bdbd,_0x3ca484){const _0x517636=a159_0x3ddbd6,_0x4859a3={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x482700 of _0x47e806){try{if(_0x482700[_0x517636(0x110)]===_0x517636(0x1b2)&&_0x482700[_0x517636(0x142)])_0x69bdbd[_0x517636(0x173)]?.({'type':'activation_creating','segmentName':_0x25fbbc,'activationName':_0x482700['name']}),await _0x69bdbd['withProgress']('Creating\x20activation\x20\x27'+_0x482700['name']+_0x517636(0x121),()=>_0x48881f['segment'][_0x517636(0x127)](_0x4ece03,_0x18ae90,_0x482700[_0x517636(0x142)])),_0x69bdbd[_0x517636(0x173)]?.({'type':_0x517636(0x12a),'segmentName':_0x25fbbc,'activationName':_0x482700[_0x517636(0x101)]}),_0x69bdbd[_0x517636(0x15d)]?.(_0x517636(0x158)+_0x482700[_0x517636(0x101)]+'\x27'),_0x4859a3[_0x517636(0x1e6)]++;else{if(_0x482700['type']===_0x517636(0xf5)&&_0x482700[_0x517636(0x142)]&&_0x482700[_0x517636(0x1b9)])_0x69bdbd['onProgress']?.({'type':_0x517636(0x1c9),'segmentName':_0x25fbbc,'activationName':_0x482700[_0x517636(0x101)]}),await _0x69bdbd[_0x517636(0x125)](_0x517636(0x16d)+_0x482700[_0x517636(0x101)]+'\x27...',()=>_0x48881f['segment'][_0x517636(0x151)](_0x4ece03,_0x18ae90,_0x482700[_0x517636(0x1b9)]['id'],_0x482700[_0x517636(0x142)])),_0x69bdbd[_0x517636(0x173)]?.({'type':'activation_updated','segmentName':_0x25fbbc,'activationName':_0x482700[_0x517636(0x101)]}),_0x69bdbd[_0x517636(0x15d)]?.(_0x517636(0x1e8)+_0x482700[_0x517636(0x101)]+'\x27'),_0x4859a3[_0x517636(0x12f)]++;else _0x482700[_0x517636(0x110)]===_0x517636(0x12b)&&_0x482700[_0x517636(0x1b9)]&&(_0x69bdbd[_0x517636(0x173)]?.({'type':'activation_deleting','segmentName':_0x25fbbc,'activationName':_0x482700[_0x517636(0x101)]}),await _0x69bdbd[_0x517636(0x125)](_0x517636(0x103)+_0x482700[_0x517636(0x101)]+_0x517636(0x121),()=>_0x48881f['segment'][_0x517636(0x181)](_0x4ece03,_0x18ae90,_0x482700[_0x517636(0x1b9)]['id'])),_0x69bdbd[_0x517636(0x173)]?.({'type':_0x517636(0x1c3),'segmentName':_0x25fbbc,'activationName':_0x482700[_0x517636(0x101)]}),_0x69bdbd[_0x517636(0x163)]?.(_0x517636(0x14d)+_0x482700[_0x517636(0x101)]+'\x27'),_0x4859a3[_0x517636(0x12c)]++);}}catch(_0x247551){const _0x47d37c=isHttp400Error(_0x247551),_0x58c433=_0x47d37c?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x517636(0x1dd)],_0x31e725=getErrorMessage(_0x247551);throw new SDKError(_0x58c433,_0x517636(0x161)+_0x482700['type']+'\x20activation\x20\x27'+_0x482700[_0x517636(0x101)]+_0x517636(0x1d5)+_0x3ca484+_0x517636(0x1bf)+_0x31e725,_0x247551);}}return _0x4859a3;}export async function executePushFolders(_0x5a10fc,_0x72a382,_0x21eed9,_0x4a0601,_0x381743){const _0x516c27=a159_0x3ddbd6,_0x301e9b=new Map(_0x21eed9),_0x2f0e0c=sortFoldersByDepth(_0x72a382);for(const _0x1cf3c4 of _0x2f0e0c){const _0x2bdf84=_0x1cf3c4[_0x516c27(0x183)]('/'),_0x3fe0e5=_0x2bdf84[_0x2bdf84['length']-0x1],_0x19b503=_0x2bdf84[_0x516c27(0x1a1)](0x0,-0x1)[_0x516c27(0x1b8)]('/'),_0x5211e7=_0x301e9b['get'](_0x19b503);_0x381743[_0x516c27(0x173)]?.({'type':_0x516c27(0x1a7),'folder':_0x1cf3c4});const _0x407500={'name':_0x3fe0e5,'parentFolderId':_0x5211e7},_0x1cc155=await _0x381743[_0x516c27(0x125)](_0x516c27(0xfc)+_0x1cf3c4+_0x516c27(0x121),()=>_0x5a10fc[_0x516c27(0x177)][_0x516c27(0x15e)](_0x4a0601[_0x516c27(0x184)],_0x407500));_0x301e9b[_0x516c27(0x18a)](_0x1cf3c4,_0x1cc155[_0x516c27(0x179)]['id']),_0x381743[_0x516c27(0x173)]?.({'type':_0x516c27(0x1cc),'folder':_0x1cf3c4,'folderId':_0x1cc155[_0x516c27(0x179)]['id']}),_0x381743[_0x516c27(0xf8)]?.(_0x516c27(0x157)+_0x1cf3c4+'\x27');}return _0x301e9b;}export async function executePushSegmentDeletions(_0x26e1d1,_0x192d5d,_0x456642){const _0x29c671=a159_0x3ddbd6;if(_0x192d5d['length']===0x0)return 0x0;const {batchAsync:_0xc4aafb}=await import('../../utils/async.js'),_0x5567fe=0x5,_0x152664=await _0xc4aafb(_0x192d5d,async _0x231506=>{const _0x2af410=a159_0x4982;return _0x456642['onProgress']?.({'type':_0x2af410(0x132),'name':_0x231506[_0x2af410(0x101)]}),await _0x26e1d1['segment']['deleteSegment'](_0x231506['id']),_0x456642[_0x2af410(0x173)]?.({'type':_0x2af410(0x1e0),'name':_0x231506[_0x2af410(0x101)]}),_0x456642[_0x2af410(0x163)]?.(_0x2af410(0x149)+_0x231506[_0x2af410(0x101)]+'\x27'),0x1;},_0x5567fe);return _0x152664[_0x29c671(0x115)]((_0x94b135,_0x498c5b)=>_0x94b135+_0x498c5b,0x0);}export async function executePushJourneys(_0x1c81b2,_0x4358de,_0x291d85,_0x584811,_0x3cc3b1){const _0x4a8e03=a159_0x3ddbd6,{journeyDefToRequest:_0x5a7077}=await import(_0x4a8e03(0x16f)),{activationDefToCreateRequest:_0x24f68f,yamlRuleToApi:_0x11aba6,validateSegmentRule:_0xe39753}=await import('./child-segment-yaml.js'),_0x3377ad={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x5e991e=new Map(_0x291d85['segmentNameToId']),_0x1f5f61=0x5;for(let _0x85d555=0x0;_0x85d555<_0x4358de[_0x4a8e03(0x107)];_0x85d555+=_0x1f5f61){const _0x2e95fe=_0x4358de[_0x4a8e03(0x1a1)](_0x85d555,_0x85d555+_0x1f5f61),_0x2542eb=await Promise[_0x4a8e03(0x11d)](_0x2e95fe[_0x4a8e03(0x185)](async _0x18f930=>{const _0x53886c=_0x4a8e03;if(!_0x18f930['isNew']&&!_0x18f930[_0x53886c(0x14e)])return{'action':'unchanged','name':_0x18f930[_0x53886c(0x19f)][_0x53886c(0x101)],'journeyId':_0x18f930['existingJourney']?.['id']};const _0x1b6f4f=_0x18f930[_0x53886c(0x1ba)]?_0x291d85[_0x53886c(0x114)][_0x53886c(0x17f)](_0x18f930[_0x53886c(0x1ba)]):undefined;_0x3cc3b1[_0x53886c(0x173)]?.({'type':_0x18f930[_0x53886c(0xee)]?_0x53886c(0x15b):'journey_updating','name':_0x18f930['yamlConfig'][_0x53886c(0x101)]});try{const _0x215b13=await executeSingleJourneyPush(_0x1c81b2,_0x18f930,{..._0x291d85,'segmentNameToId':_0x5e991e},{'parentId':_0x584811[_0x53886c(0x184)],'rootFolderId':_0x584811[_0x53886c(0x102)],'folderId':_0x1b6f4f,'verbose':_0x584811['verbose']},_0x3cc3b1,{'journeyDefToRequest':_0x5a7077,'activationDefToCreateRequest':_0x24f68f,'yamlRuleToApi':_0x11aba6,'validateSegmentRule':_0xe39753});for(const [_0x12fd79,_0x3de34e]of _0x215b13['embeddedSegmentNameToId']){_0x5e991e[_0x53886c(0x18a)](_0x12fd79,_0x3de34e),_0x3377ad[_0x53886c(0x16b)]['set'](_0x12fd79,_0x3de34e);}if(_0x215b13[_0x53886c(0x1ca)]===_0x53886c(0x1e6))_0x3cc3b1['onProgress']?.({'type':_0x53886c(0x15f),'name':_0x18f930['yamlConfig'][_0x53886c(0x101)],'journeyId':_0x215b13['journeyId']}),_0x3cc3b1[_0x53886c(0x15d)]?.(_0x53886c(0x1b4)+_0x18f930[_0x53886c(0x19f)][_0x53886c(0x101)]+'\x27'),_0x3377ad[_0x53886c(0x1e6)]++;else _0x215b13[_0x53886c(0x1ca)]===_0x53886c(0x12f)&&(_0x3cc3b1[_0x53886c(0x173)]?.({'type':_0x53886c(0x1ad),'name':_0x18f930[_0x53886c(0x19f)][_0x53886c(0x101)]}),_0x3cc3b1[_0x53886c(0x15d)]?.(_0x53886c(0x152)+_0x18f930[_0x53886c(0x19f)]['name']+'\x27'),_0x3377ad[_0x53886c(0x12f)]++);return{'action':_0x215b13[_0x53886c(0x1ca)],'name':_0x18f930['yamlConfig'][_0x53886c(0x101)],'journeyId':_0x215b13[_0x53886c(0x17b)]};}catch(_0x298c28){const _0x249566=isHttp400Error(_0x298c28),_0x24f26c=_0x249566?ErrorCode[_0x53886c(0x126)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x4f5c17=getErrorMessage(_0x298c28);throw new SDKError(_0x24f26c,_0x53886c(0x161)+(_0x18f930[_0x53886c(0xee)]?_0x53886c(0x1b2):_0x53886c(0xf5))+_0x53886c(0x1ab)+_0x18f930['absolutePath']+_0x53886c(0x1bf)+_0x4f5c17,_0x298c28);}}));_0x3377ad[_0x4a8e03(0x111)][_0x4a8e03(0x1c5)](..._0x2542eb);}return _0x3377ad;}async function matchExistingJourneySegments(_0x35fc9f,_0x9758ab,_0x33d1db,_0x4b22d0,_0x554608){const _0x5af9ac=a159_0x3ddbd6;if(!_0x9758ab[_0x5af9ac(0x131)]||!_0x9758ab[_0x5af9ac(0x19f)][_0x5af9ac(0x167)])return;const _0x10b2c6=new Map(),_0x2c652b=new Set();for(const _0x852e of Object[_0x5af9ac(0x150)](_0x9758ab[_0x5af9ac(0x19f)][_0x5af9ac(0x167)])){const _0xc44f82=generateDeterministicJourneySegmentName(_0x9758ab['yamlConfig'][_0x5af9ac(0x101)],_0x852e);_0x10b2c6[_0x5af9ac(0x18a)](_0xc44f82,_0x852e),_0x2c652b['add'](_0x852e);}const _0x385078=[],_0x280b6f=collectSegmentIdsFromJourneyApi(_0x9758ab[_0x5af9ac(0x131)]);for(const _0x5a7d7b of _0x280b6f){const _0x34b3d4=await fetchSegment(_0x35fc9f,_0x33d1db,_0x5a7d7b,_0x4b22d0);if(!_0x34b3d4?.['name'])continue;const _0x5e6de5=_0x10b2c6[_0x5af9ac(0x17f)](_0x34b3d4[_0x5af9ac(0x101)]);_0x5e6de5?(_0x554608[_0x5af9ac(0x18a)](_0x5e6de5,_0x5a7d7b),_0x2c652b[_0x5af9ac(0x12b)](_0x5e6de5)):_0x385078['push']({'id':_0x5a7d7b,'seg':_0x34b3d4});}if(_0x2c652b[_0x5af9ac(0x1c6)]>0x0&&_0x385078['length']>0x0){const {localExpandedRuleToNames:_0x3e381b}=buildLocalExpandedRuleMappings(_0x9758ab[_0x5af9ac(0x19f)]),_0x5b6c95=new Map();for(const {id:_0x372c27,seg:_0x3f67ac}of _0x385078){if(_0x3f67ac['rule']){const _0x2cdc2a=apiRuleToYaml(_0x3f67ac[_0x5af9ac(0x174)]);_0x5b6c95[_0x5af9ac(0x18a)](_0x372c27,_0x2cdc2a);}}for(const {id:_0x45bc61,seg:_0x1d4dd8}of _0x385078){if(!_0x1d4dd8[_0x5af9ac(0x174)])continue;const _0x34dd93=_0x5b6c95[_0x5af9ac(0x17f)](_0x45bc61);if(!_0x34dd93)continue;const _0x272fc3=serializeExpandedRule(_0x34dd93,_0x5b6c95),_0x214187=_0x3e381b['get'](_0x272fc3);if(_0x214187){const _0x5151d5=_0x214187[_0x5af9ac(0x1be)](_0x2ae34f=>_0x2c652b['has'](_0x2ae34f));_0x5151d5&&(_0x554608[_0x5af9ac(0x18a)](_0x5151d5,_0x45bc61),_0x2c652b['delete'](_0x5151d5),logger[_0x5af9ac(0x13e)](_0x5af9ac(0x11a)+_0x1d4dd8['name']+'\x27\x20to\x20local\x20\x27'+_0x5151d5+_0x5af9ac(0x1d2)));}}}}async function executeSingleJourneyPush(_0x36e0ef,_0x58b363,_0x438c1a,_0x2bbfb6,_0x5391d2,_0x305077){const _0x2b6713=a159_0x3ddbd6,{journeyDefToRequest:_0x556db5,activationDefToCreateRequest:_0x154c53,yamlRuleToApi:_0x1bca46,validateSegmentRule:_0x18fd77}=_0x305077,_0x58ca71=new Map(),_0xf72525=new Map();recoverSegmentIdsFromPushRecovery(_0x58b363,_0x58ca71,_0x438c1a[_0x2b6713(0x172)]);const _0x19f0c6=new Map(),_0x5d21fd=new Map(),_0x21c7c9=new Map();let _0x4608c5;const _0x579531=async()=>{const _0x2201e3=_0x2b6713;if(_0x4608c5)return;_0x4608c5=new Map();if(!_0x58b363[_0x2201e3(0x131)])return;const _0x1a3106=await _0x36e0ef[_0x2201e3(0x17c)][_0x2201e3(0x11e)](_0x58b363[_0x2201e3(0x131)]['id']);for(const _0x120443 of _0x1a3106){const _0x34c74b=journeyActivationStepToYaml(_0x120443,_0x438c1a[_0x2201e3(0x11c)],_0x438c1a['connectionIdToNameMap']),_0x504521=activationSignature(_0x34c74b);!_0x4608c5[_0x2201e3(0x18e)](_0x504521)&&_0x4608c5['set'](_0x504521,_0x120443['id']),_0x34c74b['name']&&_0xf72525['set'](_0x34c74b[_0x2201e3(0x101)],_0x120443['id']);}};await matchExistingJourneySegments(_0x36e0ef,_0x58b363,_0x2bbfb6[_0x2b6713(0x184)],_0x438c1a[_0x2b6713(0x1af)],_0x438c1a['segmentNameToId']);const _0x5537f6={'resolveSegmentId':async _0x2077c1=>{const _0x680330=_0x2b6713,_0x2b368e=_0x438c1a['segmentNameToId'][_0x680330(0x17f)](_0x2077c1);if(!_0x2b368e)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x680330(0x14f)+_0x2077c1+_0x680330(0x100)+_0x58b363[_0x680330(0x19f)][_0x680330(0x101)]+')');return _0x2b368e;},'resolveEmbeddedSegmentId':async(_0x37a335,_0x212d83)=>{const _0x4bae46=_0x2b6713,_0x232642=_0x438c1a['segmentNameToId'][_0x4bae46(0x17f)](_0x37a335);if(_0x232642)return _0x232642;const _0x67e105=_0x438c1a['existingSegments'][_0x4bae46(0x1be)](_0x4fbb7e=>_0x4fbb7e[_0x4bae46(0x101)]===_0x37a335);if(_0x67e105)return _0x438c1a['segmentNameToId'][_0x4bae46(0x18a)](_0x37a335,_0x67e105['id']),_0x67e105['id'];if(_0x58b363[_0x4bae46(0xee)]){const {stageName:_0x488a1a,criteriaName:_0x235aa3}=findSegmentCriteriaLocation(_0x58b363['yamlConfig'],_0x37a335);return _0x18fd77(_0x37a335,_0x212d83[_0x4bae46(0x174)]),_0x5d21fd[_0x4bae46(0x18a)](_0x37a335,{'definition':_0x212d83,'stageName':_0x488a1a,'criteriaName':_0x235aa3}),createPendingSegmentId(_0x37a335);}const _0x691977=_0x58b363[_0x4bae46(0x131)]?.['id'];if(!_0x691977)throw new SDKError(ErrorCode['INTERNAL'],_0x4bae46(0x156));const _0x1fb098=_0x19f0c6[_0x4bae46(0x17f)](_0x37a335);if(_0x1fb098)return _0x1fb098;const _0x2eda60=((async()=>{const _0x19773f=_0x4bae46;_0x18fd77(_0x37a335,_0x212d83[_0x19773f(0x174)]);const _0x32cfc8=generateDeterministicJourneySegmentName(_0x58b363['yamlConfig']['name'],_0x37a335),_0x3cfd0c=_0x438c1a[_0x19773f(0x1af)][_0x19773f(0x1be)](_0x23e057=>_0x23e057[_0x19773f(0x101)]===_0x32cfc8),_0x50ceda=createSegmentIdResolver(_0x438c1a[_0x19773f(0x172)],_0x37a335),_0x5c7d02=await resolveRuleSegmentIds(_0x212d83[_0x19773f(0x174)],_0x50ceda);let _0x56d638;return _0x3cfd0c?(await _0x36e0ef[_0x19773f(0x177)][_0x19773f(0x11f)](_0x2bbfb6[_0x19773f(0x184)],_0x3cfd0c['id'],{'description':_0x212d83[_0x19773f(0x133)]||_0x19773f(0xef)+_0x37a335,'rule':_0x1bca46(_0x5c7d02),'countPopulation':!![]}),_0x56d638=_0x3cfd0c['id'],saveSegmentToPushRecovery(_0x58b363[_0x19773f(0xff)],_0x58b363[_0x19773f(0x19f)][_0x19773f(0x101)],_0x37a335,{'segmentId':_0x56d638,'uniqueServerName':_0x32cfc8,'createdAt':new Date()[_0x19773f(0x148)]()})):_0x56d638=await createOrRecoverEmbeddedSegment(_0x36e0ef,_0x58b363,{'localName':_0x37a335,'uniqueSegmentName':_0x32cfc8,'description':_0x212d83['description']||'Entry\x20criteria:\x20'+_0x37a335,'journeyId':_0x691977,'resolvedRule':_0x5c7d02,'parentId':_0x2bbfb6['parentId'],'folderId':_0x2bbfb6[_0x19773f(0x102)]||''},_0x1bca46),_0x438c1a[_0x19773f(0x172)][_0x19773f(0x18a)](_0x37a335,_0x56d638),_0x58ca71['set'](_0x37a335,_0x56d638),_0x56d638;})());_0x19f0c6[_0x4bae46(0x18a)](_0x37a335,_0x2eda60);try{return await _0x2eda60;}finally{_0x19f0c6[_0x4bae46(0x12b)](_0x37a335);}},'resolveActivationId':async _0x31b084=>{const _0x298b46=_0x2b6713,_0x5e7d01=_0xf72525['get'](_0x31b084);if(_0x5e7d01)return _0x5e7d01;if(_0x58b363['existingJourney']){await _0x579531();const _0x28eea0=_0xf72525[_0x298b46(0x17f)](_0x31b084);if(_0x28eea0)return _0x28eea0;}throw new SDKError(ErrorCode[_0x298b46(0x19c)],_0x298b46(0x169)+_0x31b084+_0x298b46(0x100)+_0x58b363['yamlConfig'][_0x298b46(0x101)]+_0x298b46(0x12e)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x294b2f,_0xbfc3a8)=>{const _0x516bf5=_0x2b6713,_0x18d01e=_0xf72525[_0x516bf5(0x17f)](_0x294b2f);if(_0x18d01e)return _0x18d01e;if(_0x58b363[_0x516bf5(0xee)])return _0x21c7c9[_0x516bf5(0x18a)](_0x294b2f,_0xbfc3a8),createPendingActivationId(_0x294b2f);if(_0x58b363[_0x516bf5(0x131)]){await _0x579531();const _0x439194=_0xf72525[_0x516bf5(0x17f)](_0xbfc3a8[_0x516bf5(0x101)]);if(_0x439194)return _0xf72525[_0x516bf5(0x18a)](_0x294b2f,_0x439194),_0x439194;const _0x3bd372=activationSignature(_0xbfc3a8),_0x9eb485=_0x4608c5?.[_0x516bf5(0x17f)](_0x3bd372);if(_0x9eb485)return _0xf72525[_0x516bf5(0x18a)](_0x294b2f,_0x9eb485),_0x9eb485;const _0x51645f=await _0x154c53(_0xbfc3a8,_0x438c1a[_0x516bf5(0x1da)]),_0x1033c3={..._0x51645f,..._0xbfc3a8[_0x516bf5(0x19b)]!==undefined&&{'runAfterJourneyRefresh':_0xbfc3a8[_0x516bf5(0x19b)]}},_0x90761d=await _0x36e0ef[_0x516bf5(0x17c)][_0x516bf5(0x127)](_0x58b363[_0x516bf5(0x131)]['id'],_0x1033c3);return _0xf72525[_0x516bf5(0x18a)](_0x294b2f,_0x90761d['id']),_0x90761d['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x516bf5(0xed));},'resolveJourneyId':async _0xbb0efe=>{const _0x256b9b=_0x2b6713;try{return await _0x36e0ef[_0x256b9b(0x17c)][_0x256b9b(0x109)](_0x2bbfb6[_0x256b9b(0x184)],_0xbb0efe);}catch(_0x4b3d2f){throw new SDKError(ErrorCode['NOT_FOUND'],_0x256b9b(0x18f)+_0xbb0efe+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x58b363['yamlConfig']['name']+'\x27)',_0x4b3d2f);}},'resolveStageId':async(_0x43439a,_0x3cbf10)=>{const _0x176fc9=_0x2b6713,_0x3cf396=await _0x36e0ef[_0x176fc9(0x17c)]['getJourney'](_0x43439a),_0x20949a=_0x3cf396[_0x176fc9(0x1b5)][_0x176fc9(0x1d7)][_0x176fc9(0x1be)](_0x3c4b40=>_0x3c4b40[_0x176fc9(0x101)][_0x176fc9(0x188)]()===_0x3cbf10[_0x176fc9(0x188)]());if(!_0x20949a?.['id'])throw new SDKError(ErrorCode[_0x176fc9(0x19c)],_0x176fc9(0x1b0)+_0x3cbf10+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x3cf396[_0x176fc9(0x1b5)][_0x176fc9(0x19e)]||_0x3cf396[_0x176fc9(0x1b5)][_0x176fc9(0x101)])+'\x27');return _0x20949a['id'];}},_0x4be210=await _0x556db5(_0x58b363[_0x2b6713(0x19f)],_0x2bbfb6[_0x2b6713(0x184)],_0x5537f6),_0x522be4=_0x2bbfb6[_0x2b6713(0x1df)]||_0x2bbfb6[_0x2b6713(0x102)];_0x522be4&&(_0x4be210[_0x2b6713(0x1cb)]={'parentFolder':{'data':{'id':_0x522be4,'type':_0x2b6713(0x10e)}}});if(_0x58b363[_0x2b6713(0xee)]){if(_0x5d21fd['size']>0x0||_0x21c7c9[_0x2b6713(0x1c6)]>0x0)return await executeThreeStepJourneyCreate(_0x36e0ef,_0x58b363,_0x4be210,{'pendingEmbeddedSegments':_0x5d21fd,'pendingEmbeddedActivations':_0x21c7c9,'embeddedSegmentNameToId':_0x58ca71,'journeyActivationNameToId':_0xf72525},{..._0x2bbfb6,'effectiveFolderId':_0x522be4},_0x438c1a,_0x5391d2,_0x305077);else{ensureJourneyDefaults(_0x4be210[_0x2b6713(0x1b5)]);const _0x54decb=await _0x36e0ef[_0x2b6713(0x17c)][_0x2b6713(0x1b2)](_0x4be210);return deletePushRecovery(_0x58b363['absolutePath']),{'action':'created','journeyId':_0x54decb['id'],'embeddedSegmentNameToId':_0x58ca71};}}else{if(_0x58b363['hasChanges']&&_0x58b363[_0x2b6713(0x131)]){_0x4be210['id']=_0x58b363[_0x2b6713(0x131)]['id'];const _0x36323c=_0x4be210[_0x2b6713(0x1b5)];_0x58b363[_0x2b6713(0x131)][_0x2b6713(0x1b5)]?.[_0x2b6713(0x19e)]&&(_0x36323c[_0x2b6713(0x19e)]=_0x58b363['existingJourney'][_0x2b6713(0x1b5)][_0x2b6713(0x19e)]);const _0x240655=_0x58b363[_0x2b6713(0x131)][_0x2b6713(0x1b5)]?.[_0x2b6713(0x1d7)];return _0x240655&&_0x4be210[_0x2b6713(0x1b5)][_0x2b6713(0x1d7)]&&injectExistingStageIds(_0x4be210[_0x2b6713(0x1b5)][_0x2b6713(0x1d7)],_0x240655),ensureJourneyDefaults(_0x36323c),await _0x36e0ef['journey'][_0x2b6713(0xf5)](_0x58b363[_0x2b6713(0x131)]['id'],_0x4be210),deletePushRecovery(_0x58b363[_0x2b6713(0xff)]),{'action':_0x2b6713(0x12f),'journeyId':_0x58b363['existingJourney']['id'],'embeddedSegmentNameToId':_0x58ca71};}}return deletePushRecovery(_0x58b363[_0x2b6713(0xff)]),{'action':_0x2b6713(0x1b7),'journeyId':_0x58b363[_0x2b6713(0x131)]?.['id'],'embeddedSegmentNameToId':_0x58ca71};}function findSegmentCriteriaLocation(_0x580283,_0x304f1e){const _0x179377=a159_0x3ddbd6,_0x2ab95b=_0x580283['stages']||_0x580283[_0x179377(0x176)]?.[0x0]?.['stages']||[];let _0x2ca3d9='entry',_0x443551=_0x304f1e;const _0xbedee9=_0x580283[_0x179377(0x191)]||_0x580283[_0x179377(0x176)]?.[0x0]?.[_0x179377(0x191)];if(_0xbedee9?.[_0x179377(0x177)]===_0x304f1e)return{'stageName':'goal','criteriaName':_0xbedee9['name']||_0x304f1e};_0xc6249e:for(const _0x4d1645 of _0x2ab95b){if(_0x4d1645[_0x179377(0x108)]?.['segment']===_0x304f1e){_0x2ca3d9=_0x4d1645['name'],_0x443551=_0x4d1645['entry_criteria']['name']||_0x304f1e;break;}if(_0x4d1645['steps'])for(const _0x16ca3d of _0x4d1645['steps']){if(_0x16ca3d[_0x179377(0x110)]===_0x179377(0x11b)&&_0x16ca3d[_0x179377(0x112)]?.[_0x179377(0x1bd)])for(const _0x26329d of _0x16ca3d[_0x179377(0x112)][_0x179377(0x1bd)]){if(_0x26329d[_0x179377(0x177)]===_0x304f1e){_0x2ca3d9=_0x4d1645[_0x179377(0x101)],_0x443551=_0x26329d[_0x179377(0x101)]||_0x304f1e;break _0xc6249e;}}}}return{'stageName':_0x2ca3d9,'criteriaName':_0x443551};}async function executeThreeStepJourneyCreate(_0x2ed75b,_0x214dca,_0x7373a5,_0x2e74a6,_0x10ecbd,_0x288cc2,_0x15f8f5,_0x2159f1){const _0x75bcc2=a159_0x3ddbd6,{activationDefToCreateRequest:_0x3efbaa,yamlRuleToApi:_0x1b39ef}=_0x2159f1,{pendingEmbeddedSegments:_0x3ad478,pendingEmbeddedActivations:_0x327331,embeddedSegmentNameToId:_0x1fc859}=_0x2e74a6,_0x4e7ed2=JSON[_0x75bcc2(0x187)](JSON['stringify'](_0x7373a5));ensureJourneyDefaults(_0x4e7ed2[_0x75bcc2(0x1b5)]),stripPendingIds(_0x4e7ed2);const _0xbdeb3c=await _0x2ed75b[_0x75bcc2(0x17c)][_0x75bcc2(0x1b2)](_0x4e7ed2),_0x18d2c3=_0xbdeb3c['id'],_0xaa002e=new Map();for(const _0x25a6b0 of _0xbdeb3c[_0x75bcc2(0x1b5)]['journeyStages']){_0xaa002e[_0x75bcc2(0x18a)](_0x25a6b0[_0x75bcc2(0x101)][_0x75bcc2(0x188)](),_0x25a6b0['id']);}recoverSegmentIdsFromPushRecovery(_0x214dca,_0x1fc859,_0x288cc2[_0x75bcc2(0x172)]);for(const [_0x17eb38,{definition:_0x105059}]of _0x3ad478){if(_0x1fc859[_0x75bcc2(0x18e)](_0x17eb38)){_0x15f8f5[_0x75bcc2(0x173)]?.({'type':'embedded_segment_created','journeyName':_0x214dca[_0x75bcc2(0x19f)][_0x75bcc2(0x101)],'segmentName':_0x17eb38});continue;}const _0x4aca91=generateDeterministicJourneySegmentName(_0x214dca[_0x75bcc2(0x19f)][_0x75bcc2(0x101)],_0x17eb38);_0x15f8f5[_0x75bcc2(0x173)]?.({'type':_0x75bcc2(0xf7),'journeyName':_0x214dca[_0x75bcc2(0x19f)]['name'],'segmentName':_0x17eb38});const _0x2835ae=createSegmentIdResolver(_0x288cc2[_0x75bcc2(0x172)],_0x17eb38),_0x572f51=await resolveRuleSegmentIds(_0x105059[_0x75bcc2(0x174)],_0x2835ae),_0x4e3cab=await createOrRecoverEmbeddedSegment(_0x2ed75b,_0x214dca,{'localName':_0x17eb38,'uniqueSegmentName':_0x4aca91,'description':_0x105059[_0x75bcc2(0x133)]||_0x75bcc2(0xef)+_0x17eb38,'journeyId':_0x18d2c3,'resolvedRule':_0x572f51,'parentId':_0x10ecbd[_0x75bcc2(0x184)],'folderId':_0x10ecbd[_0x75bcc2(0x17a)]||''},_0x1b39ef);_0x1fc859['set'](_0x17eb38,_0x4e3cab),_0x288cc2[_0x75bcc2(0x172)][_0x75bcc2(0x18a)](_0x17eb38,_0x4e3cab),_0x15f8f5[_0x75bcc2(0x173)]?.({'type':_0x75bcc2(0x15c),'journeyName':_0x214dca[_0x75bcc2(0x19f)][_0x75bcc2(0x101)],'segmentName':_0x17eb38});}const _0x3ddde9=new Map();for(const [_0x52cd64,_0x104f52]of _0x327331){_0x15f8f5[_0x75bcc2(0x173)]?.({'type':_0x75bcc2(0x1d8),'journeyName':_0x214dca['yamlConfig'][_0x75bcc2(0x101)],'activationName':_0x52cd64});const _0x2a3d61=await _0x3efbaa(_0x104f52,_0x288cc2[_0x75bcc2(0x1da)]),_0xc95a87={..._0x2a3d61,..._0x104f52[_0x75bcc2(0x19b)]!==undefined&&{'runAfterJourneyRefresh':_0x104f52[_0x75bcc2(0x19b)]}},_0xc2a32c=await _0x2ed75b[_0x75bcc2(0x17c)][_0x75bcc2(0x127)](_0x18d2c3,_0xc95a87);_0x3ddde9['set'](_0x52cd64,_0xc2a32c['id']),_0x2e74a6['journeyActivationNameToId']['set'](_0x52cd64,_0xc2a32c['id']),_0x15f8f5[_0x75bcc2(0x173)]?.({'type':_0x75bcc2(0x1a5),'journeyName':_0x214dca[_0x75bcc2(0x19f)]['name'],'activationName':_0x52cd64});}const _0x590e7f=JSON[_0x75bcc2(0x187)](JSON['stringify'](_0x7373a5));return _0x590e7f['id']=_0x18d2c3,ensureJourneyDefaults(_0x590e7f[_0x75bcc2(0x1b5)]),resolvePendingIdsInRequest(_0x590e7f,_0x7373a5,_0xaa002e,_0x1fc859,_0x3ddde9,_0x15f8f5),await _0x2ed75b[_0x75bcc2(0x17c)][_0x75bcc2(0xf5)](_0x18d2c3,_0x590e7f),deletePushRecovery(_0x214dca[_0x75bcc2(0xff)]),{'action':_0x75bcc2(0x1e6),'journeyId':_0x18d2c3,'embeddedSegmentNameToId':_0x1fc859};}export function stripWaitStepPendingIds(_0x53080b){const _0x362a53=a159_0x3ddbd6,_0x35d699=_0x53080b['conditionSegmentId']&&isPendingSegmentId(_0x53080b[_0x362a53(0x1b1)]),_0x400928=_0x53080b[_0x362a53(0x198)]?.[_0x362a53(0x1ac)](_0x343397=>_0x343397['segmentId']&&isPendingSegmentId(_0x343397[_0x362a53(0x1bc)]));(_0x35d699||_0x400928)&&(_0x53080b['waitStepType']=_0x362a53(0x1c8),_0x53080b['waitStep']=0x1,_0x53080b['waitStepUnit']=_0x362a53(0x117),delete _0x53080b[_0x362a53(0x1b1)],delete _0x53080b['conditionTimeoutDuration'],delete _0x53080b[_0x362a53(0x18d)],delete _0x53080b[_0x362a53(0x198)]);}export function resolveWaitStepPendingIds(_0x26b955,_0x487f7a,_0xb3c3cf,_0x2a6bde){const _0x83578c=a159_0x3ddbd6;if(_0x487f7a[_0x83578c(0x1b1)]&&isPendingSegmentId(_0x487f7a['conditionSegmentId'])){const _0x16c17a=_0xb3c3cf(_0x487f7a['conditionSegmentId'],_0x83578c(0x120)+_0x2a6bde+_0x83578c(0x122));_0x16c17a&&(_0x26b955[_0x83578c(0x140)]=_0x83578c(0x165),_0x26b955[_0x83578c(0x1b1)]=_0x16c17a,delete _0x26b955[_0x83578c(0x1d0)],delete _0x26b955[_0x83578c(0xf2)],_0x487f7a[_0x83578c(0x106)]!==undefined&&(_0x26b955[_0x83578c(0x106)]=_0x487f7a[_0x83578c(0x106)]),_0x487f7a[_0x83578c(0x18d)]&&(_0x26b955[_0x83578c(0x18d)]=_0x487f7a[_0x83578c(0x18d)]));}if(_0x487f7a['conditions']){const _0x5a3a4e=_0x487f7a[_0x83578c(0x198)]['some'](_0x2339d4=>_0x2339d4[_0x83578c(0x1bc)]&&isPendingSegmentId(_0x2339d4[_0x83578c(0x1bc)]));if(_0x5a3a4e){const _0x3ccbca=_0x487f7a[_0x83578c(0x198)][_0x83578c(0x185)](_0x3f0304=>{const _0x2f533b=_0x83578c;if(_0x3f0304[_0x2f533b(0x1bc)]&&isPendingSegmentId(_0x3f0304['segmentId'])){const _0x20f808=_0xb3c3cf(_0x3f0304[_0x2f533b(0x1bc)],_0x2f533b(0x120)+_0x2a6bde+_0x2f533b(0x122));return{..._0x3f0304,'segmentId':_0x20f808||_0x3f0304['segmentId']};}return{..._0x3f0304};});_0x26b955['waitStepType']=_0x83578c(0x165),_0x26b955[_0x83578c(0x198)]=_0x3ccbca,delete _0x26b955[_0x83578c(0x1d0)],delete _0x26b955[_0x83578c(0xf2)],delete _0x26b955[_0x83578c(0x1b1)],delete _0x26b955[_0x83578c(0x106)],delete _0x26b955[_0x83578c(0x18d)];}}}function stripPendingIds(_0x3c30b8){const _0x1ac5d5=a159_0x3ddbd6;_0x3c30b8[_0x1ac5d5(0x1b5)]['goal']?.[_0x1ac5d5(0x1bc)]&&isPendingSegmentId(_0x3c30b8[_0x1ac5d5(0x1b5)][_0x1ac5d5(0x191)][_0x1ac5d5(0x1bc)])&&delete _0x3c30b8[_0x1ac5d5(0x1b5)][_0x1ac5d5(0x191)];for(const _0x9ff70 of _0x3c30b8[_0x1ac5d5(0x1b5)][_0x1ac5d5(0x1d7)]||[]){_0x9ff70[_0x1ac5d5(0x139)]?.[_0x1ac5d5(0x1bc)]&&isPendingSegmentId(_0x9ff70[_0x1ac5d5(0x139)][_0x1ac5d5(0x1bc)])&&delete _0x9ff70['entryCriteria'];_0x9ff70[_0x1ac5d5(0x196)]?.[_0x1ac5d5(0x1bc)]&&isPendingSegmentId(_0x9ff70[_0x1ac5d5(0x196)][_0x1ac5d5(0x1bc)])&&delete _0x9ff70[_0x1ac5d5(0x196)];_0x9ff70[_0x1ac5d5(0x1b3)]&&(_0x9ff70[_0x1ac5d5(0x1b3)]=_0x9ff70['exitCriterias']['filter'](_0x390e67=>!_0x390e67[_0x1ac5d5(0x1bc)]||!isPendingSegmentId(_0x390e67['segmentId'])));if(_0x9ff70[_0x1ac5d5(0x123)])for(const _0xcacf49 of Object[_0x1ac5d5(0x150)](_0x9ff70[_0x1ac5d5(0x123)])){const _0x351992=_0x9ff70[_0x1ac5d5(0x123)][_0xcacf49];_0x351992[_0x1ac5d5(0x110)]===_0x1ac5d5(0x171)&&_0x351992[_0x1ac5d5(0x14c)]&&isPendingActivationId(_0x351992[_0x1ac5d5(0x14c)])&&(_0x351992[_0x1ac5d5(0x14c)]='');if(_0x351992[_0x1ac5d5(0x110)]==='DecisionPoint'&&_0x351992[_0x1ac5d5(0x1bd)])for(const _0x52bad0 of _0x351992['branches']){_0x52bad0[_0x1ac5d5(0x1bc)]&&isPendingSegmentId(_0x52bad0[_0x1ac5d5(0x1bc)])&&(_0x52bad0[_0x1ac5d5(0x1bc)]='');}_0x351992[_0x1ac5d5(0x110)]==='WaitStep'&&stripWaitStepPendingIds(_0x351992);}}}function resolvePendingIdsInRequest(_0x4750a8,_0x42670d,_0x2f44ec,_0x2823e4,_0x3af4e5,_0x368dd6){const _0x1d9803=a159_0x3ddbd6,_0x223d98=(_0x10f220,_0x1ff20a)=>{const _0x405326=a159_0x4982;if(!isPendingSegmentId(_0x10f220))return _0x10f220;const _0x15e08d=extractPendingSegmentName(_0x10f220),_0x17f771=_0x2823e4['get'](_0x15e08d);return!_0x17f771&&_0x368dd6[_0x405326(0x1dc)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x15e08d+_0x405326(0x18c)+_0x1ff20a),_0x17f771;};if(_0x4750a8['attributes'][_0x1d9803(0x191)]?.['segmentId']&&isPendingSegmentId(_0x4750a8[_0x1d9803(0x1b5)]['goal'][_0x1d9803(0x1bc)])){const _0x57ce20=_0x223d98(_0x4750a8[_0x1d9803(0x1b5)][_0x1d9803(0x191)]['segmentId'],'goal\x20criteria');_0x57ce20&&(_0x4750a8[_0x1d9803(0x1b5)][_0x1d9803(0x191)][_0x1d9803(0x1bc)]=_0x57ce20);}for(const _0x1dcc73 of _0x4750a8['attributes'][_0x1d9803(0x1d7)]||[]){const _0x5d5b2a=_0x2f44ec[_0x1d9803(0x17f)](_0x1dcc73[_0x1d9803(0x101)][_0x1d9803(0x188)]());_0x5d5b2a&&(_0x1dcc73['id']=_0x5d5b2a);if(_0x1dcc73[_0x1d9803(0x139)]?.[_0x1d9803(0x1bc)]&&isPendingSegmentId(_0x1dcc73[_0x1d9803(0x139)][_0x1d9803(0x1bc)])){const _0x2d9ce1=_0x223d98(_0x1dcc73[_0x1d9803(0x139)][_0x1d9803(0x1bc)],_0x1d9803(0x120)+_0x1dcc73['name']+_0x1d9803(0x1e1));_0x2d9ce1&&(_0x1dcc73[_0x1d9803(0x139)]['segmentId']=_0x2d9ce1);}if(_0x1dcc73['exitCriterias'])for(const _0x54745d of _0x1dcc73[_0x1d9803(0x1b3)]){if(_0x54745d[_0x1d9803(0x1bc)]&&isPendingSegmentId(_0x54745d[_0x1d9803(0x1bc)])){const _0x5ab252=_0x223d98(_0x54745d[_0x1d9803(0x1bc)],_0x1d9803(0x120)+_0x1dcc73[_0x1d9803(0x101)]+_0x1d9803(0x124));_0x5ab252&&(_0x54745d[_0x1d9803(0x1bc)]=_0x5ab252);}}if(_0x1dcc73[_0x1d9803(0x196)]?.[_0x1d9803(0x1bc)]&&isPendingSegmentId(_0x1dcc73[_0x1d9803(0x196)][_0x1d9803(0x1bc)])){const _0xd8f6fb=_0x223d98(_0x1dcc73[_0x1d9803(0x196)][_0x1d9803(0x1bc)],'stage\x20\x27'+_0x1dcc73[_0x1d9803(0x101)]+'\x27\x20milestone');_0xd8f6fb&&(_0x1dcc73['milestone'][_0x1d9803(0x1bc)]=_0xd8f6fb);}if(_0x1dcc73['steps']){const _0x4d0e47=_0x5e0458=>_0x42670d['attributes'][_0x1d9803(0x1d7)]?.['find'](_0x314dac=>_0x314dac[_0x1d9803(0x101)][_0x1d9803(0x188)]()===_0x1dcc73[_0x1d9803(0x101)]['toLowerCase']())?.[_0x1d9803(0x123)]?.[_0x5e0458];for(const _0x95c171 of Object['keys'](_0x1dcc73[_0x1d9803(0x123)])){const _0x3312b0=_0x1dcc73[_0x1d9803(0x123)][_0x95c171],_0x49d45e=_0x4d0e47(_0x95c171);if(_0x3312b0[_0x1d9803(0x110)]===_0x1d9803(0x171)&&_0x3312b0[_0x1d9803(0x14c)]&&(isPendingActivationId(_0x3312b0[_0x1d9803(0x14c)])||_0x3312b0['journeyActivationStepId']==='')){if(_0x49d45e?.[_0x1d9803(0x14c)]&&isPendingActivationId(_0x49d45e[_0x1d9803(0x14c)])){const _0x59b28c=extractPendingActivationName(_0x49d45e[_0x1d9803(0x14c)]),_0x593dcb=_0x3af4e5[_0x1d9803(0x17f)](_0x59b28c);_0x593dcb&&(_0x3312b0[_0x1d9803(0x14c)]=_0x593dcb);}}if(_0x3312b0[_0x1d9803(0x110)]===_0x1d9803(0x17d)&&_0x3312b0[_0x1d9803(0x1bd)]&&_0x49d45e?.[_0x1d9803(0x1bd)])for(let _0x5d3155=0x0;_0x5d3155<_0x3312b0['branches'][_0x1d9803(0x107)];_0x5d3155++){const _0x1cd8ef=_0x3312b0[_0x1d9803(0x1bd)][_0x5d3155],_0x461462=_0x49d45e['branches'][_0x5d3155];if(_0x461462?.[_0x1d9803(0x1bc)]&&isPendingSegmentId(_0x461462[_0x1d9803(0x1bc)])){const _0x49bc53=_0x223d98(_0x461462[_0x1d9803(0x1bc)],'stage\x20\x27'+_0x1dcc73[_0x1d9803(0x101)]+_0x1d9803(0x199)+(_0x1cd8ef[_0x1d9803(0x101)]||_0x5d3155)+'\x27');_0x49bc53&&(_0x1cd8ef['segmentId']=_0x49bc53);}}_0x3312b0[_0x1d9803(0x110)]==='WaitStep'&&_0x49d45e?.['type']===_0x1d9803(0x1c2)&&resolveWaitStepPendingIds(_0x3312b0,_0x49d45e,_0x223d98,_0x1dcc73['name']);}}}}
@@ -1 +1 @@
1
- (function(_0x2de753,_0x869beb){const _0xcaa993=a160_0x3ca4,_0x18def3=_0x2de753();while(!![]){try{const _0x235971=-parseInt(_0xcaa993(0xf4))/0x1*(parseInt(_0xcaa993(0xfd))/0x2)+-parseInt(_0xcaa993(0xf5))/0x3+-parseInt(_0xcaa993(0xf7))/0x4*(-parseInt(_0xcaa993(0xfe))/0x5)+parseInt(_0xcaa993(0xf9))/0x6*(parseInt(_0xcaa993(0x103))/0x7)+-parseInt(_0xcaa993(0xff))/0x8*(parseInt(_0xcaa993(0xfc))/0x9)+-parseInt(_0xcaa993(0x105))/0xa*(parseInt(_0xcaa993(0xf8))/0xb)+parseInt(_0xcaa993(0xfa))/0xc*(parseInt(_0xcaa993(0xf3))/0xd);if(_0x235971===_0x869beb)break;else _0x18def3['push'](_0x18def3['shift']());}catch(_0x272e6a){_0x18def3['push'](_0x18def3['shift']());}}}(a160_0x48c1,0x3f201));function a160_0x3ca4(_0x3fedd4,_0x2bdf93){_0x3fedd4=_0x3fedd4-0xf3;const _0x48c15f=a160_0x48c1();let _0x3ca4fe=_0x48c15f[_0x3fedd4];return _0x3ca4fe;}export function buildFolderIdToPathMap(_0x1dda40){const _0x71d7=a160_0x3ca4,_0x4c258a=new Map(),_0x32efe4=new Map();for(const _0x56b1b7 of _0x1dda40){_0x32efe4[_0x71d7(0x101)](_0x56b1b7['id'],_0x56b1b7);}const _0x44c871=new Set();for(const _0x494750 of _0x1dda40){!_0x494750[_0x71d7(0xf6)]&&_0x44c871[_0x71d7(0x100)](_0x494750['id']);}function _0x57fecf(_0x506209){const _0x4b2e9e=_0x71d7;if(_0x4c258a[_0x4b2e9e(0x102)](_0x506209['id']))return _0x4c258a[_0x4b2e9e(0x104)](_0x506209['id']);if(_0x44c871['has'](_0x506209['id']))return _0x4c258a['set'](_0x506209['id'],''),'';if(_0x506209['parentFolderId']){const _0x3d4277=_0x32efe4['get'](_0x506209['parentFolderId']);if(_0x3d4277){const _0x522bd2=_0x57fecf(_0x3d4277),_0x5e9371=_0x522bd2?_0x522bd2+'/'+_0x506209[_0x4b2e9e(0xfb)]:_0x506209[_0x4b2e9e(0xfb)];return _0x4c258a['set'](_0x506209['id'],_0x5e9371),_0x5e9371;}}const _0x18637d=_0x506209[_0x4b2e9e(0xfb)];return _0x4c258a['set'](_0x506209['id'],_0x18637d),_0x18637d;}for(const _0x4a2b14 of _0x1dda40){_0x57fecf(_0x4a2b14);}return _0x4c258a;}export function buildFolderPathToIdMap(_0x322d9b){const _0x3c1fb6=a160_0x3ca4,_0x372c8a=new Map(),_0x39469a=new Map();for(const _0x1896c2 of _0x322d9b){_0x39469a[_0x3c1fb6(0x101)](_0x1896c2['id'],_0x1896c2);}const _0x5b1e24=new Set();for(const _0x4af6e8 of _0x322d9b){!_0x4af6e8[_0x3c1fb6(0xf6)]&&_0x5b1e24['add'](_0x4af6e8['id']);}function _0x425b63(_0x3687b8){const _0x149de9=_0x3c1fb6;if(_0x5b1e24[_0x149de9(0x102)](_0x3687b8['id']))return'';if(_0x3687b8['parentFolderId']){const _0x18ae74=_0x39469a['get'](_0x3687b8[_0x149de9(0xf6)]);if(_0x18ae74){const _0x24e7e5=_0x425b63(_0x18ae74);return _0x24e7e5?_0x24e7e5+'/'+_0x3687b8[_0x149de9(0xfb)]:_0x3687b8[_0x149de9(0xfb)];}}return _0x3687b8[_0x149de9(0xfb)];}for(const _0x356917 of _0x322d9b){const _0x3d89ed=_0x425b63(_0x356917);_0x372c8a[_0x3c1fb6(0x101)](_0x3d89ed,_0x356917['id']);}return _0x372c8a;}export function buildFolderMaps(_0x469ef0){const _0x3620d9=a160_0x3ca4,_0x4c6c94=buildFolderIdToPathMap(_0x469ef0),_0x15ff52=new Map();for(const [_0x59bddc,_0xa80c01]of _0x4c6c94){_0x15ff52[_0x3620d9(0x101)](_0xa80c01,_0x59bddc);}return{'idToPath':_0x4c6c94,'pathToId':_0x15ff52};}function a160_0x48c1(){const _0x2c789f=['3201DzyRDP','54ZPtmej','11108328rWrmKl','name','129321rMHgwj','33316Hcbzbj','47615hKMOYJ','8HcJQfF','add','set','has','57162fkdsIi','get','6980tPBIkm','13NHDTlb','22jnJPZQ','927096MawbfP','parentFolderId','64AKmcnV'];a160_0x48c1=function(){return _0x2c789f;};return a160_0x48c1();}export function getFolderPath(_0x36e5c9,_0x3daa80){const _0x203b87=a160_0x3ca4;if(!_0x36e5c9)return'';return _0x3daa80[_0x203b87(0x104)](_0x36e5c9)??'';}
1
+ (function(_0x4e2147,_0x5bd933){const _0x14612c=a160_0x2455,_0x5073cd=_0x4e2147();while(!![]){try{const _0x510538=parseInt(_0x14612c(0x13c))/0x1+parseInt(_0x14612c(0x142))/0x2+-parseInt(_0x14612c(0x140))/0x3*(-parseInt(_0x14612c(0x13b))/0x4)+parseInt(_0x14612c(0x139))/0x5+parseInt(_0x14612c(0x13f))/0x6+-parseInt(_0x14612c(0x13a))/0x7*(-parseInt(_0x14612c(0x143))/0x8)+-parseInt(_0x14612c(0x135))/0x9;if(_0x510538===_0x5bd933)break;else _0x5073cd['push'](_0x5073cd['shift']());}catch(_0x44b97a){_0x5073cd['push'](_0x5073cd['shift']());}}}(a160_0x23ee,0x79705));export function buildFolderIdToPathMap(_0x37d450){const _0x169c69=a160_0x2455,_0x2ce08c=new Map(),_0x559002=new Map();for(const _0x3adefc of _0x37d450){_0x559002[_0x169c69(0x136)](_0x3adefc['id'],_0x3adefc);}const _0x420e9f=new Set();for(const _0xdb7c57 of _0x37d450){!_0xdb7c57['parentFolderId']&&_0x420e9f[_0x169c69(0x138)](_0xdb7c57['id']);}function _0x29728b(_0x193b99){const _0x536b61=_0x169c69;if(_0x2ce08c[_0x536b61(0x13e)](_0x193b99['id']))return _0x2ce08c[_0x536b61(0x137)](_0x193b99['id']);if(_0x420e9f['has'](_0x193b99['id']))return _0x2ce08c['set'](_0x193b99['id'],''),'';if(_0x193b99[_0x536b61(0x13d)]){const _0x170893=_0x559002['get'](_0x193b99[_0x536b61(0x13d)]);if(_0x170893){const _0x3c41b4=_0x29728b(_0x170893),_0x51d95c=_0x3c41b4?_0x3c41b4+'/'+_0x193b99[_0x536b61(0x141)]:_0x193b99[_0x536b61(0x141)];return _0x2ce08c[_0x536b61(0x136)](_0x193b99['id'],_0x51d95c),_0x51d95c;}}const _0x5a221c=_0x193b99['name'];return _0x2ce08c[_0x536b61(0x136)](_0x193b99['id'],_0x5a221c),_0x5a221c;}for(const _0x20c6f4 of _0x37d450){_0x29728b(_0x20c6f4);}return _0x2ce08c;}function a160_0x23ee(){const _0x2f1715=['has','1262670SYNwOw','4425rwoeXs','name','52798svQUHt','8SdNheh','8156574pFQLWQ','set','get','add','723875vDdPIP','240310BCftVI','816drwwzm','686850rQSEGb','parentFolderId'];a160_0x23ee=function(){return _0x2f1715;};return a160_0x23ee();}export function buildFolderPathToIdMap(_0x546f12){const _0x389887=a160_0x2455,_0x12c0a1=new Map(),_0x6d8f2=new Map();for(const _0x2db1ac of _0x546f12){_0x6d8f2['set'](_0x2db1ac['id'],_0x2db1ac);}const _0x37fd9b=new Set();for(const _0x310993 of _0x546f12){!_0x310993[_0x389887(0x13d)]&&_0x37fd9b[_0x389887(0x138)](_0x310993['id']);}function _0x94ca0d(_0x281e61){const _0x103e7c=_0x389887;if(_0x37fd9b[_0x103e7c(0x13e)](_0x281e61['id']))return'';if(_0x281e61[_0x103e7c(0x13d)]){const _0x5af4a5=_0x6d8f2[_0x103e7c(0x137)](_0x281e61[_0x103e7c(0x13d)]);if(_0x5af4a5){const _0x2721eb=_0x94ca0d(_0x5af4a5);return _0x2721eb?_0x2721eb+'/'+_0x281e61[_0x103e7c(0x141)]:_0x281e61[_0x103e7c(0x141)];}}return _0x281e61[_0x103e7c(0x141)];}for(const _0x5a8761 of _0x546f12){const _0x1d69ce=_0x94ca0d(_0x5a8761);_0x12c0a1['set'](_0x1d69ce,_0x5a8761['id']);}return _0x12c0a1;}export function buildFolderMaps(_0x2f7c0b){const _0x7bd6b=a160_0x2455,_0x5dfb60=buildFolderIdToPathMap(_0x2f7c0b),_0x192c48=new Map();for(const [_0x155946,_0x15b195]of _0x5dfb60){_0x192c48[_0x7bd6b(0x136)](_0x15b195,_0x155946);}return{'idToPath':_0x5dfb60,'pathToId':_0x192c48};}function a160_0x2455(_0x5bdee7,_0x2063ec){_0x5bdee7=_0x5bdee7-0x135;const _0x23eec7=a160_0x23ee();let _0x2455f8=_0x23eec7[_0x5bdee7];return _0x2455f8;}export function getFolderPath(_0x12e7c8,_0x337507){const _0x1c8d04=a160_0x2455;if(!_0x12e7c8)return'';return _0x337507[_0x1c8d04(0x137)](_0x12e7c8)??'';}