@treasuredata/tdx 2026.3.9 → 2026.3.10

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 (210) 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/cli.js.map +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-test-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/auth-login-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.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.d.ts.map +1 -1
  55. package/dist/commands/workflow-command.js +1 -1
  56. package/dist/commands/workflow-command.js.map +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/utils.js +1 -1
  78. package/dist/proxy/claude-usage-tracker.js +1 -1
  79. package/dist/proxy/passthrough-server.js +1 -1
  80. package/dist/proxy/sse-usage-parser.js +1 -1
  81. package/dist/sdk/agent/agent-config.js +1 -1
  82. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  83. package/dist/sdk/agent/agent-yaml.js +1 -1
  84. package/dist/sdk/agent/test/evaluator.js +1 -1
  85. package/dist/sdk/agent/test/executor.js +1 -1
  86. package/dist/sdk/agent/test/index.js +1 -1
  87. package/dist/sdk/agent/test/output.js +1 -1
  88. package/dist/sdk/agent/test/parser.js +1 -1
  89. package/dist/sdk/agent/tool-target-registry.js +1 -1
  90. package/dist/sdk/api.js +1 -1
  91. package/dist/sdk/client/cdp-api-client.js +1 -1
  92. package/dist/sdk/client/delivery-api-client.js +1 -1
  93. package/dist/sdk/client/endpoints.js +1 -1
  94. package/dist/sdk/client/engage-api-client.js +1 -1
  95. package/dist/sdk/client/http-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js +1 -1
  97. package/dist/sdk/client/oauth-refresh.js +1 -1
  98. package/dist/sdk/client/rate-limiter.js +1 -1
  99. package/dist/sdk/client/td-api-client.js +1 -1
  100. package/dist/sdk/client/trino-api-client.js +1 -1
  101. package/dist/sdk/client/workflow-client.js +1 -1
  102. package/dist/sdk/connection-validator.js +1 -1
  103. package/dist/sdk/connection.js +1 -1
  104. package/dist/sdk/delivery.js +1 -1
  105. package/dist/sdk/engage/campaign-pull.js +1 -1
  106. package/dist/sdk/engage/campaign-push.js +1 -1
  107. package/dist/sdk/engage/campaign-validator.js +1 -1
  108. package/dist/sdk/engage/campaign-yaml.js +1 -1
  109. package/dist/sdk/engage/template-pull.js +1 -1
  110. package/dist/sdk/engage/template-push.js +1 -1
  111. package/dist/sdk/engage/template-validator.js +1 -1
  112. package/dist/sdk/engage/template-yaml.js +1 -1
  113. package/dist/sdk/engage/types/campaign-def.js +1 -1
  114. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  115. package/dist/sdk/engage/types/template-schema.js +1 -1
  116. package/dist/sdk/engage.js +1 -1
  117. package/dist/sdk/errors.d.ts +2 -0
  118. package/dist/sdk/errors.d.ts.map +1 -1
  119. package/dist/sdk/errors.js +1 -1
  120. package/dist/sdk/errors.js.map +1 -1
  121. package/dist/sdk/index.js +1 -1
  122. package/dist/sdk/io/index.js +1 -1
  123. package/dist/sdk/io/node-filesystem.js +1 -1
  124. package/dist/sdk/job.js +1 -1
  125. package/dist/sdk/journey.js +1 -1
  126. package/dist/sdk/llm/chat-cache.js +1 -1
  127. package/dist/sdk/llm/index.js +1 -1
  128. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  129. package/dist/sdk/llm/model-factors.js +1 -1
  130. package/dist/sdk/personalization.js +1 -1
  131. package/dist/sdk/query/index.js +1 -1
  132. package/dist/sdk/query/sql-parser.js +1 -1
  133. package/dist/sdk/realtime.js +1 -1
  134. package/dist/sdk/schedule.js +1 -1
  135. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  136. package/dist/sdk/segment/fields-display.js +1 -1
  137. package/dist/sdk/segment/file-discovery.js +1 -1
  138. package/dist/sdk/segment/journey-utils.js +1 -1
  139. package/dist/sdk/segment/journey-validator.js +1 -1
  140. package/dist/sdk/segment/journey-yaml.js +1 -1
  141. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  142. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  143. package/dist/sdk/segment/pull-workflow.js +1 -1
  144. package/dist/sdk/segment/push-recovery.js +1 -1
  145. package/dist/sdk/segment/push-workflow.js +1 -1
  146. package/dist/sdk/segment/resolution-context.js +1 -1
  147. package/dist/sdk/segment/segment-path-parser.js +1 -1
  148. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  149. package/dist/sdk/segment/segment-validator.js +1 -1
  150. package/dist/sdk/segment/target-resolution.js +1 -1
  151. package/dist/sdk/segment/tdx-config.js +1 -1
  152. package/dist/sdk/segment/types/activation-schema.js +1 -1
  153. package/dist/sdk/segment/types/journey-def.js +1 -1
  154. package/dist/sdk/segment/types/journey-schema.js +1 -1
  155. package/dist/sdk/segment/types/segment-def.js +1 -1
  156. package/dist/sdk/segment/types/segment-schema.js +1 -1
  157. package/dist/sdk/segment/validate-files.js +1 -1
  158. package/dist/sdk/segment/yaml-validator.js +1 -1
  159. package/dist/sdk/segment.js +1 -1
  160. package/dist/sdk/types/index.js +1 -1
  161. package/dist/sdk/types/progress.js +1 -1
  162. package/dist/sdk/user.js +1 -1
  163. package/dist/sdk/util/format-detector.js +1 -1
  164. package/dist/sdk/util/formatters.js +1 -1
  165. package/dist/sdk/util/index.js +1 -1
  166. package/dist/sdk/util/paginate.js +1 -1
  167. package/dist/sdk/util/tree-formatter.js +1 -1
  168. package/dist/sdk/workflow/archive-validation.js +1 -1
  169. package/dist/sdk/workflow/clone-workflow.js +1 -1
  170. package/dist/sdk/workflow/index.d.ts +12 -0
  171. package/dist/sdk/workflow/index.d.ts.map +1 -1
  172. package/dist/sdk/workflow/index.js +1 -1
  173. package/dist/sdk/workflow/index.js.map +1 -1
  174. package/dist/sdk/workflow/pull-workflow.js +1 -1
  175. package/dist/sdk/workflow/push-workflow.js +1 -1
  176. package/dist/sdk/workflow/tdx-config.js +1 -1
  177. package/dist/sdk/workflow/workflow-utils.js +1 -1
  178. package/dist/test-utils/command-runner.js +1 -1
  179. package/dist/test-utils/factories.js +1 -1
  180. package/dist/test-utils/fixtures.js +1 -1
  181. package/dist/test-utils/http-mock.js +1 -1
  182. package/dist/test-utils/index.js +1 -1
  183. package/dist/utils/async.js +1 -1
  184. package/dist/utils/colors.js +1 -1
  185. package/dist/utils/diff.js +1 -1
  186. package/dist/utils/file-permissions.js +1 -1
  187. package/dist/utils/file-reader.js +1 -1
  188. package/dist/utils/github-releases.js +1 -1
  189. package/dist/utils/global-cache.js +1 -1
  190. package/dist/utils/json-loader.js +1 -1
  191. package/dist/utils/local-cache.js +1 -1
  192. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  193. package/dist/utils/logger/formatters/index.js +1 -1
  194. package/dist/utils/logger/handlers/console-handler.js +1 -1
  195. package/dist/utils/logger/handlers/file-handler.js +1 -1
  196. package/dist/utils/logger/handlers/index.js +1 -1
  197. package/dist/utils/logger/handlers/null-handler.js +1 -1
  198. package/dist/utils/logger/index.js +1 -1
  199. package/dist/utils/logger/logger.js +1 -1
  200. package/dist/utils/logger/types.js +1 -1
  201. package/dist/utils/option-validation.js +1 -1
  202. package/dist/utils/process.js +1 -1
  203. package/dist/utils/prompt.js +1 -1
  204. package/dist/utils/spinner.js +1 -1
  205. package/dist/utils/sse-parser.js +1 -1
  206. package/dist/utils/string-utils.js +1 -1
  207. package/dist/utils/table-ref-parser.js +1 -1
  208. package/dist/utils/tdx-logger.js +1 -1
  209. package/dist/utils/version-check.js +1 -1
  210. package/package.json +1 -1
@@ -1 +1 @@
1
- const a139_0x696151=a139_0xa0e6;(function(_0x58c28b,_0x4df182){const _0x37a8ee=a139_0xa0e6,_0x2aa1d8=_0x58c28b();while(!![]){try{const _0x1c03f2=-parseInt(_0x37a8ee(0x11e))/0x1*(-parseInt(_0x37a8ee(0x116))/0x2)+-parseInt(_0x37a8ee(0x117))/0x3*(parseInt(_0x37a8ee(0x113))/0x4)+-parseInt(_0x37a8ee(0x10a))/0x5*(-parseInt(_0x37a8ee(0x114))/0x6)+-parseInt(_0x37a8ee(0x106))/0x7+-parseInt(_0x37a8ee(0x11c))/0x8*(-parseInt(_0x37a8ee(0x112))/0x9)+parseInt(_0x37a8ee(0x107))/0xa+parseInt(_0x37a8ee(0x10c))/0xb;if(_0x1c03f2===_0x4df182)break;else _0x2aa1d8['push'](_0x2aa1d8['shift']());}catch(_0x945e65){_0x2aa1d8['push'](_0x2aa1d8['shift']());}}}(a139_0x27e8,0xe0b3d));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';function a139_0xa0e6(_0x1d7c11,_0xb981f0){_0x1d7c11=_0x1d7c11-0x106;const _0x27e8e9=a139_0x27e8();let _0xa0e60e=_0x27e8e9[_0x1d7c11];return _0xa0e60e;}function a139_0x27e8(){const _0x319de9=['debug','2467OFwpde','9102352XljoEA','15592830eZjJyc','utf-8','segments','20sJzNsO','warn','9526891FRgyjm','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','ENOENT','tdx.sdk.push-recovery','code','38889JuBEGy','6491528erGCMs','74604lioXQe','toISOString','598KhqmTd','3UiFrQh','journeyName','version','join','stringify','1168ZdZjfE'];a139_0x27e8=function(){return _0x319de9;};return a139_0x27e8();}import a139_0x49017a from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a139_0x696151(0x110));export function getPushRecoveryPath(_0x37f714){const _0x47c541=a139_0x696151,_0x379dfd=a139_0x49017a['dirname'](_0x37f714),_0x5e3785=a139_0x49017a['basename'](_0x37f714);return a139_0x49017a[_0x47c541(0x11a)](_0x379dfd,'.'+_0x5e3785+'.push-recovery.json');}export function readPushRecovery(_0x433cae){const _0x2f213e=a139_0x696151,_0x325fc6=getPushRecoveryPath(_0x433cae);if(!existsSync(_0x325fc6))return undefined;try{const _0x151190=readFileSync(_0x325fc6,_0x2f213e(0x108)),_0x59f8cc=JSON['parse'](_0x151190);if(_0x59f8cc?.[_0x2f213e(0x119)]!==0x1||typeof _0x59f8cc[_0x2f213e(0x118)]!=='string')return undefined;return _0x59f8cc;}catch(_0x49497c){return _0x49497c instanceof SyntaxError?logger[_0x2f213e(0x11d)](_0x2f213e(0x10e)+_0x49497c):logger[_0x2f213e(0x10b)]('Failed\x20to\x20read\x20push\x20recovery\x20file:\x20'+_0x49497c),undefined;}}export function writePushRecovery(_0x5b21b3,_0xb4e5db){const _0x1e5c00=a139_0x696151,_0x7a483a=getPushRecoveryPath(_0x5b21b3),_0x3e65fd=_0x7a483a+'.tmp';writeFileSync(_0x3e65fd,JSON[_0x1e5c00(0x11b)](_0xb4e5db,null,0x2)+'\x0a','utf-8'),renameSync(_0x3e65fd,_0x7a483a);}export function deletePushRecovery(_0x4f401b){const _0x2da0fa=a139_0x696151,_0x326e7a=getPushRecoveryPath(_0x4f401b);try{unlinkSync(_0x326e7a);}catch(_0x283172){_0x283172[_0x2da0fa(0x111)]!==_0x2da0fa(0x10f)&&logger['debug'](_0x2da0fa(0x10d)+_0x283172);}}export function saveSegmentToPushRecovery(_0x28ee61,_0x42db5c,_0x5df984,_0x9c4585){const _0x47f950=a139_0x696151,_0x16a561=readPushRecovery(_0x28ee61),_0x416826=_0x16a561?.[_0x47f950(0x118)]===_0x42db5c?{..._0x16a561,'updatedAt':new Date()['toISOString']()}:{'version':0x1,'journeyName':_0x42db5c,'updatedAt':new Date()[_0x47f950(0x115)](),'segments':{}};_0x416826[_0x47f950(0x109)][_0x5df984]=_0x9c4585,writePushRecovery(_0x28ee61,_0x416826);}
1
+ const a139_0x19859b=a139_0xba9e;(function(_0x46ea4c,_0x1c3579){const _0x1e77dd=a139_0xba9e,_0x5878ed=_0x46ea4c();while(!![]){try{const _0x2ceefb=parseInt(_0x1e77dd(0xa1))/0x1+-parseInt(_0x1e77dd(0xa8))/0x2*(parseInt(_0x1e77dd(0x90))/0x3)+parseInt(_0x1e77dd(0x95))/0x4+-parseInt(_0x1e77dd(0x8d))/0x5+-parseInt(_0x1e77dd(0x92))/0x6*(parseInt(_0x1e77dd(0x9e))/0x7)+parseInt(_0x1e77dd(0x96))/0x8+parseInt(_0x1e77dd(0x94))/0x9*(parseInt(_0x1e77dd(0x99))/0xa);if(_0x2ceefb===_0x1c3579)break;else _0x5878ed['push'](_0x5878ed['shift']());}catch(_0x1dbece){_0x5878ed['push'](_0x5878ed['shift']());}}}(a139_0x48f2,0x9e5a7));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a139_0x47963a from'path';function a139_0x48f2(){const _0x1aa033=['3011085npduDU','journeyName','code','3201477VtvEYT','segments','18gvtVnV','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','16029hBkUtz','1331664IRKmFD','917656xXkNIJ','debug','ENOENT','9330EArYPN','join','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','toISOString','stringify','2442419Wgnzzv','parse','warn','1255446TyVPlJ','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','utf-8','.push-recovery.json','.tmp','dirname','tdx.sdk.push-recovery','2ghXYUb','version'];a139_0x48f2=function(){return _0x1aa033;};return a139_0x48f2();}import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a139_0x19859b(0xa7));export function getPushRecoveryPath(_0x232e2b){const _0x2c8c9a=a139_0x19859b,_0x207a81=a139_0x47963a[_0x2c8c9a(0xa6)](_0x232e2b),_0x51e692=a139_0x47963a['basename'](_0x232e2b);return a139_0x47963a[_0x2c8c9a(0x9a)](_0x207a81,'.'+_0x51e692+_0x2c8c9a(0xa4));}export function readPushRecovery(_0x126686){const _0x29d8c9=a139_0x19859b,_0x355faa=getPushRecoveryPath(_0x126686);if(!existsSync(_0x355faa))return undefined;try{const _0x1669af=readFileSync(_0x355faa,_0x29d8c9(0xa3)),_0x4a9794=JSON[_0x29d8c9(0x9f)](_0x1669af);if(_0x4a9794?.[_0x29d8c9(0x8c)]!==0x1||typeof _0x4a9794[_0x29d8c9(0x8e)]!=='string')return undefined;return _0x4a9794;}catch(_0x17322b){return _0x17322b instanceof SyntaxError?logger[_0x29d8c9(0x97)](_0x29d8c9(0xa2)+_0x17322b):logger[_0x29d8c9(0xa0)](_0x29d8c9(0x93)+_0x17322b),undefined;}}export function writePushRecovery(_0x1561fe,_0x3e9eda){const _0x1e2c37=a139_0x19859b,_0x53b142=getPushRecoveryPath(_0x1561fe),_0x21e142=_0x53b142+_0x1e2c37(0xa5);writeFileSync(_0x21e142,JSON[_0x1e2c37(0x9d)](_0x3e9eda,null,0x2)+'\x0a',_0x1e2c37(0xa3)),renameSync(_0x21e142,_0x53b142);}export function deletePushRecovery(_0xf54f2f){const _0x3050c3=a139_0x19859b,_0x22c2a4=getPushRecoveryPath(_0xf54f2f);try{unlinkSync(_0x22c2a4);}catch(_0x954240){_0x954240[_0x3050c3(0x8f)]!==_0x3050c3(0x98)&&logger['debug'](_0x3050c3(0x9b)+_0x954240);}}function a139_0xba9e(_0x592365,_0x26a17a){_0x592365=_0x592365-0x8c;const _0x48f25b=a139_0x48f2();let _0xba9eb1=_0x48f25b[_0x592365];return _0xba9eb1;}export function saveSegmentToPushRecovery(_0x2c55ce,_0x275feb,_0x3d7ced,_0x2d311d){const _0x110291=a139_0x19859b,_0x123ffd=readPushRecovery(_0x2c55ce),_0x58fccc=_0x123ffd?.[_0x110291(0x8e)]===_0x275feb?{..._0x123ffd,'updatedAt':new Date()[_0x110291(0x9c)]()}:{'version':0x1,'journeyName':_0x275feb,'updatedAt':new Date()[_0x110291(0x9c)](),'segments':{}};_0x58fccc[_0x110291(0x91)][_0x3d7ced]=_0x2d311d,writePushRecovery(_0x2c55ce,_0x58fccc);}
@@ -1 +1 @@
1
- const a140_0x408869=a140_0x340f;(function(_0x22850a,_0x560072){const _0x59e4dd=a140_0x340f,_0x1a0736=_0x22850a();while(!![]){try{const _0x100e9f=-parseInt(_0x59e4dd(0x1ca))/0x1*(-parseInt(_0x59e4dd(0x1d7))/0x2)+parseInt(_0x59e4dd(0x22b))/0x3*(-parseInt(_0x59e4dd(0x224))/0x4)+-parseInt(_0x59e4dd(0x23a))/0x5*(-parseInt(_0x59e4dd(0x1a8))/0x6)+parseInt(_0x59e4dd(0x284))/0x7+parseInt(_0x59e4dd(0x1c5))/0x8+-parseInt(_0x59e4dd(0x260))/0x9*(-parseInt(_0x59e4dd(0x1ed))/0xa)+-parseInt(_0x59e4dd(0x25d))/0xb*(parseInt(_0x59e4dd(0x220))/0xc);if(_0x100e9f===_0x560072)break;else _0x1a0736['push'](_0x1a0736['shift']());}catch(_0x2271a0){_0x1a0736['push'](_0x1a0736['shift']());}}}(a140_0x54fe,0x6a819));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x408869(0x216));export const PENDING_SEGMENT_PREFIX=a140_0x408869(0x231);export const PENDING_ACTIVATION_PREFIX=a140_0x408869(0x273);export function createPendingSegmentId(_0x324fc8){return''+PENDING_SEGMENT_PREFIX+_0x324fc8+'__';}export function isPendingSegmentId(_0x5e4b8e){const _0x2eb419=a140_0x408869;return _0x5e4b8e[_0x2eb419(0x1d2)](PENDING_SEGMENT_PREFIX)&&!_0x5e4b8e[_0x2eb419(0x1d2)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x5a9854){const _0x1c67a5=a140_0x408869;return _0x5a9854[_0x1c67a5(0x1bf)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x7b2d47){return''+PENDING_ACTIVATION_PREFIX+_0x7b2d47+'__';}export function isPendingActivationId(_0x2f1ea1){return _0x2f1ea1['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x3c34f4){const _0x5873d0=a140_0x408869;return _0x3c34f4[_0x5873d0(0x1bf)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x46fcdd,_0x3f83a3){const _0x29dd70=a140_0x408869,_0x28a981=_0x46fcdd+'::'+(_0x3f83a3[_0x29dd70(0x195)]()||_0x29dd70(0x22d)),_0x556631=createHash('sha1')[_0x29dd70(0x250)](_0x28a981)[_0x29dd70(0x27b)](_0x29dd70(0x1a5))[_0x29dd70(0x282)](0x0,0xc);return'journey_entry_criteria_'+_0x556631;}export function ensureJourneyDefaults(_0x35a1fd){const _0x4eeaa0=a140_0x408869;!_0x35a1fd[_0x4eeaa0(0x1c0)]&&(_0x35a1fd[_0x4eeaa0(0x1c0)]=''),!_0x35a1fd[_0x4eeaa0(0x27c)]&&(_0x35a1fd['state']=_0x4eeaa0(0x1bc));}export function injectExistingStageIds(_0xafa801,_0x3660f6){const _0x31e8b1=a140_0x408869,_0x895946=new Map(_0x3660f6[_0x31e8b1(0x268)](_0x3a159b=>[_0x3a159b[_0x31e8b1(0x265)],_0x3a159b['id']]));for(const _0x3a4b83 of _0xafa801){if(!_0x3a4b83['id']){const _0x3cbfec=_0x895946[_0x31e8b1(0x1f1)](_0x3a4b83[_0x31e8b1(0x265)]);_0x3cbfec&&(_0x3a4b83['id']=_0x3cbfec);}}}export function resolveTDFolderPath(_0x428110,_0x59af8b,_0x5c726d){const _0xffd8f2=a140_0x408869;if(!_0x59af8b)return _0x428110;if(_0x428110===_0x5c726d||_0x428110[_0xffd8f2(0x1d2)](_0x5c726d+'/'))return _0x428110;return _0x428110?_0x5c726d+'/'+_0x428110:_0x5c726d;}export function addFoldersToCreate(_0x5239d5,_0x19cbd2,_0x8b5380){const _0x44a576=a140_0x408869;if(!_0x5239d5)return;if(_0x19cbd2[_0x44a576(0x1ea)](_0x5239d5))return;const _0x18860a=_0x5239d5['split']('/');let _0x1a8cc6='';for(const _0x2c0565 of _0x18860a){_0x1a8cc6=_0x1a8cc6?_0x1a8cc6+'/'+_0x2c0565:_0x2c0565,!_0x19cbd2['has'](_0x1a8cc6)&&_0x8b5380[_0x44a576(0x199)](_0x1a8cc6);}}export function sortFoldersByDepth(_0x501124){return[..._0x501124]['sort']((_0x5a4a87,_0xbbc2a6)=>{const _0x1ce752=a140_0x340f,_0x593d3a=(_0x5a4a87[_0x1ce752(0x21b)](/\//g)||[])[_0x1ce752(0x280)],_0x53153f=(_0xbbc2a6[_0x1ce752(0x21b)](/\//g)||[])[_0x1ce752(0x280)];return _0x593d3a-_0x53153f;});}import*as a140_0x461fde from'yaml';import{readFileSync}from'fs';function a140_0x340f(_0x171eae,_0x406706){_0x171eae=_0x171eae-0x188;const _0x54fe78=a140_0x54fe();let _0x340ff0=_0x54fe78[_0x171eae];return _0x340ff0;}import a140_0x44127b from'path';import{isJourneyDef,parseYamlString as a140_0x190f74,toYamlString as a140_0x3add77,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(_0x5e6c73){const _0xa967d=a140_0x408869;if(Array[_0xa967d(0x1d1)](_0x5e6c73))return'['+_0x5e6c73['map'](_0x1a66bf=>stableStringify(_0x1a66bf))[_0xa967d(0x1cc)](',')+']';if(_0x5e6c73&&typeof _0x5e6c73==='object'){const _0xd3744a=_0x5e6c73,_0x55da75=Object['keys'](_0xd3744a)['sort'](),_0x2ab27c=_0x55da75[_0xa967d(0x268)](_0xaf9eba=>'\x22'+_0xaf9eba+'\x22:'+stableStringify(_0xd3744a[_0xaf9eba]));return'{'+_0x2ab27c[_0xa967d(0x1cc)](',')+'}';}const _0x19f396=JSON[_0xa967d(0x22c)](_0x5e6c73);return _0x19f396===undefined?'null':_0x19f396;}function activationSignature(_0x4d2131){const _0x395f4c=a140_0x408869,_0x30d7d7={'connection':_0x4d2131[_0x395f4c(0x279)],..._0x4d2131[_0x395f4c(0x1b5)]!==undefined&&{'all_columns':_0x4d2131[_0x395f4c(0x1b5)]},..._0x4d2131['columns']!==undefined&&{'columns':_0x4d2131['columns']},..._0x4d2131['behavior']!==undefined&&{'behavior':_0x4d2131[_0x395f4c(0x1b9)]},..._0x4d2131['schedule']!==undefined&&{'schedule':_0x4d2131[_0x395f4c(0x21c)]},..._0x4d2131[_0x395f4c(0x20c)]!==undefined&&{'notification':_0x4d2131[_0x395f4c(0x20c)]},..._0x4d2131[_0x395f4c(0x1fc)]!==undefined&&{'connector_config':_0x4d2131[_0x395f4c(0x1fc)]},..._0x4d2131[_0x395f4c(0x24f)]!==undefined&&{'activation_template_id':_0x4d2131[_0x395f4c(0x24f)]}};return stableStringify(_0x30d7d7);}async function fetchSegment(_0x125494,_0x4b99ba,_0x59fa5b,_0x50df49){const _0xdb145=a140_0x408869,_0x478f92=_0x50df49?.[_0xdb145(0x270)](_0x1183b4=>_0x1183b4['id']===_0x59fa5b);if(_0x478f92)return _0x478f92;try{return await _0x125494[_0xdb145(0x22d)][_0xdb145(0x1ef)](_0x4b99ba,_0x59fa5b);}catch(_0x20a6ce){logger[_0xdb145(0x1bd)]('getSegment\x20failed\x20for\x20'+_0x59fa5b+_0xdb145(0x239)+_0x20a6ce);try{return await _0x125494[_0xdb145(0x22d)]['getSegmentEntity'](_0x59fa5b);}catch(_0x2d0ec6){return logger['debug'](_0xdb145(0x1ae)+_0x59fa5b+':\x20'+_0x2d0ec6),null;}}}function recoverSegmentIdsFromPushRecovery(_0x12fc54,_0x2dc972,_0x3c7b91){const _0x364346=a140_0x408869,_0x3c27dd=readPushRecovery(_0x12fc54[_0x364346(0x21d)]);if(_0x3c27dd?.[_0x364346(0x20b)]===_0x12fc54[_0x364346(0x18a)]['name'])for(const [_0x3a1682,_0x5c3ec4]of Object['entries'](_0x3c27dd[_0x364346(0x241)])){const _0x43411b=generateDeterministicJourneySegmentName(_0x12fc54[_0x364346(0x18a)][_0x364346(0x265)],_0x3a1682);_0x5c3ec4[_0x364346(0x25e)]===_0x43411b&&(_0x2dc972[_0x364346(0x1f8)](_0x3a1682,_0x5c3ec4['segmentId']),_0x3c7b91[_0x364346(0x1f8)](_0x3a1682,_0x5c3ec4['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0xf06427,_0x53c712,_0x1c1a9b,_0xa5834a){const _0x141bfd=a140_0x408869;let _0x2c413f;try{_0x2c413f=await _0xf06427['segment'][_0x141bfd(0x1a1)]({'name':_0x1c1a9b[_0x141bfd(0x26b)],'description':_0x1c1a9b[_0x141bfd(0x1c0)],'journeyId':_0x1c1a9b['journeyId'],'rule':_0xa5834a(_0x1c1a9b[_0x141bfd(0x275)],!![]),'countPopulation':!![],'parentFolderId':_0x1c1a9b[_0x141bfd(0x258)],'audienceId':_0x1c1a9b[_0x141bfd(0x18e)]});}catch(_0x443abb){const _0x287145=_0x443abb instanceof Error&&_0x443abb[_0x141bfd(0x192)]['includes'](_0x141bfd(0x1d3));if(_0x287145){const _0x79fac7=readPushRecovery(_0x53c712['absolutePath']),_0x42b156=_0x79fac7?.['journeyName']===_0x53c712[_0x141bfd(0x18a)][_0x141bfd(0x265)]?_0x79fac7[_0x141bfd(0x241)][_0x1c1a9b['localName']]:undefined;if(_0x42b156?.[_0x141bfd(0x25e)]===_0x1c1a9b[_0x141bfd(0x26b)])await _0xf06427[_0x141bfd(0x22d)][_0x141bfd(0x1b7)](_0x1c1a9b['parentId'],_0x42b156[_0x141bfd(0x1d4)],{'description':_0x1c1a9b[_0x141bfd(0x1c0)],'rule':_0xa5834a(_0x1c1a9b[_0x141bfd(0x275)],!![]),'countPopulation':!![]}),_0x2c413f=_0x42b156[_0x141bfd(0x1d4)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0x1c1a9b[_0x141bfd(0x194)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x141bfd(0x237)+_0x53c712[_0x141bfd(0x21d)][_0x141bfd(0x1bf)](/([^/]+)$/,_0x141bfd(0x246))+')\x20')+_0x141bfd(0x229),_0x443abb);}else throw _0x443abb;}return saveSegmentToPushRecovery(_0x53c712[_0x141bfd(0x21d)],_0x53c712[_0x141bfd(0x18a)][_0x141bfd(0x265)],_0x1c1a9b['localName'],{'segmentId':_0x2c413f,'uniqueServerName':_0x1c1a9b[_0x141bfd(0x26b)],'createdAt':new Date()[_0x141bfd(0x1ec)]()}),_0x2c413f;}export async function prepareSegmentFiles(_0x2ddc8f,_0x169937,_0x4225b1,_0x4b80ef,_0x1115c6){const _0x382f15=a140_0x408869,{activationDefToCreateRequest:_0x35ca9c}=await import(_0x382f15(0x207)),_0x5b1d17=[],_0x4695cb=new Set();for(const {yamlConfig:_0x463111,folderPath:_0x595b0b,sourcePath:_0xc43a9e}of _0x2ddc8f){const _0x7d7151=resolveTDFolderPath(_0x595b0b,_0x4b80ef,_0x1115c6),_0xc8b524=_0x7d7151+':'+_0x463111['name'],_0x40c8cf=_0x169937[_0x382f15(0x200)][_0x382f15(0x1f1)](_0xc8b524),_0x2dd943=_0x40c8cf?_0x169937['activationsBySegmentId'][_0x382f15(0x1f1)](_0x40c8cf['id'])||[]:[];addFoldersToCreate(_0x7d7151,_0x169937['folderPathToId'],_0x4695cb);const _0x532156=calculateActivationActions(_0x463111[_0x382f15(0x20a)]||[],_0x2dd943,_0x169937[_0x382f15(0x1d8)],_0x169937['connectionIdToNameMap']);for(const _0x39a1ec of _0x532156){(_0x39a1ec[_0x382f15(0x1ce)]===_0x382f15(0x1e9)||_0x39a1ec['type']===_0x382f15(0x250))&&_0x39a1ec[_0x382f15(0x213)]&&(_0x39a1ec[_0x382f15(0x211)]=await _0x35ca9c(_0x39a1ec[_0x382f15(0x213)],_0x4225b1));}const _0xcfd9c0=calculateSegmentDiff(_0x463111,_0x40c8cf,_0x2dd943,_0x169937[_0x382f15(0x1d8)],_0x169937[_0x382f15(0x1e7)]);_0x5b1d17[_0x382f15(0x1aa)]({'relativePath':_0x463111[_0x382f15(0x265)],'absolutePath':_0xc43a9e,'yamlConfig':_0x463111,'folderPath':_0x7d7151,'existingSegment':_0x40c8cf,'existingActivations':_0x2dd943,'isNew':_0xcfd9c0[_0x382f15(0x248)],'hasChanges':_0xcfd9c0[_0x382f15(0x26a)],'diff':_0xcfd9c0['diff'],'activationActions':_0x532156});}return{'segmentFiles':_0x5b1d17,'foldersToCreate':_0x4695cb};}export async function prepareJourneyFiles(_0x2169a5,_0x4caca9,_0x5530e8,_0x24fb2e){const _0x40b92b=a140_0x408869,_0x6a65ca=[],_0x5dfba6=new Set();for(const {yamlConfig:_0x2fee0d,folderPath:_0x4881b9,sourcePath:_0x7dd2aa}of _0x2169a5){const _0x1b9831=resolveTDFolderPath(_0x4881b9,_0x5530e8,_0x24fb2e),_0x145425=_0x1b9831+':'+_0x2fee0d['name'],_0x5e8f81=_0x4caca9['journeyBundlesByFolderAndName'][_0x40b92b(0x1f1)](_0x145425);let _0x17bebc,_0x22857f;if(_0x5e8f81&&_0x5e8f81[_0x40b92b(0x280)]>0x0){const _0x5d3a5d=buildLocalExpandedRuleMappings(_0x2fee0d),{createYamlContext:_0x4228ac,prefetchJourneySegments:_0x40b233}=createPushYamlContextForBundle(_0x4caca9[_0x40b92b(0x20e)],_0x4caca9['parentId'],_0x4caca9[_0x40b92b(0x206)],_0x5d3a5d,_0x4caca9[_0x40b92b(0x1d8)],_0x4caca9[_0x40b92b(0x1e7)],_0x4caca9['activationStepsById'],_0x4caca9[_0x40b92b(0x1d5)]);await _0x40b233(_0x5e8f81[_0x40b92b(0x268)](_0x38eab3=>_0x38eab3['id']));const _0x9cf118=await _0x4caca9[_0x40b92b(0x20e)][_0x40b92b(0x25f)]['getLatestJourneyId'](_0x5e8f81[0x0][_0x40b92b(0x18b)]),_0x435e48=hasMultipleVersions(_0x2fee0d),_0x4074c7=async _0x402841=>{const _0x3dc4c2=_0x40b92b,_0x5fa100=_0x4caca9['journeyById']?.['get'](_0x402841);if(_0x5fa100)return _0x5fa100;return _0x4caca9[_0x3dc4c2(0x204)]({'journeyId':_0x402841,'journeyName':_0x2fee0d[_0x3dc4c2(0x265)],'isMultiVersion':_0x5e8f81[_0x3dc4c2(0x280)]>0x1});};if(_0x435e48&&_0x5e8f81[_0x40b92b(0x280)]>0x1){const _0x1457c8=[];for(const _0x57d5b4 of _0x5e8f81){const _0x81ee13=_0x57d5b4[_0x40b92b(0x1e4)]||0x1;_0x4caca9[_0x40b92b(0x272)]?.['update']('Fetching\x20'+_0x2fee0d[_0x40b92b(0x265)]+'\x20v'+_0x81ee13);const _0x133aaf=await _0x4074c7(_0x57d5b4['id']),_0x84c6e9=_0x4228ac(_0x57d5b4['id']),_0x2436bc=await journeyResponseToDef(_0x133aaf,_0x84c6e9);_0x1457c8[_0x40b92b(0x1aa)]({'item':_0x57d5b4,'yaml':_0x2436bc});}const _0x49013e=buildLocalRuleToNameMappingFromJourney(_0x2fee0d);_0x22857f=buildMergedJourneyDef(_0x1457c8,_0x49013e,_0x9cf118);const _0x40b2e6=Math[_0x40b92b(0x1db)](..._0x1457c8['map'](_0x2134e9=>_0x2134e9[_0x40b92b(0x26d)][_0x40b92b(0x1e4)]||0x0)),_0x123f93=_0x5e8f81['find'](_0x2fd038=>(_0x2fd038['versionNumber']||0x0)===_0x40b2e6);_0x123f93&&(_0x4caca9[_0x40b92b(0x272)]?.[_0x40b92b(0x250)](_0x40b92b(0x23b)+_0x2fee0d[_0x40b92b(0x265)]+'\x20v'+_0x40b2e6),_0x17bebc=await _0x4074c7(_0x123f93['id']));}else{const _0x527beb=_0x5e8f81[_0x5e8f81[_0x40b92b(0x280)]-0x1];_0x4caca9[_0x40b92b(0x272)]?.[_0x40b92b(0x250)](_0x40b92b(0x23b)+_0x2fee0d['name']),_0x17bebc=await _0x4074c7(_0x527beb['id']);const _0x216b66=_0x4228ac(_0x527beb['id']),_0x47c23c=await journeyResponseToDef(_0x17bebc,_0x216b66),_0xb443ed=buildLocalRuleToNameMappingFromJourney(_0x2fee0d);_0x22857f=buildMergedJourneyDef([{'item':_0x527beb,'yaml':_0x47c23c}],_0xb443ed,_0x9cf118);}}addFoldersToCreate(_0x1b9831,_0x4caca9[_0x40b92b(0x1ba)],_0x5dfba6);const _0x553bd8=calculateJourneyDiff(_0x2fee0d,_0x22857f);_0x6a65ca[_0x40b92b(0x1aa)]({'relativePath':_0x2fee0d['name'],'absolutePath':_0x7dd2aa,'yamlConfig':_0x2fee0d,'folderPath':_0x1b9831,'existingJourney':_0x17bebc,'isNew':_0x553bd8[_0x40b92b(0x248)],'hasChanges':_0x553bd8[_0x40b92b(0x26a)],'diff':_0x553bd8[_0x40b92b(0x18c)]});}return{'journeyFiles':_0x6a65ca,'foldersToCreate':_0x5dfba6};}export function calculateActivationActions(_0x5c29fb,_0x1aef03,_0x4554f9,_0x6a0ee1){const _0x3f7a0d=a140_0x408869,_0x4cc7a3=[],_0x2c40da=new Map();for(const _0x4cd2c0 of _0x1aef03){_0x2c40da['set'](_0x4cd2c0['name'],_0x4cd2c0);}const _0x1bb9c3=new Map();for(const _0x300a28 of _0x5c29fb){_0x1bb9c3[_0x3f7a0d(0x1f8)](_0x300a28[_0x3f7a0d(0x265)],_0x300a28);}for(const _0x4776fd of _0x5c29fb){const _0x1c2362=_0x2c40da[_0x3f7a0d(0x1f1)](_0x4776fd[_0x3f7a0d(0x265)]);if(!_0x1c2362)_0x4cc7a3['push']({'type':_0x3f7a0d(0x1e9),'name':_0x4776fd['name'],'yamlActivation':_0x4776fd});else{const _0x16a505=activationResponseToDef(_0x1c2362,_0x4554f9,_0x6a0ee1),_0x2a79e1=a140_0x461fde[_0x3f7a0d(0x22c)](_0x16a505),_0x1fbd6e=a140_0x461fde['stringify'](_0x4776fd);_0x2a79e1!==_0x1fbd6e&&_0x4cc7a3[_0x3f7a0d(0x1aa)]({'type':_0x3f7a0d(0x250),'name':_0x4776fd['name'],'yamlActivation':_0x4776fd,'existingActivation':_0x1c2362});}}for(const _0x1ee8fd of _0x1aef03){!_0x1bb9c3['has'](_0x1ee8fd['name'])&&_0x4cc7a3[_0x3f7a0d(0x1aa)]({'type':_0x3f7a0d(0x1b6),'name':_0x1ee8fd[_0x3f7a0d(0x265)],'existingActivation':_0x1ee8fd});}return _0x4cc7a3;}function calculateYamlDiff(_0x35045a,_0x47f825){if(_0x47f825){const _0x5254f9=generateDiff(_0x47f825,_0x35045a),_0x56af0f=hasChanges(_0x5254f9);return{'isNew':![],'hasChanges':_0x56af0f,'diff':_0x56af0f?formatDiffWithColors(_0x5254f9):undefined};}const _0x53ba7f=generateDiff('',_0x35045a);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x53ba7f)};}export function calculateSegmentDiff(_0x418259,_0x12008d,_0x7c64c6,_0x195c5a,_0x43fedb){const _0x57fd0b=segmentToYamlString(_0x418259),_0xc56ecf=_0x12008d?segmentToYamlString(segmentWithActivationsToYaml(_0x12008d,_0x7c64c6,undefined,_0x195c5a,_0x43fedb)):undefined;return calculateYamlDiff(_0x57fd0b,_0xc56ecf);}export function calculateJourneyDiff(_0x7d83ec,_0x4799c6){const _0x134131=normalizeJourneyDef(_0x7d83ec,_0x7d83ec),_0x452e32=a140_0x3add77(_0x134131),_0x5e8d43=_0x4799c6?a140_0x3add77(normalizeJourneyDef(_0x4799c6,_0x7d83ec)):undefined;return calculateYamlDiff(_0x452e32,_0x5e8d43);}export function findSegmentsToDelete(_0x79ab88,_0x4e5206,_0x3c68d2,_0x233aef,_0x38ad64){const _0x5b3aea=a140_0x408869,_0x5efc92=new Set();for(const {yamlConfig:_0x40ce24,folderPath:_0x3fcb0d}of _0x4e5206){_0x5efc92[_0x5b3aea(0x199)](_0x3fcb0d+':'+_0x40ce24['name']);}return _0x79ab88[_0x5b3aea(0x24c)](_0x431e4b=>{const _0x5c69d7=_0x5b3aea,_0x56e81a=_0x431e4b[_0x5c69d7(0x259)]?_0x3c68d2[_0x5c69d7(0x1f1)](_0x431e4b[_0x5c69d7(0x259)][_0x5c69d7(0x205)]())||'':'',_0x5b58e7=_0x56e81a+':'+_0x431e4b[_0x5c69d7(0x265)];if(_0x5efc92[_0x5c69d7(0x1ea)](_0x5b58e7))return![];if(_0x38ad64)return _0x56e81a===_0x233aef||_0x56e81a[_0x5c69d7(0x1d2)](_0x233aef+'/');return!![];});}export function findJourneysToDelete(_0x1dca75,_0x5d338d,_0x3270b1,_0x217cf1,_0x4883ce){const _0x22ad62=a140_0x408869,_0x2ef3d6=new Set();for(const {yamlConfig:_0x23dcbd,folderPath:_0x288634}of _0x5d338d){_0x2ef3d6[_0x22ad62(0x199)](_0x288634+':'+_0x23dcbd[_0x22ad62(0x265)]);}return _0x1dca75[_0x22ad62(0x24c)](_0x52762e=>{const _0x400469=_0x22ad62,_0x2ca7a7=_0x52762e[_0x400469(0x258)]?_0x3270b1[_0x400469(0x1f1)](_0x52762e['folderId'])||'':'',_0x5af57b=_0x2ca7a7+':'+_0x52762e['journeyBundleName'];if(_0x2ef3d6[_0x400469(0x1ea)](_0x5af57b))return![];if(_0x4883ce)return _0x2ca7a7===_0x217cf1||_0x2ca7a7[_0x400469(0x1d2)](_0x217cf1+'/');return!![];});}export function buildSegmentLookupMap(_0x54909b,_0x1a954c){const _0x3be367=a140_0x408869,_0x83739d=new Map();for(const _0x2bd7c0 of _0x54909b){const _0x5e9772=_0x2bd7c0[_0x3be367(0x259)]?_0x1a954c[_0x3be367(0x1f1)](_0x2bd7c0[_0x3be367(0x259)]['toString']())||'':'',_0x149c65=_0x5e9772+':'+_0x2bd7c0[_0x3be367(0x265)];_0x83739d[_0x3be367(0x1f8)](_0x149c65,_0x2bd7c0);}return _0x83739d;}export function buildSegmentNameToIdMap(_0x43a48a){const _0x535ff1=a140_0x408869,_0x253351=new Map();for(const _0x700df8 of _0x43a48a){_0x253351[_0x535ff1(0x1f8)](_0x700df8[_0x535ff1(0x265)],_0x700df8['id']);}return _0x253351;}export function buildJourneyBundleLookupMap(_0x3dcd6a,_0x211277){const _0x4214b1=a140_0x408869,_0x319bd6=new Map();for(const _0x475de9 of _0x3dcd6a){const _0x2c77ce=_0x475de9[_0x4214b1(0x258)]?_0x211277[_0x4214b1(0x1f1)](_0x475de9[_0x4214b1(0x258)])||'':'',_0x100ed5=_0x2c77ce+':'+_0x475de9[_0x4214b1(0x261)];!_0x319bd6[_0x4214b1(0x1ea)](_0x100ed5)&&_0x319bd6[_0x4214b1(0x1f8)](_0x100ed5,[]),_0x319bd6[_0x4214b1(0x1f1)](_0x100ed5)[_0x4214b1(0x1aa)](_0x475de9);}for(const _0x367c4a of _0x319bd6['values']()){_0x367c4a[_0x4214b1(0x191)]((_0x3d00c5,_0x42cfb3)=>(_0x3d00c5[_0x4214b1(0x1e4)]||0x0)-(_0x42cfb3[_0x4214b1(0x1e4)]||0x0));}return _0x319bd6;}export function collectFoldersToCreate(_0x3c06fa,_0x1966b1){const _0x5e7963=a140_0x408869,_0x3e65e8=new Set();for(const _0x5d5ec4 of _0x3c06fa){if(!_0x5d5ec4)continue;if(_0x1966b1[_0x5e7963(0x1ea)](_0x5d5ec4))continue;const _0x2af7d0=_0x5d5ec4[_0x5e7963(0x1dd)]('/');let _0x2a5a98='';for(const _0x57a2b0 of _0x2af7d0){_0x2a5a98=_0x2a5a98?_0x2a5a98+'/'+_0x57a2b0:_0x57a2b0,!_0x1966b1[_0x5e7963(0x1ea)](_0x2a5a98)&&_0x3e65e8[_0x5e7963(0x199)](_0x2a5a98);}}return _0x3e65e8;}export function parseAndClassifyYamlFiles(_0x54b0d9,_0x8b9f5b,_0x4f5432){const _0x4db2f6=a140_0x408869,_0x44f86e=[],_0x175be3=[];for(const _0x128fb9 of _0x54b0d9){const _0x4432f7=a140_0x44127b[_0x4db2f6(0x1e5)](_0x8b9f5b,a140_0x44127b[_0x4db2f6(0x223)](_0x128fb9)),_0x18edb9=_0x4432f7==='.'?'':_0x4432f7,_0x2b4163=readFileSync(_0x128fb9,'utf-8'),_0xad17f6=a140_0x461fde[_0x4db2f6(0x193)](_0x2b4163);if(isJourneyDef(_0xad17f6)){const _0xdf2c44=a140_0x190f74(_0x2b4163);_0x175be3[_0x4db2f6(0x1aa)]({'yamlConfig':_0xdf2c44,'folderPath':_0x18edb9,'sourcePath':_0x128fb9});}else{if(!_0x4f5432?.['skipSegments']){const _0x315f90=parseSegmentYamlFile(_0x2b4163),_0x20bcab=normalizeChildSegmentYaml(_0x315f90);_0x44f86e[_0x4db2f6(0x1aa)]({'yamlConfig':_0x20bcab,'folderPath':_0x18edb9,'sourcePath':_0x128fb9});}}}return{'segments':_0x44f86e,'journeys':_0x175be3};}export function validateParsedFiles(_0x2b4ecb,_0x16e1aa){const _0x27f35e=a140_0x408869,_0x53d608=[];for(const {yamlConfig:_0x47ddde,sourcePath:_0x2f06a3}of _0x2b4ecb[_0x27f35e(0x241)]){const _0xc36b00=readFileSync(_0x2f06a3,_0x27f35e(0x1fd)),_0x105b44=a140_0x461fde['parseDocument'](_0xc36b00),_0x3e05e5=validateSegmentDef(_0x47ddde,{'source':_0xc36b00,'document':_0x105b44},{'skipSchema':!![]});if(!_0x3e05e5['valid']){const _0x44851a=a140_0x44127b[_0x27f35e(0x1e5)](_0x16e1aa,_0x2f06a3);_0x53d608[_0x27f35e(0x1aa)]({'filePath':_0x44851a,'source':_0xc36b00,'result':_0x3e05e5,'isJourney':![]});}}for(const {yamlConfig:_0x16b271,sourcePath:_0x2bfe37}of _0x2b4ecb[_0x27f35e(0x1f9)]){const _0x4670ae=readFileSync(_0x2bfe37,_0x27f35e(0x1fd)),_0x38d39a=a140_0x461fde['parseDocument'](_0x4670ae),_0x13fc84=validateJourneyDef(_0x16b271,{'source':_0x4670ae,'document':_0x38d39a},{'skipSchema':!![]});if(!_0x13fc84[_0x27f35e(0x1b2)]){const _0x49f057=a140_0x44127b[_0x27f35e(0x1e5)](_0x16e1aa,_0x2bfe37);_0x53d608['push']({'filePath':_0x49f057,'source':_0x4670ae,'result':_0x13fc84,'isJourney':!![]});}}return _0x53d608;}export function formatValidationErrors(_0x21ca1e){const _0xd92b1b=a140_0x408869,_0x142b69=[];for(const {filePath:_0x483395,source:_0x462df8,result:_0x36ce96,isJourney:_0x2b945a}of _0x21ca1e){const _0x4a4d17=_0x2b945a?_0xd92b1b(0x25f):_0xd92b1b(0x22d);_0x142b69[_0xd92b1b(0x1aa)]('\x0a'+_0x483395+'\x20('+_0x4a4d17+_0xd92b1b(0x203)+_0x36ce96[_0xd92b1b(0x1a6)]['length']+_0xd92b1b(0x25b)),_0x142b69[_0xd92b1b(0x1aa)](formatValidationResult(_0x36ce96,_0x462df8,_0x483395));}return _0x142b69[_0xd92b1b(0x1cc)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x370202){const _0x385f8a=a140_0x408869,_0x597ff7=new Set(),_0x429f2c=new Map(),_0x872cd6=collectSegmentUsageCounts(_0x370202);if(_0x370202['segments'])for(const [_0x59a085,_0x1b0c01]of Object[_0x385f8a(0x18f)](_0x370202[_0x385f8a(0x241)])){_0x597ff7[_0x385f8a(0x199)](_0x59a085);if(_0x1b0c01[_0x385f8a(0x219)]){const _0x3dec84=yamlRuleToApi(_0x1b0c01[_0x385f8a(0x219)]),_0x47ebd8=apiRuleToYaml(_0x3dec84);_0x429f2c[_0x385f8a(0x1f8)](_0x59a085,_0x47ebd8);}}const _0x15280e=new Map();let _0x5818bb=0x0;for(const [_0x10be46,_0x5b8537]of _0x429f2c){const _0x5ced2b=serializeExpandedRule(_0x5b8537,_0x429f2c),_0x24bbee=_0x15280e[_0x385f8a(0x1f1)](_0x5ced2b)||[];_0x24bbee[_0x385f8a(0x1aa)]({'name':_0x10be46,'index':_0x5818bb}),_0x15280e[_0x385f8a(0x1f8)](_0x5ced2b,_0x24bbee),_0x5818bb++;}const _0x3676c5=new Map();for(const [_0x3fb60f,_0x12f6bb]of _0x15280e){const _0xc041d6=_0x12f6bb[_0x385f8a(0x282)]()[_0x385f8a(0x191)]((_0x13cb74,_0x255ccf)=>{const _0x3f25f7=_0x385f8a,_0x732471=_0x872cd6[_0x3f25f7(0x1f1)](_0x13cb74['name'])||0x0,_0x4a0d38=_0x872cd6[_0x3f25f7(0x1f1)](_0x255ccf[_0x3f25f7(0x265)])||0x0;if(_0x732471!==_0x4a0d38)return _0x4a0d38-_0x732471;return _0x13cb74['index']-_0x255ccf[_0x3f25f7(0x202)];})['map'](_0x28b0ba=>_0x28b0ba[_0x385f8a(0x265)]),_0xa95e19=[];for(const _0x938472 of _0xc041d6){const _0x1b6836=_0x872cd6[_0x385f8a(0x1f1)](_0x938472)||0x0,_0x1225aa=Math[_0x385f8a(0x1db)](_0x1b6836,0x1);for(let _0x13466e=0x0;_0x13466e<_0x1225aa;_0x13466e++){_0xa95e19['push'](_0x938472);}}_0x3676c5[_0x385f8a(0x1f8)](_0x3fb60f,_0xa95e19);}return{'existingLocalSegmentNames':_0x597ff7,'localSegmentRules':_0x429f2c,'localExpandedRuleToNames':_0x3676c5};}export function createSegmentIdResolver(_0xc1b9fa,_0x261ebb){return async _0x2d2dca=>{const _0x431e95=a140_0x340f,_0x162e85=_0xc1b9fa[_0x431e95(0x1f1)](_0x2d2dca);if(!_0x162e85)throw new SDKError(ErrorCode[_0x431e95(0x214)],_0x431e95(0x27e)+_0x2d2dca+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x261ebb+'\x27)');return _0x162e85;};}function a140_0x54fe(){const _0x160728=['embedded_segment_created','find','activation_deleting','progress','__pending_act_','Activation\x20not\x20found:\x20','resolvedRule','Failed\x20to\x20fetch\x20referenced\x20segment\x20','nameToType','./journey-yaml.js','connection','createdSegmentId','digest','state','waitStep','Segment\x20not\x20found:\x20','journey_updating','length','activationParams','slice','listActivations','124194iMOnfQ','\x27\x20exit\x20criteria','action','keys','activation_updating','waitStepType','stages','yamlConfig','journeyBundleId','diff','JOURNEY_UPDATE_ERROR','parentId','entries','activationContext','sort','message','parse','localName','trim','journey_created','Stage\x20\x27','Entry\x20criteria:\x20','add','\x27\x20for\x20','embeddedSegmentNameToId','JOURNEY_SYNTAX_ERROR','SEGMENT_SYNTAX_ERROR','ACTIVATION_UPDATE_ERROR','kind','from','createJourneySegment','rootFolderId','flatMap','conditionSegmentId','hex','errors','verbose','1498440PMMyyT','logSuccess','push','segment_updated','size','Deleted\x20activation\x20\x27','getSegmentEntity\x20also\x20failed\x20for\x20','logInfo','Activation','folderPath','valid','effectiveFolderId','activation_','all_columns','delete','updateSegmentById','Creating\x20folder\x20\x27','behavior','folderPathToId','embedded_activation_created','draft','debug','attributes','replace','description','journeyActivationNameToId','decision_point','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','entry_criteria','2354648mCXpJJ','folder_creating','\x27\x20from\x20file:\x20','INTERNAL','goal','104987CeYqQy','user','join','\x0a\x20\x20','type','activation_deleted','Updated\x20activation\x20\x27','isArray','startsWith','Name\x20has\x20already\x20been\x20taken','segmentId','journeyById','journey_updated','14EJunFb','idToEmailMap','parentSegmentFolder','../../utils/async.js','max','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','split','\x20journey\x20from\x20file:\x20','createActivation','journeyId','goal\x20criteria','conditions','Created\x20folder\x20\x27','versionNumber','relative','parentFolder','connectionIdToNameMap','Updated\x20segment\x20\x27','create','has','onProgress','toISOString','130VnTTnN','deleted','getSegment','embedded_activation_creating','get','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','conditionTimeoutUnit','Created\x20activation\x20\x27','embedded_segment_creating','WaitStep','Failed\x20to\x20resolve\x20activation\x20','set','journeys','segment_deleting','Failed\x20to\x20','connector_config','utf-8','run_after_journey_refresh','with','segmentByFolderAndName','logWarning','index','):\x20','fetchJourney','toString','existingSegments','./child-segment-yaml.js','activation_creating','\x27\x20to\x20local\x20\x27','activations','journeyName','notification','journeyActivationStepId','deps','waitStepUnit','buildUserMaps','validatedRequest','createdSegmentIds','yamlActivation','SEGMENT_NOT_FOUND','NOT_FOUND','tdx.sdk.push-workflow','results','toLowerCase','rule','Duration','match','schedule','absolutePath','existingActivation','\x20segment\x20from\x20file:\x20','1329888QbhJuk','Deleting\x20activation\x20\x27','existingJourney','dirname','1559724CuWbhJ','segment_created','segment_updating','data','Condition','and\x20the\x20server\x20segment,\x20then\x20retry.','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','3Nfaxaa','stringify','segment','steps','entry','reduce','__pending_','\x27...','activationActions','updated','Deleted\x20segment\x20\x27','entryCriteria','Delete\x20the\x20push\x20recovery\x20file\x20(','segmentNameToId',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','10wpcYqA','Fetching\x20','idToName','list','ACTIVATION_SYNTAX_ERROR','journeyStages','\x27\x20by\x20rule\x20content','segments','getJourney','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','DecisionPoint','relationships','.$1.push-recovery.json','all','isNew','Matched\x20server\x20segment\x20\x27','logDeleted','unchanged','filter','Journey\x20\x27',').\x20','activation_template_id','update','conditionTimeoutDuration','stage\x20\x27','existingSegment','created','getActivation','\x20(referenced\x20in\x20journey\x20','resolveJourneyId','folderId','segmentFolderId','Updating\x20activation\x20\x27','\x20error(s)','some','99QKACnd','uniqueServerName','journey','191862KhbwGT','journeyBundleName','branches','Creating\x20segment\x20\x27','exitCriterias','name','withProgress','deleteSegment','map','createSegment','hasChanges','uniqueSegmentName','milestone','item','SEGMENT_UPDATE_ERROR'];a140_0x54fe=function(){return _0x160728;};return a140_0x54fe();}export function extractRootFolderId(_0x4f22e3){const _0x47a9c5=a140_0x408869;return _0x4f22e3[_0x47a9c5(0x245)]?.[_0x47a9c5(0x1d9)]?.['data']?.['id']||_0x4f22e3[_0x47a9c5(0x245)]?.[_0x47a9c5(0x1e6)]?.[_0x47a9c5(0x227)]?.['id'];}export function buildConnectionMaps(_0x5bd74d){const _0x5c9903=a140_0x408869,_0x553d89=new Map(),_0x67023d=new Map(),_0x3ec7a3=new Map();for(const _0x59ba8e of _0x5bd74d){_0x553d89['set'](_0x59ba8e[_0x5c9903(0x265)],parseInt(_0x59ba8e['id'],0xa)),_0x67023d[_0x5c9903(0x1f8)](_0x59ba8e['id'],_0x59ba8e['name']),_0x3ec7a3[_0x5c9903(0x1f8)](_0x59ba8e[_0x5c9903(0x265)],_0x59ba8e[_0x5c9903(0x1ce)]);}return{'nameToId':_0x553d89,'idToName':_0x67023d,'nameToType':_0x3ec7a3};}export function calculatePushStats(_0x4a23a6,_0x122cb1,_0x45df88,_0x2e8de1,_0x19707d,_0x5b9420,_0x3d9843){const _0x133d99=a140_0x408869,_0x4b12c0=_0x4a23a6[_0x133d99(0x24c)](_0x36370c=>_0x36370c[_0x133d99(0x248)]),_0x236323=_0x4a23a6[_0x133d99(0x24c)](_0x7d55b3=>!_0x7d55b3[_0x133d99(0x248)]&&_0x7d55b3['hasChanges']),_0x440a0a=_0x4a23a6[_0x133d99(0x24c)](_0xaf2fbc=>!_0xaf2fbc[_0x133d99(0x248)]&&!_0xaf2fbc['hasChanges']),_0x23c715=_0x5b9420?_0x2e8de1:[],_0x48c00b=_0x122cb1[_0x133d99(0x24c)](_0x3fcd43=>_0x3fcd43['isNew']),_0xbcd41a=_0x122cb1[_0x133d99(0x24c)](_0x33846d=>!_0x33846d[_0x133d99(0x248)]&&_0x33846d[_0x133d99(0x26a)]),_0x38599=_0x122cb1['filter'](_0x337ed5=>!_0x337ed5[_0x133d99(0x248)]&&!_0x337ed5[_0x133d99(0x26a)]),_0x2bce97=_0x5b9420?_0x19707d:[],_0x3232ad=_0x4a23a6[_0x133d99(0x1a3)](_0x21956b=>_0x21956b[_0x133d99(0x233)]),_0x35dab7=_0x3232ad[_0x133d99(0x24c)](_0x2de1ea=>_0x2de1ea[_0x133d99(0x1ce)]===_0x133d99(0x1e9)),_0x4603d7=_0x3232ad[_0x133d99(0x24c)](_0x428486=>_0x428486[_0x133d99(0x1ce)]==='update'),_0x48e700=_0x3232ad[_0x133d99(0x24c)](_0x5ec09c=>_0x5ec09c['type']===_0x133d99(0x1b6)),_0x26227c=Array[_0x133d99(0x1a0)](_0x45df88)[_0x133d99(0x191)](),_0xd1a20c=_0x3d9843?![]:_0x4b12c0['length']>0x0||_0x236323[_0x133d99(0x280)]>0x0||_0x23c715[_0x133d99(0x280)]>0x0,_0x362c1a=_0x48c00b[_0x133d99(0x280)]>0x0||_0xbcd41a[_0x133d99(0x280)]>0x0||_0x2bce97['length']>0x0,_0x26254d=_0x3d9843?![]:_0x3232ad['length']>0x0,_0x55a573=_0x26227c[_0x133d99(0x280)]>0x0;return{'segments':{'new':_0x4b12c0,'changed':_0x236323,'unchanged':_0x440a0a,'toDelete':_0x23c715},'journeys':{'new':_0x48c00b,'changed':_0xbcd41a,'unchanged':_0x38599,'toDelete':_0x2bce97},'activations':{'all':_0x3232ad,'toCreate':_0x35dab7,'toUpdate':_0x4603d7,'toDelete':_0x48e700},'folders':{'toCreate':_0x26227c},'counts':{'segments':{'new':_0x4b12c0[_0x133d99(0x280)],'changed':_0x236323['length'],'unchanged':_0x440a0a[_0x133d99(0x280)],'toDelete':_0x23c715[_0x133d99(0x280)]},'journeys':{'new':_0x48c00b[_0x133d99(0x280)],'changed':_0xbcd41a[_0x133d99(0x280)],'unchanged':_0x38599[_0x133d99(0x280)],'toDelete':_0x2bce97['length']},'activations':{'create':_0x35dab7[_0x133d99(0x280)],'update':_0x4603d7[_0x133d99(0x280)],'delete':_0x48e700[_0x133d99(0x280)]},'folders':_0x26227c['length']},'hasChanges':_0xd1a20c||_0x362c1a||_0x26254d||_0x55a573};}export async function buildPushExecutionContext(_0x13350d,_0x370804,_0x1550e7,_0x2cf5e0,_0x21581a,_0x33424c){const _0x467408=a140_0x408869,_0x3ba13a=extractRootFolderId(_0x1550e7),{pathToId:_0x26de1f,idToPath:_0x258e3c}=buildFolderMaps(_0x21581a),_0x24fdb9=buildSegmentNameToIdMap(_0x2cf5e0),_0x5988f6=new Map(),{batchAsync:_0x5a96a2}=await import(_0x467408(0x1da)),[_0x2fafc2,_0x8f6585]=await Promise[_0x467408(0x247)]([_0x13350d[_0x467408(0x1cb)][_0x467408(0x210)](),_0x13350d[_0x467408(0x279)][_0x467408(0x23d)](),((async()=>{const _0x2b21ef=_0x467408;!_0x33424c&&_0x2cf5e0[_0x2b21ef(0x280)]>0x0&&await _0x5a96a2(_0x2cf5e0,async _0x588564=>{const _0x16428f=_0x2b21ef,_0x58a967=await _0x13350d['segment'][_0x16428f(0x283)](_0x370804,_0x588564['id']);_0x5988f6[_0x16428f(0x1f8)](_0x588564['id'],_0x58a967);});})())]),{emailToId:_0x2e766b,idToEmail:_0x43df6a}=_0x2fafc2,_0x37b1de=buildConnectionMaps(_0x8f6585);return{'rootFolderId':_0x3ba13a,'folderPathToId':_0x26de1f,'folderIdToPath':_0x258e3c,'segmentNameToId':_0x24fdb9,'activationsBySegmentId':_0x5988f6,'emailToIdMap':_0x2e766b,'idToEmailMap':_0x43df6a,'connectionNameToIdMap':_0x37b1de['nameToId'],'connectionIdToNameMap':_0x37b1de[_0x467408(0x23c)],'connectionNameToTypeMap':_0x37b1de[_0x467408(0x277)]};}export function createPushYamlContextForBundle(_0x47dd27,_0x377fd5,_0x1b4711,_0x1aba2c,_0x39785b,_0x2fe1ad,_0x47d169,_0x30831a){const {existingLocalSegmentNames:_0x2e104c,localExpandedRuleToNames:_0x1484b7}=_0x1aba2c,_0x364e67=new Set(),_0x24171e=new Map(),_0x46f883=new Map(),_0x1d11a7=new Map(),_0x4c3fd5=createJumpTargetCache(),_0xe92fa=new Map(),_0x4c3d4b=new Map(),_0x13ce04=new Set();let _0x15ad85;const _0x12eb6c=_0x44fdb8=>{const _0xf865e9={'resolveSegment':async _0x375e9a=>{const _0x4df532=a140_0x340f,_0x253289=_0x1d11a7[_0x4df532(0x1f1)](_0x375e9a);if(_0x253289!==undefined)return{'name':_0x253289,'isJourneyLocal':!![]};try{const _0x37e0a0=await fetchSegment(_0x47dd27,_0x377fd5,_0x375e9a,_0x1b4711);if(!_0x37e0a0)throw new Error('Segment\x20not\x20found');const _0x13f8f6=generateJourneyLocalName(_0x37e0a0[_0x4df532(0x265)]),_0x5e166d=_0x37e0a0[_0x4df532(0x19f)]===SEGMENT_KIND_JOURNEY&&_0x13f8f6!==undefined;let _0x21f8fe=_0x37e0a0[_0x4df532(0x265)],_0x31845a;if(_0x5e166d&&_0x37e0a0[_0x4df532(0x219)]){const _0xafe54c=apiRuleToYaml(_0x37e0a0[_0x4df532(0x219)]);_0x4c3d4b['set'](_0x375e9a,_0xafe54c);const _0x2212c4=async _0xf2fcc1=>{const _0x3aa59b=_0x4df532,_0x2092a5=collectSegmentRefsFromRule(_0xf2fcc1);for(const _0x4167ca of _0x2092a5){if(!_0x4c3d4b[_0x3aa59b(0x1ea)](_0x4167ca))try{const _0x55f1f2=await fetchSegment(_0x47dd27,_0x377fd5,_0x4167ca,_0x1b4711);if(_0x55f1f2?.[_0x3aa59b(0x219)]){const _0x3a7e83=apiRuleToYaml(_0x55f1f2[_0x3aa59b(0x219)]);_0x4c3d4b[_0x3aa59b(0x1f8)](_0x4167ca,_0x3a7e83),await _0x2212c4(_0x3a7e83);}}catch(_0x19dc1e){logger['debug'](_0x3aa59b(0x276)+_0x4167ca+':\x20'+_0x19dc1e);}}};await _0x2212c4(_0xafe54c);const _0x3db902=serializeExpandedRule(_0xafe54c,_0x4c3d4b),_0x4a83a2=_0x1484b7[_0x4df532(0x1f1)](_0x3db902);if(_0x4a83a2&&_0x4a83a2['length']>0x0){const _0x163f4e=_0x24171e[_0x4df532(0x1f1)](_0x3db902)||0x0,_0x41f741=_0x4a83a2[_0x163f4e]||_0x4a83a2[_0x4a83a2[_0x4df532(0x280)]-0x1];_0x24171e['set'](_0x3db902,_0x163f4e+0x1),_0x21f8fe=_0x41f741,_0x364e67[_0x4df532(0x199)](_0x21f8fe),_0x1d11a7[_0x4df532(0x1f8)](_0x375e9a,_0x21f8fe);const _0x23fe60=await resolveRuleSegmentRefs(_0xafe54c,async _0x17287d=>{const _0x493ea8=_0x4df532,_0x2063af=_0x1d11a7[_0x493ea8(0x1f1)](_0x17287d);if(_0x2063af)return _0x2063af;const _0x3737a8=await _0x15ad85['resolveSegment'](_0x17287d);return _0x3737a8[_0x493ea8(0x265)];});_0x31845a={'description':_0x37e0a0[_0x4df532(0x1c0)],'rule':_0x23fe60};}else{const _0x345271=_0xe92fa[_0x4df532(0x1f1)](_0x3db902);if(_0x345271)_0x21f8fe=_0x345271,_0x1d11a7[_0x4df532(0x1f8)](_0x375e9a,_0x21f8fe);else{if(_0x13f8f6){let _0x9db22c=_0x13f8f6,_0x4f1bd6=0x2;while(_0x364e67[_0x4df532(0x1ea)](_0x9db22c)||_0x2e104c[_0x4df532(0x1ea)](_0x9db22c)){_0x9db22c=_0x13f8f6+'_'+_0x4f1bd6,_0x4f1bd6++;}_0x364e67['add'](_0x9db22c),_0x21f8fe=_0x9db22c;}_0x1d11a7[_0x4df532(0x1f8)](_0x375e9a,_0x21f8fe),_0xe92fa['set'](_0x3db902,_0x21f8fe);const _0x2525d5=await resolveRuleSegmentRefs(_0xafe54c,async _0x6be67e=>{const _0xc0cde6=_0x4df532,_0x366823=_0x1d11a7[_0xc0cde6(0x1f1)](_0x6be67e);if(_0x366823)return _0x366823;const _0x2bb36b=await _0x15ad85['resolveSegment'](_0x6be67e);return _0x2bb36b[_0xc0cde6(0x265)];});_0x31845a={'description':_0x37e0a0['description'],'rule':_0x2525d5};}}}return{'name':_0x21f8fe,'isJourneyLocal':_0x5e166d,'definition':_0x31845a};}catch(_0xdc4d5e){return logger[_0x4df532(0x1bd)]('Failed\x20to\x20resolve\x20segment\x20'+_0x375e9a+':\x20'+_0xdc4d5e),{'name':_0x375e9a,'isJourneyLocal':![]};}},'resolveActivation':async _0x52487d=>{const _0x2aeb05=a140_0x340f,_0x6f6974=_0x46f883['get'](_0x52487d);if(_0x6f6974!==undefined)return{'name':_0x6f6974,'isJourneyLocal':!![]};try{let _0x5c0234=_0x47d169?.[_0x2aeb05(0x1f1)](_0x52487d);!_0x5c0234&&(_0x5c0234=await _0x47dd27[_0x2aeb05(0x25f)][_0x2aeb05(0x255)](_0x44fdb8,_0x52487d));const _0x7ceac6=_0x5c0234[_0x2aeb05(0x1be)][_0x2aeb05(0x281)][_0x2aeb05(0x265)]||_0x52487d,_0x319e66=sanitizeYamlKey(_0x7ceac6)||_0x2aeb05(0x1b4)+_0x52487d,_0x98f7dd=_0x319e66;_0x46f883[_0x2aeb05(0x1f8)](_0x52487d,_0x98f7dd);const _0x3365bc=journeyActivationStepToYaml(_0x5c0234,_0x39785b,_0x2fe1ad);return{'name':_0x98f7dd,'isJourneyLocal':!![],'definition':_0x3365bc};}catch(_0xe666af){return logger['debug'](_0x2aeb05(0x1f7)+_0x52487d+':\x20'+_0xe666af),{'name':_0x52487d,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x2575b2,_0x5ebbd7)=>resolveJumpTarget(_0x2575b2,_0x5ebbd7,_0x4c3fd5,async _0x4de4a2=>{const _0x25c8af=a140_0x340f,_0x2ecca1=_0x30831a?.['get'](_0x4de4a2);if(_0x2ecca1)return _0x2ecca1;return _0x47dd27[_0x25c8af(0x25f)][_0x25c8af(0x242)](_0x4de4a2);})};return _0x15ad85=_0xf865e9,_0xf865e9;},_0x3cd1fb=async _0xb32686=>{const _0x1f9131=a140_0x340f,{collectSegmentIdsFromJourneyApi:_0xb09066}=await import(_0x1f9131(0x278)),{batchAsync:_0x42f35f}=await import(_0x1f9131(0x1da)),_0x7ba163=new Set();for(const _0x58619f of _0xb32686){let _0x5daddc=_0x30831a?.[_0x1f9131(0x1f1)](_0x58619f);!_0x5daddc&&(_0x5daddc=await _0x47dd27[_0x1f9131(0x25f)][_0x1f9131(0x242)](_0x58619f));const _0x2bd285=_0xb09066(_0x5daddc);for(const _0x3a0574 of _0x2bd285){_0x7ba163[_0x1f9131(0x199)](_0x3a0574);}}let _0x20fd80=Array[_0x1f9131(0x1a0)](_0x7ba163);while(_0x20fd80[_0x1f9131(0x280)]>0x0){const _0x3970d0=_0x20fd80[_0x1f9131(0x24c)](_0x22da42=>!_0x13ce04['has'](_0x22da42));if(_0x3970d0['length']===0x0)break;const _0x188f14=await _0x42f35f(_0x3970d0,async _0x131e45=>{const _0x57ba8d=_0x1f9131;_0x13ce04[_0x57ba8d(0x199)](_0x131e45);const _0x5770c0=await fetchSegment(_0x47dd27,_0x377fd5,_0x131e45,_0x1b4711);if(!_0x5770c0)return null;return{'segmentId':_0x131e45,'segment':_0x5770c0};},0xa),_0x2657bd=new Set();for(const _0x256dc1 of _0x188f14){if(!_0x256dc1?.[_0x1f9131(0x22d)]?.['rule'])continue;const _0x1ff6eb=apiRuleToYaml(_0x256dc1[_0x1f9131(0x22d)][_0x1f9131(0x219)]);_0x4c3d4b[_0x1f9131(0x1f8)](_0x256dc1[_0x1f9131(0x1d4)],_0x1ff6eb);const _0x557af2=collectSegmentRefsFromRule(_0x1ff6eb);for(const _0x3be995 of _0x557af2){!_0x13ce04[_0x1f9131(0x1ea)](_0x3be995)&&_0x2657bd[_0x1f9131(0x199)](_0x3be995);}}_0x20fd80=Array[_0x1f9131(0x1a0)](_0x2657bd);}};return{'createYamlContext':_0x12eb6c,'prefetchJourneySegments':_0x3cd1fb};}export async function executePushSegments(_0x1f6af0,_0x40888d,_0xfecb41,_0x31cbe1,_0x40bd2e){const _0x1341ab=a140_0x408869,{segmentDefToCreateRequest:_0x2826f9,segmentDefToUpdateRequest:_0x1c9ff7}=await import(_0x1341ab(0x207)),_0x15692c=_0xfecb41[_0x1341ab(0x1ba)],_0x3b32ab=0x5,_0x587ba4=async _0x1d02a3=>{const _0x3f4437=_0x1341ab,_0x57b804=_0x1d02a3['folderPath']?_0x15692c[_0x3f4437(0x1f1)](_0x1d02a3[_0x3f4437(0x1b1)]):undefined;let _0x562e94;const _0x296e9c={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x681bf5=_0x1d02a3['yamlConfig'];if(_0x1d02a3[_0x3f4437(0x18a)]['rule']){const _0x133690=createSegmentIdResolver(_0xfecb41[_0x3f4437(0x238)],_0x1d02a3['yamlConfig'][_0x3f4437(0x265)]),_0x4b43af=await resolveRuleSegmentIds(_0x1d02a3['yamlConfig']['rule'],_0x133690);_0x681bf5={..._0x1d02a3[_0x3f4437(0x18a)],'rule':_0x4b43af};}try{if(_0x1d02a3['isNew']){_0x40bd2e[_0x3f4437(0x1eb)]?.({'type':'segment_creating','name':_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]});const _0x2b927e=_0x2826f9(_0x681bf5,_0x57b804),_0x54b829=await _0x40bd2e[_0x3f4437(0x266)](_0x3f4437(0x263)+_0x1d02a3[_0x3f4437(0x18a)]['name']+_0x3f4437(0x232),()=>_0x1f6af0[_0x3f4437(0x22d)][_0x3f4437(0x269)](_0x31cbe1['parentId'],_0x2b927e));_0x562e94=_0x54b829[_0x3f4437(0x227)]['id'],_0xfecb41[_0x3f4437(0x238)][_0x3f4437(0x1f8)](_0x1d02a3['yamlConfig'][_0x3f4437(0x265)],_0x562e94),_0x296e9c['createdSegmentId']={'name':_0x1d02a3[_0x3f4437(0x18a)]['name'],'id':_0x562e94},_0x40bd2e['onProgress']?.({'type':_0x3f4437(0x225),'name':_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)],'segmentId':_0x562e94}),_0x40bd2e[_0x3f4437(0x1a9)]?.('Created\x20segment\x20\x27'+_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]+'\x27'),_0x296e9c['created']=0x1;}else{if(_0x1d02a3[_0x3f4437(0x26a)]){_0x40bd2e[_0x3f4437(0x1eb)]?.({'type':_0x3f4437(0x226),'name':_0x1d02a3[_0x3f4437(0x18a)]['name']});const _0x59f4b2=_0x1c9ff7(_0x681bf5);_0x57b804!==_0x1d02a3['existingSegment']?.['segmentFolderId']&&(_0x59f4b2[_0x3f4437(0x259)]=_0x57b804?parseInt(_0x57b804,0xa):undefined),await _0x40bd2e['withProgress']('Updating\x20segment\x20\x27'+_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]+'\x27...',()=>_0x1f6af0[_0x3f4437(0x22d)][_0x3f4437(0x1b7)](_0x31cbe1[_0x3f4437(0x18e)],_0x1d02a3[_0x3f4437(0x253)]['id'],_0x59f4b2)),_0x562e94=_0x1d02a3[_0x3f4437(0x253)]['id'],_0x40bd2e['onProgress']?.({'type':_0x3f4437(0x1ab),'name':_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]}),_0x40bd2e[_0x3f4437(0x1a9)]?.(_0x3f4437(0x1e8)+_0x1d02a3[_0x3f4437(0x18a)]['name']+'\x27'),_0x296e9c['updated']=0x1;}else _0x562e94=_0x1d02a3[_0x3f4437(0x253)]['id'];}}catch(_0x5cbbe6){const _0x27abc8=isHttp400Error(_0x5cbbe6),_0x35669c=_0x27abc8?ErrorCode[_0x3f4437(0x19d)]:ErrorCode[_0x3f4437(0x26e)],_0x45a969=getErrorMessage(_0x5cbbe6);throw new SDKError(_0x35669c,_0x3f4437(0x1fb)+(_0x1d02a3[_0x3f4437(0x248)]?_0x3f4437(0x1e9):_0x3f4437(0x250))+_0x3f4437(0x21f)+_0x1d02a3[_0x3f4437(0x21d)]+'\x0a\x20\x20'+_0x45a969,_0x5cbbe6);}try{const _0x2ceca6=await syncActivationsForSegment(_0x1f6af0,_0x31cbe1[_0x3f4437(0x18e)],_0x562e94,_0x1d02a3['yamlConfig'][_0x3f4437(0x265)],_0x1d02a3[_0x3f4437(0x233)],_0x40bd2e,_0x1d02a3[_0x3f4437(0x21d)]);_0x296e9c['activations']=_0x2ceca6;}catch(_0x27a017){if(_0x27a017 instanceof SDKError)throw _0x27a017;throw new SDKError(ErrorCode[_0x3f4437(0x19e)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]+_0x3f4437(0x1c7)+_0x1d02a3['absolutePath']+_0x3f4437(0x1cd)+getErrorMessage(_0x27a017),_0x27a017);}return _0x296e9c;},_0x95e10=await batchAsync(_0x40888d,_0x587ba4,_0x3b32ab),_0x5bed67={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x70a8f2 of _0x95e10){_0x5bed67[_0x1341ab(0x254)]+=_0x70a8f2['created'],_0x5bed67[_0x1341ab(0x234)]+=_0x70a8f2[_0x1341ab(0x234)],_0x70a8f2[_0x1341ab(0x27a)]&&_0x5bed67[_0x1341ab(0x212)]['set'](_0x70a8f2[_0x1341ab(0x27a)]['name'],_0x70a8f2[_0x1341ab(0x27a)]['id']),_0x5bed67[_0x1341ab(0x20a)][_0x1341ab(0x254)]+=_0x70a8f2[_0x1341ab(0x20a)][_0x1341ab(0x254)],_0x5bed67[_0x1341ab(0x20a)]['updated']+=_0x70a8f2['activations'][_0x1341ab(0x234)],_0x5bed67[_0x1341ab(0x20a)][_0x1341ab(0x1ee)]+=_0x70a8f2[_0x1341ab(0x20a)][_0x1341ab(0x1ee)];}return _0x5bed67;}async function syncActivationsForSegment(_0x563221,_0x4d6ca5,_0x2822c7,_0x40dd26,_0x38fd40,_0x5a4c29,_0x286021){const _0x1f0bf6=a140_0x408869,_0x118579={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x1858cc of _0x38fd40){try{if(_0x1858cc[_0x1f0bf6(0x1ce)]===_0x1f0bf6(0x1e9)&&_0x1858cc[_0x1f0bf6(0x211)])_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':_0x1f0bf6(0x208),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),await _0x5a4c29[_0x1f0bf6(0x266)]('Creating\x20activation\x20\x27'+_0x1858cc[_0x1f0bf6(0x265)]+_0x1f0bf6(0x232),()=>_0x563221[_0x1f0bf6(0x22d)][_0x1f0bf6(0x1df)](_0x4d6ca5,_0x2822c7,_0x1858cc[_0x1f0bf6(0x211)])),_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':'activation_created','segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),_0x5a4c29[_0x1f0bf6(0x1a9)]?.(_0x1f0bf6(0x1f4)+_0x1858cc[_0x1f0bf6(0x265)]+'\x27'),_0x118579[_0x1f0bf6(0x254)]++;else{if(_0x1858cc['type']===_0x1f0bf6(0x250)&&_0x1858cc['validatedRequest']&&_0x1858cc[_0x1f0bf6(0x21e)])_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':_0x1f0bf6(0x288),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),await _0x5a4c29[_0x1f0bf6(0x266)](_0x1f0bf6(0x25a)+_0x1858cc[_0x1f0bf6(0x265)]+_0x1f0bf6(0x232),()=>_0x563221[_0x1f0bf6(0x22d)]['updateActivation'](_0x4d6ca5,_0x2822c7,_0x1858cc[_0x1f0bf6(0x21e)]['id'],_0x1858cc[_0x1f0bf6(0x211)])),_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':'activation_updated','segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),_0x5a4c29[_0x1f0bf6(0x1a9)]?.(_0x1f0bf6(0x1d0)+_0x1858cc[_0x1f0bf6(0x265)]+'\x27'),_0x118579['updated']++;else _0x1858cc[_0x1f0bf6(0x1ce)]===_0x1f0bf6(0x1b6)&&_0x1858cc[_0x1f0bf6(0x21e)]&&(_0x5a4c29['onProgress']?.({'type':_0x1f0bf6(0x271),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),await _0x5a4c29[_0x1f0bf6(0x266)](_0x1f0bf6(0x221)+_0x1858cc['name']+_0x1f0bf6(0x232),()=>_0x563221[_0x1f0bf6(0x22d)]['deleteActivation'](_0x4d6ca5,_0x2822c7,_0x1858cc[_0x1f0bf6(0x21e)]['id'])),_0x5a4c29['onProgress']?.({'type':_0x1f0bf6(0x1cf),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),_0x5a4c29[_0x1f0bf6(0x24a)]?.(_0x1f0bf6(0x1ad)+_0x1858cc['name']+'\x27'),_0x118579[_0x1f0bf6(0x1ee)]++);}}catch(_0xb256e8){const _0x483a83=isHttp400Error(_0xb256e8),_0x3afd7e=_0x483a83?ErrorCode[_0x1f0bf6(0x23e)]:ErrorCode[_0x1f0bf6(0x19e)],_0x2f5b07=getErrorMessage(_0xb256e8);throw new SDKError(_0x3afd7e,_0x1f0bf6(0x1fb)+_0x1858cc[_0x1f0bf6(0x1ce)]+'\x20activation\x20\x27'+_0x1858cc[_0x1f0bf6(0x265)]+'\x27\x20from\x20file:\x20'+_0x286021+_0x1f0bf6(0x1cd)+_0x2f5b07,_0xb256e8);}}return _0x118579;}export async function executePushFolders(_0x1dbb2e,_0x356c40,_0x39ec12,_0x23fbe8,_0x1aea2e){const _0x23e19a=a140_0x408869,_0x39644a=new Map(_0x39ec12),_0x206623=sortFoldersByDepth(_0x356c40);for(const _0x913e35 of _0x206623){const _0x1d6b37=_0x913e35['split']('/'),_0x4ad058=_0x1d6b37[_0x1d6b37[_0x23e19a(0x280)]-0x1],_0x188028=_0x1d6b37[_0x23e19a(0x282)](0x0,-0x1)[_0x23e19a(0x1cc)]('/'),_0x38ffda=_0x39644a[_0x23e19a(0x1f1)](_0x188028);_0x1aea2e[_0x23e19a(0x1eb)]?.({'type':_0x23e19a(0x1c6),'folder':_0x913e35});const _0xd09ef7={'name':_0x4ad058,'parentFolderId':_0x38ffda},_0x3b6e5f=await _0x1aea2e[_0x23e19a(0x266)](_0x23e19a(0x1b8)+_0x913e35+'\x27...',()=>_0x1dbb2e[_0x23e19a(0x22d)]['createFolder'](_0x23fbe8[_0x23e19a(0x18e)],_0xd09ef7));_0x39644a[_0x23e19a(0x1f8)](_0x913e35,_0x3b6e5f[_0x23e19a(0x227)]['id']),_0x1aea2e[_0x23e19a(0x1eb)]?.({'type':'folder_created','folder':_0x913e35,'folderId':_0x3b6e5f[_0x23e19a(0x227)]['id']}),_0x1aea2e[_0x23e19a(0x1af)]?.(_0x23e19a(0x1e3)+_0x913e35+'\x27');}return _0x39644a;}export async function executePushSegmentDeletions(_0x11e9a1,_0x4469ab,_0x587784){const _0x491345=a140_0x408869;if(_0x4469ab['length']===0x0)return 0x0;const {batchAsync:_0x7ae665}=await import(_0x491345(0x1da)),_0x5cf9c4=0x5,_0x300fd8=await _0x7ae665(_0x4469ab,async _0x45f676=>{const _0x1b344d=_0x491345;return _0x587784[_0x1b344d(0x1eb)]?.({'type':_0x1b344d(0x1fa),'name':_0x45f676[_0x1b344d(0x265)]}),await _0x11e9a1[_0x1b344d(0x22d)][_0x1b344d(0x267)](_0x45f676['id']),_0x587784[_0x1b344d(0x1eb)]?.({'type':'segment_deleted','name':_0x45f676[_0x1b344d(0x265)]}),_0x587784[_0x1b344d(0x24a)]?.(_0x1b344d(0x235)+_0x45f676[_0x1b344d(0x265)]+'\x27'),0x1;},_0x5cf9c4);return _0x300fd8[_0x491345(0x230)]((_0x4ee36a,_0x24139f)=>_0x4ee36a+_0x24139f,0x0);}export async function executePushJourneys(_0x53f96f,_0x98857,_0x7bfe4b,_0xe60785,_0x1d3570){const _0x4bcce7=a140_0x408869,{journeyDefToRequest:_0x406a68}=await import(_0x4bcce7(0x278)),{activationDefToCreateRequest:_0x2a8deb,yamlRuleToApi:_0x201a79,validateSegmentRule:_0x978db0}=await import('./child-segment-yaml.js'),_0x37c19f={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x1788fc=new Map(_0x7bfe4b[_0x4bcce7(0x238)]),_0x5adce3=0x5;for(let _0x1c2e5f=0x0;_0x1c2e5f<_0x98857['length'];_0x1c2e5f+=_0x5adce3){const _0x248d67=_0x98857[_0x4bcce7(0x282)](_0x1c2e5f,_0x1c2e5f+_0x5adce3),_0x3f2010=await Promise[_0x4bcce7(0x247)](_0x248d67['map'](async _0x4df9be=>{const _0x2892df=_0x4bcce7;if(!_0x4df9be[_0x2892df(0x248)]&&!_0x4df9be['hasChanges'])return{'action':_0x2892df(0x24b),'name':_0x4df9be['yamlConfig']['name'],'journeyId':_0x4df9be['existingJourney']?.['id']};const _0x111101=_0x4df9be[_0x2892df(0x1b1)]?_0x7bfe4b[_0x2892df(0x1ba)][_0x2892df(0x1f1)](_0x4df9be[_0x2892df(0x1b1)]):undefined;_0x1d3570[_0x2892df(0x1eb)]?.({'type':_0x4df9be[_0x2892df(0x248)]?'journey_creating':_0x2892df(0x27f),'name':_0x4df9be[_0x2892df(0x18a)]['name']});try{const _0x51b2b0=await executeSingleJourneyPush(_0x53f96f,_0x4df9be,{..._0x7bfe4b,'segmentNameToId':_0x1788fc},{'parentId':_0xe60785[_0x2892df(0x18e)],'rootFolderId':_0xe60785[_0x2892df(0x1a2)],'folderId':_0x111101,'verbose':_0xe60785[_0x2892df(0x1a7)]},_0x1d3570,{'journeyDefToRequest':_0x406a68,'activationDefToCreateRequest':_0x2a8deb,'yamlRuleToApi':_0x201a79,'validateSegmentRule':_0x978db0});for(const [_0x4ee8ca,_0x42421d]of _0x51b2b0[_0x2892df(0x19b)]){_0x1788fc[_0x2892df(0x1f8)](_0x4ee8ca,_0x42421d),_0x37c19f[_0x2892df(0x19b)][_0x2892df(0x1f8)](_0x4ee8ca,_0x42421d);}if(_0x51b2b0[_0x2892df(0x286)]===_0x2892df(0x254))_0x1d3570[_0x2892df(0x1eb)]?.({'type':_0x2892df(0x196),'name':_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)],'journeyId':_0x51b2b0[_0x2892df(0x1e0)]}),_0x1d3570['logSuccess']?.('Created\x20journey\x20\x27'+_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)]+'\x27'),_0x37c19f[_0x2892df(0x254)]++;else _0x51b2b0[_0x2892df(0x286)]==='updated'&&(_0x1d3570['onProgress']?.({'type':_0x2892df(0x1d6),'name':_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)]}),_0x1d3570['logSuccess']?.('Updated\x20journey\x20\x27'+_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)]+'\x27'),_0x37c19f[_0x2892df(0x234)]++);return{'action':_0x51b2b0[_0x2892df(0x286)],'name':_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)],'journeyId':_0x51b2b0['journeyId']};}catch(_0x1fa63f){const _0x720db9=isHttp400Error(_0x1fa63f),_0x59998e=_0x720db9?ErrorCode[_0x2892df(0x19c)]:ErrorCode[_0x2892df(0x18d)],_0x482df9=getErrorMessage(_0x1fa63f);throw new SDKError(_0x59998e,_0x2892df(0x1fb)+(_0x4df9be['isNew']?_0x2892df(0x1e9):_0x2892df(0x250))+_0x2892df(0x1de)+_0x4df9be[_0x2892df(0x21d)]+'\x0a\x20\x20'+_0x482df9,_0x1fa63f);}}));_0x37c19f[_0x4bcce7(0x217)][_0x4bcce7(0x1aa)](..._0x3f2010);}return _0x37c19f;}async function matchExistingJourneySegments(_0x178bb2,_0x203c17,_0x63c686,_0x204d13,_0x30e0d1){const _0x385cd0=a140_0x408869;if(!_0x203c17[_0x385cd0(0x222)]||!_0x203c17[_0x385cd0(0x18a)][_0x385cd0(0x241)])return;const _0x168f36=new Map(),_0xe12648=new Set();for(const _0x258762 of Object[_0x385cd0(0x287)](_0x203c17[_0x385cd0(0x18a)]['segments'])){const _0x21dec9=generateDeterministicJourneySegmentName(_0x203c17[_0x385cd0(0x18a)]['name'],_0x258762);_0x168f36['set'](_0x21dec9,_0x258762),_0xe12648['add'](_0x258762);}const _0x3de9de=[],_0xb3226f=collectSegmentIdsFromJourneyApi(_0x203c17[_0x385cd0(0x222)]);for(const _0x96f902 of _0xb3226f){const _0x386731=await fetchSegment(_0x178bb2,_0x63c686,_0x96f902,_0x204d13);if(!_0x386731?.[_0x385cd0(0x265)])continue;const _0x52a452=_0x168f36[_0x385cd0(0x1f1)](_0x386731[_0x385cd0(0x265)]);_0x52a452?(_0x30e0d1[_0x385cd0(0x1f8)](_0x52a452,_0x96f902),_0xe12648['delete'](_0x52a452)):_0x3de9de[_0x385cd0(0x1aa)]({'id':_0x96f902,'seg':_0x386731});}if(_0xe12648['size']>0x0&&_0x3de9de[_0x385cd0(0x280)]>0x0){const {localExpandedRuleToNames:_0x3ee8cb}=buildLocalExpandedRuleMappings(_0x203c17[_0x385cd0(0x18a)]),_0x3fcec5=new Map();for(const {id:_0x4ff6ed,seg:_0x376fad}of _0x3de9de){if(_0x376fad[_0x385cd0(0x219)]){const _0x2427b4=apiRuleToYaml(_0x376fad['rule']);_0x3fcec5[_0x385cd0(0x1f8)](_0x4ff6ed,_0x2427b4);}}for(const {id:_0x2562f8,seg:_0x1cb87}of _0x3de9de){if(!_0x1cb87[_0x385cd0(0x219)])continue;const _0x1c9dfe=_0x3fcec5[_0x385cd0(0x1f1)](_0x2562f8);if(!_0x1c9dfe)continue;const _0xf88970=serializeExpandedRule(_0x1c9dfe,_0x3fcec5),_0x391291=_0x3ee8cb[_0x385cd0(0x1f1)](_0xf88970);if(_0x391291){const _0x18939a=_0x391291[_0x385cd0(0x270)](_0x18ddb2=>_0xe12648[_0x385cd0(0x1ea)](_0x18ddb2));_0x18939a&&(_0x30e0d1[_0x385cd0(0x1f8)](_0x18939a,_0x2562f8),_0xe12648[_0x385cd0(0x1b6)](_0x18939a),logger[_0x385cd0(0x1bd)](_0x385cd0(0x249)+_0x1cb87[_0x385cd0(0x265)]+_0x385cd0(0x209)+_0x18939a+_0x385cd0(0x240)));}}}}async function executeSingleJourneyPush(_0x6c2d50,_0x356a50,_0x22625,_0x37ef34,_0x11d977,_0x492d71){const _0x3beeb2=a140_0x408869,{journeyDefToRequest:_0xcccd3f,activationDefToCreateRequest:_0x1195d0,yamlRuleToApi:_0xd1193,validateSegmentRule:_0x567ef5}=_0x492d71,_0x30d5b0=new Map(),_0x329c25=new Map();recoverSegmentIdsFromPushRecovery(_0x356a50,_0x30d5b0,_0x22625['segmentNameToId']);const _0x51be36=new Map(),_0x1e78c8=new Map(),_0x20954d=new Map();let _0x180623;const _0x44e03f=async()=>{const _0x50be51=a140_0x340f;if(_0x180623)return;_0x180623=new Map();if(!_0x356a50['existingJourney'])return;const _0x371896=await _0x6c2d50['journey'][_0x50be51(0x283)](_0x356a50[_0x50be51(0x222)]['id']);for(const _0x14887f of _0x371896){const _0x2c2937=journeyActivationStepToYaml(_0x14887f,_0x22625[_0x50be51(0x1d8)],_0x22625[_0x50be51(0x1e7)]),_0x3aa355=activationSignature(_0x2c2937);!_0x180623[_0x50be51(0x1ea)](_0x3aa355)&&_0x180623[_0x50be51(0x1f8)](_0x3aa355,_0x14887f['id']),_0x2c2937[_0x50be51(0x265)]&&_0x329c25[_0x50be51(0x1f8)](_0x2c2937[_0x50be51(0x265)],_0x14887f['id']);}};await matchExistingJourneySegments(_0x6c2d50,_0x356a50,_0x37ef34[_0x3beeb2(0x18e)],_0x22625['existingSegments'],_0x22625[_0x3beeb2(0x238)]);const _0x3719b8={'resolveSegmentId':async _0xbc2e44=>{const _0x5c39e6=_0x3beeb2,_0x5ab49f=_0x22625[_0x5c39e6(0x238)]['get'](_0xbc2e44);if(!_0x5ab49f)throw new SDKError(ErrorCode[_0x5c39e6(0x214)],_0x5c39e6(0x27e)+_0xbc2e44+_0x5c39e6(0x256)+_0x356a50[_0x5c39e6(0x18a)][_0x5c39e6(0x265)]+')');return _0x5ab49f;},'resolveEmbeddedSegmentId':async(_0x5b39de,_0x1ac163)=>{const _0x40b815=_0x3beeb2,_0x32d1e3=_0x22625[_0x40b815(0x238)]['get'](_0x5b39de);if(_0x32d1e3)return _0x32d1e3;const _0x147761=_0x22625[_0x40b815(0x206)][_0x40b815(0x270)](_0x1580f3=>_0x1580f3[_0x40b815(0x265)]===_0x5b39de);if(_0x147761)return _0x22625['segmentNameToId'][_0x40b815(0x1f8)](_0x5b39de,_0x147761['id']),_0x147761['id'];if(_0x356a50['isNew']){const {stageName:_0x1ddf74,criteriaName:_0x28f2db}=findSegmentCriteriaLocation(_0x356a50[_0x40b815(0x18a)],_0x5b39de);return _0x567ef5(_0x5b39de,_0x1ac163[_0x40b815(0x219)]),_0x1e78c8[_0x40b815(0x1f8)](_0x5b39de,{'definition':_0x1ac163,'stageName':_0x1ddf74,'criteriaName':_0x28f2db}),createPendingSegmentId(_0x5b39de);}const _0x262dde=_0x356a50['existingJourney']?.['id'];if(!_0x262dde)throw new SDKError(ErrorCode[_0x40b815(0x1c8)],_0x40b815(0x22a));const _0x4cbc99=_0x51be36['get'](_0x5b39de);if(_0x4cbc99)return _0x4cbc99;const _0xaa1a60=((async()=>{const _0x4695d0=_0x40b815;_0x567ef5(_0x5b39de,_0x1ac163[_0x4695d0(0x219)]);const _0x2251eb=generateDeterministicJourneySegmentName(_0x356a50[_0x4695d0(0x18a)][_0x4695d0(0x265)],_0x5b39de),_0x520ef7=_0x22625['existingSegments'][_0x4695d0(0x270)](_0x2a677d=>_0x2a677d[_0x4695d0(0x265)]===_0x2251eb),_0x6a7594=createSegmentIdResolver(_0x22625['segmentNameToId'],_0x5b39de),_0x5cc1a5=await resolveRuleSegmentIds(_0x1ac163[_0x4695d0(0x219)],_0x6a7594);let _0x1d266c;return _0x520ef7?(await _0x6c2d50[_0x4695d0(0x22d)][_0x4695d0(0x1b7)](_0x37ef34['parentId'],_0x520ef7['id'],{'description':_0x1ac163[_0x4695d0(0x1c0)]||_0x4695d0(0x198)+_0x5b39de,'rule':_0xd1193(_0x5cc1a5,!![]),'countPopulation':!![]}),_0x1d266c=_0x520ef7['id'],saveSegmentToPushRecovery(_0x356a50['absolutePath'],_0x356a50[_0x4695d0(0x18a)][_0x4695d0(0x265)],_0x5b39de,{'segmentId':_0x1d266c,'uniqueServerName':_0x2251eb,'createdAt':new Date()[_0x4695d0(0x1ec)]()})):_0x1d266c=await createOrRecoverEmbeddedSegment(_0x6c2d50,_0x356a50,{'localName':_0x5b39de,'uniqueSegmentName':_0x2251eb,'description':_0x1ac163[_0x4695d0(0x1c0)]||_0x4695d0(0x198)+_0x5b39de,'journeyId':_0x262dde,'resolvedRule':_0x5cc1a5,'parentId':_0x37ef34[_0x4695d0(0x18e)],'folderId':_0x37ef34[_0x4695d0(0x1a2)]||''},_0xd1193),_0x22625[_0x4695d0(0x238)][_0x4695d0(0x1f8)](_0x5b39de,_0x1d266c),_0x30d5b0['set'](_0x5b39de,_0x1d266c),_0x1d266c;})());_0x51be36['set'](_0x5b39de,_0xaa1a60);try{return await _0xaa1a60;}finally{_0x51be36[_0x40b815(0x1b6)](_0x5b39de);}},'resolveActivationId':async _0x480e88=>{const _0x3af41b=_0x3beeb2,_0x17784a=_0x329c25[_0x3af41b(0x1f1)](_0x480e88);if(_0x17784a)return _0x17784a;if(_0x356a50[_0x3af41b(0x222)]){await _0x44e03f();const _0x4d4e4c=_0x329c25['get'](_0x480e88);if(_0x4d4e4c)return _0x4d4e4c;}throw new SDKError(ErrorCode[_0x3af41b(0x215)],_0x3af41b(0x274)+_0x480e88+_0x3af41b(0x256)+_0x356a50[_0x3af41b(0x18a)][_0x3af41b(0x265)]+_0x3af41b(0x24e)+_0x3af41b(0x1c3));},'resolveEmbeddedActivationId':async(_0x2df774,_0x4700e5)=>{const _0x2e4edd=_0x3beeb2,_0x44cda1=_0x329c25[_0x2e4edd(0x1f1)](_0x2df774);if(_0x44cda1)return _0x44cda1;if(_0x356a50['isNew'])return _0x20954d[_0x2e4edd(0x1f8)](_0x2df774,_0x4700e5),createPendingActivationId(_0x2df774);if(_0x356a50[_0x2e4edd(0x222)]){await _0x44e03f();const _0x5c3d09=_0x329c25[_0x2e4edd(0x1f1)](_0x4700e5[_0x2e4edd(0x265)]);if(_0x5c3d09)return _0x329c25[_0x2e4edd(0x1f8)](_0x2df774,_0x5c3d09),_0x5c3d09;const _0x5ad202=activationSignature(_0x4700e5),_0x32b66d=_0x180623?.[_0x2e4edd(0x1f1)](_0x5ad202);if(_0x32b66d)return _0x329c25[_0x2e4edd(0x1f8)](_0x2df774,_0x32b66d),_0x32b66d;const _0x4a3dda=await _0x1195d0(_0x4700e5,_0x22625[_0x2e4edd(0x190)]),_0x102be5={..._0x4a3dda,..._0x4700e5['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x4700e5[_0x2e4edd(0x1fe)]}},_0x580e03=await _0x6c2d50['journey'][_0x2e4edd(0x1df)](_0x356a50['existingJourney']['id'],_0x102be5);return _0x329c25[_0x2e4edd(0x1f8)](_0x2df774,_0x580e03['id']),_0x580e03['id'];}throw new SDKError(ErrorCode[_0x2e4edd(0x1c8)],_0x2e4edd(0x243));},'resolveJourneyId':async _0x42a532=>{const _0x5c6ba7=_0x3beeb2;try{return await _0x6c2d50[_0x5c6ba7(0x25f)][_0x5c6ba7(0x257)](_0x37ef34[_0x5c6ba7(0x18e)],_0x42a532);}catch(_0x35a065){throw new SDKError(ErrorCode[_0x5c6ba7(0x215)],_0x5c6ba7(0x24d)+_0x42a532+_0x5c6ba7(0x1f2)+_0x356a50[_0x5c6ba7(0x18a)][_0x5c6ba7(0x265)]+'\x27)',_0x35a065);}},'resolveStageId':async(_0x3bac24,_0x4934fa)=>{const _0x24b0ec=_0x3beeb2,_0x55d206=await _0x6c2d50[_0x24b0ec(0x25f)][_0x24b0ec(0x242)](_0x3bac24),_0x1ab2dd=_0x55d206['attributes'][_0x24b0ec(0x23f)]['find'](_0x49893c=>_0x49893c['name'][_0x24b0ec(0x218)]()===_0x4934fa['toLowerCase']());if(!_0x1ab2dd?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x24b0ec(0x197)+_0x4934fa+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x55d206['attributes'][_0x24b0ec(0x261)]||_0x55d206[_0x24b0ec(0x1be)][_0x24b0ec(0x265)])+'\x27');return _0x1ab2dd['id'];}},_0x19d9ec=await _0xcccd3f(_0x356a50[_0x3beeb2(0x18a)],_0x37ef34[_0x3beeb2(0x18e)],_0x3719b8),_0x90030=_0x37ef34[_0x3beeb2(0x258)]||_0x37ef34[_0x3beeb2(0x1a2)];_0x90030&&(_0x19d9ec[_0x3beeb2(0x245)]={'parentFolder':{'data':{'id':_0x90030,'type':'folder'}}});if(_0x356a50[_0x3beeb2(0x248)]){if(_0x1e78c8['size']>0x0||_0x20954d[_0x3beeb2(0x1ac)]>0x0)return await executeThreeStepJourneyCreate(_0x6c2d50,_0x356a50,_0x19d9ec,{'pendingEmbeddedSegments':_0x1e78c8,'pendingEmbeddedActivations':_0x20954d,'embeddedSegmentNameToId':_0x30d5b0,'journeyActivationNameToId':_0x329c25},{..._0x37ef34,'effectiveFolderId':_0x90030},_0x22625,_0x11d977,_0x492d71);else{ensureJourneyDefaults(_0x19d9ec[_0x3beeb2(0x1be)]);const _0x4e77c7=await _0x6c2d50[_0x3beeb2(0x25f)]['create'](_0x19d9ec);return deletePushRecovery(_0x356a50[_0x3beeb2(0x21d)]),{'action':'created','journeyId':_0x4e77c7['id'],'embeddedSegmentNameToId':_0x30d5b0};}}else{if(_0x356a50[_0x3beeb2(0x26a)]&&_0x356a50[_0x3beeb2(0x222)]){_0x19d9ec['id']=_0x356a50[_0x3beeb2(0x222)]['id'];const _0x4e14c4=_0x19d9ec[_0x3beeb2(0x1be)];_0x356a50[_0x3beeb2(0x222)][_0x3beeb2(0x1be)]?.['journeyBundleName']&&(_0x4e14c4['journeyBundleName']=_0x356a50[_0x3beeb2(0x222)]['attributes']['journeyBundleName']);const _0x38f82d=_0x356a50[_0x3beeb2(0x222)][_0x3beeb2(0x1be)]?.['journeyStages'];return _0x38f82d&&_0x19d9ec['attributes'][_0x3beeb2(0x23f)]&&injectExistingStageIds(_0x19d9ec[_0x3beeb2(0x1be)]['journeyStages'],_0x38f82d),ensureJourneyDefaults(_0x4e14c4),await _0x6c2d50[_0x3beeb2(0x25f)]['update'](_0x356a50[_0x3beeb2(0x222)]['id'],_0x19d9ec),deletePushRecovery(_0x356a50['absolutePath']),{'action':_0x3beeb2(0x234),'journeyId':_0x356a50[_0x3beeb2(0x222)]['id'],'embeddedSegmentNameToId':_0x30d5b0};}}return deletePushRecovery(_0x356a50[_0x3beeb2(0x21d)]),{'action':_0x3beeb2(0x24b),'journeyId':_0x356a50[_0x3beeb2(0x222)]?.['id'],'embeddedSegmentNameToId':_0x30d5b0};}function findSegmentCriteriaLocation(_0x32c88c,_0x597482){const _0x448f9a=a140_0x408869,_0x573101=_0x32c88c[_0x448f9a(0x189)]||_0x32c88c[_0x448f9a(0x1f9)]?.[0x0]?.['stages']||[];let _0x52e8a8=_0x448f9a(0x22f),_0x4ab4a9=_0x597482;const _0x29ee1c=_0x32c88c[_0x448f9a(0x1c9)]||_0x32c88c[_0x448f9a(0x1f9)]?.[0x0]?.[_0x448f9a(0x1c9)];if(_0x29ee1c?.[_0x448f9a(0x22d)]===_0x597482)return{'stageName':_0x448f9a(0x1c9),'criteriaName':_0x29ee1c[_0x448f9a(0x265)]||_0x597482};_0x1b6a7e:for(const _0x4ec997 of _0x573101){if(_0x4ec997[_0x448f9a(0x1c4)]?.[_0x448f9a(0x22d)]===_0x597482){_0x52e8a8=_0x4ec997['name'],_0x4ab4a9=_0x4ec997[_0x448f9a(0x1c4)]['name']||_0x597482;break;}if(_0x4ec997[_0x448f9a(0x22e)])for(const _0x350bbb of _0x4ec997[_0x448f9a(0x22e)]){if(_0x350bbb['type']===_0x448f9a(0x1c2)&&_0x350bbb[_0x448f9a(0x1ff)]?.[_0x448f9a(0x262)])for(const _0x1f14e2 of _0x350bbb[_0x448f9a(0x1ff)]['branches']){if(_0x1f14e2[_0x448f9a(0x22d)]===_0x597482){_0x52e8a8=_0x4ec997[_0x448f9a(0x265)],_0x4ab4a9=_0x1f14e2['name']||_0x597482;break _0x1b6a7e;}}}}return{'stageName':_0x52e8a8,'criteriaName':_0x4ab4a9};}async function executeThreeStepJourneyCreate(_0x516d40,_0x15ecca,_0xf4c361,_0x644561,_0x21c672,_0x3b156d,_0x509632,_0x1ba0e8){const _0x3df28d=a140_0x408869,{activationDefToCreateRequest:_0x5a0d13,yamlRuleToApi:_0x2d79a7}=_0x1ba0e8,{pendingEmbeddedSegments:_0x790465,pendingEmbeddedActivations:_0x3b5b72,embeddedSegmentNameToId:_0xe264f8}=_0x644561,_0xcc8d05=JSON['parse'](JSON[_0x3df28d(0x22c)](_0xf4c361));ensureJourneyDefaults(_0xcc8d05[_0x3df28d(0x1be)]),stripPendingIds(_0xcc8d05);const _0x8b34b3=await _0x516d40[_0x3df28d(0x25f)][_0x3df28d(0x1e9)](_0xcc8d05),_0x19f135=_0x8b34b3['id'],_0x2bd27f=new Map();for(const _0x371c6a of _0x8b34b3[_0x3df28d(0x1be)][_0x3df28d(0x23f)]){_0x2bd27f[_0x3df28d(0x1f8)](_0x371c6a[_0x3df28d(0x265)]['toLowerCase'](),_0x371c6a['id']);}recoverSegmentIdsFromPushRecovery(_0x15ecca,_0xe264f8,_0x3b156d[_0x3df28d(0x238)]);for(const [_0x51cc34,{definition:_0x51b668}]of _0x790465){if(_0xe264f8[_0x3df28d(0x1ea)](_0x51cc34)){_0x509632['onProgress']?.({'type':_0x3df28d(0x26f),'journeyName':_0x15ecca['yamlConfig'][_0x3df28d(0x265)],'segmentName':_0x51cc34});continue;}const _0x36c4eb=generateDeterministicJourneySegmentName(_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],_0x51cc34);_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x1f5),'journeyName':_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],'segmentName':_0x51cc34});const _0x4e75e2=createSegmentIdResolver(_0x3b156d[_0x3df28d(0x238)],_0x51cc34),_0x5db16c=await resolveRuleSegmentIds(_0x51b668['rule'],_0x4e75e2),_0x4f3a43=await createOrRecoverEmbeddedSegment(_0x516d40,_0x15ecca,{'localName':_0x51cc34,'uniqueSegmentName':_0x36c4eb,'description':_0x51b668['description']||_0x3df28d(0x198)+_0x51cc34,'journeyId':_0x19f135,'resolvedRule':_0x5db16c,'parentId':_0x21c672[_0x3df28d(0x18e)],'folderId':_0x21c672[_0x3df28d(0x1b3)]||''},_0x2d79a7);_0xe264f8[_0x3df28d(0x1f8)](_0x51cc34,_0x4f3a43),_0x3b156d[_0x3df28d(0x238)]['set'](_0x51cc34,_0x4f3a43),_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x26f),'journeyName':_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],'segmentName':_0x51cc34});}const _0x500cd5=new Map();for(const [_0x308730,_0x5c4737]of _0x3b5b72){_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x1f0),'journeyName':_0x15ecca['yamlConfig'][_0x3df28d(0x265)],'activationName':_0x308730});const _0x13cc7a=await _0x5a0d13(_0x5c4737,_0x3b156d['activationContext']),_0xe24842={..._0x13cc7a,..._0x5c4737[_0x3df28d(0x1fe)]!==undefined&&{'runAfterJourneyRefresh':_0x5c4737[_0x3df28d(0x1fe)]}},_0x414e2e=await _0x516d40[_0x3df28d(0x25f)][_0x3df28d(0x1df)](_0x19f135,_0xe24842);_0x500cd5[_0x3df28d(0x1f8)](_0x308730,_0x414e2e['id']),_0x644561[_0x3df28d(0x1c1)][_0x3df28d(0x1f8)](_0x308730,_0x414e2e['id']),_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x1bb),'journeyName':_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],'activationName':_0x308730});}const _0x4134d3=JSON[_0x3df28d(0x193)](JSON[_0x3df28d(0x22c)](_0xf4c361));return _0x4134d3['id']=_0x19f135,ensureJourneyDefaults(_0x4134d3[_0x3df28d(0x1be)]),resolvePendingIdsInRequest(_0x4134d3,_0xf4c361,_0x2bd27f,_0xe264f8,_0x500cd5,_0x509632),await _0x516d40[_0x3df28d(0x25f)]['update'](_0x19f135,_0x4134d3),deletePushRecovery(_0x15ecca[_0x3df28d(0x21d)]),{'action':'created','journeyId':_0x19f135,'embeddedSegmentNameToId':_0xe264f8};}export function stripWaitStepPendingIds(_0x4f2400){const _0x5f2293=a140_0x408869,_0x47fd40=_0x4f2400[_0x5f2293(0x1a4)]&&isPendingSegmentId(_0x4f2400[_0x5f2293(0x1a4)]),_0x6b8b70=_0x4f2400['conditions']?.[_0x5f2293(0x25c)](_0x5e4dd8=>_0x5e4dd8['segmentId']&&isPendingSegmentId(_0x5e4dd8[_0x5f2293(0x1d4)]));(_0x47fd40||_0x6b8b70)&&(_0x4f2400[_0x5f2293(0x188)]=_0x5f2293(0x21a),_0x4f2400[_0x5f2293(0x27d)]=0x1,_0x4f2400[_0x5f2293(0x20f)]='day',delete _0x4f2400[_0x5f2293(0x1a4)],delete _0x4f2400['conditionTimeoutDuration'],delete _0x4f2400['conditionTimeoutUnit'],delete _0x4f2400[_0x5f2293(0x1e2)]);}export function resolveWaitStepPendingIds(_0x246975,_0x2f68c9,_0x2170de,_0x1db65e){const _0x23784f=a140_0x408869;if(_0x2f68c9[_0x23784f(0x1a4)]&&isPendingSegmentId(_0x2f68c9[_0x23784f(0x1a4)])){const _0x32ae1b=_0x2170de(_0x2f68c9[_0x23784f(0x1a4)],_0x23784f(0x252)+_0x1db65e+'\x27\x20wait\x20condition');_0x32ae1b&&(_0x246975['waitStepType']=_0x23784f(0x228),_0x246975[_0x23784f(0x1a4)]=_0x32ae1b,delete _0x246975[_0x23784f(0x27d)],delete _0x246975['waitStepUnit'],_0x2f68c9[_0x23784f(0x251)]!==undefined&&(_0x246975['conditionTimeoutDuration']=_0x2f68c9[_0x23784f(0x251)]),_0x2f68c9[_0x23784f(0x1f3)]&&(_0x246975[_0x23784f(0x1f3)]=_0x2f68c9[_0x23784f(0x1f3)]));}if(_0x2f68c9[_0x23784f(0x1e2)]){const _0x40c99c=_0x2f68c9[_0x23784f(0x1e2)][_0x23784f(0x25c)](_0xbad740=>_0xbad740['segmentId']&&isPendingSegmentId(_0xbad740[_0x23784f(0x1d4)]));if(_0x40c99c){const _0x42084f=_0x2f68c9[_0x23784f(0x1e2)][_0x23784f(0x268)](_0x1d79c5=>{const _0xf8132f=_0x23784f;if(_0x1d79c5[_0xf8132f(0x1d4)]&&isPendingSegmentId(_0x1d79c5[_0xf8132f(0x1d4)])){const _0x5f0d01=_0x2170de(_0x1d79c5['segmentId'],'stage\x20\x27'+_0x1db65e+'\x27\x20wait\x20condition');return{..._0x1d79c5,'segmentId':_0x5f0d01||_0x1d79c5[_0xf8132f(0x1d4)]};}return{..._0x1d79c5};});_0x246975[_0x23784f(0x188)]=_0x23784f(0x228),_0x246975['conditions']=_0x42084f,delete _0x246975[_0x23784f(0x27d)],delete _0x246975[_0x23784f(0x20f)],delete _0x246975[_0x23784f(0x1a4)],delete _0x246975[_0x23784f(0x251)],delete _0x246975[_0x23784f(0x1f3)];}}}function stripPendingIds(_0x3ecba5){const _0xa5609d=a140_0x408869;_0x3ecba5[_0xa5609d(0x1be)][_0xa5609d(0x1c9)]?.['segmentId']&&isPendingSegmentId(_0x3ecba5[_0xa5609d(0x1be)]['goal'][_0xa5609d(0x1d4)])&&delete _0x3ecba5[_0xa5609d(0x1be)][_0xa5609d(0x1c9)];for(const _0xb096 of _0x3ecba5[_0xa5609d(0x1be)][_0xa5609d(0x23f)]||[]){_0xb096[_0xa5609d(0x236)]?.[_0xa5609d(0x1d4)]&&isPendingSegmentId(_0xb096[_0xa5609d(0x236)][_0xa5609d(0x1d4)])&&delete _0xb096[_0xa5609d(0x236)];_0xb096[_0xa5609d(0x26c)]?.[_0xa5609d(0x1d4)]&&isPendingSegmentId(_0xb096[_0xa5609d(0x26c)]['segmentId'])&&delete _0xb096[_0xa5609d(0x26c)];_0xb096[_0xa5609d(0x264)]&&(_0xb096['exitCriterias']=_0xb096[_0xa5609d(0x264)][_0xa5609d(0x24c)](_0x1b95f3=>!_0x1b95f3[_0xa5609d(0x1d4)]||!isPendingSegmentId(_0x1b95f3['segmentId'])));if(_0xb096['steps'])for(const _0x291938 of Object['keys'](_0xb096[_0xa5609d(0x22e)])){const _0xca55c4=_0xb096[_0xa5609d(0x22e)][_0x291938];_0xca55c4[_0xa5609d(0x1ce)]==='Activation'&&_0xca55c4['journeyActivationStepId']&&isPendingActivationId(_0xca55c4[_0xa5609d(0x20d)])&&(_0xca55c4[_0xa5609d(0x20d)]='');if(_0xca55c4[_0xa5609d(0x1ce)]===_0xa5609d(0x244)&&_0xca55c4[_0xa5609d(0x262)])for(const _0x51f503 of _0xca55c4['branches']){_0x51f503[_0xa5609d(0x1d4)]&&isPendingSegmentId(_0x51f503[_0xa5609d(0x1d4)])&&(_0x51f503[_0xa5609d(0x1d4)]='');}_0xca55c4[_0xa5609d(0x1ce)]==='WaitStep'&&stripWaitStepPendingIds(_0xca55c4);}}}function resolvePendingIdsInRequest(_0x96d80b,_0x156990,_0x3b22b1,_0x493c50,_0x5e4ff9,_0x2a8465){const _0xa582bb=a140_0x408869,_0x5b8938=(_0x3047da,_0x5d77d5)=>{const _0x593dd1=a140_0x340f;if(!isPendingSegmentId(_0x3047da))return _0x3047da;const _0x6b540f=extractPendingSegmentName(_0x3047da),_0x4c548c=_0x493c50[_0x593dd1(0x1f1)](_0x6b540f);return!_0x4c548c&&_0x2a8465[_0x593dd1(0x201)]?.(_0x593dd1(0x1dc)+_0x6b540f+_0x593dd1(0x19a)+_0x5d77d5),_0x4c548c;};if(_0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x1c9)]?.['segmentId']&&isPendingSegmentId(_0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x1c9)]['segmentId'])){const _0x5c1aec=_0x5b8938(_0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x1c9)][_0xa582bb(0x1d4)],_0xa582bb(0x1e1));_0x5c1aec&&(_0x96d80b[_0xa582bb(0x1be)]['goal']['segmentId']=_0x5c1aec);}for(const _0x3637a9 of _0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x23f)]||[]){const _0x15ddf6=_0x3b22b1[_0xa582bb(0x1f1)](_0x3637a9[_0xa582bb(0x265)]['toLowerCase']());_0x15ddf6&&(_0x3637a9['id']=_0x15ddf6);if(_0x3637a9[_0xa582bb(0x236)]?.['segmentId']&&isPendingSegmentId(_0x3637a9[_0xa582bb(0x236)][_0xa582bb(0x1d4)])){const _0x3eab86=_0x5b8938(_0x3637a9[_0xa582bb(0x236)][_0xa582bb(0x1d4)],_0xa582bb(0x252)+_0x3637a9[_0xa582bb(0x265)]+'\x27\x20entry\x20criteria');_0x3eab86&&(_0x3637a9[_0xa582bb(0x236)][_0xa582bb(0x1d4)]=_0x3eab86);}if(_0x3637a9['exitCriterias'])for(const _0xb9e928 of _0x3637a9[_0xa582bb(0x264)]){if(_0xb9e928[_0xa582bb(0x1d4)]&&isPendingSegmentId(_0xb9e928[_0xa582bb(0x1d4)])){const _0x18f333=_0x5b8938(_0xb9e928[_0xa582bb(0x1d4)],_0xa582bb(0x252)+_0x3637a9[_0xa582bb(0x265)]+_0xa582bb(0x285));_0x18f333&&(_0xb9e928[_0xa582bb(0x1d4)]=_0x18f333);}}if(_0x3637a9[_0xa582bb(0x26c)]?.['segmentId']&&isPendingSegmentId(_0x3637a9[_0xa582bb(0x26c)]['segmentId'])){const _0x2f8d6e=_0x5b8938(_0x3637a9['milestone'][_0xa582bb(0x1d4)],'stage\x20\x27'+_0x3637a9['name']+'\x27\x20milestone');_0x2f8d6e&&(_0x3637a9[_0xa582bb(0x26c)][_0xa582bb(0x1d4)]=_0x2f8d6e);}if(_0x3637a9[_0xa582bb(0x22e)]){const _0x53d6f9=_0x2e0c2d=>_0x156990[_0xa582bb(0x1be)]['journeyStages']?.[_0xa582bb(0x270)](_0x1c58e1=>_0x1c58e1[_0xa582bb(0x265)][_0xa582bb(0x218)]()===_0x3637a9['name']['toLowerCase']())?.[_0xa582bb(0x22e)]?.[_0x2e0c2d];for(const _0x1a407c of Object[_0xa582bb(0x287)](_0x3637a9[_0xa582bb(0x22e)])){const _0x151848=_0x3637a9['steps'][_0x1a407c],_0x3e6843=_0x53d6f9(_0x1a407c);if(_0x151848[_0xa582bb(0x1ce)]===_0xa582bb(0x1b0)&&_0x151848[_0xa582bb(0x20d)]&&(isPendingActivationId(_0x151848[_0xa582bb(0x20d)])||_0x151848[_0xa582bb(0x20d)]==='')){if(_0x3e6843?.[_0xa582bb(0x20d)]&&isPendingActivationId(_0x3e6843[_0xa582bb(0x20d)])){const _0x38def3=extractPendingActivationName(_0x3e6843[_0xa582bb(0x20d)]),_0x57c868=_0x5e4ff9[_0xa582bb(0x1f1)](_0x38def3);_0x57c868&&(_0x151848['journeyActivationStepId']=_0x57c868);}}if(_0x151848[_0xa582bb(0x1ce)]==='DecisionPoint'&&_0x151848[_0xa582bb(0x262)]&&_0x3e6843?.[_0xa582bb(0x262)])for(let _0x19d50f=0x0;_0x19d50f<_0x151848[_0xa582bb(0x262)][_0xa582bb(0x280)];_0x19d50f++){const _0x475209=_0x151848['branches'][_0x19d50f],_0x1e4f4e=_0x3e6843[_0xa582bb(0x262)][_0x19d50f];if(_0x1e4f4e?.[_0xa582bb(0x1d4)]&&isPendingSegmentId(_0x1e4f4e[_0xa582bb(0x1d4)])){const _0x4d93e6=_0x5b8938(_0x1e4f4e[_0xa582bb(0x1d4)],_0xa582bb(0x252)+_0x3637a9[_0xa582bb(0x265)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x475209[_0xa582bb(0x265)]||_0x19d50f)+'\x27');_0x4d93e6&&(_0x475209[_0xa582bb(0x1d4)]=_0x4d93e6);}}_0x151848[_0xa582bb(0x1ce)]===_0xa582bb(0x1f6)&&_0x3e6843?.['type']===_0xa582bb(0x1f6)&&resolveWaitStepPendingIds(_0x151848,_0x3e6843,_0x5b8938,_0x3637a9[_0xa582bb(0x265)]);}}}}
1
+ const a140_0x2d1abb=a140_0x4f0a;(function(_0x17d107,_0x5ac681){const _0x4314b4=a140_0x4f0a,_0x25fd71=_0x17d107();while(!![]){try{const _0x2aba09=parseInt(_0x4314b4(0x15c))/0x1*(-parseInt(_0x4314b4(0x19b))/0x2)+parseInt(_0x4314b4(0x154))/0x3+-parseInt(_0x4314b4(0x1b7))/0x4*(-parseInt(_0x4314b4(0x1e5))/0x5)+-parseInt(_0x4314b4(0x1c0))/0x6+parseInt(_0x4314b4(0x235))/0x7+-parseInt(_0x4314b4(0x1b4))/0x8+parseInt(_0x4314b4(0x1ee))/0x9*(-parseInt(_0x4314b4(0x166))/0xa);if(_0x2aba09===_0x5ac681)break;else _0x25fd71['push'](_0x25fd71['shift']());}catch(_0x1cba8f){_0x25fd71['push'](_0x25fd71['shift']());}}}(a140_0x51ab,0x2310b));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');function a140_0x4f0a(_0x19048e,_0x1c740a){_0x19048e=_0x19048e-0x14b;const _0x51ab77=a140_0x51ab();let _0x4f0aac=_0x51ab77[_0x19048e];return _0x4f0aac;}export const PENDING_SEGMENT_PREFIX=a140_0x2d1abb(0x217);export const PENDING_ACTIVATION_PREFIX=a140_0x2d1abb(0x1e9);export function createPendingSegmentId(_0x4cb505){return''+PENDING_SEGMENT_PREFIX+_0x4cb505+'__';}export function isPendingSegmentId(_0x39ef9f){return _0x39ef9f['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x39ef9f['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x34aeed){const _0x42d5af=a140_0x2d1abb;return _0x34aeed[_0x42d5af(0x180)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4c8225){return''+PENDING_ACTIVATION_PREFIX+_0x4c8225+'__';}export function isPendingActivationId(_0x21c8fc){return _0x21c8fc['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x3100f6){const _0x24e634=a140_0x2d1abb;return _0x3100f6[_0x24e634(0x180)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x5cc3b6,_0x316c71){const _0x4f4fa0=a140_0x2d1abb,_0x291c9f=_0x5cc3b6+'::'+(_0x316c71['trim']()||_0x4f4fa0(0x150)),_0x4dfc3f=createHash(_0x4f4fa0(0x14b))[_0x4f4fa0(0x1db)](_0x291c9f)['digest'](_0x4f4fa0(0x1af))[_0x4f4fa0(0x17d)](0x0,0xc);return _0x4f4fa0(0x1c2)+_0x4dfc3f;}export function ensureJourneyDefaults(_0x2a7855){const _0x2a838f=a140_0x2d1abb;!_0x2a7855[_0x2a838f(0x170)]&&(_0x2a7855[_0x2a838f(0x170)]=''),!_0x2a7855[_0x2a838f(0x1e3)]&&(_0x2a7855[_0x2a838f(0x1e3)]='draft');}export function injectExistingStageIds(_0x51ce3b,_0x48eede){const _0x2f1873=a140_0x2d1abb,_0x1d9f5c=new Map(_0x48eede[_0x2f1873(0x1d7)](_0x37f3d1=>[_0x37f3d1[_0x2f1873(0x1d5)],_0x37f3d1['id']]));for(const _0xf76242 of _0x51ce3b){if(!_0xf76242['id']){const _0x1110a6=_0x1d9f5c[_0x2f1873(0x160)](_0xf76242[_0x2f1873(0x1d5)]);_0x1110a6&&(_0xf76242['id']=_0x1110a6);}}}export function resolveTDFolderPath(_0x337673,_0x2a7ba1,_0x26a0c8){const _0x3a1f70=a140_0x2d1abb;if(!_0x2a7ba1)return _0x337673;if(_0x337673===_0x26a0c8||_0x337673[_0x3a1f70(0x19a)](_0x26a0c8+'/'))return _0x337673;return _0x337673?_0x26a0c8+'/'+_0x337673:_0x26a0c8;}export function addFoldersToCreate(_0x1f3986,_0xba9299,_0x29e754){const _0x3649ab=a140_0x2d1abb;if(!_0x1f3986)return;if(_0xba9299['has'](_0x1f3986))return;const _0x1b8226=_0x1f3986[_0x3649ab(0x1b0)]('/');let _0xbcb191='';for(const _0xac21a5 of _0x1b8226){_0xbcb191=_0xbcb191?_0xbcb191+'/'+_0xac21a5:_0xac21a5,!_0xba9299[_0x3649ab(0x1aa)](_0xbcb191)&&_0x29e754[_0x3649ab(0x1c7)](_0xbcb191);}}export function sortFoldersByDepth(_0x3a1ff4){const _0x3b4b33=a140_0x2d1abb;return[..._0x3a1ff4][_0x3b4b33(0x176)]((_0x441ade,_0x2783fe)=>{const _0x16744e=_0x3b4b33,_0x1b81b3=(_0x441ade[_0x16744e(0x22a)](/\//g)||[])[_0x16744e(0x1b5)],_0x41dbf3=(_0x2783fe[_0x16744e(0x22a)](/\//g)||[])[_0x16744e(0x1b5)];return _0x1b81b3-_0x41dbf3;});}import*as a140_0x399a39 from'yaml';import{readFileSync}from'fs';import a140_0x41e71e from'path';import{isJourneyDef,parseYamlString as a140_0x10dfcc,toYamlString as a140_0x5cd287,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(_0x29f385){const _0x44d552=a140_0x2d1abb;if(Array[_0x44d552(0x189)](_0x29f385))return'['+_0x29f385[_0x44d552(0x1d7)](_0x60d66c=>stableStringify(_0x60d66c))[_0x44d552(0x181)](',')+']';if(_0x29f385&&typeof _0x29f385===_0x44d552(0x234)){const _0x275046=_0x29f385,_0x1256dc=Object[_0x44d552(0x244)](_0x275046)[_0x44d552(0x176)](),_0x9ddc4=_0x1256dc[_0x44d552(0x1d7)](_0x243f21=>'\x22'+_0x243f21+'\x22:'+stableStringify(_0x275046[_0x243f21]));return'{'+_0x9ddc4['join'](',')+'}';}const _0x3ecf2e=JSON[_0x44d552(0x21f)](_0x29f385);return _0x3ecf2e===undefined?_0x44d552(0x212):_0x3ecf2e;}function activationSignature(_0x56272d){const _0x161b3a=a140_0x2d1abb,_0x29d988={'connection':_0x56272d[_0x161b3a(0x161)],..._0x56272d['all_columns']!==undefined&&{'all_columns':_0x56272d[_0x161b3a(0x186)]},..._0x56272d[_0x161b3a(0x15e)]!==undefined&&{'columns':_0x56272d[_0x161b3a(0x15e)]},..._0x56272d[_0x161b3a(0x184)]!==undefined&&{'behavior':_0x56272d[_0x161b3a(0x184)]},..._0x56272d[_0x161b3a(0x1ec)]!==undefined&&{'schedule':_0x56272d[_0x161b3a(0x1ec)]},..._0x56272d[_0x161b3a(0x1e4)]!==undefined&&{'notification':_0x56272d[_0x161b3a(0x1e4)]},..._0x56272d[_0x161b3a(0x1a8)]!==undefined&&{'connector_config':_0x56272d[_0x161b3a(0x1a8)]},..._0x56272d[_0x161b3a(0x1b8)]!==undefined&&{'activation_template_id':_0x56272d[_0x161b3a(0x1b8)]}};return stableStringify(_0x29d988);}async function fetchSegment(_0x42c57d,_0x265668,_0x561329,_0x12c67b){const _0x1f3517=a140_0x2d1abb,_0x125e07=_0x12c67b?.[_0x1f3517(0x1ba)](_0x347d45=>_0x347d45['id']===_0x561329);if(_0x125e07)return _0x125e07;try{return await _0x42c57d[_0x1f3517(0x150)][_0x1f3517(0x1cd)](_0x265668,_0x561329);}catch(_0x10f2de){logger[_0x1f3517(0x1ab)](_0x1f3517(0x1da)+_0x561329+_0x1f3517(0x216)+_0x10f2de);try{return await _0x42c57d[_0x1f3517(0x150)][_0x1f3517(0x1ae)](_0x561329);}catch(_0x34435a){return logger[_0x1f3517(0x1ab)](_0x1f3517(0x207)+_0x561329+':\x20'+_0x34435a),null;}}}function recoverSegmentIdsFromPushRecovery(_0x51272c,_0x5314ef,_0x46fb7f){const _0x400571=a140_0x2d1abb,_0x3293e0=readPushRecovery(_0x51272c[_0x400571(0x238)]);if(_0x3293e0?.[_0x400571(0x17a)]===_0x51272c['yamlConfig']['name'])for(const [_0x540d29,_0x5b6164]of Object['entries'](_0x3293e0['segments'])){const _0x1892df=generateDeterministicJourneySegmentName(_0x51272c['yamlConfig'][_0x400571(0x1d5)],_0x540d29);_0x5b6164[_0x400571(0x1bb)]===_0x1892df&&(_0x5314ef['set'](_0x540d29,_0x5b6164[_0x400571(0x231)]),_0x46fb7f[_0x400571(0x1cf)](_0x540d29,_0x5b6164[_0x400571(0x231)]));}}async function createOrRecoverEmbeddedSegment(_0x3711a1,_0x3e2524,_0x3882f1,_0x321a42){const _0xe4877d=a140_0x2d1abb;let _0x55f49c;try{_0x55f49c=await _0x3711a1[_0xe4877d(0x150)]['createJourneySegment']({'name':_0x3882f1[_0xe4877d(0x215)],'description':_0x3882f1[_0xe4877d(0x170)],'journeyId':_0x3882f1[_0xe4877d(0x1fe)],'rule':_0x321a42(_0x3882f1[_0xe4877d(0x204)],!![]),'countPopulation':!![],'parentFolderId':_0x3882f1[_0xe4877d(0x174)],'audienceId':_0x3882f1[_0xe4877d(0x1c5)]});}catch(_0x2d98da){const _0x22162d=_0x2d98da instanceof Error&&_0x2d98da[_0xe4877d(0x1b1)][_0xe4877d(0x1a4)]('Name\x20has\x20already\x20been\x20taken');if(_0x22162d){const _0x23f125=readPushRecovery(_0x3e2524[_0xe4877d(0x238)]),_0x56ec50=_0x23f125?.[_0xe4877d(0x17a)]===_0x3e2524[_0xe4877d(0x165)]['name']?_0x23f125[_0xe4877d(0x1c8)][_0x3882f1['localName']]:undefined;if(_0x56ec50?.[_0xe4877d(0x1bb)]===_0x3882f1['uniqueSegmentName'])await _0x3711a1['segment']['updateSegmentById'](_0x3882f1[_0xe4877d(0x1c5)],_0x56ec50[_0xe4877d(0x231)],{'description':_0x3882f1[_0xe4877d(0x170)],'rule':_0x321a42(_0x3882f1[_0xe4877d(0x204)],!![]),'countPopulation':!![]}),_0x55f49c=_0x56ec50[_0xe4877d(0x231)];else throw new SDKError(ErrorCode[_0xe4877d(0x1eb)],'Embedded\x20segment\x20\x27'+_0x3882f1[_0xe4877d(0x20c)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0xe4877d(0x1c1)+_0x3e2524['absolutePath'][_0xe4877d(0x180)](/([^/]+)$/,_0xe4877d(0x21b))+')\x20')+_0xe4877d(0x17f),_0x2d98da);}else throw _0x2d98da;}return saveSegmentToPushRecovery(_0x3e2524[_0xe4877d(0x238)],_0x3e2524[_0xe4877d(0x165)][_0xe4877d(0x1d5)],_0x3882f1[_0xe4877d(0x20c)],{'segmentId':_0x55f49c,'uniqueServerName':_0x3882f1[_0xe4877d(0x215)],'createdAt':new Date()[_0xe4877d(0x211)]()}),_0x55f49c;}export async function prepareSegmentFiles(_0x38489c,_0x35e42b,_0xf32b9c,_0x43f837,_0x3ed55d){const _0x3550d0=a140_0x2d1abb,{activationDefToCreateRequest:_0x190369}=await import(_0x3550d0(0x205)),_0x3a37f5=[],_0x285166=new Set();for(const {yamlConfig:_0x35436d,folderPath:_0x58bd76,sourcePath:_0x4c4110}of _0x38489c){const _0x8bcf5c=resolveTDFolderPath(_0x58bd76,_0x43f837,_0x3ed55d),_0x2e1fa2=_0x8bcf5c+':'+_0x35436d['name'],_0x492777=_0x35e42b[_0x3550d0(0x1dc)][_0x3550d0(0x160)](_0x2e1fa2),_0x1b63de=_0x492777?_0x35e42b[_0x3550d0(0x20f)][_0x3550d0(0x160)](_0x492777['id'])||[]:[];addFoldersToCreate(_0x8bcf5c,_0x35e42b['folderPathToId'],_0x285166);const _0x760598=calculateActivationActions(_0x35436d['activations']||[],_0x1b63de,_0x35e42b['idToEmailMap'],_0x35e42b[_0x3550d0(0x1a2)]);for(const _0x54063d of _0x760598){(_0x54063d[_0x3550d0(0x19d)]==='create'||_0x54063d[_0x3550d0(0x19d)]===_0x3550d0(0x1db))&&_0x54063d[_0x3550d0(0x224)]&&(_0x54063d['validatedRequest']=await _0x190369(_0x54063d[_0x3550d0(0x224)],_0xf32b9c));}const _0x31159f=calculateSegmentDiff(_0x35436d,_0x492777,_0x1b63de,_0x35e42b[_0x3550d0(0x18e)],_0x35e42b[_0x3550d0(0x1a2)]);_0x3a37f5[_0x3550d0(0x243)]({'relativePath':_0x35436d[_0x3550d0(0x1d5)],'absolutePath':_0x4c4110,'yamlConfig':_0x35436d,'folderPath':_0x8bcf5c,'existingSegment':_0x492777,'existingActivations':_0x1b63de,'isNew':_0x31159f[_0x3550d0(0x17b)],'hasChanges':_0x31159f['hasChanges'],'diff':_0x31159f[_0x3550d0(0x169)],'activationActions':_0x760598});}return{'segmentFiles':_0x3a37f5,'foldersToCreate':_0x285166};}export async function prepareJourneyFiles(_0x315f83,_0xdb0a83,_0xb392dd,_0x2409e9){const _0x4aeb7c=a140_0x2d1abb,_0xd09aa5=[],_0x1278c6=new Set();for(const {yamlConfig:_0x39a6b2,folderPath:_0x4ede34,sourcePath:_0x1ce51a}of _0x315f83){const _0x567d0e=resolveTDFolderPath(_0x4ede34,_0xb392dd,_0x2409e9),_0x561230=_0x567d0e+':'+_0x39a6b2[_0x4aeb7c(0x1d5)],_0x21fbd0=_0xdb0a83[_0x4aeb7c(0x1fa)][_0x4aeb7c(0x160)](_0x561230);let _0x3d0fa8,_0x21099b;if(_0x21fbd0&&_0x21fbd0['length']>0x0){const _0x1908ef=buildLocalExpandedRuleMappings(_0x39a6b2),{createYamlContext:_0x36a3e9,prefetchJourneySegments:_0x13c03d}=createPushYamlContextForBundle(_0xdb0a83[_0x4aeb7c(0x1c6)],_0xdb0a83['parentId'],_0xdb0a83['existingSegments'],_0x1908ef,_0xdb0a83[_0x4aeb7c(0x18e)],_0xdb0a83[_0x4aeb7c(0x1a2)],_0xdb0a83[_0x4aeb7c(0x23a)],_0xdb0a83[_0x4aeb7c(0x226)]);await _0x13c03d(_0x21fbd0['map'](_0x1fb5bf=>_0x1fb5bf['id']));const _0x2c4cc0=await _0xdb0a83[_0x4aeb7c(0x1c6)][_0x4aeb7c(0x151)][_0x4aeb7c(0x15b)](_0x21fbd0[0x0][_0x4aeb7c(0x157)]),_0x34cd59=hasMultipleVersions(_0x39a6b2),_0x1b0936=async _0x428844=>{const _0x40d250=_0x4aeb7c,_0x55a1b1=_0xdb0a83[_0x40d250(0x226)]?.['get'](_0x428844);if(_0x55a1b1)return _0x55a1b1;return _0xdb0a83['fetchJourney']({'journeyId':_0x428844,'journeyName':_0x39a6b2[_0x40d250(0x1d5)],'isMultiVersion':_0x21fbd0[_0x40d250(0x1b5)]>0x1});};if(_0x34cd59&&_0x21fbd0['length']>0x1){const _0x5a1081=[];for(const _0x187181 of _0x21fbd0){const _0x37c510=_0x187181[_0x4aeb7c(0x1bd)]||0x1;_0xdb0a83[_0x4aeb7c(0x14d)]?.['update'](_0x4aeb7c(0x214)+_0x39a6b2[_0x4aeb7c(0x1d5)]+'\x20v'+_0x37c510);const _0xa7d03b=await _0x1b0936(_0x187181['id']),_0xe9b6b1=_0x36a3e9(_0x187181['id']),_0x264bdb=await journeyResponseToDef(_0xa7d03b,_0xe9b6b1);_0x5a1081[_0x4aeb7c(0x243)]({'item':_0x187181,'yaml':_0x264bdb});}const _0x2268d6=buildLocalRuleToNameMappingFromJourney(_0x39a6b2);_0x21099b=buildMergedJourneyDef(_0x5a1081,_0x2268d6,_0x2c4cc0);const _0x5a68d0=Math[_0x4aeb7c(0x1a7)](..._0x5a1081[_0x4aeb7c(0x1d7)](_0x39decf=>_0x39decf[_0x4aeb7c(0x187)]['versionNumber']||0x0)),_0x260e47=_0x21fbd0['find'](_0x14e7d1=>(_0x14e7d1[_0x4aeb7c(0x1bd)]||0x0)===_0x5a68d0);_0x260e47&&(_0xdb0a83[_0x4aeb7c(0x14d)]?.[_0x4aeb7c(0x1db)](_0x4aeb7c(0x214)+_0x39a6b2[_0x4aeb7c(0x1d5)]+'\x20v'+_0x5a68d0),_0x3d0fa8=await _0x1b0936(_0x260e47['id']));}else{const _0x23ac0a=_0x21fbd0[_0x21fbd0[_0x4aeb7c(0x1b5)]-0x1];_0xdb0a83['progress']?.[_0x4aeb7c(0x1db)]('Fetching\x20'+_0x39a6b2[_0x4aeb7c(0x1d5)]),_0x3d0fa8=await _0x1b0936(_0x23ac0a['id']);const _0x34cb58=_0x36a3e9(_0x23ac0a['id']),_0x4e75ac=await journeyResponseToDef(_0x3d0fa8,_0x34cb58),_0xb25070=buildLocalRuleToNameMappingFromJourney(_0x39a6b2);_0x21099b=buildMergedJourneyDef([{'item':_0x23ac0a,'yaml':_0x4e75ac}],_0xb25070,_0x2c4cc0);}}addFoldersToCreate(_0x567d0e,_0xdb0a83[_0x4aeb7c(0x18d)],_0x1278c6);const _0xae0213=calculateJourneyDiff(_0x39a6b2,_0x21099b);_0xd09aa5['push']({'relativePath':_0x39a6b2[_0x4aeb7c(0x1d5)],'absolutePath':_0x1ce51a,'yamlConfig':_0x39a6b2,'folderPath':_0x567d0e,'existingJourney':_0x3d0fa8,'isNew':_0xae0213['isNew'],'hasChanges':_0xae0213[_0x4aeb7c(0x21d)],'diff':_0xae0213[_0x4aeb7c(0x169)]});}return{'journeyFiles':_0xd09aa5,'foldersToCreate':_0x1278c6};}export function calculateActivationActions(_0x25b621,_0x8f7e5f,_0xb05d68,_0x2b4f25){const _0x20e202=a140_0x2d1abb,_0x2ecd5e=[],_0x25db60=new Map();for(const _0x313c01 of _0x8f7e5f){_0x25db60[_0x20e202(0x1cf)](_0x313c01[_0x20e202(0x1d5)],_0x313c01);}const _0x4b234a=new Map();for(const _0x83f8db of _0x25b621){_0x4b234a[_0x20e202(0x1cf)](_0x83f8db[_0x20e202(0x1d5)],_0x83f8db);}for(const _0x4ee322 of _0x25b621){const _0x1c08ba=_0x25db60[_0x20e202(0x160)](_0x4ee322[_0x20e202(0x1d5)]);if(!_0x1c08ba)_0x2ecd5e['push']({'type':'create','name':_0x4ee322[_0x20e202(0x1d5)],'yamlActivation':_0x4ee322});else{const _0x45be25=activationResponseToDef(_0x1c08ba,_0xb05d68,_0x2b4f25),_0x8cd9c4=a140_0x399a39[_0x20e202(0x21f)](_0x45be25),_0x1688ba=a140_0x399a39[_0x20e202(0x21f)](_0x4ee322);_0x8cd9c4!==_0x1688ba&&_0x2ecd5e['push']({'type':_0x20e202(0x1db),'name':_0x4ee322[_0x20e202(0x1d5)],'yamlActivation':_0x4ee322,'existingActivation':_0x1c08ba});}}for(const _0x484818 of _0x8f7e5f){!_0x4b234a[_0x20e202(0x1aa)](_0x484818['name'])&&_0x2ecd5e[_0x20e202(0x243)]({'type':_0x20e202(0x22b),'name':_0x484818[_0x20e202(0x1d5)],'existingActivation':_0x484818});}return _0x2ecd5e;}function calculateYamlDiff(_0x5eb8ce,_0xdea241){if(_0xdea241){const _0x277967=generateDiff(_0xdea241,_0x5eb8ce),_0x1d6eb2=hasChanges(_0x277967);return{'isNew':![],'hasChanges':_0x1d6eb2,'diff':_0x1d6eb2?formatDiffWithColors(_0x277967):undefined};}const _0x1215f3=generateDiff('',_0x5eb8ce);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x1215f3)};}export function calculateSegmentDiff(_0x4c0845,_0x19a54d,_0x34c59c,_0x39caf5,_0x10e428){const _0x4dff77=segmentToYamlString(_0x4c0845),_0x8c9dd7=_0x19a54d?segmentToYamlString(segmentWithActivationsToYaml(_0x19a54d,_0x34c59c,undefined,_0x39caf5,_0x10e428)):undefined;return calculateYamlDiff(_0x4dff77,_0x8c9dd7);}export function calculateJourneyDiff(_0x5ec0b3,_0x45796f){const _0x331b5e=normalizeJourneyDef(_0x5ec0b3,_0x5ec0b3),_0x433646=a140_0x5cd287(_0x331b5e),_0xd29c20=_0x45796f?a140_0x5cd287(normalizeJourneyDef(_0x45796f,_0x5ec0b3)):undefined;return calculateYamlDiff(_0x433646,_0xd29c20);}export function findSegmentsToDelete(_0x4d9319,_0x366758,_0xc323a1,_0x1dceae,_0x50ff27){const _0x235f8c=a140_0x2d1abb,_0x437c70=new Set();for(const {yamlConfig:_0x4bc0f1,folderPath:_0x3c1710}of _0x366758){_0x437c70[_0x235f8c(0x1c7)](_0x3c1710+':'+_0x4bc0f1[_0x235f8c(0x1d5)]);}return _0x4d9319[_0x235f8c(0x177)](_0x95a200=>{const _0x29c419=_0x235f8c,_0x5a6021=_0x95a200[_0x29c419(0x1e8)]?_0xc323a1[_0x29c419(0x160)](_0x95a200['segmentFolderId'][_0x29c419(0x1f9)]())||'':'',_0x5ee9f7=_0x5a6021+':'+_0x95a200[_0x29c419(0x1d5)];if(_0x437c70[_0x29c419(0x1aa)](_0x5ee9f7))return![];if(_0x50ff27)return _0x5a6021===_0x1dceae||_0x5a6021[_0x29c419(0x19a)](_0x1dceae+'/');return!![];});}export function findJourneysToDelete(_0x236e1a,_0x381632,_0x481be7,_0x1a6933,_0x59bdff){const _0x5b570f=a140_0x2d1abb,_0x53d94d=new Set();for(const {yamlConfig:_0x3202d8,folderPath:_0x1f1b22}of _0x381632){_0x53d94d[_0x5b570f(0x1c7)](_0x1f1b22+':'+_0x3202d8['name']);}return _0x236e1a[_0x5b570f(0x177)](_0x2503f6=>{const _0x159e5d=_0x5b570f,_0x115488=_0x2503f6['folderId']?_0x481be7[_0x159e5d(0x160)](_0x2503f6[_0x159e5d(0x174)])||'':'',_0x54d671=_0x115488+':'+_0x2503f6['journeyBundleName'];if(_0x53d94d['has'](_0x54d671))return![];if(_0x59bdff)return _0x115488===_0x1a6933||_0x115488[_0x159e5d(0x19a)](_0x1a6933+'/');return!![];});}export function buildSegmentLookupMap(_0x180493,_0x28fdb9){const _0x1e4473=a140_0x2d1abb,_0x21dae8=new Map();for(const _0x4f49f9 of _0x180493){const _0x3aaf4b=_0x4f49f9[_0x1e4473(0x1e8)]?_0x28fdb9['get'](_0x4f49f9['segmentFolderId']['toString']())||'':'',_0x55fd88=_0x3aaf4b+':'+_0x4f49f9[_0x1e4473(0x1d5)];_0x21dae8[_0x1e4473(0x1cf)](_0x55fd88,_0x4f49f9);}return _0x21dae8;}export function buildSegmentNameToIdMap(_0x3ed6eb){const _0x5ca1b6=a140_0x2d1abb,_0x1583e1=new Map();for(const _0xa49957 of _0x3ed6eb){_0x1583e1[_0x5ca1b6(0x1cf)](_0xa49957[_0x5ca1b6(0x1d5)],_0xa49957['id']);}return _0x1583e1;}export function buildJourneyBundleLookupMap(_0x46f0f3,_0x501989){const _0x36e604=a140_0x2d1abb,_0x5bc211=new Map();for(const _0x3717b4 of _0x46f0f3){const _0x167abd=_0x3717b4[_0x36e604(0x174)]?_0x501989['get'](_0x3717b4[_0x36e604(0x174)])||'':'',_0x79ce1e=_0x167abd+':'+_0x3717b4[_0x36e604(0x1f4)];!_0x5bc211[_0x36e604(0x1aa)](_0x79ce1e)&&_0x5bc211['set'](_0x79ce1e,[]),_0x5bc211[_0x36e604(0x160)](_0x79ce1e)[_0x36e604(0x243)](_0x3717b4);}for(const _0x2702f4 of _0x5bc211['values']()){_0x2702f4[_0x36e604(0x176)]((_0xe7e349,_0x3bf2ff)=>(_0xe7e349[_0x36e604(0x1bd)]||0x0)-(_0x3bf2ff[_0x36e604(0x1bd)]||0x0));}return _0x5bc211;}export function collectFoldersToCreate(_0x547019,_0x22b17f){const _0x2c47ed=a140_0x2d1abb,_0x62977=new Set();for(const _0x171212 of _0x547019){if(!_0x171212)continue;if(_0x22b17f[_0x2c47ed(0x1aa)](_0x171212))continue;const _0x31455a=_0x171212[_0x2c47ed(0x1b0)]('/');let _0x26280e='';for(const _0x440bed of _0x31455a){_0x26280e=_0x26280e?_0x26280e+'/'+_0x440bed:_0x440bed,!_0x22b17f[_0x2c47ed(0x1aa)](_0x26280e)&&_0x62977[_0x2c47ed(0x1c7)](_0x26280e);}}return _0x62977;}export function parseAndClassifyYamlFiles(_0x369b56,_0x48973a,_0x5ca331){const _0x1e7de3=a140_0x2d1abb,_0x357109=[],_0x3e0953=[];for(const _0x1debe3 of _0x369b56){const _0x541394=a140_0x41e71e[_0x1e7de3(0x23e)](_0x48973a,a140_0x41e71e[_0x1e7de3(0x1e7)](_0x1debe3)),_0x22a67e=_0x541394==='.'?'':_0x541394,_0xe7eab7=readFileSync(_0x1debe3,_0x1e7de3(0x1d4)),_0x54a640=a140_0x399a39[_0x1e7de3(0x1e0)](_0xe7eab7);if(isJourneyDef(_0x54a640)){const _0x34b851=a140_0x10dfcc(_0xe7eab7);_0x3e0953[_0x1e7de3(0x243)]({'yamlConfig':_0x34b851,'folderPath':_0x22a67e,'sourcePath':_0x1debe3});}else{if(!_0x5ca331?.['skipSegments']){const _0x4446cf=parseSegmentYamlFile(_0xe7eab7),_0x125163=normalizeChildSegmentYaml(_0x4446cf);_0x357109[_0x1e7de3(0x243)]({'yamlConfig':_0x125163,'folderPath':_0x22a67e,'sourcePath':_0x1debe3});}}}return{'segments':_0x357109,'journeys':_0x3e0953};}export function validateParsedFiles(_0x10c897,_0x4dee41){const _0x1334f3=a140_0x2d1abb,_0x260ed8=[];for(const {yamlConfig:_0xd48d8,sourcePath:_0x33e531}of _0x10c897['segments']){const _0x50d5f5=readFileSync(_0x33e531,_0x1334f3(0x1d4)),_0x502076=a140_0x399a39['parseDocument'](_0x50d5f5),_0x18ebd6=validateSegmentDef(_0xd48d8,{'source':_0x50d5f5,'document':_0x502076},{'skipSchema':!![]});if(!_0x18ebd6[_0x1334f3(0x213)]){const _0x4edc6f=a140_0x41e71e[_0x1334f3(0x23e)](_0x4dee41,_0x33e531);_0x260ed8[_0x1334f3(0x243)]({'filePath':_0x4edc6f,'source':_0x50d5f5,'result':_0x18ebd6,'isJourney':![]});}}for(const {yamlConfig:_0x31d4c0,sourcePath:_0x1ee092}of _0x10c897[_0x1334f3(0x203)]){const _0x2213ab=readFileSync(_0x1ee092,_0x1334f3(0x1d4)),_0x4a822c=a140_0x399a39[_0x1334f3(0x218)](_0x2213ab),_0x4c3c29=validateJourneyDef(_0x31d4c0,{'source':_0x2213ab,'document':_0x4a822c},{'skipSchema':!![]});if(!_0x4c3c29[_0x1334f3(0x213)]){const _0x3017a5=a140_0x41e71e[_0x1334f3(0x23e)](_0x4dee41,_0x1ee092);_0x260ed8['push']({'filePath':_0x3017a5,'source':_0x2213ab,'result':_0x4c3c29,'isJourney':!![]});}}return _0x260ed8;}export function formatValidationErrors(_0x541271){const _0xc87c85=a140_0x2d1abb,_0x10840a=[];for(const {filePath:_0x2a41a0,source:_0x2a2669,result:_0x164213,isJourney:_0xf4bc6d}of _0x541271){const _0x1c7c51=_0xf4bc6d?'journey':_0xc87c85(0x150);_0x10840a[_0xc87c85(0x243)]('\x0a'+_0x2a41a0+'\x20('+_0x1c7c51+_0xc87c85(0x192)+_0x164213[_0xc87c85(0x1bc)][_0xc87c85(0x1b5)]+_0xc87c85(0x199)),_0x10840a[_0xc87c85(0x243)](formatValidationResult(_0x164213,_0x2a2669,_0x2a41a0));}return _0x10840a[_0xc87c85(0x181)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x15670a){const _0x505341=a140_0x2d1abb,_0xe3ad45=new Set(),_0x4ba868=new Map(),_0x58a477=collectSegmentUsageCounts(_0x15670a);if(_0x15670a[_0x505341(0x1c8)])for(const [_0x813c9f,_0x3d20c9]of Object[_0x505341(0x1ea)](_0x15670a['segments'])){_0xe3ad45[_0x505341(0x1c7)](_0x813c9f);if(_0x3d20c9['rule']){const _0x2a95a1=yamlRuleToApi(_0x3d20c9['rule']),_0x434765=apiRuleToYaml(_0x2a95a1);_0x4ba868[_0x505341(0x1cf)](_0x813c9f,_0x434765);}}const _0x3d2c09=new Map();let _0x3e4e6f=0x0;for(const [_0x2c1cdc,_0x15b0ef]of _0x4ba868){const _0x151480=serializeExpandedRule(_0x15b0ef,_0x4ba868),_0x23d1d9=_0x3d2c09[_0x505341(0x160)](_0x151480)||[];_0x23d1d9['push']({'name':_0x2c1cdc,'index':_0x3e4e6f}),_0x3d2c09['set'](_0x151480,_0x23d1d9),_0x3e4e6f++;}const _0x4693d7=new Map();for(const [_0xaedf49,_0x4db51c]of _0x3d2c09){const _0x386023=_0x4db51c[_0x505341(0x17d)]()[_0x505341(0x176)]((_0x218107,_0x435a25)=>{const _0x1943bc=_0x505341,_0x340cd0=_0x58a477[_0x1943bc(0x160)](_0x218107[_0x1943bc(0x1d5)])||0x0,_0x2edcbb=_0x58a477[_0x1943bc(0x160)](_0x435a25[_0x1943bc(0x1d5)])||0x0;if(_0x340cd0!==_0x2edcbb)return _0x2edcbb-_0x340cd0;return _0x218107[_0x1943bc(0x156)]-_0x435a25[_0x1943bc(0x156)];})[_0x505341(0x1d7)](_0x1705f6=>_0x1705f6[_0x505341(0x1d5)]),_0x38732d=[];for(const _0xebfe35 of _0x386023){const _0x55ac61=_0x58a477['get'](_0xebfe35)||0x0,_0x1226da=Math['max'](_0x55ac61,0x1);for(let _0x25c7c1=0x0;_0x25c7c1<_0x1226da;_0x25c7c1++){_0x38732d[_0x505341(0x243)](_0xebfe35);}}_0x4693d7[_0x505341(0x1cf)](_0xaedf49,_0x38732d);}return{'existingLocalSegmentNames':_0xe3ad45,'localSegmentRules':_0x4ba868,'localExpandedRuleToNames':_0x4693d7};}export function createSegmentIdResolver(_0x10573e,_0x43b6f){return async _0xcae1e9=>{const _0x1018ee=a140_0x4f0a,_0x2ab24a=_0x10573e['get'](_0xcae1e9);if(!_0x2ab24a)throw new SDKError(ErrorCode[_0x1018ee(0x162)],_0x1018ee(0x219)+_0xcae1e9+_0x1018ee(0x152)+_0x43b6f+'\x27)');return _0x2ab24a;};}export function extractRootFolderId(_0x5ccca9){const _0x59ea58=a140_0x2d1abb;return _0x5ccca9[_0x59ea58(0x194)]?.['parentSegmentFolder']?.[_0x59ea58(0x21c)]?.['id']||_0x5ccca9[_0x59ea58(0x194)]?.[_0x59ea58(0x19c)]?.['data']?.['id'];}export function buildConnectionMaps(_0x1209e1){const _0x5d458b=a140_0x2d1abb,_0x37ef4e=new Map(),_0x5ecd81=new Map(),_0x5a761f=new Map();for(const _0x3a7aed of _0x1209e1){_0x37ef4e['set'](_0x3a7aed['name'],parseInt(_0x3a7aed['id'],0xa)),_0x5ecd81['set'](_0x3a7aed['id'],_0x3a7aed[_0x5d458b(0x1d5)]),_0x5a761f['set'](_0x3a7aed[_0x5d458b(0x1d5)],_0x3a7aed[_0x5d458b(0x19d)]);}return{'nameToId':_0x37ef4e,'idToName':_0x5ecd81,'nameToType':_0x5a761f};}export function calculatePushStats(_0x582cae,_0x98ef01,_0x3f2663,_0xcffa3b,_0x2322da,_0x5b6990,_0x1eb0a8){const _0x39c573=a140_0x2d1abb,_0x5b0b8d=_0x582cae[_0x39c573(0x177)](_0x5dec2b=>_0x5dec2b[_0x39c573(0x17b)]),_0x445eb1=_0x582cae[_0x39c573(0x177)](_0x49a734=>!_0x49a734[_0x39c573(0x17b)]&&_0x49a734[_0x39c573(0x21d)]),_0x50725b=_0x582cae['filter'](_0x14fb93=>!_0x14fb93[_0x39c573(0x17b)]&&!_0x14fb93[_0x39c573(0x21d)]),_0x488234=_0x5b6990?_0xcffa3b:[],_0x58ead7=_0x98ef01['filter'](_0x241245=>_0x241245[_0x39c573(0x17b)]),_0x3912e8=_0x98ef01[_0x39c573(0x177)](_0x5e68d8=>!_0x5e68d8[_0x39c573(0x17b)]&&_0x5e68d8[_0x39c573(0x21d)]),_0x1466bf=_0x98ef01[_0x39c573(0x177)](_0x1229bb=>!_0x1229bb[_0x39c573(0x17b)]&&!_0x1229bb[_0x39c573(0x21d)]),_0x462419=_0x5b6990?_0x2322da:[],_0x34e454=_0x582cae[_0x39c573(0x164)](_0x3ad662=>_0x3ad662['activationActions']),_0x191540=_0x34e454[_0x39c573(0x177)](_0x45a7fb=>_0x45a7fb[_0x39c573(0x19d)]===_0x39c573(0x185)),_0x4ecb82=_0x34e454[_0x39c573(0x177)](_0x31ffbc=>_0x31ffbc[_0x39c573(0x19d)]===_0x39c573(0x1db)),_0xfb8f30=_0x34e454[_0x39c573(0x177)](_0x510001=>_0x510001[_0x39c573(0x19d)]==='delete'),_0x1e6870=Array[_0x39c573(0x237)](_0x3f2663)[_0x39c573(0x176)](),_0x44c1a1=_0x1eb0a8?![]:_0x5b0b8d['length']>0x0||_0x445eb1['length']>0x0||_0x488234['length']>0x0,_0x5b1603=_0x58ead7[_0x39c573(0x1b5)]>0x0||_0x3912e8['length']>0x0||_0x462419[_0x39c573(0x1b5)]>0x0,_0xc1dde2=_0x1eb0a8?![]:_0x34e454[_0x39c573(0x1b5)]>0x0,_0x257d9f=_0x1e6870[_0x39c573(0x1b5)]>0x0;return{'segments':{'new':_0x5b0b8d,'changed':_0x445eb1,'unchanged':_0x50725b,'toDelete':_0x488234},'journeys':{'new':_0x58ead7,'changed':_0x3912e8,'unchanged':_0x1466bf,'toDelete':_0x462419},'activations':{'all':_0x34e454,'toCreate':_0x191540,'toUpdate':_0x4ecb82,'toDelete':_0xfb8f30},'folders':{'toCreate':_0x1e6870},'counts':{'segments':{'new':_0x5b0b8d[_0x39c573(0x1b5)],'changed':_0x445eb1[_0x39c573(0x1b5)],'unchanged':_0x50725b['length'],'toDelete':_0x488234[_0x39c573(0x1b5)]},'journeys':{'new':_0x58ead7[_0x39c573(0x1b5)],'changed':_0x3912e8[_0x39c573(0x1b5)],'unchanged':_0x1466bf[_0x39c573(0x1b5)],'toDelete':_0x462419[_0x39c573(0x1b5)]},'activations':{'create':_0x191540['length'],'update':_0x4ecb82[_0x39c573(0x1b5)],'delete':_0xfb8f30[_0x39c573(0x1b5)]},'folders':_0x1e6870[_0x39c573(0x1b5)]},'hasChanges':_0x44c1a1||_0x5b1603||_0xc1dde2||_0x257d9f};}export async function buildPushExecutionContext(_0x212b0f,_0x5f7b40,_0x39fc47,_0x1a1cb5,_0x46a3e4,_0x4fd9b8){const _0x1eac00=a140_0x2d1abb,_0x3018c4=extractRootFolderId(_0x39fc47),{pathToId:_0x1ad758,idToPath:_0x237835}=buildFolderMaps(_0x46a3e4),_0x5d5f31=buildSegmentNameToIdMap(_0x1a1cb5),_0x5cd537=new Map(),{batchAsync:_0x31451d}=await import(_0x1eac00(0x1d6)),[_0x372e1f,_0x2ac4de]=await Promise['all']([_0x212b0f[_0x1eac00(0x18a)][_0x1eac00(0x1ef)](),_0x212b0f[_0x1eac00(0x161)][_0x1eac00(0x1cb)](),((async()=>{const _0x1f5a94=_0x1eac00;!_0x4fd9b8&&_0x1a1cb5[_0x1f5a94(0x1b5)]>0x0&&await _0x31451d(_0x1a1cb5,async _0x57ffec=>{const _0x426b22=_0x1f5a94,_0x850041=await _0x212b0f[_0x426b22(0x150)][_0x426b22(0x1a6)](_0x5f7b40,_0x57ffec['id']);_0x5cd537[_0x426b22(0x1cf)](_0x57ffec['id'],_0x850041);});})())]),{emailToId:_0x4632d9,idToEmail:_0x118181}=_0x372e1f,_0x3fdffc=buildConnectionMaps(_0x2ac4de);return{'rootFolderId':_0x3018c4,'folderPathToId':_0x1ad758,'folderIdToPath':_0x237835,'segmentNameToId':_0x5d5f31,'activationsBySegmentId':_0x5cd537,'emailToIdMap':_0x4632d9,'idToEmailMap':_0x118181,'connectionNameToIdMap':_0x3fdffc[_0x1eac00(0x1dd)],'connectionIdToNameMap':_0x3fdffc[_0x1eac00(0x209)],'connectionNameToTypeMap':_0x3fdffc[_0x1eac00(0x179)]};}export function createPushYamlContextForBundle(_0x4aadab,_0x8a72c0,_0x51c00f,_0x3339b4,_0x5df8f6,_0x2a369e,_0x62af03,_0x3ee8ba){const {existingLocalSegmentNames:_0x32e037,localExpandedRuleToNames:_0x2cca12}=_0x3339b4,_0x56f2d7=new Set(),_0x12fde0=new Map(),_0x3db4b4=new Map(),_0xf51f52=new Map(),_0x142767=createJumpTargetCache(),_0x1bbb79=new Map(),_0x2e6e0a=new Map(),_0x124d5b=new Set();let _0xd8ba13;const _0x59473f=_0x1ff7ee=>{const _0x298a0d={'resolveSegment':async _0x222740=>{const _0x2a1bf7=a140_0x4f0a,_0x35eff5=_0xf51f52[_0x2a1bf7(0x160)](_0x222740);if(_0x35eff5!==undefined)return{'name':_0x35eff5,'isJourneyLocal':!![]};try{const _0x50d98=await fetchSegment(_0x4aadab,_0x8a72c0,_0x222740,_0x51c00f);if(!_0x50d98)throw new Error(_0x2a1bf7(0x18f));const _0x338056=generateJourneyLocalName(_0x50d98[_0x2a1bf7(0x1d5)]),_0x21b267=_0x50d98['kind']===SEGMENT_KIND_JOURNEY&&_0x338056!==undefined;let _0x252ea9=_0x50d98[_0x2a1bf7(0x1d5)],_0x3504a8;if(_0x21b267&&_0x50d98[_0x2a1bf7(0x20b)]){const _0x26b469=apiRuleToYaml(_0x50d98[_0x2a1bf7(0x20b)]);_0x2e6e0a['set'](_0x222740,_0x26b469);const _0x49c6cd=async _0x2d3948=>{const _0x4d442d=_0x2a1bf7,_0x3445ce=collectSegmentRefsFromRule(_0x2d3948);for(const _0x4c8ee2 of _0x3445ce){if(!_0x2e6e0a['has'](_0x4c8ee2))try{const _0x4069e4=await fetchSegment(_0x4aadab,_0x8a72c0,_0x4c8ee2,_0x51c00f);if(_0x4069e4?.[_0x4d442d(0x20b)]){const _0x172032=apiRuleToYaml(_0x4069e4[_0x4d442d(0x20b)]);_0x2e6e0a[_0x4d442d(0x1cf)](_0x4c8ee2,_0x172032),await _0x49c6cd(_0x172032);}}catch(_0x17cf9c){logger['debug'](_0x4d442d(0x1d3)+_0x4c8ee2+':\x20'+_0x17cf9c);}}};await _0x49c6cd(_0x26b469);const _0x442d45=serializeExpandedRule(_0x26b469,_0x2e6e0a),_0x563ff6=_0x2cca12[_0x2a1bf7(0x160)](_0x442d45);if(_0x563ff6&&_0x563ff6[_0x2a1bf7(0x1b5)]>0x0){const _0x3906b7=_0x12fde0['get'](_0x442d45)||0x0,_0x3328e6=_0x563ff6[_0x3906b7]||_0x563ff6[_0x563ff6[_0x2a1bf7(0x1b5)]-0x1];_0x12fde0[_0x2a1bf7(0x1cf)](_0x442d45,_0x3906b7+0x1),_0x252ea9=_0x3328e6,_0x56f2d7[_0x2a1bf7(0x1c7)](_0x252ea9),_0xf51f52[_0x2a1bf7(0x1cf)](_0x222740,_0x252ea9);const _0x37f1eb=await resolveRuleSegmentRefs(_0x26b469,async _0x2204d5=>{const _0x2597e2=_0x2a1bf7,_0x3af689=_0xf51f52[_0x2597e2(0x160)](_0x2204d5);if(_0x3af689)return _0x3af689;const _0x13582a=await _0xd8ba13[_0x2597e2(0x22e)](_0x2204d5);return _0x13582a[_0x2597e2(0x1d5)];});_0x3504a8={'description':_0x50d98['description'],'rule':_0x37f1eb};}else{const _0x3d419b=_0x1bbb79[_0x2a1bf7(0x160)](_0x442d45);if(_0x3d419b)_0x252ea9=_0x3d419b,_0xf51f52[_0x2a1bf7(0x1cf)](_0x222740,_0x252ea9);else{if(_0x338056){let _0x1ca52c=_0x338056,_0xb8069b=0x2;while(_0x56f2d7[_0x2a1bf7(0x1aa)](_0x1ca52c)||_0x32e037[_0x2a1bf7(0x1aa)](_0x1ca52c)){_0x1ca52c=_0x338056+'_'+_0xb8069b,_0xb8069b++;}_0x56f2d7['add'](_0x1ca52c),_0x252ea9=_0x1ca52c;}_0xf51f52[_0x2a1bf7(0x1cf)](_0x222740,_0x252ea9),_0x1bbb79['set'](_0x442d45,_0x252ea9);const _0x5e377e=await resolveRuleSegmentRefs(_0x26b469,async _0x9b0c9c=>{const _0x30e6c6=_0x2a1bf7,_0x5e4c55=_0xf51f52['get'](_0x9b0c9c);if(_0x5e4c55)return _0x5e4c55;const _0xcc5fc8=await _0xd8ba13[_0x30e6c6(0x22e)](_0x9b0c9c);return _0xcc5fc8[_0x30e6c6(0x1d5)];});_0x3504a8={'description':_0x50d98[_0x2a1bf7(0x170)],'rule':_0x5e377e};}}}return{'name':_0x252ea9,'isJourneyLocal':_0x21b267,'definition':_0x3504a8};}catch(_0x253074){return logger[_0x2a1bf7(0x1ab)](_0x2a1bf7(0x1f8)+_0x222740+':\x20'+_0x253074),{'name':_0x222740,'isJourneyLocal':![]};}},'resolveActivation':async _0x18ffec=>{const _0x4386f2=a140_0x4f0a,_0x423ae3=_0x3db4b4['get'](_0x18ffec);if(_0x423ae3!==undefined)return{'name':_0x423ae3,'isJourneyLocal':!![]};try{let _0x3560c9=_0x62af03?.[_0x4386f2(0x160)](_0x18ffec);!_0x3560c9&&(_0x3560c9=await _0x4aadab[_0x4386f2(0x151)][_0x4386f2(0x200)](_0x1ff7ee,_0x18ffec));const _0x5ec4ba=_0x3560c9['attributes'][_0x4386f2(0x222)][_0x4386f2(0x1d5)]||_0x18ffec,_0x28defd=sanitizeYamlKey(_0x5ec4ba)||_0x4386f2(0x1b3)+_0x18ffec,_0xb4da72=_0x28defd;_0x3db4b4[_0x4386f2(0x1cf)](_0x18ffec,_0xb4da72);const _0x2c7db3=journeyActivationStepToYaml(_0x3560c9,_0x5df8f6,_0x2a369e);return{'name':_0xb4da72,'isJourneyLocal':!![],'definition':_0x2c7db3};}catch(_0x29d0d5){return logger[_0x4386f2(0x1ab)](_0x4386f2(0x1f1)+_0x18ffec+':\x20'+_0x29d0d5),{'name':_0x18ffec,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x32a5ff,_0x178e07)=>resolveJumpTarget(_0x32a5ff,_0x178e07,_0x142767,async _0x18f45e=>{const _0x5badbe=a140_0x4f0a,_0x215ed0=_0x3ee8ba?.[_0x5badbe(0x160)](_0x18f45e);if(_0x215ed0)return _0x215ed0;return _0x4aadab[_0x5badbe(0x151)]['getJourney'](_0x18f45e);})};return _0xd8ba13=_0x298a0d,_0x298a0d;},_0x1de0ab=async _0x515b5e=>{const _0x1ce280=a140_0x4f0a,{collectSegmentIdsFromJourneyApi:_0x30631c}=await import(_0x1ce280(0x242)),{batchAsync:_0x43a660}=await import('../../utils/async.js'),_0x246778=new Set();for(const _0x5d115c of _0x515b5e){let _0x1385b4=_0x3ee8ba?.['get'](_0x5d115c);!_0x1385b4&&(_0x1385b4=await _0x4aadab[_0x1ce280(0x151)][_0x1ce280(0x175)](_0x5d115c));const _0x47becf=_0x30631c(_0x1385b4);for(const _0xba54e5 of _0x47becf){_0x246778[_0x1ce280(0x1c7)](_0xba54e5);}}let _0x5da523=Array[_0x1ce280(0x237)](_0x246778);while(_0x5da523[_0x1ce280(0x1b5)]>0x0){const _0x1a0779=_0x5da523[_0x1ce280(0x177)](_0x205635=>!_0x124d5b[_0x1ce280(0x1aa)](_0x205635));if(_0x1a0779['length']===0x0)break;const _0x645f7f=await _0x43a660(_0x1a0779,async _0x24c012=>{const _0x55bfd4=_0x1ce280;_0x124d5b[_0x55bfd4(0x1c7)](_0x24c012);const _0x5cd8da=await fetchSegment(_0x4aadab,_0x8a72c0,_0x24c012,_0x51c00f);if(!_0x5cd8da)return null;return{'segmentId':_0x24c012,'segment':_0x5cd8da};},0xa),_0x31e474=new Set();for(const _0x11e3c1 of _0x645f7f){if(!_0x11e3c1?.[_0x1ce280(0x150)]?.[_0x1ce280(0x20b)])continue;const _0x97e340=apiRuleToYaml(_0x11e3c1[_0x1ce280(0x150)][_0x1ce280(0x20b)]);_0x2e6e0a[_0x1ce280(0x1cf)](_0x11e3c1['segmentId'],_0x97e340);const _0x363197=collectSegmentRefsFromRule(_0x97e340);for(const _0x3ebafa of _0x363197){!_0x124d5b[_0x1ce280(0x1aa)](_0x3ebafa)&&_0x31e474[_0x1ce280(0x1c7)](_0x3ebafa);}}_0x5da523=Array[_0x1ce280(0x237)](_0x31e474);}};return{'createYamlContext':_0x59473f,'prefetchJourneySegments':_0x1de0ab};}export async function executePushSegments(_0x2db870,_0x17b4f0,_0x2cea84,_0x59b582,_0x5cb974){const _0x585387=a140_0x2d1abb,{segmentDefToCreateRequest:_0x5bfaec,segmentDefToUpdateRequest:_0x5066cb}=await import('./child-segment-yaml.js'),_0x11c5a4=_0x2cea84['folderPathToId'],_0x586c3d=0x5,_0x958009=async _0x33a806=>{const _0x17401c=a140_0x4f0a,_0x3064e2=_0x33a806[_0x17401c(0x191)]?_0x11c5a4['get'](_0x33a806[_0x17401c(0x191)]):undefined;let _0x15b927;const _0x5579ba={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x1c370e=_0x33a806['yamlConfig'];if(_0x33a806['yamlConfig']['rule']){const _0x3133be=createSegmentIdResolver(_0x2cea84['segmentNameToId'],_0x33a806[_0x17401c(0x165)]['name']),_0x29c13a=await resolveRuleSegmentIds(_0x33a806[_0x17401c(0x165)][_0x17401c(0x20b)],_0x3133be);_0x1c370e={..._0x33a806['yamlConfig'],'rule':_0x29c13a};}try{if(_0x33a806['isNew']){_0x5cb974['onProgress']?.({'type':_0x17401c(0x178),'name':_0x33a806[_0x17401c(0x165)][_0x17401c(0x1d5)]});const _0x113d0a=_0x5bfaec(_0x1c370e,_0x3064e2),_0x30356c=await _0x5cb974[_0x17401c(0x19e)](_0x17401c(0x159)+_0x33a806['yamlConfig']['name']+'\x27...',()=>_0x2db870[_0x17401c(0x150)][_0x17401c(0x1cc)](_0x59b582[_0x17401c(0x1c5)],_0x113d0a));_0x15b927=_0x30356c[_0x17401c(0x21c)]['id'],_0x2cea84[_0x17401c(0x1f6)][_0x17401c(0x1cf)](_0x33a806[_0x17401c(0x165)]['name'],_0x15b927),_0x5579ba[_0x17401c(0x15d)]={'name':_0x33a806[_0x17401c(0x165)]['name'],'id':_0x15b927},_0x5cb974[_0x17401c(0x236)]?.({'type':'segment_created','name':_0x33a806[_0x17401c(0x165)][_0x17401c(0x1d5)],'segmentId':_0x15b927}),_0x5cb974[_0x17401c(0x1de)]?.(_0x17401c(0x1d8)+_0x33a806[_0x17401c(0x165)]['name']+'\x27'),_0x5579ba['created']=0x1;}else{if(_0x33a806[_0x17401c(0x21d)]){_0x5cb974[_0x17401c(0x236)]?.({'type':_0x17401c(0x210),'name':_0x33a806['yamlConfig'][_0x17401c(0x1d5)]});const _0x3e498c=_0x5066cb(_0x1c370e);_0x3064e2!==_0x33a806[_0x17401c(0x22c)]?.['segmentFolderId']&&(_0x3e498c[_0x17401c(0x1e8)]=_0x3064e2?parseInt(_0x3064e2,0xa):undefined),await _0x5cb974[_0x17401c(0x19e)]('Updating\x20segment\x20\x27'+_0x33a806[_0x17401c(0x165)][_0x17401c(0x1d5)]+_0x17401c(0x1d0),()=>_0x2db870[_0x17401c(0x150)][_0x17401c(0x1e2)](_0x59b582['parentId'],_0x33a806[_0x17401c(0x22c)]['id'],_0x3e498c)),_0x15b927=_0x33a806[_0x17401c(0x22c)]['id'],_0x5cb974[_0x17401c(0x236)]?.({'type':_0x17401c(0x195),'name':_0x33a806[_0x17401c(0x165)]['name']}),_0x5cb974[_0x17401c(0x1de)]?.('Updated\x20segment\x20\x27'+_0x33a806[_0x17401c(0x165)][_0x17401c(0x1d5)]+'\x27'),_0x5579ba['updated']=0x1;}else _0x15b927=_0x33a806['existingSegment']['id'];}}catch(_0x3a332f){const _0x49916d=isHttp400Error(_0x3a332f),_0x4d876e=_0x49916d?ErrorCode[_0x17401c(0x229)]:ErrorCode[_0x17401c(0x1eb)],_0x51ddc6=getErrorMessage(_0x3a332f);throw new SDKError(_0x4d876e,_0x17401c(0x14f)+(_0x33a806[_0x17401c(0x17b)]?'create':_0x17401c(0x1db))+'\x20segment\x20from\x20file:\x20'+_0x33a806[_0x17401c(0x238)]+_0x17401c(0x1ff)+_0x51ddc6,_0x3a332f);}try{const _0x3cf4ea=await syncActivationsForSegment(_0x2db870,_0x59b582[_0x17401c(0x1c5)],_0x15b927,_0x33a806[_0x17401c(0x165)][_0x17401c(0x1d5)],_0x33a806['activationActions'],_0x5cb974,_0x33a806[_0x17401c(0x238)]);_0x5579ba[_0x17401c(0x167)]=_0x3cf4ea;}catch(_0x2a4272){if(_0x2a4272 instanceof SDKError)throw _0x2a4272;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x17401c(0x196)+_0x33a806['yamlConfig'][_0x17401c(0x1d5)]+_0x17401c(0x155)+_0x33a806[_0x17401c(0x238)]+'\x0a\x20\x20'+getErrorMessage(_0x2a4272),_0x2a4272);}return _0x5579ba;},_0x46d311=await batchAsync(_0x17b4f0,_0x958009,_0x586c3d),_0x23aefe={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x50617a of _0x46d311){_0x23aefe[_0x585387(0x1b9)]+=_0x50617a[_0x585387(0x1b9)],_0x23aefe[_0x585387(0x239)]+=_0x50617a['updated'],_0x50617a['createdSegmentId']&&_0x23aefe['createdSegmentIds'][_0x585387(0x1cf)](_0x50617a[_0x585387(0x15d)]['name'],_0x50617a[_0x585387(0x15d)]['id']),_0x23aefe[_0x585387(0x167)][_0x585387(0x1b9)]+=_0x50617a[_0x585387(0x167)][_0x585387(0x1b9)],_0x23aefe[_0x585387(0x167)][_0x585387(0x239)]+=_0x50617a[_0x585387(0x167)][_0x585387(0x239)],_0x23aefe[_0x585387(0x167)]['deleted']+=_0x50617a[_0x585387(0x167)]['deleted'];}return _0x23aefe;}function a140_0x51ab(){const _0x1afac0=['activation_template_id','created','find','uniqueServerName','errors','versionNumber','embedded_activation_created','existingSegments','712782jVKtkV','Delete\x20the\x20push\x20recovery\x20file\x20(','journey_entry_criteria_','action','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','parentId','deps','add','segments','all','journey_creating','list','createSegment','getSegment','activation_deleted','set','\x27...','stages','effectiveFolderId','Failed\x20to\x20fetch\x20referenced\x20segment\x20','utf-8','name','../../utils/async.js','map','Created\x20segment\x20\x27','Matched\x20server\x20segment\x20\x27','getSegment\x20failed\x20for\x20','update','segmentByFolderAndName','nameToId','logSuccess','WaitStep','parse','Deleted\x20segment\x20\x27','updateSegmentById','state','notification','415410ryPIum','conditions','dirname','segmentFolderId','__pending_act_','entries','SEGMENT_UPDATE_ERROR','schedule','conditionTimeoutUnit','9INAozO','buildUserMaps','\x27\x20not\x20found\x20in\x20journey\x20\x27','Failed\x20to\x20resolve\x20activation\x20','\x27\x20decision\x20point\x20branch\x20\x27','embedded_segment_creating','journeyBundleName','Entry\x20criteria:\x20','segmentNameToId','conditionSegmentId','Failed\x20to\x20resolve\x20segment\x20','toString','journeyBundlesByFolderAndName','milestone','Deleting\x20activation\x20\x27','updateActivation','journeyId','\x0a\x20\x20','getActivation','reduce','journeyStages','journeys','resolvedRule','./child-segment-yaml.js','decision_point','getSegmentEntity\x20also\x20failed\x20for\x20','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','idToName','waitStep','rule','localName','\x27\x20exit\x20criteria','\x20journey\x20from\x20file:\x20','activationsBySegmentId','segment_updating','toISOString','null','valid','Fetching\x20','uniqueSegmentName',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','__pending_','parseDocument','Segment\x20not\x20found:\x20','journeyActivationStepId','.$1.push-recovery.json','data','hasChanges','with','stringify','rootFolderId','waitStepUnit','activationParams','some','yamlActivation','attributes','journeyById','Creating\x20activation\x20\x27','NOT_FOUND','SEGMENT_SYNTAX_ERROR','match','delete','existingSegment','Activation','resolveSegment','Duration','Created\x20journey\x20\x27','segmentId','entry_criteria','INTERNAL','object','849352IOMVhQ','onProgress','from','absolutePath','updated','activationStepsById','ACTIVATION_SYNTAX_ERROR','\x27\x20for\x20','existingJourney','relative','existingActivation','logDeleted','unchanged','./journey-yaml.js','push','keys','branches','sha1','activationContext','progress','stage\x20\x27','Failed\x20to\x20','segment','journey','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','\x20(referenced\x20in\x20journey\x20','416982WnlcAv','\x27\x20from\x20file:\x20','index','journeyBundleId',').\x20','Creating\x20segment\x20\x27','Updated\x20activation\x20\x27','getLatestJourneyId','8871TzfNeT','createdSegmentId','columns','entry','get','connection','SEGMENT_NOT_FOUND','toLowerCase','flatMap','yamlConfig','844690IoytUh','activations','folder','diff','\x20activation\x20\x27','entryCriteria','segment_deleting','resolveJourneyId','\x27\x20entry\x20criteria','run_after_journey_refresh','description','Journey\x20\x27','embedded_activation_creating','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','folderId','getJourney','sort','filter','segment_creating','nameToType','journeyName','isNew','waitStepType','slice','validatedRequest','and\x20the\x20server\x20segment,\x20then\x20retry.','replace','join','goal','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','behavior','create','all_columns','item','steps','isArray','user','size','journey_updated','folderPathToId','idToEmailMap','Segment\x20not\x20found','exitCriterias','folderPath','):\x20','\x27\x20to\x20local\x20\x27','relationships','segment_updated','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','conditionTimeoutDuration','DecisionPoint','\x20error(s)','startsWith','14ZYSaFR','parentFolder','type','withProgress','Created\x20folder\x20\x27','Creating\x20folder\x20\x27','journey_created','connectionIdToNameMap','deleted','includes','folder_creating','listActivations','max','connector_config','activation_created','has','debug','goal\x20criteria','Condition','getSegmentEntity','hex','split','message','embedded_segment_created','activation_','804688eqDjus','length','\x27\x20wait\x20condition','12PGyFhm'];a140_0x51ab=function(){return _0x1afac0;};return a140_0x51ab();}async function syncActivationsForSegment(_0x1a1fbb,_0x2b34ea,_0x49189b,_0x59c08f,_0x473116,_0x31d39c,_0x44dd7f){const _0x5a2040=a140_0x2d1abb,_0x6fc63a={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x1d8e05 of _0x473116){try{if(_0x1d8e05[_0x5a2040(0x19d)]===_0x5a2040(0x185)&&_0x1d8e05['validatedRequest'])_0x31d39c[_0x5a2040(0x236)]?.({'type':'activation_creating','segmentName':_0x59c08f,'activationName':_0x1d8e05['name']}),await _0x31d39c[_0x5a2040(0x19e)](_0x5a2040(0x227)+_0x1d8e05[_0x5a2040(0x1d5)]+_0x5a2040(0x1d0),()=>_0x1a1fbb[_0x5a2040(0x150)]['createActivation'](_0x2b34ea,_0x49189b,_0x1d8e05[_0x5a2040(0x17e)])),_0x31d39c['onProgress']?.({'type':_0x5a2040(0x1a9),'segmentName':_0x59c08f,'activationName':_0x1d8e05[_0x5a2040(0x1d5)]}),_0x31d39c[_0x5a2040(0x1de)]?.('Created\x20activation\x20\x27'+_0x1d8e05[_0x5a2040(0x1d5)]+'\x27'),_0x6fc63a['created']++;else{if(_0x1d8e05[_0x5a2040(0x19d)]===_0x5a2040(0x1db)&&_0x1d8e05['validatedRequest']&&_0x1d8e05[_0x5a2040(0x23f)])_0x31d39c[_0x5a2040(0x236)]?.({'type':'activation_updating','segmentName':_0x59c08f,'activationName':_0x1d8e05[_0x5a2040(0x1d5)]}),await _0x31d39c[_0x5a2040(0x19e)]('Updating\x20activation\x20\x27'+_0x1d8e05[_0x5a2040(0x1d5)]+_0x5a2040(0x1d0),()=>_0x1a1fbb['segment'][_0x5a2040(0x1fd)](_0x2b34ea,_0x49189b,_0x1d8e05['existingActivation']['id'],_0x1d8e05[_0x5a2040(0x17e)])),_0x31d39c[_0x5a2040(0x236)]?.({'type':'activation_updated','segmentName':_0x59c08f,'activationName':_0x1d8e05[_0x5a2040(0x1d5)]}),_0x31d39c[_0x5a2040(0x1de)]?.(_0x5a2040(0x15a)+_0x1d8e05[_0x5a2040(0x1d5)]+'\x27'),_0x6fc63a[_0x5a2040(0x239)]++;else _0x1d8e05[_0x5a2040(0x19d)]==='delete'&&_0x1d8e05['existingActivation']&&(_0x31d39c['onProgress']?.({'type':'activation_deleting','segmentName':_0x59c08f,'activationName':_0x1d8e05[_0x5a2040(0x1d5)]}),await _0x31d39c[_0x5a2040(0x19e)](_0x5a2040(0x1fc)+_0x1d8e05[_0x5a2040(0x1d5)]+_0x5a2040(0x1d0),()=>_0x1a1fbb[_0x5a2040(0x150)]['deleteActivation'](_0x2b34ea,_0x49189b,_0x1d8e05[_0x5a2040(0x23f)]['id'])),_0x31d39c[_0x5a2040(0x236)]?.({'type':_0x5a2040(0x1ce),'segmentName':_0x59c08f,'activationName':_0x1d8e05[_0x5a2040(0x1d5)]}),_0x31d39c['logDeleted']?.('Deleted\x20activation\x20\x27'+_0x1d8e05[_0x5a2040(0x1d5)]+'\x27'),_0x6fc63a[_0x5a2040(0x1a3)]++);}}catch(_0x57d6ae){const _0x21039c=isHttp400Error(_0x57d6ae),_0x4cfeff=_0x21039c?ErrorCode[_0x5a2040(0x23b)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x2066db=getErrorMessage(_0x57d6ae);throw new SDKError(_0x4cfeff,_0x5a2040(0x14f)+_0x1d8e05[_0x5a2040(0x19d)]+_0x5a2040(0x16a)+_0x1d8e05[_0x5a2040(0x1d5)]+_0x5a2040(0x155)+_0x44dd7f+'\x0a\x20\x20'+_0x2066db,_0x57d6ae);}}return _0x6fc63a;}export async function executePushFolders(_0x56d0ae,_0x104bce,_0x422fd6,_0xeb6456,_0x4f884c){const _0x197eb6=a140_0x2d1abb,_0x7ddd99=new Map(_0x422fd6),_0x458dba=sortFoldersByDepth(_0x104bce);for(const _0x11b9d7 of _0x458dba){const _0x24a056=_0x11b9d7[_0x197eb6(0x1b0)]('/'),_0x454033=_0x24a056[_0x24a056[_0x197eb6(0x1b5)]-0x1],_0x76f9bf=_0x24a056[_0x197eb6(0x17d)](0x0,-0x1)[_0x197eb6(0x181)]('/'),_0x5a8a2b=_0x7ddd99[_0x197eb6(0x160)](_0x76f9bf);_0x4f884c[_0x197eb6(0x236)]?.({'type':_0x197eb6(0x1a5),'folder':_0x11b9d7});const _0x15cb42={'name':_0x454033,'parentFolderId':_0x5a8a2b},_0x1f523d=await _0x4f884c[_0x197eb6(0x19e)](_0x197eb6(0x1a0)+_0x11b9d7+_0x197eb6(0x1d0),()=>_0x56d0ae[_0x197eb6(0x150)]['createFolder'](_0xeb6456[_0x197eb6(0x1c5)],_0x15cb42));_0x7ddd99[_0x197eb6(0x1cf)](_0x11b9d7,_0x1f523d['data']['id']),_0x4f884c[_0x197eb6(0x236)]?.({'type':'folder_created','folder':_0x11b9d7,'folderId':_0x1f523d[_0x197eb6(0x21c)]['id']}),_0x4f884c['logInfo']?.(_0x197eb6(0x19f)+_0x11b9d7+'\x27');}return _0x7ddd99;}export async function executePushSegmentDeletions(_0x45fe71,_0x265f65,_0x53ff29){const _0x56a621=a140_0x2d1abb;if(_0x265f65[_0x56a621(0x1b5)]===0x0)return 0x0;const {batchAsync:_0x2903f9}=await import('../../utils/async.js'),_0x26a33e=0x5,_0x2caf2d=await _0x2903f9(_0x265f65,async _0x1a458f=>{const _0x135020=_0x56a621;return _0x53ff29[_0x135020(0x236)]?.({'type':_0x135020(0x16c),'name':_0x1a458f[_0x135020(0x1d5)]}),await _0x45fe71['segment']['deleteSegment'](_0x1a458f['id']),_0x53ff29[_0x135020(0x236)]?.({'type':'segment_deleted','name':_0x1a458f[_0x135020(0x1d5)]}),_0x53ff29[_0x135020(0x240)]?.(_0x135020(0x1e1)+_0x1a458f[_0x135020(0x1d5)]+'\x27'),0x1;},_0x26a33e);return _0x2caf2d[_0x56a621(0x201)]((_0x21dfd3,_0x46b920)=>_0x21dfd3+_0x46b920,0x0);}export async function executePushJourneys(_0x422c5a,_0xf0cbf4,_0x24bad8,_0x371d6f,_0x352bf1){const _0xc0d044=a140_0x2d1abb,{journeyDefToRequest:_0x542d8b}=await import(_0xc0d044(0x242)),{activationDefToCreateRequest:_0x25d752,yamlRuleToApi:_0x50a650,validateSegmentRule:_0x8f4a56}=await import(_0xc0d044(0x205)),_0x2f1459={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x16e4f5=new Map(_0x24bad8[_0xc0d044(0x1f6)]),_0xd8b572=0x5;for(let _0x477b13=0x0;_0x477b13<_0xf0cbf4[_0xc0d044(0x1b5)];_0x477b13+=_0xd8b572){const _0x12e8c7=_0xf0cbf4[_0xc0d044(0x17d)](_0x477b13,_0x477b13+_0xd8b572),_0x17efab=await Promise[_0xc0d044(0x1c9)](_0x12e8c7['map'](async _0x392b7f=>{const _0x1fa314=_0xc0d044;if(!_0x392b7f[_0x1fa314(0x17b)]&&!_0x392b7f[_0x1fa314(0x21d)])return{'action':_0x1fa314(0x241),'name':_0x392b7f[_0x1fa314(0x165)][_0x1fa314(0x1d5)],'journeyId':_0x392b7f[_0x1fa314(0x23d)]?.['id']};const _0x2e74ca=_0x392b7f[_0x1fa314(0x191)]?_0x24bad8[_0x1fa314(0x18d)][_0x1fa314(0x160)](_0x392b7f[_0x1fa314(0x191)]):undefined;_0x352bf1[_0x1fa314(0x236)]?.({'type':_0x392b7f[_0x1fa314(0x17b)]?_0x1fa314(0x1ca):'journey_updating','name':_0x392b7f[_0x1fa314(0x165)][_0x1fa314(0x1d5)]});try{const _0x34dd79=await executeSingleJourneyPush(_0x422c5a,_0x392b7f,{..._0x24bad8,'segmentNameToId':_0x16e4f5},{'parentId':_0x371d6f[_0x1fa314(0x1c5)],'rootFolderId':_0x371d6f['rootFolderId'],'folderId':_0x2e74ca,'verbose':_0x371d6f['verbose']},_0x352bf1,{'journeyDefToRequest':_0x542d8b,'activationDefToCreateRequest':_0x25d752,'yamlRuleToApi':_0x50a650,'validateSegmentRule':_0x8f4a56});for(const [_0x495e7f,_0x22a25d]of _0x34dd79['embeddedSegmentNameToId']){_0x16e4f5['set'](_0x495e7f,_0x22a25d),_0x2f1459['embeddedSegmentNameToId'][_0x1fa314(0x1cf)](_0x495e7f,_0x22a25d);}if(_0x34dd79[_0x1fa314(0x1c3)]===_0x1fa314(0x1b9))_0x352bf1[_0x1fa314(0x236)]?.({'type':_0x1fa314(0x1a1),'name':_0x392b7f[_0x1fa314(0x165)]['name'],'journeyId':_0x34dd79[_0x1fa314(0x1fe)]}),_0x352bf1[_0x1fa314(0x1de)]?.(_0x1fa314(0x230)+_0x392b7f['yamlConfig']['name']+'\x27'),_0x2f1459[_0x1fa314(0x1b9)]++;else _0x34dd79[_0x1fa314(0x1c3)]==='updated'&&(_0x352bf1['onProgress']?.({'type':_0x1fa314(0x18c),'name':_0x392b7f[_0x1fa314(0x165)][_0x1fa314(0x1d5)]}),_0x352bf1['logSuccess']?.('Updated\x20journey\x20\x27'+_0x392b7f[_0x1fa314(0x165)][_0x1fa314(0x1d5)]+'\x27'),_0x2f1459[_0x1fa314(0x239)]++);return{'action':_0x34dd79[_0x1fa314(0x1c3)],'name':_0x392b7f['yamlConfig']['name'],'journeyId':_0x34dd79['journeyId']};}catch(_0x2d691c){const _0x3cb103=isHttp400Error(_0x2d691c),_0x6b2dd1=_0x3cb103?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x38401a=getErrorMessage(_0x2d691c);throw new SDKError(_0x6b2dd1,_0x1fa314(0x14f)+(_0x392b7f[_0x1fa314(0x17b)]?_0x1fa314(0x185):'update')+_0x1fa314(0x20e)+_0x392b7f['absolutePath']+_0x1fa314(0x1ff)+_0x38401a,_0x2d691c);}}));_0x2f1459['results'][_0xc0d044(0x243)](..._0x17efab);}return _0x2f1459;}async function matchExistingJourneySegments(_0x2f801a,_0xcec73c,_0x424d44,_0x739473,_0x5a1d4f){const _0x21c268=a140_0x2d1abb;if(!_0xcec73c['existingJourney']||!_0xcec73c[_0x21c268(0x165)]['segments'])return;const _0x18845b=new Map(),_0x299fb1=new Set();for(const _0x33c3a4 of Object[_0x21c268(0x244)](_0xcec73c[_0x21c268(0x165)]['segments'])){const _0x33a138=generateDeterministicJourneySegmentName(_0xcec73c['yamlConfig'][_0x21c268(0x1d5)],_0x33c3a4);_0x18845b['set'](_0x33a138,_0x33c3a4),_0x299fb1[_0x21c268(0x1c7)](_0x33c3a4);}const _0x9e0f06=[],_0x30ba1d=collectSegmentIdsFromJourneyApi(_0xcec73c['existingJourney']);for(const _0x47a7f7 of _0x30ba1d){const _0x598d31=await fetchSegment(_0x2f801a,_0x424d44,_0x47a7f7,_0x739473);if(!_0x598d31?.[_0x21c268(0x1d5)])continue;const _0x27b2f4=_0x18845b[_0x21c268(0x160)](_0x598d31[_0x21c268(0x1d5)]);_0x27b2f4?(_0x5a1d4f[_0x21c268(0x1cf)](_0x27b2f4,_0x47a7f7),_0x299fb1[_0x21c268(0x22b)](_0x27b2f4)):_0x9e0f06[_0x21c268(0x243)]({'id':_0x47a7f7,'seg':_0x598d31});}if(_0x299fb1['size']>0x0&&_0x9e0f06[_0x21c268(0x1b5)]>0x0){const {localExpandedRuleToNames:_0x762289}=buildLocalExpandedRuleMappings(_0xcec73c[_0x21c268(0x165)]),_0x53c317=new Map();for(const {id:_0x8853de,seg:_0x16d7e6}of _0x9e0f06){if(_0x16d7e6[_0x21c268(0x20b)]){const _0x42fa3a=apiRuleToYaml(_0x16d7e6['rule']);_0x53c317[_0x21c268(0x1cf)](_0x8853de,_0x42fa3a);}}for(const {id:_0x11564a,seg:_0x286c72}of _0x9e0f06){if(!_0x286c72[_0x21c268(0x20b)])continue;const _0x59f468=_0x53c317[_0x21c268(0x160)](_0x11564a);if(!_0x59f468)continue;const _0x27c421=serializeExpandedRule(_0x59f468,_0x53c317),_0x2d6227=_0x762289[_0x21c268(0x160)](_0x27c421);if(_0x2d6227){const _0x137b96=_0x2d6227[_0x21c268(0x1ba)](_0x1ff765=>_0x299fb1[_0x21c268(0x1aa)](_0x1ff765));_0x137b96&&(_0x5a1d4f[_0x21c268(0x1cf)](_0x137b96,_0x11564a),_0x299fb1[_0x21c268(0x22b)](_0x137b96),logger[_0x21c268(0x1ab)](_0x21c268(0x1d9)+_0x286c72['name']+_0x21c268(0x193)+_0x137b96+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x2ff1ad,_0x4f93a4,_0x402972,_0xbc529b,_0x2ed66f,_0x384307){const _0x41f5a8=a140_0x2d1abb,{journeyDefToRequest:_0x4c4505,activationDefToCreateRequest:_0x1cbb8d,yamlRuleToApi:_0x3afb3c,validateSegmentRule:_0x311b03}=_0x384307,_0x1e756c=new Map(),_0x3b590a=new Map();recoverSegmentIdsFromPushRecovery(_0x4f93a4,_0x1e756c,_0x402972[_0x41f5a8(0x1f6)]);const _0x1854fb=new Map(),_0x14c923=new Map(),_0x2de651=new Map();let _0x487e4b;const _0x5ad461=async()=>{const _0x56ab5b=_0x41f5a8;if(_0x487e4b)return;_0x487e4b=new Map();if(!_0x4f93a4['existingJourney'])return;const _0x593658=await _0x2ff1ad[_0x56ab5b(0x151)]['listActivations'](_0x4f93a4['existingJourney']['id']);for(const _0x893df8 of _0x593658){const _0x3c8bf6=journeyActivationStepToYaml(_0x893df8,_0x402972[_0x56ab5b(0x18e)],_0x402972[_0x56ab5b(0x1a2)]),_0x1dc45f=activationSignature(_0x3c8bf6);!_0x487e4b[_0x56ab5b(0x1aa)](_0x1dc45f)&&_0x487e4b[_0x56ab5b(0x1cf)](_0x1dc45f,_0x893df8['id']),_0x3c8bf6['name']&&_0x3b590a[_0x56ab5b(0x1cf)](_0x3c8bf6['name'],_0x893df8['id']);}};await matchExistingJourneySegments(_0x2ff1ad,_0x4f93a4,_0xbc529b[_0x41f5a8(0x1c5)],_0x402972[_0x41f5a8(0x1bf)],_0x402972[_0x41f5a8(0x1f6)]);const _0x5baa20={'resolveSegmentId':async _0x386661=>{const _0x5cac0d=_0x41f5a8,_0x22443b=_0x402972[_0x5cac0d(0x1f6)][_0x5cac0d(0x160)](_0x386661);if(!_0x22443b)throw new SDKError(ErrorCode[_0x5cac0d(0x162)],_0x5cac0d(0x219)+_0x386661+_0x5cac0d(0x153)+_0x4f93a4[_0x5cac0d(0x165)][_0x5cac0d(0x1d5)]+')');return _0x22443b;},'resolveEmbeddedSegmentId':async(_0x9ac6f5,_0xd39e8f)=>{const _0x23650e=_0x41f5a8,_0x346da2=_0x402972['segmentNameToId'][_0x23650e(0x160)](_0x9ac6f5);if(_0x346da2)return _0x346da2;const _0x480a40=_0x402972[_0x23650e(0x1bf)][_0x23650e(0x1ba)](_0x168899=>_0x168899['name']===_0x9ac6f5);if(_0x480a40)return _0x402972[_0x23650e(0x1f6)][_0x23650e(0x1cf)](_0x9ac6f5,_0x480a40['id']),_0x480a40['id'];if(_0x4f93a4[_0x23650e(0x17b)]){const {stageName:_0x4fc723,criteriaName:_0x4370b3}=findSegmentCriteriaLocation(_0x4f93a4['yamlConfig'],_0x9ac6f5);return _0x311b03(_0x9ac6f5,_0xd39e8f[_0x23650e(0x20b)]),_0x14c923[_0x23650e(0x1cf)](_0x9ac6f5,{'definition':_0xd39e8f,'stageName':_0x4fc723,'criteriaName':_0x4370b3}),createPendingSegmentId(_0x9ac6f5);}const _0x21178c=_0x4f93a4[_0x23650e(0x23d)]?.['id'];if(!_0x21178c)throw new SDKError(ErrorCode[_0x23650e(0x233)],_0x23650e(0x208));const _0xee8fcc=_0x1854fb[_0x23650e(0x160)](_0x9ac6f5);if(_0xee8fcc)return _0xee8fcc;const _0x3aff13=((async()=>{const _0x5c536e=_0x23650e;_0x311b03(_0x9ac6f5,_0xd39e8f[_0x5c536e(0x20b)]);const _0x31ac52=generateDeterministicJourneySegmentName(_0x4f93a4[_0x5c536e(0x165)][_0x5c536e(0x1d5)],_0x9ac6f5),_0xb6f59a=_0x402972['existingSegments']['find'](_0x3ac0fa=>_0x3ac0fa[_0x5c536e(0x1d5)]===_0x31ac52),_0x46da20=createSegmentIdResolver(_0x402972[_0x5c536e(0x1f6)],_0x9ac6f5),_0xaf3574=await resolveRuleSegmentIds(_0xd39e8f[_0x5c536e(0x20b)],_0x46da20);let _0x91eeae;return _0xb6f59a?(await _0x2ff1ad[_0x5c536e(0x150)]['updateSegmentById'](_0xbc529b[_0x5c536e(0x1c5)],_0xb6f59a['id'],{'description':_0xd39e8f[_0x5c536e(0x170)]||_0x5c536e(0x1f5)+_0x9ac6f5,'rule':_0x3afb3c(_0xaf3574,!![]),'countPopulation':!![]}),_0x91eeae=_0xb6f59a['id'],saveSegmentToPushRecovery(_0x4f93a4[_0x5c536e(0x238)],_0x4f93a4[_0x5c536e(0x165)]['name'],_0x9ac6f5,{'segmentId':_0x91eeae,'uniqueServerName':_0x31ac52,'createdAt':new Date()[_0x5c536e(0x211)]()})):_0x91eeae=await createOrRecoverEmbeddedSegment(_0x2ff1ad,_0x4f93a4,{'localName':_0x9ac6f5,'uniqueSegmentName':_0x31ac52,'description':_0xd39e8f[_0x5c536e(0x170)]||_0x5c536e(0x1f5)+_0x9ac6f5,'journeyId':_0x21178c,'resolvedRule':_0xaf3574,'parentId':_0xbc529b['parentId'],'folderId':_0xbc529b[_0x5c536e(0x220)]||''},_0x3afb3c),_0x402972[_0x5c536e(0x1f6)][_0x5c536e(0x1cf)](_0x9ac6f5,_0x91eeae),_0x1e756c['set'](_0x9ac6f5,_0x91eeae),_0x91eeae;})());_0x1854fb[_0x23650e(0x1cf)](_0x9ac6f5,_0x3aff13);try{return await _0x3aff13;}finally{_0x1854fb[_0x23650e(0x22b)](_0x9ac6f5);}},'resolveActivationId':async _0x1967b0=>{const _0x2ea8b9=_0x41f5a8,_0x326ec6=_0x3b590a['get'](_0x1967b0);if(_0x326ec6)return _0x326ec6;if(_0x4f93a4[_0x2ea8b9(0x23d)]){await _0x5ad461();const _0x4b8147=_0x3b590a[_0x2ea8b9(0x160)](_0x1967b0);if(_0x4b8147)return _0x4b8147;}throw new SDKError(ErrorCode['NOT_FOUND'],'Activation\x20not\x20found:\x20'+_0x1967b0+_0x2ea8b9(0x153)+_0x4f93a4[_0x2ea8b9(0x165)][_0x2ea8b9(0x1d5)]+_0x2ea8b9(0x158)+_0x2ea8b9(0x183));},'resolveEmbeddedActivationId':async(_0x3d4489,_0x1a16f2)=>{const _0x361317=_0x41f5a8,_0x201fa1=_0x3b590a[_0x361317(0x160)](_0x3d4489);if(_0x201fa1)return _0x201fa1;if(_0x4f93a4[_0x361317(0x17b)])return _0x2de651[_0x361317(0x1cf)](_0x3d4489,_0x1a16f2),createPendingActivationId(_0x3d4489);if(_0x4f93a4[_0x361317(0x23d)]){await _0x5ad461();const _0x5f3291=_0x3b590a[_0x361317(0x160)](_0x1a16f2['name']);if(_0x5f3291)return _0x3b590a[_0x361317(0x1cf)](_0x3d4489,_0x5f3291),_0x5f3291;const _0x293018=activationSignature(_0x1a16f2),_0x2f532c=_0x487e4b?.[_0x361317(0x160)](_0x293018);if(_0x2f532c)return _0x3b590a[_0x361317(0x1cf)](_0x3d4489,_0x2f532c),_0x2f532c;const _0x1dc1ca=await _0x1cbb8d(_0x1a16f2,_0x402972['activationContext']),_0x3b36bd={..._0x1dc1ca,..._0x1a16f2['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x1a16f2[_0x361317(0x16f)]}},_0x2092b0=await _0x2ff1ad[_0x361317(0x151)]['createActivation'](_0x4f93a4[_0x361317(0x23d)]['id'],_0x3b36bd);return _0x3b590a[_0x361317(0x1cf)](_0x3d4489,_0x2092b0['id']),_0x2092b0['id'];}throw new SDKError(ErrorCode[_0x361317(0x233)],_0x361317(0x173));},'resolveJourneyId':async _0x14f080=>{const _0x3cd4ee=_0x41f5a8;try{return await _0x2ff1ad[_0x3cd4ee(0x151)][_0x3cd4ee(0x16d)](_0xbc529b[_0x3cd4ee(0x1c5)],_0x14f080);}catch(_0x1476e9){throw new SDKError(ErrorCode[_0x3cd4ee(0x228)],_0x3cd4ee(0x171)+_0x14f080+_0x3cd4ee(0x1c4)+_0x4f93a4[_0x3cd4ee(0x165)][_0x3cd4ee(0x1d5)]+'\x27)',_0x1476e9);}},'resolveStageId':async(_0x4ef880,_0x4c8961)=>{const _0x52485d=_0x41f5a8,_0x28e1dc=await _0x2ff1ad['journey'][_0x52485d(0x175)](_0x4ef880),_0x2d080e=_0x28e1dc[_0x52485d(0x225)][_0x52485d(0x202)]['find'](_0xe92646=>_0xe92646['name'][_0x52485d(0x163)]()===_0x4c8961[_0x52485d(0x163)]());if(!_0x2d080e?.['id'])throw new SDKError(ErrorCode[_0x52485d(0x228)],'Stage\x20\x27'+_0x4c8961+_0x52485d(0x1f0)+(_0x28e1dc[_0x52485d(0x225)][_0x52485d(0x1f4)]||_0x28e1dc[_0x52485d(0x225)]['name'])+'\x27');return _0x2d080e['id'];}},_0x6dd2a0=await _0x4c4505(_0x4f93a4['yamlConfig'],_0xbc529b[_0x41f5a8(0x1c5)],_0x5baa20),_0x1683d7=_0xbc529b['folderId']||_0xbc529b['rootFolderId'];_0x1683d7&&(_0x6dd2a0[_0x41f5a8(0x194)]={'parentFolder':{'data':{'id':_0x1683d7,'type':_0x41f5a8(0x168)}}});if(_0x4f93a4[_0x41f5a8(0x17b)]){if(_0x14c923['size']>0x0||_0x2de651[_0x41f5a8(0x18b)]>0x0)return await executeThreeStepJourneyCreate(_0x2ff1ad,_0x4f93a4,_0x6dd2a0,{'pendingEmbeddedSegments':_0x14c923,'pendingEmbeddedActivations':_0x2de651,'embeddedSegmentNameToId':_0x1e756c,'journeyActivationNameToId':_0x3b590a},{..._0xbc529b,'effectiveFolderId':_0x1683d7},_0x402972,_0x2ed66f,_0x384307);else{ensureJourneyDefaults(_0x6dd2a0[_0x41f5a8(0x225)]);const _0x4fe429=await _0x2ff1ad[_0x41f5a8(0x151)][_0x41f5a8(0x185)](_0x6dd2a0);return deletePushRecovery(_0x4f93a4['absolutePath']),{'action':_0x41f5a8(0x1b9),'journeyId':_0x4fe429['id'],'embeddedSegmentNameToId':_0x1e756c};}}else{if(_0x4f93a4[_0x41f5a8(0x21d)]&&_0x4f93a4[_0x41f5a8(0x23d)]){_0x6dd2a0['id']=_0x4f93a4[_0x41f5a8(0x23d)]['id'];const _0x3b9fe6=_0x6dd2a0[_0x41f5a8(0x225)];_0x4f93a4[_0x41f5a8(0x23d)][_0x41f5a8(0x225)]?.[_0x41f5a8(0x1f4)]&&(_0x3b9fe6[_0x41f5a8(0x1f4)]=_0x4f93a4['existingJourney']['attributes'][_0x41f5a8(0x1f4)]);const _0x4e2830=_0x4f93a4[_0x41f5a8(0x23d)][_0x41f5a8(0x225)]?.[_0x41f5a8(0x202)];return _0x4e2830&&_0x6dd2a0['attributes']['journeyStages']&&injectExistingStageIds(_0x6dd2a0[_0x41f5a8(0x225)][_0x41f5a8(0x202)],_0x4e2830),ensureJourneyDefaults(_0x3b9fe6),await _0x2ff1ad[_0x41f5a8(0x151)]['update'](_0x4f93a4[_0x41f5a8(0x23d)]['id'],_0x6dd2a0),deletePushRecovery(_0x4f93a4['absolutePath']),{'action':_0x41f5a8(0x239),'journeyId':_0x4f93a4['existingJourney']['id'],'embeddedSegmentNameToId':_0x1e756c};}}return deletePushRecovery(_0x4f93a4[_0x41f5a8(0x238)]),{'action':_0x41f5a8(0x241),'journeyId':_0x4f93a4[_0x41f5a8(0x23d)]?.['id'],'embeddedSegmentNameToId':_0x1e756c};}function findSegmentCriteriaLocation(_0xba82be,_0x5ee658){const _0x4228f6=a140_0x2d1abb,_0x3d318d=_0xba82be[_0x4228f6(0x1d1)]||_0xba82be['journeys']?.[0x0]?.[_0x4228f6(0x1d1)]||[];let _0x3616b2=_0x4228f6(0x15f),_0x2be877=_0x5ee658;const _0x7e2067=_0xba82be[_0x4228f6(0x182)]||_0xba82be[_0x4228f6(0x203)]?.[0x0]?.[_0x4228f6(0x182)];if(_0x7e2067?.[_0x4228f6(0x150)]===_0x5ee658)return{'stageName':_0x4228f6(0x182),'criteriaName':_0x7e2067[_0x4228f6(0x1d5)]||_0x5ee658};_0x1e965d:for(const _0xa31a07 of _0x3d318d){if(_0xa31a07[_0x4228f6(0x232)]?.[_0x4228f6(0x150)]===_0x5ee658){_0x3616b2=_0xa31a07[_0x4228f6(0x1d5)],_0x2be877=_0xa31a07[_0x4228f6(0x232)][_0x4228f6(0x1d5)]||_0x5ee658;break;}if(_0xa31a07[_0x4228f6(0x188)])for(const _0x1e2d56 of _0xa31a07[_0x4228f6(0x188)]){if(_0x1e2d56[_0x4228f6(0x19d)]===_0x4228f6(0x206)&&_0x1e2d56['with']?.[_0x4228f6(0x245)])for(const _0x431bf6 of _0x1e2d56[_0x4228f6(0x21e)][_0x4228f6(0x245)]){if(_0x431bf6[_0x4228f6(0x150)]===_0x5ee658){_0x3616b2=_0xa31a07['name'],_0x2be877=_0x431bf6[_0x4228f6(0x1d5)]||_0x5ee658;break _0x1e965d;}}}}return{'stageName':_0x3616b2,'criteriaName':_0x2be877};}async function executeThreeStepJourneyCreate(_0x5d6a16,_0x22519d,_0x58d146,_0x2562be,_0x54b9fb,_0x16bbbe,_0xe11df2,_0x1b40ff){const _0x5db076=a140_0x2d1abb,{activationDefToCreateRequest:_0x143f06,yamlRuleToApi:_0x541aa2}=_0x1b40ff,{pendingEmbeddedSegments:_0x2e7997,pendingEmbeddedActivations:_0x6ecc9c,embeddedSegmentNameToId:_0x59c92f}=_0x2562be,_0x1722e7=JSON[_0x5db076(0x1e0)](JSON[_0x5db076(0x21f)](_0x58d146));ensureJourneyDefaults(_0x1722e7[_0x5db076(0x225)]),stripPendingIds(_0x1722e7);const _0x4c0466=await _0x5d6a16[_0x5db076(0x151)][_0x5db076(0x185)](_0x1722e7),_0xa74da6=_0x4c0466['id'],_0x58dcba=new Map();for(const _0x3d8454 of _0x4c0466[_0x5db076(0x225)][_0x5db076(0x202)]){_0x58dcba[_0x5db076(0x1cf)](_0x3d8454[_0x5db076(0x1d5)][_0x5db076(0x163)](),_0x3d8454['id']);}recoverSegmentIdsFromPushRecovery(_0x22519d,_0x59c92f,_0x16bbbe[_0x5db076(0x1f6)]);for(const [_0x116796,{definition:_0x3a5045}]of _0x2e7997){if(_0x59c92f['has'](_0x116796)){_0xe11df2[_0x5db076(0x236)]?.({'type':_0x5db076(0x1b2),'journeyName':_0x22519d[_0x5db076(0x165)][_0x5db076(0x1d5)],'segmentName':_0x116796});continue;}const _0x59c9a6=generateDeterministicJourneySegmentName(_0x22519d[_0x5db076(0x165)][_0x5db076(0x1d5)],_0x116796);_0xe11df2[_0x5db076(0x236)]?.({'type':_0x5db076(0x1f3),'journeyName':_0x22519d[_0x5db076(0x165)][_0x5db076(0x1d5)],'segmentName':_0x116796});const _0x319b10=createSegmentIdResolver(_0x16bbbe[_0x5db076(0x1f6)],_0x116796),_0xa3fc80=await resolveRuleSegmentIds(_0x3a5045[_0x5db076(0x20b)],_0x319b10),_0x5522df=await createOrRecoverEmbeddedSegment(_0x5d6a16,_0x22519d,{'localName':_0x116796,'uniqueSegmentName':_0x59c9a6,'description':_0x3a5045['description']||_0x5db076(0x1f5)+_0x116796,'journeyId':_0xa74da6,'resolvedRule':_0xa3fc80,'parentId':_0x54b9fb[_0x5db076(0x1c5)],'folderId':_0x54b9fb[_0x5db076(0x1d2)]||''},_0x541aa2);_0x59c92f['set'](_0x116796,_0x5522df),_0x16bbbe[_0x5db076(0x1f6)]['set'](_0x116796,_0x5522df),_0xe11df2['onProgress']?.({'type':_0x5db076(0x1b2),'journeyName':_0x22519d[_0x5db076(0x165)][_0x5db076(0x1d5)],'segmentName':_0x116796});}const _0x2c74f5=new Map();for(const [_0x3b76ab,_0x4ecb8c]of _0x6ecc9c){_0xe11df2[_0x5db076(0x236)]?.({'type':_0x5db076(0x172),'journeyName':_0x22519d[_0x5db076(0x165)]['name'],'activationName':_0x3b76ab});const _0x29b32a=await _0x143f06(_0x4ecb8c,_0x16bbbe[_0x5db076(0x14c)]),_0x4eeaec={..._0x29b32a,..._0x4ecb8c[_0x5db076(0x16f)]!==undefined&&{'runAfterJourneyRefresh':_0x4ecb8c[_0x5db076(0x16f)]}},_0x30b3e8=await _0x5d6a16[_0x5db076(0x151)]['createActivation'](_0xa74da6,_0x4eeaec);_0x2c74f5['set'](_0x3b76ab,_0x30b3e8['id']),_0x2562be['journeyActivationNameToId'][_0x5db076(0x1cf)](_0x3b76ab,_0x30b3e8['id']),_0xe11df2[_0x5db076(0x236)]?.({'type':_0x5db076(0x1be),'journeyName':_0x22519d['yamlConfig'][_0x5db076(0x1d5)],'activationName':_0x3b76ab});}const _0x3d39b5=JSON['parse'](JSON[_0x5db076(0x21f)](_0x58d146));return _0x3d39b5['id']=_0xa74da6,ensureJourneyDefaults(_0x3d39b5['attributes']),resolvePendingIdsInRequest(_0x3d39b5,_0x58d146,_0x58dcba,_0x59c92f,_0x2c74f5,_0xe11df2),await _0x5d6a16[_0x5db076(0x151)][_0x5db076(0x1db)](_0xa74da6,_0x3d39b5),deletePushRecovery(_0x22519d[_0x5db076(0x238)]),{'action':'created','journeyId':_0xa74da6,'embeddedSegmentNameToId':_0x59c92f};}export function stripWaitStepPendingIds(_0x523c9e){const _0x312561=a140_0x2d1abb,_0x52b1d7=_0x523c9e[_0x312561(0x1f7)]&&isPendingSegmentId(_0x523c9e[_0x312561(0x1f7)]),_0x1fcddb=_0x523c9e[_0x312561(0x1e6)]?.[_0x312561(0x223)](_0x545a04=>_0x545a04[_0x312561(0x231)]&&isPendingSegmentId(_0x545a04[_0x312561(0x231)]));(_0x52b1d7||_0x1fcddb)&&(_0x523c9e[_0x312561(0x17c)]=_0x312561(0x22f),_0x523c9e[_0x312561(0x20a)]=0x1,_0x523c9e['waitStepUnit']='day',delete _0x523c9e[_0x312561(0x1f7)],delete _0x523c9e[_0x312561(0x197)],delete _0x523c9e[_0x312561(0x1ed)],delete _0x523c9e[_0x312561(0x1e6)]);}export function resolveWaitStepPendingIds(_0x24a381,_0x151831,_0x1fba93,_0xb71028){const _0x5200c1=a140_0x2d1abb;if(_0x151831[_0x5200c1(0x1f7)]&&isPendingSegmentId(_0x151831['conditionSegmentId'])){const _0xb9e29=_0x1fba93(_0x151831[_0x5200c1(0x1f7)],_0x5200c1(0x14e)+_0xb71028+_0x5200c1(0x1b6));_0xb9e29&&(_0x24a381[_0x5200c1(0x17c)]=_0x5200c1(0x1ad),_0x24a381['conditionSegmentId']=_0xb9e29,delete _0x24a381[_0x5200c1(0x20a)],delete _0x24a381['waitStepUnit'],_0x151831[_0x5200c1(0x197)]!==undefined&&(_0x24a381['conditionTimeoutDuration']=_0x151831[_0x5200c1(0x197)]),_0x151831[_0x5200c1(0x1ed)]&&(_0x24a381[_0x5200c1(0x1ed)]=_0x151831['conditionTimeoutUnit']));}if(_0x151831[_0x5200c1(0x1e6)]){const _0x9c5991=_0x151831[_0x5200c1(0x1e6)][_0x5200c1(0x223)](_0x2ef0f5=>_0x2ef0f5[_0x5200c1(0x231)]&&isPendingSegmentId(_0x2ef0f5['segmentId']));if(_0x9c5991){const _0xccf930=_0x151831[_0x5200c1(0x1e6)]['map'](_0x4cb27b=>{const _0x780141=_0x5200c1;if(_0x4cb27b[_0x780141(0x231)]&&isPendingSegmentId(_0x4cb27b['segmentId'])){const _0xd514c0=_0x1fba93(_0x4cb27b[_0x780141(0x231)],_0x780141(0x14e)+_0xb71028+_0x780141(0x1b6));return{..._0x4cb27b,'segmentId':_0xd514c0||_0x4cb27b[_0x780141(0x231)]};}return{..._0x4cb27b};});_0x24a381['waitStepType']='Condition',_0x24a381[_0x5200c1(0x1e6)]=_0xccf930,delete _0x24a381['waitStep'],delete _0x24a381[_0x5200c1(0x221)],delete _0x24a381['conditionSegmentId'],delete _0x24a381[_0x5200c1(0x197)],delete _0x24a381[_0x5200c1(0x1ed)];}}}function stripPendingIds(_0x4066f6){const _0x216f15=a140_0x2d1abb;_0x4066f6[_0x216f15(0x225)][_0x216f15(0x182)]?.['segmentId']&&isPendingSegmentId(_0x4066f6[_0x216f15(0x225)][_0x216f15(0x182)][_0x216f15(0x231)])&&delete _0x4066f6[_0x216f15(0x225)]['goal'];for(const _0x1dadde of _0x4066f6['attributes'][_0x216f15(0x202)]||[]){_0x1dadde[_0x216f15(0x16b)]?.[_0x216f15(0x231)]&&isPendingSegmentId(_0x1dadde['entryCriteria'][_0x216f15(0x231)])&&delete _0x1dadde[_0x216f15(0x16b)];_0x1dadde[_0x216f15(0x1fb)]?.[_0x216f15(0x231)]&&isPendingSegmentId(_0x1dadde[_0x216f15(0x1fb)]['segmentId'])&&delete _0x1dadde[_0x216f15(0x1fb)];_0x1dadde[_0x216f15(0x190)]&&(_0x1dadde[_0x216f15(0x190)]=_0x1dadde[_0x216f15(0x190)][_0x216f15(0x177)](_0x3b351e=>!_0x3b351e[_0x216f15(0x231)]||!isPendingSegmentId(_0x3b351e[_0x216f15(0x231)])));if(_0x1dadde[_0x216f15(0x188)])for(const _0x5e7182 of Object[_0x216f15(0x244)](_0x1dadde[_0x216f15(0x188)])){const _0x1518b7=_0x1dadde['steps'][_0x5e7182];_0x1518b7['type']===_0x216f15(0x22d)&&_0x1518b7['journeyActivationStepId']&&isPendingActivationId(_0x1518b7[_0x216f15(0x21a)])&&(_0x1518b7[_0x216f15(0x21a)]='');if(_0x1518b7['type']===_0x216f15(0x198)&&_0x1518b7['branches'])for(const _0xe39a86 of _0x1518b7[_0x216f15(0x245)]){_0xe39a86[_0x216f15(0x231)]&&isPendingSegmentId(_0xe39a86[_0x216f15(0x231)])&&(_0xe39a86[_0x216f15(0x231)]='');}_0x1518b7[_0x216f15(0x19d)]===_0x216f15(0x1df)&&stripWaitStepPendingIds(_0x1518b7);}}}function resolvePendingIdsInRequest(_0x4b01ce,_0x3059a9,_0x13ad51,_0x118226,_0x1c0fd2,_0x3ac669){const _0x34a6a7=a140_0x2d1abb,_0x2e50a4=(_0x5354db,_0x2fb4e9)=>{const _0xe9c746=a140_0x4f0a;if(!isPendingSegmentId(_0x5354db))return _0x5354db;const _0x43a760=extractPendingSegmentName(_0x5354db),_0x417939=_0x118226['get'](_0x43a760);return!_0x417939&&_0x3ac669['logWarning']?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x43a760+_0xe9c746(0x23c)+_0x2fb4e9),_0x417939;};if(_0x4b01ce[_0x34a6a7(0x225)][_0x34a6a7(0x182)]?.['segmentId']&&isPendingSegmentId(_0x4b01ce['attributes'][_0x34a6a7(0x182)][_0x34a6a7(0x231)])){const _0x5dd734=_0x2e50a4(_0x4b01ce[_0x34a6a7(0x225)][_0x34a6a7(0x182)][_0x34a6a7(0x231)],_0x34a6a7(0x1ac));_0x5dd734&&(_0x4b01ce[_0x34a6a7(0x225)][_0x34a6a7(0x182)][_0x34a6a7(0x231)]=_0x5dd734);}for(const _0x2127d1 of _0x4b01ce['attributes']['journeyStages']||[]){const _0x550e3f=_0x13ad51[_0x34a6a7(0x160)](_0x2127d1[_0x34a6a7(0x1d5)][_0x34a6a7(0x163)]());_0x550e3f&&(_0x2127d1['id']=_0x550e3f);if(_0x2127d1[_0x34a6a7(0x16b)]?.[_0x34a6a7(0x231)]&&isPendingSegmentId(_0x2127d1[_0x34a6a7(0x16b)][_0x34a6a7(0x231)])){const _0x5e9303=_0x2e50a4(_0x2127d1[_0x34a6a7(0x16b)][_0x34a6a7(0x231)],_0x34a6a7(0x14e)+_0x2127d1[_0x34a6a7(0x1d5)]+_0x34a6a7(0x16e));_0x5e9303&&(_0x2127d1[_0x34a6a7(0x16b)][_0x34a6a7(0x231)]=_0x5e9303);}if(_0x2127d1[_0x34a6a7(0x190)])for(const _0x9b344f of _0x2127d1[_0x34a6a7(0x190)]){if(_0x9b344f[_0x34a6a7(0x231)]&&isPendingSegmentId(_0x9b344f[_0x34a6a7(0x231)])){const _0x251030=_0x2e50a4(_0x9b344f['segmentId'],_0x34a6a7(0x14e)+_0x2127d1[_0x34a6a7(0x1d5)]+_0x34a6a7(0x20d));_0x251030&&(_0x9b344f[_0x34a6a7(0x231)]=_0x251030);}}if(_0x2127d1[_0x34a6a7(0x1fb)]?.[_0x34a6a7(0x231)]&&isPendingSegmentId(_0x2127d1[_0x34a6a7(0x1fb)][_0x34a6a7(0x231)])){const _0x2c1f3a=_0x2e50a4(_0x2127d1[_0x34a6a7(0x1fb)][_0x34a6a7(0x231)],'stage\x20\x27'+_0x2127d1[_0x34a6a7(0x1d5)]+'\x27\x20milestone');_0x2c1f3a&&(_0x2127d1[_0x34a6a7(0x1fb)][_0x34a6a7(0x231)]=_0x2c1f3a);}if(_0x2127d1[_0x34a6a7(0x188)]){const _0x31eb41=_0x16aa8b=>_0x3059a9[_0x34a6a7(0x225)][_0x34a6a7(0x202)]?.[_0x34a6a7(0x1ba)](_0x5c5cc6=>_0x5c5cc6[_0x34a6a7(0x1d5)]['toLowerCase']()===_0x2127d1[_0x34a6a7(0x1d5)][_0x34a6a7(0x163)]())?.[_0x34a6a7(0x188)]?.[_0x16aa8b];for(const _0x1fa6dd of Object[_0x34a6a7(0x244)](_0x2127d1[_0x34a6a7(0x188)])){const _0x507cbd=_0x2127d1[_0x34a6a7(0x188)][_0x1fa6dd],_0x56310e=_0x31eb41(_0x1fa6dd);if(_0x507cbd[_0x34a6a7(0x19d)]==='Activation'&&_0x507cbd[_0x34a6a7(0x21a)]&&(isPendingActivationId(_0x507cbd[_0x34a6a7(0x21a)])||_0x507cbd[_0x34a6a7(0x21a)]==='')){if(_0x56310e?.[_0x34a6a7(0x21a)]&&isPendingActivationId(_0x56310e[_0x34a6a7(0x21a)])){const _0x38b0ea=extractPendingActivationName(_0x56310e[_0x34a6a7(0x21a)]),_0x385fe3=_0x1c0fd2[_0x34a6a7(0x160)](_0x38b0ea);_0x385fe3&&(_0x507cbd['journeyActivationStepId']=_0x385fe3);}}if(_0x507cbd[_0x34a6a7(0x19d)]===_0x34a6a7(0x198)&&_0x507cbd[_0x34a6a7(0x245)]&&_0x56310e?.['branches'])for(let _0x5cdbb1=0x0;_0x5cdbb1<_0x507cbd[_0x34a6a7(0x245)]['length'];_0x5cdbb1++){const _0x127e26=_0x507cbd[_0x34a6a7(0x245)][_0x5cdbb1],_0x3c6821=_0x56310e[_0x34a6a7(0x245)][_0x5cdbb1];if(_0x3c6821?.['segmentId']&&isPendingSegmentId(_0x3c6821[_0x34a6a7(0x231)])){const _0x18f769=_0x2e50a4(_0x3c6821[_0x34a6a7(0x231)],_0x34a6a7(0x14e)+_0x2127d1[_0x34a6a7(0x1d5)]+_0x34a6a7(0x1f2)+(_0x127e26[_0x34a6a7(0x1d5)]||_0x5cdbb1)+'\x27');_0x18f769&&(_0x127e26[_0x34a6a7(0x231)]=_0x18f769);}}_0x507cbd[_0x34a6a7(0x19d)]===_0x34a6a7(0x1df)&&_0x56310e?.['type']===_0x34a6a7(0x1df)&&resolveWaitStepPendingIds(_0x507cbd,_0x56310e,_0x2e50a4,_0x2127d1['name']);}}}}
@@ -1 +1 @@
1
- (function(_0x1b8477,_0xa471b3){const _0x2340ca=a141_0x46f7,_0x1604e1=_0x1b8477();while(!![]){try{const _0x4039d4=-parseInt(_0x2340ca(0x19b))/0x1+-parseInt(_0x2340ca(0x192))/0x2*(-parseInt(_0x2340ca(0x19f))/0x3)+parseInt(_0x2340ca(0x19a))/0x4*(-parseInt(_0x2340ca(0x195))/0x5)+-parseInt(_0x2340ca(0x19c))/0x6+parseInt(_0x2340ca(0x197))/0x7*(-parseInt(_0x2340ca(0x193))/0x8)+parseInt(_0x2340ca(0x19d))/0x9+parseInt(_0x2340ca(0x199))/0xa;if(_0x4039d4===_0xa471b3)break;else _0x1604e1['push'](_0x1604e1['shift']());}catch(_0x2a029f){_0x1604e1['push'](_0x1604e1['shift']());}}}(a141_0x5058,0x397f5));export function buildFolderIdToPathMap(_0x27c392){const _0x5a2254=a141_0x46f7,_0x2859a8=new Map(),_0x49e92e=new Map();for(const _0x51d61a of _0x27c392){_0x49e92e[_0x5a2254(0x19e)](_0x51d61a['id'],_0x51d61a);}const _0xd85a62=new Set();for(const _0x2f5359 of _0x27c392){!_0x2f5359[_0x5a2254(0x196)]&&_0xd85a62[_0x5a2254(0x1a0)](_0x2f5359['id']);}function _0x47eae7(_0x594f73){const _0x529509=_0x5a2254;if(_0x2859a8[_0x529509(0x1a1)](_0x594f73['id']))return _0x2859a8['get'](_0x594f73['id']);if(_0xd85a62[_0x529509(0x1a1)](_0x594f73['id']))return _0x2859a8['set'](_0x594f73['id'],''),'';if(_0x594f73[_0x529509(0x196)]){const _0x1e81f2=_0x49e92e['get'](_0x594f73[_0x529509(0x196)]);if(_0x1e81f2){const _0x41604c=_0x47eae7(_0x1e81f2),_0x64bd01=_0x41604c?_0x41604c+'/'+_0x594f73[_0x529509(0x194)]:_0x594f73[_0x529509(0x194)];return _0x2859a8[_0x529509(0x19e)](_0x594f73['id'],_0x64bd01),_0x64bd01;}}const _0xca77c=_0x594f73[_0x529509(0x194)];return _0x2859a8[_0x529509(0x19e)](_0x594f73['id'],_0xca77c),_0xca77c;}for(const _0x483a5e of _0x27c392){_0x47eae7(_0x483a5e);}return _0x2859a8;}export function buildFolderPathToIdMap(_0x588206){const _0x382765=a141_0x46f7,_0x30d86e=new Map(),_0x94da5=new Map();for(const _0x408c3b of _0x588206){_0x94da5['set'](_0x408c3b['id'],_0x408c3b);}const _0x46513b=new Set();for(const _0x42d4e3 of _0x588206){!_0x42d4e3[_0x382765(0x196)]&&_0x46513b['add'](_0x42d4e3['id']);}function _0x3497b1(_0x1c668d){const _0x1a0d1a=_0x382765;if(_0x46513b['has'](_0x1c668d['id']))return'';if(_0x1c668d['parentFolderId']){const _0x5763d2=_0x94da5[_0x1a0d1a(0x198)](_0x1c668d[_0x1a0d1a(0x196)]);if(_0x5763d2){const _0x43f6a7=_0x3497b1(_0x5763d2);return _0x43f6a7?_0x43f6a7+'/'+_0x1c668d[_0x1a0d1a(0x194)]:_0x1c668d[_0x1a0d1a(0x194)];}}return _0x1c668d[_0x1a0d1a(0x194)];}for(const _0x145c1d of _0x588206){const _0xe4a757=_0x3497b1(_0x145c1d);_0x30d86e[_0x382765(0x19e)](_0xe4a757,_0x145c1d['id']);}return _0x30d86e;}export function buildFolderMaps(_0x52d2be){const _0x44a490=a141_0x46f7,_0x251eb0=buildFolderIdToPathMap(_0x52d2be),_0x26a60c=new Map();for(const [_0x528437,_0x55ef63]of _0x251eb0){_0x26a60c[_0x44a490(0x19e)](_0x55ef63,_0x528437);}return{'idToPath':_0x251eb0,'pathToId':_0x26a60c};}function a141_0x46f7(_0x1cb1f4,_0x23ecba){_0x1cb1f4=_0x1cb1f4-0x192;const _0x505864=a141_0x5058();let _0x46f70d=_0x505864[_0x1cb1f4];return _0x46f70d;}function a141_0x5058(){const _0x279f42=['parentFolderId','2590eGnKZI','get','1582540zhlbbr','88096imDFUu','71331mSNpGW','735144qViJFt','3331071DTNWjn','set','3MvnKEy','add','has','920834smIvoD','3048KjzQuJ','name','95lEnOwz'];a141_0x5058=function(){return _0x279f42;};return a141_0x5058();}export function getFolderPath(_0x5a384d,_0x18834e){const _0x37b15d=a141_0x46f7;if(!_0x5a384d)return'';return _0x18834e[_0x37b15d(0x198)](_0x5a384d)??'';}
1
+ (function(_0x141010,_0x5848fa){const _0x13b71b=a141_0x5336,_0x283b6a=_0x141010();while(!![]){try{const _0x153011=parseInt(_0x13b71b(0x113))/0x1*(parseInt(_0x13b71b(0x110))/0x2)+-parseInt(_0x13b71b(0x10a))/0x3+-parseInt(_0x13b71b(0x10c))/0x4*(-parseInt(_0x13b71b(0x112))/0x5)+-parseInt(_0x13b71b(0x107))/0x6+parseInt(_0x13b71b(0x10f))/0x7*(parseInt(_0x13b71b(0x111))/0x8)+parseInt(_0x13b71b(0x115))/0x9*(-parseInt(_0x13b71b(0x116))/0xa)+parseInt(_0x13b71b(0x10d))/0xb;if(_0x153011===_0x5848fa)break;else _0x283b6a['push'](_0x283b6a['shift']());}catch(_0x3b333f){_0x283b6a['push'](_0x283b6a['shift']());}}}(a141_0x6bac,0x80424));function a141_0x6bac(){const _0x18bc6f=['8862557lKHeuA','set','3358733otrnVV','4274BKucLe','8rbEPif','175135MqvOjc','43bqVIZE','parentFolderId','605034edwcMX','70WWOgRp','name','1829160cfYjUR','add','get','439983IQkQkX','has','8lzBUUn'];a141_0x6bac=function(){return _0x18bc6f;};return a141_0x6bac();}function a141_0x5336(_0x5932f5,_0x34c16a){_0x5932f5=_0x5932f5-0x106;const _0x6bac07=a141_0x6bac();let _0x533630=_0x6bac07[_0x5932f5];return _0x533630;}export function buildFolderIdToPathMap(_0x4100e3){const _0x526890=a141_0x5336,_0x3a06b1=new Map(),_0x2d9ab2=new Map();for(const _0x395aa1 of _0x4100e3){_0x2d9ab2[_0x526890(0x10e)](_0x395aa1['id'],_0x395aa1);}const _0x595229=new Set();for(const _0x10f2d7 of _0x4100e3){!_0x10f2d7[_0x526890(0x114)]&&_0x595229['add'](_0x10f2d7['id']);}function _0xea4164(_0x44d7ab){const _0x5125b4=_0x526890;if(_0x3a06b1[_0x5125b4(0x10b)](_0x44d7ab['id']))return _0x3a06b1[_0x5125b4(0x109)](_0x44d7ab['id']);if(_0x595229['has'](_0x44d7ab['id']))return _0x3a06b1[_0x5125b4(0x10e)](_0x44d7ab['id'],''),'';if(_0x44d7ab[_0x5125b4(0x114)]){const _0x1b88f1=_0x2d9ab2[_0x5125b4(0x109)](_0x44d7ab[_0x5125b4(0x114)]);if(_0x1b88f1){const _0x1b061c=_0xea4164(_0x1b88f1),_0x445e0d=_0x1b061c?_0x1b061c+'/'+_0x44d7ab['name']:_0x44d7ab[_0x5125b4(0x106)];return _0x3a06b1['set'](_0x44d7ab['id'],_0x445e0d),_0x445e0d;}}const _0x2911b8=_0x44d7ab['name'];return _0x3a06b1[_0x5125b4(0x10e)](_0x44d7ab['id'],_0x2911b8),_0x2911b8;}for(const _0x3789b0 of _0x4100e3){_0xea4164(_0x3789b0);}return _0x3a06b1;}export function buildFolderPathToIdMap(_0x1a6b55){const _0x5610de=a141_0x5336,_0x43533f=new Map(),_0x120556=new Map();for(const _0x102ff5 of _0x1a6b55){_0x120556['set'](_0x102ff5['id'],_0x102ff5);}const _0x5a9bf2=new Set();for(const _0x450ab2 of _0x1a6b55){!_0x450ab2[_0x5610de(0x114)]&&_0x5a9bf2[_0x5610de(0x108)](_0x450ab2['id']);}function _0x52f102(_0xac11e1){const _0x1a9c26=_0x5610de;if(_0x5a9bf2[_0x1a9c26(0x10b)](_0xac11e1['id']))return'';if(_0xac11e1['parentFolderId']){const _0x3d2164=_0x120556['get'](_0xac11e1[_0x1a9c26(0x114)]);if(_0x3d2164){const _0x2c8b6b=_0x52f102(_0x3d2164);return _0x2c8b6b?_0x2c8b6b+'/'+_0xac11e1[_0x1a9c26(0x106)]:_0xac11e1['name'];}}return _0xac11e1[_0x1a9c26(0x106)];}for(const _0x21ad26 of _0x1a6b55){const _0x11da75=_0x52f102(_0x21ad26);_0x43533f[_0x5610de(0x10e)](_0x11da75,_0x21ad26['id']);}return _0x43533f;}export function buildFolderMaps(_0x5e6dcb){const _0x1dff11=a141_0x5336,_0x11509a=buildFolderIdToPathMap(_0x5e6dcb),_0x5692cc=new Map();for(const [_0x1efde0,_0x310772]of _0x11509a){_0x5692cc[_0x1dff11(0x10e)](_0x310772,_0x1efde0);}return{'idToPath':_0x11509a,'pathToId':_0x5692cc};}export function getFolderPath(_0x34dccd,_0x2dc68c){const _0x182df3=a141_0x5336;if(!_0x34dccd)return'';return _0x2dc68c[_0x182df3(0x109)](_0x34dccd)??'';}
@@ -1 +1 @@
1
- (function(_0x3a9198,_0x291cef){const _0x4025fc=a142_0x1fde,_0x43de19=_0x3a9198();while(!![]){try{const _0x22c99c=parseInt(_0x4025fc(0x108))/0x1*(-parseInt(_0x4025fc(0x122))/0x2)+parseInt(_0x4025fc(0xf6))/0x3*(-parseInt(_0x4025fc(0x11b))/0x4)+parseInt(_0x4025fc(0xf2))/0x5*(parseInt(_0x4025fc(0xfd))/0x6)+-parseInt(_0x4025fc(0x112))/0x7+-parseInt(_0x4025fc(0x100))/0x8+parseInt(_0x4025fc(0xf8))/0x9*(parseInt(_0x4025fc(0x106))/0xa)+parseInt(_0x4025fc(0xf3))/0xb;if(_0x22c99c===_0x291cef)break;else _0x43de19['push'](_0x43de19['shift']());}catch(_0x127e60){_0x43de19['push'](_0x43de19['shift']());}}}(a142_0x5e8d,0x28aae));import a142_0x423373 from'path';import{parse as a142_0x249842}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x23583f){const _0x11732d=a142_0x1fde;if(!_0x23583f||_0x23583f[_0x11732d(0xfb)]()==='')throw new Error(_0x11732d(0x116));const _0x4fc9ce=_0x23583f['trim']();if(_0x4fc9ce==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x23583f};const _0x27b93f=_0x4fc9ce[_0x11732d(0x11f)]('/')?_0x4fc9ce[_0x11732d(0xfc)](0x1):_0x4fc9ce,_0x481e52=_0x27b93f['split']('/')[_0x11732d(0x118)](_0x535dec=>_0x535dec!=='');if(_0x481e52[_0x11732d(0x10d)]===0x0)throw new Error(_0x11732d(0x113));const _0xd25abb=_0x4fc9ce[_0x11732d(0x11f)]('/')||!isRelativePathSegment(_0x481e52[0x0]);for(const _0x35a734 of _0x481e52){validatePathSegment(_0x35a734);}return{'segments':_0x481e52,'isAbsolute':_0xd25abb,'raw':_0x23583f};}function isRelativePathSegment(_0x52674d){return _0x52674d==='.'||_0x52674d==='..';}function validatePathSegment(_0x3a52a0){const _0x134ad3=a142_0x1fde;if(_0x3a52a0==='')throw new Error(_0x134ad3(0x10c));if(_0x3a52a0==='.'||_0x3a52a0==='..')return;if(/[\x00-\x1F\x7F]/[_0x134ad3(0x104)](_0x3a52a0))throw new Error(_0x134ad3(0x120)+_0x3a52a0);if(_0x3a52a0!==_0x3a52a0[_0x134ad3(0xfb)]()){}}export function validatePath(_0x5a15c4){const _0x1507f8=a142_0x1fde;if(_0x5a15c4[_0x1507f8(0x11a)][_0x1507f8(0x10d)]===0x0&&!_0x5a15c4[_0x1507f8(0xf7)])throw new Error(_0x1507f8(0x10a));if(_0x5a15c4[_0x1507f8(0xf7)]){if(_0x5a15c4['segments'][0x0]==='..')throw new Error(_0x1507f8(0x11e));let _0x76c980=0x0;for(const _0x56df85 of _0x5a15c4[_0x1507f8(0x11a)]){if(_0x56df85==='..'){if(_0x76c980===0x0)throw new Error(_0x1507f8(0x111));_0x76c980--;}else _0x56df85!=='.'&&_0x76c980++;}}}export function joinPaths(_0x521efd,_0x5554e3){const _0x52d498=a142_0x1fde;if(!_0x521efd||_0x521efd==='/')return _0x5554e3;if(!_0x5554e3||_0x5554e3==='.')return _0x521efd;if(_0x5554e3[_0x52d498(0x11f)]('/'))return _0x5554e3;const _0x331b31=parsePath(_0x521efd),_0x4b96d3=parsePath(_0x5554e3),_0x5621b2=[..._0x331b31['segments']];for(const _0x249b5f of _0x4b96d3[_0x52d498(0x11a)]){if(_0x249b5f==='.')continue;else{if(_0x249b5f==='..'){if(_0x5621b2[_0x52d498(0x10d)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x5621b2['pop']();}else _0x5621b2[_0x52d498(0x121)](_0x249b5f);}}const _0x201931=_0x5621b2['join']('/');return _0x331b31[_0x52d498(0x10b)][_0x52d498(0x11f)]('/')?'/'+_0x201931:_0x201931;}export function normalizePath(_0x415d9b){const _0x530a79=a142_0x1fde,_0x4bfbca=parsePath(_0x415d9b),_0x173866=[];for(const _0x4a5315 of _0x4bfbca[_0x530a79(0x11a)]){if(_0x4a5315==='.')continue;else{if(_0x4a5315==='..'){if(_0x173866[_0x530a79(0x10d)]===0x0){if(_0x4bfbca[_0x530a79(0xf7)])throw new Error(_0x530a79(0x101));_0x173866[_0x530a79(0x121)]('..');}else _0x173866[_0x173866[_0x530a79(0x10d)]-0x1]==='..'?_0x173866[_0x530a79(0x121)]('..'):_0x173866['pop']();}else _0x173866[_0x530a79(0x121)](_0x4a5315);}}if(_0x173866['length']===0x0)return _0x4bfbca[_0x530a79(0xf7)]?'/':'.';const _0xb76903=_0x173866[_0x530a79(0xf4)]('/');return _0x4bfbca['raw']['startsWith']('/')?'/'+_0xb76903:_0xb76903;}export function getParentPath(_0x397431){const _0x46bcb7=a142_0x1fde,_0x27b758=parsePath(_0x397431);if(_0x27b758[_0x46bcb7(0x11a)][_0x46bcb7(0x10d)]<=0x1)return'/';const _0x272a73=_0x27b758['segments'][_0x46bcb7(0x115)](0x0,-0x1)['join']('/');return _0x27b758[_0x46bcb7(0x10b)]['startsWith']('/')?'/'+_0x272a73:_0x272a73;}function a142_0x5e8d(){const _0x22bff2=['90ULDXWF','parse','215062epIfza','.yml','Relative\x20path\x20cannot\x20be\x20empty','raw','Path\x20segment\x20cannot\x20be\x20empty','length','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','dirname','name','Path\x20attempts\x20to\x20navigate\x20above\x20root','2082122GlpjBG','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','root','slice','Path\x20cannot\x20be\x20empty','parent_segment','filter','replace','segments','12OvFoAm','tdx.json','Cannot\x20split\x20empty\x20path','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','startsWith','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','push','2vkZGuA','33610sdtAvY','9213919GosgAp','join','File\x20not\x20found:\x20','85713QdmNSJ','isAbsolute','94518JvJPOC','readFile','endsWith','trim','substring','108yGhVHg','.yaml','No\x20tdx.json\x20found\x20for\x20file:\x20','2306784OaGCPP','Cannot\x20navigate\x20above\x20root','segment','journey','test','exists'];a142_0x5e8d=function(){return _0x22bff2;};return a142_0x5e8d();}export function getBaseName(_0x5960c3){const _0x3e1a6d=a142_0x1fde,_0x563b6f=parsePath(_0x5960c3);return _0x563b6f[_0x3e1a6d(0x11a)][_0x563b6f[_0x3e1a6d(0x11a)][_0x3e1a6d(0x10d)]-0x1]||'';}export function isChildPath(_0x99cef3,_0x99dd05){const _0x324d0e=a142_0x1fde,_0x521aa6=parsePath(_0x99cef3),_0x565e7c=parsePath(_0x99dd05);if(_0x521aa6[_0x324d0e(0x11a)][_0x324d0e(0x10d)]<=_0x565e7c[_0x324d0e(0x11a)][_0x324d0e(0x10d)])return![];for(let _0x197e36=0x0;_0x197e36<_0x565e7c['segments'][_0x324d0e(0x10d)];_0x197e36++){if(_0x521aa6['segments'][_0x197e36]!==_0x565e7c[_0x324d0e(0x11a)][_0x197e36])return![];}return!![];}function a142_0x1fde(_0x5d94ab,_0x459785){_0x5d94ab=_0x5d94ab-0xf2;const _0x5e8d4d=a142_0x5e8d();let _0x1fde7c=_0x5e8d4d[_0x5d94ab];return _0x1fde7c;}export function splitPath(_0xff220d){const _0x12c543=a142_0x1fde,_0x146cd0=parsePath(_0xff220d);if(_0x146cd0[_0x12c543(0x11a)][_0x12c543(0x10d)]===0x0)throw new Error(_0x12c543(0x11d));if(_0x146cd0[_0x12c543(0x11a)]['length']===0x1)return{'parent':_0x146cd0['segments'][0x0]};return{'parent':_0x146cd0[_0x12c543(0x11a)][0x0],'child':_0x146cd0['segments']['slice'](0x1)[_0x12c543(0xf4)]('/')};}export function isYamlFilePath(_0x119269){const _0x187448=a142_0x1fde;return _0x119269[_0x187448(0xfa)](_0x187448(0x109))||_0x119269['endsWith'](_0x187448(0xfe));}export async function resolveYamlFilePath(_0x20e5f1,_0x3a1f5e=nodeFileSystem){const _0x165d55=a142_0x1fde,_0x2adb42=a142_0x423373['resolve'](_0x20e5f1);if(!await _0x3a1f5e[_0x165d55(0x105)](_0x2adb42))throw new Error(_0x165d55(0xf5)+_0x20e5f1);let _0x382901=a142_0x423373[_0x165d55(0x10f)](_0x2adb42),_0x52ca66=null,_0x593d32=null;const _0x434d43=a142_0x423373[_0x165d55(0x107)](_0x382901)[_0x165d55(0x114)];while(_0x382901!==_0x434d43){const _0x5db579=a142_0x423373['join'](_0x382901,_0x165d55(0x11c));if(await _0x3a1f5e['exists'](_0x5db579)){_0x52ca66=_0x5db579,_0x593d32=_0x382901;break;}_0x382901=a142_0x423373[_0x165d55(0x10f)](_0x382901);}if(!_0x52ca66||!_0x593d32)throw new Error(_0x165d55(0xff)+_0x20e5f1+'\x0a'+_0x165d55(0x10e));const _0x2e47e5=await _0x3a1f5e['readFile'](_0x52ca66),_0x4120d8=JSON[_0x165d55(0x107)](_0x2e47e5),_0xf1d6e8=_0x4120d8[_0x165d55(0x117)];if(!_0xf1d6e8)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x1c4be9=await _0x3a1f5e[_0x165d55(0xf9)](_0x2adb42),_0x34d543=a142_0x249842(_0x1c4be9),_0x5d7725=_0x34d543[_0x165d55(0x110)];if(!_0x5d7725)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x20e5f1);const _0x1d98f1=_0x34d543['type']===_0x165d55(0x103)?_0x165d55(0x103):_0x165d55(0x102),_0xee7ab7=a142_0x423373['relative'](_0x593d32,_0x2adb42),_0x566e2d=a142_0x423373[_0x165d55(0x10f)](_0xee7ab7),_0x5634a8=_0x566e2d==='.'?'':_0x566e2d[_0x165d55(0x119)](/\\/g,'/'),_0x1ef39a=_0x5634a8?_0xf1d6e8+'/'+_0x5634a8+'/'+_0x5d7725:_0xf1d6e8+'/'+_0x5d7725;return{'parentSegment':_0xf1d6e8,'segmentName':_0x5d7725,'folderPath':_0x5634a8,'fullPath':_0x1ef39a,'resourceType':_0x1d98f1,'content':_0x1c4be9};}
1
+ (function(_0x5d253a,_0x29fb9a){const _0x2cf7ce=a142_0x5e78,_0x12dfe1=_0x5d253a();while(!![]){try{const _0x366409=parseInt(_0x2cf7ce(0xf9))/0x1+-parseInt(_0x2cf7ce(0xe5))/0x2*(parseInt(_0x2cf7ce(0xe7))/0x3)+parseInt(_0x2cf7ce(0xd4))/0x4*(-parseInt(_0x2cf7ce(0xf7))/0x5)+parseInt(_0x2cf7ce(0x100))/0x6+parseInt(_0x2cf7ce(0xd9))/0x7*(-parseInt(_0x2cf7ce(0xee))/0x8)+-parseInt(_0x2cf7ce(0x101))/0x9*(parseInt(_0x2cf7ce(0x103))/0xa)+-parseInt(_0x2cf7ce(0xec))/0xb*(parseInt(_0x2cf7ce(0xf1))/0xc);if(_0x366409===_0x29fb9a)break;else _0x12dfe1['push'](_0x12dfe1['shift']());}catch(_0x15e133){_0x12dfe1['push'](_0x12dfe1['shift']());}}}(a142_0x5bdb,0x3397e));import a142_0x287075 from'path';function a142_0x5e78(_0xbfbb17,_0x547e32){_0xbfbb17=_0xbfbb17-0xd1;const _0x5bdb9c=a142_0x5bdb();let _0x5e781f=_0x5bdb9c[_0xbfbb17];return _0x5e781f;}import{parse as a142_0x4950ae}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x170dfa){const _0x336abe=a142_0x5e78;if(!_0x170dfa||_0x170dfa['trim']()==='')throw new Error(_0x336abe(0xdb));const _0x1dba37=_0x170dfa['trim']();if(_0x1dba37==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x170dfa};const _0x383173=_0x1dba37[_0x336abe(0xf6)]('/')?_0x1dba37['substring'](0x1):_0x1dba37,_0x4e755a=_0x383173[_0x336abe(0xde)]('/')[_0x336abe(0xef)](_0x3eab89=>_0x3eab89!=='');if(_0x4e755a[_0x336abe(0xf3)]===0x0)throw new Error(_0x336abe(0xdd));const _0xb12e9e=_0x1dba37[_0x336abe(0xf6)]('/')||!isRelativePathSegment(_0x4e755a[0x0]);for(const _0x4f3714 of _0x4e755a){validatePathSegment(_0x4f3714);}return{'segments':_0x4e755a,'isAbsolute':_0xb12e9e,'raw':_0x170dfa};}function isRelativePathSegment(_0x5023fc){return _0x5023fc==='.'||_0x5023fc==='..';}function validatePathSegment(_0x1d1d53){const _0x58168f=a142_0x5e78;if(_0x1d1d53==='')throw new Error(_0x58168f(0xfc));if(_0x1d1d53==='.'||_0x1d1d53==='..')return;if(/[\x00-\x1F\x7F]/[_0x58168f(0xe1)](_0x1d1d53))throw new Error(_0x58168f(0xd5)+_0x1d1d53);if(_0x1d1d53!==_0x1d1d53[_0x58168f(0xe8)]()){}}export function validatePath(_0x12e920){const _0x1d738e=a142_0x5e78;if(_0x12e920[_0x1d738e(0xe0)]['length']===0x0&&!_0x12e920[_0x1d738e(0xd6)])throw new Error(_0x1d738e(0xfb));if(_0x12e920[_0x1d738e(0xd6)]){if(_0x12e920['segments'][0x0]==='..')throw new Error(_0x1d738e(0xdf));let _0x435bda=0x0;for(const _0x58b290 of _0x12e920[_0x1d738e(0xe0)]){if(_0x58b290==='..'){if(_0x435bda===0x0)throw new Error(_0x1d738e(0xda));_0x435bda--;}else _0x58b290!=='.'&&_0x435bda++;}}}export function joinPaths(_0x871585,_0x447b59){const _0x208855=a142_0x5e78;if(!_0x871585||_0x871585==='/')return _0x447b59;if(!_0x447b59||_0x447b59==='.')return _0x871585;if(_0x447b59[_0x208855(0xf6)]('/'))return _0x447b59;const _0x50986e=parsePath(_0x871585),_0x1f0bb6=parsePath(_0x447b59),_0x4214e3=[..._0x50986e[_0x208855(0xe0)]];for(const _0x374272 of _0x1f0bb6[_0x208855(0xe0)]){if(_0x374272==='.')continue;else{if(_0x374272==='..'){if(_0x4214e3[_0x208855(0xf3)]===0x0)throw new Error(_0x208855(0xd1));_0x4214e3[_0x208855(0xea)]();}else _0x4214e3['push'](_0x374272);}}const _0x1c8ef3=_0x4214e3[_0x208855(0xd3)]('/');return _0x50986e['raw']['startsWith']('/')?'/'+_0x1c8ef3:_0x1c8ef3;}export function normalizePath(_0x348212){const _0x3dab01=a142_0x5e78,_0x3aec90=parsePath(_0x348212),_0xb30194=[];for(const _0x56ac86 of _0x3aec90[_0x3dab01(0xe0)]){if(_0x56ac86==='.')continue;else{if(_0x56ac86==='..'){if(_0xb30194['length']===0x0){if(_0x3aec90['isAbsolute'])throw new Error(_0x3dab01(0xd1));_0xb30194['push']('..');}else _0xb30194[_0xb30194[_0x3dab01(0xf3)]-0x1]==='..'?_0xb30194[_0x3dab01(0xff)]('..'):_0xb30194['pop']();}else _0xb30194[_0x3dab01(0xff)](_0x56ac86);}}if(_0xb30194[_0x3dab01(0xf3)]===0x0)return _0x3aec90[_0x3dab01(0xd6)]?'/':'.';const _0x86e16c=_0xb30194['join']('/');return _0x3aec90['raw'][_0x3dab01(0xf6)]('/')?'/'+_0x86e16c:_0x86e16c;}export function getParentPath(_0x3ed480){const _0x3f7e66=a142_0x5e78,_0x38d8b3=parsePath(_0x3ed480);if(_0x38d8b3[_0x3f7e66(0xe0)][_0x3f7e66(0xf3)]<=0x1)return'/';const _0x776eb2=_0x38d8b3[_0x3f7e66(0xe0)][_0x3f7e66(0xfd)](0x0,-0x1)[_0x3f7e66(0xd3)]('/');return _0x38d8b3[_0x3f7e66(0xf2)][_0x3f7e66(0xf6)]('/')?'/'+_0x776eb2:_0x776eb2;}export function getBaseName(_0x5c1e68){const _0x4b27f3=a142_0x5e78,_0x1cc5a1=parsePath(_0x5c1e68);return _0x1cc5a1['segments'][_0x1cc5a1[_0x4b27f3(0xe0)]['length']-0x1]||'';}function a142_0x5bdb(){const _0x425fcc=['filter','name','754404ygaoaC','raw','length','No\x20tdx.json\x20found\x20for\x20file:\x20','endsWith','startsWith','708610iENgKd','readFile','268383XSEQMa','relative','Relative\x20path\x20cannot\x20be\x20empty','Path\x20segment\x20cannot\x20be\x20empty','slice','.yml','push','1718868jtQrYH','3141qCtQqr','exists','30zbkUQd','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','resolve','Cannot\x20navigate\x20above\x20root','replace','join','4dnydaE','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','isAbsolute','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','root','805OoifKs','Path\x20attempts\x20to\x20navigate\x20above\x20root','Path\x20cannot\x20be\x20empty','segment','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','split','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','segments','test','tdx.json','parse','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','2644yaOeAR','journey','33cGLubk','trim','dirname','pop','Cannot\x20split\x20empty\x20path','22wJpmVG','parent_segment','4208MmeNJW'];a142_0x5bdb=function(){return _0x425fcc;};return a142_0x5bdb();}export function isChildPath(_0x583f73,_0x4d9cb0){const _0x4e59c0=a142_0x5e78,_0x807969=parsePath(_0x583f73),_0x4b8a0b=parsePath(_0x4d9cb0);if(_0x807969[_0x4e59c0(0xe0)]['length']<=_0x4b8a0b[_0x4e59c0(0xe0)][_0x4e59c0(0xf3)])return![];for(let _0x4f686a=0x0;_0x4f686a<_0x4b8a0b[_0x4e59c0(0xe0)][_0x4e59c0(0xf3)];_0x4f686a++){if(_0x807969['segments'][_0x4f686a]!==_0x4b8a0b[_0x4e59c0(0xe0)][_0x4f686a])return![];}return!![];}export function splitPath(_0x12b07c){const _0x3875df=a142_0x5e78,_0x55a8b9=parsePath(_0x12b07c);if(_0x55a8b9[_0x3875df(0xe0)]['length']===0x0)throw new Error(_0x3875df(0xeb));if(_0x55a8b9[_0x3875df(0xe0)][_0x3875df(0xf3)]===0x1)return{'parent':_0x55a8b9['segments'][0x0]};return{'parent':_0x55a8b9[_0x3875df(0xe0)][0x0],'child':_0x55a8b9[_0x3875df(0xe0)][_0x3875df(0xfd)](0x1)[_0x3875df(0xd3)]('/')};}export function isYamlFilePath(_0x43a77d){const _0xe17ef0=a142_0x5e78;return _0x43a77d[_0xe17ef0(0xf5)](_0xe17ef0(0xfe))||_0x43a77d[_0xe17ef0(0xf5)]('.yaml');}export async function resolveYamlFilePath(_0x3ff88b,_0x55d79d=nodeFileSystem){const _0x98862d=a142_0x5e78,_0x393318=a142_0x287075[_0x98862d(0x105)](_0x3ff88b);if(!await _0x55d79d[_0x98862d(0x102)](_0x393318))throw new Error('File\x20not\x20found:\x20'+_0x3ff88b);let _0x5c1976=a142_0x287075[_0x98862d(0xe9)](_0x393318),_0x424db0=null,_0x5aabf2=null;const _0x584007=a142_0x287075['parse'](_0x5c1976)[_0x98862d(0xd8)];while(_0x5c1976!==_0x584007){const _0x24251c=a142_0x287075[_0x98862d(0xd3)](_0x5c1976,_0x98862d(0xe2));if(await _0x55d79d[_0x98862d(0x102)](_0x24251c)){_0x424db0=_0x24251c,_0x5aabf2=_0x5c1976;break;}_0x5c1976=a142_0x287075['dirname'](_0x5c1976);}if(!_0x424db0||!_0x5aabf2)throw new Error(_0x98862d(0xf4)+_0x3ff88b+'\x0a'+_0x98862d(0xe4));const _0x1d272f=await _0x55d79d[_0x98862d(0xf8)](_0x424db0),_0x287558=JSON[_0x98862d(0xe3)](_0x1d272f),_0x2052a2=_0x287558[_0x98862d(0xed)];if(!_0x2052a2)throw new Error(_0x98862d(0x104));const _0x594a35=await _0x55d79d[_0x98862d(0xf8)](_0x393318),_0x577bcd=a142_0x4950ae(_0x594a35),_0x4d7bf6=_0x577bcd[_0x98862d(0xf0)];if(!_0x4d7bf6)throw new Error(_0x98862d(0xd7)+_0x3ff88b);const _0x1f1af6=_0x577bcd['type']===_0x98862d(0xe6)?_0x98862d(0xe6):_0x98862d(0xdc),_0x2d665c=a142_0x287075[_0x98862d(0xfa)](_0x5aabf2,_0x393318),_0x3e4b4c=a142_0x287075[_0x98862d(0xe9)](_0x2d665c),_0x1d397d=_0x3e4b4c==='.'?'':_0x3e4b4c[_0x98862d(0xd2)](/\\/g,'/'),_0x1447c1=_0x1d397d?_0x2052a2+'/'+_0x1d397d+'/'+_0x4d7bf6:_0x2052a2+'/'+_0x4d7bf6;return{'parentSegment':_0x2052a2,'segmentName':_0x4d7bf6,'folderPath':_0x1d397d,'fullPath':_0x1447c1,'resourceType':_0x1f1af6,'content':_0x594a35};}
@@ -1 +1 @@
1
- function a143_0x5455(_0x315dfa,_0xa00340){_0x315dfa=_0x315dfa-0x196;const _0x4203fd=a143_0x4203();let _0x545595=_0x4203fd[_0x315dfa];return _0x545595;}(function(_0x498c75,_0x2df1ad){const _0x20b995=a143_0x5455,_0xa8345c=_0x498c75();while(!![]){try{const _0xa70e9a=-parseInt(_0x20b995(0x1a4))/0x1*(-parseInt(_0x20b995(0x19f))/0x2)+parseInt(_0x20b995(0x19a))/0x3*(parseInt(_0x20b995(0x198))/0x4)+-parseInt(_0x20b995(0x19b))/0x5+parseInt(_0x20b995(0x1a0))/0x6*(-parseInt(_0x20b995(0x199))/0x7)+-parseInt(_0x20b995(0x1a5))/0x8*(-parseInt(_0x20b995(0x1a1))/0x9)+parseInt(_0x20b995(0x1a3))/0xa+-parseInt(_0x20b995(0x19c))/0xb;if(_0xa70e9a===_0x2df1ad)break;else _0xa8345c['push'](_0xa8345c['shift']());}catch(_0x2d7751){_0xa8345c['push'](_0xa8345c['shift']());}}}(a143_0x4203,0xb1c62));export function parseSegmentRef(_0x295681){const _0x282d2=a143_0x5455,_0x3d1be8=_0x295681[_0x282d2(0x19e)]('/');if(_0x3d1be8===-0x1)return{'parentId':_0x295681};if(_0x3d1be8===0x0)throw new Error(_0x282d2(0x1a2)+_0x295681+_0x282d2(0x19d));const _0x37ea1f=_0x295681[_0x282d2(0x197)](0x0,_0x3d1be8),_0x3099ab=_0x295681[_0x282d2(0x197)](_0x3d1be8+0x1);if(_0x3099ab==='')throw new Error(_0x282d2(0x1a2)+_0x295681+_0x282d2(0x196));return{'parentId':_0x37ea1f,'childId':_0x3099ab};}function a143_0x4203(){const _0x536e6b=['substring','6692pqselj','21jDuWSJ','1083skwnzc','3122960GFloQr','8588085VnbGgA','.\x20Parent\x20name\x20cannot\x20be\x20empty','indexOf','1204666lJoCSV','659310ufomZT','10994463MIJoxy','Invalid\x20segment\x20reference\x20format:\x20','352510ufJkwU','1InSSKO','8MWYcSl','.\x20Child\x20name\x20cannot\x20be\x20empty'];a143_0x4203=function(){return _0x536e6b;};return a143_0x4203();}
1
+ function a143_0xfbc1(){const _0x156c60=['252uSUnxS','1864800bjfAQL','24bIfRuw','indexOf','11910gZDosY','substring','.\x20Child\x20name\x20cannot\x20be\x20empty','45740BBDfaP','Invalid\x20segment\x20reference\x20format:\x20','402155VqQABq','510mxgPTJ','357865gaiGOz','581Dquuvf','6354128OvQaRQ','.\x20Parent\x20name\x20cannot\x20be\x20empty','5064IQSupM'];a143_0xfbc1=function(){return _0x156c60;};return a143_0xfbc1();}(function(_0x4f24d1,_0x5e978d){const _0x5e7bae=a143_0xb23d,_0x38410f=_0x4f24d1();while(!![]){try{const _0x308092=parseInt(_0x5e7bae(0x6b))/0x1+-parseInt(_0x5e7bae(0x6a))/0x2*(parseInt(_0x5e7bae(0x6f))/0x3)+parseInt(_0x5e7bae(0x72))/0x4*(-parseInt(_0x5e7bae(0x69))/0x5)+-parseInt(_0x5e7bae(0x74))/0x6*(-parseInt(_0x5e7bae(0x6c))/0x7)+parseInt(_0x5e7bae(0x71))/0x8+parseInt(_0x5e7bae(0x70))/0x9*(-parseInt(_0x5e7bae(0x77))/0xa)+parseInt(_0x5e7bae(0x6d))/0xb;if(_0x308092===_0x5e978d)break;else _0x38410f['push'](_0x38410f['shift']());}catch(_0x5531bf){_0x38410f['push'](_0x38410f['shift']());}}}(a143_0xfbc1,0x475ae));function a143_0xb23d(_0x58bef5,_0x11658e){_0x58bef5=_0x58bef5-0x69;const _0xfbc12a=a143_0xfbc1();let _0xb23dba=_0xfbc12a[_0x58bef5];return _0xb23dba;}export function parseSegmentRef(_0xb82447){const _0x159a8d=a143_0xb23d,_0x47476d=_0xb82447[_0x159a8d(0x73)]('/');if(_0x47476d===-0x1)return{'parentId':_0xb82447};if(_0x47476d===0x0)throw new Error(_0x159a8d(0x78)+_0xb82447+_0x159a8d(0x6e));const _0x2e38b4=_0xb82447[_0x159a8d(0x75)](0x0,_0x47476d),_0x2dc542=_0xb82447[_0x159a8d(0x75)](_0x47476d+0x1);if(_0x2dc542==='')throw new Error(_0x159a8d(0x78)+_0xb82447+_0x159a8d(0x76));return{'parentId':_0x2e38b4,'childId':_0x2dc542};}