@treasuredata/tdx 2026.3.28 → 2026.3.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/policy-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.js +1 -1
  55. package/dist/core/auth.js +1 -1
  56. package/dist/core/command-output.js +1 -1
  57. package/dist/core/config.js +1 -1
  58. package/dist/core/connection-cache.js +1 -1
  59. package/dist/core/constants.js +1 -1
  60. package/dist/core/credential-cache.js +1 -1
  61. package/dist/core/global-context.js +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/oauth-keychain.js +1 -1
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/core/user-cache.js +1 -1
  69. package/dist/core/version.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/mcp/server.js +1 -1
  72. package/dist/mcp/tools/index.js +1 -1
  73. package/dist/mcp/tools/tdx-run.js +1 -1
  74. package/dist/mcp/tools/tdx-search.js +1 -1
  75. package/dist/mcp/utils.js +1 -1
  76. package/dist/proxy/claude-usage-tracker.js +1 -1
  77. package/dist/proxy/passthrough-server.js +1 -1
  78. package/dist/proxy/sse-usage-parser.js +1 -1
  79. package/dist/sdk/agent/agent-config.js +1 -1
  80. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  81. package/dist/sdk/agent/agent-yaml.js +1 -1
  82. package/dist/sdk/agent/test/evaluator.js +1 -1
  83. package/dist/sdk/agent/test/executor.js +1 -1
  84. package/dist/sdk/agent/test/index.js +1 -1
  85. package/dist/sdk/agent/test/output.js +1 -1
  86. package/dist/sdk/agent/test/parser.js +1 -1
  87. package/dist/sdk/agent/tool-target-registry.js +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/delivery-api-client.js +1 -1
  91. package/dist/sdk/client/endpoints.js +1 -1
  92. package/dist/sdk/client/engage-api-client.js +1 -1
  93. package/dist/sdk/client/http-client.js +1 -1
  94. package/dist/sdk/client/llm-api-client.js +1 -1
  95. package/dist/sdk/client/oauth-refresh.js +1 -1
  96. package/dist/sdk/client/rate-limiter.js +1 -1
  97. package/dist/sdk/client/td-api-client.js +1 -1
  98. package/dist/sdk/client/trino-api-client.js +1 -1
  99. package/dist/sdk/client/workflow-client.js +1 -1
  100. package/dist/sdk/connection-validator.js +1 -1
  101. package/dist/sdk/connection.js +1 -1
  102. package/dist/sdk/delivery.js +1 -1
  103. package/dist/sdk/engage/campaign-pull.js +1 -1
  104. package/dist/sdk/engage/campaign-push.js +1 -1
  105. package/dist/sdk/engage/campaign-validator.js +1 -1
  106. package/dist/sdk/engage/campaign-yaml.js +1 -1
  107. package/dist/sdk/engage/template-pull.js +1 -1
  108. package/dist/sdk/engage/template-push.js +1 -1
  109. package/dist/sdk/engage/template-validator.js +1 -1
  110. package/dist/sdk/engage/template-yaml.js +1 -1
  111. package/dist/sdk/engage/types/campaign-def.js +1 -1
  112. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  113. package/dist/sdk/engage/types/template-schema.js +1 -1
  114. package/dist/sdk/engage.js +1 -1
  115. package/dist/sdk/errors.js +1 -1
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/io/index.js +1 -1
  118. package/dist/sdk/io/node-filesystem.js +1 -1
  119. package/dist/sdk/job.js +1 -1
  120. package/dist/sdk/journey.js +1 -1
  121. package/dist/sdk/llm/chat-cache.js +1 -1
  122. package/dist/sdk/llm/index.js +1 -1
  123. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  124. package/dist/sdk/llm/model-factors.js +1 -1
  125. package/dist/sdk/personalization.js +1 -1
  126. package/dist/sdk/policy.js +1 -1
  127. package/dist/sdk/query/index.js +1 -1
  128. package/dist/sdk/query/sql-parser.js +1 -1
  129. package/dist/sdk/realtime.js +1 -1
  130. package/dist/sdk/schedule.js +1 -1
  131. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  132. package/dist/sdk/segment/fields-display.js +1 -1
  133. package/dist/sdk/segment/file-discovery.js +1 -1
  134. package/dist/sdk/segment/journey-utils.js +1 -1
  135. package/dist/sdk/segment/journey-validator.js +1 -1
  136. package/dist/sdk/segment/journey-yaml.js +1 -1
  137. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  138. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  139. package/dist/sdk/segment/pull-workflow.js +1 -1
  140. package/dist/sdk/segment/push-recovery.js +1 -1
  141. package/dist/sdk/segment/push-workflow.js +1 -1
  142. package/dist/sdk/segment/resolution-context.js +1 -1
  143. package/dist/sdk/segment/segment-path-parser.js +1 -1
  144. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  145. package/dist/sdk/segment/segment-validator.js +1 -1
  146. package/dist/sdk/segment/target-resolution.js +1 -1
  147. package/dist/sdk/segment/tdx-config.js +1 -1
  148. package/dist/sdk/segment/types/activation-schema.js +1 -1
  149. package/dist/sdk/segment/types/journey-def.js +1 -1
  150. package/dist/sdk/segment/types/journey-schema.js +1 -1
  151. package/dist/sdk/segment/types/segment-def.js +1 -1
  152. package/dist/sdk/segment/types/segment-schema.js +1 -1
  153. package/dist/sdk/segment/validate-files.js +1 -1
  154. package/dist/sdk/segment/yaml-validator.js +1 -1
  155. package/dist/sdk/segment.js +1 -1
  156. package/dist/sdk/types/index.js +1 -1
  157. package/dist/sdk/types/progress.js +1 -1
  158. package/dist/sdk/user.js +1 -1
  159. package/dist/sdk/util/format-detector.js +1 -1
  160. package/dist/sdk/util/formatters.js +1 -1
  161. package/dist/sdk/util/index.js +1 -1
  162. package/dist/sdk/util/paginate.js +1 -1
  163. package/dist/sdk/util/tree-formatter.js +1 -1
  164. package/dist/sdk/workflow/archive-validation.js +1 -1
  165. package/dist/sdk/workflow/clone-workflow.js +1 -1
  166. package/dist/sdk/workflow/index.js +1 -1
  167. package/dist/sdk/workflow/pull-workflow.js +1 -1
  168. package/dist/sdk/workflow/push-workflow.js +1 -1
  169. package/dist/sdk/workflow/tdx-config.js +1 -1
  170. package/dist/sdk/workflow/workflow-utils.js +1 -1
  171. package/dist/test-utils/command-runner.js +1 -1
  172. package/dist/test-utils/factories.js +1 -1
  173. package/dist/test-utils/fixtures.js +1 -1
  174. package/dist/test-utils/http-mock.js +1 -1
  175. package/dist/test-utils/index.js +1 -1
  176. package/dist/utils/async.js +1 -1
  177. package/dist/utils/colors.js +1 -1
  178. package/dist/utils/diff.js +1 -1
  179. package/dist/utils/file-permissions.js +1 -1
  180. package/dist/utils/file-reader.js +1 -1
  181. package/dist/utils/github-releases.js +1 -1
  182. package/dist/utils/global-cache.js +1 -1
  183. package/dist/utils/json-loader.js +1 -1
  184. package/dist/utils/local-cache.js +1 -1
  185. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  186. package/dist/utils/logger/formatters/index.js +1 -1
  187. package/dist/utils/logger/handlers/console-handler.js +1 -1
  188. package/dist/utils/logger/handlers/file-handler.js +1 -1
  189. package/dist/utils/logger/handlers/index.js +1 -1
  190. package/dist/utils/logger/handlers/null-handler.js +1 -1
  191. package/dist/utils/logger/index.js +1 -1
  192. package/dist/utils/logger/logger.js +1 -1
  193. package/dist/utils/logger/types.js +1 -1
  194. package/dist/utils/option-validation.js +1 -1
  195. package/dist/utils/process.js +1 -1
  196. package/dist/utils/prompt.js +1 -1
  197. package/dist/utils/spinner.js +1 -1
  198. package/dist/utils/sse-parser.js +1 -1
  199. package/dist/utils/string-utils.js +1 -1
  200. package/dist/utils/table-ref-parser.js +1 -1
  201. package/dist/utils/tdx-logger.js +1 -1
  202. package/dist/utils/version-check.js +1 -1
  203. package/package.json +1 -1
@@ -1 +1 @@
1
- const a141_0x44ac1d=a141_0x343e;(function(_0x299c28,_0x4b708a){const _0x5c77a3=a141_0x343e,_0x2c8496=_0x299c28();while(!![]){try{const _0xd5aca7=-parseInt(_0x5c77a3(0x18d))/0x1+-parseInt(_0x5c77a3(0x188))/0x2+parseInt(_0x5c77a3(0x18f))/0x3+-parseInt(_0x5c77a3(0x191))/0x4+-parseInt(_0x5c77a3(0x182))/0x5*(-parseInt(_0x5c77a3(0x17c))/0x6)+-parseInt(_0x5c77a3(0x187))/0x7*(parseInt(_0x5c77a3(0x192))/0x8)+parseInt(_0x5c77a3(0x17a))/0x9;if(_0xd5aca7===_0x4b708a)break;else _0x2c8496['push'](_0x2c8496['shift']());}catch(_0x223851){_0x2c8496['push'](_0x2c8496['shift']());}}}(a141_0x2b44,0x33489));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a141_0x85150c from'path';function a141_0x2b44(){const _0x54b7e0=['parse','118459cfsqXG','stringify','7422eGHdll','join','998984NlcWuE','8drpPrd','6682302pmpekt','version','942CHmNVv','.push-recovery.json','debug','toISOString','tdx.sdk.push-recovery','.tmp','12335BzyNuA','journeyName','string','utf-8','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','2467199DgDqte','403104dwgOvi','ENOENT','warn','dirname'];a141_0x2b44=function(){return _0x54b7e0;};return a141_0x2b44();}import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a141_0x44ac1d(0x180));function a141_0x343e(_0x245285,_0x4d5a06){_0x245285=_0x245285-0x17a;const _0x2b4419=a141_0x2b44();let _0x343e06=_0x2b4419[_0x245285];return _0x343e06;}export function getPushRecoveryPath(_0x2b22f0){const _0x1b0653=a141_0x44ac1d,_0x3bc492=a141_0x85150c[_0x1b0653(0x18b)](_0x2b22f0),_0x42fb35=a141_0x85150c['basename'](_0x2b22f0);return a141_0x85150c[_0x1b0653(0x190)](_0x3bc492,'.'+_0x42fb35+_0x1b0653(0x17d));}export function readPushRecovery(_0x221098){const _0x237c9a=a141_0x44ac1d,_0x906107=getPushRecoveryPath(_0x221098);if(!existsSync(_0x906107))return undefined;try{const _0x193b2a=readFileSync(_0x906107,_0x237c9a(0x185)),_0x683859=JSON[_0x237c9a(0x18c)](_0x193b2a);if(_0x683859?.[_0x237c9a(0x17b)]!==0x1||typeof _0x683859[_0x237c9a(0x183)]!==_0x237c9a(0x184))return undefined;return _0x683859;}catch(_0x3b1133){return _0x3b1133 instanceof SyntaxError?logger[_0x237c9a(0x17e)]('Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20'+_0x3b1133):logger[_0x237c9a(0x18a)](_0x237c9a(0x186)+_0x3b1133),undefined;}}export function writePushRecovery(_0x58f22b,_0x55b634){const _0x5d51f6=a141_0x44ac1d,_0x5336b5=getPushRecoveryPath(_0x58f22b),_0x454774=_0x5336b5+_0x5d51f6(0x181);writeFileSync(_0x454774,JSON[_0x5d51f6(0x18e)](_0x55b634,null,0x2)+'\x0a',_0x5d51f6(0x185)),renameSync(_0x454774,_0x5336b5);}export function deletePushRecovery(_0x117e3e){const _0x7454f3=a141_0x44ac1d,_0x261363=getPushRecoveryPath(_0x117e3e);try{unlinkSync(_0x261363);}catch(_0x156b89){_0x156b89['code']!==_0x7454f3(0x189)&&logger[_0x7454f3(0x17e)]('Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20'+_0x156b89);}}export function saveSegmentToPushRecovery(_0x46035c,_0x3eb9fd,_0x1be26a,_0x4417ca){const _0x1259de=a141_0x44ac1d,_0x29f541=readPushRecovery(_0x46035c),_0x4efe6f=_0x29f541?.['journeyName']===_0x3eb9fd?{..._0x29f541,'updatedAt':new Date()[_0x1259de(0x17f)]()}:{'version':0x1,'journeyName':_0x3eb9fd,'updatedAt':new Date()[_0x1259de(0x17f)](),'segments':{}};_0x4efe6f['segments'][_0x1be26a]=_0x4417ca,writePushRecovery(_0x46035c,_0x4efe6f);}
1
+ const a141_0xc59602=a141_0x163b;(function(_0x1f5c96,_0x4ab8f0){const _0x190d1e=a141_0x163b,_0x43d59b=_0x1f5c96();while(!![]){try{const _0x12222b=parseInt(_0x190d1e(0xe6))/0x1+parseInt(_0x190d1e(0xd0))/0x2+-parseInt(_0x190d1e(0xe1))/0x3+parseInt(_0x190d1e(0xd2))/0x4*(parseInt(_0x190d1e(0xde))/0x5)+-parseInt(_0x190d1e(0xd1))/0x6+parseInt(_0x190d1e(0xe8))/0x7+-parseInt(_0x190d1e(0xdd))/0x8*(-parseInt(_0x190d1e(0xe4))/0x9);if(_0x12222b===_0x4ab8f0)break;else _0x43d59b['push'](_0x43d59b['shift']());}catch(_0x5e4be4){_0x43d59b['push'](_0x43d59b['shift']());}}}(a141_0xc10b,0xbb945));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a141_0x514325 from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a141_0xc59602(0xd9));function a141_0xc10b(){const _0xadc48c=['warn','segments','debug','tdx.sdk.push-recovery','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','.tmp','stringify','272ejaHuY','2010625DAdTiv','utf-8','join','2118651KBIIpe','ENOENT','basename','106614KvNdfT','parse','370065RTNMBg','journeyName','2878533iAfTpN','.push-recovery.json','2123948fsrcXF','7041630OnROHt','4JOQGHv','toISOString','code','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20'];a141_0xc10b=function(){return _0xadc48c;};return a141_0xc10b();}export function getPushRecoveryPath(_0x4e711f){const _0x9df603=a141_0xc59602,_0x17bbef=a141_0x514325['dirname'](_0x4e711f),_0x2381b4=a141_0x514325[_0x9df603(0xe3)](_0x4e711f);return a141_0x514325[_0x9df603(0xe0)](_0x17bbef,'.'+_0x2381b4+_0x9df603(0xe9));}export function readPushRecovery(_0x5ad344){const _0x55cdae=a141_0xc59602,_0x964a1b=getPushRecoveryPath(_0x5ad344);if(!existsSync(_0x964a1b))return undefined;try{const _0x3aeb17=readFileSync(_0x964a1b,_0x55cdae(0xdf)),_0x167cca=JSON[_0x55cdae(0xe5)](_0x3aeb17);if(_0x167cca?.['version']!==0x1||typeof _0x167cca[_0x55cdae(0xe7)]!=='string')return undefined;return _0x167cca;}catch(_0xb62c06){return _0xb62c06 instanceof SyntaxError?logger[_0x55cdae(0xd8)](_0x55cdae(0xd5)+_0xb62c06):logger[_0x55cdae(0xd6)]('Failed\x20to\x20read\x20push\x20recovery\x20file:\x20'+_0xb62c06),undefined;}}function a141_0x163b(_0x27448d,_0x184a4b){_0x27448d=_0x27448d-0xd0;const _0xc10b0a=a141_0xc10b();let _0x163be6=_0xc10b0a[_0x27448d];return _0x163be6;}export function writePushRecovery(_0x23e92d,_0xea2314){const _0x4cdfc7=a141_0xc59602,_0x2155d6=getPushRecoveryPath(_0x23e92d),_0xb15943=_0x2155d6+_0x4cdfc7(0xdb);writeFileSync(_0xb15943,JSON[_0x4cdfc7(0xdc)](_0xea2314,null,0x2)+'\x0a',_0x4cdfc7(0xdf)),renameSync(_0xb15943,_0x2155d6);}export function deletePushRecovery(_0x256e6a){const _0x3149de=a141_0xc59602,_0x2417f7=getPushRecoveryPath(_0x256e6a);try{unlinkSync(_0x2417f7);}catch(_0x13cfc9){_0x13cfc9[_0x3149de(0xd4)]!==_0x3149de(0xe2)&&logger[_0x3149de(0xd8)](_0x3149de(0xda)+_0x13cfc9);}}export function saveSegmentToPushRecovery(_0x3dc4af,_0x40b59e,_0x24ed73,_0xf79a97){const _0x3b469f=a141_0xc59602,_0x257ced=readPushRecovery(_0x3dc4af),_0x2c6d7f=_0x257ced?.[_0x3b469f(0xe7)]===_0x40b59e?{..._0x257ced,'updatedAt':new Date()['toISOString']()}:{'version':0x1,'journeyName':_0x40b59e,'updatedAt':new Date()[_0x3b469f(0xd3)](),'segments':{}};_0x2c6d7f[_0x3b469f(0xd7)][_0x24ed73]=_0xf79a97,writePushRecovery(_0x3dc4af,_0x2c6d7f);}
@@ -1 +1 @@
1
- const a142_0x5b9def=a142_0x361a;(function(_0x35f6f5,_0x5c8d44){const _0x30be72=a142_0x361a,_0x2e27c0=_0x35f6f5();while(!![]){try{const _0x2c5395=parseInt(_0x30be72(0x1d0))/0x1+-parseInt(_0x30be72(0x18e))/0x2+-parseInt(_0x30be72(0x1bd))/0x3*(-parseInt(_0x30be72(0x209))/0x4)+-parseInt(_0x30be72(0x18c))/0x5*(-parseInt(_0x30be72(0x12f))/0x6)+-parseInt(_0x30be72(0x21a))/0x7+-parseInt(_0x30be72(0x1ae))/0x8+parseInt(_0x30be72(0x1e9))/0x9*(parseInt(_0x30be72(0x1f3))/0xa);if(_0x2c5395===_0x5c8d44)break;else _0x2e27c0['push'](_0x2e27c0['shift']());}catch(_0x58c4d5){_0x2e27c0['push'](_0x2e27c0['shift']());}}}(a142_0x3d03,0x3648b));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a142_0x5b9def(0x16a));export const PENDING_SEGMENT_PREFIX=a142_0x5b9def(0x220);export const PENDING_ACTIVATION_PREFIX=a142_0x5b9def(0x13f);export function createPendingSegmentId(_0x13c79b){return''+PENDING_SEGMENT_PREFIX+_0x13c79b+'__';}export function isPendingSegmentId(_0x4ad2d3){const _0x17661e=a142_0x5b9def;return _0x4ad2d3['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x4ad2d3[_0x17661e(0x1ff)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x1c511a){const _0x259067=a142_0x5b9def;return _0x1c511a[_0x259067(0x1d4)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x147ccf){return''+PENDING_ACTIVATION_PREFIX+_0x147ccf+'__';}function a142_0x361a(_0x14676b,_0x3c423f){_0x14676b=_0x14676b-0x124;const _0x3d033d=a142_0x3d03();let _0x361ab4=_0x3d033d[_0x14676b];return _0x361ab4;}export function isPendingActivationId(_0x3f432a){return _0x3f432a['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1f077a){const _0x2ad562=a142_0x5b9def;return _0x1f077a[_0x2ad562(0x1d4)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x3e2e21,_0x4e10bd){const _0x24ac83=a142_0x5b9def,_0x3b3f8a=_0x3e2e21+'::'+(_0x4e10bd[_0x24ac83(0x12b)]()||'segment'),_0x57a75c=createHash(_0x24ac83(0x21b))[_0x24ac83(0x1c3)](_0x3b3f8a)[_0x24ac83(0x142)]('hex')[_0x24ac83(0x12e)](0x0,0xc);return'journey_entry_criteria_'+_0x57a75c;}export function ensureJourneyDefaults(_0xd398f4){const _0x433b17=a142_0x5b9def;!_0xd398f4[_0x433b17(0x190)]&&(_0xd398f4[_0x433b17(0x190)]=''),!_0xd398f4[_0x433b17(0x179)]&&(_0xd398f4[_0x433b17(0x179)]=_0x433b17(0x124));}export function injectExistingStageIds(_0x1fd4be,_0x9a7690){const _0x32e889=a142_0x5b9def,_0x2f61fc=new Map(_0x9a7690[_0x32e889(0x17c)](_0x134f88=>[_0x134f88[_0x32e889(0x13e)],_0x134f88['id']]));for(const _0x1f1052 of _0x1fd4be){if(!_0x1f1052['id']){const _0x15d5f8=_0x2f61fc[_0x32e889(0x1b1)](_0x1f1052[_0x32e889(0x13e)]);_0x15d5f8&&(_0x1f1052['id']=_0x15d5f8);}}}export function resolveTDFolderPath(_0x446a17,_0x584c97,_0x3dee29){const _0xc653c6=a142_0x5b9def;if(!_0x584c97)return _0x446a17;if(_0x446a17===_0x3dee29||_0x446a17[_0xc653c6(0x1ff)](_0x3dee29+'/'))return _0x446a17;return _0x446a17?_0x3dee29+'/'+_0x446a17:_0x3dee29;}export function addFoldersToCreate(_0x101458,_0x2d9641,_0x2c0ea9){const _0x72b1ce=a142_0x5b9def;if(!_0x101458)return;if(_0x2d9641[_0x72b1ce(0x1da)](_0x101458))return;const _0x130e26=_0x101458[_0x72b1ce(0x208)]('/');let _0x1f1922='';for(const _0x1cdc1b of _0x130e26){_0x1f1922=_0x1f1922?_0x1f1922+'/'+_0x1cdc1b:_0x1cdc1b,!_0x2d9641['has'](_0x1f1922)&&_0x2c0ea9['add'](_0x1f1922);}}export function sortFoldersByDepth(_0x2c6f2e){const _0x53c4f9=a142_0x5b9def;return[..._0x2c6f2e][_0x53c4f9(0x1f8)]((_0x5ee70c,_0x257db8)=>{const _0x18671d=_0x53c4f9,_0x1bd985=(_0x5ee70c[_0x18671d(0x1e2)](/\//g)||[])['length'],_0x255b87=(_0x257db8['match'](/\//g)||[])[_0x18671d(0x164)];return _0x1bd985-_0x255b87;});}import*as a142_0x2bab56 from'yaml';import{readFileSync}from'fs';import a142_0x30beb9 from'path';import{isJourneyDef,parseYamlString as a142_0x2abc5a,toYamlString as a142_0x4333ae,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(_0x55f503){const _0x5e7762=a142_0x5b9def;if(Array['isArray'](_0x55f503))return'['+_0x55f503[_0x5e7762(0x17c)](_0x5ecf29=>stableStringify(_0x5ecf29))[_0x5e7762(0x1e3)](',')+']';if(_0x55f503&&typeof _0x55f503===_0x5e7762(0x180)){const _0xe7d24f=_0x55f503,_0x29c002=Object[_0x5e7762(0x205)](_0xe7d24f)[_0x5e7762(0x1f8)](),_0x45e906=_0x29c002[_0x5e7762(0x17c)](_0x392a45=>'\x22'+_0x392a45+'\x22:'+stableStringify(_0xe7d24f[_0x392a45]));return'{'+_0x45e906[_0x5e7762(0x1e3)](',')+'}';}const _0x49a21c=JSON[_0x5e7762(0x1dd)](_0x55f503);return _0x49a21c===undefined?'null':_0x49a21c;}function activationSignature(_0x230781){const _0x2c217b=a142_0x5b9def,_0x302f57={'connection':_0x230781[_0x2c217b(0x13c)],..._0x230781[_0x2c217b(0x174)]!==undefined&&{'all_columns':_0x230781['all_columns']},..._0x230781[_0x2c217b(0x1a1)]!==undefined&&{'columns':_0x230781[_0x2c217b(0x1a1)]},..._0x230781[_0x2c217b(0x224)]!==undefined&&{'behavior':_0x230781[_0x2c217b(0x224)]},..._0x230781[_0x2c217b(0x137)]!==undefined&&{'schedule':_0x230781['schedule']},..._0x230781[_0x2c217b(0x1dc)]!==undefined&&{'notification':_0x230781[_0x2c217b(0x1dc)]},..._0x230781[_0x2c217b(0x1f9)]!==undefined&&{'connector_config':_0x230781[_0x2c217b(0x1f9)]},..._0x230781[_0x2c217b(0x1e6)]!==undefined&&{'activation_template_id':_0x230781[_0x2c217b(0x1e6)]}};return stableStringify(_0x302f57);}async function fetchSegment(_0x80bf7f,_0x43343b,_0x474cca,_0x3004c0){const _0x33c67d=a142_0x5b9def,_0x109f71=_0x3004c0?.[_0x33c67d(0x1c5)](_0x2f9ea9=>_0x2f9ea9['id']===_0x474cca);if(_0x109f71)return _0x109f71;try{return await _0x80bf7f[_0x33c67d(0x162)][_0x33c67d(0x14d)](_0x43343b,_0x474cca);}catch(_0x158ade){logger[_0x33c67d(0x1c7)]('getSegment\x20failed\x20for\x20'+_0x474cca+_0x33c67d(0x1c0)+_0x158ade);try{return await _0x80bf7f[_0x33c67d(0x162)][_0x33c67d(0x1cc)](_0x474cca);}catch(_0x52055f){return logger[_0x33c67d(0x1c7)](_0x33c67d(0x1e5)+_0x474cca+':\x20'+_0x52055f),null;}}}function recoverSegmentIdsFromPushRecovery(_0x3792dc,_0x3a2b30,_0x4e76a9){const _0x2881f5=a142_0x5b9def,_0x56addc=readPushRecovery(_0x3792dc['absolutePath']);if(_0x56addc?.[_0x2881f5(0x183)]===_0x3792dc[_0x2881f5(0x219)][_0x2881f5(0x13e)])for(const [_0x105559,_0x2dc7e2]of Object[_0x2881f5(0x181)](_0x56addc[_0x2881f5(0x15b)])){const _0x1869a1=generateDeterministicJourneySegmentName(_0x3792dc[_0x2881f5(0x219)][_0x2881f5(0x13e)],_0x105559);_0x2dc7e2['uniqueServerName']===_0x1869a1&&(_0x3a2b30[_0x2881f5(0x204)](_0x105559,_0x2dc7e2[_0x2881f5(0x191)]),_0x4e76a9['set'](_0x105559,_0x2dc7e2[_0x2881f5(0x191)]));}}async function createOrRecoverEmbeddedSegment(_0xf91b10,_0x50ed06,_0x373a50,_0x3fc75c){const _0x2aa6f4=a142_0x5b9def;let _0x3d5b6a;try{_0x3d5b6a=await _0xf91b10[_0x2aa6f4(0x162)][_0x2aa6f4(0x196)]({'name':_0x373a50['uniqueSegmentName'],'description':_0x373a50[_0x2aa6f4(0x190)],'journeyId':_0x373a50[_0x2aa6f4(0x1b7)],'rule':_0x3fc75c(_0x373a50[_0x2aa6f4(0x1bc)],!![]),'countPopulation':!![],'parentFolderId':_0x373a50['folderId'],'audienceId':_0x373a50[_0x2aa6f4(0x13d)]});}catch(_0x5aaa61){const _0x1a9cea=_0x5aaa61 instanceof Error&&_0x5aaa61[_0x2aa6f4(0x18f)][_0x2aa6f4(0x16b)]('Name\x20has\x20already\x20been\x20taken');if(_0x1a9cea){const _0x4db459=readPushRecovery(_0x50ed06['absolutePath']),_0x24d5d5=_0x4db459?.[_0x2aa6f4(0x183)]===_0x50ed06[_0x2aa6f4(0x219)]['name']?_0x4db459[_0x2aa6f4(0x15b)][_0x373a50[_0x2aa6f4(0x1e4)]]:undefined;if(_0x24d5d5?.[_0x2aa6f4(0x201)]===_0x373a50[_0x2aa6f4(0x130)])await _0xf91b10[_0x2aa6f4(0x162)][_0x2aa6f4(0x1df)](_0x373a50['parentId'],_0x24d5d5[_0x2aa6f4(0x191)],{'description':_0x373a50['description'],'rule':_0x3fc75c(_0x373a50['resolvedRule'],!![]),'countPopulation':!![]}),_0x3d5b6a=_0x24d5d5[_0x2aa6f4(0x191)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],_0x2aa6f4(0x19a)+_0x373a50[_0x2aa6f4(0x1e4)]+_0x2aa6f4(0x15f)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x50ed06[_0x2aa6f4(0x156)]['replace'](/([^/]+)$/,_0x2aa6f4(0x195))+')\x20')+_0x2aa6f4(0x12d),_0x5aaa61);}else throw _0x5aaa61;}return saveSegmentToPushRecovery(_0x50ed06[_0x2aa6f4(0x156)],_0x50ed06[_0x2aa6f4(0x219)][_0x2aa6f4(0x13e)],_0x373a50[_0x2aa6f4(0x1e4)],{'segmentId':_0x3d5b6a,'uniqueServerName':_0x373a50[_0x2aa6f4(0x130)],'createdAt':new Date()[_0x2aa6f4(0x177)]()}),_0x3d5b6a;}export async function prepareSegmentFiles(_0x88ed8b,_0x13bb44,_0x1f028a,_0x47f0a9,_0x4bacac){const _0x22e14e=a142_0x5b9def,{activationDefToCreateRequest:_0x1d5db8}=await import('./child-segment-yaml.js'),_0x10a485=[],_0xe8566a=new Set();for(const {yamlConfig:_0x1bc3d5,folderPath:_0x461670,sourcePath:_0x59dc5e}of _0x88ed8b){const _0x4ff918=resolveTDFolderPath(_0x461670,_0x47f0a9,_0x4bacac),_0x4effad=_0x4ff918+':'+_0x1bc3d5[_0x22e14e(0x13e)],_0x200f5c=_0x13bb44['segmentByFolderAndName'][_0x22e14e(0x1b1)](_0x4effad),_0x531575=_0x200f5c?_0x13bb44['activationsBySegmentId'][_0x22e14e(0x1b1)](_0x200f5c['id'])||[]:[];addFoldersToCreate(_0x4ff918,_0x13bb44[_0x22e14e(0x1db)],_0xe8566a);const _0x1dcb74=calculateActivationActions(_0x1bc3d5[_0x22e14e(0x1d5)]||[],_0x531575,_0x13bb44[_0x22e14e(0x141)],_0x13bb44[_0x22e14e(0x1d9)]);for(const _0x123fba of _0x1dcb74){(_0x123fba[_0x22e14e(0x17b)]===_0x22e14e(0x1d1)||_0x123fba['type']===_0x22e14e(0x1c3))&&_0x123fba[_0x22e14e(0x12c)]&&(_0x123fba['validatedRequest']=await _0x1d5db8(_0x123fba[_0x22e14e(0x12c)],_0x1f028a));}const _0x53a5b8=calculateSegmentDiff(_0x1bc3d5,_0x200f5c,_0x531575,_0x13bb44[_0x22e14e(0x141)],_0x13bb44[_0x22e14e(0x1d9)]);_0x10a485[_0x22e14e(0x188)]({'relativePath':_0x1bc3d5['name'],'absolutePath':_0x59dc5e,'yamlConfig':_0x1bc3d5,'folderPath':_0x4ff918,'existingSegment':_0x200f5c,'existingActivations':_0x531575,'isNew':_0x53a5b8[_0x22e14e(0x1af)],'hasChanges':_0x53a5b8[_0x22e14e(0x161)],'diff':_0x53a5b8[_0x22e14e(0x21c)],'activationActions':_0x1dcb74});}return{'segmentFiles':_0x10a485,'foldersToCreate':_0xe8566a};}export async function prepareJourneyFiles(_0x65d119,_0x315c89,_0x287613,_0x197936){const _0x4d2c25=a142_0x5b9def,_0x1692d2=[],_0x1edd87=new Set();for(const {yamlConfig:_0x395f47,folderPath:_0x44cc5e,sourcePath:_0x2ca8e4}of _0x65d119){const _0x2fd61c=resolveTDFolderPath(_0x44cc5e,_0x287613,_0x197936),_0x2c65bf=_0x2fd61c+':'+_0x395f47[_0x4d2c25(0x13e)],_0x17ac1f=_0x315c89['journeyBundlesByFolderAndName'][_0x4d2c25(0x1b1)](_0x2c65bf);let _0x35c7c5,_0xdf7515;if(_0x17ac1f&&_0x17ac1f[_0x4d2c25(0x164)]>0x0){const _0x571047=buildLocalExpandedRuleMappings(_0x395f47),{createYamlContext:_0x31dea5,prefetchJourneySegments:_0xe318cf}=createPushYamlContextForBundle(_0x315c89[_0x4d2c25(0x160)],_0x315c89['parentId'],_0x315c89[_0x4d2c25(0x1ee)],_0x571047,_0x315c89[_0x4d2c25(0x141)],_0x315c89['connectionIdToNameMap'],_0x315c89[_0x4d2c25(0x1a7)],_0x315c89[_0x4d2c25(0x157)]);await _0xe318cf(_0x17ac1f['map'](_0x54b70e=>_0x54b70e['id']));const _0x2377ed=await _0x315c89[_0x4d2c25(0x160)]['journey'][_0x4d2c25(0x15d)](_0x17ac1f[0x0]['journeyBundleId']),_0x51b79a=hasMultipleVersions(_0x395f47),_0x38ad48=async _0x3f006b=>{const _0x38a26b=_0x4d2c25,_0x18ef7c=_0x315c89[_0x38a26b(0x157)]?.[_0x38a26b(0x1b1)](_0x3f006b);if(_0x18ef7c)return _0x18ef7c;return _0x315c89[_0x38a26b(0x136)]({'journeyId':_0x3f006b,'journeyName':_0x395f47['name'],'isMultiVersion':_0x17ac1f[_0x38a26b(0x164)]>0x1});};if(_0x51b79a&&_0x17ac1f[_0x4d2c25(0x164)]>0x1){const _0x415c0c=[];for(const _0xf10e02 of _0x17ac1f){const _0x3e6bac=_0xf10e02[_0x4d2c25(0x207)]||0x1;_0x315c89['progress']?.['update'](_0x4d2c25(0x1e1)+_0x395f47[_0x4d2c25(0x13e)]+'\x20v'+_0x3e6bac);const _0x75e628=await _0x38ad48(_0xf10e02['id']),_0x56b272=_0x31dea5(_0xf10e02['id']),_0x26fe83=await journeyResponseToDef(_0x75e628,_0x56b272);_0x415c0c[_0x4d2c25(0x188)]({'item':_0xf10e02,'yaml':_0x26fe83});}const _0x3e7f74=buildLocalRuleToNameMappingFromJourney(_0x395f47);_0xdf7515=buildMergedJourneyDef(_0x415c0c,_0x3e7f74,_0x2377ed);const _0x45add8=Math[_0x4d2c25(0x202)](..._0x415c0c[_0x4d2c25(0x17c)](_0x5aa5ca=>_0x5aa5ca[_0x4d2c25(0x18d)]['versionNumber']||0x0)),_0x3c8b98=_0x17ac1f[_0x4d2c25(0x1c5)](_0x33411b=>(_0x33411b[_0x4d2c25(0x207)]||0x0)===_0x45add8);_0x3c8b98&&(_0x315c89['progress']?.[_0x4d2c25(0x1c3)](_0x4d2c25(0x1e1)+_0x395f47['name']+'\x20v'+_0x45add8),_0x35c7c5=await _0x38ad48(_0x3c8b98['id']));}else{const _0x30caef=_0x17ac1f[_0x17ac1f[_0x4d2c25(0x164)]-0x1];_0x315c89['progress']?.[_0x4d2c25(0x1c3)](_0x4d2c25(0x1e1)+_0x395f47[_0x4d2c25(0x13e)]),_0x35c7c5=await _0x38ad48(_0x30caef['id']);const _0x5a970c=_0x31dea5(_0x30caef['id']),_0x1fcbcb=await journeyResponseToDef(_0x35c7c5,_0x5a970c),_0x383eb3=buildLocalRuleToNameMappingFromJourney(_0x395f47);_0xdf7515=buildMergedJourneyDef([{'item':_0x30caef,'yaml':_0x1fcbcb}],_0x383eb3,_0x2377ed);}}addFoldersToCreate(_0x2fd61c,_0x315c89[_0x4d2c25(0x1db)],_0x1edd87);const _0x26a831=calculateJourneyDiff(_0x395f47,_0xdf7515);_0x1692d2['push']({'relativePath':_0x395f47['name'],'absolutePath':_0x2ca8e4,'yamlConfig':_0x395f47,'folderPath':_0x2fd61c,'existingJourney':_0x35c7c5,'isNew':_0x26a831[_0x4d2c25(0x1af)],'hasChanges':_0x26a831[_0x4d2c25(0x161)],'diff':_0x26a831[_0x4d2c25(0x21c)]});}return{'journeyFiles':_0x1692d2,'foldersToCreate':_0x1edd87};}export function calculateActivationActions(_0x1f08d2,_0x12c859,_0x4a9b54,_0x9ec071){const _0x34ca93=a142_0x5b9def,_0x27b201=[],_0x49de1c=new Map();for(const _0xa68d91 of _0x12c859){_0x49de1c['set'](_0xa68d91[_0x34ca93(0x13e)],_0xa68d91);}const _0x437379=new Map();for(const _0x13c563 of _0x1f08d2){_0x437379['set'](_0x13c563[_0x34ca93(0x13e)],_0x13c563);}for(const _0x372e3f of _0x1f08d2){const _0x84158c=_0x49de1c[_0x34ca93(0x1b1)](_0x372e3f['name']);if(!_0x84158c)_0x27b201['push']({'type':_0x34ca93(0x1d1),'name':_0x372e3f[_0x34ca93(0x13e)],'yamlActivation':_0x372e3f});else{const _0xa86263=activationResponseToDef(_0x84158c,_0x4a9b54,_0x9ec071),_0x3825d5=a142_0x2bab56[_0x34ca93(0x1dd)](_0xa86263),_0x13f7d9=a142_0x2bab56['stringify'](_0x372e3f);_0x3825d5!==_0x13f7d9&&_0x27b201[_0x34ca93(0x188)]({'type':_0x34ca93(0x1c3),'name':_0x372e3f[_0x34ca93(0x13e)],'yamlActivation':_0x372e3f,'existingActivation':_0x84158c});}}for(const _0x3af0ee of _0x12c859){!_0x437379['has'](_0x3af0ee['name'])&&_0x27b201[_0x34ca93(0x188)]({'type':_0x34ca93(0x173),'name':_0x3af0ee[_0x34ca93(0x13e)],'existingActivation':_0x3af0ee});}return _0x27b201;}function calculateYamlDiff(_0x236765,_0x5a0d3d){if(_0x5a0d3d){const _0x1afd87=generateDiff(_0x5a0d3d,_0x236765),_0xc5d015=hasChanges(_0x1afd87);return{'isNew':![],'hasChanges':_0xc5d015,'diff':_0xc5d015?formatDiffWithColors(_0x1afd87):undefined};}const _0x27aeae=generateDiff('',_0x236765);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x27aeae)};}export function calculateSegmentDiff(_0x4d7bc8,_0x58053b,_0x16b6ff,_0x67574a,_0x2548aa){const _0x2ad68d=segmentToYamlString(_0x4d7bc8),_0x6c6041=_0x58053b?segmentToYamlString(segmentWithActivationsToYaml(_0x58053b,_0x16b6ff,undefined,_0x67574a,_0x2548aa)):undefined;return calculateYamlDiff(_0x2ad68d,_0x6c6041);}export function calculateJourneyDiff(_0x41c7c8,_0x2dba6a){const _0x246405=normalizeJourneyDef(_0x41c7c8,_0x41c7c8),_0x101253=a142_0x4333ae(_0x246405),_0x415cda=_0x2dba6a?a142_0x4333ae(normalizeJourneyDef(_0x2dba6a,_0x41c7c8)):undefined;return calculateYamlDiff(_0x101253,_0x415cda);}export function findSegmentsToDelete(_0x5c799c,_0x5a72fb,_0x5aab89,_0x51b98c,_0x4ae8d9){const _0x5ae967=a142_0x5b9def,_0x1949ae=new Set();for(const {yamlConfig:_0x1f2f61,folderPath:_0x48c3d8}of _0x5a72fb){_0x1949ae[_0x5ae967(0x128)](_0x48c3d8+':'+_0x1f2f61[_0x5ae967(0x13e)]);}return _0x5c799c[_0x5ae967(0x192)](_0x434755=>{const _0x308429=_0x5ae967,_0x2cc097=_0x434755['segmentFolderId']?_0x5aab89['get'](_0x434755[_0x308429(0x1d7)][_0x308429(0x1b0)]())||'':'',_0x598272=_0x2cc097+':'+_0x434755[_0x308429(0x13e)];if(_0x1949ae[_0x308429(0x1da)](_0x598272))return![];if(_0x4ae8d9)return _0x2cc097===_0x51b98c||_0x2cc097[_0x308429(0x1ff)](_0x51b98c+'/');return!![];});}export function findJourneysToDelete(_0x1da516,_0xae1b83,_0x2f0741,_0x4da8dd,_0x6bc7cc){const _0x3f899d=a142_0x5b9def,_0x180757=new Set();for(const {yamlConfig:_0x12ce42,folderPath:_0x1926d2}of _0xae1b83){_0x180757[_0x3f899d(0x128)](_0x1926d2+':'+_0x12ce42[_0x3f899d(0x13e)]);}return _0x1da516[_0x3f899d(0x192)](_0x4b7962=>{const _0x3111f2=_0x3f899d,_0x38a791=_0x4b7962[_0x3111f2(0x132)]?_0x2f0741['get'](_0x4b7962[_0x3111f2(0x132)])||'':'',_0x24d4df=_0x38a791+':'+_0x4b7962[_0x3111f2(0x1ab)];if(_0x180757[_0x3111f2(0x1da)](_0x24d4df))return![];if(_0x6bc7cc)return _0x38a791===_0x4da8dd||_0x38a791[_0x3111f2(0x1ff)](_0x4da8dd+'/');return!![];});}export function buildSegmentLookupMap(_0x45eaa1,_0x458082){const _0x59f084=a142_0x5b9def,_0x261bfe=new Map();for(const _0xb92f0c of _0x45eaa1){const _0x2c6753=_0xb92f0c[_0x59f084(0x1d7)]?_0x458082[_0x59f084(0x1b1)](_0xb92f0c['segmentFolderId']['toString']())||'':'',_0xa2622a=_0x2c6753+':'+_0xb92f0c[_0x59f084(0x13e)];_0x261bfe[_0x59f084(0x204)](_0xa2622a,_0xb92f0c);}return _0x261bfe;}export function buildSegmentNameToIdMap(_0x3882c3){const _0x343629=a142_0x5b9def,_0x580da6=new Map();for(const _0x2a9273 of _0x3882c3){_0x580da6[_0x343629(0x204)](_0x2a9273['name'],_0x2a9273['id']);}return _0x580da6;}export function buildJourneyBundleLookupMap(_0x1aa5c9,_0x20e6a0){const _0x5eb5b6=a142_0x5b9def,_0x23d9ea=new Map();for(const _0x361597 of _0x1aa5c9){const _0x42a0dc=_0x361597[_0x5eb5b6(0x132)]?_0x20e6a0[_0x5eb5b6(0x1b1)](_0x361597['folderId'])||'':'',_0x28d643=_0x42a0dc+':'+_0x361597[_0x5eb5b6(0x1ab)];!_0x23d9ea[_0x5eb5b6(0x1da)](_0x28d643)&&_0x23d9ea[_0x5eb5b6(0x204)](_0x28d643,[]),_0x23d9ea[_0x5eb5b6(0x1b1)](_0x28d643)[_0x5eb5b6(0x188)](_0x361597);}for(const _0x53abbc of _0x23d9ea[_0x5eb5b6(0x1d3)]()){_0x53abbc[_0x5eb5b6(0x1f8)]((_0xdc24c,_0x2979e3)=>(_0xdc24c[_0x5eb5b6(0x207)]||0x0)-(_0x2979e3[_0x5eb5b6(0x207)]||0x0));}return _0x23d9ea;}export function collectFoldersToCreate(_0x2e13cb,_0x1d7c24){const _0x121b64=a142_0x5b9def,_0xd5a9e1=new Set();for(const _0x5cb0ff of _0x2e13cb){if(!_0x5cb0ff)continue;if(_0x1d7c24['has'](_0x5cb0ff))continue;const _0x4578eb=_0x5cb0ff['split']('/');let _0x1374f0='';for(const _0xbcf442 of _0x4578eb){_0x1374f0=_0x1374f0?_0x1374f0+'/'+_0xbcf442:_0xbcf442,!_0x1d7c24[_0x121b64(0x1da)](_0x1374f0)&&_0xd5a9e1['add'](_0x1374f0);}}return _0xd5a9e1;}export function parseAndClassifyYamlFiles(_0x1e66b3,_0x62d109,_0x499880){const _0x50ddda=a142_0x5b9def,_0xbe5d2f=[],_0x2c7cc9=[];for(const _0x1e9bb9 of _0x1e66b3){const _0x5f5554=a142_0x30beb9[_0x50ddda(0x1f1)](_0x62d109,a142_0x30beb9[_0x50ddda(0x194)](_0x1e9bb9)),_0x1f2e24=_0x5f5554==='.'?'':_0x5f5554,_0x223582=readFileSync(_0x1e9bb9,_0x50ddda(0x19f)),_0x44d8e4=a142_0x2bab56[_0x50ddda(0x16f)](_0x223582);if(isJourneyDef(_0x44d8e4)){const _0x464146=a142_0x2abc5a(_0x223582);_0x2c7cc9['push']({'yamlConfig':_0x464146,'folderPath':_0x1f2e24,'sourcePath':_0x1e9bb9});}else{if(!_0x499880?.[_0x50ddda(0x1cd)]){const _0x4ccfa1=parseSegmentYamlFile(_0x223582),_0x460bd3=normalizeChildSegmentYaml(_0x4ccfa1);_0xbe5d2f[_0x50ddda(0x188)]({'yamlConfig':_0x460bd3,'folderPath':_0x1f2e24,'sourcePath':_0x1e9bb9});}}}return{'segments':_0xbe5d2f,'journeys':_0x2c7cc9};}export function validateParsedFiles(_0x303777,_0x3540d1){const _0x552525=a142_0x5b9def,_0x301380=[];for(const {yamlConfig:_0x5beddc,sourcePath:_0x1e330a}of _0x303777['segments']){const _0xd46d60=readFileSync(_0x1e330a,_0x552525(0x19f)),_0x4e78f9=a142_0x2bab56[_0x552525(0x17f)](_0xd46d60),_0x42aed3=validateSegmentDef(_0x5beddc,{'source':_0xd46d60,'document':_0x4e78f9},{'skipSchema':!![]});if(!_0x42aed3['valid']){const _0x44fbd4=a142_0x30beb9[_0x552525(0x1f1)](_0x3540d1,_0x1e330a);_0x301380['push']({'filePath':_0x44fbd4,'source':_0xd46d60,'result':_0x42aed3,'isJourney':![]});}}for(const {yamlConfig:_0x2323d8,sourcePath:_0x2148cf}of _0x303777[_0x552525(0x212)]){const _0x50776f=readFileSync(_0x2148cf,'utf-8'),_0x5ab2a1=a142_0x2bab56['parseDocument'](_0x50776f),_0x57a597=validateJourneyDef(_0x2323d8,{'source':_0x50776f,'document':_0x5ab2a1},{'skipSchema':!![]});if(!_0x57a597[_0x552525(0x1bf)]){const _0x3aee5a=a142_0x30beb9['relative'](_0x3540d1,_0x2148cf);_0x301380[_0x552525(0x188)]({'filePath':_0x3aee5a,'source':_0x50776f,'result':_0x57a597,'isJourney':!![]});}}return _0x301380;}export function formatValidationErrors(_0x382087){const _0x18896f=a142_0x5b9def,_0x3afa5a=[];for(const {filePath:_0x34ef0a,source:_0x3c023e,result:_0x2a6347,isJourney:_0x375476}of _0x382087){const _0x3983f5=_0x375476?_0x18896f(0x169):_0x18896f(0x162);_0x3afa5a[_0x18896f(0x188)]('\x0a'+_0x34ef0a+'\x20('+_0x3983f5+_0x18896f(0x211)+_0x2a6347[_0x18896f(0x171)][_0x18896f(0x164)]+'\x20error(s)'),_0x3afa5a['push'](formatValidationResult(_0x2a6347,_0x3c023e,_0x34ef0a));}return _0x3afa5a['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x21dc94){const _0x38658f=a142_0x5b9def,_0x69a2a7=new Set(),_0x1e5601=new Map(),_0x4b3956=collectSegmentUsageCounts(_0x21dc94);if(_0x21dc94[_0x38658f(0x15b)])for(const [_0x154936,_0x2912b0]of Object[_0x38658f(0x181)](_0x21dc94['segments'])){_0x69a2a7[_0x38658f(0x128)](_0x154936);if(_0x2912b0[_0x38658f(0x14c)]){const _0x5bcb2d=yamlRuleToApi(_0x2912b0[_0x38658f(0x14c)]),_0x6f17d8=apiRuleToYaml(_0x5bcb2d);_0x1e5601['set'](_0x154936,_0x6f17d8);}}const _0x2d8329=new Map();let _0x434541=0x0;for(const [_0x1f17e8,_0x38d99e]of _0x1e5601){const _0x357758=serializeExpandedRule(_0x38d99e,_0x1e5601),_0x3118ba=_0x2d8329[_0x38658f(0x1b1)](_0x357758)||[];_0x3118ba['push']({'name':_0x1f17e8,'index':_0x434541}),_0x2d8329[_0x38658f(0x204)](_0x357758,_0x3118ba),_0x434541++;}const _0x595cfe=new Map();for(const [_0x29e290,_0x387ca5]of _0x2d8329){const _0x20f580=_0x387ca5[_0x38658f(0x12e)]()[_0x38658f(0x1f8)]((_0x70acba,_0xd2598)=>{const _0x1581a2=_0x38658f,_0x3dc273=_0x4b3956[_0x1581a2(0x1b1)](_0x70acba[_0x1581a2(0x13e)])||0x0,_0x1747ca=_0x4b3956[_0x1581a2(0x1b1)](_0xd2598[_0x1581a2(0x13e)])||0x0;if(_0x3dc273!==_0x1747ca)return _0x1747ca-_0x3dc273;return _0x70acba[_0x1581a2(0x163)]-_0xd2598[_0x1581a2(0x163)];})[_0x38658f(0x17c)](_0x15404e=>_0x15404e['name']),_0x1d0c04=[];for(const _0x220a54 of _0x20f580){const _0x4a935c=_0x4b3956['get'](_0x220a54)||0x0,_0x2c6351=Math[_0x38658f(0x202)](_0x4a935c,0x1);for(let _0x48e2d3=0x0;_0x48e2d3<_0x2c6351;_0x48e2d3++){_0x1d0c04['push'](_0x220a54);}}_0x595cfe[_0x38658f(0x204)](_0x29e290,_0x1d0c04);}return{'existingLocalSegmentNames':_0x69a2a7,'localSegmentRules':_0x1e5601,'localExpandedRuleToNames':_0x595cfe};}function a142_0x3d03(){const _0x200918=['213UZpzkY','activationContext','valid',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','activationParams','day','update','some','find','\x27\x20decision\x20point\x20branch\x20\x27','debug','journey_creating','\x27\x20from\x20file:\x20','branches','\x27\x20milestone','getSegmentEntity','skipSegments','\x27\x20not\x20found\x20in\x20journey\x20\x27','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','239176BAuBFJ','create','INTERNAL','values','replace','activations','deleteSegment','segmentFolderId','Condition','connectionIdToNameMap','has','folderPathToId','notification','stringify','\x27\x20entry\x20criteria','updateSegmentById','entryCriteria','Fetching\x20','match','join','localName','getSegmentEntity\x20also\x20failed\x20for\x20','activation_template_id','goal\x20criteria','flatMap','20583MCeSyJ','Activation','withProgress','folder_created','Created\x20activation\x20\x27','existingSegments','run_after_journey_refresh','results','relative','JOURNEY_UPDATE_ERROR','2020jHfAQS','createFolder','exitCriterias','getActivation','journey_updating','sort','connector_config','created','Created\x20journey\x20\x27','reduce','\x27\x20for\x20','logDeleted','startsWith','deleted','uniqueServerName','max','kind','set','keys','\x20(referenced\x20in\x20journey\x20','versionNumber','split','2656nWcfkw','activation_deleted','segment_deleted','SEGMENT_SYNTAX_ERROR','Segment\x20not\x20found','JOURNEY_SYNTAX_ERROR','updated','\x20segment\x20from\x20file:\x20','):\x20','journeys','./journey-yaml.js','Updated\x20segment\x20\x27','waitStepType','createSegment','toLowerCase','WaitStep','yamlConfig','2118508NMszVS','sha1','diff','journeyStages','segmentNameToId','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','__pending_','verbose','parentSegmentFolder','Duration','behavior','draft','logInfo','data','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','add','resolveSegment','journeyActivationNameToId','trim','yamlActivation','and\x20the\x20server\x20segment,\x20then\x20retry.','slice','3246aoUiLY','uniqueSegmentName','Entry\x20criteria:\x20','folderId','embedded_activation_creating','steps','createActivation','fetchJourney','schedule','createdSegmentId','journey_created','segment_creating','Failed\x20to\x20','connection','parentId','name','__pending_act_','Creating\x20segment\x20\x27','idToEmailMap','digest','\x0a\x20\x20','folder','activation_','embeddedSegmentNameToId','conditionTimeoutUnit','onProgress','activation_created','embedded_segment_created','segment_deleting','rule','getSegment','NOT_FOUND','stages','getJourney','milestone','size','\x27\x20exit\x20criteria','resolveJourneyId','logSuccess','absolutePath','journeyById','conditionSegmentId','ACTIVATION_UPDATE_ERROR','conditionTimeoutDuration','segments','existingActivation','getLatestJourneyId','Updating\x20segment\x20\x27','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','deps','hasChanges','segment','index','length','Created\x20segment\x20\x27','conditions','rootFolderId','waitStepUnit','journey','tdx.sdk.push-workflow','includes','Matched\x20server\x20segment\x20\x27','embedded_activation_created','SEGMENT_UPDATE_ERROR','parse','Creating\x20folder\x20\x27','errors','list','delete','all_columns','activationActions','with','toISOString','Creating\x20activation\x20\x27','state','Updated\x20journey\x20\x27','type','map','Deleted\x20activation\x20\x27','action','parseDocument','object','entries','\x27\x20to\x20local\x20\x27','journeyName','listActivations','ACTIVATION_SYNTAX_ERROR',').\x20','\x27\x20by\x20rule\x20content','push','embedded_segment_creating','attributes','../../utils/async.js','1055Jasgpy','item','161764yGaBQF','message','description','segmentId','filter','journey_updated','dirname','.$1.push-recovery.json','createJourneySegment','Created\x20folder\x20\x27','waitStep','from','Embedded\x20segment\x20\x27','existingJourney','\x27...','idToName','updateActivation','utf-8','Segment\x20not\x20found:\x20','columns','Updated\x20activation\x20\x27','validatedRequest','nameToId','relationships','stage\x20\x27','activationStepsById','\x27\x20wait\x20condition','DecisionPoint','activation_deleting','journeyBundleName','goal','existingSegment','2052576LFudxg','isNew','toString','get','deleteActivation','journeyActivationStepId','entry_criteria','Stage\x20\x27','createdSegmentIds','journeyId','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','unchanged','Deleted\x20segment\x20\x27','folderPath','resolvedRule'];a142_0x3d03=function(){return _0x200918;};return a142_0x3d03();}export function createSegmentIdResolver(_0x58dff9,_0x17ddf3){return async _0x478668=>{const _0x4b5458=a142_0x361a,_0x267f0c=_0x58dff9[_0x4b5458(0x1b1)](_0x478668);if(!_0x267f0c)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x478668+_0x4b5458(0x21f)+_0x17ddf3+'\x27)');return _0x267f0c;};}export function extractRootFolderId(_0x34e8ca){const _0x5f34c9=a142_0x5b9def;return _0x34e8ca['relationships']?.[_0x5f34c9(0x222)]?.[_0x5f34c9(0x126)]?.['id']||_0x34e8ca[_0x5f34c9(0x1a5)]?.['parentFolder']?.[_0x5f34c9(0x126)]?.['id'];}export function buildConnectionMaps(_0x3c21b5){const _0x30513f=a142_0x5b9def,_0x3baa62=new Map(),_0x4770a7=new Map(),_0x3c08d0=new Map();for(const _0x8a28b3 of _0x3c21b5){_0x3baa62[_0x30513f(0x204)](_0x8a28b3[_0x30513f(0x13e)],parseInt(_0x8a28b3['id'],0xa)),_0x4770a7['set'](_0x8a28b3['id'],_0x8a28b3[_0x30513f(0x13e)]),_0x3c08d0[_0x30513f(0x204)](_0x8a28b3['name'],_0x8a28b3[_0x30513f(0x17b)]);}return{'nameToId':_0x3baa62,'idToName':_0x4770a7,'nameToType':_0x3c08d0};}export function calculatePushStats(_0xe93db,_0xb38064,_0x1b2d5b,_0x3146d5,_0x2da9b2,_0x24be96,_0x52b4b3){const _0x598222=a142_0x5b9def,_0x1a97a8=_0xe93db[_0x598222(0x192)](_0x132ba0=>_0x132ba0['isNew']),_0x1bdd93=_0xe93db[_0x598222(0x192)](_0x3dcac8=>!_0x3dcac8[_0x598222(0x1af)]&&_0x3dcac8[_0x598222(0x161)]),_0x4ff01d=_0xe93db[_0x598222(0x192)](_0x5d39d8=>!_0x5d39d8[_0x598222(0x1af)]&&!_0x5d39d8[_0x598222(0x161)]),_0x44fc87=_0x24be96?_0x3146d5:[],_0x428971=_0xb38064[_0x598222(0x192)](_0x8d6c12=>_0x8d6c12[_0x598222(0x1af)]),_0x3b5db0=_0xb38064[_0x598222(0x192)](_0x5e539b=>!_0x5e539b[_0x598222(0x1af)]&&_0x5e539b['hasChanges']),_0x32d691=_0xb38064['filter'](_0x105875=>!_0x105875[_0x598222(0x1af)]&&!_0x105875[_0x598222(0x161)]),_0x3a821c=_0x24be96?_0x2da9b2:[],_0x56e3be=_0xe93db[_0x598222(0x1e8)](_0x5abff6=>_0x5abff6[_0x598222(0x175)]),_0x24e705=_0x56e3be[_0x598222(0x192)](_0x2a4955=>_0x2a4955[_0x598222(0x17b)]==='create'),_0x103696=_0x56e3be[_0x598222(0x192)](_0x183580=>_0x183580[_0x598222(0x17b)]==='update'),_0x1e6ac8=_0x56e3be[_0x598222(0x192)](_0x16f664=>_0x16f664[_0x598222(0x17b)]===_0x598222(0x173)),_0x22d502=Array[_0x598222(0x199)](_0x1b2d5b)[_0x598222(0x1f8)](),_0x37367a=_0x52b4b3?![]:_0x1a97a8[_0x598222(0x164)]>0x0||_0x1bdd93[_0x598222(0x164)]>0x0||_0x44fc87[_0x598222(0x164)]>0x0,_0x65404e=_0x428971[_0x598222(0x164)]>0x0||_0x3b5db0[_0x598222(0x164)]>0x0||_0x3a821c['length']>0x0,_0x2f6f2c=_0x52b4b3?![]:_0x56e3be[_0x598222(0x164)]>0x0,_0x2d2286=_0x22d502['length']>0x0;return{'segments':{'new':_0x1a97a8,'changed':_0x1bdd93,'unchanged':_0x4ff01d,'toDelete':_0x44fc87},'journeys':{'new':_0x428971,'changed':_0x3b5db0,'unchanged':_0x32d691,'toDelete':_0x3a821c},'activations':{'all':_0x56e3be,'toCreate':_0x24e705,'toUpdate':_0x103696,'toDelete':_0x1e6ac8},'folders':{'toCreate':_0x22d502},'counts':{'segments':{'new':_0x1a97a8[_0x598222(0x164)],'changed':_0x1bdd93[_0x598222(0x164)],'unchanged':_0x4ff01d[_0x598222(0x164)],'toDelete':_0x44fc87[_0x598222(0x164)]},'journeys':{'new':_0x428971[_0x598222(0x164)],'changed':_0x3b5db0[_0x598222(0x164)],'unchanged':_0x32d691['length'],'toDelete':_0x3a821c[_0x598222(0x164)]},'activations':{'create':_0x24e705['length'],'update':_0x103696['length'],'delete':_0x1e6ac8['length']},'folders':_0x22d502[_0x598222(0x164)]},'hasChanges':_0x37367a||_0x65404e||_0x2f6f2c||_0x2d2286};}export async function buildPushExecutionContext(_0x17735f,_0x4fcf2a,_0x2d192c,_0x3a2946,_0x9349ef,_0x388ab2){const _0x87b22d=a142_0x5b9def,_0x50bdb9=extractRootFolderId(_0x2d192c),{pathToId:_0x24e3a3,idToPath:_0x24d90b}=buildFolderMaps(_0x9349ef),_0x5157de=buildSegmentNameToIdMap(_0x3a2946),_0x26ef8b=new Map(),{batchAsync:_0x47e665}=await import(_0x87b22d(0x18b)),[_0x2b6c79,_0x3d5a0b]=await Promise['all']([_0x17735f['user']['buildUserMaps'](),_0x17735f['connection'][_0x87b22d(0x172)](),((async()=>{const _0x386b6c=_0x87b22d;!_0x388ab2&&_0x3a2946[_0x386b6c(0x164)]>0x0&&await _0x47e665(_0x3a2946,async _0x4941e4=>{const _0x250a96=_0x386b6c,_0x67dd8f=await _0x17735f[_0x250a96(0x162)][_0x250a96(0x184)](_0x4fcf2a,_0x4941e4['id']);_0x26ef8b[_0x250a96(0x204)](_0x4941e4['id'],_0x67dd8f);});})())]),{emailToId:_0x16df21,idToEmail:_0x22659c}=_0x2b6c79,_0x54b829=buildConnectionMaps(_0x3d5a0b);return{'rootFolderId':_0x50bdb9,'folderPathToId':_0x24e3a3,'folderIdToPath':_0x24d90b,'segmentNameToId':_0x5157de,'activationsBySegmentId':_0x26ef8b,'emailToIdMap':_0x16df21,'idToEmailMap':_0x22659c,'connectionNameToIdMap':_0x54b829[_0x87b22d(0x1a4)],'connectionIdToNameMap':_0x54b829[_0x87b22d(0x19d)],'connectionNameToTypeMap':_0x54b829['nameToType']};}export function createPushYamlContextForBundle(_0xa7bf1,_0x2cd9ec,_0x230b87,_0x397bbf,_0x414c15,_0x5648ba,_0x509c10,_0x20e76c){const {existingLocalSegmentNames:_0x4a1a65,localExpandedRuleToNames:_0xf4c73a}=_0x397bbf,_0xa290e1=new Set(),_0x2a8e47=new Map(),_0x4ab824=new Map(),_0x258af5=new Map(),_0x9fb272=createJumpTargetCache(),_0x1fc254=new Map(),_0x4f1289=new Map(),_0x36a6bc=new Set();let _0xc18c34;const _0x2a1a55=_0x4081ac=>{const _0x29b8aa={'resolveSegment':async _0x599cf9=>{const _0x481030=a142_0x361a,_0x14bec7=_0x258af5['get'](_0x599cf9);if(_0x14bec7!==undefined)return{'name':_0x14bec7,'isJourneyLocal':!![]};try{const _0x162c61=await fetchSegment(_0xa7bf1,_0x2cd9ec,_0x599cf9,_0x230b87);if(!_0x162c61)throw new Error(_0x481030(0x20d));const _0x53a872=generateJourneyLocalName(_0x162c61[_0x481030(0x13e)]),_0x1c5d81=_0x162c61[_0x481030(0x203)]===SEGMENT_KIND_JOURNEY&&_0x53a872!==undefined;let _0x5e0a73=_0x162c61['name'],_0x4b7a91;if(_0x1c5d81&&_0x162c61['rule']){const _0x1f74da=apiRuleToYaml(_0x162c61[_0x481030(0x14c)]);_0x4f1289[_0x481030(0x204)](_0x599cf9,_0x1f74da);const _0x58187f=async _0x25f0db=>{const _0x3de00d=_0x481030,_0x72c375=collectSegmentRefsFromRule(_0x25f0db);for(const _0x319ba0 of _0x72c375){if(!_0x4f1289['has'](_0x319ba0))try{const _0x49d485=await fetchSegment(_0xa7bf1,_0x2cd9ec,_0x319ba0,_0x230b87);if(_0x49d485?.[_0x3de00d(0x14c)]){const _0x538d7e=apiRuleToYaml(_0x49d485['rule']);_0x4f1289[_0x3de00d(0x204)](_0x319ba0,_0x538d7e),await _0x58187f(_0x538d7e);}}catch(_0xacd245){logger['debug']('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x319ba0+':\x20'+_0xacd245);}}};await _0x58187f(_0x1f74da);const _0x297e8b=serializeExpandedRule(_0x1f74da,_0x4f1289),_0x45ff5b=_0xf4c73a[_0x481030(0x1b1)](_0x297e8b);if(_0x45ff5b&&_0x45ff5b[_0x481030(0x164)]>0x0){const _0x21edd2=_0x2a8e47[_0x481030(0x1b1)](_0x297e8b)||0x0,_0x502978=_0x45ff5b[_0x21edd2]||_0x45ff5b[_0x45ff5b[_0x481030(0x164)]-0x1];_0x2a8e47[_0x481030(0x204)](_0x297e8b,_0x21edd2+0x1),_0x5e0a73=_0x502978,_0xa290e1[_0x481030(0x128)](_0x5e0a73),_0x258af5['set'](_0x599cf9,_0x5e0a73);const _0x57c73b=await resolveRuleSegmentRefs(_0x1f74da,async _0xfad175=>{const _0x46368c=_0x481030,_0x2cc824=_0x258af5[_0x46368c(0x1b1)](_0xfad175);if(_0x2cc824)return _0x2cc824;const _0x50feba=await _0xc18c34[_0x46368c(0x129)](_0xfad175);return _0x50feba[_0x46368c(0x13e)];});_0x4b7a91={'description':_0x162c61[_0x481030(0x190)],'rule':_0x57c73b};}else{const _0x5eb0e7=_0x1fc254[_0x481030(0x1b1)](_0x297e8b);if(_0x5eb0e7)_0x5e0a73=_0x5eb0e7,_0x258af5[_0x481030(0x204)](_0x599cf9,_0x5e0a73);else{if(_0x53a872){let _0x499af1=_0x53a872,_0x43fdac=0x2;while(_0xa290e1[_0x481030(0x1da)](_0x499af1)||_0x4a1a65[_0x481030(0x1da)](_0x499af1)){_0x499af1=_0x53a872+'_'+_0x43fdac,_0x43fdac++;}_0xa290e1[_0x481030(0x128)](_0x499af1),_0x5e0a73=_0x499af1;}_0x258af5[_0x481030(0x204)](_0x599cf9,_0x5e0a73),_0x1fc254[_0x481030(0x204)](_0x297e8b,_0x5e0a73);const _0x32bed2=await resolveRuleSegmentRefs(_0x1f74da,async _0x471d65=>{const _0x476c58=_0x481030,_0x262201=_0x258af5[_0x476c58(0x1b1)](_0x471d65);if(_0x262201)return _0x262201;const _0x1124e4=await _0xc18c34[_0x476c58(0x129)](_0x471d65);return _0x1124e4['name'];});_0x4b7a91={'description':_0x162c61[_0x481030(0x190)],'rule':_0x32bed2};}}}return{'name':_0x5e0a73,'isJourneyLocal':_0x1c5d81,'definition':_0x4b7a91};}catch(_0x314732){return logger[_0x481030(0x1c7)]('Failed\x20to\x20resolve\x20segment\x20'+_0x599cf9+':\x20'+_0x314732),{'name':_0x599cf9,'isJourneyLocal':![]};}},'resolveActivation':async _0x32f078=>{const _0x358bae=a142_0x361a,_0x1f4181=_0x4ab824[_0x358bae(0x1b1)](_0x32f078);if(_0x1f4181!==undefined)return{'name':_0x1f4181,'isJourneyLocal':!![]};try{let _0x4f15b3=_0x509c10?.[_0x358bae(0x1b1)](_0x32f078);!_0x4f15b3&&(_0x4f15b3=await _0xa7bf1[_0x358bae(0x169)][_0x358bae(0x1f6)](_0x4081ac,_0x32f078));const _0x4d5886=_0x4f15b3[_0x358bae(0x18a)][_0x358bae(0x1c1)][_0x358bae(0x13e)]||_0x32f078,_0x55a139=sanitizeYamlKey(_0x4d5886)||_0x358bae(0x145)+_0x32f078,_0x1976a3=_0x55a139;_0x4ab824[_0x358bae(0x204)](_0x32f078,_0x1976a3);const _0x125385=journeyActivationStepToYaml(_0x4f15b3,_0x414c15,_0x5648ba);return{'name':_0x1976a3,'isJourneyLocal':!![],'definition':_0x125385};}catch(_0x37d7f6){return logger['debug']('Failed\x20to\x20resolve\x20activation\x20'+_0x32f078+':\x20'+_0x37d7f6),{'name':_0x32f078,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x20e54c,_0x17369b)=>resolveJumpTarget(_0x20e54c,_0x17369b,_0x9fb272,async _0x26d12c=>{const _0x3b65c3=a142_0x361a,_0x1fee34=_0x20e76c?.[_0x3b65c3(0x1b1)](_0x26d12c);if(_0x1fee34)return _0x1fee34;return _0xa7bf1[_0x3b65c3(0x169)][_0x3b65c3(0x150)](_0x26d12c);})};return _0xc18c34=_0x29b8aa,_0x29b8aa;},_0x3e8e13=async _0x2f1c4c=>{const _0x1836e7=a142_0x361a,{collectSegmentIdsFromJourneyApi:_0x5744a6}=await import(_0x1836e7(0x213)),{batchAsync:_0x4f4aef}=await import(_0x1836e7(0x18b)),_0x256c51=new Set();for(const _0x400ad5 of _0x2f1c4c){let _0x4bafe2=_0x20e76c?.[_0x1836e7(0x1b1)](_0x400ad5);!_0x4bafe2&&(_0x4bafe2=await _0xa7bf1[_0x1836e7(0x169)][_0x1836e7(0x150)](_0x400ad5));const _0x508e90=_0x5744a6(_0x4bafe2);for(const _0x476035 of _0x508e90){_0x256c51[_0x1836e7(0x128)](_0x476035);}}let _0x1ee74f=Array[_0x1836e7(0x199)](_0x256c51);while(_0x1ee74f['length']>0x0){const _0x2f83b2=_0x1ee74f[_0x1836e7(0x192)](_0x39b3a5=>!_0x36a6bc[_0x1836e7(0x1da)](_0x39b3a5));if(_0x2f83b2[_0x1836e7(0x164)]===0x0)break;const _0x372698=await _0x4f4aef(_0x2f83b2,async _0x4973ed=>{const _0x4653df=_0x1836e7;_0x36a6bc[_0x4653df(0x128)](_0x4973ed);const _0x11aa5b=await fetchSegment(_0xa7bf1,_0x2cd9ec,_0x4973ed,_0x230b87);if(!_0x11aa5b)return null;return{'segmentId':_0x4973ed,'segment':_0x11aa5b};},0xa),_0x2018cf=new Set();for(const _0x5b05c0 of _0x372698){if(!_0x5b05c0?.[_0x1836e7(0x162)]?.[_0x1836e7(0x14c)])continue;const _0x8cc859=apiRuleToYaml(_0x5b05c0[_0x1836e7(0x162)][_0x1836e7(0x14c)]);_0x4f1289['set'](_0x5b05c0[_0x1836e7(0x191)],_0x8cc859);const _0x3acac9=collectSegmentRefsFromRule(_0x8cc859);for(const _0x4dad1a of _0x3acac9){!_0x36a6bc[_0x1836e7(0x1da)](_0x4dad1a)&&_0x2018cf[_0x1836e7(0x128)](_0x4dad1a);}}_0x1ee74f=Array[_0x1836e7(0x199)](_0x2018cf);}};return{'createYamlContext':_0x2a1a55,'prefetchJourneySegments':_0x3e8e13};}export async function executePushSegments(_0x2db69b,_0x40115f,_0x2aa1d1,_0x559fff,_0x589abb){const _0x2fc3b1=a142_0x5b9def,{segmentDefToCreateRequest:_0x2b342d,segmentDefToUpdateRequest:_0x45929b}=await import('./child-segment-yaml.js'),_0x2469b7=_0x2aa1d1[_0x2fc3b1(0x1db)],_0x46411f=0x5,_0x234530=async _0x19e058=>{const _0x564c78=_0x2fc3b1,_0xc03415=_0x19e058[_0x564c78(0x1bb)]?_0x2469b7[_0x564c78(0x1b1)](_0x19e058[_0x564c78(0x1bb)]):undefined;let _0x49f1af;const _0x565587={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x99d17b=_0x19e058[_0x564c78(0x219)];if(_0x19e058[_0x564c78(0x219)][_0x564c78(0x14c)]){const _0x3d170c=createSegmentIdResolver(_0x2aa1d1[_0x564c78(0x21e)],_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]),_0x4c628d=await resolveRuleSegmentIds(_0x19e058['yamlConfig'][_0x564c78(0x14c)],_0x3d170c);_0x99d17b={..._0x19e058[_0x564c78(0x219)],'rule':_0x4c628d};}try{if(_0x19e058[_0x564c78(0x1af)]){_0x589abb[_0x564c78(0x148)]?.({'type':_0x564c78(0x13a),'name':_0x19e058['yamlConfig']['name']});const _0x29a80e=_0x2b342d(_0x99d17b,_0xc03415),_0x33ece8=await _0x589abb[_0x564c78(0x1eb)](_0x564c78(0x140)+_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]+'\x27...',()=>_0x2db69b['segment'][_0x564c78(0x216)](_0x559fff['parentId'],_0x29a80e));_0x49f1af=_0x33ece8['data']['id'],_0x2aa1d1[_0x564c78(0x21e)][_0x564c78(0x204)](_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)],_0x49f1af),_0x565587[_0x564c78(0x138)]={'name':_0x19e058['yamlConfig'][_0x564c78(0x13e)],'id':_0x49f1af},_0x589abb[_0x564c78(0x148)]?.({'type':'segment_created','name':_0x19e058['yamlConfig'][_0x564c78(0x13e)],'segmentId':_0x49f1af}),_0x589abb[_0x564c78(0x155)]?.(_0x564c78(0x165)+_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]+'\x27'),_0x565587[_0x564c78(0x1fa)]=0x1;}else{if(_0x19e058['hasChanges']){_0x589abb[_0x564c78(0x148)]?.({'type':'segment_updating','name':_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]});const _0x22ed54=_0x45929b(_0x99d17b);_0xc03415!==_0x19e058[_0x564c78(0x1ad)]?.[_0x564c78(0x1d7)]&&(_0x22ed54['segmentFolderId']=_0xc03415?parseInt(_0xc03415,0xa):undefined),await _0x589abb[_0x564c78(0x1eb)](_0x564c78(0x15e)+_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]+_0x564c78(0x19c),()=>_0x2db69b['segment'][_0x564c78(0x1df)](_0x559fff[_0x564c78(0x13d)],_0x19e058[_0x564c78(0x1ad)]['id'],_0x22ed54)),_0x49f1af=_0x19e058[_0x564c78(0x1ad)]['id'],_0x589abb['onProgress']?.({'type':'segment_updated','name':_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]}),_0x589abb['logSuccess']?.(_0x564c78(0x214)+_0x19e058['yamlConfig']['name']+'\x27'),_0x565587[_0x564c78(0x20f)]=0x1;}else _0x49f1af=_0x19e058[_0x564c78(0x1ad)]['id'];}}catch(_0x4efde8){const _0x45d614=isHttp400Error(_0x4efde8),_0x1e0b2d=_0x45d614?ErrorCode[_0x564c78(0x20c)]:ErrorCode[_0x564c78(0x16e)],_0x513398=getErrorMessage(_0x4efde8);throw new SDKError(_0x1e0b2d,'Failed\x20to\x20'+(_0x19e058[_0x564c78(0x1af)]?_0x564c78(0x1d1):_0x564c78(0x1c3))+_0x564c78(0x210)+_0x19e058[_0x564c78(0x156)]+_0x564c78(0x143)+_0x513398,_0x4efde8);}try{const _0x1bd399=await syncActivationsForSegment(_0x2db69b,_0x559fff[_0x564c78(0x13d)],_0x49f1af,_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)],_0x19e058[_0x564c78(0x175)],_0x589abb,_0x19e058['absolutePath']);_0x565587[_0x564c78(0x1d5)]=_0x1bd399;}catch(_0x448ade){if(_0x448ade instanceof SDKError)throw _0x448ade;throw new SDKError(ErrorCode[_0x564c78(0x159)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x19e058['yamlConfig']['name']+_0x564c78(0x1c9)+_0x19e058[_0x564c78(0x156)]+_0x564c78(0x143)+getErrorMessage(_0x448ade),_0x448ade);}return _0x565587;},_0x44771e=await batchAsync(_0x40115f,_0x234530,_0x46411f),_0x2f2bd7={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x457462 of _0x44771e){_0x2f2bd7[_0x2fc3b1(0x1fa)]+=_0x457462[_0x2fc3b1(0x1fa)],_0x2f2bd7[_0x2fc3b1(0x20f)]+=_0x457462['updated'],_0x457462[_0x2fc3b1(0x138)]&&_0x2f2bd7[_0x2fc3b1(0x1b6)][_0x2fc3b1(0x204)](_0x457462[_0x2fc3b1(0x138)][_0x2fc3b1(0x13e)],_0x457462[_0x2fc3b1(0x138)]['id']),_0x2f2bd7[_0x2fc3b1(0x1d5)]['created']+=_0x457462[_0x2fc3b1(0x1d5)]['created'],_0x2f2bd7['activations'][_0x2fc3b1(0x20f)]+=_0x457462[_0x2fc3b1(0x1d5)]['updated'],_0x2f2bd7['activations'][_0x2fc3b1(0x200)]+=_0x457462['activations'][_0x2fc3b1(0x200)];}return _0x2f2bd7;}async function syncActivationsForSegment(_0x180cca,_0x15643a,_0x4b8441,_0x497751,_0x1401b8,_0x5391e8,_0x13395a){const _0x272d6f=a142_0x5b9def,_0x541fcb={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x28e38b of _0x1401b8){try{if(_0x28e38b['type']===_0x272d6f(0x1d1)&&_0x28e38b[_0x272d6f(0x1a3)])_0x5391e8[_0x272d6f(0x148)]?.({'type':'activation_creating','segmentName':_0x497751,'activationName':_0x28e38b[_0x272d6f(0x13e)]}),await _0x5391e8[_0x272d6f(0x1eb)](_0x272d6f(0x178)+_0x28e38b[_0x272d6f(0x13e)]+_0x272d6f(0x19c),()=>_0x180cca[_0x272d6f(0x162)][_0x272d6f(0x135)](_0x15643a,_0x4b8441,_0x28e38b[_0x272d6f(0x1a3)])),_0x5391e8['onProgress']?.({'type':_0x272d6f(0x149),'segmentName':_0x497751,'activationName':_0x28e38b[_0x272d6f(0x13e)]}),_0x5391e8[_0x272d6f(0x155)]?.(_0x272d6f(0x1ed)+_0x28e38b[_0x272d6f(0x13e)]+'\x27'),_0x541fcb['created']++;else{if(_0x28e38b[_0x272d6f(0x17b)]==='update'&&_0x28e38b[_0x272d6f(0x1a3)]&&_0x28e38b[_0x272d6f(0x15c)])_0x5391e8['onProgress']?.({'type':'activation_updating','segmentName':_0x497751,'activationName':_0x28e38b[_0x272d6f(0x13e)]}),await _0x5391e8['withProgress']('Updating\x20activation\x20\x27'+_0x28e38b[_0x272d6f(0x13e)]+_0x272d6f(0x19c),()=>_0x180cca['segment'][_0x272d6f(0x19e)](_0x15643a,_0x4b8441,_0x28e38b[_0x272d6f(0x15c)]['id'],_0x28e38b[_0x272d6f(0x1a3)])),_0x5391e8['onProgress']?.({'type':'activation_updated','segmentName':_0x497751,'activationName':_0x28e38b['name']}),_0x5391e8[_0x272d6f(0x155)]?.(_0x272d6f(0x1a2)+_0x28e38b[_0x272d6f(0x13e)]+'\x27'),_0x541fcb[_0x272d6f(0x20f)]++;else _0x28e38b['type']===_0x272d6f(0x173)&&_0x28e38b[_0x272d6f(0x15c)]&&(_0x5391e8[_0x272d6f(0x148)]?.({'type':_0x272d6f(0x1aa),'segmentName':_0x497751,'activationName':_0x28e38b[_0x272d6f(0x13e)]}),await _0x5391e8[_0x272d6f(0x1eb)]('Deleting\x20activation\x20\x27'+_0x28e38b['name']+_0x272d6f(0x19c),()=>_0x180cca[_0x272d6f(0x162)][_0x272d6f(0x1b2)](_0x15643a,_0x4b8441,_0x28e38b[_0x272d6f(0x15c)]['id'])),_0x5391e8['onProgress']?.({'type':_0x272d6f(0x20a),'segmentName':_0x497751,'activationName':_0x28e38b[_0x272d6f(0x13e)]}),_0x5391e8[_0x272d6f(0x1fe)]?.(_0x272d6f(0x17d)+_0x28e38b[_0x272d6f(0x13e)]+'\x27'),_0x541fcb[_0x272d6f(0x200)]++);}}catch(_0x34c63c){const _0x3804b4=isHttp400Error(_0x34c63c),_0x3f18d9=_0x3804b4?ErrorCode[_0x272d6f(0x185)]:ErrorCode[_0x272d6f(0x159)],_0x2c87ab=getErrorMessage(_0x34c63c);throw new SDKError(_0x3f18d9,'Failed\x20to\x20'+_0x28e38b['type']+'\x20activation\x20\x27'+_0x28e38b[_0x272d6f(0x13e)]+'\x27\x20from\x20file:\x20'+_0x13395a+_0x272d6f(0x143)+_0x2c87ab,_0x34c63c);}}return _0x541fcb;}export async function executePushFolders(_0x1a8917,_0x39202f,_0x6efc97,_0xaea03a,_0x213591){const _0x1910d8=a142_0x5b9def,_0x26d6bf=new Map(_0x6efc97),_0xbcf289=sortFoldersByDepth(_0x39202f);for(const _0x3225ba of _0xbcf289){const _0x109f61=_0x3225ba['split']('/'),_0xd0c45a=_0x109f61[_0x109f61[_0x1910d8(0x164)]-0x1],_0x59f2f7=_0x109f61[_0x1910d8(0x12e)](0x0,-0x1)[_0x1910d8(0x1e3)]('/'),_0x201eb9=_0x26d6bf['get'](_0x59f2f7);_0x213591[_0x1910d8(0x148)]?.({'type':'folder_creating','folder':_0x3225ba});const _0x21b5d8={'name':_0xd0c45a,'parentFolderId':_0x201eb9},_0x31bb8c=await _0x213591[_0x1910d8(0x1eb)](_0x1910d8(0x170)+_0x3225ba+_0x1910d8(0x19c),()=>_0x1a8917['segment'][_0x1910d8(0x1f4)](_0xaea03a['parentId'],_0x21b5d8));_0x26d6bf[_0x1910d8(0x204)](_0x3225ba,_0x31bb8c[_0x1910d8(0x126)]['id']),_0x213591[_0x1910d8(0x148)]?.({'type':_0x1910d8(0x1ec),'folder':_0x3225ba,'folderId':_0x31bb8c[_0x1910d8(0x126)]['id']}),_0x213591[_0x1910d8(0x125)]?.(_0x1910d8(0x197)+_0x3225ba+'\x27');}return _0x26d6bf;}export async function executePushSegmentDeletions(_0x3ac322,_0x563782,_0x5191a7){const _0x4c988f=a142_0x5b9def;if(_0x563782[_0x4c988f(0x164)]===0x0)return 0x0;const {batchAsync:_0x643a1b}=await import(_0x4c988f(0x18b)),_0x215d35=0x5,_0x4352d1=await _0x643a1b(_0x563782,async _0x4aa51f=>{const _0x32fef7=_0x4c988f;return _0x5191a7[_0x32fef7(0x148)]?.({'type':_0x32fef7(0x14b),'name':_0x4aa51f[_0x32fef7(0x13e)]}),await _0x3ac322['segment'][_0x32fef7(0x1d6)](_0x4aa51f['id']),_0x5191a7[_0x32fef7(0x148)]?.({'type':_0x32fef7(0x20b),'name':_0x4aa51f[_0x32fef7(0x13e)]}),_0x5191a7[_0x32fef7(0x1fe)]?.(_0x32fef7(0x1ba)+_0x4aa51f[_0x32fef7(0x13e)]+'\x27'),0x1;},_0x215d35);return _0x4352d1[_0x4c988f(0x1fc)]((_0x1653bd,_0x363db2)=>_0x1653bd+_0x363db2,0x0);}export async function executePushJourneys(_0x419963,_0x2e5393,_0x59aed5,_0x37d098,_0x4db60a){const _0x4063f4=a142_0x5b9def,{journeyDefToRequest:_0x2c7430}=await import(_0x4063f4(0x213)),{activationDefToCreateRequest:_0x1957a6,yamlRuleToApi:_0x39e886,validateSegmentRule:_0x2ad619}=await import('./child-segment-yaml.js'),_0x528f15={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x43c515=new Map(_0x59aed5[_0x4063f4(0x21e)]),_0x3f6c64=0x5;for(let _0x569a1c=0x0;_0x569a1c<_0x2e5393[_0x4063f4(0x164)];_0x569a1c+=_0x3f6c64){const _0x37f8d9=_0x2e5393[_0x4063f4(0x12e)](_0x569a1c,_0x569a1c+_0x3f6c64),_0x54125d=await Promise['all'](_0x37f8d9[_0x4063f4(0x17c)](async _0x51af5a=>{const _0x3202f0=_0x4063f4;if(!_0x51af5a['isNew']&&!_0x51af5a['hasChanges'])return{'action':'unchanged','name':_0x51af5a[_0x3202f0(0x219)]['name'],'journeyId':_0x51af5a[_0x3202f0(0x19b)]?.['id']};const _0x3ea679=_0x51af5a[_0x3202f0(0x1bb)]?_0x59aed5[_0x3202f0(0x1db)][_0x3202f0(0x1b1)](_0x51af5a[_0x3202f0(0x1bb)]):undefined;_0x4db60a[_0x3202f0(0x148)]?.({'type':_0x51af5a['isNew']?_0x3202f0(0x1c8):_0x3202f0(0x1f7),'name':_0x51af5a[_0x3202f0(0x219)][_0x3202f0(0x13e)]});try{const _0x5b7ab9=await executeSingleJourneyPush(_0x419963,_0x51af5a,{..._0x59aed5,'segmentNameToId':_0x43c515},{'parentId':_0x37d098['parentId'],'rootFolderId':_0x37d098[_0x3202f0(0x167)],'folderId':_0x3ea679,'verbose':_0x37d098[_0x3202f0(0x221)]},_0x4db60a,{'journeyDefToRequest':_0x2c7430,'activationDefToCreateRequest':_0x1957a6,'yamlRuleToApi':_0x39e886,'validateSegmentRule':_0x2ad619});for(const [_0x4ac0c6,_0x3e5b11]of _0x5b7ab9[_0x3202f0(0x146)]){_0x43c515[_0x3202f0(0x204)](_0x4ac0c6,_0x3e5b11),_0x528f15[_0x3202f0(0x146)]['set'](_0x4ac0c6,_0x3e5b11);}if(_0x5b7ab9[_0x3202f0(0x17e)]===_0x3202f0(0x1fa))_0x4db60a['onProgress']?.({'type':_0x3202f0(0x139),'name':_0x51af5a[_0x3202f0(0x219)][_0x3202f0(0x13e)],'journeyId':_0x5b7ab9[_0x3202f0(0x1b7)]}),_0x4db60a[_0x3202f0(0x155)]?.(_0x3202f0(0x1fb)+_0x51af5a[_0x3202f0(0x219)][_0x3202f0(0x13e)]+'\x27'),_0x528f15[_0x3202f0(0x1fa)]++;else _0x5b7ab9[_0x3202f0(0x17e)]===_0x3202f0(0x20f)&&(_0x4db60a[_0x3202f0(0x148)]?.({'type':_0x3202f0(0x193),'name':_0x51af5a[_0x3202f0(0x219)]['name']}),_0x4db60a['logSuccess']?.(_0x3202f0(0x17a)+_0x51af5a[_0x3202f0(0x219)]['name']+'\x27'),_0x528f15['updated']++);return{'action':_0x5b7ab9[_0x3202f0(0x17e)],'name':_0x51af5a['yamlConfig']['name'],'journeyId':_0x5b7ab9[_0x3202f0(0x1b7)]};}catch(_0x59a13d){const _0x294fe3=isHttp400Error(_0x59a13d),_0x65085d=_0x294fe3?ErrorCode[_0x3202f0(0x20e)]:ErrorCode[_0x3202f0(0x1f2)],_0x12898b=getErrorMessage(_0x59a13d);throw new SDKError(_0x65085d,_0x3202f0(0x13b)+(_0x51af5a['isNew']?_0x3202f0(0x1d1):_0x3202f0(0x1c3))+'\x20journey\x20from\x20file:\x20'+_0x51af5a[_0x3202f0(0x156)]+_0x3202f0(0x143)+_0x12898b,_0x59a13d);}}));_0x528f15[_0x4063f4(0x1f0)][_0x4063f4(0x188)](..._0x54125d);}return _0x528f15;}async function matchExistingJourneySegments(_0x187695,_0x42ad9d,_0x5264d0,_0x272e67,_0x6f0ef5){const _0x218112=a142_0x5b9def;if(!_0x42ad9d['existingJourney']||!_0x42ad9d[_0x218112(0x219)]['segments'])return;const _0x428f03=new Map(),_0x2ada2f=new Set();for(const _0x481345 of Object[_0x218112(0x205)](_0x42ad9d[_0x218112(0x219)][_0x218112(0x15b)])){const _0x174349=generateDeterministicJourneySegmentName(_0x42ad9d[_0x218112(0x219)]['name'],_0x481345);_0x428f03[_0x218112(0x204)](_0x174349,_0x481345),_0x2ada2f[_0x218112(0x128)](_0x481345);}const _0x5874f3=[],_0x46139e=collectSegmentIdsFromJourneyApi(_0x42ad9d[_0x218112(0x19b)]);for(const _0x320f22 of _0x46139e){const _0x1693b5=await fetchSegment(_0x187695,_0x5264d0,_0x320f22,_0x272e67);if(!_0x1693b5?.[_0x218112(0x13e)])continue;const _0x526211=_0x428f03[_0x218112(0x1b1)](_0x1693b5[_0x218112(0x13e)]);_0x526211?(_0x6f0ef5[_0x218112(0x204)](_0x526211,_0x320f22),_0x2ada2f['delete'](_0x526211)):_0x5874f3[_0x218112(0x188)]({'id':_0x320f22,'seg':_0x1693b5});}if(_0x2ada2f[_0x218112(0x152)]>0x0&&_0x5874f3[_0x218112(0x164)]>0x0){const {localExpandedRuleToNames:_0x2b3e2d}=buildLocalExpandedRuleMappings(_0x42ad9d[_0x218112(0x219)]),_0x247a44=new Map();for(const {id:_0x5a91ca,seg:_0x45b543}of _0x5874f3){if(_0x45b543[_0x218112(0x14c)]){const _0x3b2937=apiRuleToYaml(_0x45b543[_0x218112(0x14c)]);_0x247a44['set'](_0x5a91ca,_0x3b2937);}}for(const {id:_0x48f4f2,seg:_0x5e697f}of _0x5874f3){if(!_0x5e697f[_0x218112(0x14c)])continue;const _0x1de032=_0x247a44[_0x218112(0x1b1)](_0x48f4f2);if(!_0x1de032)continue;const _0x1a52f5=serializeExpandedRule(_0x1de032,_0x247a44),_0x2bc24c=_0x2b3e2d[_0x218112(0x1b1)](_0x1a52f5);if(_0x2bc24c){const _0x4fee32=_0x2bc24c[_0x218112(0x1c5)](_0x102a62=>_0x2ada2f['has'](_0x102a62));_0x4fee32&&(_0x6f0ef5[_0x218112(0x204)](_0x4fee32,_0x48f4f2),_0x2ada2f[_0x218112(0x173)](_0x4fee32),logger[_0x218112(0x1c7)](_0x218112(0x16c)+_0x5e697f[_0x218112(0x13e)]+_0x218112(0x182)+_0x4fee32+_0x218112(0x187)));}}}}async function executeSingleJourneyPush(_0x2395a0,_0x197416,_0x122c1d,_0x2edff7,_0x223588,_0x4c4a77){const _0x10b21c=a142_0x5b9def,{journeyDefToRequest:_0x2ec786,activationDefToCreateRequest:_0x396506,yamlRuleToApi:_0x21943c,validateSegmentRule:_0x38225c}=_0x4c4a77,_0x5b0685=new Map(),_0x13bbc8=new Map();recoverSegmentIdsFromPushRecovery(_0x197416,_0x5b0685,_0x122c1d[_0x10b21c(0x21e)]);const _0x44756b=new Map(),_0x4e1579=new Map(),_0x166001=new Map();let _0x1fa7f5;const _0x1e2806=async()=>{const _0xaa1403=_0x10b21c;if(_0x1fa7f5)return;_0x1fa7f5=new Map();if(!_0x197416[_0xaa1403(0x19b)])return;const _0x3bebbc=await _0x2395a0[_0xaa1403(0x169)][_0xaa1403(0x184)](_0x197416[_0xaa1403(0x19b)]['id']);for(const _0x2c902a of _0x3bebbc){const _0x7cc1f6=journeyActivationStepToYaml(_0x2c902a,_0x122c1d[_0xaa1403(0x141)],_0x122c1d['connectionIdToNameMap']),_0x2c4b1a=activationSignature(_0x7cc1f6);!_0x1fa7f5[_0xaa1403(0x1da)](_0x2c4b1a)&&_0x1fa7f5[_0xaa1403(0x204)](_0x2c4b1a,_0x2c902a['id']),_0x7cc1f6[_0xaa1403(0x13e)]&&_0x13bbc8['set'](_0x7cc1f6[_0xaa1403(0x13e)],_0x2c902a['id']);}};await matchExistingJourneySegments(_0x2395a0,_0x197416,_0x2edff7[_0x10b21c(0x13d)],_0x122c1d[_0x10b21c(0x1ee)],_0x122c1d[_0x10b21c(0x21e)]);const _0x2cc9ae={'resolveSegmentId':async _0x417922=>{const _0x5b8a97=_0x10b21c,_0x121936=_0x122c1d['segmentNameToId'][_0x5b8a97(0x1b1)](_0x417922);if(!_0x121936)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5b8a97(0x1a0)+_0x417922+'\x20(referenced\x20in\x20journey\x20'+_0x197416[_0x5b8a97(0x219)][_0x5b8a97(0x13e)]+')');return _0x121936;},'resolveEmbeddedSegmentId':async(_0x10f796,_0x1525cc)=>{const _0x1cbd3d=_0x10b21c,_0x1b4377=_0x122c1d[_0x1cbd3d(0x21e)][_0x1cbd3d(0x1b1)](_0x10f796);if(_0x1b4377)return _0x1b4377;const _0x26cb47=_0x122c1d[_0x1cbd3d(0x1ee)][_0x1cbd3d(0x1c5)](_0x2826bf=>_0x2826bf[_0x1cbd3d(0x13e)]===_0x10f796);if(_0x26cb47)return _0x122c1d[_0x1cbd3d(0x21e)]['set'](_0x10f796,_0x26cb47['id']),_0x26cb47['id'];if(_0x197416[_0x1cbd3d(0x1af)]){const {stageName:_0x467ed5,criteriaName:_0x30fd7f}=findSegmentCriteriaLocation(_0x197416[_0x1cbd3d(0x219)],_0x10f796);return _0x38225c(_0x10f796,_0x1525cc[_0x1cbd3d(0x14c)]),_0x4e1579['set'](_0x10f796,{'definition':_0x1525cc,'stageName':_0x467ed5,'criteriaName':_0x30fd7f}),createPendingSegmentId(_0x10f796);}const _0x239608=_0x197416[_0x1cbd3d(0x19b)]?.['id'];if(!_0x239608)throw new SDKError(ErrorCode[_0x1cbd3d(0x1d2)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x5bd33e=_0x44756b[_0x1cbd3d(0x1b1)](_0x10f796);if(_0x5bd33e)return _0x5bd33e;const _0x1ba79c=((async()=>{const _0x522c5b=_0x1cbd3d;_0x38225c(_0x10f796,_0x1525cc[_0x522c5b(0x14c)]);const _0x305d47=generateDeterministicJourneySegmentName(_0x197416['yamlConfig'][_0x522c5b(0x13e)],_0x10f796),_0x4c19d6=_0x122c1d[_0x522c5b(0x1ee)][_0x522c5b(0x1c5)](_0x4a0188=>_0x4a0188[_0x522c5b(0x13e)]===_0x305d47),_0x1b35c6=createSegmentIdResolver(_0x122c1d[_0x522c5b(0x21e)],_0x10f796),_0x290bdc=await resolveRuleSegmentIds(_0x1525cc[_0x522c5b(0x14c)],_0x1b35c6);let _0x2a00d4;return _0x4c19d6?(await _0x2395a0['segment'][_0x522c5b(0x1df)](_0x2edff7[_0x522c5b(0x13d)],_0x4c19d6['id'],{'description':_0x1525cc[_0x522c5b(0x190)]||_0x522c5b(0x131)+_0x10f796,'rule':_0x21943c(_0x290bdc,!![]),'countPopulation':!![]}),_0x2a00d4=_0x4c19d6['id'],saveSegmentToPushRecovery(_0x197416[_0x522c5b(0x156)],_0x197416[_0x522c5b(0x219)][_0x522c5b(0x13e)],_0x10f796,{'segmentId':_0x2a00d4,'uniqueServerName':_0x305d47,'createdAt':new Date()[_0x522c5b(0x177)]()})):_0x2a00d4=await createOrRecoverEmbeddedSegment(_0x2395a0,_0x197416,{'localName':_0x10f796,'uniqueSegmentName':_0x305d47,'description':_0x1525cc[_0x522c5b(0x190)]||_0x522c5b(0x131)+_0x10f796,'journeyId':_0x239608,'resolvedRule':_0x290bdc,'parentId':_0x2edff7['parentId'],'folderId':_0x2edff7[_0x522c5b(0x167)]||''},_0x21943c),_0x122c1d[_0x522c5b(0x21e)]['set'](_0x10f796,_0x2a00d4),_0x5b0685[_0x522c5b(0x204)](_0x10f796,_0x2a00d4),_0x2a00d4;})());_0x44756b['set'](_0x10f796,_0x1ba79c);try{return await _0x1ba79c;}finally{_0x44756b['delete'](_0x10f796);}},'resolveActivationId':async _0x1ffe38=>{const _0xa9b4e7=_0x10b21c,_0x215c43=_0x13bbc8[_0xa9b4e7(0x1b1)](_0x1ffe38);if(_0x215c43)return _0x215c43;if(_0x197416['existingJourney']){await _0x1e2806();const _0x17cc35=_0x13bbc8[_0xa9b4e7(0x1b1)](_0x1ffe38);if(_0x17cc35)return _0x17cc35;}throw new SDKError(ErrorCode[_0xa9b4e7(0x14e)],'Activation\x20not\x20found:\x20'+_0x1ffe38+_0xa9b4e7(0x206)+_0x197416[_0xa9b4e7(0x219)][_0xa9b4e7(0x13e)]+_0xa9b4e7(0x186)+_0xa9b4e7(0x1b8));},'resolveEmbeddedActivationId':async(_0x25e30f,_0x3f2b02)=>{const _0x7d805a=_0x10b21c,_0x52940d=_0x13bbc8['get'](_0x25e30f);if(_0x52940d)return _0x52940d;if(_0x197416[_0x7d805a(0x1af)])return _0x166001[_0x7d805a(0x204)](_0x25e30f,_0x3f2b02),createPendingActivationId(_0x25e30f);if(_0x197416['existingJourney']){await _0x1e2806();const _0x45cbe3=_0x13bbc8[_0x7d805a(0x1b1)](_0x3f2b02['name']);if(_0x45cbe3)return _0x13bbc8['set'](_0x25e30f,_0x45cbe3),_0x45cbe3;const _0x23580e=activationSignature(_0x3f2b02),_0x24384c=_0x1fa7f5?.[_0x7d805a(0x1b1)](_0x23580e);if(_0x24384c)return _0x13bbc8['set'](_0x25e30f,_0x24384c),_0x24384c;const _0x54f7cc=await _0x396506(_0x3f2b02,_0x122c1d['activationContext']),_0x5cf1bf={..._0x54f7cc,..._0x3f2b02[_0x7d805a(0x1ef)]!==undefined&&{'runAfterJourneyRefresh':_0x3f2b02[_0x7d805a(0x1ef)]}},_0xc6a545=await _0x2395a0[_0x7d805a(0x169)][_0x7d805a(0x135)](_0x197416[_0x7d805a(0x19b)]['id'],_0x5cf1bf);return _0x13bbc8[_0x7d805a(0x204)](_0x25e30f,_0xc6a545['id']),_0xc6a545['id'];}throw new SDKError(ErrorCode[_0x7d805a(0x1d2)],_0x7d805a(0x127));},'resolveJourneyId':async _0xb1ecd1=>{const _0x3bf19a=_0x10b21c;try{return await _0x2395a0['journey'][_0x3bf19a(0x154)](_0x2edff7['parentId'],_0xb1ecd1);}catch(_0x1ae32c){throw new SDKError(ErrorCode[_0x3bf19a(0x14e)],'Journey\x20\x27'+_0xb1ecd1+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x197416[_0x3bf19a(0x219)][_0x3bf19a(0x13e)]+'\x27)',_0x1ae32c);}},'resolveStageId':async(_0x3a3777,_0xbbf602)=>{const _0x227cec=_0x10b21c,_0xd3b5b0=await _0x2395a0['journey']['getJourney'](_0x3a3777),_0x7fe8f8=_0xd3b5b0[_0x227cec(0x18a)]['journeyStages'][_0x227cec(0x1c5)](_0x3e5ab0=>_0x3e5ab0[_0x227cec(0x13e)][_0x227cec(0x217)]()===_0xbbf602[_0x227cec(0x217)]());if(!_0x7fe8f8?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x227cec(0x1b5)+_0xbbf602+_0x227cec(0x1ce)+(_0xd3b5b0['attributes']['journeyBundleName']||_0xd3b5b0[_0x227cec(0x18a)][_0x227cec(0x13e)])+'\x27');return _0x7fe8f8['id'];}},_0x2d60b5=await _0x2ec786(_0x197416[_0x10b21c(0x219)],_0x2edff7['parentId'],_0x2cc9ae),_0x2b7064=_0x2edff7[_0x10b21c(0x132)]||_0x2edff7['rootFolderId'];_0x2b7064&&(_0x2d60b5['relationships']={'parentFolder':{'data':{'id':_0x2b7064,'type':_0x10b21c(0x144)}}});if(_0x197416['isNew']){if(_0x4e1579['size']>0x0||_0x166001['size']>0x0)return await executeThreeStepJourneyCreate(_0x2395a0,_0x197416,_0x2d60b5,{'pendingEmbeddedSegments':_0x4e1579,'pendingEmbeddedActivations':_0x166001,'embeddedSegmentNameToId':_0x5b0685,'journeyActivationNameToId':_0x13bbc8},{..._0x2edff7,'effectiveFolderId':_0x2b7064},_0x122c1d,_0x223588,_0x4c4a77);else{ensureJourneyDefaults(_0x2d60b5[_0x10b21c(0x18a)]);const _0x2ccf71=await _0x2395a0['journey']['create'](_0x2d60b5);return deletePushRecovery(_0x197416['absolutePath']),{'action':'created','journeyId':_0x2ccf71['id'],'embeddedSegmentNameToId':_0x5b0685};}}else{if(_0x197416[_0x10b21c(0x161)]&&_0x197416[_0x10b21c(0x19b)]){_0x2d60b5['id']=_0x197416[_0x10b21c(0x19b)]['id'];const _0x4693b0=_0x2d60b5[_0x10b21c(0x18a)];_0x197416['existingJourney'][_0x10b21c(0x18a)]?.[_0x10b21c(0x1ab)]&&(_0x4693b0[_0x10b21c(0x1ab)]=_0x197416[_0x10b21c(0x19b)][_0x10b21c(0x18a)][_0x10b21c(0x1ab)]);const _0x203c97=_0x197416['existingJourney'][_0x10b21c(0x18a)]?.['journeyStages'];return _0x203c97&&_0x2d60b5[_0x10b21c(0x18a)][_0x10b21c(0x21d)]&&injectExistingStageIds(_0x2d60b5[_0x10b21c(0x18a)][_0x10b21c(0x21d)],_0x203c97),ensureJourneyDefaults(_0x4693b0),await _0x2395a0[_0x10b21c(0x169)][_0x10b21c(0x1c3)](_0x197416[_0x10b21c(0x19b)]['id'],_0x2d60b5),deletePushRecovery(_0x197416[_0x10b21c(0x156)]),{'action':_0x10b21c(0x20f),'journeyId':_0x197416['existingJourney']['id'],'embeddedSegmentNameToId':_0x5b0685};}}return deletePushRecovery(_0x197416[_0x10b21c(0x156)]),{'action':_0x10b21c(0x1b9),'journeyId':_0x197416['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x5b0685};}function findSegmentCriteriaLocation(_0x331046,_0x4b4a27){const _0x5821db=a142_0x5b9def,_0x6df35a=_0x331046[_0x5821db(0x14f)]||_0x331046[_0x5821db(0x212)]?.[0x0]?.[_0x5821db(0x14f)]||[];let _0x4596bd='entry',_0xa189e0=_0x4b4a27;const _0x2a2108=_0x331046[_0x5821db(0x1ac)]||_0x331046[_0x5821db(0x212)]?.[0x0]?.[_0x5821db(0x1ac)];if(_0x2a2108?.[_0x5821db(0x162)]===_0x4b4a27)return{'stageName':_0x5821db(0x1ac),'criteriaName':_0x2a2108[_0x5821db(0x13e)]||_0x4b4a27};_0x55cc6c:for(const _0x18bdcd of _0x6df35a){if(_0x18bdcd[_0x5821db(0x1b4)]?.[_0x5821db(0x162)]===_0x4b4a27){_0x4596bd=_0x18bdcd[_0x5821db(0x13e)],_0xa189e0=_0x18bdcd[_0x5821db(0x1b4)][_0x5821db(0x13e)]||_0x4b4a27;break;}if(_0x18bdcd[_0x5821db(0x134)])for(const _0x5e0703 of _0x18bdcd[_0x5821db(0x134)]){if(_0x5e0703['type']==='decision_point'&&_0x5e0703['with']?.['branches'])for(const _0x32276d of _0x5e0703[_0x5821db(0x176)][_0x5821db(0x1ca)]){if(_0x32276d['segment']===_0x4b4a27){_0x4596bd=_0x18bdcd[_0x5821db(0x13e)],_0xa189e0=_0x32276d[_0x5821db(0x13e)]||_0x4b4a27;break _0x55cc6c;}}}}return{'stageName':_0x4596bd,'criteriaName':_0xa189e0};}async function executeThreeStepJourneyCreate(_0x4f4cdb,_0x5c6863,_0x36999a,_0x353ed4,_0x1bc477,_0x2edfcd,_0x2f6630,_0x2b847e){const _0x380613=a142_0x5b9def,{activationDefToCreateRequest:_0x33925e,yamlRuleToApi:_0x5cf754}=_0x2b847e,{pendingEmbeddedSegments:_0x54fe25,pendingEmbeddedActivations:_0x67c8cf,embeddedSegmentNameToId:_0x52aa92}=_0x353ed4,_0x166a0e=JSON[_0x380613(0x16f)](JSON[_0x380613(0x1dd)](_0x36999a));ensureJourneyDefaults(_0x166a0e[_0x380613(0x18a)]),stripPendingIds(_0x166a0e);const _0x41aa9a=await _0x4f4cdb[_0x380613(0x169)][_0x380613(0x1d1)](_0x166a0e),_0x3c00d2=_0x41aa9a['id'],_0x1dd5f9=new Map();for(const _0x5d30c8 of _0x41aa9a[_0x380613(0x18a)][_0x380613(0x21d)]){_0x1dd5f9[_0x380613(0x204)](_0x5d30c8[_0x380613(0x13e)][_0x380613(0x217)](),_0x5d30c8['id']);}recoverSegmentIdsFromPushRecovery(_0x5c6863,_0x52aa92,_0x2edfcd[_0x380613(0x21e)]);for(const [_0x47125a,{definition:_0x4a4929}]of _0x54fe25){if(_0x52aa92[_0x380613(0x1da)](_0x47125a)){_0x2f6630[_0x380613(0x148)]?.({'type':_0x380613(0x14a),'journeyName':_0x5c6863[_0x380613(0x219)]['name'],'segmentName':_0x47125a});continue;}const _0x41d147=generateDeterministicJourneySegmentName(_0x5c6863[_0x380613(0x219)][_0x380613(0x13e)],_0x47125a);_0x2f6630['onProgress']?.({'type':_0x380613(0x189),'journeyName':_0x5c6863[_0x380613(0x219)][_0x380613(0x13e)],'segmentName':_0x47125a});const _0xc95687=createSegmentIdResolver(_0x2edfcd[_0x380613(0x21e)],_0x47125a),_0x2af6d1=await resolveRuleSegmentIds(_0x4a4929[_0x380613(0x14c)],_0xc95687),_0x5f4f4c=await createOrRecoverEmbeddedSegment(_0x4f4cdb,_0x5c6863,{'localName':_0x47125a,'uniqueSegmentName':_0x41d147,'description':_0x4a4929['description']||_0x380613(0x131)+_0x47125a,'journeyId':_0x3c00d2,'resolvedRule':_0x2af6d1,'parentId':_0x1bc477[_0x380613(0x13d)],'folderId':_0x1bc477['effectiveFolderId']||''},_0x5cf754);_0x52aa92[_0x380613(0x204)](_0x47125a,_0x5f4f4c),_0x2edfcd[_0x380613(0x21e)][_0x380613(0x204)](_0x47125a,_0x5f4f4c),_0x2f6630[_0x380613(0x148)]?.({'type':_0x380613(0x14a),'journeyName':_0x5c6863[_0x380613(0x219)][_0x380613(0x13e)],'segmentName':_0x47125a});}const _0x2b1eda=new Map();for(const [_0x36f324,_0x51ea75]of _0x67c8cf){_0x2f6630['onProgress']?.({'type':_0x380613(0x133),'journeyName':_0x5c6863['yamlConfig']['name'],'activationName':_0x36f324});const _0x18f507=await _0x33925e(_0x51ea75,_0x2edfcd[_0x380613(0x1be)]),_0x1e7539={..._0x18f507,..._0x51ea75[_0x380613(0x1ef)]!==undefined&&{'runAfterJourneyRefresh':_0x51ea75[_0x380613(0x1ef)]}},_0x4a2a1b=await _0x4f4cdb[_0x380613(0x169)][_0x380613(0x135)](_0x3c00d2,_0x1e7539);_0x2b1eda['set'](_0x36f324,_0x4a2a1b['id']),_0x353ed4[_0x380613(0x12a)][_0x380613(0x204)](_0x36f324,_0x4a2a1b['id']),_0x2f6630[_0x380613(0x148)]?.({'type':_0x380613(0x16d),'journeyName':_0x5c6863['yamlConfig'][_0x380613(0x13e)],'activationName':_0x36f324});}const _0x13079d=JSON[_0x380613(0x16f)](JSON[_0x380613(0x1dd)](_0x36999a));return _0x13079d['id']=_0x3c00d2,ensureJourneyDefaults(_0x13079d[_0x380613(0x18a)]),resolvePendingIdsInRequest(_0x13079d,_0x36999a,_0x1dd5f9,_0x52aa92,_0x2b1eda,_0x2f6630),await _0x4f4cdb[_0x380613(0x169)][_0x380613(0x1c3)](_0x3c00d2,_0x13079d),deletePushRecovery(_0x5c6863[_0x380613(0x156)]),{'action':_0x380613(0x1fa),'journeyId':_0x3c00d2,'embeddedSegmentNameToId':_0x52aa92};}export function stripWaitStepPendingIds(_0x18257c){const _0x20ecd5=a142_0x5b9def,_0x3f8914=_0x18257c[_0x20ecd5(0x158)]&&isPendingSegmentId(_0x18257c[_0x20ecd5(0x158)]),_0x540926=_0x18257c[_0x20ecd5(0x166)]?.['some'](_0x26f063=>_0x26f063[_0x20ecd5(0x191)]&&isPendingSegmentId(_0x26f063[_0x20ecd5(0x191)]));(_0x3f8914||_0x540926)&&(_0x18257c[_0x20ecd5(0x215)]=_0x20ecd5(0x223),_0x18257c[_0x20ecd5(0x198)]=0x1,_0x18257c[_0x20ecd5(0x168)]=_0x20ecd5(0x1c2),delete _0x18257c[_0x20ecd5(0x158)],delete _0x18257c[_0x20ecd5(0x15a)],delete _0x18257c['conditionTimeoutUnit'],delete _0x18257c['conditions']);}export function resolveWaitStepPendingIds(_0x111bbd,_0x56c280,_0x3019e6,_0x5df7da){const _0x17615e=a142_0x5b9def;if(_0x56c280[_0x17615e(0x158)]&&isPendingSegmentId(_0x56c280[_0x17615e(0x158)])){const _0x3a51e0=_0x3019e6(_0x56c280[_0x17615e(0x158)],'stage\x20\x27'+_0x5df7da+_0x17615e(0x1a8));_0x3a51e0&&(_0x111bbd[_0x17615e(0x215)]=_0x17615e(0x1d8),_0x111bbd[_0x17615e(0x158)]=_0x3a51e0,delete _0x111bbd[_0x17615e(0x198)],delete _0x111bbd[_0x17615e(0x168)],_0x56c280[_0x17615e(0x15a)]!==undefined&&(_0x111bbd[_0x17615e(0x15a)]=_0x56c280[_0x17615e(0x15a)]),_0x56c280[_0x17615e(0x147)]&&(_0x111bbd['conditionTimeoutUnit']=_0x56c280[_0x17615e(0x147)]));}if(_0x56c280[_0x17615e(0x166)]){const _0x18b282=_0x56c280[_0x17615e(0x166)][_0x17615e(0x1c4)](_0x23ce37=>_0x23ce37[_0x17615e(0x191)]&&isPendingSegmentId(_0x23ce37[_0x17615e(0x191)]));if(_0x18b282){const _0x5af847=_0x56c280[_0x17615e(0x166)][_0x17615e(0x17c)](_0x3c2039=>{const _0x486e39=_0x17615e;if(_0x3c2039[_0x486e39(0x191)]&&isPendingSegmentId(_0x3c2039[_0x486e39(0x191)])){const _0x1179a2=_0x3019e6(_0x3c2039['segmentId'],'stage\x20\x27'+_0x5df7da+_0x486e39(0x1a8));return{..._0x3c2039,'segmentId':_0x1179a2||_0x3c2039[_0x486e39(0x191)]};}return{..._0x3c2039};});_0x111bbd[_0x17615e(0x215)]=_0x17615e(0x1d8),_0x111bbd[_0x17615e(0x166)]=_0x5af847,delete _0x111bbd[_0x17615e(0x198)],delete _0x111bbd[_0x17615e(0x168)],delete _0x111bbd[_0x17615e(0x158)],delete _0x111bbd[_0x17615e(0x15a)],delete _0x111bbd[_0x17615e(0x147)];}}}function stripPendingIds(_0x45f013){const _0x38c017=a142_0x5b9def;_0x45f013[_0x38c017(0x18a)][_0x38c017(0x1ac)]?.[_0x38c017(0x191)]&&isPendingSegmentId(_0x45f013[_0x38c017(0x18a)][_0x38c017(0x1ac)]['segmentId'])&&delete _0x45f013[_0x38c017(0x18a)]['goal'];for(const _0x75fd7f of _0x45f013['attributes'][_0x38c017(0x21d)]||[]){_0x75fd7f[_0x38c017(0x1e0)]?.[_0x38c017(0x191)]&&isPendingSegmentId(_0x75fd7f[_0x38c017(0x1e0)][_0x38c017(0x191)])&&delete _0x75fd7f[_0x38c017(0x1e0)];_0x75fd7f['milestone']?.[_0x38c017(0x191)]&&isPendingSegmentId(_0x75fd7f[_0x38c017(0x151)][_0x38c017(0x191)])&&delete _0x75fd7f[_0x38c017(0x151)];_0x75fd7f['exitCriterias']&&(_0x75fd7f[_0x38c017(0x1f5)]=_0x75fd7f['exitCriterias'][_0x38c017(0x192)](_0x3f02a5=>!_0x3f02a5[_0x38c017(0x191)]||!isPendingSegmentId(_0x3f02a5['segmentId'])));if(_0x75fd7f[_0x38c017(0x134)])for(const _0x2ad080 of Object[_0x38c017(0x205)](_0x75fd7f[_0x38c017(0x134)])){const _0x416b52=_0x75fd7f[_0x38c017(0x134)][_0x2ad080];_0x416b52[_0x38c017(0x17b)]==='Activation'&&_0x416b52[_0x38c017(0x1b3)]&&isPendingActivationId(_0x416b52['journeyActivationStepId'])&&(_0x416b52[_0x38c017(0x1b3)]='');if(_0x416b52[_0x38c017(0x17b)]===_0x38c017(0x1a9)&&_0x416b52[_0x38c017(0x1ca)])for(const _0x51bfdd of _0x416b52['branches']){_0x51bfdd['segmentId']&&isPendingSegmentId(_0x51bfdd[_0x38c017(0x191)])&&(_0x51bfdd[_0x38c017(0x191)]='');}_0x416b52[_0x38c017(0x17b)]===_0x38c017(0x218)&&stripWaitStepPendingIds(_0x416b52);}}}function resolvePendingIdsInRequest(_0x58414b,_0x49a13a,_0x23e0e5,_0x426af9,_0x16cd4e,_0x51ad89){const _0x222cdb=a142_0x5b9def,_0x434695=(_0x1150cb,_0x4d8536)=>{const _0x311ac3=a142_0x361a;if(!isPendingSegmentId(_0x1150cb))return _0x1150cb;const _0x26ed78=extractPendingSegmentName(_0x1150cb),_0x577277=_0x426af9[_0x311ac3(0x1b1)](_0x26ed78);return!_0x577277&&_0x51ad89['logWarning']?.(_0x311ac3(0x1cf)+_0x26ed78+_0x311ac3(0x1fd)+_0x4d8536),_0x577277;};if(_0x58414b['attributes'][_0x222cdb(0x1ac)]?.['segmentId']&&isPendingSegmentId(_0x58414b[_0x222cdb(0x18a)][_0x222cdb(0x1ac)]['segmentId'])){const _0x3f88a8=_0x434695(_0x58414b[_0x222cdb(0x18a)][_0x222cdb(0x1ac)][_0x222cdb(0x191)],_0x222cdb(0x1e7));_0x3f88a8&&(_0x58414b[_0x222cdb(0x18a)][_0x222cdb(0x1ac)][_0x222cdb(0x191)]=_0x3f88a8);}for(const _0xe4817c of _0x58414b['attributes'][_0x222cdb(0x21d)]||[]){const _0x23371a=_0x23e0e5[_0x222cdb(0x1b1)](_0xe4817c['name'][_0x222cdb(0x217)]());_0x23371a&&(_0xe4817c['id']=_0x23371a);if(_0xe4817c[_0x222cdb(0x1e0)]?.[_0x222cdb(0x191)]&&isPendingSegmentId(_0xe4817c[_0x222cdb(0x1e0)]['segmentId'])){const _0x483a92=_0x434695(_0xe4817c['entryCriteria']['segmentId'],_0x222cdb(0x1a6)+_0xe4817c[_0x222cdb(0x13e)]+_0x222cdb(0x1de));_0x483a92&&(_0xe4817c[_0x222cdb(0x1e0)]['segmentId']=_0x483a92);}if(_0xe4817c[_0x222cdb(0x1f5)])for(const _0x198b35 of _0xe4817c[_0x222cdb(0x1f5)]){if(_0x198b35[_0x222cdb(0x191)]&&isPendingSegmentId(_0x198b35[_0x222cdb(0x191)])){const _0x57d80d=_0x434695(_0x198b35[_0x222cdb(0x191)],_0x222cdb(0x1a6)+_0xe4817c[_0x222cdb(0x13e)]+_0x222cdb(0x153));_0x57d80d&&(_0x198b35[_0x222cdb(0x191)]=_0x57d80d);}}if(_0xe4817c[_0x222cdb(0x151)]?.[_0x222cdb(0x191)]&&isPendingSegmentId(_0xe4817c[_0x222cdb(0x151)][_0x222cdb(0x191)])){const _0x1c810e=_0x434695(_0xe4817c[_0x222cdb(0x151)][_0x222cdb(0x191)],_0x222cdb(0x1a6)+_0xe4817c[_0x222cdb(0x13e)]+_0x222cdb(0x1cb));_0x1c810e&&(_0xe4817c[_0x222cdb(0x151)][_0x222cdb(0x191)]=_0x1c810e);}if(_0xe4817c[_0x222cdb(0x134)]){const _0x5afc04=_0x53f660=>_0x49a13a[_0x222cdb(0x18a)][_0x222cdb(0x21d)]?.[_0x222cdb(0x1c5)](_0x4b08a2=>_0x4b08a2[_0x222cdb(0x13e)][_0x222cdb(0x217)]()===_0xe4817c[_0x222cdb(0x13e)][_0x222cdb(0x217)]())?.['steps']?.[_0x53f660];for(const _0x51fe24 of Object['keys'](_0xe4817c['steps'])){const _0x405af3=_0xe4817c[_0x222cdb(0x134)][_0x51fe24],_0x67e4a2=_0x5afc04(_0x51fe24);if(_0x405af3[_0x222cdb(0x17b)]===_0x222cdb(0x1ea)&&_0x405af3[_0x222cdb(0x1b3)]&&(isPendingActivationId(_0x405af3['journeyActivationStepId'])||_0x405af3[_0x222cdb(0x1b3)]==='')){if(_0x67e4a2?.[_0x222cdb(0x1b3)]&&isPendingActivationId(_0x67e4a2[_0x222cdb(0x1b3)])){const _0x54f62c=extractPendingActivationName(_0x67e4a2[_0x222cdb(0x1b3)]),_0x18cf1a=_0x16cd4e[_0x222cdb(0x1b1)](_0x54f62c);_0x18cf1a&&(_0x405af3[_0x222cdb(0x1b3)]=_0x18cf1a);}}if(_0x405af3['type']==='DecisionPoint'&&_0x405af3[_0x222cdb(0x1ca)]&&_0x67e4a2?.['branches'])for(let _0x5f0550=0x0;_0x5f0550<_0x405af3['branches'][_0x222cdb(0x164)];_0x5f0550++){const _0x265c70=_0x405af3[_0x222cdb(0x1ca)][_0x5f0550],_0x1ef780=_0x67e4a2[_0x222cdb(0x1ca)][_0x5f0550];if(_0x1ef780?.[_0x222cdb(0x191)]&&isPendingSegmentId(_0x1ef780[_0x222cdb(0x191)])){const _0x59f397=_0x434695(_0x1ef780[_0x222cdb(0x191)],_0x222cdb(0x1a6)+_0xe4817c[_0x222cdb(0x13e)]+_0x222cdb(0x1c6)+(_0x265c70[_0x222cdb(0x13e)]||_0x5f0550)+'\x27');_0x59f397&&(_0x265c70[_0x222cdb(0x191)]=_0x59f397);}}_0x405af3[_0x222cdb(0x17b)]===_0x222cdb(0x218)&&_0x67e4a2?.[_0x222cdb(0x17b)]===_0x222cdb(0x218)&&resolveWaitStepPendingIds(_0x405af3,_0x67e4a2,_0x434695,_0xe4817c[_0x222cdb(0x13e)]);}}}}
1
+ function a142_0x1ee8(){const _0x4db154=['push','relationships','rule','getSegmentEntity\x20also\x20failed\x20for\x20','\x27\x20wait\x20condition','activationStepsById','conditionSegmentId','getLatestJourneyId','18lmWFby','createdSegmentId','Duration','replace','journeyStages','parentFolder','stages','\x27...','deps','activation_updating','getJourney','notification','entryCriteria','Activation','Deleting\x20activation\x20\x27','run_after_journey_refresh','index','10cVsfzW','SEGMENT_UPDATE_ERROR','add','description','goal','has','utf-8','existingJourney','trim','activation_','533268kGWvMr','find','WaitStep','toLowerCase','resolvedRule','state','journey_creating','journeyActivationStepId','journeyActivationNameToId','action','nameToType','7QGZYWG','createJourneySegment','exitCriterias','conditionTimeoutUnit','../../utils/async.js','journeyId','embedded_segment_created','journeyName','\x0a\x20\x20','Updating\x20activation\x20\x27','match','existingSegments','waitStep','Segment\x20not\x20found:\x20','size','draft','set','activation_updated','create','versionNumber','updateSegmentById','conditions','all','stage\x20\x27','segments','129165MPLZbk','parse','split','some','segment','Entry\x20criteria:\x20','journeyBundleName','Creating\x20folder\x20\x27','includes','activation_created','isArray','1180856kNZwVx','validatedRequest','startsWith','getSegment','activation_template_id','\x27\x20by\x20rule\x20content','existingSegment','stringify','activationsBySegmentId','journey_updated','withProgress','JOURNEY_UPDATE_ERROR','hasChanges','results','Created\x20segment\x20\x27','Creating\x20segment\x20\x27','folder_creating','from','segmentNameToId','Name\x20has\x20already\x20been\x20taken','kind','getActivation','__pending_act_','parentId','SEGMENT_SYNTAX_ERROR','Embedded\x20segment\x20\x27','sort','yamlConfig','./journey-yaml.js','connector_config','uniqueSegmentName','journey_entry_criteria_','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','flatMap','rootFolderId','activation_deleted','milestone','unchanged','segmentId','Matched\x20server\x20segment\x20\x27','__pending_','\x27\x20decision\x20point\x20branch\x20\x27','logWarning','\x20segment\x20from\x20file:\x20','deleted','folderPath','buildUserMaps','createSegment','progress','Fetching\x20','steps','segment_creating','deleteActivation','localName','SEGMENT_NOT_FOUND','data','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','map','keys','connectionIdToNameMap',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','verbose','logInfo','delete','Condition','isNew','embedded_segment_creating','segmentFolderId','parseDocument','activation_deleting','Activation\x20not\x20found:\x20','uniqueServerName','deleteSegment','logSuccess','skipSegments','list','valid','JOURNEY_SYNTAX_ERROR','idToName','slice','Deleted\x20segment\x20\x27','activationParams','connection','\x20error(s)','name','ACTIVATION_UPDATE_ERROR','dirname','activationContext','created','journeyById','diff','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','updated','6UaUtXc','goal\x20criteria','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','columns','349586pIPMVr','relative','reduce','\x27\x20not\x20found\x20in\x20journey\x20\x27','update','idToEmailMap','errors','resolveSegment','activation_creating','\x27\x20to\x20local\x20\x27','nameToId','journeys','createActivation','Failed\x20to\x20resolve\x20segment\x20','type','Journey\x20\x27','join','null','createdSegmentIds','waitStepType','day','\x20(referenced\x20in\x20journey\x20','behavior','folderPathToId','10804800XifIpc','\x20activation\x20\x27','folder','values','.$1.push-recovery.json','existingActivation','embeddedSegmentNameToId','digest','with','segment_updated','all_columns','segmentByFolderAndName','message','folderId','toISOString','NOT_FOUND','createFolder','journeyBundleId','length','getSegmentEntity','toString','DecisionPoint','absolutePath','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','logDeleted','branches','\x20journey\x20from\x20file:\x20','activations','Stage\x20\x27','hex','conditionTimeoutDuration','2jgYQrH','entries','schedule','):\x20','object','entry','waitStepUnit','Creating\x20activation\x20\x27','Updated\x20segment\x20\x27','610348yWFTLb','ACTIVATION_SYNTAX_ERROR','getSegment\x20failed\x20for\x20','entry_criteria','onProgress','embedded_activation_created','Updating\x20segment\x20\x27','listActivations','\x27\x20from\x20file:\x20','Failed\x20to\x20fetch\x20referenced\x20segment\x20','debug','journey_updating','get','journey','Failed\x20to\x20','filter','./child-segment-yaml.js','attributes','Segment\x20not\x20found','3790952PcXlQO','\x27\x20exit\x20criteria','sha1','effectiveFolderId','segment_deleted'];a142_0x1ee8=function(){return _0x4db154;};return a142_0x1ee8();}const a142_0x5b6902=a142_0x10a9;(function(_0x3cbca4,_0x50cfd3){const _0x4b12ed=a142_0x10a9,_0x34b4cd=_0x3cbca4();while(!![]){try{const _0x1be317=-parseInt(_0x4b12ed(0x123))/0x1*(parseInt(_0x4b12ed(0xec))/0x2)+parseInt(_0x4b12ed(0xe8))/0x3*(-parseInt(_0x4b12ed(0x12c))/0x4)+parseInt(_0x4b12ed(0x18b))/0x5*(parseInt(_0x4b12ed(0x14c))/0x6)+-parseInt(_0x4b12ed(0x172))/0x7*(-parseInt(_0x4b12ed(0x196))/0x8)+-parseInt(_0x4b12ed(0x167))/0x9*(-parseInt(_0x4b12ed(0x15d))/0xa)+-parseInt(_0x4b12ed(0x13f))/0xb+parseInt(_0x4b12ed(0x104))/0xc;if(_0x1be317===_0x50cfd3)break;else _0x34b4cd['push'](_0x34b4cd['shift']());}catch(_0x15dffe){_0x34b4cd['push'](_0x34b4cd['shift']());}}}(a142_0x1ee8,0x2d416));function a142_0x10a9(_0x41c3ee,_0x33c69a){_0x41c3ee=_0x41c3ee-0xd8;const _0x1ee8b6=a142_0x1ee8();let _0x10a9d0=_0x1ee8b6[_0x41c3ee];return _0x10a9d0;}import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a142_0x5b6902(0x1be);export const PENDING_ACTIVATION_PREFIX=a142_0x5b6902(0x1ac);export function createPendingSegmentId(_0x23a4df){return''+PENDING_SEGMENT_PREFIX+_0x23a4df+'__';}export function isPendingSegmentId(_0x5ba069){const _0x217cc2=a142_0x5b6902;return _0x5ba069[_0x217cc2(0x198)](PENDING_SEGMENT_PREFIX)&&!_0x5ba069[_0x217cc2(0x198)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x2645fa){return _0x2645fa['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0xc0514a){return''+PENDING_ACTIVATION_PREFIX+_0xc0514a+'__';}export function isPendingActivationId(_0x7adf63){const _0x5b23aa=a142_0x5b6902;return _0x7adf63[_0x5b23aa(0x198)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x49e54a){const _0x99557b=a142_0x5b6902;return _0x49e54a[_0x99557b(0x14f)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x3f8853,_0x3ecd12){const _0x373cae=a142_0x5b6902,_0x508947=_0x3f8853+'::'+(_0x3ecd12[_0x373cae(0x165)]()||'segment'),_0x54da98=createHash(_0x373cae(0x141))[_0x373cae(0xf0)](_0x508947)[_0x373cae(0x10b)](_0x373cae(0x121))['slice'](0x0,0xc);return _0x373cae(0x1b5)+_0x54da98;}export function ensureJourneyDefaults(_0x31d998){const _0x2428dd=a142_0x5b6902;!_0x31d998[_0x2428dd(0x160)]&&(_0x31d998[_0x2428dd(0x160)]=''),!_0x31d998[_0x2428dd(0x16c)]&&(_0x31d998[_0x2428dd(0x16c)]=_0x2428dd(0x181));}export function injectExistingStageIds(_0x1d9843,_0x455127){const _0x37a4df=a142_0x5b6902,_0x3f55b7=new Map(_0x455127['map'](_0x5ad221=>[_0x5ad221[_0x37a4df(0xdf)],_0x5ad221['id']]));for(const _0x4e28a2 of _0x1d9843){if(!_0x4e28a2['id']){const _0x2977f6=_0x3f55b7[_0x37a4df(0x138)](_0x4e28a2[_0x37a4df(0xdf)]);_0x2977f6&&(_0x4e28a2['id']=_0x2977f6);}}}export function resolveTDFolderPath(_0x349ee6,_0x126f41,_0x23ad55){if(!_0x126f41)return _0x349ee6;if(_0x349ee6===_0x23ad55||_0x349ee6['startsWith'](_0x23ad55+'/'))return _0x349ee6;return _0x349ee6?_0x23ad55+'/'+_0x349ee6:_0x23ad55;}export function addFoldersToCreate(_0x58cebf,_0x47eddc,_0x990158){const _0x144f6a=a142_0x5b6902;if(!_0x58cebf)return;if(_0x47eddc['has'](_0x58cebf))return;const _0x15f443=_0x58cebf[_0x144f6a(0x18d)]('/');let _0x4fc75a='';for(const _0x3d3ba6 of _0x15f443){_0x4fc75a=_0x4fc75a?_0x4fc75a+'/'+_0x3d3ba6:_0x3d3ba6,!_0x47eddc[_0x144f6a(0x162)](_0x4fc75a)&&_0x990158[_0x144f6a(0x15f)](_0x4fc75a);}}export function sortFoldersByDepth(_0x2b29d4){const _0x1bab78=a142_0x5b6902;return[..._0x2b29d4][_0x1bab78(0x1b0)]((_0x5cd6f6,_0x30751e)=>{const _0x6df7fc=_0x1bab78,_0x5f12ee=(_0x5cd6f6[_0x6df7fc(0x17c)](/\//g)||[])[_0x6df7fc(0x116)],_0x101e73=(_0x30751e[_0x6df7fc(0x17c)](/\//g)||[])[_0x6df7fc(0x116)];return _0x5f12ee-_0x101e73;});}import*as a142_0x26725c from'yaml';import{readFileSync}from'fs';import a142_0x2fc8e0 from'path';import{isJourneyDef,parseYamlString as a142_0x4f5357,toYamlString as a142_0xf8032f,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(_0x796cd3){const _0x3c104d=a142_0x5b6902;if(Array[_0x3c104d(0x195)](_0x796cd3))return'['+_0x796cd3['map'](_0x1a8bee=>stableStringify(_0x1a8bee))[_0x3c104d(0xfc)](',')+']';if(_0x796cd3&&typeof _0x796cd3===_0x3c104d(0x127)){const _0x515807=_0x796cd3,_0x4c3cde=Object[_0x3c104d(0x1d0)](_0x515807)['sort'](),_0x57e337=_0x4c3cde[_0x3c104d(0x1cf)](_0x4d5a35=>'\x22'+_0x4d5a35+'\x22:'+stableStringify(_0x515807[_0x4d5a35]));return'{'+_0x57e337[_0x3c104d(0xfc)](',')+'}';}const _0x30e8b2=JSON[_0x3c104d(0x19d)](_0x796cd3);return _0x30e8b2===undefined?_0x3c104d(0xfd):_0x30e8b2;}function activationSignature(_0x489dc9){const _0x1c0f31=a142_0x5b6902,_0x1a95e4={'connection':_0x489dc9[_0x1c0f31(0xdd)],..._0x489dc9[_0x1c0f31(0x10e)]!==undefined&&{'all_columns':_0x489dc9['all_columns']},..._0x489dc9[_0x1c0f31(0xeb)]!==undefined&&{'columns':_0x489dc9[_0x1c0f31(0xeb)]},..._0x489dc9['behavior']!==undefined&&{'behavior':_0x489dc9[_0x1c0f31(0x102)]},..._0x489dc9[_0x1c0f31(0x125)]!==undefined&&{'schedule':_0x489dc9[_0x1c0f31(0x125)]},..._0x489dc9[_0x1c0f31(0x157)]!==undefined&&{'notification':_0x489dc9[_0x1c0f31(0x157)]},..._0x489dc9[_0x1c0f31(0x1b3)]!==undefined&&{'connector_config':_0x489dc9['connector_config']},..._0x489dc9[_0x1c0f31(0x19a)]!==undefined&&{'activation_template_id':_0x489dc9[_0x1c0f31(0x19a)]}};return stableStringify(_0x1a95e4);}async function fetchSegment(_0x147d0e,_0x2a6f2a,_0x471f40,_0x201959){const _0x1af14a=a142_0x5b6902,_0x48de28=_0x201959?.[_0x1af14a(0x168)](_0x1ed114=>_0x1ed114['id']===_0x471f40);if(_0x48de28)return _0x48de28;try{return await _0x147d0e[_0x1af14a(0x18f)][_0x1af14a(0x199)](_0x2a6f2a,_0x471f40);}catch(_0x127a67){logger[_0x1af14a(0x136)](_0x1af14a(0x12e)+_0x471f40+_0x1af14a(0x1d2)+_0x127a67);try{return await _0x147d0e[_0x1af14a(0x18f)][_0x1af14a(0x117)](_0x471f40);}catch(_0x1912e){return logger[_0x1af14a(0x136)](_0x1af14a(0x147)+_0x471f40+':\x20'+_0x1912e),null;}}}function recoverSegmentIdsFromPushRecovery(_0x4621d7,_0x182159,_0x468224){const _0x3ee766=a142_0x5b6902,_0x27d689=readPushRecovery(_0x4621d7[_0x3ee766(0x11a)]);if(_0x27d689?.['journeyName']===_0x4621d7[_0x3ee766(0x1b1)]['name'])for(const [_0x28a5d2,_0x5585ed]of Object[_0x3ee766(0x124)](_0x27d689[_0x3ee766(0x18a)])){const _0x48160d=generateDeterministicJourneySegmentName(_0x4621d7[_0x3ee766(0x1b1)][_0x3ee766(0xdf)],_0x28a5d2);_0x5585ed[_0x3ee766(0x1dd)]===_0x48160d&&(_0x182159[_0x3ee766(0x182)](_0x28a5d2,_0x5585ed[_0x3ee766(0x1bc)]),_0x468224[_0x3ee766(0x182)](_0x28a5d2,_0x5585ed['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x5e1048,_0x4984d8,_0x45859d,_0x434e55){const _0x2b8ab3=a142_0x5b6902;let _0x12a03b;try{_0x12a03b=await _0x5e1048['segment'][_0x2b8ab3(0x173)]({'name':_0x45859d[_0x2b8ab3(0x1b4)],'description':_0x45859d['description'],'journeyId':_0x45859d['journeyId'],'rule':_0x434e55(_0x45859d[_0x2b8ab3(0x16b)],!![]),'countPopulation':!![],'parentFolderId':_0x45859d['folderId'],'audienceId':_0x45859d[_0x2b8ab3(0x1ad)]});}catch(_0x400ba2){const _0x5ca4b2=_0x400ba2 instanceof Error&&_0x400ba2[_0x2b8ab3(0x110)][_0x2b8ab3(0x193)](_0x2b8ab3(0x1a9));if(_0x5ca4b2){const _0x312210=readPushRecovery(_0x4984d8[_0x2b8ab3(0x11a)]),_0x49275b=_0x312210?.[_0x2b8ab3(0x179)]===_0x4984d8[_0x2b8ab3(0x1b1)]['name']?_0x312210[_0x2b8ab3(0x18a)][_0x45859d[_0x2b8ab3(0x1cb)]]:undefined;if(_0x49275b?.[_0x2b8ab3(0x1dd)]===_0x45859d[_0x2b8ab3(0x1b4)])await _0x5e1048[_0x2b8ab3(0x18f)][_0x2b8ab3(0x186)](_0x45859d['parentId'],_0x49275b[_0x2b8ab3(0x1bc)],{'description':_0x45859d[_0x2b8ab3(0x160)],'rule':_0x434e55(_0x45859d['resolvedRule'],!![]),'countPopulation':!![]}),_0x12a03b=_0x49275b[_0x2b8ab3(0x1bc)];else throw new SDKError(ErrorCode[_0x2b8ab3(0x15e)],_0x2b8ab3(0x1af)+_0x45859d[_0x2b8ab3(0x1cb)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x4984d8[_0x2b8ab3(0x11a)][_0x2b8ab3(0x14f)](/([^/]+)$/,_0x2b8ab3(0x108))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x400ba2);}else throw _0x400ba2;}return saveSegmentToPushRecovery(_0x4984d8[_0x2b8ab3(0x11a)],_0x4984d8[_0x2b8ab3(0x1b1)][_0x2b8ab3(0xdf)],_0x45859d['localName'],{'segmentId':_0x12a03b,'uniqueServerName':_0x45859d[_0x2b8ab3(0x1b4)],'createdAt':new Date()[_0x2b8ab3(0x112)]()}),_0x12a03b;}export async function prepareSegmentFiles(_0x88d94e,_0x1eacc8,_0x413cfc,_0xe3c517,_0x12874d){const _0x114db9=a142_0x5b6902,{activationDefToCreateRequest:_0x56c821}=await import(_0x114db9(0x13c)),_0x32b9d9=[],_0x24a8c0=new Set();for(const {yamlConfig:_0x281f03,folderPath:_0x3e0f54,sourcePath:_0x27e72e}of _0x88d94e){const _0x519555=resolveTDFolderPath(_0x3e0f54,_0xe3c517,_0x12874d),_0x49ca6e=_0x519555+':'+_0x281f03[_0x114db9(0xdf)],_0x337f49=_0x1eacc8[_0x114db9(0x10f)][_0x114db9(0x138)](_0x49ca6e),_0x4f34a2=_0x337f49?_0x1eacc8[_0x114db9(0x19e)][_0x114db9(0x138)](_0x337f49['id'])||[]:[];addFoldersToCreate(_0x519555,_0x1eacc8[_0x114db9(0x103)],_0x24a8c0);const _0x50d184=calculateActivationActions(_0x281f03[_0x114db9(0x11f)]||[],_0x4f34a2,_0x1eacc8[_0x114db9(0xf1)],_0x1eacc8[_0x114db9(0x1d1)]);for(const _0x445ed1 of _0x50d184){(_0x445ed1['type']===_0x114db9(0x184)||_0x445ed1[_0x114db9(0xfa)]===_0x114db9(0xf0))&&_0x445ed1['yamlActivation']&&(_0x445ed1[_0x114db9(0x197)]=await _0x56c821(_0x445ed1['yamlActivation'],_0x413cfc));}const _0x38b448=calculateSegmentDiff(_0x281f03,_0x337f49,_0x4f34a2,_0x1eacc8[_0x114db9(0xf1)],_0x1eacc8[_0x114db9(0x1d1)]);_0x32b9d9[_0x114db9(0x144)]({'relativePath':_0x281f03['name'],'absolutePath':_0x27e72e,'yamlConfig':_0x281f03,'folderPath':_0x519555,'existingSegment':_0x337f49,'existingActivations':_0x4f34a2,'isNew':_0x38b448[_0x114db9(0x1d7)],'hasChanges':_0x38b448[_0x114db9(0x1a2)],'diff':_0x38b448[_0x114db9(0xe5)],'activationActions':_0x50d184});}return{'segmentFiles':_0x32b9d9,'foldersToCreate':_0x24a8c0};}export async function prepareJourneyFiles(_0x3efd52,_0x18c33e,_0x3ced14,_0x2c2b4c){const _0x30fbfe=a142_0x5b6902,_0x4e0fb5=[],_0x452779=new Set();for(const {yamlConfig:_0x422cf8,folderPath:_0x5e1b5d,sourcePath:_0x489039}of _0x3efd52){const _0x5f0a91=resolveTDFolderPath(_0x5e1b5d,_0x3ced14,_0x2c2b4c),_0x181630=_0x5f0a91+':'+_0x422cf8[_0x30fbfe(0xdf)],_0x27f53a=_0x18c33e['journeyBundlesByFolderAndName'][_0x30fbfe(0x138)](_0x181630);let _0x2993d5,_0x4c3bf3;if(_0x27f53a&&_0x27f53a[_0x30fbfe(0x116)]>0x0){const _0x4123e3=buildLocalExpandedRuleMappings(_0x422cf8),{createYamlContext:_0x2a5ea6,prefetchJourneySegments:_0x573822}=createPushYamlContextForBundle(_0x18c33e['deps'],_0x18c33e[_0x30fbfe(0x1ad)],_0x18c33e[_0x30fbfe(0x17d)],_0x4123e3,_0x18c33e['idToEmailMap'],_0x18c33e[_0x30fbfe(0x1d1)],_0x18c33e[_0x30fbfe(0x149)],_0x18c33e[_0x30fbfe(0xe4)]);await _0x573822(_0x27f53a['map'](_0x5a8fdf=>_0x5a8fdf['id']));const _0x3cb638=await _0x18c33e[_0x30fbfe(0x154)][_0x30fbfe(0x139)][_0x30fbfe(0x14b)](_0x27f53a[0x0][_0x30fbfe(0x115)]),_0x162223=hasMultipleVersions(_0x422cf8),_0x1fda6d=async _0x326d29=>{const _0x44fc61=_0x30fbfe,_0x46fd30=_0x18c33e[_0x44fc61(0xe4)]?.[_0x44fc61(0x138)](_0x326d29);if(_0x46fd30)return _0x46fd30;return _0x18c33e['fetchJourney']({'journeyId':_0x326d29,'journeyName':_0x422cf8['name'],'isMultiVersion':_0x27f53a['length']>0x1});};if(_0x162223&&_0x27f53a['length']>0x1){const _0x47058c=[];for(const _0x15eca1 of _0x27f53a){const _0x15249b=_0x15eca1[_0x30fbfe(0x185)]||0x1;_0x18c33e[_0x30fbfe(0x1c6)]?.['update'](_0x30fbfe(0x1c7)+_0x422cf8[_0x30fbfe(0xdf)]+'\x20v'+_0x15249b);const _0x3854e1=await _0x1fda6d(_0x15eca1['id']),_0x5bf93a=_0x2a5ea6(_0x15eca1['id']),_0x2f65f1=await journeyResponseToDef(_0x3854e1,_0x5bf93a);_0x47058c['push']({'item':_0x15eca1,'yaml':_0x2f65f1});}const _0x226449=buildLocalRuleToNameMappingFromJourney(_0x422cf8);_0x4c3bf3=buildMergedJourneyDef(_0x47058c,_0x226449,_0x3cb638);const _0x195e67=Math['max'](..._0x47058c[_0x30fbfe(0x1cf)](_0x2bbb1d=>_0x2bbb1d['item'][_0x30fbfe(0x185)]||0x0)),_0x4ab0de=_0x27f53a[_0x30fbfe(0x168)](_0x4b0fbb=>(_0x4b0fbb[_0x30fbfe(0x185)]||0x0)===_0x195e67);_0x4ab0de&&(_0x18c33e[_0x30fbfe(0x1c6)]?.[_0x30fbfe(0xf0)](_0x30fbfe(0x1c7)+_0x422cf8['name']+'\x20v'+_0x195e67),_0x2993d5=await _0x1fda6d(_0x4ab0de['id']));}else{const _0x161bb3=_0x27f53a[_0x27f53a[_0x30fbfe(0x116)]-0x1];_0x18c33e[_0x30fbfe(0x1c6)]?.['update']('Fetching\x20'+_0x422cf8[_0x30fbfe(0xdf)]),_0x2993d5=await _0x1fda6d(_0x161bb3['id']);const _0x385db8=_0x2a5ea6(_0x161bb3['id']),_0x14c0c2=await journeyResponseToDef(_0x2993d5,_0x385db8),_0x1c8676=buildLocalRuleToNameMappingFromJourney(_0x422cf8);_0x4c3bf3=buildMergedJourneyDef([{'item':_0x161bb3,'yaml':_0x14c0c2}],_0x1c8676,_0x3cb638);}}addFoldersToCreate(_0x5f0a91,_0x18c33e[_0x30fbfe(0x103)],_0x452779);const _0x440da8=calculateJourneyDiff(_0x422cf8,_0x4c3bf3);_0x4e0fb5[_0x30fbfe(0x144)]({'relativePath':_0x422cf8[_0x30fbfe(0xdf)],'absolutePath':_0x489039,'yamlConfig':_0x422cf8,'folderPath':_0x5f0a91,'existingJourney':_0x2993d5,'isNew':_0x440da8[_0x30fbfe(0x1d7)],'hasChanges':_0x440da8[_0x30fbfe(0x1a2)],'diff':_0x440da8[_0x30fbfe(0xe5)]});}return{'journeyFiles':_0x4e0fb5,'foldersToCreate':_0x452779};}export function calculateActivationActions(_0x5743a6,_0x40dbea,_0x4d0e2e,_0x48d4e0){const _0x4a3edb=a142_0x5b6902,_0x2ac7e1=[],_0x4317ba=new Map();for(const _0x35c4d7 of _0x40dbea){_0x4317ba[_0x4a3edb(0x182)](_0x35c4d7[_0x4a3edb(0xdf)],_0x35c4d7);}const _0x47ff1a=new Map();for(const _0x593ab0 of _0x5743a6){_0x47ff1a[_0x4a3edb(0x182)](_0x593ab0[_0x4a3edb(0xdf)],_0x593ab0);}for(const _0x1a2656 of _0x5743a6){const _0x3e3dc8=_0x4317ba[_0x4a3edb(0x138)](_0x1a2656[_0x4a3edb(0xdf)]);if(!_0x3e3dc8)_0x2ac7e1[_0x4a3edb(0x144)]({'type':_0x4a3edb(0x184),'name':_0x1a2656[_0x4a3edb(0xdf)],'yamlActivation':_0x1a2656});else{const _0x595593=activationResponseToDef(_0x3e3dc8,_0x4d0e2e,_0x48d4e0),_0x3088a5=a142_0x26725c[_0x4a3edb(0x19d)](_0x595593),_0x416443=a142_0x26725c[_0x4a3edb(0x19d)](_0x1a2656);_0x3088a5!==_0x416443&&_0x2ac7e1[_0x4a3edb(0x144)]({'type':_0x4a3edb(0xf0),'name':_0x1a2656['name'],'yamlActivation':_0x1a2656,'existingActivation':_0x3e3dc8});}}for(const _0x7ce348 of _0x40dbea){!_0x47ff1a[_0x4a3edb(0x162)](_0x7ce348[_0x4a3edb(0xdf)])&&_0x2ac7e1[_0x4a3edb(0x144)]({'type':_0x4a3edb(0x1d5),'name':_0x7ce348[_0x4a3edb(0xdf)],'existingActivation':_0x7ce348});}return _0x2ac7e1;}function calculateYamlDiff(_0x512208,_0x4d58a7){if(_0x4d58a7){const _0x2a545b=generateDiff(_0x4d58a7,_0x512208),_0xd74430=hasChanges(_0x2a545b);return{'isNew':![],'hasChanges':_0xd74430,'diff':_0xd74430?formatDiffWithColors(_0x2a545b):undefined};}const _0x2ae94f=generateDiff('',_0x512208);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x2ae94f)};}export function calculateSegmentDiff(_0x38ba3f,_0x23c6b5,_0x5d1154,_0x18c4b1,_0x427f3a){const _0x125171=segmentToYamlString(_0x38ba3f),_0x189666=_0x23c6b5?segmentToYamlString(segmentWithActivationsToYaml(_0x23c6b5,_0x5d1154,undefined,_0x18c4b1,_0x427f3a)):undefined;return calculateYamlDiff(_0x125171,_0x189666);}export function calculateJourneyDiff(_0x56178e,_0xb5ef25){const _0x3d4427=normalizeJourneyDef(_0x56178e,_0x56178e),_0x3106da=a142_0xf8032f(_0x3d4427),_0x3c3066=_0xb5ef25?a142_0xf8032f(normalizeJourneyDef(_0xb5ef25,_0x56178e)):undefined;return calculateYamlDiff(_0x3106da,_0x3c3066);}export function findSegmentsToDelete(_0x195e57,_0xb7f425,_0x2b1412,_0x284f39,_0x1bdcb5){const _0x4d6a43=a142_0x5b6902,_0x35508d=new Set();for(const {yamlConfig:_0x3c7fdb,folderPath:_0x2c607a}of _0xb7f425){_0x35508d['add'](_0x2c607a+':'+_0x3c7fdb[_0x4d6a43(0xdf)]);}return _0x195e57[_0x4d6a43(0x13b)](_0x40f14d=>{const _0x276dab=_0x4d6a43,_0x652626=_0x40f14d['segmentFolderId']?_0x2b1412[_0x276dab(0x138)](_0x40f14d['segmentFolderId'][_0x276dab(0x118)]())||'':'',_0x35f916=_0x652626+':'+_0x40f14d[_0x276dab(0xdf)];if(_0x35508d[_0x276dab(0x162)](_0x35f916))return![];if(_0x1bdcb5)return _0x652626===_0x284f39||_0x652626[_0x276dab(0x198)](_0x284f39+'/');return!![];});}export function findJourneysToDelete(_0x14bebd,_0x1aea01,_0x7eb685,_0x12e1e0,_0x11912b){const _0x4e17c7=a142_0x5b6902,_0x4e1772=new Set();for(const {yamlConfig:_0x282c77,folderPath:_0x56ec53}of _0x1aea01){_0x4e1772[_0x4e17c7(0x15f)](_0x56ec53+':'+_0x282c77[_0x4e17c7(0xdf)]);}return _0x14bebd[_0x4e17c7(0x13b)](_0x46e17d=>{const _0x50f266=_0x4e17c7,_0x3ee098=_0x46e17d[_0x50f266(0x111)]?_0x7eb685[_0x50f266(0x138)](_0x46e17d[_0x50f266(0x111)])||'':'',_0x260e6d=_0x3ee098+':'+_0x46e17d[_0x50f266(0x191)];if(_0x4e1772[_0x50f266(0x162)](_0x260e6d))return![];if(_0x11912b)return _0x3ee098===_0x12e1e0||_0x3ee098[_0x50f266(0x198)](_0x12e1e0+'/');return!![];});}export function buildSegmentLookupMap(_0x10aa90,_0x4f455f){const _0x226fe1=a142_0x5b6902,_0x18d122=new Map();for(const _0x3c2d3d of _0x10aa90){const _0x512a2d=_0x3c2d3d['segmentFolderId']?_0x4f455f['get'](_0x3c2d3d[_0x226fe1(0x1d9)][_0x226fe1(0x118)]())||'':'',_0x5eef7d=_0x512a2d+':'+_0x3c2d3d[_0x226fe1(0xdf)];_0x18d122[_0x226fe1(0x182)](_0x5eef7d,_0x3c2d3d);}return _0x18d122;}export function buildSegmentNameToIdMap(_0x5f0803){const _0x528506=a142_0x5b6902,_0x2c6a44=new Map();for(const _0xa1bb7 of _0x5f0803){_0x2c6a44['set'](_0xa1bb7[_0x528506(0xdf)],_0xa1bb7['id']);}return _0x2c6a44;}export function buildJourneyBundleLookupMap(_0x74e354,_0xd4777b){const _0x55c226=a142_0x5b6902,_0x25ffc6=new Map();for(const _0x4bb55e of _0x74e354){const _0x2463e5=_0x4bb55e[_0x55c226(0x111)]?_0xd4777b[_0x55c226(0x138)](_0x4bb55e[_0x55c226(0x111)])||'':'',_0x42a385=_0x2463e5+':'+_0x4bb55e[_0x55c226(0x191)];!_0x25ffc6[_0x55c226(0x162)](_0x42a385)&&_0x25ffc6['set'](_0x42a385,[]),_0x25ffc6['get'](_0x42a385)[_0x55c226(0x144)](_0x4bb55e);}for(const _0x45018d of _0x25ffc6[_0x55c226(0x107)]()){_0x45018d[_0x55c226(0x1b0)]((_0x5ded9e,_0x428c79)=>(_0x5ded9e['versionNumber']||0x0)-(_0x428c79[_0x55c226(0x185)]||0x0));}return _0x25ffc6;}export function collectFoldersToCreate(_0x5c85ca,_0x38428b){const _0x3e8ac8=a142_0x5b6902,_0x5e11e3=new Set();for(const _0x11930f of _0x5c85ca){if(!_0x11930f)continue;if(_0x38428b[_0x3e8ac8(0x162)](_0x11930f))continue;const _0x2fe9b5=_0x11930f['split']('/');let _0x35a213='';for(const _0x54b0fc of _0x2fe9b5){_0x35a213=_0x35a213?_0x35a213+'/'+_0x54b0fc:_0x54b0fc,!_0x38428b[_0x3e8ac8(0x162)](_0x35a213)&&_0x5e11e3[_0x3e8ac8(0x15f)](_0x35a213);}}return _0x5e11e3;}export function parseAndClassifyYamlFiles(_0x5e67ce,_0xfa8a32,_0x3ecc72){const _0x2bd785=a142_0x5b6902,_0x36f4a5=[],_0x4695df=[];for(const _0x3a6b7d of _0x5e67ce){const _0x90d36e=a142_0x2fc8e0[_0x2bd785(0xed)](_0xfa8a32,a142_0x2fc8e0[_0x2bd785(0xe1)](_0x3a6b7d)),_0x5c12df=_0x90d36e==='.'?'':_0x90d36e,_0xb970ae=readFileSync(_0x3a6b7d,_0x2bd785(0x163)),_0x35179d=a142_0x26725c[_0x2bd785(0x18c)](_0xb970ae);if(isJourneyDef(_0x35179d)){const _0x392d72=a142_0x4f5357(_0xb970ae);_0x4695df['push']({'yamlConfig':_0x392d72,'folderPath':_0x5c12df,'sourcePath':_0x3a6b7d});}else{if(!_0x3ecc72?.[_0x2bd785(0x1e0)]){const _0x23dc0f=parseSegmentYamlFile(_0xb970ae),_0x7a1f8d=normalizeChildSegmentYaml(_0x23dc0f);_0x36f4a5[_0x2bd785(0x144)]({'yamlConfig':_0x7a1f8d,'folderPath':_0x5c12df,'sourcePath':_0x3a6b7d});}}}return{'segments':_0x36f4a5,'journeys':_0x4695df};}export function validateParsedFiles(_0x17da96,_0x3c2277){const _0x2214bc=a142_0x5b6902,_0xbc6bce=[];for(const {yamlConfig:_0x89981e,sourcePath:_0x567fb2}of _0x17da96[_0x2214bc(0x18a)]){const _0x43322b=readFileSync(_0x567fb2,_0x2214bc(0x163)),_0x25535c=a142_0x26725c[_0x2214bc(0x1da)](_0x43322b),_0x55c0f0=validateSegmentDef(_0x89981e,{'source':_0x43322b,'document':_0x25535c},{'skipSchema':!![]});if(!_0x55c0f0[_0x2214bc(0x1e2)]){const _0x27925d=a142_0x2fc8e0[_0x2214bc(0xed)](_0x3c2277,_0x567fb2);_0xbc6bce['push']({'filePath':_0x27925d,'source':_0x43322b,'result':_0x55c0f0,'isJourney':![]});}}for(const {yamlConfig:_0x1c0017,sourcePath:_0x1db18a}of _0x17da96[_0x2214bc(0xf7)]){const _0x312d39=readFileSync(_0x1db18a,_0x2214bc(0x163)),_0x3b5aa4=a142_0x26725c[_0x2214bc(0x1da)](_0x312d39),_0x14a1f0=validateJourneyDef(_0x1c0017,{'source':_0x312d39,'document':_0x3b5aa4},{'skipSchema':!![]});if(!_0x14a1f0[_0x2214bc(0x1e2)]){const _0x2e5cc2=a142_0x2fc8e0[_0x2214bc(0xed)](_0x3c2277,_0x1db18a);_0xbc6bce[_0x2214bc(0x144)]({'filePath':_0x2e5cc2,'source':_0x312d39,'result':_0x14a1f0,'isJourney':!![]});}}return _0xbc6bce;}export function formatValidationErrors(_0x405715){const _0x277c75=a142_0x5b6902,_0x8dc5c1=[];for(const {filePath:_0x523205,source:_0x500fbc,result:_0x7e9be8,isJourney:_0x7f61b4}of _0x405715){const _0x48887d=_0x7f61b4?_0x277c75(0x139):_0x277c75(0x18f);_0x8dc5c1[_0x277c75(0x144)]('\x0a'+_0x523205+'\x20('+_0x48887d+_0x277c75(0x126)+_0x7e9be8[_0x277c75(0xf2)]['length']+_0x277c75(0xde)),_0x8dc5c1['push'](formatValidationResult(_0x7e9be8,_0x500fbc,_0x523205));}return _0x8dc5c1[_0x277c75(0xfc)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x451289){const _0x1adebc=a142_0x5b6902,_0x757ffc=new Set(),_0x519051=new Map(),_0x2ce8e8=collectSegmentUsageCounts(_0x451289);if(_0x451289[_0x1adebc(0x18a)])for(const [_0x2ede74,_0x1aff5a]of Object[_0x1adebc(0x124)](_0x451289[_0x1adebc(0x18a)])){_0x757ffc[_0x1adebc(0x15f)](_0x2ede74);if(_0x1aff5a['rule']){const _0x44e358=yamlRuleToApi(_0x1aff5a['rule']),_0x2100f6=apiRuleToYaml(_0x44e358);_0x519051['set'](_0x2ede74,_0x2100f6);}}const _0x54cfc4=new Map();let _0x421785=0x0;for(const [_0xdbdcf1,_0x16c241]of _0x519051){const _0x18c1b3=serializeExpandedRule(_0x16c241,_0x519051),_0x5e118c=_0x54cfc4[_0x1adebc(0x138)](_0x18c1b3)||[];_0x5e118c[_0x1adebc(0x144)]({'name':_0xdbdcf1,'index':_0x421785}),_0x54cfc4[_0x1adebc(0x182)](_0x18c1b3,_0x5e118c),_0x421785++;}const _0x1f7008=new Map();for(const [_0x5023a3,_0x5502d7]of _0x54cfc4){const _0x745f2b=_0x5502d7[_0x1adebc(0xda)]()[_0x1adebc(0x1b0)]((_0x5aa078,_0x2cf558)=>{const _0x59bea0=_0x1adebc,_0x3430e8=_0x2ce8e8[_0x59bea0(0x138)](_0x5aa078['name'])||0x0,_0x5bc4e9=_0x2ce8e8[_0x59bea0(0x138)](_0x2cf558[_0x59bea0(0xdf)])||0x0;if(_0x3430e8!==_0x5bc4e9)return _0x5bc4e9-_0x3430e8;return _0x5aa078[_0x59bea0(0x15c)]-_0x2cf558[_0x59bea0(0x15c)];})['map'](_0x296966=>_0x296966[_0x1adebc(0xdf)]),_0x4a7a3b=[];for(const _0x56257c of _0x745f2b){const _0x206479=_0x2ce8e8[_0x1adebc(0x138)](_0x56257c)||0x0,_0x339ac3=Math['max'](_0x206479,0x1);for(let _0x177825=0x0;_0x177825<_0x339ac3;_0x177825++){_0x4a7a3b['push'](_0x56257c);}}_0x1f7008[_0x1adebc(0x182)](_0x5023a3,_0x4a7a3b);}return{'existingLocalSegmentNames':_0x757ffc,'localSegmentRules':_0x519051,'localExpandedRuleToNames':_0x1f7008};}export function createSegmentIdResolver(_0x432480,_0x26c784){return async _0x3ad89c=>{const _0x35e659=a142_0x10a9,_0x2f195c=_0x432480[_0x35e659(0x138)](_0x3ad89c);if(!_0x2f195c)throw new SDKError(ErrorCode[_0x35e659(0x1cc)],'Segment\x20not\x20found:\x20'+_0x3ad89c+_0x35e659(0x1b6)+_0x26c784+'\x27)');return _0x2f195c;};}export function extractRootFolderId(_0x10d176){const _0x4f4979=a142_0x5b6902;return _0x10d176[_0x4f4979(0x145)]?.['parentSegmentFolder']?.[_0x4f4979(0x1cd)]?.['id']||_0x10d176[_0x4f4979(0x145)]?.[_0x4f4979(0x151)]?.[_0x4f4979(0x1cd)]?.['id'];}export function buildConnectionMaps(_0x1c56f9){const _0x480175=a142_0x5b6902,_0x219941=new Map(),_0xe219db=new Map(),_0x372df1=new Map();for(const _0x10d7e5 of _0x1c56f9){_0x219941[_0x480175(0x182)](_0x10d7e5['name'],parseInt(_0x10d7e5['id'],0xa)),_0xe219db[_0x480175(0x182)](_0x10d7e5['id'],_0x10d7e5[_0x480175(0xdf)]),_0x372df1[_0x480175(0x182)](_0x10d7e5[_0x480175(0xdf)],_0x10d7e5['type']);}return{'nameToId':_0x219941,'idToName':_0xe219db,'nameToType':_0x372df1};}export function calculatePushStats(_0x565454,_0x3b75fc,_0x44d4f6,_0x309caf,_0x1bade0,_0x3170b0,_0x5ceeb8){const _0x2bf0bb=a142_0x5b6902,_0x384554=_0x565454['filter'](_0x2460f7=>_0x2460f7[_0x2bf0bb(0x1d7)]),_0x2e2a40=_0x565454[_0x2bf0bb(0x13b)](_0xc48df7=>!_0xc48df7['isNew']&&_0xc48df7[_0x2bf0bb(0x1a2)]),_0x17019b=_0x565454[_0x2bf0bb(0x13b)](_0x5e1c6c=>!_0x5e1c6c[_0x2bf0bb(0x1d7)]&&!_0x5e1c6c[_0x2bf0bb(0x1a2)]),_0x511ea3=_0x3170b0?_0x309caf:[],_0x68d963=_0x3b75fc[_0x2bf0bb(0x13b)](_0x48f6aa=>_0x48f6aa[_0x2bf0bb(0x1d7)]),_0x936b63=_0x3b75fc['filter'](_0x183157=>!_0x183157[_0x2bf0bb(0x1d7)]&&_0x183157['hasChanges']),_0x35bcc4=_0x3b75fc[_0x2bf0bb(0x13b)](_0x676cae=>!_0x676cae['isNew']&&!_0x676cae['hasChanges']),_0x4dea93=_0x3170b0?_0x1bade0:[],_0x3fc922=_0x565454[_0x2bf0bb(0x1b7)](_0x3e06c6=>_0x3e06c6['activationActions']),_0x53d8e8=_0x3fc922[_0x2bf0bb(0x13b)](_0x9ea675=>_0x9ea675[_0x2bf0bb(0xfa)]==='create'),_0x16f97d=_0x3fc922[_0x2bf0bb(0x13b)](_0x1bb63b=>_0x1bb63b[_0x2bf0bb(0xfa)]==='update'),_0x17e316=_0x3fc922[_0x2bf0bb(0x13b)](_0x46a4d4=>_0x46a4d4['type']==='delete'),_0x1d7767=Array[_0x2bf0bb(0x1a7)](_0x44d4f6)['sort'](),_0xbcf7a=_0x5ceeb8?![]:_0x384554[_0x2bf0bb(0x116)]>0x0||_0x2e2a40['length']>0x0||_0x511ea3['length']>0x0,_0x1342c0=_0x68d963[_0x2bf0bb(0x116)]>0x0||_0x936b63['length']>0x0||_0x4dea93[_0x2bf0bb(0x116)]>0x0,_0x20b98d=_0x5ceeb8?![]:_0x3fc922[_0x2bf0bb(0x116)]>0x0,_0x50f7e9=_0x1d7767[_0x2bf0bb(0x116)]>0x0;return{'segments':{'new':_0x384554,'changed':_0x2e2a40,'unchanged':_0x17019b,'toDelete':_0x511ea3},'journeys':{'new':_0x68d963,'changed':_0x936b63,'unchanged':_0x35bcc4,'toDelete':_0x4dea93},'activations':{'all':_0x3fc922,'toCreate':_0x53d8e8,'toUpdate':_0x16f97d,'toDelete':_0x17e316},'folders':{'toCreate':_0x1d7767},'counts':{'segments':{'new':_0x384554[_0x2bf0bb(0x116)],'changed':_0x2e2a40[_0x2bf0bb(0x116)],'unchanged':_0x17019b[_0x2bf0bb(0x116)],'toDelete':_0x511ea3['length']},'journeys':{'new':_0x68d963['length'],'changed':_0x936b63[_0x2bf0bb(0x116)],'unchanged':_0x35bcc4[_0x2bf0bb(0x116)],'toDelete':_0x4dea93[_0x2bf0bb(0x116)]},'activations':{'create':_0x53d8e8['length'],'update':_0x16f97d['length'],'delete':_0x17e316[_0x2bf0bb(0x116)]},'folders':_0x1d7767['length']},'hasChanges':_0xbcf7a||_0x1342c0||_0x20b98d||_0x50f7e9};}export async function buildPushExecutionContext(_0x553d5e,_0x56ffd2,_0x5b4222,_0x3192c5,_0x1178e6,_0x2934ce){const _0x516836=a142_0x5b6902,_0x2ee3d1=extractRootFolderId(_0x5b4222),{pathToId:_0x7e1c74,idToPath:_0x4942f6}=buildFolderMaps(_0x1178e6),_0x1d8a44=buildSegmentNameToIdMap(_0x3192c5),_0xee277f=new Map(),{batchAsync:_0x1bdf22}=await import(_0x516836(0x176)),[_0x435075,_0x2ff27e]=await Promise[_0x516836(0x188)]([_0x553d5e['user'][_0x516836(0x1c4)](),_0x553d5e[_0x516836(0xdd)][_0x516836(0x1e1)](),((async()=>{!_0x2934ce&&_0x3192c5['length']>0x0&&await _0x1bdf22(_0x3192c5,async _0x34d22c=>{const _0x1a33ad=a142_0x10a9,_0x1fee00=await _0x553d5e['segment'][_0x1a33ad(0x133)](_0x56ffd2,_0x34d22c['id']);_0xee277f[_0x1a33ad(0x182)](_0x34d22c['id'],_0x1fee00);});})())]),{emailToId:_0xf4e3b8,idToEmail:_0x29eb42}=_0x435075,_0x446f43=buildConnectionMaps(_0x2ff27e);return{'rootFolderId':_0x2ee3d1,'folderPathToId':_0x7e1c74,'folderIdToPath':_0x4942f6,'segmentNameToId':_0x1d8a44,'activationsBySegmentId':_0xee277f,'emailToIdMap':_0xf4e3b8,'idToEmailMap':_0x29eb42,'connectionNameToIdMap':_0x446f43[_0x516836(0xf6)],'connectionIdToNameMap':_0x446f43[_0x516836(0xd9)],'connectionNameToTypeMap':_0x446f43[_0x516836(0x171)]};}export function createPushYamlContextForBundle(_0x205054,_0x1d8462,_0x5a015f,_0x30c116,_0x21d00e,_0x4fdd9d,_0x114c61,_0x274205){const {existingLocalSegmentNames:_0x38e859,localExpandedRuleToNames:_0x134c5c}=_0x30c116,_0x176398=new Set(),_0x7f7115=new Map(),_0x185135=new Map(),_0x1d3d1b=new Map(),_0x2ae73e=createJumpTargetCache(),_0x2976cf=new Map(),_0x4162b9=new Map(),_0x209bec=new Set();let _0x14d7fb;const _0x29e7c8=_0x327bb4=>{const _0x2fc39a={'resolveSegment':async _0x474fb7=>{const _0x21b6de=a142_0x10a9,_0x355b97=_0x1d3d1b['get'](_0x474fb7);if(_0x355b97!==undefined)return{'name':_0x355b97,'isJourneyLocal':!![]};try{const _0x5183ea=await fetchSegment(_0x205054,_0x1d8462,_0x474fb7,_0x5a015f);if(!_0x5183ea)throw new Error(_0x21b6de(0x13e));const _0xe6a408=generateJourneyLocalName(_0x5183ea['name']),_0x186485=_0x5183ea[_0x21b6de(0x1aa)]===SEGMENT_KIND_JOURNEY&&_0xe6a408!==undefined;let _0x5056ad=_0x5183ea[_0x21b6de(0xdf)],_0x504a7e;if(_0x186485&&_0x5183ea['rule']){const _0x21bd78=apiRuleToYaml(_0x5183ea[_0x21b6de(0x146)]);_0x4162b9[_0x21b6de(0x182)](_0x474fb7,_0x21bd78);const _0x2f7c7b=async _0x15f047=>{const _0x4eb5fa=_0x21b6de,_0x5e3697=collectSegmentRefsFromRule(_0x15f047);for(const _0x5c5eeb of _0x5e3697){if(!_0x4162b9[_0x4eb5fa(0x162)](_0x5c5eeb))try{const _0x6057e3=await fetchSegment(_0x205054,_0x1d8462,_0x5c5eeb,_0x5a015f);if(_0x6057e3?.[_0x4eb5fa(0x146)]){const _0x1e5819=apiRuleToYaml(_0x6057e3[_0x4eb5fa(0x146)]);_0x4162b9[_0x4eb5fa(0x182)](_0x5c5eeb,_0x1e5819),await _0x2f7c7b(_0x1e5819);}}catch(_0x298dbf){logger[_0x4eb5fa(0x136)](_0x4eb5fa(0x135)+_0x5c5eeb+':\x20'+_0x298dbf);}}};await _0x2f7c7b(_0x21bd78);const _0x428b33=serializeExpandedRule(_0x21bd78,_0x4162b9),_0x31e7f7=_0x134c5c['get'](_0x428b33);if(_0x31e7f7&&_0x31e7f7['length']>0x0){const _0x3485be=_0x7f7115[_0x21b6de(0x138)](_0x428b33)||0x0,_0x4fab45=_0x31e7f7[_0x3485be]||_0x31e7f7[_0x31e7f7[_0x21b6de(0x116)]-0x1];_0x7f7115[_0x21b6de(0x182)](_0x428b33,_0x3485be+0x1),_0x5056ad=_0x4fab45,_0x176398['add'](_0x5056ad),_0x1d3d1b[_0x21b6de(0x182)](_0x474fb7,_0x5056ad);const _0x47971c=await resolveRuleSegmentRefs(_0x21bd78,async _0x2d1fe7=>{const _0x50feab=_0x21b6de,_0x121c23=_0x1d3d1b[_0x50feab(0x138)](_0x2d1fe7);if(_0x121c23)return _0x121c23;const _0x24d0cf=await _0x14d7fb[_0x50feab(0xf3)](_0x2d1fe7);return _0x24d0cf[_0x50feab(0xdf)];});_0x504a7e={'description':_0x5183ea[_0x21b6de(0x160)],'rule':_0x47971c};}else{const _0x16651a=_0x2976cf[_0x21b6de(0x138)](_0x428b33);if(_0x16651a)_0x5056ad=_0x16651a,_0x1d3d1b[_0x21b6de(0x182)](_0x474fb7,_0x5056ad);else{if(_0xe6a408){let _0x3bb9e7=_0xe6a408,_0xe374ab=0x2;while(_0x176398[_0x21b6de(0x162)](_0x3bb9e7)||_0x38e859[_0x21b6de(0x162)](_0x3bb9e7)){_0x3bb9e7=_0xe6a408+'_'+_0xe374ab,_0xe374ab++;}_0x176398[_0x21b6de(0x15f)](_0x3bb9e7),_0x5056ad=_0x3bb9e7;}_0x1d3d1b['set'](_0x474fb7,_0x5056ad),_0x2976cf[_0x21b6de(0x182)](_0x428b33,_0x5056ad);const _0x84146b=await resolveRuleSegmentRefs(_0x21bd78,async _0xfd071e=>{const _0x52d6d8=_0x21b6de,_0x277082=_0x1d3d1b[_0x52d6d8(0x138)](_0xfd071e);if(_0x277082)return _0x277082;const _0xda2cff=await _0x14d7fb[_0x52d6d8(0xf3)](_0xfd071e);return _0xda2cff[_0x52d6d8(0xdf)];});_0x504a7e={'description':_0x5183ea[_0x21b6de(0x160)],'rule':_0x84146b};}}}return{'name':_0x5056ad,'isJourneyLocal':_0x186485,'definition':_0x504a7e};}catch(_0x41047d){return logger[_0x21b6de(0x136)](_0x21b6de(0xf9)+_0x474fb7+':\x20'+_0x41047d),{'name':_0x474fb7,'isJourneyLocal':![]};}},'resolveActivation':async _0x666c69=>{const _0xb12082=a142_0x10a9,_0x41bde2=_0x185135[_0xb12082(0x138)](_0x666c69);if(_0x41bde2!==undefined)return{'name':_0x41bde2,'isJourneyLocal':!![]};try{let _0x21c87c=_0x114c61?.['get'](_0x666c69);!_0x21c87c&&(_0x21c87c=await _0x205054[_0xb12082(0x139)][_0xb12082(0x1ab)](_0x327bb4,_0x666c69));const _0x3ef145=_0x21c87c[_0xb12082(0x13d)][_0xb12082(0xdc)]['name']||_0x666c69,_0x3dbff2=sanitizeYamlKey(_0x3ef145)||_0xb12082(0x166)+_0x666c69,_0x3ee676=_0x3dbff2;_0x185135[_0xb12082(0x182)](_0x666c69,_0x3ee676);const _0x146569=journeyActivationStepToYaml(_0x21c87c,_0x21d00e,_0x4fdd9d);return{'name':_0x3ee676,'isJourneyLocal':!![],'definition':_0x146569};}catch(_0x3dcab7){return logger['debug']('Failed\x20to\x20resolve\x20activation\x20'+_0x666c69+':\x20'+_0x3dcab7),{'name':_0x666c69,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x5e56ab,_0x2f656b)=>resolveJumpTarget(_0x5e56ab,_0x2f656b,_0x2ae73e,async _0x163376=>{const _0x59af8a=a142_0x10a9,_0x20f403=_0x274205?.[_0x59af8a(0x138)](_0x163376);if(_0x20f403)return _0x20f403;return _0x205054[_0x59af8a(0x139)]['getJourney'](_0x163376);})};return _0x14d7fb=_0x2fc39a,_0x2fc39a;},_0x5c6bfb=async _0x3e71b0=>{const _0x2b33ee=a142_0x10a9,{collectSegmentIdsFromJourneyApi:_0x40f00d}=await import(_0x2b33ee(0x1b2)),{batchAsync:_0x39ee64}=await import(_0x2b33ee(0x176)),_0x242d9a=new Set();for(const _0x38864b of _0x3e71b0){let _0x40f366=_0x274205?.[_0x2b33ee(0x138)](_0x38864b);!_0x40f366&&(_0x40f366=await _0x205054[_0x2b33ee(0x139)]['getJourney'](_0x38864b));const _0x280e44=_0x40f00d(_0x40f366);for(const _0x34d606 of _0x280e44){_0x242d9a['add'](_0x34d606);}}let _0x127007=Array[_0x2b33ee(0x1a7)](_0x242d9a);while(_0x127007['length']>0x0){const _0x55f141=_0x127007[_0x2b33ee(0x13b)](_0x5c3c1e=>!_0x209bec[_0x2b33ee(0x162)](_0x5c3c1e));if(_0x55f141[_0x2b33ee(0x116)]===0x0)break;const _0xe35854=await _0x39ee64(_0x55f141,async _0x2f4654=>{const _0x219b42=_0x2b33ee;_0x209bec[_0x219b42(0x15f)](_0x2f4654);const _0x104015=await fetchSegment(_0x205054,_0x1d8462,_0x2f4654,_0x5a015f);if(!_0x104015)return null;return{'segmentId':_0x2f4654,'segment':_0x104015};},0xa),_0x490a5f=new Set();for(const _0x528d03 of _0xe35854){if(!_0x528d03?.[_0x2b33ee(0x18f)]?.['rule'])continue;const _0xb63227=apiRuleToYaml(_0x528d03['segment'][_0x2b33ee(0x146)]);_0x4162b9[_0x2b33ee(0x182)](_0x528d03[_0x2b33ee(0x1bc)],_0xb63227);const _0x359145=collectSegmentRefsFromRule(_0xb63227);for(const _0x56e665 of _0x359145){!_0x209bec[_0x2b33ee(0x162)](_0x56e665)&&_0x490a5f[_0x2b33ee(0x15f)](_0x56e665);}}_0x127007=Array[_0x2b33ee(0x1a7)](_0x490a5f);}};return{'createYamlContext':_0x29e7c8,'prefetchJourneySegments':_0x5c6bfb};}export async function executePushSegments(_0x29d7e1,_0x21951f,_0x1ac9f1,_0xddc26e,_0x4ed740){const _0x226845=a142_0x5b6902,{segmentDefToCreateRequest:_0x453450,segmentDefToUpdateRequest:_0x3a290f}=await import(_0x226845(0x13c)),_0x6603c8=_0x1ac9f1[_0x226845(0x103)],_0xfee1e0=0x5,_0x338252=async _0x2f5018=>{const _0x177ace=_0x226845,_0x2b37af=_0x2f5018[_0x177ace(0x1c3)]?_0x6603c8[_0x177ace(0x138)](_0x2f5018['folderPath']):undefined;let _0x8f6a8;const _0x56415c={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x3f055e=_0x2f5018['yamlConfig'];if(_0x2f5018['yamlConfig'][_0x177ace(0x146)]){const _0x143e1f=createSegmentIdResolver(_0x1ac9f1[_0x177ace(0x1a8)],_0x2f5018[_0x177ace(0x1b1)][_0x177ace(0xdf)]),_0x1fcc57=await resolveRuleSegmentIds(_0x2f5018['yamlConfig'][_0x177ace(0x146)],_0x143e1f);_0x3f055e={..._0x2f5018[_0x177ace(0x1b1)],'rule':_0x1fcc57};}try{if(_0x2f5018[_0x177ace(0x1d7)]){_0x4ed740[_0x177ace(0x130)]?.({'type':_0x177ace(0x1c9),'name':_0x2f5018[_0x177ace(0x1b1)]['name']});const _0x588121=_0x453450(_0x3f055e,_0x2b37af),_0x1293cb=await _0x4ed740[_0x177ace(0x1a0)](_0x177ace(0x1a5)+_0x2f5018[_0x177ace(0x1b1)][_0x177ace(0xdf)]+_0x177ace(0x153),()=>_0x29d7e1['segment'][_0x177ace(0x1c5)](_0xddc26e['parentId'],_0x588121));_0x8f6a8=_0x1293cb[_0x177ace(0x1cd)]['id'],_0x1ac9f1[_0x177ace(0x1a8)]['set'](_0x2f5018[_0x177ace(0x1b1)][_0x177ace(0xdf)],_0x8f6a8),_0x56415c[_0x177ace(0x14d)]={'name':_0x2f5018['yamlConfig'][_0x177ace(0xdf)],'id':_0x8f6a8},_0x4ed740['onProgress']?.({'type':'segment_created','name':_0x2f5018[_0x177ace(0x1b1)][_0x177ace(0xdf)],'segmentId':_0x8f6a8}),_0x4ed740[_0x177ace(0x1df)]?.(_0x177ace(0x1a4)+_0x2f5018['yamlConfig']['name']+'\x27'),_0x56415c[_0x177ace(0xe3)]=0x1;}else{if(_0x2f5018[_0x177ace(0x1a2)]){_0x4ed740[_0x177ace(0x130)]?.({'type':'segment_updating','name':_0x2f5018[_0x177ace(0x1b1)]['name']});const _0x1147af=_0x3a290f(_0x3f055e);_0x2b37af!==_0x2f5018[_0x177ace(0x19c)]?.[_0x177ace(0x1d9)]&&(_0x1147af[_0x177ace(0x1d9)]=_0x2b37af?parseInt(_0x2b37af,0xa):undefined),await _0x4ed740[_0x177ace(0x1a0)](_0x177ace(0x132)+_0x2f5018['yamlConfig'][_0x177ace(0xdf)]+'\x27...',()=>_0x29d7e1['segment'][_0x177ace(0x186)](_0xddc26e[_0x177ace(0x1ad)],_0x2f5018['existingSegment']['id'],_0x1147af)),_0x8f6a8=_0x2f5018['existingSegment']['id'],_0x4ed740[_0x177ace(0x130)]?.({'type':_0x177ace(0x10d),'name':_0x2f5018['yamlConfig'][_0x177ace(0xdf)]}),_0x4ed740[_0x177ace(0x1df)]?.(_0x177ace(0x12b)+_0x2f5018[_0x177ace(0x1b1)][_0x177ace(0xdf)]+'\x27'),_0x56415c[_0x177ace(0xe7)]=0x1;}else _0x8f6a8=_0x2f5018[_0x177ace(0x19c)]['id'];}}catch(_0x1cb21e){const _0x32b034=isHttp400Error(_0x1cb21e),_0xe2c9ca=_0x32b034?ErrorCode[_0x177ace(0x1ae)]:ErrorCode[_0x177ace(0x15e)],_0x59325a=getErrorMessage(_0x1cb21e);throw new SDKError(_0xe2c9ca,_0x177ace(0x13a)+(_0x2f5018['isNew']?_0x177ace(0x184):_0x177ace(0xf0))+_0x177ace(0x1c1)+_0x2f5018[_0x177ace(0x11a)]+'\x0a\x20\x20'+_0x59325a,_0x1cb21e);}try{const _0x4817d2=await syncActivationsForSegment(_0x29d7e1,_0xddc26e['parentId'],_0x8f6a8,_0x2f5018[_0x177ace(0x1b1)][_0x177ace(0xdf)],_0x2f5018['activationActions'],_0x4ed740,_0x2f5018[_0x177ace(0x11a)]);_0x56415c[_0x177ace(0x11f)]=_0x4817d2;}catch(_0x421090){if(_0x421090 instanceof SDKError)throw _0x421090;throw new SDKError(ErrorCode[_0x177ace(0xe0)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x2f5018[_0x177ace(0x1b1)][_0x177ace(0xdf)]+_0x177ace(0x134)+_0x2f5018[_0x177ace(0x11a)]+_0x177ace(0x17a)+getErrorMessage(_0x421090),_0x421090);}return _0x56415c;},_0x27c253=await batchAsync(_0x21951f,_0x338252,_0xfee1e0),_0x29d575={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x36c74e of _0x27c253){_0x29d575[_0x226845(0xe3)]+=_0x36c74e[_0x226845(0xe3)],_0x29d575[_0x226845(0xe7)]+=_0x36c74e[_0x226845(0xe7)],_0x36c74e['createdSegmentId']&&_0x29d575[_0x226845(0xfe)][_0x226845(0x182)](_0x36c74e['createdSegmentId'][_0x226845(0xdf)],_0x36c74e[_0x226845(0x14d)]['id']),_0x29d575[_0x226845(0x11f)][_0x226845(0xe3)]+=_0x36c74e[_0x226845(0x11f)][_0x226845(0xe3)],_0x29d575[_0x226845(0x11f)][_0x226845(0xe7)]+=_0x36c74e['activations']['updated'],_0x29d575[_0x226845(0x11f)][_0x226845(0x1c2)]+=_0x36c74e[_0x226845(0x11f)][_0x226845(0x1c2)];}return _0x29d575;}async function syncActivationsForSegment(_0x1f592f,_0x1d769b,_0x48e0d2,_0x539ca1,_0xca0e52,_0x5eaf82,_0x379a45){const _0x4dc22d=a142_0x5b6902,_0x3ecd1e={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xcc9392 of _0xca0e52){try{if(_0xcc9392[_0x4dc22d(0xfa)]===_0x4dc22d(0x184)&&_0xcc9392[_0x4dc22d(0x197)])_0x5eaf82['onProgress']?.({'type':_0x4dc22d(0xf4),'segmentName':_0x539ca1,'activationName':_0xcc9392[_0x4dc22d(0xdf)]}),await _0x5eaf82[_0x4dc22d(0x1a0)](_0x4dc22d(0x12a)+_0xcc9392['name']+_0x4dc22d(0x153),()=>_0x1f592f['segment'][_0x4dc22d(0xf8)](_0x1d769b,_0x48e0d2,_0xcc9392[_0x4dc22d(0x197)])),_0x5eaf82[_0x4dc22d(0x130)]?.({'type':_0x4dc22d(0x194),'segmentName':_0x539ca1,'activationName':_0xcc9392[_0x4dc22d(0xdf)]}),_0x5eaf82[_0x4dc22d(0x1df)]?.('Created\x20activation\x20\x27'+_0xcc9392[_0x4dc22d(0xdf)]+'\x27'),_0x3ecd1e[_0x4dc22d(0xe3)]++;else{if(_0xcc9392['type']==='update'&&_0xcc9392['validatedRequest']&&_0xcc9392[_0x4dc22d(0x109)])_0x5eaf82[_0x4dc22d(0x130)]?.({'type':_0x4dc22d(0x155),'segmentName':_0x539ca1,'activationName':_0xcc9392[_0x4dc22d(0xdf)]}),await _0x5eaf82['withProgress'](_0x4dc22d(0x17b)+_0xcc9392[_0x4dc22d(0xdf)]+_0x4dc22d(0x153),()=>_0x1f592f[_0x4dc22d(0x18f)]['updateActivation'](_0x1d769b,_0x48e0d2,_0xcc9392[_0x4dc22d(0x109)]['id'],_0xcc9392['validatedRequest'])),_0x5eaf82[_0x4dc22d(0x130)]?.({'type':_0x4dc22d(0x183),'segmentName':_0x539ca1,'activationName':_0xcc9392[_0x4dc22d(0xdf)]}),_0x5eaf82['logSuccess']?.('Updated\x20activation\x20\x27'+_0xcc9392[_0x4dc22d(0xdf)]+'\x27'),_0x3ecd1e[_0x4dc22d(0xe7)]++;else _0xcc9392[_0x4dc22d(0xfa)]==='delete'&&_0xcc9392[_0x4dc22d(0x109)]&&(_0x5eaf82[_0x4dc22d(0x130)]?.({'type':_0x4dc22d(0x1db),'segmentName':_0x539ca1,'activationName':_0xcc9392[_0x4dc22d(0xdf)]}),await _0x5eaf82['withProgress'](_0x4dc22d(0x15a)+_0xcc9392[_0x4dc22d(0xdf)]+'\x27...',()=>_0x1f592f[_0x4dc22d(0x18f)][_0x4dc22d(0x1ca)](_0x1d769b,_0x48e0d2,_0xcc9392['existingActivation']['id'])),_0x5eaf82[_0x4dc22d(0x130)]?.({'type':_0x4dc22d(0x1b9),'segmentName':_0x539ca1,'activationName':_0xcc9392[_0x4dc22d(0xdf)]}),_0x5eaf82[_0x4dc22d(0x11c)]?.('Deleted\x20activation\x20\x27'+_0xcc9392['name']+'\x27'),_0x3ecd1e[_0x4dc22d(0x1c2)]++);}}catch(_0xadfa08){const _0x49304c=isHttp400Error(_0xadfa08),_0x3ce0f7=_0x49304c?ErrorCode[_0x4dc22d(0x12d)]:ErrorCode[_0x4dc22d(0xe0)],_0x25309b=getErrorMessage(_0xadfa08);throw new SDKError(_0x3ce0f7,_0x4dc22d(0x13a)+_0xcc9392[_0x4dc22d(0xfa)]+_0x4dc22d(0x105)+_0xcc9392['name']+_0x4dc22d(0x134)+_0x379a45+'\x0a\x20\x20'+_0x25309b,_0xadfa08);}}return _0x3ecd1e;}export async function executePushFolders(_0x27a6a0,_0x54d671,_0x8236f9,_0x30732f,_0x49030b){const _0x60d669=a142_0x5b6902,_0x16ada4=new Map(_0x8236f9),_0x3afecf=sortFoldersByDepth(_0x54d671);for(const _0x2399f8 of _0x3afecf){const _0x4a8e83=_0x2399f8[_0x60d669(0x18d)]('/'),_0x381997=_0x4a8e83[_0x4a8e83['length']-0x1],_0x4dc0ce=_0x4a8e83['slice'](0x0,-0x1)[_0x60d669(0xfc)]('/'),_0x49d79c=_0x16ada4['get'](_0x4dc0ce);_0x49030b['onProgress']?.({'type':_0x60d669(0x1a6),'folder':_0x2399f8});const _0x36c8a6={'name':_0x381997,'parentFolderId':_0x49d79c},_0x3df331=await _0x49030b[_0x60d669(0x1a0)](_0x60d669(0x192)+_0x2399f8+_0x60d669(0x153),()=>_0x27a6a0[_0x60d669(0x18f)][_0x60d669(0x114)](_0x30732f[_0x60d669(0x1ad)],_0x36c8a6));_0x16ada4[_0x60d669(0x182)](_0x2399f8,_0x3df331[_0x60d669(0x1cd)]['id']),_0x49030b[_0x60d669(0x130)]?.({'type':'folder_created','folder':_0x2399f8,'folderId':_0x3df331[_0x60d669(0x1cd)]['id']}),_0x49030b[_0x60d669(0x1d4)]?.('Created\x20folder\x20\x27'+_0x2399f8+'\x27');}return _0x16ada4;}export async function executePushSegmentDeletions(_0x2a1092,_0x35b9ac,_0x54f30a){const _0x1816a0=a142_0x5b6902;if(_0x35b9ac[_0x1816a0(0x116)]===0x0)return 0x0;const {batchAsync:_0x525082}=await import(_0x1816a0(0x176)),_0xab286c=0x5,_0x5048ac=await _0x525082(_0x35b9ac,async _0x358d85=>{const _0x2eaeff=_0x1816a0;return _0x54f30a[_0x2eaeff(0x130)]?.({'type':'segment_deleting','name':_0x358d85[_0x2eaeff(0xdf)]}),await _0x2a1092[_0x2eaeff(0x18f)][_0x2eaeff(0x1de)](_0x358d85['id']),_0x54f30a['onProgress']?.({'type':_0x2eaeff(0x143),'name':_0x358d85[_0x2eaeff(0xdf)]}),_0x54f30a[_0x2eaeff(0x11c)]?.(_0x2eaeff(0xdb)+_0x358d85['name']+'\x27'),0x1;},_0xab286c);return _0x5048ac[_0x1816a0(0xee)]((_0x1a48ef,_0x26295c)=>_0x1a48ef+_0x26295c,0x0);}export async function executePushJourneys(_0x3ac57a,_0x47768a,_0x396336,_0x117ac8,_0x4c5875){const _0x5e9d0e=a142_0x5b6902,{journeyDefToRequest:_0x2029bb}=await import(_0x5e9d0e(0x1b2)),{activationDefToCreateRequest:_0x3e4035,yamlRuleToApi:_0x2eb53e,validateSegmentRule:_0x295df1}=await import(_0x5e9d0e(0x13c)),_0x3ce7e3={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4289c6=new Map(_0x396336[_0x5e9d0e(0x1a8)]),_0x1b3990=0x5;for(let _0x14bf95=0x0;_0x14bf95<_0x47768a[_0x5e9d0e(0x116)];_0x14bf95+=_0x1b3990){const _0x348975=_0x47768a[_0x5e9d0e(0xda)](_0x14bf95,_0x14bf95+_0x1b3990),_0x2b99a5=await Promise[_0x5e9d0e(0x188)](_0x348975[_0x5e9d0e(0x1cf)](async _0x5ac2d1=>{const _0x51f645=_0x5e9d0e;if(!_0x5ac2d1[_0x51f645(0x1d7)]&&!_0x5ac2d1[_0x51f645(0x1a2)])return{'action':'unchanged','name':_0x5ac2d1[_0x51f645(0x1b1)][_0x51f645(0xdf)],'journeyId':_0x5ac2d1[_0x51f645(0x164)]?.['id']};const _0x3869d5=_0x5ac2d1['folderPath']?_0x396336[_0x51f645(0x103)]['get'](_0x5ac2d1['folderPath']):undefined;_0x4c5875['onProgress']?.({'type':_0x5ac2d1['isNew']?_0x51f645(0x16d):_0x51f645(0x137),'name':_0x5ac2d1[_0x51f645(0x1b1)][_0x51f645(0xdf)]});try{const _0x2f3777=await executeSingleJourneyPush(_0x3ac57a,_0x5ac2d1,{..._0x396336,'segmentNameToId':_0x4289c6},{'parentId':_0x117ac8['parentId'],'rootFolderId':_0x117ac8['rootFolderId'],'folderId':_0x3869d5,'verbose':_0x117ac8[_0x51f645(0x1d3)]},_0x4c5875,{'journeyDefToRequest':_0x2029bb,'activationDefToCreateRequest':_0x3e4035,'yamlRuleToApi':_0x2eb53e,'validateSegmentRule':_0x295df1});for(const [_0x37a121,_0x326b90]of _0x2f3777['embeddedSegmentNameToId']){_0x4289c6['set'](_0x37a121,_0x326b90),_0x3ce7e3[_0x51f645(0x10a)][_0x51f645(0x182)](_0x37a121,_0x326b90);}if(_0x2f3777[_0x51f645(0x170)]===_0x51f645(0xe3))_0x4c5875[_0x51f645(0x130)]?.({'type':'journey_created','name':_0x5ac2d1[_0x51f645(0x1b1)][_0x51f645(0xdf)],'journeyId':_0x2f3777[_0x51f645(0x177)]}),_0x4c5875[_0x51f645(0x1df)]?.('Created\x20journey\x20\x27'+_0x5ac2d1[_0x51f645(0x1b1)][_0x51f645(0xdf)]+'\x27'),_0x3ce7e3[_0x51f645(0xe3)]++;else _0x2f3777['action']===_0x51f645(0xe7)&&(_0x4c5875[_0x51f645(0x130)]?.({'type':_0x51f645(0x19f),'name':_0x5ac2d1[_0x51f645(0x1b1)][_0x51f645(0xdf)]}),_0x4c5875[_0x51f645(0x1df)]?.('Updated\x20journey\x20\x27'+_0x5ac2d1[_0x51f645(0x1b1)][_0x51f645(0xdf)]+'\x27'),_0x3ce7e3['updated']++);return{'action':_0x2f3777[_0x51f645(0x170)],'name':_0x5ac2d1[_0x51f645(0x1b1)][_0x51f645(0xdf)],'journeyId':_0x2f3777[_0x51f645(0x177)]};}catch(_0x368bcb){const _0x1e3b5f=isHttp400Error(_0x368bcb),_0x46de5b=_0x1e3b5f?ErrorCode[_0x51f645(0xd8)]:ErrorCode[_0x51f645(0x1a1)],_0x1a150d=getErrorMessage(_0x368bcb);throw new SDKError(_0x46de5b,_0x51f645(0x13a)+(_0x5ac2d1[_0x51f645(0x1d7)]?'create':'update')+_0x51f645(0x11e)+_0x5ac2d1[_0x51f645(0x11a)]+_0x51f645(0x17a)+_0x1a150d,_0x368bcb);}}));_0x3ce7e3[_0x5e9d0e(0x1a3)][_0x5e9d0e(0x144)](..._0x2b99a5);}return _0x3ce7e3;}async function matchExistingJourneySegments(_0x4863c1,_0x4df27b,_0x46cbb1,_0x218deb,_0x4b075b){const _0x3f3ad2=a142_0x5b6902;if(!_0x4df27b[_0x3f3ad2(0x164)]||!_0x4df27b[_0x3f3ad2(0x1b1)]['segments'])return;const _0x4fa767=new Map(),_0x53599a=new Set();for(const _0x15ffbc of Object['keys'](_0x4df27b['yamlConfig'][_0x3f3ad2(0x18a)])){const _0x454394=generateDeterministicJourneySegmentName(_0x4df27b[_0x3f3ad2(0x1b1)][_0x3f3ad2(0xdf)],_0x15ffbc);_0x4fa767[_0x3f3ad2(0x182)](_0x454394,_0x15ffbc),_0x53599a[_0x3f3ad2(0x15f)](_0x15ffbc);}const _0x4d3e33=[],_0x6e7bfc=collectSegmentIdsFromJourneyApi(_0x4df27b[_0x3f3ad2(0x164)]);for(const _0x46156a of _0x6e7bfc){const _0x36508f=await fetchSegment(_0x4863c1,_0x46cbb1,_0x46156a,_0x218deb);if(!_0x36508f?.[_0x3f3ad2(0xdf)])continue;const _0x17b150=_0x4fa767[_0x3f3ad2(0x138)](_0x36508f[_0x3f3ad2(0xdf)]);_0x17b150?(_0x4b075b['set'](_0x17b150,_0x46156a),_0x53599a[_0x3f3ad2(0x1d5)](_0x17b150)):_0x4d3e33[_0x3f3ad2(0x144)]({'id':_0x46156a,'seg':_0x36508f});}if(_0x53599a['size']>0x0&&_0x4d3e33['length']>0x0){const {localExpandedRuleToNames:_0x206a6b}=buildLocalExpandedRuleMappings(_0x4df27b['yamlConfig']),_0x373503=new Map();for(const {id:_0x99067b,seg:_0x23961d}of _0x4d3e33){if(_0x23961d['rule']){const _0x113c76=apiRuleToYaml(_0x23961d['rule']);_0x373503[_0x3f3ad2(0x182)](_0x99067b,_0x113c76);}}for(const {id:_0x25e8aa,seg:_0x40e191}of _0x4d3e33){if(!_0x40e191[_0x3f3ad2(0x146)])continue;const _0x1fb4d0=_0x373503['get'](_0x25e8aa);if(!_0x1fb4d0)continue;const _0x171333=serializeExpandedRule(_0x1fb4d0,_0x373503),_0x1dddf9=_0x206a6b[_0x3f3ad2(0x138)](_0x171333);if(_0x1dddf9){const _0x3ea294=_0x1dddf9[_0x3f3ad2(0x168)](_0x17b6b4=>_0x53599a[_0x3f3ad2(0x162)](_0x17b6b4));_0x3ea294&&(_0x4b075b['set'](_0x3ea294,_0x25e8aa),_0x53599a['delete'](_0x3ea294),logger[_0x3f3ad2(0x136)](_0x3f3ad2(0x1bd)+_0x40e191[_0x3f3ad2(0xdf)]+_0x3f3ad2(0xf5)+_0x3ea294+_0x3f3ad2(0x19b)));}}}}async function executeSingleJourneyPush(_0x210ade,_0x356efd,_0x5cd914,_0xd878b4,_0x48ed4e,_0x53306d){const _0xd482b1=a142_0x5b6902,{journeyDefToRequest:_0x3699c7,activationDefToCreateRequest:_0x1cfb6e,yamlRuleToApi:_0x22ec80,validateSegmentRule:_0x29bea8}=_0x53306d,_0x574db5=new Map(),_0x1c6cbd=new Map();recoverSegmentIdsFromPushRecovery(_0x356efd,_0x574db5,_0x5cd914[_0xd482b1(0x1a8)]);const _0x558f53=new Map(),_0x5c1dd2=new Map(),_0xdc8fbf=new Map();let _0x2425d5;const _0x4629b4=async()=>{const _0x4f9e6b=_0xd482b1;if(_0x2425d5)return;_0x2425d5=new Map();if(!_0x356efd[_0x4f9e6b(0x164)])return;const _0x97cee=await _0x210ade[_0x4f9e6b(0x139)]['listActivations'](_0x356efd['existingJourney']['id']);for(const _0x313de1 of _0x97cee){const _0x3b9bd4=journeyActivationStepToYaml(_0x313de1,_0x5cd914[_0x4f9e6b(0xf1)],_0x5cd914[_0x4f9e6b(0x1d1)]),_0x2f3fc7=activationSignature(_0x3b9bd4);!_0x2425d5[_0x4f9e6b(0x162)](_0x2f3fc7)&&_0x2425d5[_0x4f9e6b(0x182)](_0x2f3fc7,_0x313de1['id']),_0x3b9bd4[_0x4f9e6b(0xdf)]&&_0x1c6cbd[_0x4f9e6b(0x182)](_0x3b9bd4[_0x4f9e6b(0xdf)],_0x313de1['id']);}};await matchExistingJourneySegments(_0x210ade,_0x356efd,_0xd878b4[_0xd482b1(0x1ad)],_0x5cd914[_0xd482b1(0x17d)],_0x5cd914['segmentNameToId']);const _0x40ff6d={'resolveSegmentId':async _0x37afec=>{const _0x24f6b4=_0xd482b1,_0x2793ad=_0x5cd914[_0x24f6b4(0x1a8)][_0x24f6b4(0x138)](_0x37afec);if(!_0x2793ad)throw new SDKError(ErrorCode[_0x24f6b4(0x1cc)],_0x24f6b4(0x17f)+_0x37afec+_0x24f6b4(0x101)+_0x356efd['yamlConfig'][_0x24f6b4(0xdf)]+')');return _0x2793ad;},'resolveEmbeddedSegmentId':async(_0x140055,_0x39669c)=>{const _0x704275=_0xd482b1,_0x2a42c4=_0x5cd914[_0x704275(0x1a8)][_0x704275(0x138)](_0x140055);if(_0x2a42c4)return _0x2a42c4;const _0x8017ef=_0x5cd914[_0x704275(0x17d)][_0x704275(0x168)](_0x4002d2=>_0x4002d2[_0x704275(0xdf)]===_0x140055);if(_0x8017ef)return _0x5cd914[_0x704275(0x1a8)]['set'](_0x140055,_0x8017ef['id']),_0x8017ef['id'];if(_0x356efd[_0x704275(0x1d7)]){const {stageName:_0x3f544c,criteriaName:_0x4abba7}=findSegmentCriteriaLocation(_0x356efd[_0x704275(0x1b1)],_0x140055);return _0x29bea8(_0x140055,_0x39669c['rule']),_0x5c1dd2[_0x704275(0x182)](_0x140055,{'definition':_0x39669c,'stageName':_0x3f544c,'criteriaName':_0x4abba7}),createPendingSegmentId(_0x140055);}const _0x1a536e=_0x356efd[_0x704275(0x164)]?.['id'];if(!_0x1a536e)throw new SDKError(ErrorCode['INTERNAL'],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x39ca87=_0x558f53['get'](_0x140055);if(_0x39ca87)return _0x39ca87;const _0x5a1ab6=((async()=>{const _0x157e31=_0x704275;_0x29bea8(_0x140055,_0x39669c[_0x157e31(0x146)]);const _0xc29d34=generateDeterministicJourneySegmentName(_0x356efd[_0x157e31(0x1b1)][_0x157e31(0xdf)],_0x140055),_0x1234b1=_0x5cd914[_0x157e31(0x17d)][_0x157e31(0x168)](_0x9a8630=>_0x9a8630[_0x157e31(0xdf)]===_0xc29d34),_0x1a5b03=createSegmentIdResolver(_0x5cd914[_0x157e31(0x1a8)],_0x140055),_0x56044f=await resolveRuleSegmentIds(_0x39669c[_0x157e31(0x146)],_0x1a5b03);let _0x2f9ce8;return _0x1234b1?(await _0x210ade[_0x157e31(0x18f)][_0x157e31(0x186)](_0xd878b4[_0x157e31(0x1ad)],_0x1234b1['id'],{'description':_0x39669c['description']||_0x157e31(0x190)+_0x140055,'rule':_0x22ec80(_0x56044f,!![]),'countPopulation':!![]}),_0x2f9ce8=_0x1234b1['id'],saveSegmentToPushRecovery(_0x356efd[_0x157e31(0x11a)],_0x356efd[_0x157e31(0x1b1)][_0x157e31(0xdf)],_0x140055,{'segmentId':_0x2f9ce8,'uniqueServerName':_0xc29d34,'createdAt':new Date()['toISOString']()})):_0x2f9ce8=await createOrRecoverEmbeddedSegment(_0x210ade,_0x356efd,{'localName':_0x140055,'uniqueSegmentName':_0xc29d34,'description':_0x39669c[_0x157e31(0x160)]||'Entry\x20criteria:\x20'+_0x140055,'journeyId':_0x1a536e,'resolvedRule':_0x56044f,'parentId':_0xd878b4[_0x157e31(0x1ad)],'folderId':_0xd878b4['rootFolderId']||''},_0x22ec80),_0x5cd914['segmentNameToId'][_0x157e31(0x182)](_0x140055,_0x2f9ce8),_0x574db5[_0x157e31(0x182)](_0x140055,_0x2f9ce8),_0x2f9ce8;})());_0x558f53['set'](_0x140055,_0x5a1ab6);try{return await _0x5a1ab6;}finally{_0x558f53['delete'](_0x140055);}},'resolveActivationId':async _0x160822=>{const _0x49a1c8=_0xd482b1,_0xaa0cdb=_0x1c6cbd[_0x49a1c8(0x138)](_0x160822);if(_0xaa0cdb)return _0xaa0cdb;if(_0x356efd['existingJourney']){await _0x4629b4();const _0x920679=_0x1c6cbd[_0x49a1c8(0x138)](_0x160822);if(_0x920679)return _0x920679;}throw new SDKError(ErrorCode[_0x49a1c8(0x113)],_0x49a1c8(0x1dc)+_0x160822+_0x49a1c8(0x101)+_0x356efd[_0x49a1c8(0x1b1)][_0x49a1c8(0xdf)]+').\x20'+_0x49a1c8(0xea));},'resolveEmbeddedActivationId':async(_0x54296c,_0x27fab3)=>{const _0x5f3216=_0xd482b1,_0x334b42=_0x1c6cbd[_0x5f3216(0x138)](_0x54296c);if(_0x334b42)return _0x334b42;if(_0x356efd[_0x5f3216(0x1d7)])return _0xdc8fbf[_0x5f3216(0x182)](_0x54296c,_0x27fab3),createPendingActivationId(_0x54296c);if(_0x356efd[_0x5f3216(0x164)]){await _0x4629b4();const _0x681a72=_0x1c6cbd[_0x5f3216(0x138)](_0x27fab3[_0x5f3216(0xdf)]);if(_0x681a72)return _0x1c6cbd['set'](_0x54296c,_0x681a72),_0x681a72;const _0x126b61=activationSignature(_0x27fab3),_0xd2d507=_0x2425d5?.[_0x5f3216(0x138)](_0x126b61);if(_0xd2d507)return _0x1c6cbd[_0x5f3216(0x182)](_0x54296c,_0xd2d507),_0xd2d507;const _0x225775=await _0x1cfb6e(_0x27fab3,_0x5cd914[_0x5f3216(0xe2)]),_0x2fbedc={..._0x225775,..._0x27fab3[_0x5f3216(0x15b)]!==undefined&&{'runAfterJourneyRefresh':_0x27fab3[_0x5f3216(0x15b)]}},_0x34f1df=await _0x210ade['journey'][_0x5f3216(0xf8)](_0x356efd[_0x5f3216(0x164)]['id'],_0x2fbedc);return _0x1c6cbd[_0x5f3216(0x182)](_0x54296c,_0x34f1df['id']),_0x34f1df['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x5f3216(0x1ce));},'resolveJourneyId':async _0x30d4c2=>{const _0xc6eb59=_0xd482b1;try{return await _0x210ade[_0xc6eb59(0x139)]['resolveJourneyId'](_0xd878b4[_0xc6eb59(0x1ad)],_0x30d4c2);}catch(_0x279564){throw new SDKError(ErrorCode[_0xc6eb59(0x113)],_0xc6eb59(0xfb)+_0x30d4c2+_0xc6eb59(0xe6)+_0x356efd[_0xc6eb59(0x1b1)]['name']+'\x27)',_0x279564);}},'resolveStageId':async(_0x18eae9,_0xd75515)=>{const _0x144ede=_0xd482b1,_0x1ff4b9=await _0x210ade[_0x144ede(0x139)][_0x144ede(0x156)](_0x18eae9),_0x316554=_0x1ff4b9[_0x144ede(0x13d)][_0x144ede(0x150)]['find'](_0x2a8f02=>_0x2a8f02['name']['toLowerCase']()===_0xd75515[_0x144ede(0x16a)]());if(!_0x316554?.['id'])throw new SDKError(ErrorCode[_0x144ede(0x113)],_0x144ede(0x120)+_0xd75515+_0x144ede(0xef)+(_0x1ff4b9[_0x144ede(0x13d)]['journeyBundleName']||_0x1ff4b9[_0x144ede(0x13d)][_0x144ede(0xdf)])+'\x27');return _0x316554['id'];}},_0x362083=await _0x3699c7(_0x356efd[_0xd482b1(0x1b1)],_0xd878b4[_0xd482b1(0x1ad)],_0x40ff6d),_0x29ab1f=_0xd878b4[_0xd482b1(0x111)]||_0xd878b4[_0xd482b1(0x1b8)];_0x29ab1f&&(_0x362083[_0xd482b1(0x145)]={'parentFolder':{'data':{'id':_0x29ab1f,'type':_0xd482b1(0x106)}}});if(_0x356efd[_0xd482b1(0x1d7)]){if(_0x5c1dd2[_0xd482b1(0x180)]>0x0||_0xdc8fbf[_0xd482b1(0x180)]>0x0)return await executeThreeStepJourneyCreate(_0x210ade,_0x356efd,_0x362083,{'pendingEmbeddedSegments':_0x5c1dd2,'pendingEmbeddedActivations':_0xdc8fbf,'embeddedSegmentNameToId':_0x574db5,'journeyActivationNameToId':_0x1c6cbd},{..._0xd878b4,'effectiveFolderId':_0x29ab1f},_0x5cd914,_0x48ed4e,_0x53306d);else{ensureJourneyDefaults(_0x362083[_0xd482b1(0x13d)]);const _0x30f237=await _0x210ade[_0xd482b1(0x139)]['create'](_0x362083);return deletePushRecovery(_0x356efd[_0xd482b1(0x11a)]),{'action':'created','journeyId':_0x30f237['id'],'embeddedSegmentNameToId':_0x574db5};}}else{if(_0x356efd[_0xd482b1(0x1a2)]&&_0x356efd[_0xd482b1(0x164)]){_0x362083['id']=_0x356efd['existingJourney']['id'];const _0x5ce97c=_0x362083[_0xd482b1(0x13d)];_0x356efd[_0xd482b1(0x164)][_0xd482b1(0x13d)]?.[_0xd482b1(0x191)]&&(_0x5ce97c[_0xd482b1(0x191)]=_0x356efd[_0xd482b1(0x164)][_0xd482b1(0x13d)]['journeyBundleName']);const _0x3007c3=_0x356efd['existingJourney'][_0xd482b1(0x13d)]?.['journeyStages'];return _0x3007c3&&_0x362083['attributes'][_0xd482b1(0x150)]&&injectExistingStageIds(_0x362083['attributes'][_0xd482b1(0x150)],_0x3007c3),ensureJourneyDefaults(_0x5ce97c),await _0x210ade[_0xd482b1(0x139)][_0xd482b1(0xf0)](_0x356efd[_0xd482b1(0x164)]['id'],_0x362083),deletePushRecovery(_0x356efd['absolutePath']),{'action':_0xd482b1(0xe7),'journeyId':_0x356efd[_0xd482b1(0x164)]['id'],'embeddedSegmentNameToId':_0x574db5};}}return deletePushRecovery(_0x356efd[_0xd482b1(0x11a)]),{'action':_0xd482b1(0x1bb),'journeyId':_0x356efd[_0xd482b1(0x164)]?.['id'],'embeddedSegmentNameToId':_0x574db5};}function findSegmentCriteriaLocation(_0x766864,_0x1a49ba){const _0x2d0c8a=a142_0x5b6902,_0x125fba=_0x766864['stages']||_0x766864[_0x2d0c8a(0xf7)]?.[0x0]?.[_0x2d0c8a(0x152)]||[];let _0x359c1d=_0x2d0c8a(0x128),_0x44fa28=_0x1a49ba;const _0x3c8120=_0x766864[_0x2d0c8a(0x161)]||_0x766864[_0x2d0c8a(0xf7)]?.[0x0]?.['goal'];if(_0x3c8120?.[_0x2d0c8a(0x18f)]===_0x1a49ba)return{'stageName':_0x2d0c8a(0x161),'criteriaName':_0x3c8120[_0x2d0c8a(0xdf)]||_0x1a49ba};_0xfdb4c0:for(const _0x1fddbf of _0x125fba){if(_0x1fddbf['entry_criteria']?.[_0x2d0c8a(0x18f)]===_0x1a49ba){_0x359c1d=_0x1fddbf[_0x2d0c8a(0xdf)],_0x44fa28=_0x1fddbf[_0x2d0c8a(0x12f)]['name']||_0x1a49ba;break;}if(_0x1fddbf[_0x2d0c8a(0x1c8)])for(const _0x71b402 of _0x1fddbf['steps']){if(_0x71b402[_0x2d0c8a(0xfa)]==='decision_point'&&_0x71b402[_0x2d0c8a(0x10c)]?.[_0x2d0c8a(0x11d)])for(const _0xc6d389 of _0x71b402[_0x2d0c8a(0x10c)]['branches']){if(_0xc6d389['segment']===_0x1a49ba){_0x359c1d=_0x1fddbf[_0x2d0c8a(0xdf)],_0x44fa28=_0xc6d389[_0x2d0c8a(0xdf)]||_0x1a49ba;break _0xfdb4c0;}}}}return{'stageName':_0x359c1d,'criteriaName':_0x44fa28};}async function executeThreeStepJourneyCreate(_0x53669e,_0x315b7e,_0x17f308,_0x43adb0,_0xa1ba47,_0x1bc2f5,_0x5bc24e,_0xe26638){const _0x328b57=a142_0x5b6902,{activationDefToCreateRequest:_0x2da53e,yamlRuleToApi:_0xbae6bd}=_0xe26638,{pendingEmbeddedSegments:_0x590509,pendingEmbeddedActivations:_0x1c847a,embeddedSegmentNameToId:_0x2d8008}=_0x43adb0,_0x270c36=JSON['parse'](JSON[_0x328b57(0x19d)](_0x17f308));ensureJourneyDefaults(_0x270c36[_0x328b57(0x13d)]),stripPendingIds(_0x270c36);const _0x32b3ed=await _0x53669e[_0x328b57(0x139)][_0x328b57(0x184)](_0x270c36),_0x3159c4=_0x32b3ed['id'],_0x4d4bd1=new Map();for(const _0x289405 of _0x32b3ed[_0x328b57(0x13d)]['journeyStages']){_0x4d4bd1['set'](_0x289405[_0x328b57(0xdf)][_0x328b57(0x16a)](),_0x289405['id']);}recoverSegmentIdsFromPushRecovery(_0x315b7e,_0x2d8008,_0x1bc2f5[_0x328b57(0x1a8)]);for(const [_0x4e65fa,{definition:_0x519b7d}]of _0x590509){if(_0x2d8008['has'](_0x4e65fa)){_0x5bc24e[_0x328b57(0x130)]?.({'type':_0x328b57(0x178),'journeyName':_0x315b7e[_0x328b57(0x1b1)][_0x328b57(0xdf)],'segmentName':_0x4e65fa});continue;}const _0x5334db=generateDeterministicJourneySegmentName(_0x315b7e[_0x328b57(0x1b1)][_0x328b57(0xdf)],_0x4e65fa);_0x5bc24e[_0x328b57(0x130)]?.({'type':_0x328b57(0x1d8),'journeyName':_0x315b7e[_0x328b57(0x1b1)][_0x328b57(0xdf)],'segmentName':_0x4e65fa});const _0x57ede6=createSegmentIdResolver(_0x1bc2f5[_0x328b57(0x1a8)],_0x4e65fa),_0x1cbf7e=await resolveRuleSegmentIds(_0x519b7d[_0x328b57(0x146)],_0x57ede6),_0x44cc35=await createOrRecoverEmbeddedSegment(_0x53669e,_0x315b7e,{'localName':_0x4e65fa,'uniqueSegmentName':_0x5334db,'description':_0x519b7d[_0x328b57(0x160)]||_0x328b57(0x190)+_0x4e65fa,'journeyId':_0x3159c4,'resolvedRule':_0x1cbf7e,'parentId':_0xa1ba47['parentId'],'folderId':_0xa1ba47[_0x328b57(0x142)]||''},_0xbae6bd);_0x2d8008['set'](_0x4e65fa,_0x44cc35),_0x1bc2f5[_0x328b57(0x1a8)][_0x328b57(0x182)](_0x4e65fa,_0x44cc35),_0x5bc24e[_0x328b57(0x130)]?.({'type':_0x328b57(0x178),'journeyName':_0x315b7e[_0x328b57(0x1b1)][_0x328b57(0xdf)],'segmentName':_0x4e65fa});}const _0xadb412=new Map();for(const [_0x18b4e3,_0x3daf2b]of _0x1c847a){_0x5bc24e['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x315b7e[_0x328b57(0x1b1)]['name'],'activationName':_0x18b4e3});const _0x135f2a=await _0x2da53e(_0x3daf2b,_0x1bc2f5[_0x328b57(0xe2)]),_0x1872a5={..._0x135f2a,..._0x3daf2b[_0x328b57(0x15b)]!==undefined&&{'runAfterJourneyRefresh':_0x3daf2b[_0x328b57(0x15b)]}},_0x147740=await _0x53669e[_0x328b57(0x139)][_0x328b57(0xf8)](_0x3159c4,_0x1872a5);_0xadb412[_0x328b57(0x182)](_0x18b4e3,_0x147740['id']),_0x43adb0[_0x328b57(0x16f)][_0x328b57(0x182)](_0x18b4e3,_0x147740['id']),_0x5bc24e[_0x328b57(0x130)]?.({'type':_0x328b57(0x131),'journeyName':_0x315b7e[_0x328b57(0x1b1)][_0x328b57(0xdf)],'activationName':_0x18b4e3});}const _0x24db84=JSON[_0x328b57(0x18c)](JSON['stringify'](_0x17f308));return _0x24db84['id']=_0x3159c4,ensureJourneyDefaults(_0x24db84['attributes']),resolvePendingIdsInRequest(_0x24db84,_0x17f308,_0x4d4bd1,_0x2d8008,_0xadb412,_0x5bc24e),await _0x53669e[_0x328b57(0x139)][_0x328b57(0xf0)](_0x3159c4,_0x24db84),deletePushRecovery(_0x315b7e[_0x328b57(0x11a)]),{'action':_0x328b57(0xe3),'journeyId':_0x3159c4,'embeddedSegmentNameToId':_0x2d8008};}export function stripWaitStepPendingIds(_0x5b47e4){const _0x45742a=a142_0x5b6902,_0x1da506=_0x5b47e4[_0x45742a(0x14a)]&&isPendingSegmentId(_0x5b47e4[_0x45742a(0x14a)]),_0x569358=_0x5b47e4[_0x45742a(0x187)]?.['some'](_0x4e7c45=>_0x4e7c45[_0x45742a(0x1bc)]&&isPendingSegmentId(_0x4e7c45[_0x45742a(0x1bc)]));(_0x1da506||_0x569358)&&(_0x5b47e4[_0x45742a(0xff)]=_0x45742a(0x14e),_0x5b47e4[_0x45742a(0x17e)]=0x1,_0x5b47e4[_0x45742a(0x129)]=_0x45742a(0x100),delete _0x5b47e4[_0x45742a(0x14a)],delete _0x5b47e4[_0x45742a(0x122)],delete _0x5b47e4['conditionTimeoutUnit'],delete _0x5b47e4[_0x45742a(0x187)]);}export function resolveWaitStepPendingIds(_0x442a76,_0x1a57d5,_0x451386,_0x187a74){const _0x3f31eb=a142_0x5b6902;if(_0x1a57d5[_0x3f31eb(0x14a)]&&isPendingSegmentId(_0x1a57d5[_0x3f31eb(0x14a)])){const _0x2f9fe8=_0x451386(_0x1a57d5[_0x3f31eb(0x14a)],_0x3f31eb(0x189)+_0x187a74+_0x3f31eb(0x148));_0x2f9fe8&&(_0x442a76['waitStepType']='Condition',_0x442a76[_0x3f31eb(0x14a)]=_0x2f9fe8,delete _0x442a76['waitStep'],delete _0x442a76['waitStepUnit'],_0x1a57d5[_0x3f31eb(0x122)]!==undefined&&(_0x442a76[_0x3f31eb(0x122)]=_0x1a57d5[_0x3f31eb(0x122)]),_0x1a57d5[_0x3f31eb(0x175)]&&(_0x442a76['conditionTimeoutUnit']=_0x1a57d5[_0x3f31eb(0x175)]));}if(_0x1a57d5[_0x3f31eb(0x187)]){const _0x430f09=_0x1a57d5[_0x3f31eb(0x187)][_0x3f31eb(0x18e)](_0x5a92b1=>_0x5a92b1[_0x3f31eb(0x1bc)]&&isPendingSegmentId(_0x5a92b1[_0x3f31eb(0x1bc)]));if(_0x430f09){const _0x16e53f=_0x1a57d5[_0x3f31eb(0x187)][_0x3f31eb(0x1cf)](_0x3ba6b0=>{const _0x524da4=_0x3f31eb;if(_0x3ba6b0['segmentId']&&isPendingSegmentId(_0x3ba6b0['segmentId'])){const _0x26ef68=_0x451386(_0x3ba6b0[_0x524da4(0x1bc)],_0x524da4(0x189)+_0x187a74+'\x27\x20wait\x20condition');return{..._0x3ba6b0,'segmentId':_0x26ef68||_0x3ba6b0[_0x524da4(0x1bc)]};}return{..._0x3ba6b0};});_0x442a76[_0x3f31eb(0xff)]=_0x3f31eb(0x1d6),_0x442a76[_0x3f31eb(0x187)]=_0x16e53f,delete _0x442a76[_0x3f31eb(0x17e)],delete _0x442a76[_0x3f31eb(0x129)],delete _0x442a76['conditionSegmentId'],delete _0x442a76[_0x3f31eb(0x122)],delete _0x442a76[_0x3f31eb(0x175)];}}}function stripPendingIds(_0x14a412){const _0x45ca81=a142_0x5b6902;_0x14a412[_0x45ca81(0x13d)][_0x45ca81(0x161)]?.[_0x45ca81(0x1bc)]&&isPendingSegmentId(_0x14a412[_0x45ca81(0x13d)][_0x45ca81(0x161)]['segmentId'])&&delete _0x14a412[_0x45ca81(0x13d)][_0x45ca81(0x161)];for(const _0x317a42 of _0x14a412[_0x45ca81(0x13d)]['journeyStages']||[]){_0x317a42[_0x45ca81(0x158)]?.[_0x45ca81(0x1bc)]&&isPendingSegmentId(_0x317a42[_0x45ca81(0x158)][_0x45ca81(0x1bc)])&&delete _0x317a42[_0x45ca81(0x158)];_0x317a42[_0x45ca81(0x1ba)]?.['segmentId']&&isPendingSegmentId(_0x317a42['milestone'][_0x45ca81(0x1bc)])&&delete _0x317a42[_0x45ca81(0x1ba)];_0x317a42['exitCriterias']&&(_0x317a42[_0x45ca81(0x174)]=_0x317a42[_0x45ca81(0x174)]['filter'](_0x25ad80=>!_0x25ad80['segmentId']||!isPendingSegmentId(_0x25ad80[_0x45ca81(0x1bc)])));if(_0x317a42[_0x45ca81(0x1c8)])for(const _0x2eb656 of Object[_0x45ca81(0x1d0)](_0x317a42['steps'])){const _0x576b32=_0x317a42[_0x45ca81(0x1c8)][_0x2eb656];_0x576b32[_0x45ca81(0xfa)]==='Activation'&&_0x576b32[_0x45ca81(0x16e)]&&isPendingActivationId(_0x576b32[_0x45ca81(0x16e)])&&(_0x576b32[_0x45ca81(0x16e)]='');if(_0x576b32[_0x45ca81(0xfa)]==='DecisionPoint'&&_0x576b32[_0x45ca81(0x11d)])for(const _0x40af8d of _0x576b32[_0x45ca81(0x11d)]){_0x40af8d['segmentId']&&isPendingSegmentId(_0x40af8d[_0x45ca81(0x1bc)])&&(_0x40af8d[_0x45ca81(0x1bc)]='');}_0x576b32[_0x45ca81(0xfa)]===_0x45ca81(0x169)&&stripWaitStepPendingIds(_0x576b32);}}}function resolvePendingIdsInRequest(_0x14929a,_0x5a9bd8,_0x311cbe,_0x1b2451,_0x34fdce,_0x248fd3){const _0x18e957=a142_0x5b6902,_0x50a236=(_0x8107ff,_0x5b1e57)=>{const _0x4cf4c4=a142_0x10a9;if(!isPendingSegmentId(_0x8107ff))return _0x8107ff;const _0x394a76=extractPendingSegmentName(_0x8107ff),_0x273ceb=_0x1b2451[_0x4cf4c4(0x138)](_0x394a76);return!_0x273ceb&&_0x248fd3[_0x4cf4c4(0x1c0)]?.(_0x4cf4c4(0x11b)+_0x394a76+'\x27\x20for\x20'+_0x5b1e57),_0x273ceb;};if(_0x14929a[_0x18e957(0x13d)][_0x18e957(0x161)]?.[_0x18e957(0x1bc)]&&isPendingSegmentId(_0x14929a[_0x18e957(0x13d)][_0x18e957(0x161)][_0x18e957(0x1bc)])){const _0x3efbb5=_0x50a236(_0x14929a[_0x18e957(0x13d)][_0x18e957(0x161)][_0x18e957(0x1bc)],_0x18e957(0xe9));_0x3efbb5&&(_0x14929a[_0x18e957(0x13d)][_0x18e957(0x161)]['segmentId']=_0x3efbb5);}for(const _0x2b7084 of _0x14929a[_0x18e957(0x13d)]['journeyStages']||[]){const _0x7c0326=_0x311cbe[_0x18e957(0x138)](_0x2b7084['name'][_0x18e957(0x16a)]());_0x7c0326&&(_0x2b7084['id']=_0x7c0326);if(_0x2b7084[_0x18e957(0x158)]?.[_0x18e957(0x1bc)]&&isPendingSegmentId(_0x2b7084[_0x18e957(0x158)][_0x18e957(0x1bc)])){const _0x56409a=_0x50a236(_0x2b7084[_0x18e957(0x158)][_0x18e957(0x1bc)],_0x18e957(0x189)+_0x2b7084[_0x18e957(0xdf)]+'\x27\x20entry\x20criteria');_0x56409a&&(_0x2b7084[_0x18e957(0x158)]['segmentId']=_0x56409a);}if(_0x2b7084['exitCriterias'])for(const _0x592b9e of _0x2b7084[_0x18e957(0x174)]){if(_0x592b9e[_0x18e957(0x1bc)]&&isPendingSegmentId(_0x592b9e[_0x18e957(0x1bc)])){const _0x533474=_0x50a236(_0x592b9e['segmentId'],_0x18e957(0x189)+_0x2b7084['name']+_0x18e957(0x140));_0x533474&&(_0x592b9e[_0x18e957(0x1bc)]=_0x533474);}}if(_0x2b7084[_0x18e957(0x1ba)]?.['segmentId']&&isPendingSegmentId(_0x2b7084['milestone'][_0x18e957(0x1bc)])){const _0x38fc79=_0x50a236(_0x2b7084[_0x18e957(0x1ba)]['segmentId'],_0x18e957(0x189)+_0x2b7084[_0x18e957(0xdf)]+'\x27\x20milestone');_0x38fc79&&(_0x2b7084['milestone'][_0x18e957(0x1bc)]=_0x38fc79);}if(_0x2b7084[_0x18e957(0x1c8)]){const _0x315605=_0x2a7b6f=>_0x5a9bd8[_0x18e957(0x13d)][_0x18e957(0x150)]?.[_0x18e957(0x168)](_0x2e3e93=>_0x2e3e93['name'][_0x18e957(0x16a)]()===_0x2b7084['name']['toLowerCase']())?.[_0x18e957(0x1c8)]?.[_0x2a7b6f];for(const _0x28456c of Object['keys'](_0x2b7084[_0x18e957(0x1c8)])){const _0x8c384=_0x2b7084['steps'][_0x28456c],_0x241c24=_0x315605(_0x28456c);if(_0x8c384['type']===_0x18e957(0x159)&&_0x8c384[_0x18e957(0x16e)]&&(isPendingActivationId(_0x8c384[_0x18e957(0x16e)])||_0x8c384[_0x18e957(0x16e)]==='')){if(_0x241c24?.[_0x18e957(0x16e)]&&isPendingActivationId(_0x241c24[_0x18e957(0x16e)])){const _0x3a77b5=extractPendingActivationName(_0x241c24[_0x18e957(0x16e)]),_0x543c00=_0x34fdce[_0x18e957(0x138)](_0x3a77b5);_0x543c00&&(_0x8c384[_0x18e957(0x16e)]=_0x543c00);}}if(_0x8c384[_0x18e957(0xfa)]===_0x18e957(0x119)&&_0x8c384[_0x18e957(0x11d)]&&_0x241c24?.['branches'])for(let _0xdab58b=0x0;_0xdab58b<_0x8c384[_0x18e957(0x11d)][_0x18e957(0x116)];_0xdab58b++){const _0x2b2143=_0x8c384[_0x18e957(0x11d)][_0xdab58b],_0x2d738f=_0x241c24[_0x18e957(0x11d)][_0xdab58b];if(_0x2d738f?.[_0x18e957(0x1bc)]&&isPendingSegmentId(_0x2d738f['segmentId'])){const _0x2b1b07=_0x50a236(_0x2d738f[_0x18e957(0x1bc)],_0x18e957(0x189)+_0x2b7084[_0x18e957(0xdf)]+_0x18e957(0x1bf)+(_0x2b2143[_0x18e957(0xdf)]||_0xdab58b)+'\x27');_0x2b1b07&&(_0x2b2143['segmentId']=_0x2b1b07);}}_0x8c384[_0x18e957(0xfa)]==='WaitStep'&&_0x241c24?.[_0x18e957(0xfa)]==='WaitStep'&&resolveWaitStepPendingIds(_0x8c384,_0x241c24,_0x50a236,_0x2b7084[_0x18e957(0xdf)]);}}}}
@@ -1 +1 @@
1
- (function(_0xb6d4d7,_0x26c081){const _0x356984=a143_0xf61f,_0x33e0a6=_0xb6d4d7();while(!![]){try{const _0x59ea2a=-parseInt(_0x356984(0x130))/0x1*(parseInt(_0x356984(0x134))/0x2)+-parseInt(_0x356984(0x12d))/0x3*(-parseInt(_0x356984(0x12c))/0x4)+parseInt(_0x356984(0x127))/0x5+parseInt(_0x356984(0x133))/0x6+parseInt(_0x356984(0x12b))/0x7*(-parseInt(_0x356984(0x132))/0x8)+-parseInt(_0x356984(0x135))/0x9+-parseInt(_0x356984(0x12f))/0xa*(parseInt(_0x356984(0x137))/0xb);if(_0x59ea2a===_0x26c081)break;else _0x33e0a6['push'](_0x33e0a6['shift']());}catch(_0x181247){_0x33e0a6['push'](_0x33e0a6['shift']());}}}(a143_0x4824,0x9657a));export function buildFolderIdToPathMap(_0x3447d6){const _0x5012ea=a143_0xf61f,_0x580a7d=new Map(),_0x1ae0de=new Map();for(const _0x5dfffa of _0x3447d6){_0x1ae0de['set'](_0x5dfffa['id'],_0x5dfffa);}const _0x306695=new Set();for(const _0x38a065 of _0x3447d6){!_0x38a065[_0x5012ea(0x12e)]&&_0x306695[_0x5012ea(0x136)](_0x38a065['id']);}function _0x583353(_0x2d29a7){const _0x5c05e6=_0x5012ea;if(_0x580a7d[_0x5c05e6(0x128)](_0x2d29a7['id']))return _0x580a7d[_0x5c05e6(0x12a)](_0x2d29a7['id']);if(_0x306695[_0x5c05e6(0x128)](_0x2d29a7['id']))return _0x580a7d['set'](_0x2d29a7['id'],''),'';if(_0x2d29a7[_0x5c05e6(0x12e)]){const _0x10107f=_0x1ae0de['get'](_0x2d29a7[_0x5c05e6(0x12e)]);if(_0x10107f){const _0x7d8f75=_0x583353(_0x10107f),_0x4e137b=_0x7d8f75?_0x7d8f75+'/'+_0x2d29a7[_0x5c05e6(0x131)]:_0x2d29a7[_0x5c05e6(0x131)];return _0x580a7d[_0x5c05e6(0x129)](_0x2d29a7['id'],_0x4e137b),_0x4e137b;}}const _0x3b6ea0=_0x2d29a7[_0x5c05e6(0x131)];return _0x580a7d[_0x5c05e6(0x129)](_0x2d29a7['id'],_0x3b6ea0),_0x3b6ea0;}for(const _0x448378 of _0x3447d6){_0x583353(_0x448378);}return _0x580a7d;}function a143_0xf61f(_0x710418,_0x1bdcf2){_0x710418=_0x710418-0x127;const _0x4824bf=a143_0x4824();let _0xf61f54=_0x4824bf[_0x710418];return _0xf61f54;}function a143_0x4824(){const _0x31e2d4=['parentFolderId','30ktGMrw','32941NqNyyA','name','904KUPxSb','4670226pbPOst','6abBJBW','4228119BZqewl','add','2364923KVLyiI','3547370yGMxyt','has','set','get','15701ejbkhd','7508aEXHnN','951EjNHZX'];a143_0x4824=function(){return _0x31e2d4;};return a143_0x4824();}export function buildFolderPathToIdMap(_0x17d067){const _0x10378d=a143_0xf61f,_0x5bfa5d=new Map(),_0x176e0e=new Map();for(const _0x268aea of _0x17d067){_0x176e0e['set'](_0x268aea['id'],_0x268aea);}const _0x52a83f=new Set();for(const _0x2b129e of _0x17d067){!_0x2b129e[_0x10378d(0x12e)]&&_0x52a83f[_0x10378d(0x136)](_0x2b129e['id']);}function _0x219331(_0x42c47d){const _0x2b85f2=_0x10378d;if(_0x52a83f[_0x2b85f2(0x128)](_0x42c47d['id']))return'';if(_0x42c47d[_0x2b85f2(0x12e)]){const _0xb28a79=_0x176e0e[_0x2b85f2(0x12a)](_0x42c47d[_0x2b85f2(0x12e)]);if(_0xb28a79){const _0x8ffa7b=_0x219331(_0xb28a79);return _0x8ffa7b?_0x8ffa7b+'/'+_0x42c47d[_0x2b85f2(0x131)]:_0x42c47d[_0x2b85f2(0x131)];}}return _0x42c47d['name'];}for(const _0x324b10 of _0x17d067){const _0x26f560=_0x219331(_0x324b10);_0x5bfa5d[_0x10378d(0x129)](_0x26f560,_0x324b10['id']);}return _0x5bfa5d;}export function buildFolderMaps(_0x4f7134){const _0x302fed=a143_0xf61f,_0x2a7e73=buildFolderIdToPathMap(_0x4f7134),_0x14d693=new Map();for(const [_0x28ba3a,_0x2a56d2]of _0x2a7e73){_0x14d693[_0x302fed(0x129)](_0x2a56d2,_0x28ba3a);}return{'idToPath':_0x2a7e73,'pathToId':_0x14d693};}export function getFolderPath(_0x4119ac,_0xd02f30){const _0x43234a=a143_0xf61f;if(!_0x4119ac)return'';return _0xd02f30[_0x43234a(0x12a)](_0x4119ac)??'';}
1
+ (function(_0x46f009,_0x21fc2c){const _0x5f0468=a143_0x349b,_0x2e55ca=_0x46f009();while(!![]){try{const _0x2901f5=parseInt(_0x5f0468(0xfc))/0x1+-parseInt(_0x5f0468(0x107))/0x2+-parseInt(_0x5f0468(0x102))/0x3+parseInt(_0x5f0468(0x108))/0x4+parseInt(_0x5f0468(0x103))/0x5+-parseInt(_0x5f0468(0xfe))/0x6*(-parseInt(_0x5f0468(0xff))/0x7)+parseInt(_0x5f0468(0x106))/0x8;if(_0x2901f5===_0x21fc2c)break;else _0x2e55ca['push'](_0x2e55ca['shift']());}catch(_0x29ad08){_0x2e55ca['push'](_0x2e55ca['shift']());}}}(a143_0x40f8,0x6db7c));function a143_0x40f8(){const _0x2e1f67=['1427172iNXJNK','516808LvZvsD','add','366912tXqUMA','set','2304ArGWDK','7231hzYKly','has','parentFolderId','443067WCugzI','353540IznCMC','name','get','2777480uBGJhT'];a143_0x40f8=function(){return _0x2e1f67;};return a143_0x40f8();}function a143_0x349b(_0x6c94fd,_0x3f7b15){_0x6c94fd=_0x6c94fd-0xfc;const _0x40f85b=a143_0x40f8();let _0x349bb0=_0x40f85b[_0x6c94fd];return _0x349bb0;}export function buildFolderIdToPathMap(_0x9a2b8b){const _0xcf8d6d=a143_0x349b,_0x11aabd=new Map(),_0x75e069=new Map();for(const _0x48e389 of _0x9a2b8b){_0x75e069[_0xcf8d6d(0xfd)](_0x48e389['id'],_0x48e389);}const _0x31ef34=new Set();for(const _0x56d156 of _0x9a2b8b){!_0x56d156['parentFolderId']&&_0x31ef34[_0xcf8d6d(0x109)](_0x56d156['id']);}function _0x4b5086(_0x297951){const _0x153da5=_0xcf8d6d;if(_0x11aabd[_0x153da5(0x100)](_0x297951['id']))return _0x11aabd[_0x153da5(0x105)](_0x297951['id']);if(_0x31ef34[_0x153da5(0x100)](_0x297951['id']))return _0x11aabd[_0x153da5(0xfd)](_0x297951['id'],''),'';if(_0x297951[_0x153da5(0x101)]){const _0x8ca397=_0x75e069[_0x153da5(0x105)](_0x297951[_0x153da5(0x101)]);if(_0x8ca397){const _0x4796b2=_0x4b5086(_0x8ca397),_0xac5b5e=_0x4796b2?_0x4796b2+'/'+_0x297951[_0x153da5(0x104)]:_0x297951['name'];return _0x11aabd[_0x153da5(0xfd)](_0x297951['id'],_0xac5b5e),_0xac5b5e;}}const _0x4ce1cb=_0x297951[_0x153da5(0x104)];return _0x11aabd[_0x153da5(0xfd)](_0x297951['id'],_0x4ce1cb),_0x4ce1cb;}for(const _0x33e41d of _0x9a2b8b){_0x4b5086(_0x33e41d);}return _0x11aabd;}export function buildFolderPathToIdMap(_0x54b497){const _0x1e483d=a143_0x349b,_0x5c7b3d=new Map(),_0x435fec=new Map();for(const _0x2d5204 of _0x54b497){_0x435fec[_0x1e483d(0xfd)](_0x2d5204['id'],_0x2d5204);}const _0xbac9a7=new Set();for(const _0x4187c8 of _0x54b497){!_0x4187c8['parentFolderId']&&_0xbac9a7['add'](_0x4187c8['id']);}function _0x40b59a(_0x3ce375){const _0x18165e=_0x1e483d;if(_0xbac9a7[_0x18165e(0x100)](_0x3ce375['id']))return'';if(_0x3ce375['parentFolderId']){const _0x347a7b=_0x435fec[_0x18165e(0x105)](_0x3ce375['parentFolderId']);if(_0x347a7b){const _0x5d9c5c=_0x40b59a(_0x347a7b);return _0x5d9c5c?_0x5d9c5c+'/'+_0x3ce375[_0x18165e(0x104)]:_0x3ce375[_0x18165e(0x104)];}}return _0x3ce375[_0x18165e(0x104)];}for(const _0x5a9109 of _0x54b497){const _0x2b1b94=_0x40b59a(_0x5a9109);_0x5c7b3d[_0x1e483d(0xfd)](_0x2b1b94,_0x5a9109['id']);}return _0x5c7b3d;}export function buildFolderMaps(_0x27ee37){const _0x4e3504=a143_0x349b,_0x25e30b=buildFolderIdToPathMap(_0x27ee37),_0x23b206=new Map();for(const [_0x1aa427,_0x56e641]of _0x25e30b){_0x23b206[_0x4e3504(0xfd)](_0x56e641,_0x1aa427);}return{'idToPath':_0x25e30b,'pathToId':_0x23b206};}export function getFolderPath(_0x190502,_0x269d07){const _0x419247=a143_0x349b;if(!_0x190502)return'';return _0x269d07[_0x419247(0x105)](_0x190502)??'';}
@@ -1 +1 @@
1
- (function(_0x546336,_0x5c94d0){const _0x5bda56=a144_0x1a25,_0x398cfa=_0x546336();while(!![]){try{const _0x570194=-parseInt(_0x5bda56(0x129))/0x1+-parseInt(_0x5bda56(0x10e))/0x2*(-parseInt(_0x5bda56(0x108))/0x3)+-parseInt(_0x5bda56(0x110))/0x4*(parseInt(_0x5bda56(0x111))/0x5)+parseInt(_0x5bda56(0x107))/0x6*(-parseInt(_0x5bda56(0x125))/0x7)+-parseInt(_0x5bda56(0x116))/0x8+-parseInt(_0x5bda56(0x131))/0x9*(parseInt(_0x5bda56(0x113))/0xa)+parseInt(_0x5bda56(0x132))/0xb*(parseInt(_0x5bda56(0x10d))/0xc);if(_0x570194===_0x5c94d0)break;else _0x398cfa['push'](_0x398cfa['shift']());}catch(_0x9a7ef5){_0x398cfa['push'](_0x398cfa['shift']());}}}(a144_0x2b1f,0x394cd));function a144_0x2b1f(){const _0x5c9b63=['push','95358lRsOeS','21kpjoFJ','segment','No\x20tdx.json\x20found\x20for\x20file:\x20','length','exists','84WzDYyR','87254OVuLYB','replace','4hdnuou','2035080ixPGUM','Path\x20cannot\x20be\x20empty','310srXdRc','parse','root','2955824HjAcxb','Relative\x20path\x20cannot\x20be\x20empty','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Path\x20attempts\x20to\x20navigate\x20above\x20root','pop','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','journey','join','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','type','readFile','segments','filter','relative','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','77ylalkl','endsWith','.yaml','isAbsolute','174209mWyCWO','Cannot\x20navigate\x20above\x20root','parent_segment','tdx.json','name','.yml','dirname','test','4869TifIFD','1683957gRGFpr','trim','raw','startsWith','substring','split','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'];a144_0x2b1f=function(){return _0x5c9b63;};return a144_0x2b1f();}import a144_0x43ee37 from'path';import{parse as a144_0x34cf87}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x35360a){const _0x291512=a144_0x1a25;if(!_0x35360a||_0x35360a[_0x291512(0x100)]()==='')throw new Error(_0x291512(0x112));const _0x45ed56=_0x35360a[_0x291512(0x100)]();if(_0x45ed56==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x35360a};const _0x479b64=_0x45ed56[_0x291512(0x102)]('/')?_0x45ed56[_0x291512(0x103)](0x1):_0x45ed56,_0x16800c=_0x479b64[_0x291512(0x104)]('/')[_0x291512(0x122)](_0x459219=>_0x459219!=='');if(_0x16800c[_0x291512(0x10b)]===0x0)throw new Error(_0x291512(0x124));const _0x3ce212=_0x45ed56['startsWith']('/')||!isRelativePathSegment(_0x16800c[0x0]);for(const _0x3a5dbd of _0x16800c){validatePathSegment(_0x3a5dbd);}return{'segments':_0x16800c,'isAbsolute':_0x3ce212,'raw':_0x35360a};}function isRelativePathSegment(_0x305513){return _0x305513==='.'||_0x305513==='..';}function validatePathSegment(_0x231ba7){const _0x1a8a67=a144_0x1a25;if(_0x231ba7==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x231ba7==='.'||_0x231ba7==='..')return;if(/[\x00-\x1F\x7F]/[_0x1a8a67(0x130)](_0x231ba7))throw new Error(_0x1a8a67(0x11e)+_0x231ba7);if(_0x231ba7!==_0x231ba7[_0x1a8a67(0x100)]()){}}export function validatePath(_0x38892c){const _0x16cb7a=a144_0x1a25;if(_0x38892c[_0x16cb7a(0x121)]['length']===0x0&&!_0x38892c[_0x16cb7a(0x128)])throw new Error(_0x16cb7a(0x117));if(_0x38892c[_0x16cb7a(0x128)]){if(_0x38892c['segments'][0x0]==='..')throw new Error(_0x16cb7a(0x11b));let _0x12c8ca=0x0;for(const _0x587d6b of _0x38892c[_0x16cb7a(0x121)]){if(_0x587d6b==='..'){if(_0x12c8ca===0x0)throw new Error(_0x16cb7a(0x119));_0x12c8ca--;}else _0x587d6b!=='.'&&_0x12c8ca++;}}}export function joinPaths(_0x45a70b,_0x116084){const _0x9daa16=a144_0x1a25;if(!_0x45a70b||_0x45a70b==='/')return _0x116084;if(!_0x116084||_0x116084==='.')return _0x45a70b;if(_0x116084[_0x9daa16(0x102)]('/'))return _0x116084;const _0x13dfcc=parsePath(_0x45a70b),_0xd569f8=parsePath(_0x116084),_0x51807c=[..._0x13dfcc['segments']];for(const _0x3eb81d of _0xd569f8[_0x9daa16(0x121)]){if(_0x3eb81d==='.')continue;else{if(_0x3eb81d==='..'){if(_0x51807c['length']===0x0)throw new Error(_0x9daa16(0x12a));_0x51807c[_0x9daa16(0x11a)]();}else _0x51807c[_0x9daa16(0x106)](_0x3eb81d);}}const _0x4cb213=_0x51807c[_0x9daa16(0x11d)]('/');return _0x13dfcc[_0x9daa16(0x101)][_0x9daa16(0x102)]('/')?'/'+_0x4cb213:_0x4cb213;}function a144_0x1a25(_0x292ee2,_0x444df5){_0x292ee2=_0x292ee2-0x100;const _0x2b1fd0=a144_0x2b1f();let _0x1a25ed=_0x2b1fd0[_0x292ee2];return _0x1a25ed;}export function normalizePath(_0x3897f5){const _0x54ba71=a144_0x1a25,_0x33de84=parsePath(_0x3897f5),_0x5fc364=[];for(const _0x3f4d67 of _0x33de84[_0x54ba71(0x121)]){if(_0x3f4d67==='.')continue;else{if(_0x3f4d67==='..'){if(_0x5fc364[_0x54ba71(0x10b)]===0x0){if(_0x33de84[_0x54ba71(0x128)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x5fc364['push']('..');}else _0x5fc364[_0x5fc364[_0x54ba71(0x10b)]-0x1]==='..'?_0x5fc364['push']('..'):_0x5fc364['pop']();}else _0x5fc364[_0x54ba71(0x106)](_0x3f4d67);}}if(_0x5fc364[_0x54ba71(0x10b)]===0x0)return _0x33de84[_0x54ba71(0x128)]?'/':'.';const _0x8a26f4=_0x5fc364[_0x54ba71(0x11d)]('/');return _0x33de84[_0x54ba71(0x101)][_0x54ba71(0x102)]('/')?'/'+_0x8a26f4:_0x8a26f4;}export function getParentPath(_0x3ac69f){const _0x15942d=a144_0x1a25,_0x6d0a78=parsePath(_0x3ac69f);if(_0x6d0a78[_0x15942d(0x121)]['length']<=0x1)return'/';const _0x1ac8e9=_0x6d0a78[_0x15942d(0x121)]['slice'](0x0,-0x1)[_0x15942d(0x11d)]('/');return _0x6d0a78['raw'][_0x15942d(0x102)]('/')?'/'+_0x1ac8e9:_0x1ac8e9;}export function getBaseName(_0x24eb17){const _0x4312bd=a144_0x1a25,_0x8d607a=parsePath(_0x24eb17);return _0x8d607a[_0x4312bd(0x121)][_0x8d607a[_0x4312bd(0x121)][_0x4312bd(0x10b)]-0x1]||'';}export function isChildPath(_0x142d68,_0x18ae45){const _0x426b1c=a144_0x1a25,_0x253da2=parsePath(_0x142d68),_0x285471=parsePath(_0x18ae45);if(_0x253da2[_0x426b1c(0x121)]['length']<=_0x285471[_0x426b1c(0x121)][_0x426b1c(0x10b)])return![];for(let _0x38dc04=0x0;_0x38dc04<_0x285471['segments'][_0x426b1c(0x10b)];_0x38dc04++){if(_0x253da2[_0x426b1c(0x121)][_0x38dc04]!==_0x285471['segments'][_0x38dc04])return![];}return!![];}export function splitPath(_0x23c838){const _0x43019f=a144_0x1a25,_0x318b29=parsePath(_0x23c838);if(_0x318b29[_0x43019f(0x121)][_0x43019f(0x10b)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x318b29['segments'][_0x43019f(0x10b)]===0x1)return{'parent':_0x318b29[_0x43019f(0x121)][0x0]};return{'parent':_0x318b29[_0x43019f(0x121)][0x0],'child':_0x318b29[_0x43019f(0x121)]['slice'](0x1)[_0x43019f(0x11d)]('/')};}export function isYamlFilePath(_0x4e31ab){const _0x12219d=a144_0x1a25;return _0x4e31ab[_0x12219d(0x126)](_0x12219d(0x12e))||_0x4e31ab[_0x12219d(0x126)](_0x12219d(0x127));}export async function resolveYamlFilePath(_0x11a2d7,_0x4fcebf=nodeFileSystem){const _0xa7a68e=a144_0x1a25,_0x5e7bca=a144_0x43ee37['resolve'](_0x11a2d7);if(!await _0x4fcebf[_0xa7a68e(0x10c)](_0x5e7bca))throw new Error('File\x20not\x20found:\x20'+_0x11a2d7);let _0x2ad81b=a144_0x43ee37['dirname'](_0x5e7bca),_0x286447=null,_0x4ad788=null;const _0x5656db=a144_0x43ee37[_0xa7a68e(0x114)](_0x2ad81b)[_0xa7a68e(0x115)];while(_0x2ad81b!==_0x5656db){const _0x4b92dc=a144_0x43ee37[_0xa7a68e(0x11d)](_0x2ad81b,_0xa7a68e(0x12c));if(await _0x4fcebf[_0xa7a68e(0x10c)](_0x4b92dc)){_0x286447=_0x4b92dc,_0x4ad788=_0x2ad81b;break;}_0x2ad81b=a144_0x43ee37[_0xa7a68e(0x12f)](_0x2ad81b);}if(!_0x286447||!_0x4ad788)throw new Error(_0xa7a68e(0x10a)+_0x11a2d7+'\x0a'+_0xa7a68e(0x118));const _0xb626fc=await _0x4fcebf[_0xa7a68e(0x120)](_0x286447),_0x3a73c7=JSON[_0xa7a68e(0x114)](_0xb626fc),_0x135940=_0x3a73c7[_0xa7a68e(0x12b)];if(!_0x135940)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x44865b=await _0x4fcebf['readFile'](_0x5e7bca),_0x41398c=a144_0x34cf87(_0x44865b),_0x1ab8dd=_0x41398c[_0xa7a68e(0x12d)];if(!_0x1ab8dd)throw new Error(_0xa7a68e(0x105)+_0x11a2d7);const _0x5acfd7=_0x41398c[_0xa7a68e(0x11f)]===_0xa7a68e(0x11c)?_0xa7a68e(0x11c):_0xa7a68e(0x109),_0x79a4f7=a144_0x43ee37[_0xa7a68e(0x123)](_0x4ad788,_0x5e7bca),_0x104c19=a144_0x43ee37[_0xa7a68e(0x12f)](_0x79a4f7),_0x1497c7=_0x104c19==='.'?'':_0x104c19[_0xa7a68e(0x10f)](/\\/g,'/'),_0x526cb1=_0x1497c7?_0x135940+'/'+_0x1497c7+'/'+_0x1ab8dd:_0x135940+'/'+_0x1ab8dd;return{'parentSegment':_0x135940,'segmentName':_0x1ab8dd,'folderPath':_0x1497c7,'fullPath':_0x526cb1,'resourceType':_0x5acfd7,'content':_0x44865b};}
1
+ function a144_0x20ff(){const _0x47cd3c=['.yaml','relative','filter','Cannot\x20split\x20empty\x20path','Path\x20segment\x20cannot\x20be\x20empty','tdx.json','push','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','test','segments','substring','startsWith','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','344178MwmFry','8sKeial','raw','4894650hFLfci','replace','name','585197GVdWzK','File\x20not\x20found:\x20','25370191eWtWdu','length','Cannot\x20navigate\x20above\x20root','4468965SkQEbU','parse','Relative\x20path\x20cannot\x20be\x20empty','segment','.yml','slice','344996WujJUV','Path\x20attempts\x20to\x20navigate\x20above\x20root','isAbsolute','4fMziPf','Path\x20cannot\x20be\x20empty','3408503wLwfsR','No\x20tdx.json\x20found\x20for\x20file:\x20','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','split','pop','140aMmLSC','root','dirname','trim','journey','3ofXJxF','join','exists'];a144_0x20ff=function(){return _0x47cd3c;};return a144_0x20ff();}(function(_0x4a3e2c,_0x1463cb){const _0x5429af=a144_0x2075,_0x2ab2f9=_0x4a3e2c();while(!![]){try{const _0x235fcb=-parseInt(_0x5429af(0x131))/0x1+parseInt(_0x5429af(0x13c))/0x2*(-parseInt(_0x5429af(0x11b))/0x3)+-parseInt(_0x5429af(0x10f))/0x4*(parseInt(_0x5429af(0x136))/0x5)+parseInt(_0x5429af(0x12e))/0x6+parseInt(_0x5429af(0x111))/0x7*(-parseInt(_0x5429af(0x12c))/0x8)+-parseInt(_0x5429af(0x12b))/0x9*(parseInt(_0x5429af(0x116))/0xa)+parseInt(_0x5429af(0x133))/0xb;if(_0x235fcb===_0x1463cb)break;else _0x2ab2f9['push'](_0x2ab2f9['shift']());}catch(_0x3565a7){_0x2ab2f9['push'](_0x2ab2f9['shift']());}}}(a144_0x20ff,0x6d75f));import a144_0x381e13 from'path';import{parse as a144_0x45feee}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x29d947){const _0x4b2905=a144_0x2075;if(!_0x29d947||_0x29d947[_0x4b2905(0x119)]()==='')throw new Error(_0x4b2905(0x110));const _0xfc407=_0x29d947[_0x4b2905(0x119)]();if(_0xfc407==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x29d947};const _0x1762cf=_0xfc407['startsWith']('/')?_0xfc407[_0x4b2905(0x128)](0x1):_0xfc407,_0x5f213a=_0x1762cf[_0x4b2905(0x114)]('/')[_0x4b2905(0x120)](_0x4181eb=>_0x4181eb!=='');if(_0x5f213a[_0x4b2905(0x134)]===0x0)throw new Error(_0x4b2905(0x125));const _0x535e0c=_0xfc407[_0x4b2905(0x129)]('/')||!isRelativePathSegment(_0x5f213a[0x0]);for(const _0x567467 of _0x5f213a){validatePathSegment(_0x567467);}return{'segments':_0x5f213a,'isAbsolute':_0x535e0c,'raw':_0x29d947};}function isRelativePathSegment(_0x3c1664){return _0x3c1664==='.'||_0x3c1664==='..';}function validatePathSegment(_0x89d19a){const _0xc8dfaa=a144_0x2075;if(_0x89d19a==='')throw new Error(_0xc8dfaa(0x122));if(_0x89d19a==='.'||_0x89d19a==='..')return;if(/[\x00-\x1F\x7F]/[_0xc8dfaa(0x126)](_0x89d19a))throw new Error(_0xc8dfaa(0x113)+_0x89d19a);if(_0x89d19a!==_0x89d19a[_0xc8dfaa(0x119)]()){}}export function validatePath(_0x2fca9c){const _0x4e3358=a144_0x2075;if(_0x2fca9c['segments']['length']===0x0&&!_0x2fca9c[_0x4e3358(0x10e)])throw new Error(_0x4e3358(0x138));if(_0x2fca9c[_0x4e3358(0x10e)]){if(_0x2fca9c[_0x4e3358(0x127)][0x0]==='..')throw new Error(_0x4e3358(0x12a));let _0x4736d7=0x0;for(const _0x125eac of _0x2fca9c['segments']){if(_0x125eac==='..'){if(_0x4736d7===0x0)throw new Error(_0x4e3358(0x10d));_0x4736d7--;}else _0x125eac!=='.'&&_0x4736d7++;}}}export function joinPaths(_0x2c84b5,_0x22ba71){const _0x1fa3e8=a144_0x2075;if(!_0x2c84b5||_0x2c84b5==='/')return _0x22ba71;if(!_0x22ba71||_0x22ba71==='.')return _0x2c84b5;if(_0x22ba71[_0x1fa3e8(0x129)]('/'))return _0x22ba71;const _0x4bb559=parsePath(_0x2c84b5),_0x49880a=parsePath(_0x22ba71),_0x373175=[..._0x4bb559['segments']];for(const _0x444efd of _0x49880a['segments']){if(_0x444efd==='.')continue;else{if(_0x444efd==='..'){if(_0x373175['length']===0x0)throw new Error(_0x1fa3e8(0x135));_0x373175[_0x1fa3e8(0x115)]();}else _0x373175[_0x1fa3e8(0x124)](_0x444efd);}}const _0x511782=_0x373175[_0x1fa3e8(0x11c)]('/');return _0x4bb559[_0x1fa3e8(0x12d)][_0x1fa3e8(0x129)]('/')?'/'+_0x511782:_0x511782;}export function normalizePath(_0x2838c4){const _0x3d4d90=a144_0x2075,_0x2ec2b8=parsePath(_0x2838c4),_0x57179c=[];for(const _0x19c891 of _0x2ec2b8['segments']){if(_0x19c891==='.')continue;else{if(_0x19c891==='..'){if(_0x57179c[_0x3d4d90(0x134)]===0x0){if(_0x2ec2b8[_0x3d4d90(0x10e)])throw new Error(_0x3d4d90(0x135));_0x57179c['push']('..');}else _0x57179c[_0x57179c['length']-0x1]==='..'?_0x57179c[_0x3d4d90(0x124)]('..'):_0x57179c[_0x3d4d90(0x115)]();}else _0x57179c[_0x3d4d90(0x124)](_0x19c891);}}if(_0x57179c[_0x3d4d90(0x134)]===0x0)return _0x2ec2b8['isAbsolute']?'/':'.';const _0xbf9f38=_0x57179c['join']('/');return _0x2ec2b8['raw'][_0x3d4d90(0x129)]('/')?'/'+_0xbf9f38:_0xbf9f38;}export function getParentPath(_0x588b2a){const _0x4c030e=a144_0x2075,_0x5ac8bf=parsePath(_0x588b2a);if(_0x5ac8bf['segments'][_0x4c030e(0x134)]<=0x1)return'/';const _0x26532b=_0x5ac8bf['segments'][_0x4c030e(0x13b)](0x0,-0x1)['join']('/');return _0x5ac8bf[_0x4c030e(0x12d)][_0x4c030e(0x129)]('/')?'/'+_0x26532b:_0x26532b;}export function getBaseName(_0x2a243a){const _0x1f21b8=a144_0x2075,_0x56f625=parsePath(_0x2a243a);return _0x56f625[_0x1f21b8(0x127)][_0x56f625[_0x1f21b8(0x127)][_0x1f21b8(0x134)]-0x1]||'';}export function isChildPath(_0x3dd348,_0xfd944){const _0x932d34=a144_0x2075,_0x4cc8ab=parsePath(_0x3dd348),_0x4810c6=parsePath(_0xfd944);if(_0x4cc8ab[_0x932d34(0x127)][_0x932d34(0x134)]<=_0x4810c6[_0x932d34(0x127)][_0x932d34(0x134)])return![];for(let _0x3980f1=0x0;_0x3980f1<_0x4810c6[_0x932d34(0x127)][_0x932d34(0x134)];_0x3980f1++){if(_0x4cc8ab[_0x932d34(0x127)][_0x3980f1]!==_0x4810c6['segments'][_0x3980f1])return![];}return!![];}export function splitPath(_0x47ab90){const _0x19590a=a144_0x2075,_0x427a0a=parsePath(_0x47ab90);if(_0x427a0a[_0x19590a(0x127)][_0x19590a(0x134)]===0x0)throw new Error(_0x19590a(0x121));if(_0x427a0a[_0x19590a(0x127)][_0x19590a(0x134)]===0x1)return{'parent':_0x427a0a[_0x19590a(0x127)][0x0]};return{'parent':_0x427a0a[_0x19590a(0x127)][0x0],'child':_0x427a0a[_0x19590a(0x127)]['slice'](0x1)[_0x19590a(0x11c)]('/')};}export function isYamlFilePath(_0x22badb){const _0x391586=a144_0x2075;return _0x22badb['endsWith'](_0x391586(0x13a))||_0x22badb['endsWith'](_0x391586(0x11e));}function a144_0x2075(_0x4e9d4a,_0x2b5839){_0x4e9d4a=_0x4e9d4a-0x10d;const _0x20ff4a=a144_0x20ff();let _0x2075da=_0x20ff4a[_0x4e9d4a];return _0x2075da;}export async function resolveYamlFilePath(_0x377fd0,_0x41cd47=nodeFileSystem){const _0x5303ef=a144_0x2075,_0x3b31b0=a144_0x381e13['resolve'](_0x377fd0);if(!await _0x41cd47[_0x5303ef(0x11d)](_0x3b31b0))throw new Error(_0x5303ef(0x132)+_0x377fd0);let _0xfe4412=a144_0x381e13[_0x5303ef(0x118)](_0x3b31b0),_0x170a73=null,_0x4e9001=null;const _0x308175=a144_0x381e13[_0x5303ef(0x137)](_0xfe4412)[_0x5303ef(0x117)];while(_0xfe4412!==_0x308175){const _0x1a8fe6=a144_0x381e13[_0x5303ef(0x11c)](_0xfe4412,_0x5303ef(0x123));if(await _0x41cd47['exists'](_0x1a8fe6)){_0x170a73=_0x1a8fe6,_0x4e9001=_0xfe4412;break;}_0xfe4412=a144_0x381e13[_0x5303ef(0x118)](_0xfe4412);}if(!_0x170a73||!_0x4e9001)throw new Error(_0x5303ef(0x112)+_0x377fd0+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x88973=await _0x41cd47['readFile'](_0x170a73),_0x3298b6=JSON[_0x5303ef(0x137)](_0x88973),_0x57b75c=_0x3298b6['parent_segment'];if(!_0x57b75c)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x16774d=await _0x41cd47['readFile'](_0x3b31b0),_0x13210c=a144_0x45feee(_0x16774d),_0x3f5ca6=_0x13210c[_0x5303ef(0x130)];if(!_0x3f5ca6)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x377fd0);const _0x413d3c=_0x13210c['type']===_0x5303ef(0x11a)?_0x5303ef(0x11a):_0x5303ef(0x139),_0x429db0=a144_0x381e13[_0x5303ef(0x11f)](_0x4e9001,_0x3b31b0),_0x4abeb9=a144_0x381e13[_0x5303ef(0x118)](_0x429db0),_0x16912c=_0x4abeb9==='.'?'':_0x4abeb9[_0x5303ef(0x12f)](/\\/g,'/'),_0x2410d5=_0x16912c?_0x57b75c+'/'+_0x16912c+'/'+_0x3f5ca6:_0x57b75c+'/'+_0x3f5ca6;return{'parentSegment':_0x57b75c,'segmentName':_0x3f5ca6,'folderPath':_0x16912c,'fullPath':_0x2410d5,'resourceType':_0x413d3c,'content':_0x16774d};}
@@ -1 +1 @@
1
- function a145_0x10ef(_0x5e47df,_0x33076f){_0x5e47df=_0x5e47df-0x1ca;const _0x1a5599=a145_0x1a55();let _0x10efda=_0x1a5599[_0x5e47df];return _0x10efda;}function a145_0x1a55(){const _0x2c448c=['Invalid\x20segment\x20reference\x20format:\x20','substring','123831zhevPW','.\x20Parent\x20name\x20cannot\x20be\x20empty','1100348CVyVYE','3462605CKiVnx','6490168xmxyvF','6HRlXLZ','2593948dFvurI','151501ZaPYyM','1202572JnkoxV','indexOf','.\x20Child\x20name\x20cannot\x20be\x20empty','9VDrRMZ'];a145_0x1a55=function(){return _0x2c448c;};return a145_0x1a55();}(function(_0x2c6004,_0x33f034){const _0x43be7d=a145_0x10ef,_0xc7a639=_0x2c6004();while(!![]){try{const _0x14cc8f=parseInt(_0x43be7d(0x1d4))/0x1+-parseInt(_0x43be7d(0x1cf))/0x2+-parseInt(_0x43be7d(0x1cd))/0x3+parseInt(_0x43be7d(0x1d5))/0x4+-parseInt(_0x43be7d(0x1d0))/0x5*(parseInt(_0x43be7d(0x1d2))/0x6)+parseInt(_0x43be7d(0x1d3))/0x7+-parseInt(_0x43be7d(0x1d1))/0x8*(-parseInt(_0x43be7d(0x1ca))/0x9);if(_0x14cc8f===_0x33f034)break;else _0xc7a639['push'](_0xc7a639['shift']());}catch(_0x9c9187){_0xc7a639['push'](_0xc7a639['shift']());}}}(a145_0x1a55,0x55737));export function parseSegmentRef(_0xdacbc){const _0x24db6e=a145_0x10ef,_0x1d074b=_0xdacbc[_0x24db6e(0x1d6)]('/');if(_0x1d074b===-0x1)return{'parentId':_0xdacbc};if(_0x1d074b===0x0)throw new Error(_0x24db6e(0x1cb)+_0xdacbc+_0x24db6e(0x1ce));const _0x15014e=_0xdacbc['substring'](0x0,_0x1d074b),_0x157dd5=_0xdacbc[_0x24db6e(0x1cc)](_0x1d074b+0x1);if(_0x157dd5==='')throw new Error(_0x24db6e(0x1cb)+_0xdacbc+_0x24db6e(0x1d7));return{'parentId':_0x15014e,'childId':_0x157dd5};}
1
+ (function(_0xbf2d12,_0x34bc19){const _0x5aa324=a145_0x174f,_0x49fb8b=_0xbf2d12();while(!![]){try{const _0x58295e=parseInt(_0x5aa324(0xf1))/0x1*(-parseInt(_0x5aa324(0xf5))/0x2)+-parseInt(_0x5aa324(0xec))/0x3*(-parseInt(_0x5aa324(0xf2))/0x4)+-parseInt(_0x5aa324(0xf6))/0x5+-parseInt(_0x5aa324(0xeb))/0x6*(parseInt(_0x5aa324(0xef))/0x7)+-parseInt(_0x5aa324(0xf8))/0x8+-parseInt(_0x5aa324(0xf3))/0x9+-parseInt(_0x5aa324(0xf0))/0xa*(-parseInt(_0x5aa324(0xf4))/0xb);if(_0x58295e===_0x34bc19)break;else _0x49fb8b['push'](_0x49fb8b['shift']());}catch(_0x77f287){_0x49fb8b['push'](_0x49fb8b['shift']());}}}(a145_0x5dc5,0xa29c0));function a145_0x174f(_0x3bdeca,_0x4fc144){_0x3bdeca=_0x3bdeca-0xeb;const _0x5dc569=a145_0x5dc5();let _0x174f68=_0x5dc569[_0x3bdeca];return _0x174f68;}export function parseSegmentRef(_0x5f289d){const _0x4a001f=a145_0x174f,_0x24cd12=_0x5f289d['indexOf']('/');if(_0x24cd12===-0x1)return{'parentId':_0x5f289d};if(_0x24cd12===0x0)throw new Error(_0x4a001f(0xf7)+_0x5f289d+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x50d107=_0x5f289d[_0x4a001f(0xee)](0x0,_0x24cd12),_0x199ff0=_0x5f289d[_0x4a001f(0xee)](_0x24cd12+0x1);if(_0x199ff0==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x5f289d+_0x4a001f(0xed));return{'parentId':_0x50d107,'childId':_0x199ff0};}function a145_0x5dc5(){const _0x28c4ed=['13895zriNfF','10lKDcjq','6LTKtoc','4gtdIYv','8064099oBMXlT','46045252ThBGiS','343646RxEYjc','3004150tyoslW','Invalid\x20segment\x20reference\x20format:\x20','9884968AjxjTg','72RXjybv','802008mfHWDV','.\x20Child\x20name\x20cannot\x20be\x20empty','substring'];a145_0x5dc5=function(){return _0x28c4ed;};return a145_0x5dc5();}