@treasuredata/tdx 2026.3.6 → 2026.3.8

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 (208) 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-command.js.map +1 -1
  11. package/dist/commands/auth-login-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.d.ts.map +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/profiles-command.js.map +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.d.ts.map +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/user-command.js.map +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/oauth-keychain.js +1 -1
  68. package/dist/core/oauth.d.ts.map +1 -1
  69. package/dist/core/oauth.js +1 -1
  70. package/dist/core/oauth.js.map +1 -1
  71. package/dist/core/profile.js +1 -1
  72. package/dist/core/project-config.js +1 -1
  73. package/dist/core/session.js +1 -1
  74. package/dist/core/user-cache.js +1 -1
  75. package/dist/core/version.js +1 -1
  76. package/dist/index.js +1 -1
  77. package/dist/mcp/server.js +1 -1
  78. package/dist/mcp/tools/index.js +1 -1
  79. package/dist/mcp/tools/tdx-run.js +1 -1
  80. package/dist/mcp/tools/tdx-search.js +1 -1
  81. package/dist/mcp/utils.js +1 -1
  82. package/dist/proxy/claude-usage-tracker.js +1 -1
  83. package/dist/proxy/passthrough-server.js +1 -1
  84. package/dist/proxy/sse-usage-parser.js +1 -1
  85. package/dist/sdk/agent/agent-config.js +1 -1
  86. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  87. package/dist/sdk/agent/agent-yaml.js +1 -1
  88. package/dist/sdk/agent/test/evaluator.js +1 -1
  89. package/dist/sdk/agent/test/executor.js +1 -1
  90. package/dist/sdk/agent/test/index.js +1 -1
  91. package/dist/sdk/agent/test/output.js +1 -1
  92. package/dist/sdk/agent/test/parser.js +1 -1
  93. package/dist/sdk/agent/tool-target-registry.js +1 -1
  94. package/dist/sdk/api.js +1 -1
  95. package/dist/sdk/client/cdp-api-client.js +1 -1
  96. package/dist/sdk/client/delivery-api-client.js +1 -1
  97. package/dist/sdk/client/endpoints.js +1 -1
  98. package/dist/sdk/client/engage-api-client.js +1 -1
  99. package/dist/sdk/client/http-client.js +1 -1
  100. package/dist/sdk/client/llm-api-client.js +1 -1
  101. package/dist/sdk/client/oauth-refresh.js +1 -1
  102. package/dist/sdk/client/rate-limiter.js +1 -1
  103. package/dist/sdk/client/td-api-client.js +1 -1
  104. package/dist/sdk/client/trino-api-client.js +1 -1
  105. package/dist/sdk/client/workflow-client.js +1 -1
  106. package/dist/sdk/connection-validator.js +1 -1
  107. package/dist/sdk/connection.js +1 -1
  108. package/dist/sdk/delivery.js +1 -1
  109. package/dist/sdk/engage/campaign-pull.js +1 -1
  110. package/dist/sdk/engage/campaign-push.js +1 -1
  111. package/dist/sdk/engage/campaign-validator.js +1 -1
  112. package/dist/sdk/engage/campaign-yaml.js +1 -1
  113. package/dist/sdk/engage/template-pull.js +1 -1
  114. package/dist/sdk/engage/template-push.js +1 -1
  115. package/dist/sdk/engage/template-validator.js +1 -1
  116. package/dist/sdk/engage/template-yaml.js +1 -1
  117. package/dist/sdk/engage/types/campaign-def.js +1 -1
  118. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  119. package/dist/sdk/engage/types/template-schema.js +1 -1
  120. package/dist/sdk/engage.js +1 -1
  121. package/dist/sdk/errors.js +1 -1
  122. package/dist/sdk/index.js +1 -1
  123. package/dist/sdk/io/index.js +1 -1
  124. package/dist/sdk/io/node-filesystem.js +1 -1
  125. package/dist/sdk/job.js +1 -1
  126. package/dist/sdk/journey.js +1 -1
  127. package/dist/sdk/llm/chat-cache.js +1 -1
  128. package/dist/sdk/llm/index.js +1 -1
  129. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  130. package/dist/sdk/llm/model-factors.js +1 -1
  131. package/dist/sdk/personalization.js +1 -1
  132. package/dist/sdk/query/index.js +1 -1
  133. package/dist/sdk/query/sql-parser.js +1 -1
  134. package/dist/sdk/realtime.js +1 -1
  135. package/dist/sdk/schedule.js +1 -1
  136. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  137. package/dist/sdk/segment/fields-display.js +1 -1
  138. package/dist/sdk/segment/file-discovery.js +1 -1
  139. package/dist/sdk/segment/journey-utils.js +1 -1
  140. package/dist/sdk/segment/journey-validator.js +1 -1
  141. package/dist/sdk/segment/journey-yaml.js +1 -1
  142. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  143. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  144. package/dist/sdk/segment/pull-workflow.js +1 -1
  145. package/dist/sdk/segment/push-recovery.js +1 -1
  146. package/dist/sdk/segment/push-workflow.js +1 -1
  147. package/dist/sdk/segment/resolution-context.js +1 -1
  148. package/dist/sdk/segment/segment-path-parser.js +1 -1
  149. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  150. package/dist/sdk/segment/segment-validator.js +1 -1
  151. package/dist/sdk/segment/target-resolution.js +1 -1
  152. package/dist/sdk/segment/tdx-config.js +1 -1
  153. package/dist/sdk/segment/types/activation-schema.js +1 -1
  154. package/dist/sdk/segment/types/journey-def.js +1 -1
  155. package/dist/sdk/segment/types/journey-schema.js +1 -1
  156. package/dist/sdk/segment/types/segment-def.js +1 -1
  157. package/dist/sdk/segment/types/segment-schema.js +1 -1
  158. package/dist/sdk/segment/validate-files.js +1 -1
  159. package/dist/sdk/segment/yaml-validator.js +1 -1
  160. package/dist/sdk/segment.js +1 -1
  161. package/dist/sdk/types/index.js +1 -1
  162. package/dist/sdk/types/progress.js +1 -1
  163. package/dist/sdk/user.js +1 -1
  164. package/dist/sdk/util/format-detector.js +1 -1
  165. package/dist/sdk/util/formatters.js +1 -1
  166. package/dist/sdk/util/index.js +1 -1
  167. package/dist/sdk/util/paginate.js +1 -1
  168. package/dist/sdk/util/tree-formatter.js +1 -1
  169. package/dist/sdk/workflow/archive-validation.js +1 -1
  170. package/dist/sdk/workflow/clone-workflow.js +1 -1
  171. package/dist/sdk/workflow/index.js +1 -1
  172. package/dist/sdk/workflow/pull-workflow.js +1 -1
  173. package/dist/sdk/workflow/push-workflow.js +1 -1
  174. package/dist/sdk/workflow/tdx-config.js +1 -1
  175. package/dist/sdk/workflow/workflow-utils.js +1 -1
  176. package/dist/test-utils/command-runner.js +1 -1
  177. package/dist/test-utils/factories.js +1 -1
  178. package/dist/test-utils/fixtures.js +1 -1
  179. package/dist/test-utils/http-mock.js +1 -1
  180. package/dist/test-utils/index.js +1 -1
  181. package/dist/utils/async.js +1 -1
  182. package/dist/utils/colors.js +1 -1
  183. package/dist/utils/diff.js +1 -1
  184. package/dist/utils/file-permissions.js +1 -1
  185. package/dist/utils/file-reader.js +1 -1
  186. package/dist/utils/github-releases.js +1 -1
  187. package/dist/utils/global-cache.js +1 -1
  188. package/dist/utils/json-loader.js +1 -1
  189. package/dist/utils/local-cache.js +1 -1
  190. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  191. package/dist/utils/logger/formatters/index.js +1 -1
  192. package/dist/utils/logger/handlers/console-handler.js +1 -1
  193. package/dist/utils/logger/handlers/file-handler.js +1 -1
  194. package/dist/utils/logger/handlers/index.js +1 -1
  195. package/dist/utils/logger/handlers/null-handler.js +1 -1
  196. package/dist/utils/logger/index.js +1 -1
  197. package/dist/utils/logger/logger.js +1 -1
  198. package/dist/utils/logger/types.js +1 -1
  199. package/dist/utils/option-validation.js +1 -1
  200. package/dist/utils/process.js +1 -1
  201. package/dist/utils/prompt.js +1 -1
  202. package/dist/utils/spinner.js +1 -1
  203. package/dist/utils/sse-parser.js +1 -1
  204. package/dist/utils/string-utils.js +1 -1
  205. package/dist/utils/table-ref-parser.js +1 -1
  206. package/dist/utils/tdx-logger.js +1 -1
  207. package/dist/utils/version-check.js +1 -1
  208. package/package.json +1 -1
@@ -1 +1 @@
1
- function a139_0x5349(){const _0x1001b7=['86232Uovqkx','tdx.sdk.push-recovery','ENOENT','2TCrwyE','1224594RqiHVb','join','92199WJBgPq','segments','version','toISOString','debug','dirname','36995zHefIJ','journeyName','basename','stringify','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','.tmp','747QDOUvH','335024phWvXy','warn','1879104urTryb','parse','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','.push-recovery.json','28000VSQYLb','15IDfrnV'];a139_0x5349=function(){return _0x1001b7;};return a139_0x5349();}const a139_0x488f49=a139_0x1e65;(function(_0x723e8,_0x3a6128){const _0x341556=a139_0x1e65,_0x1120fd=_0x723e8();while(!![]){try{const _0x281980=parseInt(_0x341556(0xe8))/0x1+-parseInt(_0x341556(0xdf))/0x2*(-parseInt(_0x341556(0xe2))/0x3)+-parseInt(_0x341556(0xd3))/0x4+parseInt(_0x341556(0xdb))/0x5*(-parseInt(_0x341556(0xdc))/0x6)+parseInt(_0x341556(0xe0))/0x7+parseInt(_0x341556(0xd5))/0x8+parseInt(_0x341556(0xd2))/0x9*(-parseInt(_0x341556(0xda))/0xa);if(_0x281980===_0x3a6128)break;else _0x1120fd['push'](_0x1120fd['shift']());}catch(_0x1aa3b8){_0x1120fd['push'](_0x1120fd['shift']());}}}(a139_0x5349,0x1ce0e));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a139_0x2915e0 from'path';function a139_0x1e65(_0x5e24c7,_0x1deb93){_0x5e24c7=_0x5e24c7-0xd0;const _0x534991=a139_0x5349();let _0x1e65c7=_0x534991[_0x5e24c7];return _0x1e65c7;}import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a139_0x488f49(0xdd));export function getPushRecoveryPath(_0x267548){const _0x4092bd=a139_0x488f49,_0x30ee78=a139_0x2915e0[_0x4092bd(0xe7)](_0x267548),_0x5466e3=a139_0x2915e0[_0x4092bd(0xea)](_0x267548);return a139_0x2915e0[_0x4092bd(0xe1)](_0x30ee78,'.'+_0x5466e3+_0x4092bd(0xd9));}export function readPushRecovery(_0x4fa805){const _0x29ef92=a139_0x488f49,_0x44f213=getPushRecoveryPath(_0x4fa805);if(!existsSync(_0x44f213))return undefined;try{const _0x5adaef=readFileSync(_0x44f213,'utf-8'),_0x1cca3b=JSON[_0x29ef92(0xd6)](_0x5adaef);if(_0x1cca3b?.[_0x29ef92(0xe4)]!==0x1||typeof _0x1cca3b[_0x29ef92(0xe9)]!=='string')return undefined;return _0x1cca3b;}catch(_0x106759){return _0x106759 instanceof SyntaxError?logger[_0x29ef92(0xe6)](_0x29ef92(0xd8)+_0x106759):logger[_0x29ef92(0xd4)](_0x29ef92(0xd7)+_0x106759),undefined;}}export function writePushRecovery(_0xac9e92,_0x5433d8){const _0x44a91a=a139_0x488f49,_0x27e170=getPushRecoveryPath(_0xac9e92),_0xdd47c5=_0x27e170+_0x44a91a(0xd1);writeFileSync(_0xdd47c5,JSON[_0x44a91a(0xeb)](_0x5433d8,null,0x2)+'\x0a','utf-8'),renameSync(_0xdd47c5,_0x27e170);}export function deletePushRecovery(_0x1ee9a1){const _0x9f110d=a139_0x488f49,_0x2550fa=getPushRecoveryPath(_0x1ee9a1);try{unlinkSync(_0x2550fa);}catch(_0x3ab970){_0x3ab970['code']!==_0x9f110d(0xde)&&logger[_0x9f110d(0xe6)](_0x9f110d(0xd0)+_0x3ab970);}}export function saveSegmentToPushRecovery(_0x51c3ed,_0x5c6601,_0x3fe96c,_0xd8dd88){const _0x5d0b17=a139_0x488f49,_0x3b941f=readPushRecovery(_0x51c3ed),_0x50f018=_0x3b941f?.[_0x5d0b17(0xe9)]===_0x5c6601?{..._0x3b941f,'updatedAt':new Date()[_0x5d0b17(0xe5)]()}:{'version':0x1,'journeyName':_0x5c6601,'updatedAt':new Date()[_0x5d0b17(0xe5)](),'segments':{}};_0x50f018[_0x5d0b17(0xe3)][_0x3fe96c]=_0xd8dd88,writePushRecovery(_0x51c3ed,_0x50f018);}
1
+ const a139_0x16393b=a139_0xdc2d;(function(_0x1251b4,_0xbb31eb){const _0x1c9ed0=a139_0xdc2d,_0x20bb8c=_0x1251b4();while(!![]){try{const _0x309a8b=parseInt(_0x1c9ed0(0xb8))/0x1*(-parseInt(_0x1c9ed0(0xae))/0x2)+-parseInt(_0x1c9ed0(0xb7))/0x3*(parseInt(_0x1c9ed0(0xb2))/0x4)+parseInt(_0x1c9ed0(0xaa))/0x5*(-parseInt(_0x1c9ed0(0xb6))/0x6)+parseInt(_0x1c9ed0(0xb0))/0x7*(parseInt(_0x1c9ed0(0xac))/0x8)+parseInt(_0x1c9ed0(0xc2))/0x9*(parseInt(_0x1c9ed0(0xc1))/0xa)+-parseInt(_0x1c9ed0(0xb4))/0xb*(parseInt(_0x1c9ed0(0xba))/0xc)+parseInt(_0x1c9ed0(0xaf))/0xd;if(_0x309a8b===_0xbb31eb)break;else _0x20bb8c['push'](_0x20bb8c['shift']());}catch(_0x1aca7a){_0x20bb8c['push'](_0x20bb8c['shift']());}}}(a139_0x4819,0x2074f));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a139_0x144f45 from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a139_0x16393b(0xbf));function a139_0xdc2d(_0x1b1417,_0x75de66){_0x1b1417=_0x1b1417-0xa9;const _0x48195d=a139_0x4819();let _0xdc2daa=_0x48195d[_0x1b1417];return _0xdc2daa;}export function getPushRecoveryPath(_0xeea0cf){const _0x279b03=a139_0x16393b,_0x2e9bd2=a139_0x144f45[_0x279b03(0xb3)](_0xeea0cf),_0x13e4a1=a139_0x144f45[_0x279b03(0xc3)](_0xeea0cf);return a139_0x144f45[_0x279b03(0xb5)](_0x2e9bd2,'.'+_0x13e4a1+'.push-recovery.json');}export function readPushRecovery(_0x2b5d1b){const _0xd8f140=a139_0x16393b,_0x30ce34=getPushRecoveryPath(_0x2b5d1b);if(!existsSync(_0x30ce34))return undefined;try{const _0x3e7c2b=readFileSync(_0x30ce34,'utf-8'),_0x3ec963=JSON['parse'](_0x3e7c2b);if(_0x3ec963?.['version']!==0x1||typeof _0x3ec963[_0xd8f140(0xb1)]!==_0xd8f140(0xad))return undefined;return _0x3ec963;}catch(_0x290f29){return _0x290f29 instanceof SyntaxError?logger[_0xd8f140(0xb9)]('Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20'+_0x290f29):logger[_0xd8f140(0xbe)](_0xd8f140(0xc0)+_0x290f29),undefined;}}export function writePushRecovery(_0x3f7a85,_0x2fd68a){const _0x212ab4=a139_0x16393b,_0x5a6aab=getPushRecoveryPath(_0x3f7a85),_0x3e3ae5=_0x5a6aab+_0x212ab4(0xa9);writeFileSync(_0x3e3ae5,JSON['stringify'](_0x2fd68a,null,0x2)+'\x0a','utf-8'),renameSync(_0x3e3ae5,_0x5a6aab);}export function deletePushRecovery(_0x14fae3){const _0x24c3c3=a139_0x16393b,_0x1fb6a3=getPushRecoveryPath(_0x14fae3);try{unlinkSync(_0x1fb6a3);}catch(_0x171a34){_0x171a34[_0x24c3c3(0xab)]!=='ENOENT'&&logger[_0x24c3c3(0xb9)](_0x24c3c3(0xbc)+_0x171a34);}}function a139_0x4819(){const _0x3f4434=['281785ltDirg','journeyName','16bkkOWJ','dirname','3047RdQNmQ','join','191442kUgZVE','97308lOSYLN','13258vQxNES','debug','5724ozuUnJ','segments','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','toISOString','warn','tdx.sdk.push-recovery','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','190hvEOlk','124092NDPrWz','basename','.tmp','5OQZKyV','code','48JxAzRU','string','16VcJHaF','380705kAjsBM'];a139_0x4819=function(){return _0x3f4434;};return a139_0x4819();}export function saveSegmentToPushRecovery(_0x60be95,_0xeecd79,_0xcaccfa,_0x51622f){const _0x265c16=a139_0x16393b,_0x26fa81=readPushRecovery(_0x60be95),_0x3f2c54=_0x26fa81?.[_0x265c16(0xb1)]===_0xeecd79?{..._0x26fa81,'updatedAt':new Date()[_0x265c16(0xbd)]()}:{'version':0x1,'journeyName':_0xeecd79,'updatedAt':new Date()[_0x265c16(0xbd)](),'segments':{}};_0x3f2c54[_0x265c16(0xbb)][_0xcaccfa]=_0x51622f,writePushRecovery(_0x60be95,_0x3f2c54);}
@@ -1 +1 @@
1
- const a140_0x2324c6=a140_0x2c4f;(function(_0xce9f45,_0x19bf31){const _0xbc5037=a140_0x2c4f,_0x4b34eb=_0xce9f45();while(!![]){try{const _0x2ba7eb=parseInt(_0xbc5037(0x136))/0x1+-parseInt(_0xbc5037(0x149))/0x2*(parseInt(_0xbc5037(0x1ad))/0x3)+-parseInt(_0xbc5037(0x11c))/0x4*(parseInt(_0xbc5037(0x1a8))/0x5)+parseInt(_0xbc5037(0x12f))/0x6*(-parseInt(_0xbc5037(0x174))/0x7)+-parseInt(_0xbc5037(0x18a))/0x8*(parseInt(_0xbc5037(0x12a))/0x9)+parseInt(_0xbc5037(0x1bc))/0xa+parseInt(_0xbc5037(0x1ff))/0xb;if(_0x2ba7eb===_0x19bf31)break;else _0x4b34eb['push'](_0x4b34eb['shift']());}catch(_0x5ce85a){_0x4b34eb['push'](_0x4b34eb['shift']());}}}(a140_0x1beb,0x292b5));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x2324c6(0x1e8));export const PENDING_SEGMENT_PREFIX=a140_0x2324c6(0x141);export const PENDING_ACTIVATION_PREFIX=a140_0x2324c6(0x1f3);export function createPendingSegmentId(_0x426b75){return''+PENDING_SEGMENT_PREFIX+_0x426b75+'__';}export function isPendingSegmentId(_0x3c8af2){return _0x3c8af2['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x3c8af2['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x5899c5){const _0x3ae535=a140_0x2324c6;return _0x5899c5[_0x3ae535(0x13c)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0xe0c636){return''+PENDING_ACTIVATION_PREFIX+_0xe0c636+'__';}export function isPendingActivationId(_0x483a3d){const _0x4bf8ea=a140_0x2324c6;return _0x483a3d[_0x4bf8ea(0x1cb)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5eaadf){const _0x15405f=a140_0x2324c6;return _0x5eaadf[_0x15405f(0x13c)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x12935b,_0x2e6368){const _0x5d82e2=a140_0x2324c6,_0x30e221=_0x12935b+'::'+(_0x2e6368[_0x5d82e2(0x111)]()||_0x5d82e2(0x176)),_0x2eeb59=createHash(_0x5d82e2(0x1d2))[_0x5d82e2(0x10b)](_0x30e221)[_0x5d82e2(0x122)]('hex')['slice'](0x0,0xc);return'journey_entry_criteria_'+_0x2eeb59;}export function ensureJourneyDefaults(_0x45e2b0){const _0x3de0dc=a140_0x2324c6;!_0x45e2b0['description']&&(_0x45e2b0['description']=''),!_0x45e2b0[_0x3de0dc(0x19f)]&&(_0x45e2b0[_0x3de0dc(0x19f)]=_0x3de0dc(0x1c6));}export function injectExistingStageIds(_0x4c8e99,_0x4169c2){const _0x4948df=a140_0x2324c6,_0x5f30fc=new Map(_0x4169c2[_0x4948df(0x1ac)](_0x3abe98=>[_0x3abe98[_0x4948df(0x1b4)],_0x3abe98['id']]));for(const _0x316292 of _0x4c8e99){if(!_0x316292['id']){const _0x550669=_0x5f30fc[_0x4948df(0x115)](_0x316292[_0x4948df(0x1b4)]);_0x550669&&(_0x316292['id']=_0x550669);}}}export function resolveTDFolderPath(_0x239a97,_0x5308c9,_0x2e6e45){if(!_0x5308c9)return _0x239a97;if(_0x239a97===_0x2e6e45||_0x239a97['startsWith'](_0x2e6e45+'/'))return _0x239a97;return _0x239a97?_0x2e6e45+'/'+_0x239a97:_0x2e6e45;}export function addFoldersToCreate(_0x518d4a,_0x35a636,_0x470026){const _0x3b6c6d=a140_0x2324c6;if(!_0x518d4a)return;if(_0x35a636['has'](_0x518d4a))return;const _0xd0c656=_0x518d4a['split']('/');let _0x27bc5d='';for(const _0x427e43 of _0xd0c656){_0x27bc5d=_0x27bc5d?_0x27bc5d+'/'+_0x427e43:_0x427e43,!_0x35a636[_0x3b6c6d(0x18f)](_0x27bc5d)&&_0x470026['add'](_0x27bc5d);}}export function sortFoldersByDepth(_0x2709b8){const _0x7313d1=a140_0x2324c6;return[..._0x2709b8][_0x7313d1(0x1e6)]((_0x13c036,_0x296f90)=>{const _0x43dff6=_0x7313d1,_0x5c1706=(_0x13c036['match'](/\//g)||[])['length'],_0x5d5937=(_0x296f90[_0x43dff6(0x199)](/\//g)||[])[_0x43dff6(0x13b)];return _0x5c1706-_0x5d5937;});}import*as a140_0x13bab5 from'yaml';import{readFileSync}from'fs';import a140_0x55cf1c from'path';import{isJourneyDef,parseYamlString as a140_0x4d7e52,toYamlString as a140_0x115742,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 a140_0x2c4f(_0x58b71c,_0x17c3e4){_0x58b71c=_0x58b71c-0xfa;const _0x1bebaa=a140_0x1beb();let _0x2c4fe1=_0x1bebaa[_0x58b71c];return _0x2c4fe1;}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(_0x11092a){const _0x3255b6=a140_0x2324c6;if(Array['isArray'](_0x11092a))return'['+_0x11092a['map'](_0x3e1cf0=>stableStringify(_0x3e1cf0))[_0x3255b6(0x1af)](',')+']';if(_0x11092a&&typeof _0x11092a===_0x3255b6(0x106)){const _0x1d69c3=_0x11092a,_0x36a17e=Object[_0x3255b6(0x1c9)](_0x1d69c3)[_0x3255b6(0x1e6)](),_0x2b1c7a=_0x36a17e[_0x3255b6(0x1ac)](_0x4ec815=>'\x22'+_0x4ec815+'\x22:'+stableStringify(_0x1d69c3[_0x4ec815]));return'{'+_0x2b1c7a['join'](',')+'}';}const _0x309b41=JSON[_0x3255b6(0x117)](_0x11092a);return _0x309b41===undefined?_0x3255b6(0x1cd):_0x309b41;}function activationSignature(_0xd56c2){const _0x1995fc=a140_0x2324c6,_0x110f4a={'connection':_0xd56c2['connection'],..._0xd56c2[_0x1995fc(0x10f)]!==undefined&&{'all_columns':_0xd56c2[_0x1995fc(0x10f)]},..._0xd56c2[_0x1995fc(0x181)]!==undefined&&{'columns':_0xd56c2[_0x1995fc(0x181)]},..._0xd56c2[_0x1995fc(0x19b)]!==undefined&&{'behavior':_0xd56c2['behavior']},..._0xd56c2[_0x1995fc(0x1a9)]!==undefined&&{'schedule':_0xd56c2[_0x1995fc(0x1a9)]},..._0xd56c2['notification']!==undefined&&{'notification':_0xd56c2[_0x1995fc(0x1be)]},..._0xd56c2[_0x1995fc(0x1b8)]!==undefined&&{'connector_config':_0xd56c2['connector_config']},..._0xd56c2[_0x1995fc(0x1a5)]!==undefined&&{'activation_template_id':_0xd56c2[_0x1995fc(0x1a5)]}};return stableStringify(_0x110f4a);}async function fetchSegment(_0x42a0f3,_0x6f2021,_0x12f2de,_0x434a71){const _0x51390a=a140_0x2324c6,_0x32f73a=_0x434a71?.[_0x51390a(0x1dd)](_0x3b2580=>_0x3b2580['id']===_0x12f2de);if(_0x32f73a)return _0x32f73a;try{return await _0x42a0f3[_0x51390a(0x176)][_0x51390a(0xfc)](_0x6f2021,_0x12f2de);}catch(_0x4257aa){logger[_0x51390a(0x14a)](_0x51390a(0x1aa)+_0x12f2de+_0x51390a(0x11e)+_0x4257aa);try{return await _0x42a0f3[_0x51390a(0x176)]['getSegmentEntity'](_0x12f2de);}catch(_0xe5dca9){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x12f2de+':\x20'+_0xe5dca9),null;}}}function recoverSegmentIdsFromPushRecovery(_0xc1229f,_0x27429a,_0x376fed){const _0xceeb4a=a140_0x2324c6,_0x3fa1a1=readPushRecovery(_0xc1229f[_0xceeb4a(0x164)]);if(_0x3fa1a1?.[_0xceeb4a(0x1d9)]===_0xc1229f[_0xceeb4a(0x189)][_0xceeb4a(0x1b4)])for(const [_0x1ce4f3,_0x510dd4]of Object[_0xceeb4a(0xfd)](_0x3fa1a1['segments'])){const _0x17a910=generateDeterministicJourneySegmentName(_0xc1229f['yamlConfig'][_0xceeb4a(0x1b4)],_0x1ce4f3);_0x510dd4[_0xceeb4a(0x1f0)]===_0x17a910&&(_0x27429a[_0xceeb4a(0x12c)](_0x1ce4f3,_0x510dd4[_0xceeb4a(0x1e5)]),_0x376fed['set'](_0x1ce4f3,_0x510dd4[_0xceeb4a(0x1e5)]));}}async function createOrRecoverEmbeddedSegment(_0x26a142,_0x57e82d,_0x1866ef,_0x3f3d1e){const _0x2b3a45=a140_0x2324c6;let _0x4eccfe;try{_0x4eccfe=await _0x26a142[_0x2b3a45(0x176)][_0x2b3a45(0x155)]({'name':_0x1866ef['uniqueSegmentName'],'description':_0x1866ef[_0x2b3a45(0x198)],'journeyId':_0x1866ef[_0x2b3a45(0x15b)],'rule':_0x3f3d1e(_0x1866ef['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x1866ef[_0x2b3a45(0x1b9)],'audienceId':_0x1866ef['parentId']});}catch(_0x5295dc){const _0x8fbbd5=_0x5295dc instanceof Error&&_0x5295dc[_0x2b3a45(0x1a7)][_0x2b3a45(0x104)]('Name\x20has\x20already\x20been\x20taken');if(_0x8fbbd5){const _0x15eb4f=readPushRecovery(_0x57e82d['absolutePath']),_0x24033f=_0x15eb4f?.[_0x2b3a45(0x1d9)]===_0x57e82d[_0x2b3a45(0x189)][_0x2b3a45(0x1b4)]?_0x15eb4f[_0x2b3a45(0x14c)][_0x1866ef[_0x2b3a45(0x10e)]]:undefined;if(_0x24033f?.[_0x2b3a45(0x1f0)]===_0x1866ef[_0x2b3a45(0x127)])await _0x26a142['segment'][_0x2b3a45(0x1ea)](_0x1866ef['parentId'],_0x24033f[_0x2b3a45(0x1e5)],{'description':_0x1866ef[_0x2b3a45(0x198)],'rule':_0x3f3d1e(_0x1866ef[_0x2b3a45(0x1d7)],!![]),'countPopulation':!![]}),_0x4eccfe=_0x24033f[_0x2b3a45(0x1e5)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0x1866ef[_0x2b3a45(0x10e)]+_0x2b3a45(0x191)+(_0x2b3a45(0x1c2)+_0x57e82d['absolutePath']['replace'](/([^/]+)$/,_0x2b3a45(0x1e3))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x5295dc);}else throw _0x5295dc;}return saveSegmentToPushRecovery(_0x57e82d[_0x2b3a45(0x164)],_0x57e82d[_0x2b3a45(0x189)]['name'],_0x1866ef['localName'],{'segmentId':_0x4eccfe,'uniqueServerName':_0x1866ef['uniqueSegmentName'],'createdAt':new Date()[_0x2b3a45(0x19e)]()}),_0x4eccfe;}export async function prepareSegmentFiles(_0x4c9b37,_0x39a33b,_0x59111e,_0x269ead,_0x48c636){const _0x212a12=a140_0x2324c6,{activationDefToCreateRequest:_0x55de21}=await import('./child-segment-yaml.js'),_0x527a46=[],_0xc5266=new Set();for(const {yamlConfig:_0x4e7a0a,folderPath:_0x44d145,sourcePath:_0x73ddfc}of _0x4c9b37){const _0x15eabb=resolveTDFolderPath(_0x44d145,_0x269ead,_0x48c636),_0x2a5c97=_0x15eabb+':'+_0x4e7a0a[_0x212a12(0x1b4)],_0x5f5d35=_0x39a33b[_0x212a12(0x1bf)][_0x212a12(0x115)](_0x2a5c97),_0x4219ee=_0x5f5d35?_0x39a33b['activationsBySegmentId'][_0x212a12(0x115)](_0x5f5d35['id'])||[]:[];addFoldersToCreate(_0x15eabb,_0x39a33b[_0x212a12(0x1b6)],_0xc5266);const _0x7daa13=calculateActivationActions(_0x4e7a0a[_0x212a12(0x158)]||[],_0x4219ee,_0x39a33b[_0x212a12(0x133)],_0x39a33b[_0x212a12(0x1c8)]);for(const _0x56a20c of _0x7daa13){(_0x56a20c[_0x212a12(0x13e)]===_0x212a12(0x1f1)||_0x56a20c['type']===_0x212a12(0x10b))&&_0x56a20c['yamlActivation']&&(_0x56a20c[_0x212a12(0x1ec)]=await _0x55de21(_0x56a20c['yamlActivation'],_0x59111e));}const _0x39becc=calculateSegmentDiff(_0x4e7a0a,_0x5f5d35,_0x4219ee,_0x39a33b[_0x212a12(0x133)],_0x39a33b[_0x212a12(0x1c8)]);_0x527a46[_0x212a12(0x1fb)]({'relativePath':_0x4e7a0a[_0x212a12(0x1b4)],'absolutePath':_0x73ddfc,'yamlConfig':_0x4e7a0a,'folderPath':_0x15eabb,'existingSegment':_0x5f5d35,'existingActivations':_0x4219ee,'isNew':_0x39becc[_0x212a12(0x13a)],'hasChanges':_0x39becc[_0x212a12(0x196)],'diff':_0x39becc[_0x212a12(0x202)],'activationActions':_0x7daa13});}return{'segmentFiles':_0x527a46,'foldersToCreate':_0xc5266};}export async function prepareJourneyFiles(_0x29dc58,_0x55a262,_0x5644e4,_0x4f2525){const _0x5d4c92=a140_0x2324c6,_0x49c7f=[],_0x34f0e5=new Set();for(const {yamlConfig:_0x5514b5,folderPath:_0x5d9863,sourcePath:_0x53fcd3}of _0x29dc58){const _0x1eb8be=resolveTDFolderPath(_0x5d9863,_0x5644e4,_0x4f2525),_0x23f4f9=_0x1eb8be+':'+_0x5514b5[_0x5d4c92(0x1b4)],_0x91a446=_0x55a262['journeyBundlesByFolderAndName'][_0x5d4c92(0x115)](_0x23f4f9);let _0x5f300a,_0x5e1677;if(_0x91a446&&_0x91a446['length']>0x0){const _0x231f3f=buildLocalExpandedRuleMappings(_0x5514b5),{createYamlContext:_0x5b3089,prefetchJourneySegments:_0x42a8db}=createPushYamlContextForBundle(_0x55a262[_0x5d4c92(0x135)],_0x55a262[_0x5d4c92(0x194)],_0x55a262[_0x5d4c92(0x1fd)],_0x231f3f,_0x55a262[_0x5d4c92(0x133)],_0x55a262[_0x5d4c92(0x1c8)],_0x55a262[_0x5d4c92(0x1cf)],_0x55a262[_0x5d4c92(0x1fc)]);await _0x42a8db(_0x91a446[_0x5d4c92(0x1ac)](_0x209f25=>_0x209f25['id']));const _0x233614=await _0x55a262[_0x5d4c92(0x135)]['journey'][_0x5d4c92(0x18c)](_0x91a446[0x0][_0x5d4c92(0x109)]),_0x12460d=hasMultipleVersions(_0x5514b5),_0x291322=async _0x520e51=>{const _0x3777db=_0x5d4c92,_0x1e9405=_0x55a262['journeyById']?.[_0x3777db(0x115)](_0x520e51);if(_0x1e9405)return _0x1e9405;return _0x55a262[_0x3777db(0x173)]({'journeyId':_0x520e51,'journeyName':_0x5514b5['name'],'isMultiVersion':_0x91a446[_0x3777db(0x13b)]>0x1});};if(_0x12460d&&_0x91a446[_0x5d4c92(0x13b)]>0x1){const _0x218658=[];for(const _0x380616 of _0x91a446){const _0x304800=_0x380616[_0x5d4c92(0x1a3)]||0x1;_0x55a262[_0x5d4c92(0x201)]?.[_0x5d4c92(0x10b)](_0x5d4c92(0x151)+_0x5514b5[_0x5d4c92(0x1b4)]+'\x20v'+_0x304800);const _0x2ad626=await _0x291322(_0x380616['id']),_0x41d614=_0x5b3089(_0x380616['id']),_0x4008c0=await journeyResponseToDef(_0x2ad626,_0x41d614);_0x218658[_0x5d4c92(0x1fb)]({'item':_0x380616,'yaml':_0x4008c0});}const _0x1701b7=buildLocalRuleToNameMappingFromJourney(_0x5514b5);_0x5e1677=buildMergedJourneyDef(_0x218658,_0x1701b7,_0x233614);const _0x4d1b04=Math['max'](..._0x218658[_0x5d4c92(0x1ac)](_0x224e72=>_0x224e72[_0x5d4c92(0x190)][_0x5d4c92(0x1a3)]||0x0)),_0x15754f=_0x91a446[_0x5d4c92(0x1dd)](_0x241e22=>(_0x241e22[_0x5d4c92(0x1a3)]||0x0)===_0x4d1b04);_0x15754f&&(_0x55a262['progress']?.[_0x5d4c92(0x10b)]('Fetching\x20'+_0x5514b5['name']+'\x20v'+_0x4d1b04),_0x5f300a=await _0x291322(_0x15754f['id']));}else{const _0x1a24be=_0x91a446[_0x91a446[_0x5d4c92(0x13b)]-0x1];_0x55a262[_0x5d4c92(0x201)]?.[_0x5d4c92(0x10b)](_0x5d4c92(0x151)+_0x5514b5[_0x5d4c92(0x1b4)]),_0x5f300a=await _0x291322(_0x1a24be['id']);const _0x4118cf=_0x5b3089(_0x1a24be['id']),_0x18a978=await journeyResponseToDef(_0x5f300a,_0x4118cf),_0xe96ef4=buildLocalRuleToNameMappingFromJourney(_0x5514b5);_0x5e1677=buildMergedJourneyDef([{'item':_0x1a24be,'yaml':_0x18a978}],_0xe96ef4,_0x233614);}}addFoldersToCreate(_0x1eb8be,_0x55a262['folderPathToId'],_0x34f0e5);const _0x3c6a1d=calculateJourneyDiff(_0x5514b5,_0x5e1677);_0x49c7f[_0x5d4c92(0x1fb)]({'relativePath':_0x5514b5[_0x5d4c92(0x1b4)],'absolutePath':_0x53fcd3,'yamlConfig':_0x5514b5,'folderPath':_0x1eb8be,'existingJourney':_0x5f300a,'isNew':_0x3c6a1d[_0x5d4c92(0x13a)],'hasChanges':_0x3c6a1d[_0x5d4c92(0x196)],'diff':_0x3c6a1d[_0x5d4c92(0x202)]});}return{'journeyFiles':_0x49c7f,'foldersToCreate':_0x34f0e5};}export function calculateActivationActions(_0x1074f0,_0x273108,_0x527174,_0x63aa6b){const _0x17c38b=a140_0x2324c6,_0x2a20ff=[],_0x2c3daf=new Map();for(const _0x53f55a of _0x273108){_0x2c3daf[_0x17c38b(0x12c)](_0x53f55a['name'],_0x53f55a);}const _0x3fe4b2=new Map();for(const _0x2a3be9 of _0x1074f0){_0x3fe4b2[_0x17c38b(0x12c)](_0x2a3be9[_0x17c38b(0x1b4)],_0x2a3be9);}for(const _0x375473 of _0x1074f0){const _0x35783d=_0x2c3daf['get'](_0x375473[_0x17c38b(0x1b4)]);if(!_0x35783d)_0x2a20ff[_0x17c38b(0x1fb)]({'type':'create','name':_0x375473[_0x17c38b(0x1b4)],'yamlActivation':_0x375473});else{const _0x1a3b50=activationResponseToDef(_0x35783d,_0x527174,_0x63aa6b),_0xcc5adb=a140_0x13bab5[_0x17c38b(0x117)](_0x1a3b50),_0x3aa71f=a140_0x13bab5['stringify'](_0x375473);_0xcc5adb!==_0x3aa71f&&_0x2a20ff[_0x17c38b(0x1fb)]({'type':_0x17c38b(0x10b),'name':_0x375473[_0x17c38b(0x1b4)],'yamlActivation':_0x375473,'existingActivation':_0x35783d});}}for(const _0x239800 of _0x273108){!_0x3fe4b2[_0x17c38b(0x18f)](_0x239800[_0x17c38b(0x1b4)])&&_0x2a20ff[_0x17c38b(0x1fb)]({'type':'delete','name':_0x239800[_0x17c38b(0x1b4)],'existingActivation':_0x239800});}return _0x2a20ff;}function calculateYamlDiff(_0xfea7f0,_0x4546a1){if(_0x4546a1){const _0x3a4fd9=generateDiff(_0x4546a1,_0xfea7f0),_0x59dbab=hasChanges(_0x3a4fd9);return{'isNew':![],'hasChanges':_0x59dbab,'diff':_0x59dbab?formatDiffWithColors(_0x3a4fd9):undefined};}const _0xfbfa17=generateDiff('',_0xfea7f0);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0xfbfa17)};}export function calculateSegmentDiff(_0x76be63,_0x4ea92e,_0x3b4d20,_0x27a6da,_0x35151d){const _0x57c0d3=segmentToYamlString(_0x76be63),_0x322ca8=_0x4ea92e?segmentToYamlString(segmentWithActivationsToYaml(_0x4ea92e,_0x3b4d20,undefined,_0x27a6da,_0x35151d)):undefined;return calculateYamlDiff(_0x57c0d3,_0x322ca8);}export function calculateJourneyDiff(_0xaab12a,_0x5bf9ff){const _0x36eb83=normalizeJourneyDef(_0xaab12a,_0xaab12a),_0x33231d=a140_0x115742(_0x36eb83),_0x58ed41=_0x5bf9ff?a140_0x115742(normalizeJourneyDef(_0x5bf9ff,_0xaab12a)):undefined;return calculateYamlDiff(_0x33231d,_0x58ed41);}export function findSegmentsToDelete(_0x38d93c,_0x3baed0,_0x520f2a,_0x4a04d1,_0x294352){const _0x11e373=a140_0x2324c6,_0x4ed5fa=new Set();for(const {yamlConfig:_0x31ae17,folderPath:_0xb47f35}of _0x3baed0){_0x4ed5fa['add'](_0xb47f35+':'+_0x31ae17[_0x11e373(0x1b4)]);}return _0x38d93c[_0x11e373(0x108)](_0x156596=>{const _0x19c367=_0x11e373,_0x2bdbd5=_0x156596[_0x19c367(0x11a)]?_0x520f2a['get'](_0x156596[_0x19c367(0x11a)][_0x19c367(0x1ae)]())||'':'',_0x31bb00=_0x2bdbd5+':'+_0x156596[_0x19c367(0x1b4)];if(_0x4ed5fa[_0x19c367(0x18f)](_0x31bb00))return![];if(_0x294352)return _0x2bdbd5===_0x4a04d1||_0x2bdbd5['startsWith'](_0x4a04d1+'/');return!![];});}export function findJourneysToDelete(_0x37ffe7,_0x57328c,_0x2d0e52,_0x196c9f,_0x5cd4d1){const _0x73cdf9=a140_0x2324c6,_0x3cd7db=new Set();for(const {yamlConfig:_0x206aa0,folderPath:_0x30d264}of _0x57328c){_0x3cd7db['add'](_0x30d264+':'+_0x206aa0[_0x73cdf9(0x1b4)]);}return _0x37ffe7['filter'](_0x1c9c0d=>{const _0x31cfc1=_0x73cdf9,_0x3c1c87=_0x1c9c0d[_0x31cfc1(0x1b9)]?_0x2d0e52[_0x31cfc1(0x115)](_0x1c9c0d['folderId'])||'':'',_0x3a9c91=_0x3c1c87+':'+_0x1c9c0d[_0x31cfc1(0x143)];if(_0x3cd7db[_0x31cfc1(0x18f)](_0x3a9c91))return![];if(_0x5cd4d1)return _0x3c1c87===_0x196c9f||_0x3c1c87[_0x31cfc1(0x1cb)](_0x196c9f+'/');return!![];});}export function buildSegmentLookupMap(_0x2fc1c3,_0x3666cc){const _0x58c014=a140_0x2324c6,_0x2f03df=new Map();for(const _0x4fcdfd of _0x2fc1c3){const _0x3b2a17=_0x4fcdfd[_0x58c014(0x11a)]?_0x3666cc[_0x58c014(0x115)](_0x4fcdfd[_0x58c014(0x11a)][_0x58c014(0x1ae)]())||'':'',_0x222655=_0x3b2a17+':'+_0x4fcdfd[_0x58c014(0x1b4)];_0x2f03df[_0x58c014(0x12c)](_0x222655,_0x4fcdfd);}return _0x2f03df;}export function buildSegmentNameToIdMap(_0x486f49){const _0x470984=a140_0x2324c6,_0x36a3dd=new Map();for(const _0x4d23fc of _0x486f49){_0x36a3dd[_0x470984(0x12c)](_0x4d23fc['name'],_0x4d23fc['id']);}return _0x36a3dd;}export function buildJourneyBundleLookupMap(_0x48f3f1,_0x6d0ec3){const _0x4c2c30=a140_0x2324c6,_0x2d0235=new Map();for(const _0x1cb3e3 of _0x48f3f1){const _0x57ca15=_0x1cb3e3['folderId']?_0x6d0ec3[_0x4c2c30(0x115)](_0x1cb3e3['folderId'])||'':'',_0x1e1236=_0x57ca15+':'+_0x1cb3e3['journeyBundleName'];!_0x2d0235[_0x4c2c30(0x18f)](_0x1e1236)&&_0x2d0235[_0x4c2c30(0x12c)](_0x1e1236,[]),_0x2d0235[_0x4c2c30(0x115)](_0x1e1236)['push'](_0x1cb3e3);}for(const _0x392e6c of _0x2d0235[_0x4c2c30(0x19d)]()){_0x392e6c[_0x4c2c30(0x1e6)]((_0x12ab26,_0x254f1b)=>(_0x12ab26[_0x4c2c30(0x1a3)]||0x0)-(_0x254f1b['versionNumber']||0x0));}return _0x2d0235;}export function collectFoldersToCreate(_0x38dcf9,_0x2816af){const _0x2c20f6=a140_0x2324c6,_0x161765=new Set();for(const _0x2dd864 of _0x38dcf9){if(!_0x2dd864)continue;if(_0x2816af[_0x2c20f6(0x18f)](_0x2dd864))continue;const _0x524e01=_0x2dd864['split']('/');let _0x55d069='';for(const _0x17e346 of _0x524e01){_0x55d069=_0x55d069?_0x55d069+'/'+_0x17e346:_0x17e346,!_0x2816af[_0x2c20f6(0x18f)](_0x55d069)&&_0x161765[_0x2c20f6(0x1f4)](_0x55d069);}}return _0x161765;}export function parseAndClassifyYamlFiles(_0x1dbb63,_0xa55d4a,_0x5cf8bd){const _0x12ab8b=a140_0x2324c6,_0x4d2234=[],_0x23928c=[];for(const _0x1f2a5d of _0x1dbb63){const _0x395927=a140_0x55cf1c[_0x12ab8b(0xfb)](_0xa55d4a,a140_0x55cf1c['dirname'](_0x1f2a5d)),_0x5e1687=_0x395927==='.'?'':_0x395927,_0x824636=readFileSync(_0x1f2a5d,'utf-8'),_0xd9547b=a140_0x13bab5[_0x12ab8b(0x1f2)](_0x824636);if(isJourneyDef(_0xd9547b)){const _0x30d7bf=a140_0x4d7e52(_0x824636);_0x23928c['push']({'yamlConfig':_0x30d7bf,'folderPath':_0x5e1687,'sourcePath':_0x1f2a5d});}else{if(!_0x5cf8bd?.[_0x12ab8b(0x114)]){const _0x4676fa=parseSegmentYamlFile(_0x824636),_0x2fc9da=normalizeChildSegmentYaml(_0x4676fa);_0x4d2234['push']({'yamlConfig':_0x2fc9da,'folderPath':_0x5e1687,'sourcePath':_0x1f2a5d});}}}return{'segments':_0x4d2234,'journeys':_0x23928c};}export function validateParsedFiles(_0x2cbb1d,_0x7be90e){const _0x452d98=a140_0x2324c6,_0x38390d=[];for(const {yamlConfig:_0x43cea9,sourcePath:_0x4ce16d}of _0x2cbb1d[_0x452d98(0x14c)]){const _0x1e950f=readFileSync(_0x4ce16d,_0x452d98(0x10a)),_0x2d6ab3=a140_0x13bab5['parseDocument'](_0x1e950f),_0x16ab83=validateSegmentDef(_0x43cea9,{'source':_0x1e950f,'document':_0x2d6ab3},{'skipSchema':!![]});if(!_0x16ab83[_0x452d98(0x1d8)]){const _0x306061=a140_0x55cf1c[_0x452d98(0xfb)](_0x7be90e,_0x4ce16d);_0x38390d[_0x452d98(0x1fb)]({'filePath':_0x306061,'source':_0x1e950f,'result':_0x16ab83,'isJourney':![]});}}for(const {yamlConfig:_0x30ffef,sourcePath:_0x17de2d}of _0x2cbb1d[_0x452d98(0x139)]){const _0x24c25f=readFileSync(_0x17de2d,'utf-8'),_0x219517=a140_0x13bab5[_0x452d98(0x1ee)](_0x24c25f),_0x467003=validateJourneyDef(_0x30ffef,{'source':_0x24c25f,'document':_0x219517},{'skipSchema':!![]});if(!_0x467003[_0x452d98(0x1d8)]){const _0x138e0e=a140_0x55cf1c[_0x452d98(0xfb)](_0x7be90e,_0x17de2d);_0x38390d[_0x452d98(0x1fb)]({'filePath':_0x138e0e,'source':_0x24c25f,'result':_0x467003,'isJourney':!![]});}}return _0x38390d;}export function formatValidationErrors(_0xf1a0e2){const _0x1fb35b=a140_0x2324c6,_0x121de5=[];for(const {filePath:_0x2d667d,source:_0x2eeeaf,result:_0x463149,isJourney:_0x48c28a}of _0xf1a0e2){const _0xebccc3=_0x48c28a?_0x1fb35b(0x1ab):_0x1fb35b(0x176);_0x121de5[_0x1fb35b(0x1fb)]('\x0a'+_0x2d667d+'\x20('+_0xebccc3+_0x1fb35b(0x177)+_0x463149[_0x1fb35b(0x19c)][_0x1fb35b(0x13b)]+_0x1fb35b(0x14d)),_0x121de5[_0x1fb35b(0x1fb)](formatValidationResult(_0x463149,_0x2eeeaf,_0x2d667d));}return _0x121de5[_0x1fb35b(0x1af)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x505c37){const _0x32aee0=a140_0x2324c6,_0x4d6554=new Set(),_0x431d10=new Map(),_0x3d5deb=collectSegmentUsageCounts(_0x505c37);if(_0x505c37[_0x32aee0(0x14c)])for(const [_0x4d3831,_0x167002]of Object[_0x32aee0(0xfd)](_0x505c37[_0x32aee0(0x14c)])){_0x4d6554[_0x32aee0(0x1f4)](_0x4d3831);if(_0x167002[_0x32aee0(0x154)]){const _0x5263f6=yamlRuleToApi(_0x167002[_0x32aee0(0x154)]),_0x209a82=apiRuleToYaml(_0x5263f6);_0x431d10[_0x32aee0(0x12c)](_0x4d3831,_0x209a82);}}const _0x3e9987=new Map();let _0x401f76=0x0;for(const [_0x4b257b,_0x29561a]of _0x431d10){const _0x527302=serializeExpandedRule(_0x29561a,_0x431d10),_0x3fb272=_0x3e9987[_0x32aee0(0x115)](_0x527302)||[];_0x3fb272[_0x32aee0(0x1fb)]({'name':_0x4b257b,'index':_0x401f76}),_0x3e9987[_0x32aee0(0x12c)](_0x527302,_0x3fb272),_0x401f76++;}const _0x125103=new Map();for(const [_0x593f04,_0x9ffec8]of _0x3e9987){const _0x2835ce=_0x9ffec8['slice']()['sort']((_0x2b2cef,_0x2fa967)=>{const _0x38fb7f=_0x32aee0,_0x446f24=_0x3d5deb['get'](_0x2b2cef[_0x38fb7f(0x1b4)])||0x0,_0x69e281=_0x3d5deb[_0x38fb7f(0x115)](_0x2fa967[_0x38fb7f(0x1b4)])||0x0;if(_0x446f24!==_0x69e281)return _0x69e281-_0x446f24;return _0x2b2cef[_0x38fb7f(0x12b)]-_0x2fa967[_0x38fb7f(0x12b)];})[_0x32aee0(0x1ac)](_0x3f9707=>_0x3f9707[_0x32aee0(0x1b4)]),_0xb8b582=[];for(const _0x5abe12 of _0x2835ce){const _0x875f7e=_0x3d5deb['get'](_0x5abe12)||0x0,_0x3a3b50=Math[_0x32aee0(0x19a)](_0x875f7e,0x1);for(let _0x5767b7=0x0;_0x5767b7<_0x3a3b50;_0x5767b7++){_0xb8b582[_0x32aee0(0x1fb)](_0x5abe12);}}_0x125103[_0x32aee0(0x12c)](_0x593f04,_0xb8b582);}return{'existingLocalSegmentNames':_0x4d6554,'localSegmentRules':_0x431d10,'localExpandedRuleToNames':_0x125103};}export function createSegmentIdResolver(_0x488140,_0x358ff6){return async _0x246648=>{const _0x379ffc=a140_0x2c4f,_0x55a80c=_0x488140[_0x379ffc(0x115)](_0x246648);if(!_0x55a80c)throw new SDKError(ErrorCode[_0x379ffc(0x100)],_0x379ffc(0x165)+_0x246648+_0x379ffc(0x17b)+_0x358ff6+'\x27)');return _0x55a80c;};}export function extractRootFolderId(_0x224290){const _0x5545e5=a140_0x2324c6;return _0x224290[_0x5545e5(0x1b3)]?.[_0x5545e5(0x170)]?.[_0x5545e5(0x16c)]?.['id']||_0x224290[_0x5545e5(0x1b3)]?.[_0x5545e5(0x1ce)]?.[_0x5545e5(0x16c)]?.['id'];}export function buildConnectionMaps(_0x51b3f0){const _0x43f40f=a140_0x2324c6,_0x2139cf=new Map(),_0x47a12d=new Map(),_0x159dd9=new Map();for(const _0x18378c of _0x51b3f0){_0x2139cf[_0x43f40f(0x12c)](_0x18378c[_0x43f40f(0x1b4)],parseInt(_0x18378c['id'],0xa)),_0x47a12d[_0x43f40f(0x12c)](_0x18378c['id'],_0x18378c[_0x43f40f(0x1b4)]),_0x159dd9[_0x43f40f(0x12c)](_0x18378c[_0x43f40f(0x1b4)],_0x18378c[_0x43f40f(0x13e)]);}return{'nameToId':_0x2139cf,'idToName':_0x47a12d,'nameToType':_0x159dd9};}function a140_0x1beb(){const _0x4cd465=['segment_updated','size','activation_created','list','Journey\x20\x27','yamlConfig','8TYmPwX','getJourney','getLatestJourneyId','Created\x20segment\x20\x27','Creating\x20activation\x20\x27','has','item','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','folder','folderPath','parentId','SEGMENT_UPDATE_ERROR','hasChanges','resolveSegment','description','match','max','behavior','errors','values','toISOString','state','run_after_journey_refresh','JOURNEY_SYNTAX_ERROR','createSegment','versionNumber','\x20(referenced\x20in\x20journey\x20','activation_template_id','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','message','5iCBvep','schedule','getSegment\x20failed\x20for\x20','journey','map','3UFMFfT','toString','join','stages','conditionTimeoutUnit','segment_deleted','relationships','name','Failed\x20to\x20fetch\x20referenced\x20segment\x20','folderPathToId','conditionTimeoutDuration','connector_config','folderId',').\x20','\x20activation\x20\x27','1711960Xvcftk','\x27\x20from\x20file:\x20','notification','segmentByFolderAndName','entryCriteria','Condition','Delete\x20the\x20push\x20recovery\x20file\x20(','segment_creating','\x27...','steps','draft','\x27\x20for\x20','connectionIdToNameMap','keys','deleteActivation','startsWith','some','null','parentFolder','activationStepsById','ACTIVATION_SYNTAX_ERROR','user','sha1','segment_deleting','split','Duration','effectiveFolderId','resolvedRule','valid','journeyName','activationContext','Updated\x20segment\x20\x27','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','find','Activation\x20not\x20found:\x20','milestone','logDeleted','activation_updated','SEGMENT_SYNTAX_ERROR','.$1.push-recovery.json','all','segmentId','sort','JOURNEY_UPDATE_ERROR','tdx.sdk.push-workflow','journeyStages','updateSegmentById','existingActivation','validatedRequest','Created\x20journey\x20\x27','parseDocument','Deleted\x20activation\x20\x27','uniqueServerName','create','parse','__pending_act_','add','listActivations','Deleting\x20activation\x20\x27','branches','\x27\x20milestone','conditionSegmentId','slice','push','journeyById','existingSegments','Updated\x20journey\x20\x27','6927393zdQutv','createdSegmentId','progress','diff','embedded_segment_created','relative','getSegment','entries','segmentNameToId','\x0a\x20\x20','SEGMENT_NOT_FOUND','activationActions','Created\x20activation\x20\x27','segment_updating','includes','Matched\x20server\x20segment\x20\x27','object','delete','filter','journeyBundleId','utf-8','update','updated','journeyActivationStepId','localName','all_columns','activationParams','trim','INTERNAL','embedded_segment_creating','skipSegments','get','segment_created','stringify','embedded_activation_creating','embeddedSegmentNameToId','segmentFolderId','logSuccess','687172NGiXhx','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','waitStep','kind','Deleted\x20segment\x20\x27','digest','nameToType','\x20segment\x20from\x20file:\x20','journey_updated','WaitStep','uniqueSegmentName','\x27\x20by\x20rule\x20content','decision_point','1574631zvHQiM','index','set','rootFolderId','journeyActivationNameToId','6BlCven','journey_created','createFolder','action','idToEmailMap','createdSegmentIds','deps','67362BbKjSB','\x27\x20not\x20found\x20in\x20journey\x20\x27','waitStepUnit','journeys','isNew','length','replace','folder_creating','type','goal\x20criteria','Activation','__pending_','conditions','journeyBundleName','results','reduce','Failed\x20to\x20','nameToId','entry_criteria','585446zwHDwK','debug','createActivation','segments','\x20error(s)','\x27\x20entry\x20criteria','deleteSegment','idToName','Fetching\x20','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','with','rule','createJourneySegment','logWarning','activation_updating','activations','goal','updateActivation','journeyId','day','activation_deleting','toLowerCase','\x27\x20to\x20local\x20\x27','withProgress','Created\x20folder\x20\x27','existingSegment','flatMap','absolutePath','Segment\x20not\x20found:\x20','Creating\x20folder\x20\x27','NOT_FOUND','unchanged','buildUserMaps','Failed\x20to\x20resolve\x20activation\x20','existingJourney','data','./child-segment-yaml.js','onProgress','activation_','parentSegmentFolder','Entry\x20criteria:\x20','\x27\x20wait\x20condition','fetchJourney','421519QXOrWr','exitCriterias','segment','):\x20','attributes','deleted','Failed\x20to\x20resolve\x20segment\x20','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','journey_creating','stage\x20\x27','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','./journey-yaml.js','from','columns','DecisionPoint','created'];a140_0x1beb=function(){return _0x4cd465;};return a140_0x1beb();}export function calculatePushStats(_0xf5466e,_0x142415,_0x5da293,_0x68ca90,_0x1aed25,_0x7bf4eb,_0x272415){const _0x17cd78=a140_0x2324c6,_0x59eb16=_0xf5466e[_0x17cd78(0x108)](_0x2d7d68=>_0x2d7d68[_0x17cd78(0x13a)]),_0x431f26=_0xf5466e[_0x17cd78(0x108)](_0x1e663b=>!_0x1e663b[_0x17cd78(0x13a)]&&_0x1e663b[_0x17cd78(0x196)]),_0x49bebd=_0xf5466e[_0x17cd78(0x108)](_0x4d610b=>!_0x4d610b[_0x17cd78(0x13a)]&&!_0x4d610b['hasChanges']),_0x467f44=_0x7bf4eb?_0x68ca90:[],_0x1e0196=_0x142415[_0x17cd78(0x108)](_0xc360d7=>_0xc360d7['isNew']),_0x2773cf=_0x142415['filter'](_0x499cea=>!_0x499cea[_0x17cd78(0x13a)]&&_0x499cea[_0x17cd78(0x196)]),_0x21dd63=_0x142415[_0x17cd78(0x108)](_0x453e6c=>!_0x453e6c[_0x17cd78(0x13a)]&&!_0x453e6c[_0x17cd78(0x196)]),_0x1d3064=_0x7bf4eb?_0x1aed25:[],_0x5f3575=_0xf5466e[_0x17cd78(0x163)](_0x12eaee=>_0x12eaee['activationActions']),_0x2a7d21=_0x5f3575[_0x17cd78(0x108)](_0xe261db=>_0xe261db[_0x17cd78(0x13e)]===_0x17cd78(0x1f1)),_0x20de13=_0x5f3575[_0x17cd78(0x108)](_0x21f631=>_0x21f631['type']===_0x17cd78(0x10b)),_0x35dea4=_0x5f3575[_0x17cd78(0x108)](_0x142051=>_0x142051[_0x17cd78(0x13e)]==='delete'),_0x20e6b2=Array[_0x17cd78(0x180)](_0x5da293)[_0x17cd78(0x1e6)](),_0x2cfa40=_0x272415?![]:_0x59eb16[_0x17cd78(0x13b)]>0x0||_0x431f26[_0x17cd78(0x13b)]>0x0||_0x467f44[_0x17cd78(0x13b)]>0x0,_0x1e8575=_0x1e0196['length']>0x0||_0x2773cf['length']>0x0||_0x1d3064['length']>0x0,_0x547df0=_0x272415?![]:_0x5f3575[_0x17cd78(0x13b)]>0x0,_0x7a52fc=_0x20e6b2[_0x17cd78(0x13b)]>0x0;return{'segments':{'new':_0x59eb16,'changed':_0x431f26,'unchanged':_0x49bebd,'toDelete':_0x467f44},'journeys':{'new':_0x1e0196,'changed':_0x2773cf,'unchanged':_0x21dd63,'toDelete':_0x1d3064},'activations':{'all':_0x5f3575,'toCreate':_0x2a7d21,'toUpdate':_0x20de13,'toDelete':_0x35dea4},'folders':{'toCreate':_0x20e6b2},'counts':{'segments':{'new':_0x59eb16[_0x17cd78(0x13b)],'changed':_0x431f26[_0x17cd78(0x13b)],'unchanged':_0x49bebd[_0x17cd78(0x13b)],'toDelete':_0x467f44[_0x17cd78(0x13b)]},'journeys':{'new':_0x1e0196[_0x17cd78(0x13b)],'changed':_0x2773cf[_0x17cd78(0x13b)],'unchanged':_0x21dd63[_0x17cd78(0x13b)],'toDelete':_0x1d3064[_0x17cd78(0x13b)]},'activations':{'create':_0x2a7d21[_0x17cd78(0x13b)],'update':_0x20de13['length'],'delete':_0x35dea4['length']},'folders':_0x20e6b2[_0x17cd78(0x13b)]},'hasChanges':_0x2cfa40||_0x1e8575||_0x547df0||_0x7a52fc};}export async function buildPushExecutionContext(_0x45ceb6,_0x144865,_0x251d31,_0x5b6d47,_0x11c47f,_0x181ae3){const _0x4cf1cd=a140_0x2324c6,_0x223030=extractRootFolderId(_0x251d31),{pathToId:_0x5c2240,idToPath:_0x50c4c8}=buildFolderMaps(_0x11c47f),_0x32ad25=buildSegmentNameToIdMap(_0x5b6d47),_0xc44534=new Map(),{batchAsync:_0x183800}=await import('../../utils/async.js'),[_0x101438,_0x174073]=await Promise[_0x4cf1cd(0x1e4)]([_0x45ceb6[_0x4cf1cd(0x1d1)][_0x4cf1cd(0x169)](),_0x45ceb6['connection'][_0x4cf1cd(0x187)](),((async()=>{const _0x3738f8=_0x4cf1cd;!_0x181ae3&&_0x5b6d47[_0x3738f8(0x13b)]>0x0&&await _0x183800(_0x5b6d47,async _0x7fc6ad=>{const _0x369607=_0x3738f8,_0x2652e4=await _0x45ceb6[_0x369607(0x176)][_0x369607(0x1f5)](_0x144865,_0x7fc6ad['id']);_0xc44534['set'](_0x7fc6ad['id'],_0x2652e4);});})())]),{emailToId:_0x38cb01,idToEmail:_0x30dff5}=_0x101438,_0x3bd0ca=buildConnectionMaps(_0x174073);return{'rootFolderId':_0x223030,'folderPathToId':_0x5c2240,'folderIdToPath':_0x50c4c8,'segmentNameToId':_0x32ad25,'activationsBySegmentId':_0xc44534,'emailToIdMap':_0x38cb01,'idToEmailMap':_0x30dff5,'connectionNameToIdMap':_0x3bd0ca[_0x4cf1cd(0x147)],'connectionIdToNameMap':_0x3bd0ca[_0x4cf1cd(0x150)],'connectionNameToTypeMap':_0x3bd0ca[_0x4cf1cd(0x123)]};}export function createPushYamlContextForBundle(_0x242811,_0xbc999c,_0xbf6d1b,_0x1f382e,_0x5642f6,_0x421576,_0x36b1f3,_0x3927a0){const {existingLocalSegmentNames:_0x4ea7be,localExpandedRuleToNames:_0x4027e8}=_0x1f382e,_0x3e3c96=new Set(),_0x50ef55=new Map(),_0x9532e7=new Map(),_0x502599=new Map(),_0x5dffa1=createJumpTargetCache(),_0x1f30c4=new Map(),_0x13a531=new Map(),_0x2e0ff5=new Set();let _0x71570a;const _0xa28d04=_0x5982c3=>{const _0x5e6abd={'resolveSegment':async _0x3df37b=>{const _0x4ce463=a140_0x2c4f,_0x540518=_0x502599[_0x4ce463(0x115)](_0x3df37b);if(_0x540518!==undefined)return{'name':_0x540518,'isJourneyLocal':!![]};try{const _0x582ffc=await fetchSegment(_0x242811,_0xbc999c,_0x3df37b,_0xbf6d1b);if(!_0x582ffc)throw new Error('Segment\x20not\x20found');const _0x5b53e2=generateJourneyLocalName(_0x582ffc[_0x4ce463(0x1b4)]),_0x2ec4b6=_0x582ffc[_0x4ce463(0x120)]===SEGMENT_KIND_JOURNEY&&_0x5b53e2!==undefined;let _0x370c89=_0x582ffc['name'],_0x3bff8f;if(_0x2ec4b6&&_0x582ffc[_0x4ce463(0x154)]){const _0x7ade08=apiRuleToYaml(_0x582ffc[_0x4ce463(0x154)]);_0x13a531['set'](_0x3df37b,_0x7ade08);const _0x1cf1b6=async _0xe288f3=>{const _0x362323=_0x4ce463,_0x1ac4c5=collectSegmentRefsFromRule(_0xe288f3);for(const _0x138e6a of _0x1ac4c5){if(!_0x13a531['has'](_0x138e6a))try{const _0x3c2c98=await fetchSegment(_0x242811,_0xbc999c,_0x138e6a,_0xbf6d1b);if(_0x3c2c98?.[_0x362323(0x154)]){const _0x346dad=apiRuleToYaml(_0x3c2c98[_0x362323(0x154)]);_0x13a531[_0x362323(0x12c)](_0x138e6a,_0x346dad),await _0x1cf1b6(_0x346dad);}}catch(_0x5cbbd2){logger[_0x362323(0x14a)](_0x362323(0x1b5)+_0x138e6a+':\x20'+_0x5cbbd2);}}};await _0x1cf1b6(_0x7ade08);const _0x1863a8=serializeExpandedRule(_0x7ade08,_0x13a531),_0x240bcc=_0x4027e8[_0x4ce463(0x115)](_0x1863a8);if(_0x240bcc&&_0x240bcc['length']>0x0){const _0x422cd8=_0x50ef55['get'](_0x1863a8)||0x0,_0x48a233=_0x240bcc[_0x422cd8]||_0x240bcc[_0x240bcc[_0x4ce463(0x13b)]-0x1];_0x50ef55[_0x4ce463(0x12c)](_0x1863a8,_0x422cd8+0x1),_0x370c89=_0x48a233,_0x3e3c96[_0x4ce463(0x1f4)](_0x370c89),_0x502599[_0x4ce463(0x12c)](_0x3df37b,_0x370c89);const _0x2b6e7f=await resolveRuleSegmentRefs(_0x7ade08,async _0x2b00d3=>{const _0x382f1c=_0x4ce463,_0x32b428=_0x502599[_0x382f1c(0x115)](_0x2b00d3);if(_0x32b428)return _0x32b428;const _0x22d18e=await _0x71570a['resolveSegment'](_0x2b00d3);return _0x22d18e[_0x382f1c(0x1b4)];});_0x3bff8f={'description':_0x582ffc[_0x4ce463(0x198)],'rule':_0x2b6e7f};}else{const _0x1b4fb1=_0x1f30c4[_0x4ce463(0x115)](_0x1863a8);if(_0x1b4fb1)_0x370c89=_0x1b4fb1,_0x502599[_0x4ce463(0x12c)](_0x3df37b,_0x370c89);else{if(_0x5b53e2){let _0x26f780=_0x5b53e2,_0x16dcd3=0x2;while(_0x3e3c96[_0x4ce463(0x18f)](_0x26f780)||_0x4ea7be[_0x4ce463(0x18f)](_0x26f780)){_0x26f780=_0x5b53e2+'_'+_0x16dcd3,_0x16dcd3++;}_0x3e3c96[_0x4ce463(0x1f4)](_0x26f780),_0x370c89=_0x26f780;}_0x502599['set'](_0x3df37b,_0x370c89),_0x1f30c4[_0x4ce463(0x12c)](_0x1863a8,_0x370c89);const _0x43b54b=await resolveRuleSegmentRefs(_0x7ade08,async _0x1fa9b3=>{const _0x59bab8=_0x4ce463,_0x45232d=_0x502599['get'](_0x1fa9b3);if(_0x45232d)return _0x45232d;const _0x1c62db=await _0x71570a[_0x59bab8(0x197)](_0x1fa9b3);return _0x1c62db['name'];});_0x3bff8f={'description':_0x582ffc[_0x4ce463(0x198)],'rule':_0x43b54b};}}}return{'name':_0x370c89,'isJourneyLocal':_0x2ec4b6,'definition':_0x3bff8f};}catch(_0x4ee4f8){return logger[_0x4ce463(0x14a)](_0x4ce463(0x17a)+_0x3df37b+':\x20'+_0x4ee4f8),{'name':_0x3df37b,'isJourneyLocal':![]};}},'resolveActivation':async _0xdf9724=>{const _0xe8851=a140_0x2c4f,_0x211ff0=_0x9532e7['get'](_0xdf9724);if(_0x211ff0!==undefined)return{'name':_0x211ff0,'isJourneyLocal':!![]};try{let _0xd99d3d=_0x36b1f3?.['get'](_0xdf9724);!_0xd99d3d&&(_0xd99d3d=await _0x242811[_0xe8851(0x1ab)]['getActivation'](_0x5982c3,_0xdf9724));const _0x1fab01=_0xd99d3d[_0xe8851(0x178)][_0xe8851(0x110)][_0xe8851(0x1b4)]||_0xdf9724,_0x248de6=sanitizeYamlKey(_0x1fab01)||_0xe8851(0x16f)+_0xdf9724,_0x59451e=_0x248de6;_0x9532e7[_0xe8851(0x12c)](_0xdf9724,_0x59451e);const _0x101182=journeyActivationStepToYaml(_0xd99d3d,_0x5642f6,_0x421576);return{'name':_0x59451e,'isJourneyLocal':!![],'definition':_0x101182};}catch(_0x40eae8){return logger[_0xe8851(0x14a)](_0xe8851(0x16a)+_0xdf9724+':\x20'+_0x40eae8),{'name':_0xdf9724,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x287c34,_0x43db3a)=>resolveJumpTarget(_0x287c34,_0x43db3a,_0x5dffa1,async _0x1d6e2f=>{const _0x1e88dc=a140_0x2c4f,_0x1ad0c6=_0x3927a0?.[_0x1e88dc(0x115)](_0x1d6e2f);if(_0x1ad0c6)return _0x1ad0c6;return _0x242811['journey'][_0x1e88dc(0x18b)](_0x1d6e2f);})};return _0x71570a=_0x5e6abd,_0x5e6abd;},_0x467334=async _0x236a30=>{const _0x58472c=a140_0x2c4f,{collectSegmentIdsFromJourneyApi:_0x31595b}=await import(_0x58472c(0x17f)),{batchAsync:_0x28c545}=await import('../../utils/async.js'),_0x5e21f9=new Set();for(const _0x2cf9e2 of _0x236a30){let _0x4ba875=_0x3927a0?.[_0x58472c(0x115)](_0x2cf9e2);!_0x4ba875&&(_0x4ba875=await _0x242811[_0x58472c(0x1ab)][_0x58472c(0x18b)](_0x2cf9e2));const _0x3cf8d4=_0x31595b(_0x4ba875);for(const _0x4b3404 of _0x3cf8d4){_0x5e21f9['add'](_0x4b3404);}}let _0x51c1f3=Array[_0x58472c(0x180)](_0x5e21f9);while(_0x51c1f3[_0x58472c(0x13b)]>0x0){const _0x4edff4=_0x51c1f3[_0x58472c(0x108)](_0xec6d07=>!_0x2e0ff5[_0x58472c(0x18f)](_0xec6d07));if(_0x4edff4[_0x58472c(0x13b)]===0x0)break;const _0x64e6e9=await _0x28c545(_0x4edff4,async _0x48ca6c=>{const _0x5cd8e6=_0x58472c;_0x2e0ff5[_0x5cd8e6(0x1f4)](_0x48ca6c);const _0x4ebbd9=await fetchSegment(_0x242811,_0xbc999c,_0x48ca6c,_0xbf6d1b);if(!_0x4ebbd9)return null;return{'segmentId':_0x48ca6c,'segment':_0x4ebbd9};},0xa),_0x48b46f=new Set();for(const _0x3a5b64 of _0x64e6e9){if(!_0x3a5b64?.[_0x58472c(0x176)]?.[_0x58472c(0x154)])continue;const _0x8b72cd=apiRuleToYaml(_0x3a5b64[_0x58472c(0x176)]['rule']);_0x13a531[_0x58472c(0x12c)](_0x3a5b64[_0x58472c(0x1e5)],_0x8b72cd);const _0x1b6a1e=collectSegmentRefsFromRule(_0x8b72cd);for(const _0x1247b6 of _0x1b6a1e){!_0x2e0ff5[_0x58472c(0x18f)](_0x1247b6)&&_0x48b46f['add'](_0x1247b6);}}_0x51c1f3=Array[_0x58472c(0x180)](_0x48b46f);}};return{'createYamlContext':_0xa28d04,'prefetchJourneySegments':_0x467334};}export async function executePushSegments(_0x5f45c1,_0x4a5b3f,_0x17bf6f,_0x2678e6,_0x564490){const _0x1d4858=a140_0x2324c6,{segmentDefToCreateRequest:_0x28d6c7,segmentDefToUpdateRequest:_0x460d7a}=await import(_0x1d4858(0x16d)),_0x24a23f=_0x17bf6f[_0x1d4858(0x1b6)],_0x34462b=0x5,_0x367203=async _0x3b9723=>{const _0x574f30=_0x1d4858,_0x4ce35f=_0x3b9723['folderPath']?_0x24a23f[_0x574f30(0x115)](_0x3b9723['folderPath']):undefined;let _0x46810e;const _0x45ae5d={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x3658cd=_0x3b9723[_0x574f30(0x189)];if(_0x3b9723[_0x574f30(0x189)]['rule']){const _0x585796=createSegmentIdResolver(_0x17bf6f[_0x574f30(0xfe)],_0x3b9723['yamlConfig'][_0x574f30(0x1b4)]),_0x15adc1=await resolveRuleSegmentIds(_0x3b9723[_0x574f30(0x189)][_0x574f30(0x154)],_0x585796);_0x3658cd={..._0x3b9723[_0x574f30(0x189)],'rule':_0x15adc1};}try{if(_0x3b9723[_0x574f30(0x13a)]){_0x564490[_0x574f30(0x16e)]?.({'type':_0x574f30(0x1c3),'name':_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]});const _0xe1e3de=_0x28d6c7(_0x3658cd,_0x4ce35f),_0x16be78=await _0x564490['withProgress']('Creating\x20segment\x20\x27'+_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]+_0x574f30(0x1c4),()=>_0x5f45c1['segment'][_0x574f30(0x1a2)](_0x2678e6['parentId'],_0xe1e3de));_0x46810e=_0x16be78[_0x574f30(0x16c)]['id'],_0x17bf6f[_0x574f30(0xfe)][_0x574f30(0x12c)](_0x3b9723[_0x574f30(0x189)]['name'],_0x46810e),_0x45ae5d[_0x574f30(0x200)]={'name':_0x3b9723['yamlConfig'][_0x574f30(0x1b4)],'id':_0x46810e},_0x564490['onProgress']?.({'type':_0x574f30(0x116),'name':_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)],'segmentId':_0x46810e}),_0x564490[_0x574f30(0x11b)]?.(_0x574f30(0x18d)+_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]+'\x27'),_0x45ae5d[_0x574f30(0x183)]=0x1;}else{if(_0x3b9723[_0x574f30(0x196)]){_0x564490[_0x574f30(0x16e)]?.({'type':_0x574f30(0x103),'name':_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]});const _0xf2da2b=_0x460d7a(_0x3658cd);_0x4ce35f!==_0x3b9723[_0x574f30(0x162)]?.[_0x574f30(0x11a)]&&(_0xf2da2b[_0x574f30(0x11a)]=_0x4ce35f?parseInt(_0x4ce35f,0xa):undefined),await _0x564490[_0x574f30(0x160)]('Updating\x20segment\x20\x27'+_0x3b9723['yamlConfig']['name']+_0x574f30(0x1c4),()=>_0x5f45c1[_0x574f30(0x176)][_0x574f30(0x1ea)](_0x2678e6['parentId'],_0x3b9723['existingSegment']['id'],_0xf2da2b)),_0x46810e=_0x3b9723[_0x574f30(0x162)]['id'],_0x564490[_0x574f30(0x16e)]?.({'type':_0x574f30(0x184),'name':_0x3b9723[_0x574f30(0x189)]['name']}),_0x564490[_0x574f30(0x11b)]?.(_0x574f30(0x1db)+_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]+'\x27'),_0x45ae5d[_0x574f30(0x10c)]=0x1;}else _0x46810e=_0x3b9723['existingSegment']['id'];}}catch(_0x1d2164){const _0x2b9dd5=isHttp400Error(_0x1d2164),_0x4b0802=_0x2b9dd5?ErrorCode[_0x574f30(0x1e2)]:ErrorCode[_0x574f30(0x195)],_0xda2818=getErrorMessage(_0x1d2164);throw new SDKError(_0x4b0802,_0x574f30(0x146)+(_0x3b9723[_0x574f30(0x13a)]?_0x574f30(0x1f1):_0x574f30(0x10b))+_0x574f30(0x124)+_0x3b9723['absolutePath']+_0x574f30(0xff)+_0xda2818,_0x1d2164);}try{const _0x5853b1=await syncActivationsForSegment(_0x5f45c1,_0x2678e6[_0x574f30(0x194)],_0x46810e,_0x3b9723['yamlConfig']['name'],_0x3b9723[_0x574f30(0x101)],_0x564490,_0x3b9723[_0x574f30(0x164)]);_0x45ae5d['activations']=_0x5853b1;}catch(_0x31af4c){if(_0x31af4c instanceof SDKError)throw _0x31af4c;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]+_0x574f30(0x1bd)+_0x3b9723[_0x574f30(0x164)]+_0x574f30(0xff)+getErrorMessage(_0x31af4c),_0x31af4c);}return _0x45ae5d;},_0x10c3f5=await batchAsync(_0x4a5b3f,_0x367203,_0x34462b),_0xeb5430={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0xb04371 of _0x10c3f5){_0xeb5430[_0x1d4858(0x183)]+=_0xb04371['created'],_0xeb5430[_0x1d4858(0x10c)]+=_0xb04371['updated'],_0xb04371[_0x1d4858(0x200)]&&_0xeb5430[_0x1d4858(0x134)]['set'](_0xb04371[_0x1d4858(0x200)][_0x1d4858(0x1b4)],_0xb04371[_0x1d4858(0x200)]['id']),_0xeb5430[_0x1d4858(0x158)][_0x1d4858(0x183)]+=_0xb04371[_0x1d4858(0x158)][_0x1d4858(0x183)],_0xeb5430[_0x1d4858(0x158)][_0x1d4858(0x10c)]+=_0xb04371['activations']['updated'],_0xeb5430['activations'][_0x1d4858(0x179)]+=_0xb04371[_0x1d4858(0x158)][_0x1d4858(0x179)];}return _0xeb5430;}async function syncActivationsForSegment(_0x2cd7e9,_0x3be50e,_0x250f81,_0x1619f1,_0x44a2bc,_0x313e62,_0x32eca4){const _0x52f535=a140_0x2324c6,_0x43dced={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x4ec567 of _0x44a2bc){try{if(_0x4ec567[_0x52f535(0x13e)]==='create'&&_0x4ec567[_0x52f535(0x1ec)])_0x313e62['onProgress']?.({'type':'activation_creating','segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),await _0x313e62[_0x52f535(0x160)](_0x52f535(0x18e)+_0x4ec567[_0x52f535(0x1b4)]+'\x27...',()=>_0x2cd7e9['segment']['createActivation'](_0x3be50e,_0x250f81,_0x4ec567[_0x52f535(0x1ec)])),_0x313e62[_0x52f535(0x16e)]?.({'type':_0x52f535(0x186),'segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),_0x313e62[_0x52f535(0x11b)]?.(_0x52f535(0x102)+_0x4ec567[_0x52f535(0x1b4)]+'\x27'),_0x43dced[_0x52f535(0x183)]++;else{if(_0x4ec567[_0x52f535(0x13e)]===_0x52f535(0x10b)&&_0x4ec567['validatedRequest']&&_0x4ec567['existingActivation'])_0x313e62['onProgress']?.({'type':_0x52f535(0x157),'segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),await _0x313e62['withProgress']('Updating\x20activation\x20\x27'+_0x4ec567[_0x52f535(0x1b4)]+_0x52f535(0x1c4),()=>_0x2cd7e9['segment'][_0x52f535(0x15a)](_0x3be50e,_0x250f81,_0x4ec567[_0x52f535(0x1eb)]['id'],_0x4ec567[_0x52f535(0x1ec)])),_0x313e62[_0x52f535(0x16e)]?.({'type':_0x52f535(0x1e1),'segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),_0x313e62[_0x52f535(0x11b)]?.('Updated\x20activation\x20\x27'+_0x4ec567['name']+'\x27'),_0x43dced['updated']++;else _0x4ec567[_0x52f535(0x13e)]==='delete'&&_0x4ec567[_0x52f535(0x1eb)]&&(_0x313e62[_0x52f535(0x16e)]?.({'type':_0x52f535(0x15d),'segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),await _0x313e62['withProgress'](_0x52f535(0x1f6)+_0x4ec567[_0x52f535(0x1b4)]+_0x52f535(0x1c4),()=>_0x2cd7e9[_0x52f535(0x176)][_0x52f535(0x1ca)](_0x3be50e,_0x250f81,_0x4ec567['existingActivation']['id'])),_0x313e62[_0x52f535(0x16e)]?.({'type':'activation_deleted','segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),_0x313e62[_0x52f535(0x1e0)]?.(_0x52f535(0x1ef)+_0x4ec567[_0x52f535(0x1b4)]+'\x27'),_0x43dced['deleted']++);}}catch(_0x202213){const _0x3b24ad=isHttp400Error(_0x202213),_0x34a609=_0x3b24ad?ErrorCode[_0x52f535(0x1d0)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x33ee84=getErrorMessage(_0x202213);throw new SDKError(_0x34a609,_0x52f535(0x146)+_0x4ec567[_0x52f535(0x13e)]+_0x52f535(0x1bb)+_0x4ec567['name']+_0x52f535(0x1bd)+_0x32eca4+_0x52f535(0xff)+_0x33ee84,_0x202213);}}return _0x43dced;}export async function executePushFolders(_0xb4d89b,_0x3512ff,_0xb28aba,_0xb44970,_0x1a9566){const _0x1b6c63=a140_0x2324c6,_0x10bcbc=new Map(_0xb28aba),_0x5273e3=sortFoldersByDepth(_0x3512ff);for(const _0x1a57d7 of _0x5273e3){const _0x51fe12=_0x1a57d7[_0x1b6c63(0x1d4)]('/'),_0x38a4e2=_0x51fe12[_0x51fe12[_0x1b6c63(0x13b)]-0x1],_0x34d858=_0x51fe12[_0x1b6c63(0x1fa)](0x0,-0x1)[_0x1b6c63(0x1af)]('/'),_0x1e841c=_0x10bcbc['get'](_0x34d858);_0x1a9566['onProgress']?.({'type':_0x1b6c63(0x13d),'folder':_0x1a57d7});const _0x1e254e={'name':_0x38a4e2,'parentFolderId':_0x1e841c},_0x4f7c55=await _0x1a9566['withProgress'](_0x1b6c63(0x166)+_0x1a57d7+_0x1b6c63(0x1c4),()=>_0xb4d89b['segment'][_0x1b6c63(0x131)](_0xb44970[_0x1b6c63(0x194)],_0x1e254e));_0x10bcbc['set'](_0x1a57d7,_0x4f7c55[_0x1b6c63(0x16c)]['id']),_0x1a9566[_0x1b6c63(0x16e)]?.({'type':'folder_created','folder':_0x1a57d7,'folderId':_0x4f7c55['data']['id']}),_0x1a9566['logInfo']?.(_0x1b6c63(0x161)+_0x1a57d7+'\x27');}return _0x10bcbc;}export async function executePushSegmentDeletions(_0x290122,_0x580f1b,_0x219d07){const _0x4723ba=a140_0x2324c6;if(_0x580f1b[_0x4723ba(0x13b)]===0x0)return 0x0;const {batchAsync:_0x273425}=await import('../../utils/async.js'),_0xf7e473=0x5,_0x21b0ce=await _0x273425(_0x580f1b,async _0x3f54ec=>{const _0x3b7dca=_0x4723ba;return _0x219d07[_0x3b7dca(0x16e)]?.({'type':_0x3b7dca(0x1d3),'name':_0x3f54ec['name']}),await _0x290122[_0x3b7dca(0x176)][_0x3b7dca(0x14f)](_0x3f54ec['id']),_0x219d07[_0x3b7dca(0x16e)]?.({'type':_0x3b7dca(0x1b2),'name':_0x3f54ec[_0x3b7dca(0x1b4)]}),_0x219d07[_0x3b7dca(0x1e0)]?.(_0x3b7dca(0x121)+_0x3f54ec[_0x3b7dca(0x1b4)]+'\x27'),0x1;},_0xf7e473);return _0x21b0ce[_0x4723ba(0x145)]((_0x386df5,_0x5aaeb6)=>_0x386df5+_0x5aaeb6,0x0);}export async function executePushJourneys(_0x5eef7d,_0x31d82e,_0x1d3f8d,_0x35a816,_0x37c887){const _0x3d3f6b=a140_0x2324c6,{journeyDefToRequest:_0x566ce8}=await import(_0x3d3f6b(0x17f)),{activationDefToCreateRequest:_0x5a2dcd,yamlRuleToApi:_0x4cf3ad,validateSegmentRule:_0x5d8613}=await import(_0x3d3f6b(0x16d)),_0x48e0a8={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x255bc3=new Map(_0x1d3f8d[_0x3d3f6b(0xfe)]),_0x28e0a5=0x5;for(let _0xfdb7da=0x0;_0xfdb7da<_0x31d82e['length'];_0xfdb7da+=_0x28e0a5){const _0x58546a=_0x31d82e[_0x3d3f6b(0x1fa)](_0xfdb7da,_0xfdb7da+_0x28e0a5),_0x2535ca=await Promise['all'](_0x58546a[_0x3d3f6b(0x1ac)](async _0x2da033=>{const _0x269bbf=_0x3d3f6b;if(!_0x2da033[_0x269bbf(0x13a)]&&!_0x2da033['hasChanges'])return{'action':_0x269bbf(0x168),'name':_0x2da033['yamlConfig'][_0x269bbf(0x1b4)],'journeyId':_0x2da033[_0x269bbf(0x16b)]?.['id']};const _0x23661a=_0x2da033[_0x269bbf(0x193)]?_0x1d3f8d[_0x269bbf(0x1b6)][_0x269bbf(0x115)](_0x2da033[_0x269bbf(0x193)]):undefined;_0x37c887['onProgress']?.({'type':_0x2da033[_0x269bbf(0x13a)]?_0x269bbf(0x17c):'journey_updating','name':_0x2da033[_0x269bbf(0x189)]['name']});try{const _0x3f5679=await executeSingleJourneyPush(_0x5eef7d,_0x2da033,{..._0x1d3f8d,'segmentNameToId':_0x255bc3},{'parentId':_0x35a816[_0x269bbf(0x194)],'rootFolderId':_0x35a816[_0x269bbf(0x12d)],'folderId':_0x23661a,'verbose':_0x35a816['verbose']},_0x37c887,{'journeyDefToRequest':_0x566ce8,'activationDefToCreateRequest':_0x5a2dcd,'yamlRuleToApi':_0x4cf3ad,'validateSegmentRule':_0x5d8613});for(const [_0x30d19a,_0x19380c]of _0x3f5679[_0x269bbf(0x119)]){_0x255bc3[_0x269bbf(0x12c)](_0x30d19a,_0x19380c),_0x48e0a8['embeddedSegmentNameToId'][_0x269bbf(0x12c)](_0x30d19a,_0x19380c);}if(_0x3f5679[_0x269bbf(0x132)]==='created')_0x37c887['onProgress']?.({'type':_0x269bbf(0x130),'name':_0x2da033[_0x269bbf(0x189)]['name'],'journeyId':_0x3f5679[_0x269bbf(0x15b)]}),_0x37c887[_0x269bbf(0x11b)]?.(_0x269bbf(0x1ed)+_0x2da033[_0x269bbf(0x189)]['name']+'\x27'),_0x48e0a8[_0x269bbf(0x183)]++;else _0x3f5679[_0x269bbf(0x132)]==='updated'&&(_0x37c887[_0x269bbf(0x16e)]?.({'type':_0x269bbf(0x125),'name':_0x2da033['yamlConfig']['name']}),_0x37c887[_0x269bbf(0x11b)]?.(_0x269bbf(0x1fe)+_0x2da033[_0x269bbf(0x189)]['name']+'\x27'),_0x48e0a8[_0x269bbf(0x10c)]++);return{'action':_0x3f5679[_0x269bbf(0x132)],'name':_0x2da033[_0x269bbf(0x189)][_0x269bbf(0x1b4)],'journeyId':_0x3f5679[_0x269bbf(0x15b)]};}catch(_0x4f1bf5){const _0xb215bc=isHttp400Error(_0x4f1bf5),_0xcbd38a=_0xb215bc?ErrorCode[_0x269bbf(0x1a1)]:ErrorCode[_0x269bbf(0x1e7)],_0x1efad3=getErrorMessage(_0x4f1bf5);throw new SDKError(_0xcbd38a,'Failed\x20to\x20'+(_0x2da033[_0x269bbf(0x13a)]?_0x269bbf(0x1f1):'update')+'\x20journey\x20from\x20file:\x20'+_0x2da033[_0x269bbf(0x164)]+_0x269bbf(0xff)+_0x1efad3,_0x4f1bf5);}}));_0x48e0a8[_0x3d3f6b(0x144)][_0x3d3f6b(0x1fb)](..._0x2535ca);}return _0x48e0a8;}async function matchExistingJourneySegments(_0x4d98fa,_0x5a6d32,_0x9a7c38,_0x241998,_0x115941){const _0x3168c4=a140_0x2324c6;if(!_0x5a6d32['existingJourney']||!_0x5a6d32[_0x3168c4(0x189)][_0x3168c4(0x14c)])return;const _0x5af438=new Map(),_0x49fd59=new Set();for(const _0x1f3a5e of Object[_0x3168c4(0x1c9)](_0x5a6d32[_0x3168c4(0x189)]['segments'])){const _0x941cc=generateDeterministicJourneySegmentName(_0x5a6d32['yamlConfig'][_0x3168c4(0x1b4)],_0x1f3a5e);_0x5af438[_0x3168c4(0x12c)](_0x941cc,_0x1f3a5e),_0x49fd59[_0x3168c4(0x1f4)](_0x1f3a5e);}const _0x15c288=[],_0x2a399f=collectSegmentIdsFromJourneyApi(_0x5a6d32[_0x3168c4(0x16b)]);for(const _0x5bc370 of _0x2a399f){const _0xbf8900=await fetchSegment(_0x4d98fa,_0x9a7c38,_0x5bc370,_0x241998);if(!_0xbf8900?.['name'])continue;const _0x2255e1=_0x5af438[_0x3168c4(0x115)](_0xbf8900[_0x3168c4(0x1b4)]);_0x2255e1?(_0x115941['set'](_0x2255e1,_0x5bc370),_0x49fd59[_0x3168c4(0x107)](_0x2255e1)):_0x15c288[_0x3168c4(0x1fb)]({'id':_0x5bc370,'seg':_0xbf8900});}if(_0x49fd59['size']>0x0&&_0x15c288['length']>0x0){const {localExpandedRuleToNames:_0x5d09d1}=buildLocalExpandedRuleMappings(_0x5a6d32['yamlConfig']),_0x2aaaae=new Map();for(const {id:_0x5af1c5,seg:_0xee7f44}of _0x15c288){if(_0xee7f44[_0x3168c4(0x154)]){const _0x279476=apiRuleToYaml(_0xee7f44[_0x3168c4(0x154)]);_0x2aaaae[_0x3168c4(0x12c)](_0x5af1c5,_0x279476);}}for(const {id:_0x21688d,seg:_0x3bf0af}of _0x15c288){if(!_0x3bf0af[_0x3168c4(0x154)])continue;const _0x16e968=_0x2aaaae[_0x3168c4(0x115)](_0x21688d);if(!_0x16e968)continue;const _0x41e8e0=serializeExpandedRule(_0x16e968,_0x2aaaae),_0x143659=_0x5d09d1[_0x3168c4(0x115)](_0x41e8e0);if(_0x143659){const _0x2ec787=_0x143659[_0x3168c4(0x1dd)](_0x51f92a=>_0x49fd59[_0x3168c4(0x18f)](_0x51f92a));_0x2ec787&&(_0x115941[_0x3168c4(0x12c)](_0x2ec787,_0x21688d),_0x49fd59[_0x3168c4(0x107)](_0x2ec787),logger[_0x3168c4(0x14a)](_0x3168c4(0x105)+_0x3bf0af[_0x3168c4(0x1b4)]+_0x3168c4(0x15f)+_0x2ec787+_0x3168c4(0x128)));}}}}async function executeSingleJourneyPush(_0x12433c,_0x47da0a,_0x54bea1,_0x2fde0c,_0x4f15d1,_0x15d913){const _0x25d01f=a140_0x2324c6,{journeyDefToRequest:_0x5acf55,activationDefToCreateRequest:_0x4f92a1,yamlRuleToApi:_0x412de7,validateSegmentRule:_0x4dada9}=_0x15d913,_0x35c92e=new Map(),_0x48eff1=new Map();recoverSegmentIdsFromPushRecovery(_0x47da0a,_0x35c92e,_0x54bea1['segmentNameToId']);const _0x55b6bf=new Map(),_0x130341=new Map(),_0x15c0e5=new Map();let _0x11eacd;const _0x502a6f=async()=>{const _0x16bb27=a140_0x2c4f;if(_0x11eacd)return;_0x11eacd=new Map();if(!_0x47da0a[_0x16bb27(0x16b)])return;const _0x504eef=await _0x12433c[_0x16bb27(0x1ab)][_0x16bb27(0x1f5)](_0x47da0a[_0x16bb27(0x16b)]['id']);for(const _0x40eac9 of _0x504eef){const _0x1e059c=journeyActivationStepToYaml(_0x40eac9,_0x54bea1['idToEmailMap'],_0x54bea1['connectionIdToNameMap']),_0x203d92=activationSignature(_0x1e059c);!_0x11eacd[_0x16bb27(0x18f)](_0x203d92)&&_0x11eacd[_0x16bb27(0x12c)](_0x203d92,_0x40eac9['id']),_0x1e059c['name']&&_0x48eff1[_0x16bb27(0x12c)](_0x1e059c[_0x16bb27(0x1b4)],_0x40eac9['id']);}};await matchExistingJourneySegments(_0x12433c,_0x47da0a,_0x2fde0c[_0x25d01f(0x194)],_0x54bea1[_0x25d01f(0x1fd)],_0x54bea1[_0x25d01f(0xfe)]);const _0x1ff2d2={'resolveSegmentId':async _0x5a0d33=>{const _0x555dce=_0x25d01f,_0x9125bf=_0x54bea1[_0x555dce(0xfe)][_0x555dce(0x115)](_0x5a0d33);if(!_0x9125bf)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x5a0d33+_0x555dce(0x1a4)+_0x47da0a['yamlConfig'][_0x555dce(0x1b4)]+')');return _0x9125bf;},'resolveEmbeddedSegmentId':async(_0x29d1b1,_0xe41857)=>{const _0x48bb5b=_0x25d01f,_0x22a1a7=_0x54bea1['segmentNameToId'][_0x48bb5b(0x115)](_0x29d1b1);if(_0x22a1a7)return _0x22a1a7;const _0x23e3a5=_0x54bea1[_0x48bb5b(0x1fd)][_0x48bb5b(0x1dd)](_0x1e9814=>_0x1e9814['name']===_0x29d1b1);if(_0x23e3a5)return _0x54bea1[_0x48bb5b(0xfe)]['set'](_0x29d1b1,_0x23e3a5['id']),_0x23e3a5['id'];if(_0x47da0a[_0x48bb5b(0x13a)]){const {stageName:_0x868245,criteriaName:_0x331096}=findSegmentCriteriaLocation(_0x47da0a['yamlConfig'],_0x29d1b1);return _0x4dada9(_0x29d1b1,_0xe41857['rule']),_0x130341['set'](_0x29d1b1,{'definition':_0xe41857,'stageName':_0x868245,'criteriaName':_0x331096}),createPendingSegmentId(_0x29d1b1);}const _0x1e740a=_0x47da0a['existingJourney']?.['id'];if(!_0x1e740a)throw new SDKError(ErrorCode[_0x48bb5b(0x112)],_0x48bb5b(0x152));const _0x1259fb=_0x55b6bf[_0x48bb5b(0x115)](_0x29d1b1);if(_0x1259fb)return _0x1259fb;const _0xd410c9=((async()=>{const _0x420636=_0x48bb5b;_0x4dada9(_0x29d1b1,_0xe41857['rule']);const _0x14513d=generateDeterministicJourneySegmentName(_0x47da0a[_0x420636(0x189)][_0x420636(0x1b4)],_0x29d1b1),_0x12e805=_0x54bea1[_0x420636(0x1fd)][_0x420636(0x1dd)](_0x20c4c9=>_0x20c4c9[_0x420636(0x1b4)]===_0x14513d),_0x134acd=createSegmentIdResolver(_0x54bea1[_0x420636(0xfe)],_0x29d1b1),_0x1eef6c=await resolveRuleSegmentIds(_0xe41857[_0x420636(0x154)],_0x134acd);let _0x3fa82c;return _0x12e805?(await _0x12433c[_0x420636(0x176)]['updateSegmentById'](_0x2fde0c[_0x420636(0x194)],_0x12e805['id'],{'description':_0xe41857['description']||_0x420636(0x171)+_0x29d1b1,'rule':_0x412de7(_0x1eef6c,!![]),'countPopulation':!![]}),_0x3fa82c=_0x12e805['id'],saveSegmentToPushRecovery(_0x47da0a[_0x420636(0x164)],_0x47da0a[_0x420636(0x189)][_0x420636(0x1b4)],_0x29d1b1,{'segmentId':_0x3fa82c,'uniqueServerName':_0x14513d,'createdAt':new Date()[_0x420636(0x19e)]()})):_0x3fa82c=await createOrRecoverEmbeddedSegment(_0x12433c,_0x47da0a,{'localName':_0x29d1b1,'uniqueSegmentName':_0x14513d,'description':_0xe41857[_0x420636(0x198)]||_0x420636(0x171)+_0x29d1b1,'journeyId':_0x1e740a,'resolvedRule':_0x1eef6c,'parentId':_0x2fde0c[_0x420636(0x194)],'folderId':_0x2fde0c[_0x420636(0x12d)]||''},_0x412de7),_0x54bea1[_0x420636(0xfe)][_0x420636(0x12c)](_0x29d1b1,_0x3fa82c),_0x35c92e['set'](_0x29d1b1,_0x3fa82c),_0x3fa82c;})());_0x55b6bf['set'](_0x29d1b1,_0xd410c9);try{return await _0xd410c9;}finally{_0x55b6bf['delete'](_0x29d1b1);}},'resolveActivationId':async _0x19468b=>{const _0x2ebb29=_0x25d01f,_0x5e69e3=_0x48eff1[_0x2ebb29(0x115)](_0x19468b);if(_0x5e69e3)return _0x5e69e3;if(_0x47da0a[_0x2ebb29(0x16b)]){await _0x502a6f();const _0x232240=_0x48eff1[_0x2ebb29(0x115)](_0x19468b);if(_0x232240)return _0x232240;}throw new SDKError(ErrorCode[_0x2ebb29(0x167)],_0x2ebb29(0x1de)+_0x19468b+_0x2ebb29(0x1a4)+_0x47da0a[_0x2ebb29(0x189)][_0x2ebb29(0x1b4)]+_0x2ebb29(0x1ba)+_0x2ebb29(0x1dc));},'resolveEmbeddedActivationId':async(_0x2775a7,_0x16a3fb)=>{const _0x24b796=_0x25d01f,_0x4197b1=_0x48eff1[_0x24b796(0x115)](_0x2775a7);if(_0x4197b1)return _0x4197b1;if(_0x47da0a[_0x24b796(0x13a)])return _0x15c0e5['set'](_0x2775a7,_0x16a3fb),createPendingActivationId(_0x2775a7);if(_0x47da0a[_0x24b796(0x16b)]){await _0x502a6f();const _0x1666ae=_0x48eff1[_0x24b796(0x115)](_0x16a3fb[_0x24b796(0x1b4)]);if(_0x1666ae)return _0x48eff1[_0x24b796(0x12c)](_0x2775a7,_0x1666ae),_0x1666ae;const _0x4783de=activationSignature(_0x16a3fb),_0x32e7fc=_0x11eacd?.[_0x24b796(0x115)](_0x4783de);if(_0x32e7fc)return _0x48eff1[_0x24b796(0x12c)](_0x2775a7,_0x32e7fc),_0x32e7fc;const _0x24cb34=await _0x4f92a1(_0x16a3fb,_0x54bea1['activationContext']),_0x59abc4={..._0x24cb34,..._0x16a3fb[_0x24b796(0x1a0)]!==undefined&&{'runAfterJourneyRefresh':_0x16a3fb[_0x24b796(0x1a0)]}},_0x28918d=await _0x12433c['journey'][_0x24b796(0x14b)](_0x47da0a[_0x24b796(0x16b)]['id'],_0x59abc4);return _0x48eff1[_0x24b796(0x12c)](_0x2775a7,_0x28918d['id']),_0x28918d['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x24b796(0x11d));},'resolveJourneyId':async _0x24206c=>{const _0x2cca68=_0x25d01f;try{return await _0x12433c[_0x2cca68(0x1ab)]['resolveJourneyId'](_0x2fde0c[_0x2cca68(0x194)],_0x24206c);}catch(_0x3d3673){throw new SDKError(ErrorCode[_0x2cca68(0x167)],_0x2cca68(0x188)+_0x24206c+_0x2cca68(0x17e)+_0x47da0a['yamlConfig'][_0x2cca68(0x1b4)]+'\x27)',_0x3d3673);}},'resolveStageId':async(_0x5bdc6d,_0xe4052d)=>{const _0x53adf9=_0x25d01f,_0x3368fe=await _0x12433c[_0x53adf9(0x1ab)][_0x53adf9(0x18b)](_0x5bdc6d),_0x47369e=_0x3368fe[_0x53adf9(0x178)][_0x53adf9(0x1e9)][_0x53adf9(0x1dd)](_0x177458=>_0x177458[_0x53adf9(0x1b4)]['toLowerCase']()===_0xe4052d[_0x53adf9(0x15e)]());if(!_0x47369e?.['id'])throw new SDKError(ErrorCode[_0x53adf9(0x167)],'Stage\x20\x27'+_0xe4052d+_0x53adf9(0x137)+(_0x3368fe[_0x53adf9(0x178)]['journeyBundleName']||_0x3368fe['attributes']['name'])+'\x27');return _0x47369e['id'];}},_0x2a7104=await _0x5acf55(_0x47da0a[_0x25d01f(0x189)],_0x2fde0c[_0x25d01f(0x194)],_0x1ff2d2),_0x34df41=_0x2fde0c['folderId']||_0x2fde0c[_0x25d01f(0x12d)];_0x34df41&&(_0x2a7104[_0x25d01f(0x1b3)]={'parentFolder':{'data':{'id':_0x34df41,'type':_0x25d01f(0x192)}}});if(_0x47da0a[_0x25d01f(0x13a)]){if(_0x130341[_0x25d01f(0x185)]>0x0||_0x15c0e5['size']>0x0)return await executeThreeStepJourneyCreate(_0x12433c,_0x47da0a,_0x2a7104,{'pendingEmbeddedSegments':_0x130341,'pendingEmbeddedActivations':_0x15c0e5,'embeddedSegmentNameToId':_0x35c92e,'journeyActivationNameToId':_0x48eff1},{..._0x2fde0c,'effectiveFolderId':_0x34df41},_0x54bea1,_0x4f15d1,_0x15d913);else{ensureJourneyDefaults(_0x2a7104[_0x25d01f(0x178)]);const _0x4d540c=await _0x12433c[_0x25d01f(0x1ab)][_0x25d01f(0x1f1)](_0x2a7104);return deletePushRecovery(_0x47da0a[_0x25d01f(0x164)]),{'action':_0x25d01f(0x183),'journeyId':_0x4d540c['id'],'embeddedSegmentNameToId':_0x35c92e};}}else{if(_0x47da0a['hasChanges']&&_0x47da0a['existingJourney']){_0x2a7104['id']=_0x47da0a['existingJourney']['id'];const _0x2f905f=_0x2a7104['attributes'];_0x47da0a[_0x25d01f(0x16b)][_0x25d01f(0x178)]?.['journeyBundleName']&&(_0x2f905f[_0x25d01f(0x143)]=_0x47da0a[_0x25d01f(0x16b)][_0x25d01f(0x178)]['journeyBundleName']);const _0x215139=_0x47da0a[_0x25d01f(0x16b)][_0x25d01f(0x178)]?.[_0x25d01f(0x1e9)];return _0x215139&&_0x2a7104['attributes']['journeyStages']&&injectExistingStageIds(_0x2a7104[_0x25d01f(0x178)][_0x25d01f(0x1e9)],_0x215139),ensureJourneyDefaults(_0x2f905f),await _0x12433c[_0x25d01f(0x1ab)][_0x25d01f(0x10b)](_0x47da0a[_0x25d01f(0x16b)]['id'],_0x2a7104),deletePushRecovery(_0x47da0a[_0x25d01f(0x164)]),{'action':_0x25d01f(0x10c),'journeyId':_0x47da0a['existingJourney']['id'],'embeddedSegmentNameToId':_0x35c92e};}}return deletePushRecovery(_0x47da0a[_0x25d01f(0x164)]),{'action':'unchanged','journeyId':_0x47da0a[_0x25d01f(0x16b)]?.['id'],'embeddedSegmentNameToId':_0x35c92e};}function findSegmentCriteriaLocation(_0x422250,_0x2b571e){const _0x1d8bee=a140_0x2324c6,_0x17f1cb=_0x422250[_0x1d8bee(0x1b0)]||_0x422250[_0x1d8bee(0x139)]?.[0x0]?.['stages']||[];let _0x58a4a5='entry',_0x9d47d9=_0x2b571e;const _0x2b76f1=_0x422250[_0x1d8bee(0x159)]||_0x422250[_0x1d8bee(0x139)]?.[0x0]?.[_0x1d8bee(0x159)];if(_0x2b76f1?.[_0x1d8bee(0x176)]===_0x2b571e)return{'stageName':_0x1d8bee(0x159),'criteriaName':_0x2b76f1[_0x1d8bee(0x1b4)]||_0x2b571e};_0x32ac58:for(const _0x1e2114 of _0x17f1cb){if(_0x1e2114[_0x1d8bee(0x148)]?.['segment']===_0x2b571e){_0x58a4a5=_0x1e2114[_0x1d8bee(0x1b4)],_0x9d47d9=_0x1e2114[_0x1d8bee(0x148)][_0x1d8bee(0x1b4)]||_0x2b571e;break;}if(_0x1e2114[_0x1d8bee(0x1c5)])for(const _0x150a8b of _0x1e2114[_0x1d8bee(0x1c5)]){if(_0x150a8b[_0x1d8bee(0x13e)]===_0x1d8bee(0x129)&&_0x150a8b[_0x1d8bee(0x153)]?.['branches'])for(const _0xb5de6d of _0x150a8b[_0x1d8bee(0x153)][_0x1d8bee(0x1f7)]){if(_0xb5de6d[_0x1d8bee(0x176)]===_0x2b571e){_0x58a4a5=_0x1e2114['name'],_0x9d47d9=_0xb5de6d[_0x1d8bee(0x1b4)]||_0x2b571e;break _0x32ac58;}}}}return{'stageName':_0x58a4a5,'criteriaName':_0x9d47d9};}async function executeThreeStepJourneyCreate(_0x1a3560,_0x4246e6,_0xaac9d8,_0xc62fd3,_0x125ca9,_0x52932d,_0x4b3a82,_0x283db0){const _0x489d05=a140_0x2324c6,{activationDefToCreateRequest:_0x18e3c9,yamlRuleToApi:_0x2b1a16}=_0x283db0,{pendingEmbeddedSegments:_0x29cf9e,pendingEmbeddedActivations:_0x14c6a1,embeddedSegmentNameToId:_0x44eeb3}=_0xc62fd3,_0x32e3dd=JSON['parse'](JSON[_0x489d05(0x117)](_0xaac9d8));ensureJourneyDefaults(_0x32e3dd['attributes']),stripPendingIds(_0x32e3dd);const _0x56e781=await _0x1a3560[_0x489d05(0x1ab)]['create'](_0x32e3dd),_0x18f9fe=_0x56e781['id'],_0x323f04=new Map();for(const _0x2bb26b of _0x56e781[_0x489d05(0x178)][_0x489d05(0x1e9)]){_0x323f04[_0x489d05(0x12c)](_0x2bb26b[_0x489d05(0x1b4)][_0x489d05(0x15e)](),_0x2bb26b['id']);}recoverSegmentIdsFromPushRecovery(_0x4246e6,_0x44eeb3,_0x52932d[_0x489d05(0xfe)]);for(const [_0x5d7fd7,{definition:_0x41608c}]of _0x29cf9e){if(_0x44eeb3[_0x489d05(0x18f)](_0x5d7fd7)){_0x4b3a82[_0x489d05(0x16e)]?.({'type':_0x489d05(0xfa),'journeyName':_0x4246e6[_0x489d05(0x189)][_0x489d05(0x1b4)],'segmentName':_0x5d7fd7});continue;}const _0x4fc6bf=generateDeterministicJourneySegmentName(_0x4246e6[_0x489d05(0x189)][_0x489d05(0x1b4)],_0x5d7fd7);_0x4b3a82[_0x489d05(0x16e)]?.({'type':_0x489d05(0x113),'journeyName':_0x4246e6[_0x489d05(0x189)]['name'],'segmentName':_0x5d7fd7});const _0x41633c=createSegmentIdResolver(_0x52932d[_0x489d05(0xfe)],_0x5d7fd7),_0x59ebac=await resolveRuleSegmentIds(_0x41608c['rule'],_0x41633c),_0x528489=await createOrRecoverEmbeddedSegment(_0x1a3560,_0x4246e6,{'localName':_0x5d7fd7,'uniqueSegmentName':_0x4fc6bf,'description':_0x41608c[_0x489d05(0x198)]||'Entry\x20criteria:\x20'+_0x5d7fd7,'journeyId':_0x18f9fe,'resolvedRule':_0x59ebac,'parentId':_0x125ca9['parentId'],'folderId':_0x125ca9[_0x489d05(0x1d6)]||''},_0x2b1a16);_0x44eeb3[_0x489d05(0x12c)](_0x5d7fd7,_0x528489),_0x52932d[_0x489d05(0xfe)]['set'](_0x5d7fd7,_0x528489),_0x4b3a82[_0x489d05(0x16e)]?.({'type':_0x489d05(0xfa),'journeyName':_0x4246e6[_0x489d05(0x189)][_0x489d05(0x1b4)],'segmentName':_0x5d7fd7});}const _0x3faa97=new Map();for(const [_0x28e571,_0x5a2173]of _0x14c6a1){_0x4b3a82[_0x489d05(0x16e)]?.({'type':_0x489d05(0x118),'journeyName':_0x4246e6[_0x489d05(0x189)][_0x489d05(0x1b4)],'activationName':_0x28e571});const _0x113d5a=await _0x18e3c9(_0x5a2173,_0x52932d[_0x489d05(0x1da)]),_0xddcafa={..._0x113d5a,..._0x5a2173[_0x489d05(0x1a0)]!==undefined&&{'runAfterJourneyRefresh':_0x5a2173[_0x489d05(0x1a0)]}},_0x1453ec=await _0x1a3560['journey'][_0x489d05(0x14b)](_0x18f9fe,_0xddcafa);_0x3faa97[_0x489d05(0x12c)](_0x28e571,_0x1453ec['id']),_0xc62fd3[_0x489d05(0x12e)][_0x489d05(0x12c)](_0x28e571,_0x1453ec['id']),_0x4b3a82[_0x489d05(0x16e)]?.({'type':'embedded_activation_created','journeyName':_0x4246e6[_0x489d05(0x189)][_0x489d05(0x1b4)],'activationName':_0x28e571});}const _0x4dd37b=JSON['parse'](JSON[_0x489d05(0x117)](_0xaac9d8));return _0x4dd37b['id']=_0x18f9fe,ensureJourneyDefaults(_0x4dd37b[_0x489d05(0x178)]),resolvePendingIdsInRequest(_0x4dd37b,_0xaac9d8,_0x323f04,_0x44eeb3,_0x3faa97,_0x4b3a82),await _0x1a3560[_0x489d05(0x1ab)][_0x489d05(0x10b)](_0x18f9fe,_0x4dd37b),deletePushRecovery(_0x4246e6['absolutePath']),{'action':'created','journeyId':_0x18f9fe,'embeddedSegmentNameToId':_0x44eeb3};}export function stripWaitStepPendingIds(_0x33ab34){const _0x5dcc4c=a140_0x2324c6,_0x3a1351=_0x33ab34[_0x5dcc4c(0x1f9)]&&isPendingSegmentId(_0x33ab34[_0x5dcc4c(0x1f9)]),_0x5c6718=_0x33ab34[_0x5dcc4c(0x142)]?.[_0x5dcc4c(0x1cc)](_0x5f2435=>_0x5f2435['segmentId']&&isPendingSegmentId(_0x5f2435['segmentId']));(_0x3a1351||_0x5c6718)&&(_0x33ab34['waitStepType']=_0x5dcc4c(0x1d5),_0x33ab34[_0x5dcc4c(0x11f)]=0x1,_0x33ab34[_0x5dcc4c(0x138)]=_0x5dcc4c(0x15c),delete _0x33ab34[_0x5dcc4c(0x1f9)],delete _0x33ab34['conditionTimeoutDuration'],delete _0x33ab34['conditionTimeoutUnit'],delete _0x33ab34[_0x5dcc4c(0x142)]);}export function resolveWaitStepPendingIds(_0x3e8250,_0x45dcf8,_0x1cee90,_0x2a6a03){const _0x2f936f=a140_0x2324c6;if(_0x45dcf8[_0x2f936f(0x1f9)]&&isPendingSegmentId(_0x45dcf8['conditionSegmentId'])){const _0x4839a1=_0x1cee90(_0x45dcf8[_0x2f936f(0x1f9)],_0x2f936f(0x17d)+_0x2a6a03+_0x2f936f(0x172));_0x4839a1&&(_0x3e8250['waitStepType']=_0x2f936f(0x1c1),_0x3e8250[_0x2f936f(0x1f9)]=_0x4839a1,delete _0x3e8250['waitStep'],delete _0x3e8250[_0x2f936f(0x138)],_0x45dcf8[_0x2f936f(0x1b7)]!==undefined&&(_0x3e8250[_0x2f936f(0x1b7)]=_0x45dcf8[_0x2f936f(0x1b7)]),_0x45dcf8[_0x2f936f(0x1b1)]&&(_0x3e8250[_0x2f936f(0x1b1)]=_0x45dcf8[_0x2f936f(0x1b1)]));}if(_0x45dcf8[_0x2f936f(0x142)]){const _0x1b971b=_0x45dcf8[_0x2f936f(0x142)][_0x2f936f(0x1cc)](_0x2f61ff=>_0x2f61ff[_0x2f936f(0x1e5)]&&isPendingSegmentId(_0x2f61ff[_0x2f936f(0x1e5)]));if(_0x1b971b){const _0x51ee65=_0x45dcf8[_0x2f936f(0x142)][_0x2f936f(0x1ac)](_0x143131=>{const _0x1ebb63=_0x2f936f;if(_0x143131[_0x1ebb63(0x1e5)]&&isPendingSegmentId(_0x143131['segmentId'])){const _0x28642d=_0x1cee90(_0x143131[_0x1ebb63(0x1e5)],_0x1ebb63(0x17d)+_0x2a6a03+_0x1ebb63(0x172));return{..._0x143131,'segmentId':_0x28642d||_0x143131[_0x1ebb63(0x1e5)]};}return{..._0x143131};});_0x3e8250['waitStepType']=_0x2f936f(0x1c1),_0x3e8250['conditions']=_0x51ee65,delete _0x3e8250['waitStep'],delete _0x3e8250[_0x2f936f(0x138)],delete _0x3e8250['conditionSegmentId'],delete _0x3e8250[_0x2f936f(0x1b7)],delete _0x3e8250[_0x2f936f(0x1b1)];}}}function stripPendingIds(_0x346938){const _0x1fef83=a140_0x2324c6;_0x346938[_0x1fef83(0x178)][_0x1fef83(0x159)]?.[_0x1fef83(0x1e5)]&&isPendingSegmentId(_0x346938['attributes'][_0x1fef83(0x159)][_0x1fef83(0x1e5)])&&delete _0x346938[_0x1fef83(0x178)][_0x1fef83(0x159)];for(const _0x1dfaae of _0x346938[_0x1fef83(0x178)][_0x1fef83(0x1e9)]||[]){_0x1dfaae[_0x1fef83(0x1c0)]?.[_0x1fef83(0x1e5)]&&isPendingSegmentId(_0x1dfaae[_0x1fef83(0x1c0)][_0x1fef83(0x1e5)])&&delete _0x1dfaae[_0x1fef83(0x1c0)];_0x1dfaae[_0x1fef83(0x1df)]?.[_0x1fef83(0x1e5)]&&isPendingSegmentId(_0x1dfaae['milestone']['segmentId'])&&delete _0x1dfaae[_0x1fef83(0x1df)];_0x1dfaae[_0x1fef83(0x175)]&&(_0x1dfaae['exitCriterias']=_0x1dfaae[_0x1fef83(0x175)]['filter'](_0x306978=>!_0x306978[_0x1fef83(0x1e5)]||!isPendingSegmentId(_0x306978[_0x1fef83(0x1e5)])));if(_0x1dfaae[_0x1fef83(0x1c5)])for(const _0x4be959 of Object[_0x1fef83(0x1c9)](_0x1dfaae['steps'])){const _0x293ba1=_0x1dfaae['steps'][_0x4be959];_0x293ba1[_0x1fef83(0x13e)]===_0x1fef83(0x140)&&_0x293ba1['journeyActivationStepId']&&isPendingActivationId(_0x293ba1[_0x1fef83(0x10d)])&&(_0x293ba1[_0x1fef83(0x10d)]='');if(_0x293ba1[_0x1fef83(0x13e)]==='DecisionPoint'&&_0x293ba1['branches'])for(const _0x403d28 of _0x293ba1[_0x1fef83(0x1f7)]){_0x403d28[_0x1fef83(0x1e5)]&&isPendingSegmentId(_0x403d28[_0x1fef83(0x1e5)])&&(_0x403d28[_0x1fef83(0x1e5)]='');}_0x293ba1[_0x1fef83(0x13e)]===_0x1fef83(0x126)&&stripWaitStepPendingIds(_0x293ba1);}}}function resolvePendingIdsInRequest(_0x2c7ebc,_0x5e1648,_0x31175e,_0xcd46b0,_0x38511b,_0x311386){const _0x4ced66=a140_0x2324c6,_0x4cebcc=(_0x54938b,_0x49c87d)=>{const _0xb2d028=a140_0x2c4f;if(!isPendingSegmentId(_0x54938b))return _0x54938b;const _0x5a079e=extractPendingSegmentName(_0x54938b),_0x3e535a=_0xcd46b0[_0xb2d028(0x115)](_0x5a079e);return!_0x3e535a&&_0x311386[_0xb2d028(0x156)]?.(_0xb2d028(0x1a6)+_0x5a079e+_0xb2d028(0x1c7)+_0x49c87d),_0x3e535a;};if(_0x2c7ebc['attributes'][_0x4ced66(0x159)]?.[_0x4ced66(0x1e5)]&&isPendingSegmentId(_0x2c7ebc[_0x4ced66(0x178)][_0x4ced66(0x159)][_0x4ced66(0x1e5)])){const _0x12aa7e=_0x4cebcc(_0x2c7ebc[_0x4ced66(0x178)][_0x4ced66(0x159)][_0x4ced66(0x1e5)],_0x4ced66(0x13f));_0x12aa7e&&(_0x2c7ebc[_0x4ced66(0x178)][_0x4ced66(0x159)][_0x4ced66(0x1e5)]=_0x12aa7e);}for(const _0x4f150e of _0x2c7ebc['attributes'][_0x4ced66(0x1e9)]||[]){const _0xf53f31=_0x31175e['get'](_0x4f150e[_0x4ced66(0x1b4)]['toLowerCase']());_0xf53f31&&(_0x4f150e['id']=_0xf53f31);if(_0x4f150e[_0x4ced66(0x1c0)]?.['segmentId']&&isPendingSegmentId(_0x4f150e[_0x4ced66(0x1c0)][_0x4ced66(0x1e5)])){const _0x18fb7e=_0x4cebcc(_0x4f150e['entryCriteria']['segmentId'],_0x4ced66(0x17d)+_0x4f150e[_0x4ced66(0x1b4)]+_0x4ced66(0x14e));_0x18fb7e&&(_0x4f150e[_0x4ced66(0x1c0)][_0x4ced66(0x1e5)]=_0x18fb7e);}if(_0x4f150e['exitCriterias'])for(const _0x8d0794 of _0x4f150e[_0x4ced66(0x175)]){if(_0x8d0794[_0x4ced66(0x1e5)]&&isPendingSegmentId(_0x8d0794['segmentId'])){const _0x763a3e=_0x4cebcc(_0x8d0794[_0x4ced66(0x1e5)],_0x4ced66(0x17d)+_0x4f150e[_0x4ced66(0x1b4)]+'\x27\x20exit\x20criteria');_0x763a3e&&(_0x8d0794[_0x4ced66(0x1e5)]=_0x763a3e);}}if(_0x4f150e['milestone']?.[_0x4ced66(0x1e5)]&&isPendingSegmentId(_0x4f150e[_0x4ced66(0x1df)][_0x4ced66(0x1e5)])){const _0x131965=_0x4cebcc(_0x4f150e[_0x4ced66(0x1df)]['segmentId'],_0x4ced66(0x17d)+_0x4f150e[_0x4ced66(0x1b4)]+_0x4ced66(0x1f8));_0x131965&&(_0x4f150e[_0x4ced66(0x1df)][_0x4ced66(0x1e5)]=_0x131965);}if(_0x4f150e[_0x4ced66(0x1c5)]){const _0x29faa5=_0x4dc772=>_0x5e1648[_0x4ced66(0x178)]['journeyStages']?.[_0x4ced66(0x1dd)](_0x2f4edf=>_0x2f4edf[_0x4ced66(0x1b4)][_0x4ced66(0x15e)]()===_0x4f150e[_0x4ced66(0x1b4)][_0x4ced66(0x15e)]())?.[_0x4ced66(0x1c5)]?.[_0x4dc772];for(const _0x2c05e7 of Object[_0x4ced66(0x1c9)](_0x4f150e['steps'])){const _0x1d3449=_0x4f150e[_0x4ced66(0x1c5)][_0x2c05e7],_0x1feeb7=_0x29faa5(_0x2c05e7);if(_0x1d3449[_0x4ced66(0x13e)]===_0x4ced66(0x140)&&_0x1d3449[_0x4ced66(0x10d)]&&(isPendingActivationId(_0x1d3449['journeyActivationStepId'])||_0x1d3449[_0x4ced66(0x10d)]==='')){if(_0x1feeb7?.[_0x4ced66(0x10d)]&&isPendingActivationId(_0x1feeb7[_0x4ced66(0x10d)])){const _0x466790=extractPendingActivationName(_0x1feeb7['journeyActivationStepId']),_0x94facf=_0x38511b[_0x4ced66(0x115)](_0x466790);_0x94facf&&(_0x1d3449[_0x4ced66(0x10d)]=_0x94facf);}}if(_0x1d3449['type']===_0x4ced66(0x182)&&_0x1d3449['branches']&&_0x1feeb7?.['branches'])for(let _0xea9776=0x0;_0xea9776<_0x1d3449[_0x4ced66(0x1f7)]['length'];_0xea9776++){const _0x102477=_0x1d3449['branches'][_0xea9776],_0x1f9948=_0x1feeb7['branches'][_0xea9776];if(_0x1f9948?.[_0x4ced66(0x1e5)]&&isPendingSegmentId(_0x1f9948['segmentId'])){const _0x4f681a=_0x4cebcc(_0x1f9948[_0x4ced66(0x1e5)],_0x4ced66(0x17d)+_0x4f150e[_0x4ced66(0x1b4)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x102477[_0x4ced66(0x1b4)]||_0xea9776)+'\x27');_0x4f681a&&(_0x102477[_0x4ced66(0x1e5)]=_0x4f681a);}}_0x1d3449[_0x4ced66(0x13e)]===_0x4ced66(0x126)&&_0x1feeb7?.[_0x4ced66(0x13e)]===_0x4ced66(0x126)&&resolveWaitStepPendingIds(_0x1d3449,_0x1feeb7,_0x4cebcc,_0x4f150e[_0x4ced66(0x1b4)]);}}}}
1
+ const a140_0x2ff839=a140_0x18bd;(function(_0x360ae2,_0xcf3f60){const _0x54ce01=a140_0x18bd,_0x514e43=_0x360ae2();while(!![]){try{const _0x4007a7=-parseInt(_0x54ce01(0x296))/0x1*(-parseInt(_0x54ce01(0x275))/0x2)+parseInt(_0x54ce01(0x2ba))/0x3+-parseInt(_0x54ce01(0x26a))/0x4*(parseInt(_0x54ce01(0x208))/0x5)+-parseInt(_0x54ce01(0x2d3))/0x6+-parseInt(_0x54ce01(0x253))/0x7+parseInt(_0x54ce01(0x234))/0x8*(parseInt(_0x54ce01(0x2b6))/0x9)+parseInt(_0x54ce01(0x251))/0xa;if(_0x4007a7===_0xcf3f60)break;else _0x514e43['push'](_0x514e43['shift']());}catch(_0x534fcf){_0x514e43['push'](_0x514e43['shift']());}}}(a140_0x33e7,0x492c3));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x2ff839(0x2d2));export const PENDING_SEGMENT_PREFIX=a140_0x2ff839(0x1ef);export const PENDING_ACTIVATION_PREFIX=a140_0x2ff839(0x22e);export function createPendingSegmentId(_0x43e1e5){return''+PENDING_SEGMENT_PREFIX+_0x43e1e5+'__';}export function isPendingSegmentId(_0x1f09da){const _0x50e166=a140_0x2ff839;return _0x1f09da[_0x50e166(0x27e)](PENDING_SEGMENT_PREFIX)&&!_0x1f09da[_0x50e166(0x27e)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x2a7476){return _0x2a7476['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4aa51b){return''+PENDING_ACTIVATION_PREFIX+_0x4aa51b+'__';}export function isPendingActivationId(_0x731b9c){return _0x731b9c['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x8a4564){const _0x406810=a140_0x2ff839;return _0x8a4564[_0x406810(0x233)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x508eb4,_0x36f01a){const _0xb87d82=a140_0x2ff839,_0x4da48f=_0x508eb4+'::'+(_0x36f01a[_0xb87d82(0x256)]()||_0xb87d82(0x1f7)),_0xa2472e=createHash(_0xb87d82(0x216))[_0xb87d82(0x210)](_0x4da48f)[_0xb87d82(0x27d)](_0xb87d82(0x26c))[_0xb87d82(0x2d4)](0x0,0xc);return'journey_entry_criteria_'+_0xa2472e;}export function ensureJourneyDefaults(_0x253695){const _0x599ee4=a140_0x2ff839;!_0x253695[_0x599ee4(0x26d)]&&(_0x253695[_0x599ee4(0x26d)]=''),!_0x253695[_0x599ee4(0x1f3)]&&(_0x253695[_0x599ee4(0x1f3)]=_0x599ee4(0x23a));}export function injectExistingStageIds(_0x27db96,_0x33294f){const _0x2f2448=a140_0x2ff839,_0xcbebe9=new Map(_0x33294f['map'](_0x4847ca=>[_0x4847ca[_0x2f2448(0x258)],_0x4847ca['id']]));for(const _0x603da9 of _0x27db96){if(!_0x603da9['id']){const _0xed0e27=_0xcbebe9['get'](_0x603da9[_0x2f2448(0x258)]);_0xed0e27&&(_0x603da9['id']=_0xed0e27);}}}export function resolveTDFolderPath(_0x48c90f,_0x2d7aad,_0x4e627b){if(!_0x2d7aad)return _0x48c90f;if(_0x48c90f===_0x4e627b||_0x48c90f['startsWith'](_0x4e627b+'/'))return _0x48c90f;return _0x48c90f?_0x4e627b+'/'+_0x48c90f:_0x4e627b;}export function addFoldersToCreate(_0x31f4d6,_0x250c70,_0x30d180){const _0x3accfa=a140_0x2ff839;if(!_0x31f4d6)return;if(_0x250c70[_0x3accfa(0x200)](_0x31f4d6))return;const _0x2ba48b=_0x31f4d6['split']('/');let _0x49e595='';for(const _0x1f522d of _0x2ba48b){_0x49e595=_0x49e595?_0x49e595+'/'+_0x1f522d:_0x1f522d,!_0x250c70['has'](_0x49e595)&&_0x30d180[_0x3accfa(0x237)](_0x49e595);}}export function sortFoldersByDepth(_0x30a59e){const _0x48c1e4=a140_0x2ff839;return[..._0x30a59e][_0x48c1e4(0x2c7)]((_0xe67066,_0x549740)=>{const _0x6a8787=_0x48c1e4,_0xa878b1=(_0xe67066['match'](/\//g)||[])[_0x6a8787(0x2cc)],_0x4c4fe8=(_0x549740['match'](/\//g)||[])['length'];return _0xa878b1-_0x4c4fe8;});}import*as a140_0x2af49b from'yaml';import{readFileSync}from'fs';import a140_0x20a41d from'path';import{isJourneyDef,parseYamlString as a140_0x38903d,toYamlString as a140_0x20196f,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(_0x2d70de){const _0x1baf6a=a140_0x2ff839;if(Array[_0x1baf6a(0x280)](_0x2d70de))return'['+_0x2d70de[_0x1baf6a(0x295)](_0x35fe01=>stableStringify(_0x35fe01))[_0x1baf6a(0x2f0)](',')+']';if(_0x2d70de&&typeof _0x2d70de===_0x1baf6a(0x23f)){const _0x1554c0=_0x2d70de,_0x569572=Object[_0x1baf6a(0x20a)](_0x1554c0)[_0x1baf6a(0x2c7)](),_0x3c3997=_0x569572[_0x1baf6a(0x295)](_0x2fb686=>'\x22'+_0x2fb686+'\x22:'+stableStringify(_0x1554c0[_0x2fb686]));return'{'+_0x3c3997[_0x1baf6a(0x2f0)](',')+'}';}const _0x26a653=JSON['stringify'](_0x2d70de);return _0x26a653===undefined?'null':_0x26a653;}function activationSignature(_0x2082ed){const _0x48b90a=a140_0x2ff839,_0x172fa4={'connection':_0x2082ed['connection'],..._0x2082ed[_0x48b90a(0x277)]!==undefined&&{'all_columns':_0x2082ed[_0x48b90a(0x277)]},..._0x2082ed[_0x48b90a(0x276)]!==undefined&&{'columns':_0x2082ed[_0x48b90a(0x276)]},..._0x2082ed[_0x48b90a(0x1fd)]!==undefined&&{'behavior':_0x2082ed[_0x48b90a(0x1fd)]},..._0x2082ed[_0x48b90a(0x289)]!==undefined&&{'schedule':_0x2082ed[_0x48b90a(0x289)]},..._0x2082ed['notification']!==undefined&&{'notification':_0x2082ed['notification']},..._0x2082ed['connector_config']!==undefined&&{'connector_config':_0x2082ed['connector_config']},..._0x2082ed[_0x48b90a(0x231)]!==undefined&&{'activation_template_id':_0x2082ed[_0x48b90a(0x231)]}};return stableStringify(_0x172fa4);}async function fetchSegment(_0x36ce55,_0x4d427f,_0x232f58,_0x48ca09){const _0x22ee37=a140_0x2ff839,_0x2a75f5=_0x48ca09?.['find'](_0x352f6b=>_0x352f6b['id']===_0x232f58);if(_0x2a75f5)return _0x2a75f5;try{return await _0x36ce55['segment'][_0x22ee37(0x20d)](_0x4d427f,_0x232f58);}catch(_0x37809d){logger[_0x22ee37(0x262)](_0x22ee37(0x224)+_0x232f58+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x37809d);try{return await _0x36ce55['segment']['getSegmentEntity'](_0x232f58);}catch(_0x17f293){return logger[_0x22ee37(0x262)](_0x22ee37(0x2ee)+_0x232f58+':\x20'+_0x17f293),null;}}}function recoverSegmentIdsFromPushRecovery(_0x2a89a6,_0x34c4bb,_0x5223cc){const _0x3df85d=a140_0x2ff839,_0x5cbe49=readPushRecovery(_0x2a89a6[_0x3df85d(0x2d1)]);if(_0x5cbe49?.[_0x3df85d(0x248)]===_0x2a89a6[_0x3df85d(0x2a6)][_0x3df85d(0x258)])for(const [_0x22d013,_0xf0eea0]of Object[_0x3df85d(0x2ea)](_0x5cbe49[_0x3df85d(0x2e1)])){const _0x3faaee=generateDeterministicJourneySegmentName(_0x2a89a6[_0x3df85d(0x2a6)][_0x3df85d(0x258)],_0x22d013);_0xf0eea0[_0x3df85d(0x21f)]===_0x3faaee&&(_0x34c4bb['set'](_0x22d013,_0xf0eea0[_0x3df85d(0x2a2)]),_0x5223cc[_0x3df85d(0x282)](_0x22d013,_0xf0eea0['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x573e24,_0x14f28c,_0x18fa53,_0x54f463){const _0x59ae55=a140_0x2ff839;let _0x25a159;try{_0x25a159=await _0x573e24['segment'][_0x59ae55(0x227)]({'name':_0x18fa53['uniqueSegmentName'],'description':_0x18fa53[_0x59ae55(0x26d)],'journeyId':_0x18fa53['journeyId'],'rule':_0x54f463(_0x18fa53[_0x59ae55(0x27a)],!![]),'countPopulation':!![],'parentFolderId':_0x18fa53['folderId'],'audienceId':_0x18fa53[_0x59ae55(0x22c)]});}catch(_0x44f635){const _0x420e02=_0x44f635 instanceof Error&&_0x44f635[_0x59ae55(0x2c1)]['includes'](_0x59ae55(0x263));if(_0x420e02){const _0x281b1f=readPushRecovery(_0x14f28c[_0x59ae55(0x2d1)]),_0x62d385=_0x281b1f?.[_0x59ae55(0x248)]===_0x14f28c[_0x59ae55(0x2a6)][_0x59ae55(0x258)]?_0x281b1f[_0x59ae55(0x2e1)][_0x18fa53[_0x59ae55(0x290)]]:undefined;if(_0x62d385?.[_0x59ae55(0x21f)]===_0x18fa53[_0x59ae55(0x2e3)])await _0x573e24[_0x59ae55(0x1f7)][_0x59ae55(0x255)](_0x18fa53[_0x59ae55(0x22c)],_0x62d385[_0x59ae55(0x2a2)],{'description':_0x18fa53[_0x59ae55(0x26d)],'rule':_0x54f463(_0x18fa53[_0x59ae55(0x27a)],!![]),'countPopulation':!![]}),_0x25a159=_0x62d385[_0x59ae55(0x2a2)];else throw new SDKError(ErrorCode[_0x59ae55(0x287)],'Embedded\x20segment\x20\x27'+_0x18fa53['localName']+_0x59ae55(0x254)+(_0x59ae55(0x28f)+_0x14f28c[_0x59ae55(0x2d1)]['replace'](/([^/]+)$/,_0x59ae55(0x2bd))+')\x20')+_0x59ae55(0x1fe),_0x44f635);}else throw _0x44f635;}return saveSegmentToPushRecovery(_0x14f28c[_0x59ae55(0x2d1)],_0x14f28c[_0x59ae55(0x2a6)][_0x59ae55(0x258)],_0x18fa53['localName'],{'segmentId':_0x25a159,'uniqueServerName':_0x18fa53[_0x59ae55(0x2e3)],'createdAt':new Date()['toISOString']()}),_0x25a159;}export async function prepareSegmentFiles(_0x2c6a5b,_0x1a9c4c,_0x391ada,_0x7ba9cf,_0x62329e){const _0x1c306e=a140_0x2ff839,{activationDefToCreateRequest:_0x187937}=await import(_0x1c306e(0x2b4)),_0x5a219d=[],_0x3b5a63=new Set();for(const {yamlConfig:_0x1a39a2,folderPath:_0x2c28df,sourcePath:_0x5bfb20}of _0x2c6a5b){const _0xbda484=resolveTDFolderPath(_0x2c28df,_0x7ba9cf,_0x62329e),_0x3e5851=_0xbda484+':'+_0x1a39a2[_0x1c306e(0x258)],_0x23153a=_0x1a9c4c[_0x1c306e(0x204)]['get'](_0x3e5851),_0x5c1bff=_0x23153a?_0x1a9c4c[_0x1c306e(0x20b)][_0x1c306e(0x2c3)](_0x23153a['id'])||[]:[];addFoldersToCreate(_0xbda484,_0x1a9c4c[_0x1c306e(0x2ed)],_0x3b5a63);const _0x4a7e44=calculateActivationActions(_0x1a39a2['activations']||[],_0x5c1bff,_0x1a9c4c[_0x1c306e(0x225)],_0x1a9c4c['connectionIdToNameMap']);for(const _0x3b0647 of _0x4a7e44){(_0x3b0647[_0x1c306e(0x2b5)]===_0x1c306e(0x27f)||_0x3b0647[_0x1c306e(0x2b5)]===_0x1c306e(0x210))&&_0x3b0647[_0x1c306e(0x205)]&&(_0x3b0647[_0x1c306e(0x232)]=await _0x187937(_0x3b0647[_0x1c306e(0x205)],_0x391ada));}const _0x46bc29=calculateSegmentDiff(_0x1a39a2,_0x23153a,_0x5c1bff,_0x1a9c4c[_0x1c306e(0x225)],_0x1a9c4c[_0x1c306e(0x244)]);_0x5a219d[_0x1c306e(0x1fc)]({'relativePath':_0x1a39a2[_0x1c306e(0x258)],'absolutePath':_0x5bfb20,'yamlConfig':_0x1a39a2,'folderPath':_0xbda484,'existingSegment':_0x23153a,'existingActivations':_0x5c1bff,'isNew':_0x46bc29[_0x1c306e(0x264)],'hasChanges':_0x46bc29[_0x1c306e(0x24c)],'diff':_0x46bc29[_0x1c306e(0x29b)],'activationActions':_0x4a7e44});}return{'segmentFiles':_0x5a219d,'foldersToCreate':_0x3b5a63};}export async function prepareJourneyFiles(_0x3d602d,_0x2a80ca,_0x435a61,_0xdaba0f){const _0x9d0132=a140_0x2ff839,_0x39fb50=[],_0x25f8ba=new Set();for(const {yamlConfig:_0x15468c,folderPath:_0xc91c8d,sourcePath:_0x39e05b}of _0x3d602d){const _0x3d6dda=resolveTDFolderPath(_0xc91c8d,_0x435a61,_0xdaba0f),_0x538afd=_0x3d6dda+':'+_0x15468c['name'],_0x54ba95=_0x2a80ca[_0x9d0132(0x1f1)][_0x9d0132(0x2c3)](_0x538afd);let _0x230381,_0x27d305;if(_0x54ba95&&_0x54ba95[_0x9d0132(0x2cc)]>0x0){const _0x6c3a31=buildLocalExpandedRuleMappings(_0x15468c),{createYamlContext:_0x4c8004,prefetchJourneySegments:_0x472dc9}=createPushYamlContextForBundle(_0x2a80ca['deps'],_0x2a80ca['parentId'],_0x2a80ca['existingSegments'],_0x6c3a31,_0x2a80ca[_0x9d0132(0x225)],_0x2a80ca['connectionIdToNameMap'],_0x2a80ca['activationStepsById'],_0x2a80ca[_0x9d0132(0x2ef)]);await _0x472dc9(_0x54ba95[_0x9d0132(0x295)](_0x44aa67=>_0x44aa67['id']));const _0x16dca1=await _0x2a80ca['deps'][_0x9d0132(0x209)][_0x9d0132(0x23e)](_0x54ba95[0x0][_0x9d0132(0x236)]),_0x41b038=hasMultipleVersions(_0x15468c),_0x31da99=async _0x5a906a=>{const _0x4ec8cd=_0x9d0132,_0x198ddb=_0x2a80ca['journeyById']?.[_0x4ec8cd(0x2c3)](_0x5a906a);if(_0x198ddb)return _0x198ddb;return _0x2a80ca[_0x4ec8cd(0x246)]({'journeyId':_0x5a906a,'journeyName':_0x15468c[_0x4ec8cd(0x258)],'isMultiVersion':_0x54ba95['length']>0x1});};if(_0x41b038&&_0x54ba95[_0x9d0132(0x2cc)]>0x1){const _0x4c27fd=[];for(const _0x421857 of _0x54ba95){const _0x546c1e=_0x421857[_0x9d0132(0x235)]||0x1;_0x2a80ca[_0x9d0132(0x229)]?.[_0x9d0132(0x210)](_0x9d0132(0x2c9)+_0x15468c[_0x9d0132(0x258)]+'\x20v'+_0x546c1e);const _0xf06331=await _0x31da99(_0x421857['id']),_0x46719a=_0x4c8004(_0x421857['id']),_0x1ed747=await journeyResponseToDef(_0xf06331,_0x46719a);_0x4c27fd[_0x9d0132(0x1fc)]({'item':_0x421857,'yaml':_0x1ed747});}const _0x97f095=buildLocalRuleToNameMappingFromJourney(_0x15468c);_0x27d305=buildMergedJourneyDef(_0x4c27fd,_0x97f095,_0x16dca1);const _0x1b8ba=Math['max'](..._0x4c27fd[_0x9d0132(0x295)](_0x2db536=>_0x2db536[_0x9d0132(0x260)][_0x9d0132(0x235)]||0x0)),_0x4d8a12=_0x54ba95['find'](_0x256117=>(_0x256117[_0x9d0132(0x235)]||0x0)===_0x1b8ba);_0x4d8a12&&(_0x2a80ca[_0x9d0132(0x229)]?.['update'](_0x9d0132(0x2c9)+_0x15468c[_0x9d0132(0x258)]+'\x20v'+_0x1b8ba),_0x230381=await _0x31da99(_0x4d8a12['id']));}else{const _0x21dce2=_0x54ba95[_0x54ba95[_0x9d0132(0x2cc)]-0x1];_0x2a80ca['progress']?.[_0x9d0132(0x210)](_0x9d0132(0x2c9)+_0x15468c[_0x9d0132(0x258)]),_0x230381=await _0x31da99(_0x21dce2['id']);const _0x3d247f=_0x4c8004(_0x21dce2['id']),_0x423922=await journeyResponseToDef(_0x230381,_0x3d247f),_0xf6a8d6=buildLocalRuleToNameMappingFromJourney(_0x15468c);_0x27d305=buildMergedJourneyDef([{'item':_0x21dce2,'yaml':_0x423922}],_0xf6a8d6,_0x16dca1);}}addFoldersToCreate(_0x3d6dda,_0x2a80ca[_0x9d0132(0x2ed)],_0x25f8ba);const _0x55dcbc=calculateJourneyDiff(_0x15468c,_0x27d305);_0x39fb50[_0x9d0132(0x1fc)]({'relativePath':_0x15468c[_0x9d0132(0x258)],'absolutePath':_0x39e05b,'yamlConfig':_0x15468c,'folderPath':_0x3d6dda,'existingJourney':_0x230381,'isNew':_0x55dcbc[_0x9d0132(0x264)],'hasChanges':_0x55dcbc[_0x9d0132(0x24c)],'diff':_0x55dcbc[_0x9d0132(0x29b)]});}return{'journeyFiles':_0x39fb50,'foldersToCreate':_0x25f8ba};}export function calculateActivationActions(_0x1d63df,_0x31386c,_0x2c1322,_0x505960){const _0x475f0b=a140_0x2ff839,_0x158c8d=[],_0x4877d9=new Map();for(const _0x21f8f3 of _0x31386c){_0x4877d9[_0x475f0b(0x282)](_0x21f8f3[_0x475f0b(0x258)],_0x21f8f3);}const _0x230dfa=new Map();for(const _0x4fad1e of _0x1d63df){_0x230dfa['set'](_0x4fad1e[_0x475f0b(0x258)],_0x4fad1e);}for(const _0x5b6e57 of _0x1d63df){const _0x37a360=_0x4877d9['get'](_0x5b6e57['name']);if(!_0x37a360)_0x158c8d['push']({'type':_0x475f0b(0x27f),'name':_0x5b6e57['name'],'yamlActivation':_0x5b6e57});else{const _0x3b4dcc=activationResponseToDef(_0x37a360,_0x2c1322,_0x505960),_0x166183=a140_0x2af49b['stringify'](_0x3b4dcc),_0x3db876=a140_0x2af49b['stringify'](_0x5b6e57);_0x166183!==_0x3db876&&_0x158c8d['push']({'type':_0x475f0b(0x210),'name':_0x5b6e57[_0x475f0b(0x258)],'yamlActivation':_0x5b6e57,'existingActivation':_0x37a360});}}for(const _0x4c1269 of _0x31386c){!_0x230dfa[_0x475f0b(0x200)](_0x4c1269[_0x475f0b(0x258)])&&_0x158c8d[_0x475f0b(0x1fc)]({'type':_0x475f0b(0x2d9),'name':_0x4c1269[_0x475f0b(0x258)],'existingActivation':_0x4c1269});}return _0x158c8d;}function calculateYamlDiff(_0x3ea196,_0x56ab11){if(_0x56ab11){const _0x30a6d6=generateDiff(_0x56ab11,_0x3ea196),_0x4fe082=hasChanges(_0x30a6d6);return{'isNew':![],'hasChanges':_0x4fe082,'diff':_0x4fe082?formatDiffWithColors(_0x30a6d6):undefined};}const _0x1a6e22=generateDiff('',_0x3ea196);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x1a6e22)};}export function calculateSegmentDiff(_0x58b7ae,_0x360daa,_0x4bd6c9,_0x58a027,_0x5dce50){const _0x4e6c0a=segmentToYamlString(_0x58b7ae),_0x4f3141=_0x360daa?segmentToYamlString(segmentWithActivationsToYaml(_0x360daa,_0x4bd6c9,undefined,_0x58a027,_0x5dce50)):undefined;return calculateYamlDiff(_0x4e6c0a,_0x4f3141);}export function calculateJourneyDiff(_0x441ce4,_0x2f9587){const _0x373304=normalizeJourneyDef(_0x441ce4,_0x441ce4),_0x30f326=a140_0x20196f(_0x373304),_0x37c352=_0x2f9587?a140_0x20196f(normalizeJourneyDef(_0x2f9587,_0x441ce4)):undefined;return calculateYamlDiff(_0x30f326,_0x37c352);}export function findSegmentsToDelete(_0x551308,_0xa23430,_0x40c4f7,_0x35b107,_0x381896){const _0x5700c4=a140_0x2ff839,_0x2da6fe=new Set();for(const {yamlConfig:_0x252fc9,folderPath:_0x4126bb}of _0xa23430){_0x2da6fe[_0x5700c4(0x237)](_0x4126bb+':'+_0x252fc9['name']);}return _0x551308[_0x5700c4(0x2ec)](_0x493622=>{const _0x4c2e72=_0x5700c4,_0x398e1d=_0x493622[_0x4c2e72(0x299)]?_0x40c4f7[_0x4c2e72(0x2c3)](_0x493622[_0x4c2e72(0x299)][_0x4c2e72(0x24a)]())||'':'',_0x44b29e=_0x398e1d+':'+_0x493622[_0x4c2e72(0x258)];if(_0x2da6fe[_0x4c2e72(0x200)](_0x44b29e))return![];if(_0x381896)return _0x398e1d===_0x35b107||_0x398e1d[_0x4c2e72(0x27e)](_0x35b107+'/');return!![];});}export function findJourneysToDelete(_0x126f88,_0x3622e5,_0x357db9,_0x2d9461,_0x4ce486){const _0x39c615=a140_0x2ff839,_0x248924=new Set();for(const {yamlConfig:_0x14992b,folderPath:_0x338467}of _0x3622e5){_0x248924[_0x39c615(0x237)](_0x338467+':'+_0x14992b['name']);}return _0x126f88[_0x39c615(0x2ec)](_0x418b5d=>{const _0xfc5d2b=_0x39c615,_0x2439ec=_0x418b5d['folderId']?_0x357db9[_0xfc5d2b(0x2c3)](_0x418b5d['folderId'])||'':'',_0x2290f8=_0x2439ec+':'+_0x418b5d['journeyBundleName'];if(_0x248924['has'](_0x2290f8))return![];if(_0x4ce486)return _0x2439ec===_0x2d9461||_0x2439ec['startsWith'](_0x2d9461+'/');return!![];});}export function buildSegmentLookupMap(_0x3cf60f,_0x4fee0a){const _0x2fd090=a140_0x2ff839,_0x3fd2ed=new Map();for(const _0x1edd16 of _0x3cf60f){const _0x107410=_0x1edd16[_0x2fd090(0x299)]?_0x4fee0a[_0x2fd090(0x2c3)](_0x1edd16[_0x2fd090(0x299)]['toString']())||'':'',_0x52b4d7=_0x107410+':'+_0x1edd16[_0x2fd090(0x258)];_0x3fd2ed['set'](_0x52b4d7,_0x1edd16);}return _0x3fd2ed;}export function buildSegmentNameToIdMap(_0x3f6a10){const _0x1b8c97=a140_0x2ff839,_0x16a05c=new Map();for(const _0x5171c5 of _0x3f6a10){_0x16a05c[_0x1b8c97(0x282)](_0x5171c5['name'],_0x5171c5['id']);}return _0x16a05c;}export function buildJourneyBundleLookupMap(_0x39a1f8,_0x373fd5){const _0x258ee7=a140_0x2ff839,_0x13e3e3=new Map();for(const _0x328a19 of _0x39a1f8){const _0x215111=_0x328a19[_0x258ee7(0x29d)]?_0x373fd5['get'](_0x328a19[_0x258ee7(0x29d)])||'':'',_0x2c9707=_0x215111+':'+_0x328a19[_0x258ee7(0x220)];!_0x13e3e3[_0x258ee7(0x200)](_0x2c9707)&&_0x13e3e3['set'](_0x2c9707,[]),_0x13e3e3[_0x258ee7(0x2c3)](_0x2c9707)[_0x258ee7(0x1fc)](_0x328a19);}for(const _0x56d1f3 of _0x13e3e3[_0x258ee7(0x213)]()){_0x56d1f3[_0x258ee7(0x2c7)]((_0x407b08,_0x14bea7)=>(_0x407b08[_0x258ee7(0x235)]||0x0)-(_0x14bea7['versionNumber']||0x0));}return _0x13e3e3;}export function collectFoldersToCreate(_0x5d6adc,_0x155b75){const _0x29f2e8=a140_0x2ff839,_0x1e3913=new Set();for(const _0x3f29c3 of _0x5d6adc){if(!_0x3f29c3)continue;if(_0x155b75[_0x29f2e8(0x200)](_0x3f29c3))continue;const _0x206118=_0x3f29c3[_0x29f2e8(0x202)]('/');let _0x2f6472='';for(const _0x1f6568 of _0x206118){_0x2f6472=_0x2f6472?_0x2f6472+'/'+_0x1f6568:_0x1f6568,!_0x155b75[_0x29f2e8(0x200)](_0x2f6472)&&_0x1e3913[_0x29f2e8(0x237)](_0x2f6472);}}return _0x1e3913;}export function parseAndClassifyYamlFiles(_0x242ffd,_0x2dc30d,_0x45e31b){const _0x3c9271=a140_0x2ff839,_0x112d0e=[],_0x333546=[];for(const _0x5cd61a of _0x242ffd){const _0x1a3085=a140_0x20a41d['relative'](_0x2dc30d,a140_0x20a41d['dirname'](_0x5cd61a)),_0x25ae3e=_0x1a3085==='.'?'':_0x1a3085,_0x508033=readFileSync(_0x5cd61a,_0x3c9271(0x2b1)),_0x2cdbd6=a140_0x2af49b[_0x3c9271(0x2e2)](_0x508033);if(isJourneyDef(_0x2cdbd6)){const _0x2a9936=a140_0x38903d(_0x508033);_0x333546['push']({'yamlConfig':_0x2a9936,'folderPath':_0x25ae3e,'sourcePath':_0x5cd61a});}else{if(!_0x45e31b?.[_0x3c9271(0x2bb)]){const _0x574df9=parseSegmentYamlFile(_0x508033),_0xa978aa=normalizeChildSegmentYaml(_0x574df9);_0x112d0e[_0x3c9271(0x1fc)]({'yamlConfig':_0xa978aa,'folderPath':_0x25ae3e,'sourcePath':_0x5cd61a});}}}return{'segments':_0x112d0e,'journeys':_0x333546};}export function validateParsedFiles(_0x2d8f5b,_0x912a50){const _0x3eb86f=a140_0x2ff839,_0x134644=[];for(const {yamlConfig:_0x38e924,sourcePath:_0x423892}of _0x2d8f5b[_0x3eb86f(0x2e1)]){const _0x34da69=readFileSync(_0x423892,_0x3eb86f(0x2b1)),_0x19a555=a140_0x2af49b['parseDocument'](_0x34da69),_0x5c3922=validateSegmentDef(_0x38e924,{'source':_0x34da69,'document':_0x19a555},{'skipSchema':!![]});if(!_0x5c3922['valid']){const _0x369b1=a140_0x20a41d[_0x3eb86f(0x23c)](_0x912a50,_0x423892);_0x134644['push']({'filePath':_0x369b1,'source':_0x34da69,'result':_0x5c3922,'isJourney':![]});}}for(const {yamlConfig:_0xc1600a,sourcePath:_0x299cad}of _0x2d8f5b[_0x3eb86f(0x2c5)]){const _0x931037=readFileSync(_0x299cad,_0x3eb86f(0x2b1)),_0x508a04=a140_0x2af49b[_0x3eb86f(0x2de)](_0x931037),_0x3374fb=validateJourneyDef(_0xc1600a,{'source':_0x931037,'document':_0x508a04},{'skipSchema':!![]});if(!_0x3374fb['valid']){const _0x3952dc=a140_0x20a41d['relative'](_0x912a50,_0x299cad);_0x134644[_0x3eb86f(0x1fc)]({'filePath':_0x3952dc,'source':_0x931037,'result':_0x3374fb,'isJourney':!![]});}}return _0x134644;}export function formatValidationErrors(_0x4ea074){const _0x2dcd5f=a140_0x2ff839,_0x2046e6=[];for(const {filePath:_0x3ec459,source:_0x345f3b,result:_0xf47d3d,isJourney:_0x407310}of _0x4ea074){const _0x62a768=_0x407310?'journey':'segment';_0x2046e6[_0x2dcd5f(0x1fc)]('\x0a'+_0x3ec459+'\x20('+_0x62a768+_0x2dcd5f(0x22d)+_0xf47d3d[_0x2dcd5f(0x29a)][_0x2dcd5f(0x2cc)]+_0x2dcd5f(0x26e)),_0x2046e6[_0x2dcd5f(0x1fc)](formatValidationResult(_0xf47d3d,_0x345f3b,_0x3ec459));}return _0x2046e6['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x45efc4){const _0x18087b=a140_0x2ff839,_0x29c55e=new Set(),_0xc3b692=new Map(),_0x28a3cc=collectSegmentUsageCounts(_0x45efc4);if(_0x45efc4[_0x18087b(0x2e1)])for(const [_0x53bca9,_0x1bc45f]of Object[_0x18087b(0x2ea)](_0x45efc4[_0x18087b(0x2e1)])){_0x29c55e[_0x18087b(0x237)](_0x53bca9);if(_0x1bc45f[_0x18087b(0x268)]){const _0x49fae1=yamlRuleToApi(_0x1bc45f[_0x18087b(0x268)]),_0x4bc424=apiRuleToYaml(_0x49fae1);_0xc3b692[_0x18087b(0x282)](_0x53bca9,_0x4bc424);}}const _0x5a0b5f=new Map();let _0x4e5f19=0x0;for(const [_0x23f4a3,_0x5c1374]of _0xc3b692){const _0x2cf136=serializeExpandedRule(_0x5c1374,_0xc3b692),_0x2e78a=_0x5a0b5f['get'](_0x2cf136)||[];_0x2e78a['push']({'name':_0x23f4a3,'index':_0x4e5f19}),_0x5a0b5f[_0x18087b(0x282)](_0x2cf136,_0x2e78a),_0x4e5f19++;}const _0x421389=new Map();for(const [_0x5731f6,_0x5d474e]of _0x5a0b5f){const _0x1d3b76=_0x5d474e[_0x18087b(0x2d4)]()['sort']((_0x4eb3bc,_0x1524cf)=>{const _0x117b9d=_0x18087b,_0xe63f46=_0x28a3cc[_0x117b9d(0x2c3)](_0x4eb3bc['name'])||0x0,_0x51a218=_0x28a3cc['get'](_0x1524cf['name'])||0x0;if(_0xe63f46!==_0x51a218)return _0x51a218-_0xe63f46;return _0x4eb3bc['index']-_0x1524cf[_0x117b9d(0x2b3)];})[_0x18087b(0x295)](_0x2d3ffa=>_0x2d3ffa[_0x18087b(0x258)]),_0x3c5a0f=[];for(const _0x1d4b18 of _0x1d3b76){const _0x5b5f27=_0x28a3cc['get'](_0x1d4b18)||0x0,_0x4ac53d=Math[_0x18087b(0x2e8)](_0x5b5f27,0x1);for(let _0x18cb8d=0x0;_0x18cb8d<_0x4ac53d;_0x18cb8d++){_0x3c5a0f[_0x18087b(0x1fc)](_0x1d4b18);}}_0x421389[_0x18087b(0x282)](_0x5731f6,_0x3c5a0f);}return{'existingLocalSegmentNames':_0x29c55e,'localSegmentRules':_0xc3b692,'localExpandedRuleToNames':_0x421389};}export function createSegmentIdResolver(_0x504b38,_0xf1d3b5){return async _0x16616d=>{const _0x41930d=a140_0x18bd,_0x48c930=_0x504b38[_0x41930d(0x2c3)](_0x16616d);if(!_0x48c930)throw new SDKError(ErrorCode[_0x41930d(0x2a8)],_0x41930d(0x271)+_0x16616d+_0x41930d(0x252)+_0xf1d3b5+'\x27)');return _0x48c930;};}export function extractRootFolderId(_0x1774b6){const _0x167555=a140_0x2ff839;return _0x1774b6[_0x167555(0x25e)]?.[_0x167555(0x259)]?.[_0x167555(0x2b0)]?.['id']||_0x1774b6[_0x167555(0x25e)]?.[_0x167555(0x201)]?.[_0x167555(0x2b0)]?.['id'];}export function buildConnectionMaps(_0x43bec2){const _0x28aafc=a140_0x2ff839,_0x2c5816=new Map(),_0x9756c7=new Map(),_0x3191db=new Map();for(const _0x47c71e of _0x43bec2){_0x2c5816['set'](_0x47c71e[_0x28aafc(0x258)],parseInt(_0x47c71e['id'],0xa)),_0x9756c7[_0x28aafc(0x282)](_0x47c71e['id'],_0x47c71e[_0x28aafc(0x258)]),_0x3191db[_0x28aafc(0x282)](_0x47c71e[_0x28aafc(0x258)],_0x47c71e[_0x28aafc(0x2b5)]);}return{'nameToId':_0x2c5816,'idToName':_0x9756c7,'nameToType':_0x3191db};}export function calculatePushStats(_0xc8dae5,_0x1557aa,_0x23c373,_0x6ac3e9,_0x6ceb76,_0x4c1ada,_0x208f60){const _0x22e0d8=a140_0x2ff839,_0x9e0866=_0xc8dae5[_0x22e0d8(0x2ec)](_0x51051a=>_0x51051a['isNew']),_0x1d3322=_0xc8dae5[_0x22e0d8(0x2ec)](_0x12ad20=>!_0x12ad20['isNew']&&_0x12ad20[_0x22e0d8(0x24c)]),_0x2cec88=_0xc8dae5[_0x22e0d8(0x2ec)](_0xb0b4e1=>!_0xb0b4e1[_0x22e0d8(0x264)]&&!_0xb0b4e1[_0x22e0d8(0x24c)]),_0x586269=_0x4c1ada?_0x6ac3e9:[],_0xd6c3f9=_0x1557aa['filter'](_0x15884a=>_0x15884a[_0x22e0d8(0x264)]),_0x109f3c=_0x1557aa[_0x22e0d8(0x2ec)](_0x1cee2b=>!_0x1cee2b[_0x22e0d8(0x264)]&&_0x1cee2b[_0x22e0d8(0x24c)]),_0x1e2b24=_0x1557aa[_0x22e0d8(0x2ec)](_0x2813f3=>!_0x2813f3[_0x22e0d8(0x264)]&&!_0x2813f3[_0x22e0d8(0x24c)]),_0x5b54fc=_0x4c1ada?_0x6ceb76:[],_0x22c880=_0xc8dae5[_0x22e0d8(0x2d0)](_0x256628=>_0x256628[_0x22e0d8(0x26f)]),_0x3d3fae=_0x22c880[_0x22e0d8(0x2ec)](_0x525faa=>_0x525faa[_0x22e0d8(0x2b5)]===_0x22e0d8(0x27f)),_0x9903f3=_0x22c880[_0x22e0d8(0x2ec)](_0x5a55b4=>_0x5a55b4['type']==='update'),_0x3a256f=_0x22c880[_0x22e0d8(0x2ec)](_0x486d3b=>_0x486d3b[_0x22e0d8(0x2b5)]==='delete'),_0x1af9c9=Array[_0x22e0d8(0x2a7)](_0x23c373)[_0x22e0d8(0x2c7)](),_0x1e0924=_0x208f60?![]:_0x9e0866[_0x22e0d8(0x2cc)]>0x0||_0x1d3322['length']>0x0||_0x586269[_0x22e0d8(0x2cc)]>0x0,_0x2ac00f=_0xd6c3f9['length']>0x0||_0x109f3c['length']>0x0||_0x5b54fc[_0x22e0d8(0x2cc)]>0x0,_0x4b7d3c=_0x208f60?![]:_0x22c880[_0x22e0d8(0x2cc)]>0x0,_0x55a96d=_0x1af9c9['length']>0x0;return{'segments':{'new':_0x9e0866,'changed':_0x1d3322,'unchanged':_0x2cec88,'toDelete':_0x586269},'journeys':{'new':_0xd6c3f9,'changed':_0x109f3c,'unchanged':_0x1e2b24,'toDelete':_0x5b54fc},'activations':{'all':_0x22c880,'toCreate':_0x3d3fae,'toUpdate':_0x9903f3,'toDelete':_0x3a256f},'folders':{'toCreate':_0x1af9c9},'counts':{'segments':{'new':_0x9e0866[_0x22e0d8(0x2cc)],'changed':_0x1d3322[_0x22e0d8(0x2cc)],'unchanged':_0x2cec88[_0x22e0d8(0x2cc)],'toDelete':_0x586269['length']},'journeys':{'new':_0xd6c3f9[_0x22e0d8(0x2cc)],'changed':_0x109f3c['length'],'unchanged':_0x1e2b24[_0x22e0d8(0x2cc)],'toDelete':_0x5b54fc[_0x22e0d8(0x2cc)]},'activations':{'create':_0x3d3fae[_0x22e0d8(0x2cc)],'update':_0x9903f3[_0x22e0d8(0x2cc)],'delete':_0x3a256f['length']},'folders':_0x1af9c9[_0x22e0d8(0x2cc)]},'hasChanges':_0x1e0924||_0x2ac00f||_0x4b7d3c||_0x55a96d};}export async function buildPushExecutionContext(_0x521bfd,_0x1ad28d,_0x3cb99f,_0x163328,_0x74db05,_0x52e98a){const _0x23c6e7=a140_0x2ff839,_0x1bc259=extractRootFolderId(_0x3cb99f),{pathToId:_0x3674b6,idToPath:_0x666c58}=buildFolderMaps(_0x74db05),_0x155e6a=buildSegmentNameToIdMap(_0x163328),_0x387b06=new Map(),{batchAsync:_0x58903a}=await import(_0x23c6e7(0x25b)),[_0xf80bb6,_0x4ae0c5]=await Promise[_0x23c6e7(0x217)]([_0x521bfd[_0x23c6e7(0x2cd)]['buildUserMaps'](),_0x521bfd[_0x23c6e7(0x27b)][_0x23c6e7(0x269)](),((async()=>{const _0x5f5206=_0x23c6e7;!_0x52e98a&&_0x163328[_0x5f5206(0x2cc)]>0x0&&await _0x58903a(_0x163328,async _0x43bf8b=>{const _0x46e518=_0x5f5206,_0xd25559=await _0x521bfd[_0x46e518(0x1f7)][_0x46e518(0x21d)](_0x1ad28d,_0x43bf8b['id']);_0x387b06[_0x46e518(0x282)](_0x43bf8b['id'],_0xd25559);});})())]),{emailToId:_0x36e966,idToEmail:_0x15cbac}=_0xf80bb6,_0x5193a5=buildConnectionMaps(_0x4ae0c5);return{'rootFolderId':_0x1bc259,'folderPathToId':_0x3674b6,'folderIdToPath':_0x666c58,'segmentNameToId':_0x155e6a,'activationsBySegmentId':_0x387b06,'emailToIdMap':_0x36e966,'idToEmailMap':_0x15cbac,'connectionNameToIdMap':_0x5193a5[_0x23c6e7(0x270)],'connectionIdToNameMap':_0x5193a5[_0x23c6e7(0x2c6)],'connectionNameToTypeMap':_0x5193a5[_0x23c6e7(0x291)]};}export function createPushYamlContextForBundle(_0x2a5ff2,_0x2c7eaa,_0x46f7d0,_0x36f28a,_0x104d74,_0x23b6b0,_0x24b47a,_0x5a4bbe){const {existingLocalSegmentNames:_0x40dc,localExpandedRuleToNames:_0x39afe6}=_0x36f28a,_0x4c47bf=new Set(),_0x3e07b0=new Map(),_0x4c61ec=new Map(),_0x40f9fe=new Map(),_0x22d9ed=createJumpTargetCache(),_0x4afc48=new Map(),_0x44222e=new Map(),_0x1ccaf8=new Set();let _0x31bf86;const _0x30c635=_0x3ba5ef=>{const _0x2fa6af={'resolveSegment':async _0x142437=>{const _0x2f38c7=a140_0x18bd,_0x3b5e48=_0x40f9fe[_0x2f38c7(0x2c3)](_0x142437);if(_0x3b5e48!==undefined)return{'name':_0x3b5e48,'isJourneyLocal':!![]};try{const _0x39583c=await fetchSegment(_0x2a5ff2,_0x2c7eaa,_0x142437,_0x46f7d0);if(!_0x39583c)throw new Error(_0x2f38c7(0x298));const _0x597075=generateJourneyLocalName(_0x39583c[_0x2f38c7(0x258)]),_0x4f645f=_0x39583c[_0x2f38c7(0x28a)]===SEGMENT_KIND_JOURNEY&&_0x597075!==undefined;let _0x217283=_0x39583c[_0x2f38c7(0x258)],_0x5b3609;if(_0x4f645f&&_0x39583c[_0x2f38c7(0x268)]){const _0x1262e2=apiRuleToYaml(_0x39583c['rule']);_0x44222e[_0x2f38c7(0x282)](_0x142437,_0x1262e2);const _0x13c9da=async _0x206ce5=>{const _0x38038d=_0x2f38c7,_0x1717c7=collectSegmentRefsFromRule(_0x206ce5);for(const _0x438571 of _0x1717c7){if(!_0x44222e[_0x38038d(0x200)](_0x438571))try{const _0x5cf46b=await fetchSegment(_0x2a5ff2,_0x2c7eaa,_0x438571,_0x46f7d0);if(_0x5cf46b?.[_0x38038d(0x268)]){const _0xdeab5e=apiRuleToYaml(_0x5cf46b[_0x38038d(0x268)]);_0x44222e[_0x38038d(0x282)](_0x438571,_0xdeab5e),await _0x13c9da(_0xdeab5e);}}catch(_0x48c083){logger[_0x38038d(0x262)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x438571+':\x20'+_0x48c083);}}};await _0x13c9da(_0x1262e2);const _0x339b3f=serializeExpandedRule(_0x1262e2,_0x44222e),_0x56b928=_0x39afe6[_0x2f38c7(0x2c3)](_0x339b3f);if(_0x56b928&&_0x56b928[_0x2f38c7(0x2cc)]>0x0){const _0x3c5f6f=_0x3e07b0[_0x2f38c7(0x2c3)](_0x339b3f)||0x0,_0x4459cf=_0x56b928[_0x3c5f6f]||_0x56b928[_0x56b928[_0x2f38c7(0x2cc)]-0x1];_0x3e07b0[_0x2f38c7(0x282)](_0x339b3f,_0x3c5f6f+0x1),_0x217283=_0x4459cf,_0x4c47bf[_0x2f38c7(0x237)](_0x217283),_0x40f9fe[_0x2f38c7(0x282)](_0x142437,_0x217283);const _0x5499a8=await resolveRuleSegmentRefs(_0x1262e2,async _0xb223af=>{const _0x2650bf=_0x2f38c7,_0x5c26e4=_0x40f9fe['get'](_0xb223af);if(_0x5c26e4)return _0x5c26e4;const _0x3f80fc=await _0x31bf86[_0x2650bf(0x241)](_0xb223af);return _0x3f80fc[_0x2650bf(0x258)];});_0x5b3609={'description':_0x39583c['description'],'rule':_0x5499a8};}else{const _0x294204=_0x4afc48[_0x2f38c7(0x2c3)](_0x339b3f);if(_0x294204)_0x217283=_0x294204,_0x40f9fe[_0x2f38c7(0x282)](_0x142437,_0x217283);else{if(_0x597075){let _0x3e0191=_0x597075,_0x187bbd=0x2;while(_0x4c47bf[_0x2f38c7(0x200)](_0x3e0191)||_0x40dc['has'](_0x3e0191)){_0x3e0191=_0x597075+'_'+_0x187bbd,_0x187bbd++;}_0x4c47bf[_0x2f38c7(0x237)](_0x3e0191),_0x217283=_0x3e0191;}_0x40f9fe[_0x2f38c7(0x282)](_0x142437,_0x217283),_0x4afc48[_0x2f38c7(0x282)](_0x339b3f,_0x217283);const _0x3f032d=await resolveRuleSegmentRefs(_0x1262e2,async _0x19429f=>{const _0x3be116=_0x2f38c7,_0x535f40=_0x40f9fe[_0x3be116(0x2c3)](_0x19429f);if(_0x535f40)return _0x535f40;const _0x2d1fe5=await _0x31bf86[_0x3be116(0x241)](_0x19429f);return _0x2d1fe5[_0x3be116(0x258)];});_0x5b3609={'description':_0x39583c[_0x2f38c7(0x26d)],'rule':_0x3f032d};}}}return{'name':_0x217283,'isJourneyLocal':_0x4f645f,'definition':_0x5b3609};}catch(_0x29c800){return logger[_0x2f38c7(0x262)](_0x2f38c7(0x250)+_0x142437+':\x20'+_0x29c800),{'name':_0x142437,'isJourneyLocal':![]};}},'resolveActivation':async _0x582fdc=>{const _0x26d3df=a140_0x18bd,_0x4c7c77=_0x4c61ec[_0x26d3df(0x2c3)](_0x582fdc);if(_0x4c7c77!==undefined)return{'name':_0x4c7c77,'isJourneyLocal':!![]};try{let _0xb6a34a=_0x24b47a?.[_0x26d3df(0x2c3)](_0x582fdc);!_0xb6a34a&&(_0xb6a34a=await _0x2a5ff2[_0x26d3df(0x209)]['getActivation'](_0x3ba5ef,_0x582fdc));const _0x427434=_0xb6a34a[_0x26d3df(0x27c)]['activationParams']['name']||_0x582fdc,_0x5c32a6=sanitizeYamlKey(_0x427434)||'activation_'+_0x582fdc,_0x3ec0ea=_0x5c32a6;_0x4c61ec[_0x26d3df(0x282)](_0x582fdc,_0x3ec0ea);const _0x5c15c5=journeyActivationStepToYaml(_0xb6a34a,_0x104d74,_0x23b6b0);return{'name':_0x3ec0ea,'isJourneyLocal':!![],'definition':_0x5c15c5};}catch(_0x4e6e9c){return logger[_0x26d3df(0x262)](_0x26d3df(0x284)+_0x582fdc+':\x20'+_0x4e6e9c),{'name':_0x582fdc,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x59b875,_0x47fd6b)=>resolveJumpTarget(_0x59b875,_0x47fd6b,_0x22d9ed,async _0x515917=>{const _0x49890e=a140_0x18bd,_0x2d50e1=_0x5a4bbe?.[_0x49890e(0x2c3)](_0x515917);if(_0x2d50e1)return _0x2d50e1;return _0x2a5ff2[_0x49890e(0x209)]['getJourney'](_0x515917);})};return _0x31bf86=_0x2fa6af,_0x2fa6af;},_0x13b5db=async _0x4390bb=>{const _0x41322d=a140_0x18bd,{collectSegmentIdsFromJourneyApi:_0x478650}=await import(_0x41322d(0x2be)),{batchAsync:_0x14345a}=await import(_0x41322d(0x25b)),_0x2dba67=new Set();for(const _0x393e12 of _0x4390bb){let _0x2964d1=_0x5a4bbe?.['get'](_0x393e12);!_0x2964d1&&(_0x2964d1=await _0x2a5ff2[_0x41322d(0x209)]['getJourney'](_0x393e12));const _0x15be49=_0x478650(_0x2964d1);for(const _0x16af6d of _0x15be49){_0x2dba67['add'](_0x16af6d);}}let _0x22b808=Array[_0x41322d(0x2a7)](_0x2dba67);while(_0x22b808['length']>0x0){const _0x32662a=_0x22b808[_0x41322d(0x2ec)](_0xa12aea=>!_0x1ccaf8[_0x41322d(0x200)](_0xa12aea));if(_0x32662a[_0x41322d(0x2cc)]===0x0)break;const _0x280fd3=await _0x14345a(_0x32662a,async _0x3b1c88=>{const _0x118e4d=_0x41322d;_0x1ccaf8[_0x118e4d(0x237)](_0x3b1c88);const _0x4a722f=await fetchSegment(_0x2a5ff2,_0x2c7eaa,_0x3b1c88,_0x46f7d0);if(!_0x4a722f)return null;return{'segmentId':_0x3b1c88,'segment':_0x4a722f};},0xa),_0x414236=new Set();for(const _0x439eb9 of _0x280fd3){if(!_0x439eb9?.['segment']?.[_0x41322d(0x268)])continue;const _0x5bc709=apiRuleToYaml(_0x439eb9['segment'][_0x41322d(0x268)]);_0x44222e['set'](_0x439eb9[_0x41322d(0x2a2)],_0x5bc709);const _0x3e6989=collectSegmentRefsFromRule(_0x5bc709);for(const _0x277dc9 of _0x3e6989){!_0x1ccaf8[_0x41322d(0x200)](_0x277dc9)&&_0x414236[_0x41322d(0x237)](_0x277dc9);}}_0x22b808=Array[_0x41322d(0x2a7)](_0x414236);}};return{'createYamlContext':_0x30c635,'prefetchJourneySegments':_0x13b5db};}export async function executePushSegments(_0x1302c5,_0x3f4c76,_0x482a1b,_0x11ba15,_0x248117){const _0x443431=a140_0x2ff839,{segmentDefToCreateRequest:_0x5d23ac,segmentDefToUpdateRequest:_0x26cbdb}=await import(_0x443431(0x2b4)),_0x4aa145=_0x482a1b['folderPathToId'],_0x29ccba=0x5,_0x5e76b7=async _0x2c31fd=>{const _0x1c57a4=_0x443431,_0x1b0a72=_0x2c31fd['folderPath']?_0x4aa145['get'](_0x2c31fd[_0x1c57a4(0x22a)]):undefined;let _0x4613a5;const _0x4d49f3={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x3472b3=_0x2c31fd[_0x1c57a4(0x2a6)];if(_0x2c31fd['yamlConfig'][_0x1c57a4(0x268)]){const _0x5f1c65=createSegmentIdResolver(_0x482a1b[_0x1c57a4(0x2c0)],_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]),_0x34c809=await resolveRuleSegmentIds(_0x2c31fd[_0x1c57a4(0x2a6)]['rule'],_0x5f1c65);_0x3472b3={..._0x2c31fd['yamlConfig'],'rule':_0x34c809};}try{if(_0x2c31fd[_0x1c57a4(0x264)]){_0x248117['onProgress']?.({'type':_0x1c57a4(0x211),'name':_0x2c31fd[_0x1c57a4(0x2a6)]['name']});const _0x4cb535=_0x5d23ac(_0x3472b3,_0x1b0a72),_0x31cd21=await _0x248117[_0x1c57a4(0x240)](_0x1c57a4(0x2a3)+_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]+'\x27...',()=>_0x1302c5[_0x1c57a4(0x1f7)]['createSegment'](_0x11ba15['parentId'],_0x4cb535));_0x4613a5=_0x31cd21['data']['id'],_0x482a1b[_0x1c57a4(0x2c0)][_0x1c57a4(0x282)](_0x2c31fd['yamlConfig'][_0x1c57a4(0x258)],_0x4613a5),_0x4d49f3[_0x1c57a4(0x274)]={'name':_0x2c31fd['yamlConfig'][_0x1c57a4(0x258)],'id':_0x4613a5},_0x248117['onProgress']?.({'type':_0x1c57a4(0x2b7),'name':_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)],'segmentId':_0x4613a5}),_0x248117['logSuccess']?.('Created\x20segment\x20\x27'+_0x2c31fd[_0x1c57a4(0x2a6)]['name']+'\x27'),_0x4d49f3['created']=0x1;}else{if(_0x2c31fd['hasChanges']){_0x248117[_0x1c57a4(0x2e4)]?.({'type':_0x1c57a4(0x203),'name':_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]});const _0x467b4f=_0x26cbdb(_0x3472b3);_0x1b0a72!==_0x2c31fd['existingSegment']?.[_0x1c57a4(0x299)]&&(_0x467b4f[_0x1c57a4(0x299)]=_0x1b0a72?parseInt(_0x1b0a72,0xa):undefined),await _0x248117[_0x1c57a4(0x240)](_0x1c57a4(0x222)+_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]+_0x1c57a4(0x2b8),()=>_0x1302c5[_0x1c57a4(0x1f7)][_0x1c57a4(0x255)](_0x11ba15['parentId'],_0x2c31fd['existingSegment']['id'],_0x467b4f)),_0x4613a5=_0x2c31fd[_0x1c57a4(0x226)]['id'],_0x248117['onProgress']?.({'type':_0x1c57a4(0x239),'name':_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]}),_0x248117[_0x1c57a4(0x242)]?.(_0x1c57a4(0x281)+_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]+'\x27'),_0x4d49f3['updated']=0x1;}else _0x4613a5=_0x2c31fd[_0x1c57a4(0x226)]['id'];}}catch(_0x2f2fad){const _0x38e53c=isHttp400Error(_0x2f2fad),_0x49f018=_0x38e53c?ErrorCode[_0x1c57a4(0x273)]:ErrorCode[_0x1c57a4(0x287)],_0x28b3fc=getErrorMessage(_0x2f2fad);throw new SDKError(_0x49f018,'Failed\x20to\x20'+(_0x2c31fd[_0x1c57a4(0x264)]?_0x1c57a4(0x27f):_0x1c57a4(0x210))+_0x1c57a4(0x2e9)+_0x2c31fd['absolutePath']+_0x1c57a4(0x22f)+_0x28b3fc,_0x2f2fad);}try{const _0x3e3e82=await syncActivationsForSegment(_0x1302c5,_0x11ba15[_0x1c57a4(0x22c)],_0x4613a5,_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)],_0x2c31fd[_0x1c57a4(0x26f)],_0x248117,_0x2c31fd[_0x1c57a4(0x2d1)]);_0x4d49f3['activations']=_0x3e3e82;}catch(_0x18ac1b){if(_0x18ac1b instanceof SDKError)throw _0x18ac1b;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x2c31fd[_0x1c57a4(0x2a6)]['name']+_0x1c57a4(0x29f)+_0x2c31fd['absolutePath']+_0x1c57a4(0x22f)+getErrorMessage(_0x18ac1b),_0x18ac1b);}return _0x4d49f3;},_0x1ec328=await batchAsync(_0x3f4c76,_0x5e76b7,_0x29ccba),_0x388165={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x259ad7 of _0x1ec328){_0x388165[_0x443431(0x2cb)]+=_0x259ad7[_0x443431(0x2cb)],_0x388165[_0x443431(0x25c)]+=_0x259ad7[_0x443431(0x25c)],_0x259ad7[_0x443431(0x274)]&&_0x388165[_0x443431(0x23d)][_0x443431(0x282)](_0x259ad7[_0x443431(0x274)][_0x443431(0x258)],_0x259ad7[_0x443431(0x274)]['id']),_0x388165[_0x443431(0x265)]['created']+=_0x259ad7[_0x443431(0x265)]['created'],_0x388165[_0x443431(0x265)]['updated']+=_0x259ad7[_0x443431(0x265)][_0x443431(0x25c)],_0x388165[_0x443431(0x265)]['deleted']+=_0x259ad7[_0x443431(0x265)][_0x443431(0x2d5)];}return _0x388165;}async function syncActivationsForSegment(_0x1e88b0,_0x16532b,_0x225b6a,_0x3a2f38,_0x7819ac,_0x2de87d,_0x590352){const _0x239aca=a140_0x2ff839,_0x4baf77={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x37530c of _0x7819ac){try{if(_0x37530c['type']===_0x239aca(0x27f)&&_0x37530c[_0x239aca(0x232)])_0x2de87d[_0x239aca(0x2e4)]?.({'type':_0x239aca(0x2d6),'segmentName':_0x3a2f38,'activationName':_0x37530c['name']}),await _0x2de87d[_0x239aca(0x240)]('Creating\x20activation\x20\x27'+_0x37530c['name']+_0x239aca(0x2b8),()=>_0x1e88b0['segment']['createActivation'](_0x16532b,_0x225b6a,_0x37530c['validatedRequest'])),_0x2de87d[_0x239aca(0x2e4)]?.({'type':'activation_created','segmentName':_0x3a2f38,'activationName':_0x37530c[_0x239aca(0x258)]}),_0x2de87d['logSuccess']?.('Created\x20activation\x20\x27'+_0x37530c[_0x239aca(0x258)]+'\x27'),_0x4baf77[_0x239aca(0x2cb)]++;else{if(_0x37530c[_0x239aca(0x2b5)]===_0x239aca(0x210)&&_0x37530c['validatedRequest']&&_0x37530c['existingActivation'])_0x2de87d[_0x239aca(0x2e4)]?.({'type':_0x239aca(0x293),'segmentName':_0x3a2f38,'activationName':_0x37530c[_0x239aca(0x258)]}),await _0x2de87d[_0x239aca(0x240)](_0x239aca(0x2a1)+_0x37530c[_0x239aca(0x258)]+_0x239aca(0x2b8),()=>_0x1e88b0['segment'][_0x239aca(0x1f2)](_0x16532b,_0x225b6a,_0x37530c[_0x239aca(0x21e)]['id'],_0x37530c['validatedRequest'])),_0x2de87d[_0x239aca(0x2e4)]?.({'type':_0x239aca(0x2e7),'segmentName':_0x3a2f38,'activationName':_0x37530c['name']}),_0x2de87d[_0x239aca(0x242)]?.('Updated\x20activation\x20\x27'+_0x37530c[_0x239aca(0x258)]+'\x27'),_0x4baf77['updated']++;else _0x37530c[_0x239aca(0x2b5)]===_0x239aca(0x2d9)&&_0x37530c['existingActivation']&&(_0x2de87d[_0x239aca(0x2e4)]?.({'type':_0x239aca(0x2e6),'segmentName':_0x3a2f38,'activationName':_0x37530c[_0x239aca(0x258)]}),await _0x2de87d[_0x239aca(0x240)](_0x239aca(0x297)+_0x37530c[_0x239aca(0x258)]+_0x239aca(0x2b8),()=>_0x1e88b0[_0x239aca(0x1f7)][_0x239aca(0x2a9)](_0x16532b,_0x225b6a,_0x37530c[_0x239aca(0x21e)]['id'])),_0x2de87d[_0x239aca(0x2e4)]?.({'type':'activation_deleted','segmentName':_0x3a2f38,'activationName':_0x37530c[_0x239aca(0x258)]}),_0x2de87d[_0x239aca(0x206)]?.('Deleted\x20activation\x20\x27'+_0x37530c['name']+'\x27'),_0x4baf77[_0x239aca(0x2d5)]++);}}catch(_0x51d6f3){const _0x3fac8a=isHttp400Error(_0x51d6f3),_0x406b09=_0x3fac8a?ErrorCode[_0x239aca(0x285)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x3c6c4e=getErrorMessage(_0x51d6f3);throw new SDKError(_0x406b09,_0x239aca(0x24b)+_0x37530c['type']+_0x239aca(0x272)+_0x37530c[_0x239aca(0x258)]+'\x27\x20from\x20file:\x20'+_0x590352+_0x239aca(0x22f)+_0x3c6c4e,_0x51d6f3);}}return _0x4baf77;}export async function executePushFolders(_0x1b1e2d,_0x581fbb,_0x36ffb5,_0x3eceda,_0x21a36d){const _0x1ca801=a140_0x2ff839,_0x6c94f3=new Map(_0x36ffb5),_0x2c70ab=sortFoldersByDepth(_0x581fbb);for(const _0x3edf9f of _0x2c70ab){const _0x28aad1=_0x3edf9f[_0x1ca801(0x202)]('/'),_0x560b48=_0x28aad1[_0x28aad1[_0x1ca801(0x2cc)]-0x1],_0xaca571=_0x28aad1['slice'](0x0,-0x1)[_0x1ca801(0x2f0)]('/'),_0x453b26=_0x6c94f3[_0x1ca801(0x2c3)](_0xaca571);_0x21a36d[_0x1ca801(0x2e4)]?.({'type':_0x1ca801(0x25d),'folder':_0x3edf9f});const _0x1bf754={'name':_0x560b48,'parentFolderId':_0x453b26},_0x33a1e4=await _0x21a36d[_0x1ca801(0x240)](_0x1ca801(0x29e)+_0x3edf9f+_0x1ca801(0x2b8),()=>_0x1b1e2d[_0x1ca801(0x1f7)][_0x1ca801(0x2bc)](_0x3eceda[_0x1ca801(0x22c)],_0x1bf754));_0x6c94f3[_0x1ca801(0x282)](_0x3edf9f,_0x33a1e4[_0x1ca801(0x2b0)]['id']),_0x21a36d[_0x1ca801(0x2e4)]?.({'type':_0x1ca801(0x212),'folder':_0x3edf9f,'folderId':_0x33a1e4[_0x1ca801(0x2b0)]['id']}),_0x21a36d['logInfo']?.('Created\x20folder\x20\x27'+_0x3edf9f+'\x27');}return _0x6c94f3;}export async function executePushSegmentDeletions(_0xb1539b,_0x4805c5,_0x5b4d41){const _0x117d84=a140_0x2ff839;if(_0x4805c5[_0x117d84(0x2cc)]===0x0)return 0x0;const {batchAsync:_0x35f445}=await import('../../utils/async.js'),_0xe44d5f=0x5,_0x31db1d=await _0x35f445(_0x4805c5,async _0x543587=>{const _0x5c501b=_0x117d84;return _0x5b4d41[_0x5c501b(0x2e4)]?.({'type':_0x5c501b(0x2c8),'name':_0x543587['name']}),await _0xb1539b[_0x5c501b(0x1f7)][_0x5c501b(0x2e0)](_0x543587['id']),_0x5b4d41[_0x5c501b(0x2e4)]?.({'type':_0x5c501b(0x1ff),'name':_0x543587['name']}),_0x5b4d41['logDeleted']?.('Deleted\x20segment\x20\x27'+_0x543587[_0x5c501b(0x258)]+'\x27'),0x1;},_0xe44d5f);return _0x31db1d[_0x117d84(0x2d8)]((_0x4dff44,_0x422255)=>_0x4dff44+_0x422255,0x0);}export async function executePushJourneys(_0x3f7d28,_0x524855,_0x442b11,_0x10632d,_0x29e3f0){const _0x2a9ca7=a140_0x2ff839,{journeyDefToRequest:_0x345c25}=await import(_0x2a9ca7(0x2be)),{activationDefToCreateRequest:_0x4ef1ab,yamlRuleToApi:_0x2b5831,validateSegmentRule:_0x3b53c2}=await import('./child-segment-yaml.js'),_0x522054={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x1b7381=new Map(_0x442b11[_0x2a9ca7(0x2c0)]),_0x142b04=0x5;for(let _0x19718d=0x0;_0x19718d<_0x524855[_0x2a9ca7(0x2cc)];_0x19718d+=_0x142b04){const _0x22085c=_0x524855[_0x2a9ca7(0x2d4)](_0x19718d,_0x19718d+_0x142b04),_0x3fb66f=await Promise['all'](_0x22085c[_0x2a9ca7(0x295)](async _0x3530dd=>{const _0x57f808=_0x2a9ca7;if(!_0x3530dd['isNew']&&!_0x3530dd['hasChanges'])return{'action':'unchanged','name':_0x3530dd[_0x57f808(0x2a6)][_0x57f808(0x258)],'journeyId':_0x3530dd[_0x57f808(0x2ad)]?.['id']};const _0x5348fa=_0x3530dd['folderPath']?_0x442b11[_0x57f808(0x2ed)][_0x57f808(0x2c3)](_0x3530dd['folderPath']):undefined;_0x29e3f0[_0x57f808(0x2e4)]?.({'type':_0x3530dd[_0x57f808(0x264)]?'journey_creating':'journey_updating','name':_0x3530dd[_0x57f808(0x2a6)][_0x57f808(0x258)]});try{const _0x5dfb46=await executeSingleJourneyPush(_0x3f7d28,_0x3530dd,{..._0x442b11,'segmentNameToId':_0x1b7381},{'parentId':_0x10632d[_0x57f808(0x22c)],'rootFolderId':_0x10632d[_0x57f808(0x2a0)],'folderId':_0x5348fa,'verbose':_0x10632d['verbose']},_0x29e3f0,{'journeyDefToRequest':_0x345c25,'activationDefToCreateRequest':_0x4ef1ab,'yamlRuleToApi':_0x2b5831,'validateSegmentRule':_0x3b53c2});for(const [_0x7294e8,_0x404867]of _0x5dfb46[_0x57f808(0x1f9)]){_0x1b7381[_0x57f808(0x282)](_0x7294e8,_0x404867),_0x522054[_0x57f808(0x1f9)][_0x57f808(0x282)](_0x7294e8,_0x404867);}if(_0x5dfb46[_0x57f808(0x21c)]==='created')_0x29e3f0['onProgress']?.({'type':_0x57f808(0x21a),'name':_0x3530dd['yamlConfig']['name'],'journeyId':_0x5dfb46[_0x57f808(0x294)]}),_0x29e3f0[_0x57f808(0x242)]?.(_0x57f808(0x292)+_0x3530dd['yamlConfig']['name']+'\x27'),_0x522054[_0x57f808(0x2cb)]++;else _0x5dfb46[_0x57f808(0x21c)]==='updated'&&(_0x29e3f0[_0x57f808(0x2e4)]?.({'type':'journey_updated','name':_0x3530dd[_0x57f808(0x2a6)]['name']}),_0x29e3f0[_0x57f808(0x242)]?.(_0x57f808(0x2c4)+_0x3530dd['yamlConfig'][_0x57f808(0x258)]+'\x27'),_0x522054[_0x57f808(0x25c)]++);return{'action':_0x5dfb46['action'],'name':_0x3530dd['yamlConfig'][_0x57f808(0x258)],'journeyId':_0x5dfb46[_0x57f808(0x294)]};}catch(_0x3d9044){const _0x502e32=isHttp400Error(_0x3d9044),_0x4102d7=_0x502e32?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x5246ec=getErrorMessage(_0x3d9044);throw new SDKError(_0x4102d7,_0x57f808(0x24b)+(_0x3530dd[_0x57f808(0x264)]?'create':_0x57f808(0x210))+_0x57f808(0x238)+_0x3530dd[_0x57f808(0x2d1)]+_0x57f808(0x22f)+_0x5246ec,_0x3d9044);}}));_0x522054[_0x2a9ca7(0x214)]['push'](..._0x3fb66f);}return _0x522054;}async function matchExistingJourneySegments(_0x1a606f,_0x2fa3b9,_0xf79aeb,_0x93cce7,_0xea03d6){const _0x4c2fd1=a140_0x2ff839;if(!_0x2fa3b9[_0x4c2fd1(0x2ad)]||!_0x2fa3b9[_0x4c2fd1(0x2a6)]['segments'])return;const _0x56d941=new Map(),_0x7550ff=new Set();for(const _0x4ea7c7 of Object[_0x4c2fd1(0x20a)](_0x2fa3b9[_0x4c2fd1(0x2a6)][_0x4c2fd1(0x2e1)])){const _0x3c7ab4=generateDeterministicJourneySegmentName(_0x2fa3b9[_0x4c2fd1(0x2a6)][_0x4c2fd1(0x258)],_0x4ea7c7);_0x56d941[_0x4c2fd1(0x282)](_0x3c7ab4,_0x4ea7c7),_0x7550ff[_0x4c2fd1(0x237)](_0x4ea7c7);}const _0x8c3d0f=[],_0x5818b6=collectSegmentIdsFromJourneyApi(_0x2fa3b9['existingJourney']);for(const _0x5ba9d5 of _0x5818b6){const _0x32861f=await fetchSegment(_0x1a606f,_0xf79aeb,_0x5ba9d5,_0x93cce7);if(!_0x32861f?.[_0x4c2fd1(0x258)])continue;const _0x2f9a60=_0x56d941['get'](_0x32861f[_0x4c2fd1(0x258)]);_0x2f9a60?(_0xea03d6[_0x4c2fd1(0x282)](_0x2f9a60,_0x5ba9d5),_0x7550ff[_0x4c2fd1(0x2d9)](_0x2f9a60)):_0x8c3d0f['push']({'id':_0x5ba9d5,'seg':_0x32861f});}if(_0x7550ff['size']>0x0&&_0x8c3d0f[_0x4c2fd1(0x2cc)]>0x0){const {localExpandedRuleToNames:_0xdf3eac}=buildLocalExpandedRuleMappings(_0x2fa3b9['yamlConfig']),_0x74cb57=new Map();for(const {id:_0x499495,seg:_0x49eb9c}of _0x8c3d0f){if(_0x49eb9c['rule']){const _0x1a119d=apiRuleToYaml(_0x49eb9c[_0x4c2fd1(0x268)]);_0x74cb57[_0x4c2fd1(0x282)](_0x499495,_0x1a119d);}}for(const {id:_0x25f5de,seg:_0x35d142}of _0x8c3d0f){if(!_0x35d142['rule'])continue;const _0x144eff=_0x74cb57['get'](_0x25f5de);if(!_0x144eff)continue;const _0x7dad37=serializeExpandedRule(_0x144eff,_0x74cb57),_0x20d2c8=_0xdf3eac[_0x4c2fd1(0x2c3)](_0x7dad37);if(_0x20d2c8){const _0x704afe=_0x20d2c8[_0x4c2fd1(0x219)](_0x36fea6=>_0x7550ff[_0x4c2fd1(0x200)](_0x36fea6));_0x704afe&&(_0xea03d6[_0x4c2fd1(0x282)](_0x704afe,_0x25f5de),_0x7550ff['delete'](_0x704afe),logger['debug']('Matched\x20server\x20segment\x20\x27'+_0x35d142[_0x4c2fd1(0x258)]+_0x4c2fd1(0x24e)+_0x704afe+_0x4c2fd1(0x223)));}}}}async function executeSingleJourneyPush(_0x29fb29,_0x187de8,_0x4eb0f6,_0x1170c1,_0x4017f9,_0x16842c){const _0x4b3285=a140_0x2ff839,{journeyDefToRequest:_0x4d1438,activationDefToCreateRequest:_0x4e69d1,yamlRuleToApi:_0x41aed4,validateSegmentRule:_0x5e7ddb}=_0x16842c,_0x2c0385=new Map(),_0x4067c5=new Map();recoverSegmentIdsFromPushRecovery(_0x187de8,_0x2c0385,_0x4eb0f6[_0x4b3285(0x2c0)]);const _0x1002bd=new Map(),_0x3ab5ec=new Map(),_0x153ea9=new Map();let _0x1ec9f5;const _0x55477a=async()=>{const _0x51ace8=_0x4b3285;if(_0x1ec9f5)return;_0x1ec9f5=new Map();if(!_0x187de8[_0x51ace8(0x2ad)])return;const _0x585cc0=await _0x29fb29[_0x51ace8(0x209)]['listActivations'](_0x187de8['existingJourney']['id']);for(const _0x45dd59 of _0x585cc0){const _0x4f86e4=journeyActivationStepToYaml(_0x45dd59,_0x4eb0f6[_0x51ace8(0x225)],_0x4eb0f6['connectionIdToNameMap']),_0x2cd70a=activationSignature(_0x4f86e4);!_0x1ec9f5['has'](_0x2cd70a)&&_0x1ec9f5[_0x51ace8(0x282)](_0x2cd70a,_0x45dd59['id']),_0x4f86e4['name']&&_0x4067c5[_0x51ace8(0x282)](_0x4f86e4[_0x51ace8(0x258)],_0x45dd59['id']);}};await matchExistingJourneySegments(_0x29fb29,_0x187de8,_0x1170c1[_0x4b3285(0x22c)],_0x4eb0f6[_0x4b3285(0x25a)],_0x4eb0f6[_0x4b3285(0x2c0)]);const _0x28b985={'resolveSegmentId':async _0x25ee48=>{const _0x4d61a5=_0x4b3285,_0x3b632b=_0x4eb0f6[_0x4d61a5(0x2c0)]['get'](_0x25ee48);if(!_0x3b632b)throw new SDKError(ErrorCode[_0x4d61a5(0x2a8)],'Segment\x20not\x20found:\x20'+_0x25ee48+_0x4d61a5(0x2cf)+_0x187de8[_0x4d61a5(0x2a6)][_0x4d61a5(0x258)]+')');return _0x3b632b;},'resolveEmbeddedSegmentId':async(_0x4ab4bb,_0x67e185)=>{const _0x2ce020=_0x4b3285,_0x54362e=_0x4eb0f6['segmentNameToId'][_0x2ce020(0x2c3)](_0x4ab4bb);if(_0x54362e)return _0x54362e;const _0x5e2242=_0x4eb0f6['existingSegments'][_0x2ce020(0x219)](_0x45f1c1=>_0x45f1c1[_0x2ce020(0x258)]===_0x4ab4bb);if(_0x5e2242)return _0x4eb0f6[_0x2ce020(0x2c0)][_0x2ce020(0x282)](_0x4ab4bb,_0x5e2242['id']),_0x5e2242['id'];if(_0x187de8[_0x2ce020(0x264)]){const {stageName:_0xc1295d,criteriaName:_0x1603b1}=findSegmentCriteriaLocation(_0x187de8[_0x2ce020(0x2a6)],_0x4ab4bb);return _0x5e7ddb(_0x4ab4bb,_0x67e185[_0x2ce020(0x268)]),_0x3ab5ec[_0x2ce020(0x282)](_0x4ab4bb,{'definition':_0x67e185,'stageName':_0xc1295d,'criteriaName':_0x1603b1}),createPendingSegmentId(_0x4ab4bb);}const _0x26a46c=_0x187de8[_0x2ce020(0x2ad)]?.['id'];if(!_0x26a46c)throw new SDKError(ErrorCode[_0x2ce020(0x1f6)],_0x2ce020(0x267));const _0x7eecc6=_0x1002bd[_0x2ce020(0x2c3)](_0x4ab4bb);if(_0x7eecc6)return _0x7eecc6;const _0x2fa200=((async()=>{const _0x49e1e4=_0x2ce020;_0x5e7ddb(_0x4ab4bb,_0x67e185[_0x49e1e4(0x268)]);const _0x8ddff8=generateDeterministicJourneySegmentName(_0x187de8['yamlConfig'][_0x49e1e4(0x258)],_0x4ab4bb),_0x8538d0=_0x4eb0f6[_0x49e1e4(0x25a)][_0x49e1e4(0x219)](_0x5850b0=>_0x5850b0[_0x49e1e4(0x258)]===_0x8ddff8),_0x2f4c19=createSegmentIdResolver(_0x4eb0f6['segmentNameToId'],_0x4ab4bb),_0x58a31d=await resolveRuleSegmentIds(_0x67e185[_0x49e1e4(0x268)],_0x2f4c19);let _0x35df54;return _0x8538d0?(await _0x29fb29[_0x49e1e4(0x1f7)][_0x49e1e4(0x255)](_0x1170c1[_0x49e1e4(0x22c)],_0x8538d0['id'],{'description':_0x67e185[_0x49e1e4(0x26d)]||_0x49e1e4(0x21b)+_0x4ab4bb,'rule':_0x41aed4(_0x58a31d,!![]),'countPopulation':!![]}),_0x35df54=_0x8538d0['id'],saveSegmentToPushRecovery(_0x187de8[_0x49e1e4(0x2d1)],_0x187de8[_0x49e1e4(0x2a6)][_0x49e1e4(0x258)],_0x4ab4bb,{'segmentId':_0x35df54,'uniqueServerName':_0x8ddff8,'createdAt':new Date()[_0x49e1e4(0x249)]()})):_0x35df54=await createOrRecoverEmbeddedSegment(_0x29fb29,_0x187de8,{'localName':_0x4ab4bb,'uniqueSegmentName':_0x8ddff8,'description':_0x67e185[_0x49e1e4(0x26d)]||'Entry\x20criteria:\x20'+_0x4ab4bb,'journeyId':_0x26a46c,'resolvedRule':_0x58a31d,'parentId':_0x1170c1[_0x49e1e4(0x22c)],'folderId':_0x1170c1[_0x49e1e4(0x2a0)]||''},_0x41aed4),_0x4eb0f6[_0x49e1e4(0x2c0)][_0x49e1e4(0x282)](_0x4ab4bb,_0x35df54),_0x2c0385['set'](_0x4ab4bb,_0x35df54),_0x35df54;})());_0x1002bd['set'](_0x4ab4bb,_0x2fa200);try{return await _0x2fa200;}finally{_0x1002bd['delete'](_0x4ab4bb);}},'resolveActivationId':async _0x4e0afd=>{const _0x1a6ca3=_0x4b3285,_0x57cd14=_0x4067c5[_0x1a6ca3(0x2c3)](_0x4e0afd);if(_0x57cd14)return _0x57cd14;if(_0x187de8[_0x1a6ca3(0x2ad)]){await _0x55477a();const _0x4f52f1=_0x4067c5[_0x1a6ca3(0x2c3)](_0x4e0afd);if(_0x4f52f1)return _0x4f52f1;}throw new SDKError(ErrorCode['NOT_FOUND'],_0x1a6ca3(0x28c)+_0x4e0afd+_0x1a6ca3(0x2cf)+_0x187de8[_0x1a6ca3(0x2a6)][_0x1a6ca3(0x258)]+_0x1a6ca3(0x228)+_0x1a6ca3(0x278));},'resolveEmbeddedActivationId':async(_0x49a1af,_0x46ad87)=>{const _0xf7aba6=_0x4b3285,_0x21ea07=_0x4067c5[_0xf7aba6(0x2c3)](_0x49a1af);if(_0x21ea07)return _0x21ea07;if(_0x187de8['isNew'])return _0x153ea9[_0xf7aba6(0x282)](_0x49a1af,_0x46ad87),createPendingActivationId(_0x49a1af);if(_0x187de8[_0xf7aba6(0x2ad)]){await _0x55477a();const _0x5955c4=_0x4067c5[_0xf7aba6(0x2c3)](_0x46ad87[_0xf7aba6(0x258)]);if(_0x5955c4)return _0x4067c5['set'](_0x49a1af,_0x5955c4),_0x5955c4;const _0x3246a8=activationSignature(_0x46ad87),_0x51b343=_0x1ec9f5?.[_0xf7aba6(0x2c3)](_0x3246a8);if(_0x51b343)return _0x4067c5[_0xf7aba6(0x282)](_0x49a1af,_0x51b343),_0x51b343;const _0x1fc6c0=await _0x4e69d1(_0x46ad87,_0x4eb0f6[_0xf7aba6(0x243)]),_0x18a572={..._0x1fc6c0,..._0x46ad87[_0xf7aba6(0x28d)]!==undefined&&{'runAfterJourneyRefresh':_0x46ad87[_0xf7aba6(0x28d)]}},_0x525357=await _0x29fb29[_0xf7aba6(0x209)][_0xf7aba6(0x2ae)](_0x187de8['existingJourney']['id'],_0x18a572);return _0x4067c5[_0xf7aba6(0x282)](_0x49a1af,_0x525357['id']),_0x525357['id'];}throw new SDKError(ErrorCode[_0xf7aba6(0x1f6)],_0xf7aba6(0x22b));},'resolveJourneyId':async _0x13598e=>{const _0x219525=_0x4b3285;try{return await _0x29fb29['journey'][_0x219525(0x24f)](_0x1170c1[_0x219525(0x22c)],_0x13598e);}catch(_0x207672){throw new SDKError(ErrorCode[_0x219525(0x286)],_0x219525(0x2dd)+_0x13598e+_0x219525(0x2c2)+_0x187de8[_0x219525(0x2a6)][_0x219525(0x258)]+'\x27)',_0x207672);}},'resolveStageId':async(_0x453c71,_0x35f00b)=>{const _0x3b6958=_0x4b3285,_0x5b2b95=await _0x29fb29[_0x3b6958(0x209)][_0x3b6958(0x2f1)](_0x453c71),_0x2a96e1=_0x5b2b95['attributes']['journeyStages'][_0x3b6958(0x219)](_0x56ac41=>_0x56ac41[_0x3b6958(0x258)][_0x3b6958(0x2a4)]()===_0x35f00b[_0x3b6958(0x2a4)]());if(!_0x2a96e1?.['id'])throw new SDKError(ErrorCode[_0x3b6958(0x286)],_0x3b6958(0x221)+_0x35f00b+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x5b2b95['attributes']['journeyBundleName']||_0x5b2b95[_0x3b6958(0x27c)][_0x3b6958(0x258)])+'\x27');return _0x2a96e1['id'];}},_0x45a406=await _0x4d1438(_0x187de8['yamlConfig'],_0x1170c1[_0x4b3285(0x22c)],_0x28b985),_0x3abece=_0x1170c1['folderId']||_0x1170c1['rootFolderId'];_0x3abece&&(_0x45a406[_0x4b3285(0x25e)]={'parentFolder':{'data':{'id':_0x3abece,'type':_0x4b3285(0x215)}}});if(_0x187de8['isNew']){if(_0x3ab5ec['size']>0x0||_0x153ea9[_0x4b3285(0x24d)]>0x0)return await executeThreeStepJourneyCreate(_0x29fb29,_0x187de8,_0x45a406,{'pendingEmbeddedSegments':_0x3ab5ec,'pendingEmbeddedActivations':_0x153ea9,'embeddedSegmentNameToId':_0x2c0385,'journeyActivationNameToId':_0x4067c5},{..._0x1170c1,'effectiveFolderId':_0x3abece},_0x4eb0f6,_0x4017f9,_0x16842c);else{ensureJourneyDefaults(_0x45a406[_0x4b3285(0x27c)]);const _0x460c22=await _0x29fb29[_0x4b3285(0x209)]['create'](_0x45a406);return deletePushRecovery(_0x187de8[_0x4b3285(0x2d1)]),{'action':_0x4b3285(0x2cb),'journeyId':_0x460c22['id'],'embeddedSegmentNameToId':_0x2c0385};}}else{if(_0x187de8['hasChanges']&&_0x187de8['existingJourney']){_0x45a406['id']=_0x187de8[_0x4b3285(0x2ad)]['id'];const _0x18c1d0=_0x45a406['attributes'];_0x187de8[_0x4b3285(0x2ad)][_0x4b3285(0x27c)]?.[_0x4b3285(0x220)]&&(_0x18c1d0['journeyBundleName']=_0x187de8[_0x4b3285(0x2ad)][_0x4b3285(0x27c)]['journeyBundleName']);const _0x192ad1=_0x187de8[_0x4b3285(0x2ad)][_0x4b3285(0x27c)]?.[_0x4b3285(0x2b9)];return _0x192ad1&&_0x45a406['attributes'][_0x4b3285(0x2b9)]&&injectExistingStageIds(_0x45a406['attributes']['journeyStages'],_0x192ad1),ensureJourneyDefaults(_0x18c1d0),await _0x29fb29[_0x4b3285(0x209)][_0x4b3285(0x210)](_0x187de8[_0x4b3285(0x2ad)]['id'],_0x45a406),deletePushRecovery(_0x187de8[_0x4b3285(0x2d1)]),{'action':_0x4b3285(0x25c),'journeyId':_0x187de8[_0x4b3285(0x2ad)]['id'],'embeddedSegmentNameToId':_0x2c0385};}}return deletePushRecovery(_0x187de8[_0x4b3285(0x2d1)]),{'action':_0x4b3285(0x20c),'journeyId':_0x187de8[_0x4b3285(0x2ad)]?.['id'],'embeddedSegmentNameToId':_0x2c0385};}function findSegmentCriteriaLocation(_0x5a021b,_0x248668){const _0x5ca10b=a140_0x2ff839,_0x282097=_0x5a021b[_0x5ca10b(0x2df)]||_0x5a021b[_0x5ca10b(0x2c5)]?.[0x0]?.[_0x5ca10b(0x2df)]||[];let _0xf58cdd=_0x5ca10b(0x2da),_0x4ab14c=_0x248668;const _0x5eec03=_0x5a021b['goal']||_0x5a021b[_0x5ca10b(0x2c5)]?.[0x0]?.[_0x5ca10b(0x25f)];if(_0x5eec03?.[_0x5ca10b(0x1f7)]===_0x248668)return{'stageName':_0x5ca10b(0x25f),'criteriaName':_0x5eec03[_0x5ca10b(0x258)]||_0x248668};_0x5cb7eb:for(const _0x38af51 of _0x282097){if(_0x38af51[_0x5ca10b(0x218)]?.[_0x5ca10b(0x1f7)]===_0x248668){_0xf58cdd=_0x38af51[_0x5ca10b(0x258)],_0x4ab14c=_0x38af51[_0x5ca10b(0x218)][_0x5ca10b(0x258)]||_0x248668;break;}if(_0x38af51[_0x5ca10b(0x288)])for(const _0x3146f6 of _0x38af51[_0x5ca10b(0x288)]){if(_0x3146f6[_0x5ca10b(0x2b5)]===_0x5ca10b(0x28b)&&_0x3146f6[_0x5ca10b(0x1f0)]?.[_0x5ca10b(0x28e)])for(const _0x107f25 of _0x3146f6[_0x5ca10b(0x1f0)]['branches']){if(_0x107f25[_0x5ca10b(0x1f7)]===_0x248668){_0xf58cdd=_0x38af51[_0x5ca10b(0x258)],_0x4ab14c=_0x107f25[_0x5ca10b(0x258)]||_0x248668;break _0x5cb7eb;}}}}return{'stageName':_0xf58cdd,'criteriaName':_0x4ab14c};}function a140_0x33e7(){const _0x36b319=['Updating\x20segment\x20\x27','\x27\x20by\x20rule\x20content','getSegment\x20failed\x20for\x20','idToEmailMap','existingSegment','createJourneySegment',').\x20','progress','folderPath','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','parentId','):\x20','__pending_act_','\x0a\x20\x20','\x27\x20wait\x20condition','activation_template_id','validatedRequest','replace','4072Buglcg','versionNumber','journeyBundleId','add','\x20journey\x20from\x20file:\x20','segment_updated','draft','goal\x20criteria','relative','createdSegmentIds','getLatestJourneyId','object','withProgress','resolveSegment','logSuccess','activationContext','connectionIdToNameMap','waitStep','fetchJourney','logWarning','journeyName','toISOString','toString','Failed\x20to\x20','hasChanges','size','\x27\x20to\x20local\x20\x27','resolveJourneyId','Failed\x20to\x20resolve\x20segment\x20','6412360RTYnPG','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','1985641haiHaI','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','updateSegmentById','trim','milestone','name','parentSegmentFolder','existingSegments','../../utils/async.js','updated','folder_creating','relationships','goal','item','journeyActivationNameToId','debug','Name\x20has\x20already\x20been\x20taken','isNew','activations','\x27\x20entry\x20criteria','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','rule','list','7772qhlLbl','embedded_segment_creating','hex','description','\x20error(s)','activationActions','nameToId','Segment\x20not\x20found:\x20','\x20activation\x20\x27','SEGMENT_SYNTAX_ERROR','createdSegmentId','38378hRSsEM','columns','all_columns','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','effectiveFolderId','resolvedRule','connection','attributes','digest','startsWith','create','isArray','Updated\x20segment\x20\x27','set','waitStepUnit','Failed\x20to\x20resolve\x20activation\x20','ACTIVATION_SYNTAX_ERROR','NOT_FOUND','SEGMENT_UPDATE_ERROR','steps','schedule','kind','decision_point','Activation\x20not\x20found:\x20','run_after_journey_refresh','branches','Delete\x20the\x20push\x20recovery\x20file\x20(','localName','nameToType','Created\x20journey\x20\x27','activation_updating','journeyId','map','11FcwbWB','Deleting\x20activation\x20\x27','Segment\x20not\x20found','segmentFolderId','errors','diff','Duration','folderId','Creating\x20folder\x20\x27','\x27\x20from\x20file:\x20','rootFolderId','Updating\x20activation\x20\x27','segmentId','Creating\x20segment\x20\x27','toLowerCase','embedded_segment_created','yamlConfig','from','SEGMENT_NOT_FOUND','deleteActivation','\x27\x20exit\x20criteria','conditionSegmentId','journeyActivationStepId','existingJourney','createActivation','stringify','data','utf-8','conditions','index','./child-segment-yaml.js','type','1494cQTokl','segment_created','\x27...','journeyStages','1094673WXtPNl','skipSegments','createFolder','.$1.push-recovery.json','./journey-yaml.js','entryCriteria','segmentNameToId','message','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','get','Updated\x20journey\x20\x27','journeys','idToName','sort','segment_deleting','Fetching\x20','Activation','created','length','user','\x27\x20for\x20','\x20(referenced\x20in\x20journey\x20','flatMap','absolutePath','tdx.sdk.push-workflow','1313826kYCodX','slice','deleted','activation_creating','\x27\x20milestone','reduce','delete','entry','day','Condition','Journey\x20\x27','parseDocument','stages','deleteSegment','segments','parse','uniqueSegmentName','onProgress','waitStepType','activation_deleting','activation_updated','max','\x20segment\x20from\x20file:\x20','entries','exitCriterias','filter','folderPathToId','getSegmentEntity\x20also\x20failed\x20for\x20','journeyById','join','getJourney','__pending_','with','journeyBundlesByFolderAndName','updateActivation','state','some','conditionTimeoutUnit','INTERNAL','segment','WaitStep','embeddedSegmentNameToId','conditionTimeoutDuration','DecisionPoint','push','behavior','and\x20the\x20server\x20segment,\x20then\x20retry.','segment_deleted','has','parentFolder','split','segment_updating','segmentByFolderAndName','yamlActivation','logDeleted','\x27\x20decision\x20point\x20branch\x20\x27','1285JeHtjL','journey','keys','activationsBySegmentId','unchanged','getSegment','embedded_activation_created','stage\x20\x27','update','segment_creating','folder_created','values','results','folder','sha1','all','entry_criteria','find','journey_created','Entry\x20criteria:\x20','action','listActivations','existingActivation','uniqueServerName','journeyBundleName','Stage\x20\x27'];a140_0x33e7=function(){return _0x36b319;};return a140_0x33e7();}function a140_0x18bd(_0x35ca75,_0x3132a8){_0x35ca75=_0x35ca75-0x1ef;const _0x33e760=a140_0x33e7();let _0x18bddb=_0x33e760[_0x35ca75];return _0x18bddb;}async function executeThreeStepJourneyCreate(_0x476d4e,_0x1e54d8,_0x13e14b,_0x2d4daf,_0x58a490,_0x1fd86a,_0x5dc65f,_0x343295){const _0x55745e=a140_0x2ff839,{activationDefToCreateRequest:_0x348f51,yamlRuleToApi:_0x120705}=_0x343295,{pendingEmbeddedSegments:_0x120c59,pendingEmbeddedActivations:_0x2e4e2c,embeddedSegmentNameToId:_0x1a4403}=_0x2d4daf,_0x5b3d58=JSON[_0x55745e(0x2e2)](JSON[_0x55745e(0x2af)](_0x13e14b));ensureJourneyDefaults(_0x5b3d58[_0x55745e(0x27c)]),stripPendingIds(_0x5b3d58);const _0x11bf67=await _0x476d4e['journey']['create'](_0x5b3d58),_0x3a60b4=_0x11bf67['id'],_0x657a73=new Map();for(const _0x388300 of _0x11bf67[_0x55745e(0x27c)]['journeyStages']){_0x657a73[_0x55745e(0x282)](_0x388300[_0x55745e(0x258)]['toLowerCase'](),_0x388300['id']);}recoverSegmentIdsFromPushRecovery(_0x1e54d8,_0x1a4403,_0x1fd86a[_0x55745e(0x2c0)]);for(const [_0x44542d,{definition:_0x2255eb}]of _0x120c59){if(_0x1a4403[_0x55745e(0x200)](_0x44542d)){_0x5dc65f[_0x55745e(0x2e4)]?.({'type':_0x55745e(0x2a5),'journeyName':_0x1e54d8['yamlConfig'][_0x55745e(0x258)],'segmentName':_0x44542d});continue;}const _0x379b31=generateDeterministicJourneySegmentName(_0x1e54d8[_0x55745e(0x2a6)][_0x55745e(0x258)],_0x44542d);_0x5dc65f['onProgress']?.({'type':_0x55745e(0x26b),'journeyName':_0x1e54d8['yamlConfig'][_0x55745e(0x258)],'segmentName':_0x44542d});const _0x2da118=createSegmentIdResolver(_0x1fd86a['segmentNameToId'],_0x44542d),_0x4124cb=await resolveRuleSegmentIds(_0x2255eb['rule'],_0x2da118),_0x48453c=await createOrRecoverEmbeddedSegment(_0x476d4e,_0x1e54d8,{'localName':_0x44542d,'uniqueSegmentName':_0x379b31,'description':_0x2255eb[_0x55745e(0x26d)]||'Entry\x20criteria:\x20'+_0x44542d,'journeyId':_0x3a60b4,'resolvedRule':_0x4124cb,'parentId':_0x58a490[_0x55745e(0x22c)],'folderId':_0x58a490[_0x55745e(0x279)]||''},_0x120705);_0x1a4403[_0x55745e(0x282)](_0x44542d,_0x48453c),_0x1fd86a[_0x55745e(0x2c0)]['set'](_0x44542d,_0x48453c),_0x5dc65f['onProgress']?.({'type':_0x55745e(0x2a5),'journeyName':_0x1e54d8[_0x55745e(0x2a6)][_0x55745e(0x258)],'segmentName':_0x44542d});}const _0x246905=new Map();for(const [_0x4ddaad,_0x2f7629]of _0x2e4e2c){_0x5dc65f['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x1e54d8[_0x55745e(0x2a6)]['name'],'activationName':_0x4ddaad});const _0x35410a=await _0x348f51(_0x2f7629,_0x1fd86a['activationContext']),_0xf9ca08={..._0x35410a,..._0x2f7629[_0x55745e(0x28d)]!==undefined&&{'runAfterJourneyRefresh':_0x2f7629['run_after_journey_refresh']}},_0x305c77=await _0x476d4e[_0x55745e(0x209)][_0x55745e(0x2ae)](_0x3a60b4,_0xf9ca08);_0x246905[_0x55745e(0x282)](_0x4ddaad,_0x305c77['id']),_0x2d4daf[_0x55745e(0x261)]['set'](_0x4ddaad,_0x305c77['id']),_0x5dc65f['onProgress']?.({'type':_0x55745e(0x20e),'journeyName':_0x1e54d8[_0x55745e(0x2a6)][_0x55745e(0x258)],'activationName':_0x4ddaad});}const _0x5133ee=JSON['parse'](JSON[_0x55745e(0x2af)](_0x13e14b));return _0x5133ee['id']=_0x3a60b4,ensureJourneyDefaults(_0x5133ee['attributes']),resolvePendingIdsInRequest(_0x5133ee,_0x13e14b,_0x657a73,_0x1a4403,_0x246905,_0x5dc65f),await _0x476d4e['journey'][_0x55745e(0x210)](_0x3a60b4,_0x5133ee),deletePushRecovery(_0x1e54d8[_0x55745e(0x2d1)]),{'action':_0x55745e(0x2cb),'journeyId':_0x3a60b4,'embeddedSegmentNameToId':_0x1a4403};}export function stripWaitStepPendingIds(_0x11bdea){const _0x3ad9f7=a140_0x2ff839,_0x5aff03=_0x11bdea[_0x3ad9f7(0x2ab)]&&isPendingSegmentId(_0x11bdea[_0x3ad9f7(0x2ab)]),_0x306211=_0x11bdea[_0x3ad9f7(0x2b2)]?.['some'](_0x4db57b=>_0x4db57b[_0x3ad9f7(0x2a2)]&&isPendingSegmentId(_0x4db57b[_0x3ad9f7(0x2a2)]));(_0x5aff03||_0x306211)&&(_0x11bdea[_0x3ad9f7(0x2e5)]=_0x3ad9f7(0x29c),_0x11bdea[_0x3ad9f7(0x245)]=0x1,_0x11bdea['waitStepUnit']=_0x3ad9f7(0x2db),delete _0x11bdea['conditionSegmentId'],delete _0x11bdea[_0x3ad9f7(0x1fa)],delete _0x11bdea[_0x3ad9f7(0x1f5)],delete _0x11bdea[_0x3ad9f7(0x2b2)]);}export function resolveWaitStepPendingIds(_0x2775c0,_0xef77bb,_0x5c81bd,_0x6f3d84){const _0x2f2dd3=a140_0x2ff839;if(_0xef77bb[_0x2f2dd3(0x2ab)]&&isPendingSegmentId(_0xef77bb[_0x2f2dd3(0x2ab)])){const _0xb84e75=_0x5c81bd(_0xef77bb[_0x2f2dd3(0x2ab)],_0x2f2dd3(0x20f)+_0x6f3d84+'\x27\x20wait\x20condition');_0xb84e75&&(_0x2775c0['waitStepType']=_0x2f2dd3(0x2dc),_0x2775c0[_0x2f2dd3(0x2ab)]=_0xb84e75,delete _0x2775c0[_0x2f2dd3(0x245)],delete _0x2775c0[_0x2f2dd3(0x283)],_0xef77bb[_0x2f2dd3(0x1fa)]!==undefined&&(_0x2775c0[_0x2f2dd3(0x1fa)]=_0xef77bb['conditionTimeoutDuration']),_0xef77bb[_0x2f2dd3(0x1f5)]&&(_0x2775c0[_0x2f2dd3(0x1f5)]=_0xef77bb['conditionTimeoutUnit']));}if(_0xef77bb[_0x2f2dd3(0x2b2)]){const _0x2dcb75=_0xef77bb[_0x2f2dd3(0x2b2)][_0x2f2dd3(0x1f4)](_0x5742a3=>_0x5742a3['segmentId']&&isPendingSegmentId(_0x5742a3[_0x2f2dd3(0x2a2)]));if(_0x2dcb75){const _0x37ec6=_0xef77bb[_0x2f2dd3(0x2b2)][_0x2f2dd3(0x295)](_0xa2ed07=>{const _0x32e1ed=_0x2f2dd3;if(_0xa2ed07['segmentId']&&isPendingSegmentId(_0xa2ed07[_0x32e1ed(0x2a2)])){const _0x41576d=_0x5c81bd(_0xa2ed07[_0x32e1ed(0x2a2)],_0x32e1ed(0x20f)+_0x6f3d84+_0x32e1ed(0x230));return{..._0xa2ed07,'segmentId':_0x41576d||_0xa2ed07[_0x32e1ed(0x2a2)]};}return{..._0xa2ed07};});_0x2775c0[_0x2f2dd3(0x2e5)]=_0x2f2dd3(0x2dc),_0x2775c0[_0x2f2dd3(0x2b2)]=_0x37ec6,delete _0x2775c0[_0x2f2dd3(0x245)],delete _0x2775c0[_0x2f2dd3(0x283)],delete _0x2775c0[_0x2f2dd3(0x2ab)],delete _0x2775c0[_0x2f2dd3(0x1fa)],delete _0x2775c0[_0x2f2dd3(0x1f5)];}}}function stripPendingIds(_0x4f5d8a){const _0x39106c=a140_0x2ff839;_0x4f5d8a[_0x39106c(0x27c)][_0x39106c(0x25f)]?.[_0x39106c(0x2a2)]&&isPendingSegmentId(_0x4f5d8a[_0x39106c(0x27c)][_0x39106c(0x25f)][_0x39106c(0x2a2)])&&delete _0x4f5d8a[_0x39106c(0x27c)][_0x39106c(0x25f)];for(const _0x1fe6f0 of _0x4f5d8a['attributes'][_0x39106c(0x2b9)]||[]){_0x1fe6f0[_0x39106c(0x2bf)]?.[_0x39106c(0x2a2)]&&isPendingSegmentId(_0x1fe6f0[_0x39106c(0x2bf)][_0x39106c(0x2a2)])&&delete _0x1fe6f0[_0x39106c(0x2bf)];_0x1fe6f0[_0x39106c(0x257)]?.[_0x39106c(0x2a2)]&&isPendingSegmentId(_0x1fe6f0[_0x39106c(0x257)]['segmentId'])&&delete _0x1fe6f0[_0x39106c(0x257)];_0x1fe6f0[_0x39106c(0x2eb)]&&(_0x1fe6f0['exitCriterias']=_0x1fe6f0[_0x39106c(0x2eb)][_0x39106c(0x2ec)](_0x8be94c=>!_0x8be94c[_0x39106c(0x2a2)]||!isPendingSegmentId(_0x8be94c[_0x39106c(0x2a2)])));if(_0x1fe6f0[_0x39106c(0x288)])for(const _0x5d51cb of Object[_0x39106c(0x20a)](_0x1fe6f0[_0x39106c(0x288)])){const _0x155fb7=_0x1fe6f0['steps'][_0x5d51cb];_0x155fb7[_0x39106c(0x2b5)]===_0x39106c(0x2ca)&&_0x155fb7[_0x39106c(0x2ac)]&&isPendingActivationId(_0x155fb7[_0x39106c(0x2ac)])&&(_0x155fb7[_0x39106c(0x2ac)]='');if(_0x155fb7[_0x39106c(0x2b5)]===_0x39106c(0x1fb)&&_0x155fb7[_0x39106c(0x28e)])for(const _0x563b10 of _0x155fb7[_0x39106c(0x28e)]){_0x563b10[_0x39106c(0x2a2)]&&isPendingSegmentId(_0x563b10['segmentId'])&&(_0x563b10['segmentId']='');}_0x155fb7[_0x39106c(0x2b5)]===_0x39106c(0x1f8)&&stripWaitStepPendingIds(_0x155fb7);}}}function resolvePendingIdsInRequest(_0x536d67,_0x443e91,_0xda3dc2,_0x2409d2,_0x3c86d1,_0xfe8f6){const _0x1e1354=a140_0x2ff839,_0x1ef65d=(_0x2b540f,_0x5adcdb)=>{const _0x2578c7=a140_0x18bd;if(!isPendingSegmentId(_0x2b540f))return _0x2b540f;const _0x75998f=extractPendingSegmentName(_0x2b540f),_0x393c23=_0x2409d2['get'](_0x75998f);return!_0x393c23&&_0xfe8f6[_0x2578c7(0x247)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x75998f+_0x2578c7(0x2ce)+_0x5adcdb),_0x393c23;};if(_0x536d67[_0x1e1354(0x27c)]['goal']?.[_0x1e1354(0x2a2)]&&isPendingSegmentId(_0x536d67['attributes'][_0x1e1354(0x25f)]['segmentId'])){const _0x2d0d2f=_0x1ef65d(_0x536d67['attributes']['goal']['segmentId'],_0x1e1354(0x23b));_0x2d0d2f&&(_0x536d67[_0x1e1354(0x27c)][_0x1e1354(0x25f)][_0x1e1354(0x2a2)]=_0x2d0d2f);}for(const _0x29290f of _0x536d67[_0x1e1354(0x27c)]['journeyStages']||[]){const _0x504bcc=_0xda3dc2[_0x1e1354(0x2c3)](_0x29290f[_0x1e1354(0x258)]['toLowerCase']());_0x504bcc&&(_0x29290f['id']=_0x504bcc);if(_0x29290f[_0x1e1354(0x2bf)]?.['segmentId']&&isPendingSegmentId(_0x29290f[_0x1e1354(0x2bf)][_0x1e1354(0x2a2)])){const _0x1b883f=_0x1ef65d(_0x29290f['entryCriteria'][_0x1e1354(0x2a2)],_0x1e1354(0x20f)+_0x29290f[_0x1e1354(0x258)]+_0x1e1354(0x266));_0x1b883f&&(_0x29290f[_0x1e1354(0x2bf)][_0x1e1354(0x2a2)]=_0x1b883f);}if(_0x29290f[_0x1e1354(0x2eb)])for(const _0x45f7b6 of _0x29290f[_0x1e1354(0x2eb)]){if(_0x45f7b6['segmentId']&&isPendingSegmentId(_0x45f7b6[_0x1e1354(0x2a2)])){const _0x449cc7=_0x1ef65d(_0x45f7b6[_0x1e1354(0x2a2)],_0x1e1354(0x20f)+_0x29290f[_0x1e1354(0x258)]+_0x1e1354(0x2aa));_0x449cc7&&(_0x45f7b6[_0x1e1354(0x2a2)]=_0x449cc7);}}if(_0x29290f['milestone']?.[_0x1e1354(0x2a2)]&&isPendingSegmentId(_0x29290f[_0x1e1354(0x257)][_0x1e1354(0x2a2)])){const _0xa26b96=_0x1ef65d(_0x29290f[_0x1e1354(0x257)][_0x1e1354(0x2a2)],'stage\x20\x27'+_0x29290f[_0x1e1354(0x258)]+_0x1e1354(0x2d7));_0xa26b96&&(_0x29290f[_0x1e1354(0x257)][_0x1e1354(0x2a2)]=_0xa26b96);}if(_0x29290f[_0x1e1354(0x288)]){const _0x24dd10=_0x184946=>_0x443e91[_0x1e1354(0x27c)][_0x1e1354(0x2b9)]?.[_0x1e1354(0x219)](_0x3e30ff=>_0x3e30ff[_0x1e1354(0x258)][_0x1e1354(0x2a4)]()===_0x29290f[_0x1e1354(0x258)][_0x1e1354(0x2a4)]())?.[_0x1e1354(0x288)]?.[_0x184946];for(const _0x10db98 of Object[_0x1e1354(0x20a)](_0x29290f[_0x1e1354(0x288)])){const _0x44095a=_0x29290f[_0x1e1354(0x288)][_0x10db98],_0x44b933=_0x24dd10(_0x10db98);if(_0x44095a['type']===_0x1e1354(0x2ca)&&_0x44095a['journeyActivationStepId']&&(isPendingActivationId(_0x44095a[_0x1e1354(0x2ac)])||_0x44095a[_0x1e1354(0x2ac)]==='')){if(_0x44b933?.[_0x1e1354(0x2ac)]&&isPendingActivationId(_0x44b933['journeyActivationStepId'])){const _0x9539df=extractPendingActivationName(_0x44b933['journeyActivationStepId']),_0x4d8ec3=_0x3c86d1[_0x1e1354(0x2c3)](_0x9539df);_0x4d8ec3&&(_0x44095a[_0x1e1354(0x2ac)]=_0x4d8ec3);}}if(_0x44095a['type']===_0x1e1354(0x1fb)&&_0x44095a[_0x1e1354(0x28e)]&&_0x44b933?.[_0x1e1354(0x28e)])for(let _0x172fbe=0x0;_0x172fbe<_0x44095a[_0x1e1354(0x28e)][_0x1e1354(0x2cc)];_0x172fbe++){const _0x2ba5cc=_0x44095a[_0x1e1354(0x28e)][_0x172fbe],_0x16b3ca=_0x44b933['branches'][_0x172fbe];if(_0x16b3ca?.[_0x1e1354(0x2a2)]&&isPendingSegmentId(_0x16b3ca[_0x1e1354(0x2a2)])){const _0x18de84=_0x1ef65d(_0x16b3ca['segmentId'],_0x1e1354(0x20f)+_0x29290f[_0x1e1354(0x258)]+_0x1e1354(0x207)+(_0x2ba5cc[_0x1e1354(0x258)]||_0x172fbe)+'\x27');_0x18de84&&(_0x2ba5cc['segmentId']=_0x18de84);}}_0x44095a[_0x1e1354(0x2b5)]===_0x1e1354(0x1f8)&&_0x44b933?.[_0x1e1354(0x2b5)]===_0x1e1354(0x1f8)&&resolveWaitStepPendingIds(_0x44095a,_0x44b933,_0x1ef65d,_0x29290f[_0x1e1354(0x258)]);}}}}
@@ -1 +1 @@
1
- function a141_0x115a(_0x291471,_0x286d0c){_0x291471=_0x291471-0xc7;const _0x2d760a=a141_0x2d76();let _0x115a30=_0x2d760a[_0x291471];return _0x115a30;}(function(_0x332aed,_0x2bc77e){const _0x27d743=a141_0x115a,_0x1302c6=_0x332aed();while(!![]){try{const _0x46cfbe=-parseInt(_0x27d743(0xca))/0x1+parseInt(_0x27d743(0xd2))/0x2+parseInt(_0x27d743(0xd1))/0x3+parseInt(_0x27d743(0xcb))/0x4*(parseInt(_0x27d743(0xcc))/0x5)+-parseInt(_0x27d743(0xcf))/0x6+parseInt(_0x27d743(0xd4))/0x7*(parseInt(_0x27d743(0xd0))/0x8)+-parseInt(_0x27d743(0xc7))/0x9*(-parseInt(_0x27d743(0xcd))/0xa);if(_0x46cfbe===_0x2bc77e)break;else _0x1302c6['push'](_0x1302c6['shift']());}catch(_0x4ea83f){_0x1302c6['push'](_0x1302c6['shift']());}}}(a141_0x2d76,0x602e5));function a141_0x2d76(){const _0x33f8dc=['309099FzPlwW','387534rbfAfo','get','14IHHdHG','name','add','27nVqJeD','parentFolderId','set','69999JGcirV','4OOBEjO','259910enwWda','651190ywTTgS','has','4509414oFvqYk','2685544BAIcQd'];a141_0x2d76=function(){return _0x33f8dc;};return a141_0x2d76();}export function buildFolderIdToPathMap(_0x39e0d9){const _0x3b3ebd=a141_0x115a,_0xe53aa0=new Map(),_0x2a6c3=new Map();for(const _0x5498a3 of _0x39e0d9){_0x2a6c3[_0x3b3ebd(0xc9)](_0x5498a3['id'],_0x5498a3);}const _0x4ca9f9=new Set();for(const _0x4cc311 of _0x39e0d9){!_0x4cc311['parentFolderId']&&_0x4ca9f9[_0x3b3ebd(0xd6)](_0x4cc311['id']);}function _0x3392d3(_0x149587){const _0x3d7303=_0x3b3ebd;if(_0xe53aa0[_0x3d7303(0xce)](_0x149587['id']))return _0xe53aa0['get'](_0x149587['id']);if(_0x4ca9f9[_0x3d7303(0xce)](_0x149587['id']))return _0xe53aa0[_0x3d7303(0xc9)](_0x149587['id'],''),'';if(_0x149587[_0x3d7303(0xc8)]){const _0x2e67c4=_0x2a6c3[_0x3d7303(0xd3)](_0x149587[_0x3d7303(0xc8)]);if(_0x2e67c4){const _0x1d61b8=_0x3392d3(_0x2e67c4),_0x2bce2c=_0x1d61b8?_0x1d61b8+'/'+_0x149587['name']:_0x149587[_0x3d7303(0xd5)];return _0xe53aa0['set'](_0x149587['id'],_0x2bce2c),_0x2bce2c;}}const _0x36ecad=_0x149587[_0x3d7303(0xd5)];return _0xe53aa0[_0x3d7303(0xc9)](_0x149587['id'],_0x36ecad),_0x36ecad;}for(const _0x2948af of _0x39e0d9){_0x3392d3(_0x2948af);}return _0xe53aa0;}export function buildFolderPathToIdMap(_0x518f11){const _0x36f17e=a141_0x115a,_0x183cd6=new Map(),_0x30c536=new Map();for(const _0x49fd64 of _0x518f11){_0x30c536[_0x36f17e(0xc9)](_0x49fd64['id'],_0x49fd64);}const _0x32dc4b=new Set();for(const _0x295eea of _0x518f11){!_0x295eea[_0x36f17e(0xc8)]&&_0x32dc4b['add'](_0x295eea['id']);}function _0x5e8633(_0x4a65e8){const _0x4e53f1=_0x36f17e;if(_0x32dc4b[_0x4e53f1(0xce)](_0x4a65e8['id']))return'';if(_0x4a65e8[_0x4e53f1(0xc8)]){const _0x1b14fe=_0x30c536[_0x4e53f1(0xd3)](_0x4a65e8[_0x4e53f1(0xc8)]);if(_0x1b14fe){const _0x429475=_0x5e8633(_0x1b14fe);return _0x429475?_0x429475+'/'+_0x4a65e8[_0x4e53f1(0xd5)]:_0x4a65e8[_0x4e53f1(0xd5)];}}return _0x4a65e8[_0x4e53f1(0xd5)];}for(const _0x4d59f1 of _0x518f11){const _0x17ab4b=_0x5e8633(_0x4d59f1);_0x183cd6[_0x36f17e(0xc9)](_0x17ab4b,_0x4d59f1['id']);}return _0x183cd6;}export function buildFolderMaps(_0xeab6da){const _0x48fc9b=buildFolderIdToPathMap(_0xeab6da),_0x4d5867=new Map();for(const [_0x4b8c03,_0x1df6aa]of _0x48fc9b){_0x4d5867['set'](_0x1df6aa,_0x4b8c03);}return{'idToPath':_0x48fc9b,'pathToId':_0x4d5867};}export function getFolderPath(_0x1a36e8,_0x4de088){if(!_0x1a36e8)return'';return _0x4de088['get'](_0x1a36e8)??'';}
1
+ function a141_0x588f(_0x1929e2,_0x28eb3d){_0x1929e2=_0x1929e2-0xa4;const _0x557ed4=a141_0x557e();let _0x588f05=_0x557ed4[_0x1929e2];return _0x588f05;}(function(_0x35bee2,_0x1cd404){const _0x88f66=a141_0x588f,_0x36e46b=_0x35bee2();while(!![]){try{const _0x2caf94=parseInt(_0x88f66(0xa5))/0x1*(parseInt(_0x88f66(0xb0))/0x2)+parseInt(_0x88f66(0xa6))/0x3+parseInt(_0x88f66(0xaa))/0x4*(-parseInt(_0x88f66(0xb4))/0x5)+parseInt(_0x88f66(0xa4))/0x6+-parseInt(_0x88f66(0xab))/0x7*(-parseInt(_0x88f66(0xaf))/0x8)+-parseInt(_0x88f66(0xa9))/0x9*(-parseInt(_0x88f66(0xa8))/0xa)+-parseInt(_0x88f66(0xa7))/0xb;if(_0x2caf94===_0x1cd404)break;else _0x36e46b['push'](_0x36e46b['shift']());}catch(_0xf3a1b4){_0x36e46b['push'](_0x36e46b['shift']());}}}(a141_0x557e,0xe3f71));export function buildFolderIdToPathMap(_0x2158dd){const _0x273071=a141_0x588f,_0x488e8a=new Map(),_0x36a50d=new Map();for(const _0x4633d7 of _0x2158dd){_0x36a50d[_0x273071(0xb3)](_0x4633d7['id'],_0x4633d7);}const _0x5344de=new Set();for(const _0x280a09 of _0x2158dd){!_0x280a09['parentFolderId']&&_0x5344de['add'](_0x280a09['id']);}function _0x42ea5a(_0xcb75ab){const _0x14d1aa=_0x273071;if(_0x488e8a[_0x14d1aa(0xad)](_0xcb75ab['id']))return _0x488e8a[_0x14d1aa(0xb2)](_0xcb75ab['id']);if(_0x5344de[_0x14d1aa(0xad)](_0xcb75ab['id']))return _0x488e8a[_0x14d1aa(0xb3)](_0xcb75ab['id'],''),'';if(_0xcb75ab['parentFolderId']){const _0x5c86e0=_0x36a50d[_0x14d1aa(0xb2)](_0xcb75ab[_0x14d1aa(0xb1)]);if(_0x5c86e0){const _0x3abad4=_0x42ea5a(_0x5c86e0),_0x11efef=_0x3abad4?_0x3abad4+'/'+_0xcb75ab[_0x14d1aa(0xac)]:_0xcb75ab[_0x14d1aa(0xac)];return _0x488e8a[_0x14d1aa(0xb3)](_0xcb75ab['id'],_0x11efef),_0x11efef;}}const _0x419feb=_0xcb75ab['name'];return _0x488e8a[_0x14d1aa(0xb3)](_0xcb75ab['id'],_0x419feb),_0x419feb;}for(const _0x3fc309 of _0x2158dd){_0x42ea5a(_0x3fc309);}return _0x488e8a;}export function buildFolderPathToIdMap(_0x4ed30a){const _0x529d4f=a141_0x588f,_0x39ffa4=new Map(),_0x1b5319=new Map();for(const _0xac5341 of _0x4ed30a){_0x1b5319[_0x529d4f(0xb3)](_0xac5341['id'],_0xac5341);}const _0x490b9c=new Set();for(const _0x581639 of _0x4ed30a){!_0x581639[_0x529d4f(0xb1)]&&_0x490b9c[_0x529d4f(0xae)](_0x581639['id']);}function _0x55a057(_0x5e97dc){const _0x2e5fe2=_0x529d4f;if(_0x490b9c[_0x2e5fe2(0xad)](_0x5e97dc['id']))return'';if(_0x5e97dc[_0x2e5fe2(0xb1)]){const _0x1bab91=_0x1b5319[_0x2e5fe2(0xb2)](_0x5e97dc[_0x2e5fe2(0xb1)]);if(_0x1bab91){const _0x21e1e9=_0x55a057(_0x1bab91);return _0x21e1e9?_0x21e1e9+'/'+_0x5e97dc[_0x2e5fe2(0xac)]:_0x5e97dc[_0x2e5fe2(0xac)];}}return _0x5e97dc[_0x2e5fe2(0xac)];}for(const _0x41ac65 of _0x4ed30a){const _0x11f677=_0x55a057(_0x41ac65);_0x39ffa4['set'](_0x11f677,_0x41ac65['id']);}return _0x39ffa4;}export function buildFolderMaps(_0x4afc91){const _0x1f0750=buildFolderIdToPathMap(_0x4afc91),_0x20bc89=new Map();for(const [_0x222813,_0x5b95d1]of _0x1f0750){_0x20bc89['set'](_0x5b95d1,_0x222813);}return{'idToPath':_0x1f0750,'pathToId':_0x20bc89};}export function getFolderPath(_0x5c3b69,_0x11693a){const _0x29c313=a141_0x588f;if(!_0x5c3b69)return'';return _0x11693a[_0x29c313(0xb2)](_0x5c3b69)??'';}function a141_0x557e(){const _0x1345d8=['637EcKuFQ','name','has','add','50232XJAtYm','1313384madudD','parentFolderId','get','set','155lGIgFB','6212256htiSJG','2idMupY','2952813QckSMl','28766463kFbyyA','450XZDANI','119988bYklEr','123288TRqOVi'];a141_0x557e=function(){return _0x1345d8;};return a141_0x557e();}
@@ -1 +1 @@
1
- (function(_0x337604,_0x1b95d1){const _0x41123c=a142_0x58ea,_0x5613e0=_0x337604();while(!![]){try{const _0x41d6b2=parseInt(_0x41123c(0xff))/0x1*(parseInt(_0x41123c(0x117))/0x2)+-parseInt(_0x41123c(0xf7))/0x3*(-parseInt(_0x41123c(0x12a))/0x4)+-parseInt(_0x41123c(0x120))/0x5*(-parseInt(_0x41123c(0x10a))/0x6)+-parseInt(_0x41123c(0x106))/0x7+parseInt(_0x41123c(0x102))/0x8*(parseInt(_0x41123c(0x114))/0x9)+parseInt(_0x41123c(0x121))/0xa+parseInt(_0x41123c(0xfb))/0xb*(-parseInt(_0x41123c(0x108))/0xc);if(_0x41d6b2===_0x1b95d1)break;else _0x5613e0['push'](_0x5613e0['shift']());}catch(_0x5816cf){_0x5613e0['push'](_0x5613e0['shift']());}}}(a142_0x121f,0xa7ece));import a142_0x3a8e1a from'path';import{parse as a142_0x5dcc9f}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x5d1d95){const _0x13e10d=a142_0x58ea;if(!_0x5d1d95||_0x5d1d95[_0x13e10d(0x11a)]()==='')throw new Error(_0x13e10d(0x111));const _0x4471c3=_0x5d1d95[_0x13e10d(0x11a)]();if(_0x4471c3==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x5d1d95};const _0x235660=_0x4471c3[_0x13e10d(0x127)]('/')?_0x4471c3[_0x13e10d(0x104)](0x1):_0x4471c3,_0xd4768=_0x235660[_0x13e10d(0x113)]('/')[_0x13e10d(0x109)](_0x93dfb=>_0x93dfb!=='');if(_0xd4768[_0x13e10d(0x126)]===0x0)throw new Error(_0x13e10d(0x10f));const _0x53f674=_0x4471c3['startsWith']('/')||!isRelativePathSegment(_0xd4768[0x0]);for(const _0x6198b0 of _0xd4768){validatePathSegment(_0x6198b0);}return{'segments':_0xd4768,'isAbsolute':_0x53f674,'raw':_0x5d1d95};}function isRelativePathSegment(_0x1a6b04){return _0x1a6b04==='.'||_0x1a6b04==='..';}function validatePathSegment(_0x26cbdc){const _0x3d05f=a142_0x58ea;if(_0x26cbdc==='')throw new Error(_0x3d05f(0xf6));if(_0x26cbdc==='.'||_0x26cbdc==='..')return;if(/[\x00-\x1F\x7F]/[_0x3d05f(0xf9)](_0x26cbdc))throw new Error(_0x3d05f(0xfa)+_0x26cbdc);if(_0x26cbdc!==_0x26cbdc[_0x3d05f(0x11a)]()){}}export function validatePath(_0xf18e57){const _0x510023=a142_0x58ea;if(_0xf18e57[_0x510023(0x10d)][_0x510023(0x126)]===0x0&&!_0xf18e57['isAbsolute'])throw new Error(_0x510023(0x128));if(_0xf18e57[_0x510023(0x129)]){if(_0xf18e57['segments'][0x0]==='..')throw new Error(_0x510023(0xfd));let _0x3508ae=0x0;for(const _0x29f77e of _0xf18e57[_0x510023(0x10d)]){if(_0x29f77e==='..'){if(_0x3508ae===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x3508ae--;}else _0x29f77e!=='.'&&_0x3508ae++;}}}export function joinPaths(_0x455428,_0x1d54c9){const _0x5313a4=a142_0x58ea;if(!_0x455428||_0x455428==='/')return _0x1d54c9;if(!_0x1d54c9||_0x1d54c9==='.')return _0x455428;if(_0x1d54c9[_0x5313a4(0x127)]('/'))return _0x1d54c9;const _0xd64609=parsePath(_0x455428),_0xa76605=parsePath(_0x1d54c9),_0x40154a=[..._0xd64609[_0x5313a4(0x10d)]];for(const _0x40a7a7 of _0xa76605[_0x5313a4(0x10d)]){if(_0x40a7a7==='.')continue;else{if(_0x40a7a7==='..'){if(_0x40154a[_0x5313a4(0x126)]===0x0)throw new Error(_0x5313a4(0x101));_0x40154a['pop']();}else _0x40154a[_0x5313a4(0x11e)](_0x40a7a7);}}const _0x27234d=_0x40154a[_0x5313a4(0x100)]('/');return _0xd64609['raw'][_0x5313a4(0x127)]('/')?'/'+_0x27234d:_0x27234d;}export function normalizePath(_0x547a6d){const _0x2b56d4=a142_0x58ea,_0x48923e=parsePath(_0x547a6d),_0x1749be=[];for(const _0x1740d5 of _0x48923e['segments']){if(_0x1740d5==='.')continue;else{if(_0x1740d5==='..'){if(_0x1749be[_0x2b56d4(0x126)]===0x0){if(_0x48923e['isAbsolute'])throw new Error(_0x2b56d4(0x101));_0x1749be[_0x2b56d4(0x11e)]('..');}else _0x1749be[_0x1749be['length']-0x1]==='..'?_0x1749be['push']('..'):_0x1749be[_0x2b56d4(0x103)]();}else _0x1749be[_0x2b56d4(0x11e)](_0x1740d5);}}if(_0x1749be['length']===0x0)return _0x48923e[_0x2b56d4(0x129)]?'/':'.';const _0x23b99e=_0x1749be[_0x2b56d4(0x100)]('/');return _0x48923e[_0x2b56d4(0x10c)]['startsWith']('/')?'/'+_0x23b99e:_0x23b99e;}export function getParentPath(_0x35fc7c){const _0x25cf06=a142_0x58ea,_0x50dd7b=parsePath(_0x35fc7c);if(_0x50dd7b[_0x25cf06(0x10d)][_0x25cf06(0x126)]<=0x1)return'/';const _0x1306ac=_0x50dd7b[_0x25cf06(0x10d)][_0x25cf06(0x122)](0x0,-0x1)[_0x25cf06(0x100)]('/');return _0x50dd7b[_0x25cf06(0x10c)][_0x25cf06(0x127)]('/')?'/'+_0x1306ac:_0x1306ac;}export function getBaseName(_0x20f60a){const _0x2f70af=a142_0x58ea,_0x1062e5=parsePath(_0x20f60a);return _0x1062e5[_0x2f70af(0x10d)][_0x1062e5[_0x2f70af(0x10d)][_0x2f70af(0x126)]-0x1]||'';}function a142_0x58ea(_0x3e8c38,_0x75da6e){_0x3e8c38=_0x3e8c38-0xf6;const _0x121fb1=a142_0x121f();let _0x58eac8=_0x121fb1[_0x3e8c38];return _0x58eac8;}export function isChildPath(_0x171ad5,_0xf5b0f8){const _0x493444=a142_0x58ea,_0x31dd8a=parsePath(_0x171ad5),_0x16b40b=parsePath(_0xf5b0f8);if(_0x31dd8a['segments'][_0x493444(0x126)]<=_0x16b40b[_0x493444(0x10d)][_0x493444(0x126)])return![];for(let _0x341763=0x0;_0x341763<_0x16b40b['segments'][_0x493444(0x126)];_0x341763++){if(_0x31dd8a[_0x493444(0x10d)][_0x341763]!==_0x16b40b[_0x493444(0x10d)][_0x341763])return![];}return!![];}function a142_0x121f(){const _0x5e6785=['parse','Path\x20cannot\x20be\x20empty','name','split','3898881kCOgWh','resolve','exists','4702wAiAXD','.yml','readFile','trim','parent_segment','relative','No\x20tdx.json\x20found\x20for\x20file:\x20','push','.yaml','1858895bUFmFc','1404810DHgRpO','slice','File\x20not\x20found:\x20','journey','root','length','startsWith','Relative\x20path\x20cannot\x20be\x20empty','isAbsolute','3112332CegFDj','endsWith','Path\x20segment\x20cannot\x20be\x20empty','3XNtREo','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','test','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','11uJcbTq','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','replace','313uqbMVP','join','Cannot\x20navigate\x20above\x20root','8ztGssw','pop','substring','tdx.json','4775603WVrMvS','Cannot\x20split\x20empty\x20path','17533716WRlhvb','filter','12ofJLhc','segment','raw','segments','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Path\x20must\x20contain\x20at\x20least\x20one\x20segment'];a142_0x121f=function(){return _0x5e6785;};return a142_0x121f();}export function splitPath(_0x132ef7){const _0x19843d=a142_0x58ea,_0x5f5acd=parsePath(_0x132ef7);if(_0x5f5acd[_0x19843d(0x10d)][_0x19843d(0x126)]===0x0)throw new Error(_0x19843d(0x107));if(_0x5f5acd[_0x19843d(0x10d)]['length']===0x1)return{'parent':_0x5f5acd['segments'][0x0]};return{'parent':_0x5f5acd[_0x19843d(0x10d)][0x0],'child':_0x5f5acd[_0x19843d(0x10d)][_0x19843d(0x122)](0x1)['join']('/')};}export function isYamlFilePath(_0x42af76){const _0x1707dc=a142_0x58ea;return _0x42af76[_0x1707dc(0x12b)](_0x1707dc(0x118))||_0x42af76[_0x1707dc(0x12b)](_0x1707dc(0x11f));}export async function resolveYamlFilePath(_0x2636b8,_0x10f866=nodeFileSystem){const _0x589f79=a142_0x58ea,_0x3281cb=a142_0x3a8e1a[_0x589f79(0x115)](_0x2636b8);if(!await _0x10f866['exists'](_0x3281cb))throw new Error(_0x589f79(0x123)+_0x2636b8);let _0x4fbb17=a142_0x3a8e1a['dirname'](_0x3281cb),_0x4014d9=null,_0x447105=null;const _0x2f5114=a142_0x3a8e1a[_0x589f79(0x110)](_0x4fbb17)[_0x589f79(0x125)];while(_0x4fbb17!==_0x2f5114){const _0x2cca73=a142_0x3a8e1a[_0x589f79(0x100)](_0x4fbb17,_0x589f79(0x105));if(await _0x10f866[_0x589f79(0x116)](_0x2cca73)){_0x4014d9=_0x2cca73,_0x447105=_0x4fbb17;break;}_0x4fbb17=a142_0x3a8e1a['dirname'](_0x4fbb17);}if(!_0x4014d9||!_0x447105)throw new Error(_0x589f79(0x11d)+_0x2636b8+'\x0a'+_0x589f79(0x10e));const _0x548481=await _0x10f866[_0x589f79(0x119)](_0x4014d9),_0x5d8bac=JSON[_0x589f79(0x110)](_0x548481),_0x1befe3=_0x5d8bac[_0x589f79(0x11b)];if(!_0x1befe3)throw new Error(_0x589f79(0xfc));const _0x2321ca=await _0x10f866['readFile'](_0x3281cb),_0x11b43a=a142_0x5dcc9f(_0x2321ca),_0x349cde=_0x11b43a[_0x589f79(0x112)];if(!_0x349cde)throw new Error(_0x589f79(0xf8)+_0x2636b8);const _0x5a75b8=_0x11b43a['type']===_0x589f79(0x124)?_0x589f79(0x124):_0x589f79(0x10b),_0x4ae0cb=a142_0x3a8e1a[_0x589f79(0x11c)](_0x447105,_0x3281cb),_0x381b60=a142_0x3a8e1a['dirname'](_0x4ae0cb),_0x51c953=_0x381b60==='.'?'':_0x381b60[_0x589f79(0xfe)](/\\/g,'/'),_0x4b81ec=_0x51c953?_0x1befe3+'/'+_0x51c953+'/'+_0x349cde:_0x1befe3+'/'+_0x349cde;return{'parentSegment':_0x1befe3,'segmentName':_0x349cde,'folderPath':_0x51c953,'fullPath':_0x4b81ec,'resourceType':_0x5a75b8,'content':_0x2321ca};}
1
+ (function(_0x4a4fd4,_0x1e447f){const _0x308858=a142_0x5f54,_0x52bdeb=_0x4a4fd4();while(!![]){try{const _0x16e7a6=parseInt(_0x308858(0x1b3))/0x1*(-parseInt(_0x308858(0x186))/0x2)+parseInt(_0x308858(0x18c))/0x3+-parseInt(_0x308858(0x198))/0x4+-parseInt(_0x308858(0x1af))/0x5*(-parseInt(_0x308858(0x1a9))/0x6)+-parseInt(_0x308858(0x1a1))/0x7+parseInt(_0x308858(0x1b0))/0x8*(-parseInt(_0x308858(0x188))/0x9)+parseInt(_0x308858(0x1ae))/0xa;if(_0x16e7a6===_0x1e447f)break;else _0x52bdeb['push'](_0x52bdeb['shift']());}catch(_0x49ab94){_0x52bdeb['push'](_0x52bdeb['shift']());}}}(a142_0x18af,0xa2607));import a142_0x31116e from'path';import{parse as a142_0x377afe}from'yaml';function a142_0x18af(){const _0x1b959a=['Path\x20cannot\x20be\x20empty','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','relative','raw','trim','exists','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','dirname','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','1586584WxzeKr','startsWith','Path\x20attempts\x20to\x20navigate\x20above\x20root','type','parse','endsWith','root','.yml','segments','2819432wNtPUH','push','filter','Path\x20segment\x20cannot\x20be\x20empty','pop','length','isAbsolute','Cannot\x20navigate\x20above\x20root','354qDuujN','No\x20tdx.json\x20found\x20for\x20file:\x20','substring','resolve','tdx.json','18449180cmPImw','66985AgOXAj','9521896WxgEmt','replace','Relative\x20path\x20cannot\x20be\x20empty','565JOGJsZ','join','4422NdTzGB','journey','9hrHowz','readFile','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','segment','3805884oRIiDZ','test'];a142_0x18af=function(){return _0x1b959a;};return a142_0x18af();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x406fce){const _0xb0cf7d=a142_0x5f54;if(!_0x406fce||_0x406fce[_0xb0cf7d(0x192)]()==='')throw new Error(_0xb0cf7d(0x18e));const _0x21b7e8=_0x406fce[_0xb0cf7d(0x192)]();if(_0x21b7e8==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x406fce};const _0x3a0bde=_0x21b7e8[_0xb0cf7d(0x199)]('/')?_0x21b7e8[_0xb0cf7d(0x1ab)](0x1):_0x21b7e8,_0x3eb03d=_0x3a0bde['split']('/')[_0xb0cf7d(0x1a3)](_0x4461a1=>_0x4461a1!=='');if(_0x3eb03d['length']===0x0)throw new Error(_0xb0cf7d(0x196));const _0x28e811=_0x21b7e8[_0xb0cf7d(0x199)]('/')||!isRelativePathSegment(_0x3eb03d[0x0]);for(const _0x271455 of _0x3eb03d){validatePathSegment(_0x271455);}return{'segments':_0x3eb03d,'isAbsolute':_0x28e811,'raw':_0x406fce};}function isRelativePathSegment(_0x36dc63){return _0x36dc63==='.'||_0x36dc63==='..';}function validatePathSegment(_0x2ad352){const _0x12215a=a142_0x5f54;if(_0x2ad352==='')throw new Error(_0x12215a(0x1a4));if(_0x2ad352==='.'||_0x2ad352==='..')return;if(/[\x00-\x1F\x7F]/[_0x12215a(0x18d)](_0x2ad352))throw new Error(_0x12215a(0x194)+_0x2ad352);if(_0x2ad352!==_0x2ad352[_0x12215a(0x192)]()){}}export function validatePath(_0x39bfcd){const _0x1b44c4=a142_0x5f54;if(_0x39bfcd['segments'][_0x1b44c4(0x1a6)]===0x0&&!_0x39bfcd['isAbsolute'])throw new Error(_0x1b44c4(0x1b2));if(_0x39bfcd['isAbsolute']){if(_0x39bfcd[_0x1b44c4(0x1a0)][0x0]==='..')throw new Error(_0x1b44c4(0x18f));let _0x4d09f0=0x0;for(const _0x3f61aa of _0x39bfcd['segments']){if(_0x3f61aa==='..'){if(_0x4d09f0===0x0)throw new Error(_0x1b44c4(0x19a));_0x4d09f0--;}else _0x3f61aa!=='.'&&_0x4d09f0++;}}}export function joinPaths(_0x22d923,_0x118a22){const _0x4b63c3=a142_0x5f54;if(!_0x22d923||_0x22d923==='/')return _0x118a22;if(!_0x118a22||_0x118a22==='.')return _0x22d923;if(_0x118a22[_0x4b63c3(0x199)]('/'))return _0x118a22;const _0x2a7c9e=parsePath(_0x22d923),_0x4f9d2b=parsePath(_0x118a22),_0xea350=[..._0x2a7c9e[_0x4b63c3(0x1a0)]];for(const _0x2b98d0 of _0x4f9d2b[_0x4b63c3(0x1a0)]){if(_0x2b98d0==='.')continue;else{if(_0x2b98d0==='..'){if(_0xea350[_0x4b63c3(0x1a6)]===0x0)throw new Error(_0x4b63c3(0x1a8));_0xea350[_0x4b63c3(0x1a5)]();}else _0xea350[_0x4b63c3(0x1a2)](_0x2b98d0);}}const _0x303f50=_0xea350[_0x4b63c3(0x1b4)]('/');return _0x2a7c9e[_0x4b63c3(0x191)][_0x4b63c3(0x199)]('/')?'/'+_0x303f50:_0x303f50;}export function normalizePath(_0x28acd6){const _0x21ab8c=a142_0x5f54,_0x58a275=parsePath(_0x28acd6),_0x4dca1e=[];for(const _0x5c138e of _0x58a275['segments']){if(_0x5c138e==='.')continue;else{if(_0x5c138e==='..'){if(_0x4dca1e[_0x21ab8c(0x1a6)]===0x0){if(_0x58a275['isAbsolute'])throw new Error(_0x21ab8c(0x1a8));_0x4dca1e[_0x21ab8c(0x1a2)]('..');}else _0x4dca1e[_0x4dca1e[_0x21ab8c(0x1a6)]-0x1]==='..'?_0x4dca1e[_0x21ab8c(0x1a2)]('..'):_0x4dca1e['pop']();}else _0x4dca1e['push'](_0x5c138e);}}if(_0x4dca1e['length']===0x0)return _0x58a275[_0x21ab8c(0x1a7)]?'/':'.';const _0x24fc62=_0x4dca1e[_0x21ab8c(0x1b4)]('/');return _0x58a275[_0x21ab8c(0x191)][_0x21ab8c(0x199)]('/')?'/'+_0x24fc62:_0x24fc62;}export function getParentPath(_0x47a688){const _0x4c947f=a142_0x5f54,_0x411804=parsePath(_0x47a688);if(_0x411804[_0x4c947f(0x1a0)][_0x4c947f(0x1a6)]<=0x1)return'/';const _0x4b0fd2=_0x411804[_0x4c947f(0x1a0)]['slice'](0x0,-0x1)[_0x4c947f(0x1b4)]('/');return _0x411804[_0x4c947f(0x191)]['startsWith']('/')?'/'+_0x4b0fd2:_0x4b0fd2;}export function getBaseName(_0x51b116){const _0x4e8b99=a142_0x5f54,_0x1a9a01=parsePath(_0x51b116);return _0x1a9a01[_0x4e8b99(0x1a0)][_0x1a9a01[_0x4e8b99(0x1a0)][_0x4e8b99(0x1a6)]-0x1]||'';}export function isChildPath(_0x19db36,_0x3af44a){const _0x5e08df=a142_0x5f54,_0x1f6973=parsePath(_0x19db36),_0x2df254=parsePath(_0x3af44a);if(_0x1f6973[_0x5e08df(0x1a0)]['length']<=_0x2df254[_0x5e08df(0x1a0)][_0x5e08df(0x1a6)])return![];for(let _0x350d68=0x0;_0x350d68<_0x2df254[_0x5e08df(0x1a0)][_0x5e08df(0x1a6)];_0x350d68++){if(_0x1f6973[_0x5e08df(0x1a0)][_0x350d68]!==_0x2df254[_0x5e08df(0x1a0)][_0x350d68])return![];}return!![];}export function splitPath(_0x4da941){const _0x379e04=a142_0x5f54,_0x202749=parsePath(_0x4da941);if(_0x202749[_0x379e04(0x1a0)]['length']===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x202749[_0x379e04(0x1a0)][_0x379e04(0x1a6)]===0x1)return{'parent':_0x202749[_0x379e04(0x1a0)][0x0]};return{'parent':_0x202749[_0x379e04(0x1a0)][0x0],'child':_0x202749['segments']['slice'](0x1)[_0x379e04(0x1b4)]('/')};}export function isYamlFilePath(_0x44e08f){const _0x330b99=a142_0x5f54;return _0x44e08f['endsWith'](_0x330b99(0x19f))||_0x44e08f[_0x330b99(0x19d)]('.yaml');}function a142_0x5f54(_0xaacfa4,_0x2964d7){_0xaacfa4=_0xaacfa4-0x186;const _0x18afd8=a142_0x18af();let _0x5f54c4=_0x18afd8[_0xaacfa4];return _0x5f54c4;}export async function resolveYamlFilePath(_0x2609f7,_0x181348=nodeFileSystem){const _0x1a8baf=a142_0x5f54,_0x259e8f=a142_0x31116e[_0x1a8baf(0x1ac)](_0x2609f7);if(!await _0x181348[_0x1a8baf(0x193)](_0x259e8f))throw new Error('File\x20not\x20found:\x20'+_0x2609f7);let _0x3ad21e=a142_0x31116e[_0x1a8baf(0x195)](_0x259e8f),_0x2d8328=null,_0x37807c=null;const _0x4a7075=a142_0x31116e[_0x1a8baf(0x19c)](_0x3ad21e)[_0x1a8baf(0x19e)];while(_0x3ad21e!==_0x4a7075){const _0xb4b8=a142_0x31116e[_0x1a8baf(0x1b4)](_0x3ad21e,_0x1a8baf(0x1ad));if(await _0x181348[_0x1a8baf(0x193)](_0xb4b8)){_0x2d8328=_0xb4b8,_0x37807c=_0x3ad21e;break;}_0x3ad21e=a142_0x31116e[_0x1a8baf(0x195)](_0x3ad21e);}if(!_0x2d8328||!_0x37807c)throw new Error(_0x1a8baf(0x1aa)+_0x2609f7+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x2d9bcd=await _0x181348[_0x1a8baf(0x189)](_0x2d8328),_0x49b25e=JSON['parse'](_0x2d9bcd),_0x3f8bdd=_0x49b25e['parent_segment'];if(!_0x3f8bdd)throw new Error(_0x1a8baf(0x18a));const _0x221c2c=await _0x181348['readFile'](_0x259e8f),_0x369d04=a142_0x377afe(_0x221c2c),_0x2d7f1b=_0x369d04['name'];if(!_0x2d7f1b)throw new Error(_0x1a8baf(0x197)+_0x2609f7);const _0xc7e71=_0x369d04[_0x1a8baf(0x19b)]===_0x1a8baf(0x187)?_0x1a8baf(0x187):_0x1a8baf(0x18b),_0x59e2a2=a142_0x31116e[_0x1a8baf(0x190)](_0x37807c,_0x259e8f),_0x50a5d3=a142_0x31116e[_0x1a8baf(0x195)](_0x59e2a2),_0x3ba983=_0x50a5d3==='.'?'':_0x50a5d3[_0x1a8baf(0x1b1)](/\\/g,'/'),_0x1a67cd=_0x3ba983?_0x3f8bdd+'/'+_0x3ba983+'/'+_0x2d7f1b:_0x3f8bdd+'/'+_0x2d7f1b;return{'parentSegment':_0x3f8bdd,'segmentName':_0x2d7f1b,'folderPath':_0x3ba983,'fullPath':_0x1a67cd,'resourceType':_0xc7e71,'content':_0x221c2c};}
@@ -1 +1 @@
1
- function a143_0x391a(_0x538017,_0x1ce31d){_0x538017=_0x538017-0x1b1;const _0x344d2b=a143_0x344d();let _0x391afa=_0x344d2b[_0x538017];return _0x391afa;}(function(_0x14d79a,_0x17e28d){const _0x1798f7=a143_0x391a,_0x5e8a71=_0x14d79a();while(!![]){try{const _0x7553ac=parseInt(_0x1798f7(0x1b3))/0x1*(parseInt(_0x1798f7(0x1b1))/0x2)+parseInt(_0x1798f7(0x1be))/0x3*(parseInt(_0x1798f7(0x1bc))/0x4)+parseInt(_0x1798f7(0x1b4))/0x5+-parseInt(_0x1798f7(0x1b7))/0x6+parseInt(_0x1798f7(0x1bb))/0x7*(parseInt(_0x1798f7(0x1ba))/0x8)+-parseInt(_0x1798f7(0x1b2))/0x9*(parseInt(_0x1798f7(0x1bd))/0xa)+-parseInt(_0x1798f7(0x1bf))/0xb;if(_0x7553ac===_0x17e28d)break;else _0x5e8a71['push'](_0x5e8a71['shift']());}catch(_0x51d3f1){_0x5e8a71['push'](_0x5e8a71['shift']());}}}(a143_0x344d,0x87eba));function a143_0x344d(){const _0x12bbac=['6GBRKMz','1911118KEhmuj','73214UCIbQo','25218WLWySd','11BIBUpA','1494160rDXAyC','.\x20Parent\x20name\x20cannot\x20be\x20empty','Invalid\x20segment\x20reference\x20format:\x20','3631812ppkwVc','indexOf','substring','11912gdcTCj','2569ZfcZgr','898512VzIxBI','1290exAMxS'];a143_0x344d=function(){return _0x12bbac;};return a143_0x344d();}export function parseSegmentRef(_0x2a9a71){const _0x2eae9e=a143_0x391a,_0x94193e=_0x2a9a71[_0x2eae9e(0x1b8)]('/');if(_0x94193e===-0x1)return{'parentId':_0x2a9a71};if(_0x94193e===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x2a9a71+_0x2eae9e(0x1b5));const _0x265027=_0x2a9a71[_0x2eae9e(0x1b9)](0x0,_0x94193e),_0x5b0587=_0x2a9a71[_0x2eae9e(0x1b9)](_0x94193e+0x1);if(_0x5b0587==='')throw new Error(_0x2eae9e(0x1b6)+_0x2a9a71+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x265027,'childId':_0x5b0587};}
1
+ (function(_0x2388bb,_0x3a255a){const _0x436671=a143_0x158d,_0x6f45e7=_0x2388bb();while(!![]){try{const _0x5b1cec=parseInt(_0x436671(0x1eb))/0x1+-parseInt(_0x436671(0x1e9))/0x2+-parseInt(_0x436671(0x1ea))/0x3+-parseInt(_0x436671(0x1ec))/0x4+-parseInt(_0x436671(0x1e5))/0x5*(-parseInt(_0x436671(0x1e8))/0x6)+parseInt(_0x436671(0x1f0))/0x7*(-parseInt(_0x436671(0x1ef))/0x8)+-parseInt(_0x436671(0x1ed))/0x9*(-parseInt(_0x436671(0x1f1))/0xa);if(_0x5b1cec===_0x3a255a)break;else _0x6f45e7['push'](_0x6f45e7['shift']());}catch(_0x5bb85a){_0x6f45e7['push'](_0x6f45e7['shift']());}}}(a143_0x565b,0xe1241));function a143_0x565b(){const _0x2ef3fe=['.\x20Child\x20name\x20cannot\x20be\x20empty','indexOf','6NlRLLH','2195074OMmXWJ','1582434MVngcd','414311mWQIxg','1621504PTLGnz','11825586itBAuw','.\x20Parent\x20name\x20cannot\x20be\x20empty','12774064PRdBBs','7KTZqie','20hhpGQQ','Invalid\x20segment\x20reference\x20format:\x20','7535535xuKRuY'];a143_0x565b=function(){return _0x2ef3fe;};return a143_0x565b();}function a143_0x158d(_0x198890,_0x900996){_0x198890=_0x198890-0x1e4;const _0x565b0a=a143_0x565b();let _0x158d6a=_0x565b0a[_0x198890];return _0x158d6a;}export function parseSegmentRef(_0x4ad8df){const _0x1682a4=a143_0x158d,_0x4c067f=_0x4ad8df[_0x1682a4(0x1e7)]('/');if(_0x4c067f===-0x1)return{'parentId':_0x4ad8df};if(_0x4c067f===0x0)throw new Error(_0x1682a4(0x1e4)+_0x4ad8df+_0x1682a4(0x1ee));const _0x505e19=_0x4ad8df['substring'](0x0,_0x4c067f),_0x3aa5ad=_0x4ad8df['substring'](_0x4c067f+0x1);if(_0x3aa5ad==='')throw new Error(_0x1682a4(0x1e4)+_0x4ad8df+_0x1682a4(0x1e6));return{'parentId':_0x505e19,'childId':_0x3aa5ad};}