@treasuredata/tdx 2026.3.35 → 2026.3.37

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 (219) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/frontmatter.js +1 -1
  182. package/dist/sdk/workspace/git.js +1 -1
  183. package/dist/sdk/workspace/index.js +1 -1
  184. package/dist/sdk/workspace/templates.js +1 -1
  185. package/dist/sdk/workspace/weekly.js +1 -1
  186. package/dist/sdk/workspace/wikilinks.js +1 -1
  187. package/dist/test-utils/command-runner.js +1 -1
  188. package/dist/test-utils/factories.js +1 -1
  189. package/dist/test-utils/fixtures.js +1 -1
  190. package/dist/test-utils/http-mock.js +1 -1
  191. package/dist/test-utils/index.js +1 -1
  192. package/dist/utils/async.js +1 -1
  193. package/dist/utils/colors.js +1 -1
  194. package/dist/utils/diff.js +1 -1
  195. package/dist/utils/file-permissions.js +1 -1
  196. package/dist/utils/file-reader.js +1 -1
  197. package/dist/utils/github-releases.js +1 -1
  198. package/dist/utils/global-cache.js +1 -1
  199. package/dist/utils/json-loader.js +1 -1
  200. package/dist/utils/local-cache.js +1 -1
  201. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  202. package/dist/utils/logger/formatters/index.js +1 -1
  203. package/dist/utils/logger/handlers/console-handler.js +1 -1
  204. package/dist/utils/logger/handlers/file-handler.js +1 -1
  205. package/dist/utils/logger/handlers/index.js +1 -1
  206. package/dist/utils/logger/handlers/null-handler.js +1 -1
  207. package/dist/utils/logger/index.js +1 -1
  208. package/dist/utils/logger/logger.js +1 -1
  209. package/dist/utils/logger/types.js +1 -1
  210. package/dist/utils/option-validation.js +1 -1
  211. package/dist/utils/process.js +1 -1
  212. package/dist/utils/prompt.js +1 -1
  213. package/dist/utils/spinner.js +1 -1
  214. package/dist/utils/sse-parser.js +1 -1
  215. package/dist/utils/string-utils.js +1 -1
  216. package/dist/utils/table-ref-parser.js +1 -1
  217. package/dist/utils/tdx-logger.js +1 -1
  218. package/dist/utils/version-check.js +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- const a151_0x570370=a151_0x586a;(function(_0x43f158,_0xde3eff){const _0x32b58=a151_0x586a,_0x4bb2de=_0x43f158();while(!![]){try{const _0x27596c=-parseInt(_0x32b58(0x1a6))/0x1*(-parseInt(_0x32b58(0x1b2))/0x2)+parseInt(_0x32b58(0x19f))/0x3+parseInt(_0x32b58(0x1af))/0x4*(-parseInt(_0x32b58(0x19c))/0x5)+-parseInt(_0x32b58(0x1b0))/0x6*(parseInt(_0x32b58(0x1a1))/0x7)+-parseInt(_0x32b58(0x19d))/0x8*(-parseInt(_0x32b58(0x1a5))/0x9)+-parseInt(_0x32b58(0x199))/0xa*(parseInt(_0x32b58(0x1b1))/0xb)+-parseInt(_0x32b58(0x1aa))/0xc*(-parseInt(_0x32b58(0x19e))/0xd);if(_0x27596c===_0xde3eff)break;else _0x4bb2de['push'](_0x4bb2de['shift']());}catch(_0x56d481){_0x4bb2de['push'](_0x4bb2de['shift']());}}}(a151_0x75a6,0x6c749));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';function a151_0x586a(_0x25e627,_0x3c1150){_0x25e627=_0x25e627-0x199;const _0x75a6bd=a151_0x75a6();let _0x586ad3=_0x75a6bd[_0x25e627];return _0x586ad3;}import a151_0x216ba4 from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a151_0x570370(0x19b));export function getPushRecoveryPath(_0x2d8ed4){const _0x5beda9=a151_0x570370,_0x53639e=a151_0x216ba4[_0x5beda9(0x1a9)](_0x2d8ed4),_0x5b8658=a151_0x216ba4[_0x5beda9(0x1a8)](_0x2d8ed4);return a151_0x216ba4['join'](_0x53639e,'.'+_0x5b8658+'.push-recovery.json');}export function readPushRecovery(_0x8fad07){const _0x2cfd3f=a151_0x570370,_0x24b3c2=getPushRecoveryPath(_0x8fad07);if(!existsSync(_0x24b3c2))return undefined;try{const _0x19842f=readFileSync(_0x24b3c2,_0x2cfd3f(0x1ae)),_0x50614e=JSON['parse'](_0x19842f);if(_0x50614e?.[_0x2cfd3f(0x1a2)]!==0x1||typeof _0x50614e[_0x2cfd3f(0x19a)]!=='string')return undefined;return _0x50614e;}catch(_0x141d3d){return _0x141d3d instanceof SyntaxError?logger[_0x2cfd3f(0x1a3)](_0x2cfd3f(0x1a7)+_0x141d3d):logger['warn']('Failed\x20to\x20read\x20push\x20recovery\x20file:\x20'+_0x141d3d),undefined;}}export function writePushRecovery(_0x590caf,_0x189714){const _0x433e62=a151_0x570370,_0x1dc211=getPushRecoveryPath(_0x590caf),_0xa9573a=_0x1dc211+_0x433e62(0x1a4);writeFileSync(_0xa9573a,JSON[_0x433e62(0x1ab)](_0x189714,null,0x2)+'\x0a',_0x433e62(0x1ae)),renameSync(_0xa9573a,_0x1dc211);}export function deletePushRecovery(_0xdadfb){const _0x43d356=a151_0x570370,_0x3e8a37=getPushRecoveryPath(_0xdadfb);try{unlinkSync(_0x3e8a37);}catch(_0x26c3bd){_0x26c3bd[_0x43d356(0x1ac)]!=='ENOENT'&&logger[_0x43d356(0x1a3)]('Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20'+_0x26c3bd);}}export function saveSegmentToPushRecovery(_0x4d2026,_0x5691cb,_0x5a903e,_0x10bc7b){const _0x8557f8=a151_0x570370,_0x4feec4=readPushRecovery(_0x4d2026),_0x404e8d=_0x4feec4?.['journeyName']===_0x5691cb?{..._0x4feec4,'updatedAt':new Date()[_0x8557f8(0x1ad)]()}:{'version':0x1,'journeyName':_0x5691cb,'updatedAt':new Date()[_0x8557f8(0x1ad)](),'segments':{}};_0x404e8d[_0x8557f8(0x1a0)][_0x5a903e]=_0x10bc7b,writePushRecovery(_0x4d2026,_0x404e8d);}function a151_0x75a6(){const _0x21f572=['Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','basename','dirname','57636anhkOL','stringify','code','toISOString','utf-8','64KiYDEf','8214uvGIZN','7990191nuxgqw','25924OeEekv','10cLZkdk','journeyName','tdx.sdk.push-recovery','38785swcgPj','12088pXxnDJ','1053KVnFkI','662241oHarYI','segments','581yffWUm','version','debug','.tmp','819ETzKUU','51TDwnFG'];a151_0x75a6=function(){return _0x21f572;};return a151_0x75a6();}
1
+ const a151_0x4bfcb4=a151_0x3d9c;(function(_0x25ea08,_0x597c20){const _0x11e877=a151_0x3d9c,_0x259ab5=_0x25ea08();while(!![]){try{const _0x26ad34=-parseInt(_0x11e877(0x170))/0x1+parseInt(_0x11e877(0x17e))/0x2*(-parseInt(_0x11e877(0x185))/0x3)+parseInt(_0x11e877(0x171))/0x4*(-parseInt(_0x11e877(0x16f))/0x5)+-parseInt(_0x11e877(0x174))/0x6*(parseInt(_0x11e877(0x184))/0x7)+parseInt(_0x11e877(0x17b))/0x8+-parseInt(_0x11e877(0x182))/0x9*(-parseInt(_0x11e877(0x17c))/0xa)+parseInt(_0x11e877(0x181))/0xb;if(_0x26ad34===_0x597c20)break;else _0x259ab5['push'](_0x259ab5['shift']());}catch(_0x55b609){_0x259ab5['push'](_0x259ab5['shift']());}}}(a151_0x5ace,0x20296));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';function a151_0x5ace(){const _0x2905d7=['773390TrLEdg','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','6COuiZk','utf-8','ENOENT','5587857JQqpaN','27vvJYwm','code','358141MqbKeR','222897ggnbKZ','journeyName','toISOString','525adFmVL','251486MZVBuN','4688yRvsCm','join','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','30tWQopN','string','dirname','tdx.sdk.push-recovery','.push-recovery.json','basename','version','1959904umtdTE'];a151_0x5ace=function(){return _0x2905d7;};return a151_0x5ace();}import a151_0x3ec4be from'path';function a151_0x3d9c(_0x148858,_0x28a66a){_0x148858=_0x148858-0x16f;const _0x5ace54=a151_0x5ace();let _0x3d9c62=_0x5ace54[_0x148858];return _0x3d9c62;}import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a151_0x4bfcb4(0x177));export function getPushRecoveryPath(_0x5918f2){const _0x523413=a151_0x4bfcb4,_0x52b9e2=a151_0x3ec4be[_0x523413(0x176)](_0x5918f2),_0x263013=a151_0x3ec4be[_0x523413(0x179)](_0x5918f2);return a151_0x3ec4be[_0x523413(0x172)](_0x52b9e2,'.'+_0x263013+_0x523413(0x178));}export function readPushRecovery(_0x4ed6e3){const _0xd820f0=a151_0x4bfcb4,_0x573560=getPushRecoveryPath(_0x4ed6e3);if(!existsSync(_0x573560))return undefined;try{const _0x15726d=readFileSync(_0x573560,_0xd820f0(0x17f)),_0x3f2d08=JSON['parse'](_0x15726d);if(_0x3f2d08?.[_0xd820f0(0x17a)]!==0x1||typeof _0x3f2d08[_0xd820f0(0x186)]!==_0xd820f0(0x175))return undefined;return _0x3f2d08;}catch(_0xcfbf74){return _0xcfbf74 instanceof SyntaxError?logger['debug'](_0xd820f0(0x17d)+_0xcfbf74):logger['warn'](_0xd820f0(0x173)+_0xcfbf74),undefined;}}export function writePushRecovery(_0x4b4a9d,_0x39ac56){const _0x1ed5b9=a151_0x4bfcb4,_0x87fb60=getPushRecoveryPath(_0x4b4a9d),_0x3fc872=_0x87fb60+'.tmp';writeFileSync(_0x3fc872,JSON['stringify'](_0x39ac56,null,0x2)+'\x0a',_0x1ed5b9(0x17f)),renameSync(_0x3fc872,_0x87fb60);}export function deletePushRecovery(_0x5185c4){const _0x4a4468=a151_0x4bfcb4,_0x16cd81=getPushRecoveryPath(_0x5185c4);try{unlinkSync(_0x16cd81);}catch(_0x4a73a3){_0x4a73a3[_0x4a4468(0x183)]!==_0x4a4468(0x180)&&logger['debug']('Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20'+_0x4a73a3);}}export function saveSegmentToPushRecovery(_0x2ed4bc,_0x5d8951,_0x2eb526,_0x4c066a){const _0x23c5d1=a151_0x4bfcb4,_0x29747=readPushRecovery(_0x2ed4bc),_0x44a58a=_0x29747?.[_0x23c5d1(0x186)]===_0x5d8951?{..._0x29747,'updatedAt':new Date()[_0x23c5d1(0x187)]()}:{'version':0x1,'journeyName':_0x5d8951,'updatedAt':new Date()[_0x23c5d1(0x187)](),'segments':{}};_0x44a58a['segments'][_0x2eb526]=_0x4c066a,writePushRecovery(_0x2ed4bc,_0x44a58a);}
@@ -1 +1 @@
1
- (function(_0x491e0a,_0x235da5){const _0x518209=a152_0x57cc,_0x2d8857=_0x491e0a();while(!![]){try{const _0xc2f0b5=-parseInt(_0x518209(0x1b9))/0x1*(-parseInt(_0x518209(0x185))/0x2)+-parseInt(_0x518209(0x195))/0x3*(parseInt(_0x518209(0x1a9))/0x4)+-parseInt(_0x518209(0x1af))/0x5+parseInt(_0x518209(0x1ad))/0x6+-parseInt(_0x518209(0x20e))/0x7+parseInt(_0x518209(0x1c5))/0x8*(parseInt(_0x518209(0x1d1))/0x9)+parseInt(_0x518209(0x1d9))/0xa;if(_0xc2f0b5===_0x235da5)break;else _0x2d8857['push'](_0x2d8857['shift']());}catch(_0x396a54){_0x2d8857['push'](_0x2d8857['shift']());}}}(a152_0x1b16,0x9440d));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x390dd1){return''+PENDING_SEGMENT_PREFIX+_0x390dd1+'__';}export function isPendingSegmentId(_0x26d9a9){const _0x3452fe=a152_0x57cc;return _0x26d9a9[_0x3452fe(0x192)](PENDING_SEGMENT_PREFIX)&&!_0x26d9a9['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x14c2b0){const _0x50df62=a152_0x57cc;return _0x14c2b0[_0x50df62(0x1a3)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5adc20){return''+PENDING_ACTIVATION_PREFIX+_0x5adc20+'__';}function a152_0x57cc(_0x42abd5,_0x446139){_0x42abd5=_0x42abd5-0x123;const _0x1b1617=a152_0x1b16();let _0x57ccc0=_0x1b1617[_0x42abd5];return _0x57ccc0;}export function isPendingActivationId(_0x4c88bc){const _0x534eba=a152_0x57cc;return _0x4c88bc[_0x534eba(0x192)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x142c23){const _0x1280b9=a152_0x57cc;return _0x142c23[_0x1280b9(0x1a3)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x51e788,_0x36ccd7){const _0x5c4240=a152_0x57cc,_0x531e0f=_0x51e788+'::'+(_0x36ccd7[_0x5c4240(0x1ed)]()||_0x5c4240(0x1ef)),_0x275189=createHash('sha1')[_0x5c4240(0x1fe)](_0x531e0f)[_0x5c4240(0x21f)]('hex')['slice'](0x0,0xc);return _0x5c4240(0x186)+_0x275189;}export function ensureJourneyDefaults(_0x4ff2cf){const _0xe254b8=a152_0x57cc;!_0x4ff2cf[_0xe254b8(0x151)]&&(_0x4ff2cf['description']=''),!_0x4ff2cf['state']&&(_0x4ff2cf['state']=_0xe254b8(0x1e1));}export function injectExistingStageIds(_0x4851ff,_0x213e44){const _0x34a577=a152_0x57cc,_0x3a7ba1=new Map(_0x213e44[_0x34a577(0x1dd)](_0x5f246c=>[_0x5f246c[_0x34a577(0x128)],_0x5f246c['id']]));for(const _0x46c5a9 of _0x4851ff){if(!_0x46c5a9['id']){const _0x44d8ae=_0x3a7ba1[_0x34a577(0x1bc)](_0x46c5a9[_0x34a577(0x128)]);_0x44d8ae&&(_0x46c5a9['id']=_0x44d8ae);}}}export function resolveTDFolderPath(_0x1853c5,_0x2661d8,_0x5d9250){const _0x4bf710=a152_0x57cc;if(!_0x2661d8)return _0x1853c5;if(_0x1853c5===_0x5d9250||_0x1853c5[_0x4bf710(0x192)](_0x5d9250+'/'))return _0x1853c5;return _0x1853c5?_0x5d9250+'/'+_0x1853c5:_0x5d9250;}export function addFoldersToCreate(_0x55c120,_0x37b4d2,_0x54a2cb){const _0x162c52=a152_0x57cc;if(!_0x55c120)return;if(_0x37b4d2[_0x162c52(0x169)](_0x55c120))return;const _0x199db2=_0x55c120[_0x162c52(0x21d)]('/');let _0x4a4453='';for(const _0x895c97 of _0x199db2){_0x4a4453=_0x4a4453?_0x4a4453+'/'+_0x895c97:_0x895c97,!_0x37b4d2[_0x162c52(0x169)](_0x4a4453)&&_0x54a2cb[_0x162c52(0x180)](_0x4a4453);}}export function sortFoldersByDepth(_0x5c74ac){const _0x51c98e=a152_0x57cc;return[..._0x5c74ac][_0x51c98e(0x13f)]((_0x5ab314,_0x6ce942)=>{const _0x1afa41=_0x51c98e,_0x5f4679=(_0x5ab314[_0x1afa41(0x191)](/\//g)||[])[_0x1afa41(0x1d7)],_0x157d55=(_0x6ce942[_0x1afa41(0x191)](/\//g)||[])['length'];return _0x5f4679-_0x157d55;});}import*as a152_0x21a271 from'yaml';import{readFileSync}from'fs';import a152_0x54c886 from'path';import{isJourneyDef,parseYamlString as a152_0x1367fb,toYamlString as a152_0x57e6e8,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(_0x3d9b75){const _0x42978e=a152_0x57cc;if(Array['isArray'](_0x3d9b75))return'['+_0x3d9b75['map'](_0x51a449=>stableStringify(_0x51a449))['join'](',')+']';if(_0x3d9b75&&typeof _0x3d9b75===_0x42978e(0x182)){const _0x58952a=_0x3d9b75,_0x26ec9b=Object[_0x42978e(0x14f)](_0x58952a)[_0x42978e(0x13f)](),_0x34cc06=_0x26ec9b[_0x42978e(0x1dd)](_0x369ea7=>'\x22'+_0x369ea7+'\x22:'+stableStringify(_0x58952a[_0x369ea7]));return'{'+_0x34cc06[_0x42978e(0x136)](',')+'}';}const _0x17fea1=JSON[_0x42978e(0x1bb)](_0x3d9b75);return _0x17fea1===undefined?_0x42978e(0x223):_0x17fea1;}function activationSignature(_0x221496){const _0x4e76d7=a152_0x57cc,_0x26f087={'connection':_0x221496['connection'],..._0x221496[_0x4e76d7(0x1b6)]!==undefined&&{'all_columns':_0x221496[_0x4e76d7(0x1b6)]},..._0x221496[_0x4e76d7(0x150)]!==undefined&&{'columns':_0x221496[_0x4e76d7(0x150)]},..._0x221496[_0x4e76d7(0x1b3)]!==undefined&&{'behavior':_0x221496['behavior']},..._0x221496[_0x4e76d7(0x1c7)]!==undefined&&{'schedule':_0x221496[_0x4e76d7(0x1c7)]},..._0x221496[_0x4e76d7(0x1bf)]!==undefined&&{'notification':_0x221496[_0x4e76d7(0x1bf)]},..._0x221496[_0x4e76d7(0x17e)]!==undefined&&{'connector_config':_0x221496[_0x4e76d7(0x17e)]},..._0x221496[_0x4e76d7(0x135)]!==undefined&&{'activation_template_id':_0x221496['activation_template_id']}};return stableStringify(_0x26f087);}async function fetchSegment(_0x50d25c,_0x354969,_0x485ef4,_0x3f2971){const _0x354098=a152_0x57cc,_0x43c7ad=_0x3f2971?.['find'](_0x4ff43f=>_0x4ff43f['id']===_0x485ef4);if(_0x43c7ad)return _0x43c7ad;try{return await _0x50d25c[_0x354098(0x1ef)]['getSegment'](_0x354969,_0x485ef4);}catch(_0xb8494b){logger[_0x354098(0x1d2)]('getSegment\x20failed\x20for\x20'+_0x485ef4+_0x354098(0x17d)+_0xb8494b);try{return await _0x50d25c[_0x354098(0x1ef)]['getSegmentEntity'](_0x485ef4);}catch(_0x2e3cc9){return logger['debug'](_0x354098(0x167)+_0x485ef4+':\x20'+_0x2e3cc9),null;}}}function recoverSegmentIdsFromPushRecovery(_0x23b684,_0x9a489a,_0x21cbcc){const _0x456d8f=a152_0x57cc,_0xae37f5=readPushRecovery(_0x23b684[_0x456d8f(0x1f2)]);if(_0xae37f5?.['journeyName']===_0x23b684[_0x456d8f(0x20f)]['name'])for(const [_0x44cfd0,_0x440947]of Object[_0x456d8f(0x1ec)](_0xae37f5[_0x456d8f(0x155)])){const _0x27b929=generateDeterministicJourneySegmentName(_0x23b684[_0x456d8f(0x20f)][_0x456d8f(0x128)],_0x44cfd0);_0x440947[_0x456d8f(0x16c)]===_0x27b929&&(_0x9a489a['set'](_0x44cfd0,_0x440947[_0x456d8f(0x1c9)]),_0x21cbcc[_0x456d8f(0x1a0)](_0x44cfd0,_0x440947[_0x456d8f(0x1c9)]));}}async function createOrRecoverEmbeddedSegment(_0x512621,_0x273007,_0x549e4c,_0x57b7b6){const _0x2990b4=a152_0x57cc;let _0x1d9116;try{_0x1d9116=await _0x512621[_0x2990b4(0x1ef)][_0x2990b4(0x189)]({'name':_0x549e4c[_0x2990b4(0x1c2)],'description':_0x549e4c[_0x2990b4(0x151)],'journeyId':_0x549e4c[_0x2990b4(0x14c)],'rule':_0x57b7b6(_0x549e4c[_0x2990b4(0x1ac)],!![]),'countPopulation':!![],'parentFolderId':_0x549e4c['folderId'],'audienceId':_0x549e4c[_0x2990b4(0x1b2)]});}catch(_0x30c100){const _0x3a81a4=_0x30c100 instanceof Error&&_0x30c100[_0x2990b4(0x19b)][_0x2990b4(0x132)]('Name\x20has\x20already\x20been\x20taken');if(_0x3a81a4){const _0x6f4204=readPushRecovery(_0x273007[_0x2990b4(0x1f2)]),_0x1c3e0f=_0x6f4204?.[_0x2990b4(0x201)]===_0x273007[_0x2990b4(0x20f)][_0x2990b4(0x128)]?_0x6f4204['segments'][_0x549e4c[_0x2990b4(0x1e8)]]:undefined;if(_0x1c3e0f?.[_0x2990b4(0x16c)]===_0x549e4c['uniqueSegmentName'])await _0x512621[_0x2990b4(0x1ef)][_0x2990b4(0x1f5)](_0x549e4c[_0x2990b4(0x1b2)],_0x1c3e0f[_0x2990b4(0x1c9)],{'description':_0x549e4c[_0x2990b4(0x151)],'rule':_0x57b7b6(_0x549e4c[_0x2990b4(0x1ac)],!![]),'countPopulation':!![]}),_0x1d9116=_0x1c3e0f[_0x2990b4(0x1c9)];else throw new SDKError(ErrorCode[_0x2990b4(0x181)],_0x2990b4(0x160)+_0x549e4c[_0x2990b4(0x1e8)]+_0x2990b4(0x1a7)+(_0x2990b4(0x140)+_0x273007[_0x2990b4(0x1f2)][_0x2990b4(0x1a3)](/([^/]+)$/,_0x2990b4(0x130))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x30c100);}else throw _0x30c100;}return saveSegmentToPushRecovery(_0x273007[_0x2990b4(0x1f2)],_0x273007[_0x2990b4(0x20f)][_0x2990b4(0x128)],_0x549e4c[_0x2990b4(0x1e8)],{'segmentId':_0x1d9116,'uniqueServerName':_0x549e4c[_0x2990b4(0x1c2)],'createdAt':new Date()[_0x2990b4(0x17b)]()}),_0x1d9116;}export async function prepareSegmentFiles(_0x2f8016,_0x2b2770,_0x424111,_0x22dc08,_0x31658){const _0x5301df=a152_0x57cc,{activationDefToCreateRequest:_0x3faf84}=await import(_0x5301df(0x13d)),_0x2cef5b=[],_0x5d76b1=new Set();for(const {yamlConfig:_0x1775bf,folderPath:_0x4e3b7c,sourcePath:_0x244648}of _0x2f8016){const _0x38135b=resolveTDFolderPath(_0x4e3b7c,_0x22dc08,_0x31658),_0x441741=_0x38135b+':'+_0x1775bf[_0x5301df(0x128)],_0x543f5f=_0x2b2770[_0x5301df(0x1b8)]['get'](_0x441741),_0x544210=_0x543f5f?_0x2b2770[_0x5301df(0x1d8)][_0x5301df(0x1bc)](_0x543f5f['id'])||[]:[];addFoldersToCreate(_0x38135b,_0x2b2770['folderPathToId'],_0x5d76b1);const _0x44e87d=calculateActivationActions(_0x1775bf[_0x5301df(0x222)]||[],_0x544210,_0x2b2770['idToEmailMap'],_0x2b2770['connectionIdToNameMap']);for(const _0x38ebd0 of _0x44e87d){(_0x38ebd0[_0x5301df(0x19e)]==='create'||_0x38ebd0[_0x5301df(0x19e)]===_0x5301df(0x1fe))&&_0x38ebd0['yamlActivation']&&(_0x38ebd0[_0x5301df(0x13c)]=await _0x3faf84(_0x38ebd0[_0x5301df(0x1f6)],_0x424111));}const _0x2dce62=calculateSegmentDiff(_0x1775bf,_0x543f5f,_0x544210,_0x2b2770[_0x5301df(0x1f7)],_0x2b2770['connectionIdToNameMap']);_0x2cef5b['push']({'relativePath':_0x1775bf[_0x5301df(0x128)],'absolutePath':_0x244648,'yamlConfig':_0x1775bf,'folderPath':_0x38135b,'existingSegment':_0x543f5f,'existingActivations':_0x544210,'isNew':_0x2dce62['isNew'],'hasChanges':_0x2dce62[_0x5301df(0x15b)],'diff':_0x2dce62['diff'],'activationActions':_0x44e87d});}return{'segmentFiles':_0x2cef5b,'foldersToCreate':_0x5d76b1};}export async function prepareJourneyFiles(_0x54322d,_0x138399,_0x51b773,_0x5819fc){const _0x59272a=a152_0x57cc,_0x4a4970=[],_0x1573d0=new Set();for(const {yamlConfig:_0x1a9315,folderPath:_0x101321,sourcePath:_0x116470}of _0x54322d){const _0x539b18=resolveTDFolderPath(_0x101321,_0x51b773,_0x5819fc),_0x381e04=_0x539b18+':'+_0x1a9315[_0x59272a(0x128)],_0x5700d0=_0x138399[_0x59272a(0x20b)][_0x59272a(0x1bc)](_0x381e04);let _0x577afb,_0x264fdb;if(_0x5700d0&&_0x5700d0[_0x59272a(0x1d7)]>0x0){const _0xef5f46=buildLocalExpandedRuleMappings(_0x1a9315),{createYamlContext:_0x35318b,prefetchJourneySegments:_0x5dea00}=createPushYamlContextForBundle(_0x138399[_0x59272a(0x14d)],_0x138399[_0x59272a(0x1b2)],_0x138399['existingSegments'],_0xef5f46,_0x138399[_0x59272a(0x1f7)],_0x138399[_0x59272a(0x1a4)],_0x138399[_0x59272a(0x213)],_0x138399[_0x59272a(0x1c6)]);await _0x5dea00(_0x5700d0['map'](_0x4a6b44=>_0x4a6b44['id']));const _0x2a699c=await _0x138399[_0x59272a(0x14d)][_0x59272a(0x1a8)]['getLatestJourneyId'](_0x5700d0[0x0][_0x59272a(0x164)]),_0x2d2140=hasMultipleVersions(_0x1a9315),_0x3aa860=async _0x1392f9=>{const _0x3aa233=_0x59272a,_0x3e3592=_0x138399[_0x3aa233(0x1c6)]?.[_0x3aa233(0x1bc)](_0x1392f9);if(_0x3e3592)return _0x3e3592;return _0x138399['fetchJourney']({'journeyId':_0x1392f9,'journeyName':_0x1a9315[_0x3aa233(0x128)],'isMultiVersion':_0x5700d0[_0x3aa233(0x1d7)]>0x1});};if(_0x2d2140&&_0x5700d0['length']>0x1){const _0x4445fd=[];for(const _0x12211b of _0x5700d0){const _0x5e30d3=_0x12211b[_0x59272a(0x219)]||0x1;_0x138399[_0x59272a(0x1c1)]?.[_0x59272a(0x1fe)](_0x59272a(0x1b0)+_0x1a9315[_0x59272a(0x128)]+'\x20v'+_0x5e30d3);const _0x491f3e=await _0x3aa860(_0x12211b['id']),_0x154834=_0x35318b(_0x12211b['id']),_0x4facd9=await journeyResponseToDef(_0x491f3e,_0x154834);_0x4445fd['push']({'item':_0x12211b,'yaml':_0x4facd9});}const _0x564c99=buildLocalRuleToNameMappingFromJourney(_0x1a9315);_0x264fdb=buildMergedJourneyDef(_0x4445fd,_0x564c99,_0x2a699c);const _0x370204=Math[_0x59272a(0x1cd)](..._0x4445fd[_0x59272a(0x1dd)](_0x3a8de1=>_0x3a8de1[_0x59272a(0x207)][_0x59272a(0x219)]||0x0)),_0x1e1906=_0x5700d0[_0x59272a(0x1e6)](_0x1ab634=>(_0x1ab634[_0x59272a(0x219)]||0x0)===_0x370204);_0x1e1906&&(_0x138399[_0x59272a(0x1c1)]?.[_0x59272a(0x1fe)](_0x59272a(0x1b0)+_0x1a9315['name']+'\x20v'+_0x370204),_0x577afb=await _0x3aa860(_0x1e1906['id']));}else{const _0x3c3400=_0x5700d0[_0x5700d0[_0x59272a(0x1d7)]-0x1];_0x138399[_0x59272a(0x1c1)]?.[_0x59272a(0x1fe)](_0x59272a(0x1b0)+_0x1a9315[_0x59272a(0x128)]),_0x577afb=await _0x3aa860(_0x3c3400['id']);const _0x580a04=_0x35318b(_0x3c3400['id']),_0x5753a0=await journeyResponseToDef(_0x577afb,_0x580a04),_0x412d72=buildLocalRuleToNameMappingFromJourney(_0x1a9315);_0x264fdb=buildMergedJourneyDef([{'item':_0x3c3400,'yaml':_0x5753a0}],_0x412d72,_0x2a699c);}}addFoldersToCreate(_0x539b18,_0x138399[_0x59272a(0x204)],_0x1573d0);const _0xe9a593=calculateJourneyDiff(_0x1a9315,_0x264fdb);_0x4a4970[_0x59272a(0x168)]({'relativePath':_0x1a9315['name'],'absolutePath':_0x116470,'yamlConfig':_0x1a9315,'folderPath':_0x539b18,'existingJourney':_0x577afb,'isNew':_0xe9a593['isNew'],'hasChanges':_0xe9a593[_0x59272a(0x15b)],'diff':_0xe9a593[_0x59272a(0x21b)]});}return{'journeyFiles':_0x4a4970,'foldersToCreate':_0x1573d0};}export function calculateActivationActions(_0x9bebc1,_0x264ef0,_0x378b4e,_0x110ee2){const _0x589fd5=a152_0x57cc,_0x458a33=[],_0x2fadc6=new Map();for(const _0x539b73 of _0x264ef0){_0x2fadc6['set'](_0x539b73['name'],_0x539b73);}const _0x5857b1=new Map();for(const _0x15e72f of _0x9bebc1){_0x5857b1['set'](_0x15e72f[_0x589fd5(0x128)],_0x15e72f);}for(const _0x227248 of _0x9bebc1){const _0x3f3b2c=_0x2fadc6[_0x589fd5(0x1bc)](_0x227248[_0x589fd5(0x128)]);if(!_0x3f3b2c)_0x458a33[_0x589fd5(0x168)]({'type':_0x589fd5(0x1c0),'name':_0x227248[_0x589fd5(0x128)],'yamlActivation':_0x227248});else{const _0x4c4c0c=activationResponseToDef(_0x3f3b2c,_0x378b4e,_0x110ee2),_0x423a17=a152_0x21a271[_0x589fd5(0x1bb)](_0x4c4c0c),_0x16271c=a152_0x21a271[_0x589fd5(0x1bb)](_0x227248);_0x423a17!==_0x16271c&&_0x458a33[_0x589fd5(0x168)]({'type':_0x589fd5(0x1fe),'name':_0x227248[_0x589fd5(0x128)],'yamlActivation':_0x227248,'existingActivation':_0x3f3b2c});}}for(const _0x5a6bbf of _0x264ef0){!_0x5857b1['has'](_0x5a6bbf['name'])&&_0x458a33[_0x589fd5(0x168)]({'type':_0x589fd5(0x141),'name':_0x5a6bbf['name'],'existingActivation':_0x5a6bbf});}return _0x458a33;}function calculateYamlDiff(_0x2cda00,_0x559ea7){if(_0x559ea7){const _0x51ff76=generateDiff(_0x559ea7,_0x2cda00),_0x332745=hasChanges(_0x51ff76);return{'isNew':![],'hasChanges':_0x332745,'diff':_0x332745?formatDiffWithColors(_0x51ff76):undefined};}const _0x316e7a=generateDiff('',_0x2cda00);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x316e7a)};}export function calculateSegmentDiff(_0x3c3af8,_0x21c47e,_0x57fe51,_0x3cd949,_0x32b728){const _0x10146f=segmentToYamlString(_0x3c3af8),_0x58aacc=_0x21c47e?segmentToYamlString(segmentWithActivationsToYaml(_0x21c47e,_0x57fe51,undefined,_0x3cd949,_0x32b728)):undefined;return calculateYamlDiff(_0x10146f,_0x58aacc);}export function calculateJourneyDiff(_0x3916e3,_0x266558){const _0x3bfe1c=normalizeJourneyDef(_0x3916e3,_0x3916e3),_0x2ba5d5=a152_0x57e6e8(_0x3bfe1c),_0x2e5c42=_0x266558?a152_0x57e6e8(normalizeJourneyDef(_0x266558,_0x3916e3)):undefined;return calculateYamlDiff(_0x2ba5d5,_0x2e5c42);}export function findSegmentsToDelete(_0x2b5690,_0x2f974b,_0x56156c,_0xc6f274,_0x1aa30a){const _0x284b82=a152_0x57cc,_0x2688a0=new Set();for(const {yamlConfig:_0x548b45,folderPath:_0x52db10}of _0x2f974b){_0x2688a0['add'](_0x52db10+':'+_0x548b45[_0x284b82(0x128)]);}return _0x2b5690[_0x284b82(0x203)](_0x1ab374=>{const _0x299187=_0x284b82,_0x57a03d=_0x1ab374[_0x299187(0x19c)]?_0x56156c[_0x299187(0x1bc)](_0x1ab374[_0x299187(0x19c)]['toString']())||'':'',_0x64f6aa=_0x57a03d+':'+_0x1ab374[_0x299187(0x128)];if(_0x2688a0[_0x299187(0x169)](_0x64f6aa))return![];if(_0x1aa30a)return _0x57a03d===_0xc6f274||_0x57a03d[_0x299187(0x192)](_0xc6f274+'/');return!![];});}export function findJourneysToDelete(_0x587df4,_0x4b5d6e,_0x18c252,_0x4f2572,_0x60f707){const _0xef41b9=a152_0x57cc,_0x54d236=new Set();for(const {yamlConfig:_0x3b022d,folderPath:_0x3921f5}of _0x4b5d6e){_0x54d236[_0xef41b9(0x180)](_0x3921f5+':'+_0x3b022d[_0xef41b9(0x128)]);}return _0x587df4[_0xef41b9(0x203)](_0x538d8f=>{const _0x5b5890=_0xef41b9,_0x570a32=_0x538d8f[_0x5b5890(0x18f)]?_0x18c252['get'](_0x538d8f[_0x5b5890(0x18f)])||'':'',_0x1a63c5=_0x570a32+':'+_0x538d8f[_0x5b5890(0x170)];if(_0x54d236[_0x5b5890(0x169)](_0x1a63c5))return![];if(_0x60f707)return _0x570a32===_0x4f2572||_0x570a32['startsWith'](_0x4f2572+'/');return!![];});}export function buildSegmentLookupMap(_0x71cc98,_0x46cdef){const _0xe02542=a152_0x57cc,_0x33352c=new Map();for(const _0xfe0a94 of _0x71cc98){const _0x5c41d3=_0xfe0a94[_0xe02542(0x19c)]?_0x46cdef['get'](_0xfe0a94[_0xe02542(0x19c)][_0xe02542(0x206)]())||'':'',_0x32da7f=_0x5c41d3+':'+_0xfe0a94['name'];_0x33352c['set'](_0x32da7f,_0xfe0a94);}return _0x33352c;}export function buildSegmentNameToIdMap(_0x1dd9a5){const _0x408e87=a152_0x57cc,_0x33852d=new Map();for(const _0x21328b of _0x1dd9a5){_0x33852d[_0x408e87(0x1a0)](_0x21328b[_0x408e87(0x128)],_0x21328b['id']);}return _0x33852d;}export function buildJourneyBundleLookupMap(_0x521958,_0x18217b){const _0x6fe094=a152_0x57cc,_0x373e2d=new Map();for(const _0x5e5c9f of _0x521958){const _0x4f6eb5=_0x5e5c9f['folderId']?_0x18217b[_0x6fe094(0x1bc)](_0x5e5c9f[_0x6fe094(0x18f)])||'':'',_0xaf984e=_0x4f6eb5+':'+_0x5e5c9f[_0x6fe094(0x170)];!_0x373e2d[_0x6fe094(0x169)](_0xaf984e)&&_0x373e2d[_0x6fe094(0x1a0)](_0xaf984e,[]),_0x373e2d['get'](_0xaf984e)[_0x6fe094(0x168)](_0x5e5c9f);}for(const _0x516853 of _0x373e2d[_0x6fe094(0x20c)]()){_0x516853[_0x6fe094(0x13f)]((_0x22d86b,_0x22efc4)=>(_0x22d86b[_0x6fe094(0x219)]||0x0)-(_0x22efc4['versionNumber']||0x0));}return _0x373e2d;}export function collectFoldersToCreate(_0x14665f,_0x25e696){const _0x2709a8=new Set();for(const _0x1b19d6 of _0x14665f){if(!_0x1b19d6)continue;if(_0x25e696['has'](_0x1b19d6))continue;const _0x41bf7b=_0x1b19d6['split']('/');let _0xe20679='';for(const _0x15d181 of _0x41bf7b){_0xe20679=_0xe20679?_0xe20679+'/'+_0x15d181:_0x15d181,!_0x25e696['has'](_0xe20679)&&_0x2709a8['add'](_0xe20679);}}return _0x2709a8;}export function parseAndClassifyYamlFiles(_0x14cdfb,_0x1b3c8b,_0x2e1132){const _0x2677d9=a152_0x57cc,_0x87f108=[],_0x1684df=[];for(const _0x664d64 of _0x14cdfb){const _0x287999=a152_0x54c886['relative'](_0x1b3c8b,a152_0x54c886[_0x2677d9(0x1ae)](_0x664d64)),_0x2c73ce=_0x287999==='.'?'':_0x287999,_0xdcae3f=readFileSync(_0x664d64,_0x2677d9(0x159)),_0x1f5848=a152_0x21a271[_0x2677d9(0x1f9)](_0xdcae3f);if(isJourneyDef(_0x1f5848)){const _0xfc3890=a152_0x1367fb(_0xdcae3f);_0x1684df[_0x2677d9(0x168)]({'yamlConfig':_0xfc3890,'folderPath':_0x2c73ce,'sourcePath':_0x664d64});}else{if(!_0x2e1132?.[_0x2677d9(0x17f)]){const _0x97fe57=parseSegmentYamlFile(_0xdcae3f),_0x1c8908=normalizeChildSegmentYaml(_0x97fe57);_0x87f108['push']({'yamlConfig':_0x1c8908,'folderPath':_0x2c73ce,'sourcePath':_0x664d64});}}}return{'segments':_0x87f108,'journeys':_0x1684df};}export function validateParsedFiles(_0x5dfcff,_0x325a51){const _0x14bb33=a152_0x57cc,_0x55afe8=[];for(const {yamlConfig:_0x39cbfc,sourcePath:_0x30a82d}of _0x5dfcff[_0x14bb33(0x155)]){const _0x101be4=readFileSync(_0x30a82d,_0x14bb33(0x159)),_0x29dd5b=a152_0x21a271[_0x14bb33(0x153)](_0x101be4),_0x479013=validateSegmentDef(_0x39cbfc,{'source':_0x101be4,'document':_0x29dd5b},{'skipSchema':!![]});if(!_0x479013[_0x14bb33(0x1fd)]){const _0x329de5=a152_0x54c886[_0x14bb33(0x156)](_0x325a51,_0x30a82d);_0x55afe8['push']({'filePath':_0x329de5,'source':_0x101be4,'result':_0x479013,'isJourney':![]});}}for(const {yamlConfig:_0x544d23,sourcePath:_0x237c4c}of _0x5dfcff[_0x14bb33(0x1f3)]){const _0xf315bb=readFileSync(_0x237c4c,_0x14bb33(0x159)),_0x38ede0=a152_0x21a271['parseDocument'](_0xf315bb),_0xcfc6fd=validateJourneyDef(_0x544d23,{'source':_0xf315bb,'document':_0x38ede0},{'skipSchema':!![]});if(!_0xcfc6fd[_0x14bb33(0x1fd)]){const _0x3e7df0=a152_0x54c886[_0x14bb33(0x156)](_0x325a51,_0x237c4c);_0x55afe8[_0x14bb33(0x168)]({'filePath':_0x3e7df0,'source':_0xf315bb,'result':_0xcfc6fd,'isJourney':!![]});}}return _0x55afe8;}export function formatValidationErrors(_0x14bbeb){const _0x3721e8=a152_0x57cc,_0x17a647=[];for(const {filePath:_0x6c530b,source:_0x3f4da8,result:_0xf4d13b,isJourney:_0x51bd7b}of _0x14bbeb){const _0x580929=_0x51bd7b?_0x3721e8(0x1a8):'segment';_0x17a647[_0x3721e8(0x168)]('\x0a'+_0x6c530b+'\x20('+_0x580929+'):\x20'+_0xf4d13b[_0x3721e8(0x127)][_0x3721e8(0x1d7)]+_0x3721e8(0x17a)),_0x17a647[_0x3721e8(0x168)](formatValidationResult(_0xf4d13b,_0x3f4da8,_0x6c530b));}return _0x17a647[_0x3721e8(0x136)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x337ea1){const _0x55dcec=a152_0x57cc,_0xf9cc68=new Set(),_0x24ee14=new Map(),_0x4dabda=collectSegmentUsageCounts(_0x337ea1);if(_0x337ea1[_0x55dcec(0x155)])for(const [_0x319ae8,_0x2fbffa]of Object[_0x55dcec(0x1ec)](_0x337ea1[_0x55dcec(0x155)])){_0xf9cc68['add'](_0x319ae8);if(_0x2fbffa['rule']){const _0x107714=yamlRuleToApi(_0x2fbffa['rule']),_0x2234d0=apiRuleToYaml(_0x107714);_0x24ee14['set'](_0x319ae8,_0x2234d0);}}const _0x1e3e3e=new Map();let _0xa35a99=0x0;for(const [_0x36723d,_0x37c5c2]of _0x24ee14){const _0x37e7af=serializeExpandedRule(_0x37c5c2,_0x24ee14),_0x357c08=_0x1e3e3e[_0x55dcec(0x1bc)](_0x37e7af)||[];_0x357c08[_0x55dcec(0x168)]({'name':_0x36723d,'index':_0xa35a99}),_0x1e3e3e[_0x55dcec(0x1a0)](_0x37e7af,_0x357c08),_0xa35a99++;}const _0x5d63dc=new Map();for(const [_0x25c9cb,_0x3ae750]of _0x1e3e3e){const _0x36e28b=_0x3ae750['slice']()[_0x55dcec(0x13f)]((_0x4c4c4b,_0x47b007)=>{const _0x504812=_0x55dcec,_0x11069d=_0x4dabda['get'](_0x4c4c4b[_0x504812(0x128)])||0x0,_0x48e8f0=_0x4dabda[_0x504812(0x1bc)](_0x47b007[_0x504812(0x128)])||0x0;if(_0x11069d!==_0x48e8f0)return _0x48e8f0-_0x11069d;return _0x4c4c4b['index']-_0x47b007[_0x504812(0x146)];})[_0x55dcec(0x1dd)](_0x16a1a3=>_0x16a1a3['name']),_0x101dd9=[];for(const _0xa77e5c of _0x36e28b){const _0x514cf3=_0x4dabda[_0x55dcec(0x1bc)](_0xa77e5c)||0x0,_0x35c9b1=Math[_0x55dcec(0x1cd)](_0x514cf3,0x1);for(let _0x5a1ddd=0x0;_0x5a1ddd<_0x35c9b1;_0x5a1ddd++){_0x101dd9['push'](_0xa77e5c);}}_0x5d63dc[_0x55dcec(0x1a0)](_0x25c9cb,_0x101dd9);}return{'existingLocalSegmentNames':_0xf9cc68,'localSegmentRules':_0x24ee14,'localExpandedRuleToNames':_0x5d63dc};}export function createSegmentIdResolver(_0x1ef830,_0x5d9246){return async _0x1ff042=>{const _0x4d8c3c=a152_0x57cc,_0x42675f=_0x1ef830[_0x4d8c3c(0x1bc)](_0x1ff042);if(!_0x42675f)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x1ff042+_0x4d8c3c(0x1b5)+_0x5d9246+'\x27)');return _0x42675f;};}export function extractRootFolderId(_0x155087){const _0x1d4f4c=a152_0x57cc;return _0x155087[_0x1d4f4c(0x143)]?.[_0x1d4f4c(0x1d4)]?.[_0x1d4f4c(0x144)]?.['id']||_0x155087[_0x1d4f4c(0x143)]?.['parentFolder']?.[_0x1d4f4c(0x144)]?.['id'];}export function buildConnectionMaps(_0x4ff041){const _0x284255=a152_0x57cc,_0x392593=new Map(),_0x52dd4d=new Map(),_0x143809=new Map();for(const _0x4cc3e7 of _0x4ff041){_0x392593[_0x284255(0x1a0)](_0x4cc3e7[_0x284255(0x128)],parseInt(_0x4cc3e7['id'],0xa)),_0x52dd4d['set'](_0x4cc3e7['id'],_0x4cc3e7[_0x284255(0x128)]),_0x143809[_0x284255(0x1a0)](_0x4cc3e7[_0x284255(0x128)],_0x4cc3e7['type']);}return{'nameToId':_0x392593,'idToName':_0x52dd4d,'nameToType':_0x143809};}export function calculatePushStats(_0x1bde59,_0x1c07f8,_0x240970,_0x5b24d4,_0x2f8e66,_0x3eba66,_0x57c447){const _0x3998b0=a152_0x57cc,_0x25ba90=_0x1bde59[_0x3998b0(0x203)](_0x16c2ae=>_0x16c2ae[_0x3998b0(0x13a)]),_0x5d9419=_0x1bde59[_0x3998b0(0x203)](_0x45f1a2=>!_0x45f1a2[_0x3998b0(0x13a)]&&_0x45f1a2[_0x3998b0(0x15b)]),_0x5ccd37=_0x1bde59[_0x3998b0(0x203)](_0x2b2775=>!_0x2b2775['isNew']&&!_0x2b2775[_0x3998b0(0x15b)]),_0x4ff7c8=_0x3eba66?_0x5b24d4:[],_0x2d010b=_0x1c07f8[_0x3998b0(0x203)](_0x593403=>_0x593403[_0x3998b0(0x13a)]),_0x35c333=_0x1c07f8[_0x3998b0(0x203)](_0x151863=>!_0x151863[_0x3998b0(0x13a)]&&_0x151863['hasChanges']),_0x5cf484=_0x1c07f8[_0x3998b0(0x203)](_0x182881=>!_0x182881[_0x3998b0(0x13a)]&&!_0x182881[_0x3998b0(0x15b)]),_0x82c61d=_0x3eba66?_0x2f8e66:[],_0x5c744d=_0x1bde59[_0x3998b0(0x1dc)](_0x548525=>_0x548525[_0x3998b0(0x21c)]),_0x4b2e0a=_0x5c744d[_0x3998b0(0x203)](_0x36d3e6=>_0x36d3e6[_0x3998b0(0x19e)]==='create'),_0x3b97ae=_0x5c744d[_0x3998b0(0x203)](_0x4c319b=>_0x4c319b[_0x3998b0(0x19e)]===_0x3998b0(0x1fe)),_0x2bcf45=_0x5c744d[_0x3998b0(0x203)](_0x2477b0=>_0x2477b0[_0x3998b0(0x19e)]===_0x3998b0(0x141)),_0x604368=Array[_0x3998b0(0x12b)](_0x240970)[_0x3998b0(0x13f)](),_0x3db326=_0x57c447?![]:_0x25ba90[_0x3998b0(0x1d7)]>0x0||_0x5d9419[_0x3998b0(0x1d7)]>0x0||_0x4ff7c8[_0x3998b0(0x1d7)]>0x0,_0x6015ce=_0x2d010b[_0x3998b0(0x1d7)]>0x0||_0x35c333[_0x3998b0(0x1d7)]>0x0||_0x82c61d[_0x3998b0(0x1d7)]>0x0,_0x24d863=_0x57c447?![]:_0x5c744d[_0x3998b0(0x1d7)]>0x0,_0x2ef30f=_0x604368[_0x3998b0(0x1d7)]>0x0;return{'segments':{'new':_0x25ba90,'changed':_0x5d9419,'unchanged':_0x5ccd37,'toDelete':_0x4ff7c8},'journeys':{'new':_0x2d010b,'changed':_0x35c333,'unchanged':_0x5cf484,'toDelete':_0x82c61d},'activations':{'all':_0x5c744d,'toCreate':_0x4b2e0a,'toUpdate':_0x3b97ae,'toDelete':_0x2bcf45},'folders':{'toCreate':_0x604368},'counts':{'segments':{'new':_0x25ba90[_0x3998b0(0x1d7)],'changed':_0x5d9419[_0x3998b0(0x1d7)],'unchanged':_0x5ccd37[_0x3998b0(0x1d7)],'toDelete':_0x4ff7c8['length']},'journeys':{'new':_0x2d010b[_0x3998b0(0x1d7)],'changed':_0x35c333[_0x3998b0(0x1d7)],'unchanged':_0x5cf484[_0x3998b0(0x1d7)],'toDelete':_0x82c61d['length']},'activations':{'create':_0x4b2e0a['length'],'update':_0x3b97ae[_0x3998b0(0x1d7)],'delete':_0x2bcf45[_0x3998b0(0x1d7)]},'folders':_0x604368[_0x3998b0(0x1d7)]},'hasChanges':_0x3db326||_0x6015ce||_0x24d863||_0x2ef30f};}export async function buildPushExecutionContext(_0x304b25,_0xe48373,_0x20174c,_0x3beefa,_0x5026ef,_0x4cf9d0){const _0x18a396=a152_0x57cc,_0x3c5dff=extractRootFolderId(_0x20174c),{pathToId:_0x3449e7,idToPath:_0x4092db}=buildFolderMaps(_0x5026ef),_0x1e4052=buildSegmentNameToIdMap(_0x3beefa),_0x5ccfbc=new Map(),{batchAsync:_0x31dcc5}=await import('../../utils/async.js'),[_0xe4f79a,_0x178332]=await Promise[_0x18a396(0x12c)]([_0x304b25['user'][_0x18a396(0x125)](),_0x304b25[_0x18a396(0x13e)][_0x18a396(0x1ee)](),((async()=>{const _0xee5238=_0x18a396;!_0x4cf9d0&&_0x3beefa[_0xee5238(0x1d7)]>0x0&&await _0x31dcc5(_0x3beefa,async _0x41f8da=>{const _0x166298=_0xee5238,_0x1feb47=await _0x304b25[_0x166298(0x1ef)][_0x166298(0x215)](_0xe48373,_0x41f8da['id']);_0x5ccfbc[_0x166298(0x1a0)](_0x41f8da['id'],_0x1feb47);});})())]),{emailToId:_0x1563ee,idToEmail:_0x2ef46b}=_0xe4f79a,_0x5b36f5=buildConnectionMaps(_0x178332);return{'rootFolderId':_0x3c5dff,'folderPathToId':_0x3449e7,'folderIdToPath':_0x4092db,'segmentNameToId':_0x1e4052,'activationsBySegmentId':_0x5ccfbc,'emailToIdMap':_0x1563ee,'idToEmailMap':_0x2ef46b,'connectionNameToIdMap':_0x5b36f5['nameToId'],'connectionIdToNameMap':_0x5b36f5['idToName'],'connectionNameToTypeMap':_0x5b36f5[_0x18a396(0x131)]};}export function createPushYamlContextForBundle(_0xf8770a,_0x442b7b,_0x598d7c,_0xad6487,_0x471d6d,_0x70d829,_0x56efef,_0x7eb8e9){const {existingLocalSegmentNames:_0x316d60,localExpandedRuleToNames:_0x18c3be}=_0xad6487,_0x3de5f3=new Set(),_0x45d3fb=new Map(),_0x4a8ccb=new Map(),_0x3c833a=new Map(),_0x1e81c9=createJumpTargetCache(),_0xaba3bc=new Map(),_0x2c516e=new Map(),_0x1f3b4f=new Set();let _0x4b06c8;const _0x40636b=_0x273531=>{const _0x2c2fae={'resolveSegment':async _0x20ee0f=>{const _0xa93937=a152_0x57cc,_0xc136db=_0x3c833a[_0xa93937(0x1bc)](_0x20ee0f);if(_0xc136db!==undefined)return{'name':_0xc136db,'isJourneyLocal':!![]};try{const _0x46e20d=await fetchSegment(_0xf8770a,_0x442b7b,_0x20ee0f,_0x598d7c);if(!_0x46e20d)throw new Error(_0xa93937(0x172));const _0x3cf4ff=generateJourneyLocalName(_0x46e20d['name']),_0x264735=_0x46e20d[_0xa93937(0x18e)]===SEGMENT_KIND_JOURNEY&&_0x3cf4ff!==undefined;let _0x526414=_0x46e20d[_0xa93937(0x128)],_0xc87e7c;if(_0x264735&&_0x46e20d[_0xa93937(0x154)]){const _0x45fdbf=apiRuleToYaml(_0x46e20d[_0xa93937(0x154)]);_0x2c516e[_0xa93937(0x1a0)](_0x20ee0f,_0x45fdbf);const _0x28d734=async _0x1e5130=>{const _0x4fc5b6=_0xa93937,_0x572f09=collectSegmentRefsFromRule(_0x1e5130);for(const _0x327ebe of _0x572f09){if(!_0x2c516e[_0x4fc5b6(0x169)](_0x327ebe))try{const _0x5e40cd=await fetchSegment(_0xf8770a,_0x442b7b,_0x327ebe,_0x598d7c);if(_0x5e40cd?.[_0x4fc5b6(0x154)]){const _0x15ff83=apiRuleToYaml(_0x5e40cd[_0x4fc5b6(0x154)]);_0x2c516e[_0x4fc5b6(0x1a0)](_0x327ebe,_0x15ff83),await _0x28d734(_0x15ff83);}}catch(_0x44d0e5){logger[_0x4fc5b6(0x1d2)](_0x4fc5b6(0x1b7)+_0x327ebe+':\x20'+_0x44d0e5);}}};await _0x28d734(_0x45fdbf);const _0x1b6217=serializeExpandedRule(_0x45fdbf,_0x2c516e),_0x174a44=_0x18c3be[_0xa93937(0x1bc)](_0x1b6217);if(_0x174a44&&_0x174a44[_0xa93937(0x1d7)]>0x0){const _0xfd9b3=_0x45d3fb['get'](_0x1b6217)||0x0,_0x266497=_0x174a44[_0xfd9b3]||_0x174a44[_0x174a44[_0xa93937(0x1d7)]-0x1];_0x45d3fb[_0xa93937(0x1a0)](_0x1b6217,_0xfd9b3+0x1),_0x526414=_0x266497,_0x3de5f3['add'](_0x526414),_0x3c833a[_0xa93937(0x1a0)](_0x20ee0f,_0x526414);const _0x56a87c=await resolveRuleSegmentRefs(_0x45fdbf,async _0x3c2e6d=>{const _0x17e928=_0xa93937,_0x3c9d17=_0x3c833a[_0x17e928(0x1bc)](_0x3c2e6d);if(_0x3c9d17)return _0x3c9d17;const _0x21292e=await _0x4b06c8[_0x17e928(0x15c)](_0x3c2e6d);return _0x21292e[_0x17e928(0x128)];});_0xc87e7c={'description':_0x46e20d['description'],'rule':_0x56a87c};}else{const _0x41f2f0=_0xaba3bc[_0xa93937(0x1bc)](_0x1b6217);if(_0x41f2f0)_0x526414=_0x41f2f0,_0x3c833a['set'](_0x20ee0f,_0x526414);else{if(_0x3cf4ff){let _0x5aedde=_0x3cf4ff,_0x2d1bfb=0x2;while(_0x3de5f3[_0xa93937(0x169)](_0x5aedde)||_0x316d60[_0xa93937(0x169)](_0x5aedde)){_0x5aedde=_0x3cf4ff+'_'+_0x2d1bfb,_0x2d1bfb++;}_0x3de5f3['add'](_0x5aedde),_0x526414=_0x5aedde;}_0x3c833a[_0xa93937(0x1a0)](_0x20ee0f,_0x526414),_0xaba3bc[_0xa93937(0x1a0)](_0x1b6217,_0x526414);const _0x13a44d=await resolveRuleSegmentRefs(_0x45fdbf,async _0x2f05b8=>{const _0x14c82b=_0xa93937,_0x278bc7=_0x3c833a[_0x14c82b(0x1bc)](_0x2f05b8);if(_0x278bc7)return _0x278bc7;const _0x36fa24=await _0x4b06c8[_0x14c82b(0x15c)](_0x2f05b8);return _0x36fa24[_0x14c82b(0x128)];});_0xc87e7c={'description':_0x46e20d[_0xa93937(0x151)],'rule':_0x13a44d};}}}return{'name':_0x526414,'isJourneyLocal':_0x264735,'definition':_0xc87e7c};}catch(_0x35fbda){return logger['debug'](_0xa93937(0x1d3)+_0x20ee0f+':\x20'+_0x35fbda),{'name':_0x20ee0f,'isJourneyLocal':![]};}},'resolveActivation':async _0x57091b=>{const _0x35472a=a152_0x57cc,_0x14ba30=_0x4a8ccb['get'](_0x57091b);if(_0x14ba30!==undefined)return{'name':_0x14ba30,'isJourneyLocal':!![]};try{let _0x4b9f74=_0x56efef?.[_0x35472a(0x1bc)](_0x57091b);!_0x4b9f74&&(_0x4b9f74=await _0xf8770a['journey']['getActivation'](_0x273531,_0x57091b));const _0x12b48b=_0x4b9f74[_0x35472a(0x16e)]['activationParams'][_0x35472a(0x128)]||_0x57091b,_0x384dac=sanitizeYamlKey(_0x12b48b)||_0x35472a(0x174)+_0x57091b,_0xa775e2=_0x384dac;_0x4a8ccb[_0x35472a(0x1a0)](_0x57091b,_0xa775e2);const _0x27f1d0=journeyActivationStepToYaml(_0x4b9f74,_0x471d6d,_0x70d829);return{'name':_0xa775e2,'isJourneyLocal':!![],'definition':_0x27f1d0};}catch(_0x2ba1cb){return logger['debug'](_0x35472a(0x1a2)+_0x57091b+':\x20'+_0x2ba1cb),{'name':_0x57091b,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x549d18,_0x5557d1)=>resolveJumpTarget(_0x549d18,_0x5557d1,_0x1e81c9,async _0x49ddfb=>{const _0x544084=a152_0x57cc,_0x154e05=_0x7eb8e9?.['get'](_0x49ddfb);if(_0x154e05)return _0x154e05;return _0xf8770a[_0x544084(0x1a8)][_0x544084(0x217)](_0x49ddfb);})};return _0x4b06c8=_0x2c2fae,_0x2c2fae;},_0x2b13de=async _0x100736=>{const _0x36fee3=a152_0x57cc,{collectSegmentIdsFromJourneyApi:_0x583bc5}=await import('./journey-yaml.js'),{batchAsync:_0x44874f}=await import(_0x36fee3(0x16d)),_0x4fbb32=new Set();for(const _0x2704f3 of _0x100736){let _0x40de24=_0x7eb8e9?.[_0x36fee3(0x1bc)](_0x2704f3);!_0x40de24&&(_0x40de24=await _0xf8770a['journey']['getJourney'](_0x2704f3));const _0x11edf2=_0x583bc5(_0x40de24);for(const _0x3fbb3f of _0x11edf2){_0x4fbb32[_0x36fee3(0x180)](_0x3fbb3f);}}let _0x17b2de=Array[_0x36fee3(0x12b)](_0x4fbb32);while(_0x17b2de[_0x36fee3(0x1d7)]>0x0){const _0x2b07ef=_0x17b2de['filter'](_0x2b4bfc=>!_0x1f3b4f[_0x36fee3(0x169)](_0x2b4bfc));if(_0x2b07ef[_0x36fee3(0x1d7)]===0x0)break;const _0x2ffe59=await _0x44874f(_0x2b07ef,async _0x211263=>{_0x1f3b4f['add'](_0x211263);const _0x8a5fa6=await fetchSegment(_0xf8770a,_0x442b7b,_0x211263,_0x598d7c);if(!_0x8a5fa6)return null;return{'segmentId':_0x211263,'segment':_0x8a5fa6};},0xa),_0x428083=new Set();for(const _0x14ac94 of _0x2ffe59){if(!_0x14ac94?.['segment']?.['rule'])continue;const _0x42cade=apiRuleToYaml(_0x14ac94[_0x36fee3(0x1ef)][_0x36fee3(0x154)]);_0x2c516e[_0x36fee3(0x1a0)](_0x14ac94['segmentId'],_0x42cade);const _0x2a850f=collectSegmentRefsFromRule(_0x42cade);for(const _0x4a3c63 of _0x2a850f){!_0x1f3b4f[_0x36fee3(0x169)](_0x4a3c63)&&_0x428083[_0x36fee3(0x180)](_0x4a3c63);}}_0x17b2de=Array[_0x36fee3(0x12b)](_0x428083);}};return{'createYamlContext':_0x40636b,'prefetchJourneySegments':_0x2b13de};}export async function executePushSegments(_0x341d6b,_0x591fec,_0x40d161,_0x3bd71a,_0x2b5aa){const _0x4875ad=a152_0x57cc,{segmentDefToCreateRequest:_0x348cb6,segmentDefToUpdateRequest:_0x504b28}=await import(_0x4875ad(0x13d)),_0x2c6dd8=_0x40d161[_0x4875ad(0x204)],_0x7425cf=0x5,_0x16150d=async _0x431258=>{const _0x539304=_0x4875ad,_0x55acbc=_0x431258[_0x539304(0x1bd)]?_0x2c6dd8[_0x539304(0x1bc)](_0x431258[_0x539304(0x1bd)]):undefined;let _0x4f9043;const _0x4e115f={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x59865f=_0x431258[_0x539304(0x20f)];if(_0x431258[_0x539304(0x20f)][_0x539304(0x154)]){const _0x42fbec=createSegmentIdResolver(_0x40d161['segmentNameToId'],_0x431258['yamlConfig'][_0x539304(0x128)]),_0x54509b=await resolveRuleSegmentIds(_0x431258[_0x539304(0x20f)]['rule'],_0x42fbec);_0x59865f={..._0x431258[_0x539304(0x20f)],'rule':_0x54509b};}try{if(_0x431258[_0x539304(0x13a)]){_0x2b5aa[_0x539304(0x1cc)]?.({'type':_0x539304(0x16b),'name':_0x431258[_0x539304(0x20f)]['name']});const _0x315516=_0x348cb6(_0x59865f,_0x55acbc),_0x761002=await _0x2b5aa[_0x539304(0x176)](_0x539304(0x1a6)+_0x431258[_0x539304(0x20f)][_0x539304(0x128)]+'\x27...',()=>_0x341d6b['segment'][_0x539304(0x142)](_0x3bd71a[_0x539304(0x1b2)],_0x315516));_0x4f9043=_0x761002['data']['id'],_0x40d161['segmentNameToId'][_0x539304(0x1a0)](_0x431258[_0x539304(0x20f)][_0x539304(0x128)],_0x4f9043),_0x4e115f['createdSegmentId']={'name':_0x431258['yamlConfig'][_0x539304(0x128)],'id':_0x4f9043},_0x2b5aa[_0x539304(0x1cc)]?.({'type':_0x539304(0x21a),'name':_0x431258['yamlConfig'][_0x539304(0x128)],'segmentId':_0x4f9043}),_0x2b5aa[_0x539304(0x190)]?.(_0x539304(0x1e9)+_0x431258[_0x539304(0x20f)]['name']+'\x27'),_0x4e115f[_0x539304(0x1f1)]=0x1;}else{if(_0x431258[_0x539304(0x15b)]){_0x2b5aa[_0x539304(0x1cc)]?.({'type':'segment_updating','name':_0x431258['yamlConfig'][_0x539304(0x128)]});const _0x5f3830=_0x504b28(_0x59865f);_0x55acbc!==_0x431258[_0x539304(0x216)]?.[_0x539304(0x19c)]&&(_0x5f3830[_0x539304(0x19c)]=_0x55acbc?parseInt(_0x55acbc,0xa):undefined),await _0x2b5aa['withProgress'](_0x539304(0x15d)+_0x431258[_0x539304(0x20f)]['name']+'\x27...',()=>_0x341d6b['segment'][_0x539304(0x1f5)](_0x3bd71a['parentId'],_0x431258[_0x539304(0x216)]['id'],_0x5f3830)),_0x4f9043=_0x431258[_0x539304(0x216)]['id'],_0x2b5aa[_0x539304(0x1cc)]?.({'type':_0x539304(0x1cf),'name':_0x431258[_0x539304(0x20f)]['name']}),_0x2b5aa[_0x539304(0x190)]?.(_0x539304(0x138)+_0x431258['yamlConfig'][_0x539304(0x128)]+'\x27'),_0x4e115f[_0x539304(0x123)]=0x1;}else _0x4f9043=_0x431258['existingSegment']['id'];}}catch(_0x2e0744){const _0x3c3503=isHttp400Error(_0x2e0744),_0x28f3a6=_0x3c3503?ErrorCode[_0x539304(0x221)]:ErrorCode[_0x539304(0x181)],_0xf2b4a2=getErrorMessage(_0x2e0744);throw new SDKError(_0x28f3a6,_0x539304(0x19a)+(_0x431258['isNew']?_0x539304(0x1c0):_0x539304(0x1fe))+_0x539304(0x129)+_0x431258['absolutePath']+'\x0a\x20\x20'+_0xf2b4a2,_0x2e0744);}try{const _0x2ad0c7=await syncActivationsForSegment(_0x341d6b,_0x3bd71a[_0x539304(0x1b2)],_0x4f9043,_0x431258[_0x539304(0x20f)]['name'],_0x431258[_0x539304(0x21c)],_0x2b5aa,_0x431258['absolutePath']);_0x4e115f[_0x539304(0x222)]=_0x2ad0c7;}catch(_0x4d89f0){if(_0x4d89f0 instanceof SDKError)throw _0x4d89f0;throw new SDKError(ErrorCode[_0x539304(0x171)],_0x539304(0x1b4)+_0x431258[_0x539304(0x20f)][_0x539304(0x128)]+_0x539304(0x212)+_0x431258[_0x539304(0x1f2)]+_0x539304(0x183)+getErrorMessage(_0x4d89f0),_0x4d89f0);}return _0x4e115f;},_0x4de721=await batchAsync(_0x591fec,_0x16150d,_0x7425cf),_0x38ff0b={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x1371f6 of _0x4de721){_0x38ff0b[_0x4875ad(0x1f1)]+=_0x1371f6['created'],_0x38ff0b[_0x4875ad(0x123)]+=_0x1371f6[_0x4875ad(0x123)],_0x1371f6[_0x4875ad(0x1f4)]&&_0x38ff0b[_0x4875ad(0x162)][_0x4875ad(0x1a0)](_0x1371f6[_0x4875ad(0x1f4)]['name'],_0x1371f6['createdSegmentId']['id']),_0x38ff0b[_0x4875ad(0x222)][_0x4875ad(0x1f1)]+=_0x1371f6['activations'][_0x4875ad(0x1f1)],_0x38ff0b[_0x4875ad(0x222)]['updated']+=_0x1371f6[_0x4875ad(0x222)]['updated'],_0x38ff0b[_0x4875ad(0x222)][_0x4875ad(0x205)]+=_0x1371f6[_0x4875ad(0x222)]['deleted'];}return _0x38ff0b;}async function syncActivationsForSegment(_0xac4a07,_0x59156f,_0x4759dc,_0x42769b,_0x335b97,_0x56d9d4,_0x1410c7){const _0x29b1ac=a152_0x57cc,_0x13ee5c={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xace67c of _0x335b97){try{if(_0xace67c[_0x29b1ac(0x19e)]===_0x29b1ac(0x1c0)&&_0xace67c['validatedRequest'])_0x56d9d4[_0x29b1ac(0x1cc)]?.({'type':_0x29b1ac(0x1ab),'segmentName':_0x42769b,'activationName':_0xace67c[_0x29b1ac(0x128)]}),await _0x56d9d4[_0x29b1ac(0x176)](_0x29b1ac(0x1ea)+_0xace67c['name']+_0x29b1ac(0x18d),()=>_0xac4a07[_0x29b1ac(0x1ef)][_0x29b1ac(0x12e)](_0x59156f,_0x4759dc,_0xace67c['validatedRequest'])),_0x56d9d4[_0x29b1ac(0x1cc)]?.({'type':_0x29b1ac(0x1a1),'segmentName':_0x42769b,'activationName':_0xace67c['name']}),_0x56d9d4[_0x29b1ac(0x190)]?.('Created\x20activation\x20\x27'+_0xace67c[_0x29b1ac(0x128)]+'\x27'),_0x13ee5c[_0x29b1ac(0x1f1)]++;else{if(_0xace67c[_0x29b1ac(0x19e)]===_0x29b1ac(0x1fe)&&_0xace67c['validatedRequest']&&_0xace67c[_0x29b1ac(0x184)])_0x56d9d4['onProgress']?.({'type':_0x29b1ac(0x1c4),'segmentName':_0x42769b,'activationName':_0xace67c['name']}),await _0x56d9d4[_0x29b1ac(0x176)](_0x29b1ac(0x1ba)+_0xace67c['name']+_0x29b1ac(0x18d),()=>_0xac4a07[_0x29b1ac(0x1ef)][_0x29b1ac(0x220)](_0x59156f,_0x4759dc,_0xace67c[_0x29b1ac(0x184)]['id'],_0xace67c[_0x29b1ac(0x13c)])),_0x56d9d4[_0x29b1ac(0x1cc)]?.({'type':_0x29b1ac(0x12a),'segmentName':_0x42769b,'activationName':_0xace67c[_0x29b1ac(0x128)]}),_0x56d9d4[_0x29b1ac(0x190)]?.(_0x29b1ac(0x14e)+_0xace67c[_0x29b1ac(0x128)]+'\x27'),_0x13ee5c[_0x29b1ac(0x123)]++;else _0xace67c[_0x29b1ac(0x19e)]===_0x29b1ac(0x141)&&_0xace67c[_0x29b1ac(0x184)]&&(_0x56d9d4['onProgress']?.({'type':'activation_deleting','segmentName':_0x42769b,'activationName':_0xace67c[_0x29b1ac(0x128)]}),await _0x56d9d4[_0x29b1ac(0x176)](_0x29b1ac(0x224)+_0xace67c[_0x29b1ac(0x128)]+_0x29b1ac(0x18d),()=>_0xac4a07['segment']['deleteActivation'](_0x59156f,_0x4759dc,_0xace67c['existingActivation']['id'])),_0x56d9d4[_0x29b1ac(0x1cc)]?.({'type':_0x29b1ac(0x1cb),'segmentName':_0x42769b,'activationName':_0xace67c[_0x29b1ac(0x128)]}),_0x56d9d4[_0x29b1ac(0x208)]?.('Deleted\x20activation\x20\x27'+_0xace67c[_0x29b1ac(0x128)]+'\x27'),_0x13ee5c[_0x29b1ac(0x205)]++);}}catch(_0x1f8e0d){const _0x142df0=isHttp400Error(_0x1f8e0d),_0x415289=_0x142df0?ErrorCode[_0x29b1ac(0x1f8)]:ErrorCode[_0x29b1ac(0x171)],_0x44c144=getErrorMessage(_0x1f8e0d);throw new SDKError(_0x415289,_0x29b1ac(0x19a)+_0xace67c[_0x29b1ac(0x19e)]+'\x20activation\x20\x27'+_0xace67c[_0x29b1ac(0x128)]+_0x29b1ac(0x212)+_0x1410c7+_0x29b1ac(0x183)+_0x44c144,_0x1f8e0d);}}return _0x13ee5c;}export async function executePushFolders(_0x2df1fd,_0x50bdb9,_0xf5d02,_0x177e9b,_0x205384){const _0x20dfe0=a152_0x57cc,_0x35d212=new Map(_0xf5d02),_0x2a5e84=sortFoldersByDepth(_0x50bdb9);for(const _0x13ed1c of _0x2a5e84){const _0x36265a=_0x13ed1c[_0x20dfe0(0x21d)]('/'),_0x5f2a28=_0x36265a[_0x36265a['length']-0x1],_0x36a966=_0x36265a[_0x20dfe0(0x149)](0x0,-0x1)[_0x20dfe0(0x136)]('/'),_0x37f671=_0x35d212[_0x20dfe0(0x1bc)](_0x36a966);_0x205384[_0x20dfe0(0x1cc)]?.({'type':_0x20dfe0(0x137),'folder':_0x13ed1c});const _0x4db192={'name':_0x5f2a28,'parentFolderId':_0x37f671},_0x258fa3=await _0x205384[_0x20dfe0(0x176)](_0x20dfe0(0x1db)+_0x13ed1c+_0x20dfe0(0x18d),()=>_0x2df1fd[_0x20dfe0(0x1ef)][_0x20dfe0(0x209)](_0x177e9b[_0x20dfe0(0x1b2)],_0x4db192));_0x35d212['set'](_0x13ed1c,_0x258fa3['data']['id']),_0x205384[_0x20dfe0(0x1cc)]?.({'type':'folder_created','folder':_0x13ed1c,'folderId':_0x258fa3[_0x20dfe0(0x144)]['id']}),_0x205384['logInfo']?.(_0x20dfe0(0x1ce)+_0x13ed1c+'\x27');}return _0x35d212;}export async function executePushSegmentDeletions(_0xab26f6,_0x2610ed,_0x5d921c){const _0x200813=a152_0x57cc;if(_0x2610ed['length']===0x0)return 0x0;const {batchAsync:_0x4f9cab}=await import('../../utils/async.js'),_0x1c3302=0x5,_0xe6b757=await _0x4f9cab(_0x2610ed,async _0x127cae=>{const _0xd648a=a152_0x57cc;return _0x5d921c[_0xd648a(0x1cc)]?.({'type':_0xd648a(0x157),'name':_0x127cae['name']}),await _0xab26f6[_0xd648a(0x1ef)][_0xd648a(0x1a5)](_0x127cae['id']),_0x5d921c[_0xd648a(0x1cc)]?.({'type':_0xd648a(0x1d0),'name':_0x127cae[_0xd648a(0x128)]}),_0x5d921c[_0xd648a(0x208)]?.(_0xd648a(0x18a)+_0x127cae['name']+'\x27'),0x1;},_0x1c3302);return _0xe6b757[_0x200813(0x133)]((_0x4e1af4,_0x546f8c)=>_0x4e1af4+_0x546f8c,0x0);}export async function executePushJourneys(_0x162905,_0x5b5f04,_0x5bb89a,_0x320da8,_0x303c40){const _0x5d2eff=a152_0x57cc,{journeyDefToRequest:_0x28bc06}=await import(_0x5d2eff(0x14a)),{activationDefToCreateRequest:_0x223f2d,yamlRuleToApi:_0x11ba87,validateSegmentRule:_0xce459b}=await import(_0x5d2eff(0x13d)),_0x2b0b7d={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x27cb2b=new Map(_0x5bb89a['segmentNameToId']),_0xa0b377=0x5;for(let _0x6a50ba=0x0;_0x6a50ba<_0x5b5f04['length'];_0x6a50ba+=_0xa0b377){const _0x52024c=_0x5b5f04[_0x5d2eff(0x149)](_0x6a50ba,_0x6a50ba+_0xa0b377),_0x203c30=await Promise[_0x5d2eff(0x12c)](_0x52024c['map'](async _0x353bd5=>{const _0x53a77e=_0x5d2eff;if(!_0x353bd5[_0x53a77e(0x13a)]&&!_0x353bd5[_0x53a77e(0x15b)])return{'action':_0x53a77e(0x178),'name':_0x353bd5[_0x53a77e(0x20f)]['name'],'journeyId':_0x353bd5[_0x53a77e(0x1c3)]?.['id']};const _0x4b3f2b=_0x353bd5['folderPath']?_0x5bb89a[_0x53a77e(0x204)][_0x53a77e(0x1bc)](_0x353bd5[_0x53a77e(0x1bd)]):undefined;_0x303c40[_0x53a77e(0x1cc)]?.({'type':_0x353bd5[_0x53a77e(0x13a)]?_0x53a77e(0x1ff):_0x53a77e(0x179),'name':_0x353bd5['yamlConfig'][_0x53a77e(0x128)]});try{const _0x576991=await executeSingleJourneyPush(_0x162905,_0x353bd5,{..._0x5bb89a,'segmentNameToId':_0x27cb2b},{'parentId':_0x320da8['parentId'],'rootFolderId':_0x320da8[_0x53a77e(0x16f)],'folderId':_0x4b3f2b,'verbose':_0x320da8[_0x53a77e(0x18b)]},_0x303c40,{'journeyDefToRequest':_0x28bc06,'activationDefToCreateRequest':_0x223f2d,'yamlRuleToApi':_0x11ba87,'validateSegmentRule':_0xce459b});for(const [_0x2d2986,_0x56d2ae]of _0x576991[_0x53a77e(0x124)]){_0x27cb2b[_0x53a77e(0x1a0)](_0x2d2986,_0x56d2ae),_0x2b0b7d[_0x53a77e(0x124)][_0x53a77e(0x1a0)](_0x2d2986,_0x56d2ae);}if(_0x576991[_0x53a77e(0x15a)]===_0x53a77e(0x1f1))_0x303c40[_0x53a77e(0x1cc)]?.({'type':_0x53a77e(0x15f),'name':_0x353bd5[_0x53a77e(0x20f)]['name'],'journeyId':_0x576991[_0x53a77e(0x14c)]}),_0x303c40[_0x53a77e(0x190)]?.(_0x53a77e(0x21e)+_0x353bd5[_0x53a77e(0x20f)]['name']+'\x27'),_0x2b0b7d[_0x53a77e(0x1f1)]++;else _0x576991[_0x53a77e(0x15a)]===_0x53a77e(0x123)&&(_0x303c40['onProgress']?.({'type':_0x53a77e(0x1f0),'name':_0x353bd5['yamlConfig'][_0x53a77e(0x128)]}),_0x303c40[_0x53a77e(0x190)]?.(_0x53a77e(0x202)+_0x353bd5[_0x53a77e(0x20f)][_0x53a77e(0x128)]+'\x27'),_0x2b0b7d[_0x53a77e(0x123)]++);return{'action':_0x576991[_0x53a77e(0x15a)],'name':_0x353bd5['yamlConfig'][_0x53a77e(0x128)],'journeyId':_0x576991[_0x53a77e(0x14c)]};}catch(_0x3f59ab){const _0x3adf88=isHttp400Error(_0x3f59ab),_0xa018e3=_0x3adf88?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x5c7f7e=getErrorMessage(_0x3f59ab);throw new SDKError(_0xa018e3,_0x53a77e(0x19a)+(_0x353bd5[_0x53a77e(0x13a)]?_0x53a77e(0x1c0):'update')+_0x53a77e(0x1ca)+_0x353bd5[_0x53a77e(0x1f2)]+'\x0a\x20\x20'+_0x5c7f7e,_0x3f59ab);}}));_0x2b0b7d[_0x5d2eff(0x1e2)]['push'](..._0x203c30);}return _0x2b0b7d;}async function matchExistingJourneySegments(_0x21db75,_0x71711d,_0x4e7ace,_0x231a08,_0x1a605f){const _0x2a68a5=a152_0x57cc;if(!_0x71711d[_0x2a68a5(0x1c3)]||!_0x71711d[_0x2a68a5(0x20f)][_0x2a68a5(0x155)])return;const _0x6b502c=new Map(),_0x23baeb=new Set();for(const _0x45c0da of Object[_0x2a68a5(0x14f)](_0x71711d[_0x2a68a5(0x20f)][_0x2a68a5(0x155)])){const _0x2b9ec3=generateDeterministicJourneySegmentName(_0x71711d[_0x2a68a5(0x20f)][_0x2a68a5(0x128)],_0x45c0da);_0x6b502c[_0x2a68a5(0x1a0)](_0x2b9ec3,_0x45c0da),_0x23baeb[_0x2a68a5(0x180)](_0x45c0da);}const _0x5b2bcc=[],_0x5457b1=collectSegmentIdsFromJourneyApi(_0x71711d[_0x2a68a5(0x1c3)]);for(const _0x276ebc of _0x5457b1){const _0x5f4d67=await fetchSegment(_0x21db75,_0x4e7ace,_0x276ebc,_0x231a08);if(!_0x5f4d67?.[_0x2a68a5(0x128)])continue;const _0x5e4aae=_0x6b502c['get'](_0x5f4d67[_0x2a68a5(0x128)]);_0x5e4aae?(_0x1a605f[_0x2a68a5(0x1a0)](_0x5e4aae,_0x276ebc),_0x23baeb['delete'](_0x5e4aae)):_0x5b2bcc[_0x2a68a5(0x168)]({'id':_0x276ebc,'seg':_0x5f4d67});}if(_0x23baeb[_0x2a68a5(0x1e3)]>0x0&&_0x5b2bcc[_0x2a68a5(0x1d7)]>0x0){const {localExpandedRuleToNames:_0x558eec}=buildLocalExpandedRuleMappings(_0x71711d[_0x2a68a5(0x20f)]),_0x51cef0=new Map();for(const {id:_0x5bf534,seg:_0x1f7926}of _0x5b2bcc){if(_0x1f7926[_0x2a68a5(0x154)]){const _0x6740f0=apiRuleToYaml(_0x1f7926['rule']);_0x51cef0[_0x2a68a5(0x1a0)](_0x5bf534,_0x6740f0);}}for(const {id:_0x5171dd,seg:_0x3214af}of _0x5b2bcc){if(!_0x3214af[_0x2a68a5(0x154)])continue;const _0x39ca7b=_0x51cef0[_0x2a68a5(0x1bc)](_0x5171dd);if(!_0x39ca7b)continue;const _0x3880c4=serializeExpandedRule(_0x39ca7b,_0x51cef0),_0x2460ac=_0x558eec[_0x2a68a5(0x1bc)](_0x3880c4);if(_0x2460ac){const _0x3344a0=_0x2460ac[_0x2a68a5(0x1e6)](_0xd9ab33=>_0x23baeb[_0x2a68a5(0x169)](_0xd9ab33));_0x3344a0&&(_0x1a605f[_0x2a68a5(0x1a0)](_0x3344a0,_0x5171dd),_0x23baeb['delete'](_0x3344a0),logger[_0x2a68a5(0x1d2)](_0x2a68a5(0x173)+_0x3214af[_0x2a68a5(0x128)]+_0x2a68a5(0x18c)+_0x3344a0+_0x2a68a5(0x12d)));}}}}async function executeSingleJourneyPush(_0x111c63,_0x2cda2d,_0x2efbd0,_0x1bbd6d,_0x251bce,_0x373145){const _0x1913d9=a152_0x57cc,{journeyDefToRequest:_0x117e94,activationDefToCreateRequest:_0x22585a,yamlRuleToApi:_0x15ae98,validateSegmentRule:_0x34af5d}=_0x373145,_0x401bfa=new Map(),_0x318c17=new Map();recoverSegmentIdsFromPushRecovery(_0x2cda2d,_0x401bfa,_0x2efbd0[_0x1913d9(0x197)]);const _0x2bb11c=new Map(),_0x5e64fd=new Map(),_0x39c00b=new Map();let _0x27c421;const _0x5192b5=async()=>{const _0x53dcd9=_0x1913d9;if(_0x27c421)return;_0x27c421=new Map();if(!_0x2cda2d[_0x53dcd9(0x1c3)])return;const _0x3a308e=await _0x111c63['journey'][_0x53dcd9(0x215)](_0x2cda2d[_0x53dcd9(0x1c3)]['id']);for(const _0x3e4c22 of _0x3a308e){const _0x8d434c=journeyActivationStepToYaml(_0x3e4c22,_0x2efbd0['idToEmailMap'],_0x2efbd0['connectionIdToNameMap']),_0x717404=activationSignature(_0x8d434c);!_0x27c421[_0x53dcd9(0x169)](_0x717404)&&_0x27c421[_0x53dcd9(0x1a0)](_0x717404,_0x3e4c22['id']),_0x8d434c[_0x53dcd9(0x128)]&&_0x318c17[_0x53dcd9(0x1a0)](_0x8d434c[_0x53dcd9(0x128)],_0x3e4c22['id']);}};await matchExistingJourneySegments(_0x111c63,_0x2cda2d,_0x1bbd6d[_0x1913d9(0x1b2)],_0x2efbd0[_0x1913d9(0x145)],_0x2efbd0[_0x1913d9(0x197)]);const _0x16f058={'resolveSegmentId':async _0x1c50ff=>{const _0x30e0f1=_0x1913d9,_0x3dd77f=_0x2efbd0['segmentNameToId'][_0x30e0f1(0x1bc)](_0x1c50ff);if(!_0x3dd77f)throw new SDKError(ErrorCode[_0x30e0f1(0x12f)],_0x30e0f1(0x196)+_0x1c50ff+'\x20(referenced\x20in\x20journey\x20'+_0x2cda2d[_0x30e0f1(0x20f)][_0x30e0f1(0x128)]+')');return _0x3dd77f;},'resolveEmbeddedSegmentId':async(_0x2b443e,_0x3a89e9)=>{const _0x351c93=_0x1913d9,_0xb508a5=_0x2efbd0[_0x351c93(0x197)]['get'](_0x2b443e);if(_0xb508a5)return _0xb508a5;const _0x4073ce=_0x2efbd0[_0x351c93(0x145)][_0x351c93(0x1e6)](_0x4151f1=>_0x4151f1[_0x351c93(0x128)]===_0x2b443e);if(_0x4073ce)return _0x2efbd0[_0x351c93(0x197)]['set'](_0x2b443e,_0x4073ce['id']),_0x4073ce['id'];if(_0x2cda2d[_0x351c93(0x13a)]){const {stageName:_0x38ee7c,criteriaName:_0x16836a}=findSegmentCriteriaLocation(_0x2cda2d[_0x351c93(0x20f)],_0x2b443e);return _0x34af5d(_0x2b443e,_0x3a89e9['rule']),_0x5e64fd[_0x351c93(0x1a0)](_0x2b443e,{'definition':_0x3a89e9,'stageName':_0x38ee7c,'criteriaName':_0x16836a}),createPendingSegmentId(_0x2b443e);}const _0x472935=_0x2cda2d['existingJourney']?.['id'];if(!_0x472935)throw new SDKError(ErrorCode[_0x351c93(0x1d5)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0xd0e5c2=_0x2bb11c[_0x351c93(0x1bc)](_0x2b443e);if(_0xd0e5c2)return _0xd0e5c2;const _0x8afec1=((async()=>{const _0x424cef=_0x351c93;_0x34af5d(_0x2b443e,_0x3a89e9[_0x424cef(0x154)]);const _0x4aedd3=generateDeterministicJourneySegmentName(_0x2cda2d[_0x424cef(0x20f)][_0x424cef(0x128)],_0x2b443e),_0x4b8c02=_0x2efbd0[_0x424cef(0x145)][_0x424cef(0x1e6)](_0x71dd9d=>_0x71dd9d['name']===_0x4aedd3),_0x1d1c75=createSegmentIdResolver(_0x2efbd0[_0x424cef(0x197)],_0x2b443e),_0x54a51e=await resolveRuleSegmentIds(_0x3a89e9[_0x424cef(0x154)],_0x1d1c75);let _0x454534;return _0x4b8c02?(await _0x111c63[_0x424cef(0x1ef)][_0x424cef(0x1f5)](_0x1bbd6d[_0x424cef(0x1b2)],_0x4b8c02['id'],{'description':_0x3a89e9[_0x424cef(0x151)]||_0x424cef(0x166)+_0x2b443e,'rule':_0x15ae98(_0x54a51e,!![]),'countPopulation':!![]}),_0x454534=_0x4b8c02['id'],saveSegmentToPushRecovery(_0x2cda2d[_0x424cef(0x1f2)],_0x2cda2d['yamlConfig'][_0x424cef(0x128)],_0x2b443e,{'segmentId':_0x454534,'uniqueServerName':_0x4aedd3,'createdAt':new Date()['toISOString']()})):_0x454534=await createOrRecoverEmbeddedSegment(_0x111c63,_0x2cda2d,{'localName':_0x2b443e,'uniqueSegmentName':_0x4aedd3,'description':_0x3a89e9[_0x424cef(0x151)]||_0x424cef(0x166)+_0x2b443e,'journeyId':_0x472935,'resolvedRule':_0x54a51e,'parentId':_0x1bbd6d[_0x424cef(0x1b2)],'folderId':_0x1bbd6d['rootFolderId']||''},_0x15ae98),_0x2efbd0['segmentNameToId'][_0x424cef(0x1a0)](_0x2b443e,_0x454534),_0x401bfa[_0x424cef(0x1a0)](_0x2b443e,_0x454534),_0x454534;})());_0x2bb11c[_0x351c93(0x1a0)](_0x2b443e,_0x8afec1);try{return await _0x8afec1;}finally{_0x2bb11c[_0x351c93(0x141)](_0x2b443e);}},'resolveActivationId':async _0x248c33=>{const _0xcc5c0a=_0x1913d9,_0x491ef8=_0x318c17[_0xcc5c0a(0x1bc)](_0x248c33);if(_0x491ef8)return _0x491ef8;if(_0x2cda2d[_0xcc5c0a(0x1c3)]){await _0x5192b5();const _0x4bc6fc=_0x318c17[_0xcc5c0a(0x1bc)](_0x248c33);if(_0x4bc6fc)return _0x4bc6fc;}throw new SDKError(ErrorCode[_0xcc5c0a(0x1be)],_0xcc5c0a(0x148)+_0x248c33+_0xcc5c0a(0x1d6)+_0x2cda2d[_0xcc5c0a(0x20f)][_0xcc5c0a(0x128)]+_0xcc5c0a(0x139)+_0xcc5c0a(0x1b1));},'resolveEmbeddedActivationId':async(_0x2344f4,_0xee7a7a)=>{const _0x2a2727=_0x1913d9,_0x4967ec=_0x318c17[_0x2a2727(0x1bc)](_0x2344f4);if(_0x4967ec)return _0x4967ec;if(_0x2cda2d[_0x2a2727(0x13a)])return _0x39c00b[_0x2a2727(0x1a0)](_0x2344f4,_0xee7a7a),createPendingActivationId(_0x2344f4);if(_0x2cda2d[_0x2a2727(0x1c3)]){await _0x5192b5();const _0x4b3985=_0x318c17['get'](_0xee7a7a[_0x2a2727(0x128)]);if(_0x4b3985)return _0x318c17[_0x2a2727(0x1a0)](_0x2344f4,_0x4b3985),_0x4b3985;const _0x40731f=activationSignature(_0xee7a7a),_0x1c86a2=_0x27c421?.[_0x2a2727(0x1bc)](_0x40731f);if(_0x1c86a2)return _0x318c17[_0x2a2727(0x1a0)](_0x2344f4,_0x1c86a2),_0x1c86a2;const _0x4c2f9d=await _0x22585a(_0xee7a7a,_0x2efbd0[_0x2a2727(0x20a)]),_0x252576={..._0x4c2f9d,..._0xee7a7a[_0x2a2727(0x20d)]!==undefined&&{'runAfterJourneyRefresh':_0xee7a7a['run_after_journey_refresh']}},_0x15c716=await _0x111c63[_0x2a2727(0x1a8)][_0x2a2727(0x12e)](_0x2cda2d[_0x2a2727(0x1c3)]['id'],_0x252576);return _0x318c17[_0x2a2727(0x1a0)](_0x2344f4,_0x15c716['id']),_0x15c716['id'];}throw new SDKError(ErrorCode[_0x2a2727(0x1d5)],_0x2a2727(0x188));},'resolveJourneyId':async _0x1bcf2f=>{const _0x53ff6f=_0x1913d9;try{return await _0x111c63[_0x53ff6f(0x1a8)][_0x53ff6f(0x13b)](_0x1bbd6d[_0x53ff6f(0x1b2)],_0x1bcf2f);}catch(_0x3ca0da){throw new SDKError(ErrorCode[_0x53ff6f(0x1be)],_0x53ff6f(0x200)+_0x1bcf2f+_0x53ff6f(0x1fb)+_0x2cda2d[_0x53ff6f(0x20f)][_0x53ff6f(0x128)]+'\x27)',_0x3ca0da);}},'resolveStageId':async(_0x225774,_0x56d4ad)=>{const _0x5167e0=_0x1913d9,_0x172c32=await _0x111c63[_0x5167e0(0x1a8)][_0x5167e0(0x217)](_0x225774),_0x19628c=_0x172c32['attributes']['journeyStages'][_0x5167e0(0x1e6)](_0x4a5ac7=>_0x4a5ac7[_0x5167e0(0x128)][_0x5167e0(0x211)]()===_0x56d4ad[_0x5167e0(0x211)]());if(!_0x19628c?.['id'])throw new SDKError(ErrorCode[_0x5167e0(0x1be)],_0x5167e0(0x1e7)+_0x56d4ad+_0x5167e0(0x1e0)+(_0x172c32['attributes'][_0x5167e0(0x170)]||_0x172c32[_0x5167e0(0x16e)][_0x5167e0(0x128)])+'\x27');return _0x19628c['id'];}},_0x5d605a=await _0x117e94(_0x2cda2d[_0x1913d9(0x20f)],_0x1bbd6d['parentId'],_0x16f058),_0x37b5a4=_0x1bbd6d[_0x1913d9(0x18f)]||_0x1bbd6d[_0x1913d9(0x16f)];_0x37b5a4&&(_0x5d605a[_0x1913d9(0x143)]={'parentFolder':{'data':{'id':_0x37b5a4,'type':_0x1913d9(0x147)}}});if(_0x2cda2d[_0x1913d9(0x13a)]){if(_0x5e64fd[_0x1913d9(0x1e3)]>0x0||_0x39c00b[_0x1913d9(0x1e3)]>0x0)return await executeThreeStepJourneyCreate(_0x111c63,_0x2cda2d,_0x5d605a,{'pendingEmbeddedSegments':_0x5e64fd,'pendingEmbeddedActivations':_0x39c00b,'embeddedSegmentNameToId':_0x401bfa,'journeyActivationNameToId':_0x318c17},{..._0x1bbd6d,'effectiveFolderId':_0x37b5a4},_0x2efbd0,_0x251bce,_0x373145);else{ensureJourneyDefaults(_0x5d605a[_0x1913d9(0x16e)]);const _0x13e8f8=await _0x111c63[_0x1913d9(0x1a8)]['create'](_0x5d605a);return deletePushRecovery(_0x2cda2d['absolutePath']),{'action':_0x1913d9(0x1f1),'journeyId':_0x13e8f8['id'],'embeddedSegmentNameToId':_0x401bfa};}}else{if(_0x2cda2d[_0x1913d9(0x15b)]&&_0x2cda2d[_0x1913d9(0x1c3)]){_0x5d605a['id']=_0x2cda2d[_0x1913d9(0x1c3)]['id'];const _0x434d35=_0x5d605a[_0x1913d9(0x16e)];_0x2cda2d[_0x1913d9(0x1c3)][_0x1913d9(0x16e)]?.[_0x1913d9(0x170)]&&(_0x434d35[_0x1913d9(0x170)]=_0x2cda2d['existingJourney'][_0x1913d9(0x16e)][_0x1913d9(0x170)]);const _0x583537=_0x2cda2d[_0x1913d9(0x1c3)]['attributes']?.['journeyStages'];return _0x583537&&_0x5d605a[_0x1913d9(0x16e)]['journeyStages']&&injectExistingStageIds(_0x5d605a[_0x1913d9(0x16e)]['journeyStages'],_0x583537),ensureJourneyDefaults(_0x434d35),await _0x111c63[_0x1913d9(0x1a8)][_0x1913d9(0x1fe)](_0x2cda2d[_0x1913d9(0x1c3)]['id'],_0x5d605a),deletePushRecovery(_0x2cda2d['absolutePath']),{'action':_0x1913d9(0x123),'journeyId':_0x2cda2d[_0x1913d9(0x1c3)]['id'],'embeddedSegmentNameToId':_0x401bfa};}}return deletePushRecovery(_0x2cda2d[_0x1913d9(0x1f2)]),{'action':'unchanged','journeyId':_0x2cda2d[_0x1913d9(0x1c3)]?.['id'],'embeddedSegmentNameToId':_0x401bfa};}function findSegmentCriteriaLocation(_0x45a55c,_0x4b20d7){const _0x294f10=a152_0x57cc,_0x3e4aaa=_0x45a55c['stages']||_0x45a55c[_0x294f10(0x1f3)]?.[0x0]?.[_0x294f10(0x1fc)]||[];let _0x21fa8a='entry',_0x27aa30=_0x4b20d7;const _0x2cdbb4=_0x45a55c['goal']||_0x45a55c[_0x294f10(0x1f3)]?.[0x0]?.['goal'];if(_0x2cdbb4?.[_0x294f10(0x1ef)]===_0x4b20d7)return{'stageName':_0x294f10(0x17c),'criteriaName':_0x2cdbb4[_0x294f10(0x128)]||_0x4b20d7};_0x56e4d9:for(const _0x184b66 of _0x3e4aaa){if(_0x184b66[_0x294f10(0x210)]?.['segment']===_0x4b20d7){_0x21fa8a=_0x184b66[_0x294f10(0x128)],_0x27aa30=_0x184b66[_0x294f10(0x210)][_0x294f10(0x128)]||_0x4b20d7;break;}if(_0x184b66[_0x294f10(0x214)])for(const _0x5823c of _0x184b66['steps']){if(_0x5823c['type']==='decision_point'&&_0x5823c[_0x294f10(0x14b)]?.['branches'])for(const _0x361d76 of _0x5823c[_0x294f10(0x14b)][_0x294f10(0x187)]){if(_0x361d76[_0x294f10(0x1ef)]===_0x4b20d7){_0x21fa8a=_0x184b66[_0x294f10(0x128)],_0x27aa30=_0x361d76[_0x294f10(0x128)]||_0x4b20d7;break _0x56e4d9;}}}}return{'stageName':_0x21fa8a,'criteriaName':_0x27aa30};}async function executeThreeStepJourneyCreate(_0x5afab1,_0x83663f,_0x5162d9,_0x4cc330,_0x3cee0c,_0x68a908,_0x18c0e1,_0x373aef){const _0x54b601=a152_0x57cc,{activationDefToCreateRequest:_0x901622,yamlRuleToApi:_0x26c9c1}=_0x373aef,{pendingEmbeddedSegments:_0x1efb74,pendingEmbeddedActivations:_0x2169ee,embeddedSegmentNameToId:_0x4b872b}=_0x4cc330,_0x325d40=JSON[_0x54b601(0x1f9)](JSON[_0x54b601(0x1bb)](_0x5162d9));ensureJourneyDefaults(_0x325d40[_0x54b601(0x16e)]),stripPendingIds(_0x325d40);const _0x2fa8b4=await _0x5afab1[_0x54b601(0x1a8)][_0x54b601(0x1c0)](_0x325d40),_0x20b1bd=_0x2fa8b4['id'],_0x123107=new Map();for(const _0x221fc5 of _0x2fa8b4[_0x54b601(0x16e)][_0x54b601(0x1de)]){_0x123107[_0x54b601(0x1a0)](_0x221fc5[_0x54b601(0x128)][_0x54b601(0x211)](),_0x221fc5['id']);}recoverSegmentIdsFromPushRecovery(_0x83663f,_0x4b872b,_0x68a908['segmentNameToId']);for(const [_0x122c0b,{definition:_0x31029a}]of _0x1efb74){if(_0x4b872b['has'](_0x122c0b)){_0x18c0e1[_0x54b601(0x1cc)]?.({'type':_0x54b601(0x199),'journeyName':_0x83663f[_0x54b601(0x20f)][_0x54b601(0x128)],'segmentName':_0x122c0b});continue;}const _0x60c86d=generateDeterministicJourneySegmentName(_0x83663f[_0x54b601(0x20f)]['name'],_0x122c0b);_0x18c0e1[_0x54b601(0x1cc)]?.({'type':'embedded_segment_creating','journeyName':_0x83663f[_0x54b601(0x20f)][_0x54b601(0x128)],'segmentName':_0x122c0b});const _0x3987a3=createSegmentIdResolver(_0x68a908[_0x54b601(0x197)],_0x122c0b),_0x240bb7=await resolveRuleSegmentIds(_0x31029a['rule'],_0x3987a3),_0x372d94=await createOrRecoverEmbeddedSegment(_0x5afab1,_0x83663f,{'localName':_0x122c0b,'uniqueSegmentName':_0x60c86d,'description':_0x31029a[_0x54b601(0x151)]||_0x54b601(0x166)+_0x122c0b,'journeyId':_0x20b1bd,'resolvedRule':_0x240bb7,'parentId':_0x3cee0c[_0x54b601(0x1b2)],'folderId':_0x3cee0c[_0x54b601(0x218)]||''},_0x26c9c1);_0x4b872b[_0x54b601(0x1a0)](_0x122c0b,_0x372d94),_0x68a908['segmentNameToId'][_0x54b601(0x1a0)](_0x122c0b,_0x372d94),_0x18c0e1['onProgress']?.({'type':_0x54b601(0x199),'journeyName':_0x83663f[_0x54b601(0x20f)][_0x54b601(0x128)],'segmentName':_0x122c0b});}const _0x118750=new Map();for(const [_0x509458,_0x2f1b89]of _0x2169ee){_0x18c0e1['onProgress']?.({'type':_0x54b601(0x1df),'journeyName':_0x83663f[_0x54b601(0x20f)][_0x54b601(0x128)],'activationName':_0x509458});const _0x368d06=await _0x901622(_0x2f1b89,_0x68a908[_0x54b601(0x20a)]),_0x5c008c={..._0x368d06,..._0x2f1b89[_0x54b601(0x20d)]!==undefined&&{'runAfterJourneyRefresh':_0x2f1b89['run_after_journey_refresh']}},_0x43f19d=await _0x5afab1[_0x54b601(0x1a8)][_0x54b601(0x12e)](_0x20b1bd,_0x5c008c);_0x118750[_0x54b601(0x1a0)](_0x509458,_0x43f19d['id']),_0x4cc330['journeyActivationNameToId'][_0x54b601(0x1a0)](_0x509458,_0x43f19d['id']),_0x18c0e1['onProgress']?.({'type':_0x54b601(0x1eb),'journeyName':_0x83663f[_0x54b601(0x20f)][_0x54b601(0x128)],'activationName':_0x509458});}const _0x5aefdb=JSON['parse'](JSON[_0x54b601(0x1bb)](_0x5162d9));return _0x5aefdb['id']=_0x20b1bd,ensureJourneyDefaults(_0x5aefdb[_0x54b601(0x16e)]),resolvePendingIdsInRequest(_0x5aefdb,_0x5162d9,_0x123107,_0x4b872b,_0x118750,_0x18c0e1),await _0x5afab1['journey'][_0x54b601(0x1fe)](_0x20b1bd,_0x5aefdb),deletePushRecovery(_0x83663f[_0x54b601(0x1f2)]),{'action':_0x54b601(0x1f1),'journeyId':_0x20b1bd,'embeddedSegmentNameToId':_0x4b872b};}export function stripWaitStepPendingIds(_0x53c505){const _0x390887=a152_0x57cc,_0x5647ee=_0x53c505[_0x390887(0x175)]&&isPendingSegmentId(_0x53c505['conditionSegmentId']),_0x2f0363=_0x53c505[_0x390887(0x177)]?.[_0x390887(0x16a)](_0x3c2f1b=>_0x3c2f1b[_0x390887(0x1c9)]&&isPendingSegmentId(_0x3c2f1b['segmentId']));(_0x5647ee||_0x2f0363)&&(_0x53c505[_0x390887(0x134)]=_0x390887(0x1c8),_0x53c505[_0x390887(0x152)]=0x1,_0x53c505['waitStepUnit']=_0x390887(0x1e4),delete _0x53c505[_0x390887(0x175)],delete _0x53c505[_0x390887(0x1fa)],delete _0x53c505[_0x390887(0x19d)],delete _0x53c505[_0x390887(0x177)]);}export function resolveWaitStepPendingIds(_0x529a85,_0x24b9ec,_0xbed5b8,_0x2ff9fd){const _0x20cde7=a152_0x57cc;if(_0x24b9ec[_0x20cde7(0x175)]&&isPendingSegmentId(_0x24b9ec['conditionSegmentId'])){const _0x4c8853=_0xbed5b8(_0x24b9ec[_0x20cde7(0x175)],_0x20cde7(0x158)+_0x2ff9fd+_0x20cde7(0x126));_0x4c8853&&(_0x529a85[_0x20cde7(0x134)]=_0x20cde7(0x1da),_0x529a85[_0x20cde7(0x175)]=_0x4c8853,delete _0x529a85[_0x20cde7(0x152)],delete _0x529a85[_0x20cde7(0x1e5)],_0x24b9ec[_0x20cde7(0x1fa)]!==undefined&&(_0x529a85['conditionTimeoutDuration']=_0x24b9ec[_0x20cde7(0x1fa)]),_0x24b9ec[_0x20cde7(0x19d)]&&(_0x529a85['conditionTimeoutUnit']=_0x24b9ec[_0x20cde7(0x19d)]));}if(_0x24b9ec[_0x20cde7(0x177)]){const _0x313df5=_0x24b9ec[_0x20cde7(0x177)][_0x20cde7(0x16a)](_0xe88a20=>_0xe88a20['segmentId']&&isPendingSegmentId(_0xe88a20[_0x20cde7(0x1c9)]));if(_0x313df5){const _0xf43452=_0x24b9ec[_0x20cde7(0x177)][_0x20cde7(0x1dd)](_0x38dac2=>{const _0x1d2ea1=_0x20cde7;if(_0x38dac2[_0x1d2ea1(0x1c9)]&&isPendingSegmentId(_0x38dac2[_0x1d2ea1(0x1c9)])){const _0x4369c8=_0xbed5b8(_0x38dac2['segmentId'],_0x1d2ea1(0x158)+_0x2ff9fd+_0x1d2ea1(0x126));return{..._0x38dac2,'segmentId':_0x4369c8||_0x38dac2[_0x1d2ea1(0x1c9)]};}return{..._0x38dac2};});_0x529a85[_0x20cde7(0x134)]=_0x20cde7(0x1da),_0x529a85[_0x20cde7(0x177)]=_0xf43452,delete _0x529a85[_0x20cde7(0x152)],delete _0x529a85[_0x20cde7(0x1e5)],delete _0x529a85[_0x20cde7(0x175)],delete _0x529a85['conditionTimeoutDuration'],delete _0x529a85[_0x20cde7(0x19d)];}}}function a152_0x1b16(){const _0x304ed8=['resolveJourneyId','validatedRequest','./child-segment-yaml.js','connection','sort','Delete\x20the\x20push\x20recovery\x20file\x20(','delete','createSegment','relationships','data','existingSegments','index','folder','Activation\x20not\x20found:\x20','slice','./journey-yaml.js','with','journeyId','deps','Updated\x20activation\x20\x27','keys','columns','description','waitStep','parseDocument','rule','segments','relative','segment_deleting','stage\x20\x27','utf-8','action','hasChanges','resolveSegment','Updating\x20segment\x20\x27','DecisionPoint','journey_created','Embedded\x20segment\x20\x27','\x27\x20exit\x20criteria','createdSegmentIds','WaitStep','journeyBundleId','exitCriterias','Entry\x20criteria:\x20','getSegmentEntity\x20also\x20failed\x20for\x20','push','has','some','segment_creating','uniqueServerName','../../utils/async.js','attributes','rootFolderId','journeyBundleName','ACTIVATION_UPDATE_ERROR','Segment\x20not\x20found','Matched\x20server\x20segment\x20\x27','activation_','conditionSegmentId','withProgress','conditions','unchanged','journey_updating','\x20error(s)','toISOString','goal',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','connector_config','skipSegments','add','SEGMENT_UPDATE_ERROR','object','\x0a\x20\x20','existingActivation','60646SRzZCU','journey_entry_criteria_','branches','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','createJourneySegment','Deleted\x20segment\x20\x27','verbose','\x27\x20to\x20local\x20\x27','\x27...','kind','folderId','logSuccess','match','startsWith','milestone','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','12BhSKCI','Segment\x20not\x20found:\x20','segmentNameToId','logWarning','embedded_segment_created','Failed\x20to\x20','message','segmentFolderId','conditionTimeoutUnit','type','entryCriteria','set','activation_created','Failed\x20to\x20resolve\x20activation\x20','replace','connectionIdToNameMap','deleteSegment','Creating\x20segment\x20\x27','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','journey','926984TKQVFQ','\x27\x20decision\x20point\x20branch\x20\x27','activation_creating','resolvedRule','6057198vAbyQD','dirname','4857815mWNNPN','Fetching\x20','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','parentId','behavior','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','all_columns','Failed\x20to\x20fetch\x20referenced\x20segment\x20','segmentByFolderAndName','3iGsHSs','Updating\x20activation\x20\x27','stringify','get','folderPath','NOT_FOUND','notification','create','progress','uniqueSegmentName','existingJourney','activation_updating','15384xTjOgx','journeyById','schedule','Duration','segmentId','\x20journey\x20from\x20file:\x20','activation_deleted','onProgress','max','Created\x20folder\x20\x27','segment_updated','segment_deleted','5319FjoAGA','debug','Failed\x20to\x20resolve\x20segment\x20','parentSegmentFolder','INTERNAL','\x20(referenced\x20in\x20journey\x20','length','activationsBySegmentId','14367750ZMUCVZ','Condition','Creating\x20folder\x20\x27','flatMap','map','journeyStages','embedded_activation_creating','\x27\x20not\x20found\x20in\x20journey\x20\x27','draft','results','size','day','waitStepUnit','find','Stage\x20\x27','localName','Created\x20segment\x20\x27','Creating\x20activation\x20\x27','embedded_activation_created','entries','trim','list','segment','journey_updated','created','absolutePath','journeys','createdSegmentId','updateSegmentById','yamlActivation','idToEmailMap','ACTIVATION_SYNTAX_ERROR','parse','conditionTimeoutDuration','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','stages','valid','update','journey_creating','Journey\x20\x27','journeyName','Updated\x20journey\x20\x27','filter','folderPathToId','deleted','toString','item','logDeleted','createFolder','activationContext','journeyBundlesByFolderAndName','values','run_after_journey_refresh','8175846bxYuDB','yamlConfig','entry_criteria','toLowerCase','\x27\x20from\x20file:\x20','activationStepsById','steps','listActivations','existingSegment','getJourney','effectiveFolderId','versionNumber','segment_created','diff','activationActions','split','Created\x20journey\x20\x27','digest','updateActivation','SEGMENT_SYNTAX_ERROR','activations','null','Deleting\x20activation\x20\x27','journeyActivationStepId','updated','embeddedSegmentNameToId','buildUserMaps','\x27\x20wait\x20condition','errors','name','\x20segment\x20from\x20file:\x20','activation_updated','from','all','\x27\x20by\x20rule\x20content','createActivation','SEGMENT_NOT_FOUND','.$1.push-recovery.json','nameToType','includes','reduce','waitStepType','activation_template_id','join','folder_creating','Updated\x20segment\x20\x27',').\x20','isNew'];a152_0x1b16=function(){return _0x304ed8;};return a152_0x1b16();}function stripPendingIds(_0xdf4a43){const _0x1a8980=a152_0x57cc;_0xdf4a43['attributes'][_0x1a8980(0x17c)]?.[_0x1a8980(0x1c9)]&&isPendingSegmentId(_0xdf4a43['attributes'][_0x1a8980(0x17c)][_0x1a8980(0x1c9)])&&delete _0xdf4a43[_0x1a8980(0x16e)]['goal'];for(const _0x49487c of _0xdf4a43[_0x1a8980(0x16e)][_0x1a8980(0x1de)]||[]){_0x49487c[_0x1a8980(0x19f)]?.[_0x1a8980(0x1c9)]&&isPendingSegmentId(_0x49487c[_0x1a8980(0x19f)][_0x1a8980(0x1c9)])&&delete _0x49487c['entryCriteria'];_0x49487c['milestone']?.[_0x1a8980(0x1c9)]&&isPendingSegmentId(_0x49487c[_0x1a8980(0x193)][_0x1a8980(0x1c9)])&&delete _0x49487c['milestone'];_0x49487c[_0x1a8980(0x165)]&&(_0x49487c[_0x1a8980(0x165)]=_0x49487c[_0x1a8980(0x165)]['filter'](_0xa2339a=>!_0xa2339a['segmentId']||!isPendingSegmentId(_0xa2339a['segmentId'])));if(_0x49487c[_0x1a8980(0x214)])for(const _0x4b6291 of Object[_0x1a8980(0x14f)](_0x49487c[_0x1a8980(0x214)])){const _0x1237b1=_0x49487c[_0x1a8980(0x214)][_0x4b6291];_0x1237b1[_0x1a8980(0x19e)]==='Activation'&&_0x1237b1[_0x1a8980(0x225)]&&isPendingActivationId(_0x1237b1[_0x1a8980(0x225)])&&(_0x1237b1[_0x1a8980(0x225)]='');if(_0x1237b1['type']===_0x1a8980(0x15e)&&_0x1237b1[_0x1a8980(0x187)])for(const _0x456d22 of _0x1237b1[_0x1a8980(0x187)]){_0x456d22[_0x1a8980(0x1c9)]&&isPendingSegmentId(_0x456d22[_0x1a8980(0x1c9)])&&(_0x456d22[_0x1a8980(0x1c9)]='');}_0x1237b1['type']==='WaitStep'&&stripWaitStepPendingIds(_0x1237b1);}}}function resolvePendingIdsInRequest(_0x39f97a,_0x54b2bd,_0x50f04d,_0x31aef3,_0x1a6832,_0x502490){const _0x1dbb64=a152_0x57cc,_0x500bc9=(_0x76add9,_0x1a6d9c)=>{const _0x46c316=a152_0x57cc;if(!isPendingSegmentId(_0x76add9))return _0x76add9;const _0x4774e7=extractPendingSegmentName(_0x76add9),_0x4520f=_0x31aef3[_0x46c316(0x1bc)](_0x4774e7);return!_0x4520f&&_0x502490[_0x46c316(0x198)]?.(_0x46c316(0x194)+_0x4774e7+'\x27\x20for\x20'+_0x1a6d9c),_0x4520f;};if(_0x39f97a['attributes'][_0x1dbb64(0x17c)]?.['segmentId']&&isPendingSegmentId(_0x39f97a[_0x1dbb64(0x16e)][_0x1dbb64(0x17c)][_0x1dbb64(0x1c9)])){const _0x1e281a=_0x500bc9(_0x39f97a[_0x1dbb64(0x16e)][_0x1dbb64(0x17c)][_0x1dbb64(0x1c9)],'goal\x20criteria');_0x1e281a&&(_0x39f97a[_0x1dbb64(0x16e)][_0x1dbb64(0x17c)]['segmentId']=_0x1e281a);}for(const _0x2f8a60 of _0x39f97a[_0x1dbb64(0x16e)][_0x1dbb64(0x1de)]||[]){const _0x3f715d=_0x50f04d['get'](_0x2f8a60[_0x1dbb64(0x128)]['toLowerCase']());_0x3f715d&&(_0x2f8a60['id']=_0x3f715d);if(_0x2f8a60['entryCriteria']?.[_0x1dbb64(0x1c9)]&&isPendingSegmentId(_0x2f8a60[_0x1dbb64(0x19f)][_0x1dbb64(0x1c9)])){const _0x99cccb=_0x500bc9(_0x2f8a60[_0x1dbb64(0x19f)]['segmentId'],'stage\x20\x27'+_0x2f8a60[_0x1dbb64(0x128)]+'\x27\x20entry\x20criteria');_0x99cccb&&(_0x2f8a60[_0x1dbb64(0x19f)][_0x1dbb64(0x1c9)]=_0x99cccb);}if(_0x2f8a60[_0x1dbb64(0x165)])for(const _0x401766 of _0x2f8a60[_0x1dbb64(0x165)]){if(_0x401766[_0x1dbb64(0x1c9)]&&isPendingSegmentId(_0x401766[_0x1dbb64(0x1c9)])){const _0x11cb67=_0x500bc9(_0x401766[_0x1dbb64(0x1c9)],_0x1dbb64(0x158)+_0x2f8a60[_0x1dbb64(0x128)]+_0x1dbb64(0x161));_0x11cb67&&(_0x401766[_0x1dbb64(0x1c9)]=_0x11cb67);}}if(_0x2f8a60['milestone']?.[_0x1dbb64(0x1c9)]&&isPendingSegmentId(_0x2f8a60[_0x1dbb64(0x193)]['segmentId'])){const _0x2e7236=_0x500bc9(_0x2f8a60[_0x1dbb64(0x193)][_0x1dbb64(0x1c9)],_0x1dbb64(0x158)+_0x2f8a60[_0x1dbb64(0x128)]+'\x27\x20milestone');_0x2e7236&&(_0x2f8a60['milestone'][_0x1dbb64(0x1c9)]=_0x2e7236);}if(_0x2f8a60[_0x1dbb64(0x214)]){const _0x45b7ba=_0x1565c3=>_0x54b2bd[_0x1dbb64(0x16e)][_0x1dbb64(0x1de)]?.['find'](_0x5227de=>_0x5227de[_0x1dbb64(0x128)]['toLowerCase']()===_0x2f8a60[_0x1dbb64(0x128)][_0x1dbb64(0x211)]())?.[_0x1dbb64(0x214)]?.[_0x1565c3];for(const _0x3ae8ac of Object[_0x1dbb64(0x14f)](_0x2f8a60[_0x1dbb64(0x214)])){const _0x322207=_0x2f8a60[_0x1dbb64(0x214)][_0x3ae8ac],_0x1b238b=_0x45b7ba(_0x3ae8ac);if(_0x322207['type']==='Activation'&&_0x322207['journeyActivationStepId']&&(isPendingActivationId(_0x322207[_0x1dbb64(0x225)])||_0x322207[_0x1dbb64(0x225)]==='')){if(_0x1b238b?.[_0x1dbb64(0x225)]&&isPendingActivationId(_0x1b238b[_0x1dbb64(0x225)])){const _0x410d39=extractPendingActivationName(_0x1b238b[_0x1dbb64(0x225)]),_0x39b510=_0x1a6832[_0x1dbb64(0x1bc)](_0x410d39);_0x39b510&&(_0x322207['journeyActivationStepId']=_0x39b510);}}if(_0x322207['type']===_0x1dbb64(0x15e)&&_0x322207[_0x1dbb64(0x187)]&&_0x1b238b?.[_0x1dbb64(0x187)])for(let _0x439035=0x0;_0x439035<_0x322207['branches']['length'];_0x439035++){const _0x19eca3=_0x322207[_0x1dbb64(0x187)][_0x439035],_0x220544=_0x1b238b[_0x1dbb64(0x187)][_0x439035];if(_0x220544?.[_0x1dbb64(0x1c9)]&&isPendingSegmentId(_0x220544['segmentId'])){const _0x1d3db9=_0x500bc9(_0x220544[_0x1dbb64(0x1c9)],_0x1dbb64(0x158)+_0x2f8a60[_0x1dbb64(0x128)]+_0x1dbb64(0x1aa)+(_0x19eca3[_0x1dbb64(0x128)]||_0x439035)+'\x27');_0x1d3db9&&(_0x19eca3[_0x1dbb64(0x1c9)]=_0x1d3db9);}}_0x322207[_0x1dbb64(0x19e)]===_0x1dbb64(0x163)&&_0x1b238b?.['type']===_0x1dbb64(0x163)&&resolveWaitStepPendingIds(_0x322207,_0x1b238b,_0x500bc9,_0x2f8a60[_0x1dbb64(0x128)]);}}}}
1
+ const a152_0x56096e=a152_0x3f60;(function(_0x11e792,_0x25607a){const _0x18c2e1=a152_0x3f60,_0x4dce29=_0x11e792();while(!![]){try{const _0x1cbca6=-parseInt(_0x18c2e1(0x209))/0x1+parseInt(_0x18c2e1(0x258))/0x2+-parseInt(_0x18c2e1(0x1dc))/0x3*(-parseInt(_0x18c2e1(0x1e2))/0x4)+-parseInt(_0x18c2e1(0x161))/0x5*(parseInt(_0x18c2e1(0x175))/0x6)+parseInt(_0x18c2e1(0x257))/0x7*(-parseInt(_0x18c2e1(0x20e))/0x8)+parseInt(_0x18c2e1(0x225))/0x9+parseInt(_0x18c2e1(0x22b))/0xa*(-parseInt(_0x18c2e1(0x237))/0xb);if(_0x1cbca6===_0x25607a)break;else _0x4dce29['push'](_0x4dce29['shift']());}catch(_0x4ac7c9){_0x4dce29['push'](_0x4dce29['shift']());}}}(a152_0x161f,0x3e2b1));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x56096e(0x1f6));export const PENDING_SEGMENT_PREFIX=a152_0x56096e(0x1af);export const PENDING_ACTIVATION_PREFIX=a152_0x56096e(0x1e3);export function createPendingSegmentId(_0x2e0f32){return''+PENDING_SEGMENT_PREFIX+_0x2e0f32+'__';}export function isPendingSegmentId(_0x4b0892){const _0x152e6c=a152_0x56096e;return _0x4b0892[_0x152e6c(0x200)](PENDING_SEGMENT_PREFIX)&&!_0x4b0892['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x32744a){const _0x4fb719=a152_0x56096e;return _0x32744a[_0x4fb719(0x216)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4cda8d){return''+PENDING_ACTIVATION_PREFIX+_0x4cda8d+'__';}function a152_0x161f(){const _0x319ce1=['\x20journey\x20from\x20file:\x20','digest','size','activationActions','embeddedSegmentNameToId','JOURNEY_SYNTAX_ERROR','message','Deleted\x20activation\x20\x27','has','stages','resolveSegment','__pending_','Updated\x20activation\x20\x27','parseDocument','getLatestJourneyId','\x20error(s)','\x27\x20entry\x20criteria','segmentId','with','results','notification','activation_created','ACTIVATION_SYNTAX_ERROR','Stage\x20\x27','add','conditionTimeoutUnit','join','entry_criteria','yamlActivation','logWarning','folderId','data','description','waitStepUnit','createJourneySegment','journeyBundleId','journeyId','stringify',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','activation_creating','parentSegmentFolder','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','getSegment\x20failed\x20for\x20','segment_updated','\x27\x20from\x20file:\x20','Updated\x20journey\x20\x27','unchanged','exitCriterias','Failed\x20to\x20','parse','existingActivation','folder_creating','create','journeyBundlesByFolderAndName','\x27\x20for\x20','Journey\x20\x27','65622mgIOSK','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','name','getJourney','filter','Fetching\x20','16RfitTv','__pending_act_','kind','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','\x27\x20to\x20local\x20\x27','some','length','map','errors','embedded_segment_created','index','journeyBundleName','\x27\x20wait\x20condition','effectiveFolderId','createdSegmentIds','slice','embedded_activation_creating','entries','Updating\x20activation\x20\x27','WaitStep','tdx.sdk.push-workflow','activation_updating','updated','keys','connection','activation_deleting','journeyStages','conditionTimeoutDuration','all_columns','.$1.push-recovery.json','startsWith','debug','object','journey_created','delete','goal','\x20activation\x20\x27','INTERNAL','milestone','167000KLSObr','existingJourney','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Deleting\x20activation\x20\x27','Created\x20activation\x20\x27','14520InopQa','nameToType','activation_updated','embedded_activation_created','progress','activation_template_id','verbose','Creating\x20folder\x20\x27','replace','journey_updating','Created\x20journey\x20\x27','logSuccess','day','../../utils/async.js','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','type','reduce','Segment\x20not\x20found:\x20','\x27\x20by\x20rule\x20content','behavior','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','journey_creating','deleted','1798416vXfmOO','Activation','Creating\x20segment\x20\x27','existingSegments','\x0a\x20\x20','./child-segment-yaml.js','2190NSxEmQ','logDeleted','update','Created\x20segment\x20\x27','Failed\x20to\x20resolve\x20segment\x20','segmentByFolderAndName','Embedded\x20segment\x20\x27','segment','onProgress','sort','decision_point','created','1870gVQirS','waitStep','deleteSegment','uniqueSegmentName','\x27\x20not\x20found\x20in\x20journey\x20\x27','Activation\x20not\x20found:\x20','user','Name\x20has\x20already\x20been\x20taken','waitStepType','yamlConfig','get','ACTIVATION_UPDATE_ERROR','attributes','hex','getSegmentEntity\x20also\x20failed\x20for\x20','journey','diff','activation_','segments','localName','createActivation','isNew','Segment\x20not\x20found','deleteActivation','columns','relationships','draft','folderPath','segment_created','idToEmailMap','action','connector_config','763oLRSJi','933672RdBVXS','conditionSegmentId','null','skipSegments','connectionIdToNameMap','steps','Failed\x20to\x20resolve\x20activation\x20','resolvedRule','activations','flatMap','fetchJourney','from','DecisionPoint','state','relative','segment_deleting','existingSegment','resolveJourneyId','hasChanges','updateSegmentById','folderPathToId','createFolder','stage\x20\x27','listActivations','5DFsKgD','Updating\x20segment\x20\x27','rootFolderId','schedule','withProgress','deps','list','./journey-yaml.js','Entry\x20criteria:\x20','embedded_segment_creating','\x27...','max','NOT_FOUND','conditions','toISOString','split','SEGMENT_NOT_FOUND','segment_deleted',').\x20','activationContext','584700pzplPS','journey_updated','all','JOURNEY_UPDATE_ERROR','journeyActivationNameToId','sha1','SEGMENT_UPDATE_ERROR','journeyActivationStepId','createdSegmentId','Delete\x20the\x20push\x20recovery\x20file\x20(','push','dirname','Deleted\x20segment\x20\x27','idToName','isArray','journeyName','journeys','\x20segment\x20from\x20file:\x20','utf-8','run_after_journey_refresh','validatedRequest','absolutePath','logInfo','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','goal\x20criteria','segmentFolderId','Condition','journeyById','uniqueServerName','\x20(referenced\x20in\x20journey\x20','buildUserMaps','segment_updating','toString','activationStepsById','entryCriteria','find','parentId','getActivation','versionNumber','\x27\x20milestone','toLowerCase','match','set','segmentNameToId','):\x20','branches','rule'];a152_0x161f=function(){return _0x319ce1;};return a152_0x161f();}export function isPendingActivationId(_0x44d381){const _0x4e3e74=a152_0x56096e;return _0x44d381[_0x4e3e74(0x200)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5ecf0f){const _0x563cc6=a152_0x56096e;return _0x5ecf0f[_0x563cc6(0x216)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x1ef3ab,_0x8551d6){const _0x4d005b=a152_0x56096e,_0x1290a9=_0x1ef3ab+'::'+(_0x8551d6['trim']()||_0x4d005b(0x232)),_0x255aca=createHash(_0x4d005b(0x17a))[_0x4d005b(0x22d)](_0x1290a9)[_0x4d005b(0x1a5)](_0x4d005b(0x244))[_0x4d005b(0x1f1)](0x0,0xc);return'journey_entry_criteria_'+_0x255aca;}export function ensureJourneyDefaults(_0x2a7b78){const _0x46281b=a152_0x56096e;!_0x2a7b78[_0x46281b(0x1c4)]&&(_0x2a7b78[_0x46281b(0x1c4)]=''),!_0x2a7b78[_0x46281b(0x156)]&&(_0x2a7b78[_0x46281b(0x156)]=_0x46281b(0x251));}export function injectExistingStageIds(_0x145ad7,_0x4bfa7f){const _0xf52ab0=a152_0x56096e,_0x500d38=new Map(_0x4bfa7f[_0xf52ab0(0x1e9)](_0x47c0bf=>[_0x47c0bf['name'],_0x47c0bf['id']]));for(const _0x3da87f of _0x145ad7){if(!_0x3da87f['id']){const _0x2577d6=_0x500d38[_0xf52ab0(0x241)](_0x3da87f['name']);_0x2577d6&&(_0x3da87f['id']=_0x2577d6);}}}export function resolveTDFolderPath(_0x41ec13,_0x252262,_0x3d1307){if(!_0x252262)return _0x41ec13;if(_0x41ec13===_0x3d1307||_0x41ec13['startsWith'](_0x3d1307+'/'))return _0x41ec13;return _0x41ec13?_0x3d1307+'/'+_0x41ec13:_0x3d1307;}export function addFoldersToCreate(_0x41a1f6,_0x597cf2,_0x5694f8){const _0x1bef04=a152_0x56096e;if(!_0x41a1f6)return;if(_0x597cf2[_0x1bef04(0x1ac)](_0x41a1f6))return;const _0x1bef2f=_0x41a1f6[_0x1bef04(0x170)]('/');let _0x2292a5='';for(const _0x470926 of _0x1bef2f){_0x2292a5=_0x2292a5?_0x2292a5+'/'+_0x470926:_0x470926,!_0x597cf2[_0x1bef04(0x1ac)](_0x2292a5)&&_0x5694f8[_0x1bef04(0x1bc)](_0x2292a5);}}export function sortFoldersByDepth(_0x291a1a){const _0x1f1866=a152_0x56096e;return[..._0x291a1a][_0x1f1866(0x234)]((_0x3728d5,_0x30bbcc)=>{const _0x4fb0a4=_0x1f1866,_0x29696e=(_0x3728d5[_0x4fb0a4(0x19e)](/\//g)||[])['length'],_0x3b601a=(_0x30bbcc[_0x4fb0a4(0x19e)](/\//g)||[])[_0x4fb0a4(0x1e8)];return _0x29696e-_0x3b601a;});}import*as a152_0xbfd065 from'yaml';import{readFileSync}from'fs';import a152_0x51d9c3 from'path';import{isJourneyDef,parseYamlString as a152_0x3e5f8c,toYamlString as a152_0x2b0e63,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(_0x34590b){const _0x201ae1=a152_0x56096e;if(Array[_0x201ae1(0x183)](_0x34590b))return'['+_0x34590b[_0x201ae1(0x1e9)](_0x43f01c=>stableStringify(_0x43f01c))[_0x201ae1(0x1be)](',')+']';if(_0x34590b&&typeof _0x34590b===_0x201ae1(0x202)){const _0x2a4c60=_0x34590b,_0x35c6ff=Object[_0x201ae1(0x1f9)](_0x2a4c60)[_0x201ae1(0x234)](),_0x275769=_0x35c6ff[_0x201ae1(0x1e9)](_0x3a891d=>'\x22'+_0x3a891d+'\x22:'+stableStringify(_0x2a4c60[_0x3a891d]));return'{'+_0x275769['join'](',')+'}';}const _0x10ff6d=JSON[_0x201ae1(0x1c9)](_0x34590b);return _0x10ff6d===undefined?_0x201ae1(0x25a):_0x10ff6d;}function activationSignature(_0x4fecd9){const _0x4047f4=a152_0x56096e,_0x49052a={'connection':_0x4fecd9[_0x4047f4(0x1fa)],..._0x4fecd9[_0x4047f4(0x1fe)]!==undefined&&{'all_columns':_0x4fecd9[_0x4047f4(0x1fe)]},..._0x4fecd9[_0x4047f4(0x24f)]!==undefined&&{'columns':_0x4fecd9[_0x4047f4(0x24f)]},..._0x4fecd9[_0x4047f4(0x221)]!==undefined&&{'behavior':_0x4fecd9['behavior']},..._0x4fecd9['schedule']!==undefined&&{'schedule':_0x4fecd9[_0x4047f4(0x164)]},..._0x4fecd9[_0x4047f4(0x1b8)]!==undefined&&{'notification':_0x4fecd9[_0x4047f4(0x1b8)]},..._0x4fecd9[_0x4047f4(0x256)]!==undefined&&{'connector_config':_0x4fecd9[_0x4047f4(0x256)]},..._0x4fecd9[_0x4047f4(0x213)]!==undefined&&{'activation_template_id':_0x4fecd9[_0x4047f4(0x213)]}};return stableStringify(_0x49052a);}async function fetchSegment(_0x5776da,_0x3dccfa,_0x2ee7b6,_0x4d274d){const _0x5c8a75=a152_0x56096e,_0x21e61c=_0x4d274d?.[_0x5c8a75(0x198)](_0x2bf270=>_0x2bf270['id']===_0x2ee7b6);if(_0x21e61c)return _0x21e61c;try{return await _0x5776da[_0x5c8a75(0x232)]['getSegment'](_0x3dccfa,_0x2ee7b6);}catch(_0x3d93f3){logger[_0x5c8a75(0x201)](_0x5c8a75(0x1ce)+_0x2ee7b6+_0x5c8a75(0x1ca)+_0x3d93f3);try{return await _0x5776da['segment']['getSegmentEntity'](_0x2ee7b6);}catch(_0x2917aa){return logger['debug'](_0x5c8a75(0x245)+_0x2ee7b6+':\x20'+_0x2917aa),null;}}}function recoverSegmentIdsFromPushRecovery(_0x2a87f6,_0x96ebc6,_0x1ae15e){const _0x36a145=a152_0x56096e,_0x14d897=readPushRecovery(_0x2a87f6[_0x36a145(0x18a)]);if(_0x14d897?.[_0x36a145(0x184)]===_0x2a87f6[_0x36a145(0x240)]['name'])for(const [_0x513b60,_0x86f69a]of Object[_0x36a145(0x1f3)](_0x14d897[_0x36a145(0x249)])){const _0x1881f6=generateDeterministicJourneySegmentName(_0x2a87f6[_0x36a145(0x240)][_0x36a145(0x1de)],_0x513b60);_0x86f69a[_0x36a145(0x191)]===_0x1881f6&&(_0x96ebc6[_0x36a145(0x19f)](_0x513b60,_0x86f69a[_0x36a145(0x1b5)]),_0x1ae15e['set'](_0x513b60,_0x86f69a[_0x36a145(0x1b5)]));}}async function createOrRecoverEmbeddedSegment(_0x2a9c13,_0x3d8d62,_0x3697c0,_0x46b106){const _0x513498=a152_0x56096e;let _0x5009f1;try{_0x5009f1=await _0x2a9c13[_0x513498(0x232)][_0x513498(0x1c6)]({'name':_0x3697c0['uniqueSegmentName'],'description':_0x3697c0['description'],'journeyId':_0x3697c0[_0x513498(0x1c8)],'rule':_0x46b106(_0x3697c0[_0x513498(0x150)],!![]),'countPopulation':!![],'parentFolderId':_0x3697c0[_0x513498(0x1c2)],'audienceId':_0x3697c0[_0x513498(0x199)]});}catch(_0x105fd9){const _0x4e96c9=_0x105fd9 instanceof Error&&_0x105fd9[_0x513498(0x1aa)]['includes'](_0x513498(0x23e));if(_0x4e96c9){const _0x1d1293=readPushRecovery(_0x3d8d62[_0x513498(0x18a)]),_0x58f6d2=_0x1d1293?.['journeyName']===_0x3d8d62[_0x513498(0x240)][_0x513498(0x1de)]?_0x1d1293[_0x513498(0x249)][_0x3697c0[_0x513498(0x24a)]]:undefined;if(_0x58f6d2?.['uniqueServerName']===_0x3697c0['uniqueSegmentName'])await _0x2a9c13[_0x513498(0x232)][_0x513498(0x15c)](_0x3697c0[_0x513498(0x199)],_0x58f6d2[_0x513498(0x1b5)],{'description':_0x3697c0[_0x513498(0x1c4)],'rule':_0x46b106(_0x3697c0[_0x513498(0x150)],!![]),'countPopulation':!![]}),_0x5009f1=_0x58f6d2[_0x513498(0x1b5)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],_0x513498(0x231)+_0x3697c0[_0x513498(0x24a)]+_0x513498(0x1dd)+(_0x513498(0x17e)+_0x3d8d62[_0x513498(0x18a)][_0x513498(0x216)](/([^/]+)$/,_0x513498(0x1ff))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x105fd9);}else throw _0x105fd9;}return saveSegmentToPushRecovery(_0x3d8d62[_0x513498(0x18a)],_0x3d8d62[_0x513498(0x240)][_0x513498(0x1de)],_0x3697c0[_0x513498(0x24a)],{'segmentId':_0x5009f1,'uniqueServerName':_0x3697c0[_0x513498(0x23a)],'createdAt':new Date()[_0x513498(0x16f)]()}),_0x5009f1;}export async function prepareSegmentFiles(_0x3a42a6,_0x3ecb54,_0x3e9f11,_0x4b7ecc,_0x2a1b1f){const _0x524697=a152_0x56096e,{activationDefToCreateRequest:_0x41a711}=await import(_0x524697(0x22a)),_0xa46348=[],_0x7da6da=new Set();for(const {yamlConfig:_0x9eee7,folderPath:_0x496dff,sourcePath:_0x319ddc}of _0x3a42a6){const _0x4a91e2=resolveTDFolderPath(_0x496dff,_0x4b7ecc,_0x2a1b1f),_0x52fc64=_0x4a91e2+':'+_0x9eee7[_0x524697(0x1de)],_0x2bd4db=_0x3ecb54[_0x524697(0x230)][_0x524697(0x241)](_0x52fc64),_0x5398d2=_0x2bd4db?_0x3ecb54['activationsBySegmentId'][_0x524697(0x241)](_0x2bd4db['id'])||[]:[];addFoldersToCreate(_0x4a91e2,_0x3ecb54[_0x524697(0x15d)],_0x7da6da);const _0x438858=calculateActivationActions(_0x9eee7[_0x524697(0x151)]||[],_0x5398d2,_0x3ecb54[_0x524697(0x254)],_0x3ecb54['connectionIdToNameMap']);for(const _0x549904 of _0x438858){(_0x549904[_0x524697(0x21d)]===_0x524697(0x1d8)||_0x549904[_0x524697(0x21d)]==='update')&&_0x549904['yamlActivation']&&(_0x549904[_0x524697(0x189)]=await _0x41a711(_0x549904[_0x524697(0x1c0)],_0x3e9f11));}const _0x3f750f=calculateSegmentDiff(_0x9eee7,_0x2bd4db,_0x5398d2,_0x3ecb54[_0x524697(0x254)],_0x3ecb54['connectionIdToNameMap']);_0xa46348[_0x524697(0x17f)]({'relativePath':_0x9eee7[_0x524697(0x1de)],'absolutePath':_0x319ddc,'yamlConfig':_0x9eee7,'folderPath':_0x4a91e2,'existingSegment':_0x2bd4db,'existingActivations':_0x5398d2,'isNew':_0x3f750f[_0x524697(0x24c)],'hasChanges':_0x3f750f[_0x524697(0x15b)],'diff':_0x3f750f['diff'],'activationActions':_0x438858});}return{'segmentFiles':_0xa46348,'foldersToCreate':_0x7da6da};}export async function prepareJourneyFiles(_0x249a20,_0xc52406,_0x40e086,_0x1d3a4c){const _0x2a2735=a152_0x56096e,_0x48f20d=[],_0x562f5a=new Set();for(const {yamlConfig:_0x2c3712,folderPath:_0x2b50ef,sourcePath:_0x2d86d3}of _0x249a20){const _0x34f3da=resolveTDFolderPath(_0x2b50ef,_0x40e086,_0x1d3a4c),_0x528daf=_0x34f3da+':'+_0x2c3712[_0x2a2735(0x1de)],_0x54d3ba=_0xc52406[_0x2a2735(0x1d9)][_0x2a2735(0x241)](_0x528daf);let _0x241d4b,_0x45eecc;if(_0x54d3ba&&_0x54d3ba[_0x2a2735(0x1e8)]>0x0){const _0xeaae39=buildLocalExpandedRuleMappings(_0x2c3712),{createYamlContext:_0x2aba9d,prefetchJourneySegments:_0x4e44f7}=createPushYamlContextForBundle(_0xc52406['deps'],_0xc52406[_0x2a2735(0x199)],_0xc52406[_0x2a2735(0x228)],_0xeaae39,_0xc52406[_0x2a2735(0x254)],_0xc52406[_0x2a2735(0x14d)],_0xc52406[_0x2a2735(0x196)],_0xc52406[_0x2a2735(0x190)]);await _0x4e44f7(_0x54d3ba[_0x2a2735(0x1e9)](_0x2c4fb5=>_0x2c4fb5['id']));const _0x3eeab9=await _0xc52406[_0x2a2735(0x166)][_0x2a2735(0x246)][_0x2a2735(0x1b2)](_0x54d3ba[0x0][_0x2a2735(0x1c7)]),_0x39d480=hasMultipleVersions(_0x2c3712),_0x42c52c=async _0x325ccf=>{const _0x13f228=_0x2a2735,_0x5467fc=_0xc52406[_0x13f228(0x190)]?.[_0x13f228(0x241)](_0x325ccf);if(_0x5467fc)return _0x5467fc;return _0xc52406[_0x13f228(0x153)]({'journeyId':_0x325ccf,'journeyName':_0x2c3712[_0x13f228(0x1de)],'isMultiVersion':_0x54d3ba[_0x13f228(0x1e8)]>0x1});};if(_0x39d480&&_0x54d3ba['length']>0x1){const _0x4e6284=[];for(const _0x5d4c55 of _0x54d3ba){const _0x4b8307=_0x5d4c55[_0x2a2735(0x19b)]||0x1;_0xc52406[_0x2a2735(0x212)]?.[_0x2a2735(0x22d)](_0x2a2735(0x1e1)+_0x2c3712['name']+'\x20v'+_0x4b8307);const _0x127fae=await _0x42c52c(_0x5d4c55['id']),_0x515bf7=_0x2aba9d(_0x5d4c55['id']),_0x3ecbe4=await journeyResponseToDef(_0x127fae,_0x515bf7);_0x4e6284[_0x2a2735(0x17f)]({'item':_0x5d4c55,'yaml':_0x3ecbe4});}const _0x57d305=buildLocalRuleToNameMappingFromJourney(_0x2c3712);_0x45eecc=buildMergedJourneyDef(_0x4e6284,_0x57d305,_0x3eeab9);const _0x1498e1=Math[_0x2a2735(0x16c)](..._0x4e6284[_0x2a2735(0x1e9)](_0x5a3ca8=>_0x5a3ca8['item'][_0x2a2735(0x19b)]||0x0)),_0x193a50=_0x54d3ba[_0x2a2735(0x198)](_0x27c01e=>(_0x27c01e['versionNumber']||0x0)===_0x1498e1);_0x193a50&&(_0xc52406[_0x2a2735(0x212)]?.[_0x2a2735(0x22d)](_0x2a2735(0x1e1)+_0x2c3712[_0x2a2735(0x1de)]+'\x20v'+_0x1498e1),_0x241d4b=await _0x42c52c(_0x193a50['id']));}else{const _0xb34bb0=_0x54d3ba[_0x54d3ba[_0x2a2735(0x1e8)]-0x1];_0xc52406[_0x2a2735(0x212)]?.[_0x2a2735(0x22d)]('Fetching\x20'+_0x2c3712['name']),_0x241d4b=await _0x42c52c(_0xb34bb0['id']);const _0xac3f9f=_0x2aba9d(_0xb34bb0['id']),_0x18fa5c=await journeyResponseToDef(_0x241d4b,_0xac3f9f),_0x355038=buildLocalRuleToNameMappingFromJourney(_0x2c3712);_0x45eecc=buildMergedJourneyDef([{'item':_0xb34bb0,'yaml':_0x18fa5c}],_0x355038,_0x3eeab9);}}addFoldersToCreate(_0x34f3da,_0xc52406['folderPathToId'],_0x562f5a);const _0x798222=calculateJourneyDiff(_0x2c3712,_0x45eecc);_0x48f20d[_0x2a2735(0x17f)]({'relativePath':_0x2c3712[_0x2a2735(0x1de)],'absolutePath':_0x2d86d3,'yamlConfig':_0x2c3712,'folderPath':_0x34f3da,'existingJourney':_0x241d4b,'isNew':_0x798222[_0x2a2735(0x24c)],'hasChanges':_0x798222[_0x2a2735(0x15b)],'diff':_0x798222[_0x2a2735(0x247)]});}return{'journeyFiles':_0x48f20d,'foldersToCreate':_0x562f5a};}export function calculateActivationActions(_0x2e0ee2,_0x46a2b5,_0x409f9e,_0x2d6563){const _0x4c6848=a152_0x56096e,_0x10f2af=[],_0x435d4f=new Map();for(const _0x13c7d3 of _0x46a2b5){_0x435d4f[_0x4c6848(0x19f)](_0x13c7d3[_0x4c6848(0x1de)],_0x13c7d3);}const _0x10d6d8=new Map();for(const _0x1f2b25 of _0x2e0ee2){_0x10d6d8[_0x4c6848(0x19f)](_0x1f2b25['name'],_0x1f2b25);}for(const _0x5a9602 of _0x2e0ee2){const _0x540d9a=_0x435d4f[_0x4c6848(0x241)](_0x5a9602['name']);if(!_0x540d9a)_0x10f2af[_0x4c6848(0x17f)]({'type':_0x4c6848(0x1d8),'name':_0x5a9602[_0x4c6848(0x1de)],'yamlActivation':_0x5a9602});else{const _0x50d21b=activationResponseToDef(_0x540d9a,_0x409f9e,_0x2d6563),_0x420414=a152_0xbfd065[_0x4c6848(0x1c9)](_0x50d21b),_0x1f45ce=a152_0xbfd065['stringify'](_0x5a9602);_0x420414!==_0x1f45ce&&_0x10f2af[_0x4c6848(0x17f)]({'type':_0x4c6848(0x22d),'name':_0x5a9602['name'],'yamlActivation':_0x5a9602,'existingActivation':_0x540d9a});}}for(const _0x3f71a8 of _0x46a2b5){!_0x10d6d8[_0x4c6848(0x1ac)](_0x3f71a8[_0x4c6848(0x1de)])&&_0x10f2af[_0x4c6848(0x17f)]({'type':_0x4c6848(0x204),'name':_0x3f71a8['name'],'existingActivation':_0x3f71a8});}return _0x10f2af;}function calculateYamlDiff(_0x41a4cc,_0x3c3947){if(_0x3c3947){const _0x4f61fa=generateDiff(_0x3c3947,_0x41a4cc),_0x5bb7b9=hasChanges(_0x4f61fa);return{'isNew':![],'hasChanges':_0x5bb7b9,'diff':_0x5bb7b9?formatDiffWithColors(_0x4f61fa):undefined};}const _0x4da968=generateDiff('',_0x41a4cc);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x4da968)};}export function calculateSegmentDiff(_0x456672,_0x4b9703,_0x2412fe,_0x413e49,_0x26c553){const _0x330dc3=segmentToYamlString(_0x456672),_0xf6cb3b=_0x4b9703?segmentToYamlString(segmentWithActivationsToYaml(_0x4b9703,_0x2412fe,undefined,_0x413e49,_0x26c553)):undefined;return calculateYamlDiff(_0x330dc3,_0xf6cb3b);}export function calculateJourneyDiff(_0x55ea09,_0x25580d){const _0x34ebbb=normalizeJourneyDef(_0x55ea09,_0x55ea09),_0x56ec75=a152_0x2b0e63(_0x34ebbb),_0x95772b=_0x25580d?a152_0x2b0e63(normalizeJourneyDef(_0x25580d,_0x55ea09)):undefined;return calculateYamlDiff(_0x56ec75,_0x95772b);}export function findSegmentsToDelete(_0x4afac6,_0x2911eb,_0x2ed9e4,_0x452ad3,_0x79df6f){const _0xa4ee05=new Set();for(const {yamlConfig:_0x32ecc6,folderPath:_0x152367}of _0x2911eb){_0xa4ee05['add'](_0x152367+':'+_0x32ecc6['name']);}return _0x4afac6['filter'](_0x56739d=>{const _0x4139d9=a152_0x3f60,_0x51711d=_0x56739d[_0x4139d9(0x18e)]?_0x2ed9e4[_0x4139d9(0x241)](_0x56739d[_0x4139d9(0x18e)][_0x4139d9(0x195)]())||'':'',_0x411aea=_0x51711d+':'+_0x56739d[_0x4139d9(0x1de)];if(_0xa4ee05[_0x4139d9(0x1ac)](_0x411aea))return![];if(_0x79df6f)return _0x51711d===_0x452ad3||_0x51711d[_0x4139d9(0x200)](_0x452ad3+'/');return!![];});}export function findJourneysToDelete(_0x140b9f,_0x31580e,_0x284590,_0x1b50bc,_0x418f9f){const _0x22edf0=a152_0x56096e,_0x8b154d=new Set();for(const {yamlConfig:_0x502311,folderPath:_0xb459b8}of _0x31580e){_0x8b154d[_0x22edf0(0x1bc)](_0xb459b8+':'+_0x502311['name']);}return _0x140b9f[_0x22edf0(0x1e0)](_0x410beb=>{const _0x32d97d=_0x22edf0,_0x423386=_0x410beb[_0x32d97d(0x1c2)]?_0x284590[_0x32d97d(0x241)](_0x410beb['folderId'])||'':'',_0x394ea6=_0x423386+':'+_0x410beb[_0x32d97d(0x1ed)];if(_0x8b154d['has'](_0x394ea6))return![];if(_0x418f9f)return _0x423386===_0x1b50bc||_0x423386[_0x32d97d(0x200)](_0x1b50bc+'/');return!![];});}export function buildSegmentLookupMap(_0xebcbb1,_0x9fb6d4){const _0x2988ed=a152_0x56096e,_0x533de5=new Map();for(const _0x5db29b of _0xebcbb1){const _0x5f3e00=_0x5db29b[_0x2988ed(0x18e)]?_0x9fb6d4[_0x2988ed(0x241)](_0x5db29b[_0x2988ed(0x18e)][_0x2988ed(0x195)]())||'':'',_0xd961d3=_0x5f3e00+':'+_0x5db29b[_0x2988ed(0x1de)];_0x533de5['set'](_0xd961d3,_0x5db29b);}return _0x533de5;}export function buildSegmentNameToIdMap(_0xf6ca8f){const _0x24a8e2=a152_0x56096e,_0x364bcd=new Map();for(const _0x1d6c59 of _0xf6ca8f){_0x364bcd[_0x24a8e2(0x19f)](_0x1d6c59['name'],_0x1d6c59['id']);}return _0x364bcd;}export function buildJourneyBundleLookupMap(_0x20db84,_0x570b53){const _0x19e629=a152_0x56096e,_0x3e0b29=new Map();for(const _0x4a3898 of _0x20db84){const _0x366558=_0x4a3898[_0x19e629(0x1c2)]?_0x570b53[_0x19e629(0x241)](_0x4a3898[_0x19e629(0x1c2)])||'':'',_0x7280a7=_0x366558+':'+_0x4a3898['journeyBundleName'];!_0x3e0b29['has'](_0x7280a7)&&_0x3e0b29[_0x19e629(0x19f)](_0x7280a7,[]),_0x3e0b29[_0x19e629(0x241)](_0x7280a7)[_0x19e629(0x17f)](_0x4a3898);}for(const _0x3b2e4d of _0x3e0b29['values']()){_0x3b2e4d[_0x19e629(0x234)]((_0x4c439b,_0xe2fe87)=>(_0x4c439b[_0x19e629(0x19b)]||0x0)-(_0xe2fe87[_0x19e629(0x19b)]||0x0));}return _0x3e0b29;}export function collectFoldersToCreate(_0x304c56,_0x4c3e6f){const _0x38f6e0=a152_0x56096e,_0x276a01=new Set();for(const _0x100320 of _0x304c56){if(!_0x100320)continue;if(_0x4c3e6f[_0x38f6e0(0x1ac)](_0x100320))continue;const _0xefb073=_0x100320[_0x38f6e0(0x170)]('/');let _0x58fddb='';for(const _0x5b12d3 of _0xefb073){_0x58fddb=_0x58fddb?_0x58fddb+'/'+_0x5b12d3:_0x5b12d3,!_0x4c3e6f[_0x38f6e0(0x1ac)](_0x58fddb)&&_0x276a01[_0x38f6e0(0x1bc)](_0x58fddb);}}return _0x276a01;}export function parseAndClassifyYamlFiles(_0xbd6823,_0x478650,_0x65ca5f){const _0x1a9de6=a152_0x56096e,_0x1cec46=[],_0x417660=[];for(const _0x457676 of _0xbd6823){const _0x212d85=a152_0x51d9c3['relative'](_0x478650,a152_0x51d9c3[_0x1a9de6(0x180)](_0x457676)),_0x39f237=_0x212d85==='.'?'':_0x212d85,_0xb42caa=readFileSync(_0x457676,_0x1a9de6(0x187)),_0x16760d=a152_0xbfd065[_0x1a9de6(0x1d5)](_0xb42caa);if(isJourneyDef(_0x16760d)){const _0x54c4f5=a152_0x3e5f8c(_0xb42caa);_0x417660[_0x1a9de6(0x17f)]({'yamlConfig':_0x54c4f5,'folderPath':_0x39f237,'sourcePath':_0x457676});}else{if(!_0x65ca5f?.[_0x1a9de6(0x25b)]){const _0x574832=parseSegmentYamlFile(_0xb42caa),_0x3585da=normalizeChildSegmentYaml(_0x574832);_0x1cec46[_0x1a9de6(0x17f)]({'yamlConfig':_0x3585da,'folderPath':_0x39f237,'sourcePath':_0x457676});}}}return{'segments':_0x1cec46,'journeys':_0x417660};}export function validateParsedFiles(_0x4315d2,_0x5eaf5a){const _0x4eccb0=a152_0x56096e,_0x484dba=[];for(const {yamlConfig:_0xf56042,sourcePath:_0x4dd8ca}of _0x4315d2[_0x4eccb0(0x249)]){const _0x52ce54=readFileSync(_0x4dd8ca,_0x4eccb0(0x187)),_0x393901=a152_0xbfd065[_0x4eccb0(0x1b1)](_0x52ce54),_0x2f0dfe=validateSegmentDef(_0xf56042,{'source':_0x52ce54,'document':_0x393901},{'skipSchema':!![]});if(!_0x2f0dfe['valid']){const _0xf8bff2=a152_0x51d9c3['relative'](_0x5eaf5a,_0x4dd8ca);_0x484dba['push']({'filePath':_0xf8bff2,'source':_0x52ce54,'result':_0x2f0dfe,'isJourney':![]});}}for(const {yamlConfig:_0x13e976,sourcePath:_0x24b219}of _0x4315d2[_0x4eccb0(0x185)]){const _0x56e946=readFileSync(_0x24b219,_0x4eccb0(0x187)),_0x50d1e2=a152_0xbfd065['parseDocument'](_0x56e946),_0x255c97=validateJourneyDef(_0x13e976,{'source':_0x56e946,'document':_0x50d1e2},{'skipSchema':!![]});if(!_0x255c97['valid']){const _0x409138=a152_0x51d9c3[_0x4eccb0(0x157)](_0x5eaf5a,_0x24b219);_0x484dba[_0x4eccb0(0x17f)]({'filePath':_0x409138,'source':_0x56e946,'result':_0x255c97,'isJourney':!![]});}}return _0x484dba;}export function formatValidationErrors(_0x1d0329){const _0x918429=a152_0x56096e,_0x38a800=[];for(const {filePath:_0xfa63d4,source:_0x3c8239,result:_0x508061,isJourney:_0x209a44}of _0x1d0329){const _0x3ceacb=_0x209a44?_0x918429(0x246):_0x918429(0x232);_0x38a800[_0x918429(0x17f)]('\x0a'+_0xfa63d4+'\x20('+_0x3ceacb+_0x918429(0x1a1)+_0x508061[_0x918429(0x1ea)][_0x918429(0x1e8)]+_0x918429(0x1b3)),_0x38a800[_0x918429(0x17f)](formatValidationResult(_0x508061,_0x3c8239,_0xfa63d4));}return _0x38a800[_0x918429(0x1be)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x56e35c){const _0xee5421=a152_0x56096e,_0x4b41ea=new Set(),_0x338d63=new Map(),_0x4f087a=collectSegmentUsageCounts(_0x56e35c);if(_0x56e35c[_0xee5421(0x249)])for(const [_0x1973b6,_0x3f3f53]of Object[_0xee5421(0x1f3)](_0x56e35c[_0xee5421(0x249)])){_0x4b41ea[_0xee5421(0x1bc)](_0x1973b6);if(_0x3f3f53[_0xee5421(0x1a3)]){const _0xef171a=yamlRuleToApi(_0x3f3f53[_0xee5421(0x1a3)]),_0x36df20=apiRuleToYaml(_0xef171a);_0x338d63[_0xee5421(0x19f)](_0x1973b6,_0x36df20);}}const _0x36f74c=new Map();let _0x2cd82d=0x0;for(const [_0x5368d6,_0x460acb]of _0x338d63){const _0x12d953=serializeExpandedRule(_0x460acb,_0x338d63),_0x5359b9=_0x36f74c[_0xee5421(0x241)](_0x12d953)||[];_0x5359b9[_0xee5421(0x17f)]({'name':_0x5368d6,'index':_0x2cd82d}),_0x36f74c[_0xee5421(0x19f)](_0x12d953,_0x5359b9),_0x2cd82d++;}const _0x2bbf72=new Map();for(const [_0x4e8289,_0x5c4901]of _0x36f74c){const _0xe40f7b=_0x5c4901[_0xee5421(0x1f1)]()[_0xee5421(0x234)]((_0x4b6086,_0x46b588)=>{const _0x421d73=_0xee5421,_0x439ca0=_0x4f087a[_0x421d73(0x241)](_0x4b6086['name'])||0x0,_0x3b45e1=_0x4f087a['get'](_0x46b588[_0x421d73(0x1de)])||0x0;if(_0x439ca0!==_0x3b45e1)return _0x3b45e1-_0x439ca0;return _0x4b6086[_0x421d73(0x1ec)]-_0x46b588['index'];})[_0xee5421(0x1e9)](_0x15f12f=>_0x15f12f[_0xee5421(0x1de)]),_0x569001=[];for(const _0x2919ec of _0xe40f7b){const _0x3487a3=_0x4f087a['get'](_0x2919ec)||0x0,_0x384bcb=Math[_0xee5421(0x16c)](_0x3487a3,0x1);for(let _0x5791df=0x0;_0x5791df<_0x384bcb;_0x5791df++){_0x569001[_0xee5421(0x17f)](_0x2919ec);}}_0x2bbf72['set'](_0x4e8289,_0x569001);}return{'existingLocalSegmentNames':_0x4b41ea,'localSegmentRules':_0x338d63,'localExpandedRuleToNames':_0x2bbf72};}export function createSegmentIdResolver(_0x1b7da8,_0x2b981b){return async _0x2459af=>{const _0x2c9446=a152_0x3f60,_0x2846af=_0x1b7da8[_0x2c9446(0x241)](_0x2459af);if(!_0x2846af)throw new SDKError(ErrorCode[_0x2c9446(0x171)],_0x2c9446(0x21f)+_0x2459af+_0x2c9446(0x18c)+_0x2b981b+'\x27)');return _0x2846af;};}export function extractRootFolderId(_0x3ff31b){const _0x2f20e4=a152_0x56096e;return _0x3ff31b[_0x2f20e4(0x250)]?.[_0x2f20e4(0x1cc)]?.[_0x2f20e4(0x1c3)]?.['id']||_0x3ff31b[_0x2f20e4(0x250)]?.['parentFolder']?.[_0x2f20e4(0x1c3)]?.['id'];}export function buildConnectionMaps(_0x1c9f5d){const _0x23554d=a152_0x56096e,_0x4dc4cd=new Map(),_0x42a13a=new Map(),_0x355330=new Map();for(const _0x2e21ca of _0x1c9f5d){_0x4dc4cd[_0x23554d(0x19f)](_0x2e21ca[_0x23554d(0x1de)],parseInt(_0x2e21ca['id'],0xa)),_0x42a13a['set'](_0x2e21ca['id'],_0x2e21ca[_0x23554d(0x1de)]),_0x355330[_0x23554d(0x19f)](_0x2e21ca['name'],_0x2e21ca[_0x23554d(0x21d)]);}return{'nameToId':_0x4dc4cd,'idToName':_0x42a13a,'nameToType':_0x355330};}export function calculatePushStats(_0x22fa9c,_0x500ce0,_0x3e19b8,_0x927ae8,_0x20fdb3,_0x1e6470,_0x45945c){const _0x48fe60=a152_0x56096e,_0x318130=_0x22fa9c['filter'](_0x2ca949=>_0x2ca949[_0x48fe60(0x24c)]),_0x93416f=_0x22fa9c[_0x48fe60(0x1e0)](_0x88859a=>!_0x88859a[_0x48fe60(0x24c)]&&_0x88859a[_0x48fe60(0x15b)]),_0x576184=_0x22fa9c['filter'](_0x498766=>!_0x498766[_0x48fe60(0x24c)]&&!_0x498766['hasChanges']),_0x2ed0c0=_0x1e6470?_0x927ae8:[],_0x180b06=_0x500ce0[_0x48fe60(0x1e0)](_0x12b05a=>_0x12b05a[_0x48fe60(0x24c)]),_0x5c5639=_0x500ce0[_0x48fe60(0x1e0)](_0x3160fe=>!_0x3160fe[_0x48fe60(0x24c)]&&_0x3160fe[_0x48fe60(0x15b)]),_0x3883de=_0x500ce0['filter'](_0x54f1d3=>!_0x54f1d3[_0x48fe60(0x24c)]&&!_0x54f1d3[_0x48fe60(0x15b)]),_0xbbdf9=_0x1e6470?_0x20fdb3:[],_0x104ece=_0x22fa9c[_0x48fe60(0x152)](_0x2a18bf=>_0x2a18bf[_0x48fe60(0x1a7)]),_0x4cab06=_0x104ece[_0x48fe60(0x1e0)](_0x37c714=>_0x37c714['type']===_0x48fe60(0x1d8)),_0x416563=_0x104ece['filter'](_0x4a8fd0=>_0x4a8fd0[_0x48fe60(0x21d)]===_0x48fe60(0x22d)),_0x5e57a7=_0x104ece['filter'](_0x18a00e=>_0x18a00e[_0x48fe60(0x21d)]===_0x48fe60(0x204)),_0x43e0fe=Array[_0x48fe60(0x154)](_0x3e19b8)[_0x48fe60(0x234)](),_0x23afc2=_0x45945c?![]:_0x318130[_0x48fe60(0x1e8)]>0x0||_0x93416f['length']>0x0||_0x2ed0c0[_0x48fe60(0x1e8)]>0x0,_0x41f5a8=_0x180b06['length']>0x0||_0x5c5639['length']>0x0||_0xbbdf9[_0x48fe60(0x1e8)]>0x0,_0x267f3e=_0x45945c?![]:_0x104ece[_0x48fe60(0x1e8)]>0x0,_0x4cc1ee=_0x43e0fe[_0x48fe60(0x1e8)]>0x0;return{'segments':{'new':_0x318130,'changed':_0x93416f,'unchanged':_0x576184,'toDelete':_0x2ed0c0},'journeys':{'new':_0x180b06,'changed':_0x5c5639,'unchanged':_0x3883de,'toDelete':_0xbbdf9},'activations':{'all':_0x104ece,'toCreate':_0x4cab06,'toUpdate':_0x416563,'toDelete':_0x5e57a7},'folders':{'toCreate':_0x43e0fe},'counts':{'segments':{'new':_0x318130['length'],'changed':_0x93416f[_0x48fe60(0x1e8)],'unchanged':_0x576184[_0x48fe60(0x1e8)],'toDelete':_0x2ed0c0[_0x48fe60(0x1e8)]},'journeys':{'new':_0x180b06['length'],'changed':_0x5c5639[_0x48fe60(0x1e8)],'unchanged':_0x3883de[_0x48fe60(0x1e8)],'toDelete':_0xbbdf9[_0x48fe60(0x1e8)]},'activations':{'create':_0x4cab06[_0x48fe60(0x1e8)],'update':_0x416563[_0x48fe60(0x1e8)],'delete':_0x5e57a7['length']},'folders':_0x43e0fe[_0x48fe60(0x1e8)]},'hasChanges':_0x23afc2||_0x41f5a8||_0x267f3e||_0x4cc1ee};}export async function buildPushExecutionContext(_0x1aecbe,_0x5d790a,_0x2129c3,_0x5ce38c,_0x40a997,_0x38cd62){const _0x3ea330=a152_0x56096e,_0x53ccac=extractRootFolderId(_0x2129c3),{pathToId:_0x196054,idToPath:_0x40705a}=buildFolderMaps(_0x40a997),_0x4a52de=buildSegmentNameToIdMap(_0x5ce38c),_0xaa9cb8=new Map(),{batchAsync:_0x363f2c}=await import('../../utils/async.js'),[_0x3ba475,_0x403583]=await Promise[_0x3ea330(0x177)]([_0x1aecbe[_0x3ea330(0x23d)][_0x3ea330(0x193)](),_0x1aecbe[_0x3ea330(0x1fa)][_0x3ea330(0x167)](),((async()=>{const _0x1ad9e0=_0x3ea330;!_0x38cd62&&_0x5ce38c[_0x1ad9e0(0x1e8)]>0x0&&await _0x363f2c(_0x5ce38c,async _0x270cb7=>{const _0x234422=_0x1ad9e0,_0x1e87f3=await _0x1aecbe['segment'][_0x234422(0x160)](_0x5d790a,_0x270cb7['id']);_0xaa9cb8['set'](_0x270cb7['id'],_0x1e87f3);});})())]),{emailToId:_0x8af3cf,idToEmail:_0x4075b9}=_0x3ba475,_0x5bacf1=buildConnectionMaps(_0x403583);return{'rootFolderId':_0x53ccac,'folderPathToId':_0x196054,'folderIdToPath':_0x40705a,'segmentNameToId':_0x4a52de,'activationsBySegmentId':_0xaa9cb8,'emailToIdMap':_0x8af3cf,'idToEmailMap':_0x4075b9,'connectionNameToIdMap':_0x5bacf1['nameToId'],'connectionIdToNameMap':_0x5bacf1[_0x3ea330(0x182)],'connectionNameToTypeMap':_0x5bacf1[_0x3ea330(0x20f)]};}export function createPushYamlContextForBundle(_0x36a86c,_0x2e23ed,_0x35fbe4,_0x215297,_0xbd8714,_0x4f439f,_0x58649c,_0x562ee0){const {existingLocalSegmentNames:_0x448b04,localExpandedRuleToNames:_0x53d50f}=_0x215297,_0x4acf27=new Set(),_0x549b9c=new Map(),_0x1e424b=new Map(),_0x17bf12=new Map(),_0x33b7c0=createJumpTargetCache(),_0x539c7b=new Map(),_0x5e6058=new Map(),_0x114cfc=new Set();let _0x4ebe4c;const _0x39df87=_0x1e921c=>{const _0x5f311f={'resolveSegment':async _0x5eb480=>{const _0x33e229=a152_0x3f60,_0x4755e1=_0x17bf12[_0x33e229(0x241)](_0x5eb480);if(_0x4755e1!==undefined)return{'name':_0x4755e1,'isJourneyLocal':!![]};try{const _0x15706b=await fetchSegment(_0x36a86c,_0x2e23ed,_0x5eb480,_0x35fbe4);if(!_0x15706b)throw new Error(_0x33e229(0x24d));const _0x2b1218=generateJourneyLocalName(_0x15706b['name']),_0x33f8a4=_0x15706b[_0x33e229(0x1e4)]===SEGMENT_KIND_JOURNEY&&_0x2b1218!==undefined;let _0x54cbe8=_0x15706b[_0x33e229(0x1de)],_0x503949;if(_0x33f8a4&&_0x15706b[_0x33e229(0x1a3)]){const _0x5c6a40=apiRuleToYaml(_0x15706b['rule']);_0x5e6058[_0x33e229(0x19f)](_0x5eb480,_0x5c6a40);const _0x148e4a=async _0x3fd569=>{const _0x2b8f72=_0x33e229,_0xfca2cb=collectSegmentRefsFromRule(_0x3fd569);for(const _0x50754e of _0xfca2cb){if(!_0x5e6058[_0x2b8f72(0x1ac)](_0x50754e))try{const _0x493da6=await fetchSegment(_0x36a86c,_0x2e23ed,_0x50754e,_0x35fbe4);if(_0x493da6?.['rule']){const _0x14e803=apiRuleToYaml(_0x493da6['rule']);_0x5e6058[_0x2b8f72(0x19f)](_0x50754e,_0x14e803),await _0x148e4a(_0x14e803);}}catch(_0x1e86e7){logger[_0x2b8f72(0x201)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x50754e+':\x20'+_0x1e86e7);}}};await _0x148e4a(_0x5c6a40);const _0x450e5d=serializeExpandedRule(_0x5c6a40,_0x5e6058),_0x3b423b=_0x53d50f['get'](_0x450e5d);if(_0x3b423b&&_0x3b423b[_0x33e229(0x1e8)]>0x0){const _0x493eab=_0x549b9c[_0x33e229(0x241)](_0x450e5d)||0x0,_0x563261=_0x3b423b[_0x493eab]||_0x3b423b[_0x3b423b['length']-0x1];_0x549b9c['set'](_0x450e5d,_0x493eab+0x1),_0x54cbe8=_0x563261,_0x4acf27['add'](_0x54cbe8),_0x17bf12[_0x33e229(0x19f)](_0x5eb480,_0x54cbe8);const _0x906764=await resolveRuleSegmentRefs(_0x5c6a40,async _0x23f7dd=>{const _0x260704=_0x33e229,_0x43abd9=_0x17bf12[_0x260704(0x241)](_0x23f7dd);if(_0x43abd9)return _0x43abd9;const _0x42e6d9=await _0x4ebe4c[_0x260704(0x1ae)](_0x23f7dd);return _0x42e6d9['name'];});_0x503949={'description':_0x15706b[_0x33e229(0x1c4)],'rule':_0x906764};}else{const _0x1ee11d=_0x539c7b[_0x33e229(0x241)](_0x450e5d);if(_0x1ee11d)_0x54cbe8=_0x1ee11d,_0x17bf12[_0x33e229(0x19f)](_0x5eb480,_0x54cbe8);else{if(_0x2b1218){let _0x47a5fb=_0x2b1218,_0x43ede1=0x2;while(_0x4acf27[_0x33e229(0x1ac)](_0x47a5fb)||_0x448b04['has'](_0x47a5fb)){_0x47a5fb=_0x2b1218+'_'+_0x43ede1,_0x43ede1++;}_0x4acf27[_0x33e229(0x1bc)](_0x47a5fb),_0x54cbe8=_0x47a5fb;}_0x17bf12[_0x33e229(0x19f)](_0x5eb480,_0x54cbe8),_0x539c7b[_0x33e229(0x19f)](_0x450e5d,_0x54cbe8);const _0x133fd4=await resolveRuleSegmentRefs(_0x5c6a40,async _0x1642e5=>{const _0x4f5b28=_0x33e229,_0x2947f3=_0x17bf12[_0x4f5b28(0x241)](_0x1642e5);if(_0x2947f3)return _0x2947f3;const _0x4d4ec9=await _0x4ebe4c['resolveSegment'](_0x1642e5);return _0x4d4ec9['name'];});_0x503949={'description':_0x15706b[_0x33e229(0x1c4)],'rule':_0x133fd4};}}}return{'name':_0x54cbe8,'isJourneyLocal':_0x33f8a4,'definition':_0x503949};}catch(_0x350438){return logger[_0x33e229(0x201)](_0x33e229(0x22f)+_0x5eb480+':\x20'+_0x350438),{'name':_0x5eb480,'isJourneyLocal':![]};}},'resolveActivation':async _0x42b744=>{const _0x2c1cd8=a152_0x3f60,_0x2ba91f=_0x1e424b[_0x2c1cd8(0x241)](_0x42b744);if(_0x2ba91f!==undefined)return{'name':_0x2ba91f,'isJourneyLocal':!![]};try{let _0x5298fd=_0x58649c?.[_0x2c1cd8(0x241)](_0x42b744);!_0x5298fd&&(_0x5298fd=await _0x36a86c[_0x2c1cd8(0x246)][_0x2c1cd8(0x19a)](_0x1e921c,_0x42b744));const _0x393f88=_0x5298fd[_0x2c1cd8(0x243)]['activationParams'][_0x2c1cd8(0x1de)]||_0x42b744,_0x59ddda=sanitizeYamlKey(_0x393f88)||_0x2c1cd8(0x248)+_0x42b744,_0x5497b9=_0x59ddda;_0x1e424b[_0x2c1cd8(0x19f)](_0x42b744,_0x5497b9);const _0x3059ef=journeyActivationStepToYaml(_0x5298fd,_0xbd8714,_0x4f439f);return{'name':_0x5497b9,'isJourneyLocal':!![],'definition':_0x3059ef};}catch(_0x32b60c){return logger[_0x2c1cd8(0x201)](_0x2c1cd8(0x14f)+_0x42b744+':\x20'+_0x32b60c),{'name':_0x42b744,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x3254b4,_0x5d7409)=>resolveJumpTarget(_0x3254b4,_0x5d7409,_0x33b7c0,async _0x31cd3c=>{const _0x1ef579=a152_0x3f60,_0x5bfc61=_0x562ee0?.[_0x1ef579(0x241)](_0x31cd3c);if(_0x5bfc61)return _0x5bfc61;return _0x36a86c['journey'][_0x1ef579(0x1df)](_0x31cd3c);})};return _0x4ebe4c=_0x5f311f,_0x5f311f;},_0xd2f06f=async _0x22649d=>{const _0x697595=a152_0x3f60,{collectSegmentIdsFromJourneyApi:_0x10c473}=await import(_0x697595(0x168)),{batchAsync:_0x33b414}=await import('../../utils/async.js'),_0x28e31d=new Set();for(const _0x3c5820 of _0x22649d){let _0x5d9fcb=_0x562ee0?.['get'](_0x3c5820);!_0x5d9fcb&&(_0x5d9fcb=await _0x36a86c[_0x697595(0x246)][_0x697595(0x1df)](_0x3c5820));const _0x22a29e=_0x10c473(_0x5d9fcb);for(const _0x409009 of _0x22a29e){_0x28e31d[_0x697595(0x1bc)](_0x409009);}}let _0x59ada2=Array[_0x697595(0x154)](_0x28e31d);while(_0x59ada2['length']>0x0){const _0x1a4871=_0x59ada2[_0x697595(0x1e0)](_0x203f95=>!_0x114cfc['has'](_0x203f95));if(_0x1a4871[_0x697595(0x1e8)]===0x0)break;const _0xed69ee=await _0x33b414(_0x1a4871,async _0x304c12=>{const _0x26dfb7=_0x697595;_0x114cfc[_0x26dfb7(0x1bc)](_0x304c12);const _0x5b0e7e=await fetchSegment(_0x36a86c,_0x2e23ed,_0x304c12,_0x35fbe4);if(!_0x5b0e7e)return null;return{'segmentId':_0x304c12,'segment':_0x5b0e7e};},0xa),_0x519380=new Set();for(const _0x53b85d of _0xed69ee){if(!_0x53b85d?.[_0x697595(0x232)]?.[_0x697595(0x1a3)])continue;const _0x41c62e=apiRuleToYaml(_0x53b85d[_0x697595(0x232)][_0x697595(0x1a3)]);_0x5e6058[_0x697595(0x19f)](_0x53b85d['segmentId'],_0x41c62e);const _0x3d27a7=collectSegmentRefsFromRule(_0x41c62e);for(const _0x85d2e8 of _0x3d27a7){!_0x114cfc[_0x697595(0x1ac)](_0x85d2e8)&&_0x519380[_0x697595(0x1bc)](_0x85d2e8);}}_0x59ada2=Array[_0x697595(0x154)](_0x519380);}};return{'createYamlContext':_0x39df87,'prefetchJourneySegments':_0xd2f06f};}export async function executePushSegments(_0x2cd3c3,_0x2f64dd,_0x4747b4,_0x54430c,_0x4ae6d1){const _0x547d33=a152_0x56096e,{segmentDefToCreateRequest:_0x4f4f15,segmentDefToUpdateRequest:_0x4828c3}=await import('./child-segment-yaml.js'),_0x31faf6=_0x4747b4[_0x547d33(0x15d)],_0x138a63=0x5,_0x2ceb0b=async _0x199ba2=>{const _0x4a269a=_0x547d33,_0x4f781b=_0x199ba2[_0x4a269a(0x252)]?_0x31faf6['get'](_0x199ba2[_0x4a269a(0x252)]):undefined;let _0x1f1384;const _0x3e54ea={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x51972f=_0x199ba2['yamlConfig'];if(_0x199ba2['yamlConfig'][_0x4a269a(0x1a3)]){const _0x596537=createSegmentIdResolver(_0x4747b4[_0x4a269a(0x1a0)],_0x199ba2[_0x4a269a(0x240)][_0x4a269a(0x1de)]),_0x5e7d92=await resolveRuleSegmentIds(_0x199ba2[_0x4a269a(0x240)][_0x4a269a(0x1a3)],_0x596537);_0x51972f={..._0x199ba2['yamlConfig'],'rule':_0x5e7d92};}try{if(_0x199ba2['isNew']){_0x4ae6d1[_0x4a269a(0x233)]?.({'type':'segment_creating','name':_0x199ba2[_0x4a269a(0x240)][_0x4a269a(0x1de)]});const _0x1a3df5=_0x4f4f15(_0x51972f,_0x4f781b),_0x2b408e=await _0x4ae6d1[_0x4a269a(0x165)](_0x4a269a(0x227)+_0x199ba2[_0x4a269a(0x240)][_0x4a269a(0x1de)]+'\x27...',()=>_0x2cd3c3[_0x4a269a(0x232)]['createSegment'](_0x54430c['parentId'],_0x1a3df5));_0x1f1384=_0x2b408e[_0x4a269a(0x1c3)]['id'],_0x4747b4[_0x4a269a(0x1a0)][_0x4a269a(0x19f)](_0x199ba2[_0x4a269a(0x240)]['name'],_0x1f1384),_0x3e54ea['createdSegmentId']={'name':_0x199ba2['yamlConfig'][_0x4a269a(0x1de)],'id':_0x1f1384},_0x4ae6d1['onProgress']?.({'type':_0x4a269a(0x253),'name':_0x199ba2[_0x4a269a(0x240)][_0x4a269a(0x1de)],'segmentId':_0x1f1384}),_0x4ae6d1['logSuccess']?.(_0x4a269a(0x22e)+_0x199ba2[_0x4a269a(0x240)]['name']+'\x27'),_0x3e54ea[_0x4a269a(0x236)]=0x1;}else{if(_0x199ba2[_0x4a269a(0x15b)]){_0x4ae6d1['onProgress']?.({'type':_0x4a269a(0x194),'name':_0x199ba2[_0x4a269a(0x240)]['name']});const _0x3d52a2=_0x4828c3(_0x51972f);_0x4f781b!==_0x199ba2[_0x4a269a(0x159)]?.[_0x4a269a(0x18e)]&&(_0x3d52a2[_0x4a269a(0x18e)]=_0x4f781b?parseInt(_0x4f781b,0xa):undefined),await _0x4ae6d1['withProgress'](_0x4a269a(0x162)+_0x199ba2[_0x4a269a(0x240)][_0x4a269a(0x1de)]+_0x4a269a(0x16b),()=>_0x2cd3c3[_0x4a269a(0x232)][_0x4a269a(0x15c)](_0x54430c[_0x4a269a(0x199)],_0x199ba2['existingSegment']['id'],_0x3d52a2)),_0x1f1384=_0x199ba2[_0x4a269a(0x159)]['id'],_0x4ae6d1['onProgress']?.({'type':_0x4a269a(0x1cf),'name':_0x199ba2[_0x4a269a(0x240)][_0x4a269a(0x1de)]}),_0x4ae6d1[_0x4a269a(0x219)]?.('Updated\x20segment\x20\x27'+_0x199ba2['yamlConfig'][_0x4a269a(0x1de)]+'\x27'),_0x3e54ea[_0x4a269a(0x1f8)]=0x1;}else _0x1f1384=_0x199ba2[_0x4a269a(0x159)]['id'];}}catch(_0x27dff3){const _0xb2011b=isHttp400Error(_0x27dff3),_0x51c106=_0xb2011b?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x4a269a(0x17b)],_0x13ed22=getErrorMessage(_0x27dff3);throw new SDKError(_0x51c106,_0x4a269a(0x1d4)+(_0x199ba2[_0x4a269a(0x24c)]?_0x4a269a(0x1d8):'update')+_0x4a269a(0x186)+_0x199ba2[_0x4a269a(0x18a)]+_0x4a269a(0x229)+_0x13ed22,_0x27dff3);}try{const _0x203ecc=await syncActivationsForSegment(_0x2cd3c3,_0x54430c['parentId'],_0x1f1384,_0x199ba2[_0x4a269a(0x240)][_0x4a269a(0x1de)],_0x199ba2[_0x4a269a(0x1a7)],_0x4ae6d1,_0x199ba2[_0x4a269a(0x18a)]);_0x3e54ea['activations']=_0x203ecc;}catch(_0x320c4f){if(_0x320c4f instanceof SDKError)throw _0x320c4f;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x199ba2[_0x4a269a(0x240)][_0x4a269a(0x1de)]+'\x27\x20from\x20file:\x20'+_0x199ba2[_0x4a269a(0x18a)]+'\x0a\x20\x20'+getErrorMessage(_0x320c4f),_0x320c4f);}return _0x3e54ea;},_0x44570b=await batchAsync(_0x2f64dd,_0x2ceb0b,_0x138a63),_0x89229f={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x10d28d of _0x44570b){_0x89229f[_0x547d33(0x236)]+=_0x10d28d[_0x547d33(0x236)],_0x89229f[_0x547d33(0x1f8)]+=_0x10d28d[_0x547d33(0x1f8)],_0x10d28d[_0x547d33(0x17d)]&&_0x89229f[_0x547d33(0x1f0)][_0x547d33(0x19f)](_0x10d28d[_0x547d33(0x17d)][_0x547d33(0x1de)],_0x10d28d[_0x547d33(0x17d)]['id']),_0x89229f['activations']['created']+=_0x10d28d['activations'][_0x547d33(0x236)],_0x89229f[_0x547d33(0x151)][_0x547d33(0x1f8)]+=_0x10d28d[_0x547d33(0x151)]['updated'],_0x89229f[_0x547d33(0x151)]['deleted']+=_0x10d28d[_0x547d33(0x151)][_0x547d33(0x224)];}return _0x89229f;}async function syncActivationsForSegment(_0x3f335b,_0x4a0bda,_0x3ee6dd,_0x11e02e,_0x2aa226,_0x53fa3d,_0x3cf353){const _0x9d8f15=a152_0x56096e,_0x54cb77={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x392f56 of _0x2aa226){try{if(_0x392f56[_0x9d8f15(0x21d)]===_0x9d8f15(0x1d8)&&_0x392f56[_0x9d8f15(0x189)])_0x53fa3d[_0x9d8f15(0x233)]?.({'type':_0x9d8f15(0x1cb),'segmentName':_0x11e02e,'activationName':_0x392f56['name']}),await _0x53fa3d['withProgress']('Creating\x20activation\x20\x27'+_0x392f56[_0x9d8f15(0x1de)]+_0x9d8f15(0x16b),()=>_0x3f335b[_0x9d8f15(0x232)]['createActivation'](_0x4a0bda,_0x3ee6dd,_0x392f56['validatedRequest'])),_0x53fa3d[_0x9d8f15(0x233)]?.({'type':_0x9d8f15(0x1b9),'segmentName':_0x11e02e,'activationName':_0x392f56[_0x9d8f15(0x1de)]}),_0x53fa3d['logSuccess']?.(_0x9d8f15(0x20d)+_0x392f56[_0x9d8f15(0x1de)]+'\x27'),_0x54cb77[_0x9d8f15(0x236)]++;else{if(_0x392f56['type']==='update'&&_0x392f56[_0x9d8f15(0x189)]&&_0x392f56[_0x9d8f15(0x1d6)])_0x53fa3d['onProgress']?.({'type':_0x9d8f15(0x1f7),'segmentName':_0x11e02e,'activationName':_0x392f56[_0x9d8f15(0x1de)]}),await _0x53fa3d[_0x9d8f15(0x165)](_0x9d8f15(0x1f4)+_0x392f56['name']+'\x27...',()=>_0x3f335b[_0x9d8f15(0x232)]['updateActivation'](_0x4a0bda,_0x3ee6dd,_0x392f56[_0x9d8f15(0x1d6)]['id'],_0x392f56[_0x9d8f15(0x189)])),_0x53fa3d[_0x9d8f15(0x233)]?.({'type':_0x9d8f15(0x210),'segmentName':_0x11e02e,'activationName':_0x392f56[_0x9d8f15(0x1de)]}),_0x53fa3d['logSuccess']?.(_0x9d8f15(0x1b0)+_0x392f56[_0x9d8f15(0x1de)]+'\x27'),_0x54cb77[_0x9d8f15(0x1f8)]++;else _0x392f56[_0x9d8f15(0x21d)]===_0x9d8f15(0x204)&&_0x392f56[_0x9d8f15(0x1d6)]&&(_0x53fa3d[_0x9d8f15(0x233)]?.({'type':_0x9d8f15(0x1fb),'segmentName':_0x11e02e,'activationName':_0x392f56[_0x9d8f15(0x1de)]}),await _0x53fa3d[_0x9d8f15(0x165)](_0x9d8f15(0x20c)+_0x392f56['name']+_0x9d8f15(0x16b),()=>_0x3f335b[_0x9d8f15(0x232)][_0x9d8f15(0x24e)](_0x4a0bda,_0x3ee6dd,_0x392f56[_0x9d8f15(0x1d6)]['id'])),_0x53fa3d[_0x9d8f15(0x233)]?.({'type':'activation_deleted','segmentName':_0x11e02e,'activationName':_0x392f56[_0x9d8f15(0x1de)]}),_0x53fa3d['logDeleted']?.(_0x9d8f15(0x1ab)+_0x392f56['name']+'\x27'),_0x54cb77[_0x9d8f15(0x224)]++);}}catch(_0x3bc366){const _0x2e3a95=isHttp400Error(_0x3bc366),_0x3b920a=_0x2e3a95?ErrorCode[_0x9d8f15(0x1ba)]:ErrorCode[_0x9d8f15(0x242)],_0x40b849=getErrorMessage(_0x3bc366);throw new SDKError(_0x3b920a,_0x9d8f15(0x1d4)+_0x392f56[_0x9d8f15(0x21d)]+_0x9d8f15(0x206)+_0x392f56[_0x9d8f15(0x1de)]+_0x9d8f15(0x1d0)+_0x3cf353+'\x0a\x20\x20'+_0x40b849,_0x3bc366);}}return _0x54cb77;}export async function executePushFolders(_0x53c4fb,_0x96eb48,_0x49d28e,_0x3ddab8,_0x51b8d8){const _0xde44ed=a152_0x56096e,_0x655524=new Map(_0x49d28e),_0x3e70bd=sortFoldersByDepth(_0x96eb48);for(const _0x5c0957 of _0x3e70bd){const _0x5c2a44=_0x5c0957[_0xde44ed(0x170)]('/'),_0x4bcf09=_0x5c2a44[_0x5c2a44['length']-0x1],_0x1eb1df=_0x5c2a44['slice'](0x0,-0x1)[_0xde44ed(0x1be)]('/'),_0x2fa6cd=_0x655524[_0xde44ed(0x241)](_0x1eb1df);_0x51b8d8['onProgress']?.({'type':_0xde44ed(0x1d7),'folder':_0x5c0957});const _0x55d156={'name':_0x4bcf09,'parentFolderId':_0x2fa6cd},_0x412aee=await _0x51b8d8['withProgress'](_0xde44ed(0x215)+_0x5c0957+_0xde44ed(0x16b),()=>_0x53c4fb[_0xde44ed(0x232)][_0xde44ed(0x15e)](_0x3ddab8[_0xde44ed(0x199)],_0x55d156));_0x655524[_0xde44ed(0x19f)](_0x5c0957,_0x412aee[_0xde44ed(0x1c3)]['id']),_0x51b8d8['onProgress']?.({'type':'folder_created','folder':_0x5c0957,'folderId':_0x412aee['data']['id']}),_0x51b8d8[_0xde44ed(0x18b)]?.('Created\x20folder\x20\x27'+_0x5c0957+'\x27');}return _0x655524;}export async function executePushSegmentDeletions(_0x28ac0e,_0x35ad4d,_0x2f778f){const _0xa91df5=a152_0x56096e;if(_0x35ad4d[_0xa91df5(0x1e8)]===0x0)return 0x0;const {batchAsync:_0x474bb6}=await import(_0xa91df5(0x21b)),_0x1cf725=0x5,_0x41cf01=await _0x474bb6(_0x35ad4d,async _0x478c10=>{const _0x579b8d=_0xa91df5;return _0x2f778f[_0x579b8d(0x233)]?.({'type':_0x579b8d(0x158),'name':_0x478c10[_0x579b8d(0x1de)]}),await _0x28ac0e[_0x579b8d(0x232)][_0x579b8d(0x239)](_0x478c10['id']),_0x2f778f[_0x579b8d(0x233)]?.({'type':_0x579b8d(0x172),'name':_0x478c10['name']}),_0x2f778f[_0x579b8d(0x22c)]?.(_0x579b8d(0x181)+_0x478c10[_0x579b8d(0x1de)]+'\x27'),0x1;},_0x1cf725);return _0x41cf01[_0xa91df5(0x21e)]((_0x34a298,_0xa09694)=>_0x34a298+_0xa09694,0x0);}export async function executePushJourneys(_0x3f93f4,_0x4ff1e6,_0x35a9ca,_0x4d90da,_0x2763bc){const _0x1b07ce=a152_0x56096e,{journeyDefToRequest:_0x246cde}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x40226a,yamlRuleToApi:_0x27caaa,validateSegmentRule:_0x24948f}=await import('./child-segment-yaml.js'),_0x4485db={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x11c996=new Map(_0x35a9ca[_0x1b07ce(0x1a0)]),_0x5036e2=0x5;for(let _0x30af83=0x0;_0x30af83<_0x4ff1e6[_0x1b07ce(0x1e8)];_0x30af83+=_0x5036e2){const _0xb4c857=_0x4ff1e6[_0x1b07ce(0x1f1)](_0x30af83,_0x30af83+_0x5036e2),_0x289568=await Promise[_0x1b07ce(0x177)](_0xb4c857[_0x1b07ce(0x1e9)](async _0x1fd749=>{const _0x4f9329=_0x1b07ce;if(!_0x1fd749[_0x4f9329(0x24c)]&&!_0x1fd749[_0x4f9329(0x15b)])return{'action':_0x4f9329(0x1d2),'name':_0x1fd749[_0x4f9329(0x240)][_0x4f9329(0x1de)],'journeyId':_0x1fd749['existingJourney']?.['id']};const _0x50c28b=_0x1fd749[_0x4f9329(0x252)]?_0x35a9ca[_0x4f9329(0x15d)][_0x4f9329(0x241)](_0x1fd749[_0x4f9329(0x252)]):undefined;_0x2763bc['onProgress']?.({'type':_0x1fd749[_0x4f9329(0x24c)]?_0x4f9329(0x223):_0x4f9329(0x217),'name':_0x1fd749[_0x4f9329(0x240)][_0x4f9329(0x1de)]});try{const _0x44940f=await executeSingleJourneyPush(_0x3f93f4,_0x1fd749,{..._0x35a9ca,'segmentNameToId':_0x11c996},{'parentId':_0x4d90da[_0x4f9329(0x199)],'rootFolderId':_0x4d90da['rootFolderId'],'folderId':_0x50c28b,'verbose':_0x4d90da[_0x4f9329(0x214)]},_0x2763bc,{'journeyDefToRequest':_0x246cde,'activationDefToCreateRequest':_0x40226a,'yamlRuleToApi':_0x27caaa,'validateSegmentRule':_0x24948f});for(const [_0x59b336,_0x1c154a]of _0x44940f['embeddedSegmentNameToId']){_0x11c996[_0x4f9329(0x19f)](_0x59b336,_0x1c154a),_0x4485db[_0x4f9329(0x1a8)][_0x4f9329(0x19f)](_0x59b336,_0x1c154a);}if(_0x44940f[_0x4f9329(0x255)]===_0x4f9329(0x236))_0x2763bc[_0x4f9329(0x233)]?.({'type':_0x4f9329(0x203),'name':_0x1fd749['yamlConfig'][_0x4f9329(0x1de)],'journeyId':_0x44940f[_0x4f9329(0x1c8)]}),_0x2763bc[_0x4f9329(0x219)]?.(_0x4f9329(0x218)+_0x1fd749[_0x4f9329(0x240)]['name']+'\x27'),_0x4485db['created']++;else _0x44940f[_0x4f9329(0x255)]===_0x4f9329(0x1f8)&&(_0x2763bc['onProgress']?.({'type':_0x4f9329(0x176),'name':_0x1fd749[_0x4f9329(0x240)][_0x4f9329(0x1de)]}),_0x2763bc['logSuccess']?.(_0x4f9329(0x1d1)+_0x1fd749[_0x4f9329(0x240)][_0x4f9329(0x1de)]+'\x27'),_0x4485db[_0x4f9329(0x1f8)]++);return{'action':_0x44940f['action'],'name':_0x1fd749[_0x4f9329(0x240)][_0x4f9329(0x1de)],'journeyId':_0x44940f[_0x4f9329(0x1c8)]};}catch(_0x170ca1){const _0x211d9d=isHttp400Error(_0x170ca1),_0x3407b0=_0x211d9d?ErrorCode[_0x4f9329(0x1a9)]:ErrorCode[_0x4f9329(0x178)],_0x310add=getErrorMessage(_0x170ca1);throw new SDKError(_0x3407b0,_0x4f9329(0x1d4)+(_0x1fd749[_0x4f9329(0x24c)]?'create':_0x4f9329(0x22d))+_0x4f9329(0x1a4)+_0x1fd749[_0x4f9329(0x18a)]+_0x4f9329(0x229)+_0x310add,_0x170ca1);}}));_0x4485db[_0x1b07ce(0x1b7)][_0x1b07ce(0x17f)](..._0x289568);}return _0x4485db;}async function matchExistingJourneySegments(_0x449a31,_0x5cfd26,_0x42c636,_0x5df482,_0x32feab){const _0x50dfb9=a152_0x56096e;if(!_0x5cfd26[_0x50dfb9(0x20a)]||!_0x5cfd26['yamlConfig'][_0x50dfb9(0x249)])return;const _0x47a5c9=new Map(),_0x3c6149=new Set();for(const _0xfeb610 of Object[_0x50dfb9(0x1f9)](_0x5cfd26[_0x50dfb9(0x240)][_0x50dfb9(0x249)])){const _0x5886ce=generateDeterministicJourneySegmentName(_0x5cfd26['yamlConfig'][_0x50dfb9(0x1de)],_0xfeb610);_0x47a5c9['set'](_0x5886ce,_0xfeb610),_0x3c6149[_0x50dfb9(0x1bc)](_0xfeb610);}const _0x5a9bde=[],_0x17f3d1=collectSegmentIdsFromJourneyApi(_0x5cfd26[_0x50dfb9(0x20a)]);for(const _0xef68b of _0x17f3d1){const _0x1bbaa2=await fetchSegment(_0x449a31,_0x42c636,_0xef68b,_0x5df482);if(!_0x1bbaa2?.[_0x50dfb9(0x1de)])continue;const _0x5b3f18=_0x47a5c9[_0x50dfb9(0x241)](_0x1bbaa2[_0x50dfb9(0x1de)]);_0x5b3f18?(_0x32feab[_0x50dfb9(0x19f)](_0x5b3f18,_0xef68b),_0x3c6149[_0x50dfb9(0x204)](_0x5b3f18)):_0x5a9bde[_0x50dfb9(0x17f)]({'id':_0xef68b,'seg':_0x1bbaa2});}if(_0x3c6149[_0x50dfb9(0x1a6)]>0x0&&_0x5a9bde['length']>0x0){const {localExpandedRuleToNames:_0xa88fab}=buildLocalExpandedRuleMappings(_0x5cfd26['yamlConfig']),_0x1f9176=new Map();for(const {id:_0x402173,seg:_0x12e0b0}of _0x5a9bde){if(_0x12e0b0[_0x50dfb9(0x1a3)]){const _0x301d6d=apiRuleToYaml(_0x12e0b0['rule']);_0x1f9176['set'](_0x402173,_0x301d6d);}}for(const {id:_0x1887d1,seg:_0xba6ea1}of _0x5a9bde){if(!_0xba6ea1[_0x50dfb9(0x1a3)])continue;const _0x48f416=_0x1f9176[_0x50dfb9(0x241)](_0x1887d1);if(!_0x48f416)continue;const _0x7cafc2=serializeExpandedRule(_0x48f416,_0x1f9176),_0x515bcc=_0xa88fab['get'](_0x7cafc2);if(_0x515bcc){const _0x4eb6ee=_0x515bcc['find'](_0x382ecb=>_0x3c6149[_0x50dfb9(0x1ac)](_0x382ecb));_0x4eb6ee&&(_0x32feab['set'](_0x4eb6ee,_0x1887d1),_0x3c6149[_0x50dfb9(0x204)](_0x4eb6ee),logger['debug']('Matched\x20server\x20segment\x20\x27'+_0xba6ea1[_0x50dfb9(0x1de)]+_0x50dfb9(0x1e6)+_0x4eb6ee+_0x50dfb9(0x220)));}}}}async function executeSingleJourneyPush(_0x10d1ec,_0x262ee4,_0x1afa1d,_0x25f9cc,_0x285907,_0x371902){const _0x23add1=a152_0x56096e,{journeyDefToRequest:_0x196eed,activationDefToCreateRequest:_0x23229a,yamlRuleToApi:_0x9b3788,validateSegmentRule:_0x555ce3}=_0x371902,_0x75566=new Map(),_0x21babe=new Map();recoverSegmentIdsFromPushRecovery(_0x262ee4,_0x75566,_0x1afa1d[_0x23add1(0x1a0)]);const _0x4fa0f8=new Map(),_0x35ebca=new Map(),_0x387954=new Map();let _0x2dd85c;const _0x4c81c4=async()=>{const _0x4bf62f=_0x23add1;if(_0x2dd85c)return;_0x2dd85c=new Map();if(!_0x262ee4[_0x4bf62f(0x20a)])return;const _0x3b2a64=await _0x10d1ec[_0x4bf62f(0x246)][_0x4bf62f(0x160)](_0x262ee4[_0x4bf62f(0x20a)]['id']);for(const _0x4ca880 of _0x3b2a64){const _0x1506f7=journeyActivationStepToYaml(_0x4ca880,_0x1afa1d[_0x4bf62f(0x254)],_0x1afa1d['connectionIdToNameMap']),_0xdaa428=activationSignature(_0x1506f7);!_0x2dd85c[_0x4bf62f(0x1ac)](_0xdaa428)&&_0x2dd85c[_0x4bf62f(0x19f)](_0xdaa428,_0x4ca880['id']),_0x1506f7['name']&&_0x21babe[_0x4bf62f(0x19f)](_0x1506f7[_0x4bf62f(0x1de)],_0x4ca880['id']);}};await matchExistingJourneySegments(_0x10d1ec,_0x262ee4,_0x25f9cc[_0x23add1(0x199)],_0x1afa1d[_0x23add1(0x228)],_0x1afa1d['segmentNameToId']);const _0xd84a60={'resolveSegmentId':async _0x7b87d1=>{const _0x2b362c=_0x23add1,_0xad5577=_0x1afa1d[_0x2b362c(0x1a0)]['get'](_0x7b87d1);if(!_0xad5577)throw new SDKError(ErrorCode[_0x2b362c(0x171)],'Segment\x20not\x20found:\x20'+_0x7b87d1+_0x2b362c(0x192)+_0x262ee4['yamlConfig'][_0x2b362c(0x1de)]+')');return _0xad5577;},'resolveEmbeddedSegmentId':async(_0x2f0d49,_0x4a69f3)=>{const _0x358c6c=_0x23add1,_0x297699=_0x1afa1d[_0x358c6c(0x1a0)]['get'](_0x2f0d49);if(_0x297699)return _0x297699;const _0x1824c=_0x1afa1d[_0x358c6c(0x228)][_0x358c6c(0x198)](_0x346bf4=>_0x346bf4['name']===_0x2f0d49);if(_0x1824c)return _0x1afa1d[_0x358c6c(0x1a0)][_0x358c6c(0x19f)](_0x2f0d49,_0x1824c['id']),_0x1824c['id'];if(_0x262ee4[_0x358c6c(0x24c)]){const {stageName:_0x4d07cd,criteriaName:_0x4daad1}=findSegmentCriteriaLocation(_0x262ee4[_0x358c6c(0x240)],_0x2f0d49);return _0x555ce3(_0x2f0d49,_0x4a69f3['rule']),_0x35ebca['set'](_0x2f0d49,{'definition':_0x4a69f3,'stageName':_0x4d07cd,'criteriaName':_0x4daad1}),createPendingSegmentId(_0x2f0d49);}const _0x55e9ed=_0x262ee4[_0x358c6c(0x20a)]?.['id'];if(!_0x55e9ed)throw new SDKError(ErrorCode[_0x358c6c(0x207)],_0x358c6c(0x222));const _0x5f060d=_0x4fa0f8[_0x358c6c(0x241)](_0x2f0d49);if(_0x5f060d)return _0x5f060d;const _0x1efbba=((async()=>{const _0x93d315=_0x358c6c;_0x555ce3(_0x2f0d49,_0x4a69f3[_0x93d315(0x1a3)]);const _0x57b640=generateDeterministicJourneySegmentName(_0x262ee4[_0x93d315(0x240)]['name'],_0x2f0d49),_0x94b28d=_0x1afa1d[_0x93d315(0x228)][_0x93d315(0x198)](_0x3cb6d8=>_0x3cb6d8[_0x93d315(0x1de)]===_0x57b640),_0x331708=createSegmentIdResolver(_0x1afa1d[_0x93d315(0x1a0)],_0x2f0d49),_0x5c7051=await resolveRuleSegmentIds(_0x4a69f3[_0x93d315(0x1a3)],_0x331708);let _0xd20b3;return _0x94b28d?(await _0x10d1ec[_0x93d315(0x232)][_0x93d315(0x15c)](_0x25f9cc[_0x93d315(0x199)],_0x94b28d['id'],{'description':_0x4a69f3['description']||_0x93d315(0x169)+_0x2f0d49,'rule':_0x9b3788(_0x5c7051,!![]),'countPopulation':!![]}),_0xd20b3=_0x94b28d['id'],saveSegmentToPushRecovery(_0x262ee4[_0x93d315(0x18a)],_0x262ee4[_0x93d315(0x240)][_0x93d315(0x1de)],_0x2f0d49,{'segmentId':_0xd20b3,'uniqueServerName':_0x57b640,'createdAt':new Date()[_0x93d315(0x16f)]()})):_0xd20b3=await createOrRecoverEmbeddedSegment(_0x10d1ec,_0x262ee4,{'localName':_0x2f0d49,'uniqueSegmentName':_0x57b640,'description':_0x4a69f3[_0x93d315(0x1c4)]||_0x93d315(0x169)+_0x2f0d49,'journeyId':_0x55e9ed,'resolvedRule':_0x5c7051,'parentId':_0x25f9cc['parentId'],'folderId':_0x25f9cc[_0x93d315(0x163)]||''},_0x9b3788),_0x1afa1d[_0x93d315(0x1a0)][_0x93d315(0x19f)](_0x2f0d49,_0xd20b3),_0x75566[_0x93d315(0x19f)](_0x2f0d49,_0xd20b3),_0xd20b3;})());_0x4fa0f8['set'](_0x2f0d49,_0x1efbba);try{return await _0x1efbba;}finally{_0x4fa0f8[_0x358c6c(0x204)](_0x2f0d49);}},'resolveActivationId':async _0x23ab61=>{const _0x16d67c=_0x23add1,_0x1ce996=_0x21babe[_0x16d67c(0x241)](_0x23ab61);if(_0x1ce996)return _0x1ce996;if(_0x262ee4[_0x16d67c(0x20a)]){await _0x4c81c4();const _0x20c808=_0x21babe[_0x16d67c(0x241)](_0x23ab61);if(_0x20c808)return _0x20c808;}throw new SDKError(ErrorCode[_0x16d67c(0x16d)],_0x16d67c(0x23c)+_0x23ab61+_0x16d67c(0x192)+_0x262ee4['yamlConfig']['name']+_0x16d67c(0x173)+_0x16d67c(0x1e5));},'resolveEmbeddedActivationId':async(_0x5b358d,_0x450dd0)=>{const _0x5671cd=_0x23add1,_0x23048f=_0x21babe[_0x5671cd(0x241)](_0x5b358d);if(_0x23048f)return _0x23048f;if(_0x262ee4['isNew'])return _0x387954['set'](_0x5b358d,_0x450dd0),createPendingActivationId(_0x5b358d);if(_0x262ee4[_0x5671cd(0x20a)]){await _0x4c81c4();const _0x49779a=_0x21babe['get'](_0x450dd0[_0x5671cd(0x1de)]);if(_0x49779a)return _0x21babe[_0x5671cd(0x19f)](_0x5b358d,_0x49779a),_0x49779a;const _0x230196=activationSignature(_0x450dd0),_0x388ef5=_0x2dd85c?.[_0x5671cd(0x241)](_0x230196);if(_0x388ef5)return _0x21babe[_0x5671cd(0x19f)](_0x5b358d,_0x388ef5),_0x388ef5;const _0x3235fb=await _0x23229a(_0x450dd0,_0x1afa1d[_0x5671cd(0x174)]),_0x29bca8={..._0x3235fb,..._0x450dd0[_0x5671cd(0x188)]!==undefined&&{'runAfterJourneyRefresh':_0x450dd0['run_after_journey_refresh']}},_0x436801=await _0x10d1ec[_0x5671cd(0x246)]['createActivation'](_0x262ee4['existingJourney']['id'],_0x29bca8);return _0x21babe[_0x5671cd(0x19f)](_0x5b358d,_0x436801['id']),_0x436801['id'];}throw new SDKError(ErrorCode[_0x5671cd(0x207)],_0x5671cd(0x1cd));},'resolveJourneyId':async _0x1545d9=>{const _0x1daa8f=_0x23add1;try{return await _0x10d1ec[_0x1daa8f(0x246)][_0x1daa8f(0x15a)](_0x25f9cc[_0x1daa8f(0x199)],_0x1545d9);}catch(_0x3e8f0c){throw new SDKError(ErrorCode[_0x1daa8f(0x16d)],_0x1daa8f(0x1db)+_0x1545d9+_0x1daa8f(0x20b)+_0x262ee4[_0x1daa8f(0x240)][_0x1daa8f(0x1de)]+'\x27)',_0x3e8f0c);}},'resolveStageId':async(_0x4ff7e2,_0x2b9656)=>{const _0xbe775b=_0x23add1,_0x5dd856=await _0x10d1ec[_0xbe775b(0x246)][_0xbe775b(0x1df)](_0x4ff7e2),_0x16edca=_0x5dd856['attributes']['journeyStages'][_0xbe775b(0x198)](_0x64870f=>_0x64870f[_0xbe775b(0x1de)]['toLowerCase']()===_0x2b9656[_0xbe775b(0x19d)]());if(!_0x16edca?.['id'])throw new SDKError(ErrorCode[_0xbe775b(0x16d)],_0xbe775b(0x1bb)+_0x2b9656+_0xbe775b(0x23b)+(_0x5dd856['attributes']['journeyBundleName']||_0x5dd856[_0xbe775b(0x243)]['name'])+'\x27');return _0x16edca['id'];}},_0x445f63=await _0x196eed(_0x262ee4[_0x23add1(0x240)],_0x25f9cc[_0x23add1(0x199)],_0xd84a60),_0xed6f7a=_0x25f9cc[_0x23add1(0x1c2)]||_0x25f9cc['rootFolderId'];_0xed6f7a&&(_0x445f63[_0x23add1(0x250)]={'parentFolder':{'data':{'id':_0xed6f7a,'type':'folder'}}});if(_0x262ee4[_0x23add1(0x24c)]){if(_0x35ebca[_0x23add1(0x1a6)]>0x0||_0x387954['size']>0x0)return await executeThreeStepJourneyCreate(_0x10d1ec,_0x262ee4,_0x445f63,{'pendingEmbeddedSegments':_0x35ebca,'pendingEmbeddedActivations':_0x387954,'embeddedSegmentNameToId':_0x75566,'journeyActivationNameToId':_0x21babe},{..._0x25f9cc,'effectiveFolderId':_0xed6f7a},_0x1afa1d,_0x285907,_0x371902);else{ensureJourneyDefaults(_0x445f63[_0x23add1(0x243)]);const _0x11781b=await _0x10d1ec[_0x23add1(0x246)]['create'](_0x445f63);return deletePushRecovery(_0x262ee4[_0x23add1(0x18a)]),{'action':_0x23add1(0x236),'journeyId':_0x11781b['id'],'embeddedSegmentNameToId':_0x75566};}}else{if(_0x262ee4[_0x23add1(0x15b)]&&_0x262ee4[_0x23add1(0x20a)]){_0x445f63['id']=_0x262ee4['existingJourney']['id'];const _0x25d2b9=_0x445f63['attributes'];_0x262ee4['existingJourney'][_0x23add1(0x243)]?.['journeyBundleName']&&(_0x25d2b9['journeyBundleName']=_0x262ee4[_0x23add1(0x20a)][_0x23add1(0x243)][_0x23add1(0x1ed)]);const _0x3e7017=_0x262ee4[_0x23add1(0x20a)][_0x23add1(0x243)]?.[_0x23add1(0x1fc)];return _0x3e7017&&_0x445f63[_0x23add1(0x243)]['journeyStages']&&injectExistingStageIds(_0x445f63[_0x23add1(0x243)][_0x23add1(0x1fc)],_0x3e7017),ensureJourneyDefaults(_0x25d2b9),await _0x10d1ec[_0x23add1(0x246)][_0x23add1(0x22d)](_0x262ee4[_0x23add1(0x20a)]['id'],_0x445f63),deletePushRecovery(_0x262ee4[_0x23add1(0x18a)]),{'action':_0x23add1(0x1f8),'journeyId':_0x262ee4[_0x23add1(0x20a)]['id'],'embeddedSegmentNameToId':_0x75566};}}return deletePushRecovery(_0x262ee4['absolutePath']),{'action':_0x23add1(0x1d2),'journeyId':_0x262ee4[_0x23add1(0x20a)]?.['id'],'embeddedSegmentNameToId':_0x75566};}function findSegmentCriteriaLocation(_0xc9ec70,_0x4a23e){const _0xc0f04a=a152_0x56096e,_0x12a4ae=_0xc9ec70['stages']||_0xc9ec70[_0xc0f04a(0x185)]?.[0x0]?.[_0xc0f04a(0x1ad)]||[];let _0x4e6ab3='entry',_0x3c5e66=_0x4a23e;const _0x47a704=_0xc9ec70[_0xc0f04a(0x205)]||_0xc9ec70[_0xc0f04a(0x185)]?.[0x0]?.['goal'];if(_0x47a704?.['segment']===_0x4a23e)return{'stageName':'goal','criteriaName':_0x47a704[_0xc0f04a(0x1de)]||_0x4a23e};_0x17aa5c:for(const _0x5a8d7b of _0x12a4ae){if(_0x5a8d7b[_0xc0f04a(0x1bf)]?.[_0xc0f04a(0x232)]===_0x4a23e){_0x4e6ab3=_0x5a8d7b['name'],_0x3c5e66=_0x5a8d7b[_0xc0f04a(0x1bf)]['name']||_0x4a23e;break;}if(_0x5a8d7b[_0xc0f04a(0x14e)])for(const _0x3174df of _0x5a8d7b[_0xc0f04a(0x14e)]){if(_0x3174df['type']===_0xc0f04a(0x235)&&_0x3174df[_0xc0f04a(0x1b6)]?.['branches'])for(const _0x5a7606 of _0x3174df[_0xc0f04a(0x1b6)][_0xc0f04a(0x1a2)]){if(_0x5a7606[_0xc0f04a(0x232)]===_0x4a23e){_0x4e6ab3=_0x5a8d7b[_0xc0f04a(0x1de)],_0x3c5e66=_0x5a7606[_0xc0f04a(0x1de)]||_0x4a23e;break _0x17aa5c;}}}}return{'stageName':_0x4e6ab3,'criteriaName':_0x3c5e66};}async function executeThreeStepJourneyCreate(_0x1adee5,_0x4b406c,_0x2a57f7,_0x44b9b7,_0x5dbc86,_0x1a8fa7,_0x1418e3,_0x2421fa){const _0x426b3b=a152_0x56096e,{activationDefToCreateRequest:_0x2ce598,yamlRuleToApi:_0x37a2f3}=_0x2421fa,{pendingEmbeddedSegments:_0x2b2585,pendingEmbeddedActivations:_0x3b6d02,embeddedSegmentNameToId:_0x1f2975}=_0x44b9b7,_0x39dcc7=JSON[_0x426b3b(0x1d5)](JSON[_0x426b3b(0x1c9)](_0x2a57f7));ensureJourneyDefaults(_0x39dcc7['attributes']),stripPendingIds(_0x39dcc7);const _0x3d7199=await _0x1adee5[_0x426b3b(0x246)]['create'](_0x39dcc7),_0x535f2b=_0x3d7199['id'],_0x2129a6=new Map();for(const _0x81becc of _0x3d7199[_0x426b3b(0x243)][_0x426b3b(0x1fc)]){_0x2129a6[_0x426b3b(0x19f)](_0x81becc[_0x426b3b(0x1de)][_0x426b3b(0x19d)](),_0x81becc['id']);}recoverSegmentIdsFromPushRecovery(_0x4b406c,_0x1f2975,_0x1a8fa7[_0x426b3b(0x1a0)]);for(const [_0x1be92d,{definition:_0x5d959d}]of _0x2b2585){if(_0x1f2975['has'](_0x1be92d)){_0x1418e3[_0x426b3b(0x233)]?.({'type':_0x426b3b(0x1eb),'journeyName':_0x4b406c[_0x426b3b(0x240)][_0x426b3b(0x1de)],'segmentName':_0x1be92d});continue;}const _0x44ba85=generateDeterministicJourneySegmentName(_0x4b406c[_0x426b3b(0x240)][_0x426b3b(0x1de)],_0x1be92d);_0x1418e3['onProgress']?.({'type':_0x426b3b(0x16a),'journeyName':_0x4b406c['yamlConfig'][_0x426b3b(0x1de)],'segmentName':_0x1be92d});const _0x12401b=createSegmentIdResolver(_0x1a8fa7[_0x426b3b(0x1a0)],_0x1be92d),_0x51c234=await resolveRuleSegmentIds(_0x5d959d['rule'],_0x12401b),_0x5b9da3=await createOrRecoverEmbeddedSegment(_0x1adee5,_0x4b406c,{'localName':_0x1be92d,'uniqueSegmentName':_0x44ba85,'description':_0x5d959d['description']||_0x426b3b(0x169)+_0x1be92d,'journeyId':_0x535f2b,'resolvedRule':_0x51c234,'parentId':_0x5dbc86[_0x426b3b(0x199)],'folderId':_0x5dbc86[_0x426b3b(0x1ef)]||''},_0x37a2f3);_0x1f2975[_0x426b3b(0x19f)](_0x1be92d,_0x5b9da3),_0x1a8fa7[_0x426b3b(0x1a0)][_0x426b3b(0x19f)](_0x1be92d,_0x5b9da3),_0x1418e3[_0x426b3b(0x233)]?.({'type':_0x426b3b(0x1eb),'journeyName':_0x4b406c[_0x426b3b(0x240)][_0x426b3b(0x1de)],'segmentName':_0x1be92d});}const _0x4e5e5c=new Map();for(const [_0x566f01,_0x5e8009]of _0x3b6d02){_0x1418e3['onProgress']?.({'type':_0x426b3b(0x1f2),'journeyName':_0x4b406c[_0x426b3b(0x240)]['name'],'activationName':_0x566f01});const _0x55bd1f=await _0x2ce598(_0x5e8009,_0x1a8fa7[_0x426b3b(0x174)]),_0x744ce9={..._0x55bd1f,..._0x5e8009[_0x426b3b(0x188)]!==undefined&&{'runAfterJourneyRefresh':_0x5e8009['run_after_journey_refresh']}},_0x9cc626=await _0x1adee5[_0x426b3b(0x246)][_0x426b3b(0x24b)](_0x535f2b,_0x744ce9);_0x4e5e5c[_0x426b3b(0x19f)](_0x566f01,_0x9cc626['id']),_0x44b9b7[_0x426b3b(0x179)]['set'](_0x566f01,_0x9cc626['id']),_0x1418e3[_0x426b3b(0x233)]?.({'type':_0x426b3b(0x211),'journeyName':_0x4b406c['yamlConfig'][_0x426b3b(0x1de)],'activationName':_0x566f01});}const _0xc5ad7f=JSON['parse'](JSON[_0x426b3b(0x1c9)](_0x2a57f7));return _0xc5ad7f['id']=_0x535f2b,ensureJourneyDefaults(_0xc5ad7f['attributes']),resolvePendingIdsInRequest(_0xc5ad7f,_0x2a57f7,_0x2129a6,_0x1f2975,_0x4e5e5c,_0x1418e3),await _0x1adee5['journey'][_0x426b3b(0x22d)](_0x535f2b,_0xc5ad7f),deletePushRecovery(_0x4b406c['absolutePath']),{'action':_0x426b3b(0x236),'journeyId':_0x535f2b,'embeddedSegmentNameToId':_0x1f2975};}export function stripWaitStepPendingIds(_0x1b48eb){const _0x263dbf=a152_0x56096e,_0x27daa2=_0x1b48eb[_0x263dbf(0x259)]&&isPendingSegmentId(_0x1b48eb['conditionSegmentId']),_0x3a1b9e=_0x1b48eb[_0x263dbf(0x16e)]?.[_0x263dbf(0x1e7)](_0x575a5c=>_0x575a5c[_0x263dbf(0x1b5)]&&isPendingSegmentId(_0x575a5c[_0x263dbf(0x1b5)]));(_0x27daa2||_0x3a1b9e)&&(_0x1b48eb[_0x263dbf(0x23f)]='Duration',_0x1b48eb[_0x263dbf(0x238)]=0x1,_0x1b48eb[_0x263dbf(0x1c5)]=_0x263dbf(0x21a),delete _0x1b48eb[_0x263dbf(0x259)],delete _0x1b48eb[_0x263dbf(0x1fd)],delete _0x1b48eb[_0x263dbf(0x1bd)],delete _0x1b48eb[_0x263dbf(0x16e)]);}export function resolveWaitStepPendingIds(_0x5a88ba,_0x54b594,_0x2605d4,_0x54b30f){const _0x5f2d22=a152_0x56096e;if(_0x54b594[_0x5f2d22(0x259)]&&isPendingSegmentId(_0x54b594[_0x5f2d22(0x259)])){const _0x3d4475=_0x2605d4(_0x54b594[_0x5f2d22(0x259)],'stage\x20\x27'+_0x54b30f+_0x5f2d22(0x1ee));_0x3d4475&&(_0x5a88ba[_0x5f2d22(0x23f)]=_0x5f2d22(0x18f),_0x5a88ba[_0x5f2d22(0x259)]=_0x3d4475,delete _0x5a88ba[_0x5f2d22(0x238)],delete _0x5a88ba[_0x5f2d22(0x1c5)],_0x54b594[_0x5f2d22(0x1fd)]!==undefined&&(_0x5a88ba[_0x5f2d22(0x1fd)]=_0x54b594[_0x5f2d22(0x1fd)]),_0x54b594[_0x5f2d22(0x1bd)]&&(_0x5a88ba[_0x5f2d22(0x1bd)]=_0x54b594[_0x5f2d22(0x1bd)]));}if(_0x54b594[_0x5f2d22(0x16e)]){const _0x820c21=_0x54b594['conditions'][_0x5f2d22(0x1e7)](_0x5a5cc1=>_0x5a5cc1[_0x5f2d22(0x1b5)]&&isPendingSegmentId(_0x5a5cc1[_0x5f2d22(0x1b5)]));if(_0x820c21){const _0x103c2d=_0x54b594['conditions'][_0x5f2d22(0x1e9)](_0x199572=>{const _0x232f4d=_0x5f2d22;if(_0x199572[_0x232f4d(0x1b5)]&&isPendingSegmentId(_0x199572[_0x232f4d(0x1b5)])){const _0x5467ff=_0x2605d4(_0x199572[_0x232f4d(0x1b5)],'stage\x20\x27'+_0x54b30f+_0x232f4d(0x1ee));return{..._0x199572,'segmentId':_0x5467ff||_0x199572[_0x232f4d(0x1b5)]};}return{..._0x199572};});_0x5a88ba[_0x5f2d22(0x23f)]='Condition',_0x5a88ba[_0x5f2d22(0x16e)]=_0x103c2d,delete _0x5a88ba[_0x5f2d22(0x238)],delete _0x5a88ba[_0x5f2d22(0x1c5)],delete _0x5a88ba[_0x5f2d22(0x259)],delete _0x5a88ba['conditionTimeoutDuration'],delete _0x5a88ba[_0x5f2d22(0x1bd)];}}}function stripPendingIds(_0x559c78){const _0x224b58=a152_0x56096e;_0x559c78[_0x224b58(0x243)][_0x224b58(0x205)]?.[_0x224b58(0x1b5)]&&isPendingSegmentId(_0x559c78['attributes'][_0x224b58(0x205)][_0x224b58(0x1b5)])&&delete _0x559c78[_0x224b58(0x243)][_0x224b58(0x205)];for(const _0x565b46 of _0x559c78['attributes']['journeyStages']||[]){_0x565b46[_0x224b58(0x197)]?.[_0x224b58(0x1b5)]&&isPendingSegmentId(_0x565b46[_0x224b58(0x197)]['segmentId'])&&delete _0x565b46['entryCriteria'];_0x565b46[_0x224b58(0x208)]?.[_0x224b58(0x1b5)]&&isPendingSegmentId(_0x565b46[_0x224b58(0x208)][_0x224b58(0x1b5)])&&delete _0x565b46['milestone'];_0x565b46[_0x224b58(0x1d3)]&&(_0x565b46['exitCriterias']=_0x565b46[_0x224b58(0x1d3)][_0x224b58(0x1e0)](_0x16378e=>!_0x16378e[_0x224b58(0x1b5)]||!isPendingSegmentId(_0x16378e['segmentId'])));if(_0x565b46[_0x224b58(0x14e)])for(const _0x5c5bb8 of Object[_0x224b58(0x1f9)](_0x565b46['steps'])){const _0x348433=_0x565b46['steps'][_0x5c5bb8];_0x348433['type']===_0x224b58(0x226)&&_0x348433['journeyActivationStepId']&&isPendingActivationId(_0x348433[_0x224b58(0x17c)])&&(_0x348433[_0x224b58(0x17c)]='');if(_0x348433['type']===_0x224b58(0x155)&&_0x348433['branches'])for(const _0x2fd6d9 of _0x348433['branches']){_0x2fd6d9[_0x224b58(0x1b5)]&&isPendingSegmentId(_0x2fd6d9[_0x224b58(0x1b5)])&&(_0x2fd6d9[_0x224b58(0x1b5)]='');}_0x348433['type']===_0x224b58(0x1f5)&&stripWaitStepPendingIds(_0x348433);}}}function a152_0x3f60(_0x4ef396,_0x358c6d){_0x4ef396=_0x4ef396-0x14d;const _0x161f7a=a152_0x161f();let _0x3f6027=_0x161f7a[_0x4ef396];return _0x3f6027;}function resolvePendingIdsInRequest(_0x3935d7,_0x43ee75,_0x13f408,_0x29a058,_0x3807c4,_0x261fb1){const _0x516579=a152_0x56096e,_0x420e19=(_0xf6e465,_0x3cbf21)=>{const _0x5ce9fb=a152_0x3f60;if(!isPendingSegmentId(_0xf6e465))return _0xf6e465;const _0x382520=extractPendingSegmentName(_0xf6e465),_0x205966=_0x29a058['get'](_0x382520);return!_0x205966&&_0x261fb1[_0x5ce9fb(0x1c1)]?.(_0x5ce9fb(0x21c)+_0x382520+_0x5ce9fb(0x1da)+_0x3cbf21),_0x205966;};if(_0x3935d7[_0x516579(0x243)][_0x516579(0x205)]?.[_0x516579(0x1b5)]&&isPendingSegmentId(_0x3935d7[_0x516579(0x243)]['goal'][_0x516579(0x1b5)])){const _0x1593a7=_0x420e19(_0x3935d7['attributes'][_0x516579(0x205)][_0x516579(0x1b5)],_0x516579(0x18d));_0x1593a7&&(_0x3935d7[_0x516579(0x243)][_0x516579(0x205)][_0x516579(0x1b5)]=_0x1593a7);}for(const _0x2e9e05 of _0x3935d7[_0x516579(0x243)][_0x516579(0x1fc)]||[]){const _0x1b363e=_0x13f408[_0x516579(0x241)](_0x2e9e05[_0x516579(0x1de)][_0x516579(0x19d)]());_0x1b363e&&(_0x2e9e05['id']=_0x1b363e);if(_0x2e9e05[_0x516579(0x197)]?.[_0x516579(0x1b5)]&&isPendingSegmentId(_0x2e9e05[_0x516579(0x197)][_0x516579(0x1b5)])){const _0x2f9537=_0x420e19(_0x2e9e05['entryCriteria'][_0x516579(0x1b5)],'stage\x20\x27'+_0x2e9e05[_0x516579(0x1de)]+_0x516579(0x1b4));_0x2f9537&&(_0x2e9e05['entryCriteria']['segmentId']=_0x2f9537);}if(_0x2e9e05['exitCriterias'])for(const _0x3436e8 of _0x2e9e05[_0x516579(0x1d3)]){if(_0x3436e8[_0x516579(0x1b5)]&&isPendingSegmentId(_0x3436e8[_0x516579(0x1b5)])){const _0x29c0ad=_0x420e19(_0x3436e8[_0x516579(0x1b5)],_0x516579(0x15f)+_0x2e9e05[_0x516579(0x1de)]+'\x27\x20exit\x20criteria');_0x29c0ad&&(_0x3436e8[_0x516579(0x1b5)]=_0x29c0ad);}}if(_0x2e9e05[_0x516579(0x208)]?.['segmentId']&&isPendingSegmentId(_0x2e9e05['milestone']['segmentId'])){const _0x5f5953=_0x420e19(_0x2e9e05['milestone'][_0x516579(0x1b5)],_0x516579(0x15f)+_0x2e9e05[_0x516579(0x1de)]+_0x516579(0x19c));_0x5f5953&&(_0x2e9e05[_0x516579(0x208)][_0x516579(0x1b5)]=_0x5f5953);}if(_0x2e9e05[_0x516579(0x14e)]){const _0x5e0f1b=_0x45c0d7=>_0x43ee75[_0x516579(0x243)]['journeyStages']?.[_0x516579(0x198)](_0x67b8bf=>_0x67b8bf[_0x516579(0x1de)][_0x516579(0x19d)]()===_0x2e9e05['name'][_0x516579(0x19d)]())?.[_0x516579(0x14e)]?.[_0x45c0d7];for(const _0xe1558d of Object[_0x516579(0x1f9)](_0x2e9e05[_0x516579(0x14e)])){const _0x301523=_0x2e9e05[_0x516579(0x14e)][_0xe1558d],_0xb2b2e4=_0x5e0f1b(_0xe1558d);if(_0x301523[_0x516579(0x21d)]==='Activation'&&_0x301523[_0x516579(0x17c)]&&(isPendingActivationId(_0x301523[_0x516579(0x17c)])||_0x301523[_0x516579(0x17c)]==='')){if(_0xb2b2e4?.[_0x516579(0x17c)]&&isPendingActivationId(_0xb2b2e4['journeyActivationStepId'])){const _0x31ba01=extractPendingActivationName(_0xb2b2e4['journeyActivationStepId']),_0x3d1f1b=_0x3807c4[_0x516579(0x241)](_0x31ba01);_0x3d1f1b&&(_0x301523['journeyActivationStepId']=_0x3d1f1b);}}if(_0x301523[_0x516579(0x21d)]===_0x516579(0x155)&&_0x301523['branches']&&_0xb2b2e4?.[_0x516579(0x1a2)])for(let _0x50f19e=0x0;_0x50f19e<_0x301523['branches']['length'];_0x50f19e++){const _0x392dc6=_0x301523[_0x516579(0x1a2)][_0x50f19e],_0x3cdf2b=_0xb2b2e4[_0x516579(0x1a2)][_0x50f19e];if(_0x3cdf2b?.[_0x516579(0x1b5)]&&isPendingSegmentId(_0x3cdf2b['segmentId'])){const _0x4b491c=_0x420e19(_0x3cdf2b['segmentId'],_0x516579(0x15f)+_0x2e9e05[_0x516579(0x1de)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x392dc6[_0x516579(0x1de)]||_0x50f19e)+'\x27');_0x4b491c&&(_0x392dc6['segmentId']=_0x4b491c);}}_0x301523['type']===_0x516579(0x1f5)&&_0xb2b2e4?.[_0x516579(0x21d)]===_0x516579(0x1f5)&&resolveWaitStepPendingIds(_0x301523,_0xb2b2e4,_0x420e19,_0x2e9e05[_0x516579(0x1de)]);}}}}
@@ -1 +1 @@
1
- function a153_0x2525(_0x285426,_0x4db367){_0x285426=_0x285426-0x175;const _0x5cd607=a153_0x5cd6();let _0x25253a=_0x5cd607[_0x285426];return _0x25253a;}(function(_0x12c9ff,_0x53ef92){const _0x53da24=a153_0x2525,_0x574a12=_0x12c9ff();while(!![]){try{const _0x192b0b=-parseInt(_0x53da24(0x17d))/0x1*(-parseInt(_0x53da24(0x17f))/0x2)+parseInt(_0x53da24(0x175))/0x3*(parseInt(_0x53da24(0x17b))/0x4)+-parseInt(_0x53da24(0x186))/0x5*(-parseInt(_0x53da24(0x177))/0x6)+-parseInt(_0x53da24(0x185))/0x7*(-parseInt(_0x53da24(0x180))/0x8)+parseInt(_0x53da24(0x184))/0x9+parseInt(_0x53da24(0x176))/0xa*(parseInt(_0x53da24(0x17e))/0xb)+-parseInt(_0x53da24(0x179))/0xc;if(_0x192b0b===_0x53ef92)break;else _0x574a12['push'](_0x574a12['shift']());}catch(_0x3aa119){_0x574a12['push'](_0x574a12['shift']());}}}(a153_0x5cd6,0x25dda));export function buildFolderIdToPathMap(_0x10437a){const _0x285ee9=a153_0x2525,_0x2fb789=new Map(),_0x493c04=new Map();for(const _0x1fcc97 of _0x10437a){_0x493c04['set'](_0x1fcc97['id'],_0x1fcc97);}const _0x1680f6=new Set();for(const _0x11dc34 of _0x10437a){!_0x11dc34['parentFolderId']&&_0x1680f6[_0x285ee9(0x178)](_0x11dc34['id']);}function _0x58c708(_0x3827bf){const _0x4ced79=_0x285ee9;if(_0x2fb789[_0x4ced79(0x17c)](_0x3827bf['id']))return _0x2fb789['get'](_0x3827bf['id']);if(_0x1680f6['has'](_0x3827bf['id']))return _0x2fb789['set'](_0x3827bf['id'],''),'';if(_0x3827bf['parentFolderId']){const _0x4a6cbd=_0x493c04[_0x4ced79(0x183)](_0x3827bf[_0x4ced79(0x181)]);if(_0x4a6cbd){const _0x845387=_0x58c708(_0x4a6cbd),_0x1a9a6f=_0x845387?_0x845387+'/'+_0x3827bf[_0x4ced79(0x17a)]:_0x3827bf[_0x4ced79(0x17a)];return _0x2fb789[_0x4ced79(0x182)](_0x3827bf['id'],_0x1a9a6f),_0x1a9a6f;}}const _0x2c9da9=_0x3827bf[_0x4ced79(0x17a)];return _0x2fb789[_0x4ced79(0x182)](_0x3827bf['id'],_0x2c9da9),_0x2c9da9;}for(const _0x36b13b of _0x10437a){_0x58c708(_0x36b13b);}return _0x2fb789;}export function buildFolderPathToIdMap(_0x3793ce){const _0x1fd7ba=a153_0x2525,_0x38acb8=new Map(),_0x3555f5=new Map();for(const _0x550059 of _0x3793ce){_0x3555f5[_0x1fd7ba(0x182)](_0x550059['id'],_0x550059);}const _0x425f78=new Set();for(const _0x38a474 of _0x3793ce){!_0x38a474[_0x1fd7ba(0x181)]&&_0x425f78[_0x1fd7ba(0x178)](_0x38a474['id']);}function _0x548e9f(_0x1d78e2){const _0x536b74=_0x1fd7ba;if(_0x425f78[_0x536b74(0x17c)](_0x1d78e2['id']))return'';if(_0x1d78e2[_0x536b74(0x181)]){const _0x37d530=_0x3555f5[_0x536b74(0x183)](_0x1d78e2[_0x536b74(0x181)]);if(_0x37d530){const _0x9f1e89=_0x548e9f(_0x37d530);return _0x9f1e89?_0x9f1e89+'/'+_0x1d78e2['name']:_0x1d78e2['name'];}}return _0x1d78e2[_0x536b74(0x17a)];}for(const _0x4912af of _0x3793ce){const _0x2d1bba=_0x548e9f(_0x4912af);_0x38acb8[_0x1fd7ba(0x182)](_0x2d1bba,_0x4912af['id']);}return _0x38acb8;}function a153_0x5cd6(){const _0x141b1f=['99302JjpWns','2865WXwEkH','155457bcgjiT','3057290boCovq','1734vHtwZS','add','13343544PCudRf','name','20vGrHsK','has','2ZgvJBR','11IwNefh','261910PmvmEQ','8DneqCE','parentFolderId','set','get','2344887LlTXgj'];a153_0x5cd6=function(){return _0x141b1f;};return a153_0x5cd6();}export function buildFolderMaps(_0x26f67e){const _0x40c370=a153_0x2525,_0x4c2b2b=buildFolderIdToPathMap(_0x26f67e),_0x33c72f=new Map();for(const [_0x262009,_0xf0c9fa]of _0x4c2b2b){_0x33c72f[_0x40c370(0x182)](_0xf0c9fa,_0x262009);}return{'idToPath':_0x4c2b2b,'pathToId':_0x33c72f};}export function getFolderPath(_0x5bbad0,_0x3d8bdb){if(!_0x5bbad0)return'';return _0x3d8bdb['get'](_0x5bbad0)??'';}
1
+ (function(_0x23873d,_0x274373){const _0x538d73=a153_0x1661,_0x4890ce=_0x23873d();while(!![]){try{const _0x24fcad=-parseInt(_0x538d73(0xb1))/0x1*(-parseInt(_0x538d73(0xa4))/0x2)+-parseInt(_0x538d73(0xab))/0x3*(-parseInt(_0x538d73(0xa0))/0x4)+-parseInt(_0x538d73(0xaa))/0x5*(parseInt(_0x538d73(0x9f))/0x6)+-parseInt(_0x538d73(0xa3))/0x7*(-parseInt(_0x538d73(0xa5))/0x8)+-parseInt(_0x538d73(0xac))/0x9*(-parseInt(_0x538d73(0xad))/0xa)+parseInt(_0x538d73(0xa1))/0xb+-parseInt(_0x538d73(0xa2))/0xc*(parseInt(_0x538d73(0xa7))/0xd);if(_0x24fcad===_0x274373)break;else _0x4890ce['push'](_0x4890ce['shift']());}catch(_0x37515e){_0x4890ce['push'](_0x4890ce['shift']());}}}(a153_0x1873,0xefbc1));export function buildFolderIdToPathMap(_0x105971){const _0x3a959c=a153_0x1661,_0x262288=new Map(),_0x225e49=new Map();for(const _0x380ee3 of _0x105971){_0x225e49[_0x3a959c(0xa9)](_0x380ee3['id'],_0x380ee3);}const _0x9a29de=new Set();for(const _0x5a8b4c of _0x105971){!_0x5a8b4c[_0x3a959c(0xaf)]&&_0x9a29de['add'](_0x5a8b4c['id']);}function _0x2c30bf(_0x197e62){const _0x4f491c=_0x3a959c;if(_0x262288[_0x4f491c(0xae)](_0x197e62['id']))return _0x262288[_0x4f491c(0xa8)](_0x197e62['id']);if(_0x9a29de[_0x4f491c(0xae)](_0x197e62['id']))return _0x262288[_0x4f491c(0xa9)](_0x197e62['id'],''),'';if(_0x197e62[_0x4f491c(0xaf)]){const _0xedec1e=_0x225e49['get'](_0x197e62[_0x4f491c(0xaf)]);if(_0xedec1e){const _0x3145de=_0x2c30bf(_0xedec1e),_0x18dfb0=_0x3145de?_0x3145de+'/'+_0x197e62[_0x4f491c(0xa6)]:_0x197e62['name'];return _0x262288['set'](_0x197e62['id'],_0x18dfb0),_0x18dfb0;}}const _0x5c69ed=_0x197e62['name'];return _0x262288[_0x4f491c(0xa9)](_0x197e62['id'],_0x5c69ed),_0x5c69ed;}for(const _0x54ecf1 of _0x105971){_0x2c30bf(_0x54ecf1);}return _0x262288;}function a153_0x1873(){const _0x26faac=['has','parentFolderId','add','34KMzrzA','10031790gUalDH','91932qVtHwo','4384347cFIoUN','83364OWJAks','28KeSKMp','108378LVygIJ','2612552DsvtoW','name','2652UHmrlb','get','set','5NOSGHp','63VWHtCJ','46332SsDcXG','80gofKXH'];a153_0x1873=function(){return _0x26faac;};return a153_0x1873();}export function buildFolderPathToIdMap(_0x69ea37){const _0x2234a1=a153_0x1661,_0x114f59=new Map(),_0x281525=new Map();for(const _0x17e046 of _0x69ea37){_0x281525[_0x2234a1(0xa9)](_0x17e046['id'],_0x17e046);}const _0x51afb9=new Set();for(const _0x52b282 of _0x69ea37){!_0x52b282[_0x2234a1(0xaf)]&&_0x51afb9[_0x2234a1(0xb0)](_0x52b282['id']);}function _0x3b1e46(_0x3ecb7a){const _0x3d500b=_0x2234a1;if(_0x51afb9[_0x3d500b(0xae)](_0x3ecb7a['id']))return'';if(_0x3ecb7a['parentFolderId']){const _0x2b0fb2=_0x281525[_0x3d500b(0xa8)](_0x3ecb7a[_0x3d500b(0xaf)]);if(_0x2b0fb2){const _0x9cd958=_0x3b1e46(_0x2b0fb2);return _0x9cd958?_0x9cd958+'/'+_0x3ecb7a[_0x3d500b(0xa6)]:_0x3ecb7a[_0x3d500b(0xa6)];}}return _0x3ecb7a[_0x3d500b(0xa6)];}for(const _0x319063 of _0x69ea37){const _0x291b14=_0x3b1e46(_0x319063);_0x114f59[_0x2234a1(0xa9)](_0x291b14,_0x319063['id']);}return _0x114f59;}function a153_0x1661(_0x128c8b,_0xcfa30b){_0x128c8b=_0x128c8b-0x9f;const _0x187370=a153_0x1873();let _0x1661bf=_0x187370[_0x128c8b];return _0x1661bf;}export function buildFolderMaps(_0x552195){const _0x542579=a153_0x1661,_0x1d00a6=buildFolderIdToPathMap(_0x552195),_0x4211a8=new Map();for(const [_0x590c4e,_0x454162]of _0x1d00a6){_0x4211a8[_0x542579(0xa9)](_0x454162,_0x590c4e);}return{'idToPath':_0x1d00a6,'pathToId':_0x4211a8};}export function getFolderPath(_0x17bda3,_0x392662){const _0x28700d=a153_0x1661;if(!_0x17bda3)return'';return _0x392662[_0x28700d(0xa8)](_0x17bda3)??'';}
@@ -1 +1 @@
1
- (function(_0xe0642b,_0xe5e9df){const _0x31ef7d=a154_0x55fe,_0x4c74b5=_0xe0642b();while(!![]){try{const _0xeddb21=parseInt(_0x31ef7d(0x13e))/0x1*(-parseInt(_0x31ef7d(0x143))/0x2)+-parseInt(_0x31ef7d(0x159))/0x3*(-parseInt(_0x31ef7d(0x139))/0x4)+-parseInt(_0x31ef7d(0x154))/0x5+parseInt(_0x31ef7d(0x137))/0x6+-parseInt(_0x31ef7d(0x160))/0x7*(parseInt(_0x31ef7d(0x14d))/0x8)+parseInt(_0x31ef7d(0x15a))/0x9*(-parseInt(_0x31ef7d(0x149))/0xa)+parseInt(_0x31ef7d(0x151))/0xb;if(_0xeddb21===_0xe5e9df)break;else _0x4c74b5['push'](_0x4c74b5['shift']());}catch(_0x169ff0){_0x4c74b5['push'](_0x4c74b5['shift']());}}}(a154_0x225f,0x62fe2));import a154_0x285bf7 from'path';import{parse as a154_0x269aef}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0xfedfbd){const _0x318eee=a154_0x55fe;if(!_0xfedfbd||_0xfedfbd[_0x318eee(0x155)]()==='')throw new Error(_0x318eee(0x141));const _0x101062=_0xfedfbd[_0x318eee(0x155)]();if(_0x101062==='/')return{'segments':[],'isAbsolute':!![],'raw':_0xfedfbd};const _0x51b153=_0x101062[_0x318eee(0x152)]('/')?_0x101062['substring'](0x1):_0x101062,_0x365201=_0x51b153['split']('/')[_0x318eee(0x142)](_0x55c473=>_0x55c473!=='');if(_0x365201[_0x318eee(0x157)]===0x0)throw new Error(_0x318eee(0x153));const _0x532b81=_0x101062[_0x318eee(0x152)]('/')||!isRelativePathSegment(_0x365201[0x0]);for(const _0x3ffe80 of _0x365201){validatePathSegment(_0x3ffe80);}return{'segments':_0x365201,'isAbsolute':_0x532b81,'raw':_0xfedfbd};}function isRelativePathSegment(_0xbfe08a){return _0xbfe08a==='.'||_0xbfe08a==='..';}function a154_0x225f(){const _0x5665c6=['3832PxBOXX','push','slice','No\x20tdx.json\x20found\x20for\x20file:\x20','test','381911nFvbig','Cannot\x20navigate\x20above\x20root','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Path\x20cannot\x20be\x20empty','filter','4uqlZMB','resolve','segments','journey','exists','File\x20not\x20found:\x20','67420VvKitr','tdx.json','join','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','16UhiFDR','pop','Cannot\x20split\x20empty\x20path','Path\x20segment\x20cannot\x20be\x20empty','14175205sWgOwH','startsWith','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','2417135DloXii','trim','parse','length','isAbsolute','2028OmtthJ','234lDHSFR','type','Path\x20attempts\x20to\x20navigate\x20above\x20root','segment','dirname','readFile','2009945aCGKuV','root','endsWith','2796132yRDAHS','raw'];a154_0x225f=function(){return _0x5665c6;};return a154_0x225f();}function validatePathSegment(_0x4278dc){const _0x2c94aa=a154_0x55fe;if(_0x4278dc==='')throw new Error(_0x2c94aa(0x150));if(_0x4278dc==='.'||_0x4278dc==='..')return;if(/[\x00-\x1F\x7F]/[_0x2c94aa(0x13d)](_0x4278dc))throw new Error(_0x2c94aa(0x140)+_0x4278dc);if(_0x4278dc!==_0x4278dc['trim']()){}}export function validatePath(_0x5394bc){const _0x3b7f2c=a154_0x55fe;if(_0x5394bc[_0x3b7f2c(0x145)][_0x3b7f2c(0x157)]===0x0&&!_0x5394bc[_0x3b7f2c(0x158)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x5394bc[_0x3b7f2c(0x158)]){if(_0x5394bc[_0x3b7f2c(0x145)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x4bbf15=0x0;for(const _0x481cf3 of _0x5394bc[_0x3b7f2c(0x145)]){if(_0x481cf3==='..'){if(_0x4bbf15===0x0)throw new Error(_0x3b7f2c(0x15c));_0x4bbf15--;}else _0x481cf3!=='.'&&_0x4bbf15++;}}}export function joinPaths(_0x596b98,_0x403f14){const _0x213034=a154_0x55fe;if(!_0x596b98||_0x596b98==='/')return _0x403f14;if(!_0x403f14||_0x403f14==='.')return _0x596b98;if(_0x403f14[_0x213034(0x152)]('/'))return _0x403f14;const _0x3a891d=parsePath(_0x596b98),_0x549199=parsePath(_0x403f14),_0x54b9ac=[..._0x3a891d[_0x213034(0x145)]];for(const _0x31e057 of _0x549199[_0x213034(0x145)]){if(_0x31e057==='.')continue;else{if(_0x31e057==='..'){if(_0x54b9ac['length']===0x0)throw new Error(_0x213034(0x13f));_0x54b9ac[_0x213034(0x14e)]();}else _0x54b9ac['push'](_0x31e057);}}const _0xe8ef07=_0x54b9ac[_0x213034(0x14b)]('/');return _0x3a891d[_0x213034(0x138)][_0x213034(0x152)]('/')?'/'+_0xe8ef07:_0xe8ef07;}export function normalizePath(_0x8d7b40){const _0x2d0b6b=a154_0x55fe,_0x2616da=parsePath(_0x8d7b40),_0xd55ca5=[];for(const _0x699e13 of _0x2616da[_0x2d0b6b(0x145)]){if(_0x699e13==='.')continue;else{if(_0x699e13==='..'){if(_0xd55ca5['length']===0x0){if(_0x2616da[_0x2d0b6b(0x158)])throw new Error(_0x2d0b6b(0x13f));_0xd55ca5[_0x2d0b6b(0x13a)]('..');}else _0xd55ca5[_0xd55ca5[_0x2d0b6b(0x157)]-0x1]==='..'?_0xd55ca5[_0x2d0b6b(0x13a)]('..'):_0xd55ca5['pop']();}else _0xd55ca5[_0x2d0b6b(0x13a)](_0x699e13);}}if(_0xd55ca5[_0x2d0b6b(0x157)]===0x0)return _0x2616da[_0x2d0b6b(0x158)]?'/':'.';const _0x561ae9=_0xd55ca5['join']('/');return _0x2616da[_0x2d0b6b(0x138)][_0x2d0b6b(0x152)]('/')?'/'+_0x561ae9:_0x561ae9;}export function getParentPath(_0x5f191d){const _0x1e3bed=a154_0x55fe,_0x57609e=parsePath(_0x5f191d);if(_0x57609e[_0x1e3bed(0x145)][_0x1e3bed(0x157)]<=0x1)return'/';const _0x301c00=_0x57609e['segments']['slice'](0x0,-0x1)['join']('/');return _0x57609e[_0x1e3bed(0x138)][_0x1e3bed(0x152)]('/')?'/'+_0x301c00:_0x301c00;}function a154_0x55fe(_0x13ace0,_0x370e2f){_0x13ace0=_0x13ace0-0x137;const _0x225f44=a154_0x225f();let _0x55fe3b=_0x225f44[_0x13ace0];return _0x55fe3b;}export function getBaseName(_0x2c10e7){const _0x3593e3=a154_0x55fe,_0x381aa4=parsePath(_0x2c10e7);return _0x381aa4[_0x3593e3(0x145)][_0x381aa4['segments'][_0x3593e3(0x157)]-0x1]||'';}export function isChildPath(_0x662bbf,_0x10a218){const _0x130199=a154_0x55fe,_0x47aa8f=parsePath(_0x662bbf),_0x1a815a=parsePath(_0x10a218);if(_0x47aa8f[_0x130199(0x145)][_0x130199(0x157)]<=_0x1a815a['segments'][_0x130199(0x157)])return![];for(let _0x52e83c=0x0;_0x52e83c<_0x1a815a[_0x130199(0x145)][_0x130199(0x157)];_0x52e83c++){if(_0x47aa8f['segments'][_0x52e83c]!==_0x1a815a[_0x130199(0x145)][_0x52e83c])return![];}return!![];}export function splitPath(_0x2628d6){const _0x230dcb=a154_0x55fe,_0x8c05e9=parsePath(_0x2628d6);if(_0x8c05e9[_0x230dcb(0x145)][_0x230dcb(0x157)]===0x0)throw new Error(_0x230dcb(0x14f));if(_0x8c05e9[_0x230dcb(0x145)][_0x230dcb(0x157)]===0x1)return{'parent':_0x8c05e9[_0x230dcb(0x145)][0x0]};return{'parent':_0x8c05e9[_0x230dcb(0x145)][0x0],'child':_0x8c05e9[_0x230dcb(0x145)][_0x230dcb(0x13b)](0x1)[_0x230dcb(0x14b)]('/')};}export function isYamlFilePath(_0x1f24d9){const _0x1a1f26=a154_0x55fe;return _0x1f24d9[_0x1a1f26(0x162)]('.yml')||_0x1f24d9[_0x1a1f26(0x162)]('.yaml');}export async function resolveYamlFilePath(_0x2f4c05,_0x570f2e=nodeFileSystem){const _0x116ad0=a154_0x55fe,_0x1dac70=a154_0x285bf7[_0x116ad0(0x144)](_0x2f4c05);if(!await _0x570f2e[_0x116ad0(0x147)](_0x1dac70))throw new Error(_0x116ad0(0x148)+_0x2f4c05);let _0x39ecdb=a154_0x285bf7[_0x116ad0(0x15e)](_0x1dac70),_0x2669c0=null,_0x18fe32=null;const _0x9c004=a154_0x285bf7['parse'](_0x39ecdb)[_0x116ad0(0x161)];while(_0x39ecdb!==_0x9c004){const _0x140a9f=a154_0x285bf7[_0x116ad0(0x14b)](_0x39ecdb,_0x116ad0(0x14a));if(await _0x570f2e['exists'](_0x140a9f)){_0x2669c0=_0x140a9f,_0x18fe32=_0x39ecdb;break;}_0x39ecdb=a154_0x285bf7[_0x116ad0(0x15e)](_0x39ecdb);}if(!_0x2669c0||!_0x18fe32)throw new Error(_0x116ad0(0x13c)+_0x2f4c05+'\x0a'+_0x116ad0(0x14c));const _0x4b21e9=await _0x570f2e[_0x116ad0(0x15f)](_0x2669c0),_0x24c528=JSON[_0x116ad0(0x156)](_0x4b21e9),_0x207bd4=_0x24c528['parent_segment'];if(!_0x207bd4)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x49b6c5=await _0x570f2e['readFile'](_0x1dac70),_0x1c7561=a154_0x269aef(_0x49b6c5),_0x1cb633=_0x1c7561['name'];if(!_0x1cb633)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x2f4c05);const _0x51ac9a=_0x1c7561[_0x116ad0(0x15b)]===_0x116ad0(0x146)?_0x116ad0(0x146):_0x116ad0(0x15d),_0x31d1e0=a154_0x285bf7['relative'](_0x18fe32,_0x1dac70),_0x2b8138=a154_0x285bf7[_0x116ad0(0x15e)](_0x31d1e0),_0x589b82=_0x2b8138==='.'?'':_0x2b8138['replace'](/\\/g,'/'),_0x5e6506=_0x589b82?_0x207bd4+'/'+_0x589b82+'/'+_0x1cb633:_0x207bd4+'/'+_0x1cb633;return{'parentSegment':_0x207bd4,'segmentName':_0x1cb633,'folderPath':_0x589b82,'fullPath':_0x5e6506,'resourceType':_0x51ac9a,'content':_0x49b6c5};}
1
+ (function(_0x2cbafe,_0x3e8978){const _0x11385f=a154_0x1c6d,_0xbbfb5d=_0x2cbafe();while(!![]){try{const _0x3f9d05=parseInt(_0x11385f(0xba))/0x1+-parseInt(_0x11385f(0xb3))/0x2*(parseInt(_0x11385f(0xc9))/0x3)+-parseInt(_0x11385f(0xb8))/0x4*(parseInt(_0x11385f(0xd3))/0x5)+-parseInt(_0x11385f(0xb6))/0x6+-parseInt(_0x11385f(0xcd))/0x7*(-parseInt(_0x11385f(0xc3))/0x8)+parseInt(_0x11385f(0xbf))/0x9+parseInt(_0x11385f(0xca))/0xa;if(_0x3f9d05===_0x3e8978)break;else _0xbbfb5d['push'](_0xbbfb5d['shift']());}catch(_0x1020cc){_0xbbfb5d['push'](_0xbbfb5d['shift']());}}}(a154_0x289d,0x73d89));import a154_0x44e749 from'path';function a154_0x1c6d(_0x1e5ab9,_0x2d7356){_0x1e5ab9=_0x1e5ab9-0xad;const _0x289df4=a154_0x289d();let _0x1c6d2c=_0x289df4[_0x1e5ab9];return _0x1c6d2c;}function a154_0x289d(){const _0x1837ee=['Path\x20segment\x20cannot\x20be\x20empty','filter','384447UMWmqJ','name','push','split','journey','isAbsolute','605IzZIjs','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','slice','readFile','parse','length','replace','pop','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','resolve','raw','startsWith','Cannot\x20navigate\x20above\x20root','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','segments','tdx.json','segment','2mKACEp','type','Cannot\x20split\x20empty\x20path','2100198uMLCeF','File\x20not\x20found:\x20','18992ipmeQz','Relative\x20path\x20cannot\x20be\x20empty','115856XCsLji','exists','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Path\x20cannot\x20be\x20empty','parent_segment','7355205Tdcexn','join','endsWith','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','80DWXDLZ','relative','root','dirname','Path\x20attempts\x20to\x20navigate\x20above\x20root','trim','2413227RTKrrr','7211440alfRqn'];a154_0x289d=function(){return _0x1837ee;};return a154_0x289d();}import{parse as a154_0x3a1277}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x4154b1){const _0x243767=a154_0x1c6d;if(!_0x4154b1||_0x4154b1[_0x243767(0xc8)]()==='')throw new Error(_0x243767(0xbd));const _0x177317=_0x4154b1[_0x243767(0xc8)]();if(_0x177317==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x4154b1};const _0x2de63d=_0x177317[_0x243767(0xad)]('/')?_0x177317['substring'](0x1):_0x177317,_0x13b1e8=_0x2de63d[_0x243767(0xd0)]('/')[_0x243767(0xcc)](_0x2a128e=>_0x2a128e!=='');if(_0x13b1e8[_0x243767(0xd8)]===0x0)throw new Error(_0x243767(0xd4));const _0x4eb382=_0x177317[_0x243767(0xad)]('/')||!isRelativePathSegment(_0x13b1e8[0x0]);for(const _0x1a6258 of _0x13b1e8){validatePathSegment(_0x1a6258);}return{'segments':_0x13b1e8,'isAbsolute':_0x4eb382,'raw':_0x4154b1};}function isRelativePathSegment(_0x1cf324){return _0x1cf324==='.'||_0x1cf324==='..';}function validatePathSegment(_0x340a71){const _0x439411=a154_0x1c6d;if(_0x340a71==='')throw new Error(_0x439411(0xcb));if(_0x340a71==='.'||_0x340a71==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x340a71))throw new Error(_0x439411(0xaf)+_0x340a71);if(_0x340a71!==_0x340a71[_0x439411(0xc8)]()){}}export function validatePath(_0x15138e){const _0x1f2fa0=a154_0x1c6d;if(_0x15138e['segments']['length']===0x0&&!_0x15138e['isAbsolute'])throw new Error(_0x1f2fa0(0xb9));if(_0x15138e['isAbsolute']){if(_0x15138e[_0x1f2fa0(0xb0)][0x0]==='..')throw new Error(_0x1f2fa0(0xc2));let _0x32004e=0x0;for(const _0x57b951 of _0x15138e[_0x1f2fa0(0xb0)]){if(_0x57b951==='..'){if(_0x32004e===0x0)throw new Error(_0x1f2fa0(0xc7));_0x32004e--;}else _0x57b951!=='.'&&_0x32004e++;}}}export function joinPaths(_0xc71cc9,_0x5f003b){const _0xcbb662=a154_0x1c6d;if(!_0xc71cc9||_0xc71cc9==='/')return _0x5f003b;if(!_0x5f003b||_0x5f003b==='.')return _0xc71cc9;if(_0x5f003b[_0xcbb662(0xad)]('/'))return _0x5f003b;const _0x1dc194=parsePath(_0xc71cc9),_0x121f21=parsePath(_0x5f003b),_0x16b719=[..._0x1dc194[_0xcbb662(0xb0)]];for(const _0x28124b of _0x121f21[_0xcbb662(0xb0)]){if(_0x28124b==='.')continue;else{if(_0x28124b==='..'){if(_0x16b719[_0xcbb662(0xd8)]===0x0)throw new Error(_0xcbb662(0xae));_0x16b719[_0xcbb662(0xda)]();}else _0x16b719[_0xcbb662(0xcf)](_0x28124b);}}const _0x33580a=_0x16b719[_0xcbb662(0xc0)]('/');return _0x1dc194[_0xcbb662(0xdd)][_0xcbb662(0xad)]('/')?'/'+_0x33580a:_0x33580a;}export function normalizePath(_0x434b01){const _0x1517a6=a154_0x1c6d,_0x11200f=parsePath(_0x434b01),_0x237de6=[];for(const _0xa430a3 of _0x11200f['segments']){if(_0xa430a3==='.')continue;else{if(_0xa430a3==='..'){if(_0x237de6[_0x1517a6(0xd8)]===0x0){if(_0x11200f[_0x1517a6(0xd2)])throw new Error(_0x1517a6(0xae));_0x237de6[_0x1517a6(0xcf)]('..');}else _0x237de6[_0x237de6[_0x1517a6(0xd8)]-0x1]==='..'?_0x237de6[_0x1517a6(0xcf)]('..'):_0x237de6['pop']();}else _0x237de6[_0x1517a6(0xcf)](_0xa430a3);}}if(_0x237de6[_0x1517a6(0xd8)]===0x0)return _0x11200f['isAbsolute']?'/':'.';const _0x2f723a=_0x237de6[_0x1517a6(0xc0)]('/');return _0x11200f[_0x1517a6(0xdd)][_0x1517a6(0xad)]('/')?'/'+_0x2f723a:_0x2f723a;}export function getParentPath(_0x4b2ff8){const _0x6ab9bf=a154_0x1c6d,_0x15f14a=parsePath(_0x4b2ff8);if(_0x15f14a['segments']['length']<=0x1)return'/';const _0x2e809a=_0x15f14a[_0x6ab9bf(0xb0)][_0x6ab9bf(0xd5)](0x0,-0x1)[_0x6ab9bf(0xc0)]('/');return _0x15f14a[_0x6ab9bf(0xdd)][_0x6ab9bf(0xad)]('/')?'/'+_0x2e809a:_0x2e809a;}export function getBaseName(_0x46a367){const _0x50e124=a154_0x1c6d,_0x465d85=parsePath(_0x46a367);return _0x465d85[_0x50e124(0xb0)][_0x465d85[_0x50e124(0xb0)]['length']-0x1]||'';}export function isChildPath(_0x4f7aeb,_0x420193){const _0x5b32fe=a154_0x1c6d,_0x232d42=parsePath(_0x4f7aeb),_0x433da5=parsePath(_0x420193);if(_0x232d42[_0x5b32fe(0xb0)][_0x5b32fe(0xd8)]<=_0x433da5[_0x5b32fe(0xb0)][_0x5b32fe(0xd8)])return![];for(let _0x125a98=0x0;_0x125a98<_0x433da5['segments'][_0x5b32fe(0xd8)];_0x125a98++){if(_0x232d42['segments'][_0x125a98]!==_0x433da5[_0x5b32fe(0xb0)][_0x125a98])return![];}return!![];}export function splitPath(_0x37c575){const _0x39063f=a154_0x1c6d,_0x5617c8=parsePath(_0x37c575);if(_0x5617c8['segments'][_0x39063f(0xd8)]===0x0)throw new Error(_0x39063f(0xb5));if(_0x5617c8['segments'][_0x39063f(0xd8)]===0x1)return{'parent':_0x5617c8[_0x39063f(0xb0)][0x0]};return{'parent':_0x5617c8['segments'][0x0],'child':_0x5617c8[_0x39063f(0xb0)]['slice'](0x1)[_0x39063f(0xc0)]('/')};}export function isYamlFilePath(_0x1a90be){const _0x4cbc5e=a154_0x1c6d;return _0x1a90be['endsWith']('.yml')||_0x1a90be[_0x4cbc5e(0xc1)]('.yaml');}export async function resolveYamlFilePath(_0x76ef8d,_0x154872=nodeFileSystem){const _0x28208a=a154_0x1c6d,_0x348d79=a154_0x44e749[_0x28208a(0xdc)](_0x76ef8d);if(!await _0x154872[_0x28208a(0xbb)](_0x348d79))throw new Error(_0x28208a(0xb7)+_0x76ef8d);let _0x4cb620=a154_0x44e749[_0x28208a(0xc6)](_0x348d79),_0xfeab37=null,_0x52cda3=null;const _0x2a3b59=a154_0x44e749[_0x28208a(0xd7)](_0x4cb620)[_0x28208a(0xc5)];while(_0x4cb620!==_0x2a3b59){const _0x27732b=a154_0x44e749['join'](_0x4cb620,_0x28208a(0xb1));if(await _0x154872[_0x28208a(0xbb)](_0x27732b)){_0xfeab37=_0x27732b,_0x52cda3=_0x4cb620;break;}_0x4cb620=a154_0x44e749[_0x28208a(0xc6)](_0x4cb620);}if(!_0xfeab37||!_0x52cda3)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x76ef8d+'\x0a'+_0x28208a(0xbc));const _0x4ea886=await _0x154872[_0x28208a(0xd6)](_0xfeab37),_0xfd4895=JSON['parse'](_0x4ea886),_0x1de21c=_0xfd4895[_0x28208a(0xbe)];if(!_0x1de21c)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x2c6a9a=await _0x154872[_0x28208a(0xd6)](_0x348d79),_0xf4cef5=a154_0x3a1277(_0x2c6a9a),_0x3ea410=_0xf4cef5[_0x28208a(0xce)];if(!_0x3ea410)throw new Error(_0x28208a(0xdb)+_0x76ef8d);const _0x1324f6=_0xf4cef5[_0x28208a(0xb4)]===_0x28208a(0xd1)?_0x28208a(0xd1):_0x28208a(0xb2),_0x113744=a154_0x44e749[_0x28208a(0xc4)](_0x52cda3,_0x348d79),_0x351856=a154_0x44e749[_0x28208a(0xc6)](_0x113744),_0x3bab50=_0x351856==='.'?'':_0x351856[_0x28208a(0xd9)](/\\/g,'/'),_0x5b754f=_0x3bab50?_0x1de21c+'/'+_0x3bab50+'/'+_0x3ea410:_0x1de21c+'/'+_0x3ea410;return{'parentSegment':_0x1de21c,'segmentName':_0x3ea410,'folderPath':_0x3bab50,'fullPath':_0x5b754f,'resourceType':_0x1324f6,'content':_0x2c6a9a};}
@@ -1 +1 @@
1
- function a155_0x4e4a(_0x5f33d6,_0x3a3fc3){_0x5f33d6=_0x5f33d6-0xfa;const _0x101314=a155_0x1013();let _0x4e4a71=_0x101314[_0x5f33d6];return _0x4e4a71;}function a155_0x1013(){const _0x227749=['Invalid\x20segment\x20reference\x20format:\x20','6VQtaMg','631492JjrYge','5301Rzdemv','692625rBWjZk','1lvhCCY','818153JdRdUr','302674mohOma','144328kVmRIo','.\x20Child\x20name\x20cannot\x20be\x20empty','indexOf','990110RrQeLm','9zhKaei','substring'];a155_0x1013=function(){return _0x227749;};return a155_0x1013();}(function(_0x5a6990,_0x30a325){const _0x389f6a=a155_0x4e4a,_0x57b509=_0x5a6990();while(!![]){try{const _0x1b538f=parseInt(_0x389f6a(0x106))/0x1*(parseInt(_0x389f6a(0xfa))/0x2)+-parseInt(_0x389f6a(0x104))/0x3+parseInt(_0x389f6a(0x103))/0x4+-parseInt(_0x389f6a(0x105))/0x5+-parseInt(_0x389f6a(0x102))/0x6*(parseInt(_0x389f6a(0x107))/0x7)+-parseInt(_0x389f6a(0xfb))/0x8*(parseInt(_0x389f6a(0xff))/0x9)+parseInt(_0x389f6a(0xfe))/0xa;if(_0x1b538f===_0x30a325)break;else _0x57b509['push'](_0x57b509['shift']());}catch(_0x135b47){_0x57b509['push'](_0x57b509['shift']());}}}(a155_0x1013,0x20791));export function parseSegmentRef(_0x4c37ab){const _0x13b743=a155_0x4e4a,_0x58ba98=_0x4c37ab[_0x13b743(0xfd)]('/');if(_0x58ba98===-0x1)return{'parentId':_0x4c37ab};if(_0x58ba98===0x0)throw new Error(_0x13b743(0x101)+_0x4c37ab+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x496b01=_0x4c37ab[_0x13b743(0x100)](0x0,_0x58ba98),_0x5f42ce=_0x4c37ab[_0x13b743(0x100)](_0x58ba98+0x1);if(_0x5f42ce==='')throw new Error(_0x13b743(0x101)+_0x4c37ab+_0x13b743(0xfc));return{'parentId':_0x496b01,'childId':_0x5f42ce};}
1
+ (function(_0x323e14,_0x54ee37){const _0x4b13cc=a155_0x39a2,_0x4f8275=_0x323e14();while(!![]){try{const _0xd52629=-parseInt(_0x4b13cc(0xbc))/0x1*(parseInt(_0x4b13cc(0xbe))/0x2)+-parseInt(_0x4b13cc(0xc8))/0x3+parseInt(_0x4b13cc(0xc4))/0x4*(parseInt(_0x4b13cc(0xc5))/0x5)+-parseInt(_0x4b13cc(0xbf))/0x6+parseInt(_0x4b13cc(0xc7))/0x7*(parseInt(_0x4b13cc(0xc2))/0x8)+parseInt(_0x4b13cc(0xc1))/0x9+parseInt(_0x4b13cc(0xc6))/0xa;if(_0xd52629===_0x54ee37)break;else _0x4f8275['push'](_0x4f8275['shift']());}catch(_0xf49fa8){_0x4f8275['push'](_0x4f8275['shift']());}}}(a155_0x3d14,0xb2e0b));function a155_0x3d14(){const _0x4d4364=['substring','17700WhJGhR','760wiuXbZ','11612530nxbLpb','3318686ZFGlQD','4163901GnEfZg','1gBPwOs','indexOf','2566518CSiUoU','2965320BqzGiO','Invalid\x20segment\x20reference\x20format:\x20','5777838VyzhXV','24bbKoFg'];a155_0x3d14=function(){return _0x4d4364;};return a155_0x3d14();}function a155_0x39a2(_0x554454,_0x5027a3){_0x554454=_0x554454-0xbc;const _0x3d140a=a155_0x3d14();let _0x39a29e=_0x3d140a[_0x554454];return _0x39a29e;}export function parseSegmentRef(_0x7dcfd7){const _0x57d5a0=a155_0x39a2,_0x58fe63=_0x7dcfd7[_0x57d5a0(0xbd)]('/');if(_0x58fe63===-0x1)return{'parentId':_0x7dcfd7};if(_0x58fe63===0x0)throw new Error(_0x57d5a0(0xc0)+_0x7dcfd7+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0xbe9661=_0x7dcfd7[_0x57d5a0(0xc3)](0x0,_0x58fe63),_0x54c8b8=_0x7dcfd7['substring'](_0x58fe63+0x1);if(_0x54c8b8==='')throw new Error(_0x57d5a0(0xc0)+_0x7dcfd7+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0xbe9661,'childId':_0x54c8b8};}