@treasuredata/tdx 2026.3.23 → 2026.3.25

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 (203) 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.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/policy-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.js +1 -1
  55. package/dist/core/auth.js +1 -1
  56. package/dist/core/command-output.js +1 -1
  57. package/dist/core/config.js +1 -1
  58. package/dist/core/connection-cache.js +1 -1
  59. package/dist/core/constants.js +1 -1
  60. package/dist/core/credential-cache.js +1 -1
  61. package/dist/core/global-context.js +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/oauth-keychain.js +1 -1
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/core/user-cache.js +1 -1
  69. package/dist/core/version.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/mcp/server.js +1 -1
  72. package/dist/mcp/tools/index.js +1 -1
  73. package/dist/mcp/tools/tdx-run.js +1 -1
  74. package/dist/mcp/tools/tdx-search.js +1 -1
  75. package/dist/mcp/utils.js +1 -1
  76. package/dist/proxy/claude-usage-tracker.js +1 -1
  77. package/dist/proxy/passthrough-server.js +1 -1
  78. package/dist/proxy/sse-usage-parser.js +1 -1
  79. package/dist/sdk/agent/agent-config.js +1 -1
  80. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  81. package/dist/sdk/agent/agent-yaml.js +1 -1
  82. package/dist/sdk/agent/test/evaluator.js +1 -1
  83. package/dist/sdk/agent/test/executor.js +1 -1
  84. package/dist/sdk/agent/test/index.js +1 -1
  85. package/dist/sdk/agent/test/output.js +1 -1
  86. package/dist/sdk/agent/test/parser.js +1 -1
  87. package/dist/sdk/agent/tool-target-registry.js +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/delivery-api-client.js +1 -1
  91. package/dist/sdk/client/endpoints.js +1 -1
  92. package/dist/sdk/client/engage-api-client.js +1 -1
  93. package/dist/sdk/client/http-client.js +1 -1
  94. package/dist/sdk/client/llm-api-client.js +1 -1
  95. package/dist/sdk/client/oauth-refresh.js +1 -1
  96. package/dist/sdk/client/rate-limiter.js +1 -1
  97. package/dist/sdk/client/td-api-client.js +1 -1
  98. package/dist/sdk/client/trino-api-client.js +1 -1
  99. package/dist/sdk/client/workflow-client.js +1 -1
  100. package/dist/sdk/connection-validator.js +1 -1
  101. package/dist/sdk/connection.js +1 -1
  102. package/dist/sdk/delivery.js +1 -1
  103. package/dist/sdk/engage/campaign-pull.js +1 -1
  104. package/dist/sdk/engage/campaign-push.js +1 -1
  105. package/dist/sdk/engage/campaign-validator.js +1 -1
  106. package/dist/sdk/engage/campaign-yaml.js +1 -1
  107. package/dist/sdk/engage/template-pull.js +1 -1
  108. package/dist/sdk/engage/template-push.js +1 -1
  109. package/dist/sdk/engage/template-validator.js +1 -1
  110. package/dist/sdk/engage/template-yaml.js +1 -1
  111. package/dist/sdk/engage/types/campaign-def.js +1 -1
  112. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  113. package/dist/sdk/engage/types/template-schema.js +1 -1
  114. package/dist/sdk/engage.js +1 -1
  115. package/dist/sdk/errors.js +1 -1
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/io/index.js +1 -1
  118. package/dist/sdk/io/node-filesystem.js +1 -1
  119. package/dist/sdk/job.js +1 -1
  120. package/dist/sdk/journey.js +1 -1
  121. package/dist/sdk/llm/chat-cache.js +1 -1
  122. package/dist/sdk/llm/index.js +1 -1
  123. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  124. package/dist/sdk/llm/model-factors.js +1 -1
  125. package/dist/sdk/personalization.js +1 -1
  126. package/dist/sdk/policy.js +1 -1
  127. package/dist/sdk/query/index.js +1 -1
  128. package/dist/sdk/query/sql-parser.js +1 -1
  129. package/dist/sdk/realtime.js +1 -1
  130. package/dist/sdk/schedule.js +1 -1
  131. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  132. package/dist/sdk/segment/fields-display.js +1 -1
  133. package/dist/sdk/segment/file-discovery.js +1 -1
  134. package/dist/sdk/segment/journey-utils.js +1 -1
  135. package/dist/sdk/segment/journey-validator.js +1 -1
  136. package/dist/sdk/segment/journey-yaml.js +1 -1
  137. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  138. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  139. package/dist/sdk/segment/pull-workflow.js +1 -1
  140. package/dist/sdk/segment/push-recovery.js +1 -1
  141. package/dist/sdk/segment/push-workflow.js +1 -1
  142. package/dist/sdk/segment/resolution-context.js +1 -1
  143. package/dist/sdk/segment/segment-path-parser.js +1 -1
  144. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  145. package/dist/sdk/segment/segment-validator.js +1 -1
  146. package/dist/sdk/segment/target-resolution.js +1 -1
  147. package/dist/sdk/segment/tdx-config.js +1 -1
  148. package/dist/sdk/segment/types/activation-schema.js +1 -1
  149. package/dist/sdk/segment/types/journey-def.js +1 -1
  150. package/dist/sdk/segment/types/journey-schema.js +1 -1
  151. package/dist/sdk/segment/types/segment-def.js +1 -1
  152. package/dist/sdk/segment/types/segment-schema.js +1 -1
  153. package/dist/sdk/segment/validate-files.js +1 -1
  154. package/dist/sdk/segment/yaml-validator.js +1 -1
  155. package/dist/sdk/segment.js +1 -1
  156. package/dist/sdk/types/index.js +1 -1
  157. package/dist/sdk/types/progress.js +1 -1
  158. package/dist/sdk/user.js +1 -1
  159. package/dist/sdk/util/format-detector.js +1 -1
  160. package/dist/sdk/util/formatters.js +1 -1
  161. package/dist/sdk/util/index.js +1 -1
  162. package/dist/sdk/util/paginate.js +1 -1
  163. package/dist/sdk/util/tree-formatter.js +1 -1
  164. package/dist/sdk/workflow/archive-validation.js +1 -1
  165. package/dist/sdk/workflow/clone-workflow.js +1 -1
  166. package/dist/sdk/workflow/index.js +1 -1
  167. package/dist/sdk/workflow/pull-workflow.js +1 -1
  168. package/dist/sdk/workflow/push-workflow.js +1 -1
  169. package/dist/sdk/workflow/tdx-config.js +1 -1
  170. package/dist/sdk/workflow/workflow-utils.js +1 -1
  171. package/dist/test-utils/command-runner.js +1 -1
  172. package/dist/test-utils/factories.js +1 -1
  173. package/dist/test-utils/fixtures.js +1 -1
  174. package/dist/test-utils/http-mock.js +1 -1
  175. package/dist/test-utils/index.js +1 -1
  176. package/dist/utils/async.js +1 -1
  177. package/dist/utils/colors.js +1 -1
  178. package/dist/utils/diff.js +1 -1
  179. package/dist/utils/file-permissions.js +1 -1
  180. package/dist/utils/file-reader.js +1 -1
  181. package/dist/utils/github-releases.js +1 -1
  182. package/dist/utils/global-cache.js +1 -1
  183. package/dist/utils/json-loader.js +1 -1
  184. package/dist/utils/local-cache.js +1 -1
  185. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  186. package/dist/utils/logger/formatters/index.js +1 -1
  187. package/dist/utils/logger/handlers/console-handler.js +1 -1
  188. package/dist/utils/logger/handlers/file-handler.js +1 -1
  189. package/dist/utils/logger/handlers/index.js +1 -1
  190. package/dist/utils/logger/handlers/null-handler.js +1 -1
  191. package/dist/utils/logger/index.js +1 -1
  192. package/dist/utils/logger/logger.js +1 -1
  193. package/dist/utils/logger/types.js +1 -1
  194. package/dist/utils/option-validation.js +1 -1
  195. package/dist/utils/process.js +1 -1
  196. package/dist/utils/prompt.js +1 -1
  197. package/dist/utils/spinner.js +1 -1
  198. package/dist/utils/sse-parser.js +1 -1
  199. package/dist/utils/string-utils.js +1 -1
  200. package/dist/utils/table-ref-parser.js +1 -1
  201. package/dist/utils/tdx-logger.js +1 -1
  202. package/dist/utils/version-check.js +1 -1
  203. package/package.json +1 -1
@@ -1 +1 @@
1
- const a141_0x39b92e=a141_0x273c;(function(_0x57a756,_0x5e51cc){const _0x2d8732=a141_0x273c,_0x296052=_0x57a756();while(!![]){try{const _0x151e7d=-parseInt(_0x2d8732(0x146))/0x1+-parseInt(_0x2d8732(0x134))/0x2*(-parseInt(_0x2d8732(0x13a))/0x3)+parseInt(_0x2d8732(0x14c))/0x4*(parseInt(_0x2d8732(0x139))/0x5)+-parseInt(_0x2d8732(0x137))/0x6*(-parseInt(_0x2d8732(0x135))/0x7)+-parseInt(_0x2d8732(0x13f))/0x8+parseInt(_0x2d8732(0x13b))/0x9+parseInt(_0x2d8732(0x140))/0xa*(-parseInt(_0x2d8732(0x138))/0xb);if(_0x151e7d===_0x5e51cc)break;else _0x296052['push'](_0x296052['shift']());}catch(_0x364660){_0x296052['push'](_0x296052['shift']());}}}(a141_0x58c4,0x49296));function a141_0x58c4(){const _0x37fba2=['journeyName','parse','.push-recovery.json','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','1928056IUtRsv','tdx.sdk.push-recovery','ENOENT','dirname','segments','9700JoxJPt','21SUxzkH','code','937518DSsQop','3820388ctPPCY','5peEbho','30zEDFdd','3119742LQmBOO','toISOString','debug','.tmp','944480wXmuNJ','10LBdVDA','version','utf-8','warn','string','join','580873PxUzsG','stringify'];a141_0x58c4=function(){return _0x37fba2;};return a141_0x58c4();}import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a141_0x1836b7 from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a141_0x39b92e(0x130));export function getPushRecoveryPath(_0x53894c){const _0xd700af=a141_0x39b92e,_0x1c4d40=a141_0x1836b7[_0xd700af(0x132)](_0x53894c),_0x406037=a141_0x1836b7['basename'](_0x53894c);return a141_0x1836b7[_0xd700af(0x145)](_0x1c4d40,'.'+_0x406037+_0xd700af(0x14a));}function a141_0x273c(_0x228ef0,_0x3aa800){_0x228ef0=_0x228ef0-0x130;const _0x58c404=a141_0x58c4();let _0x273c90=_0x58c404[_0x228ef0];return _0x273c90;}export function readPushRecovery(_0x5c7d90){const _0x569308=a141_0x39b92e,_0x671145=getPushRecoveryPath(_0x5c7d90);if(!existsSync(_0x671145))return undefined;try{const _0x65dd80=readFileSync(_0x671145,_0x569308(0x142)),_0x3f2a31=JSON[_0x569308(0x149)](_0x65dd80);if(_0x3f2a31?.[_0x569308(0x141)]!==0x1||typeof _0x3f2a31[_0x569308(0x148)]!==_0x569308(0x144))return undefined;return _0x3f2a31;}catch(_0x2154a4){return _0x2154a4 instanceof SyntaxError?logger[_0x569308(0x13d)](_0x569308(0x14b)+_0x2154a4):logger[_0x569308(0x143)]('Failed\x20to\x20read\x20push\x20recovery\x20file:\x20'+_0x2154a4),undefined;}}export function writePushRecovery(_0x1c84bb,_0x3075a2){const _0x536f25=a141_0x39b92e,_0xaa5ee6=getPushRecoveryPath(_0x1c84bb),_0x3d1c23=_0xaa5ee6+_0x536f25(0x13e);writeFileSync(_0x3d1c23,JSON[_0x536f25(0x147)](_0x3075a2,null,0x2)+'\x0a','utf-8'),renameSync(_0x3d1c23,_0xaa5ee6);}export function deletePushRecovery(_0x2510ec){const _0x557ceb=a141_0x39b92e,_0x62b188=getPushRecoveryPath(_0x2510ec);try{unlinkSync(_0x62b188);}catch(_0x1c4448){_0x1c4448[_0x557ceb(0x136)]!==_0x557ceb(0x131)&&logger[_0x557ceb(0x13d)]('Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20'+_0x1c4448);}}export function saveSegmentToPushRecovery(_0x5c16f5,_0xc07eea,_0x57ba64,_0x44bea3){const _0x79c99d=a141_0x39b92e,_0x2588fe=readPushRecovery(_0x5c16f5),_0x6d905a=_0x2588fe?.['journeyName']===_0xc07eea?{..._0x2588fe,'updatedAt':new Date()[_0x79c99d(0x13c)]()}:{'version':0x1,'journeyName':_0xc07eea,'updatedAt':new Date()[_0x79c99d(0x13c)](),'segments':{}};_0x6d905a[_0x79c99d(0x133)][_0x57ba64]=_0x44bea3,writePushRecovery(_0x5c16f5,_0x6d905a);}
1
+ const a141_0x564c60=a141_0x164a;(function(_0x590ddd,_0x370c00){const _0x2f6d1c=a141_0x164a,_0x2ea20d=_0x590ddd();while(!![]){try{const _0xe835aa=-parseInt(_0x2f6d1c(0x145))/0x1*(parseInt(_0x2f6d1c(0x14a))/0x2)+parseInt(_0x2f6d1c(0x143))/0x3*(parseInt(_0x2f6d1c(0x150))/0x4)+-parseInt(_0x2f6d1c(0x140))/0x5+parseInt(_0x2f6d1c(0x14b))/0x6*(parseInt(_0x2f6d1c(0x14c))/0x7)+parseInt(_0x2f6d1c(0x139))/0x8+-parseInt(_0x2f6d1c(0x14d))/0x9+parseInt(_0x2f6d1c(0x13d))/0xa;if(_0xe835aa===_0x370c00)break;else _0x2ea20d['push'](_0x2ea20d['shift']());}catch(_0x5e26e6){_0x2ea20d['push'](_0x2ea20d['shift']());}}}(a141_0x50ad,0x3c540));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a141_0x51b228 from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a141_0x564c60(0x148));export function getPushRecoveryPath(_0x1651dd){const _0x196740=a141_0x564c60,_0x32b462=a141_0x51b228[_0x196740(0x13f)](_0x1651dd),_0xa30768=a141_0x51b228[_0x196740(0x13e)](_0x1651dd);return a141_0x51b228[_0x196740(0x152)](_0x32b462,'.'+_0xa30768+'.push-recovery.json');}function a141_0x164a(_0x42be80,_0x2f591f){_0x42be80=_0x42be80-0x138;const _0x50ad43=a141_0x50ad();let _0x164a66=_0x50ad43[_0x42be80];return _0x164a66;}function a141_0x50ad(){const _0x560179=['tdx.sdk.push-recovery','utf-8','6gwFbrs','1782474mllUWa','7DDivac','1077300fzsjng','version','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','1772nzLbIy','debug','join','stringify','1370584nLRpPd','segments','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','toISOString','3742350YNNkzB','basename','dirname','1080385iQdAlm','ENOENT','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','723cMsHeb','parse','122173YVVuCu','string','.tmp'];a141_0x50ad=function(){return _0x560179;};return a141_0x50ad();}export function readPushRecovery(_0x15d22b){const _0x98cef3=a141_0x564c60,_0x59163d=getPushRecoveryPath(_0x15d22b);if(!existsSync(_0x59163d))return undefined;try{const _0x2f4dba=readFileSync(_0x59163d,'utf-8'),_0x18ea72=JSON[_0x98cef3(0x144)](_0x2f4dba);if(_0x18ea72?.[_0x98cef3(0x14e)]!==0x1||typeof _0x18ea72['journeyName']!==_0x98cef3(0x146))return undefined;return _0x18ea72;}catch(_0x55e570){return _0x55e570 instanceof SyntaxError?logger[_0x98cef3(0x151)](_0x98cef3(0x142)+_0x55e570):logger['warn'](_0x98cef3(0x14f)+_0x55e570),undefined;}}export function writePushRecovery(_0x5da4cb,_0x4d4992){const _0x340b70=a141_0x564c60,_0x3d1cf8=getPushRecoveryPath(_0x5da4cb),_0x179371=_0x3d1cf8+_0x340b70(0x147);writeFileSync(_0x179371,JSON[_0x340b70(0x138)](_0x4d4992,null,0x2)+'\x0a',_0x340b70(0x149)),renameSync(_0x179371,_0x3d1cf8);}export function deletePushRecovery(_0x57cf34){const _0x3d5ac4=a141_0x564c60,_0x108e03=getPushRecoveryPath(_0x57cf34);try{unlinkSync(_0x108e03);}catch(_0x354d7c){_0x354d7c['code']!==_0x3d5ac4(0x141)&&logger[_0x3d5ac4(0x151)](_0x3d5ac4(0x13b)+_0x354d7c);}}export function saveSegmentToPushRecovery(_0x329b47,_0x50ccef,_0xa99a09,_0x28b56f){const _0x32fd53=a141_0x564c60,_0x2fa5f9=readPushRecovery(_0x329b47),_0x10fede=_0x2fa5f9?.['journeyName']===_0x50ccef?{..._0x2fa5f9,'updatedAt':new Date()[_0x32fd53(0x13c)]()}:{'version':0x1,'journeyName':_0x50ccef,'updatedAt':new Date()['toISOString'](),'segments':{}};_0x10fede[_0x32fd53(0x13a)][_0xa99a09]=_0x28b56f,writePushRecovery(_0x329b47,_0x10fede);}
@@ -1 +1 @@
1
- const a142_0x5a306c=a142_0x7272;(function(_0x11be6a,_0x4d1bcd){const _0x9ff299=a142_0x7272,_0x39bdc5=_0x11be6a();while(!![]){try{const _0x36bd22=-parseInt(_0x9ff299(0x20a))/0x1*(parseInt(_0x9ff299(0x1f8))/0x2)+-parseInt(_0x9ff299(0x284))/0x3+parseInt(_0x9ff299(0x214))/0x4*(parseInt(_0x9ff299(0x1bb))/0x5)+parseInt(_0x9ff299(0x2b6))/0x6*(-parseInt(_0x9ff299(0x280))/0x7)+parseInt(_0x9ff299(0x1e6))/0x8*(parseInt(_0x9ff299(0x257))/0x9)+-parseInt(_0x9ff299(0x22a))/0xa+parseInt(_0x9ff299(0x297))/0xb*(parseInt(_0x9ff299(0x1af))/0xc);if(_0x36bd22===_0x4d1bcd)break;else _0x39bdc5['push'](_0x39bdc5['shift']());}catch(_0x112d68){_0x39bdc5['push'](_0x39bdc5['shift']());}}}(a142_0x9770,0x361de));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a142_0x5a306c(0x1dd));export const PENDING_SEGMENT_PREFIX=a142_0x5a306c(0x28f);export const PENDING_ACTIVATION_PREFIX=a142_0x5a306c(0x286);export function createPendingSegmentId(_0x5e4778){return''+PENDING_SEGMENT_PREFIX+_0x5e4778+'__';}export function isPendingSegmentId(_0x3c4370){const _0x33efd3=a142_0x5a306c;return _0x3c4370[_0x33efd3(0x220)](PENDING_SEGMENT_PREFIX)&&!_0x3c4370['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x178cb3){const _0x47ed00=a142_0x5a306c;return _0x178cb3[_0x47ed00(0x291)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x44165e){return''+PENDING_ACTIVATION_PREFIX+_0x44165e+'__';}export function isPendingActivationId(_0x1f259d){const _0x4ebffd=a142_0x5a306c;return _0x1f259d[_0x4ebffd(0x220)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x4d6349){const _0x2adfec=a142_0x5a306c;return _0x4d6349[_0x2adfec(0x291)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x4ea77,_0x18356c){const _0x3f486c=a142_0x5a306c,_0x17a8aa=_0x4ea77+'::'+(_0x18356c[_0x3f486c(0x22e)]()||_0x3f486c(0x293)),_0x43c501=createHash(_0x3f486c(0x227))['update'](_0x17a8aa)[_0x3f486c(0x1b7)](_0x3f486c(0x1bd))[_0x3f486c(0x25f)](0x0,0xc);return'journey_entry_criteria_'+_0x43c501;}export function ensureJourneyDefaults(_0x2f66da){const _0x2921de=a142_0x5a306c;!_0x2f66da[_0x2921de(0x1ba)]&&(_0x2f66da[_0x2921de(0x1ba)]=''),!_0x2f66da['state']&&(_0x2f66da[_0x2921de(0x26c)]=_0x2921de(0x23a));}export function injectExistingStageIds(_0x14c97d,_0x5324ff){const _0x4a080c=a142_0x5a306c,_0x2d7ed4=new Map(_0x5324ff[_0x4a080c(0x26f)](_0x227008=>[_0x227008[_0x4a080c(0x279)],_0x227008['id']]));for(const _0x3911bb of _0x14c97d){if(!_0x3911bb['id']){const _0x148f8a=_0x2d7ed4[_0x4a080c(0x219)](_0x3911bb[_0x4a080c(0x279)]);_0x148f8a&&(_0x3911bb['id']=_0x148f8a);}}}export function resolveTDFolderPath(_0x439de5,_0x2877d6,_0x2c9326){const _0x217f0a=a142_0x5a306c;if(!_0x2877d6)return _0x439de5;if(_0x439de5===_0x2c9326||_0x439de5[_0x217f0a(0x220)](_0x2c9326+'/'))return _0x439de5;return _0x439de5?_0x2c9326+'/'+_0x439de5:_0x2c9326;}export function addFoldersToCreate(_0x12f1cf,_0x121be0,_0x4f841e){const _0xe9dcf3=a142_0x5a306c;if(!_0x12f1cf)return;if(_0x121be0[_0xe9dcf3(0x26b)](_0x12f1cf))return;const _0x164cf5=_0x12f1cf[_0xe9dcf3(0x215)]('/');let _0xe76417='';for(const _0x3dddb8 of _0x164cf5){_0xe76417=_0xe76417?_0xe76417+'/'+_0x3dddb8:_0x3dddb8,!_0x121be0[_0xe9dcf3(0x26b)](_0xe76417)&&_0x4f841e[_0xe9dcf3(0x1c8)](_0xe76417);}}function a142_0x9770(){const _0x21c190=['join','has','state','created','activation_updated','map','deleted','folder_creating','reduce','match','segments','Created\x20segment\x20\x27','Segment\x20not\x20found:\x20','activationStepsById','conditionTimeoutUnit','name','logDeleted','Failed\x20to\x20fetch\x20referenced\x20segment\x20','../../utils/async.js','segmentByFolderAndName','\x20segment\x20from\x20file:\x20','segment_creating','1441370BzjdoY','parse','Creating\x20segment\x20\x27','getJourney','1284984OiPFwf','exitCriterias','__pending_act_','logInfo','idToName','hasChanges','list','updated','decision_point','diff','and\x20the\x20server\x20segment,\x20then\x20retry.','__pending_','Segment\x20not\x20found','replace','isNew','segment','Created\x20journey\x20\x27','SEGMENT_NOT_FOUND','uniqueServerName','81587YEhnpE','data','connector_config','toString','getSegmentEntity\x20also\x20failed\x20for\x20','nameToType','journeyActivationNameToId','folder','toISOString','journeyBundlesByFolderAndName','SEGMENT_SYNTAX_ERROR','nameToId','logWarning','Updated\x20segment\x20\x27','createSegment','yamlActivation','getSegment\x20failed\x20for\x20','Failed\x20to\x20','embedded_activation_creating','rootFolderId','activation_template_id','rule','conditionSegmentId','Activation','branches','getSegment','stages','valid','segment_updated','entryCriteria','parentId','6eUlWeG','journeyById','):\x20','set','\x27...','folderId','from','1464WJwDQv','\x27\x20from\x20file:\x20','Entry\x20criteria:\x20','deleteActivation','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','behavior',').\x20','./child-segment-yaml.js','digest','item','Updated\x20activation\x20\x27','description','1355JlSoJY','type','hex','run_after_journey_refresh','toLowerCase','debug','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','existingSegments','updateActivation','resolveJourneyId','journeys','JOURNEY_SYNTAX_ERROR','skipSegments','add','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','includes','segmentFolderId','activationActions','activationContext','Creating\x20folder\x20\x27','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','entry_criteria','DecisionPoint','columns','Created\x20folder\x20\x27','journeyBundleId','verbose','activationParams','folderPathToId','createJourneySegment','NOT_FOUND','folder_created','conditionTimeoutDuration','waitStep','tdx.sdk.push-workflow','deps','max','journeyName','segment_deleted','\x0a\x20\x20','journey_creating','\x20journey\x20from\x20file:\x20','isArray','123992zNvbeG','journeyId','delete','entry','Matched\x20server\x20segment\x20\x27','index','Fetching\x20','schedule','updateSegmentById','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','waitStepUnit','existingSegment','Journey\x20\x27','folderPath','goal','Stage\x20\x27','createdSegmentId','versionNumber','160978OHNZSq','Deleted\x20activation\x20\x27','connection','Created\x20activation\x20\x27','withProgress','Updating\x20activation\x20\x27','existingActivation','activation_updating','\x27\x20to\x20local\x20\x27','activation_creating','relationships','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','values','journeyActivationStepId','Failed\x20to\x20resolve\x20activation\x20','segment_deleting','size','update','2NPPaTK','Name\x20has\x20already\x20been\x20taken',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','yamlConfig','journeyBundleName','waitStepType','flatMap','absolutePath','activations','.$1.push-recovery.json','1972XaptNN','split','find','ACTIVATION_UPDATE_ERROR','goal\x20criteria','get','keys','segmentId','segmentNameToId','conditions','JOURNEY_UPDATE_ERROR','journeyStages','startsWith','errors','deleteSegment','resolvedRule','utf-8','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','dirname','sha1','createdSegmentIds','all','370980EtCagR','length','buildUserMaps','activation_created','trim','INTERNAL','embedded_segment_created','message','localName','Condition','with','attributes','results','idToEmailMap','\x27\x20wait\x20condition','milestone','draft','onProgress','createActivation','progress','validatedRequest','effectiveFolderId','\x27\x20entry\x20criteria','sort','parentFolder','Embedded\x20segment\x20\x27','create','Creating\x20activation\x20\x27','relative','parseDocument','logSuccess','steps','\x20activation\x20\x27','null','listActivations','filter','connectionIdToNameMap','uniqueSegmentName','entries','SEGMENT_UPDATE_ERROR','embedded_activation_created','Updated\x20journey\x20\x27','stage\x20\x27','notification','existingJourney','9JgSSdq','\x27\x20by\x20rule\x20content','Failed\x20to\x20resolve\x20segment\x20','\x27\x20exit\x20criteria','stringify','embeddedSegmentNameToId','\x27\x20not\x20found\x20in\x20journey\x20\x27','push','slice','WaitStep','action','Updating\x20segment\x20\x27','resolveSegment','unchanged','\x27\x20milestone','./journey-yaml.js','getActivation','journey','some'];a142_0x9770=function(){return _0x21c190;};return a142_0x9770();}export function sortFoldersByDepth(_0x522e2a){const _0x100cf3=a142_0x5a306c;return[..._0x522e2a][_0x100cf3(0x241)]((_0x328ce6,_0x4fc185)=>{const _0x55193a=_0x100cf3,_0x21bd3f=(_0x328ce6[_0x55193a(0x273)](/\//g)||[])[_0x55193a(0x22b)],_0xe43ddf=(_0x4fc185[_0x55193a(0x273)](/\//g)||[])['length'];return _0x21bd3f-_0xe43ddf;});}import*as a142_0x2f4ea7 from'yaml';function a142_0x7272(_0x3ff13e,_0x1ad1c6){_0x3ff13e=_0x3ff13e-0x1aa;const _0x97708f=a142_0x9770();let _0x7272f9=_0x97708f[_0x3ff13e];return _0x7272f9;}import{readFileSync}from'fs';import a142_0x45daf7 from'path';import{isJourneyDef,parseYamlString as a142_0x26fe56,toYamlString as a142_0x564648,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(_0x46f9ed){const _0x22fff8=a142_0x5a306c;if(Array[_0x22fff8(0x1e5)](_0x46f9ed))return'['+_0x46f9ed[_0x22fff8(0x26f)](_0x63d0e2=>stableStringify(_0x63d0e2))[_0x22fff8(0x26a)](',')+']';if(_0x46f9ed&&typeof _0x46f9ed==='object'){const _0x5d7736=_0x46f9ed,_0x582bcf=Object[_0x22fff8(0x21a)](_0x5d7736)[_0x22fff8(0x241)](),_0x4e2928=_0x582bcf[_0x22fff8(0x26f)](_0x7f718=>'\x22'+_0x7f718+'\x22:'+stableStringify(_0x5d7736[_0x7f718]));return'{'+_0x4e2928[_0x22fff8(0x26a)](',')+'}';}const _0x12b837=JSON[_0x22fff8(0x25b)](_0x46f9ed);return _0x12b837===undefined?_0x22fff8(0x24b):_0x12b837;}function activationSignature(_0x5610f6){const _0x24e578=a142_0x5a306c,_0x25a7e2={'connection':_0x5610f6['connection'],..._0x5610f6['all_columns']!==undefined&&{'all_columns':_0x5610f6['all_columns']},..._0x5610f6[_0x24e578(0x1d2)]!==undefined&&{'columns':_0x5610f6[_0x24e578(0x1d2)]},..._0x5610f6[_0x24e578(0x1b4)]!==undefined&&{'behavior':_0x5610f6['behavior']},..._0x5610f6[_0x24e578(0x1ed)]!==undefined&&{'schedule':_0x5610f6[_0x24e578(0x1ed)]},..._0x5610f6[_0x24e578(0x255)]!==undefined&&{'notification':_0x5610f6['notification']},..._0x5610f6[_0x24e578(0x299)]!==undefined&&{'connector_config':_0x5610f6[_0x24e578(0x299)]},..._0x5610f6[_0x24e578(0x2ab)]!==undefined&&{'activation_template_id':_0x5610f6[_0x24e578(0x2ab)]}};return stableStringify(_0x25a7e2);}async function fetchSegment(_0x2457f7,_0x25c947,_0x30c755,_0x36d36b){const _0x2337d0=a142_0x5a306c,_0x4f2af3=_0x36d36b?.[_0x2337d0(0x216)](_0x4569f6=>_0x4569f6['id']===_0x30c755);if(_0x4f2af3)return _0x4f2af3;try{return await _0x2457f7[_0x2337d0(0x293)][_0x2337d0(0x2b0)](_0x25c947,_0x30c755);}catch(_0x36fdd4){logger['debug'](_0x2337d0(0x2a7)+_0x30c755+_0x2337d0(0x20c)+_0x36fdd4);try{return await _0x2457f7[_0x2337d0(0x293)]['getSegmentEntity'](_0x30c755);}catch(_0x2992f0){return logger[_0x2337d0(0x1c0)](_0x2337d0(0x29b)+_0x30c755+':\x20'+_0x2992f0),null;}}}function recoverSegmentIdsFromPushRecovery(_0x190052,_0x5983b3,_0x1d2de2){const _0x5e4fd7=a142_0x5a306c,_0x2a2bf0=readPushRecovery(_0x190052[_0x5e4fd7(0x211)]);if(_0x2a2bf0?.[_0x5e4fd7(0x1e0)]===_0x190052['yamlConfig']['name'])for(const [_0x600770,_0x18224d]of Object[_0x5e4fd7(0x250)](_0x2a2bf0['segments'])){const _0x26e2b1=generateDeterministicJourneySegmentName(_0x190052[_0x5e4fd7(0x20d)][_0x5e4fd7(0x279)],_0x600770);_0x18224d[_0x5e4fd7(0x296)]===_0x26e2b1&&(_0x5983b3[_0x5e4fd7(0x1ab)](_0x600770,_0x18224d[_0x5e4fd7(0x21b)]),_0x1d2de2[_0x5e4fd7(0x1ab)](_0x600770,_0x18224d[_0x5e4fd7(0x21b)]));}}async function createOrRecoverEmbeddedSegment(_0x4543a0,_0x686662,_0x3308b5,_0x5e43f1){const _0x279d9d=a142_0x5a306c;let _0x37a0a1;try{_0x37a0a1=await _0x4543a0[_0x279d9d(0x293)][_0x279d9d(0x1d8)]({'name':_0x3308b5['uniqueSegmentName'],'description':_0x3308b5[_0x279d9d(0x1ba)],'journeyId':_0x3308b5[_0x279d9d(0x1e7)],'rule':_0x5e43f1(_0x3308b5[_0x279d9d(0x223)],!![]),'countPopulation':!![],'parentFolderId':_0x3308b5['folderId'],'audienceId':_0x3308b5[_0x279d9d(0x2b5)]});}catch(_0x578e11){const _0x16dd1e=_0x578e11 instanceof Error&&_0x578e11[_0x279d9d(0x231)][_0x279d9d(0x1ca)](_0x279d9d(0x20b));if(_0x16dd1e){const _0x5a8fe7=readPushRecovery(_0x686662[_0x279d9d(0x211)]),_0x4225c8=_0x5a8fe7?.[_0x279d9d(0x1e0)]===_0x686662[_0x279d9d(0x20d)]['name']?_0x5a8fe7[_0x279d9d(0x274)][_0x3308b5[_0x279d9d(0x232)]]:undefined;if(_0x4225c8?.[_0x279d9d(0x296)]===_0x3308b5[_0x279d9d(0x24f)])await _0x4543a0[_0x279d9d(0x293)][_0x279d9d(0x1ee)](_0x3308b5[_0x279d9d(0x2b5)],_0x4225c8[_0x279d9d(0x21b)],{'description':_0x3308b5['description'],'rule':_0x5e43f1(_0x3308b5[_0x279d9d(0x223)],!![]),'countPopulation':!![]}),_0x37a0a1=_0x4225c8[_0x279d9d(0x21b)];else throw new SDKError(ErrorCode[_0x279d9d(0x251)],_0x279d9d(0x243)+_0x3308b5[_0x279d9d(0x232)]+_0x279d9d(0x1c1)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x686662['absolutePath'][_0x279d9d(0x291)](/([^/]+)$/,_0x279d9d(0x213))+')\x20')+_0x279d9d(0x28e),_0x578e11);}else throw _0x578e11;}return saveSegmentToPushRecovery(_0x686662[_0x279d9d(0x211)],_0x686662[_0x279d9d(0x20d)][_0x279d9d(0x279)],_0x3308b5['localName'],{'segmentId':_0x37a0a1,'uniqueServerName':_0x3308b5['uniqueSegmentName'],'createdAt':new Date()[_0x279d9d(0x29f)]()}),_0x37a0a1;}export async function prepareSegmentFiles(_0x373f01,_0x420385,_0x3b9702,_0x52087d,_0xafcdb3){const _0x54abf2=a142_0x5a306c,{activationDefToCreateRequest:_0x3207a0}=await import(_0x54abf2(0x1b6)),_0x692a3c=[],_0x3b5541=new Set();for(const {yamlConfig:_0x6469da,folderPath:_0x3bc138,sourcePath:_0x2a8fdd}of _0x373f01){const _0x23c85b=resolveTDFolderPath(_0x3bc138,_0x52087d,_0xafcdb3),_0x142ca5=_0x23c85b+':'+_0x6469da[_0x54abf2(0x279)],_0x554be1=_0x420385[_0x54abf2(0x27d)][_0x54abf2(0x219)](_0x142ca5),_0x52edbd=_0x554be1?_0x420385['activationsBySegmentId']['get'](_0x554be1['id'])||[]:[];addFoldersToCreate(_0x23c85b,_0x420385[_0x54abf2(0x1d7)],_0x3b5541);const _0x3db924=calculateActivationActions(_0x6469da[_0x54abf2(0x212)]||[],_0x52edbd,_0x420385[_0x54abf2(0x237)],_0x420385[_0x54abf2(0x24e)]);for(const _0x168a2a of _0x3db924){(_0x168a2a['type']===_0x54abf2(0x244)||_0x168a2a[_0x54abf2(0x1bc)]===_0x54abf2(0x209))&&_0x168a2a[_0x54abf2(0x2a6)]&&(_0x168a2a['validatedRequest']=await _0x3207a0(_0x168a2a['yamlActivation'],_0x3b9702));}const _0x350c00=calculateSegmentDiff(_0x6469da,_0x554be1,_0x52edbd,_0x420385[_0x54abf2(0x237)],_0x420385['connectionIdToNameMap']);_0x692a3c[_0x54abf2(0x25e)]({'relativePath':_0x6469da['name'],'absolutePath':_0x2a8fdd,'yamlConfig':_0x6469da,'folderPath':_0x23c85b,'existingSegment':_0x554be1,'existingActivations':_0x52edbd,'isNew':_0x350c00[_0x54abf2(0x292)],'hasChanges':_0x350c00[_0x54abf2(0x289)],'diff':_0x350c00[_0x54abf2(0x28d)],'activationActions':_0x3db924});}return{'segmentFiles':_0x692a3c,'foldersToCreate':_0x3b5541};}export async function prepareJourneyFiles(_0xf1d2d1,_0x5a21d3,_0x30a786,_0x169fad){const _0x4b2bd8=a142_0x5a306c,_0x4bbc43=[],_0x1d409a=new Set();for(const {yamlConfig:_0x204569,folderPath:_0x3ca2de,sourcePath:_0x46d807}of _0xf1d2d1){const _0xc33c4a=resolveTDFolderPath(_0x3ca2de,_0x30a786,_0x169fad),_0x2554bb=_0xc33c4a+':'+_0x204569[_0x4b2bd8(0x279)],_0x21124e=_0x5a21d3[_0x4b2bd8(0x2a0)][_0x4b2bd8(0x219)](_0x2554bb);let _0x2e1ec2,_0x174b14;if(_0x21124e&&_0x21124e[_0x4b2bd8(0x22b)]>0x0){const _0x367a3d=buildLocalExpandedRuleMappings(_0x204569),{createYamlContext:_0x57d692,prefetchJourneySegments:_0x5c0717}=createPushYamlContextForBundle(_0x5a21d3[_0x4b2bd8(0x1de)],_0x5a21d3[_0x4b2bd8(0x2b5)],_0x5a21d3[_0x4b2bd8(0x1c2)],_0x367a3d,_0x5a21d3['idToEmailMap'],_0x5a21d3[_0x4b2bd8(0x24e)],_0x5a21d3[_0x4b2bd8(0x277)],_0x5a21d3[_0x4b2bd8(0x2b7)]);await _0x5c0717(_0x21124e['map'](_0x3fa293=>_0x3fa293['id']));const _0x16dfb8=await _0x5a21d3[_0x4b2bd8(0x1de)]['journey']['getLatestJourneyId'](_0x21124e[0x0][_0x4b2bd8(0x1d4)]),_0x13dfcc=hasMultipleVersions(_0x204569),_0x2ab7d9=async _0x11b690=>{const _0x20ccc8=_0x4b2bd8,_0x562a6f=_0x5a21d3[_0x20ccc8(0x2b7)]?.[_0x20ccc8(0x219)](_0x11b690);if(_0x562a6f)return _0x562a6f;return _0x5a21d3['fetchJourney']({'journeyId':_0x11b690,'journeyName':_0x204569['name'],'isMultiVersion':_0x21124e[_0x20ccc8(0x22b)]>0x1});};if(_0x13dfcc&&_0x21124e[_0x4b2bd8(0x22b)]>0x1){const _0x5d0f39=[];for(const _0x1842e4 of _0x21124e){const _0x600190=_0x1842e4[_0x4b2bd8(0x1f7)]||0x1;_0x5a21d3[_0x4b2bd8(0x23d)]?.[_0x4b2bd8(0x209)](_0x4b2bd8(0x1ec)+_0x204569['name']+'\x20v'+_0x600190);const _0x5de595=await _0x2ab7d9(_0x1842e4['id']),_0x34a3d0=_0x57d692(_0x1842e4['id']),_0x435fe5=await journeyResponseToDef(_0x5de595,_0x34a3d0);_0x5d0f39['push']({'item':_0x1842e4,'yaml':_0x435fe5});}const _0x3b8751=buildLocalRuleToNameMappingFromJourney(_0x204569);_0x174b14=buildMergedJourneyDef(_0x5d0f39,_0x3b8751,_0x16dfb8);const _0x555d1f=Math[_0x4b2bd8(0x1df)](..._0x5d0f39[_0x4b2bd8(0x26f)](_0x33ddb6=>_0x33ddb6[_0x4b2bd8(0x1b8)][_0x4b2bd8(0x1f7)]||0x0)),_0x499b1f=_0x21124e[_0x4b2bd8(0x216)](_0x727b99=>(_0x727b99[_0x4b2bd8(0x1f7)]||0x0)===_0x555d1f);_0x499b1f&&(_0x5a21d3['progress']?.['update']('Fetching\x20'+_0x204569[_0x4b2bd8(0x279)]+'\x20v'+_0x555d1f),_0x2e1ec2=await _0x2ab7d9(_0x499b1f['id']));}else{const _0x22553d=_0x21124e[_0x21124e['length']-0x1];_0x5a21d3[_0x4b2bd8(0x23d)]?.[_0x4b2bd8(0x209)](_0x4b2bd8(0x1ec)+_0x204569[_0x4b2bd8(0x279)]),_0x2e1ec2=await _0x2ab7d9(_0x22553d['id']);const _0x538181=_0x57d692(_0x22553d['id']),_0x4049be=await journeyResponseToDef(_0x2e1ec2,_0x538181),_0x3ccf33=buildLocalRuleToNameMappingFromJourney(_0x204569);_0x174b14=buildMergedJourneyDef([{'item':_0x22553d,'yaml':_0x4049be}],_0x3ccf33,_0x16dfb8);}}addFoldersToCreate(_0xc33c4a,_0x5a21d3[_0x4b2bd8(0x1d7)],_0x1d409a);const _0x482e66=calculateJourneyDiff(_0x204569,_0x174b14);_0x4bbc43[_0x4b2bd8(0x25e)]({'relativePath':_0x204569[_0x4b2bd8(0x279)],'absolutePath':_0x46d807,'yamlConfig':_0x204569,'folderPath':_0xc33c4a,'existingJourney':_0x2e1ec2,'isNew':_0x482e66['isNew'],'hasChanges':_0x482e66[_0x4b2bd8(0x289)],'diff':_0x482e66[_0x4b2bd8(0x28d)]});}return{'journeyFiles':_0x4bbc43,'foldersToCreate':_0x1d409a};}export function calculateActivationActions(_0x1863c2,_0xa5ca35,_0x3bce3a,_0x152c9e){const _0xf1553a=a142_0x5a306c,_0x36c09e=[],_0x3513bc=new Map();for(const _0x338fa1 of _0xa5ca35){_0x3513bc[_0xf1553a(0x1ab)](_0x338fa1[_0xf1553a(0x279)],_0x338fa1);}const _0xea000b=new Map();for(const _0x307ea2 of _0x1863c2){_0xea000b[_0xf1553a(0x1ab)](_0x307ea2[_0xf1553a(0x279)],_0x307ea2);}for(const _0x5d711f of _0x1863c2){const _0x3ef883=_0x3513bc[_0xf1553a(0x219)](_0x5d711f[_0xf1553a(0x279)]);if(!_0x3ef883)_0x36c09e[_0xf1553a(0x25e)]({'type':_0xf1553a(0x244),'name':_0x5d711f['name'],'yamlActivation':_0x5d711f});else{const _0x524261=activationResponseToDef(_0x3ef883,_0x3bce3a,_0x152c9e),_0x1a0312=a142_0x2f4ea7[_0xf1553a(0x25b)](_0x524261),_0x162493=a142_0x2f4ea7[_0xf1553a(0x25b)](_0x5d711f);_0x1a0312!==_0x162493&&_0x36c09e[_0xf1553a(0x25e)]({'type':_0xf1553a(0x209),'name':_0x5d711f[_0xf1553a(0x279)],'yamlActivation':_0x5d711f,'existingActivation':_0x3ef883});}}for(const _0x3667b5 of _0xa5ca35){!_0xea000b[_0xf1553a(0x26b)](_0x3667b5[_0xf1553a(0x279)])&&_0x36c09e[_0xf1553a(0x25e)]({'type':_0xf1553a(0x1e8),'name':_0x3667b5[_0xf1553a(0x279)],'existingActivation':_0x3667b5});}return _0x36c09e;}function calculateYamlDiff(_0x6f2cb3,_0x3ac187){if(_0x3ac187){const _0x8ccc59=generateDiff(_0x3ac187,_0x6f2cb3),_0x6c4d15=hasChanges(_0x8ccc59);return{'isNew':![],'hasChanges':_0x6c4d15,'diff':_0x6c4d15?formatDiffWithColors(_0x8ccc59):undefined};}const _0x581cb4=generateDiff('',_0x6f2cb3);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x581cb4)};}export function calculateSegmentDiff(_0x3308b8,_0x436cd7,_0x54b692,_0x46685e,_0x781a1c){const _0x56ceda=segmentToYamlString(_0x3308b8),_0x419aae=_0x436cd7?segmentToYamlString(segmentWithActivationsToYaml(_0x436cd7,_0x54b692,undefined,_0x46685e,_0x781a1c)):undefined;return calculateYamlDiff(_0x56ceda,_0x419aae);}export function calculateJourneyDiff(_0x38141c,_0x19ecdd){const _0x726fb9=normalizeJourneyDef(_0x38141c,_0x38141c),_0x5437bb=a142_0x564648(_0x726fb9),_0x2ce9ae=_0x19ecdd?a142_0x564648(normalizeJourneyDef(_0x19ecdd,_0x38141c)):undefined;return calculateYamlDiff(_0x5437bb,_0x2ce9ae);}export function findSegmentsToDelete(_0x4ff70b,_0xaf7751,_0x1ebae1,_0x1bca0e,_0x31e0c5){const _0xb4b4c=a142_0x5a306c,_0x114cbe=new Set();for(const {yamlConfig:_0x4f1ebb,folderPath:_0x366d23}of _0xaf7751){_0x114cbe[_0xb4b4c(0x1c8)](_0x366d23+':'+_0x4f1ebb[_0xb4b4c(0x279)]);}return _0x4ff70b[_0xb4b4c(0x24d)](_0xb912e6=>{const _0x39613d=_0xb4b4c,_0x582aab=_0xb912e6['segmentFolderId']?_0x1ebae1[_0x39613d(0x219)](_0xb912e6[_0x39613d(0x1cb)][_0x39613d(0x29a)]())||'':'',_0x5ad74b=_0x582aab+':'+_0xb912e6[_0x39613d(0x279)];if(_0x114cbe[_0x39613d(0x26b)](_0x5ad74b))return![];if(_0x31e0c5)return _0x582aab===_0x1bca0e||_0x582aab[_0x39613d(0x220)](_0x1bca0e+'/');return!![];});}export function findJourneysToDelete(_0x341b79,_0x2d59be,_0x1fc4f9,_0x7ac910,_0x55484f){const _0x5678d4=a142_0x5a306c,_0x575168=new Set();for(const {yamlConfig:_0x23c9c7,folderPath:_0x237152}of _0x2d59be){_0x575168['add'](_0x237152+':'+_0x23c9c7[_0x5678d4(0x279)]);}return _0x341b79[_0x5678d4(0x24d)](_0x1f5409=>{const _0x29bc3b=_0x5678d4,_0x385672=_0x1f5409[_0x29bc3b(0x1ad)]?_0x1fc4f9[_0x29bc3b(0x219)](_0x1f5409[_0x29bc3b(0x1ad)])||'':'',_0x229a74=_0x385672+':'+_0x1f5409[_0x29bc3b(0x20e)];if(_0x575168[_0x29bc3b(0x26b)](_0x229a74))return![];if(_0x55484f)return _0x385672===_0x7ac910||_0x385672[_0x29bc3b(0x220)](_0x7ac910+'/');return!![];});}export function buildSegmentLookupMap(_0x514864,_0x496a50){const _0x5a5e3e=a142_0x5a306c,_0x2bc6a6=new Map();for(const _0x21cfdc of _0x514864){const _0x2f2fd1=_0x21cfdc[_0x5a5e3e(0x1cb)]?_0x496a50['get'](_0x21cfdc[_0x5a5e3e(0x1cb)][_0x5a5e3e(0x29a)]())||'':'',_0x50a526=_0x2f2fd1+':'+_0x21cfdc[_0x5a5e3e(0x279)];_0x2bc6a6[_0x5a5e3e(0x1ab)](_0x50a526,_0x21cfdc);}return _0x2bc6a6;}export function buildSegmentNameToIdMap(_0x1f0cc1){const _0x48a55d=new Map();for(const _0x257968 of _0x1f0cc1){_0x48a55d['set'](_0x257968['name'],_0x257968['id']);}return _0x48a55d;}export function buildJourneyBundleLookupMap(_0x3442ad,_0x4976c2){const _0x1881b8=a142_0x5a306c,_0x34b47e=new Map();for(const _0x558a12 of _0x3442ad){const _0x47ce37=_0x558a12['folderId']?_0x4976c2[_0x1881b8(0x219)](_0x558a12[_0x1881b8(0x1ad)])||'':'',_0x5a0e4c=_0x47ce37+':'+_0x558a12['journeyBundleName'];!_0x34b47e[_0x1881b8(0x26b)](_0x5a0e4c)&&_0x34b47e['set'](_0x5a0e4c,[]),_0x34b47e[_0x1881b8(0x219)](_0x5a0e4c)['push'](_0x558a12);}for(const _0x563440 of _0x34b47e[_0x1881b8(0x204)]()){_0x563440[_0x1881b8(0x241)]((_0x486fef,_0x5429d7)=>(_0x486fef[_0x1881b8(0x1f7)]||0x0)-(_0x5429d7[_0x1881b8(0x1f7)]||0x0));}return _0x34b47e;}export function collectFoldersToCreate(_0x2d7fa8,_0x39a4f6){const _0x29ed85=a142_0x5a306c,_0x588bfd=new Set();for(const _0x5a6632 of _0x2d7fa8){if(!_0x5a6632)continue;if(_0x39a4f6['has'](_0x5a6632))continue;const _0xd8db6c=_0x5a6632[_0x29ed85(0x215)]('/');let _0x4f7a33='';for(const _0x412651 of _0xd8db6c){_0x4f7a33=_0x4f7a33?_0x4f7a33+'/'+_0x412651:_0x412651,!_0x39a4f6[_0x29ed85(0x26b)](_0x4f7a33)&&_0x588bfd['add'](_0x4f7a33);}}return _0x588bfd;}export function parseAndClassifyYamlFiles(_0x324f21,_0x1705fe,_0x3b3476){const _0x5e7b61=a142_0x5a306c,_0x35f450=[],_0x346899=[];for(const _0x6b0907 of _0x324f21){const _0x3e7054=a142_0x45daf7[_0x5e7b61(0x246)](_0x1705fe,a142_0x45daf7[_0x5e7b61(0x226)](_0x6b0907)),_0x2a622c=_0x3e7054==='.'?'':_0x3e7054,_0x17d768=readFileSync(_0x6b0907,_0x5e7b61(0x224)),_0x5bf7c4=a142_0x2f4ea7[_0x5e7b61(0x281)](_0x17d768);if(isJourneyDef(_0x5bf7c4)){const _0x37b3d4=a142_0x26fe56(_0x17d768);_0x346899['push']({'yamlConfig':_0x37b3d4,'folderPath':_0x2a622c,'sourcePath':_0x6b0907});}else{if(!_0x3b3476?.[_0x5e7b61(0x1c7)]){const _0xd6e78e=parseSegmentYamlFile(_0x17d768),_0x16d112=normalizeChildSegmentYaml(_0xd6e78e);_0x35f450[_0x5e7b61(0x25e)]({'yamlConfig':_0x16d112,'folderPath':_0x2a622c,'sourcePath':_0x6b0907});}}}return{'segments':_0x35f450,'journeys':_0x346899};}export function validateParsedFiles(_0x5cf580,_0x2cd217){const _0x4c30f6=a142_0x5a306c,_0x4ea173=[];for(const {yamlConfig:_0x8bca1c,sourcePath:_0x55fa15}of _0x5cf580['segments']){const _0x2d8c78=readFileSync(_0x55fa15,_0x4c30f6(0x224)),_0x3fec05=a142_0x2f4ea7[_0x4c30f6(0x247)](_0x2d8c78),_0x4de930=validateSegmentDef(_0x8bca1c,{'source':_0x2d8c78,'document':_0x3fec05},{'skipSchema':!![]});if(!_0x4de930[_0x4c30f6(0x2b2)]){const _0x2b4368=a142_0x45daf7[_0x4c30f6(0x246)](_0x2cd217,_0x55fa15);_0x4ea173['push']({'filePath':_0x2b4368,'source':_0x2d8c78,'result':_0x4de930,'isJourney':![]});}}for(const {yamlConfig:_0x1a4c96,sourcePath:_0x2bd0e3}of _0x5cf580[_0x4c30f6(0x1c5)]){const _0x6fa27c=readFileSync(_0x2bd0e3,_0x4c30f6(0x224)),_0x26d728=a142_0x2f4ea7[_0x4c30f6(0x247)](_0x6fa27c),_0x22553c=validateJourneyDef(_0x1a4c96,{'source':_0x6fa27c,'document':_0x26d728},{'skipSchema':!![]});if(!_0x22553c[_0x4c30f6(0x2b2)]){const _0x1a4ea6=a142_0x45daf7[_0x4c30f6(0x246)](_0x2cd217,_0x2bd0e3);_0x4ea173['push']({'filePath':_0x1a4ea6,'source':_0x6fa27c,'result':_0x22553c,'isJourney':!![]});}}return _0x4ea173;}export function formatValidationErrors(_0x4b9066){const _0x466d99=a142_0x5a306c,_0x30c560=[];for(const {filePath:_0x33082f,source:_0x26d3f7,result:_0x5c0e12,isJourney:_0x2edb3c}of _0x4b9066){const _0x2bff42=_0x2edb3c?_0x466d99(0x268):_0x466d99(0x293);_0x30c560[_0x466d99(0x25e)]('\x0a'+_0x33082f+'\x20('+_0x2bff42+_0x466d99(0x1aa)+_0x5c0e12[_0x466d99(0x221)][_0x466d99(0x22b)]+'\x20error(s)'),_0x30c560[_0x466d99(0x25e)](formatValidationResult(_0x5c0e12,_0x26d3f7,_0x33082f));}return _0x30c560[_0x466d99(0x26a)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x18a83e){const _0x53995d=a142_0x5a306c,_0x50c6e8=new Set(),_0x1f83d2=new Map(),_0x2e7ec1=collectSegmentUsageCounts(_0x18a83e);if(_0x18a83e[_0x53995d(0x274)])for(const [_0x5da4a0,_0x2db724]of Object[_0x53995d(0x250)](_0x18a83e[_0x53995d(0x274)])){_0x50c6e8[_0x53995d(0x1c8)](_0x5da4a0);if(_0x2db724[_0x53995d(0x2ac)]){const _0x14d798=yamlRuleToApi(_0x2db724[_0x53995d(0x2ac)]),_0x556fa2=apiRuleToYaml(_0x14d798);_0x1f83d2[_0x53995d(0x1ab)](_0x5da4a0,_0x556fa2);}}const _0x44860c=new Map();let _0xd01709=0x0;for(const [_0x599197,_0x8e4bf]of _0x1f83d2){const _0x383940=serializeExpandedRule(_0x8e4bf,_0x1f83d2),_0x546902=_0x44860c[_0x53995d(0x219)](_0x383940)||[];_0x546902['push']({'name':_0x599197,'index':_0xd01709}),_0x44860c['set'](_0x383940,_0x546902),_0xd01709++;}const _0x1d4508=new Map();for(const [_0xad914d,_0x64614f]of _0x44860c){const _0x20703a=_0x64614f[_0x53995d(0x25f)]()[_0x53995d(0x241)]((_0x3dbed6,_0x12569b)=>{const _0x3f7d75=_0x53995d,_0x16f233=_0x2e7ec1[_0x3f7d75(0x219)](_0x3dbed6[_0x3f7d75(0x279)])||0x0,_0x46d393=_0x2e7ec1['get'](_0x12569b[_0x3f7d75(0x279)])||0x0;if(_0x16f233!==_0x46d393)return _0x46d393-_0x16f233;return _0x3dbed6['index']-_0x12569b[_0x3f7d75(0x1eb)];})['map'](_0x57fffe=>_0x57fffe['name']),_0x1a08c8=[];for(const _0x374b90 of _0x20703a){const _0x5c01f2=_0x2e7ec1[_0x53995d(0x219)](_0x374b90)||0x0,_0x20f860=Math[_0x53995d(0x1df)](_0x5c01f2,0x1);for(let _0x4d1715=0x0;_0x4d1715<_0x20f860;_0x4d1715++){_0x1a08c8[_0x53995d(0x25e)](_0x374b90);}}_0x1d4508['set'](_0xad914d,_0x1a08c8);}return{'existingLocalSegmentNames':_0x50c6e8,'localSegmentRules':_0x1f83d2,'localExpandedRuleToNames':_0x1d4508};}export function createSegmentIdResolver(_0x257afa,_0x521f6d){return async _0x2c84ce=>{const _0x298469=a142_0x7272,_0x10d52a=_0x257afa[_0x298469(0x219)](_0x2c84ce);if(!_0x10d52a)throw new SDKError(ErrorCode[_0x298469(0x295)],'Segment\x20not\x20found:\x20'+_0x2c84ce+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x521f6d+'\x27)');return _0x10d52a;};}export function extractRootFolderId(_0x42a6cc){const _0x3f7c17=a142_0x5a306c;return _0x42a6cc[_0x3f7c17(0x202)]?.['parentSegmentFolder']?.[_0x3f7c17(0x298)]?.['id']||_0x42a6cc[_0x3f7c17(0x202)]?.[_0x3f7c17(0x242)]?.[_0x3f7c17(0x298)]?.['id'];}export function buildConnectionMaps(_0x61f1dc){const _0x43632d=a142_0x5a306c,_0x54daec=new Map(),_0x531876=new Map(),_0x290580=new Map();for(const _0x4a00a7 of _0x61f1dc){_0x54daec[_0x43632d(0x1ab)](_0x4a00a7[_0x43632d(0x279)],parseInt(_0x4a00a7['id'],0xa)),_0x531876['set'](_0x4a00a7['id'],_0x4a00a7[_0x43632d(0x279)]),_0x290580[_0x43632d(0x1ab)](_0x4a00a7['name'],_0x4a00a7['type']);}return{'nameToId':_0x54daec,'idToName':_0x531876,'nameToType':_0x290580};}export function calculatePushStats(_0x21ebae,_0xaa84a2,_0x3e0692,_0x5589d6,_0x502451,_0x4bc4ef,_0x29563e){const _0x4872de=a142_0x5a306c,_0x48fe53=_0x21ebae[_0x4872de(0x24d)](_0x3a5d8a=>_0x3a5d8a[_0x4872de(0x292)]),_0x538800=_0x21ebae[_0x4872de(0x24d)](_0x532dee=>!_0x532dee[_0x4872de(0x292)]&&_0x532dee[_0x4872de(0x289)]),_0x41b663=_0x21ebae['filter'](_0x1f25c3=>!_0x1f25c3[_0x4872de(0x292)]&&!_0x1f25c3['hasChanges']),_0x4d00ee=_0x4bc4ef?_0x5589d6:[],_0x36d25f=_0xaa84a2[_0x4872de(0x24d)](_0x4907dd=>_0x4907dd[_0x4872de(0x292)]),_0x59ad0a=_0xaa84a2[_0x4872de(0x24d)](_0x5823e4=>!_0x5823e4[_0x4872de(0x292)]&&_0x5823e4[_0x4872de(0x289)]),_0x10df1c=_0xaa84a2[_0x4872de(0x24d)](_0x41f6e8=>!_0x41f6e8[_0x4872de(0x292)]&&!_0x41f6e8['hasChanges']),_0x2a8261=_0x4bc4ef?_0x502451:[],_0xe4c381=_0x21ebae[_0x4872de(0x210)](_0x3dbbfd=>_0x3dbbfd['activationActions']),_0x522ff1=_0xe4c381['filter'](_0x5f0c09=>_0x5f0c09[_0x4872de(0x1bc)]==='create'),_0x536e56=_0xe4c381[_0x4872de(0x24d)](_0x3cf32e=>_0x3cf32e[_0x4872de(0x1bc)]===_0x4872de(0x209)),_0x38e6bf=_0xe4c381['filter'](_0x4b4522=>_0x4b4522[_0x4872de(0x1bc)]===_0x4872de(0x1e8)),_0x2016cd=Array[_0x4872de(0x1ae)](_0x3e0692)['sort'](),_0x5f2708=_0x29563e?![]:_0x48fe53[_0x4872de(0x22b)]>0x0||_0x538800[_0x4872de(0x22b)]>0x0||_0x4d00ee[_0x4872de(0x22b)]>0x0,_0x4f9fde=_0x36d25f[_0x4872de(0x22b)]>0x0||_0x59ad0a[_0x4872de(0x22b)]>0x0||_0x2a8261[_0x4872de(0x22b)]>0x0,_0x184720=_0x29563e?![]:_0xe4c381[_0x4872de(0x22b)]>0x0,_0x56c8ba=_0x2016cd[_0x4872de(0x22b)]>0x0;return{'segments':{'new':_0x48fe53,'changed':_0x538800,'unchanged':_0x41b663,'toDelete':_0x4d00ee},'journeys':{'new':_0x36d25f,'changed':_0x59ad0a,'unchanged':_0x10df1c,'toDelete':_0x2a8261},'activations':{'all':_0xe4c381,'toCreate':_0x522ff1,'toUpdate':_0x536e56,'toDelete':_0x38e6bf},'folders':{'toCreate':_0x2016cd},'counts':{'segments':{'new':_0x48fe53['length'],'changed':_0x538800['length'],'unchanged':_0x41b663['length'],'toDelete':_0x4d00ee['length']},'journeys':{'new':_0x36d25f['length'],'changed':_0x59ad0a[_0x4872de(0x22b)],'unchanged':_0x10df1c['length'],'toDelete':_0x2a8261[_0x4872de(0x22b)]},'activations':{'create':_0x522ff1[_0x4872de(0x22b)],'update':_0x536e56[_0x4872de(0x22b)],'delete':_0x38e6bf[_0x4872de(0x22b)]},'folders':_0x2016cd[_0x4872de(0x22b)]},'hasChanges':_0x5f2708||_0x4f9fde||_0x184720||_0x56c8ba};}export async function buildPushExecutionContext(_0x7166f9,_0xbcb80b,_0x43c71f,_0x4a131f,_0x2db60e,_0x535b5a){const _0x55850b=a142_0x5a306c,_0x39a91a=extractRootFolderId(_0x43c71f),{pathToId:_0x2323bf,idToPath:_0x4d22e6}=buildFolderMaps(_0x2db60e),_0x4e0220=buildSegmentNameToIdMap(_0x4a131f),_0x520ee9=new Map(),{batchAsync:_0x535e44}=await import(_0x55850b(0x27c)),[_0x168305,_0x5aa83d]=await Promise[_0x55850b(0x229)]([_0x7166f9['user'][_0x55850b(0x22c)](),_0x7166f9[_0x55850b(0x1fa)][_0x55850b(0x28a)](),((async()=>{!_0x535b5a&&_0x4a131f['length']>0x0&&await _0x535e44(_0x4a131f,async _0x4e7736=>{const _0x70257b=a142_0x7272,_0x2f4280=await _0x7166f9[_0x70257b(0x293)][_0x70257b(0x24c)](_0xbcb80b,_0x4e7736['id']);_0x520ee9[_0x70257b(0x1ab)](_0x4e7736['id'],_0x2f4280);});})())]),{emailToId:_0x5c2345,idToEmail:_0x4265b0}=_0x168305,_0x18c804=buildConnectionMaps(_0x5aa83d);return{'rootFolderId':_0x39a91a,'folderPathToId':_0x2323bf,'folderIdToPath':_0x4d22e6,'segmentNameToId':_0x4e0220,'activationsBySegmentId':_0x520ee9,'emailToIdMap':_0x5c2345,'idToEmailMap':_0x4265b0,'connectionNameToIdMap':_0x18c804[_0x55850b(0x2a2)],'connectionIdToNameMap':_0x18c804[_0x55850b(0x288)],'connectionNameToTypeMap':_0x18c804[_0x55850b(0x29c)]};}export function createPushYamlContextForBundle(_0x168ebf,_0x15d846,_0x249795,_0x5aa28b,_0xd35264,_0x2ab58d,_0x55e8e8,_0x4de4f9){const {existingLocalSegmentNames:_0x50c8db,localExpandedRuleToNames:_0x39a97e}=_0x5aa28b,_0x4c415a=new Set(),_0x1b591c=new Map(),_0x57909a=new Map(),_0x52cade=new Map(),_0x14cc1d=createJumpTargetCache(),_0x5313dc=new Map(),_0xcd687c=new Map(),_0x94a18c=new Set();let _0x18f02c;const _0xa2406=_0x180a5c=>{const _0x25ca33={'resolveSegment':async _0x2eb0ef=>{const _0x40bdbe=a142_0x7272,_0x54c653=_0x52cade[_0x40bdbe(0x219)](_0x2eb0ef);if(_0x54c653!==undefined)return{'name':_0x54c653,'isJourneyLocal':!![]};try{const _0x178d78=await fetchSegment(_0x168ebf,_0x15d846,_0x2eb0ef,_0x249795);if(!_0x178d78)throw new Error(_0x40bdbe(0x290));const _0x5ba408=generateJourneyLocalName(_0x178d78['name']),_0x41e071=_0x178d78['kind']===SEGMENT_KIND_JOURNEY&&_0x5ba408!==undefined;let _0x18d734=_0x178d78[_0x40bdbe(0x279)],_0x44f422;if(_0x41e071&&_0x178d78['rule']){const _0x16cdac=apiRuleToYaml(_0x178d78[_0x40bdbe(0x2ac)]);_0xcd687c['set'](_0x2eb0ef,_0x16cdac);const _0x1dc7a8=async _0x335d79=>{const _0x54ebb5=_0x40bdbe,_0xf929f3=collectSegmentRefsFromRule(_0x335d79);for(const _0x1bffbf of _0xf929f3){if(!_0xcd687c['has'](_0x1bffbf))try{const _0x5ae07d=await fetchSegment(_0x168ebf,_0x15d846,_0x1bffbf,_0x249795);if(_0x5ae07d?.[_0x54ebb5(0x2ac)]){const _0x2cda1f=apiRuleToYaml(_0x5ae07d[_0x54ebb5(0x2ac)]);_0xcd687c['set'](_0x1bffbf,_0x2cda1f),await _0x1dc7a8(_0x2cda1f);}}catch(_0x418d1d){logger[_0x54ebb5(0x1c0)](_0x54ebb5(0x27b)+_0x1bffbf+':\x20'+_0x418d1d);}}};await _0x1dc7a8(_0x16cdac);const _0x4c3e93=serializeExpandedRule(_0x16cdac,_0xcd687c),_0x524d86=_0x39a97e[_0x40bdbe(0x219)](_0x4c3e93);if(_0x524d86&&_0x524d86[_0x40bdbe(0x22b)]>0x0){const _0x57b49f=_0x1b591c[_0x40bdbe(0x219)](_0x4c3e93)||0x0,_0x501b32=_0x524d86[_0x57b49f]||_0x524d86[_0x524d86[_0x40bdbe(0x22b)]-0x1];_0x1b591c[_0x40bdbe(0x1ab)](_0x4c3e93,_0x57b49f+0x1),_0x18d734=_0x501b32,_0x4c415a[_0x40bdbe(0x1c8)](_0x18d734),_0x52cade[_0x40bdbe(0x1ab)](_0x2eb0ef,_0x18d734);const _0x85622b=await resolveRuleSegmentRefs(_0x16cdac,async _0x217e8a=>{const _0xf001fe=_0x40bdbe,_0x577461=_0x52cade[_0xf001fe(0x219)](_0x217e8a);if(_0x577461)return _0x577461;const _0x4467b9=await _0x18f02c[_0xf001fe(0x263)](_0x217e8a);return _0x4467b9[_0xf001fe(0x279)];});_0x44f422={'description':_0x178d78['description'],'rule':_0x85622b};}else{const _0x3149ec=_0x5313dc[_0x40bdbe(0x219)](_0x4c3e93);if(_0x3149ec)_0x18d734=_0x3149ec,_0x52cade[_0x40bdbe(0x1ab)](_0x2eb0ef,_0x18d734);else{if(_0x5ba408){let _0xca47e=_0x5ba408,_0x48f3d2=0x2;while(_0x4c415a['has'](_0xca47e)||_0x50c8db[_0x40bdbe(0x26b)](_0xca47e)){_0xca47e=_0x5ba408+'_'+_0x48f3d2,_0x48f3d2++;}_0x4c415a[_0x40bdbe(0x1c8)](_0xca47e),_0x18d734=_0xca47e;}_0x52cade[_0x40bdbe(0x1ab)](_0x2eb0ef,_0x18d734),_0x5313dc[_0x40bdbe(0x1ab)](_0x4c3e93,_0x18d734);const _0x46bebf=await resolveRuleSegmentRefs(_0x16cdac,async _0x4a7046=>{const _0x47a03d=_0x40bdbe,_0x411b31=_0x52cade['get'](_0x4a7046);if(_0x411b31)return _0x411b31;const _0x4f96d7=await _0x18f02c['resolveSegment'](_0x4a7046);return _0x4f96d7[_0x47a03d(0x279)];});_0x44f422={'description':_0x178d78['description'],'rule':_0x46bebf};}}}return{'name':_0x18d734,'isJourneyLocal':_0x41e071,'definition':_0x44f422};}catch(_0xaca879){return logger[_0x40bdbe(0x1c0)](_0x40bdbe(0x259)+_0x2eb0ef+':\x20'+_0xaca879),{'name':_0x2eb0ef,'isJourneyLocal':![]};}},'resolveActivation':async _0x1b34aa=>{const _0xd1ba67=a142_0x7272,_0x32d11d=_0x57909a['get'](_0x1b34aa);if(_0x32d11d!==undefined)return{'name':_0x32d11d,'isJourneyLocal':!![]};try{let _0x453985=_0x55e8e8?.[_0xd1ba67(0x219)](_0x1b34aa);!_0x453985&&(_0x453985=await _0x168ebf[_0xd1ba67(0x268)][_0xd1ba67(0x267)](_0x180a5c,_0x1b34aa));const _0x1f5272=_0x453985[_0xd1ba67(0x235)][_0xd1ba67(0x1d6)]['name']||_0x1b34aa,_0x1b48ab=sanitizeYamlKey(_0x1f5272)||'activation_'+_0x1b34aa,_0x103fcf=_0x1b48ab;_0x57909a[_0xd1ba67(0x1ab)](_0x1b34aa,_0x103fcf);const _0x26b6eb=journeyActivationStepToYaml(_0x453985,_0xd35264,_0x2ab58d);return{'name':_0x103fcf,'isJourneyLocal':!![],'definition':_0x26b6eb};}catch(_0x3cf270){return logger[_0xd1ba67(0x1c0)](_0xd1ba67(0x206)+_0x1b34aa+':\x20'+_0x3cf270),{'name':_0x1b34aa,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x17de77,_0x4fbb39)=>resolveJumpTarget(_0x17de77,_0x4fbb39,_0x14cc1d,async _0x4314f2=>{const _0x3e6fed=a142_0x7272,_0x3c5d30=_0x4de4f9?.['get'](_0x4314f2);if(_0x3c5d30)return _0x3c5d30;return _0x168ebf[_0x3e6fed(0x268)][_0x3e6fed(0x283)](_0x4314f2);})};return _0x18f02c=_0x25ca33,_0x25ca33;},_0x34d256=async _0xa1a51f=>{const _0x4acd99=a142_0x7272,{collectSegmentIdsFromJourneyApi:_0x4ada1e}=await import(_0x4acd99(0x266)),{batchAsync:_0xd28e7d}=await import('../../utils/async.js'),_0x56a1d6=new Set();for(const _0x1a7564 of _0xa1a51f){let _0x482ec2=_0x4de4f9?.[_0x4acd99(0x219)](_0x1a7564);!_0x482ec2&&(_0x482ec2=await _0x168ebf[_0x4acd99(0x268)][_0x4acd99(0x283)](_0x1a7564));const _0x17ffef=_0x4ada1e(_0x482ec2);for(const _0x17a7a7 of _0x17ffef){_0x56a1d6[_0x4acd99(0x1c8)](_0x17a7a7);}}let _0x346771=Array[_0x4acd99(0x1ae)](_0x56a1d6);while(_0x346771[_0x4acd99(0x22b)]>0x0){const _0x5b885e=_0x346771['filter'](_0x1f0bcf=>!_0x94a18c[_0x4acd99(0x26b)](_0x1f0bcf));if(_0x5b885e['length']===0x0)break;const _0x1fb634=await _0xd28e7d(_0x5b885e,async _0x59b727=>{const _0x31290b=_0x4acd99;_0x94a18c[_0x31290b(0x1c8)](_0x59b727);const _0x4ab05d=await fetchSegment(_0x168ebf,_0x15d846,_0x59b727,_0x249795);if(!_0x4ab05d)return null;return{'segmentId':_0x59b727,'segment':_0x4ab05d};},0xa),_0x163f6c=new Set();for(const _0x25f9c0 of _0x1fb634){if(!_0x25f9c0?.[_0x4acd99(0x293)]?.[_0x4acd99(0x2ac)])continue;const _0x3210de=apiRuleToYaml(_0x25f9c0[_0x4acd99(0x293)][_0x4acd99(0x2ac)]);_0xcd687c[_0x4acd99(0x1ab)](_0x25f9c0[_0x4acd99(0x21b)],_0x3210de);const _0x1e5d53=collectSegmentRefsFromRule(_0x3210de);for(const _0x25a92e of _0x1e5d53){!_0x94a18c['has'](_0x25a92e)&&_0x163f6c['add'](_0x25a92e);}}_0x346771=Array[_0x4acd99(0x1ae)](_0x163f6c);}};return{'createYamlContext':_0xa2406,'prefetchJourneySegments':_0x34d256};}export async function executePushSegments(_0x54f7fd,_0x331ee6,_0x532ab5,_0x1ee0bf,_0x203a75){const _0x524681=a142_0x5a306c,{segmentDefToCreateRequest:_0x5852ab,segmentDefToUpdateRequest:_0x46817b}=await import(_0x524681(0x1b6)),_0x3feaa1=_0x532ab5[_0x524681(0x1d7)],_0x57e9e6=0x5,_0x2a5666=async _0xa2b9df=>{const _0x3cec86=_0x524681,_0x170dbd=_0xa2b9df[_0x3cec86(0x1f3)]?_0x3feaa1['get'](_0xa2b9df['folderPath']):undefined;let _0x23a8df;const _0x4e2240={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x37e4d9=_0xa2b9df[_0x3cec86(0x20d)];if(_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x2ac)]){const _0x305b9c=createSegmentIdResolver(_0x532ab5[_0x3cec86(0x21c)],_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)]),_0x56e2f1=await resolveRuleSegmentIds(_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x2ac)],_0x305b9c);_0x37e4d9={..._0xa2b9df[_0x3cec86(0x20d)],'rule':_0x56e2f1};}try{if(_0xa2b9df['isNew']){_0x203a75[_0x3cec86(0x23b)]?.({'type':_0x3cec86(0x27f),'name':_0xa2b9df['yamlConfig'][_0x3cec86(0x279)]});const _0x22157c=_0x5852ab(_0x37e4d9,_0x170dbd),_0x2b84a1=await _0x203a75[_0x3cec86(0x1fc)](_0x3cec86(0x282)+_0xa2b9df['yamlConfig'][_0x3cec86(0x279)]+'\x27...',()=>_0x54f7fd[_0x3cec86(0x293)][_0x3cec86(0x2a5)](_0x1ee0bf[_0x3cec86(0x2b5)],_0x22157c));_0x23a8df=_0x2b84a1[_0x3cec86(0x298)]['id'],_0x532ab5[_0x3cec86(0x21c)]['set'](_0xa2b9df['yamlConfig'][_0x3cec86(0x279)],_0x23a8df),_0x4e2240[_0x3cec86(0x1f6)]={'name':_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)],'id':_0x23a8df},_0x203a75['onProgress']?.({'type':'segment_created','name':_0xa2b9df['yamlConfig'][_0x3cec86(0x279)],'segmentId':_0x23a8df}),_0x203a75[_0x3cec86(0x248)]?.(_0x3cec86(0x275)+_0xa2b9df['yamlConfig'][_0x3cec86(0x279)]+'\x27'),_0x4e2240[_0x3cec86(0x26d)]=0x1;}else{if(_0xa2b9df[_0x3cec86(0x289)]){_0x203a75[_0x3cec86(0x23b)]?.({'type':'segment_updating','name':_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)]});const _0x50ffb7=_0x46817b(_0x37e4d9);_0x170dbd!==_0xa2b9df[_0x3cec86(0x1f1)]?.[_0x3cec86(0x1cb)]&&(_0x50ffb7['segmentFolderId']=_0x170dbd?parseInt(_0x170dbd,0xa):undefined),await _0x203a75[_0x3cec86(0x1fc)](_0x3cec86(0x262)+_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)]+'\x27...',()=>_0x54f7fd['segment'][_0x3cec86(0x1ee)](_0x1ee0bf['parentId'],_0xa2b9df[_0x3cec86(0x1f1)]['id'],_0x50ffb7)),_0x23a8df=_0xa2b9df['existingSegment']['id'],_0x203a75[_0x3cec86(0x23b)]?.({'type':_0x3cec86(0x2b3),'name':_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)]}),_0x203a75[_0x3cec86(0x248)]?.(_0x3cec86(0x2a4)+_0xa2b9df['yamlConfig'][_0x3cec86(0x279)]+'\x27'),_0x4e2240[_0x3cec86(0x28b)]=0x1;}else _0x23a8df=_0xa2b9df[_0x3cec86(0x1f1)]['id'];}}catch(_0xc51819){const _0x1e37c8=isHttp400Error(_0xc51819),_0x3cf8b3=_0x1e37c8?ErrorCode[_0x3cec86(0x2a1)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x3613e1=getErrorMessage(_0xc51819);throw new SDKError(_0x3cf8b3,_0x3cec86(0x2a8)+(_0xa2b9df['isNew']?_0x3cec86(0x244):_0x3cec86(0x209))+_0x3cec86(0x27e)+_0xa2b9df[_0x3cec86(0x211)]+_0x3cec86(0x1e2)+_0x3613e1,_0xc51819);}try{const _0x1dad4b=await syncActivationsForSegment(_0x54f7fd,_0x1ee0bf[_0x3cec86(0x2b5)],_0x23a8df,_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)],_0xa2b9df[_0x3cec86(0x1cc)],_0x203a75,_0xa2b9df[_0x3cec86(0x211)]);_0x4e2240[_0x3cec86(0x212)]=_0x1dad4b;}catch(_0x44fef0){if(_0x44fef0 instanceof SDKError)throw _0x44fef0;throw new SDKError(ErrorCode[_0x3cec86(0x217)],_0x3cec86(0x1b3)+_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)]+_0x3cec86(0x1b0)+_0xa2b9df[_0x3cec86(0x211)]+'\x0a\x20\x20'+getErrorMessage(_0x44fef0),_0x44fef0);}return _0x4e2240;},_0x178c08=await batchAsync(_0x331ee6,_0x2a5666,_0x57e9e6),_0x19a18e={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x20e46e of _0x178c08){_0x19a18e['created']+=_0x20e46e[_0x524681(0x26d)],_0x19a18e['updated']+=_0x20e46e[_0x524681(0x28b)],_0x20e46e[_0x524681(0x1f6)]&&_0x19a18e[_0x524681(0x228)][_0x524681(0x1ab)](_0x20e46e[_0x524681(0x1f6)][_0x524681(0x279)],_0x20e46e[_0x524681(0x1f6)]['id']),_0x19a18e[_0x524681(0x212)][_0x524681(0x26d)]+=_0x20e46e[_0x524681(0x212)][_0x524681(0x26d)],_0x19a18e['activations'][_0x524681(0x28b)]+=_0x20e46e[_0x524681(0x212)][_0x524681(0x28b)],_0x19a18e[_0x524681(0x212)][_0x524681(0x270)]+=_0x20e46e[_0x524681(0x212)][_0x524681(0x270)];}return _0x19a18e;}async function syncActivationsForSegment(_0x55343f,_0x36f8a5,_0x1f594a,_0x128923,_0x578f88,_0x4efab1,_0x4215fc){const _0x5461c8=a142_0x5a306c,_0x3ec185={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xa89da9 of _0x578f88){try{if(_0xa89da9[_0x5461c8(0x1bc)]===_0x5461c8(0x244)&&_0xa89da9[_0x5461c8(0x23e)])_0x4efab1[_0x5461c8(0x23b)]?.({'type':_0x5461c8(0x201),'segmentName':_0x128923,'activationName':_0xa89da9[_0x5461c8(0x279)]}),await _0x4efab1[_0x5461c8(0x1fc)](_0x5461c8(0x245)+_0xa89da9[_0x5461c8(0x279)]+_0x5461c8(0x1ac),()=>_0x55343f[_0x5461c8(0x293)][_0x5461c8(0x23c)](_0x36f8a5,_0x1f594a,_0xa89da9[_0x5461c8(0x23e)])),_0x4efab1[_0x5461c8(0x23b)]?.({'type':_0x5461c8(0x22d),'segmentName':_0x128923,'activationName':_0xa89da9[_0x5461c8(0x279)]}),_0x4efab1[_0x5461c8(0x248)]?.(_0x5461c8(0x1fb)+_0xa89da9[_0x5461c8(0x279)]+'\x27'),_0x3ec185['created']++;else{if(_0xa89da9[_0x5461c8(0x1bc)]==='update'&&_0xa89da9['validatedRequest']&&_0xa89da9['existingActivation'])_0x4efab1[_0x5461c8(0x23b)]?.({'type':_0x5461c8(0x1ff),'segmentName':_0x128923,'activationName':_0xa89da9[_0x5461c8(0x279)]}),await _0x4efab1[_0x5461c8(0x1fc)](_0x5461c8(0x1fd)+_0xa89da9['name']+_0x5461c8(0x1ac),()=>_0x55343f['segment'][_0x5461c8(0x1c3)](_0x36f8a5,_0x1f594a,_0xa89da9[_0x5461c8(0x1fe)]['id'],_0xa89da9[_0x5461c8(0x23e)])),_0x4efab1[_0x5461c8(0x23b)]?.({'type':_0x5461c8(0x26e),'segmentName':_0x128923,'activationName':_0xa89da9[_0x5461c8(0x279)]}),_0x4efab1['logSuccess']?.(_0x5461c8(0x1b9)+_0xa89da9['name']+'\x27'),_0x3ec185[_0x5461c8(0x28b)]++;else _0xa89da9[_0x5461c8(0x1bc)]==='delete'&&_0xa89da9['existingActivation']&&(_0x4efab1['onProgress']?.({'type':'activation_deleting','segmentName':_0x128923,'activationName':_0xa89da9['name']}),await _0x4efab1[_0x5461c8(0x1fc)]('Deleting\x20activation\x20\x27'+_0xa89da9[_0x5461c8(0x279)]+_0x5461c8(0x1ac),()=>_0x55343f['segment'][_0x5461c8(0x1b2)](_0x36f8a5,_0x1f594a,_0xa89da9[_0x5461c8(0x1fe)]['id'])),_0x4efab1[_0x5461c8(0x23b)]?.({'type':'activation_deleted','segmentName':_0x128923,'activationName':_0xa89da9['name']}),_0x4efab1[_0x5461c8(0x27a)]?.(_0x5461c8(0x1f9)+_0xa89da9[_0x5461c8(0x279)]+'\x27'),_0x3ec185[_0x5461c8(0x270)]++);}}catch(_0x639184){const _0x323c71=isHttp400Error(_0x639184),_0x222562=_0x323c71?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x76dd99=getErrorMessage(_0x639184);throw new SDKError(_0x222562,_0x5461c8(0x2a8)+_0xa89da9['type']+_0x5461c8(0x24a)+_0xa89da9[_0x5461c8(0x279)]+_0x5461c8(0x1b0)+_0x4215fc+'\x0a\x20\x20'+_0x76dd99,_0x639184);}}return _0x3ec185;}export async function executePushFolders(_0x1ee3de,_0x432e67,_0x313f51,_0x2450f2,_0x40f426){const _0x44b6ae=a142_0x5a306c,_0x4cdc30=new Map(_0x313f51),_0x53e781=sortFoldersByDepth(_0x432e67);for(const _0x548b15 of _0x53e781){const _0xdaa378=_0x548b15['split']('/'),_0x2cae8d=_0xdaa378[_0xdaa378[_0x44b6ae(0x22b)]-0x1],_0x98f1fa=_0xdaa378[_0x44b6ae(0x25f)](0x0,-0x1)[_0x44b6ae(0x26a)]('/'),_0x347f8c=_0x4cdc30[_0x44b6ae(0x219)](_0x98f1fa);_0x40f426['onProgress']?.({'type':_0x44b6ae(0x271),'folder':_0x548b15});const _0x2ffd59={'name':_0x2cae8d,'parentFolderId':_0x347f8c},_0x304984=await _0x40f426[_0x44b6ae(0x1fc)](_0x44b6ae(0x1ce)+_0x548b15+'\x27...',()=>_0x1ee3de[_0x44b6ae(0x293)]['createFolder'](_0x2450f2['parentId'],_0x2ffd59));_0x4cdc30['set'](_0x548b15,_0x304984['data']['id']),_0x40f426[_0x44b6ae(0x23b)]?.({'type':_0x44b6ae(0x1da),'folder':_0x548b15,'folderId':_0x304984[_0x44b6ae(0x298)]['id']}),_0x40f426[_0x44b6ae(0x287)]?.(_0x44b6ae(0x1d3)+_0x548b15+'\x27');}return _0x4cdc30;}export async function executePushSegmentDeletions(_0x17b8d1,_0x56494c,_0x534bd1){const _0x2bcb69=a142_0x5a306c;if(_0x56494c[_0x2bcb69(0x22b)]===0x0)return 0x0;const {batchAsync:_0x292003}=await import(_0x2bcb69(0x27c)),_0x23a56f=0x5,_0x4766e7=await _0x292003(_0x56494c,async _0x5e6b1a=>{const _0x171bab=_0x2bcb69;return _0x534bd1[_0x171bab(0x23b)]?.({'type':_0x171bab(0x207),'name':_0x5e6b1a[_0x171bab(0x279)]}),await _0x17b8d1[_0x171bab(0x293)][_0x171bab(0x222)](_0x5e6b1a['id']),_0x534bd1[_0x171bab(0x23b)]?.({'type':_0x171bab(0x1e1),'name':_0x5e6b1a[_0x171bab(0x279)]}),_0x534bd1[_0x171bab(0x27a)]?.('Deleted\x20segment\x20\x27'+_0x5e6b1a[_0x171bab(0x279)]+'\x27'),0x1;},_0x23a56f);return _0x4766e7[_0x2bcb69(0x272)]((_0x4f7c8b,_0x48a71e)=>_0x4f7c8b+_0x48a71e,0x0);}export async function executePushJourneys(_0x5cd9b2,_0x213369,_0x55b26d,_0x2bbe6b,_0x2ffd90){const _0x2bde97=a142_0x5a306c,{journeyDefToRequest:_0x411007}=await import(_0x2bde97(0x266)),{activationDefToCreateRequest:_0x2c3ac9,yamlRuleToApi:_0x283244,validateSegmentRule:_0x5e7b95}=await import(_0x2bde97(0x1b6)),_0x5c57a2={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4d8251=new Map(_0x55b26d[_0x2bde97(0x21c)]),_0x395c30=0x5;for(let _0x46364c=0x0;_0x46364c<_0x213369[_0x2bde97(0x22b)];_0x46364c+=_0x395c30){const _0x50148a=_0x213369['slice'](_0x46364c,_0x46364c+_0x395c30),_0x577faa=await Promise[_0x2bde97(0x229)](_0x50148a[_0x2bde97(0x26f)](async _0x30f2f5=>{const _0x5c477a=_0x2bde97;if(!_0x30f2f5[_0x5c477a(0x292)]&&!_0x30f2f5[_0x5c477a(0x289)])return{'action':_0x5c477a(0x264),'name':_0x30f2f5['yamlConfig']['name'],'journeyId':_0x30f2f5[_0x5c477a(0x256)]?.['id']};const _0x394b66=_0x30f2f5[_0x5c477a(0x1f3)]?_0x55b26d[_0x5c477a(0x1d7)][_0x5c477a(0x219)](_0x30f2f5[_0x5c477a(0x1f3)]):undefined;_0x2ffd90[_0x5c477a(0x23b)]?.({'type':_0x30f2f5[_0x5c477a(0x292)]?_0x5c477a(0x1e3):'journey_updating','name':_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)]});try{const _0x334b22=await executeSingleJourneyPush(_0x5cd9b2,_0x30f2f5,{..._0x55b26d,'segmentNameToId':_0x4d8251},{'parentId':_0x2bbe6b[_0x5c477a(0x2b5)],'rootFolderId':_0x2bbe6b[_0x5c477a(0x2aa)],'folderId':_0x394b66,'verbose':_0x2bbe6b[_0x5c477a(0x1d5)]},_0x2ffd90,{'journeyDefToRequest':_0x411007,'activationDefToCreateRequest':_0x2c3ac9,'yamlRuleToApi':_0x283244,'validateSegmentRule':_0x5e7b95});for(const [_0x3786b5,_0x3815a9]of _0x334b22[_0x5c477a(0x25c)]){_0x4d8251[_0x5c477a(0x1ab)](_0x3786b5,_0x3815a9),_0x5c57a2[_0x5c477a(0x25c)][_0x5c477a(0x1ab)](_0x3786b5,_0x3815a9);}if(_0x334b22[_0x5c477a(0x261)]===_0x5c477a(0x26d))_0x2ffd90[_0x5c477a(0x23b)]?.({'type':'journey_created','name':_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)],'journeyId':_0x334b22['journeyId']}),_0x2ffd90[_0x5c477a(0x248)]?.(_0x5c477a(0x294)+_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)]+'\x27'),_0x5c57a2[_0x5c477a(0x26d)]++;else _0x334b22[_0x5c477a(0x261)]===_0x5c477a(0x28b)&&(_0x2ffd90['onProgress']?.({'type':'journey_updated','name':_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)]}),_0x2ffd90[_0x5c477a(0x248)]?.(_0x5c477a(0x253)+_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)]+'\x27'),_0x5c57a2[_0x5c477a(0x28b)]++);return{'action':_0x334b22[_0x5c477a(0x261)],'name':_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)],'journeyId':_0x334b22['journeyId']};}catch(_0x437415){const _0x2a6ee9=isHttp400Error(_0x437415),_0x57c97d=_0x2a6ee9?ErrorCode[_0x5c477a(0x1c6)]:ErrorCode[_0x5c477a(0x21e)],_0x2e6ee1=getErrorMessage(_0x437415);throw new SDKError(_0x57c97d,_0x5c477a(0x2a8)+(_0x30f2f5[_0x5c477a(0x292)]?_0x5c477a(0x244):_0x5c477a(0x209))+_0x5c477a(0x1e4)+_0x30f2f5[_0x5c477a(0x211)]+_0x5c477a(0x1e2)+_0x2e6ee1,_0x437415);}}));_0x5c57a2[_0x2bde97(0x236)][_0x2bde97(0x25e)](..._0x577faa);}return _0x5c57a2;}async function matchExistingJourneySegments(_0x25b8d6,_0x44173d,_0x342fd5,_0x4c6dd4,_0x46c111){const _0x5e9559=a142_0x5a306c;if(!_0x44173d[_0x5e9559(0x256)]||!_0x44173d[_0x5e9559(0x20d)][_0x5e9559(0x274)])return;const _0x203aa4=new Map(),_0x5b5d87=new Set();for(const _0x3ddd1d of Object[_0x5e9559(0x21a)](_0x44173d[_0x5e9559(0x20d)][_0x5e9559(0x274)])){const _0x3498cb=generateDeterministicJourneySegmentName(_0x44173d[_0x5e9559(0x20d)]['name'],_0x3ddd1d);_0x203aa4[_0x5e9559(0x1ab)](_0x3498cb,_0x3ddd1d),_0x5b5d87['add'](_0x3ddd1d);}const _0x4c44e3=[],_0x315004=collectSegmentIdsFromJourneyApi(_0x44173d[_0x5e9559(0x256)]);for(const _0x33e9d8 of _0x315004){const _0x243bcf=await fetchSegment(_0x25b8d6,_0x342fd5,_0x33e9d8,_0x4c6dd4);if(!_0x243bcf?.[_0x5e9559(0x279)])continue;const _0x89685e=_0x203aa4[_0x5e9559(0x219)](_0x243bcf[_0x5e9559(0x279)]);_0x89685e?(_0x46c111[_0x5e9559(0x1ab)](_0x89685e,_0x33e9d8),_0x5b5d87['delete'](_0x89685e)):_0x4c44e3[_0x5e9559(0x25e)]({'id':_0x33e9d8,'seg':_0x243bcf});}if(_0x5b5d87[_0x5e9559(0x208)]>0x0&&_0x4c44e3[_0x5e9559(0x22b)]>0x0){const {localExpandedRuleToNames:_0x228fd0}=buildLocalExpandedRuleMappings(_0x44173d[_0x5e9559(0x20d)]),_0x25bc2f=new Map();for(const {id:_0x2dcf1b,seg:_0xf13506}of _0x4c44e3){if(_0xf13506[_0x5e9559(0x2ac)]){const _0x30680a=apiRuleToYaml(_0xf13506[_0x5e9559(0x2ac)]);_0x25bc2f[_0x5e9559(0x1ab)](_0x2dcf1b,_0x30680a);}}for(const {id:_0x15b6f5,seg:_0x32e59e}of _0x4c44e3){if(!_0x32e59e[_0x5e9559(0x2ac)])continue;const _0x773cd6=_0x25bc2f[_0x5e9559(0x219)](_0x15b6f5);if(!_0x773cd6)continue;const _0x31f5df=serializeExpandedRule(_0x773cd6,_0x25bc2f),_0x57b7ea=_0x228fd0[_0x5e9559(0x219)](_0x31f5df);if(_0x57b7ea){const _0xf0436f=_0x57b7ea[_0x5e9559(0x216)](_0x37efe4=>_0x5b5d87[_0x5e9559(0x26b)](_0x37efe4));_0xf0436f&&(_0x46c111[_0x5e9559(0x1ab)](_0xf0436f,_0x15b6f5),_0x5b5d87['delete'](_0xf0436f),logger[_0x5e9559(0x1c0)](_0x5e9559(0x1ea)+_0x32e59e[_0x5e9559(0x279)]+_0x5e9559(0x200)+_0xf0436f+_0x5e9559(0x258)));}}}}async function executeSingleJourneyPush(_0x469cd5,_0xed8866,_0xd380cd,_0x59a74c,_0x46f8be,_0xc0b28f){const _0x395fd4=a142_0x5a306c,{journeyDefToRequest:_0x3e4824,activationDefToCreateRequest:_0x492e4b,yamlRuleToApi:_0x173cce,validateSegmentRule:_0x5ed4b4}=_0xc0b28f,_0x4f0fcb=new Map(),_0x150810=new Map();recoverSegmentIdsFromPushRecovery(_0xed8866,_0x4f0fcb,_0xd380cd['segmentNameToId']);const _0x5dddb7=new Map(),_0x22020c=new Map(),_0x525947=new Map();let _0x99b9d1;const _0x5a0519=async()=>{const _0x3aaea0=a142_0x7272;if(_0x99b9d1)return;_0x99b9d1=new Map();if(!_0xed8866[_0x3aaea0(0x256)])return;const _0x5d44b5=await _0x469cd5['journey'][_0x3aaea0(0x24c)](_0xed8866[_0x3aaea0(0x256)]['id']);for(const _0x4b8a09 of _0x5d44b5){const _0x40256d=journeyActivationStepToYaml(_0x4b8a09,_0xd380cd['idToEmailMap'],_0xd380cd[_0x3aaea0(0x24e)]),_0x5f0c27=activationSignature(_0x40256d);!_0x99b9d1[_0x3aaea0(0x26b)](_0x5f0c27)&&_0x99b9d1[_0x3aaea0(0x1ab)](_0x5f0c27,_0x4b8a09['id']),_0x40256d['name']&&_0x150810[_0x3aaea0(0x1ab)](_0x40256d['name'],_0x4b8a09['id']);}};await matchExistingJourneySegments(_0x469cd5,_0xed8866,_0x59a74c[_0x395fd4(0x2b5)],_0xd380cd[_0x395fd4(0x1c2)],_0xd380cd[_0x395fd4(0x21c)]);const _0x473882={'resolveSegmentId':async _0x403950=>{const _0x1617f3=_0x395fd4,_0x187ef0=_0xd380cd[_0x1617f3(0x21c)][_0x1617f3(0x219)](_0x403950);if(!_0x187ef0)throw new SDKError(ErrorCode[_0x1617f3(0x295)],_0x1617f3(0x276)+_0x403950+'\x20(referenced\x20in\x20journey\x20'+_0xed8866[_0x1617f3(0x20d)][_0x1617f3(0x279)]+')');return _0x187ef0;},'resolveEmbeddedSegmentId':async(_0x5de2fe,_0x2b29c9)=>{const _0x29f0a4=_0x395fd4,_0x3df736=_0xd380cd['segmentNameToId']['get'](_0x5de2fe);if(_0x3df736)return _0x3df736;const _0x16c795=_0xd380cd[_0x29f0a4(0x1c2)][_0x29f0a4(0x216)](_0x2fd84f=>_0x2fd84f['name']===_0x5de2fe);if(_0x16c795)return _0xd380cd[_0x29f0a4(0x21c)]['set'](_0x5de2fe,_0x16c795['id']),_0x16c795['id'];if(_0xed8866['isNew']){const {stageName:_0x5c1e0c,criteriaName:_0x11276d}=findSegmentCriteriaLocation(_0xed8866[_0x29f0a4(0x20d)],_0x5de2fe);return _0x5ed4b4(_0x5de2fe,_0x2b29c9[_0x29f0a4(0x2ac)]),_0x22020c[_0x29f0a4(0x1ab)](_0x5de2fe,{'definition':_0x2b29c9,'stageName':_0x5c1e0c,'criteriaName':_0x11276d}),createPendingSegmentId(_0x5de2fe);}const _0x3bb3a5=_0xed8866[_0x29f0a4(0x256)]?.['id'];if(!_0x3bb3a5)throw new SDKError(ErrorCode[_0x29f0a4(0x22f)],_0x29f0a4(0x1cf));const _0x2c87c4=_0x5dddb7['get'](_0x5de2fe);if(_0x2c87c4)return _0x2c87c4;const _0x339150=((async()=>{const _0x5bccdb=_0x29f0a4;_0x5ed4b4(_0x5de2fe,_0x2b29c9['rule']);const _0x4f0f62=generateDeterministicJourneySegmentName(_0xed8866[_0x5bccdb(0x20d)][_0x5bccdb(0x279)],_0x5de2fe),_0x77c0ea=_0xd380cd[_0x5bccdb(0x1c2)][_0x5bccdb(0x216)](_0x27b25a=>_0x27b25a[_0x5bccdb(0x279)]===_0x4f0f62),_0x693feb=createSegmentIdResolver(_0xd380cd[_0x5bccdb(0x21c)],_0x5de2fe),_0x4d8542=await resolveRuleSegmentIds(_0x2b29c9['rule'],_0x693feb);let _0x4809da;return _0x77c0ea?(await _0x469cd5[_0x5bccdb(0x293)][_0x5bccdb(0x1ee)](_0x59a74c[_0x5bccdb(0x2b5)],_0x77c0ea['id'],{'description':_0x2b29c9[_0x5bccdb(0x1ba)]||_0x5bccdb(0x1b1)+_0x5de2fe,'rule':_0x173cce(_0x4d8542,!![]),'countPopulation':!![]}),_0x4809da=_0x77c0ea['id'],saveSegmentToPushRecovery(_0xed8866[_0x5bccdb(0x211)],_0xed8866[_0x5bccdb(0x20d)]['name'],_0x5de2fe,{'segmentId':_0x4809da,'uniqueServerName':_0x4f0f62,'createdAt':new Date()[_0x5bccdb(0x29f)]()})):_0x4809da=await createOrRecoverEmbeddedSegment(_0x469cd5,_0xed8866,{'localName':_0x5de2fe,'uniqueSegmentName':_0x4f0f62,'description':_0x2b29c9['description']||_0x5bccdb(0x1b1)+_0x5de2fe,'journeyId':_0x3bb3a5,'resolvedRule':_0x4d8542,'parentId':_0x59a74c['parentId'],'folderId':_0x59a74c['rootFolderId']||''},_0x173cce),_0xd380cd[_0x5bccdb(0x21c)][_0x5bccdb(0x1ab)](_0x5de2fe,_0x4809da),_0x4f0fcb[_0x5bccdb(0x1ab)](_0x5de2fe,_0x4809da),_0x4809da;})());_0x5dddb7[_0x29f0a4(0x1ab)](_0x5de2fe,_0x339150);try{return await _0x339150;}finally{_0x5dddb7[_0x29f0a4(0x1e8)](_0x5de2fe);}},'resolveActivationId':async _0x1f864c=>{const _0x3c3503=_0x395fd4,_0x444cd4=_0x150810['get'](_0x1f864c);if(_0x444cd4)return _0x444cd4;if(_0xed8866[_0x3c3503(0x256)]){await _0x5a0519();const _0x38a4f3=_0x150810[_0x3c3503(0x219)](_0x1f864c);if(_0x38a4f3)return _0x38a4f3;}throw new SDKError(ErrorCode['NOT_FOUND'],'Activation\x20not\x20found:\x20'+_0x1f864c+'\x20(referenced\x20in\x20journey\x20'+_0xed8866['yamlConfig'][_0x3c3503(0x279)]+_0x3c3503(0x1b5)+_0x3c3503(0x203));},'resolveEmbeddedActivationId':async(_0x2264c1,_0x71819)=>{const _0x5a5ae9=_0x395fd4,_0x2def73=_0x150810['get'](_0x2264c1);if(_0x2def73)return _0x2def73;if(_0xed8866[_0x5a5ae9(0x292)])return _0x525947[_0x5a5ae9(0x1ab)](_0x2264c1,_0x71819),createPendingActivationId(_0x2264c1);if(_0xed8866['existingJourney']){await _0x5a0519();const _0x36e78e=_0x150810[_0x5a5ae9(0x219)](_0x71819['name']);if(_0x36e78e)return _0x150810['set'](_0x2264c1,_0x36e78e),_0x36e78e;const _0x3e745f=activationSignature(_0x71819),_0x49b7de=_0x99b9d1?.[_0x5a5ae9(0x219)](_0x3e745f);if(_0x49b7de)return _0x150810[_0x5a5ae9(0x1ab)](_0x2264c1,_0x49b7de),_0x49b7de;const _0x41ae00=await _0x492e4b(_0x71819,_0xd380cd[_0x5a5ae9(0x1cd)]),_0x4af30a={..._0x41ae00,..._0x71819['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x71819['run_after_journey_refresh']}},_0x2a3765=await _0x469cd5['journey'][_0x5a5ae9(0x23c)](_0xed8866[_0x5a5ae9(0x256)]['id'],_0x4af30a);return _0x150810[_0x5a5ae9(0x1ab)](_0x2264c1,_0x2a3765['id']),_0x2a3765['id'];}throw new SDKError(ErrorCode[_0x5a5ae9(0x22f)],_0x5a5ae9(0x1ef));},'resolveJourneyId':async _0x4d05b5=>{const _0x29a4ea=_0x395fd4;try{return await _0x469cd5[_0x29a4ea(0x268)][_0x29a4ea(0x1c4)](_0x59a74c['parentId'],_0x4d05b5);}catch(_0x3f4e53){throw new SDKError(ErrorCode['NOT_FOUND'],_0x29a4ea(0x1f2)+_0x4d05b5+_0x29a4ea(0x1c9)+_0xed8866[_0x29a4ea(0x20d)][_0x29a4ea(0x279)]+'\x27)',_0x3f4e53);}},'resolveStageId':async(_0x306bd9,_0x3eb23d)=>{const _0xb9af77=_0x395fd4,_0x1df470=await _0x469cd5[_0xb9af77(0x268)]['getJourney'](_0x306bd9),_0x149fa5=_0x1df470[_0xb9af77(0x235)][_0xb9af77(0x21f)][_0xb9af77(0x216)](_0x32b7ed=>_0x32b7ed['name'][_0xb9af77(0x1bf)]()===_0x3eb23d[_0xb9af77(0x1bf)]());if(!_0x149fa5?.['id'])throw new SDKError(ErrorCode[_0xb9af77(0x1d9)],_0xb9af77(0x1f5)+_0x3eb23d+_0xb9af77(0x25d)+(_0x1df470[_0xb9af77(0x235)]['journeyBundleName']||_0x1df470[_0xb9af77(0x235)][_0xb9af77(0x279)])+'\x27');return _0x149fa5['id'];}},_0x42c89c=await _0x3e4824(_0xed8866[_0x395fd4(0x20d)],_0x59a74c['parentId'],_0x473882),_0x4ceb27=_0x59a74c[_0x395fd4(0x1ad)]||_0x59a74c[_0x395fd4(0x2aa)];_0x4ceb27&&(_0x42c89c['relationships']={'parentFolder':{'data':{'id':_0x4ceb27,'type':_0x395fd4(0x29e)}}});if(_0xed8866['isNew']){if(_0x22020c[_0x395fd4(0x208)]>0x0||_0x525947['size']>0x0)return await executeThreeStepJourneyCreate(_0x469cd5,_0xed8866,_0x42c89c,{'pendingEmbeddedSegments':_0x22020c,'pendingEmbeddedActivations':_0x525947,'embeddedSegmentNameToId':_0x4f0fcb,'journeyActivationNameToId':_0x150810},{..._0x59a74c,'effectiveFolderId':_0x4ceb27},_0xd380cd,_0x46f8be,_0xc0b28f);else{ensureJourneyDefaults(_0x42c89c[_0x395fd4(0x235)]);const _0x23dbb7=await _0x469cd5['journey'][_0x395fd4(0x244)](_0x42c89c);return deletePushRecovery(_0xed8866[_0x395fd4(0x211)]),{'action':_0x395fd4(0x26d),'journeyId':_0x23dbb7['id'],'embeddedSegmentNameToId':_0x4f0fcb};}}else{if(_0xed8866['hasChanges']&&_0xed8866[_0x395fd4(0x256)]){_0x42c89c['id']=_0xed8866[_0x395fd4(0x256)]['id'];const _0x51ff19=_0x42c89c[_0x395fd4(0x235)];_0xed8866[_0x395fd4(0x256)][_0x395fd4(0x235)]?.[_0x395fd4(0x20e)]&&(_0x51ff19[_0x395fd4(0x20e)]=_0xed8866[_0x395fd4(0x256)]['attributes'][_0x395fd4(0x20e)]);const _0x243bf0=_0xed8866[_0x395fd4(0x256)][_0x395fd4(0x235)]?.[_0x395fd4(0x21f)];return _0x243bf0&&_0x42c89c['attributes']['journeyStages']&&injectExistingStageIds(_0x42c89c[_0x395fd4(0x235)]['journeyStages'],_0x243bf0),ensureJourneyDefaults(_0x51ff19),await _0x469cd5['journey']['update'](_0xed8866[_0x395fd4(0x256)]['id'],_0x42c89c),deletePushRecovery(_0xed8866[_0x395fd4(0x211)]),{'action':_0x395fd4(0x28b),'journeyId':_0xed8866[_0x395fd4(0x256)]['id'],'embeddedSegmentNameToId':_0x4f0fcb};}}return deletePushRecovery(_0xed8866[_0x395fd4(0x211)]),{'action':_0x395fd4(0x264),'journeyId':_0xed8866[_0x395fd4(0x256)]?.['id'],'embeddedSegmentNameToId':_0x4f0fcb};}function findSegmentCriteriaLocation(_0x2e7807,_0x1ec05a){const _0xc4b345=a142_0x5a306c,_0x36586d=_0x2e7807[_0xc4b345(0x2b1)]||_0x2e7807['journeys']?.[0x0]?.[_0xc4b345(0x2b1)]||[];let _0x5d0c47=_0xc4b345(0x1e9),_0xf583f6=_0x1ec05a;const _0x3573f6=_0x2e7807[_0xc4b345(0x1f4)]||_0x2e7807[_0xc4b345(0x1c5)]?.[0x0]?.[_0xc4b345(0x1f4)];if(_0x3573f6?.[_0xc4b345(0x293)]===_0x1ec05a)return{'stageName':_0xc4b345(0x1f4),'criteriaName':_0x3573f6['name']||_0x1ec05a};_0x33382c:for(const _0x575337 of _0x36586d){if(_0x575337['entry_criteria']?.[_0xc4b345(0x293)]===_0x1ec05a){_0x5d0c47=_0x575337[_0xc4b345(0x279)],_0xf583f6=_0x575337[_0xc4b345(0x1d0)][_0xc4b345(0x279)]||_0x1ec05a;break;}if(_0x575337[_0xc4b345(0x249)])for(const _0x136f5a of _0x575337[_0xc4b345(0x249)]){if(_0x136f5a[_0xc4b345(0x1bc)]===_0xc4b345(0x28c)&&_0x136f5a[_0xc4b345(0x234)]?.['branches'])for(const _0x59dcc5 of _0x136f5a['with'][_0xc4b345(0x2af)]){if(_0x59dcc5[_0xc4b345(0x293)]===_0x1ec05a){_0x5d0c47=_0x575337['name'],_0xf583f6=_0x59dcc5[_0xc4b345(0x279)]||_0x1ec05a;break _0x33382c;}}}}return{'stageName':_0x5d0c47,'criteriaName':_0xf583f6};}async function executeThreeStepJourneyCreate(_0x2891ad,_0x457760,_0x27a347,_0x4ef0c2,_0x7a5f41,_0x3ca15f,_0x5a408c,_0xce49bf){const _0x3422ef=a142_0x5a306c,{activationDefToCreateRequest:_0x2a392a,yamlRuleToApi:_0x222641}=_0xce49bf,{pendingEmbeddedSegments:_0x47ee2b,pendingEmbeddedActivations:_0x226a35,embeddedSegmentNameToId:_0x2ba869}=_0x4ef0c2,_0x2caddd=JSON['parse'](JSON[_0x3422ef(0x25b)](_0x27a347));ensureJourneyDefaults(_0x2caddd[_0x3422ef(0x235)]),stripPendingIds(_0x2caddd);const _0x91e7a=await _0x2891ad[_0x3422ef(0x268)][_0x3422ef(0x244)](_0x2caddd),_0x5239da=_0x91e7a['id'],_0x15c939=new Map();for(const _0x51e899 of _0x91e7a[_0x3422ef(0x235)]['journeyStages']){_0x15c939[_0x3422ef(0x1ab)](_0x51e899[_0x3422ef(0x279)][_0x3422ef(0x1bf)](),_0x51e899['id']);}recoverSegmentIdsFromPushRecovery(_0x457760,_0x2ba869,_0x3ca15f[_0x3422ef(0x21c)]);for(const [_0x37a80c,{definition:_0x31a9cc}]of _0x47ee2b){if(_0x2ba869['has'](_0x37a80c)){_0x5a408c[_0x3422ef(0x23b)]?.({'type':'embedded_segment_created','journeyName':_0x457760[_0x3422ef(0x20d)][_0x3422ef(0x279)],'segmentName':_0x37a80c});continue;}const _0x5baf36=generateDeterministicJourneySegmentName(_0x457760['yamlConfig']['name'],_0x37a80c);_0x5a408c[_0x3422ef(0x23b)]?.({'type':'embedded_segment_creating','journeyName':_0x457760[_0x3422ef(0x20d)]['name'],'segmentName':_0x37a80c});const _0x3a4cf0=createSegmentIdResolver(_0x3ca15f[_0x3422ef(0x21c)],_0x37a80c),_0x44fddf=await resolveRuleSegmentIds(_0x31a9cc[_0x3422ef(0x2ac)],_0x3a4cf0),_0x564b19=await createOrRecoverEmbeddedSegment(_0x2891ad,_0x457760,{'localName':_0x37a80c,'uniqueSegmentName':_0x5baf36,'description':_0x31a9cc[_0x3422ef(0x1ba)]||_0x3422ef(0x1b1)+_0x37a80c,'journeyId':_0x5239da,'resolvedRule':_0x44fddf,'parentId':_0x7a5f41[_0x3422ef(0x2b5)],'folderId':_0x7a5f41[_0x3422ef(0x23f)]||''},_0x222641);_0x2ba869['set'](_0x37a80c,_0x564b19),_0x3ca15f[_0x3422ef(0x21c)][_0x3422ef(0x1ab)](_0x37a80c,_0x564b19),_0x5a408c[_0x3422ef(0x23b)]?.({'type':_0x3422ef(0x230),'journeyName':_0x457760[_0x3422ef(0x20d)][_0x3422ef(0x279)],'segmentName':_0x37a80c});}const _0x4b4f1c=new Map();for(const [_0x5595ae,_0x160930]of _0x226a35){_0x5a408c[_0x3422ef(0x23b)]?.({'type':_0x3422ef(0x2a9),'journeyName':_0x457760['yamlConfig'][_0x3422ef(0x279)],'activationName':_0x5595ae});const _0x3a38d1=await _0x2a392a(_0x160930,_0x3ca15f[_0x3422ef(0x1cd)]),_0x1996a0={..._0x3a38d1,..._0x160930['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x160930[_0x3422ef(0x1be)]}},_0x43ef5d=await _0x2891ad[_0x3422ef(0x268)]['createActivation'](_0x5239da,_0x1996a0);_0x4b4f1c[_0x3422ef(0x1ab)](_0x5595ae,_0x43ef5d['id']),_0x4ef0c2[_0x3422ef(0x29d)]['set'](_0x5595ae,_0x43ef5d['id']),_0x5a408c['onProgress']?.({'type':_0x3422ef(0x252),'journeyName':_0x457760[_0x3422ef(0x20d)]['name'],'activationName':_0x5595ae});}const _0x537a25=JSON[_0x3422ef(0x281)](JSON['stringify'](_0x27a347));return _0x537a25['id']=_0x5239da,ensureJourneyDefaults(_0x537a25[_0x3422ef(0x235)]),resolvePendingIdsInRequest(_0x537a25,_0x27a347,_0x15c939,_0x2ba869,_0x4b4f1c,_0x5a408c),await _0x2891ad[_0x3422ef(0x268)][_0x3422ef(0x209)](_0x5239da,_0x537a25),deletePushRecovery(_0x457760[_0x3422ef(0x211)]),{'action':_0x3422ef(0x26d),'journeyId':_0x5239da,'embeddedSegmentNameToId':_0x2ba869};}export function stripWaitStepPendingIds(_0x5f39ee){const _0x58a702=a142_0x5a306c,_0x19d704=_0x5f39ee['conditionSegmentId']&&isPendingSegmentId(_0x5f39ee[_0x58a702(0x2ad)]),_0x215287=_0x5f39ee[_0x58a702(0x21d)]?.[_0x58a702(0x269)](_0x5b755d=>_0x5b755d[_0x58a702(0x21b)]&&isPendingSegmentId(_0x5b755d['segmentId']));(_0x19d704||_0x215287)&&(_0x5f39ee[_0x58a702(0x20f)]='Duration',_0x5f39ee[_0x58a702(0x1dc)]=0x1,_0x5f39ee[_0x58a702(0x1f0)]='day',delete _0x5f39ee[_0x58a702(0x2ad)],delete _0x5f39ee[_0x58a702(0x1db)],delete _0x5f39ee[_0x58a702(0x278)],delete _0x5f39ee['conditions']);}export function resolveWaitStepPendingIds(_0x4e4be2,_0x1c4d88,_0x229ccf,_0x87fa72){const _0x2a9ad2=a142_0x5a306c;if(_0x1c4d88['conditionSegmentId']&&isPendingSegmentId(_0x1c4d88[_0x2a9ad2(0x2ad)])){const _0x4c1841=_0x229ccf(_0x1c4d88[_0x2a9ad2(0x2ad)],_0x2a9ad2(0x254)+_0x87fa72+_0x2a9ad2(0x238));_0x4c1841&&(_0x4e4be2[_0x2a9ad2(0x20f)]=_0x2a9ad2(0x233),_0x4e4be2[_0x2a9ad2(0x2ad)]=_0x4c1841,delete _0x4e4be2[_0x2a9ad2(0x1dc)],delete _0x4e4be2[_0x2a9ad2(0x1f0)],_0x1c4d88['conditionTimeoutDuration']!==undefined&&(_0x4e4be2[_0x2a9ad2(0x1db)]=_0x1c4d88[_0x2a9ad2(0x1db)]),_0x1c4d88[_0x2a9ad2(0x278)]&&(_0x4e4be2[_0x2a9ad2(0x278)]=_0x1c4d88[_0x2a9ad2(0x278)]));}if(_0x1c4d88[_0x2a9ad2(0x21d)]){const _0x3d9dc1=_0x1c4d88[_0x2a9ad2(0x21d)][_0x2a9ad2(0x269)](_0x2f0cd2=>_0x2f0cd2[_0x2a9ad2(0x21b)]&&isPendingSegmentId(_0x2f0cd2[_0x2a9ad2(0x21b)]));if(_0x3d9dc1){const _0x5aabfa=_0x1c4d88[_0x2a9ad2(0x21d)][_0x2a9ad2(0x26f)](_0x26c61e=>{const _0x535f90=_0x2a9ad2;if(_0x26c61e[_0x535f90(0x21b)]&&isPendingSegmentId(_0x26c61e['segmentId'])){const _0x25c8ce=_0x229ccf(_0x26c61e[_0x535f90(0x21b)],_0x535f90(0x254)+_0x87fa72+_0x535f90(0x238));return{..._0x26c61e,'segmentId':_0x25c8ce||_0x26c61e[_0x535f90(0x21b)]};}return{..._0x26c61e};});_0x4e4be2[_0x2a9ad2(0x20f)]='Condition',_0x4e4be2[_0x2a9ad2(0x21d)]=_0x5aabfa,delete _0x4e4be2['waitStep'],delete _0x4e4be2[_0x2a9ad2(0x1f0)],delete _0x4e4be2[_0x2a9ad2(0x2ad)],delete _0x4e4be2[_0x2a9ad2(0x1db)],delete _0x4e4be2[_0x2a9ad2(0x278)];}}}function stripPendingIds(_0x4bb7db){const _0x557559=a142_0x5a306c;_0x4bb7db[_0x557559(0x235)][_0x557559(0x1f4)]?.[_0x557559(0x21b)]&&isPendingSegmentId(_0x4bb7db['attributes']['goal'][_0x557559(0x21b)])&&delete _0x4bb7db[_0x557559(0x235)][_0x557559(0x1f4)];for(const _0x4bba76 of _0x4bb7db[_0x557559(0x235)][_0x557559(0x21f)]||[]){_0x4bba76[_0x557559(0x2b4)]?.['segmentId']&&isPendingSegmentId(_0x4bba76['entryCriteria'][_0x557559(0x21b)])&&delete _0x4bba76[_0x557559(0x2b4)];_0x4bba76[_0x557559(0x239)]?.[_0x557559(0x21b)]&&isPendingSegmentId(_0x4bba76[_0x557559(0x239)][_0x557559(0x21b)])&&delete _0x4bba76[_0x557559(0x239)];_0x4bba76[_0x557559(0x285)]&&(_0x4bba76[_0x557559(0x285)]=_0x4bba76[_0x557559(0x285)]['filter'](_0x540d63=>!_0x540d63['segmentId']||!isPendingSegmentId(_0x540d63['segmentId'])));if(_0x4bba76[_0x557559(0x249)])for(const _0x24d2e5 of Object['keys'](_0x4bba76[_0x557559(0x249)])){const _0x626179=_0x4bba76[_0x557559(0x249)][_0x24d2e5];_0x626179['type']===_0x557559(0x2ae)&&_0x626179['journeyActivationStepId']&&isPendingActivationId(_0x626179[_0x557559(0x205)])&&(_0x626179['journeyActivationStepId']='');if(_0x626179[_0x557559(0x1bc)]===_0x557559(0x1d1)&&_0x626179[_0x557559(0x2af)])for(const _0x20aa26 of _0x626179['branches']){_0x20aa26[_0x557559(0x21b)]&&isPendingSegmentId(_0x20aa26[_0x557559(0x21b)])&&(_0x20aa26['segmentId']='');}_0x626179[_0x557559(0x1bc)]===_0x557559(0x260)&&stripWaitStepPendingIds(_0x626179);}}}function resolvePendingIdsInRequest(_0x3b7dd0,_0xfbe5bb,_0x3bd5b4,_0x4d99ea,_0x29ba1d,_0x57cffd){const _0x2a6324=a142_0x5a306c,_0x30df2f=(_0x54072f,_0x20a4dd)=>{const _0xa97faa=a142_0x7272;if(!isPendingSegmentId(_0x54072f))return _0x54072f;const _0x251981=extractPendingSegmentName(_0x54072f),_0x3fa3e9=_0x4d99ea['get'](_0x251981);return!_0x3fa3e9&&_0x57cffd[_0xa97faa(0x2a3)]?.(_0xa97faa(0x225)+_0x251981+'\x27\x20for\x20'+_0x20a4dd),_0x3fa3e9;};if(_0x3b7dd0[_0x2a6324(0x235)][_0x2a6324(0x1f4)]?.[_0x2a6324(0x21b)]&&isPendingSegmentId(_0x3b7dd0['attributes']['goal'][_0x2a6324(0x21b)])){const _0x543d8c=_0x30df2f(_0x3b7dd0[_0x2a6324(0x235)][_0x2a6324(0x1f4)][_0x2a6324(0x21b)],_0x2a6324(0x218));_0x543d8c&&(_0x3b7dd0[_0x2a6324(0x235)][_0x2a6324(0x1f4)][_0x2a6324(0x21b)]=_0x543d8c);}for(const _0x2d460e of _0x3b7dd0[_0x2a6324(0x235)]['journeyStages']||[]){const _0x2b7db3=_0x3bd5b4[_0x2a6324(0x219)](_0x2d460e[_0x2a6324(0x279)][_0x2a6324(0x1bf)]());_0x2b7db3&&(_0x2d460e['id']=_0x2b7db3);if(_0x2d460e['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x2d460e[_0x2a6324(0x2b4)][_0x2a6324(0x21b)])){const _0x1ff389=_0x30df2f(_0x2d460e[_0x2a6324(0x2b4)][_0x2a6324(0x21b)],_0x2a6324(0x254)+_0x2d460e['name']+_0x2a6324(0x240));_0x1ff389&&(_0x2d460e[_0x2a6324(0x2b4)][_0x2a6324(0x21b)]=_0x1ff389);}if(_0x2d460e[_0x2a6324(0x285)])for(const _0x1467f7 of _0x2d460e[_0x2a6324(0x285)]){if(_0x1467f7['segmentId']&&isPendingSegmentId(_0x1467f7[_0x2a6324(0x21b)])){const _0x5a8684=_0x30df2f(_0x1467f7['segmentId'],_0x2a6324(0x254)+_0x2d460e['name']+_0x2a6324(0x25a));_0x5a8684&&(_0x1467f7[_0x2a6324(0x21b)]=_0x5a8684);}}if(_0x2d460e[_0x2a6324(0x239)]?.[_0x2a6324(0x21b)]&&isPendingSegmentId(_0x2d460e[_0x2a6324(0x239)][_0x2a6324(0x21b)])){const _0x4e13b6=_0x30df2f(_0x2d460e[_0x2a6324(0x239)][_0x2a6324(0x21b)],_0x2a6324(0x254)+_0x2d460e[_0x2a6324(0x279)]+_0x2a6324(0x265));_0x4e13b6&&(_0x2d460e[_0x2a6324(0x239)][_0x2a6324(0x21b)]=_0x4e13b6);}if(_0x2d460e['steps']){const _0x2bc0f9=_0x2d665b=>_0xfbe5bb[_0x2a6324(0x235)][_0x2a6324(0x21f)]?.[_0x2a6324(0x216)](_0x24e1ea=>_0x24e1ea[_0x2a6324(0x279)][_0x2a6324(0x1bf)]()===_0x2d460e[_0x2a6324(0x279)][_0x2a6324(0x1bf)]())?.[_0x2a6324(0x249)]?.[_0x2d665b];for(const _0x3d7687 of Object[_0x2a6324(0x21a)](_0x2d460e[_0x2a6324(0x249)])){const _0x27ad85=_0x2d460e['steps'][_0x3d7687],_0x7858fa=_0x2bc0f9(_0x3d7687);if(_0x27ad85['type']==='Activation'&&_0x27ad85[_0x2a6324(0x205)]&&(isPendingActivationId(_0x27ad85[_0x2a6324(0x205)])||_0x27ad85[_0x2a6324(0x205)]==='')){if(_0x7858fa?.[_0x2a6324(0x205)]&&isPendingActivationId(_0x7858fa[_0x2a6324(0x205)])){const _0x56e80a=extractPendingActivationName(_0x7858fa['journeyActivationStepId']),_0x358071=_0x29ba1d[_0x2a6324(0x219)](_0x56e80a);_0x358071&&(_0x27ad85['journeyActivationStepId']=_0x358071);}}if(_0x27ad85[_0x2a6324(0x1bc)]===_0x2a6324(0x1d1)&&_0x27ad85['branches']&&_0x7858fa?.[_0x2a6324(0x2af)])for(let _0x15d39c=0x0;_0x15d39c<_0x27ad85['branches'][_0x2a6324(0x22b)];_0x15d39c++){const _0x347790=_0x27ad85['branches'][_0x15d39c],_0x46a819=_0x7858fa['branches'][_0x15d39c];if(_0x46a819?.['segmentId']&&isPendingSegmentId(_0x46a819[_0x2a6324(0x21b)])){const _0x26bdd6=_0x30df2f(_0x46a819[_0x2a6324(0x21b)],_0x2a6324(0x254)+_0x2d460e['name']+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x347790[_0x2a6324(0x279)]||_0x15d39c)+'\x27');_0x26bdd6&&(_0x347790[_0x2a6324(0x21b)]=_0x26bdd6);}}_0x27ad85[_0x2a6324(0x1bc)]===_0x2a6324(0x260)&&_0x7858fa?.[_0x2a6324(0x1bc)]===_0x2a6324(0x260)&&resolveWaitStepPendingIds(_0x27ad85,_0x7858fa,_0x30df2f,_0x2d460e['name']);}}}}
1
+ const a142_0x2ccdb5=a142_0x48cb;(function(_0x279447,_0x7312cb){const _0x9e18cd=a142_0x48cb,_0x2ce644=_0x279447();while(!![]){try{const _0x242e8d=parseInt(_0x9e18cd(0x15b))/0x1*(parseInt(_0x9e18cd(0x128))/0x2)+-parseInt(_0x9e18cd(0x153))/0x3+parseInt(_0x9e18cd(0xbe))/0x4+-parseInt(_0x9e18cd(0xa8))/0x5*(-parseInt(_0x9e18cd(0x144))/0x6)+-parseInt(_0x9e18cd(0x123))/0x7+parseInt(_0x9e18cd(0x151))/0x8+-parseInt(_0x9e18cd(0xb6))/0x9;if(_0x242e8d===_0x7312cb)break;else _0x2ce644['push'](_0x2ce644['shift']());}catch(_0x42642c){_0x2ce644['push'](_0x2ce644['shift']());}}}(a142_0x1adc,0x7dd35));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a142_0x2ccdb5(0xd4);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x14cbc6){return''+PENDING_SEGMENT_PREFIX+_0x14cbc6+'__';}export function isPendingSegmentId(_0x5d88cf){const _0x5de874=a142_0x2ccdb5;return _0x5d88cf['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x5d88cf[_0x5de874(0x181)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x2b8c3c){const _0x36be61=a142_0x2ccdb5;return _0x2b8c3c[_0x36be61(0x190)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4e1930){return''+PENDING_ACTIVATION_PREFIX+_0x4e1930+'__';}export function isPendingActivationId(_0x327fab){return _0x327fab['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x324cf7){return _0x324cf7['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x37abde,_0x5181a2){const _0x212b8c=a142_0x2ccdb5,_0x452983=_0x37abde+'::'+(_0x5181a2[_0x212b8c(0x174)]()||_0x212b8c(0xaa)),_0x4cd7a7=createHash(_0x212b8c(0xda))[_0x212b8c(0xc0)](_0x452983)[_0x212b8c(0x156)](_0x212b8c(0xeb))[_0x212b8c(0xb7)](0x0,0xc);return _0x212b8c(0x125)+_0x4cd7a7;}export function ensureJourneyDefaults(_0x1bf84e){const _0x28d800=a142_0x2ccdb5;!_0x1bf84e[_0x28d800(0x10d)]&&(_0x1bf84e[_0x28d800(0x10d)]=''),!_0x1bf84e[_0x28d800(0x157)]&&(_0x1bf84e[_0x28d800(0x157)]=_0x28d800(0x134));}export function injectExistingStageIds(_0xe02864,_0x3ad764){const _0x38b4d0=a142_0x2ccdb5,_0x30c1bd=new Map(_0x3ad764[_0x38b4d0(0x122)](_0x32ba82=>[_0x32ba82[_0x38b4d0(0xed)],_0x32ba82['id']]));for(const _0x2d4ccd of _0xe02864){if(!_0x2d4ccd['id']){const _0x2459df=_0x30c1bd['get'](_0x2d4ccd[_0x38b4d0(0xed)]);_0x2459df&&(_0x2d4ccd['id']=_0x2459df);}}}export function resolveTDFolderPath(_0x276e4c,_0x338141,_0x56b94e){const _0x2969b6=a142_0x2ccdb5;if(!_0x338141)return _0x276e4c;if(_0x276e4c===_0x56b94e||_0x276e4c[_0x2969b6(0x181)](_0x56b94e+'/'))return _0x276e4c;return _0x276e4c?_0x56b94e+'/'+_0x276e4c:_0x56b94e;}export function addFoldersToCreate(_0x1a2ffe,_0x139c50,_0x19e74e){const _0x683ae2=a142_0x2ccdb5;if(!_0x1a2ffe)return;if(_0x139c50[_0x683ae2(0x105)](_0x1a2ffe))return;const _0x522c98=_0x1a2ffe[_0x683ae2(0xbd)]('/');let _0x32d0c6='';for(const _0x45c6f5 of _0x522c98){_0x32d0c6=_0x32d0c6?_0x32d0c6+'/'+_0x45c6f5:_0x45c6f5,!_0x139c50['has'](_0x32d0c6)&&_0x19e74e['add'](_0x32d0c6);}}function a142_0x1adc(){const _0x3e37c9=['15449229xCgWZd','slice','WaitStep','journey_updating','withProgress','includes','createJourneySegment','split','4113320svBffg','Failed\x20to\x20fetch\x20referenced\x20segment\x20','update','diff','flatMap','DecisionPoint','Fetching\x20','activation_deleting','\x27\x20not\x20found\x20in\x20journey\x20\x27','Created\x20activation\x20\x27','waitStep','./journey-yaml.js','segmentFolderId','from','existingJourney','index','conditionTimeoutDuration','behavior','max','\x20journey\x20from\x20file:\x20','folder','Segment\x20not\x20found:\x20','__pending_','existingSegment','goal','isNew','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','size','sha1','Segment\x20not\x20found','Failed\x20to\x20','match','segments','journeyActivationStepId','\x27\x20by\x20rule\x20content','kind','run_after_journey_refresh','debug','parse','values','\x27\x20to\x20local\x20\x27','waitStepUnit','journeyId','journeyBundleId','hasChanges','hex','getJourney','name','journeys','embedded_activation_created','\x27...','rootFolderId','journeyBundleName','dirname','ACTIVATION_UPDATE_ERROR','deleteSegment','conditions','type','journeyActivationNameToId','updated','data','parentFolder','INTERNAL','localName','parseDocument','resolveSegment','Deleted\x20activation\x20\x27','Activation\x20not\x20found:\x20','Creating\x20segment\x20\x27','getLatestJourneyId','segmentNameToId','has','\x27\x20from\x20file:\x20','folder_created','filter','deps','folder_creating','SEGMENT_UPDATE_ERROR','decision_point','description','embeddedSegmentNameToId','activationContext','activationStepsById','toISOString','segmentId','journeyBundlesByFolderAndName','delete','activationActions','entry_criteria','updateSegmentById','add','folderPath','some','reduce','Entry\x20criteria:\x20','notification','yamlConfig','createdSegmentIds','goal\x20criteria','list','map','2177826yytmrD','null','journey_entry_criteria_','created','keys','1319504qOHyoi','JOURNEY_UPDATE_ERROR','valid','journey_created','activation_deleted','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Updated\x20journey\x20\x27','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','\x27\x20decision\x20point\x20branch\x20\x27','relative','journeyStages','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','draft','existingSegments','branches','Condition','uniqueServerName','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Activation','attributes','journey_creating','fetchJourney','uniqueSegmentName','segment_deleting','folderPathToId','deleted','\x27\x20exit\x20criteria','getSegment','12738DTnJDf','versionNumber','activations','deleteActivation','resolveJourneyId','activation_updating','push','absolutePath','\x27\x20milestone','exitCriterias','getSegmentEntity','SEGMENT_SYNTAX_ERROR','milestone','1785864zqGizn','createActivation','747840OlWXoq','\x20activation\x20\x27','SEGMENT_NOT_FOUND','digest','state','conditionSegmentId','createdSegmentId','../../utils/async.js','1cloRAz','JOURNEY_SYNTAX_ERROR','all_columns','utf-8','journeyById','activationsBySegmentId','yamlActivation','stringify','and\x20the\x20server\x20segment,\x20then\x20retry.','activation_creating','validatedRequest','Deleting\x20activation\x20\x27','Failed\x20to\x20resolve\x20activation\x20','Deleted\x20segment\x20\x27','createFolder','idToName','updateActivation',').\x20','connector_config','logWarning','parentId','Duration','entryCriteria','onProgress','listActivations','trim','activation_updated','object','resolvedRule','schedule','journeyName','activation_','Delete\x20the\x20push\x20recovery\x20file\x20(','getSegment\x20failed\x20for\x20','find','Updated\x20segment\x20\x27','activation_created','./child-segment-yaml.js','startsWith','action','buildUserMaps','stages','get','user','activation_template_id','journey','\x0a\x20\x20','logInfo','sort','segmentByFolderAndName','columns','logSuccess','results','replace','Created\x20journey\x20\x27','idToEmailMap','rule','segment_updating','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','stage\x20\x27','existingActivation','relationships',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','createSegment','\x20error(s)','embedded_segment_created','length','entry','\x27\x20entry\x20criteria','waitStepType','Stage\x20\x27','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','toString','\x27\x20wait\x20condition','steps','folderId','conditionTimeoutUnit','2075hMBLkM','create','segment','toLowerCase','nameToType','with','.$1.push-recovery.json','connection','connectionIdToNameMap','embedded_activation_creating','NOT_FOUND','join','set','Journey\x20\x27'];a142_0x1adc=function(){return _0x3e37c9;};return a142_0x1adc();}export function sortFoldersByDepth(_0x110de6){return[..._0x110de6]['sort']((_0x34055c,_0x5b0a6e)=>{const _0x3d3899=a142_0x48cb,_0x52e258=(_0x34055c[_0x3d3899(0xdd)](/\//g)||[])[_0x3d3899(0x19d)],_0x1c9657=(_0x5b0a6e[_0x3d3899(0xdd)](/\//g)||[])['length'];return _0x52e258-_0x1c9657;});}import*as a142_0x79a98e from'yaml';import{readFileSync}from'fs';import a142_0x232f03 from'path';import{isJourneyDef,parseYamlString as a142_0x401a86,toYamlString as a142_0x94e2bd,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';function a142_0x48cb(_0x3f606c,_0x274e6c){_0x3f606c=_0x3f606c-0x9e;const _0x1adcdd=a142_0x1adc();let _0x48cb92=_0x1adcdd[_0x3f606c];return _0x48cb92;}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(_0x330caf){const _0xd9646=a142_0x2ccdb5;if(Array['isArray'](_0x330caf))return'['+_0x330caf[_0xd9646(0x122)](_0x4f4c90=>stableStringify(_0x4f4c90))['join'](',')+']';if(_0x330caf&&typeof _0x330caf===_0xd9646(0x176)){const _0x38be69=_0x330caf,_0x21ed87=Object[_0xd9646(0x127)](_0x38be69)[_0xd9646(0x18b)](),_0x603699=_0x21ed87['map'](_0x81f6fc=>'\x22'+_0x81f6fc+'\x22:'+stableStringify(_0x38be69[_0x81f6fc]));return'{'+_0x603699[_0xd9646(0xb3)](',')+'}';}const _0xe8d876=JSON[_0xd9646(0x162)](_0x330caf);return _0xe8d876===undefined?_0xd9646(0x124):_0xe8d876;}function activationSignature(_0x542416){const _0x3d4aa4=a142_0x2ccdb5,_0x4503cc={'connection':_0x542416[_0x3d4aa4(0xaf)],..._0x542416[_0x3d4aa4(0x15d)]!==undefined&&{'all_columns':_0x542416[_0x3d4aa4(0x15d)]},..._0x542416[_0x3d4aa4(0x18d)]!==undefined&&{'columns':_0x542416[_0x3d4aa4(0x18d)]},..._0x542416[_0x3d4aa4(0xcf)]!==undefined&&{'behavior':_0x542416['behavior']},..._0x542416[_0x3d4aa4(0x178)]!==undefined&&{'schedule':_0x542416[_0x3d4aa4(0x178)]},..._0x542416['notification']!==undefined&&{'notification':_0x542416[_0x3d4aa4(0x11d)]},..._0x542416[_0x3d4aa4(0x16d)]!==undefined&&{'connector_config':_0x542416[_0x3d4aa4(0x16d)]},..._0x542416['activation_template_id']!==undefined&&{'activation_template_id':_0x542416[_0x3d4aa4(0x187)]}};return stableStringify(_0x4503cc);}async function fetchSegment(_0x14a785,_0x348bc3,_0x44781c,_0x80c6e4){const _0xdefd79=a142_0x2ccdb5,_0x3a910c=_0x80c6e4?.[_0xdefd79(0x17d)](_0x63b29c=>_0x63b29c['id']===_0x44781c);if(_0x3a910c)return _0x3a910c;try{return await _0x14a785[_0xdefd79(0xaa)][_0xdefd79(0x143)](_0x348bc3,_0x44781c);}catch(_0x1f6728){logger[_0xdefd79(0xe3)](_0xdefd79(0x17c)+_0x44781c+_0xdefd79(0x199)+_0x1f6728);try{return await _0x14a785[_0xdefd79(0xaa)][_0xdefd79(0x14e)](_0x44781c);}catch(_0x250404){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x44781c+':\x20'+_0x250404),null;}}}function recoverSegmentIdsFromPushRecovery(_0x41a812,_0x3d3f21,_0x2c0b4b){const _0x42c9e9=a142_0x2ccdb5,_0x42cb49=readPushRecovery(_0x41a812['absolutePath']);if(_0x42cb49?.[_0x42c9e9(0x179)]===_0x41a812[_0x42c9e9(0x11e)][_0x42c9e9(0xed)])for(const [_0x10184c,_0x3d05dd]of Object['entries'](_0x42cb49[_0x42c9e9(0xde)])){const _0x4f7ae8=generateDeterministicJourneySegmentName(_0x41a812[_0x42c9e9(0x11e)][_0x42c9e9(0xed)],_0x10184c);_0x3d05dd[_0x42c9e9(0x138)]===_0x4f7ae8&&(_0x3d3f21[_0x42c9e9(0xb4)](_0x10184c,_0x3d05dd[_0x42c9e9(0x112)]),_0x2c0b4b[_0x42c9e9(0xb4)](_0x10184c,_0x3d05dd[_0x42c9e9(0x112)]));}}async function createOrRecoverEmbeddedSegment(_0x196dd3,_0x4e35b5,_0x374ebe,_0x5da0f7){const _0x399806=a142_0x2ccdb5;let _0x306f9e;try{_0x306f9e=await _0x196dd3[_0x399806(0xaa)][_0x399806(0xbc)]({'name':_0x374ebe[_0x399806(0x13e)],'description':_0x374ebe[_0x399806(0x10d)],'journeyId':_0x374ebe[_0x399806(0xe8)],'rule':_0x5da0f7(_0x374ebe[_0x399806(0x177)],!![]),'countPopulation':!![],'parentFolderId':_0x374ebe[_0x399806(0xa6)],'audienceId':_0x374ebe['parentId']});}catch(_0x3ef711){const _0x45ae00=_0x3ef711 instanceof Error&&_0x3ef711['message'][_0x399806(0xbb)]('Name\x20has\x20already\x20been\x20taken');if(_0x45ae00){const _0x56fb03=readPushRecovery(_0x4e35b5[_0x399806(0x14b)]),_0x49b188=_0x56fb03?.[_0x399806(0x179)]===_0x4e35b5['yamlConfig'][_0x399806(0xed)]?_0x56fb03[_0x399806(0xde)][_0x374ebe[_0x399806(0xfd)]]:undefined;if(_0x49b188?.[_0x399806(0x138)]===_0x374ebe[_0x399806(0x13e)])await _0x196dd3[_0x399806(0xaa)][_0x399806(0x117)](_0x374ebe[_0x399806(0x16f)],_0x49b188[_0x399806(0x112)],{'description':_0x374ebe[_0x399806(0x10d)],'rule':_0x5da0f7(_0x374ebe[_0x399806(0x177)],!![]),'countPopulation':!![]}),_0x306f9e=_0x49b188[_0x399806(0x112)];else throw new SDKError(ErrorCode[_0x399806(0x10b)],'Embedded\x20segment\x20\x27'+_0x374ebe[_0x399806(0xfd)]+_0x399806(0x133)+(_0x399806(0x17b)+_0x4e35b5[_0x399806(0x14b)][_0x399806(0x190)](/([^/]+)$/,_0x399806(0xae))+')\x20')+_0x399806(0x163),_0x3ef711);}else throw _0x3ef711;}return saveSegmentToPushRecovery(_0x4e35b5['absolutePath'],_0x4e35b5[_0x399806(0x11e)][_0x399806(0xed)],_0x374ebe[_0x399806(0xfd)],{'segmentId':_0x306f9e,'uniqueServerName':_0x374ebe['uniqueSegmentName'],'createdAt':new Date()[_0x399806(0x111)]()}),_0x306f9e;}export async function prepareSegmentFiles(_0x543ab6,_0x4170e1,_0x8f5bc1,_0x133240,_0x565598){const _0x18e29f=a142_0x2ccdb5,{activationDefToCreateRequest:_0x1ebbf4}=await import('./child-segment-yaml.js'),_0x15aeb4=[],_0x2864b7=new Set();for(const {yamlConfig:_0x29b541,folderPath:_0x404b59,sourcePath:_0x3ed0e9}of _0x543ab6){const _0x221dc9=resolveTDFolderPath(_0x404b59,_0x133240,_0x565598),_0x332d89=_0x221dc9+':'+_0x29b541['name'],_0x4605f6=_0x4170e1[_0x18e29f(0x18c)][_0x18e29f(0x185)](_0x332d89),_0x464cc8=_0x4605f6?_0x4170e1[_0x18e29f(0x160)][_0x18e29f(0x185)](_0x4605f6['id'])||[]:[];addFoldersToCreate(_0x221dc9,_0x4170e1[_0x18e29f(0x140)],_0x2864b7);const _0x27c816=calculateActivationActions(_0x29b541['activations']||[],_0x464cc8,_0x4170e1[_0x18e29f(0x192)],_0x4170e1['connectionIdToNameMap']);for(const _0x38acd1 of _0x27c816){(_0x38acd1[_0x18e29f(0xf7)]==='create'||_0x38acd1['type']===_0x18e29f(0xc0))&&_0x38acd1[_0x18e29f(0x161)]&&(_0x38acd1[_0x18e29f(0x165)]=await _0x1ebbf4(_0x38acd1['yamlActivation'],_0x8f5bc1));}const _0x2b1c75=calculateSegmentDiff(_0x29b541,_0x4605f6,_0x464cc8,_0x4170e1[_0x18e29f(0x192)],_0x4170e1[_0x18e29f(0xb0)]);_0x15aeb4[_0x18e29f(0x14a)]({'relativePath':_0x29b541[_0x18e29f(0xed)],'absolutePath':_0x3ed0e9,'yamlConfig':_0x29b541,'folderPath':_0x221dc9,'existingSegment':_0x4605f6,'existingActivations':_0x464cc8,'isNew':_0x2b1c75[_0x18e29f(0xd7)],'hasChanges':_0x2b1c75['hasChanges'],'diff':_0x2b1c75[_0x18e29f(0xc1)],'activationActions':_0x27c816});}return{'segmentFiles':_0x15aeb4,'foldersToCreate':_0x2864b7};}export async function prepareJourneyFiles(_0x1a45a3,_0x42e5fc,_0x2b2abb,_0x278220){const _0x223927=a142_0x2ccdb5,_0x340ec7=[],_0x1fd269=new Set();for(const {yamlConfig:_0x86d2de,folderPath:_0x35066b,sourcePath:_0x2a1222}of _0x1a45a3){const _0x4d8a98=resolveTDFolderPath(_0x35066b,_0x2b2abb,_0x278220),_0x462d69=_0x4d8a98+':'+_0x86d2de['name'],_0x3838dd=_0x42e5fc[_0x223927(0x113)]['get'](_0x462d69);let _0x16bd4a,_0x505a89;if(_0x3838dd&&_0x3838dd[_0x223927(0x19d)]>0x0){const _0x4e05bc=buildLocalExpandedRuleMappings(_0x86d2de),{createYamlContext:_0x2b6483,prefetchJourneySegments:_0x40a9fd}=createPushYamlContextForBundle(_0x42e5fc[_0x223927(0x109)],_0x42e5fc['parentId'],_0x42e5fc[_0x223927(0x135)],_0x4e05bc,_0x42e5fc[_0x223927(0x192)],_0x42e5fc[_0x223927(0xb0)],_0x42e5fc[_0x223927(0x110)],_0x42e5fc[_0x223927(0x15f)]);await _0x40a9fd(_0x3838dd[_0x223927(0x122)](_0xbea250=>_0xbea250['id']));const _0x2fb278=await _0x42e5fc[_0x223927(0x109)][_0x223927(0x188)][_0x223927(0x103)](_0x3838dd[0x0][_0x223927(0xe9)]),_0xab6ae8=hasMultipleVersions(_0x86d2de),_0x520459=async _0x2a20a5=>{const _0x2d713e=_0x223927,_0x1a2e18=_0x42e5fc['journeyById']?.[_0x2d713e(0x185)](_0x2a20a5);if(_0x1a2e18)return _0x1a2e18;return _0x42e5fc[_0x2d713e(0x13d)]({'journeyId':_0x2a20a5,'journeyName':_0x86d2de[_0x2d713e(0xed)],'isMultiVersion':_0x3838dd[_0x2d713e(0x19d)]>0x1});};if(_0xab6ae8&&_0x3838dd['length']>0x1){const _0x397350=[];for(const _0x16ff41 of _0x3838dd){const _0x11f4a2=_0x16ff41[_0x223927(0x145)]||0x1;_0x42e5fc['progress']?.[_0x223927(0xc0)](_0x223927(0xc4)+_0x86d2de[_0x223927(0xed)]+'\x20v'+_0x11f4a2);const _0x534a69=await _0x520459(_0x16ff41['id']),_0x56dbc1=_0x2b6483(_0x16ff41['id']),_0x505eb9=await journeyResponseToDef(_0x534a69,_0x56dbc1);_0x397350[_0x223927(0x14a)]({'item':_0x16ff41,'yaml':_0x505eb9});}const _0x2fc6c7=buildLocalRuleToNameMappingFromJourney(_0x86d2de);_0x505a89=buildMergedJourneyDef(_0x397350,_0x2fc6c7,_0x2fb278);const _0x111cd0=Math[_0x223927(0xd0)](..._0x397350[_0x223927(0x122)](_0x1fdeb7=>_0x1fdeb7['item'][_0x223927(0x145)]||0x0)),_0x39236e=_0x3838dd['find'](_0x50ebb1=>(_0x50ebb1[_0x223927(0x145)]||0x0)===_0x111cd0);_0x39236e&&(_0x42e5fc['progress']?.[_0x223927(0xc0)](_0x223927(0xc4)+_0x86d2de['name']+'\x20v'+_0x111cd0),_0x16bd4a=await _0x520459(_0x39236e['id']));}else{const _0x449b20=_0x3838dd[_0x3838dd[_0x223927(0x19d)]-0x1];_0x42e5fc['progress']?.[_0x223927(0xc0)](_0x223927(0xc4)+_0x86d2de['name']),_0x16bd4a=await _0x520459(_0x449b20['id']);const _0x5ace31=_0x2b6483(_0x449b20['id']),_0x208790=await journeyResponseToDef(_0x16bd4a,_0x5ace31),_0x29884a=buildLocalRuleToNameMappingFromJourney(_0x86d2de);_0x505a89=buildMergedJourneyDef([{'item':_0x449b20,'yaml':_0x208790}],_0x29884a,_0x2fb278);}}addFoldersToCreate(_0x4d8a98,_0x42e5fc[_0x223927(0x140)],_0x1fd269);const _0x3ea940=calculateJourneyDiff(_0x86d2de,_0x505a89);_0x340ec7[_0x223927(0x14a)]({'relativePath':_0x86d2de['name'],'absolutePath':_0x2a1222,'yamlConfig':_0x86d2de,'folderPath':_0x4d8a98,'existingJourney':_0x16bd4a,'isNew':_0x3ea940['isNew'],'hasChanges':_0x3ea940['hasChanges'],'diff':_0x3ea940['diff']});}return{'journeyFiles':_0x340ec7,'foldersToCreate':_0x1fd269};}export function calculateActivationActions(_0x9fb89d,_0x1df68f,_0x204d34,_0x15f2db){const _0x588d9e=a142_0x2ccdb5,_0x32a236=[],_0xd5b334=new Map();for(const _0x4c8fb8 of _0x1df68f){_0xd5b334['set'](_0x4c8fb8[_0x588d9e(0xed)],_0x4c8fb8);}const _0x2c65aa=new Map();for(const _0x530704 of _0x9fb89d){_0x2c65aa[_0x588d9e(0xb4)](_0x530704[_0x588d9e(0xed)],_0x530704);}for(const _0xe28c10 of _0x9fb89d){const _0x5bff25=_0xd5b334[_0x588d9e(0x185)](_0xe28c10['name']);if(!_0x5bff25)_0x32a236[_0x588d9e(0x14a)]({'type':_0x588d9e(0xa9),'name':_0xe28c10['name'],'yamlActivation':_0xe28c10});else{const _0x49b31f=activationResponseToDef(_0x5bff25,_0x204d34,_0x15f2db),_0x4f4326=a142_0x79a98e[_0x588d9e(0x162)](_0x49b31f),_0x4c0ef6=a142_0x79a98e[_0x588d9e(0x162)](_0xe28c10);_0x4f4326!==_0x4c0ef6&&_0x32a236[_0x588d9e(0x14a)]({'type':_0x588d9e(0xc0),'name':_0xe28c10['name'],'yamlActivation':_0xe28c10,'existingActivation':_0x5bff25});}}for(const _0x5aae8d of _0x1df68f){!_0x2c65aa[_0x588d9e(0x105)](_0x5aae8d[_0x588d9e(0xed)])&&_0x32a236[_0x588d9e(0x14a)]({'type':_0x588d9e(0x114),'name':_0x5aae8d[_0x588d9e(0xed)],'existingActivation':_0x5aae8d});}return _0x32a236;}function calculateYamlDiff(_0x345e46,_0x137abe){if(_0x137abe){const _0x47103d=generateDiff(_0x137abe,_0x345e46),_0x11678a=hasChanges(_0x47103d);return{'isNew':![],'hasChanges':_0x11678a,'diff':_0x11678a?formatDiffWithColors(_0x47103d):undefined};}const _0x76de43=generateDiff('',_0x345e46);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x76de43)};}export function calculateSegmentDiff(_0x56f14d,_0x4a4328,_0x83ac99,_0x323362,_0x5210cd){const _0x4f83f7=segmentToYamlString(_0x56f14d),_0x421964=_0x4a4328?segmentToYamlString(segmentWithActivationsToYaml(_0x4a4328,_0x83ac99,undefined,_0x323362,_0x5210cd)):undefined;return calculateYamlDiff(_0x4f83f7,_0x421964);}export function calculateJourneyDiff(_0x5bf314,_0x4e9605){const _0xd58bf8=normalizeJourneyDef(_0x5bf314,_0x5bf314),_0x17f8fb=a142_0x94e2bd(_0xd58bf8),_0x46bf19=_0x4e9605?a142_0x94e2bd(normalizeJourneyDef(_0x4e9605,_0x5bf314)):undefined;return calculateYamlDiff(_0x17f8fb,_0x46bf19);}export function findSegmentsToDelete(_0x2b7183,_0x17163f,_0x51d65c,_0x4aeac6,_0x18a373){const _0x5cf217=a142_0x2ccdb5,_0x4d7a9d=new Set();for(const {yamlConfig:_0x2e5654,folderPath:_0x332dc9}of _0x17163f){_0x4d7a9d['add'](_0x332dc9+':'+_0x2e5654[_0x5cf217(0xed)]);}return _0x2b7183[_0x5cf217(0x108)](_0x20a7a1=>{const _0x13591f=_0x5cf217,_0x2fa38e=_0x20a7a1[_0x13591f(0xca)]?_0x51d65c[_0x13591f(0x185)](_0x20a7a1[_0x13591f(0xca)]['toString']())||'':'',_0xdcf2f0=_0x2fa38e+':'+_0x20a7a1[_0x13591f(0xed)];if(_0x4d7a9d[_0x13591f(0x105)](_0xdcf2f0))return![];if(_0x18a373)return _0x2fa38e===_0x4aeac6||_0x2fa38e['startsWith'](_0x4aeac6+'/');return!![];});}export function findJourneysToDelete(_0x1cd498,_0x57a213,_0x16e7b3,_0x46abdf,_0x4f06bf){const _0x493cd5=a142_0x2ccdb5,_0x2a36b6=new Set();for(const {yamlConfig:_0x4c8d47,folderPath:_0x3f7f93}of _0x57a213){_0x2a36b6[_0x493cd5(0x118)](_0x3f7f93+':'+_0x4c8d47[_0x493cd5(0xed)]);}return _0x1cd498['filter'](_0x2e5c3b=>{const _0x20bd20=_0x493cd5,_0x1bdc7d=_0x2e5c3b[_0x20bd20(0xa6)]?_0x16e7b3[_0x20bd20(0x185)](_0x2e5c3b[_0x20bd20(0xa6)])||'':'',_0x53f897=_0x1bdc7d+':'+_0x2e5c3b['journeyBundleName'];if(_0x2a36b6[_0x20bd20(0x105)](_0x53f897))return![];if(_0x4f06bf)return _0x1bdc7d===_0x46abdf||_0x1bdc7d[_0x20bd20(0x181)](_0x46abdf+'/');return!![];});}export function buildSegmentLookupMap(_0x1e6a92,_0x5900c6){const _0x9927ee=a142_0x2ccdb5,_0x11cb25=new Map();for(const _0x4f9de3 of _0x1e6a92){const _0x24d90d=_0x4f9de3[_0x9927ee(0xca)]?_0x5900c6[_0x9927ee(0x185)](_0x4f9de3[_0x9927ee(0xca)][_0x9927ee(0xa3)]())||'':'',_0x54a8ee=_0x24d90d+':'+_0x4f9de3[_0x9927ee(0xed)];_0x11cb25[_0x9927ee(0xb4)](_0x54a8ee,_0x4f9de3);}return _0x11cb25;}export function buildSegmentNameToIdMap(_0x25b953){const _0x2ca5b1=a142_0x2ccdb5,_0x41944b=new Map();for(const _0x350772 of _0x25b953){_0x41944b[_0x2ca5b1(0xb4)](_0x350772[_0x2ca5b1(0xed)],_0x350772['id']);}return _0x41944b;}export function buildJourneyBundleLookupMap(_0x40d02c,_0x35184b){const _0x5f32ca=a142_0x2ccdb5,_0x27dc60=new Map();for(const _0x1390a1 of _0x40d02c){const _0x579f15=_0x1390a1['folderId']?_0x35184b[_0x5f32ca(0x185)](_0x1390a1[_0x5f32ca(0xa6)])||'':'',_0x26fcff=_0x579f15+':'+_0x1390a1[_0x5f32ca(0xf2)];!_0x27dc60['has'](_0x26fcff)&&_0x27dc60[_0x5f32ca(0xb4)](_0x26fcff,[]),_0x27dc60['get'](_0x26fcff)[_0x5f32ca(0x14a)](_0x1390a1);}for(const _0x411a20 of _0x27dc60[_0x5f32ca(0xe5)]()){_0x411a20[_0x5f32ca(0x18b)]((_0x5dba9c,_0x2c236b)=>(_0x5dba9c[_0x5f32ca(0x145)]||0x0)-(_0x2c236b[_0x5f32ca(0x145)]||0x0));}return _0x27dc60;}export function collectFoldersToCreate(_0xb297a6,_0x3497c8){const _0x1a41d5=a142_0x2ccdb5,_0x2813b2=new Set();for(const _0x715361 of _0xb297a6){if(!_0x715361)continue;if(_0x3497c8[_0x1a41d5(0x105)](_0x715361))continue;const _0x2fac1c=_0x715361[_0x1a41d5(0xbd)]('/');let _0x14d571='';for(const _0x151602 of _0x2fac1c){_0x14d571=_0x14d571?_0x14d571+'/'+_0x151602:_0x151602,!_0x3497c8[_0x1a41d5(0x105)](_0x14d571)&&_0x2813b2['add'](_0x14d571);}}return _0x2813b2;}export function parseAndClassifyYamlFiles(_0x1cf621,_0x29349e,_0x48b266){const _0x312154=a142_0x2ccdb5,_0x2eff16=[],_0x3e3cf1=[];for(const _0x1523e4 of _0x1cf621){const _0x38aeef=a142_0x232f03['relative'](_0x29349e,a142_0x232f03[_0x312154(0xf3)](_0x1523e4)),_0x392d84=_0x38aeef==='.'?'':_0x38aeef,_0x5358b3=readFileSync(_0x1523e4,_0x312154(0x15e)),_0x2b1020=a142_0x79a98e['parse'](_0x5358b3);if(isJourneyDef(_0x2b1020)){const _0x2bf6eb=a142_0x401a86(_0x5358b3);_0x3e3cf1[_0x312154(0x14a)]({'yamlConfig':_0x2bf6eb,'folderPath':_0x392d84,'sourcePath':_0x1523e4});}else{if(!_0x48b266?.['skipSegments']){const _0x2c8d7a=parseSegmentYamlFile(_0x5358b3),_0x50f387=normalizeChildSegmentYaml(_0x2c8d7a);_0x2eff16['push']({'yamlConfig':_0x50f387,'folderPath':_0x392d84,'sourcePath':_0x1523e4});}}}return{'segments':_0x2eff16,'journeys':_0x3e3cf1};}export function validateParsedFiles(_0x44ccd3,_0x5975e8){const _0x3a6617=a142_0x2ccdb5,_0x14b0bb=[];for(const {yamlConfig:_0x513dfa,sourcePath:_0x4d2b2b}of _0x44ccd3[_0x3a6617(0xde)]){const _0x5b19fc=readFileSync(_0x4d2b2b,_0x3a6617(0x15e)),_0x5636c9=a142_0x79a98e[_0x3a6617(0xfe)](_0x5b19fc),_0x5780a4=validateSegmentDef(_0x513dfa,{'source':_0x5b19fc,'document':_0x5636c9},{'skipSchema':!![]});if(!_0x5780a4['valid']){const _0x4022f0=a142_0x232f03['relative'](_0x5975e8,_0x4d2b2b);_0x14b0bb[_0x3a6617(0x14a)]({'filePath':_0x4022f0,'source':_0x5b19fc,'result':_0x5780a4,'isJourney':![]});}}for(const {yamlConfig:_0x1e2131,sourcePath:_0x273f80}of _0x44ccd3['journeys']){const _0x1601f=readFileSync(_0x273f80,'utf-8'),_0x5e5335=a142_0x79a98e[_0x3a6617(0xfe)](_0x1601f),_0x320b48=validateJourneyDef(_0x1e2131,{'source':_0x1601f,'document':_0x5e5335},{'skipSchema':!![]});if(!_0x320b48[_0x3a6617(0x12a)]){const _0xd2d024=a142_0x232f03[_0x3a6617(0x131)](_0x5975e8,_0x273f80);_0x14b0bb[_0x3a6617(0x14a)]({'filePath':_0xd2d024,'source':_0x1601f,'result':_0x320b48,'isJourney':!![]});}}return _0x14b0bb;}export function formatValidationErrors(_0xdfab6f){const _0x401a91=a142_0x2ccdb5,_0x57475f=[];for(const {filePath:_0x3745bc,source:_0x42f2a1,result:_0x9e683a,isJourney:_0x15d991}of _0xdfab6f){const _0x43f785=_0x15d991?_0x401a91(0x188):'segment';_0x57475f[_0x401a91(0x14a)]('\x0a'+_0x3745bc+'\x20('+_0x43f785+'):\x20'+_0x9e683a['errors'][_0x401a91(0x19d)]+_0x401a91(0x19b)),_0x57475f[_0x401a91(0x14a)](formatValidationResult(_0x9e683a,_0x42f2a1,_0x3745bc));}return _0x57475f[_0x401a91(0xb3)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x56654d){const _0x594a2d=a142_0x2ccdb5,_0x465f1c=new Set(),_0x61efff=new Map(),_0x13c3d1=collectSegmentUsageCounts(_0x56654d);if(_0x56654d[_0x594a2d(0xde)])for(const [_0x5e34c9,_0x598808]of Object['entries'](_0x56654d[_0x594a2d(0xde)])){_0x465f1c['add'](_0x5e34c9);if(_0x598808[_0x594a2d(0x193)]){const _0x46faaa=yamlRuleToApi(_0x598808[_0x594a2d(0x193)]),_0x47b5b7=apiRuleToYaml(_0x46faaa);_0x61efff[_0x594a2d(0xb4)](_0x5e34c9,_0x47b5b7);}}const _0x5f06dc=new Map();let _0x1f6311=0x0;for(const [_0x2b37ef,_0xb7fb9d]of _0x61efff){const _0x53454b=serializeExpandedRule(_0xb7fb9d,_0x61efff),_0x336b92=_0x5f06dc[_0x594a2d(0x185)](_0x53454b)||[];_0x336b92[_0x594a2d(0x14a)]({'name':_0x2b37ef,'index':_0x1f6311}),_0x5f06dc['set'](_0x53454b,_0x336b92),_0x1f6311++;}const _0x2b1fd0=new Map();for(const [_0x49c7a8,_0x3cd95c]of _0x5f06dc){const _0x1ffd74=_0x3cd95c[_0x594a2d(0xb7)]()['sort']((_0x472732,_0x5787ad)=>{const _0x37d7aa=_0x594a2d,_0x46d092=_0x13c3d1[_0x37d7aa(0x185)](_0x472732['name'])||0x0,_0x442823=_0x13c3d1[_0x37d7aa(0x185)](_0x5787ad[_0x37d7aa(0xed)])||0x0;if(_0x46d092!==_0x442823)return _0x442823-_0x46d092;return _0x472732[_0x37d7aa(0xcd)]-_0x5787ad[_0x37d7aa(0xcd)];})[_0x594a2d(0x122)](_0x44374f=>_0x44374f[_0x594a2d(0xed)]),_0x35ca66=[];for(const _0x15bfba of _0x1ffd74){const _0x28955a=_0x13c3d1['get'](_0x15bfba)||0x0,_0x1e527b=Math['max'](_0x28955a,0x1);for(let _0x2ff88b=0x0;_0x2ff88b<_0x1e527b;_0x2ff88b++){_0x35ca66['push'](_0x15bfba);}}_0x2b1fd0[_0x594a2d(0xb4)](_0x49c7a8,_0x35ca66);}return{'existingLocalSegmentNames':_0x465f1c,'localSegmentRules':_0x61efff,'localExpandedRuleToNames':_0x2b1fd0};}export function createSegmentIdResolver(_0x447db3,_0x37a570){return async _0x1a4623=>{const _0x11a085=a142_0x48cb,_0x27111a=_0x447db3[_0x11a085(0x185)](_0x1a4623);if(!_0x27111a)throw new SDKError(ErrorCode[_0x11a085(0x155)],'Segment\x20not\x20found:\x20'+_0x1a4623+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x37a570+'\x27)');return _0x27111a;};}export function extractRootFolderId(_0x146327){const _0x2fa0fe=a142_0x2ccdb5;return _0x146327[_0x2fa0fe(0x198)]?.['parentSegmentFolder']?.[_0x2fa0fe(0xfa)]?.['id']||_0x146327[_0x2fa0fe(0x198)]?.[_0x2fa0fe(0xfb)]?.['data']?.['id'];}export function buildConnectionMaps(_0x3ace90){const _0x34a080=a142_0x2ccdb5,_0x4279d2=new Map(),_0x54c913=new Map(),_0x98619f=new Map();for(const _0x4d1432 of _0x3ace90){_0x4279d2[_0x34a080(0xb4)](_0x4d1432[_0x34a080(0xed)],parseInt(_0x4d1432['id'],0xa)),_0x54c913[_0x34a080(0xb4)](_0x4d1432['id'],_0x4d1432[_0x34a080(0xed)]),_0x98619f[_0x34a080(0xb4)](_0x4d1432['name'],_0x4d1432[_0x34a080(0xf7)]);}return{'nameToId':_0x4279d2,'idToName':_0x54c913,'nameToType':_0x98619f};}export function calculatePushStats(_0x238579,_0xb8e5db,_0x548a34,_0x5d1673,_0x348c3e,_0x10bf79,_0xd428de){const _0x249431=a142_0x2ccdb5,_0x3e74af=_0x238579[_0x249431(0x108)](_0x380020=>_0x380020['isNew']),_0x312ac2=_0x238579[_0x249431(0x108)](_0x55c5c4=>!_0x55c5c4[_0x249431(0xd7)]&&_0x55c5c4[_0x249431(0xea)]),_0x483bd9=_0x238579[_0x249431(0x108)](_0x269e19=>!_0x269e19[_0x249431(0xd7)]&&!_0x269e19['hasChanges']),_0x49ebd4=_0x10bf79?_0x5d1673:[],_0x4ca0=_0xb8e5db[_0x249431(0x108)](_0x1215f8=>_0x1215f8[_0x249431(0xd7)]),_0x3b8210=_0xb8e5db[_0x249431(0x108)](_0xaf46f1=>!_0xaf46f1[_0x249431(0xd7)]&&_0xaf46f1['hasChanges']),_0x50f741=_0xb8e5db[_0x249431(0x108)](_0x5bc4c0=>!_0x5bc4c0['isNew']&&!_0x5bc4c0[_0x249431(0xea)]),_0x12ed6b=_0x10bf79?_0x348c3e:[],_0x5b7fce=_0x238579[_0x249431(0xc2)](_0x16eef7=>_0x16eef7[_0x249431(0x115)]),_0x44abaa=_0x5b7fce[_0x249431(0x108)](_0x17f334=>_0x17f334[_0x249431(0xf7)]===_0x249431(0xa9)),_0x192824=_0x5b7fce['filter'](_0x5b49a6=>_0x5b49a6[_0x249431(0xf7)]===_0x249431(0xc0)),_0x2166fe=_0x5b7fce[_0x249431(0x108)](_0x333afa=>_0x333afa[_0x249431(0xf7)]===_0x249431(0x114)),_0x36aaca=Array[_0x249431(0xcb)](_0x548a34)[_0x249431(0x18b)](),_0x45231b=_0xd428de?![]:_0x3e74af[_0x249431(0x19d)]>0x0||_0x312ac2['length']>0x0||_0x49ebd4['length']>0x0,_0x562124=_0x4ca0['length']>0x0||_0x3b8210[_0x249431(0x19d)]>0x0||_0x12ed6b[_0x249431(0x19d)]>0x0,_0x6223b5=_0xd428de?![]:_0x5b7fce[_0x249431(0x19d)]>0x0,_0x33f266=_0x36aaca['length']>0x0;return{'segments':{'new':_0x3e74af,'changed':_0x312ac2,'unchanged':_0x483bd9,'toDelete':_0x49ebd4},'journeys':{'new':_0x4ca0,'changed':_0x3b8210,'unchanged':_0x50f741,'toDelete':_0x12ed6b},'activations':{'all':_0x5b7fce,'toCreate':_0x44abaa,'toUpdate':_0x192824,'toDelete':_0x2166fe},'folders':{'toCreate':_0x36aaca},'counts':{'segments':{'new':_0x3e74af[_0x249431(0x19d)],'changed':_0x312ac2[_0x249431(0x19d)],'unchanged':_0x483bd9['length'],'toDelete':_0x49ebd4[_0x249431(0x19d)]},'journeys':{'new':_0x4ca0[_0x249431(0x19d)],'changed':_0x3b8210[_0x249431(0x19d)],'unchanged':_0x50f741[_0x249431(0x19d)],'toDelete':_0x12ed6b['length']},'activations':{'create':_0x44abaa[_0x249431(0x19d)],'update':_0x192824[_0x249431(0x19d)],'delete':_0x2166fe[_0x249431(0x19d)]},'folders':_0x36aaca[_0x249431(0x19d)]},'hasChanges':_0x45231b||_0x562124||_0x6223b5||_0x33f266};}export async function buildPushExecutionContext(_0x1406f3,_0x2a5f6a,_0x381fb1,_0x3137ba,_0x3dfb3f,_0x502505){const _0x29294a=a142_0x2ccdb5,_0xa71fc4=extractRootFolderId(_0x381fb1),{pathToId:_0x14559a,idToPath:_0x10b14e}=buildFolderMaps(_0x3dfb3f),_0x1357e8=buildSegmentNameToIdMap(_0x3137ba),_0x57a91a=new Map(),{batchAsync:_0x41e4ef}=await import(_0x29294a(0x15a)),[_0x5ed814,_0x2abb51]=await Promise['all']([_0x1406f3[_0x29294a(0x186)][_0x29294a(0x183)](),_0x1406f3[_0x29294a(0xaf)][_0x29294a(0x121)](),((async()=>{const _0x20fab9=_0x29294a;!_0x502505&&_0x3137ba[_0x20fab9(0x19d)]>0x0&&await _0x41e4ef(_0x3137ba,async _0x5c071c=>{const _0x55ac9e=_0x20fab9,_0x5a3e10=await _0x1406f3[_0x55ac9e(0xaa)][_0x55ac9e(0x173)](_0x2a5f6a,_0x5c071c['id']);_0x57a91a[_0x55ac9e(0xb4)](_0x5c071c['id'],_0x5a3e10);});})())]),{emailToId:_0xfee1cd,idToEmail:_0x3f9590}=_0x5ed814,_0x83fcc6=buildConnectionMaps(_0x2abb51);return{'rootFolderId':_0xa71fc4,'folderPathToId':_0x14559a,'folderIdToPath':_0x10b14e,'segmentNameToId':_0x1357e8,'activationsBySegmentId':_0x57a91a,'emailToIdMap':_0xfee1cd,'idToEmailMap':_0x3f9590,'connectionNameToIdMap':_0x83fcc6['nameToId'],'connectionIdToNameMap':_0x83fcc6[_0x29294a(0x16a)],'connectionNameToTypeMap':_0x83fcc6[_0x29294a(0xac)]};}export function createPushYamlContextForBundle(_0x504a3f,_0x283cc1,_0x107730,_0x548463,_0x16681f,_0x19336b,_0x30da38,_0x30e829){const {existingLocalSegmentNames:_0x1fc4d3,localExpandedRuleToNames:_0xb40a1d}=_0x548463,_0x4e0f34=new Set(),_0x2d0216=new Map(),_0x86b2cf=new Map(),_0x51cc94=new Map(),_0x5acfaa=createJumpTargetCache(),_0x1ba82b=new Map(),_0x36151=new Map(),_0x318850=new Set();let _0x5a2313;const _0x4fc202=_0xa44ac8=>{const _0x38f216={'resolveSegment':async _0x7565f2=>{const _0x13d75a=a142_0x48cb,_0x3774ff=_0x51cc94[_0x13d75a(0x185)](_0x7565f2);if(_0x3774ff!==undefined)return{'name':_0x3774ff,'isJourneyLocal':!![]};try{const _0x494212=await fetchSegment(_0x504a3f,_0x283cc1,_0x7565f2,_0x107730);if(!_0x494212)throw new Error(_0x13d75a(0xdb));const _0x18f905=generateJourneyLocalName(_0x494212[_0x13d75a(0xed)]),_0x110509=_0x494212[_0x13d75a(0xe1)]===SEGMENT_KIND_JOURNEY&&_0x18f905!==undefined;let _0x492f9f=_0x494212[_0x13d75a(0xed)],_0x2d17fb;if(_0x110509&&_0x494212[_0x13d75a(0x193)]){const _0x4bd203=apiRuleToYaml(_0x494212[_0x13d75a(0x193)]);_0x36151[_0x13d75a(0xb4)](_0x7565f2,_0x4bd203);const _0x33a96b=async _0x3d35dd=>{const _0x53333a=_0x13d75a,_0x493edc=collectSegmentRefsFromRule(_0x3d35dd);for(const _0xd929c3 of _0x493edc){if(!_0x36151[_0x53333a(0x105)](_0xd929c3))try{const _0x3ecfcb=await fetchSegment(_0x504a3f,_0x283cc1,_0xd929c3,_0x107730);if(_0x3ecfcb?.['rule']){const _0x515def=apiRuleToYaml(_0x3ecfcb[_0x53333a(0x193)]);_0x36151['set'](_0xd929c3,_0x515def),await _0x33a96b(_0x515def);}}catch(_0x1ae14b){logger[_0x53333a(0xe3)](_0x53333a(0xbf)+_0xd929c3+':\x20'+_0x1ae14b);}}};await _0x33a96b(_0x4bd203);const _0x52e463=serializeExpandedRule(_0x4bd203,_0x36151),_0x4fae48=_0xb40a1d[_0x13d75a(0x185)](_0x52e463);if(_0x4fae48&&_0x4fae48[_0x13d75a(0x19d)]>0x0){const _0x4e68e6=_0x2d0216['get'](_0x52e463)||0x0,_0x53f8fc=_0x4fae48[_0x4e68e6]||_0x4fae48[_0x4fae48['length']-0x1];_0x2d0216['set'](_0x52e463,_0x4e68e6+0x1),_0x492f9f=_0x53f8fc,_0x4e0f34[_0x13d75a(0x118)](_0x492f9f),_0x51cc94['set'](_0x7565f2,_0x492f9f);const _0x55f208=await resolveRuleSegmentRefs(_0x4bd203,async _0x319173=>{const _0x191165=_0x13d75a,_0x496873=_0x51cc94['get'](_0x319173);if(_0x496873)return _0x496873;const _0x4a47ac=await _0x5a2313[_0x191165(0xff)](_0x319173);return _0x4a47ac[_0x191165(0xed)];});_0x2d17fb={'description':_0x494212[_0x13d75a(0x10d)],'rule':_0x55f208};}else{const _0x2f4f2d=_0x1ba82b[_0x13d75a(0x185)](_0x52e463);if(_0x2f4f2d)_0x492f9f=_0x2f4f2d,_0x51cc94['set'](_0x7565f2,_0x492f9f);else{if(_0x18f905){let _0x38a79d=_0x18f905,_0x5a7113=0x2;while(_0x4e0f34['has'](_0x38a79d)||_0x1fc4d3[_0x13d75a(0x105)](_0x38a79d)){_0x38a79d=_0x18f905+'_'+_0x5a7113,_0x5a7113++;}_0x4e0f34['add'](_0x38a79d),_0x492f9f=_0x38a79d;}_0x51cc94[_0x13d75a(0xb4)](_0x7565f2,_0x492f9f),_0x1ba82b['set'](_0x52e463,_0x492f9f);const _0x4b1a26=await resolveRuleSegmentRefs(_0x4bd203,async _0xc8852a=>{const _0x35756b=_0x13d75a,_0x1b919b=_0x51cc94['get'](_0xc8852a);if(_0x1b919b)return _0x1b919b;const _0x4e520d=await _0x5a2313[_0x35756b(0xff)](_0xc8852a);return _0x4e520d[_0x35756b(0xed)];});_0x2d17fb={'description':_0x494212[_0x13d75a(0x10d)],'rule':_0x4b1a26};}}}return{'name':_0x492f9f,'isJourneyLocal':_0x110509,'definition':_0x2d17fb};}catch(_0x21cba6){return logger[_0x13d75a(0xe3)]('Failed\x20to\x20resolve\x20segment\x20'+_0x7565f2+':\x20'+_0x21cba6),{'name':_0x7565f2,'isJourneyLocal':![]};}},'resolveActivation':async _0x831fb3=>{const _0x2aec23=a142_0x48cb,_0x3abcfa=_0x86b2cf[_0x2aec23(0x185)](_0x831fb3);if(_0x3abcfa!==undefined)return{'name':_0x3abcfa,'isJourneyLocal':!![]};try{let _0x2ec141=_0x30da38?.[_0x2aec23(0x185)](_0x831fb3);!_0x2ec141&&(_0x2ec141=await _0x504a3f[_0x2aec23(0x188)]['getActivation'](_0xa44ac8,_0x831fb3));const _0x14ba8c=_0x2ec141[_0x2aec23(0x13b)]['activationParams'][_0x2aec23(0xed)]||_0x831fb3,_0x207733=sanitizeYamlKey(_0x14ba8c)||_0x2aec23(0x17a)+_0x831fb3,_0x51fa56=_0x207733;_0x86b2cf[_0x2aec23(0xb4)](_0x831fb3,_0x51fa56);const _0x226fe9=journeyActivationStepToYaml(_0x2ec141,_0x16681f,_0x19336b);return{'name':_0x51fa56,'isJourneyLocal':!![],'definition':_0x226fe9};}catch(_0x133f29){return logger['debug'](_0x2aec23(0x167)+_0x831fb3+':\x20'+_0x133f29),{'name':_0x831fb3,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x5705a2,_0x3af5c0)=>resolveJumpTarget(_0x5705a2,_0x3af5c0,_0x5acfaa,async _0x9023c8=>{const _0x3b093f=a142_0x48cb,_0x457b31=_0x30e829?.[_0x3b093f(0x185)](_0x9023c8);if(_0x457b31)return _0x457b31;return _0x504a3f[_0x3b093f(0x188)][_0x3b093f(0xec)](_0x9023c8);})};return _0x5a2313=_0x38f216,_0x38f216;},_0x3df1c1=async _0x16aee2=>{const _0x2ba5e4=a142_0x48cb,{collectSegmentIdsFromJourneyApi:_0x3a1729}=await import(_0x2ba5e4(0xc9)),{batchAsync:_0x15634f}=await import(_0x2ba5e4(0x15a)),_0x25d098=new Set();for(const _0x2f80ed of _0x16aee2){let _0x372ad9=_0x30e829?.[_0x2ba5e4(0x185)](_0x2f80ed);!_0x372ad9&&(_0x372ad9=await _0x504a3f['journey'][_0x2ba5e4(0xec)](_0x2f80ed));const _0x18af1a=_0x3a1729(_0x372ad9);for(const _0x1223e3 of _0x18af1a){_0x25d098['add'](_0x1223e3);}}let _0x34d2cb=Array['from'](_0x25d098);while(_0x34d2cb['length']>0x0){const _0x5b2748=_0x34d2cb[_0x2ba5e4(0x108)](_0x1c7911=>!_0x318850['has'](_0x1c7911));if(_0x5b2748[_0x2ba5e4(0x19d)]===0x0)break;const _0x11cfd6=await _0x15634f(_0x5b2748,async _0x1d20e0=>{const _0xd78dc6=_0x2ba5e4;_0x318850[_0xd78dc6(0x118)](_0x1d20e0);const _0x479c85=await fetchSegment(_0x504a3f,_0x283cc1,_0x1d20e0,_0x107730);if(!_0x479c85)return null;return{'segmentId':_0x1d20e0,'segment':_0x479c85};},0xa),_0x338032=new Set();for(const _0x4ce449 of _0x11cfd6){if(!_0x4ce449?.[_0x2ba5e4(0xaa)]?.[_0x2ba5e4(0x193)])continue;const _0x4b3210=apiRuleToYaml(_0x4ce449['segment'][_0x2ba5e4(0x193)]);_0x36151[_0x2ba5e4(0xb4)](_0x4ce449[_0x2ba5e4(0x112)],_0x4b3210);const _0x4b10f1=collectSegmentRefsFromRule(_0x4b3210);for(const _0x4fa6d5 of _0x4b10f1){!_0x318850[_0x2ba5e4(0x105)](_0x4fa6d5)&&_0x338032[_0x2ba5e4(0x118)](_0x4fa6d5);}}_0x34d2cb=Array[_0x2ba5e4(0xcb)](_0x338032);}};return{'createYamlContext':_0x4fc202,'prefetchJourneySegments':_0x3df1c1};}export async function executePushSegments(_0x3f752c,_0x3bc1d7,_0x14135d,_0x4c930f,_0xf19740){const _0x26d103=a142_0x2ccdb5,{segmentDefToCreateRequest:_0x552817,segmentDefToUpdateRequest:_0x3dc78b}=await import(_0x26d103(0x180)),_0x4b7f83=_0x14135d[_0x26d103(0x140)],_0x2e2737=0x5,_0x5b6eef=async _0x1d5546=>{const _0x278163=_0x26d103,_0x1c77d0=_0x1d5546[_0x278163(0x119)]?_0x4b7f83[_0x278163(0x185)](_0x1d5546[_0x278163(0x119)]):undefined;let _0x7e0a08;const _0x2b6375={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5b0416=_0x1d5546[_0x278163(0x11e)];if(_0x1d5546['yamlConfig']['rule']){const _0x321a88=createSegmentIdResolver(_0x14135d[_0x278163(0x104)],_0x1d5546['yamlConfig']['name']),_0xd6bee8=await resolveRuleSegmentIds(_0x1d5546['yamlConfig'][_0x278163(0x193)],_0x321a88);_0x5b0416={..._0x1d5546['yamlConfig'],'rule':_0xd6bee8};}try{if(_0x1d5546['isNew']){_0xf19740[_0x278163(0x172)]?.({'type':'segment_creating','name':_0x1d5546[_0x278163(0x11e)]['name']});const _0x100d3f=_0x552817(_0x5b0416,_0x1c77d0),_0x4fc25b=await _0xf19740[_0x278163(0xba)](_0x278163(0x102)+_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]+'\x27...',()=>_0x3f752c[_0x278163(0xaa)][_0x278163(0x19a)](_0x4c930f[_0x278163(0x16f)],_0x100d3f));_0x7e0a08=_0x4fc25b['data']['id'],_0x14135d[_0x278163(0x104)]['set'](_0x1d5546['yamlConfig']['name'],_0x7e0a08),_0x2b6375[_0x278163(0x159)]={'name':_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)],'id':_0x7e0a08},_0xf19740[_0x278163(0x172)]?.({'type':'segment_created','name':_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)],'segmentId':_0x7e0a08}),_0xf19740[_0x278163(0x18e)]?.('Created\x20segment\x20\x27'+_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]+'\x27'),_0x2b6375[_0x278163(0x126)]=0x1;}else{if(_0x1d5546[_0x278163(0xea)]){_0xf19740[_0x278163(0x172)]?.({'type':_0x278163(0x194),'name':_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]});const _0x34423d=_0x3dc78b(_0x5b0416);_0x1c77d0!==_0x1d5546[_0x278163(0xd5)]?.[_0x278163(0xca)]&&(_0x34423d[_0x278163(0xca)]=_0x1c77d0?parseInt(_0x1c77d0,0xa):undefined),await _0xf19740[_0x278163(0xba)]('Updating\x20segment\x20\x27'+_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]+_0x278163(0xf0),()=>_0x3f752c['segment'][_0x278163(0x117)](_0x4c930f['parentId'],_0x1d5546[_0x278163(0xd5)]['id'],_0x34423d)),_0x7e0a08=_0x1d5546[_0x278163(0xd5)]['id'],_0xf19740['onProgress']?.({'type':'segment_updated','name':_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]}),_0xf19740[_0x278163(0x18e)]?.(_0x278163(0x17e)+_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]+'\x27'),_0x2b6375[_0x278163(0xf9)]=0x1;}else _0x7e0a08=_0x1d5546['existingSegment']['id'];}}catch(_0x38c4e0){const _0x4237ee=isHttp400Error(_0x38c4e0),_0x225d5e=_0x4237ee?ErrorCode[_0x278163(0x14f)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x44b3da=getErrorMessage(_0x38c4e0);throw new SDKError(_0x225d5e,_0x278163(0xdc)+(_0x1d5546[_0x278163(0xd7)]?_0x278163(0xa9):_0x278163(0xc0))+'\x20segment\x20from\x20file:\x20'+_0x1d5546[_0x278163(0x14b)]+_0x278163(0x189)+_0x44b3da,_0x38c4e0);}try{const _0x218c6f=await syncActivationsForSegment(_0x3f752c,_0x4c930f[_0x278163(0x16f)],_0x7e0a08,_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)],_0x1d5546['activationActions'],_0xf19740,_0x1d5546[_0x278163(0x14b)]);_0x2b6375[_0x278163(0x146)]=_0x218c6f;}catch(_0x1d0894){if(_0x1d0894 instanceof SDKError)throw _0x1d0894;throw new SDKError(ErrorCode[_0x278163(0xf4)],_0x278163(0xa2)+_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]+_0x278163(0x106)+_0x1d5546['absolutePath']+_0x278163(0x189)+getErrorMessage(_0x1d0894),_0x1d0894);}return _0x2b6375;},_0xc70c8c=await batchAsync(_0x3bc1d7,_0x5b6eef,_0x2e2737),_0x41eb24={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x2fa594 of _0xc70c8c){_0x41eb24[_0x26d103(0x126)]+=_0x2fa594[_0x26d103(0x126)],_0x41eb24[_0x26d103(0xf9)]+=_0x2fa594[_0x26d103(0xf9)],_0x2fa594[_0x26d103(0x159)]&&_0x41eb24[_0x26d103(0x11f)][_0x26d103(0xb4)](_0x2fa594['createdSegmentId'][_0x26d103(0xed)],_0x2fa594[_0x26d103(0x159)]['id']),_0x41eb24[_0x26d103(0x146)][_0x26d103(0x126)]+=_0x2fa594[_0x26d103(0x146)][_0x26d103(0x126)],_0x41eb24[_0x26d103(0x146)][_0x26d103(0xf9)]+=_0x2fa594['activations'][_0x26d103(0xf9)],_0x41eb24[_0x26d103(0x146)]['deleted']+=_0x2fa594[_0x26d103(0x146)][_0x26d103(0x141)];}return _0x41eb24;}async function syncActivationsForSegment(_0x3db0d3,_0x1fcc6f,_0x193a6b,_0x3035c9,_0x5421e4,_0x3298a7,_0x8e9833){const _0x37ca20=a142_0x2ccdb5,_0x18acfc={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x1a5549 of _0x5421e4){try{if(_0x1a5549[_0x37ca20(0xf7)]===_0x37ca20(0xa9)&&_0x1a5549[_0x37ca20(0x165)])_0x3298a7['onProgress']?.({'type':_0x37ca20(0x164),'segmentName':_0x3035c9,'activationName':_0x1a5549[_0x37ca20(0xed)]}),await _0x3298a7[_0x37ca20(0xba)]('Creating\x20activation\x20\x27'+_0x1a5549[_0x37ca20(0xed)]+_0x37ca20(0xf0),()=>_0x3db0d3[_0x37ca20(0xaa)]['createActivation'](_0x1fcc6f,_0x193a6b,_0x1a5549[_0x37ca20(0x165)])),_0x3298a7['onProgress']?.({'type':_0x37ca20(0x17f),'segmentName':_0x3035c9,'activationName':_0x1a5549[_0x37ca20(0xed)]}),_0x3298a7[_0x37ca20(0x18e)]?.(_0x37ca20(0xc7)+_0x1a5549[_0x37ca20(0xed)]+'\x27'),_0x18acfc[_0x37ca20(0x126)]++;else{if(_0x1a5549[_0x37ca20(0xf7)]===_0x37ca20(0xc0)&&_0x1a5549['validatedRequest']&&_0x1a5549[_0x37ca20(0x197)])_0x3298a7[_0x37ca20(0x172)]?.({'type':_0x37ca20(0x149),'segmentName':_0x3035c9,'activationName':_0x1a5549[_0x37ca20(0xed)]}),await _0x3298a7[_0x37ca20(0xba)]('Updating\x20activation\x20\x27'+_0x1a5549[_0x37ca20(0xed)]+_0x37ca20(0xf0),()=>_0x3db0d3[_0x37ca20(0xaa)][_0x37ca20(0x16b)](_0x1fcc6f,_0x193a6b,_0x1a5549[_0x37ca20(0x197)]['id'],_0x1a5549['validatedRequest'])),_0x3298a7[_0x37ca20(0x172)]?.({'type':_0x37ca20(0x175),'segmentName':_0x3035c9,'activationName':_0x1a5549[_0x37ca20(0xed)]}),_0x3298a7[_0x37ca20(0x18e)]?.('Updated\x20activation\x20\x27'+_0x1a5549[_0x37ca20(0xed)]+'\x27'),_0x18acfc[_0x37ca20(0xf9)]++;else _0x1a5549[_0x37ca20(0xf7)]===_0x37ca20(0x114)&&_0x1a5549[_0x37ca20(0x197)]&&(_0x3298a7[_0x37ca20(0x172)]?.({'type':_0x37ca20(0xc5),'segmentName':_0x3035c9,'activationName':_0x1a5549[_0x37ca20(0xed)]}),await _0x3298a7['withProgress'](_0x37ca20(0x166)+_0x1a5549['name']+_0x37ca20(0xf0),()=>_0x3db0d3['segment'][_0x37ca20(0x147)](_0x1fcc6f,_0x193a6b,_0x1a5549['existingActivation']['id'])),_0x3298a7[_0x37ca20(0x172)]?.({'type':_0x37ca20(0x12c),'segmentName':_0x3035c9,'activationName':_0x1a5549['name']}),_0x3298a7['logDeleted']?.(_0x37ca20(0x100)+_0x1a5549['name']+'\x27'),_0x18acfc[_0x37ca20(0x141)]++);}}catch(_0x99334c){const _0x22dfec=isHttp400Error(_0x99334c),_0x59a02f=_0x22dfec?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x37ca20(0xf4)],_0x346bd1=getErrorMessage(_0x99334c);throw new SDKError(_0x59a02f,_0x37ca20(0xdc)+_0x1a5549[_0x37ca20(0xf7)]+_0x37ca20(0x154)+_0x1a5549[_0x37ca20(0xed)]+_0x37ca20(0x106)+_0x8e9833+_0x37ca20(0x189)+_0x346bd1,_0x99334c);}}return _0x18acfc;}export async function executePushFolders(_0x404dab,_0x5627fb,_0x53dcfe,_0x4d6d4c,_0x24bf13){const _0x29b362=a142_0x2ccdb5,_0x4d1a32=new Map(_0x53dcfe),_0x2ee878=sortFoldersByDepth(_0x5627fb);for(const _0x1451b3 of _0x2ee878){const _0x4332ac=_0x1451b3[_0x29b362(0xbd)]('/'),_0x2563d3=_0x4332ac[_0x4332ac[_0x29b362(0x19d)]-0x1],_0x5a4caf=_0x4332ac[_0x29b362(0xb7)](0x0,-0x1)[_0x29b362(0xb3)]('/'),_0x40fbac=_0x4d1a32['get'](_0x5a4caf);_0x24bf13['onProgress']?.({'type':_0x29b362(0x10a),'folder':_0x1451b3});const _0x2cbcf9={'name':_0x2563d3,'parentFolderId':_0x40fbac},_0x4eaea1=await _0x24bf13['withProgress']('Creating\x20folder\x20\x27'+_0x1451b3+_0x29b362(0xf0),()=>_0x404dab['segment'][_0x29b362(0x169)](_0x4d6d4c[_0x29b362(0x16f)],_0x2cbcf9));_0x4d1a32[_0x29b362(0xb4)](_0x1451b3,_0x4eaea1[_0x29b362(0xfa)]['id']),_0x24bf13[_0x29b362(0x172)]?.({'type':_0x29b362(0x107),'folder':_0x1451b3,'folderId':_0x4eaea1[_0x29b362(0xfa)]['id']}),_0x24bf13[_0x29b362(0x18a)]?.('Created\x20folder\x20\x27'+_0x1451b3+'\x27');}return _0x4d1a32;}export async function executePushSegmentDeletions(_0x51629f,_0x4273e2,_0x260ca2){const _0xe73fb=a142_0x2ccdb5;if(_0x4273e2[_0xe73fb(0x19d)]===0x0)return 0x0;const {batchAsync:_0x48612d}=await import(_0xe73fb(0x15a)),_0xaad3a0=0x5,_0x1b761f=await _0x48612d(_0x4273e2,async _0x56bfd2=>{const _0x243569=_0xe73fb;return _0x260ca2['onProgress']?.({'type':_0x243569(0x13f),'name':_0x56bfd2[_0x243569(0xed)]}),await _0x51629f[_0x243569(0xaa)][_0x243569(0xf5)](_0x56bfd2['id']),_0x260ca2[_0x243569(0x172)]?.({'type':'segment_deleted','name':_0x56bfd2[_0x243569(0xed)]}),_0x260ca2['logDeleted']?.(_0x243569(0x168)+_0x56bfd2[_0x243569(0xed)]+'\x27'),0x1;},_0xaad3a0);return _0x1b761f[_0xe73fb(0x11b)]((_0x191c42,_0x3bc66b)=>_0x191c42+_0x3bc66b,0x0);}export async function executePushJourneys(_0x134fd0,_0x199273,_0x387204,_0x5ca7f0,_0x3293cc){const _0x59f00d=a142_0x2ccdb5,{journeyDefToRequest:_0x729ea3}=await import(_0x59f00d(0xc9)),{activationDefToCreateRequest:_0x1911bd,yamlRuleToApi:_0x41ab52,validateSegmentRule:_0x4d11d2}=await import(_0x59f00d(0x180)),_0x5d491a={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x9976f=new Map(_0x387204['segmentNameToId']),_0x19d62b=0x5;for(let _0x318d6d=0x0;_0x318d6d<_0x199273[_0x59f00d(0x19d)];_0x318d6d+=_0x19d62b){const _0x250d18=_0x199273[_0x59f00d(0xb7)](_0x318d6d,_0x318d6d+_0x19d62b),_0x1e769f=await Promise['all'](_0x250d18[_0x59f00d(0x122)](async _0x1998df=>{const _0x31cbd7=_0x59f00d;if(!_0x1998df[_0x31cbd7(0xd7)]&&!_0x1998df[_0x31cbd7(0xea)])return{'action':'unchanged','name':_0x1998df[_0x31cbd7(0x11e)][_0x31cbd7(0xed)],'journeyId':_0x1998df[_0x31cbd7(0xcc)]?.['id']};const _0x5b98bf=_0x1998df['folderPath']?_0x387204[_0x31cbd7(0x140)][_0x31cbd7(0x185)](_0x1998df[_0x31cbd7(0x119)]):undefined;_0x3293cc[_0x31cbd7(0x172)]?.({'type':_0x1998df[_0x31cbd7(0xd7)]?_0x31cbd7(0x13c):_0x31cbd7(0xb9),'name':_0x1998df[_0x31cbd7(0x11e)][_0x31cbd7(0xed)]});try{const _0x2ea198=await executeSingleJourneyPush(_0x134fd0,_0x1998df,{..._0x387204,'segmentNameToId':_0x9976f},{'parentId':_0x5ca7f0[_0x31cbd7(0x16f)],'rootFolderId':_0x5ca7f0[_0x31cbd7(0xf1)],'folderId':_0x5b98bf,'verbose':_0x5ca7f0['verbose']},_0x3293cc,{'journeyDefToRequest':_0x729ea3,'activationDefToCreateRequest':_0x1911bd,'yamlRuleToApi':_0x41ab52,'validateSegmentRule':_0x4d11d2});for(const [_0x33bda7,_0x12d4f4]of _0x2ea198[_0x31cbd7(0x10e)]){_0x9976f['set'](_0x33bda7,_0x12d4f4),_0x5d491a[_0x31cbd7(0x10e)][_0x31cbd7(0xb4)](_0x33bda7,_0x12d4f4);}if(_0x2ea198[_0x31cbd7(0x182)]===_0x31cbd7(0x126))_0x3293cc[_0x31cbd7(0x172)]?.({'type':_0x31cbd7(0x12b),'name':_0x1998df[_0x31cbd7(0x11e)]['name'],'journeyId':_0x2ea198[_0x31cbd7(0xe8)]}),_0x3293cc['logSuccess']?.(_0x31cbd7(0x191)+_0x1998df[_0x31cbd7(0x11e)][_0x31cbd7(0xed)]+'\x27'),_0x5d491a[_0x31cbd7(0x126)]++;else _0x2ea198['action']===_0x31cbd7(0xf9)&&(_0x3293cc['onProgress']?.({'type':'journey_updated','name':_0x1998df[_0x31cbd7(0x11e)]['name']}),_0x3293cc[_0x31cbd7(0x18e)]?.(_0x31cbd7(0x12e)+_0x1998df[_0x31cbd7(0x11e)][_0x31cbd7(0xed)]+'\x27'),_0x5d491a[_0x31cbd7(0xf9)]++);return{'action':_0x2ea198[_0x31cbd7(0x182)],'name':_0x1998df[_0x31cbd7(0x11e)][_0x31cbd7(0xed)],'journeyId':_0x2ea198[_0x31cbd7(0xe8)]};}catch(_0xf6b755){const _0x41bf1e=isHttp400Error(_0xf6b755),_0x408776=_0x41bf1e?ErrorCode[_0x31cbd7(0x15c)]:ErrorCode[_0x31cbd7(0x129)],_0xcac4b9=getErrorMessage(_0xf6b755);throw new SDKError(_0x408776,'Failed\x20to\x20'+(_0x1998df[_0x31cbd7(0xd7)]?'create':_0x31cbd7(0xc0))+_0x31cbd7(0xd1)+_0x1998df[_0x31cbd7(0x14b)]+_0x31cbd7(0x189)+_0xcac4b9,_0xf6b755);}}));_0x5d491a[_0x59f00d(0x18f)][_0x59f00d(0x14a)](..._0x1e769f);}return _0x5d491a;}async function matchExistingJourneySegments(_0xaed2fc,_0x15130a,_0x35c169,_0x581944,_0x4f7e09){const _0x3b0998=a142_0x2ccdb5;if(!_0x15130a[_0x3b0998(0xcc)]||!_0x15130a[_0x3b0998(0x11e)][_0x3b0998(0xde)])return;const _0x59b6e5=new Map(),_0x4931cd=new Set();for(const _0x771887 of Object[_0x3b0998(0x127)](_0x15130a[_0x3b0998(0x11e)]['segments'])){const _0x28c430=generateDeterministicJourneySegmentName(_0x15130a['yamlConfig']['name'],_0x771887);_0x59b6e5[_0x3b0998(0xb4)](_0x28c430,_0x771887),_0x4931cd['add'](_0x771887);}const _0x963894=[],_0x217b33=collectSegmentIdsFromJourneyApi(_0x15130a[_0x3b0998(0xcc)]);for(const _0x20cac9 of _0x217b33){const _0x24e4b4=await fetchSegment(_0xaed2fc,_0x35c169,_0x20cac9,_0x581944);if(!_0x24e4b4?.['name'])continue;const _0x514730=_0x59b6e5[_0x3b0998(0x185)](_0x24e4b4[_0x3b0998(0xed)]);_0x514730?(_0x4f7e09['set'](_0x514730,_0x20cac9),_0x4931cd[_0x3b0998(0x114)](_0x514730)):_0x963894['push']({'id':_0x20cac9,'seg':_0x24e4b4});}if(_0x4931cd[_0x3b0998(0xd9)]>0x0&&_0x963894[_0x3b0998(0x19d)]>0x0){const {localExpandedRuleToNames:_0x17daeb}=buildLocalExpandedRuleMappings(_0x15130a[_0x3b0998(0x11e)]),_0x50beff=new Map();for(const {id:_0x556b56,seg:_0x14fbd4}of _0x963894){if(_0x14fbd4[_0x3b0998(0x193)]){const _0x1e75d5=apiRuleToYaml(_0x14fbd4[_0x3b0998(0x193)]);_0x50beff[_0x3b0998(0xb4)](_0x556b56,_0x1e75d5);}}for(const {id:_0x3a5e47,seg:_0x7ac8de}of _0x963894){if(!_0x7ac8de['rule'])continue;const _0x14c93c=_0x50beff[_0x3b0998(0x185)](_0x3a5e47);if(!_0x14c93c)continue;const _0x238b2b=serializeExpandedRule(_0x14c93c,_0x50beff),_0x4a2bfa=_0x17daeb[_0x3b0998(0x185)](_0x238b2b);if(_0x4a2bfa){const _0x17fc1f=_0x4a2bfa[_0x3b0998(0x17d)](_0x3c171e=>_0x4931cd[_0x3b0998(0x105)](_0x3c171e));_0x17fc1f&&(_0x4f7e09[_0x3b0998(0xb4)](_0x17fc1f,_0x3a5e47),_0x4931cd[_0x3b0998(0x114)](_0x17fc1f),logger[_0x3b0998(0xe3)]('Matched\x20server\x20segment\x20\x27'+_0x7ac8de[_0x3b0998(0xed)]+_0x3b0998(0xe6)+_0x17fc1f+_0x3b0998(0xe0)));}}}}async function executeSingleJourneyPush(_0x1ce689,_0x326089,_0x4eea23,_0x19e553,_0xe133b9,_0x19ff29){const _0x2372da=a142_0x2ccdb5,{journeyDefToRequest:_0xef77c4,activationDefToCreateRequest:_0x138dc4,yamlRuleToApi:_0x48f44d,validateSegmentRule:_0x560d40}=_0x19ff29,_0x35a7e9=new Map(),_0x33cff4=new Map();recoverSegmentIdsFromPushRecovery(_0x326089,_0x35a7e9,_0x4eea23[_0x2372da(0x104)]);const _0x42fcaf=new Map(),_0x264490=new Map(),_0x57e62f=new Map();let _0x38ec5b;const _0x5a6b6e=async()=>{const _0x52e56b=_0x2372da;if(_0x38ec5b)return;_0x38ec5b=new Map();if(!_0x326089[_0x52e56b(0xcc)])return;const _0x6ba8ba=await _0x1ce689[_0x52e56b(0x188)][_0x52e56b(0x173)](_0x326089[_0x52e56b(0xcc)]['id']);for(const _0x2f58a7 of _0x6ba8ba){const _0xa7c322=journeyActivationStepToYaml(_0x2f58a7,_0x4eea23[_0x52e56b(0x192)],_0x4eea23['connectionIdToNameMap']),_0x36764a=activationSignature(_0xa7c322);!_0x38ec5b[_0x52e56b(0x105)](_0x36764a)&&_0x38ec5b['set'](_0x36764a,_0x2f58a7['id']),_0xa7c322[_0x52e56b(0xed)]&&_0x33cff4[_0x52e56b(0xb4)](_0xa7c322[_0x52e56b(0xed)],_0x2f58a7['id']);}};await matchExistingJourneySegments(_0x1ce689,_0x326089,_0x19e553[_0x2372da(0x16f)],_0x4eea23['existingSegments'],_0x4eea23[_0x2372da(0x104)]);const _0x3c30ff={'resolveSegmentId':async _0x326e2b=>{const _0x5a2f4f=_0x2372da,_0x455286=_0x4eea23[_0x5a2f4f(0x104)]['get'](_0x326e2b);if(!_0x455286)throw new SDKError(ErrorCode[_0x5a2f4f(0x155)],_0x5a2f4f(0xd3)+_0x326e2b+'\x20(referenced\x20in\x20journey\x20'+_0x326089['yamlConfig'][_0x5a2f4f(0xed)]+')');return _0x455286;},'resolveEmbeddedSegmentId':async(_0x14f5a1,_0x5e1df3)=>{const _0x280260=_0x2372da,_0x1185ba=_0x4eea23[_0x280260(0x104)][_0x280260(0x185)](_0x14f5a1);if(_0x1185ba)return _0x1185ba;const _0x1e469a=_0x4eea23['existingSegments']['find'](_0x13b423=>_0x13b423[_0x280260(0xed)]===_0x14f5a1);if(_0x1e469a)return _0x4eea23[_0x280260(0x104)][_0x280260(0xb4)](_0x14f5a1,_0x1e469a['id']),_0x1e469a['id'];if(_0x326089[_0x280260(0xd7)]){const {stageName:_0x1f2339,criteriaName:_0x2a1522}=findSegmentCriteriaLocation(_0x326089['yamlConfig'],_0x14f5a1);return _0x560d40(_0x14f5a1,_0x5e1df3['rule']),_0x264490[_0x280260(0xb4)](_0x14f5a1,{'definition':_0x5e1df3,'stageName':_0x1f2339,'criteriaName':_0x2a1522}),createPendingSegmentId(_0x14f5a1);}const _0x2cb827=_0x326089[_0x280260(0xcc)]?.['id'];if(!_0x2cb827)throw new SDKError(ErrorCode[_0x280260(0xfc)],_0x280260(0xd8));const _0x6b98ae=_0x42fcaf['get'](_0x14f5a1);if(_0x6b98ae)return _0x6b98ae;const _0x1f3960=((async()=>{const _0x4eef2f=_0x280260;_0x560d40(_0x14f5a1,_0x5e1df3[_0x4eef2f(0x193)]);const _0x4c4920=generateDeterministicJourneySegmentName(_0x326089[_0x4eef2f(0x11e)]['name'],_0x14f5a1),_0x124cab=_0x4eea23[_0x4eef2f(0x135)][_0x4eef2f(0x17d)](_0x37c601=>_0x37c601[_0x4eef2f(0xed)]===_0x4c4920),_0x4c5609=createSegmentIdResolver(_0x4eea23['segmentNameToId'],_0x14f5a1),_0x218152=await resolveRuleSegmentIds(_0x5e1df3[_0x4eef2f(0x193)],_0x4c5609);let _0x5875de;return _0x124cab?(await _0x1ce689['segment'][_0x4eef2f(0x117)](_0x19e553[_0x4eef2f(0x16f)],_0x124cab['id'],{'description':_0x5e1df3['description']||_0x4eef2f(0x11c)+_0x14f5a1,'rule':_0x48f44d(_0x218152,!![]),'countPopulation':!![]}),_0x5875de=_0x124cab['id'],saveSegmentToPushRecovery(_0x326089[_0x4eef2f(0x14b)],_0x326089[_0x4eef2f(0x11e)]['name'],_0x14f5a1,{'segmentId':_0x5875de,'uniqueServerName':_0x4c4920,'createdAt':new Date()['toISOString']()})):_0x5875de=await createOrRecoverEmbeddedSegment(_0x1ce689,_0x326089,{'localName':_0x14f5a1,'uniqueSegmentName':_0x4c4920,'description':_0x5e1df3[_0x4eef2f(0x10d)]||_0x4eef2f(0x11c)+_0x14f5a1,'journeyId':_0x2cb827,'resolvedRule':_0x218152,'parentId':_0x19e553[_0x4eef2f(0x16f)],'folderId':_0x19e553[_0x4eef2f(0xf1)]||''},_0x48f44d),_0x4eea23[_0x4eef2f(0x104)][_0x4eef2f(0xb4)](_0x14f5a1,_0x5875de),_0x35a7e9['set'](_0x14f5a1,_0x5875de),_0x5875de;})());_0x42fcaf[_0x280260(0xb4)](_0x14f5a1,_0x1f3960);try{return await _0x1f3960;}finally{_0x42fcaf[_0x280260(0x114)](_0x14f5a1);}},'resolveActivationId':async _0x17ef5b=>{const _0x228715=_0x2372da,_0x554cfc=_0x33cff4[_0x228715(0x185)](_0x17ef5b);if(_0x554cfc)return _0x554cfc;if(_0x326089[_0x228715(0xcc)]){await _0x5a6b6e();const _0x38ea2b=_0x33cff4[_0x228715(0x185)](_0x17ef5b);if(_0x38ea2b)return _0x38ea2b;}throw new SDKError(ErrorCode[_0x228715(0xb2)],_0x228715(0x101)+_0x17ef5b+'\x20(referenced\x20in\x20journey\x20'+_0x326089[_0x228715(0x11e)][_0x228715(0xed)]+_0x228715(0x16c)+_0x228715(0x12d));},'resolveEmbeddedActivationId':async(_0x292818,_0x2cdaa5)=>{const _0x1a83a1=_0x2372da,_0x1487df=_0x33cff4[_0x1a83a1(0x185)](_0x292818);if(_0x1487df)return _0x1487df;if(_0x326089[_0x1a83a1(0xd7)])return _0x57e62f[_0x1a83a1(0xb4)](_0x292818,_0x2cdaa5),createPendingActivationId(_0x292818);if(_0x326089[_0x1a83a1(0xcc)]){await _0x5a6b6e();const _0x464984=_0x33cff4[_0x1a83a1(0x185)](_0x2cdaa5[_0x1a83a1(0xed)]);if(_0x464984)return _0x33cff4['set'](_0x292818,_0x464984),_0x464984;const _0x134bdd=activationSignature(_0x2cdaa5),_0x31fa6f=_0x38ec5b?.[_0x1a83a1(0x185)](_0x134bdd);if(_0x31fa6f)return _0x33cff4[_0x1a83a1(0xb4)](_0x292818,_0x31fa6f),_0x31fa6f;const _0x39336b=await _0x138dc4(_0x2cdaa5,_0x4eea23[_0x1a83a1(0x10f)]),_0x24276d={..._0x39336b,..._0x2cdaa5['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x2cdaa5[_0x1a83a1(0xe2)]}},_0x202913=await _0x1ce689[_0x1a83a1(0x188)][_0x1a83a1(0x152)](_0x326089[_0x1a83a1(0xcc)]['id'],_0x24276d);return _0x33cff4[_0x1a83a1(0xb4)](_0x292818,_0x202913['id']),_0x202913['id'];}throw new SDKError(ErrorCode[_0x1a83a1(0xfc)],_0x1a83a1(0x12f));},'resolveJourneyId':async _0x50d8aa=>{const _0x19e3b2=_0x2372da;try{return await _0x1ce689[_0x19e3b2(0x188)][_0x19e3b2(0x148)](_0x19e553[_0x19e3b2(0x16f)],_0x50d8aa);}catch(_0x5bfab1){throw new SDKError(ErrorCode['NOT_FOUND'],_0x19e3b2(0xb5)+_0x50d8aa+_0x19e3b2(0x139)+_0x326089[_0x19e3b2(0x11e)][_0x19e3b2(0xed)]+'\x27)',_0x5bfab1);}},'resolveStageId':async(_0x95b9cc,_0x4c9892)=>{const _0x3d5344=_0x2372da,_0x2b4112=await _0x1ce689[_0x3d5344(0x188)][_0x3d5344(0xec)](_0x95b9cc),_0x5adc0e=_0x2b4112[_0x3d5344(0x13b)][_0x3d5344(0x132)]['find'](_0x23b177=>_0x23b177[_0x3d5344(0xed)][_0x3d5344(0xab)]()===_0x4c9892[_0x3d5344(0xab)]());if(!_0x5adc0e?.['id'])throw new SDKError(ErrorCode[_0x3d5344(0xb2)],_0x3d5344(0xa1)+_0x4c9892+_0x3d5344(0xc6)+(_0x2b4112['attributes']['journeyBundleName']||_0x2b4112[_0x3d5344(0x13b)][_0x3d5344(0xed)])+'\x27');return _0x5adc0e['id'];}},_0x3b0d9a=await _0xef77c4(_0x326089[_0x2372da(0x11e)],_0x19e553[_0x2372da(0x16f)],_0x3c30ff),_0x13f0d5=_0x19e553[_0x2372da(0xa6)]||_0x19e553[_0x2372da(0xf1)];_0x13f0d5&&(_0x3b0d9a[_0x2372da(0x198)]={'parentFolder':{'data':{'id':_0x13f0d5,'type':_0x2372da(0xd2)}}});if(_0x326089[_0x2372da(0xd7)]){if(_0x264490['size']>0x0||_0x57e62f[_0x2372da(0xd9)]>0x0)return await executeThreeStepJourneyCreate(_0x1ce689,_0x326089,_0x3b0d9a,{'pendingEmbeddedSegments':_0x264490,'pendingEmbeddedActivations':_0x57e62f,'embeddedSegmentNameToId':_0x35a7e9,'journeyActivationNameToId':_0x33cff4},{..._0x19e553,'effectiveFolderId':_0x13f0d5},_0x4eea23,_0xe133b9,_0x19ff29);else{ensureJourneyDefaults(_0x3b0d9a['attributes']);const _0x57d860=await _0x1ce689[_0x2372da(0x188)][_0x2372da(0xa9)](_0x3b0d9a);return deletePushRecovery(_0x326089['absolutePath']),{'action':_0x2372da(0x126),'journeyId':_0x57d860['id'],'embeddedSegmentNameToId':_0x35a7e9};}}else{if(_0x326089[_0x2372da(0xea)]&&_0x326089['existingJourney']){_0x3b0d9a['id']=_0x326089['existingJourney']['id'];const _0x4abc6c=_0x3b0d9a['attributes'];_0x326089[_0x2372da(0xcc)]['attributes']?.['journeyBundleName']&&(_0x4abc6c[_0x2372da(0xf2)]=_0x326089[_0x2372da(0xcc)][_0x2372da(0x13b)][_0x2372da(0xf2)]);const _0x7f215c=_0x326089[_0x2372da(0xcc)][_0x2372da(0x13b)]?.[_0x2372da(0x132)];return _0x7f215c&&_0x3b0d9a[_0x2372da(0x13b)][_0x2372da(0x132)]&&injectExistingStageIds(_0x3b0d9a[_0x2372da(0x13b)][_0x2372da(0x132)],_0x7f215c),ensureJourneyDefaults(_0x4abc6c),await _0x1ce689['journey'][_0x2372da(0xc0)](_0x326089[_0x2372da(0xcc)]['id'],_0x3b0d9a),deletePushRecovery(_0x326089['absolutePath']),{'action':_0x2372da(0xf9),'journeyId':_0x326089[_0x2372da(0xcc)]['id'],'embeddedSegmentNameToId':_0x35a7e9};}}return deletePushRecovery(_0x326089[_0x2372da(0x14b)]),{'action':'unchanged','journeyId':_0x326089[_0x2372da(0xcc)]?.['id'],'embeddedSegmentNameToId':_0x35a7e9};}function findSegmentCriteriaLocation(_0x447467,_0x4e295f){const _0x44418b=a142_0x2ccdb5,_0x186a9b=_0x447467[_0x44418b(0x184)]||_0x447467[_0x44418b(0xee)]?.[0x0]?.[_0x44418b(0x184)]||[];let _0x4ecb01=_0x44418b(0x9e),_0x41aded=_0x4e295f;const _0x54a02b=_0x447467[_0x44418b(0xd6)]||_0x447467[_0x44418b(0xee)]?.[0x0]?.[_0x44418b(0xd6)];if(_0x54a02b?.[_0x44418b(0xaa)]===_0x4e295f)return{'stageName':_0x44418b(0xd6),'criteriaName':_0x54a02b['name']||_0x4e295f};_0x398421:for(const _0x36234b of _0x186a9b){if(_0x36234b[_0x44418b(0x116)]?.[_0x44418b(0xaa)]===_0x4e295f){_0x4ecb01=_0x36234b['name'],_0x41aded=_0x36234b[_0x44418b(0x116)][_0x44418b(0xed)]||_0x4e295f;break;}if(_0x36234b[_0x44418b(0xa5)])for(const _0x2b3eab of _0x36234b[_0x44418b(0xa5)]){if(_0x2b3eab[_0x44418b(0xf7)]===_0x44418b(0x10c)&&_0x2b3eab[_0x44418b(0xad)]?.['branches'])for(const _0x3f4d82 of _0x2b3eab[_0x44418b(0xad)][_0x44418b(0x136)]){if(_0x3f4d82[_0x44418b(0xaa)]===_0x4e295f){_0x4ecb01=_0x36234b[_0x44418b(0xed)],_0x41aded=_0x3f4d82[_0x44418b(0xed)]||_0x4e295f;break _0x398421;}}}}return{'stageName':_0x4ecb01,'criteriaName':_0x41aded};}async function executeThreeStepJourneyCreate(_0x10ab3f,_0x3fa907,_0x2b370e,_0x396acf,_0x36cdfe,_0xef70ed,_0x4fc2ab,_0x1f4eca){const _0x59c201=a142_0x2ccdb5,{activationDefToCreateRequest:_0x2e217a,yamlRuleToApi:_0xf06245}=_0x1f4eca,{pendingEmbeddedSegments:_0x381521,pendingEmbeddedActivations:_0x5831c9,embeddedSegmentNameToId:_0x35ad48}=_0x396acf,_0x373ef3=JSON[_0x59c201(0xe4)](JSON[_0x59c201(0x162)](_0x2b370e));ensureJourneyDefaults(_0x373ef3['attributes']),stripPendingIds(_0x373ef3);const _0x1f552f=await _0x10ab3f[_0x59c201(0x188)]['create'](_0x373ef3),_0x21f2d0=_0x1f552f['id'],_0x51a4e8=new Map();for(const _0x2c1451 of _0x1f552f[_0x59c201(0x13b)]['journeyStages']){_0x51a4e8[_0x59c201(0xb4)](_0x2c1451[_0x59c201(0xed)][_0x59c201(0xab)](),_0x2c1451['id']);}recoverSegmentIdsFromPushRecovery(_0x3fa907,_0x35ad48,_0xef70ed['segmentNameToId']);for(const [_0x1a51c3,{definition:_0x230156}]of _0x381521){if(_0x35ad48[_0x59c201(0x105)](_0x1a51c3)){_0x4fc2ab[_0x59c201(0x172)]?.({'type':'embedded_segment_created','journeyName':_0x3fa907[_0x59c201(0x11e)][_0x59c201(0xed)],'segmentName':_0x1a51c3});continue;}const _0x34f34f=generateDeterministicJourneySegmentName(_0x3fa907[_0x59c201(0x11e)][_0x59c201(0xed)],_0x1a51c3);_0x4fc2ab[_0x59c201(0x172)]?.({'type':'embedded_segment_creating','journeyName':_0x3fa907[_0x59c201(0x11e)][_0x59c201(0xed)],'segmentName':_0x1a51c3});const _0x51a5e1=createSegmentIdResolver(_0xef70ed[_0x59c201(0x104)],_0x1a51c3),_0x3fa508=await resolveRuleSegmentIds(_0x230156['rule'],_0x51a5e1),_0x3674a3=await createOrRecoverEmbeddedSegment(_0x10ab3f,_0x3fa907,{'localName':_0x1a51c3,'uniqueSegmentName':_0x34f34f,'description':_0x230156[_0x59c201(0x10d)]||_0x59c201(0x11c)+_0x1a51c3,'journeyId':_0x21f2d0,'resolvedRule':_0x3fa508,'parentId':_0x36cdfe[_0x59c201(0x16f)],'folderId':_0x36cdfe['effectiveFolderId']||''},_0xf06245);_0x35ad48[_0x59c201(0xb4)](_0x1a51c3,_0x3674a3),_0xef70ed[_0x59c201(0x104)][_0x59c201(0xb4)](_0x1a51c3,_0x3674a3),_0x4fc2ab[_0x59c201(0x172)]?.({'type':_0x59c201(0x19c),'journeyName':_0x3fa907[_0x59c201(0x11e)][_0x59c201(0xed)],'segmentName':_0x1a51c3});}const _0x3e5fda=new Map();for(const [_0xdd4d89,_0x4d1603]of _0x5831c9){_0x4fc2ab['onProgress']?.({'type':_0x59c201(0xb1),'journeyName':_0x3fa907[_0x59c201(0x11e)][_0x59c201(0xed)],'activationName':_0xdd4d89});const _0x4a032e=await _0x2e217a(_0x4d1603,_0xef70ed[_0x59c201(0x10f)]),_0x41fcb4={..._0x4a032e,..._0x4d1603['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x4d1603[_0x59c201(0xe2)]}},_0x1f248c=await _0x10ab3f['journey'][_0x59c201(0x152)](_0x21f2d0,_0x41fcb4);_0x3e5fda[_0x59c201(0xb4)](_0xdd4d89,_0x1f248c['id']),_0x396acf[_0x59c201(0xf8)][_0x59c201(0xb4)](_0xdd4d89,_0x1f248c['id']),_0x4fc2ab['onProgress']?.({'type':_0x59c201(0xef),'journeyName':_0x3fa907[_0x59c201(0x11e)]['name'],'activationName':_0xdd4d89});}const _0x3a299e=JSON[_0x59c201(0xe4)](JSON[_0x59c201(0x162)](_0x2b370e));return _0x3a299e['id']=_0x21f2d0,ensureJourneyDefaults(_0x3a299e[_0x59c201(0x13b)]),resolvePendingIdsInRequest(_0x3a299e,_0x2b370e,_0x51a4e8,_0x35ad48,_0x3e5fda,_0x4fc2ab),await _0x10ab3f[_0x59c201(0x188)][_0x59c201(0xc0)](_0x21f2d0,_0x3a299e),deletePushRecovery(_0x3fa907[_0x59c201(0x14b)]),{'action':_0x59c201(0x126),'journeyId':_0x21f2d0,'embeddedSegmentNameToId':_0x35ad48};}export function stripWaitStepPendingIds(_0x1a7d0c){const _0x2bbbfe=a142_0x2ccdb5,_0x144541=_0x1a7d0c[_0x2bbbfe(0x158)]&&isPendingSegmentId(_0x1a7d0c[_0x2bbbfe(0x158)]),_0x2d2854=_0x1a7d0c[_0x2bbbfe(0xf6)]?.[_0x2bbbfe(0x11a)](_0x293a1c=>_0x293a1c[_0x2bbbfe(0x112)]&&isPendingSegmentId(_0x293a1c[_0x2bbbfe(0x112)]));(_0x144541||_0x2d2854)&&(_0x1a7d0c[_0x2bbbfe(0xa0)]=_0x2bbbfe(0x170),_0x1a7d0c[_0x2bbbfe(0xc8)]=0x1,_0x1a7d0c['waitStepUnit']='day',delete _0x1a7d0c[_0x2bbbfe(0x158)],delete _0x1a7d0c[_0x2bbbfe(0xce)],delete _0x1a7d0c[_0x2bbbfe(0xa7)],delete _0x1a7d0c['conditions']);}export function resolveWaitStepPendingIds(_0xc7b3b7,_0xdae6dd,_0x132656,_0x17fe9a){const _0x217f48=a142_0x2ccdb5;if(_0xdae6dd['conditionSegmentId']&&isPendingSegmentId(_0xdae6dd[_0x217f48(0x158)])){const _0x52e870=_0x132656(_0xdae6dd[_0x217f48(0x158)],_0x217f48(0x196)+_0x17fe9a+_0x217f48(0xa4));_0x52e870&&(_0xc7b3b7[_0x217f48(0xa0)]=_0x217f48(0x137),_0xc7b3b7[_0x217f48(0x158)]=_0x52e870,delete _0xc7b3b7[_0x217f48(0xc8)],delete _0xc7b3b7['waitStepUnit'],_0xdae6dd['conditionTimeoutDuration']!==undefined&&(_0xc7b3b7[_0x217f48(0xce)]=_0xdae6dd[_0x217f48(0xce)]),_0xdae6dd[_0x217f48(0xa7)]&&(_0xc7b3b7[_0x217f48(0xa7)]=_0xdae6dd['conditionTimeoutUnit']));}if(_0xdae6dd[_0x217f48(0xf6)]){const _0x28136c=_0xdae6dd[_0x217f48(0xf6)][_0x217f48(0x11a)](_0x4921fd=>_0x4921fd[_0x217f48(0x112)]&&isPendingSegmentId(_0x4921fd[_0x217f48(0x112)]));if(_0x28136c){const _0x50e5b0=_0xdae6dd['conditions'][_0x217f48(0x122)](_0x3bf19e=>{const _0x2ae8a9=_0x217f48;if(_0x3bf19e[_0x2ae8a9(0x112)]&&isPendingSegmentId(_0x3bf19e['segmentId'])){const _0x2c6416=_0x132656(_0x3bf19e[_0x2ae8a9(0x112)],_0x2ae8a9(0x196)+_0x17fe9a+_0x2ae8a9(0xa4));return{..._0x3bf19e,'segmentId':_0x2c6416||_0x3bf19e[_0x2ae8a9(0x112)]};}return{..._0x3bf19e};});_0xc7b3b7['waitStepType']=_0x217f48(0x137),_0xc7b3b7[_0x217f48(0xf6)]=_0x50e5b0,delete _0xc7b3b7['waitStep'],delete _0xc7b3b7[_0x217f48(0xe7)],delete _0xc7b3b7[_0x217f48(0x158)],delete _0xc7b3b7[_0x217f48(0xce)],delete _0xc7b3b7[_0x217f48(0xa7)];}}}function stripPendingIds(_0x20d3e8){const _0x1aec7a=a142_0x2ccdb5;_0x20d3e8[_0x1aec7a(0x13b)][_0x1aec7a(0xd6)]?.[_0x1aec7a(0x112)]&&isPendingSegmentId(_0x20d3e8[_0x1aec7a(0x13b)][_0x1aec7a(0xd6)][_0x1aec7a(0x112)])&&delete _0x20d3e8[_0x1aec7a(0x13b)]['goal'];for(const _0x49ec9a of _0x20d3e8[_0x1aec7a(0x13b)][_0x1aec7a(0x132)]||[]){_0x49ec9a[_0x1aec7a(0x171)]?.[_0x1aec7a(0x112)]&&isPendingSegmentId(_0x49ec9a['entryCriteria'][_0x1aec7a(0x112)])&&delete _0x49ec9a[_0x1aec7a(0x171)];_0x49ec9a[_0x1aec7a(0x150)]?.[_0x1aec7a(0x112)]&&isPendingSegmentId(_0x49ec9a[_0x1aec7a(0x150)]['segmentId'])&&delete _0x49ec9a['milestone'];_0x49ec9a['exitCriterias']&&(_0x49ec9a[_0x1aec7a(0x14d)]=_0x49ec9a['exitCriterias'][_0x1aec7a(0x108)](_0x2128cc=>!_0x2128cc[_0x1aec7a(0x112)]||!isPendingSegmentId(_0x2128cc[_0x1aec7a(0x112)])));if(_0x49ec9a['steps'])for(const _0xfe088 of Object[_0x1aec7a(0x127)](_0x49ec9a['steps'])){const _0x519e22=_0x49ec9a[_0x1aec7a(0xa5)][_0xfe088];_0x519e22['type']===_0x1aec7a(0x13a)&&_0x519e22[_0x1aec7a(0xdf)]&&isPendingActivationId(_0x519e22[_0x1aec7a(0xdf)])&&(_0x519e22['journeyActivationStepId']='');if(_0x519e22[_0x1aec7a(0xf7)]===_0x1aec7a(0xc3)&&_0x519e22['branches'])for(const _0x4f737d of _0x519e22[_0x1aec7a(0x136)]){_0x4f737d[_0x1aec7a(0x112)]&&isPendingSegmentId(_0x4f737d[_0x1aec7a(0x112)])&&(_0x4f737d[_0x1aec7a(0x112)]='');}_0x519e22['type']===_0x1aec7a(0xb8)&&stripWaitStepPendingIds(_0x519e22);}}}function resolvePendingIdsInRequest(_0x5bf2c,_0x5d38f9,_0x2703a7,_0x5503f8,_0x23c4dc,_0x41357c){const _0x55cba9=a142_0x2ccdb5,_0x32f201=(_0x4adcdc,_0x4e3fc9)=>{const _0x3fbe59=a142_0x48cb;if(!isPendingSegmentId(_0x4adcdc))return _0x4adcdc;const _0x339f6e=extractPendingSegmentName(_0x4adcdc),_0x407488=_0x5503f8[_0x3fbe59(0x185)](_0x339f6e);return!_0x407488&&_0x41357c[_0x3fbe59(0x16e)]?.(_0x3fbe59(0x195)+_0x339f6e+'\x27\x20for\x20'+_0x4e3fc9),_0x407488;};if(_0x5bf2c['attributes']['goal']?.[_0x55cba9(0x112)]&&isPendingSegmentId(_0x5bf2c[_0x55cba9(0x13b)][_0x55cba9(0xd6)][_0x55cba9(0x112)])){const _0x2d4473=_0x32f201(_0x5bf2c[_0x55cba9(0x13b)][_0x55cba9(0xd6)]['segmentId'],_0x55cba9(0x120));_0x2d4473&&(_0x5bf2c['attributes'][_0x55cba9(0xd6)][_0x55cba9(0x112)]=_0x2d4473);}for(const _0x4277df of _0x5bf2c[_0x55cba9(0x13b)]['journeyStages']||[]){const _0x18817b=_0x2703a7['get'](_0x4277df[_0x55cba9(0xed)]['toLowerCase']());_0x18817b&&(_0x4277df['id']=_0x18817b);if(_0x4277df[_0x55cba9(0x171)]?.[_0x55cba9(0x112)]&&isPendingSegmentId(_0x4277df[_0x55cba9(0x171)]['segmentId'])){const _0x2ca077=_0x32f201(_0x4277df[_0x55cba9(0x171)][_0x55cba9(0x112)],_0x55cba9(0x196)+_0x4277df[_0x55cba9(0xed)]+_0x55cba9(0x9f));_0x2ca077&&(_0x4277df[_0x55cba9(0x171)]['segmentId']=_0x2ca077);}if(_0x4277df['exitCriterias'])for(const _0x3a3eff of _0x4277df[_0x55cba9(0x14d)]){if(_0x3a3eff[_0x55cba9(0x112)]&&isPendingSegmentId(_0x3a3eff[_0x55cba9(0x112)])){const _0x213969=_0x32f201(_0x3a3eff[_0x55cba9(0x112)],_0x55cba9(0x196)+_0x4277df[_0x55cba9(0xed)]+_0x55cba9(0x142));_0x213969&&(_0x3a3eff[_0x55cba9(0x112)]=_0x213969);}}if(_0x4277df[_0x55cba9(0x150)]?.[_0x55cba9(0x112)]&&isPendingSegmentId(_0x4277df['milestone']['segmentId'])){const _0x45f459=_0x32f201(_0x4277df['milestone'][_0x55cba9(0x112)],_0x55cba9(0x196)+_0x4277df['name']+_0x55cba9(0x14c));_0x45f459&&(_0x4277df[_0x55cba9(0x150)][_0x55cba9(0x112)]=_0x45f459);}if(_0x4277df[_0x55cba9(0xa5)]){const _0x19bb5a=_0x155fe9=>_0x5d38f9['attributes'][_0x55cba9(0x132)]?.['find'](_0x391d2d=>_0x391d2d[_0x55cba9(0xed)][_0x55cba9(0xab)]()===_0x4277df[_0x55cba9(0xed)]['toLowerCase']())?.['steps']?.[_0x155fe9];for(const _0x2cee54 of Object['keys'](_0x4277df['steps'])){const _0x1b62fa=_0x4277df[_0x55cba9(0xa5)][_0x2cee54],_0xec6453=_0x19bb5a(_0x2cee54);if(_0x1b62fa[_0x55cba9(0xf7)]===_0x55cba9(0x13a)&&_0x1b62fa[_0x55cba9(0xdf)]&&(isPendingActivationId(_0x1b62fa[_0x55cba9(0xdf)])||_0x1b62fa[_0x55cba9(0xdf)]==='')){if(_0xec6453?.['journeyActivationStepId']&&isPendingActivationId(_0xec6453[_0x55cba9(0xdf)])){const _0x26e0bc=extractPendingActivationName(_0xec6453[_0x55cba9(0xdf)]),_0x58fb60=_0x23c4dc[_0x55cba9(0x185)](_0x26e0bc);_0x58fb60&&(_0x1b62fa[_0x55cba9(0xdf)]=_0x58fb60);}}if(_0x1b62fa[_0x55cba9(0xf7)]===_0x55cba9(0xc3)&&_0x1b62fa[_0x55cba9(0x136)]&&_0xec6453?.[_0x55cba9(0x136)])for(let _0x371b32=0x0;_0x371b32<_0x1b62fa[_0x55cba9(0x136)][_0x55cba9(0x19d)];_0x371b32++){const _0x5409aa=_0x1b62fa[_0x55cba9(0x136)][_0x371b32],_0x119765=_0xec6453[_0x55cba9(0x136)][_0x371b32];if(_0x119765?.[_0x55cba9(0x112)]&&isPendingSegmentId(_0x119765['segmentId'])){const _0x258a23=_0x32f201(_0x119765[_0x55cba9(0x112)],'stage\x20\x27'+_0x4277df[_0x55cba9(0xed)]+_0x55cba9(0x130)+(_0x5409aa['name']||_0x371b32)+'\x27');_0x258a23&&(_0x5409aa[_0x55cba9(0x112)]=_0x258a23);}}_0x1b62fa[_0x55cba9(0xf7)]===_0x55cba9(0xb8)&&_0xec6453?.[_0x55cba9(0xf7)]===_0x55cba9(0xb8)&&resolveWaitStepPendingIds(_0x1b62fa,_0xec6453,_0x32f201,_0x4277df[_0x55cba9(0xed)]);}}}}
@@ -1 +1 @@
1
- function a143_0xf25e(){const _0x9ab127=['57328PUomdC','3376640feiQOL','name','741348Tftwgq','add','154ppPzPo','63CriMUr','252hcLwlw','1735610NZGvYW','2NPBAaC','5536996ljfWle','get','has','set','3MjTwXe','1262557VwxeRw','573023xHEEVz','parentFolderId'];a143_0xf25e=function(){return _0x9ab127;};return a143_0xf25e();}(function(_0x5a941f,_0x508e47){const _0x2e7166=a143_0x1f61,_0x5dcb9d=_0x5a941f();while(!![]){try{const _0xd1a66b=-parseInt(_0x2e7166(0xde))/0x1*(-parseInt(_0x2e7166(0xd8))/0x2)+parseInt(_0x2e7166(0xdd))/0x3*(-parseInt(_0x2e7166(0xd9))/0x4)+parseInt(_0x2e7166(0xd0))/0x5+-parseInt(_0x2e7166(0xd2))/0x6+parseInt(_0x2e7166(0xd4))/0x7*(parseInt(_0x2e7166(0xcf))/0x8)+parseInt(_0x2e7166(0xd5))/0x9*(parseInt(_0x2e7166(0xd7))/0xa)+parseInt(_0x2e7166(0xdf))/0xb*(-parseInt(_0x2e7166(0xd6))/0xc);if(_0xd1a66b===_0x508e47)break;else _0x5dcb9d['push'](_0x5dcb9d['shift']());}catch(_0xd6c7f1){_0x5dcb9d['push'](_0x5dcb9d['shift']());}}}(a143_0xf25e,0xad060));export function buildFolderIdToPathMap(_0x2362c7){const _0x1989f0=a143_0x1f61,_0x2bf920=new Map(),_0x1240ac=new Map();for(const _0x44682f of _0x2362c7){_0x1240ac[_0x1989f0(0xdc)](_0x44682f['id'],_0x44682f);}const _0x2fb18d=new Set();for(const _0x46a7ea of _0x2362c7){!_0x46a7ea[_0x1989f0(0xce)]&&_0x2fb18d[_0x1989f0(0xd3)](_0x46a7ea['id']);}function _0x4bae2f(_0x3a119f){const _0x112355=_0x1989f0;if(_0x2bf920[_0x112355(0xdb)](_0x3a119f['id']))return _0x2bf920['get'](_0x3a119f['id']);if(_0x2fb18d[_0x112355(0xdb)](_0x3a119f['id']))return _0x2bf920[_0x112355(0xdc)](_0x3a119f['id'],''),'';if(_0x3a119f['parentFolderId']){const _0x378868=_0x1240ac[_0x112355(0xda)](_0x3a119f[_0x112355(0xce)]);if(_0x378868){const _0x3392d3=_0x4bae2f(_0x378868),_0x161243=_0x3392d3?_0x3392d3+'/'+_0x3a119f[_0x112355(0xd1)]:_0x3a119f['name'];return _0x2bf920[_0x112355(0xdc)](_0x3a119f['id'],_0x161243),_0x161243;}}const _0xcaf201=_0x3a119f['name'];return _0x2bf920['set'](_0x3a119f['id'],_0xcaf201),_0xcaf201;}for(const _0x4ac935 of _0x2362c7){_0x4bae2f(_0x4ac935);}return _0x2bf920;}function a143_0x1f61(_0xe37503,_0x2a3af7){_0xe37503=_0xe37503-0xce;const _0xf25ef9=a143_0xf25e();let _0x1f61ef=_0xf25ef9[_0xe37503];return _0x1f61ef;}export function buildFolderPathToIdMap(_0x18af44){const _0x26f2be=a143_0x1f61,_0x21979a=new Map(),_0x338f76=new Map();for(const _0x36c12f of _0x18af44){_0x338f76[_0x26f2be(0xdc)](_0x36c12f['id'],_0x36c12f);}const _0x4f9960=new Set();for(const _0xac0462 of _0x18af44){!_0xac0462[_0x26f2be(0xce)]&&_0x4f9960['add'](_0xac0462['id']);}function _0x147765(_0x3737f1){const _0x3471a4=_0x26f2be;if(_0x4f9960[_0x3471a4(0xdb)](_0x3737f1['id']))return'';if(_0x3737f1[_0x3471a4(0xce)]){const _0xa7b2b2=_0x338f76[_0x3471a4(0xda)](_0x3737f1[_0x3471a4(0xce)]);if(_0xa7b2b2){const _0x11036f=_0x147765(_0xa7b2b2);return _0x11036f?_0x11036f+'/'+_0x3737f1['name']:_0x3737f1[_0x3471a4(0xd1)];}}return _0x3737f1[_0x3471a4(0xd1)];}for(const _0x267630 of _0x18af44){const _0x25bc73=_0x147765(_0x267630);_0x21979a[_0x26f2be(0xdc)](_0x25bc73,_0x267630['id']);}return _0x21979a;}export function buildFolderMaps(_0x3b3f90){const _0x494f04=a143_0x1f61,_0x36fce0=buildFolderIdToPathMap(_0x3b3f90),_0x18b0f2=new Map();for(const [_0x4efbe0,_0x3692ef]of _0x36fce0){_0x18b0f2[_0x494f04(0xdc)](_0x3692ef,_0x4efbe0);}return{'idToPath':_0x36fce0,'pathToId':_0x18b0f2};}export function getFolderPath(_0x103d47,_0x298623){const _0x3722e3=a143_0x1f61;if(!_0x103d47)return'';return _0x298623[_0x3722e3(0xda)](_0x103d47)??'';}
1
+ (function(_0x2e74ec,_0xb16a95){const _0xaf2aa3=a143_0x38c9,_0x2ed477=_0x2e74ec();while(!![]){try{const _0x53a104=parseInt(_0xaf2aa3(0x77))/0x1+-parseInt(_0xaf2aa3(0x76))/0x2+-parseInt(_0xaf2aa3(0x74))/0x3+-parseInt(_0xaf2aa3(0x78))/0x4*(-parseInt(_0xaf2aa3(0x75))/0x5)+-parseInt(_0xaf2aa3(0x70))/0x6+-parseInt(_0xaf2aa3(0x73))/0x7+parseInt(_0xaf2aa3(0x6f))/0x8;if(_0x53a104===_0xb16a95)break;else _0x2ed477['push'](_0x2ed477['shift']());}catch(_0x245cf0){_0x2ed477['push'](_0x2ed477['shift']());}}}(a143_0x3cc9,0xd0307));export function buildFolderIdToPathMap(_0x1d1d36){const _0x1a2ad8=a143_0x38c9,_0x3663a7=new Map(),_0x153330=new Map();for(const _0xffb815 of _0x1d1d36){_0x153330[_0x1a2ad8(0x72)](_0xffb815['id'],_0xffb815);}const _0x219fdc=new Set();for(const _0x4158ed of _0x1d1d36){!_0x4158ed[_0x1a2ad8(0x71)]&&_0x219fdc[_0x1a2ad8(0x7a)](_0x4158ed['id']);}function _0x4aad0a(_0x5c6a85){const _0x41a532=_0x1a2ad8;if(_0x3663a7[_0x41a532(0x7b)](_0x5c6a85['id']))return _0x3663a7[_0x41a532(0x79)](_0x5c6a85['id']);if(_0x219fdc[_0x41a532(0x7b)](_0x5c6a85['id']))return _0x3663a7['set'](_0x5c6a85['id'],''),'';if(_0x5c6a85[_0x41a532(0x71)]){const _0x220b82=_0x153330[_0x41a532(0x79)](_0x5c6a85['parentFolderId']);if(_0x220b82){const _0x2a09ae=_0x4aad0a(_0x220b82),_0xb7c6d1=_0x2a09ae?_0x2a09ae+'/'+_0x5c6a85[_0x41a532(0x7c)]:_0x5c6a85[_0x41a532(0x7c)];return _0x3663a7[_0x41a532(0x72)](_0x5c6a85['id'],_0xb7c6d1),_0xb7c6d1;}}const _0x37f07a=_0x5c6a85[_0x41a532(0x7c)];return _0x3663a7[_0x41a532(0x72)](_0x5c6a85['id'],_0x37f07a),_0x37f07a;}for(const _0x13f14d of _0x1d1d36){_0x4aad0a(_0x13f14d);}return _0x3663a7;}export function buildFolderPathToIdMap(_0x152027){const _0x17678c=a143_0x38c9,_0x555e81=new Map(),_0x5aa9c8=new Map();for(const _0x2358a0 of _0x152027){_0x5aa9c8['set'](_0x2358a0['id'],_0x2358a0);}const _0xda0411=new Set();for(const _0x2ea97b of _0x152027){!_0x2ea97b[_0x17678c(0x71)]&&_0xda0411[_0x17678c(0x7a)](_0x2ea97b['id']);}function _0x2746d6(_0x4bf5ef){const _0x174274=_0x17678c;if(_0xda0411[_0x174274(0x7b)](_0x4bf5ef['id']))return'';if(_0x4bf5ef[_0x174274(0x71)]){const _0x4f3203=_0x5aa9c8[_0x174274(0x79)](_0x4bf5ef[_0x174274(0x71)]);if(_0x4f3203){const _0x34145a=_0x2746d6(_0x4f3203);return _0x34145a?_0x34145a+'/'+_0x4bf5ef[_0x174274(0x7c)]:_0x4bf5ef[_0x174274(0x7c)];}}return _0x4bf5ef[_0x174274(0x7c)];}for(const _0x1814b3 of _0x152027){const _0x3b7852=_0x2746d6(_0x1814b3);_0x555e81['set'](_0x3b7852,_0x1814b3['id']);}return _0x555e81;}function a143_0x38c9(_0x1c52e7,_0xcd695a){_0x1c52e7=_0x1c52e7-0x6f;const _0x3cc9fb=a143_0x3cc9();let _0x38c942=_0x3cc9fb[_0x1c52e7];return _0x38c942;}function a143_0x3cc9(){const _0xdea5=['15465968ErpPPA','5034726TWOUJH','parentFolderId','set','8414658fcZfYt','3391455DeAAij','5MYgEtT','1373330jYbjNl','1169180ADxDYL','6434728spiJSB','get','add','has','name'];a143_0x3cc9=function(){return _0xdea5;};return a143_0x3cc9();}export function buildFolderMaps(_0x2ffc1e){const _0x37946b=a143_0x38c9,_0x49cc53=buildFolderIdToPathMap(_0x2ffc1e),_0x467e58=new Map();for(const [_0x2ac615,_0x436c8]of _0x49cc53){_0x467e58[_0x37946b(0x72)](_0x436c8,_0x2ac615);}return{'idToPath':_0x49cc53,'pathToId':_0x467e58};}export function getFolderPath(_0x3e19fa,_0x3678a4){const _0x12c2f0=a143_0x38c9;if(!_0x3e19fa)return'';return _0x3678a4[_0x12c2f0(0x79)](_0x3e19fa)??'';}
@@ -1 +1 @@
1
- (function(_0x276431,_0x2aab01){const _0x4c3d58=a144_0x59ed,_0x119a30=_0x276431();while(!![]){try{const _0x4384b8=-parseInt(_0x4c3d58(0x126))/0x1*(parseInt(_0x4c3d58(0x116))/0x2)+-parseInt(_0x4c3d58(0x130))/0x3+-parseInt(_0x4c3d58(0x106))/0x4*(parseInt(_0x4c3d58(0x10f))/0x5)+-parseInt(_0x4c3d58(0x127))/0x6*(-parseInt(_0x4c3d58(0x122))/0x7)+parseInt(_0x4c3d58(0xfe))/0x8+-parseInt(_0x4c3d58(0x10c))/0x9*(parseInt(_0x4c3d58(0x103))/0xa)+-parseInt(_0x4c3d58(0x124))/0xb*(-parseInt(_0x4c3d58(0x108))/0xc);if(_0x4384b8===_0x2aab01)break;else _0x119a30['push'](_0x119a30['shift']());}catch(_0x28c4f7){_0x119a30['push'](_0x119a30['shift']());}}}(a144_0x467f,0x1e12a));import a144_0x2057d8 from'path';import{parse as a144_0x1f43bc}from'yaml';function a144_0x467f(){const _0x22e15b=['Relative\x20path\x20cannot\x20be\x20empty','tdx.json','root','Cannot\x20split\x20empty\x20path','split','readFile','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','isAbsolute','parent_segment','parse','.yml','457863ZOpCys','.yaml','1905981OegSyY','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','974kJuDyw','6EUZNYL','Path\x20attempts\x20to\x20navigate\x20above\x20root','segments','exists','endsWith','Cannot\x20navigate\x20above\x20root','relative','pop','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','237852CPpIxd','No\x20tdx.json\x20found\x20for\x20file:\x20','1916648VFrGoi','raw','File\x20not\x20found:\x20','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','replace','1214430GkJkSF','startsWith','resolve','477992bqLJre','slice','24lDbBHF','type','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','trim','18obvxIh','journey','dirname','5sTehqQ','push','length','Path\x20cannot\x20be\x20empty','filter','join','name','178MyHxLO'];a144_0x467f=function(){return _0x22e15b;};return a144_0x467f();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x393664){const _0x229c0f=a144_0x59ed;if(!_0x393664||_0x393664[_0x229c0f(0x10b)]()==='')throw new Error(_0x229c0f(0x112));const _0x4b0a1a=_0x393664[_0x229c0f(0x10b)]();if(_0x4b0a1a==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x393664};const _0x39c952=_0x4b0a1a[_0x229c0f(0x104)]('/')?_0x4b0a1a['substring'](0x1):_0x4b0a1a,_0xad23f3=_0x39c952[_0x229c0f(0x11b)]('/')[_0x229c0f(0x113)](_0x5e8aef=>_0x5e8aef!=='');if(_0xad23f3[_0x229c0f(0x111)]===0x0)throw new Error(_0x229c0f(0x11d));const _0x5977db=_0x4b0a1a[_0x229c0f(0x104)]('/')||!isRelativePathSegment(_0xad23f3[0x0]);for(const _0x78388b of _0xad23f3){validatePathSegment(_0x78388b);}return{'segments':_0xad23f3,'isAbsolute':_0x5977db,'raw':_0x393664};}function isRelativePathSegment(_0x59399c){return _0x59399c==='.'||_0x59399c==='..';}function validatePathSegment(_0x1748b9){const _0x215041=a144_0x59ed;if(_0x1748b9==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x1748b9==='.'||_0x1748b9==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x1748b9))throw new Error(_0x215041(0x101)+_0x1748b9);if(_0x1748b9!==_0x1748b9[_0x215041(0x10b)]()){}}export function validatePath(_0x1a6768){const _0x1ad8a1=a144_0x59ed;if(_0x1a6768[_0x1ad8a1(0x129)][_0x1ad8a1(0x111)]===0x0&&!_0x1a6768[_0x1ad8a1(0x11e)])throw new Error(_0x1ad8a1(0x117));if(_0x1a6768[_0x1ad8a1(0x11e)]){if(_0x1a6768[_0x1ad8a1(0x129)][0x0]==='..')throw new Error(_0x1ad8a1(0x125));let _0x3dd9a5=0x0;for(const _0xcf3596 of _0x1a6768[_0x1ad8a1(0x129)]){if(_0xcf3596==='..'){if(_0x3dd9a5===0x0)throw new Error(_0x1ad8a1(0x128));_0x3dd9a5--;}else _0xcf3596!=='.'&&_0x3dd9a5++;}}}export function joinPaths(_0x485345,_0x14ae14){const _0x5e96ab=a144_0x59ed;if(!_0x485345||_0x485345==='/')return _0x14ae14;if(!_0x14ae14||_0x14ae14==='.')return _0x485345;if(_0x14ae14[_0x5e96ab(0x104)]('/'))return _0x14ae14;const _0x3e4b98=parsePath(_0x485345),_0x30cbfa=parsePath(_0x14ae14),_0x1c5e0e=[..._0x3e4b98[_0x5e96ab(0x129)]];for(const _0x38167d of _0x30cbfa[_0x5e96ab(0x129)]){if(_0x38167d==='.')continue;else{if(_0x38167d==='..'){if(_0x1c5e0e[_0x5e96ab(0x111)]===0x0)throw new Error(_0x5e96ab(0x12c));_0x1c5e0e[_0x5e96ab(0x12e)]();}else _0x1c5e0e[_0x5e96ab(0x110)](_0x38167d);}}const _0xad84f7=_0x1c5e0e[_0x5e96ab(0x114)]('/');return _0x3e4b98[_0x5e96ab(0xff)][_0x5e96ab(0x104)]('/')?'/'+_0xad84f7:_0xad84f7;}export function normalizePath(_0x395972){const _0x35a266=a144_0x59ed,_0x10f5f5=parsePath(_0x395972),_0x554a56=[];for(const _0x3c909e of _0x10f5f5[_0x35a266(0x129)]){if(_0x3c909e==='.')continue;else{if(_0x3c909e==='..'){if(_0x554a56['length']===0x0){if(_0x10f5f5[_0x35a266(0x11e)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x554a56[_0x35a266(0x110)]('..');}else _0x554a56[_0x554a56[_0x35a266(0x111)]-0x1]==='..'?_0x554a56[_0x35a266(0x110)]('..'):_0x554a56[_0x35a266(0x12e)]();}else _0x554a56['push'](_0x3c909e);}}if(_0x554a56[_0x35a266(0x111)]===0x0)return _0x10f5f5[_0x35a266(0x11e)]?'/':'.';const _0x4dbd8b=_0x554a56[_0x35a266(0x114)]('/');return _0x10f5f5[_0x35a266(0xff)]['startsWith']('/')?'/'+_0x4dbd8b:_0x4dbd8b;}export function getParentPath(_0x2d6902){const _0x107a2d=a144_0x59ed,_0x544be7=parsePath(_0x2d6902);if(_0x544be7[_0x107a2d(0x129)]['length']<=0x1)return'/';const _0x84baf0=_0x544be7[_0x107a2d(0x129)]['slice'](0x0,-0x1)[_0x107a2d(0x114)]('/');return _0x544be7[_0x107a2d(0xff)][_0x107a2d(0x104)]('/')?'/'+_0x84baf0:_0x84baf0;}export function getBaseName(_0x34a200){const _0x5ea2f2=a144_0x59ed,_0x8f4665=parsePath(_0x34a200);return _0x8f4665['segments'][_0x8f4665[_0x5ea2f2(0x129)][_0x5ea2f2(0x111)]-0x1]||'';}export function isChildPath(_0x3669f1,_0x2c8c45){const _0x436868=a144_0x59ed,_0x5c2c2d=parsePath(_0x3669f1),_0x139684=parsePath(_0x2c8c45);if(_0x5c2c2d[_0x436868(0x129)][_0x436868(0x111)]<=_0x139684[_0x436868(0x129)]['length'])return![];for(let _0xc7771b=0x0;_0xc7771b<_0x139684[_0x436868(0x129)]['length'];_0xc7771b++){if(_0x5c2c2d[_0x436868(0x129)][_0xc7771b]!==_0x139684[_0x436868(0x129)][_0xc7771b])return![];}return!![];}export function splitPath(_0x4d2131){const _0x2101b6=a144_0x59ed,_0xf931a=parsePath(_0x4d2131);if(_0xf931a[_0x2101b6(0x129)][_0x2101b6(0x111)]===0x0)throw new Error(_0x2101b6(0x11a));if(_0xf931a[_0x2101b6(0x129)][_0x2101b6(0x111)]===0x1)return{'parent':_0xf931a[_0x2101b6(0x129)][0x0]};return{'parent':_0xf931a['segments'][0x0],'child':_0xf931a[_0x2101b6(0x129)][_0x2101b6(0x107)](0x1)[_0x2101b6(0x114)]('/')};}function a144_0x59ed(_0x324562,_0x525450){_0x324562=_0x324562-0xfe;const _0x467f2a=a144_0x467f();let _0x59ed38=_0x467f2a[_0x324562];return _0x59ed38;}export function isYamlFilePath(_0x492c0c){const _0x5c7a57=a144_0x59ed;return _0x492c0c[_0x5c7a57(0x12b)](_0x5c7a57(0x121))||_0x492c0c[_0x5c7a57(0x12b)](_0x5c7a57(0x123));}export async function resolveYamlFilePath(_0x18f609,_0x7728c3=nodeFileSystem){const _0x2db9c5=a144_0x59ed,_0x150f4e=a144_0x2057d8[_0x2db9c5(0x105)](_0x18f609);if(!await _0x7728c3['exists'](_0x150f4e))throw new Error(_0x2db9c5(0x100)+_0x18f609);let _0x5dbf87=a144_0x2057d8[_0x2db9c5(0x10e)](_0x150f4e),_0x337a03=null,_0x270fab=null;const _0x43fed7=a144_0x2057d8[_0x2db9c5(0x120)](_0x5dbf87)[_0x2db9c5(0x119)];while(_0x5dbf87!==_0x43fed7){const _0x5332b1=a144_0x2057d8[_0x2db9c5(0x114)](_0x5dbf87,_0x2db9c5(0x118));if(await _0x7728c3[_0x2db9c5(0x12a)](_0x5332b1)){_0x337a03=_0x5332b1,_0x270fab=_0x5dbf87;break;}_0x5dbf87=a144_0x2057d8[_0x2db9c5(0x10e)](_0x5dbf87);}if(!_0x337a03||!_0x270fab)throw new Error(_0x2db9c5(0x131)+_0x18f609+'\x0a'+_0x2db9c5(0x12f));const _0x40ff51=await _0x7728c3[_0x2db9c5(0x11c)](_0x337a03),_0x21343=JSON[_0x2db9c5(0x120)](_0x40ff51),_0x5a82f1=_0x21343[_0x2db9c5(0x11f)];if(!_0x5a82f1)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x3f15ad=await _0x7728c3[_0x2db9c5(0x11c)](_0x150f4e),_0x3d3587=a144_0x1f43bc(_0x3f15ad),_0x37f7f5=_0x3d3587[_0x2db9c5(0x115)];if(!_0x37f7f5)throw new Error(_0x2db9c5(0x10a)+_0x18f609);const _0x2178c4=_0x3d3587[_0x2db9c5(0x109)]===_0x2db9c5(0x10d)?_0x2db9c5(0x10d):'segment',_0x54d2d3=a144_0x2057d8[_0x2db9c5(0x12d)](_0x270fab,_0x150f4e),_0x4cf0c4=a144_0x2057d8['dirname'](_0x54d2d3),_0x299b08=_0x4cf0c4==='.'?'':_0x4cf0c4[_0x2db9c5(0x102)](/\\/g,'/'),_0x418d8c=_0x299b08?_0x5a82f1+'/'+_0x299b08+'/'+_0x37f7f5:_0x5a82f1+'/'+_0x37f7f5;return{'parentSegment':_0x5a82f1,'segmentName':_0x37f7f5,'folderPath':_0x299b08,'fullPath':_0x418d8c,'resourceType':_0x2178c4,'content':_0x3f15ad};}
1
+ (function(_0x43f3d0,_0x491b2f){const _0x49fac0=a144_0x4ed7,_0x425535=_0x43f3d0();while(!![]){try{const _0x577006=parseInt(_0x49fac0(0x1bf))/0x1+-parseInt(_0x49fac0(0x1b9))/0x2+parseInt(_0x49fac0(0x1d7))/0x3*(parseInt(_0x49fac0(0x1d0))/0x4)+-parseInt(_0x49fac0(0x1c6))/0x5*(-parseInt(_0x49fac0(0x1b4))/0x6)+-parseInt(_0x49fac0(0x1cb))/0x7*(-parseInt(_0x49fac0(0x1cf))/0x8)+parseInt(_0x49fac0(0x1d9))/0x9+-parseInt(_0x49fac0(0x1b1))/0xa;if(_0x577006===_0x491b2f)break;else _0x425535['push'](_0x425535['shift']());}catch(_0x541f2f){_0x425535['push'](_0x425535['shift']());}}}(a144_0x399a,0x9e4d7));import a144_0x4a6314 from'path';import{parse as a144_0x35ad14}from'yaml';function a144_0x399a(){const _0x483b4a=['startsWith','8288838QHIGsg','replace','tdx.json','pop','Cannot\x20navigate\x20above\x20root','29658510umVZNP','relative','trim','3984xZPoGy','filter','join','.yaml','type','162986HpaQjb','Path\x20cannot\x20be\x20empty','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','Path\x20segment\x20cannot\x20be\x20empty','readFile','297066ympGYR','exists','File\x20not\x20found:\x20','split','endsWith','isAbsolute','push','5135XJjIni','test','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','name','parse','2233KjIngM','journey','raw','dirname','18376WwoGXb','16KeaWEz','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','resolve','slice','length','segments','No\x20tdx.json\x20found\x20for\x20file:\x20','797274WoQQWL'];a144_0x399a=function(){return _0x483b4a;};return a144_0x399a();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0xb7b523){const _0x39d5c4=a144_0x4ed7;if(!_0xb7b523||_0xb7b523[_0x39d5c4(0x1b3)]()==='')throw new Error(_0x39d5c4(0x1ba));const _0x48f004=_0xb7b523[_0x39d5c4(0x1b3)]();if(_0x48f004==='/')return{'segments':[],'isAbsolute':!![],'raw':_0xb7b523};const _0x4d941b=_0x48f004[_0x39d5c4(0x1d8)]('/')?_0x48f004['substring'](0x1):_0x48f004,_0x4551cd=_0x4d941b[_0x39d5c4(0x1c2)]('/')[_0x39d5c4(0x1b5)](_0x2ee852=>_0x2ee852!=='');if(_0x4551cd[_0x39d5c4(0x1d4)]===0x0)throw new Error(_0x39d5c4(0x1bc));const _0x562d43=_0x48f004[_0x39d5c4(0x1d8)]('/')||!isRelativePathSegment(_0x4551cd[0x0]);for(const _0x4ea946 of _0x4551cd){validatePathSegment(_0x4ea946);}return{'segments':_0x4551cd,'isAbsolute':_0x562d43,'raw':_0xb7b523};}function isRelativePathSegment(_0x130ac6){return _0x130ac6==='.'||_0x130ac6==='..';}function validatePathSegment(_0x1f8f8b){const _0x2dac0f=a144_0x4ed7;if(_0x1f8f8b==='')throw new Error(_0x2dac0f(0x1bd));if(_0x1f8f8b==='.'||_0x1f8f8b==='..')return;if(/[\x00-\x1F\x7F]/[_0x2dac0f(0x1c7)](_0x1f8f8b))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0x1f8f8b);if(_0x1f8f8b!==_0x1f8f8b[_0x2dac0f(0x1b3)]()){}}export function validatePath(_0x35d429){const _0x1c8d40=a144_0x4ed7;if(_0x35d429[_0x1c8d40(0x1d5)][_0x1c8d40(0x1d4)]===0x0&&!_0x35d429[_0x1c8d40(0x1c4)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x35d429[_0x1c8d40(0x1c4)]){if(_0x35d429['segments'][0x0]==='..')throw new Error(_0x1c8d40(0x1d1));let _0x355b79=0x0;for(const _0x4d3298 of _0x35d429[_0x1c8d40(0x1d5)]){if(_0x4d3298==='..'){if(_0x355b79===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x355b79--;}else _0x4d3298!=='.'&&_0x355b79++;}}}export function joinPaths(_0x55d0c4,_0xa25b41){const _0x52a659=a144_0x4ed7;if(!_0x55d0c4||_0x55d0c4==='/')return _0xa25b41;if(!_0xa25b41||_0xa25b41==='.')return _0x55d0c4;if(_0xa25b41[_0x52a659(0x1d8)]('/'))return _0xa25b41;const _0x18a818=parsePath(_0x55d0c4),_0x7e1f21=parsePath(_0xa25b41),_0x4e65bc=[..._0x18a818[_0x52a659(0x1d5)]];for(const _0x552650 of _0x7e1f21[_0x52a659(0x1d5)]){if(_0x552650==='.')continue;else{if(_0x552650==='..'){if(_0x4e65bc[_0x52a659(0x1d4)]===0x0)throw new Error(_0x52a659(0x1b0));_0x4e65bc[_0x52a659(0x1dc)]();}else _0x4e65bc['push'](_0x552650);}}const _0x45b8f3=_0x4e65bc['join']('/');return _0x18a818[_0x52a659(0x1cd)][_0x52a659(0x1d8)]('/')?'/'+_0x45b8f3:_0x45b8f3;}export function normalizePath(_0x5ca4cd){const _0x38b7ff=a144_0x4ed7,_0x4530c2=parsePath(_0x5ca4cd),_0x4e43dd=[];for(const _0x4466a0 of _0x4530c2[_0x38b7ff(0x1d5)]){if(_0x4466a0==='.')continue;else{if(_0x4466a0==='..'){if(_0x4e43dd[_0x38b7ff(0x1d4)]===0x0){if(_0x4530c2[_0x38b7ff(0x1c4)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x4e43dd[_0x38b7ff(0x1c5)]('..');}else _0x4e43dd[_0x4e43dd[_0x38b7ff(0x1d4)]-0x1]==='..'?_0x4e43dd[_0x38b7ff(0x1c5)]('..'):_0x4e43dd[_0x38b7ff(0x1dc)]();}else _0x4e43dd[_0x38b7ff(0x1c5)](_0x4466a0);}}if(_0x4e43dd[_0x38b7ff(0x1d4)]===0x0)return _0x4530c2['isAbsolute']?'/':'.';const _0x4df2ec=_0x4e43dd[_0x38b7ff(0x1b6)]('/');return _0x4530c2['raw'][_0x38b7ff(0x1d8)]('/')?'/'+_0x4df2ec:_0x4df2ec;}export function getParentPath(_0x381427){const _0x47bc3d=a144_0x4ed7,_0x3f847b=parsePath(_0x381427);if(_0x3f847b[_0x47bc3d(0x1d5)][_0x47bc3d(0x1d4)]<=0x1)return'/';const _0x5b66b3=_0x3f847b[_0x47bc3d(0x1d5)]['slice'](0x0,-0x1)[_0x47bc3d(0x1b6)]('/');return _0x3f847b[_0x47bc3d(0x1cd)][_0x47bc3d(0x1d8)]('/')?'/'+_0x5b66b3:_0x5b66b3;}export function getBaseName(_0x1c74de){const _0x390e65=a144_0x4ed7,_0xf77be0=parsePath(_0x1c74de);return _0xf77be0['segments'][_0xf77be0[_0x390e65(0x1d5)]['length']-0x1]||'';}export function isChildPath(_0x16c0c6,_0x307f06){const _0x14166d=a144_0x4ed7,_0x3173ab=parsePath(_0x16c0c6),_0x10aeb7=parsePath(_0x307f06);if(_0x3173ab['segments'][_0x14166d(0x1d4)]<=_0x10aeb7[_0x14166d(0x1d5)][_0x14166d(0x1d4)])return![];for(let _0x299746=0x0;_0x299746<_0x10aeb7[_0x14166d(0x1d5)][_0x14166d(0x1d4)];_0x299746++){if(_0x3173ab[_0x14166d(0x1d5)][_0x299746]!==_0x10aeb7['segments'][_0x299746])return![];}return!![];}export function splitPath(_0x574f30){const _0x4c0696=a144_0x4ed7,_0x29f69e=parsePath(_0x574f30);if(_0x29f69e['segments'][_0x4c0696(0x1d4)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x29f69e[_0x4c0696(0x1d5)]['length']===0x1)return{'parent':_0x29f69e[_0x4c0696(0x1d5)][0x0]};return{'parent':_0x29f69e[_0x4c0696(0x1d5)][0x0],'child':_0x29f69e[_0x4c0696(0x1d5)][_0x4c0696(0x1d3)](0x1)['join']('/')};}export function isYamlFilePath(_0x268a45){const _0x243efb=a144_0x4ed7;return _0x268a45[_0x243efb(0x1c3)]('.yml')||_0x268a45['endsWith'](_0x243efb(0x1b7));}function a144_0x4ed7(_0x3765e9,_0x2a71fb){_0x3765e9=_0x3765e9-0x1b0;const _0x399aa8=a144_0x399a();let _0x4ed797=_0x399aa8[_0x3765e9];return _0x4ed797;}export async function resolveYamlFilePath(_0x4d4d75,_0x2fd534=nodeFileSystem){const _0x196d7f=a144_0x4ed7,_0x5391a1=a144_0x4a6314[_0x196d7f(0x1d2)](_0x4d4d75);if(!await _0x2fd534[_0x196d7f(0x1c0)](_0x5391a1))throw new Error(_0x196d7f(0x1c1)+_0x4d4d75);let _0xd7269c=a144_0x4a6314['dirname'](_0x5391a1),_0x2398df=null,_0x50d3e3=null;const _0x15ecb7=a144_0x4a6314['parse'](_0xd7269c)['root'];while(_0xd7269c!==_0x15ecb7){const _0x380d20=a144_0x4a6314[_0x196d7f(0x1b6)](_0xd7269c,_0x196d7f(0x1db));if(await _0x2fd534['exists'](_0x380d20)){_0x2398df=_0x380d20,_0x50d3e3=_0xd7269c;break;}_0xd7269c=a144_0x4a6314[_0x196d7f(0x1ce)](_0xd7269c);}if(!_0x2398df||!_0x50d3e3)throw new Error(_0x196d7f(0x1d6)+_0x4d4d75+'\x0a'+_0x196d7f(0x1c8));const _0x53547b=await _0x2fd534['readFile'](_0x2398df),_0x2ea48d=JSON[_0x196d7f(0x1ca)](_0x53547b),_0x31151f=_0x2ea48d['parent_segment'];if(!_0x31151f)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x2eda11=await _0x2fd534[_0x196d7f(0x1be)](_0x5391a1),_0x5e8754=a144_0x35ad14(_0x2eda11),_0x578bdc=_0x5e8754[_0x196d7f(0x1c9)];if(!_0x578bdc)throw new Error(_0x196d7f(0x1bb)+_0x4d4d75);const _0x5050d7=_0x5e8754[_0x196d7f(0x1b8)]===_0x196d7f(0x1cc)?'journey':'segment',_0x49eb98=a144_0x4a6314[_0x196d7f(0x1b2)](_0x50d3e3,_0x5391a1),_0x35760e=a144_0x4a6314['dirname'](_0x49eb98),_0x15b10f=_0x35760e==='.'?'':_0x35760e[_0x196d7f(0x1da)](/\\/g,'/'),_0x473427=_0x15b10f?_0x31151f+'/'+_0x15b10f+'/'+_0x578bdc:_0x31151f+'/'+_0x578bdc;return{'parentSegment':_0x31151f,'segmentName':_0x578bdc,'folderPath':_0x15b10f,'fullPath':_0x473427,'resourceType':_0x5050d7,'content':_0x2eda11};}
@@ -1 +1 @@
1
- function a145_0x435b(){const _0x5d0245=['802732iUUpJS','substring','.\x20Parent\x20name\x20cannot\x20be\x20empty','13411125DRGyde','1064070FKPSHU','1231521ZvYoar','indexOf','724182kUGWGM','Invalid\x20segment\x20reference\x20format:\x20','8zkRNwS','2490628QuTWMZ','85UbKxEF','.\x20Child\x20name\x20cannot\x20be\x20empty','119764CbUZNy'];a145_0x435b=function(){return _0x5d0245;};return a145_0x435b();}function a145_0x39f3(_0x479c38,_0x4e7eae){_0x479c38=_0x479c38-0x130;const _0x435b8e=a145_0x435b();let _0x39f3e2=_0x435b8e[_0x479c38];return _0x39f3e2;}(function(_0x2d44b9,_0x474356){const _0x43a8a2=a145_0x39f3,_0x25f79e=_0x2d44b9();while(!![]){try{const _0x4f017c=parseInt(_0x43a8a2(0x135))/0x1+parseInt(_0x43a8a2(0x13c))/0x2+parseInt(_0x43a8a2(0x133))/0x3+-parseInt(_0x43a8a2(0x13b))/0x4*(-parseInt(_0x43a8a2(0x139))/0x5)+parseInt(_0x43a8a2(0x132))/0x6+parseInt(_0x43a8a2(0x138))/0x7*(-parseInt(_0x43a8a2(0x137))/0x8)+-parseInt(_0x43a8a2(0x131))/0x9;if(_0x4f017c===_0x474356)break;else _0x25f79e['push'](_0x25f79e['shift']());}catch(_0x4e1fc5){_0x25f79e['push'](_0x25f79e['shift']());}}}(a145_0x435b,0x5be94));export function parseSegmentRef(_0x3befd8){const _0x16e0f7=a145_0x39f3,_0x379ebd=_0x3befd8[_0x16e0f7(0x134)]('/');if(_0x379ebd===-0x1)return{'parentId':_0x3befd8};if(_0x379ebd===0x0)throw new Error(_0x16e0f7(0x136)+_0x3befd8+_0x16e0f7(0x130));const _0x266bc1=_0x3befd8[_0x16e0f7(0x13d)](0x0,_0x379ebd),_0x1a8fd1=_0x3befd8[_0x16e0f7(0x13d)](_0x379ebd+0x1);if(_0x1a8fd1==='')throw new Error(_0x16e0f7(0x136)+_0x3befd8+_0x16e0f7(0x13a));return{'parentId':_0x266bc1,'childId':_0x1a8fd1};}
1
+ (function(_0x5b414b,_0x4eff51){const _0x262af9=a145_0x1306,_0x2940bd=_0x5b414b();while(!![]){try{const _0x1fbc84=parseInt(_0x262af9(0x93))/0x1+-parseInt(_0x262af9(0x9a))/0x2+parseInt(_0x262af9(0x9d))/0x3+parseInt(_0x262af9(0x96))/0x4+-parseInt(_0x262af9(0x98))/0x5*(parseInt(_0x262af9(0x92))/0x6)+parseInt(_0x262af9(0x9b))/0x7+parseInt(_0x262af9(0x99))/0x8*(parseInt(_0x262af9(0x94))/0x9);if(_0x1fbc84===_0x4eff51)break;else _0x2940bd['push'](_0x2940bd['shift']());}catch(_0x511622){_0x2940bd['push'](_0x2940bd['shift']());}}}(a145_0x376e,0xe3f5e));export function parseSegmentRef(_0x8d3302){const _0x2b4e00=a145_0x1306,_0x4c01aa=_0x8d3302['indexOf']('/');if(_0x4c01aa===-0x1)return{'parentId':_0x8d3302};if(_0x4c01aa===0x0)throw new Error(_0x2b4e00(0x9e)+_0x8d3302+_0x2b4e00(0x9c));const _0x200c74=_0x8d3302[_0x2b4e00(0x95)](0x0,_0x4c01aa),_0x3533d7=_0x8d3302['substring'](_0x4c01aa+0x1);if(_0x3533d7==='')throw new Error(_0x2b4e00(0x9e)+_0x8d3302+_0x2b4e00(0x97));return{'parentId':_0x200c74,'childId':_0x3533d7};}function a145_0x1306(_0x10f9f4,_0x5ef74f){_0x10f9f4=_0x10f9f4-0x92;const _0x376e82=a145_0x376e();let _0x13062c=_0x376e82[_0x10f9f4];return _0x13062c;}function a145_0x376e(){const _0x1e4819=['825879fFqDdt','Invalid\x20segment\x20reference\x20format:\x20','2537274BrKXEc','189850vxHave','9djYgFf','substring','2062792NzmdGe','.\x20Child\x20name\x20cannot\x20be\x20empty','20qRORBN','9402968ATOSKF','805612JeZztW','6102852pEkQAY','.\x20Parent\x20name\x20cannot\x20be\x20empty'];a145_0x376e=function(){return _0x1e4819;};return a145_0x376e();}