@treasuredata/tdx 2026.3.5 → 2026.3.7

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 (231) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.d.ts.map +1 -1
  12. package/dist/commands/auth-command.js +1 -1
  13. package/dist/commands/auth-command.js.map +1 -1
  14. package/dist/commands/auth-login-command.d.ts +29 -0
  15. package/dist/commands/auth-login-command.d.ts.map +1 -0
  16. package/dist/commands/auth-login-command.js +1 -0
  17. package/dist/commands/auth-login-command.js.map +1 -0
  18. package/dist/commands/chat-command.js +1 -1
  19. package/dist/commands/claude-command.js +1 -1
  20. package/dist/commands/claude-statusline-command.js +1 -1
  21. package/dist/commands/claude-usage-command.js +1 -1
  22. package/dist/commands/command.js +1 -1
  23. package/dist/commands/connection-command.js +1 -1
  24. package/dist/commands/databases.js +1 -1
  25. package/dist/commands/delivery-command.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-campaign-pull-command.js +1 -1
  28. package/dist/commands/engage-campaign-push-command.js +1 -1
  29. package/dist/commands/engage-campaign-validate-command.js +1 -1
  30. package/dist/commands/engage-command.js +1 -1
  31. package/dist/commands/engage-template-pull-command.js +1 -1
  32. package/dist/commands/engage-template-push-command.js +1 -1
  33. package/dist/commands/engage-template-validate-command.js +1 -1
  34. package/dist/commands/job-command.js +1 -1
  35. package/dist/commands/journey-command.js +1 -1
  36. package/dist/commands/journey-validate-command.js +1 -1
  37. package/dist/commands/llm-command.js +1 -1
  38. package/dist/commands/mcp-command.d.ts.map +1 -1
  39. package/dist/commands/mcp-command.js +1 -1
  40. package/dist/commands/mcp-command.js.map +1 -1
  41. package/dist/commands/parent-segment-command.js +1 -1
  42. package/dist/commands/profile-command.d.ts.map +1 -1
  43. package/dist/commands/profile-command.js +1 -1
  44. package/dist/commands/profile-command.js.map +1 -1
  45. package/dist/commands/profiles-command.js +1 -1
  46. package/dist/commands/query-command.js +1 -1
  47. package/dist/commands/schedule-command.js +1 -1
  48. package/dist/commands/segment-command.js +1 -1
  49. package/dist/commands/segment-create-command.js +1 -1
  50. package/dist/commands/segment-fields-command.js +1 -1
  51. package/dist/commands/segment-pull-command.js +1 -1
  52. package/dist/commands/segment-push-command.js +1 -1
  53. package/dist/commands/segment-update-command.js +1 -1
  54. package/dist/commands/segment-use-command.js +1 -1
  55. package/dist/commands/segment-validate-command.js +1 -1
  56. package/dist/commands/segments.js +1 -1
  57. package/dist/commands/show.js +1 -1
  58. package/dist/commands/status-command.d.ts.map +1 -1
  59. package/dist/commands/status-command.js +1 -1
  60. package/dist/commands/status-command.js.map +1 -1
  61. package/dist/commands/tables.js +1 -1
  62. package/dist/commands/unset-command.js +1 -1
  63. package/dist/commands/upgrade-command.js +1 -1
  64. package/dist/commands/use-command.js +1 -1
  65. package/dist/commands/user-command.js +1 -1
  66. package/dist/commands/workflow-command.js +1 -1
  67. package/dist/core/auth.js +1 -1
  68. package/dist/core/command-output.js +1 -1
  69. package/dist/core/config.js +1 -1
  70. package/dist/core/connection-cache.js +1 -1
  71. package/dist/core/constants.d.ts +11 -0
  72. package/dist/core/constants.d.ts.map +1 -1
  73. package/dist/core/constants.js +1 -1
  74. package/dist/core/constants.js.map +1 -1
  75. package/dist/core/credential-cache.js +1 -1
  76. package/dist/core/global-context.d.ts.map +1 -1
  77. package/dist/core/global-context.js +1 -1
  78. package/dist/core/global-context.js.map +1 -1
  79. package/dist/core/keychain.js +1 -1
  80. package/dist/core/oauth-keychain.d.ts +32 -0
  81. package/dist/core/oauth-keychain.d.ts.map +1 -0
  82. package/dist/core/oauth-keychain.js +1 -0
  83. package/dist/core/oauth-keychain.js.map +1 -0
  84. package/dist/core/oauth.d.ts +112 -0
  85. package/dist/core/oauth.d.ts.map +1 -0
  86. package/dist/core/oauth.js +1 -0
  87. package/dist/core/oauth.js.map +1 -0
  88. package/dist/core/profile.js +1 -1
  89. package/dist/core/project-config.js +1 -1
  90. package/dist/core/session.js +1 -1
  91. package/dist/core/user-cache.js +1 -1
  92. package/dist/core/version.js +1 -1
  93. package/dist/index.js +1 -1
  94. package/dist/mcp/server.js +1 -1
  95. package/dist/mcp/tools/index.js +1 -1
  96. package/dist/mcp/tools/tdx-run.js +1 -1
  97. package/dist/mcp/tools/tdx-search.js +1 -1
  98. package/dist/mcp/utils.js +1 -1
  99. package/dist/proxy/claude-usage-tracker.js +1 -1
  100. package/dist/proxy/passthrough-server.js +1 -1
  101. package/dist/proxy/sse-usage-parser.js +1 -1
  102. package/dist/sdk/agent/agent-config.js +1 -1
  103. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  104. package/dist/sdk/agent/agent-yaml.js +1 -1
  105. package/dist/sdk/agent/test/evaluator.js +1 -1
  106. package/dist/sdk/agent/test/executor.js +1 -1
  107. package/dist/sdk/agent/test/index.js +1 -1
  108. package/dist/sdk/agent/test/output.js +1 -1
  109. package/dist/sdk/agent/test/parser.js +1 -1
  110. package/dist/sdk/agent/tool-target-registry.js +1 -1
  111. package/dist/sdk/api.js +1 -1
  112. package/dist/sdk/client/cdp-api-client.js +1 -1
  113. package/dist/sdk/client/delivery-api-client.js +1 -1
  114. package/dist/sdk/client/endpoints.js +1 -1
  115. package/dist/sdk/client/endpoints.js.map +1 -1
  116. package/dist/sdk/client/engage-api-client.js +1 -1
  117. package/dist/sdk/client/http-client.js +1 -1
  118. package/dist/sdk/client/llm-api-client.js +1 -1
  119. package/dist/sdk/client/oauth-refresh.d.ts +16 -0
  120. package/dist/sdk/client/oauth-refresh.d.ts.map +1 -0
  121. package/dist/sdk/client/oauth-refresh.js +1 -0
  122. package/dist/sdk/client/oauth-refresh.js.map +1 -0
  123. package/dist/sdk/client/rate-limiter.js +1 -1
  124. package/dist/sdk/client/td-api-client.js +1 -1
  125. package/dist/sdk/client/trino-api-client.js +1 -1
  126. package/dist/sdk/client/workflow-client.js +1 -1
  127. package/dist/sdk/connection-validator.js +1 -1
  128. package/dist/sdk/connection.js +1 -1
  129. package/dist/sdk/delivery.js +1 -1
  130. package/dist/sdk/engage/campaign-pull.js +1 -1
  131. package/dist/sdk/engage/campaign-push.js +1 -1
  132. package/dist/sdk/engage/campaign-validator.js +1 -1
  133. package/dist/sdk/engage/campaign-yaml.js +1 -1
  134. package/dist/sdk/engage/template-pull.js +1 -1
  135. package/dist/sdk/engage/template-push.js +1 -1
  136. package/dist/sdk/engage/template-validator.js +1 -1
  137. package/dist/sdk/engage/template-yaml.js +1 -1
  138. package/dist/sdk/engage/types/campaign-def.js +1 -1
  139. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  140. package/dist/sdk/engage/types/template-schema.js +1 -1
  141. package/dist/sdk/engage.js +1 -1
  142. package/dist/sdk/errors.js +1 -1
  143. package/dist/sdk/index.js +1 -1
  144. package/dist/sdk/io/index.js +1 -1
  145. package/dist/sdk/io/node-filesystem.js +1 -1
  146. package/dist/sdk/job.js +1 -1
  147. package/dist/sdk/journey.js +1 -1
  148. package/dist/sdk/llm/chat-cache.js +1 -1
  149. package/dist/sdk/llm/index.js +1 -1
  150. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  151. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  152. package/dist/sdk/llm/model-factors.js +1 -1
  153. package/dist/sdk/llm/model-factors.js.map +1 -1
  154. package/dist/sdk/personalization.js +1 -1
  155. package/dist/sdk/query/index.js +1 -1
  156. package/dist/sdk/query/sql-parser.js +1 -1
  157. package/dist/sdk/realtime.js +1 -1
  158. package/dist/sdk/schedule.js +1 -1
  159. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  160. package/dist/sdk/segment/fields-display.js +1 -1
  161. package/dist/sdk/segment/file-discovery.js +1 -1
  162. package/dist/sdk/segment/journey-utils.js +1 -1
  163. package/dist/sdk/segment/journey-validator.js +1 -1
  164. package/dist/sdk/segment/journey-yaml.js +1 -1
  165. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  166. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  167. package/dist/sdk/segment/pull-workflow.js +1 -1
  168. package/dist/sdk/segment/push-recovery.js +1 -1
  169. package/dist/sdk/segment/push-workflow.js +1 -1
  170. package/dist/sdk/segment/resolution-context.js +1 -1
  171. package/dist/sdk/segment/segment-path-parser.js +1 -1
  172. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  173. package/dist/sdk/segment/segment-validator.js +1 -1
  174. package/dist/sdk/segment/target-resolution.js +1 -1
  175. package/dist/sdk/segment/tdx-config.js +1 -1
  176. package/dist/sdk/segment/types/activation-schema.js +1 -1
  177. package/dist/sdk/segment/types/journey-def.js +1 -1
  178. package/dist/sdk/segment/types/journey-schema.js +1 -1
  179. package/dist/sdk/segment/types/segment-def.js +1 -1
  180. package/dist/sdk/segment/types/segment-schema.js +1 -1
  181. package/dist/sdk/segment/validate-files.js +1 -1
  182. package/dist/sdk/segment/yaml-validator.js +1 -1
  183. package/dist/sdk/segment.js +1 -1
  184. package/dist/sdk/types/index.js +1 -1
  185. package/dist/sdk/types/progress.js +1 -1
  186. package/dist/sdk/user.js +1 -1
  187. package/dist/sdk/util/format-detector.js +1 -1
  188. package/dist/sdk/util/formatters.js +1 -1
  189. package/dist/sdk/util/index.js +1 -1
  190. package/dist/sdk/util/paginate.js +1 -1
  191. package/dist/sdk/util/tree-formatter.js +1 -1
  192. package/dist/sdk/workflow/archive-validation.js +1 -1
  193. package/dist/sdk/workflow/clone-workflow.js +1 -1
  194. package/dist/sdk/workflow/index.js +1 -1
  195. package/dist/sdk/workflow/pull-workflow.js +1 -1
  196. package/dist/sdk/workflow/push-workflow.js +1 -1
  197. package/dist/sdk/workflow/tdx-config.js +1 -1
  198. package/dist/sdk/workflow/workflow-utils.js +1 -1
  199. package/dist/test-utils/command-runner.js +1 -1
  200. package/dist/test-utils/factories.js +1 -1
  201. package/dist/test-utils/fixtures.js +1 -1
  202. package/dist/test-utils/http-mock.js +1 -1
  203. package/dist/test-utils/index.js +1 -1
  204. package/dist/utils/async.js +1 -1
  205. package/dist/utils/colors.js +1 -1
  206. package/dist/utils/diff.js +1 -1
  207. package/dist/utils/file-permissions.js +1 -1
  208. package/dist/utils/file-reader.js +1 -1
  209. package/dist/utils/github-releases.js +1 -1
  210. package/dist/utils/global-cache.js +1 -1
  211. package/dist/utils/json-loader.js +1 -1
  212. package/dist/utils/local-cache.js +1 -1
  213. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  214. package/dist/utils/logger/formatters/index.js +1 -1
  215. package/dist/utils/logger/handlers/console-handler.js +1 -1
  216. package/dist/utils/logger/handlers/file-handler.js +1 -1
  217. package/dist/utils/logger/handlers/index.js +1 -1
  218. package/dist/utils/logger/handlers/null-handler.js +1 -1
  219. package/dist/utils/logger/index.js +1 -1
  220. package/dist/utils/logger/logger.js +1 -1
  221. package/dist/utils/logger/types.js +1 -1
  222. package/dist/utils/option-validation.js +1 -1
  223. package/dist/utils/process.js +1 -1
  224. package/dist/utils/prompt.js +1 -1
  225. package/dist/utils/spinner.js +1 -1
  226. package/dist/utils/sse-parser.js +1 -1
  227. package/dist/utils/string-utils.js +1 -1
  228. package/dist/utils/table-ref-parser.js +1 -1
  229. package/dist/utils/tdx-logger.js +1 -1
  230. package/dist/utils/version-check.js +1 -1
  231. package/package.json +1 -1
@@ -1 +1 @@
1
- const a135_0x3c0fc2=a135_0x3303;function a135_0x3303(_0x252988,_0x367751){_0x252988=_0x252988-0xf8;const _0x2daea9=a135_0x2dae();let _0x3303a4=_0x2daea9[_0x252988];return _0x3303a4;}(function(_0x55287c,_0x449644){const _0x4fbdb7=a135_0x3303,_0x2840e6=_0x55287c();while(!![]){try{const _0x3205f1=-parseInt(_0x4fbdb7(0x101))/0x1*(-parseInt(_0x4fbdb7(0x110))/0x2)+-parseInt(_0x4fbdb7(0x10f))/0x3+parseInt(_0x4fbdb7(0x100))/0x4+parseInt(_0x4fbdb7(0xff))/0x5*(-parseInt(_0x4fbdb7(0xfe))/0x6)+-parseInt(_0x4fbdb7(0x105))/0x7*(parseInt(_0x4fbdb7(0xf8))/0x8)+-parseInt(_0x4fbdb7(0xfc))/0x9*(-parseInt(_0x4fbdb7(0x108))/0xa)+parseInt(_0x4fbdb7(0x10a))/0xb;if(_0x3205f1===_0x449644)break;else _0x2840e6['push'](_0x2840e6['shift']());}catch(_0x2ce17e){_0x2840e6['push'](_0x2840e6['shift']());}}}(a135_0x2dae,0xd0d2e));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a135_0x5236ab from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a135_0x3c0fc2(0x102));export function getPushRecoveryPath(_0x3b9f1c){const _0x28ae98=a135_0x3c0fc2,_0x3202f2=a135_0x5236ab[_0x28ae98(0x109)](_0x3b9f1c),_0x118c64=a135_0x5236ab['basename'](_0x3b9f1c);return a135_0x5236ab['join'](_0x3202f2,'.'+_0x118c64+_0x28ae98(0x10e));}export function readPushRecovery(_0x56f451){const _0x31b9fc=a135_0x3c0fc2,_0x43dbe3=getPushRecoveryPath(_0x56f451);if(!existsSync(_0x43dbe3))return undefined;try{const _0x3fb3b7=readFileSync(_0x43dbe3,_0x31b9fc(0x103)),_0x53a01c=JSON[_0x31b9fc(0x10c)](_0x3fb3b7);if(_0x53a01c?.[_0x31b9fc(0x10d)]!==0x1||typeof _0x53a01c[_0x31b9fc(0xf9)]!==_0x31b9fc(0xfa))return undefined;return _0x53a01c;}catch(_0x3e5a96){return _0x3e5a96 instanceof SyntaxError?logger['debug'](_0x31b9fc(0x104)+_0x3e5a96):logger['warn'](_0x31b9fc(0xfb)+_0x3e5a96),undefined;}}export function writePushRecovery(_0x5109b1,_0x54a79d){const _0x1e5486=a135_0x3c0fc2,_0x567869=getPushRecoveryPath(_0x5109b1),_0x58c2d7=_0x567869+'.tmp';writeFileSync(_0x58c2d7,JSON[_0x1e5486(0x10b)](_0x54a79d,null,0x2)+'\x0a','utf-8'),renameSync(_0x58c2d7,_0x567869);}function a135_0x2dae(){const _0x3bdc18=['Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','558FAZknc','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','1122nVzdhX','23205LItVyH','3342000lvSwUW','268VaqASw','tdx.sdk.push-recovery','utf-8','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','112teqnpa','ENOENT','toISOString','4990UTNWae','dirname','10699788XqFfIu','stringify','parse','version','.push-recovery.json','555867EWvwEp','1884awVwEw','91552vMdLDC','journeyName','string'];a135_0x2dae=function(){return _0x3bdc18;};return a135_0x2dae();}export function deletePushRecovery(_0x1b0a34){const _0x391881=a135_0x3c0fc2,_0x1cf894=getPushRecoveryPath(_0x1b0a34);try{unlinkSync(_0x1cf894);}catch(_0x2c85bb){_0x2c85bb['code']!==_0x391881(0x106)&&logger['debug'](_0x391881(0xfd)+_0x2c85bb);}}export function saveSegmentToPushRecovery(_0x2913da,_0x420957,_0x251e63,_0x39a591){const _0x5dfe46=a135_0x3c0fc2,_0x257aa7=readPushRecovery(_0x2913da),_0x19bf11=_0x257aa7?.[_0x5dfe46(0xf9)]===_0x420957?{..._0x257aa7,'updatedAt':new Date()[_0x5dfe46(0x107)]()}:{'version':0x1,'journeyName':_0x420957,'updatedAt':new Date()[_0x5dfe46(0x107)](),'segments':{}};_0x19bf11['segments'][_0x251e63]=_0x39a591,writePushRecovery(_0x2913da,_0x19bf11);}
1
+ const a139_0x338208=a139_0x102c;(function(_0x3caff3,_0x535e95){const _0x17e971=a139_0x102c,_0x4971dc=_0x3caff3();while(!![]){try{const _0x144f65=parseInt(_0x17e971(0xe0))/0x1+-parseInt(_0x17e971(0xd9))/0x2*(parseInt(_0x17e971(0xc6))/0x3)+-parseInt(_0x17e971(0xd7))/0x4+parseInt(_0x17e971(0xd6))/0x5*(parseInt(_0x17e971(0xd1))/0x6)+parseInt(_0x17e971(0xcd))/0x7+parseInt(_0x17e971(0xd4))/0x8*(parseInt(_0x17e971(0xcb))/0x9)+parseInt(_0x17e971(0xda))/0xa*(-parseInt(_0x17e971(0xd8))/0xb);if(_0x144f65===_0x535e95)break;else _0x4971dc['push'](_0x4971dc['shift']());}catch(_0x57b71d){_0x4971dc['push'](_0x4971dc['shift']());}}}(a139_0x100d,0xb022d));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a139_0x3be21a from'path';function a139_0x100d(){const _0x2d326a=['utf-8','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','16xVOYQi','segments','1610rfahWs','494120IQVfLc','55vfvHOR','2279282MNjPzJ','426290QelaGP','debug','stringify','ENOENT','toISOString','parse','908304eDGiJH','3RbSsvZ','tdx.sdk.push-recovery','warn','basename','code','931347WkwoLI','version','6696179ifXcLc','.push-recovery.json','join','journeyName','2346CNwBIM'];a139_0x100d=function(){return _0x2d326a;};return a139_0x100d();}function a139_0x102c(_0x499b44,_0x3638a7){_0x499b44=_0x499b44-0xc6;const _0x100d57=a139_0x100d();let _0x102c7a=_0x100d57[_0x499b44];return _0x102c7a;}import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a139_0x338208(0xc7));export function getPushRecoveryPath(_0x3d3de8){const _0x480dd0=a139_0x338208,_0x4c6151=a139_0x3be21a['dirname'](_0x3d3de8),_0x40c0e2=a139_0x3be21a[_0x480dd0(0xc9)](_0x3d3de8);return a139_0x3be21a[_0x480dd0(0xcf)](_0x4c6151,'.'+_0x40c0e2+_0x480dd0(0xce));}export function readPushRecovery(_0x1db05c){const _0x328ef1=a139_0x338208,_0x15f471=getPushRecoveryPath(_0x1db05c);if(!existsSync(_0x15f471))return undefined;try{const _0x23199b=readFileSync(_0x15f471,'utf-8'),_0x4cd0da=JSON[_0x328ef1(0xdf)](_0x23199b);if(_0x4cd0da?.[_0x328ef1(0xcc)]!==0x1||typeof _0x4cd0da[_0x328ef1(0xd0)]!=='string')return undefined;return _0x4cd0da;}catch(_0x319aec){return _0x319aec instanceof SyntaxError?logger[_0x328ef1(0xdb)](_0x328ef1(0xd3)+_0x319aec):logger[_0x328ef1(0xc8)]('Failed\x20to\x20read\x20push\x20recovery\x20file:\x20'+_0x319aec),undefined;}}export function writePushRecovery(_0xb7e016,_0xa40d50){const _0x509bca=a139_0x338208,_0x41757f=getPushRecoveryPath(_0xb7e016),_0x786d48=_0x41757f+'.tmp';writeFileSync(_0x786d48,JSON[_0x509bca(0xdc)](_0xa40d50,null,0x2)+'\x0a',_0x509bca(0xd2)),renameSync(_0x786d48,_0x41757f);}export function deletePushRecovery(_0x1b4b40){const _0x3d5b8f=a139_0x338208,_0x2e18e8=getPushRecoveryPath(_0x1b4b40);try{unlinkSync(_0x2e18e8);}catch(_0x439edc){_0x439edc[_0x3d5b8f(0xca)]!==_0x3d5b8f(0xdd)&&logger[_0x3d5b8f(0xdb)]('Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20'+_0x439edc);}}export function saveSegmentToPushRecovery(_0x4a6b94,_0x1688ff,_0x2c64ad,_0x30b498){const _0x2d21e3=a139_0x338208,_0x3593d8=readPushRecovery(_0x4a6b94),_0xdb3ba5=_0x3593d8?.['journeyName']===_0x1688ff?{..._0x3593d8,'updatedAt':new Date()['toISOString']()}:{'version':0x1,'journeyName':_0x1688ff,'updatedAt':new Date()[_0x2d21e3(0xde)](),'segments':{}};_0xdb3ba5[_0x2d21e3(0xd5)][_0x2c64ad]=_0x30b498,writePushRecovery(_0x4a6b94,_0xdb3ba5);}
@@ -1 +1 @@
1
- const a136_0x3aef17=a136_0x39b7;(function(_0x18f438,_0x58e13d){const _0x2542e9=a136_0x39b7,_0x5317a6=_0x18f438();while(!![]){try{const _0x1c1cbe=parseInt(_0x2542e9(0x14b))/0x1+parseInt(_0x2542e9(0xee))/0x2*(parseInt(_0x2542e9(0x139))/0x3)+-parseInt(_0x2542e9(0xc4))/0x4+parseInt(_0x2542e9(0x16c))/0x5*(parseInt(_0x2542e9(0x162))/0x6)+parseInt(_0x2542e9(0xc8))/0x7*(-parseInt(_0x2542e9(0xfa))/0x8)+-parseInt(_0x2542e9(0x11e))/0x9*(-parseInt(_0x2542e9(0x10a))/0xa)+parseInt(_0x2542e9(0x131))/0xb*(parseInt(_0x2542e9(0x12e))/0xc);if(_0x1c1cbe===_0x58e13d)break;else _0x5317a6['push'](_0x5317a6['shift']());}catch(_0x2e6440){_0x5317a6['push'](_0x5317a6['shift']());}}}(a136_0x111c,0x69e05));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a136_0x3aef17(0x16d));export const PENDING_SEGMENT_PREFIX=a136_0x3aef17(0x11a);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x47c0ef){return''+PENDING_SEGMENT_PREFIX+_0x47c0ef+'__';}export function isPendingSegmentId(_0x2c04db){const _0xfe9b24=a136_0x3aef17;return _0x2c04db['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x2c04db[_0xfe9b24(0x140)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x174439){const _0x29c890=a136_0x3aef17;return _0x174439[_0x29c890(0xe0)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x3c18c0){return''+PENDING_ACTIVATION_PREFIX+_0x3c18c0+'__';}export function isPendingActivationId(_0x1e11a7){const _0x538bbb=a136_0x3aef17;return _0x1e11a7[_0x538bbb(0x140)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x3e5c48){const _0x3ddcec=a136_0x3aef17;return _0x3e5c48[_0x3ddcec(0xe0)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x1eb2c2,_0x233790){const _0x26866e=a136_0x3aef17,_0x484105=_0x1eb2c2+'::'+(_0x233790[_0x26866e(0x181)]()||_0x26866e(0xa3)),_0x4d7946=createHash('sha1')[_0x26866e(0x137)](_0x484105)['digest'](_0x26866e(0x118))['slice'](0x0,0xc);return _0x26866e(0x174)+_0x4d7946;}export function ensureJourneyDefaults(_0x35af9b){const _0x50c4e5=a136_0x3aef17;!_0x35af9b[_0x50c4e5(0x16b)]&&(_0x35af9b[_0x50c4e5(0x16b)]=''),!_0x35af9b['state']&&(_0x35af9b[_0x50c4e5(0x142)]=_0x50c4e5(0x105));}export function injectExistingStageIds(_0x2fa5f1,_0x530438){const _0x2bc768=a136_0x3aef17,_0x6feabb=new Map(_0x530438['map'](_0x4429db=>[_0x4429db['name'],_0x4429db['id']]));for(const _0x3667e2 of _0x2fa5f1){if(!_0x3667e2['id']){const _0x2e68b2=_0x6feabb[_0x2bc768(0xe9)](_0x3667e2[_0x2bc768(0xfc)]);_0x2e68b2&&(_0x3667e2['id']=_0x2e68b2);}}}export function resolveTDFolderPath(_0x4885d1,_0x1b9e8d,_0x579f99){const _0x589412=a136_0x3aef17;if(!_0x1b9e8d)return _0x4885d1;if(_0x4885d1===_0x579f99||_0x4885d1[_0x589412(0x140)](_0x579f99+'/'))return _0x4885d1;return _0x4885d1?_0x579f99+'/'+_0x4885d1:_0x579f99;}export function addFoldersToCreate(_0x2629ad,_0x4b5f84,_0x3c948a){const _0x240d59=a136_0x3aef17;if(!_0x2629ad)return;if(_0x4b5f84[_0x240d59(0x132)](_0x2629ad))return;const _0x532453=_0x2629ad[_0x240d59(0xec)]('/');let _0x2e7972='';for(const _0x3c427c of _0x532453){_0x2e7972=_0x2e7972?_0x2e7972+'/'+_0x3c427c:_0x3c427c,!_0x4b5f84[_0x240d59(0x132)](_0x2e7972)&&_0x3c948a[_0x240d59(0x99)](_0x2e7972);}}export function sortFoldersByDepth(_0x4f8d50){const _0x1f69b2=a136_0x3aef17;return[..._0x4f8d50][_0x1f69b2(0x157)]((_0x90ab5,_0x3758f3)=>{const _0x13e5eb=_0x1f69b2,_0x325433=(_0x90ab5[_0x13e5eb(0x148)](/\//g)||[])['length'],_0x2b4858=(_0x3758f3['match'](/\//g)||[])[_0x13e5eb(0x93)];return _0x325433-_0x2b4858;});}import*as a136_0x42129b from'yaml';import{readFileSync}from'fs';import a136_0x2cf61d from'path';import{isJourneyDef,parseYamlString as a136_0x52b19f,toYamlString as a136_0x3b10e7,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 a136_0x39b7(_0x16f507,_0x5a0a80){_0x16f507=_0x16f507-0x90;const _0x111cd0=a136_0x111c();let _0x39b734=_0x111cd0[_0x16f507];return _0x39b734;}import{batchAsync}from'../../utils/async.js';function a136_0x111c(){const _0x389c9c=['journeyActivationStepId','getSegment','goal','\x20journey\x20from\x20file:\x20','hex','\x20error(s)','__pending_','reduce','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','):\x20','108ytZHuZ','relationships','max','run_after_journey_refresh','folderPath','waitStepType','listActivations','activation_updated','parentId','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','branches','activationActions','toLowerCase','existingSegments','segmentId','logSuccess','4406808giedol','entryCriteria','size','22HDevgT','has','created','decision_point','find','notification','update','entries','1317arMcqb','embedded_segment_created','JOURNEY_SYNTAX_ERROR','fetchJourney','\x27\x20exit\x20criteria','conditionTimeoutDuration','getJourney','startsWith','diff','state','activationStepsById','map','./child-segment-yaml.js','isNew','Deleted\x20segment\x20\x27','match','segmentFolderId','withProgress','738763WCXJhe','\x27\x20milestone','existingJourney','segment_deleted','verbose','values','data','getSegmentEntity','WaitStep','Embedded\x20segment\x20\x27','segmentNameToId','SEGMENT_NOT_FOUND','sort','\x20activation\x20\x27','createJourneySegment','embedded_activation_creating','\x27\x20from\x20file:\x20','Matched\x20server\x20segment\x20\x27','createFolder','journeyBundleName','deleted','parseDocument','Creating\x20folder\x20\x27','593874BloQTc','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','existingActivation','action','delete','keys','conditionSegmentId','attributes',').\x20','description','5RHMccA','tdx.sdk.push-workflow','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','with','user','valid','day','Creating\x20segment\x20\x27','journey_entry_criteria_','Condition','isArray','connection','logDeleted','journey_updated','journeys','Delete\x20the\x20push\x20recovery\x20file\x20(','embedded_segment_creating','Updating\x20activation\x20\x27','ACTIVATION_UPDATE_ERROR','list','\x20(referenced\x20in\x20journey\x20','trim','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','existingSegment','activation_deleting','stringify','goal\x20criteria','createdSegmentId','effectiveFolderId','deps','index','activationParams','exitCriterias','idToName','push','onProgress','resolvedRule','deleteSegment','nameToId','segments','Updating\x20segment\x20\x27','\x27...','\x27\x20decision\x20point\x20branch\x20\x27','rootFolderId','folder','errors','\x27\x20entry\x20criteria','activationsBySegmentId','uniqueServerName','Failed\x20to\x20fetch\x20referenced\x20segment\x20','getSegmentEntity\x20also\x20failed\x20for\x20','length','versionNumber','entry_criteria','connector_config','stages','all','add','object','\x0a\x20\x20','getSegment\x20failed\x20for\x20','results','Segment\x20not\x20found','Duration','Entry\x20criteria:\x20','activations','\x27\x20wait\x20condition','segment','steps','activationContext','createdSegmentIds','Journey\x20\x27','Created\x20activation\x20\x27','conditionTimeoutUnit','stage\x20\x27','journeyStages','parentSegmentFolder','journeyById','activation_template_id','segment_created','journey_created','journeyBundlesByFolderAndName','idToEmailMap','and\x20the\x20server\x20segment,\x20then\x20retry.','Deleted\x20activation\x20\x27','Stage\x20\x27','Name\x20has\x20already\x20been\x20taken','yamlConfig','milestone','Failed\x20to\x20','Segment\x20not\x20found:\x20','dirname','waitStep','Updated\x20journey\x20\x27','type','createActivation','\x27\x20not\x20found\x20in\x20journey\x20\x27','set','create','toISOString','3266152JxwssK','updateSegmentById','journey_creating','segment_deleting','1631RYqyGq','DecisionPoint','updated','toString','schedule','nameToType','Failed\x20to\x20resolve\x20segment\x20','.$1.push-recovery.json','slice','journey','Activation\x20not\x20found:\x20','segment_creating','connectionIdToNameMap','embeddedSegmentNameToId','journeyId','folderPathToId','NOT_FOUND','SEGMENT_SYNTAX_ERROR','hasChanges','INTERNAL',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','resolveJourneyId','\x20segment\x20from\x20file:\x20','localName','replace','unchanged','folder_creating','behavior','columns','journeyName','uniqueSegmentName','Creating\x20activation\x20\x27','message','get','yamlActivation','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','split','from','1068alqfMd','conditions','rule','../../utils/async.js','some','parse','absolutePath','SEGMENT_UPDATE_ERROR','relative','journey_updating','\x27\x20to\x20local\x20\x27','skipSegments','19144NsOHWv','all_columns','name','\x27\x20for\x20','item','Deleting\x20activation\x20\x27','getActivation','debug','Created\x20journey\x20\x27','entry','./journey-yaml.js','draft','includes','progress','segmentByFolderAndName','waitStepUnit','950KVldoB','folderId','activation_deleted','join','filter','validatedRequest','activation_creating','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','Fetching\x20','utf-8'];a136_0x111c=function(){return _0x389c9c;};return a136_0x111c();}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(_0xe81b00){const _0x54fb53=a136_0x3aef17;if(Array[_0x54fb53(0x176)](_0xe81b00))return'['+_0xe81b00[_0x54fb53(0x144)](_0x3ee7e7=>stableStringify(_0x3ee7e7))[_0x54fb53(0x10d)](',')+']';if(_0xe81b00&&typeof _0xe81b00===_0x54fb53(0x9a)){const _0x3cb061=_0xe81b00,_0x5b56ca=Object['keys'](_0x3cb061)[_0x54fb53(0x157)](),_0x7a6a34=_0x5b56ca[_0x54fb53(0x144)](_0x13016f=>'\x22'+_0x13016f+'\x22:'+stableStringify(_0x3cb061[_0x13016f]));return'{'+_0x7a6a34['join'](',')+'}';}const _0x12c603=JSON[_0x54fb53(0x185)](_0xe81b00);return _0x12c603===undefined?'null':_0x12c603;}function activationSignature(_0x46ef42){const _0x6ecb1e=a136_0x3aef17,_0x55f4f5={'connection':_0x46ef42[_0x6ecb1e(0x177)],..._0x46ef42[_0x6ecb1e(0xfb)]!==undefined&&{'all_columns':_0x46ef42[_0x6ecb1e(0xfb)]},..._0x46ef42[_0x6ecb1e(0xe4)]!==undefined&&{'columns':_0x46ef42['columns']},..._0x46ef42[_0x6ecb1e(0xe3)]!==undefined&&{'behavior':_0x46ef42[_0x6ecb1e(0xe3)]},..._0x46ef42['schedule']!==undefined&&{'schedule':_0x46ef42[_0x6ecb1e(0xcc)]},..._0x46ef42[_0x6ecb1e(0x136)]!==undefined&&{'notification':_0x46ef42['notification']},..._0x46ef42[_0x6ecb1e(0x96)]!==undefined&&{'connector_config':_0x46ef42['connector_config']},..._0x46ef42[_0x6ecb1e(0xae)]!==undefined&&{'activation_template_id':_0x46ef42[_0x6ecb1e(0xae)]}};return stableStringify(_0x55f4f5);}async function fetchSegment(_0x1aaabc,_0x38e1b7,_0x5583cc,_0x23b6de){const _0x194c56=a136_0x3aef17,_0x47fed7=_0x23b6de?.[_0x194c56(0x135)](_0x4fe3a0=>_0x4fe3a0['id']===_0x5583cc);if(_0x47fed7)return _0x47fed7;try{return await _0x1aaabc['segment'][_0x194c56(0x115)](_0x38e1b7,_0x5583cc);}catch(_0x220b51){logger[_0x194c56(0x101)](_0x194c56(0x9c)+_0x5583cc+_0x194c56(0xdc)+_0x220b51);try{return await _0x1aaabc[_0x194c56(0xa3)][_0x194c56(0x152)](_0x5583cc);}catch(_0x341e2f){return logger[_0x194c56(0x101)](_0x194c56(0x92)+_0x5583cc+':\x20'+_0x341e2f),null;}}}function recoverSegmentIdsFromPushRecovery(_0x44ea52,_0x36fa9d,_0x4b2154){const _0x4a746b=a136_0x3aef17,_0x44af6d=readPushRecovery(_0x44ea52[_0x4a746b(0xf4)]);if(_0x44af6d?.[_0x4a746b(0xe5)]===_0x44ea52[_0x4a746b(0xb7)]['name'])for(const [_0x360246,_0x59bffd]of Object[_0x4a746b(0x138)](_0x44af6d[_0x4a746b(0x193)])){const _0x1d57df=generateDeterministicJourneySegmentName(_0x44ea52[_0x4a746b(0xb7)][_0x4a746b(0xfc)],_0x360246);_0x59bffd[_0x4a746b(0x90)]===_0x1d57df&&(_0x36fa9d[_0x4a746b(0xc1)](_0x360246,_0x59bffd['segmentId']),_0x4b2154[_0x4a746b(0xc1)](_0x360246,_0x59bffd[_0x4a746b(0x12c)]));}}async function createOrRecoverEmbeddedSegment(_0x45acd0,_0x28066b,_0xde8a32,_0x50221d){const _0xa9d105=a136_0x3aef17;let _0x4f7a41;try{_0x4f7a41=await _0x45acd0[_0xa9d105(0xa3)][_0xa9d105(0x159)]({'name':_0xde8a32[_0xa9d105(0xe6)],'description':_0xde8a32[_0xa9d105(0x16b)],'journeyId':_0xde8a32[_0xa9d105(0xd6)],'rule':_0x50221d(_0xde8a32['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0xde8a32[_0xa9d105(0x10b)],'audienceId':_0xde8a32[_0xa9d105(0x126)]});}catch(_0x340fe6){const _0x566578=_0x340fe6 instanceof Error&&_0x340fe6[_0xa9d105(0xe8)][_0xa9d105(0x106)](_0xa9d105(0xb6));if(_0x566578){const _0x39d4d5=readPushRecovery(_0x28066b['absolutePath']),_0x3b8db1=_0x39d4d5?.[_0xa9d105(0xe5)]===_0x28066b['yamlConfig'][_0xa9d105(0xfc)]?_0x39d4d5[_0xa9d105(0x193)][_0xde8a32[_0xa9d105(0xdf)]]:undefined;if(_0x3b8db1?.[_0xa9d105(0x90)]===_0xde8a32[_0xa9d105(0xe6)])await _0x45acd0[_0xa9d105(0xa3)][_0xa9d105(0xc5)](_0xde8a32[_0xa9d105(0x126)],_0x3b8db1[_0xa9d105(0x12c)],{'description':_0xde8a32[_0xa9d105(0x16b)],'rule':_0x50221d(_0xde8a32[_0xa9d105(0x190)],!![]),'countPopulation':!![]}),_0x4f7a41=_0x3b8db1[_0xa9d105(0x12c)];else throw new SDKError(ErrorCode[_0xa9d105(0xf5)],_0xa9d105(0x154)+_0xde8a32[_0xa9d105(0xdf)]+_0xa9d105(0x11c)+(_0xa9d105(0x17b)+_0x28066b[_0xa9d105(0xf4)]['replace'](/([^/]+)$/,_0xa9d105(0xcf))+')\x20')+_0xa9d105(0xb3),_0x340fe6);}else throw _0x340fe6;}return saveSegmentToPushRecovery(_0x28066b[_0xa9d105(0xf4)],_0x28066b['yamlConfig'][_0xa9d105(0xfc)],_0xde8a32['localName'],{'segmentId':_0x4f7a41,'uniqueServerName':_0xde8a32[_0xa9d105(0xe6)],'createdAt':new Date()[_0xa9d105(0xc3)]()}),_0x4f7a41;}export async function prepareSegmentFiles(_0x209ad3,_0x30ca51,_0x1b993b,_0x27ec8a,_0x59b679){const _0xb20738=a136_0x3aef17,{activationDefToCreateRequest:_0x488d1f}=await import(_0xb20738(0x145)),_0x18a1f5=[],_0x2f809a=new Set();for(const {yamlConfig:_0x3122fa,folderPath:_0x20558f,sourcePath:_0x43f49e}of _0x209ad3){const _0x4da65e=resolveTDFolderPath(_0x20558f,_0x27ec8a,_0x59b679),_0x47b8c4=_0x4da65e+':'+_0x3122fa[_0xb20738(0xfc)],_0x53807e=_0x30ca51[_0xb20738(0x108)][_0xb20738(0xe9)](_0x47b8c4),_0x36f8be=_0x53807e?_0x30ca51[_0xb20738(0x19b)][_0xb20738(0xe9)](_0x53807e['id'])||[]:[];addFoldersToCreate(_0x4da65e,_0x30ca51['folderPathToId'],_0x2f809a);const _0x2e931d=calculateActivationActions(_0x3122fa[_0xb20738(0xa1)]||[],_0x36f8be,_0x30ca51[_0xb20738(0xb2)],_0x30ca51['connectionIdToNameMap']);for(const _0x588d83 of _0x2e931d){(_0x588d83['type']==='create'||_0x588d83['type']===_0xb20738(0x137))&&_0x588d83['yamlActivation']&&(_0x588d83[_0xb20738(0x10f)]=await _0x488d1f(_0x588d83[_0xb20738(0xea)],_0x1b993b));}const _0x5db702=calculateSegmentDiff(_0x3122fa,_0x53807e,_0x36f8be,_0x30ca51[_0xb20738(0xb2)],_0x30ca51[_0xb20738(0xd4)]);_0x18a1f5[_0xb20738(0x18e)]({'relativePath':_0x3122fa[_0xb20738(0xfc)],'absolutePath':_0x43f49e,'yamlConfig':_0x3122fa,'folderPath':_0x4da65e,'existingSegment':_0x53807e,'existingActivations':_0x36f8be,'isNew':_0x5db702[_0xb20738(0x146)],'hasChanges':_0x5db702[_0xb20738(0xda)],'diff':_0x5db702[_0xb20738(0x141)],'activationActions':_0x2e931d});}return{'segmentFiles':_0x18a1f5,'foldersToCreate':_0x2f809a};}export async function prepareJourneyFiles(_0x450a5c,_0xbf8388,_0x52bfb7,_0x31cef4){const _0x208f1a=a136_0x3aef17,_0x4c6891=[],_0x13e226=new Set();for(const {yamlConfig:_0x161e69,folderPath:_0x4cf788,sourcePath:_0x243ede}of _0x450a5c){const _0x5efb4b=resolveTDFolderPath(_0x4cf788,_0x52bfb7,_0x31cef4),_0x23cd8b=_0x5efb4b+':'+_0x161e69[_0x208f1a(0xfc)],_0x4e08ea=_0xbf8388[_0x208f1a(0xb1)][_0x208f1a(0xe9)](_0x23cd8b);let _0x5a75fe,_0x16c653;if(_0x4e08ea&&_0x4e08ea['length']>0x0){const _0x1228be=buildLocalExpandedRuleMappings(_0x161e69),{createYamlContext:_0x3a705d,prefetchJourneySegments:_0x11191d}=createPushYamlContextForBundle(_0xbf8388[_0x208f1a(0x189)],_0xbf8388[_0x208f1a(0x126)],_0xbf8388[_0x208f1a(0x12b)],_0x1228be,_0xbf8388[_0x208f1a(0xb2)],_0xbf8388[_0x208f1a(0xd4)],_0xbf8388[_0x208f1a(0x143)],_0xbf8388[_0x208f1a(0xad)]);await _0x11191d(_0x4e08ea['map'](_0x4e4897=>_0x4e4897['id']));const _0x5e4961=await _0xbf8388[_0x208f1a(0x189)][_0x208f1a(0xd1)]['getLatestJourneyId'](_0x4e08ea[0x0]['journeyBundleId']),_0x4f579c=hasMultipleVersions(_0x161e69),_0x23b7c6=async _0x110d8c=>{const _0x12a1cd=_0x208f1a,_0x3a1e30=_0xbf8388[_0x12a1cd(0xad)]?.[_0x12a1cd(0xe9)](_0x110d8c);if(_0x3a1e30)return _0x3a1e30;return _0xbf8388[_0x12a1cd(0x13c)]({'journeyId':_0x110d8c,'journeyName':_0x161e69['name'],'isMultiVersion':_0x4e08ea[_0x12a1cd(0x93)]>0x1});};if(_0x4f579c&&_0x4e08ea[_0x208f1a(0x93)]>0x1){const _0x52c97c=[];for(const _0x499401 of _0x4e08ea){const _0x238edc=_0x499401[_0x208f1a(0x94)]||0x1;_0xbf8388[_0x208f1a(0x107)]?.[_0x208f1a(0x137)]('Fetching\x20'+_0x161e69[_0x208f1a(0xfc)]+'\x20v'+_0x238edc);const _0x309160=await _0x23b7c6(_0x499401['id']),_0x58eb75=_0x3a705d(_0x499401['id']),_0x4e6629=await journeyResponseToDef(_0x309160,_0x58eb75);_0x52c97c[_0x208f1a(0x18e)]({'item':_0x499401,'yaml':_0x4e6629});}const _0x552c6d=buildLocalRuleToNameMappingFromJourney(_0x161e69);_0x16c653=buildMergedJourneyDef(_0x52c97c,_0x552c6d,_0x5e4961);const _0x58b4db=Math[_0x208f1a(0x120)](..._0x52c97c[_0x208f1a(0x144)](_0x47bc0c=>_0x47bc0c[_0x208f1a(0xfe)][_0x208f1a(0x94)]||0x0)),_0xb51c54=_0x4e08ea[_0x208f1a(0x135)](_0x1260a7=>(_0x1260a7[_0x208f1a(0x94)]||0x0)===_0x58b4db);_0xb51c54&&(_0xbf8388['progress']?.[_0x208f1a(0x137)](_0x208f1a(0x112)+_0x161e69[_0x208f1a(0xfc)]+'\x20v'+_0x58b4db),_0x5a75fe=await _0x23b7c6(_0xb51c54['id']));}else{const _0x15218c=_0x4e08ea[_0x4e08ea[_0x208f1a(0x93)]-0x1];_0xbf8388['progress']?.[_0x208f1a(0x137)](_0x208f1a(0x112)+_0x161e69['name']),_0x5a75fe=await _0x23b7c6(_0x15218c['id']);const _0x1a7271=_0x3a705d(_0x15218c['id']),_0x5d8b73=await journeyResponseToDef(_0x5a75fe,_0x1a7271),_0x3454ac=buildLocalRuleToNameMappingFromJourney(_0x161e69);_0x16c653=buildMergedJourneyDef([{'item':_0x15218c,'yaml':_0x5d8b73}],_0x3454ac,_0x5e4961);}}addFoldersToCreate(_0x5efb4b,_0xbf8388[_0x208f1a(0xd7)],_0x13e226);const _0x31e85f=calculateJourneyDiff(_0x161e69,_0x16c653);_0x4c6891[_0x208f1a(0x18e)]({'relativePath':_0x161e69[_0x208f1a(0xfc)],'absolutePath':_0x243ede,'yamlConfig':_0x161e69,'folderPath':_0x5efb4b,'existingJourney':_0x5a75fe,'isNew':_0x31e85f[_0x208f1a(0x146)],'hasChanges':_0x31e85f[_0x208f1a(0xda)],'diff':_0x31e85f[_0x208f1a(0x141)]});}return{'journeyFiles':_0x4c6891,'foldersToCreate':_0x13e226};}export function calculateActivationActions(_0xe72ddf,_0x11585c,_0x2a0533,_0x34a585){const _0x47c10f=a136_0x3aef17,_0x48e79a=[],_0x38733c=new Map();for(const _0x24d2b0 of _0x11585c){_0x38733c[_0x47c10f(0xc1)](_0x24d2b0['name'],_0x24d2b0);}const _0x4fbe86=new Map();for(const _0x7f4b23 of _0xe72ddf){_0x4fbe86['set'](_0x7f4b23[_0x47c10f(0xfc)],_0x7f4b23);}for(const _0x392dbe of _0xe72ddf){const _0x30ed21=_0x38733c[_0x47c10f(0xe9)](_0x392dbe[_0x47c10f(0xfc)]);if(!_0x30ed21)_0x48e79a[_0x47c10f(0x18e)]({'type':_0x47c10f(0xc2),'name':_0x392dbe[_0x47c10f(0xfc)],'yamlActivation':_0x392dbe});else{const _0x30a281=activationResponseToDef(_0x30ed21,_0x2a0533,_0x34a585),_0x373c5a=a136_0x42129b[_0x47c10f(0x185)](_0x30a281),_0x5d214c=a136_0x42129b[_0x47c10f(0x185)](_0x392dbe);_0x373c5a!==_0x5d214c&&_0x48e79a['push']({'type':_0x47c10f(0x137),'name':_0x392dbe['name'],'yamlActivation':_0x392dbe,'existingActivation':_0x30ed21});}}for(const _0x33cad9 of _0x11585c){!_0x4fbe86['has'](_0x33cad9[_0x47c10f(0xfc)])&&_0x48e79a[_0x47c10f(0x18e)]({'type':_0x47c10f(0x166),'name':_0x33cad9[_0x47c10f(0xfc)],'existingActivation':_0x33cad9});}return _0x48e79a;}function calculateYamlDiff(_0x1ca7cb,_0x292d72){if(_0x292d72){const _0x2fd871=generateDiff(_0x292d72,_0x1ca7cb),_0x5f2620=hasChanges(_0x2fd871);return{'isNew':![],'hasChanges':_0x5f2620,'diff':_0x5f2620?formatDiffWithColors(_0x2fd871):undefined};}const _0x3b75e3=generateDiff('',_0x1ca7cb);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x3b75e3)};}export function calculateSegmentDiff(_0x5a8851,_0x21a1d8,_0x3858fd,_0xa121,_0x2dd560){const _0xcc8dc3=segmentToYamlString(_0x5a8851),_0x58af2c=_0x21a1d8?segmentToYamlString(segmentWithActivationsToYaml(_0x21a1d8,_0x3858fd,undefined,_0xa121,_0x2dd560)):undefined;return calculateYamlDiff(_0xcc8dc3,_0x58af2c);}export function calculateJourneyDiff(_0x16cde6,_0xdf8ad2){const _0xa71038=normalizeJourneyDef(_0x16cde6,_0x16cde6),_0x53db2b=a136_0x3b10e7(_0xa71038),_0x188d82=_0xdf8ad2?a136_0x3b10e7(normalizeJourneyDef(_0xdf8ad2,_0x16cde6)):undefined;return calculateYamlDiff(_0x53db2b,_0x188d82);}export function findSegmentsToDelete(_0x4b9c50,_0x2b9794,_0x13b0d4,_0x3dcbed,_0x38f1a0){const _0x1b9d1d=a136_0x3aef17,_0x41c794=new Set();for(const {yamlConfig:_0x56e456,folderPath:_0xd64a88}of _0x2b9794){_0x41c794[_0x1b9d1d(0x99)](_0xd64a88+':'+_0x56e456[_0x1b9d1d(0xfc)]);}return _0x4b9c50['filter'](_0x1bec88=>{const _0x6fd184=_0x1b9d1d,_0x512324=_0x1bec88['segmentFolderId']?_0x13b0d4['get'](_0x1bec88[_0x6fd184(0x149)][_0x6fd184(0xcb)]())||'':'',_0x1fbdb7=_0x512324+':'+_0x1bec88[_0x6fd184(0xfc)];if(_0x41c794['has'](_0x1fbdb7))return![];if(_0x38f1a0)return _0x512324===_0x3dcbed||_0x512324[_0x6fd184(0x140)](_0x3dcbed+'/');return!![];});}export function findJourneysToDelete(_0x1a8572,_0x16cc7e,_0xed97b5,_0x42100c,_0x51153f){const _0x4af5fe=a136_0x3aef17,_0x226e89=new Set();for(const {yamlConfig:_0x422771,folderPath:_0x3734f9}of _0x16cc7e){_0x226e89[_0x4af5fe(0x99)](_0x3734f9+':'+_0x422771['name']);}return _0x1a8572['filter'](_0x33d0e2=>{const _0x3637f7=_0x4af5fe,_0x3526af=_0x33d0e2[_0x3637f7(0x10b)]?_0xed97b5[_0x3637f7(0xe9)](_0x33d0e2[_0x3637f7(0x10b)])||'':'',_0xd8a93b=_0x3526af+':'+_0x33d0e2[_0x3637f7(0x15e)];if(_0x226e89[_0x3637f7(0x132)](_0xd8a93b))return![];if(_0x51153f)return _0x3526af===_0x42100c||_0x3526af[_0x3637f7(0x140)](_0x42100c+'/');return!![];});}export function buildSegmentLookupMap(_0xfdba68,_0x519546){const _0x69760=a136_0x3aef17,_0x4827e0=new Map();for(const _0x543367 of _0xfdba68){const _0x4557b7=_0x543367[_0x69760(0x149)]?_0x519546[_0x69760(0xe9)](_0x543367['segmentFolderId'][_0x69760(0xcb)]())||'':'',_0x50598e=_0x4557b7+':'+_0x543367[_0x69760(0xfc)];_0x4827e0[_0x69760(0xc1)](_0x50598e,_0x543367);}return _0x4827e0;}export function buildSegmentNameToIdMap(_0x44b73f){const _0x224149=new Map();for(const _0x439c28 of _0x44b73f){_0x224149['set'](_0x439c28['name'],_0x439c28['id']);}return _0x224149;}export function buildJourneyBundleLookupMap(_0x1a1de9,_0x496dd8){const _0x3d8fd8=a136_0x3aef17,_0x3c00aa=new Map();for(const _0x22bf2c of _0x1a1de9){const _0x27a956=_0x22bf2c[_0x3d8fd8(0x10b)]?_0x496dd8[_0x3d8fd8(0xe9)](_0x22bf2c[_0x3d8fd8(0x10b)])||'':'',_0xf92a5d=_0x27a956+':'+_0x22bf2c[_0x3d8fd8(0x15e)];!_0x3c00aa[_0x3d8fd8(0x132)](_0xf92a5d)&&_0x3c00aa[_0x3d8fd8(0xc1)](_0xf92a5d,[]),_0x3c00aa[_0x3d8fd8(0xe9)](_0xf92a5d)['push'](_0x22bf2c);}for(const _0x274610 of _0x3c00aa[_0x3d8fd8(0x150)]()){_0x274610[_0x3d8fd8(0x157)]((_0x5739fe,_0x14853f)=>(_0x5739fe['versionNumber']||0x0)-(_0x14853f[_0x3d8fd8(0x94)]||0x0));}return _0x3c00aa;}export function collectFoldersToCreate(_0xe35593,_0x1726e9){const _0x96a53b=a136_0x3aef17,_0x2366c2=new Set();for(const _0x10ebd6 of _0xe35593){if(!_0x10ebd6)continue;if(_0x1726e9['has'](_0x10ebd6))continue;const _0x4e6308=_0x10ebd6[_0x96a53b(0xec)]('/');let _0xab51e6='';for(const _0x5e4b30 of _0x4e6308){_0xab51e6=_0xab51e6?_0xab51e6+'/'+_0x5e4b30:_0x5e4b30,!_0x1726e9[_0x96a53b(0x132)](_0xab51e6)&&_0x2366c2[_0x96a53b(0x99)](_0xab51e6);}}return _0x2366c2;}export function parseAndClassifyYamlFiles(_0x425130,_0x2e23b3,_0x2cf8c2){const _0x3f6edf=a136_0x3aef17,_0x4dff42=[],_0x5798c9=[];for(const _0x1131af of _0x425130){const _0x3c6fc4=a136_0x2cf61d[_0x3f6edf(0xf6)](_0x2e23b3,a136_0x2cf61d[_0x3f6edf(0xbb)](_0x1131af)),_0x444dea=_0x3c6fc4==='.'?'':_0x3c6fc4,_0x5ddf1f=readFileSync(_0x1131af,_0x3f6edf(0x113)),_0x12f185=a136_0x42129b[_0x3f6edf(0xf3)](_0x5ddf1f);if(isJourneyDef(_0x12f185)){const _0x1fdbf8=a136_0x52b19f(_0x5ddf1f);_0x5798c9[_0x3f6edf(0x18e)]({'yamlConfig':_0x1fdbf8,'folderPath':_0x444dea,'sourcePath':_0x1131af});}else{if(!_0x2cf8c2?.[_0x3f6edf(0xf9)]){const _0x148d64=parseSegmentYamlFile(_0x5ddf1f),_0x13bf62=normalizeChildSegmentYaml(_0x148d64);_0x4dff42['push']({'yamlConfig':_0x13bf62,'folderPath':_0x444dea,'sourcePath':_0x1131af});}}}return{'segments':_0x4dff42,'journeys':_0x5798c9};}export function validateParsedFiles(_0x4e7d62,_0x25101b){const _0x8aa6ac=a136_0x3aef17,_0x3b900e=[];for(const {yamlConfig:_0x210722,sourcePath:_0x19810a}of _0x4e7d62[_0x8aa6ac(0x193)]){const _0x585c7a=readFileSync(_0x19810a,_0x8aa6ac(0x113)),_0x531c19=a136_0x42129b[_0x8aa6ac(0x160)](_0x585c7a),_0x16b479=validateSegmentDef(_0x210722,{'source':_0x585c7a,'document':_0x531c19},{'skipSchema':!![]});if(!_0x16b479[_0x8aa6ac(0x171)]){const _0x45eaf6=a136_0x2cf61d[_0x8aa6ac(0xf6)](_0x25101b,_0x19810a);_0x3b900e[_0x8aa6ac(0x18e)]({'filePath':_0x45eaf6,'source':_0x585c7a,'result':_0x16b479,'isJourney':![]});}}for(const {yamlConfig:_0x54339d,sourcePath:_0x2590d3}of _0x4e7d62[_0x8aa6ac(0x17a)]){const _0x2ab71b=readFileSync(_0x2590d3,'utf-8'),_0x1b7960=a136_0x42129b[_0x8aa6ac(0x160)](_0x2ab71b),_0x1fc705=validateJourneyDef(_0x54339d,{'source':_0x2ab71b,'document':_0x1b7960},{'skipSchema':!![]});if(!_0x1fc705[_0x8aa6ac(0x171)]){const _0x1fb4da=a136_0x2cf61d[_0x8aa6ac(0xf6)](_0x25101b,_0x2590d3);_0x3b900e[_0x8aa6ac(0x18e)]({'filePath':_0x1fb4da,'source':_0x2ab71b,'result':_0x1fc705,'isJourney':!![]});}}return _0x3b900e;}export function formatValidationErrors(_0x1cfb71){const _0x33d4c0=a136_0x3aef17,_0x5a9f20=[];for(const {filePath:_0x158262,source:_0x42829b,result:_0x49f0aa,isJourney:_0x25671e}of _0x1cfb71){const _0x1df9d7=_0x25671e?_0x33d4c0(0xd1):_0x33d4c0(0xa3);_0x5a9f20[_0x33d4c0(0x18e)]('\x0a'+_0x158262+'\x20('+_0x1df9d7+_0x33d4c0(0x11d)+_0x49f0aa[_0x33d4c0(0x199)]['length']+_0x33d4c0(0x119)),_0x5a9f20['push'](formatValidationResult(_0x49f0aa,_0x42829b,_0x158262));}return _0x5a9f20[_0x33d4c0(0x10d)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x201706){const _0x5e2a36=a136_0x3aef17,_0x5651e3=new Set(),_0x5648c8=new Map(),_0x20a0c1=collectSegmentUsageCounts(_0x201706);if(_0x201706[_0x5e2a36(0x193)])for(const [_0x333c82,_0x5c5a42]of Object[_0x5e2a36(0x138)](_0x201706[_0x5e2a36(0x193)])){_0x5651e3[_0x5e2a36(0x99)](_0x333c82);if(_0x5c5a42[_0x5e2a36(0xf0)]){const _0x5fdcd1=yamlRuleToApi(_0x5c5a42[_0x5e2a36(0xf0)]),_0x3b8ec3=apiRuleToYaml(_0x5fdcd1);_0x5648c8[_0x5e2a36(0xc1)](_0x333c82,_0x3b8ec3);}}const _0x1e56ec=new Map();let _0x4479e7=0x0;for(const [_0x1381b1,_0x44b669]of _0x5648c8){const _0x54e5e9=serializeExpandedRule(_0x44b669,_0x5648c8),_0x3f9a0d=_0x1e56ec['get'](_0x54e5e9)||[];_0x3f9a0d[_0x5e2a36(0x18e)]({'name':_0x1381b1,'index':_0x4479e7}),_0x1e56ec[_0x5e2a36(0xc1)](_0x54e5e9,_0x3f9a0d),_0x4479e7++;}const _0x23031a=new Map();for(const [_0x20ef60,_0x5c8018]of _0x1e56ec){const _0x3b5d9c=_0x5c8018[_0x5e2a36(0xd0)]()[_0x5e2a36(0x157)]((_0x2e5b48,_0x49a43c)=>{const _0x27f5f1=_0x5e2a36,_0x42a9b2=_0x20a0c1[_0x27f5f1(0xe9)](_0x2e5b48[_0x27f5f1(0xfc)])||0x0,_0x273912=_0x20a0c1['get'](_0x49a43c[_0x27f5f1(0xfc)])||0x0;if(_0x42a9b2!==_0x273912)return _0x273912-_0x42a9b2;return _0x2e5b48[_0x27f5f1(0x18a)]-_0x49a43c[_0x27f5f1(0x18a)];})[_0x5e2a36(0x144)](_0x44066a=>_0x44066a[_0x5e2a36(0xfc)]),_0xf6834f=[];for(const _0x351061 of _0x3b5d9c){const _0x53bcbe=_0x20a0c1[_0x5e2a36(0xe9)](_0x351061)||0x0,_0x10e392=Math[_0x5e2a36(0x120)](_0x53bcbe,0x1);for(let _0x439882=0x0;_0x439882<_0x10e392;_0x439882++){_0xf6834f[_0x5e2a36(0x18e)](_0x351061);}}_0x23031a[_0x5e2a36(0xc1)](_0x20ef60,_0xf6834f);}return{'existingLocalSegmentNames':_0x5651e3,'localSegmentRules':_0x5648c8,'localExpandedRuleToNames':_0x23031a};}export function createSegmentIdResolver(_0x5aaa6d,_0xff64a9){return async _0x447dfd=>{const _0x36e1aa=a136_0x39b7,_0x108230=_0x5aaa6d[_0x36e1aa(0xe9)](_0x447dfd);if(!_0x108230)throw new SDKError(ErrorCode[_0x36e1aa(0x156)],'Segment\x20not\x20found:\x20'+_0x447dfd+_0x36e1aa(0x111)+_0xff64a9+'\x27)');return _0x108230;};}export function extractRootFolderId(_0x313a96){const _0x391292=a136_0x3aef17;return _0x313a96['relationships']?.[_0x391292(0xac)]?.[_0x391292(0x151)]?.['id']||_0x313a96['relationships']?.['parentFolder']?.[_0x391292(0x151)]?.['id'];}export function buildConnectionMaps(_0x836b62){const _0x2bfa00=a136_0x3aef17,_0x2e4ce8=new Map(),_0x97b11e=new Map(),_0x821cd4=new Map();for(const _0x19c461 of _0x836b62){_0x2e4ce8[_0x2bfa00(0xc1)](_0x19c461['name'],parseInt(_0x19c461['id'],0xa)),_0x97b11e['set'](_0x19c461['id'],_0x19c461[_0x2bfa00(0xfc)]),_0x821cd4[_0x2bfa00(0xc1)](_0x19c461[_0x2bfa00(0xfc)],_0x19c461[_0x2bfa00(0xbe)]);}return{'nameToId':_0x2e4ce8,'idToName':_0x97b11e,'nameToType':_0x821cd4};}export function calculatePushStats(_0x2031f3,_0x415eac,_0x3fe616,_0x280244,_0x1dd6dc,_0x5bcca7,_0x596da0){const _0x474823=a136_0x3aef17,_0x182960=_0x2031f3[_0x474823(0x10e)](_0x340b59=>_0x340b59[_0x474823(0x146)]),_0x5c86d3=_0x2031f3['filter'](_0x133e17=>!_0x133e17['isNew']&&_0x133e17['hasChanges']),_0x3b8069=_0x2031f3[_0x474823(0x10e)](_0x34ed9e=>!_0x34ed9e['isNew']&&!_0x34ed9e['hasChanges']),_0x19bd33=_0x5bcca7?_0x280244:[],_0x620c57=_0x415eac[_0x474823(0x10e)](_0x3a4c61=>_0x3a4c61[_0x474823(0x146)]),_0x3de342=_0x415eac[_0x474823(0x10e)](_0x27be0d=>!_0x27be0d[_0x474823(0x146)]&&_0x27be0d[_0x474823(0xda)]),_0x3db485=_0x415eac[_0x474823(0x10e)](_0x2f5feb=>!_0x2f5feb[_0x474823(0x146)]&&!_0x2f5feb[_0x474823(0xda)]),_0x73f72=_0x5bcca7?_0x1dd6dc:[],_0x1726c3=_0x2031f3['flatMap'](_0x541fb7=>_0x541fb7[_0x474823(0x129)]),_0x3e6bfa=_0x1726c3[_0x474823(0x10e)](_0xb20a14=>_0xb20a14[_0x474823(0xbe)]===_0x474823(0xc2)),_0x102e95=_0x1726c3[_0x474823(0x10e)](_0xd229a5=>_0xd229a5[_0x474823(0xbe)]===_0x474823(0x137)),_0xb86735=_0x1726c3['filter'](_0x13de6a=>_0x13de6a[_0x474823(0xbe)]===_0x474823(0x166)),_0x570aed=Array['from'](_0x3fe616)['sort'](),_0x2f127f=_0x596da0?![]:_0x182960[_0x474823(0x93)]>0x0||_0x5c86d3[_0x474823(0x93)]>0x0||_0x19bd33[_0x474823(0x93)]>0x0,_0x4bbcb6=_0x620c57[_0x474823(0x93)]>0x0||_0x3de342[_0x474823(0x93)]>0x0||_0x73f72[_0x474823(0x93)]>0x0,_0x4a8bd6=_0x596da0?![]:_0x1726c3[_0x474823(0x93)]>0x0,_0x29360b=_0x570aed['length']>0x0;return{'segments':{'new':_0x182960,'changed':_0x5c86d3,'unchanged':_0x3b8069,'toDelete':_0x19bd33},'journeys':{'new':_0x620c57,'changed':_0x3de342,'unchanged':_0x3db485,'toDelete':_0x73f72},'activations':{'all':_0x1726c3,'toCreate':_0x3e6bfa,'toUpdate':_0x102e95,'toDelete':_0xb86735},'folders':{'toCreate':_0x570aed},'counts':{'segments':{'new':_0x182960[_0x474823(0x93)],'changed':_0x5c86d3[_0x474823(0x93)],'unchanged':_0x3b8069[_0x474823(0x93)],'toDelete':_0x19bd33[_0x474823(0x93)]},'journeys':{'new':_0x620c57[_0x474823(0x93)],'changed':_0x3de342[_0x474823(0x93)],'unchanged':_0x3db485[_0x474823(0x93)],'toDelete':_0x73f72['length']},'activations':{'create':_0x3e6bfa[_0x474823(0x93)],'update':_0x102e95[_0x474823(0x93)],'delete':_0xb86735[_0x474823(0x93)]},'folders':_0x570aed[_0x474823(0x93)]},'hasChanges':_0x2f127f||_0x4bbcb6||_0x4a8bd6||_0x29360b};}export async function buildPushExecutionContext(_0x1d5138,_0x3bf6af,_0x1ab10a,_0x43af1d,_0x40ab54,_0x4c1079){const _0x17a9c9=a136_0x3aef17,_0x5c0fd6=extractRootFolderId(_0x1ab10a),{pathToId:_0x207c42,idToPath:_0x3b823d}=buildFolderMaps(_0x40ab54),_0x2674a7=buildSegmentNameToIdMap(_0x43af1d),_0x1ac936=new Map(),{batchAsync:_0x539291}=await import(_0x17a9c9(0xf1)),[_0x3fecb7,_0x1a09ad]=await Promise[_0x17a9c9(0x98)]([_0x1d5138[_0x17a9c9(0x170)]['buildUserMaps'](),_0x1d5138['connection'][_0x17a9c9(0x17f)](),((async()=>{const _0x55afdf=_0x17a9c9;!_0x4c1079&&_0x43af1d[_0x55afdf(0x93)]>0x0&&await _0x539291(_0x43af1d,async _0x312cfc=>{const _0x1ff942=_0x55afdf,_0xc8e223=await _0x1d5138['segment'][_0x1ff942(0x124)](_0x3bf6af,_0x312cfc['id']);_0x1ac936['set'](_0x312cfc['id'],_0xc8e223);});})())]),{emailToId:_0x4bc963,idToEmail:_0x4916f6}=_0x3fecb7,_0xe12ba9=buildConnectionMaps(_0x1a09ad);return{'rootFolderId':_0x5c0fd6,'folderPathToId':_0x207c42,'folderIdToPath':_0x3b823d,'segmentNameToId':_0x2674a7,'activationsBySegmentId':_0x1ac936,'emailToIdMap':_0x4bc963,'idToEmailMap':_0x4916f6,'connectionNameToIdMap':_0xe12ba9[_0x17a9c9(0x192)],'connectionIdToNameMap':_0xe12ba9[_0x17a9c9(0x18d)],'connectionNameToTypeMap':_0xe12ba9[_0x17a9c9(0xcd)]};}export function createPushYamlContextForBundle(_0x26a3e7,_0x733b5d,_0x240240,_0x27bb0f,_0x281d2b,_0x104c0d,_0x421a18,_0x5a795d){const {existingLocalSegmentNames:_0x9857c2,localExpandedRuleToNames:_0x20a1a3}=_0x27bb0f,_0x511da4=new Set(),_0x3e8b03=new Map(),_0x161ded=new Map(),_0x83c44a=new Map(),_0x2b93d8=createJumpTargetCache(),_0x14aba5=new Map(),_0x6a3172=new Map(),_0x29f194=new Set();let _0x1d1da1;const _0x3e84d2=_0x2ce74b=>{const _0x217d86={'resolveSegment':async _0x41e041=>{const _0x4c85e4=a136_0x39b7,_0x114671=_0x83c44a['get'](_0x41e041);if(_0x114671!==undefined)return{'name':_0x114671,'isJourneyLocal':!![]};try{const _0x1ea903=await fetchSegment(_0x26a3e7,_0x733b5d,_0x41e041,_0x240240);if(!_0x1ea903)throw new Error(_0x4c85e4(0x9e));const _0x354e60=generateJourneyLocalName(_0x1ea903[_0x4c85e4(0xfc)]),_0x4a0f98=_0x1ea903['kind']===SEGMENT_KIND_JOURNEY&&_0x354e60!==undefined;let _0x1a6242=_0x1ea903[_0x4c85e4(0xfc)],_0x407e65;if(_0x4a0f98&&_0x1ea903[_0x4c85e4(0xf0)]){const _0x109431=apiRuleToYaml(_0x1ea903[_0x4c85e4(0xf0)]);_0x6a3172['set'](_0x41e041,_0x109431);const _0x2e5a04=async _0x3c7d31=>{const _0x29f189=_0x4c85e4,_0x2ec105=collectSegmentRefsFromRule(_0x3c7d31);for(const _0x3c3493 of _0x2ec105){if(!_0x6a3172[_0x29f189(0x132)](_0x3c3493))try{const _0x285880=await fetchSegment(_0x26a3e7,_0x733b5d,_0x3c3493,_0x240240);if(_0x285880?.[_0x29f189(0xf0)]){const _0x5171fb=apiRuleToYaml(_0x285880['rule']);_0x6a3172[_0x29f189(0xc1)](_0x3c3493,_0x5171fb),await _0x2e5a04(_0x5171fb);}}catch(_0x41294f){logger[_0x29f189(0x101)](_0x29f189(0x91)+_0x3c3493+':\x20'+_0x41294f);}}};await _0x2e5a04(_0x109431);const _0x5a87fd=serializeExpandedRule(_0x109431,_0x6a3172),_0x13cec6=_0x20a1a3[_0x4c85e4(0xe9)](_0x5a87fd);if(_0x13cec6&&_0x13cec6[_0x4c85e4(0x93)]>0x0){const _0x2185b2=_0x3e8b03['get'](_0x5a87fd)||0x0,_0x5dc677=_0x13cec6[_0x2185b2]||_0x13cec6[_0x13cec6[_0x4c85e4(0x93)]-0x1];_0x3e8b03[_0x4c85e4(0xc1)](_0x5a87fd,_0x2185b2+0x1),_0x1a6242=_0x5dc677,_0x511da4[_0x4c85e4(0x99)](_0x1a6242),_0x83c44a['set'](_0x41e041,_0x1a6242);const _0x2421cb=await resolveRuleSegmentRefs(_0x109431,async _0x415507=>{const _0x5ced94=_0x4c85e4,_0x4e7ce2=_0x83c44a[_0x5ced94(0xe9)](_0x415507);if(_0x4e7ce2)return _0x4e7ce2;const _0x49ed1e=await _0x1d1da1['resolveSegment'](_0x415507);return _0x49ed1e[_0x5ced94(0xfc)];});_0x407e65={'description':_0x1ea903[_0x4c85e4(0x16b)],'rule':_0x2421cb};}else{const _0x508cc0=_0x14aba5[_0x4c85e4(0xe9)](_0x5a87fd);if(_0x508cc0)_0x1a6242=_0x508cc0,_0x83c44a[_0x4c85e4(0xc1)](_0x41e041,_0x1a6242);else{if(_0x354e60){let _0x569572=_0x354e60,_0x14b4d4=0x2;while(_0x511da4[_0x4c85e4(0x132)](_0x569572)||_0x9857c2[_0x4c85e4(0x132)](_0x569572)){_0x569572=_0x354e60+'_'+_0x14b4d4,_0x14b4d4++;}_0x511da4['add'](_0x569572),_0x1a6242=_0x569572;}_0x83c44a[_0x4c85e4(0xc1)](_0x41e041,_0x1a6242),_0x14aba5[_0x4c85e4(0xc1)](_0x5a87fd,_0x1a6242);const _0x408772=await resolveRuleSegmentRefs(_0x109431,async _0x508c09=>{const _0x5c2d82=_0x4c85e4,_0x4d6b6e=_0x83c44a[_0x5c2d82(0xe9)](_0x508c09);if(_0x4d6b6e)return _0x4d6b6e;const _0x3d7144=await _0x1d1da1['resolveSegment'](_0x508c09);return _0x3d7144[_0x5c2d82(0xfc)];});_0x407e65={'description':_0x1ea903[_0x4c85e4(0x16b)],'rule':_0x408772};}}}return{'name':_0x1a6242,'isJourneyLocal':_0x4a0f98,'definition':_0x407e65};}catch(_0x137a26){return logger[_0x4c85e4(0x101)](_0x4c85e4(0xce)+_0x41e041+':\x20'+_0x137a26),{'name':_0x41e041,'isJourneyLocal':![]};}},'resolveActivation':async _0x41622a=>{const _0x250713=a136_0x39b7,_0x165d05=_0x161ded[_0x250713(0xe9)](_0x41622a);if(_0x165d05!==undefined)return{'name':_0x165d05,'isJourneyLocal':!![]};try{let _0x2298e7=_0x421a18?.[_0x250713(0xe9)](_0x41622a);!_0x2298e7&&(_0x2298e7=await _0x26a3e7[_0x250713(0xd1)][_0x250713(0x100)](_0x2ce74b,_0x41622a));const _0x29a358=_0x2298e7[_0x250713(0x169)][_0x250713(0x18b)][_0x250713(0xfc)]||_0x41622a,_0x568d8b=sanitizeYamlKey(_0x29a358)||'activation_'+_0x41622a,_0x191938=_0x568d8b;_0x161ded['set'](_0x41622a,_0x191938);const _0x1b32c6=journeyActivationStepToYaml(_0x2298e7,_0x281d2b,_0x104c0d);return{'name':_0x191938,'isJourneyLocal':!![],'definition':_0x1b32c6};}catch(_0x2baa2b){return logger[_0x250713(0x101)]('Failed\x20to\x20resolve\x20activation\x20'+_0x41622a+':\x20'+_0x2baa2b),{'name':_0x41622a,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x476b7a,_0x54e8ad)=>resolveJumpTarget(_0x476b7a,_0x54e8ad,_0x2b93d8,async _0x5e75af=>{const _0x52adbe=a136_0x39b7,_0x1d4102=_0x5a795d?.['get'](_0x5e75af);if(_0x1d4102)return _0x1d4102;return _0x26a3e7[_0x52adbe(0xd1)]['getJourney'](_0x5e75af);})};return _0x1d1da1=_0x217d86,_0x217d86;},_0x20891b=async _0x53b4ef=>{const _0x2a23f8=a136_0x39b7,{collectSegmentIdsFromJourneyApi:_0x3e9b0f}=await import(_0x2a23f8(0x104)),{batchAsync:_0x413113}=await import('../../utils/async.js'),_0x39c801=new Set();for(const _0x3a831e of _0x53b4ef){let _0x29a586=_0x5a795d?.[_0x2a23f8(0xe9)](_0x3a831e);!_0x29a586&&(_0x29a586=await _0x26a3e7['journey'][_0x2a23f8(0x13f)](_0x3a831e));const _0x86bbb1=_0x3e9b0f(_0x29a586);for(const _0x20e7ef of _0x86bbb1){_0x39c801[_0x2a23f8(0x99)](_0x20e7ef);}}let _0x26dac4=Array[_0x2a23f8(0xed)](_0x39c801);while(_0x26dac4[_0x2a23f8(0x93)]>0x0){const _0x730cbf=_0x26dac4[_0x2a23f8(0x10e)](_0x5548ba=>!_0x29f194[_0x2a23f8(0x132)](_0x5548ba));if(_0x730cbf[_0x2a23f8(0x93)]===0x0)break;const _0x15e1ae=await _0x413113(_0x730cbf,async _0x2eb899=>{const _0x29b85f=_0x2a23f8;_0x29f194[_0x29b85f(0x99)](_0x2eb899);const _0x1e424e=await fetchSegment(_0x26a3e7,_0x733b5d,_0x2eb899,_0x240240);if(!_0x1e424e)return null;return{'segmentId':_0x2eb899,'segment':_0x1e424e};},0xa),_0x161ac3=new Set();for(const _0x166bfe of _0x15e1ae){if(!_0x166bfe?.[_0x2a23f8(0xa3)]?.[_0x2a23f8(0xf0)])continue;const _0x422c0c=apiRuleToYaml(_0x166bfe[_0x2a23f8(0xa3)][_0x2a23f8(0xf0)]);_0x6a3172[_0x2a23f8(0xc1)](_0x166bfe[_0x2a23f8(0x12c)],_0x422c0c);const _0x366493=collectSegmentRefsFromRule(_0x422c0c);for(const _0x1345ef of _0x366493){!_0x29f194[_0x2a23f8(0x132)](_0x1345ef)&&_0x161ac3[_0x2a23f8(0x99)](_0x1345ef);}}_0x26dac4=Array[_0x2a23f8(0xed)](_0x161ac3);}};return{'createYamlContext':_0x3e84d2,'prefetchJourneySegments':_0x20891b};}export async function executePushSegments(_0x56b03b,_0x43ad8c,_0x430813,_0x12b931,_0xae6e51){const _0x2b433a=a136_0x3aef17,{segmentDefToCreateRequest:_0xeac0a3,segmentDefToUpdateRequest:_0x3b2c34}=await import(_0x2b433a(0x145)),_0x10b75d=_0x430813[_0x2b433a(0xd7)],_0x1a0dd1=0x5,_0x394fa3=async _0x2141e9=>{const _0x2f6b08=_0x2b433a,_0x36179d=_0x2141e9['folderPath']?_0x10b75d[_0x2f6b08(0xe9)](_0x2141e9[_0x2f6b08(0x122)]):undefined;let _0x6ef5c1;const _0x309f5e={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x4ccad5=_0x2141e9[_0x2f6b08(0xb7)];if(_0x2141e9[_0x2f6b08(0xb7)]['rule']){const _0x310104=createSegmentIdResolver(_0x430813[_0x2f6b08(0x155)],_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]),_0x45e8a4=await resolveRuleSegmentIds(_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xf0)],_0x310104);_0x4ccad5={..._0x2141e9[_0x2f6b08(0xb7)],'rule':_0x45e8a4};}try{if(_0x2141e9[_0x2f6b08(0x146)]){_0xae6e51[_0x2f6b08(0x18f)]?.({'type':_0x2f6b08(0xd3),'name':_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]});const _0xeace0a=_0xeac0a3(_0x4ccad5,_0x36179d),_0x2a572c=await _0xae6e51[_0x2f6b08(0x14a)](_0x2f6b08(0x173)+_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]+_0x2f6b08(0x195),()=>_0x56b03b['segment']['createSegment'](_0x12b931[_0x2f6b08(0x126)],_0xeace0a));_0x6ef5c1=_0x2a572c['data']['id'],_0x430813[_0x2f6b08(0x155)][_0x2f6b08(0xc1)](_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)],_0x6ef5c1),_0x309f5e[_0x2f6b08(0x187)]={'name':_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)],'id':_0x6ef5c1},_0xae6e51[_0x2f6b08(0x18f)]?.({'type':_0x2f6b08(0xaf),'name':_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)],'segmentId':_0x6ef5c1}),_0xae6e51[_0x2f6b08(0x12d)]?.('Created\x20segment\x20\x27'+_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)]+'\x27'),_0x309f5e[_0x2f6b08(0x133)]=0x1;}else{if(_0x2141e9[_0x2f6b08(0xda)]){_0xae6e51[_0x2f6b08(0x18f)]?.({'type':'segment_updating','name':_0x2141e9[_0x2f6b08(0xb7)]['name']});const _0x9a8803=_0x3b2c34(_0x4ccad5);_0x36179d!==_0x2141e9[_0x2f6b08(0x183)]?.[_0x2f6b08(0x149)]&&(_0x9a8803[_0x2f6b08(0x149)]=_0x36179d?parseInt(_0x36179d,0xa):undefined),await _0xae6e51[_0x2f6b08(0x14a)](_0x2f6b08(0x194)+_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]+'\x27...',()=>_0x56b03b[_0x2f6b08(0xa3)][_0x2f6b08(0xc5)](_0x12b931['parentId'],_0x2141e9[_0x2f6b08(0x183)]['id'],_0x9a8803)),_0x6ef5c1=_0x2141e9[_0x2f6b08(0x183)]['id'],_0xae6e51[_0x2f6b08(0x18f)]?.({'type':'segment_updated','name':_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]}),_0xae6e51['logSuccess']?.('Updated\x20segment\x20\x27'+_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)]+'\x27'),_0x309f5e['updated']=0x1;}else _0x6ef5c1=_0x2141e9[_0x2f6b08(0x183)]['id'];}}catch(_0x4f4321){const _0x3ee230=isHttp400Error(_0x4f4321),_0x2800ee=_0x3ee230?ErrorCode[_0x2f6b08(0xd9)]:ErrorCode[_0x2f6b08(0xf5)],_0x3141f8=getErrorMessage(_0x4f4321);throw new SDKError(_0x2800ee,_0x2f6b08(0xb9)+(_0x2141e9['isNew']?_0x2f6b08(0xc2):_0x2f6b08(0x137))+_0x2f6b08(0xde)+_0x2141e9[_0x2f6b08(0xf4)]+'\x0a\x20\x20'+_0x3141f8,_0x4f4321);}try{const _0x1e729d=await syncActivationsForSegment(_0x56b03b,_0x12b931['parentId'],_0x6ef5c1,_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)],_0x2141e9[_0x2f6b08(0x129)],_0xae6e51,_0x2141e9['absolutePath']);_0x309f5e[_0x2f6b08(0xa1)]=_0x1e729d;}catch(_0x252161){if(_0x252161 instanceof SDKError)throw _0x252161;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x2f6b08(0xeb)+_0x2141e9[_0x2f6b08(0xb7)]['name']+_0x2f6b08(0x15b)+_0x2141e9['absolutePath']+_0x2f6b08(0x9b)+getErrorMessage(_0x252161),_0x252161);}return _0x309f5e;},_0x5500b9=await batchAsync(_0x43ad8c,_0x394fa3,_0x1a0dd1),_0x551f4a={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x5aed5d of _0x5500b9){_0x551f4a[_0x2b433a(0x133)]+=_0x5aed5d['created'],_0x551f4a['updated']+=_0x5aed5d['updated'],_0x5aed5d[_0x2b433a(0x187)]&&_0x551f4a[_0x2b433a(0xa6)]['set'](_0x5aed5d[_0x2b433a(0x187)][_0x2b433a(0xfc)],_0x5aed5d[_0x2b433a(0x187)]['id']),_0x551f4a[_0x2b433a(0xa1)][_0x2b433a(0x133)]+=_0x5aed5d[_0x2b433a(0xa1)][_0x2b433a(0x133)],_0x551f4a[_0x2b433a(0xa1)][_0x2b433a(0xca)]+=_0x5aed5d[_0x2b433a(0xa1)]['updated'],_0x551f4a[_0x2b433a(0xa1)][_0x2b433a(0x15f)]+=_0x5aed5d[_0x2b433a(0xa1)][_0x2b433a(0x15f)];}return _0x551f4a;}async function syncActivationsForSegment(_0xe64274,_0x33e7fb,_0x548dba,_0x47cd7e,_0x235ea2,_0x5ae290,_0x196785){const _0xf7547=a136_0x3aef17,_0x4c96f={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x3d56a6 of _0x235ea2){try{if(_0x3d56a6['type']===_0xf7547(0xc2)&&_0x3d56a6[_0xf7547(0x10f)])_0x5ae290[_0xf7547(0x18f)]?.({'type':_0xf7547(0x110),'segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),await _0x5ae290[_0xf7547(0x14a)](_0xf7547(0xe7)+_0x3d56a6[_0xf7547(0xfc)]+'\x27...',()=>_0xe64274['segment'][_0xf7547(0xbf)](_0x33e7fb,_0x548dba,_0x3d56a6['validatedRequest'])),_0x5ae290[_0xf7547(0x18f)]?.({'type':'activation_created','segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),_0x5ae290[_0xf7547(0x12d)]?.(_0xf7547(0xa8)+_0x3d56a6['name']+'\x27'),_0x4c96f['created']++;else{if(_0x3d56a6[_0xf7547(0xbe)]===_0xf7547(0x137)&&_0x3d56a6[_0xf7547(0x10f)]&&_0x3d56a6[_0xf7547(0x164)])_0x5ae290[_0xf7547(0x18f)]?.({'type':'activation_updating','segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),await _0x5ae290[_0xf7547(0x14a)](_0xf7547(0x17d)+_0x3d56a6['name']+_0xf7547(0x195),()=>_0xe64274[_0xf7547(0xa3)]['updateActivation'](_0x33e7fb,_0x548dba,_0x3d56a6[_0xf7547(0x164)]['id'],_0x3d56a6[_0xf7547(0x10f)])),_0x5ae290[_0xf7547(0x18f)]?.({'type':_0xf7547(0x125),'segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),_0x5ae290[_0xf7547(0x12d)]?.('Updated\x20activation\x20\x27'+_0x3d56a6['name']+'\x27'),_0x4c96f[_0xf7547(0xca)]++;else _0x3d56a6['type']===_0xf7547(0x166)&&_0x3d56a6[_0xf7547(0x164)]&&(_0x5ae290[_0xf7547(0x18f)]?.({'type':_0xf7547(0x184),'segmentName':_0x47cd7e,'activationName':_0x3d56a6['name']}),await _0x5ae290[_0xf7547(0x14a)](_0xf7547(0xff)+_0x3d56a6[_0xf7547(0xfc)]+'\x27...',()=>_0xe64274[_0xf7547(0xa3)]['deleteActivation'](_0x33e7fb,_0x548dba,_0x3d56a6[_0xf7547(0x164)]['id'])),_0x5ae290['onProgress']?.({'type':_0xf7547(0x10c),'segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),_0x5ae290[_0xf7547(0x178)]?.(_0xf7547(0xb4)+_0x3d56a6['name']+'\x27'),_0x4c96f[_0xf7547(0x15f)]++);}}catch(_0x3d0f3a){const _0x4e1c59=isHttp400Error(_0x3d0f3a),_0x2605f7=_0x4e1c59?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0xf7547(0x17e)],_0x3bc20c=getErrorMessage(_0x3d0f3a);throw new SDKError(_0x2605f7,_0xf7547(0xb9)+_0x3d56a6[_0xf7547(0xbe)]+_0xf7547(0x158)+_0x3d56a6[_0xf7547(0xfc)]+'\x27\x20from\x20file:\x20'+_0x196785+'\x0a\x20\x20'+_0x3bc20c,_0x3d0f3a);}}return _0x4c96f;}export async function executePushFolders(_0x37a9ef,_0x41804c,_0x3f20f6,_0x5ed847,_0x2b9bd4){const _0x5187b1=a136_0x3aef17,_0x26ccac=new Map(_0x3f20f6),_0x5ae514=sortFoldersByDepth(_0x41804c);for(const _0xc22000 of _0x5ae514){const _0x53beea=_0xc22000['split']('/'),_0x2e7ad0=_0x53beea[_0x53beea[_0x5187b1(0x93)]-0x1],_0x2d07a7=_0x53beea['slice'](0x0,-0x1)[_0x5187b1(0x10d)]('/'),_0x398b26=_0x26ccac[_0x5187b1(0xe9)](_0x2d07a7);_0x2b9bd4['onProgress']?.({'type':_0x5187b1(0xe2),'folder':_0xc22000});const _0x1f1375={'name':_0x2e7ad0,'parentFolderId':_0x398b26},_0x1ee934=await _0x2b9bd4[_0x5187b1(0x14a)](_0x5187b1(0x161)+_0xc22000+_0x5187b1(0x195),()=>_0x37a9ef['segment'][_0x5187b1(0x15d)](_0x5ed847[_0x5187b1(0x126)],_0x1f1375));_0x26ccac['set'](_0xc22000,_0x1ee934[_0x5187b1(0x151)]['id']),_0x2b9bd4[_0x5187b1(0x18f)]?.({'type':'folder_created','folder':_0xc22000,'folderId':_0x1ee934[_0x5187b1(0x151)]['id']}),_0x2b9bd4['logInfo']?.('Created\x20folder\x20\x27'+_0xc22000+'\x27');}return _0x26ccac;}export async function executePushSegmentDeletions(_0x21f847,_0x3e04fa,_0x382ec4){const _0x490b6c=a136_0x3aef17;if(_0x3e04fa[_0x490b6c(0x93)]===0x0)return 0x0;const {batchAsync:_0x48aac2}=await import(_0x490b6c(0xf1)),_0x7625a4=0x5,_0x297cdb=await _0x48aac2(_0x3e04fa,async _0x3bd0d2=>{const _0x48f733=_0x490b6c;return _0x382ec4[_0x48f733(0x18f)]?.({'type':_0x48f733(0xc7),'name':_0x3bd0d2[_0x48f733(0xfc)]}),await _0x21f847['segment'][_0x48f733(0x191)](_0x3bd0d2['id']),_0x382ec4[_0x48f733(0x18f)]?.({'type':_0x48f733(0x14e),'name':_0x3bd0d2[_0x48f733(0xfc)]}),_0x382ec4['logDeleted']?.(_0x48f733(0x147)+_0x3bd0d2[_0x48f733(0xfc)]+'\x27'),0x1;},_0x7625a4);return _0x297cdb[_0x490b6c(0x11b)]((_0x4d5bb8,_0x4ca3f8)=>_0x4d5bb8+_0x4ca3f8,0x0);}export async function executePushJourneys(_0x581a02,_0x495535,_0x407c5f,_0x16f38b,_0x207705){const _0x33b8d0=a136_0x3aef17,{journeyDefToRequest:_0x1cb273}=await import(_0x33b8d0(0x104)),{activationDefToCreateRequest:_0x54668e,yamlRuleToApi:_0x2e68df,validateSegmentRule:_0x2e9c0a}=await import(_0x33b8d0(0x145)),_0x186083={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x383aae=new Map(_0x407c5f['segmentNameToId']),_0x429a0e=0x5;for(let _0x438a5f=0x0;_0x438a5f<_0x495535[_0x33b8d0(0x93)];_0x438a5f+=_0x429a0e){const _0x34488c=_0x495535[_0x33b8d0(0xd0)](_0x438a5f,_0x438a5f+_0x429a0e),_0x57611c=await Promise[_0x33b8d0(0x98)](_0x34488c[_0x33b8d0(0x144)](async _0x167b47=>{const _0x274e0b=_0x33b8d0;if(!_0x167b47[_0x274e0b(0x146)]&&!_0x167b47['hasChanges'])return{'action':_0x274e0b(0xe1),'name':_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)],'journeyId':_0x167b47[_0x274e0b(0x14d)]?.['id']};const _0x33d8cb=_0x167b47[_0x274e0b(0x122)]?_0x407c5f[_0x274e0b(0xd7)]['get'](_0x167b47[_0x274e0b(0x122)]):undefined;_0x207705['onProgress']?.({'type':_0x167b47[_0x274e0b(0x146)]?_0x274e0b(0xc6):_0x274e0b(0xf7),'name':_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)]});try{const _0x52f1ff=await executeSingleJourneyPush(_0x581a02,_0x167b47,{..._0x407c5f,'segmentNameToId':_0x383aae},{'parentId':_0x16f38b[_0x274e0b(0x126)],'rootFolderId':_0x16f38b[_0x274e0b(0x197)],'folderId':_0x33d8cb,'verbose':_0x16f38b[_0x274e0b(0x14f)]},_0x207705,{'journeyDefToRequest':_0x1cb273,'activationDefToCreateRequest':_0x54668e,'yamlRuleToApi':_0x2e68df,'validateSegmentRule':_0x2e9c0a});for(const [_0x57a1aa,_0x5b97b1]of _0x52f1ff[_0x274e0b(0xd5)]){_0x383aae['set'](_0x57a1aa,_0x5b97b1),_0x186083[_0x274e0b(0xd5)][_0x274e0b(0xc1)](_0x57a1aa,_0x5b97b1);}if(_0x52f1ff[_0x274e0b(0x165)]===_0x274e0b(0x133))_0x207705[_0x274e0b(0x18f)]?.({'type':_0x274e0b(0xb0),'name':_0x167b47['yamlConfig']['name'],'journeyId':_0x52f1ff[_0x274e0b(0xd6)]}),_0x207705[_0x274e0b(0x12d)]?.(_0x274e0b(0x102)+_0x167b47[_0x274e0b(0xb7)]['name']+'\x27'),_0x186083[_0x274e0b(0x133)]++;else _0x52f1ff['action']===_0x274e0b(0xca)&&(_0x207705[_0x274e0b(0x18f)]?.({'type':_0x274e0b(0x179),'name':_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)]}),_0x207705[_0x274e0b(0x12d)]?.(_0x274e0b(0xbd)+_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)]+'\x27'),_0x186083[_0x274e0b(0xca)]++);return{'action':_0x52f1ff[_0x274e0b(0x165)],'name':_0x167b47[_0x274e0b(0xb7)]['name'],'journeyId':_0x52f1ff['journeyId']};}catch(_0x2e7051){const _0xe5e043=isHttp400Error(_0x2e7051),_0x4ec547=_0xe5e043?ErrorCode[_0x274e0b(0x13b)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x23af95=getErrorMessage(_0x2e7051);throw new SDKError(_0x4ec547,_0x274e0b(0xb9)+(_0x167b47[_0x274e0b(0x146)]?_0x274e0b(0xc2):_0x274e0b(0x137))+_0x274e0b(0x117)+_0x167b47[_0x274e0b(0xf4)]+'\x0a\x20\x20'+_0x23af95,_0x2e7051);}}));_0x186083[_0x33b8d0(0x9d)][_0x33b8d0(0x18e)](..._0x57611c);}return _0x186083;}async function matchExistingJourneySegments(_0x500d69,_0x3a23e3,_0x478fee,_0x44ab42,_0x1f6159){const _0x2674d8=a136_0x3aef17;if(!_0x3a23e3[_0x2674d8(0x14d)]||!_0x3a23e3[_0x2674d8(0xb7)]['segments'])return;const _0x484502=new Map(),_0x204ac9=new Set();for(const _0x4126c8 of Object[_0x2674d8(0x167)](_0x3a23e3[_0x2674d8(0xb7)][_0x2674d8(0x193)])){const _0x34f9e1=generateDeterministicJourneySegmentName(_0x3a23e3[_0x2674d8(0xb7)]['name'],_0x4126c8);_0x484502[_0x2674d8(0xc1)](_0x34f9e1,_0x4126c8),_0x204ac9['add'](_0x4126c8);}const _0x16b81d=[],_0x3bfff8=collectSegmentIdsFromJourneyApi(_0x3a23e3['existingJourney']);for(const _0x443fbd of _0x3bfff8){const _0x1118c4=await fetchSegment(_0x500d69,_0x478fee,_0x443fbd,_0x44ab42);if(!_0x1118c4?.[_0x2674d8(0xfc)])continue;const _0x4a33de=_0x484502['get'](_0x1118c4['name']);_0x4a33de?(_0x1f6159[_0x2674d8(0xc1)](_0x4a33de,_0x443fbd),_0x204ac9[_0x2674d8(0x166)](_0x4a33de)):_0x16b81d[_0x2674d8(0x18e)]({'id':_0x443fbd,'seg':_0x1118c4});}if(_0x204ac9[_0x2674d8(0x130)]>0x0&&_0x16b81d['length']>0x0){const {localExpandedRuleToNames:_0x136076}=buildLocalExpandedRuleMappings(_0x3a23e3[_0x2674d8(0xb7)]),_0x3d982a=new Map();for(const {id:_0x46528c,seg:_0x2cb712}of _0x16b81d){if(_0x2cb712[_0x2674d8(0xf0)]){const _0x218298=apiRuleToYaml(_0x2cb712['rule']);_0x3d982a[_0x2674d8(0xc1)](_0x46528c,_0x218298);}}for(const {id:_0x2816a3,seg:_0x49374e}of _0x16b81d){if(!_0x49374e['rule'])continue;const _0x20ac6c=_0x3d982a[_0x2674d8(0xe9)](_0x2816a3);if(!_0x20ac6c)continue;const _0x17323f=serializeExpandedRule(_0x20ac6c,_0x3d982a),_0x17499e=_0x136076[_0x2674d8(0xe9)](_0x17323f);if(_0x17499e){const _0x2e2d33=_0x17499e['find'](_0x4870b3=>_0x204ac9[_0x2674d8(0x132)](_0x4870b3));_0x2e2d33&&(_0x1f6159[_0x2674d8(0xc1)](_0x2e2d33,_0x2816a3),_0x204ac9[_0x2674d8(0x166)](_0x2e2d33),logger[_0x2674d8(0x101)](_0x2674d8(0x15c)+_0x49374e[_0x2674d8(0xfc)]+_0x2674d8(0xf8)+_0x2e2d33+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x37cc08,_0x1f191e,_0x324b05,_0x29f4c3,_0x3e4b26,_0x3e050f){const _0x4bccec=a136_0x3aef17,{journeyDefToRequest:_0x56d866,activationDefToCreateRequest:_0x442255,yamlRuleToApi:_0x30da48,validateSegmentRule:_0x4e16b3}=_0x3e050f,_0x37eb69=new Map(),_0x18f31d=new Map();recoverSegmentIdsFromPushRecovery(_0x1f191e,_0x37eb69,_0x324b05['segmentNameToId']);const _0x5ce731=new Map(),_0x6d7011=new Map(),_0x20dbab=new Map();let _0x2b1730;const _0x4967ea=async()=>{const _0xf0ab15=a136_0x39b7;if(_0x2b1730)return;_0x2b1730=new Map();if(!_0x1f191e[_0xf0ab15(0x14d)])return;const _0x451a02=await _0x37cc08[_0xf0ab15(0xd1)]['listActivations'](_0x1f191e['existingJourney']['id']);for(const _0x3f2c7d of _0x451a02){const _0x5201f7=journeyActivationStepToYaml(_0x3f2c7d,_0x324b05[_0xf0ab15(0xb2)],_0x324b05['connectionIdToNameMap']),_0x497e52=activationSignature(_0x5201f7);!_0x2b1730['has'](_0x497e52)&&_0x2b1730['set'](_0x497e52,_0x3f2c7d['id']),_0x5201f7[_0xf0ab15(0xfc)]&&_0x18f31d['set'](_0x5201f7[_0xf0ab15(0xfc)],_0x3f2c7d['id']);}};await matchExistingJourneySegments(_0x37cc08,_0x1f191e,_0x29f4c3[_0x4bccec(0x126)],_0x324b05[_0x4bccec(0x12b)],_0x324b05[_0x4bccec(0x155)]);const _0x5c588b={'resolveSegmentId':async _0x1eeec4=>{const _0x440c6a=_0x4bccec,_0x54c7ef=_0x324b05[_0x440c6a(0x155)][_0x440c6a(0xe9)](_0x1eeec4);if(!_0x54c7ef)throw new SDKError(ErrorCode[_0x440c6a(0x156)],_0x440c6a(0xba)+_0x1eeec4+_0x440c6a(0x180)+_0x1f191e[_0x440c6a(0xb7)]['name']+')');return _0x54c7ef;},'resolveEmbeddedSegmentId':async(_0x4c683a,_0x220b45)=>{const _0x2331f7=_0x4bccec,_0x5af733=_0x324b05[_0x2331f7(0x155)]['get'](_0x4c683a);if(_0x5af733)return _0x5af733;const _0x54f891=_0x324b05[_0x2331f7(0x12b)][_0x2331f7(0x135)](_0x3ae1e2=>_0x3ae1e2[_0x2331f7(0xfc)]===_0x4c683a);if(_0x54f891)return _0x324b05[_0x2331f7(0x155)]['set'](_0x4c683a,_0x54f891['id']),_0x54f891['id'];if(_0x1f191e[_0x2331f7(0x146)]){const {stageName:_0x4a048e,criteriaName:_0x2540b}=findSegmentCriteriaLocation(_0x1f191e[_0x2331f7(0xb7)],_0x4c683a);return _0x4e16b3(_0x4c683a,_0x220b45[_0x2331f7(0xf0)]),_0x6d7011['set'](_0x4c683a,{'definition':_0x220b45,'stageName':_0x4a048e,'criteriaName':_0x2540b}),createPendingSegmentId(_0x4c683a);}const _0x3b737a=_0x1f191e['existingJourney']?.['id'];if(!_0x3b737a)throw new SDKError(ErrorCode['INTERNAL'],_0x2331f7(0x16e));const _0x545431=_0x5ce731[_0x2331f7(0xe9)](_0x4c683a);if(_0x545431)return _0x545431;const _0x56e113=((async()=>{const _0x253958=_0x2331f7;_0x4e16b3(_0x4c683a,_0x220b45['rule']);const _0x24c0bf=generateDeterministicJourneySegmentName(_0x1f191e[_0x253958(0xb7)][_0x253958(0xfc)],_0x4c683a),_0x2ad4b0=_0x324b05['existingSegments']['find'](_0x36118b=>_0x36118b[_0x253958(0xfc)]===_0x24c0bf),_0x2da448=createSegmentIdResolver(_0x324b05['segmentNameToId'],_0x4c683a),_0x2bc6e7=await resolveRuleSegmentIds(_0x220b45[_0x253958(0xf0)],_0x2da448);let _0x3aad13;return _0x2ad4b0?(await _0x37cc08[_0x253958(0xa3)][_0x253958(0xc5)](_0x29f4c3[_0x253958(0x126)],_0x2ad4b0['id'],{'description':_0x220b45[_0x253958(0x16b)]||_0x253958(0xa0)+_0x4c683a,'rule':_0x30da48(_0x2bc6e7,!![]),'countPopulation':!![]}),_0x3aad13=_0x2ad4b0['id'],saveSegmentToPushRecovery(_0x1f191e[_0x253958(0xf4)],_0x1f191e['yamlConfig'][_0x253958(0xfc)],_0x4c683a,{'segmentId':_0x3aad13,'uniqueServerName':_0x24c0bf,'createdAt':new Date()['toISOString']()})):_0x3aad13=await createOrRecoverEmbeddedSegment(_0x37cc08,_0x1f191e,{'localName':_0x4c683a,'uniqueSegmentName':_0x24c0bf,'description':_0x220b45[_0x253958(0x16b)]||'Entry\x20criteria:\x20'+_0x4c683a,'journeyId':_0x3b737a,'resolvedRule':_0x2bc6e7,'parentId':_0x29f4c3[_0x253958(0x126)],'folderId':_0x29f4c3['rootFolderId']||''},_0x30da48),_0x324b05[_0x253958(0x155)][_0x253958(0xc1)](_0x4c683a,_0x3aad13),_0x37eb69['set'](_0x4c683a,_0x3aad13),_0x3aad13;})());_0x5ce731[_0x2331f7(0xc1)](_0x4c683a,_0x56e113);try{return await _0x56e113;}finally{_0x5ce731[_0x2331f7(0x166)](_0x4c683a);}},'resolveActivationId':async _0x5c04a2=>{const _0x5973dc=_0x4bccec,_0x71942b=_0x18f31d['get'](_0x5c04a2);if(_0x71942b)return _0x71942b;if(_0x1f191e[_0x5973dc(0x14d)]){await _0x4967ea();const _0x560747=_0x18f31d[_0x5973dc(0xe9)](_0x5c04a2);if(_0x560747)return _0x560747;}throw new SDKError(ErrorCode[_0x5973dc(0xd8)],_0x5973dc(0xd2)+_0x5c04a2+_0x5973dc(0x180)+_0x1f191e[_0x5973dc(0xb7)][_0x5973dc(0xfc)]+_0x5973dc(0x16a)+_0x5973dc(0x182));},'resolveEmbeddedActivationId':async(_0x5c2663,_0x33af14)=>{const _0x314b88=_0x4bccec,_0x50b792=_0x18f31d[_0x314b88(0xe9)](_0x5c2663);if(_0x50b792)return _0x50b792;if(_0x1f191e[_0x314b88(0x146)])return _0x20dbab['set'](_0x5c2663,_0x33af14),createPendingActivationId(_0x5c2663);if(_0x1f191e[_0x314b88(0x14d)]){await _0x4967ea();const _0xcf727a=_0x18f31d['get'](_0x33af14['name']);if(_0xcf727a)return _0x18f31d[_0x314b88(0xc1)](_0x5c2663,_0xcf727a),_0xcf727a;const _0x5ac48f=activationSignature(_0x33af14),_0x425294=_0x2b1730?.[_0x314b88(0xe9)](_0x5ac48f);if(_0x425294)return _0x18f31d[_0x314b88(0xc1)](_0x5c2663,_0x425294),_0x425294;const _0x40c106=await _0x442255(_0x33af14,_0x324b05[_0x314b88(0xa5)]),_0x2d17ae={..._0x40c106,..._0x33af14[_0x314b88(0x121)]!==undefined&&{'runAfterJourneyRefresh':_0x33af14[_0x314b88(0x121)]}},_0x40bd14=await _0x37cc08[_0x314b88(0xd1)][_0x314b88(0xbf)](_0x1f191e[_0x314b88(0x14d)]['id'],_0x2d17ae);return _0x18f31d['set'](_0x5c2663,_0x40bd14['id']),_0x40bd14['id'];}throw new SDKError(ErrorCode[_0x314b88(0xdb)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x4d9a2d=>{const _0x20eb03=_0x4bccec;try{return await _0x37cc08['journey'][_0x20eb03(0xdd)](_0x29f4c3[_0x20eb03(0x126)],_0x4d9a2d);}catch(_0xa4ff84){throw new SDKError(ErrorCode[_0x20eb03(0xd8)],_0x20eb03(0xa7)+_0x4d9a2d+_0x20eb03(0x127)+_0x1f191e[_0x20eb03(0xb7)][_0x20eb03(0xfc)]+'\x27)',_0xa4ff84);}},'resolveStageId':async(_0x5934fe,_0x7b04f9)=>{const _0x192496=_0x4bccec,_0xbc6bda=await _0x37cc08[_0x192496(0xd1)][_0x192496(0x13f)](_0x5934fe),_0x49ba9a=_0xbc6bda['attributes']['journeyStages'][_0x192496(0x135)](_0x5b2ae5=>_0x5b2ae5[_0x192496(0xfc)][_0x192496(0x12a)]()===_0x7b04f9[_0x192496(0x12a)]());if(!_0x49ba9a?.['id'])throw new SDKError(ErrorCode[_0x192496(0xd8)],_0x192496(0xb5)+_0x7b04f9+_0x192496(0xc0)+(_0xbc6bda[_0x192496(0x169)][_0x192496(0x15e)]||_0xbc6bda['attributes'][_0x192496(0xfc)])+'\x27');return _0x49ba9a['id'];}},_0x1f6b6a=await _0x56d866(_0x1f191e[_0x4bccec(0xb7)],_0x29f4c3[_0x4bccec(0x126)],_0x5c588b),_0x28a153=_0x29f4c3[_0x4bccec(0x10b)]||_0x29f4c3[_0x4bccec(0x197)];_0x28a153&&(_0x1f6b6a[_0x4bccec(0x11f)]={'parentFolder':{'data':{'id':_0x28a153,'type':_0x4bccec(0x198)}}});if(_0x1f191e[_0x4bccec(0x146)]){if(_0x6d7011[_0x4bccec(0x130)]>0x0||_0x20dbab[_0x4bccec(0x130)]>0x0)return await executeThreeStepJourneyCreate(_0x37cc08,_0x1f191e,_0x1f6b6a,{'pendingEmbeddedSegments':_0x6d7011,'pendingEmbeddedActivations':_0x20dbab,'embeddedSegmentNameToId':_0x37eb69,'journeyActivationNameToId':_0x18f31d},{..._0x29f4c3,'effectiveFolderId':_0x28a153},_0x324b05,_0x3e4b26,_0x3e050f);else{ensureJourneyDefaults(_0x1f6b6a[_0x4bccec(0x169)]);const _0x348165=await _0x37cc08[_0x4bccec(0xd1)]['create'](_0x1f6b6a);return deletePushRecovery(_0x1f191e[_0x4bccec(0xf4)]),{'action':_0x4bccec(0x133),'journeyId':_0x348165['id'],'embeddedSegmentNameToId':_0x37eb69};}}else{if(_0x1f191e[_0x4bccec(0xda)]&&_0x1f191e[_0x4bccec(0x14d)]){_0x1f6b6a['id']=_0x1f191e['existingJourney']['id'];const _0x2ff8c6=_0x1f6b6a[_0x4bccec(0x169)];_0x1f191e['existingJourney'][_0x4bccec(0x169)]?.[_0x4bccec(0x15e)]&&(_0x2ff8c6[_0x4bccec(0x15e)]=_0x1f191e[_0x4bccec(0x14d)][_0x4bccec(0x169)]['journeyBundleName']);const _0x46604b=_0x1f191e[_0x4bccec(0x14d)]['attributes']?.[_0x4bccec(0xab)];return _0x46604b&&_0x1f6b6a[_0x4bccec(0x169)][_0x4bccec(0xab)]&&injectExistingStageIds(_0x1f6b6a['attributes']['journeyStages'],_0x46604b),ensureJourneyDefaults(_0x2ff8c6),await _0x37cc08['journey']['update'](_0x1f191e[_0x4bccec(0x14d)]['id'],_0x1f6b6a),deletePushRecovery(_0x1f191e[_0x4bccec(0xf4)]),{'action':'updated','journeyId':_0x1f191e[_0x4bccec(0x14d)]['id'],'embeddedSegmentNameToId':_0x37eb69};}}return deletePushRecovery(_0x1f191e[_0x4bccec(0xf4)]),{'action':_0x4bccec(0xe1),'journeyId':_0x1f191e['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x37eb69};}function findSegmentCriteriaLocation(_0x443701,_0x307101){const _0x511ef4=a136_0x3aef17,_0x539799=_0x443701['stages']||_0x443701[_0x511ef4(0x17a)]?.[0x0]?.[_0x511ef4(0x97)]||[];let _0x4ade6b=_0x511ef4(0x103),_0x332062=_0x307101;const _0x56f544=_0x443701[_0x511ef4(0x116)]||_0x443701[_0x511ef4(0x17a)]?.[0x0]?.[_0x511ef4(0x116)];if(_0x56f544?.[_0x511ef4(0xa3)]===_0x307101)return{'stageName':_0x511ef4(0x116),'criteriaName':_0x56f544['name']||_0x307101};_0xdfa760:for(const _0x42a937 of _0x539799){if(_0x42a937[_0x511ef4(0x95)]?.[_0x511ef4(0xa3)]===_0x307101){_0x4ade6b=_0x42a937['name'],_0x332062=_0x42a937[_0x511ef4(0x95)][_0x511ef4(0xfc)]||_0x307101;break;}if(_0x42a937[_0x511ef4(0xa4)])for(const _0x3b0089 of _0x42a937['steps']){if(_0x3b0089[_0x511ef4(0xbe)]===_0x511ef4(0x134)&&_0x3b0089[_0x511ef4(0x16f)]?.[_0x511ef4(0x128)])for(const _0x1480cc of _0x3b0089['with']['branches']){if(_0x1480cc['segment']===_0x307101){_0x4ade6b=_0x42a937[_0x511ef4(0xfc)],_0x332062=_0x1480cc[_0x511ef4(0xfc)]||_0x307101;break _0xdfa760;}}}}return{'stageName':_0x4ade6b,'criteriaName':_0x332062};}async function executeThreeStepJourneyCreate(_0x52a2dd,_0x23444d,_0x1ed42c,_0x27afe8,_0x14ba59,_0x263708,_0x150a51,_0x4183c9){const _0x2ba583=a136_0x3aef17,{activationDefToCreateRequest:_0x5bddc8,yamlRuleToApi:_0x2334e6}=_0x4183c9,{pendingEmbeddedSegments:_0x54c776,pendingEmbeddedActivations:_0x337baa,embeddedSegmentNameToId:_0x882e6d}=_0x27afe8,_0x526760=JSON[_0x2ba583(0xf3)](JSON[_0x2ba583(0x185)](_0x1ed42c));ensureJourneyDefaults(_0x526760[_0x2ba583(0x169)]),stripPendingIds(_0x526760);const _0x2d3508=await _0x52a2dd[_0x2ba583(0xd1)][_0x2ba583(0xc2)](_0x526760),_0x5bd3ec=_0x2d3508['id'],_0x3fab16=new Map();for(const _0x58b89d of _0x2d3508['attributes'][_0x2ba583(0xab)]){_0x3fab16[_0x2ba583(0xc1)](_0x58b89d[_0x2ba583(0xfc)]['toLowerCase'](),_0x58b89d['id']);}recoverSegmentIdsFromPushRecovery(_0x23444d,_0x882e6d,_0x263708[_0x2ba583(0x155)]);for(const [_0x59ab25,{definition:_0x35377d}]of _0x54c776){if(_0x882e6d['has'](_0x59ab25)){_0x150a51['onProgress']?.({'type':_0x2ba583(0x13a),'journeyName':_0x23444d['yamlConfig'][_0x2ba583(0xfc)],'segmentName':_0x59ab25});continue;}const _0x39227d=generateDeterministicJourneySegmentName(_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],_0x59ab25);_0x150a51[_0x2ba583(0x18f)]?.({'type':_0x2ba583(0x17c),'journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'segmentName':_0x59ab25});const _0x65a3f9=createSegmentIdResolver(_0x263708[_0x2ba583(0x155)],_0x59ab25),_0x314341=await resolveRuleSegmentIds(_0x35377d[_0x2ba583(0xf0)],_0x65a3f9),_0xc14a93=await createOrRecoverEmbeddedSegment(_0x52a2dd,_0x23444d,{'localName':_0x59ab25,'uniqueSegmentName':_0x39227d,'description':_0x35377d[_0x2ba583(0x16b)]||_0x2ba583(0xa0)+_0x59ab25,'journeyId':_0x5bd3ec,'resolvedRule':_0x314341,'parentId':_0x14ba59[_0x2ba583(0x126)],'folderId':_0x14ba59[_0x2ba583(0x188)]||''},_0x2334e6);_0x882e6d[_0x2ba583(0xc1)](_0x59ab25,_0xc14a93),_0x263708['segmentNameToId']['set'](_0x59ab25,_0xc14a93),_0x150a51['onProgress']?.({'type':_0x2ba583(0x13a),'journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'segmentName':_0x59ab25});}const _0x26dc9b=new Map();for(const [_0x2d3905,_0x112f51]of _0x337baa){_0x150a51['onProgress']?.({'type':_0x2ba583(0x15a),'journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'activationName':_0x2d3905});const _0x21931d=await _0x5bddc8(_0x112f51,_0x263708[_0x2ba583(0xa5)]),_0x3e8707={..._0x21931d,..._0x112f51[_0x2ba583(0x121)]!==undefined&&{'runAfterJourneyRefresh':_0x112f51['run_after_journey_refresh']}},_0x4e11ce=await _0x52a2dd[_0x2ba583(0xd1)][_0x2ba583(0xbf)](_0x5bd3ec,_0x3e8707);_0x26dc9b['set'](_0x2d3905,_0x4e11ce['id']),_0x27afe8['journeyActivationNameToId'][_0x2ba583(0xc1)](_0x2d3905,_0x4e11ce['id']),_0x150a51['onProgress']?.({'type':'embedded_activation_created','journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'activationName':_0x2d3905});}const _0x522e36=JSON[_0x2ba583(0xf3)](JSON[_0x2ba583(0x185)](_0x1ed42c));return _0x522e36['id']=_0x5bd3ec,ensureJourneyDefaults(_0x522e36[_0x2ba583(0x169)]),resolvePendingIdsInRequest(_0x522e36,_0x1ed42c,_0x3fab16,_0x882e6d,_0x26dc9b,_0x150a51),await _0x52a2dd[_0x2ba583(0xd1)]['update'](_0x5bd3ec,_0x522e36),deletePushRecovery(_0x23444d[_0x2ba583(0xf4)]),{'action':_0x2ba583(0x133),'journeyId':_0x5bd3ec,'embeddedSegmentNameToId':_0x882e6d};}export function stripWaitStepPendingIds(_0x1e30ce){const _0x27dc66=a136_0x3aef17,_0x295f81=_0x1e30ce['conditionSegmentId']&&isPendingSegmentId(_0x1e30ce[_0x27dc66(0x168)]),_0x531708=_0x1e30ce[_0x27dc66(0xef)]?.[_0x27dc66(0xf2)](_0x4cc585=>_0x4cc585[_0x27dc66(0x12c)]&&isPendingSegmentId(_0x4cc585[_0x27dc66(0x12c)]));(_0x295f81||_0x531708)&&(_0x1e30ce['waitStepType']=_0x27dc66(0x9f),_0x1e30ce[_0x27dc66(0xbc)]=0x1,_0x1e30ce[_0x27dc66(0x109)]=_0x27dc66(0x172),delete _0x1e30ce[_0x27dc66(0x168)],delete _0x1e30ce[_0x27dc66(0x13e)],delete _0x1e30ce[_0x27dc66(0xa9)],delete _0x1e30ce[_0x27dc66(0xef)]);}export function resolveWaitStepPendingIds(_0x2bd6c3,_0x217391,_0x14aca5,_0x35f493){const _0x5bf910=a136_0x3aef17;if(_0x217391[_0x5bf910(0x168)]&&isPendingSegmentId(_0x217391[_0x5bf910(0x168)])){const _0x184dd3=_0x14aca5(_0x217391['conditionSegmentId'],_0x5bf910(0xaa)+_0x35f493+_0x5bf910(0xa2));_0x184dd3&&(_0x2bd6c3[_0x5bf910(0x123)]='Condition',_0x2bd6c3[_0x5bf910(0x168)]=_0x184dd3,delete _0x2bd6c3[_0x5bf910(0xbc)],delete _0x2bd6c3[_0x5bf910(0x109)],_0x217391['conditionTimeoutDuration']!==undefined&&(_0x2bd6c3[_0x5bf910(0x13e)]=_0x217391[_0x5bf910(0x13e)]),_0x217391[_0x5bf910(0xa9)]&&(_0x2bd6c3['conditionTimeoutUnit']=_0x217391[_0x5bf910(0xa9)]));}if(_0x217391['conditions']){const _0xf774af=_0x217391[_0x5bf910(0xef)]['some'](_0x466b7f=>_0x466b7f[_0x5bf910(0x12c)]&&isPendingSegmentId(_0x466b7f[_0x5bf910(0x12c)]));if(_0xf774af){const _0x1f1a71=_0x217391['conditions'][_0x5bf910(0x144)](_0x152672=>{const _0x586847=_0x5bf910;if(_0x152672['segmentId']&&isPendingSegmentId(_0x152672['segmentId'])){const _0x28a21f=_0x14aca5(_0x152672[_0x586847(0x12c)],'stage\x20\x27'+_0x35f493+'\x27\x20wait\x20condition');return{..._0x152672,'segmentId':_0x28a21f||_0x152672['segmentId']};}return{..._0x152672};});_0x2bd6c3['waitStepType']=_0x5bf910(0x175),_0x2bd6c3['conditions']=_0x1f1a71,delete _0x2bd6c3[_0x5bf910(0xbc)],delete _0x2bd6c3[_0x5bf910(0x109)],delete _0x2bd6c3[_0x5bf910(0x168)],delete _0x2bd6c3[_0x5bf910(0x13e)],delete _0x2bd6c3[_0x5bf910(0xa9)];}}}function stripPendingIds(_0x4219b4){const _0x3b33c3=a136_0x3aef17;_0x4219b4[_0x3b33c3(0x169)][_0x3b33c3(0x116)]?.[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x4219b4[_0x3b33c3(0x169)][_0x3b33c3(0x116)][_0x3b33c3(0x12c)])&&delete _0x4219b4['attributes'][_0x3b33c3(0x116)];for(const _0x5f0e78 of _0x4219b4['attributes'][_0x3b33c3(0xab)]||[]){_0x5f0e78[_0x3b33c3(0x12f)]?.[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x5f0e78[_0x3b33c3(0x12f)][_0x3b33c3(0x12c)])&&delete _0x5f0e78[_0x3b33c3(0x12f)];_0x5f0e78['milestone']?.[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x5f0e78[_0x3b33c3(0xb8)][_0x3b33c3(0x12c)])&&delete _0x5f0e78[_0x3b33c3(0xb8)];_0x5f0e78['exitCriterias']&&(_0x5f0e78[_0x3b33c3(0x18c)]=_0x5f0e78[_0x3b33c3(0x18c)][_0x3b33c3(0x10e)](_0x1914a2=>!_0x1914a2[_0x3b33c3(0x12c)]||!isPendingSegmentId(_0x1914a2[_0x3b33c3(0x12c)])));if(_0x5f0e78[_0x3b33c3(0xa4)])for(const _0xfab7ac of Object[_0x3b33c3(0x167)](_0x5f0e78['steps'])){const _0x3c93ae=_0x5f0e78[_0x3b33c3(0xa4)][_0xfab7ac];_0x3c93ae[_0x3b33c3(0xbe)]==='Activation'&&_0x3c93ae[_0x3b33c3(0x114)]&&isPendingActivationId(_0x3c93ae[_0x3b33c3(0x114)])&&(_0x3c93ae[_0x3b33c3(0x114)]='');if(_0x3c93ae[_0x3b33c3(0xbe)]===_0x3b33c3(0xc9)&&_0x3c93ae[_0x3b33c3(0x128)])for(const _0x375aff of _0x3c93ae['branches']){_0x375aff[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x375aff[_0x3b33c3(0x12c)])&&(_0x375aff[_0x3b33c3(0x12c)]='');}_0x3c93ae[_0x3b33c3(0xbe)]===_0x3b33c3(0x153)&&stripWaitStepPendingIds(_0x3c93ae);}}}function resolvePendingIdsInRequest(_0xfc6742,_0x67dab5,_0x31bfa7,_0x43e74e,_0x36ae09,_0x3fdf02){const _0x5bf514=a136_0x3aef17,_0x924e91=(_0x1629f5,_0x1b5785)=>{const _0x2d336d=a136_0x39b7;if(!isPendingSegmentId(_0x1629f5))return _0x1629f5;const _0x5b5dec=extractPendingSegmentName(_0x1629f5),_0x1cc50c=_0x43e74e[_0x2d336d(0xe9)](_0x5b5dec);return!_0x1cc50c&&_0x3fdf02['logWarning']?.(_0x2d336d(0x163)+_0x5b5dec+_0x2d336d(0xfd)+_0x1b5785),_0x1cc50c;};if(_0xfc6742['attributes'][_0x5bf514(0x116)]?.[_0x5bf514(0x12c)]&&isPendingSegmentId(_0xfc6742[_0x5bf514(0x169)][_0x5bf514(0x116)]['segmentId'])){const _0x237bb6=_0x924e91(_0xfc6742['attributes'][_0x5bf514(0x116)][_0x5bf514(0x12c)],_0x5bf514(0x186));_0x237bb6&&(_0xfc6742['attributes'][_0x5bf514(0x116)][_0x5bf514(0x12c)]=_0x237bb6);}for(const _0x393097 of _0xfc6742[_0x5bf514(0x169)]['journeyStages']||[]){const _0x5cdec4=_0x31bfa7[_0x5bf514(0xe9)](_0x393097[_0x5bf514(0xfc)][_0x5bf514(0x12a)]());_0x5cdec4&&(_0x393097['id']=_0x5cdec4);if(_0x393097['entryCriteria']?.[_0x5bf514(0x12c)]&&isPendingSegmentId(_0x393097[_0x5bf514(0x12f)][_0x5bf514(0x12c)])){const _0x2e8097=_0x924e91(_0x393097['entryCriteria'][_0x5bf514(0x12c)],_0x5bf514(0xaa)+_0x393097['name']+_0x5bf514(0x19a));_0x2e8097&&(_0x393097[_0x5bf514(0x12f)]['segmentId']=_0x2e8097);}if(_0x393097[_0x5bf514(0x18c)])for(const _0x4bd0ec of _0x393097['exitCriterias']){if(_0x4bd0ec[_0x5bf514(0x12c)]&&isPendingSegmentId(_0x4bd0ec[_0x5bf514(0x12c)])){const _0x11f839=_0x924e91(_0x4bd0ec[_0x5bf514(0x12c)],_0x5bf514(0xaa)+_0x393097[_0x5bf514(0xfc)]+_0x5bf514(0x13d));_0x11f839&&(_0x4bd0ec[_0x5bf514(0x12c)]=_0x11f839);}}if(_0x393097[_0x5bf514(0xb8)]?.[_0x5bf514(0x12c)]&&isPendingSegmentId(_0x393097['milestone']['segmentId'])){const _0x3d4d71=_0x924e91(_0x393097['milestone']['segmentId'],'stage\x20\x27'+_0x393097[_0x5bf514(0xfc)]+_0x5bf514(0x14c));_0x3d4d71&&(_0x393097[_0x5bf514(0xb8)][_0x5bf514(0x12c)]=_0x3d4d71);}if(_0x393097[_0x5bf514(0xa4)]){const _0x9dcb3a=_0x544d14=>_0x67dab5[_0x5bf514(0x169)][_0x5bf514(0xab)]?.[_0x5bf514(0x135)](_0x26e589=>_0x26e589[_0x5bf514(0xfc)]['toLowerCase']()===_0x393097['name'][_0x5bf514(0x12a)]())?.[_0x5bf514(0xa4)]?.[_0x544d14];for(const _0x4bb680 of Object[_0x5bf514(0x167)](_0x393097['steps'])){const _0xef151a=_0x393097['steps'][_0x4bb680],_0x3d0ee4=_0x9dcb3a(_0x4bb680);if(_0xef151a[_0x5bf514(0xbe)]==='Activation'&&_0xef151a['journeyActivationStepId']&&(isPendingActivationId(_0xef151a['journeyActivationStepId'])||_0xef151a[_0x5bf514(0x114)]==='')){if(_0x3d0ee4?.['journeyActivationStepId']&&isPendingActivationId(_0x3d0ee4[_0x5bf514(0x114)])){const _0x332c5f=extractPendingActivationName(_0x3d0ee4[_0x5bf514(0x114)]),_0x5c0155=_0x36ae09[_0x5bf514(0xe9)](_0x332c5f);_0x5c0155&&(_0xef151a[_0x5bf514(0x114)]=_0x5c0155);}}if(_0xef151a['type']===_0x5bf514(0xc9)&&_0xef151a['branches']&&_0x3d0ee4?.[_0x5bf514(0x128)])for(let _0x28698a=0x0;_0x28698a<_0xef151a['branches'][_0x5bf514(0x93)];_0x28698a++){const _0x3110ad=_0xef151a[_0x5bf514(0x128)][_0x28698a],_0x223c40=_0x3d0ee4[_0x5bf514(0x128)][_0x28698a];if(_0x223c40?.['segmentId']&&isPendingSegmentId(_0x223c40[_0x5bf514(0x12c)])){const _0x547db7=_0x924e91(_0x223c40[_0x5bf514(0x12c)],_0x5bf514(0xaa)+_0x393097[_0x5bf514(0xfc)]+_0x5bf514(0x196)+(_0x3110ad[_0x5bf514(0xfc)]||_0x28698a)+'\x27');_0x547db7&&(_0x3110ad[_0x5bf514(0x12c)]=_0x547db7);}}_0xef151a['type']===_0x5bf514(0x153)&&_0x3d0ee4?.[_0x5bf514(0xbe)]===_0x5bf514(0x153)&&resolveWaitStepPendingIds(_0xef151a,_0x3d0ee4,_0x924e91,_0x393097[_0x5bf514(0xfc)]);}}}}
1
+ const a140_0x1afe10=a140_0x46f4;(function(_0x441b1d,_0x568518){const _0x33c0a1=a140_0x46f4,_0xd2c08f=_0x441b1d();while(!![]){try{const _0x5eac29=-parseInt(_0x33c0a1(0x23f))/0x1*(parseInt(_0x33c0a1(0x1c6))/0x2)+parseInt(_0x33c0a1(0x2a9))/0x3+parseInt(_0x33c0a1(0x265))/0x4+parseInt(_0x33c0a1(0x1ea))/0x5+-parseInt(_0x33c0a1(0x2a2))/0x6+parseInt(_0x33c0a1(0x2ba))/0x7*(-parseInt(_0x33c0a1(0x225))/0x8)+parseInt(_0x33c0a1(0x259))/0x9*(parseInt(_0x33c0a1(0x23d))/0xa);if(_0x5eac29===_0x568518)break;else _0xd2c08f['push'](_0xd2c08f['shift']());}catch(_0x1f5b1e){_0xd2c08f['push'](_0xd2c08f['shift']());}}}(a140_0x1b50,0x1b8e7));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';function a140_0x46f4(_0x2ca7e0,_0x3ac6d6){_0x2ca7e0=_0x2ca7e0-0x1b4;const _0x1b5087=a140_0x1b50();let _0x46f466=_0x1b5087[_0x2ca7e0];return _0x46f466;}const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a140_0x1afe10(0x247);export function createPendingSegmentId(_0xa26c0f){return''+PENDING_SEGMENT_PREFIX+_0xa26c0f+'__';}export function isPendingSegmentId(_0x3bd888){return _0x3bd888['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x3bd888['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x565eaa){const _0x56b69c=a140_0x1afe10;return _0x565eaa[_0x56b69c(0x1cd)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x39d9bd){return''+PENDING_ACTIVATION_PREFIX+_0x39d9bd+'__';}export function isPendingActivationId(_0x2377a7){const _0x485b9e=a140_0x1afe10;return _0x2377a7[_0x485b9e(0x26f)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x501bea){const _0x516f57=a140_0x1afe10;return _0x501bea[_0x516f57(0x1cd)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x4f41c9,_0x13b64e){const _0x5e8faa=a140_0x1afe10,_0x2eedad=_0x4f41c9+'::'+(_0x13b64e[_0x5e8faa(0x2ad)]()||_0x5e8faa(0x21a)),_0x2adef9=createHash(_0x5e8faa(0x1bf))['update'](_0x2eedad)['digest']('hex')[_0x5e8faa(0x1fd)](0x0,0xc);return _0x5e8faa(0x1d9)+_0x2adef9;}function a140_0x1b50(){const _0x4a977f=['deleted','unchanged','behavior','name','folder_created','idToName','existingJourney','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','Created\x20activation\x20\x27','6910dRkIET','logWarning','1sVUpda','keys','activation_created','getSegmentEntity','split','results','goal\x20criteria','JOURNEY_SYNTAX_ERROR','__pending_act_','isNew','Duration','updated','Fetching\x20','logSuccess','includes','Created\x20journey\x20\x27','segment_created','WaitStep','waitStep','createdSegmentIds','segmentFolderId','logInfo','relative','Updated\x20activation\x20\x27','deleteActivation','Deleting\x20activation\x20\x27','4572GcajSk','conditionTimeoutUnit','embedded_segment_created','update','rootFolderId','.$1.push-recovery.json','toLowerCase','dirname','getSegment\x20failed\x20for\x20','existingSegments','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','createJourneySegment','50580XfwCnc','getJourney','hasChanges','valid','data','entryCriteria','yamlActivation','object','ACTIVATION_SYNTAX_ERROR','progress','startsWith','\x27\x20wait\x20condition','with','\x0a\x20\x20','conditionTimeoutDuration','withProgress','createActivation','embedded_segment_creating','max','Failed\x20to\x20resolve\x20activation\x20','segment_updating','folderPathToId','NOT_FOUND','deleteSegment','schedule','createFolder','notification','journeys','description','decision_point','logDeleted','connection','Failed\x20to\x20','getActivation','from','folder_creating','toISOString','values','uniqueServerName','Segment\x20not\x20found:\x20','Entry\x20criteria:\x20','relationships','\x27\x20exit\x20criteria','get','connectionIdToNameMap','segmentId','Segment\x20not\x20found','activation_','folderId','DecisionPoint','utf-8','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','item','action','Creating\x20activation\x20\x27','Updated\x20segment\x20\x27','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','\x27...','branches','activation_updating','day','145302XEPTpL','\x20(referenced\x20in\x20journey\x20','waitStepType','):\x20','segmentNameToId','map','\x27\x20milestone','7125epGvAB','steps','createSegment','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','trim','\x27\x20by\x20rule\x20content','created','embeddedSegmentNameToId','INTERNAL','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','sort','journeyStages','journeyBundleId','has','Activation\x20not\x20found:\x20','length','journeyName','286370PuCZxM','join','JOURNEY_UPDATE_ERROR','onProgress','exitCriterias','Embedded\x20segment\x20\x27','entry_criteria','toString','conditions','activations','columns','idToEmailMap','\x27\x20not\x20found\x20in\x20journey\x20\x27','message','list','debug','sha1','\x27\x20for\x20','reduce','journeyBundlesByFolderAndName','journey','user','size','430712IKEloV','getLatestJourneyId','deps','all','ACTIVATION_UPDATE_ERROR','effectiveFolderId','parseDocument','replace','Failed\x20to\x20resolve\x20segment\x20','Condition','existingActivation','\x20segment\x20from\x20file:\x20','versionNumber','diff','segment_creating','flatMap','Deleted\x20activation\x20\x27','\x27\x20decision\x20point\x20branch\x20\x27','parentFolder','journey_entry_criteria_','conditionSegmentId','journeyById','SEGMENT_NOT_FOUND','milestone','yamlConfig','activation_creating','stages','\x20error(s)','uniqueSegmentName','Updating\x20segment\x20\x27','draft','Failed\x20to\x20fetch\x20referenced\x20segment\x20','set','run_after_journey_refresh','Deleted\x20segment\x20\x27','\x27\x20from\x20file:\x20','954730baCFra','waitStepUnit','find','journeyActivationStepId','absolutePath','errors','some','match','activationParams','goal','journey_updating','journey_created','parentId','parentSegmentFolder','activation_deleted','Stage\x20\x27','stringify','stage\x20\x27','Activation','slice','validatedRequest','attributes','activationContext','kind','SEGMENT_UPDATE_ERROR','isArray','./child-segment-yaml.js','segment_deleted','state','activation_deleting','segments','createdSegmentId','add','embedded_activation_creating','listActivations','activationStepsById','Created\x20folder\x20\x27','journeyId','create','journey_creating','\x20journey\x20from\x20file:\x20','./journey-yaml.js','\x27\x20to\x20local\x20\x27',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','skipSegments','embedded_activation_created','journeyActivationNameToId','../../utils/async.js','segment','delete','filter','journey_updated','folderPath','connector_config','resolvedRule','activationsBySegmentId','entries','parse','journeyBundleName','40nyztDf','Updated\x20journey\x20\x27','rule','push','activationActions','existingSegment','activation_updated','entry','resolveSegment','all_columns','nameToType','updateSegmentById','localName','activation_template_id','type'];a140_0x1b50=function(){return _0x4a977f;};return a140_0x1b50();}export function ensureJourneyDefaults(_0x102cbc){const _0x383b8b=a140_0x1afe10;!_0x102cbc[_0x383b8b(0x281)]&&(_0x102cbc[_0x383b8b(0x281)]=''),!_0x102cbc[_0x383b8b(0x206)]&&(_0x102cbc['state']=_0x383b8b(0x1e4));}export function injectExistingStageIds(_0x126d40,_0x141c85){const _0x246a4b=a140_0x1afe10,_0x130b4a=new Map(_0x141c85[_0x246a4b(0x2a7)](_0x4f4e24=>[_0x4f4e24['name'],_0x4f4e24['id']]));for(const _0x287a5c of _0x126d40){if(!_0x287a5c['id']){const _0x58fbe9=_0x130b4a['get'](_0x287a5c['name']);_0x58fbe9&&(_0x287a5c['id']=_0x58fbe9);}}}export function resolveTDFolderPath(_0x33ad17,_0x322121,_0x2dceb5){const _0x33dd11=a140_0x1afe10;if(!_0x322121)return _0x33ad17;if(_0x33ad17===_0x2dceb5||_0x33ad17[_0x33dd11(0x26f)](_0x2dceb5+'/'))return _0x33ad17;return _0x33ad17?_0x2dceb5+'/'+_0x33ad17:_0x2dceb5;}export function addFoldersToCreate(_0xe84c48,_0x4eb5fd,_0x42741f){const _0x2cff55=a140_0x1afe10;if(!_0xe84c48)return;if(_0x4eb5fd['has'](_0xe84c48))return;const _0x37e764=_0xe84c48[_0x2cff55(0x243)]('/');let _0xd759f7='';for(const _0x298fb6 of _0x37e764){_0xd759f7=_0xd759f7?_0xd759f7+'/'+_0x298fb6:_0x298fb6,!_0x4eb5fd['has'](_0xd759f7)&&_0x42741f['add'](_0xd759f7);}}export function sortFoldersByDepth(_0x429898){const _0x30de46=a140_0x1afe10;return[..._0x429898][_0x30de46(0x2b3)]((_0x5d6d09,_0x1fae41)=>{const _0x121d72=_0x30de46,_0x16ad8b=(_0x5d6d09[_0x121d72(0x1f1)](/\//g)||[])[_0x121d72(0x2b8)],_0x2169ff=(_0x1fae41[_0x121d72(0x1f1)](/\//g)||[])[_0x121d72(0x2b8)];return _0x16ad8b-_0x2169ff;});}import*as a140_0x34f3e1 from'yaml';import{readFileSync}from'fs';import a140_0x3093ec from'path';import{isJourneyDef,parseYamlString as a140_0xd96d11,toYamlString as a140_0xdb675a,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(_0x46edb1){const _0x52d6b9=a140_0x1afe10;if(Array[_0x52d6b9(0x203)](_0x46edb1))return'['+_0x46edb1[_0x52d6b9(0x2a7)](_0x13f9c5=>stableStringify(_0x13f9c5))[_0x52d6b9(0x2bb)](',')+']';if(_0x46edb1&&typeof _0x46edb1===_0x52d6b9(0x26c)){const _0x44c1d6=_0x46edb1,_0x145679=Object['keys'](_0x44c1d6)[_0x52d6b9(0x2b3)](),_0x3a5d5b=_0x145679[_0x52d6b9(0x2a7)](_0x301e33=>'\x22'+_0x301e33+'\x22:'+stableStringify(_0x44c1d6[_0x301e33]));return'{'+_0x3a5d5b[_0x52d6b9(0x2bb)](',')+'}';}const _0x3255c4=JSON[_0x52d6b9(0x1fa)](_0x46edb1);return _0x3255c4===undefined?'null':_0x3255c4;}function activationSignature(_0x5121ad){const _0x3f8e8d=a140_0x1afe10,_0x4eb3bb={'connection':_0x5121ad[_0x3f8e8d(0x284)],..._0x5121ad['all_columns']!==undefined&&{'all_columns':_0x5121ad[_0x3f8e8d(0x22e)]},..._0x5121ad['columns']!==undefined&&{'columns':_0x5121ad[_0x3f8e8d(0x1b9)]},..._0x5121ad[_0x3f8e8d(0x236)]!==undefined&&{'behavior':_0x5121ad['behavior']},..._0x5121ad[_0x3f8e8d(0x27d)]!==undefined&&{'schedule':_0x5121ad[_0x3f8e8d(0x27d)]},..._0x5121ad[_0x3f8e8d(0x27f)]!==undefined&&{'notification':_0x5121ad[_0x3f8e8d(0x27f)]},..._0x5121ad[_0x3f8e8d(0x21f)]!==undefined&&{'connector_config':_0x5121ad[_0x3f8e8d(0x21f)]},..._0x5121ad[_0x3f8e8d(0x232)]!==undefined&&{'activation_template_id':_0x5121ad['activation_template_id']}};return stableStringify(_0x4eb3bb);}async function fetchSegment(_0xa41b00,_0x316bbb,_0x49371c,_0x5c23bd){const _0x3569fc=a140_0x1afe10,_0x5490b3=_0x5c23bd?.[_0x3569fc(0x1ec)](_0x3855f7=>_0x3855f7['id']===_0x49371c);if(_0x5490b3)return _0x5490b3;try{return await _0xa41b00[_0x3569fc(0x21a)]['getSegment'](_0x316bbb,_0x49371c);}catch(_0x5e5ff5){logger[_0x3569fc(0x1be)](_0x3569fc(0x261)+_0x49371c+_0x3569fc(0x215)+_0x5e5ff5);try{return await _0xa41b00[_0x3569fc(0x21a)][_0x3569fc(0x242)](_0x49371c);}catch(_0x7643b7){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x49371c+':\x20'+_0x7643b7),null;}}}function recoverSegmentIdsFromPushRecovery(_0x530dd7,_0x23b005,_0x5d0ec5){const _0x38d41b=a140_0x1afe10,_0x4cc813=readPushRecovery(_0x530dd7[_0x38d41b(0x1ee)]);if(_0x4cc813?.['journeyName']===_0x530dd7[_0x38d41b(0x1de)][_0x38d41b(0x237)])for(const [_0x3f3583,_0x35a3f6]of Object['entries'](_0x4cc813[_0x38d41b(0x208)])){const _0x302a81=generateDeterministicJourneySegmentName(_0x530dd7[_0x38d41b(0x1de)]['name'],_0x3f3583);_0x35a3f6[_0x38d41b(0x28b)]===_0x302a81&&(_0x23b005[_0x38d41b(0x1e6)](_0x3f3583,_0x35a3f6[_0x38d41b(0x292)]),_0x5d0ec5[_0x38d41b(0x1e6)](_0x3f3583,_0x35a3f6[_0x38d41b(0x292)]));}}async function createOrRecoverEmbeddedSegment(_0x29571b,_0x11d554,_0xc9d62f,_0x30aa6d){const _0x156b4d=a140_0x1afe10;let _0x1bbbc0;try{_0x1bbbc0=await _0x29571b[_0x156b4d(0x21a)][_0x156b4d(0x264)]({'name':_0xc9d62f[_0x156b4d(0x1e2)],'description':_0xc9d62f[_0x156b4d(0x281)],'journeyId':_0xc9d62f[_0x156b4d(0x20f)],'rule':_0x30aa6d(_0xc9d62f['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0xc9d62f[_0x156b4d(0x295)],'audienceId':_0xc9d62f[_0x156b4d(0x1f6)]});}catch(_0x40a2ce){const _0x2a69f5=_0x40a2ce instanceof Error&&_0x40a2ce[_0x156b4d(0x1bc)][_0x156b4d(0x24d)]('Name\x20has\x20already\x20been\x20taken');if(_0x2a69f5){const _0x286360=readPushRecovery(_0x11d554['absolutePath']),_0x11ca5b=_0x286360?.[_0x156b4d(0x2b9)]===_0x11d554[_0x156b4d(0x1de)][_0x156b4d(0x237)]?_0x286360[_0x156b4d(0x208)][_0xc9d62f[_0x156b4d(0x231)]]:undefined;if(_0x11ca5b?.[_0x156b4d(0x28b)]===_0xc9d62f[_0x156b4d(0x1e2)])await _0x29571b[_0x156b4d(0x21a)][_0x156b4d(0x230)](_0xc9d62f[_0x156b4d(0x1f6)],_0x11ca5b['segmentId'],{'description':_0xc9d62f['description'],'rule':_0x30aa6d(_0xc9d62f[_0x156b4d(0x220)],!![]),'countPopulation':!![]}),_0x1bbbc0=_0x11ca5b['segmentId'];else throw new SDKError(ErrorCode[_0x156b4d(0x202)],_0x156b4d(0x1b4)+_0xc9d62f[_0x156b4d(0x231)]+_0x156b4d(0x23b)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x11d554['absolutePath']['replace'](/([^/]+)$/,_0x156b4d(0x25e))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x40a2ce);}else throw _0x40a2ce;}return saveSegmentToPushRecovery(_0x11d554[_0x156b4d(0x1ee)],_0x11d554[_0x156b4d(0x1de)][_0x156b4d(0x237)],_0xc9d62f['localName'],{'segmentId':_0x1bbbc0,'uniqueServerName':_0xc9d62f['uniqueSegmentName'],'createdAt':new Date()[_0x156b4d(0x289)]()}),_0x1bbbc0;}export async function prepareSegmentFiles(_0x1a3654,_0x181375,_0x4fc86b,_0x3a6e88,_0x2c2134){const _0x1e28c2=a140_0x1afe10,{activationDefToCreateRequest:_0xf4099c}=await import(_0x1e28c2(0x204)),_0x43233c=[],_0x3c2d4f=new Set();for(const {yamlConfig:_0x5a0078,folderPath:_0x3d3e98,sourcePath:_0x212397}of _0x1a3654){const _0x16a9c4=resolveTDFolderPath(_0x3d3e98,_0x3a6e88,_0x2c2134),_0x1d4c99=_0x16a9c4+':'+_0x5a0078[_0x1e28c2(0x237)],_0x2758b6=_0x181375['segmentByFolderAndName'][_0x1e28c2(0x290)](_0x1d4c99),_0x3d206b=_0x2758b6?_0x181375[_0x1e28c2(0x221)][_0x1e28c2(0x290)](_0x2758b6['id'])||[]:[];addFoldersToCreate(_0x16a9c4,_0x181375['folderPathToId'],_0x3c2d4f);const _0x2e23b1=calculateActivationActions(_0x5a0078[_0x1e28c2(0x1b8)]||[],_0x3d206b,_0x181375[_0x1e28c2(0x1ba)],_0x181375['connectionIdToNameMap']);for(const _0x276725 of _0x2e23b1){(_0x276725[_0x1e28c2(0x233)]===_0x1e28c2(0x210)||_0x276725[_0x1e28c2(0x233)]===_0x1e28c2(0x25c))&&_0x276725[_0x1e28c2(0x26b)]&&(_0x276725[_0x1e28c2(0x1fe)]=await _0xf4099c(_0x276725[_0x1e28c2(0x26b)],_0x4fc86b));}const _0x3919f1=calculateSegmentDiff(_0x5a0078,_0x2758b6,_0x3d206b,_0x181375[_0x1e28c2(0x1ba)],_0x181375['connectionIdToNameMap']);_0x43233c['push']({'relativePath':_0x5a0078['name'],'absolutePath':_0x212397,'yamlConfig':_0x5a0078,'folderPath':_0x16a9c4,'existingSegment':_0x2758b6,'existingActivations':_0x3d206b,'isNew':_0x3919f1[_0x1e28c2(0x248)],'hasChanges':_0x3919f1['hasChanges'],'diff':_0x3919f1[_0x1e28c2(0x1d3)],'activationActions':_0x2e23b1});}return{'segmentFiles':_0x43233c,'foldersToCreate':_0x3c2d4f};}export async function prepareJourneyFiles(_0x39d405,_0x439542,_0x5cfa5b,_0x4c0a79){const _0x5b98f8=a140_0x1afe10,_0x58d02f=[],_0x4dee73=new Set();for(const {yamlConfig:_0x117bff,folderPath:_0x4cf6a,sourcePath:_0x4ae182}of _0x39d405){const _0x54ae57=resolveTDFolderPath(_0x4cf6a,_0x5cfa5b,_0x4c0a79),_0x2c8cd2=_0x54ae57+':'+_0x117bff[_0x5b98f8(0x237)],_0x115031=_0x439542[_0x5b98f8(0x1c2)][_0x5b98f8(0x290)](_0x2c8cd2);let _0x19d611,_0x5dd0ec;if(_0x115031&&_0x115031[_0x5b98f8(0x2b8)]>0x0){const _0x4d4bb8=buildLocalExpandedRuleMappings(_0x117bff),{createYamlContext:_0x4a738e,prefetchJourneySegments:_0x991a28}=createPushYamlContextForBundle(_0x439542['deps'],_0x439542[_0x5b98f8(0x1f6)],_0x439542[_0x5b98f8(0x262)],_0x4d4bb8,_0x439542[_0x5b98f8(0x1ba)],_0x439542[_0x5b98f8(0x291)],_0x439542[_0x5b98f8(0x20d)],_0x439542[_0x5b98f8(0x1db)]);await _0x991a28(_0x115031['map'](_0x3064c8=>_0x3064c8['id']));const _0x444a6b=await _0x439542[_0x5b98f8(0x1c8)]['journey'][_0x5b98f8(0x1c7)](_0x115031[0x0][_0x5b98f8(0x2b5)]),_0x18c464=hasMultipleVersions(_0x117bff),_0x18747b=async _0x37700d=>{const _0x11722b=_0x5b98f8,_0x53f8b7=_0x439542[_0x11722b(0x1db)]?.[_0x11722b(0x290)](_0x37700d);if(_0x53f8b7)return _0x53f8b7;return _0x439542['fetchJourney']({'journeyId':_0x37700d,'journeyName':_0x117bff[_0x11722b(0x237)],'isMultiVersion':_0x115031[_0x11722b(0x2b8)]>0x1});};if(_0x18c464&&_0x115031[_0x5b98f8(0x2b8)]>0x1){const _0x41333c=[];for(const _0xaf8bf of _0x115031){const _0x4b4af2=_0xaf8bf[_0x5b98f8(0x1d2)]||0x1;_0x439542['progress']?.[_0x5b98f8(0x25c)]('Fetching\x20'+_0x117bff[_0x5b98f8(0x237)]+'\x20v'+_0x4b4af2);const _0x560006=await _0x18747b(_0xaf8bf['id']),_0x3857a9=_0x4a738e(_0xaf8bf['id']),_0x1aae65=await journeyResponseToDef(_0x560006,_0x3857a9);_0x41333c[_0x5b98f8(0x228)]({'item':_0xaf8bf,'yaml':_0x1aae65});}const _0x4d7f2c=buildLocalRuleToNameMappingFromJourney(_0x117bff);_0x5dd0ec=buildMergedJourneyDef(_0x41333c,_0x4d7f2c,_0x444a6b);const _0x4cf4ee=Math['max'](..._0x41333c[_0x5b98f8(0x2a7)](_0x4d8d8c=>_0x4d8d8c[_0x5b98f8(0x299)][_0x5b98f8(0x1d2)]||0x0)),_0x6132c4=_0x115031[_0x5b98f8(0x1ec)](_0x4e1695=>(_0x4e1695[_0x5b98f8(0x1d2)]||0x0)===_0x4cf4ee);_0x6132c4&&(_0x439542[_0x5b98f8(0x26e)]?.[_0x5b98f8(0x25c)]('Fetching\x20'+_0x117bff[_0x5b98f8(0x237)]+'\x20v'+_0x4cf4ee),_0x19d611=await _0x18747b(_0x6132c4['id']));}else{const _0x16ce29=_0x115031[_0x115031[_0x5b98f8(0x2b8)]-0x1];_0x439542['progress']?.['update'](_0x5b98f8(0x24b)+_0x117bff[_0x5b98f8(0x237)]),_0x19d611=await _0x18747b(_0x16ce29['id']);const _0x59c5ba=_0x4a738e(_0x16ce29['id']),_0x5e3580=await journeyResponseToDef(_0x19d611,_0x59c5ba),_0x25f078=buildLocalRuleToNameMappingFromJourney(_0x117bff);_0x5dd0ec=buildMergedJourneyDef([{'item':_0x16ce29,'yaml':_0x5e3580}],_0x25f078,_0x444a6b);}}addFoldersToCreate(_0x54ae57,_0x439542[_0x5b98f8(0x27a)],_0x4dee73);const _0x3ad391=calculateJourneyDiff(_0x117bff,_0x5dd0ec);_0x58d02f[_0x5b98f8(0x228)]({'relativePath':_0x117bff[_0x5b98f8(0x237)],'absolutePath':_0x4ae182,'yamlConfig':_0x117bff,'folderPath':_0x54ae57,'existingJourney':_0x19d611,'isNew':_0x3ad391['isNew'],'hasChanges':_0x3ad391[_0x5b98f8(0x267)],'diff':_0x3ad391[_0x5b98f8(0x1d3)]});}return{'journeyFiles':_0x58d02f,'foldersToCreate':_0x4dee73};}export function calculateActivationActions(_0x283cde,_0x2e1c07,_0x9669e6,_0x445330){const _0x39eb09=a140_0x1afe10,_0x3acd9b=[],_0xcabe11=new Map();for(const _0x2d3f55 of _0x2e1c07){_0xcabe11['set'](_0x2d3f55[_0x39eb09(0x237)],_0x2d3f55);}const _0x18cdf5=new Map();for(const _0x315392 of _0x283cde){_0x18cdf5['set'](_0x315392['name'],_0x315392);}for(const _0x755fbb of _0x283cde){const _0x466460=_0xcabe11[_0x39eb09(0x290)](_0x755fbb[_0x39eb09(0x237)]);if(!_0x466460)_0x3acd9b[_0x39eb09(0x228)]({'type':'create','name':_0x755fbb['name'],'yamlActivation':_0x755fbb});else{const _0x5d8ea0=activationResponseToDef(_0x466460,_0x9669e6,_0x445330),_0x18eb02=a140_0x34f3e1[_0x39eb09(0x1fa)](_0x5d8ea0),_0x5d36f6=a140_0x34f3e1[_0x39eb09(0x1fa)](_0x755fbb);_0x18eb02!==_0x5d36f6&&_0x3acd9b[_0x39eb09(0x228)]({'type':'update','name':_0x755fbb['name'],'yamlActivation':_0x755fbb,'existingActivation':_0x466460});}}for(const _0x2f4fdc of _0x2e1c07){!_0x18cdf5[_0x39eb09(0x2b6)](_0x2f4fdc[_0x39eb09(0x237)])&&_0x3acd9b['push']({'type':_0x39eb09(0x21b),'name':_0x2f4fdc[_0x39eb09(0x237)],'existingActivation':_0x2f4fdc});}return _0x3acd9b;}function calculateYamlDiff(_0x436ca4,_0x436f60){if(_0x436f60){const _0x20dae8=generateDiff(_0x436f60,_0x436ca4),_0x189981=hasChanges(_0x20dae8);return{'isNew':![],'hasChanges':_0x189981,'diff':_0x189981?formatDiffWithColors(_0x20dae8):undefined};}const _0x5b9971=generateDiff('',_0x436ca4);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x5b9971)};}export function calculateSegmentDiff(_0x1ae4fb,_0x2da820,_0x5181f0,_0x5ae8bc,_0x5df0f1){const _0xc67096=segmentToYamlString(_0x1ae4fb),_0x411bce=_0x2da820?segmentToYamlString(segmentWithActivationsToYaml(_0x2da820,_0x5181f0,undefined,_0x5ae8bc,_0x5df0f1)):undefined;return calculateYamlDiff(_0xc67096,_0x411bce);}export function calculateJourneyDiff(_0x36454a,_0x2f148c){const _0x31bea9=normalizeJourneyDef(_0x36454a,_0x36454a),_0x2cbcb8=a140_0xdb675a(_0x31bea9),_0x322eed=_0x2f148c?a140_0xdb675a(normalizeJourneyDef(_0x2f148c,_0x36454a)):undefined;return calculateYamlDiff(_0x2cbcb8,_0x322eed);}export function findSegmentsToDelete(_0x376729,_0x305f6c,_0xd175e7,_0x2ce161,_0x37d4b2){const _0x29e6cf=a140_0x1afe10,_0x416ba0=new Set();for(const {yamlConfig:_0xb95c55,folderPath:_0x3d7b56}of _0x305f6c){_0x416ba0[_0x29e6cf(0x20a)](_0x3d7b56+':'+_0xb95c55['name']);}return _0x376729[_0x29e6cf(0x21c)](_0x32f004=>{const _0x170e34=_0x29e6cf,_0xdb19e7=_0x32f004[_0x170e34(0x253)]?_0xd175e7[_0x170e34(0x290)](_0x32f004[_0x170e34(0x253)][_0x170e34(0x1b6)]())||'':'',_0x298438=_0xdb19e7+':'+_0x32f004['name'];if(_0x416ba0[_0x170e34(0x2b6)](_0x298438))return![];if(_0x37d4b2)return _0xdb19e7===_0x2ce161||_0xdb19e7[_0x170e34(0x26f)](_0x2ce161+'/');return!![];});}export function findJourneysToDelete(_0x4e0d02,_0x40f248,_0x508ccb,_0x3603a4,_0x4bd498){const _0x402b64=a140_0x1afe10,_0x18b3ee=new Set();for(const {yamlConfig:_0x48e123,folderPath:_0x5ea29d}of _0x40f248){_0x18b3ee[_0x402b64(0x20a)](_0x5ea29d+':'+_0x48e123['name']);}return _0x4e0d02[_0x402b64(0x21c)](_0x28739b=>{const _0x23eb94=_0x402b64,_0x2f43fe=_0x28739b[_0x23eb94(0x295)]?_0x508ccb[_0x23eb94(0x290)](_0x28739b[_0x23eb94(0x295)])||'':'',_0x882739=_0x2f43fe+':'+_0x28739b['journeyBundleName'];if(_0x18b3ee['has'](_0x882739))return![];if(_0x4bd498)return _0x2f43fe===_0x3603a4||_0x2f43fe[_0x23eb94(0x26f)](_0x3603a4+'/');return!![];});}export function buildSegmentLookupMap(_0x270b7c,_0x1321ad){const _0x44cd42=a140_0x1afe10,_0x3915a0=new Map();for(const _0x391754 of _0x270b7c){const _0x32a323=_0x391754['segmentFolderId']?_0x1321ad[_0x44cd42(0x290)](_0x391754['segmentFolderId'][_0x44cd42(0x1b6)]())||'':'',_0x7d8180=_0x32a323+':'+_0x391754[_0x44cd42(0x237)];_0x3915a0[_0x44cd42(0x1e6)](_0x7d8180,_0x391754);}return _0x3915a0;}export function buildSegmentNameToIdMap(_0x1d3c47){const _0x3ca939=a140_0x1afe10,_0x51a4ad=new Map();for(const _0x245c1a of _0x1d3c47){_0x51a4ad['set'](_0x245c1a[_0x3ca939(0x237)],_0x245c1a['id']);}return _0x51a4ad;}export function buildJourneyBundleLookupMap(_0x2efb81,_0xf2e7b){const _0x1a50c6=a140_0x1afe10,_0x3fc1f2=new Map();for(const _0x3fa957 of _0x2efb81){const _0x16bafc=_0x3fa957[_0x1a50c6(0x295)]?_0xf2e7b[_0x1a50c6(0x290)](_0x3fa957[_0x1a50c6(0x295)])||'':'',_0x5e377f=_0x16bafc+':'+_0x3fa957['journeyBundleName'];!_0x3fc1f2[_0x1a50c6(0x2b6)](_0x5e377f)&&_0x3fc1f2[_0x1a50c6(0x1e6)](_0x5e377f,[]),_0x3fc1f2[_0x1a50c6(0x290)](_0x5e377f)[_0x1a50c6(0x228)](_0x3fa957);}for(const _0x5f5a97 of _0x3fc1f2[_0x1a50c6(0x28a)]()){_0x5f5a97['sort']((_0x5066b3,_0x359640)=>(_0x5066b3[_0x1a50c6(0x1d2)]||0x0)-(_0x359640['versionNumber']||0x0));}return _0x3fc1f2;}export function collectFoldersToCreate(_0x449bd8,_0x469caa){const _0x1e026e=a140_0x1afe10,_0xa6d8ba=new Set();for(const _0x31cd7f of _0x449bd8){if(!_0x31cd7f)continue;if(_0x469caa['has'](_0x31cd7f))continue;const _0x180029=_0x31cd7f[_0x1e026e(0x243)]('/');let _0xf86637='';for(const _0x2d8ade of _0x180029){_0xf86637=_0xf86637?_0xf86637+'/'+_0x2d8ade:_0x2d8ade,!_0x469caa['has'](_0xf86637)&&_0xa6d8ba['add'](_0xf86637);}}return _0xa6d8ba;}export function parseAndClassifyYamlFiles(_0x1d2664,_0xea988c,_0x451bf6){const _0xa0d7d3=a140_0x1afe10,_0x4ce0fe=[],_0xf59c30=[];for(const _0x20464b of _0x1d2664){const _0x3107e4=a140_0x3093ec[_0xa0d7d3(0x255)](_0xea988c,a140_0x3093ec[_0xa0d7d3(0x260)](_0x20464b)),_0x44f4ce=_0x3107e4==='.'?'':_0x3107e4,_0x373f34=readFileSync(_0x20464b,_0xa0d7d3(0x297)),_0xc3a675=a140_0x34f3e1[_0xa0d7d3(0x223)](_0x373f34);if(isJourneyDef(_0xc3a675)){const _0x5e7fa7=a140_0xd96d11(_0x373f34);_0xf59c30['push']({'yamlConfig':_0x5e7fa7,'folderPath':_0x44f4ce,'sourcePath':_0x20464b});}else{if(!_0x451bf6?.[_0xa0d7d3(0x216)]){const _0x188526=parseSegmentYamlFile(_0x373f34),_0x44c11b=normalizeChildSegmentYaml(_0x188526);_0x4ce0fe[_0xa0d7d3(0x228)]({'yamlConfig':_0x44c11b,'folderPath':_0x44f4ce,'sourcePath':_0x20464b});}}}return{'segments':_0x4ce0fe,'journeys':_0xf59c30};}export function validateParsedFiles(_0x5a3d6c,_0xe3ba18){const _0x30451f=a140_0x1afe10,_0x5d4991=[];for(const {yamlConfig:_0x3f57e2,sourcePath:_0x37d915}of _0x5a3d6c[_0x30451f(0x208)]){const _0x1eaaf4=readFileSync(_0x37d915,_0x30451f(0x297)),_0x4cc91b=a140_0x34f3e1[_0x30451f(0x1cc)](_0x1eaaf4),_0x36dc5f=validateSegmentDef(_0x3f57e2,{'source':_0x1eaaf4,'document':_0x4cc91b},{'skipSchema':!![]});if(!_0x36dc5f[_0x30451f(0x268)]){const _0x19b56c=a140_0x3093ec[_0x30451f(0x255)](_0xe3ba18,_0x37d915);_0x5d4991['push']({'filePath':_0x19b56c,'source':_0x1eaaf4,'result':_0x36dc5f,'isJourney':![]});}}for(const {yamlConfig:_0x10eb26,sourcePath:_0x4b9e8b}of _0x5a3d6c[_0x30451f(0x280)]){const _0x1d2dde=readFileSync(_0x4b9e8b,_0x30451f(0x297)),_0x1b65ef=a140_0x34f3e1[_0x30451f(0x1cc)](_0x1d2dde),_0x3fbf08=validateJourneyDef(_0x10eb26,{'source':_0x1d2dde,'document':_0x1b65ef},{'skipSchema':!![]});if(!_0x3fbf08['valid']){const _0x1320c0=a140_0x3093ec[_0x30451f(0x255)](_0xe3ba18,_0x4b9e8b);_0x5d4991['push']({'filePath':_0x1320c0,'source':_0x1d2dde,'result':_0x3fbf08,'isJourney':!![]});}}return _0x5d4991;}export function formatValidationErrors(_0x506cf4){const _0x296346=a140_0x1afe10,_0x301d89=[];for(const {filePath:_0x4f0768,source:_0x27114e,result:_0x36864c,isJourney:_0x317bb5}of _0x506cf4){const _0xe41088=_0x317bb5?_0x296346(0x1c3):'segment';_0x301d89['push']('\x0a'+_0x4f0768+'\x20('+_0xe41088+_0x296346(0x2a5)+_0x36864c[_0x296346(0x1ef)][_0x296346(0x2b8)]+_0x296346(0x1e1)),_0x301d89[_0x296346(0x228)](formatValidationResult(_0x36864c,_0x27114e,_0x4f0768));}return _0x301d89[_0x296346(0x2bb)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x42613a){const _0x13c2b4=a140_0x1afe10,_0x536f6c=new Set(),_0x40836f=new Map(),_0xb9c887=collectSegmentUsageCounts(_0x42613a);if(_0x42613a[_0x13c2b4(0x208)])for(const [_0x48a67d,_0x4c1c4e]of Object[_0x13c2b4(0x222)](_0x42613a[_0x13c2b4(0x208)])){_0x536f6c[_0x13c2b4(0x20a)](_0x48a67d);if(_0x4c1c4e['rule']){const _0x52c4d0=yamlRuleToApi(_0x4c1c4e[_0x13c2b4(0x227)]),_0x5a8be7=apiRuleToYaml(_0x52c4d0);_0x40836f['set'](_0x48a67d,_0x5a8be7);}}const _0x26497e=new Map();let _0x41b58a=0x0;for(const [_0x252a19,_0x1b1b94]of _0x40836f){const _0x35bb30=serializeExpandedRule(_0x1b1b94,_0x40836f),_0x402112=_0x26497e['get'](_0x35bb30)||[];_0x402112['push']({'name':_0x252a19,'index':_0x41b58a}),_0x26497e[_0x13c2b4(0x1e6)](_0x35bb30,_0x402112),_0x41b58a++;}const _0x30230b=new Map();for(const [_0x3d5567,_0x597c89]of _0x26497e){const _0x3f8c53=_0x597c89['slice']()[_0x13c2b4(0x2b3)]((_0xc84226,_0x3281fe)=>{const _0x2ae3e3=_0x13c2b4,_0x3aa5ca=_0xb9c887[_0x2ae3e3(0x290)](_0xc84226[_0x2ae3e3(0x237)])||0x0,_0x47458c=_0xb9c887['get'](_0x3281fe[_0x2ae3e3(0x237)])||0x0;if(_0x3aa5ca!==_0x47458c)return _0x47458c-_0x3aa5ca;return _0xc84226['index']-_0x3281fe['index'];})[_0x13c2b4(0x2a7)](_0x311a76=>_0x311a76[_0x13c2b4(0x237)]),_0x29008a=[];for(const _0x25592e of _0x3f8c53){const _0x263742=_0xb9c887[_0x13c2b4(0x290)](_0x25592e)||0x0,_0x57c056=Math[_0x13c2b4(0x277)](_0x263742,0x1);for(let _0x184a3c=0x0;_0x184a3c<_0x57c056;_0x184a3c++){_0x29008a[_0x13c2b4(0x228)](_0x25592e);}}_0x30230b['set'](_0x3d5567,_0x29008a);}return{'existingLocalSegmentNames':_0x536f6c,'localSegmentRules':_0x40836f,'localExpandedRuleToNames':_0x30230b};}export function createSegmentIdResolver(_0x272d7c,_0x4319e7){return async _0x4d90d9=>{const _0xb1dede=a140_0x46f4,_0x50ff9b=_0x272d7c['get'](_0x4d90d9);if(!_0x50ff9b)throw new SDKError(ErrorCode[_0xb1dede(0x1dc)],_0xb1dede(0x28c)+_0x4d90d9+_0xb1dede(0x2ac)+_0x4319e7+'\x27)');return _0x50ff9b;};}export function extractRootFolderId(_0x5753ab){const _0x4ae77c=a140_0x1afe10;return _0x5753ab[_0x4ae77c(0x28e)]?.[_0x4ae77c(0x1f7)]?.[_0x4ae77c(0x269)]?.['id']||_0x5753ab[_0x4ae77c(0x28e)]?.[_0x4ae77c(0x1d8)]?.['data']?.['id'];}export function buildConnectionMaps(_0x31a49b){const _0x1bde50=a140_0x1afe10,_0x2cf5ee=new Map(),_0xadbdef=new Map(),_0x145c68=new Map();for(const _0x516a05 of _0x31a49b){_0x2cf5ee[_0x1bde50(0x1e6)](_0x516a05[_0x1bde50(0x237)],parseInt(_0x516a05['id'],0xa)),_0xadbdef[_0x1bde50(0x1e6)](_0x516a05['id'],_0x516a05['name']),_0x145c68[_0x1bde50(0x1e6)](_0x516a05['name'],_0x516a05['type']);}return{'nameToId':_0x2cf5ee,'idToName':_0xadbdef,'nameToType':_0x145c68};}export function calculatePushStats(_0x4dec2a,_0x3066a4,_0x3ebd83,_0x7e9754,_0x25d002,_0x317012,_0x2c7313){const _0x4fd1ce=a140_0x1afe10,_0x452e84=_0x4dec2a[_0x4fd1ce(0x21c)](_0xd384bc=>_0xd384bc[_0x4fd1ce(0x248)]),_0x123add=_0x4dec2a[_0x4fd1ce(0x21c)](_0xe0f177=>!_0xe0f177[_0x4fd1ce(0x248)]&&_0xe0f177[_0x4fd1ce(0x267)]),_0x3063de=_0x4dec2a[_0x4fd1ce(0x21c)](_0xbccb81=>!_0xbccb81['isNew']&&!_0xbccb81['hasChanges']),_0x2913fd=_0x317012?_0x7e9754:[],_0x3e7bc0=_0x3066a4[_0x4fd1ce(0x21c)](_0x129cde=>_0x129cde['isNew']),_0x1d8d6a=_0x3066a4[_0x4fd1ce(0x21c)](_0x3d98e0=>!_0x3d98e0[_0x4fd1ce(0x248)]&&_0x3d98e0[_0x4fd1ce(0x267)]),_0x580df0=_0x3066a4[_0x4fd1ce(0x21c)](_0x52cadf=>!_0x52cadf[_0x4fd1ce(0x248)]&&!_0x52cadf[_0x4fd1ce(0x267)]),_0x33353e=_0x317012?_0x25d002:[],_0x31eab5=_0x4dec2a[_0x4fd1ce(0x1d5)](_0x680b0e=>_0x680b0e[_0x4fd1ce(0x229)]),_0x3074ad=_0x31eab5[_0x4fd1ce(0x21c)](_0x33269f=>_0x33269f[_0x4fd1ce(0x233)]==='create'),_0xf0eb35=_0x31eab5[_0x4fd1ce(0x21c)](_0x12ea11=>_0x12ea11[_0x4fd1ce(0x233)]===_0x4fd1ce(0x25c)),_0x381142=_0x31eab5[_0x4fd1ce(0x21c)](_0x5d82ed=>_0x5d82ed[_0x4fd1ce(0x233)]===_0x4fd1ce(0x21b)),_0x305fbd=Array[_0x4fd1ce(0x287)](_0x3ebd83)[_0x4fd1ce(0x2b3)](),_0x1de611=_0x2c7313?![]:_0x452e84[_0x4fd1ce(0x2b8)]>0x0||_0x123add[_0x4fd1ce(0x2b8)]>0x0||_0x2913fd[_0x4fd1ce(0x2b8)]>0x0,_0x7bbf74=_0x3e7bc0[_0x4fd1ce(0x2b8)]>0x0||_0x1d8d6a[_0x4fd1ce(0x2b8)]>0x0||_0x33353e['length']>0x0,_0x26ce08=_0x2c7313?![]:_0x31eab5['length']>0x0,_0x4dbea7=_0x305fbd[_0x4fd1ce(0x2b8)]>0x0;return{'segments':{'new':_0x452e84,'changed':_0x123add,'unchanged':_0x3063de,'toDelete':_0x2913fd},'journeys':{'new':_0x3e7bc0,'changed':_0x1d8d6a,'unchanged':_0x580df0,'toDelete':_0x33353e},'activations':{'all':_0x31eab5,'toCreate':_0x3074ad,'toUpdate':_0xf0eb35,'toDelete':_0x381142},'folders':{'toCreate':_0x305fbd},'counts':{'segments':{'new':_0x452e84[_0x4fd1ce(0x2b8)],'changed':_0x123add[_0x4fd1ce(0x2b8)],'unchanged':_0x3063de[_0x4fd1ce(0x2b8)],'toDelete':_0x2913fd['length']},'journeys':{'new':_0x3e7bc0['length'],'changed':_0x1d8d6a['length'],'unchanged':_0x580df0[_0x4fd1ce(0x2b8)],'toDelete':_0x33353e['length']},'activations':{'create':_0x3074ad[_0x4fd1ce(0x2b8)],'update':_0xf0eb35[_0x4fd1ce(0x2b8)],'delete':_0x381142['length']},'folders':_0x305fbd[_0x4fd1ce(0x2b8)]},'hasChanges':_0x1de611||_0x7bbf74||_0x26ce08||_0x4dbea7};}export async function buildPushExecutionContext(_0x2b519a,_0x3d4af3,_0x263e21,_0x13c2ee,_0x23e2f0,_0x10e77a){const _0x4e4657=a140_0x1afe10,_0x46f21f=extractRootFolderId(_0x263e21),{pathToId:_0x5aa122,idToPath:_0x38ec60}=buildFolderMaps(_0x23e2f0),_0x58c89c=buildSegmentNameToIdMap(_0x13c2ee),_0x2b6534=new Map(),{batchAsync:_0x3e469f}=await import(_0x4e4657(0x219)),[_0xa986dc,_0x5d7c45]=await Promise['all']([_0x2b519a[_0x4e4657(0x1c4)]['buildUserMaps'](),_0x2b519a[_0x4e4657(0x284)][_0x4e4657(0x1bd)](),((async()=>{const _0x2e8e2f=_0x4e4657;!_0x10e77a&&_0x13c2ee[_0x2e8e2f(0x2b8)]>0x0&&await _0x3e469f(_0x13c2ee,async _0x4cbbf5=>{const _0x2994e1=_0x2e8e2f,_0x3705c1=await _0x2b519a['segment'][_0x2994e1(0x20c)](_0x3d4af3,_0x4cbbf5['id']);_0x2b6534[_0x2994e1(0x1e6)](_0x4cbbf5['id'],_0x3705c1);});})())]),{emailToId:_0x1e1342,idToEmail:_0x5845dc}=_0xa986dc,_0x1e9cd6=buildConnectionMaps(_0x5d7c45);return{'rootFolderId':_0x46f21f,'folderPathToId':_0x5aa122,'folderIdToPath':_0x38ec60,'segmentNameToId':_0x58c89c,'activationsBySegmentId':_0x2b6534,'emailToIdMap':_0x1e1342,'idToEmailMap':_0x5845dc,'connectionNameToIdMap':_0x1e9cd6['nameToId'],'connectionIdToNameMap':_0x1e9cd6[_0x4e4657(0x239)],'connectionNameToTypeMap':_0x1e9cd6[_0x4e4657(0x22f)]};}export function createPushYamlContextForBundle(_0x5384e4,_0x329ba9,_0x278163,_0x166f5f,_0x22c547,_0x5afb9a,_0x21502a,_0x36f57b){const {existingLocalSegmentNames:_0x3d40cf,localExpandedRuleToNames:_0x483e9c}=_0x166f5f,_0x3ca7b3=new Set(),_0x2f642a=new Map(),_0x2e8ca9=new Map(),_0x2994f8=new Map(),_0x9b87b2=createJumpTargetCache(),_0x5584ec=new Map(),_0x19ed48=new Map(),_0x198497=new Set();let _0x3456c7;const _0x278dc3=_0x488842=>{const _0x10fabe={'resolveSegment':async _0x5db597=>{const _0x1359f7=a140_0x46f4,_0x187262=_0x2994f8[_0x1359f7(0x290)](_0x5db597);if(_0x187262!==undefined)return{'name':_0x187262,'isJourneyLocal':!![]};try{const _0x2e5740=await fetchSegment(_0x5384e4,_0x329ba9,_0x5db597,_0x278163);if(!_0x2e5740)throw new Error(_0x1359f7(0x293));const _0x29c418=generateJourneyLocalName(_0x2e5740['name']),_0x480da7=_0x2e5740[_0x1359f7(0x201)]===SEGMENT_KIND_JOURNEY&&_0x29c418!==undefined;let _0x399901=_0x2e5740[_0x1359f7(0x237)],_0x4bfefb;if(_0x480da7&&_0x2e5740['rule']){const _0x486aa3=apiRuleToYaml(_0x2e5740['rule']);_0x19ed48['set'](_0x5db597,_0x486aa3);const _0x29fb5d=async _0x3b6c75=>{const _0x45c87a=_0x1359f7,_0x3149c9=collectSegmentRefsFromRule(_0x3b6c75);for(const _0x485866 of _0x3149c9){if(!_0x19ed48[_0x45c87a(0x2b6)](_0x485866))try{const _0x3e7f88=await fetchSegment(_0x5384e4,_0x329ba9,_0x485866,_0x278163);if(_0x3e7f88?.[_0x45c87a(0x227)]){const _0x16745e=apiRuleToYaml(_0x3e7f88[_0x45c87a(0x227)]);_0x19ed48[_0x45c87a(0x1e6)](_0x485866,_0x16745e),await _0x29fb5d(_0x16745e);}}catch(_0x18d145){logger[_0x45c87a(0x1be)](_0x45c87a(0x1e5)+_0x485866+':\x20'+_0x18d145);}}};await _0x29fb5d(_0x486aa3);const _0x16e9c0=serializeExpandedRule(_0x486aa3,_0x19ed48),_0x54e734=_0x483e9c[_0x1359f7(0x290)](_0x16e9c0);if(_0x54e734&&_0x54e734[_0x1359f7(0x2b8)]>0x0){const _0x111d7d=_0x2f642a[_0x1359f7(0x290)](_0x16e9c0)||0x0,_0x59f0b3=_0x54e734[_0x111d7d]||_0x54e734[_0x54e734['length']-0x1];_0x2f642a[_0x1359f7(0x1e6)](_0x16e9c0,_0x111d7d+0x1),_0x399901=_0x59f0b3,_0x3ca7b3[_0x1359f7(0x20a)](_0x399901),_0x2994f8[_0x1359f7(0x1e6)](_0x5db597,_0x399901);const _0x39b4eb=await resolveRuleSegmentRefs(_0x486aa3,async _0x481325=>{const _0x4ae640=_0x1359f7,_0x114c9e=_0x2994f8[_0x4ae640(0x290)](_0x481325);if(_0x114c9e)return _0x114c9e;const _0xd7b05c=await _0x3456c7[_0x4ae640(0x22d)](_0x481325);return _0xd7b05c[_0x4ae640(0x237)];});_0x4bfefb={'description':_0x2e5740['description'],'rule':_0x39b4eb};}else{const _0x5f2858=_0x5584ec[_0x1359f7(0x290)](_0x16e9c0);if(_0x5f2858)_0x399901=_0x5f2858,_0x2994f8[_0x1359f7(0x1e6)](_0x5db597,_0x399901);else{if(_0x29c418){let _0x2b0be5=_0x29c418,_0x9bf16=0x2;while(_0x3ca7b3[_0x1359f7(0x2b6)](_0x2b0be5)||_0x3d40cf[_0x1359f7(0x2b6)](_0x2b0be5)){_0x2b0be5=_0x29c418+'_'+_0x9bf16,_0x9bf16++;}_0x3ca7b3[_0x1359f7(0x20a)](_0x2b0be5),_0x399901=_0x2b0be5;}_0x2994f8[_0x1359f7(0x1e6)](_0x5db597,_0x399901),_0x5584ec[_0x1359f7(0x1e6)](_0x16e9c0,_0x399901);const _0x749a14=await resolveRuleSegmentRefs(_0x486aa3,async _0x4c7b10=>{const _0x1957c6=_0x1359f7,_0x31569b=_0x2994f8[_0x1957c6(0x290)](_0x4c7b10);if(_0x31569b)return _0x31569b;const _0x3fe695=await _0x3456c7[_0x1957c6(0x22d)](_0x4c7b10);return _0x3fe695['name'];});_0x4bfefb={'description':_0x2e5740['description'],'rule':_0x749a14};}}}return{'name':_0x399901,'isJourneyLocal':_0x480da7,'definition':_0x4bfefb};}catch(_0xc66afe){return logger[_0x1359f7(0x1be)](_0x1359f7(0x1ce)+_0x5db597+':\x20'+_0xc66afe),{'name':_0x5db597,'isJourneyLocal':![]};}},'resolveActivation':async _0x4e4c9d=>{const _0x1f5cca=a140_0x46f4,_0x558905=_0x2e8ca9[_0x1f5cca(0x290)](_0x4e4c9d);if(_0x558905!==undefined)return{'name':_0x558905,'isJourneyLocal':!![]};try{let _0x3edeeb=_0x21502a?.[_0x1f5cca(0x290)](_0x4e4c9d);!_0x3edeeb&&(_0x3edeeb=await _0x5384e4['journey'][_0x1f5cca(0x286)](_0x488842,_0x4e4c9d));const _0x5b52c2=_0x3edeeb['attributes'][_0x1f5cca(0x1f2)][_0x1f5cca(0x237)]||_0x4e4c9d,_0x55d77b=sanitizeYamlKey(_0x5b52c2)||_0x1f5cca(0x294)+_0x4e4c9d,_0x38e6e5=_0x55d77b;_0x2e8ca9['set'](_0x4e4c9d,_0x38e6e5);const _0x458346=journeyActivationStepToYaml(_0x3edeeb,_0x22c547,_0x5afb9a);return{'name':_0x38e6e5,'isJourneyLocal':!![],'definition':_0x458346};}catch(_0x5334a2){return logger[_0x1f5cca(0x1be)](_0x1f5cca(0x278)+_0x4e4c9d+':\x20'+_0x5334a2),{'name':_0x4e4c9d,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x43cc83,_0x14e9bd)=>resolveJumpTarget(_0x43cc83,_0x14e9bd,_0x9b87b2,async _0x593c05=>{const _0x201d61=a140_0x46f4,_0xfdc578=_0x36f57b?.[_0x201d61(0x290)](_0x593c05);if(_0xfdc578)return _0xfdc578;return _0x5384e4[_0x201d61(0x1c3)]['getJourney'](_0x593c05);})};return _0x3456c7=_0x10fabe,_0x10fabe;},_0x2384c7=async _0x13ff8d=>{const _0x3cbeb4=a140_0x46f4,{collectSegmentIdsFromJourneyApi:_0x1c007a}=await import(_0x3cbeb4(0x213)),{batchAsync:_0x1f5660}=await import('../../utils/async.js'),_0x44cdd9=new Set();for(const _0xd0a9d9 of _0x13ff8d){let _0x53ff03=_0x36f57b?.[_0x3cbeb4(0x290)](_0xd0a9d9);!_0x53ff03&&(_0x53ff03=await _0x5384e4['journey'][_0x3cbeb4(0x266)](_0xd0a9d9));const _0xd1d195=_0x1c007a(_0x53ff03);for(const _0x34a9d0 of _0xd1d195){_0x44cdd9[_0x3cbeb4(0x20a)](_0x34a9d0);}}let _0xacb3c9=Array[_0x3cbeb4(0x287)](_0x44cdd9);while(_0xacb3c9[_0x3cbeb4(0x2b8)]>0x0){const _0x391578=_0xacb3c9[_0x3cbeb4(0x21c)](_0x35dbef=>!_0x198497['has'](_0x35dbef));if(_0x391578[_0x3cbeb4(0x2b8)]===0x0)break;const _0xf674f4=await _0x1f5660(_0x391578,async _0x306c29=>{const _0x743241=_0x3cbeb4;_0x198497[_0x743241(0x20a)](_0x306c29);const _0x3edf5b=await fetchSegment(_0x5384e4,_0x329ba9,_0x306c29,_0x278163);if(!_0x3edf5b)return null;return{'segmentId':_0x306c29,'segment':_0x3edf5b};},0xa),_0x1362c1=new Set();for(const _0x4b70df of _0xf674f4){if(!_0x4b70df?.['segment']?.['rule'])continue;const _0x53249c=apiRuleToYaml(_0x4b70df[_0x3cbeb4(0x21a)][_0x3cbeb4(0x227)]);_0x19ed48[_0x3cbeb4(0x1e6)](_0x4b70df[_0x3cbeb4(0x292)],_0x53249c);const _0x3a18d2=collectSegmentRefsFromRule(_0x53249c);for(const _0x14ab8a of _0x3a18d2){!_0x198497['has'](_0x14ab8a)&&_0x1362c1[_0x3cbeb4(0x20a)](_0x14ab8a);}}_0xacb3c9=Array[_0x3cbeb4(0x287)](_0x1362c1);}};return{'createYamlContext':_0x278dc3,'prefetchJourneySegments':_0x2384c7};}export async function executePushSegments(_0x3f8cdf,_0x46216e,_0x2a623f,_0x54ca02,_0x3cb364){const _0x271ee4=a140_0x1afe10,{segmentDefToCreateRequest:_0x59aef2,segmentDefToUpdateRequest:_0x7d7582}=await import(_0x271ee4(0x204)),_0x2fc4c8=_0x2a623f['folderPathToId'],_0x54e7b8=0x5,_0xfb1740=async _0x3ff657=>{const _0x4dc89f=_0x271ee4,_0x2e8bf9=_0x3ff657[_0x4dc89f(0x21e)]?_0x2fc4c8[_0x4dc89f(0x290)](_0x3ff657[_0x4dc89f(0x21e)]):undefined;let _0xb6e31e;const _0xc3a676={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x57a932=_0x3ff657[_0x4dc89f(0x1de)];if(_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x227)]){const _0x5577cd=createSegmentIdResolver(_0x2a623f[_0x4dc89f(0x2a6)],_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x237)]),_0x5b8eb8=await resolveRuleSegmentIds(_0x3ff657[_0x4dc89f(0x1de)]['rule'],_0x5577cd);_0x57a932={..._0x3ff657[_0x4dc89f(0x1de)],'rule':_0x5b8eb8};}try{if(_0x3ff657['isNew']){_0x3cb364['onProgress']?.({'type':_0x4dc89f(0x1d4),'name':_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x237)]});const _0x5886ca=_0x59aef2(_0x57a932,_0x2e8bf9),_0x44816e=await _0x3cb364['withProgress']('Creating\x20segment\x20\x27'+_0x3ff657['yamlConfig'][_0x4dc89f(0x237)]+'\x27...',()=>_0x3f8cdf[_0x4dc89f(0x21a)][_0x4dc89f(0x2ab)](_0x54ca02[_0x4dc89f(0x1f6)],_0x5886ca));_0xb6e31e=_0x44816e[_0x4dc89f(0x269)]['id'],_0x2a623f[_0x4dc89f(0x2a6)][_0x4dc89f(0x1e6)](_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x237)],_0xb6e31e),_0xc3a676['createdSegmentId']={'name':_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x237)],'id':_0xb6e31e},_0x3cb364[_0x4dc89f(0x2bd)]?.({'type':_0x4dc89f(0x24f),'name':_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x237)],'segmentId':_0xb6e31e}),_0x3cb364[_0x4dc89f(0x24c)]?.('Created\x20segment\x20\x27'+_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x237)]+'\x27'),_0xc3a676[_0x4dc89f(0x2af)]=0x1;}else{if(_0x3ff657[_0x4dc89f(0x267)]){_0x3cb364[_0x4dc89f(0x2bd)]?.({'type':_0x4dc89f(0x279),'name':_0x3ff657[_0x4dc89f(0x1de)]['name']});const _0x3f4b85=_0x7d7582(_0x57a932);_0x2e8bf9!==_0x3ff657[_0x4dc89f(0x22a)]?.[_0x4dc89f(0x253)]&&(_0x3f4b85[_0x4dc89f(0x253)]=_0x2e8bf9?parseInt(_0x2e8bf9,0xa):undefined),await _0x3cb364[_0x4dc89f(0x274)](_0x4dc89f(0x1e3)+_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x237)]+_0x4dc89f(0x29e),()=>_0x3f8cdf['segment'][_0x4dc89f(0x230)](_0x54ca02['parentId'],_0x3ff657['existingSegment']['id'],_0x3f4b85)),_0xb6e31e=_0x3ff657[_0x4dc89f(0x22a)]['id'],_0x3cb364['onProgress']?.({'type':'segment_updated','name':_0x3ff657[_0x4dc89f(0x1de)]['name']}),_0x3cb364[_0x4dc89f(0x24c)]?.(_0x4dc89f(0x29c)+_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x237)]+'\x27'),_0xc3a676['updated']=0x1;}else _0xb6e31e=_0x3ff657[_0x4dc89f(0x22a)]['id'];}}catch(_0x305345){const _0x547904=isHttp400Error(_0x305345),_0x312c86=_0x547904?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x4dc89f(0x202)],_0x17af9b=getErrorMessage(_0x305345);throw new SDKError(_0x312c86,'Failed\x20to\x20'+(_0x3ff657[_0x4dc89f(0x248)]?_0x4dc89f(0x210):_0x4dc89f(0x25c))+_0x4dc89f(0x1d1)+_0x3ff657[_0x4dc89f(0x1ee)]+_0x4dc89f(0x272)+_0x17af9b,_0x305345);}try{const _0x2c3a2b=await syncActivationsForSegment(_0x3f8cdf,_0x54ca02[_0x4dc89f(0x1f6)],_0xb6e31e,_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x237)],_0x3ff657[_0x4dc89f(0x229)],_0x3cb364,_0x3ff657[_0x4dc89f(0x1ee)]);_0xc3a676[_0x4dc89f(0x1b8)]=_0x2c3a2b;}catch(_0x491755){if(_0x491755 instanceof SDKError)throw _0x491755;throw new SDKError(ErrorCode[_0x4dc89f(0x1ca)],_0x4dc89f(0x29d)+_0x3ff657[_0x4dc89f(0x1de)][_0x4dc89f(0x237)]+'\x27\x20from\x20file:\x20'+_0x3ff657[_0x4dc89f(0x1ee)]+_0x4dc89f(0x272)+getErrorMessage(_0x491755),_0x491755);}return _0xc3a676;},_0x4725d1=await batchAsync(_0x46216e,_0xfb1740,_0x54e7b8),_0x2b0ad3={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x28d77d of _0x4725d1){_0x2b0ad3[_0x271ee4(0x2af)]+=_0x28d77d[_0x271ee4(0x2af)],_0x2b0ad3[_0x271ee4(0x24a)]+=_0x28d77d[_0x271ee4(0x24a)],_0x28d77d[_0x271ee4(0x209)]&&_0x2b0ad3[_0x271ee4(0x252)]['set'](_0x28d77d[_0x271ee4(0x209)]['name'],_0x28d77d[_0x271ee4(0x209)]['id']),_0x2b0ad3[_0x271ee4(0x1b8)][_0x271ee4(0x2af)]+=_0x28d77d[_0x271ee4(0x1b8)][_0x271ee4(0x2af)],_0x2b0ad3[_0x271ee4(0x1b8)][_0x271ee4(0x24a)]+=_0x28d77d[_0x271ee4(0x1b8)][_0x271ee4(0x24a)],_0x2b0ad3['activations'][_0x271ee4(0x234)]+=_0x28d77d[_0x271ee4(0x1b8)][_0x271ee4(0x234)];}return _0x2b0ad3;}async function syncActivationsForSegment(_0x2d983b,_0x3cd9bb,_0x42be47,_0x4d0938,_0x289bf1,_0xa346f7,_0x21609f){const _0x2fe9bb=a140_0x1afe10,_0x3518b4={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x488bff of _0x289bf1){try{if(_0x488bff[_0x2fe9bb(0x233)]==='create'&&_0x488bff['validatedRequest'])_0xa346f7[_0x2fe9bb(0x2bd)]?.({'type':_0x2fe9bb(0x1df),'segmentName':_0x4d0938,'activationName':_0x488bff[_0x2fe9bb(0x237)]}),await _0xa346f7['withProgress'](_0x2fe9bb(0x29b)+_0x488bff[_0x2fe9bb(0x237)]+'\x27...',()=>_0x2d983b['segment'][_0x2fe9bb(0x275)](_0x3cd9bb,_0x42be47,_0x488bff[_0x2fe9bb(0x1fe)])),_0xa346f7[_0x2fe9bb(0x2bd)]?.({'type':_0x2fe9bb(0x241),'segmentName':_0x4d0938,'activationName':_0x488bff[_0x2fe9bb(0x237)]}),_0xa346f7[_0x2fe9bb(0x24c)]?.(_0x2fe9bb(0x23c)+_0x488bff[_0x2fe9bb(0x237)]+'\x27'),_0x3518b4[_0x2fe9bb(0x2af)]++;else{if(_0x488bff[_0x2fe9bb(0x233)]===_0x2fe9bb(0x25c)&&_0x488bff['validatedRequest']&&_0x488bff[_0x2fe9bb(0x1d0)])_0xa346f7[_0x2fe9bb(0x2bd)]?.({'type':_0x2fe9bb(0x2a0),'segmentName':_0x4d0938,'activationName':_0x488bff[_0x2fe9bb(0x237)]}),await _0xa346f7[_0x2fe9bb(0x274)]('Updating\x20activation\x20\x27'+_0x488bff[_0x2fe9bb(0x237)]+_0x2fe9bb(0x29e),()=>_0x2d983b[_0x2fe9bb(0x21a)]['updateActivation'](_0x3cd9bb,_0x42be47,_0x488bff[_0x2fe9bb(0x1d0)]['id'],_0x488bff[_0x2fe9bb(0x1fe)])),_0xa346f7[_0x2fe9bb(0x2bd)]?.({'type':_0x2fe9bb(0x22b),'segmentName':_0x4d0938,'activationName':_0x488bff[_0x2fe9bb(0x237)]}),_0xa346f7[_0x2fe9bb(0x24c)]?.(_0x2fe9bb(0x256)+_0x488bff[_0x2fe9bb(0x237)]+'\x27'),_0x3518b4['updated']++;else _0x488bff[_0x2fe9bb(0x233)]==='delete'&&_0x488bff[_0x2fe9bb(0x1d0)]&&(_0xa346f7[_0x2fe9bb(0x2bd)]?.({'type':_0x2fe9bb(0x207),'segmentName':_0x4d0938,'activationName':_0x488bff[_0x2fe9bb(0x237)]}),await _0xa346f7[_0x2fe9bb(0x274)](_0x2fe9bb(0x258)+_0x488bff[_0x2fe9bb(0x237)]+_0x2fe9bb(0x29e),()=>_0x2d983b[_0x2fe9bb(0x21a)][_0x2fe9bb(0x257)](_0x3cd9bb,_0x42be47,_0x488bff['existingActivation']['id'])),_0xa346f7['onProgress']?.({'type':_0x2fe9bb(0x1f8),'segmentName':_0x4d0938,'activationName':_0x488bff[_0x2fe9bb(0x237)]}),_0xa346f7[_0x2fe9bb(0x283)]?.(_0x2fe9bb(0x1d6)+_0x488bff[_0x2fe9bb(0x237)]+'\x27'),_0x3518b4['deleted']++);}}catch(_0x59ab97){const _0x30758d=isHttp400Error(_0x59ab97),_0x41f507=_0x30758d?ErrorCode[_0x2fe9bb(0x26d)]:ErrorCode[_0x2fe9bb(0x1ca)],_0x3e207a=getErrorMessage(_0x59ab97);throw new SDKError(_0x41f507,'Failed\x20to\x20'+_0x488bff[_0x2fe9bb(0x233)]+'\x20activation\x20\x27'+_0x488bff[_0x2fe9bb(0x237)]+_0x2fe9bb(0x1e9)+_0x21609f+'\x0a\x20\x20'+_0x3e207a,_0x59ab97);}}return _0x3518b4;}export async function executePushFolders(_0x386382,_0x2b612a,_0x5039c8,_0x145843,_0x2dbff5){const _0x121874=a140_0x1afe10,_0x3dd8d8=new Map(_0x5039c8),_0x2fc424=sortFoldersByDepth(_0x2b612a);for(const _0x253d4f of _0x2fc424){const _0x46a205=_0x253d4f['split']('/'),_0x38f04b=_0x46a205[_0x46a205[_0x121874(0x2b8)]-0x1],_0x5e09d8=_0x46a205[_0x121874(0x1fd)](0x0,-0x1)[_0x121874(0x2bb)]('/'),_0x308248=_0x3dd8d8[_0x121874(0x290)](_0x5e09d8);_0x2dbff5[_0x121874(0x2bd)]?.({'type':_0x121874(0x288),'folder':_0x253d4f});const _0x191e9b={'name':_0x38f04b,'parentFolderId':_0x308248},_0x2e2873=await _0x2dbff5[_0x121874(0x274)]('Creating\x20folder\x20\x27'+_0x253d4f+_0x121874(0x29e),()=>_0x386382[_0x121874(0x21a)][_0x121874(0x27e)](_0x145843[_0x121874(0x1f6)],_0x191e9b));_0x3dd8d8[_0x121874(0x1e6)](_0x253d4f,_0x2e2873[_0x121874(0x269)]['id']),_0x2dbff5[_0x121874(0x2bd)]?.({'type':_0x121874(0x238),'folder':_0x253d4f,'folderId':_0x2e2873[_0x121874(0x269)]['id']}),_0x2dbff5[_0x121874(0x254)]?.(_0x121874(0x20e)+_0x253d4f+'\x27');}return _0x3dd8d8;}export async function executePushSegmentDeletions(_0x120ab0,_0x3dc728,_0x5ea515){const _0x400717=a140_0x1afe10;if(_0x3dc728['length']===0x0)return 0x0;const {batchAsync:_0x5ac810}=await import(_0x400717(0x219)),_0x245756=0x5,_0x3bae73=await _0x5ac810(_0x3dc728,async _0x3b1267=>{const _0x3fc811=_0x400717;return _0x5ea515[_0x3fc811(0x2bd)]?.({'type':'segment_deleting','name':_0x3b1267[_0x3fc811(0x237)]}),await _0x120ab0['segment'][_0x3fc811(0x27c)](_0x3b1267['id']),_0x5ea515[_0x3fc811(0x2bd)]?.({'type':_0x3fc811(0x205),'name':_0x3b1267[_0x3fc811(0x237)]}),_0x5ea515[_0x3fc811(0x283)]?.(_0x3fc811(0x1e8)+_0x3b1267[_0x3fc811(0x237)]+'\x27'),0x1;},_0x245756);return _0x3bae73[_0x400717(0x1c1)]((_0x3fbcc0,_0x1df587)=>_0x3fbcc0+_0x1df587,0x0);}export async function executePushJourneys(_0x5db58b,_0x2d5666,_0x286dfc,_0x124924,_0x3e64aa){const _0x13e6e3=a140_0x1afe10,{journeyDefToRequest:_0x3aa203}=await import(_0x13e6e3(0x213)),{activationDefToCreateRequest:_0x213905,yamlRuleToApi:_0xe7ff9,validateSegmentRule:_0x4e9f02}=await import(_0x13e6e3(0x204)),_0x49a74c={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x2a09b4=new Map(_0x286dfc['segmentNameToId']),_0x33c340=0x5;for(let _0x151c4b=0x0;_0x151c4b<_0x2d5666['length'];_0x151c4b+=_0x33c340){const _0x203d13=_0x2d5666['slice'](_0x151c4b,_0x151c4b+_0x33c340),_0x267b66=await Promise[_0x13e6e3(0x1c9)](_0x203d13['map'](async _0x158dc7=>{const _0x4a7301=_0x13e6e3;if(!_0x158dc7['isNew']&&!_0x158dc7['hasChanges'])return{'action':_0x4a7301(0x235),'name':_0x158dc7['yamlConfig'][_0x4a7301(0x237)],'journeyId':_0x158dc7[_0x4a7301(0x23a)]?.['id']};const _0x3a2d21=_0x158dc7['folderPath']?_0x286dfc[_0x4a7301(0x27a)][_0x4a7301(0x290)](_0x158dc7[_0x4a7301(0x21e)]):undefined;_0x3e64aa['onProgress']?.({'type':_0x158dc7[_0x4a7301(0x248)]?_0x4a7301(0x211):_0x4a7301(0x1f4),'name':_0x158dc7['yamlConfig'][_0x4a7301(0x237)]});try{const _0x232a98=await executeSingleJourneyPush(_0x5db58b,_0x158dc7,{..._0x286dfc,'segmentNameToId':_0x2a09b4},{'parentId':_0x124924[_0x4a7301(0x1f6)],'rootFolderId':_0x124924[_0x4a7301(0x25d)],'folderId':_0x3a2d21,'verbose':_0x124924['verbose']},_0x3e64aa,{'journeyDefToRequest':_0x3aa203,'activationDefToCreateRequest':_0x213905,'yamlRuleToApi':_0xe7ff9,'validateSegmentRule':_0x4e9f02});for(const [_0x35a5ba,_0xbf9a9]of _0x232a98[_0x4a7301(0x2b0)]){_0x2a09b4[_0x4a7301(0x1e6)](_0x35a5ba,_0xbf9a9),_0x49a74c['embeddedSegmentNameToId'][_0x4a7301(0x1e6)](_0x35a5ba,_0xbf9a9);}if(_0x232a98['action']===_0x4a7301(0x2af))_0x3e64aa[_0x4a7301(0x2bd)]?.({'type':_0x4a7301(0x1f5),'name':_0x158dc7[_0x4a7301(0x1de)][_0x4a7301(0x237)],'journeyId':_0x232a98[_0x4a7301(0x20f)]}),_0x3e64aa[_0x4a7301(0x24c)]?.(_0x4a7301(0x24e)+_0x158dc7[_0x4a7301(0x1de)][_0x4a7301(0x237)]+'\x27'),_0x49a74c[_0x4a7301(0x2af)]++;else _0x232a98[_0x4a7301(0x29a)]===_0x4a7301(0x24a)&&(_0x3e64aa['onProgress']?.({'type':_0x4a7301(0x21d),'name':_0x158dc7['yamlConfig']['name']}),_0x3e64aa['logSuccess']?.(_0x4a7301(0x226)+_0x158dc7['yamlConfig'][_0x4a7301(0x237)]+'\x27'),_0x49a74c[_0x4a7301(0x24a)]++);return{'action':_0x232a98[_0x4a7301(0x29a)],'name':_0x158dc7['yamlConfig'][_0x4a7301(0x237)],'journeyId':_0x232a98[_0x4a7301(0x20f)]};}catch(_0x32e26d){const _0x4cf812=isHttp400Error(_0x32e26d),_0x2c91ab=_0x4cf812?ErrorCode[_0x4a7301(0x246)]:ErrorCode[_0x4a7301(0x2bc)],_0x5d6807=getErrorMessage(_0x32e26d);throw new SDKError(_0x2c91ab,_0x4a7301(0x285)+(_0x158dc7[_0x4a7301(0x248)]?_0x4a7301(0x210):_0x4a7301(0x25c))+_0x4a7301(0x212)+_0x158dc7[_0x4a7301(0x1ee)]+_0x4a7301(0x272)+_0x5d6807,_0x32e26d);}}));_0x49a74c[_0x13e6e3(0x244)]['push'](..._0x267b66);}return _0x49a74c;}async function matchExistingJourneySegments(_0x1a8e4c,_0x4cd92b,_0x21c7bd,_0x5de667,_0x288ef2){const _0x3dc3e7=a140_0x1afe10;if(!_0x4cd92b['existingJourney']||!_0x4cd92b[_0x3dc3e7(0x1de)][_0x3dc3e7(0x208)])return;const _0x5dabdc=new Map(),_0x4d064f=new Set();for(const _0x4957d2 of Object[_0x3dc3e7(0x240)](_0x4cd92b[_0x3dc3e7(0x1de)][_0x3dc3e7(0x208)])){const _0x128bbf=generateDeterministicJourneySegmentName(_0x4cd92b[_0x3dc3e7(0x1de)][_0x3dc3e7(0x237)],_0x4957d2);_0x5dabdc[_0x3dc3e7(0x1e6)](_0x128bbf,_0x4957d2),_0x4d064f['add'](_0x4957d2);}const _0x1bea95=[],_0x1bc414=collectSegmentIdsFromJourneyApi(_0x4cd92b[_0x3dc3e7(0x23a)]);for(const _0x32b1f7 of _0x1bc414){const _0x38a6a3=await fetchSegment(_0x1a8e4c,_0x21c7bd,_0x32b1f7,_0x5de667);if(!_0x38a6a3?.[_0x3dc3e7(0x237)])continue;const _0x5d5201=_0x5dabdc[_0x3dc3e7(0x290)](_0x38a6a3[_0x3dc3e7(0x237)]);_0x5d5201?(_0x288ef2[_0x3dc3e7(0x1e6)](_0x5d5201,_0x32b1f7),_0x4d064f['delete'](_0x5d5201)):_0x1bea95['push']({'id':_0x32b1f7,'seg':_0x38a6a3});}if(_0x4d064f[_0x3dc3e7(0x1c5)]>0x0&&_0x1bea95[_0x3dc3e7(0x2b8)]>0x0){const {localExpandedRuleToNames:_0x33286d}=buildLocalExpandedRuleMappings(_0x4cd92b['yamlConfig']),_0x19babe=new Map();for(const {id:_0x36b4bf,seg:_0x2ae548}of _0x1bea95){if(_0x2ae548[_0x3dc3e7(0x227)]){const _0x4f2c00=apiRuleToYaml(_0x2ae548[_0x3dc3e7(0x227)]);_0x19babe[_0x3dc3e7(0x1e6)](_0x36b4bf,_0x4f2c00);}}for(const {id:_0xcdc57e,seg:_0x308804}of _0x1bea95){if(!_0x308804['rule'])continue;const _0x2c6cae=_0x19babe[_0x3dc3e7(0x290)](_0xcdc57e);if(!_0x2c6cae)continue;const _0x17d6de=serializeExpandedRule(_0x2c6cae,_0x19babe),_0x363751=_0x33286d[_0x3dc3e7(0x290)](_0x17d6de);if(_0x363751){const _0x276dee=_0x363751['find'](_0x2ff109=>_0x4d064f[_0x3dc3e7(0x2b6)](_0x2ff109));_0x276dee&&(_0x288ef2[_0x3dc3e7(0x1e6)](_0x276dee,_0xcdc57e),_0x4d064f[_0x3dc3e7(0x21b)](_0x276dee),logger[_0x3dc3e7(0x1be)]('Matched\x20server\x20segment\x20\x27'+_0x308804[_0x3dc3e7(0x237)]+_0x3dc3e7(0x214)+_0x276dee+_0x3dc3e7(0x2ae)));}}}}async function executeSingleJourneyPush(_0x51ea95,_0x8693c3,_0x12af79,_0x3a7c5e,_0x962171,_0x2df1c1){const _0x2af0f2=a140_0x1afe10,{journeyDefToRequest:_0x489405,activationDefToCreateRequest:_0xe1b92c,yamlRuleToApi:_0x4c179b,validateSegmentRule:_0x34f42e}=_0x2df1c1,_0x18b4c8=new Map(),_0x5cd800=new Map();recoverSegmentIdsFromPushRecovery(_0x8693c3,_0x18b4c8,_0x12af79['segmentNameToId']);const _0x345373=new Map(),_0x132aae=new Map(),_0x519d87=new Map();let _0x251ee5;const _0x5e34d2=async()=>{const _0x397a5f=a140_0x46f4;if(_0x251ee5)return;_0x251ee5=new Map();if(!_0x8693c3[_0x397a5f(0x23a)])return;const _0x325570=await _0x51ea95['journey'][_0x397a5f(0x20c)](_0x8693c3['existingJourney']['id']);for(const _0x458354 of _0x325570){const _0x4ddd07=journeyActivationStepToYaml(_0x458354,_0x12af79[_0x397a5f(0x1ba)],_0x12af79[_0x397a5f(0x291)]),_0x394553=activationSignature(_0x4ddd07);!_0x251ee5['has'](_0x394553)&&_0x251ee5[_0x397a5f(0x1e6)](_0x394553,_0x458354['id']),_0x4ddd07['name']&&_0x5cd800[_0x397a5f(0x1e6)](_0x4ddd07[_0x397a5f(0x237)],_0x458354['id']);}};await matchExistingJourneySegments(_0x51ea95,_0x8693c3,_0x3a7c5e[_0x2af0f2(0x1f6)],_0x12af79['existingSegments'],_0x12af79[_0x2af0f2(0x2a6)]);const _0x347971={'resolveSegmentId':async _0x2c1d82=>{const _0x1d093d=_0x2af0f2,_0xf5b7a9=_0x12af79[_0x1d093d(0x2a6)][_0x1d093d(0x290)](_0x2c1d82);if(!_0xf5b7a9)throw new SDKError(ErrorCode[_0x1d093d(0x1dc)],'Segment\x20not\x20found:\x20'+_0x2c1d82+_0x1d093d(0x2a3)+_0x8693c3[_0x1d093d(0x1de)][_0x1d093d(0x237)]+')');return _0xf5b7a9;},'resolveEmbeddedSegmentId':async(_0x17c472,_0x33a54e)=>{const _0x1079c9=_0x2af0f2,_0x198ab3=_0x12af79['segmentNameToId']['get'](_0x17c472);if(_0x198ab3)return _0x198ab3;const _0x4aff37=_0x12af79['existingSegments'][_0x1079c9(0x1ec)](_0x39c632=>_0x39c632[_0x1079c9(0x237)]===_0x17c472);if(_0x4aff37)return _0x12af79[_0x1079c9(0x2a6)]['set'](_0x17c472,_0x4aff37['id']),_0x4aff37['id'];if(_0x8693c3['isNew']){const {stageName:_0x4c0633,criteriaName:_0x473f32}=findSegmentCriteriaLocation(_0x8693c3['yamlConfig'],_0x17c472);return _0x34f42e(_0x17c472,_0x33a54e[_0x1079c9(0x227)]),_0x132aae[_0x1079c9(0x1e6)](_0x17c472,{'definition':_0x33a54e,'stageName':_0x4c0633,'criteriaName':_0x473f32}),createPendingSegmentId(_0x17c472);}const _0x2da81d=_0x8693c3[_0x1079c9(0x23a)]?.['id'];if(!_0x2da81d)throw new SDKError(ErrorCode[_0x1079c9(0x2b1)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x1bc690=_0x345373[_0x1079c9(0x290)](_0x17c472);if(_0x1bc690)return _0x1bc690;const _0x51d694=((async()=>{const _0x1ff9c5=_0x1079c9;_0x34f42e(_0x17c472,_0x33a54e[_0x1ff9c5(0x227)]);const _0x4ce0d0=generateDeterministicJourneySegmentName(_0x8693c3[_0x1ff9c5(0x1de)]['name'],_0x17c472),_0x5b9249=_0x12af79['existingSegments'][_0x1ff9c5(0x1ec)](_0x24c25a=>_0x24c25a[_0x1ff9c5(0x237)]===_0x4ce0d0),_0x9b014f=createSegmentIdResolver(_0x12af79[_0x1ff9c5(0x2a6)],_0x17c472),_0x5db664=await resolveRuleSegmentIds(_0x33a54e[_0x1ff9c5(0x227)],_0x9b014f);let _0x3e6292;return _0x5b9249?(await _0x51ea95[_0x1ff9c5(0x21a)][_0x1ff9c5(0x230)](_0x3a7c5e[_0x1ff9c5(0x1f6)],_0x5b9249['id'],{'description':_0x33a54e[_0x1ff9c5(0x281)]||_0x1ff9c5(0x28d)+_0x17c472,'rule':_0x4c179b(_0x5db664,!![]),'countPopulation':!![]}),_0x3e6292=_0x5b9249['id'],saveSegmentToPushRecovery(_0x8693c3[_0x1ff9c5(0x1ee)],_0x8693c3[_0x1ff9c5(0x1de)][_0x1ff9c5(0x237)],_0x17c472,{'segmentId':_0x3e6292,'uniqueServerName':_0x4ce0d0,'createdAt':new Date()[_0x1ff9c5(0x289)]()})):_0x3e6292=await createOrRecoverEmbeddedSegment(_0x51ea95,_0x8693c3,{'localName':_0x17c472,'uniqueSegmentName':_0x4ce0d0,'description':_0x33a54e['description']||_0x1ff9c5(0x28d)+_0x17c472,'journeyId':_0x2da81d,'resolvedRule':_0x5db664,'parentId':_0x3a7c5e[_0x1ff9c5(0x1f6)],'folderId':_0x3a7c5e[_0x1ff9c5(0x25d)]||''},_0x4c179b),_0x12af79[_0x1ff9c5(0x2a6)][_0x1ff9c5(0x1e6)](_0x17c472,_0x3e6292),_0x18b4c8[_0x1ff9c5(0x1e6)](_0x17c472,_0x3e6292),_0x3e6292;})());_0x345373['set'](_0x17c472,_0x51d694);try{return await _0x51d694;}finally{_0x345373[_0x1079c9(0x21b)](_0x17c472);}},'resolveActivationId':async _0x511329=>{const _0x3d8b63=_0x2af0f2,_0x437e68=_0x5cd800[_0x3d8b63(0x290)](_0x511329);if(_0x437e68)return _0x437e68;if(_0x8693c3[_0x3d8b63(0x23a)]){await _0x5e34d2();const _0x50868d=_0x5cd800[_0x3d8b63(0x290)](_0x511329);if(_0x50868d)return _0x50868d;}throw new SDKError(ErrorCode['NOT_FOUND'],_0x3d8b63(0x2b7)+_0x511329+_0x3d8b63(0x2a3)+_0x8693c3['yamlConfig']['name']+').\x20'+_0x3d8b63(0x298));},'resolveEmbeddedActivationId':async(_0x3df0dc,_0x6121e6)=>{const _0x3be5a0=_0x2af0f2,_0x4b6e86=_0x5cd800[_0x3be5a0(0x290)](_0x3df0dc);if(_0x4b6e86)return _0x4b6e86;if(_0x8693c3['isNew'])return _0x519d87[_0x3be5a0(0x1e6)](_0x3df0dc,_0x6121e6),createPendingActivationId(_0x3df0dc);if(_0x8693c3[_0x3be5a0(0x23a)]){await _0x5e34d2();const _0x73d3f0=_0x5cd800[_0x3be5a0(0x290)](_0x6121e6['name']);if(_0x73d3f0)return _0x5cd800['set'](_0x3df0dc,_0x73d3f0),_0x73d3f0;const _0x4d0387=activationSignature(_0x6121e6),_0x5227e1=_0x251ee5?.[_0x3be5a0(0x290)](_0x4d0387);if(_0x5227e1)return _0x5cd800[_0x3be5a0(0x1e6)](_0x3df0dc,_0x5227e1),_0x5227e1;const _0x1f530e=await _0xe1b92c(_0x6121e6,_0x12af79[_0x3be5a0(0x200)]),_0x18a5ca={..._0x1f530e,..._0x6121e6[_0x3be5a0(0x1e7)]!==undefined&&{'runAfterJourneyRefresh':_0x6121e6[_0x3be5a0(0x1e7)]}},_0x46468c=await _0x51ea95[_0x3be5a0(0x1c3)][_0x3be5a0(0x275)](_0x8693c3[_0x3be5a0(0x23a)]['id'],_0x18a5ca);return _0x5cd800[_0x3be5a0(0x1e6)](_0x3df0dc,_0x46468c['id']),_0x46468c['id'];}throw new SDKError(ErrorCode['INTERNAL'],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x2257be=>{const _0x5b1d0a=_0x2af0f2;try{return await _0x51ea95[_0x5b1d0a(0x1c3)]['resolveJourneyId'](_0x3a7c5e[_0x5b1d0a(0x1f6)],_0x2257be);}catch(_0x268cb5){throw new SDKError(ErrorCode['NOT_FOUND'],'Journey\x20\x27'+_0x2257be+_0x5b1d0a(0x263)+_0x8693c3['yamlConfig'][_0x5b1d0a(0x237)]+'\x27)',_0x268cb5);}},'resolveStageId':async(_0x245eb1,_0x2f3ed2)=>{const _0x33261d=_0x2af0f2,_0x2d7dca=await _0x51ea95[_0x33261d(0x1c3)]['getJourney'](_0x245eb1),_0x209315=_0x2d7dca['attributes'][_0x33261d(0x2b4)]['find'](_0x33d882=>_0x33d882[_0x33261d(0x237)][_0x33261d(0x25f)]()===_0x2f3ed2['toLowerCase']());if(!_0x209315?.['id'])throw new SDKError(ErrorCode[_0x33261d(0x27b)],_0x33261d(0x1f9)+_0x2f3ed2+_0x33261d(0x1bb)+(_0x2d7dca['attributes']['journeyBundleName']||_0x2d7dca[_0x33261d(0x1ff)][_0x33261d(0x237)])+'\x27');return _0x209315['id'];}},_0x282632=await _0x489405(_0x8693c3[_0x2af0f2(0x1de)],_0x3a7c5e[_0x2af0f2(0x1f6)],_0x347971),_0x3e69a2=_0x3a7c5e[_0x2af0f2(0x295)]||_0x3a7c5e[_0x2af0f2(0x25d)];_0x3e69a2&&(_0x282632[_0x2af0f2(0x28e)]={'parentFolder':{'data':{'id':_0x3e69a2,'type':'folder'}}});if(_0x8693c3[_0x2af0f2(0x248)]){if(_0x132aae[_0x2af0f2(0x1c5)]>0x0||_0x519d87[_0x2af0f2(0x1c5)]>0x0)return await executeThreeStepJourneyCreate(_0x51ea95,_0x8693c3,_0x282632,{'pendingEmbeddedSegments':_0x132aae,'pendingEmbeddedActivations':_0x519d87,'embeddedSegmentNameToId':_0x18b4c8,'journeyActivationNameToId':_0x5cd800},{..._0x3a7c5e,'effectiveFolderId':_0x3e69a2},_0x12af79,_0x962171,_0x2df1c1);else{ensureJourneyDefaults(_0x282632[_0x2af0f2(0x1ff)]);const _0xbe384f=await _0x51ea95[_0x2af0f2(0x1c3)][_0x2af0f2(0x210)](_0x282632);return deletePushRecovery(_0x8693c3[_0x2af0f2(0x1ee)]),{'action':_0x2af0f2(0x2af),'journeyId':_0xbe384f['id'],'embeddedSegmentNameToId':_0x18b4c8};}}else{if(_0x8693c3[_0x2af0f2(0x267)]&&_0x8693c3[_0x2af0f2(0x23a)]){_0x282632['id']=_0x8693c3[_0x2af0f2(0x23a)]['id'];const _0x2e7bc3=_0x282632[_0x2af0f2(0x1ff)];_0x8693c3[_0x2af0f2(0x23a)][_0x2af0f2(0x1ff)]?.[_0x2af0f2(0x224)]&&(_0x2e7bc3['journeyBundleName']=_0x8693c3['existingJourney']['attributes'][_0x2af0f2(0x224)]);const _0x378a1f=_0x8693c3[_0x2af0f2(0x23a)][_0x2af0f2(0x1ff)]?.[_0x2af0f2(0x2b4)];return _0x378a1f&&_0x282632['attributes'][_0x2af0f2(0x2b4)]&&injectExistingStageIds(_0x282632[_0x2af0f2(0x1ff)]['journeyStages'],_0x378a1f),ensureJourneyDefaults(_0x2e7bc3),await _0x51ea95[_0x2af0f2(0x1c3)]['update'](_0x8693c3[_0x2af0f2(0x23a)]['id'],_0x282632),deletePushRecovery(_0x8693c3[_0x2af0f2(0x1ee)]),{'action':'updated','journeyId':_0x8693c3[_0x2af0f2(0x23a)]['id'],'embeddedSegmentNameToId':_0x18b4c8};}}return deletePushRecovery(_0x8693c3[_0x2af0f2(0x1ee)]),{'action':_0x2af0f2(0x235),'journeyId':_0x8693c3[_0x2af0f2(0x23a)]?.['id'],'embeddedSegmentNameToId':_0x18b4c8};}function findSegmentCriteriaLocation(_0x1ef74c,_0x14a8fd){const _0x448d33=a140_0x1afe10,_0x5953bb=_0x1ef74c[_0x448d33(0x1e0)]||_0x1ef74c['journeys']?.[0x0]?.['stages']||[];let _0x1c22dc=_0x448d33(0x22c),_0x21277e=_0x14a8fd;const _0x312483=_0x1ef74c[_0x448d33(0x1f3)]||_0x1ef74c[_0x448d33(0x280)]?.[0x0]?.[_0x448d33(0x1f3)];if(_0x312483?.[_0x448d33(0x21a)]===_0x14a8fd)return{'stageName':_0x448d33(0x1f3),'criteriaName':_0x312483[_0x448d33(0x237)]||_0x14a8fd};_0x5394b5:for(const _0x387a43 of _0x5953bb){if(_0x387a43[_0x448d33(0x1b5)]?.['segment']===_0x14a8fd){_0x1c22dc=_0x387a43[_0x448d33(0x237)],_0x21277e=_0x387a43[_0x448d33(0x1b5)][_0x448d33(0x237)]||_0x14a8fd;break;}if(_0x387a43[_0x448d33(0x2aa)])for(const _0x483673 of _0x387a43['steps']){if(_0x483673[_0x448d33(0x233)]===_0x448d33(0x282)&&_0x483673[_0x448d33(0x271)]?.['branches'])for(const _0x2b8949 of _0x483673[_0x448d33(0x271)][_0x448d33(0x29f)]){if(_0x2b8949[_0x448d33(0x21a)]===_0x14a8fd){_0x1c22dc=_0x387a43[_0x448d33(0x237)],_0x21277e=_0x2b8949['name']||_0x14a8fd;break _0x5394b5;}}}}return{'stageName':_0x1c22dc,'criteriaName':_0x21277e};}async function executeThreeStepJourneyCreate(_0x42204f,_0x1aa052,_0x3d6a61,_0x35bd82,_0x1c7fc8,_0x4f9980,_0xa9eca8,_0x565c72){const _0x56be7c=a140_0x1afe10,{activationDefToCreateRequest:_0x5231bf,yamlRuleToApi:_0x13f09e}=_0x565c72,{pendingEmbeddedSegments:_0x71fac8,pendingEmbeddedActivations:_0x17acf9,embeddedSegmentNameToId:_0x919cee}=_0x35bd82,_0x24309c=JSON[_0x56be7c(0x223)](JSON['stringify'](_0x3d6a61));ensureJourneyDefaults(_0x24309c[_0x56be7c(0x1ff)]),stripPendingIds(_0x24309c);const _0x187fc5=await _0x42204f[_0x56be7c(0x1c3)][_0x56be7c(0x210)](_0x24309c),_0x432878=_0x187fc5['id'],_0x28e4ae=new Map();for(const _0x1c6268 of _0x187fc5[_0x56be7c(0x1ff)]['journeyStages']){_0x28e4ae[_0x56be7c(0x1e6)](_0x1c6268[_0x56be7c(0x237)][_0x56be7c(0x25f)](),_0x1c6268['id']);}recoverSegmentIdsFromPushRecovery(_0x1aa052,_0x919cee,_0x4f9980[_0x56be7c(0x2a6)]);for(const [_0x4033a0,{definition:_0x5665f3}]of _0x71fac8){if(_0x919cee[_0x56be7c(0x2b6)](_0x4033a0)){_0xa9eca8[_0x56be7c(0x2bd)]?.({'type':_0x56be7c(0x25b),'journeyName':_0x1aa052[_0x56be7c(0x1de)][_0x56be7c(0x237)],'segmentName':_0x4033a0});continue;}const _0x516457=generateDeterministicJourneySegmentName(_0x1aa052[_0x56be7c(0x1de)]['name'],_0x4033a0);_0xa9eca8[_0x56be7c(0x2bd)]?.({'type':_0x56be7c(0x276),'journeyName':_0x1aa052[_0x56be7c(0x1de)]['name'],'segmentName':_0x4033a0});const _0x2c73bb=createSegmentIdResolver(_0x4f9980[_0x56be7c(0x2a6)],_0x4033a0),_0xbec992=await resolveRuleSegmentIds(_0x5665f3[_0x56be7c(0x227)],_0x2c73bb),_0x40ae5c=await createOrRecoverEmbeddedSegment(_0x42204f,_0x1aa052,{'localName':_0x4033a0,'uniqueSegmentName':_0x516457,'description':_0x5665f3[_0x56be7c(0x281)]||_0x56be7c(0x28d)+_0x4033a0,'journeyId':_0x432878,'resolvedRule':_0xbec992,'parentId':_0x1c7fc8[_0x56be7c(0x1f6)],'folderId':_0x1c7fc8[_0x56be7c(0x1cb)]||''},_0x13f09e);_0x919cee[_0x56be7c(0x1e6)](_0x4033a0,_0x40ae5c),_0x4f9980[_0x56be7c(0x2a6)][_0x56be7c(0x1e6)](_0x4033a0,_0x40ae5c),_0xa9eca8['onProgress']?.({'type':_0x56be7c(0x25b),'journeyName':_0x1aa052[_0x56be7c(0x1de)][_0x56be7c(0x237)],'segmentName':_0x4033a0});}const _0x3ddfa0=new Map();for(const [_0x3dc039,_0x3c44a5]of _0x17acf9){_0xa9eca8['onProgress']?.({'type':_0x56be7c(0x20b),'journeyName':_0x1aa052[_0x56be7c(0x1de)][_0x56be7c(0x237)],'activationName':_0x3dc039});const _0x1a671c=await _0x5231bf(_0x3c44a5,_0x4f9980[_0x56be7c(0x200)]),_0xb65e8a={..._0x1a671c,..._0x3c44a5['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x3c44a5[_0x56be7c(0x1e7)]}},_0x523bbe=await _0x42204f[_0x56be7c(0x1c3)][_0x56be7c(0x275)](_0x432878,_0xb65e8a);_0x3ddfa0[_0x56be7c(0x1e6)](_0x3dc039,_0x523bbe['id']),_0x35bd82[_0x56be7c(0x218)][_0x56be7c(0x1e6)](_0x3dc039,_0x523bbe['id']),_0xa9eca8[_0x56be7c(0x2bd)]?.({'type':_0x56be7c(0x217),'journeyName':_0x1aa052[_0x56be7c(0x1de)][_0x56be7c(0x237)],'activationName':_0x3dc039});}const _0x3671d4=JSON[_0x56be7c(0x223)](JSON['stringify'](_0x3d6a61));return _0x3671d4['id']=_0x432878,ensureJourneyDefaults(_0x3671d4['attributes']),resolvePendingIdsInRequest(_0x3671d4,_0x3d6a61,_0x28e4ae,_0x919cee,_0x3ddfa0,_0xa9eca8),await _0x42204f['journey'][_0x56be7c(0x25c)](_0x432878,_0x3671d4),deletePushRecovery(_0x1aa052['absolutePath']),{'action':'created','journeyId':_0x432878,'embeddedSegmentNameToId':_0x919cee};}export function stripWaitStepPendingIds(_0x31f111){const _0x70bb5a=a140_0x1afe10,_0x2eb576=_0x31f111['conditionSegmentId']&&isPendingSegmentId(_0x31f111['conditionSegmentId']),_0x1567e0=_0x31f111[_0x70bb5a(0x1b7)]?.[_0x70bb5a(0x1f0)](_0xbfe308=>_0xbfe308['segmentId']&&isPendingSegmentId(_0xbfe308[_0x70bb5a(0x292)]));(_0x2eb576||_0x1567e0)&&(_0x31f111[_0x70bb5a(0x2a4)]=_0x70bb5a(0x249),_0x31f111['waitStep']=0x1,_0x31f111[_0x70bb5a(0x1eb)]=_0x70bb5a(0x2a1),delete _0x31f111['conditionSegmentId'],delete _0x31f111[_0x70bb5a(0x273)],delete _0x31f111[_0x70bb5a(0x25a)],delete _0x31f111[_0x70bb5a(0x1b7)]);}export function resolveWaitStepPendingIds(_0xe2227,_0x769204,_0x5aa71b,_0xdabe0){const _0xb57ac3=a140_0x1afe10;if(_0x769204[_0xb57ac3(0x1da)]&&isPendingSegmentId(_0x769204[_0xb57ac3(0x1da)])){const _0x54a4c8=_0x5aa71b(_0x769204[_0xb57ac3(0x1da)],'stage\x20\x27'+_0xdabe0+_0xb57ac3(0x270));_0x54a4c8&&(_0xe2227[_0xb57ac3(0x2a4)]=_0xb57ac3(0x1cf),_0xe2227[_0xb57ac3(0x1da)]=_0x54a4c8,delete _0xe2227[_0xb57ac3(0x251)],delete _0xe2227[_0xb57ac3(0x1eb)],_0x769204[_0xb57ac3(0x273)]!==undefined&&(_0xe2227[_0xb57ac3(0x273)]=_0x769204[_0xb57ac3(0x273)]),_0x769204[_0xb57ac3(0x25a)]&&(_0xe2227[_0xb57ac3(0x25a)]=_0x769204[_0xb57ac3(0x25a)]));}if(_0x769204['conditions']){const _0x57ba5d=_0x769204[_0xb57ac3(0x1b7)]['some'](_0x1a3771=>_0x1a3771[_0xb57ac3(0x292)]&&isPendingSegmentId(_0x1a3771[_0xb57ac3(0x292)]));if(_0x57ba5d){const _0x574bb1=_0x769204[_0xb57ac3(0x1b7)]['map'](_0x2b47a4=>{const _0x289525=_0xb57ac3;if(_0x2b47a4[_0x289525(0x292)]&&isPendingSegmentId(_0x2b47a4[_0x289525(0x292)])){const _0x542a3c=_0x5aa71b(_0x2b47a4[_0x289525(0x292)],'stage\x20\x27'+_0xdabe0+_0x289525(0x270));return{..._0x2b47a4,'segmentId':_0x542a3c||_0x2b47a4[_0x289525(0x292)]};}return{..._0x2b47a4};});_0xe2227[_0xb57ac3(0x2a4)]=_0xb57ac3(0x1cf),_0xe2227[_0xb57ac3(0x1b7)]=_0x574bb1,delete _0xe2227['waitStep'],delete _0xe2227[_0xb57ac3(0x1eb)],delete _0xe2227[_0xb57ac3(0x1da)],delete _0xe2227[_0xb57ac3(0x273)],delete _0xe2227['conditionTimeoutUnit'];}}}function stripPendingIds(_0x53c2bf){const _0x38410b=a140_0x1afe10;_0x53c2bf[_0x38410b(0x1ff)][_0x38410b(0x1f3)]?.['segmentId']&&isPendingSegmentId(_0x53c2bf[_0x38410b(0x1ff)][_0x38410b(0x1f3)][_0x38410b(0x292)])&&delete _0x53c2bf[_0x38410b(0x1ff)]['goal'];for(const _0x4936de of _0x53c2bf['attributes'][_0x38410b(0x2b4)]||[]){_0x4936de[_0x38410b(0x26a)]?.[_0x38410b(0x292)]&&isPendingSegmentId(_0x4936de[_0x38410b(0x26a)][_0x38410b(0x292)])&&delete _0x4936de[_0x38410b(0x26a)];_0x4936de[_0x38410b(0x1dd)]?.[_0x38410b(0x292)]&&isPendingSegmentId(_0x4936de[_0x38410b(0x1dd)][_0x38410b(0x292)])&&delete _0x4936de['milestone'];_0x4936de['exitCriterias']&&(_0x4936de[_0x38410b(0x2be)]=_0x4936de[_0x38410b(0x2be)]['filter'](_0x474286=>!_0x474286[_0x38410b(0x292)]||!isPendingSegmentId(_0x474286['segmentId'])));if(_0x4936de[_0x38410b(0x2aa)])for(const _0x137bb6 of Object[_0x38410b(0x240)](_0x4936de['steps'])){const _0x56d97e=_0x4936de[_0x38410b(0x2aa)][_0x137bb6];_0x56d97e[_0x38410b(0x233)]===_0x38410b(0x1fc)&&_0x56d97e['journeyActivationStepId']&&isPendingActivationId(_0x56d97e['journeyActivationStepId'])&&(_0x56d97e[_0x38410b(0x1ed)]='');if(_0x56d97e[_0x38410b(0x233)]===_0x38410b(0x296)&&_0x56d97e[_0x38410b(0x29f)])for(const _0x556069 of _0x56d97e[_0x38410b(0x29f)]){_0x556069[_0x38410b(0x292)]&&isPendingSegmentId(_0x556069[_0x38410b(0x292)])&&(_0x556069[_0x38410b(0x292)]='');}_0x56d97e[_0x38410b(0x233)]===_0x38410b(0x250)&&stripWaitStepPendingIds(_0x56d97e);}}}function resolvePendingIdsInRequest(_0x488212,_0x5470ba,_0x4327bc,_0x215465,_0x4a3a74,_0x5ab46c){const _0x713dc3=a140_0x1afe10,_0x265e6a=(_0x484f29,_0x1f31db)=>{const _0x183730=a140_0x46f4;if(!isPendingSegmentId(_0x484f29))return _0x484f29;const _0x456c23=extractPendingSegmentName(_0x484f29),_0x22adde=_0x215465['get'](_0x456c23);return!_0x22adde&&_0x5ab46c[_0x183730(0x23e)]?.(_0x183730(0x2b2)+_0x456c23+_0x183730(0x1c0)+_0x1f31db),_0x22adde;};if(_0x488212['attributes'][_0x713dc3(0x1f3)]?.['segmentId']&&isPendingSegmentId(_0x488212[_0x713dc3(0x1ff)][_0x713dc3(0x1f3)][_0x713dc3(0x292)])){const _0x31e7e8=_0x265e6a(_0x488212[_0x713dc3(0x1ff)][_0x713dc3(0x1f3)][_0x713dc3(0x292)],_0x713dc3(0x245));_0x31e7e8&&(_0x488212[_0x713dc3(0x1ff)][_0x713dc3(0x1f3)][_0x713dc3(0x292)]=_0x31e7e8);}for(const _0x5e737f of _0x488212[_0x713dc3(0x1ff)][_0x713dc3(0x2b4)]||[]){const _0x3e5dbd=_0x4327bc[_0x713dc3(0x290)](_0x5e737f[_0x713dc3(0x237)][_0x713dc3(0x25f)]());_0x3e5dbd&&(_0x5e737f['id']=_0x3e5dbd);if(_0x5e737f[_0x713dc3(0x26a)]?.[_0x713dc3(0x292)]&&isPendingSegmentId(_0x5e737f['entryCriteria'][_0x713dc3(0x292)])){const _0xe37399=_0x265e6a(_0x5e737f['entryCriteria']['segmentId'],'stage\x20\x27'+_0x5e737f[_0x713dc3(0x237)]+'\x27\x20entry\x20criteria');_0xe37399&&(_0x5e737f[_0x713dc3(0x26a)][_0x713dc3(0x292)]=_0xe37399);}if(_0x5e737f[_0x713dc3(0x2be)])for(const _0x521e2 of _0x5e737f[_0x713dc3(0x2be)]){if(_0x521e2['segmentId']&&isPendingSegmentId(_0x521e2['segmentId'])){const _0x1dd5d3=_0x265e6a(_0x521e2[_0x713dc3(0x292)],_0x713dc3(0x1fb)+_0x5e737f['name']+_0x713dc3(0x28f));_0x1dd5d3&&(_0x521e2[_0x713dc3(0x292)]=_0x1dd5d3);}}if(_0x5e737f[_0x713dc3(0x1dd)]?.[_0x713dc3(0x292)]&&isPendingSegmentId(_0x5e737f[_0x713dc3(0x1dd)]['segmentId'])){const _0x4a7842=_0x265e6a(_0x5e737f[_0x713dc3(0x1dd)]['segmentId'],'stage\x20\x27'+_0x5e737f['name']+_0x713dc3(0x2a8));_0x4a7842&&(_0x5e737f[_0x713dc3(0x1dd)]['segmentId']=_0x4a7842);}if(_0x5e737f[_0x713dc3(0x2aa)]){const _0x11661a=_0x16abb2=>_0x5470ba[_0x713dc3(0x1ff)][_0x713dc3(0x2b4)]?.['find'](_0x110f5f=>_0x110f5f[_0x713dc3(0x237)][_0x713dc3(0x25f)]()===_0x5e737f[_0x713dc3(0x237)]['toLowerCase']())?.[_0x713dc3(0x2aa)]?.[_0x16abb2];for(const _0x57bb29 of Object['keys'](_0x5e737f[_0x713dc3(0x2aa)])){const _0x19fadc=_0x5e737f[_0x713dc3(0x2aa)][_0x57bb29],_0x3d4a78=_0x11661a(_0x57bb29);if(_0x19fadc['type']===_0x713dc3(0x1fc)&&_0x19fadc['journeyActivationStepId']&&(isPendingActivationId(_0x19fadc['journeyActivationStepId'])||_0x19fadc['journeyActivationStepId']==='')){if(_0x3d4a78?.[_0x713dc3(0x1ed)]&&isPendingActivationId(_0x3d4a78[_0x713dc3(0x1ed)])){const _0x30a806=extractPendingActivationName(_0x3d4a78[_0x713dc3(0x1ed)]),_0x5cfc79=_0x4a3a74['get'](_0x30a806);_0x5cfc79&&(_0x19fadc[_0x713dc3(0x1ed)]=_0x5cfc79);}}if(_0x19fadc[_0x713dc3(0x233)]===_0x713dc3(0x296)&&_0x19fadc[_0x713dc3(0x29f)]&&_0x3d4a78?.[_0x713dc3(0x29f)])for(let _0x1a73ed=0x0;_0x1a73ed<_0x19fadc[_0x713dc3(0x29f)]['length'];_0x1a73ed++){const _0x3f6699=_0x19fadc[_0x713dc3(0x29f)][_0x1a73ed],_0x297819=_0x3d4a78[_0x713dc3(0x29f)][_0x1a73ed];if(_0x297819?.['segmentId']&&isPendingSegmentId(_0x297819[_0x713dc3(0x292)])){const _0x47def9=_0x265e6a(_0x297819['segmentId'],_0x713dc3(0x1fb)+_0x5e737f[_0x713dc3(0x237)]+_0x713dc3(0x1d7)+(_0x3f6699[_0x713dc3(0x237)]||_0x1a73ed)+'\x27');_0x47def9&&(_0x3f6699['segmentId']=_0x47def9);}}_0x19fadc['type']===_0x713dc3(0x250)&&_0x3d4a78?.[_0x713dc3(0x233)]===_0x713dc3(0x250)&&resolveWaitStepPendingIds(_0x19fadc,_0x3d4a78,_0x265e6a,_0x5e737f[_0x713dc3(0x237)]);}}}}
@@ -1 +1 @@
1
- function a137_0x235f(_0xd2bdb6,_0x162aaf){_0xd2bdb6=_0xd2bdb6-0xd7;const _0x425dbb=a137_0x425d();let _0x235f04=_0x425dbb[_0xd2bdb6];return _0x235f04;}function a137_0x425d(){const _0x55f7d7=['180312nbmYPV','12Nncmxc','282255nLXxVn','set','331109wmuXRK','2191662JDNmVO','name','add','get','has','522991vsyBfu','1207220KNxWjZ','32xsmYNi','parentFolderId','944316OuullX'];a137_0x425d=function(){return _0x55f7d7;};return a137_0x425d();}(function(_0x34169c,_0x594f72){const _0x58d92f=a137_0x235f,_0x32ce70=_0x34169c();while(!![]){try{const _0x3f9b77=parseInt(_0x58d92f(0xe3))/0x1+parseInt(_0x58d92f(0xdf))/0x2+parseInt(_0x58d92f(0xe1))/0x3+parseInt(_0x58d92f(0xde))/0x4+parseInt(_0x58d92f(0xdb))/0x5+-parseInt(_0x58d92f(0xe0))/0x6*(-parseInt(_0x58d92f(0xda))/0x7)+parseInt(_0x58d92f(0xdc))/0x8*(-parseInt(_0x58d92f(0xe4))/0x9);if(_0x3f9b77===_0x594f72)break;else _0x32ce70['push'](_0x32ce70['shift']());}catch(_0x26d0d4){_0x32ce70['push'](_0x32ce70['shift']());}}}(a137_0x425d,0x29123));export function buildFolderIdToPathMap(_0x37c8de){const _0xd41608=a137_0x235f,_0x740157=new Map(),_0x54e6cc=new Map();for(const _0x4e12b3 of _0x37c8de){_0x54e6cc['set'](_0x4e12b3['id'],_0x4e12b3);}const _0x5e1fae=new Set();for(const _0x4bfc21 of _0x37c8de){!_0x4bfc21[_0xd41608(0xdd)]&&_0x5e1fae['add'](_0x4bfc21['id']);}function _0x58175c(_0x50fcc9){const _0xa50f76=_0xd41608;if(_0x740157[_0xa50f76(0xd9)](_0x50fcc9['id']))return _0x740157[_0xa50f76(0xd8)](_0x50fcc9['id']);if(_0x5e1fae[_0xa50f76(0xd9)](_0x50fcc9['id']))return _0x740157['set'](_0x50fcc9['id'],''),'';if(_0x50fcc9[_0xa50f76(0xdd)]){const _0x52fe19=_0x54e6cc[_0xa50f76(0xd8)](_0x50fcc9[_0xa50f76(0xdd)]);if(_0x52fe19){const _0x13653d=_0x58175c(_0x52fe19),_0x1855ca=_0x13653d?_0x13653d+'/'+_0x50fcc9['name']:_0x50fcc9[_0xa50f76(0xe5)];return _0x740157[_0xa50f76(0xe2)](_0x50fcc9['id'],_0x1855ca),_0x1855ca;}}const _0x4a8bfd=_0x50fcc9[_0xa50f76(0xe5)];return _0x740157[_0xa50f76(0xe2)](_0x50fcc9['id'],_0x4a8bfd),_0x4a8bfd;}for(const _0x263e83 of _0x37c8de){_0x58175c(_0x263e83);}return _0x740157;}export function buildFolderPathToIdMap(_0x24a2d0){const _0x35d697=a137_0x235f,_0x5e88cb=new Map(),_0x46635e=new Map();for(const _0x52331b of _0x24a2d0){_0x46635e[_0x35d697(0xe2)](_0x52331b['id'],_0x52331b);}const _0x107c16=new Set();for(const _0xca067b of _0x24a2d0){!_0xca067b['parentFolderId']&&_0x107c16[_0x35d697(0xd7)](_0xca067b['id']);}function _0x1a1917(_0xd440e1){const _0x33642f=_0x35d697;if(_0x107c16[_0x33642f(0xd9)](_0xd440e1['id']))return'';if(_0xd440e1[_0x33642f(0xdd)]){const _0x15873d=_0x46635e['get'](_0xd440e1['parentFolderId']);if(_0x15873d){const _0x3d8bcd=_0x1a1917(_0x15873d);return _0x3d8bcd?_0x3d8bcd+'/'+_0xd440e1[_0x33642f(0xe5)]:_0xd440e1['name'];}}return _0xd440e1[_0x33642f(0xe5)];}for(const _0x48b4ba of _0x24a2d0){const _0x58ffa5=_0x1a1917(_0x48b4ba);_0x5e88cb[_0x35d697(0xe2)](_0x58ffa5,_0x48b4ba['id']);}return _0x5e88cb;}export function buildFolderMaps(_0xed5013){const _0x55b809=a137_0x235f,_0x3ceb94=buildFolderIdToPathMap(_0xed5013),_0x150be6=new Map();for(const [_0x546b70,_0x2e2cd6]of _0x3ceb94){_0x150be6[_0x55b809(0xe2)](_0x2e2cd6,_0x546b70);}return{'idToPath':_0x3ceb94,'pathToId':_0x150be6};}export function getFolderPath(_0x3bbd04,_0x36e11a){const _0x3d0e13=a137_0x235f;if(!_0x3bbd04)return'';return _0x36e11a[_0x3d0e13(0xd8)](_0x3bbd04)??'';}
1
+ function a141_0x4e3d(_0xefa88d,_0x42583e){_0xefa88d=_0xefa88d-0x86;const _0x2e72e3=a141_0x2e72();let _0x4e3d05=_0x2e72e3[_0xefa88d];return _0x4e3d05;}(function(_0x4e8dbe,_0x196bae){const _0x171931=a141_0x4e3d,_0x254274=_0x4e8dbe();while(!![]){try{const _0x4fa30d=-parseInt(_0x171931(0x8d))/0x1*(parseInt(_0x171931(0x8c))/0x2)+parseInt(_0x171931(0x89))/0x3*(-parseInt(_0x171931(0x92))/0x4)+-parseInt(_0x171931(0x93))/0x5+-parseInt(_0x171931(0x8b))/0x6+parseInt(_0x171931(0x87))/0x7+parseInt(_0x171931(0x90))/0x8*(parseInt(_0x171931(0x8a))/0x9)+-parseInt(_0x171931(0x94))/0xa*(-parseInt(_0x171931(0x88))/0xb);if(_0x4fa30d===_0x196bae)break;else _0x254274['push'](_0x254274['shift']());}catch(_0x42bb7e){_0x254274['push'](_0x254274['shift']());}}}(a141_0x2e72,0xcebd5));export function buildFolderIdToPathMap(_0x12e04a){const _0xe7dfd2=a141_0x4e3d,_0x3e4f25=new Map(),_0x318bea=new Map();for(const _0x41fb26 of _0x12e04a){_0x318bea[_0xe7dfd2(0x86)](_0x41fb26['id'],_0x41fb26);}const _0x52beb9=new Set();for(const _0x5a870a of _0x12e04a){!_0x5a870a[_0xe7dfd2(0x8f)]&&_0x52beb9[_0xe7dfd2(0x96)](_0x5a870a['id']);}function _0x5e8424(_0x45ce18){const _0x222490=_0xe7dfd2;if(_0x3e4f25[_0x222490(0x91)](_0x45ce18['id']))return _0x3e4f25[_0x222490(0x8e)](_0x45ce18['id']);if(_0x52beb9[_0x222490(0x91)](_0x45ce18['id']))return _0x3e4f25['set'](_0x45ce18['id'],''),'';if(_0x45ce18['parentFolderId']){const _0x2ae7de=_0x318bea[_0x222490(0x8e)](_0x45ce18[_0x222490(0x8f)]);if(_0x2ae7de){const _0x3b4afc=_0x5e8424(_0x2ae7de),_0x538c52=_0x3b4afc?_0x3b4afc+'/'+_0x45ce18['name']:_0x45ce18[_0x222490(0x95)];return _0x3e4f25[_0x222490(0x86)](_0x45ce18['id'],_0x538c52),_0x538c52;}}const _0x5cf8e6=_0x45ce18[_0x222490(0x95)];return _0x3e4f25[_0x222490(0x86)](_0x45ce18['id'],_0x5cf8e6),_0x5cf8e6;}for(const _0x4b3cfc of _0x12e04a){_0x5e8424(_0x4b3cfc);}return _0x3e4f25;}export function buildFolderPathToIdMap(_0x109667){const _0x128fa3=a141_0x4e3d,_0x2cc035=new Map(),_0x27e251=new Map();for(const _0x41e223 of _0x109667){_0x27e251[_0x128fa3(0x86)](_0x41e223['id'],_0x41e223);}const _0x22ea83=new Set();for(const _0x30db1e of _0x109667){!_0x30db1e[_0x128fa3(0x8f)]&&_0x22ea83[_0x128fa3(0x96)](_0x30db1e['id']);}function _0x5eb1bf(_0x191b6c){const _0x21a945=_0x128fa3;if(_0x22ea83[_0x21a945(0x91)](_0x191b6c['id']))return'';if(_0x191b6c[_0x21a945(0x8f)]){const _0x1f70e9=_0x27e251['get'](_0x191b6c[_0x21a945(0x8f)]);if(_0x1f70e9){const _0x494110=_0x5eb1bf(_0x1f70e9);return _0x494110?_0x494110+'/'+_0x191b6c[_0x21a945(0x95)]:_0x191b6c[_0x21a945(0x95)];}}return _0x191b6c[_0x21a945(0x95)];}for(const _0x71449f of _0x109667){const _0x4bb4dc=_0x5eb1bf(_0x71449f);_0x2cc035[_0x128fa3(0x86)](_0x4bb4dc,_0x71449f['id']);}return _0x2cc035;}export function buildFolderMaps(_0xdc7930){const _0x95ca10=a141_0x4e3d,_0x12da43=buildFolderIdToPathMap(_0xdc7930),_0x3480c7=new Map();for(const [_0x403676,_0x3a5f65]of _0x12da43){_0x3480c7[_0x95ca10(0x86)](_0x3a5f65,_0x403676);}return{'idToPath':_0x12da43,'pathToId':_0x3480c7};}function a141_0x2e72(){const _0x58e52f=['1177yXNvof','3AysICS','207yRCZBJ','6979344aduZsz','35378wwySqh','44SBeTch','get','parentFolderId','67384ScaHnF','has','4269752lZVqIx','3969995OgVsiS','311830ogjUTs','name','add','set','7836304VIjnKG'];a141_0x2e72=function(){return _0x58e52f;};return a141_0x2e72();}export function getFolderPath(_0x312080,_0x18ce6d){const _0x42a2a5=a141_0x4e3d;if(!_0x312080)return'';return _0x18ce6d[_0x42a2a5(0x8e)](_0x312080)??'';}
@@ -1 +1 @@
1
- (function(_0x216153,_0x3ac2a0){const _0x25e573=a138_0x5c38,_0x3ea021=_0x216153();while(!![]){try{const _0x256c51=-parseInt(_0x25e573(0xa7))/0x1+parseInt(_0x25e573(0xa9))/0x2*(parseInt(_0x25e573(0x9f))/0x3)+parseInt(_0x25e573(0x87))/0x4*(parseInt(_0x25e573(0x88))/0x5)+parseInt(_0x25e573(0x8e))/0x6*(-parseInt(_0x25e573(0xa4))/0x7)+parseInt(_0x25e573(0xad))/0x8+-parseInt(_0x25e573(0x7e))/0x9*(parseInt(_0x25e573(0xa6))/0xa)+parseInt(_0x25e573(0x85))/0xb*(-parseInt(_0x25e573(0x9d))/0xc);if(_0x256c51===_0x3ac2a0)break;else _0x3ea021['push'](_0x3ea021['shift']());}catch(_0x2cd5a7){_0x3ea021['push'](_0x3ea021['shift']());}}}(a138_0x15ce,0x536da));import a138_0x43ca0a from'path';import{parse as a138_0x324d2d}from'yaml';function a138_0x5c38(_0x1338df,_0x2f5015){_0x1338df=_0x1338df-0x7e;const _0x15cec8=a138_0x15ce();let _0x5c38e4=_0x15cec8[_0x1338df];return _0x5c38e4;}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x5b8f77){const _0x1bfe4a=a138_0x5c38;if(!_0x5b8f77||_0x5b8f77[_0x1bfe4a(0x8d)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x33ddac=_0x5b8f77[_0x1bfe4a(0x8d)]();if(_0x33ddac==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x5b8f77};const _0x4352de=_0x33ddac[_0x1bfe4a(0xa2)]('/')?_0x33ddac[_0x1bfe4a(0xa3)](0x1):_0x33ddac,_0x206b89=_0x4352de[_0x1bfe4a(0x92)]('/')['filter'](_0x107fab=>_0x107fab!=='');if(_0x206b89['length']===0x0)throw new Error(_0x1bfe4a(0x89));const _0x4525a7=_0x33ddac[_0x1bfe4a(0xa2)]('/')||!isRelativePathSegment(_0x206b89[0x0]);for(const _0x413c8b of _0x206b89){validatePathSegment(_0x413c8b);}return{'segments':_0x206b89,'isAbsolute':_0x4525a7,'raw':_0x5b8f77};}function isRelativePathSegment(_0x5aaabf){return _0x5aaabf==='.'||_0x5aaabf==='..';}function validatePathSegment(_0x51751d){const _0x35627c=a138_0x5c38;if(_0x51751d==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x51751d==='.'||_0x51751d==='..')return;if(/[\x00-\x1F\x7F]/[_0x35627c(0x96)](_0x51751d))throw new Error(_0x35627c(0x83)+_0x51751d);if(_0x51751d!==_0x51751d[_0x35627c(0x8d)]()){}}function a138_0x15ce(){const _0x126304=['isAbsolute','469048FuFvyJ','journey','join','type','5223784kqaAcC','185616CjtMGN','tdx.json','.yaml','root','No\x20tdx.json\x20found\x20for\x20file:\x20','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Cannot\x20split\x20empty\x20path','764786vSYOmP','Path\x20attempts\x20to\x20navigate\x20above\x20root','4meCpIX','2953350OGXkkn','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','parent_segment','dirname','parse','trim','641790ySLJrQ','push','segment','length','split','relative','readFile','Relative\x20path\x20cannot\x20be\x20empty','test','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','endsWith','File\x20not\x20found:\x20','name','Cannot\x20navigate\x20above\x20root','replace','36szvQts','segments','3WUHGUJ','exists','slice','startsWith','substring','21FWLCtq','raw','160AvYuLd','276988HxIIKS'];a138_0x15ce=function(){return _0x126304;};return a138_0x15ce();}export function validatePath(_0x500579){const _0x1b6793=a138_0x5c38;if(_0x500579[_0x1b6793(0x9e)]['length']===0x0&&!_0x500579[_0x1b6793(0xa8)])throw new Error(_0x1b6793(0x95));if(_0x500579[_0x1b6793(0xa8)]){if(_0x500579[_0x1b6793(0x9e)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x1003c5=0x0;for(const _0x1cd151 of _0x500579[_0x1b6793(0x9e)]){if(_0x1cd151==='..'){if(_0x1003c5===0x0)throw new Error(_0x1b6793(0x86));_0x1003c5--;}else _0x1cd151!=='.'&&_0x1003c5++;}}}export function joinPaths(_0x1015ea,_0x134ea0){const _0x17b3a1=a138_0x5c38;if(!_0x1015ea||_0x1015ea==='/')return _0x134ea0;if(!_0x134ea0||_0x134ea0==='.')return _0x1015ea;if(_0x134ea0['startsWith']('/'))return _0x134ea0;const _0x488585=parsePath(_0x1015ea),_0x336107=parsePath(_0x134ea0),_0x334ed9=[..._0x488585['segments']];for(const _0x36675b of _0x336107[_0x17b3a1(0x9e)]){if(_0x36675b==='.')continue;else{if(_0x36675b==='..'){if(_0x334ed9['length']===0x0)throw new Error(_0x17b3a1(0x9b));_0x334ed9['pop']();}else _0x334ed9[_0x17b3a1(0x8f)](_0x36675b);}}const _0x5ba196=_0x334ed9[_0x17b3a1(0xab)]('/');return _0x488585[_0x17b3a1(0xa5)]['startsWith']('/')?'/'+_0x5ba196:_0x5ba196;}export function normalizePath(_0x596899){const _0xd42d44=a138_0x5c38,_0x2af4ef=parsePath(_0x596899),_0xe5dc39=[];for(const _0xfcd9e2 of _0x2af4ef[_0xd42d44(0x9e)]){if(_0xfcd9e2==='.')continue;else{if(_0xfcd9e2==='..'){if(_0xe5dc39['length']===0x0){if(_0x2af4ef[_0xd42d44(0xa8)])throw new Error(_0xd42d44(0x9b));_0xe5dc39[_0xd42d44(0x8f)]('..');}else _0xe5dc39[_0xe5dc39['length']-0x1]==='..'?_0xe5dc39[_0xd42d44(0x8f)]('..'):_0xe5dc39['pop']();}else _0xe5dc39[_0xd42d44(0x8f)](_0xfcd9e2);}}if(_0xe5dc39[_0xd42d44(0x91)]===0x0)return _0x2af4ef[_0xd42d44(0xa8)]?'/':'.';const _0x537f8d=_0xe5dc39[_0xd42d44(0xab)]('/');return _0x2af4ef[_0xd42d44(0xa5)]['startsWith']('/')?'/'+_0x537f8d:_0x537f8d;}export function getParentPath(_0x5f193d){const _0x570c93=a138_0x5c38,_0x31fde7=parsePath(_0x5f193d);if(_0x31fde7['segments'][_0x570c93(0x91)]<=0x1)return'/';const _0x2486f8=_0x31fde7['segments'][_0x570c93(0xa1)](0x0,-0x1)['join']('/');return _0x31fde7[_0x570c93(0xa5)]['startsWith']('/')?'/'+_0x2486f8:_0x2486f8;}export function getBaseName(_0x1b0a05){const _0x13b728=a138_0x5c38,_0x117f15=parsePath(_0x1b0a05);return _0x117f15['segments'][_0x117f15[_0x13b728(0x9e)][_0x13b728(0x91)]-0x1]||'';}export function isChildPath(_0x1754b4,_0x124fb6){const _0x231aaa=a138_0x5c38,_0x44d61d=parsePath(_0x1754b4),_0x183490=parsePath(_0x124fb6);if(_0x44d61d[_0x231aaa(0x9e)]['length']<=_0x183490[_0x231aaa(0x9e)][_0x231aaa(0x91)])return![];for(let _0x20c569=0x0;_0x20c569<_0x183490['segments'][_0x231aaa(0x91)];_0x20c569++){if(_0x44d61d[_0x231aaa(0x9e)][_0x20c569]!==_0x183490['segments'][_0x20c569])return![];}return!![];}export function splitPath(_0x58f2e8){const _0x31b67a=a138_0x5c38,_0x2ed653=parsePath(_0x58f2e8);if(_0x2ed653[_0x31b67a(0x9e)][_0x31b67a(0x91)]===0x0)throw new Error(_0x31b67a(0x84));if(_0x2ed653[_0x31b67a(0x9e)][_0x31b67a(0x91)]===0x1)return{'parent':_0x2ed653[_0x31b67a(0x9e)][0x0]};return{'parent':_0x2ed653[_0x31b67a(0x9e)][0x0],'child':_0x2ed653['segments']['slice'](0x1)[_0x31b67a(0xab)]('/')};}export function isYamlFilePath(_0x4197c3){const _0x396eb1=a138_0x5c38;return _0x4197c3[_0x396eb1(0x98)]('.yml')||_0x4197c3[_0x396eb1(0x98)](_0x396eb1(0x80));}export async function resolveYamlFilePath(_0x1b80eb,_0x4d5fa5=nodeFileSystem){const _0x42bcc6=a138_0x5c38,_0x341a3e=a138_0x43ca0a['resolve'](_0x1b80eb);if(!await _0x4d5fa5[_0x42bcc6(0xa0)](_0x341a3e))throw new Error(_0x42bcc6(0x99)+_0x1b80eb);let _0x284a17=a138_0x43ca0a[_0x42bcc6(0x8b)](_0x341a3e),_0x44498b=null,_0x3bb483=null;const _0x31527a=a138_0x43ca0a['parse'](_0x284a17)[_0x42bcc6(0x81)];while(_0x284a17!==_0x31527a){const _0xccd242=a138_0x43ca0a[_0x42bcc6(0xab)](_0x284a17,_0x42bcc6(0x7f));if(await _0x4d5fa5[_0x42bcc6(0xa0)](_0xccd242)){_0x44498b=_0xccd242,_0x3bb483=_0x284a17;break;}_0x284a17=a138_0x43ca0a['dirname'](_0x284a17);}if(!_0x44498b||!_0x3bb483)throw new Error(_0x42bcc6(0x82)+_0x1b80eb+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x4fcb1f=await _0x4d5fa5['readFile'](_0x44498b),_0x266cf2=JSON[_0x42bcc6(0x8c)](_0x4fcb1f),_0x195ec1=_0x266cf2[_0x42bcc6(0x8a)];if(!_0x195ec1)throw new Error(_0x42bcc6(0x97));const _0x51edce=await _0x4d5fa5[_0x42bcc6(0x94)](_0x341a3e),_0x1b618a=a138_0x324d2d(_0x51edce),_0x2a8285=_0x1b618a[_0x42bcc6(0x9a)];if(!_0x2a8285)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x1b80eb);const _0xef1b69=_0x1b618a[_0x42bcc6(0xac)]==='journey'?_0x42bcc6(0xaa):_0x42bcc6(0x90),_0x4197ad=a138_0x43ca0a[_0x42bcc6(0x93)](_0x3bb483,_0x341a3e),_0x48bdf0=a138_0x43ca0a['dirname'](_0x4197ad),_0x2a76fb=_0x48bdf0==='.'?'':_0x48bdf0[_0x42bcc6(0x9c)](/\\/g,'/'),_0x1e63f5=_0x2a76fb?_0x195ec1+'/'+_0x2a76fb+'/'+_0x2a8285:_0x195ec1+'/'+_0x2a8285;return{'parentSegment':_0x195ec1,'segmentName':_0x2a8285,'folderPath':_0x2a76fb,'fullPath':_0x1e63f5,'resourceType':_0xef1b69,'content':_0x51edce};}
1
+ (function(_0x3fc6c9,_0x62aba3){const _0x1693be=a142_0x220e,_0x2af3b2=_0x3fc6c9();while(!![]){try{const _0x5c20d3=-parseInt(_0x1693be(0x8a))/0x1+-parseInt(_0x1693be(0xb3))/0x2+-parseInt(_0x1693be(0xac))/0x3*(parseInt(_0x1693be(0xa3))/0x4)+parseInt(_0x1693be(0x89))/0x5*(-parseInt(_0x1693be(0x98))/0x6)+-parseInt(_0x1693be(0x8b))/0x7*(-parseInt(_0x1693be(0xa5))/0x8)+parseInt(_0x1693be(0xaa))/0x9*(-parseInt(_0x1693be(0xb1))/0xa)+parseInt(_0x1693be(0x99))/0xb;if(_0x5c20d3===_0x62aba3)break;else _0x2af3b2['push'](_0x2af3b2['shift']());}catch(_0xf6575c){_0x2af3b2['push'](_0x2af3b2['shift']());}}}(a142_0x2f31,0xec4dc));import a142_0x5ceb4d from'path';import{parse as a142_0x35631a}from'yaml';function a142_0x220e(_0x58776f,_0x9aca85){_0x58776f=_0x58776f-0x84;const _0x2f3154=a142_0x2f31();let _0x220eed=_0x2f3154[_0x58776f];return _0x220eed;}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x2cf7e7){const _0x796147=a142_0x220e;if(!_0x2cf7e7||_0x2cf7e7[_0x796147(0x96)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x57ad65=_0x2cf7e7[_0x796147(0x96)]();if(_0x57ad65==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x2cf7e7};const _0x5dab12=_0x57ad65['startsWith']('/')?_0x57ad65[_0x796147(0xa6)](0x1):_0x57ad65,_0x901f66=_0x5dab12[_0x796147(0x95)]('/')[_0x796147(0x85)](_0xa5584=>_0xa5584!=='');if(_0x901f66[_0x796147(0x9c)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x585075=_0x57ad65[_0x796147(0x94)]('/')||!isRelativePathSegment(_0x901f66[0x0]);for(const _0x3dac34 of _0x901f66){validatePathSegment(_0x3dac34);}return{'segments':_0x901f66,'isAbsolute':_0x585075,'raw':_0x2cf7e7};}function isRelativePathSegment(_0x26abc6){return _0x26abc6==='.'||_0x26abc6==='..';}function validatePathSegment(_0x3721d8){const _0x149117=a142_0x220e;if(_0x3721d8==='')throw new Error(_0x149117(0x8e));if(_0x3721d8==='.'||_0x3721d8==='..')return;if(/[\x00-\x1F\x7F]/[_0x149117(0x84)](_0x3721d8))throw new Error(_0x149117(0x92)+_0x3721d8);if(_0x3721d8!==_0x3721d8[_0x149117(0x96)]()){}}export function validatePath(_0x58e1ad){const _0x357735=a142_0x220e;if(_0x58e1ad[_0x357735(0x9a)]['length']===0x0&&!_0x58e1ad[_0x357735(0xb0)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x58e1ad[_0x357735(0xb0)]){if(_0x58e1ad[_0x357735(0x9a)][0x0]==='..')throw new Error(_0x357735(0xa7));let _0x2d538e=0x0;for(const _0x4a06cf of _0x58e1ad[_0x357735(0x9a)]){if(_0x4a06cf==='..'){if(_0x2d538e===0x0)throw new Error(_0x357735(0xa0));_0x2d538e--;}else _0x4a06cf!=='.'&&_0x2d538e++;}}}export function joinPaths(_0x394042,_0x388e09){const _0x4bdcf2=a142_0x220e;if(!_0x394042||_0x394042==='/')return _0x388e09;if(!_0x388e09||_0x388e09==='.')return _0x394042;if(_0x388e09[_0x4bdcf2(0x94)]('/'))return _0x388e09;const _0x4d27cd=parsePath(_0x394042),_0xfb11b1=parsePath(_0x388e09),_0x45ba88=[..._0x4d27cd['segments']];for(const _0x395167 of _0xfb11b1[_0x4bdcf2(0x9a)]){if(_0x395167==='.')continue;else{if(_0x395167==='..'){if(_0x45ba88['length']===0x0)throw new Error(_0x4bdcf2(0xa9));_0x45ba88['pop']();}else _0x45ba88[_0x4bdcf2(0xab)](_0x395167);}}const _0x100dea=_0x45ba88['join']('/');return _0x4d27cd['raw'][_0x4bdcf2(0x94)]('/')?'/'+_0x100dea:_0x100dea;}export function normalizePath(_0x214617){const _0xd964c1=a142_0x220e,_0x16f9fd=parsePath(_0x214617),_0x49ae66=[];for(const _0xc0fc9a of _0x16f9fd[_0xd964c1(0x9a)]){if(_0xc0fc9a==='.')continue;else{if(_0xc0fc9a==='..'){if(_0x49ae66[_0xd964c1(0x9c)]===0x0){if(_0x16f9fd['isAbsolute'])throw new Error('Cannot\x20navigate\x20above\x20root');_0x49ae66[_0xd964c1(0xab)]('..');}else _0x49ae66[_0x49ae66[_0xd964c1(0x9c)]-0x1]==='..'?_0x49ae66[_0xd964c1(0xab)]('..'):_0x49ae66[_0xd964c1(0x88)]();}else _0x49ae66[_0xd964c1(0xab)](_0xc0fc9a);}}if(_0x49ae66[_0xd964c1(0x9c)]===0x0)return _0x16f9fd['isAbsolute']?'/':'.';const _0x231d79=_0x49ae66['join']('/');return _0x16f9fd[_0xd964c1(0xaf)][_0xd964c1(0x94)]('/')?'/'+_0x231d79:_0x231d79;}function a142_0x2f31(){const _0x3f5b18=['pop','110VrZkBW','1736818wudGjg','2611WDrulW','resolve','Cannot\x20split\x20empty\x20path','Path\x20segment\x20cannot\x20be\x20empty','root','exists','No\x20tdx.json\x20found\x20for\x20file:\x20','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','segment','startsWith','split','trim','endsWith','376338rSufZv','30749125RSiDvW','segments','type','length','tdx.json','readFile','.yml','Path\x20attempts\x20to\x20navigate\x20above\x20root','slice','.yaml','1348WVbeCB','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','30824PADpbn','substring','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','replace','Cannot\x20navigate\x20above\x20root','9OyzKvE','push','141wIQzuV','dirname','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','raw','isAbsolute','1228410zSDqkf','join','18480AhuXhl','parse','test','filter','journey','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'];a142_0x2f31=function(){return _0x3f5b18;};return a142_0x2f31();}export function getParentPath(_0x3741f2){const _0x4a2b8e=a142_0x220e,_0x419262=parsePath(_0x3741f2);if(_0x419262[_0x4a2b8e(0x9a)]['length']<=0x1)return'/';const _0x49b4bf=_0x419262[_0x4a2b8e(0x9a)][_0x4a2b8e(0xa1)](0x0,-0x1)['join']('/');return _0x419262[_0x4a2b8e(0xaf)]['startsWith']('/')?'/'+_0x49b4bf:_0x49b4bf;}export function getBaseName(_0x1f9418){const _0x757dd9=a142_0x220e,_0x517777=parsePath(_0x1f9418);return _0x517777[_0x757dd9(0x9a)][_0x517777[_0x757dd9(0x9a)][_0x757dd9(0x9c)]-0x1]||'';}export function isChildPath(_0x2e2c57,_0x2f4867){const _0x550162=a142_0x220e,_0x57929f=parsePath(_0x2e2c57),_0x312160=parsePath(_0x2f4867);if(_0x57929f[_0x550162(0x9a)][_0x550162(0x9c)]<=_0x312160[_0x550162(0x9a)][_0x550162(0x9c)])return![];for(let _0x4812f2=0x0;_0x4812f2<_0x312160[_0x550162(0x9a)][_0x550162(0x9c)];_0x4812f2++){if(_0x57929f[_0x550162(0x9a)][_0x4812f2]!==_0x312160[_0x550162(0x9a)][_0x4812f2])return![];}return!![];}export function splitPath(_0x38275c){const _0x30ffff=a142_0x220e,_0x3810b2=parsePath(_0x38275c);if(_0x3810b2[_0x30ffff(0x9a)][_0x30ffff(0x9c)]===0x0)throw new Error(_0x30ffff(0x8d));if(_0x3810b2[_0x30ffff(0x9a)][_0x30ffff(0x9c)]===0x1)return{'parent':_0x3810b2[_0x30ffff(0x9a)][0x0]};return{'parent':_0x3810b2['segments'][0x0],'child':_0x3810b2[_0x30ffff(0x9a)][_0x30ffff(0xa1)](0x1)[_0x30ffff(0xb2)]('/')};}export function isYamlFilePath(_0x1f09cd){const _0x171ca1=a142_0x220e;return _0x1f09cd[_0x171ca1(0x97)](_0x171ca1(0x9f))||_0x1f09cd['endsWith'](_0x171ca1(0xa2));}export async function resolveYamlFilePath(_0x260569,_0x1ce8cb=nodeFileSystem){const _0x33fba1=a142_0x220e,_0x44e9de=a142_0x5ceb4d[_0x33fba1(0x8c)](_0x260569);if(!await _0x1ce8cb[_0x33fba1(0x90)](_0x44e9de))throw new Error('File\x20not\x20found:\x20'+_0x260569);let _0x117acf=a142_0x5ceb4d['dirname'](_0x44e9de),_0x3857f8=null,_0x5cf3e2=null;const _0x1b542c=a142_0x5ceb4d[_0x33fba1(0xb4)](_0x117acf)[_0x33fba1(0x8f)];while(_0x117acf!==_0x1b542c){const _0x19f9a1=a142_0x5ceb4d[_0x33fba1(0xb2)](_0x117acf,_0x33fba1(0x9d));if(await _0x1ce8cb[_0x33fba1(0x90)](_0x19f9a1)){_0x3857f8=_0x19f9a1,_0x5cf3e2=_0x117acf;break;}_0x117acf=a142_0x5ceb4d[_0x33fba1(0xad)](_0x117acf);}if(!_0x3857f8||!_0x5cf3e2)throw new Error(_0x33fba1(0x91)+_0x260569+'\x0a'+_0x33fba1(0xae));const _0x2acc64=await _0x1ce8cb[_0x33fba1(0x9e)](_0x3857f8),_0xe64309=JSON[_0x33fba1(0xb4)](_0x2acc64),_0x31bf81=_0xe64309['parent_segment'];if(!_0x31bf81)throw new Error(_0x33fba1(0xa4));const _0x3f7b7f=await _0x1ce8cb[_0x33fba1(0x9e)](_0x44e9de),_0xd89776=a142_0x35631a(_0x3f7b7f),_0x38c7ad=_0xd89776['name'];if(!_0x38c7ad)throw new Error(_0x33fba1(0x87)+_0x260569);const _0x4ea462=_0xd89776[_0x33fba1(0x9b)]===_0x33fba1(0x86)?_0x33fba1(0x86):_0x33fba1(0x93),_0x35a4d5=a142_0x5ceb4d['relative'](_0x5cf3e2,_0x44e9de),_0xacba09=a142_0x5ceb4d[_0x33fba1(0xad)](_0x35a4d5),_0x4c0b51=_0xacba09==='.'?'':_0xacba09[_0x33fba1(0xa8)](/\\/g,'/'),_0x26c534=_0x4c0b51?_0x31bf81+'/'+_0x4c0b51+'/'+_0x38c7ad:_0x31bf81+'/'+_0x38c7ad;return{'parentSegment':_0x31bf81,'segmentName':_0x38c7ad,'folderPath':_0x4c0b51,'fullPath':_0x26c534,'resourceType':_0x4ea462,'content':_0x3f7b7f};}
@@ -1 +1 @@
1
- function a139_0x54ad(){const _0x4f32e6=['indexOf','769836SmlroS','176sdxnPv','261OeHApW','Invalid\x20segment\x20reference\x20format:\x20','.\x20Child\x20name\x20cannot\x20be\x20empty','588bimNds','37928vtFMgk','2292978vPURRK','519002lTVpdN','8DehKmL','substring','4810Rjtrig','573986EnmtZX','734979lZXiqe','5NtMeuQ'];a139_0x54ad=function(){return _0x4f32e6;};return a139_0x54ad();}(function(_0x522686,_0x1d44ef){const _0x4d8bd3=a139_0x219b,_0xdf793b=_0x522686();while(!![]){try{const _0x365c77=parseInt(_0x4d8bd3(0xf0))/0x1+parseInt(_0x4d8bd3(0xec))/0x2+-parseInt(_0x4d8bd3(0xe1))/0x3*(-parseInt(_0x4d8bd3(0xed))/0x4)+parseInt(_0x4d8bd3(0xe2))/0x5*(-parseInt(_0x4d8bd3(0xeb))/0x6)+parseInt(_0x4d8bd3(0xe9))/0x7*(parseInt(_0x4d8bd3(0xea))/0x8)+-parseInt(_0x4d8bd3(0xe6))/0x9*(-parseInt(_0x4d8bd3(0xef))/0xa)+parseInt(_0x4d8bd3(0xe5))/0xb*(-parseInt(_0x4d8bd3(0xe4))/0xc);if(_0x365c77===_0x1d44ef)break;else _0xdf793b['push'](_0xdf793b['shift']());}catch(_0x3d9962){_0xdf793b['push'](_0xdf793b['shift']());}}}(a139_0x54ad,0x4fd8f));function a139_0x219b(_0x2c8540,_0x162889){_0x2c8540=_0x2c8540-0xe1;const _0x54ad4c=a139_0x54ad();let _0x219bef=_0x54ad4c[_0x2c8540];return _0x219bef;}export function parseSegmentRef(_0x1e0e6f){const _0x33970e=a139_0x219b,_0x3a33c6=_0x1e0e6f[_0x33970e(0xe3)]('/');if(_0x3a33c6===-0x1)return{'parentId':_0x1e0e6f};if(_0x3a33c6===0x0)throw new Error(_0x33970e(0xe7)+_0x1e0e6f+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x45809f=_0x1e0e6f[_0x33970e(0xee)](0x0,_0x3a33c6),_0x78efd0=_0x1e0e6f[_0x33970e(0xee)](_0x3a33c6+0x1);if(_0x78efd0==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x1e0e6f+_0x33970e(0xe8));return{'parentId':_0x45809f,'childId':_0x78efd0};}
1
+ function a143_0x5d81(_0x5c0af3,_0x4c3cbf){_0x5c0af3=_0x5c0af3-0x1e6;const _0x3d591a=a143_0x3d59();let _0x5d8177=_0x3d591a[_0x5c0af3];return _0x5d8177;}(function(_0x37008e,_0x289961){const _0x32c8c5=a143_0x5d81,_0x135813=_0x37008e();while(!![]){try{const _0x5bb57b=parseInt(_0x32c8c5(0x1e8))/0x1+-parseInt(_0x32c8c5(0x1ea))/0x2+-parseInt(_0x32c8c5(0x1ec))/0x3*(parseInt(_0x32c8c5(0x1f0))/0x4)+parseInt(_0x32c8c5(0x1ef))/0x5*(-parseInt(_0x32c8c5(0x1e6))/0x6)+-parseInt(_0x32c8c5(0x1f2))/0x7+parseInt(_0x32c8c5(0x1e7))/0x8+parseInt(_0x32c8c5(0x1ee))/0x9;if(_0x5bb57b===_0x289961)break;else _0x135813['push'](_0x135813['shift']());}catch(_0x29b925){_0x135813['push'](_0x135813['shift']());}}}(a143_0x3d59,0x605e9));function a143_0x3d59(){const _0x3cd538=['indexOf','1095732aJrJLW','5BbWauV','28rYyLmo','substring','1862357CwAxLu','290106qzDHqn','4692080MSXRuQ','21680ILRbFq','.\x20Parent\x20name\x20cannot\x20be\x20empty','37862TXoMNl','Invalid\x20segment\x20reference\x20format:\x20','804HNyGnz'];a143_0x3d59=function(){return _0x3cd538;};return a143_0x3d59();}export function parseSegmentRef(_0x4e33a3){const _0x1c9a38=a143_0x5d81,_0x3949ba=_0x4e33a3[_0x1c9a38(0x1ed)]('/');if(_0x3949ba===-0x1)return{'parentId':_0x4e33a3};if(_0x3949ba===0x0)throw new Error(_0x1c9a38(0x1eb)+_0x4e33a3+_0x1c9a38(0x1e9));const _0x1a2bae=_0x4e33a3[_0x1c9a38(0x1f1)](0x0,_0x3949ba),_0x383576=_0x4e33a3[_0x1c9a38(0x1f1)](_0x3949ba+0x1);if(_0x383576==='')throw new Error(_0x1c9a38(0x1eb)+_0x4e33a3+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x1a2bae,'childId':_0x383576};}